From buildbot at python.org Sun Jun 1 00:03:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 31 May 2008 22:03:18 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080531220318.C637F1E4008@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/369 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: georg.brandl,gerhard.haering,mark.summerfield BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 00:52:43 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 00:52:43 +0200 (CEST) Subject: [Python-checkins] r63840 - in doctools/trunk: CHANGES sphinx/__init__.py sphinx/builder.py sphinx/environment.py sphinx/htmlhelp.py Message-ID: <20080531225243.83F071E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 00:52:42 2008 New Revision: 63840 Log: More logical "next"/"previous" links. Modified: doctools/trunk/CHANGES doctools/trunk/sphinx/__init__.py doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/htmlhelp.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sun Jun 1 00:52:42 2008 @@ -33,6 +33,9 @@ * Add document metadata to the values in the default template context. +* Let the "previous" and "next" to more logical documents, so that always + selecting "next" lets you visit every document in the tree. + Bugs fixed ---------- Modified: doctools/trunk/sphinx/__init__.py ============================================================================== --- doctools/trunk/sphinx/__init__.py (original) +++ doctools/trunk/sphinx/__init__.py Sun Jun 1 00:52:42 2008 @@ -135,6 +135,11 @@ app.builder.build_update() except KeyboardInterrupt: # catches BaseExceptions in 2.5 -- SystemExit, KeyboardInterrupt + if use_pdb: + import pdb + print >>sys.stderr, darkred('Interrupted while building, starting debugger:') + traceback.print_exc() + pdb.post_mortem(sys.exc_info()[2]) return 1 except SystemExit: return 0 Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sun Jun 1 00:52:42 2008 @@ -302,9 +302,6 @@ def prepare_writing(self, docnames): from sphinx.search import IndexBuilder - self.info(bold('creating index...')) - self.env.create_index(self) - self.indexer = IndexBuilder() self.load_indexer(docnames) self.docwriter = HTMLWriter(self) @@ -326,6 +323,8 @@ if not isinstance(self.config.html_use_opensearch, basestring): self.warn('html_use_opensearch config value must now be a string') + self.relations = self.env.collect_relations() + self.globalcontext = dict( project = self.config.project, release = self.config.release, @@ -350,28 +349,29 @@ # find out relations prev = next = None parents = [] - related = self.env.toctree_relations.get(docname) + related = self.relations.get(docname) titles = self.env.titles - if related: + if related and related[1]: try: prev = {'link': self.get_relative_uri(docname, related[1]), 'title': self.render_partial(titles[related[1]])['title']} except KeyError: # the relation is (somehow) not in the TOC tree, handle that gracefully prev = None + if related and related[2]: try: next = {'link': self.get_relative_uri(docname, related[2]), 'title': self.render_partial(titles[related[2]])['title']} except KeyError: next = None - while related: + while related and related[0]: try: parents.append( {'link': self.get_relative_uri(docname, related[0]), 'title': self.render_partial(titles[related[0]])['title']}) except KeyError: pass - related = self.env.toctree_relations.get(related[0]) + related = self.relations.get(related[0]) if parents: parents.pop() # remove link to the master file; we have a generic # "back to index" link already @@ -420,13 +420,14 @@ if self.config.html_use_index: # the total count of lines for each index letter, used to distribute # the entries into two columns + genindex = self.env.create_index(self) indexcounts = [] - for _, entries in self.env.index: + for _, entries in genindex: indexcounts.append(sum(1 + len(subitems) for _, (_, subitems) in entries)) genindexcontext = dict( - genindexentries = self.env.index, + genindexentries = genindex, genindexcounts = indexcounts, ) self.info(' genindex', nonl=1) Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Sun Jun 1 00:52:42 2008 @@ -15,10 +15,10 @@ import heapq import types import difflib -import itertools import cPickle as pickle from os import path from string import uppercase +from itertools import izip, groupby try: import hashlib md5 = hashlib.md5 @@ -58,7 +58,7 @@ # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 21 +ENV_VERSION = 22 default_substitutions = set([ @@ -225,8 +225,7 @@ self.toc_num_entries = {} # docname -> number of real entries # used to determine when to show the TOC in a sidebar # (don't show if it's only one item) - self.toctree_relations = {} # docname -> ["parent", "previous", "next"] docname - # for navigating in the toctree + self.toctree_includes = {} # docname -> list of toctree includefiles self.files_to_rebuild = {} # docname -> set of files (containing its TOCs) # to rebuild too @@ -280,11 +279,14 @@ self.titles.pop(docname, None) self.tocs.pop(docname, None) self.toc_num_entries.pop(docname, None) + self.toctree_includes.pop(docname, None) self.filemodules.pop(docname, None) self.indexentries.pop(docname, None) - for subfn, fnset in self.files_to_rebuild.iteritems(): + for subfn, fnset in self.files_to_rebuild.items(): fnset.discard(docname) + if not fnset: + del self.files_to_rebuild[subfn] for fullname, (fn, _) in self.descrefs.items(): if fn == docname: del self.descrefs[fullname] @@ -590,17 +592,11 @@ """Note a TOC tree directive in a document and gather information about file relations from it.""" includefiles = toctreenode['includefiles'] - includefiles_len = len(includefiles) - for i, includefile in enumerate(includefiles): - # the "previous" file for the first toctree item is the parent - previous = i > 0 and includefiles[i-1] or docname - # the "next" file for the last toctree item is the parent again - next = i < includefiles_len-1 and includefiles[i+1] or docname - self.toctree_relations[includefile] = [docname, previous, next] + for includefile in includefiles: # note that if the included file is rebuilt, this one must be # too (since the TOC of the included file could have changed) self.files_to_rebuild.setdefault(includefile, set()).add(docname) - + self.toctree_includes.setdefault(docname, []).extend(includefiles) def build_toc_from(self, docname, document): """Build a TOC from the doctree and store it in the inventory.""" @@ -998,14 +994,49 @@ else: # get all other symbols under one heading return 'Symbols' - self.index = [(key, list(group)) for (key, group) in - itertools.groupby(newlist, keyfunc)] + return [(key, list(group)) for (key, group) in groupby(newlist, keyfunc)] + + def collect_relations(self): + relations = {} + getinc = self.toctree_includes.get + def collect(parents, docname, previous, next): + includes = getinc(docname) + # previous + if not previous: + previous = parents[0][0] + else: + while 1: + previncs = getinc(previous) + if previncs: + previous = previncs[-1] + else: + break + # next + if includes: + next = includes[0] + elif next: + pass + else: + for parname, parindex in parents: + parincs = getinc(parname) + if parincs and parindex + 1 < len(parincs): + next = parincs[parindex+1] + break + # else it will stay None + # same for children + if includes: + for subindex, args in enumerate(izip(includes, [None] + includes, + includes[1:] + [None])): + collect([(docname, subindex)] + parents, *args) + relations[docname] = [parents[0][0], previous, next] + collect([(None, 0)], self.config.master_doc, None, None) + return relations def check_consistency(self): """Do consistency checks.""" for docname in self.all_docs: - if docname not in self.toctree_relations: + if docname not in self.files_to_rebuild: if docname == self.config.master_doc: # the master file is not included anywhere ;) continue Modified: doctools/trunk/sphinx/htmlhelp.py ============================================================================== --- doctools/trunk/sphinx/htmlhelp.py (original) +++ doctools/trunk/sphinx/htmlhelp.py Sun Jun 1 00:52:42 2008 @@ -184,6 +184,7 @@ f.close() builder.info('writing index file...') + index = builder.env.create_index(builder) f = open(path.join(outdir, outname+'.hhk'), 'w') try: f.write('') - for (key, group) in builder.env.index: + for (key, group) in index: for title, (refs, subitems) in group: write_index(title, refs, subitems) f.write('\n') From python-checkins at python.org Sun Jun 1 00:54:10 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 00:54:10 +0200 (CEST) Subject: [Python-checkins] r63841 - doctools/trunk/sphinx/environment.py Message-ID: <20080531225410.92BF71E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 00:54:10 2008 New Revision: 63841 Log: Refer to a RFC base URL that actually works. Modified: doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Sun Jun 1 00:54:10 2008 @@ -51,6 +51,7 @@ 'embed_stylesheet': False, 'cloak_email_addresses': True, 'pep_base_url': 'http://www.python.org/dev/peps/', + 'rfc_base_url': 'http://rfc.net/', 'input_encoding': 'utf-8', 'doctitle_xform': False, 'sectsubtitle_xform': False, From python-checkins at python.org Sun Jun 1 00:55:14 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 00:55:14 +0200 (CEST) Subject: [Python-checkins] r63842 - doctools/trunk/CHANGES Message-ID: <20080531225514.821CB1E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 00:55:14 2008 New Revision: 63842 Log: Reword a little. Modified: doctools/trunk/CHANGES Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sun Jun 1 00:55:14 2008 @@ -33,8 +33,8 @@ * Add document metadata to the values in the default template context. -* Let the "previous" and "next" to more logical documents, so that always - selecting "next" lets you visit every document in the tree. +* Let the "previous" and "next" to more logical documents, so that by + following "next" links you can traverse the entire TOC tree. Bugs fixed ---------- From buildbot at python.org Sun Jun 1 02:19:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 00:19:57 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 2.5 Message-ID: <20080601001957.44E981E4009@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%202.5/builds/1 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 91, in run svr.serve_a_few() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 217, in handle_request request, client_address = self.get_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 374, in get_request return self.socket.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize 2 tests failed: test_socket test_socketserver ====================================================================== ERROR: testLinuxAbstractNamespace (test.test_socket.TestLinuxAbstractNamespace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socket.py", line 926, in testLinuxAbstractNamespace s1.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize ====================================================================== FAIL: testMaxName (test.test_socket.TestLinuxAbstractNamespace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socket.py", line 934, in testMaxName self.assertEqual(s.getsockname(), address) AssertionError: '\x00hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh' != '\x00hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh' Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 91, in run svr.serve_a_few() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 217, in handle_request request, client_address = self.get_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 374, in get_request return self.socket.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 212, in test_main testall() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 200, in testall testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream) File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 144, in testloop testfunc(proto, addr) File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 63, in teststream s.sendall(teststring) File "", line 1, in sendall error: (32, 'Broken pipe') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 06:21:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 04:21:05 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080601042105.709C31E4009@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/276 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti,mark.summerfield 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 buildbot at python.org Sun Jun 1 07:05:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 05:05:57 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: <20080601050558.21BC71E4015@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/764 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,brett.cannon,eric.smith,georg.brandl 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\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str 3 tests failed: test_httpservers test_platform test_pydoc ====================================================================== ERROR: test_post (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_httpservers.py", line 325, in test_post res = self.request('/cgi-bin/file2.py', 'POST', params, headers) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_httpservers.py", line 63, in request return self.connection.getresponse() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 975, in getresponse response.begin() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 424, in begin self.msg = HTTPMessage(self.fp, 0) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\mimetools.py", line 16, in __init__ rfc822.Message.__init__(self, fp, seekable) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\rfc822.py", line 104, in __init__ self.readheaders() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\client.py", line 266, in readheaders line = str(self.fp.readline(), "iso-8859-1") File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 510, in readline b = self.read(nreadahead()) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\io.py", line 577, in read n = self.readinto(b) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 217, in readinto return self._sock.recv_into(b) socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host ====================================================================== FAIL: test_authorization (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_httpservers.py", line 339, in test_authorization (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== FAIL: test_headers_and_content (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_httpservers.py", line 320, in test_headers_and_content (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== ERROR: test_mac_ver (test.test_platform.PlatformTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_platform.py", line 68, in test_mac_ver if os.uname()[0] == 'Darwin': AttributeError: 'module' object has no attribute 'uname' ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_pydoc.py", line 237, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 09:20:47 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 1 Jun 2008 09:20:47 +0200 (CEST) Subject: [Python-checkins] r63846 - in python/trunk: Doc/c-api/file.rst Doc/library/stdtypes.rst Doc/using/cmdline.rst Include/fileobject.h Lib/test/test_sys.py Misc/NEWS Modules/main.c Objects/fileobject.c Python/pythonrun.c Python/sysmodule.c Message-ID: <20080601072047.944A91E400B@bag.python.org> Author: martin.v.loewis Date: Sun Jun 1 09:20:46 2008 New Revision: 63846 Log: New environment variable PYTHONIOENCODING. Modified: python/trunk/Doc/c-api/file.rst python/trunk/Doc/library/stdtypes.rst python/trunk/Doc/using/cmdline.rst python/trunk/Include/fileobject.h python/trunk/Lib/test/test_sys.py python/trunk/Misc/NEWS python/trunk/Modules/main.c python/trunk/Objects/fileobject.c python/trunk/Python/pythonrun.c python/trunk/Python/sysmodule.c Modified: python/trunk/Doc/c-api/file.rst ============================================================================== --- python/trunk/Doc/c-api/file.rst (original) +++ python/trunk/Doc/c-api/file.rst Sun Jun 1 09:20:46 2008 @@ -130,6 +130,14 @@ .. versionadded:: 2.3 +.. cfunction:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors) + + Set the file's encoding for Unicode output to *enc*, and its error + mode to *err*. Return 1 on success and 0 on failure. + + .. versionadded:: 2.6 + + .. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag) .. index:: single: softspace (file attribute) Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Sun Jun 1 09:20:46 2008 @@ -2165,6 +2165,13 @@ .. versionadded:: 2.3 +.. attribute:: file.errors + + The Unicode error handler used to along with the encoding. + + .. versionadded:: 2.6 + + .. attribute:: file.mode The I/O mode for the file. If the file was created using the :func:`open` Modified: python/trunk/Doc/using/cmdline.rst ============================================================================== --- python/trunk/Doc/using/cmdline.rst (original) +++ python/trunk/Doc/using/cmdline.rst Sun Jun 1 09:20:46 2008 @@ -481,6 +481,13 @@ .. versionadded:: 2.6 +.. envvar:: PYTHONIOENCODING + + Overrides the encoding used for stdin/stdout/stderr, in the syntax + encodingname:errorhandler, with the :errors part being optional. + + .. versionadded:: 2.6 + .. envvar:: PYTHONNOUSERSITE Modified: python/trunk/Include/fileobject.h ============================================================================== --- python/trunk/Include/fileobject.h (original) +++ python/trunk/Include/fileobject.h Sun Jun 1 09:20:46 2008 @@ -24,6 +24,7 @@ int f_newlinetypes; /* Types of newlines seen */ int f_skipnextlf; /* Skip next \n */ PyObject *f_encoding; + PyObject *f_errors; PyObject *weakreflist; /* List of weak references */ int unlocked_count; /* Num. currently running sections of code using f_fp with the GIL released. */ @@ -37,6 +38,7 @@ PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); +PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Sun Jun 1 09:20:46 2008 @@ -385,6 +385,26 @@ ## self.assert_(r[0][2] > 100, r[0][2]) ## self.assert_(r[1][2] > 100, r[1][2]) + def test_ioencoding(self): + import subprocess,os + env = dict(os.environ) + + # Test character: cent sign, encoded as 0x4A (ASCII J) in CP424, + # not representable in ASCII. + + env["PYTHONIOENCODING"] = "cp424" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, unichr(0xa2).encode("cp424")) + + env["PYTHONIOENCODING"] = "ascii:replace" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, '?') + + def test_main(): test.test_support.run_unittest(SysModuleTest) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 1 09:20:46 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- New environment variable PYTHONIOENCODING. + - Patch #2488: Add sys.maxsize. - Issue #2353: file.xreadlines() now emits a Py3k warning. Modified: python/trunk/Modules/main.c ============================================================================== --- python/trunk/Modules/main.c (original) +++ python/trunk/Modules/main.c Sun Jun 1 09:20:46 2008 @@ -99,6 +99,7 @@ PYTHONHOME : alternate directory (or %c).\n\ The default module search path uses %s.\n\ PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\ +PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ "; Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Sun Jun 1 09:20:46 2008 @@ -155,6 +155,7 @@ Py_DECREF(f->f_name); Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); + Py_DECREF(f->f_errors); Py_INCREF(name); f->f_name = name; @@ -170,6 +171,8 @@ f->f_skipnextlf = 0; Py_INCREF(Py_None); f->f_encoding = Py_None; + Py_INCREF(Py_None); + f->f_errors = Py_None; if (f->f_mode == NULL) return NULL; @@ -435,19 +438,38 @@ } /* Set the encoding used to output Unicode strings. - Returh 1 on success, 0 on failure. */ + Return 1 on success, 0 on failure. */ int PyFile_SetEncoding(PyObject *f, const char *enc) { + return PyFile_SetEncodingAndErrors(f, enc, NULL); +} + +int +PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors) +{ PyFileObject *file = (PyFileObject*)f; - PyObject *str = PyBytes_FromString(enc); + PyObject *str, *oerrors; assert(PyFile_Check(f)); + str = PyBytes_FromString(enc); if (!str) return 0; + if (errors) { + oerrors = PyString_FromString(errors); + if (!oerrors) { + Py_DECREF(str); + return 0; + } + } else { + oerrors = Py_None; + Py_INCREF(Py_None); + } Py_DECREF(file->f_encoding); file->f_encoding = str; + Py_DECREF(file->f_errors); + file->f_errors = oerrors; return 1; } @@ -491,6 +513,7 @@ Py_XDECREF(f->f_name); Py_XDECREF(f->f_mode); Py_XDECREF(f->f_encoding); + Py_XDECREF(f->f_errors); drop_readahead(f); Py_TYPE(f)->tp_free((PyObject *)f); } @@ -1879,6 +1902,8 @@ "file name"}, {"encoding", T_OBJECT, OFF(f_encoding), RO, "file encoding"}, + {"errors", T_OBJECT, OFF(f_errors), RO, + "Unicode error handler"}, /* getattr(f, "closed") is implemented without this table */ {NULL} /* Sentinel */ }; @@ -2093,6 +2118,8 @@ ((PyFileObject *)self)->f_mode = not_yet_string; Py_INCREF(Py_None); ((PyFileObject *)self)->f_encoding = Py_None; + Py_INCREF(Py_None); + ((PyFileObject *)self)->f_errors = Py_None; ((PyFileObject *)self)->weakreflist = NULL; ((PyFileObject *)self)->unlocked_count = 0; } @@ -2295,7 +2322,9 @@ if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { char *cenc = PyBytes_AS_STRING(enc); - value = PyUnicode_AsEncodedString(v, cenc, "strict"); + char *errors = fobj->f_errors == Py_None ? + "strict" : PyBytes_AS_STRING(fobj->f_errors); + value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) return -1; } else { Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Sun Jun 1 09:20:46 2008 @@ -132,11 +132,20 @@ PyThreadState *tstate; PyObject *bimod, *sysmod; char *p; + char *icodeset; /* On Windows, input codeset may theoretically + differ from output codeset. */ + char *codeset = NULL; + char *errors = NULL; + int free_codeset = 0; + int overridden = 0; #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) - char *codeset; - char *saved_locale; + char *saved_locale, *loc_codeset; PyObject *sys_stream, *sys_isatty; #endif +#ifdef MS_WINDOWS + char ibuf[128]; + char buf[128]; +#endif extern void _Py_ReadyTypes(void); if (initialized) @@ -238,38 +247,75 @@ _PyGILState_Init(interp, tstate); #endif /* WITH_THREAD */ + if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { + p = icodeset = codeset = strdup(p); + free_codeset = 1; + errors = strchr(p, ':'); + if (errors) { + *errors = '\0'; + errors++; + } + overridden = 1; + } + #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) /* On Unix, set the file system encoding according to the user's preference, if the CODESET names a well-known Python codec, and Py_FileSystemDefaultEncoding isn't initialized by other means. Also set the encoding of - stdin and stdout if these are terminals. */ + stdin and stdout if these are terminals, unless overridden. */ - saved_locale = strdup(setlocale(LC_CTYPE, NULL)); - setlocale(LC_CTYPE, ""); - codeset = nl_langinfo(CODESET); - if (codeset && *codeset) { - PyObject *enc = PyCodec_Encoder(codeset); - if (enc) { - codeset = strdup(codeset); - Py_DECREF(enc); - } else { - codeset = NULL; - PyErr_Clear(); + if (!overridden || !Py_FileSystemDefaultEncoding) { + saved_locale = strdup(setlocale(LC_CTYPE, NULL)); + setlocale(LC_CTYPE, ""); + loc_codeset = nl_langinfo(CODESET); + if (loc_codeset && *loc_codeset) { + PyObject *enc = PyCodec_Encoder(loc_codeset); + if (enc) { + loc_codeset = strdup(loc_codeset); + Py_DECREF(enc); + } else { + loc_codeset = NULL; + PyErr_Clear(); + } + } else + loc_codeset = NULL; + setlocale(LC_CTYPE, saved_locale); + free(saved_locale); + + if (!overridden) { + codeset = icodeset = loc_codeset; + free_codeset = 1; + } + + /* Initialize Py_FileSystemDefaultEncoding from + locale even if PYTHONIOENCODING is set. */ + if (!Py_FileSystemDefaultEncoding) { + Py_FileSystemDefaultEncoding = loc_codeset; + if (!overridden) + free_codeset = 0; } - } else - codeset = NULL; - setlocale(LC_CTYPE, saved_locale); - free(saved_locale); + } +#endif + +#ifdef MS_WINDOWS + if (!overridden) { + icodeset = ibuf; + encoding = buf; + sprintf(ibuf, "cp%d", GetConsoleCP()); + sprintf(buf, "cp%d", GetConsoleOutputCP()); + } +#endif if (codeset) { sys_stream = PySys_GetObject("stdin"); sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, icodeset, errors)) Py_FatalError("Cannot set codeset of stdin"); } Py_XDECREF(sys_isatty); @@ -278,9 +324,10 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stdout"); } Py_XDECREF(sys_isatty); @@ -289,19 +336,17 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stderr"); } Py_XDECREF(sys_isatty); - if (!Py_FileSystemDefaultEncoding) - Py_FileSystemDefaultEncoding = codeset; - else + if (free_codeset) free(codeset); } -#endif } void Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Sun Jun 1 09:20:46 2008 @@ -1232,9 +1232,6 @@ PyObject *m, *v, *sysdict; PyObject *sysin, *sysout, *syserr; char *s; -#ifdef MS_WINDOWS - char buf[128]; -#endif m = Py_InitModule3("sys", sys_methods, sys_doc); if (m == NULL) @@ -1272,23 +1269,6 @@ syserr = PyFile_FromFile(stderr, "", "w", _check_and_flush); if (PyErr_Occurred()) return NULL; -#ifdef MS_WINDOWS - if(isatty(_fileno(stdin)) && PyFile_Check(sysin)) { - sprintf(buf, "cp%d", GetConsoleCP()); - if (!PyFile_SetEncoding(sysin, buf)) - return NULL; - } - if(isatty(_fileno(stdout)) && PyFile_Check(sysout)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(sysout, buf)) - return NULL; - } - if(isatty(_fileno(stderr)) && PyFile_Check(syserr)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(syserr, buf)) - return NULL; - } -#endif PyDict_SetItemString(sysdict, "stdin", sysin); PyDict_SetItemString(sysdict, "stdout", sysout); From buildbot at python.org Sun Jun 1 09:36:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 07:36:25 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080601073625.B268E1E4013@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1415 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 10:06:18 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 1 Jun 2008 10:06:18 +0200 (CEST) Subject: [Python-checkins] r63848 - python/trunk/Python/pythonrun.c Message-ID: <20080601080618.22CCA1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Jun 1 10:06:17 2008 New Revision: 63848 Log: Move sys_stream and sys_isatty out of the have-langinfo block. Modified: python/trunk/Python/pythonrun.c Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Sun Jun 1 10:06:17 2008 @@ -138,9 +138,9 @@ char *errors = NULL; int free_codeset = 0; int overridden = 0; + PyObject *sys_stream, *sys_isatty; #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) char *saved_locale, *loc_codeset; - PyObject *sys_stream, *sys_isatty; #endif #ifdef MS_WINDOWS char ibuf[128]; From python-checkins at python.org Sun Jun 1 10:19:02 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 1 Jun 2008 10:19:02 +0200 (CEST) Subject: [Python-checkins] r63849 - python/trunk/Python/pythonrun.c Message-ID: <20080601081902.5F15E1E4009@bag.python.org> Author: martin.v.loewis Date: Sun Jun 1 10:19:02 2008 New Revision: 63849 Log: Typo: encoding -> codeset. Modified: python/trunk/Python/pythonrun.c Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Sun Jun 1 10:19:02 2008 @@ -301,7 +301,7 @@ #ifdef MS_WINDOWS if (!overridden) { icodeset = ibuf; - encoding = buf; + codeset = buf; sprintf(ibuf, "cp%d", GetConsoleCP()); sprintf(buf, "cp%d", GetConsoleOutputCP()); } From buildbot at python.org Sun Jun 1 12:10:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 10:10:54 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080601101054.9CD061E4009@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3472 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 13:29:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 11:29:32 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080601112932.83D1E1E4009@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/976 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str 5 tests failed: test_httpservers test_platform test_pydoc test_site test_winsound ====================================================================== ERROR: test_post (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_httpservers.py", line 325, in test_post res = self.request('/cgi-bin/file2.py', 'POST', params, headers) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_httpservers.py", line 63, in request return self.connection.getresponse() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\client.py", line 975, in getresponse response.begin() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\client.py", line 424, in begin self.msg = HTTPMessage(self.fp, 0) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\mimetools.py", line 16, in __init__ rfc822.Message.__init__(self, fp, seekable) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\rfc822.py", line 104, in __init__ self.readheaders() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\client.py", line 266, in readheaders line = str(self.fp.readline(), "iso-8859-1") File "C:\buildbot\3.0.heller-windows-amd64\build\lib\io.py", line 510, in readline b = self.read(nreadahead()) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\io.py", line 577, in read n = self.readinto(b) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 217, in readinto return self._sock.recv_into(b) socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host ====================================================================== FAIL: test_authorization (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_httpservers.py", line 339, in test_authorization (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== FAIL: test_headers_and_content (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_httpservers.py", line 320, in test_headers_and_content (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== ERROR: test_mac_ver (test.test_platform.PlatformTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_platform.py", line 68, in test_mac_ver if os.uname()[0] == 'Darwin': AttributeError: 'module' object has no attribute 'uname' ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_pydoc.py", line 237, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_alias_asterisk (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_winsound.py", line 87, in test_alias_asterisk winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exclamation (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_winsound.py", line 97, in test_alias_exclamation winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exit (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_winsound.py", line 107, in test_alias_exit winsound.PlaySound('SystemExit', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_hand (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_winsound.py", line 117, in test_alias_hand winsound.PlaySound('SystemHand', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_question (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\test\test_winsound.py", line 127, in test_alias_question winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) RuntimeError: Failed to play sound Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "C:\buildbot\3.0.heller-windows-amd64\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "C:\buildbot\3.0.heller-windows-amd64\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 16:30:25 2008 From: python-checkins at python.org (david.goodger) Date: Sun, 1 Jun 2008 16:30:25 +0200 (CEST) Subject: [Python-checkins] r63852 - peps/trunk/pep-3140.txt Message-ID: <20080601143025.113D21E400C@bag.python.org> Author: david.goodger Date: Sun Jun 1 16:30:24 2008 New Revision: 63852 Log: typo, spelling, caps Modified: peps/trunk/pep-3140.txt Modified: peps/trunk/pep-3140.txt ============================================================================== --- peps/trunk/pep-3140.txt (original) +++ peps/trunk/pep-3140.txt Sun Jun 1 16:30:24 2008 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date: 2008-05-28 20:38:33 -0600 (Thu, 28 May 2008)$ Author: Oleg Broytmann , - Jim Jewett + Jim Jewett Discussions-To: python-3000 at python.org Status: Rejected Type: Standards Track @@ -40,7 +40,7 @@ -- there is no standard way to print a container's content calling items' __str__, that's inconvenient in cases where __str__ and __repr__ return different results; - -- repr(item) sometimes do wrong things (hex-escapes non-ascii + -- repr(item) sometimes do wrong things (hex-escapes non-ASCII strings, e.g.) This PEP proposes to change how str(container) works. It is @@ -69,14 +69,14 @@ The disadvantage is that __repr__ often returns technical data (like '') or unreadable string (hex-encoded - string if the input is non-ascii string): + string if the input is non-ASCII string): >>> print(['????']) ['\xd4\xc5\xd3\xd4'] One of the motivations for PEP 3138 is that neither repr nor str - will allow the sensible printing of dicts whose keys are non-ascii - text strings. Now that unicode identifiers are allowed, it + will allow the sensible printing of dicts whose keys are non-ASCII + text strings. Now that Unicode identifiers are allowed, it includes Python's own attribute dicts. This also includes JSON serialization (and caused some hoops for the json lib). @@ -85,7 +85,7 @@ persistence) outputs some objects, with system-dependent failures. Changing how str(container) works would allow easy debugging in - the normal case, and retrain the safety of ASCII-only for the + the normal case, and retain the safety of ASCII-only for the machine-readable case. The only downside is that str(x) and repr(x) would more often be different -- but only in those cases where the current almost-the-same version is insufficient. @@ -169,9 +169,9 @@ drawback of the proposal is that every __repr__ implementation must be changed. Introspection could help a bit (inspect __repr__ before calling if it accepts 2 or 3 parameters), but introspection - doesn't work on classes written in C, like all builtin containers. + doesn't work on classes written in C, like all built-in containers. - Less radical proposal is to implement __str__ methods for builtin + Less radical proposal is to implement __str__ methods for built-in container types. The obvious drawback is a duplication of effort - all those __str__ and __repr__ implementations are only differ in one small detail - if they call str or repr on items. From python-checkins at python.org Sun Jun 1 16:55:06 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 1 Jun 2008 16:55:06 +0200 (CEST) Subject: [Python-checkins] r63853 - in python/branches/tlee-ast-optimize: Include/compile.h Include/optimize.h Python/bltinmodule.c Python/compile.c Python/optimize.c Python/pythonrun.c Message-ID: <20080601145506.6E2961E4009@bag.python.org> Author: thomas.lee Date: Sun Jun 1 16:55:05 2008 New Revision: 63853 Log: Making a move towards the separation of symbol table generation and compilation. This will allow us to use symtable information in the optimizer and fixes a few problems that might otherwise be caused by the optimizer. Modified: python/branches/tlee-ast-optimize/Include/compile.h python/branches/tlee-ast-optimize/Include/optimize.h python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Python/optimize.c python/branches/tlee-ast-optimize/Python/pythonrun.c Modified: python/branches/tlee-ast-optimize/Include/compile.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/compile.h (original) +++ python/branches/tlee-ast-optimize/Include/compile.h Sun Jun 1 16:55:05 2008 @@ -32,6 +32,8 @@ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, PyCompilerFlags *, PyArena *); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); +PyAPI_FUNC(int) PyAST_BuildSymbolInfo(struct _mod *, PyFutureFeatures**, + struct symtable**, const char*, PyCompilerFlags*); #define ERR_LATE_FUTURE \ "from __future__ imports must occur at the beginning of the file" Modified: python/branches/tlee-ast-optimize/Include/optimize.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/optimize.h (original) +++ python/branches/tlee-ast-optimize/Include/optimize.h Sun Jun 1 16:55:05 2008 @@ -5,7 +5,8 @@ extern "C" { #endif -PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena); +PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, + PyArena* arena); #ifdef __cplusplus }; Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Sun Jun 1 16:55:05 2008 @@ -6,6 +6,7 @@ #include "node.h" #include "code.h" #include "eval.h" +#include "symtable.h" #include "optimize.h" #include @@ -515,6 +516,8 @@ else { PyArena *arena; mod_ty mod; + struct symtable* st; + PyFutureFeatures* future; arena = PyArena_New(); mod = PyAST_obj2mod(cmd, arena, mode); @@ -522,9 +525,15 @@ PyArena_Free(arena); return NULL; } + if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, &cf)) { + PyArena_Free(arena); + return NULL; + } if (!(supplied_flags & PyCF_NO_OPTIMIZE)) { - if (!PyAST_Optimize(&mod, arena)) { + if (!PyAST_Optimize(&mod, st, arena)) { PyArena_Free(arena); + PySymtable_Free(st); + PyObject_Free(future); return NULL; } } Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Sun Jun 1 16:55:05 2008 @@ -180,6 +180,31 @@ static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__; +int +PyAST_BuildSymbolInfo(mod_ty mod, PyFutureFeatures** f, struct symtable** st, + const char* filename, PyCompilerFlags* cf) +{ + int merged; + + *f = PyFuture_FromAST(mod, filename); + if (*f == NULL) + return 0; + + merged = (*f)->ff_features | (cf ? cf->cf_flags : 0); + (*f)->ff_features = merged; + + *st = PySymtable_Build(mod, filename, *f); + if (*st == NULL) { + PyObject_Free(*st); + return 0; + } + + if (cf != NULL) + cf->cf_flags = merged; + + return 1; +} + PyObject * _Py_Mangle(PyObject *privateobj, PyObject *ident) { @@ -247,7 +272,6 @@ struct compiler c; PyCodeObject *co = NULL; PyCompilerFlags local_flags; - int merged; if (!__doc__) { __doc__ = PyString_InternFromString("__doc__"); @@ -259,25 +283,13 @@ return NULL; c.c_filename = filename; c.c_arena = arena; - c.c_future = PyFuture_FromAST(mod, filename); - if (c.c_future == NULL) - goto finally; if (!flags) { local_flags.cf_flags = 0; flags = &local_flags; } - merged = c.c_future->ff_features | flags->cf_flags; - c.c_future->ff_features = merged; - flags->cf_flags = merged; - c.c_flags = flags; - c.c_nestlevel = 0; - - c.c_st = PySymtable_Build(mod, filename, c.c_future); - if (c.c_st == NULL) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, "no symtable"); - goto finally; - } + if (!PyAST_BuildSymbolInfo(mod, &c.c_future, &c.c_st, filename, flags)) + goto finally; + c.c_flags = flags; /* XXX initialize to NULL for now, need to handle */ c.c_encoding = NULL; @@ -300,8 +312,15 @@ return NULL; mod = PyAST_FromNode(n, NULL, filename, arena); if (mod != NULL) { - if (PyAST_Optimize(&mod, arena)) { - co = PyAST_Compile(mod, filename, NULL, arena); + PyFutureFeatures* future; + struct symtable* st; + + if (PyAST_BuildSymbolInfo(mod, &future, &st, filename, NULL)) { + if (PyAST_Optimize(&mod, st, arena)) { + co = PyAST_Compile(mod, filename, NULL, arena); + } + PyObject_Free(future); + PySymtable_Free(st); } } PyArena_Free(arena); @@ -311,10 +330,10 @@ static void compiler_free(struct compiler *c) { - if (c->c_st) - PySymtable_Free(c->c_st); - if (c->c_future) - PyObject_Free(c->c_future); + if (c->c_st != NULL) + PySymtable_Free(c->c_st); + if (c->c_future) + PyObject_Free(c->c_future); Py_DECREF(c->c_stack); } Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 1 16:55:05 2008 @@ -4,14 +4,22 @@ #include "pyerrors.h" #include "node.h" #include "ast.h" +#include "symtable.h" -static int optimize_expr(expr_ty* expr_ptr, PyArena* arena); -static int optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena); -static int optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena); -static int optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena); -static int optimize_keyword(keyword_ty* kwd_ptr, PyArena* arena); -static int optimize_arguments(arguments_ty* args_ptr, PyArena* arena); -static int optimize_slice(slice_ty* slice_ptr, PyArena* arena); +static int optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_comprehension(comprehension_ty* comp_ptr, + PySTEntryObject* ste, PyArena* arena); +static int optimize_excepthandler(excepthandler_ty* exc_ptr, + PySTEntryObject* ste, PyArena* arena); +static int optimize_keyword(keyword_ty* kwd_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, + PyArena* arena); /** * Determine the constant value of a given expression. It's assumed that @@ -133,12 +141,12 @@ * Optimize a sequence of expressions. */ static int -optimize_expr_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_expr_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } @@ -186,7 +194,8 @@ * Replaces the AST node at `n' with a Pass() node. */ static asdl_seq* -_asdl_seq_replace_with_pass(asdl_seq* seq, int n, int lineno, int col_offset, PyArena* arena) +_asdl_seq_replace_with_pass(asdl_seq* seq, int n, int lineno, int col_offset, + PyArena* arena) { stmt_ty pass = Pass(lineno, col_offset, arena); if (pass == NULL) @@ -199,13 +208,13 @@ * Optimize a sequence of statements. */ static int -optimize_stmt_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { stmt_ty stmt = asdl_seq_GET(seq, n); - if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; if (stmt->kind == If_kind) { @@ -243,57 +252,59 @@ } static int -optimize_comprehension_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_comprehension_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, + PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { comprehension_ty* comp; comp = (comprehension_ty*)&asdl_seq_GET(seq, n); - if (!optimize_comprehension(comp, arena)) + if (!optimize_comprehension(comp, ste, arena)) return 0; } return 1; } static int -optimize_excepthandler_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_excepthandler_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, + PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { excepthandler_ty* excepthandler; excepthandler = (excepthandler_ty*)&asdl_seq_GET(seq, n); - if (!optimize_excepthandler(excepthandler, arena)) + if (!optimize_excepthandler(excepthandler, ste, arena)) return 0; } return 1; } static int -optimize_keyword_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_keyword_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } static int -optimize_slice_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_slice_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } static int -optimize_mod(mod_ty* mod_ptr, PyArena* arena) +optimize_mod(mod_ty* mod_ptr, PySTEntryObject* ste, PyArena* arena) { asdl_seq** body; mod_ty mod = *mod_ptr; @@ -316,7 +327,7 @@ } case Expression_kind: { - return optimize_expr(&mod->v.Expression.body, arena); + return optimize_expr(&mod->v.Expression.body, ste, arena); } default: PyErr_Format(PyExc_ValueError, "unknown mod_ty kind: %d", @@ -324,28 +335,28 @@ return 0; }; - return optimize_stmt_seq(body, arena); + return optimize_stmt_seq(body, ste, arena); } static int -optimize_bool_op(expr_ty* expr_ptr, PyArena* arena) +optimize_bool_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.BoolOp.values, arena)) + if (!optimize_expr_seq(&expr->v.BoolOp.values, ste, arena)) return 0; return 1; } static int -optimize_bin_op(expr_ty* expr_ptr, PyArena* arena) +optimize_bin_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { PyObject* left; PyObject* right; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.BinOp.left, arena)) + if (!optimize_expr(&expr->v.BinOp.left, ste, arena)) return 0; - if (!optimize_expr(&expr->v.BinOp.right, arena)) + if (!optimize_expr(&expr->v.BinOp.right, ste, arena)) return 0; /* @@ -472,11 +483,11 @@ } static int -optimize_unary_op(expr_ty* expr_ptr, PyArena* arena) +optimize_unary_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { PyObject* operand; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.UnaryOp.operand, arena)) + if (!optimize_expr(&expr->v.UnaryOp.operand, ste, arena)) return 0; operand = _expr_constant_value(expr->v.UnaryOp.operand); if (operand != NULL) { @@ -537,76 +548,82 @@ } static int -optimize_lambda(expr_ty* expr_ptr, PyArena* arena) +optimize_lambda(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Lambda.body, arena)) + /* XXX: do we need to look up ste again? */ + if (!optimize_expr(&expr->v.Lambda.body, ste, arena)) return 0; return 1; } -static int optimize_if_exp(expr_ty* expr_ptr, PyArena* arena) { +static int optimize_if_exp(expr_ty* expr_ptr, PySTEntryObject* ste, + PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.IfExp.test, arena)) + if (!optimize_expr(&expr->v.IfExp.test, ste, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.body, arena)) + if (!optimize_expr(&expr->v.IfExp.body, ste, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.orelse, arena)) + if (!optimize_expr(&expr->v.IfExp.orelse, ste, arena)) return 0; return 1; } -static int optimize_dict(expr_ty* expr_ptr, PyArena* arena) { +static int optimize_dict(expr_ty* expr_ptr, PySTEntryObject* ste, + PyArena* arena) +{ expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Dict.keys, arena)) + if (!optimize_expr_seq(&expr->v.Dict.keys, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Dict.values, arena)) + if (!optimize_expr_seq(&expr->v.Dict.values, ste, arena)) return 0; return 1; } static int -optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena) +optimize_comprehension(comprehension_ty* comp_ptr, PySTEntryObject* ste, + PyArena* arena) { comprehension_ty comp = *comp_ptr; - if (!optimize_expr(&comp->target, arena)) + if (!optimize_expr(&comp->target, ste, arena)) return 0; - if (!optimize_expr(&comp->iter, arena)) + if (!optimize_expr(&comp->iter, ste, arena)) return 0; - if (!optimize_expr_seq(&comp->ifs, arena)) + if (!optimize_expr_seq(&comp->ifs, ste, arena)) return 0; return 1; } static int -optimize_list_comp(expr_ty* expr_ptr, PyArena* arena) +optimize_list_comp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.ListComp.elt, arena)) + if (!optimize_expr(&expr->v.ListComp.elt, ste, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.ListComp.generators, arena)) + if (!optimize_comprehension_seq(&expr->v.ListComp.generators, ste, arena)) return 0; return 1; } static int -optimize_generator_exp(expr_ty* expr_ptr, PyArena* arena) +optimize_generator_exp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.GeneratorExp.elt, arena)) + if (!optimize_expr(&expr->v.GeneratorExp.elt, ste, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, arena)) + if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, ste, + arena)) return 0; return 1; } static int -optimize_yield(expr_ty* expr_ptr, PyArena* arena) +optimize_yield(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; if (expr->v.Yield.value != NULL) { expr_ty value; - if (!optimize_expr(&expr->v.Yield.value, arena)) + if (!optimize_expr(&expr->v.Yield.value, ste, arena)) return 0; value = expr->v.Yield.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -616,100 +633,101 @@ } static int -optimize_compare(expr_ty* expr_ptr, PyArena* arena) +optimize_compare(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Compare.left, arena)) + if (!optimize_expr(&expr->v.Compare.left, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Compare.comparators, arena)) + if (!optimize_expr_seq(&expr->v.Compare.comparators, ste, arena)) return 0; return 1; } static int -optimize_keyword(keyword_ty* keyword_ptr, PyArena* arena) +optimize_keyword(keyword_ty* keyword_ptr, PySTEntryObject* ste, PyArena* arena) { keyword_ty keyword = *keyword_ptr; - if (!optimize_expr(&keyword->value, arena)) + if (!optimize_expr(&keyword->value, ste, arena)) return 0; return 1; } static int -optimize_arguments(arguments_ty* args_ptr, PyArena* arena) +optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, + PyArena* arena) { arguments_ty args = *args_ptr; - if (!optimize_expr_seq(&args->args, arena)) + if (!optimize_expr_seq(&args->args, ste, arena)) return 0; - if (!optimize_expr_seq(&args->defaults, arena)) + if (!optimize_expr_seq(&args->defaults, ste, arena)) return 0; return 1; } static int -optimize_call(expr_ty* expr_ptr, PyArena* arena) +optimize_call(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Call.func, arena)) + if (!optimize_expr(&expr->v.Call.func, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Call.args, arena)) + if (!optimize_expr_seq(&expr->v.Call.args, ste, arena)) return 0; - if (!optimize_keyword_seq(&expr->v.Call.keywords, arena)) + if (!optimize_keyword_seq(&expr->v.Call.keywords, ste, arena)) return 0; if (expr->v.Call.starargs != NULL) - if (!optimize_expr(&expr->v.Call.starargs, arena)) + if (!optimize_expr(&expr->v.Call.starargs, ste, arena)) return 0; if (expr->v.Call.kwargs != NULL) - if (!optimize_expr(&expr->v.Call.kwargs, arena)) + if (!optimize_expr(&expr->v.Call.kwargs, ste, arena)) return 0; return 1; } static int -optimize_repr(expr_ty* expr_ptr, PyArena* arena) +optimize_repr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Repr.value, arena)) + if (!optimize_expr(&expr->v.Repr.value, ste, arena)) return 0; return 1; } static int -optimize_attribute(expr_ty* expr_ptr, PyArena* arena) +optimize_attribute(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Attribute.value, arena)) + if (!optimize_expr(&expr->v.Attribute.value, ste, arena)) return 0; return 1; } static int -optimize_slice(slice_ty* slice_ptr, PyArena* arena) +optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, PyArena* arena) { slice_ty slice = *slice_ptr; switch (slice->kind) { case Slice_kind: { if (slice->v.Slice.lower != NULL) - if (!optimize_expr(&slice->v.Slice.lower, arena)) + if (!optimize_expr(&slice->v.Slice.lower, ste, arena)) return 0; if (slice->v.Slice.upper != NULL) - if (!optimize_expr(&slice->v.Slice.upper, arena)) + if (!optimize_expr(&slice->v.Slice.upper, ste, arena)) return 0; if (slice->v.Slice.step != NULL) - if (!optimize_expr(&slice->v.Slice.step, arena)) + if (!optimize_expr(&slice->v.Slice.step, ste, arena)) return 0; break; } case ExtSlice_kind: { - if (!optimize_slice_seq(&slice->v.ExtSlice.dims, arena)) + if (!optimize_slice_seq(&slice->v.ExtSlice.dims, ste, arena)) return 0; break; } case Index_kind: { - if (!optimize_expr(&slice->v.Index.value, arena)) + if (!optimize_expr(&slice->v.Index.value, ste, arena)) return 0; break; } @@ -726,21 +744,21 @@ } static int -optimize_subscript(expr_ty* expr_ptr, PyArena* arena) +optimize_subscript(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Subscript.value, arena)) + if (!optimize_expr(&expr->v.Subscript.value, ste, arena)) return 0; - if (!optimize_slice(&expr->v.Subscript.slice, arena)) + if (!optimize_slice(&expr->v.Subscript.slice, ste, arena)) return 0; return 1; } static int -optimize_tuple(expr_ty* expr_ptr, PyArena* arena) +optimize_tuple(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Tuple.elts, arena)) + if (!optimize_expr_seq(&expr->v.Tuple.elts, ste, arena)) return 0; if (_is_sequence_of_constants(expr->v.Tuple.elts)) { @@ -756,7 +774,7 @@ } static int -optimize_name(expr_ty* expr_ptr, PyArena* arena) +optimize_name(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; const char* id = PyString_AS_STRING(expr->v.Name.id); @@ -783,77 +801,77 @@ } static int -optimize_expr(expr_ty* expr_ptr, PyArena* arena) +optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; switch (expr->kind) { case BoolOp_kind: { - return optimize_bool_op(expr_ptr, arena); + return optimize_bool_op(expr_ptr, ste, arena); } case BinOp_kind: { - return optimize_bin_op(expr_ptr, arena); + return optimize_bin_op(expr_ptr, ste, arena); } case UnaryOp_kind: { - return optimize_unary_op(expr_ptr, arena); + return optimize_unary_op(expr_ptr, ste, arena); } case Lambda_kind: { - return optimize_lambda(expr_ptr, arena); + return optimize_lambda(expr_ptr, ste, arena); } case IfExp_kind: { - return optimize_if_exp(expr_ptr, arena); + return optimize_if_exp(expr_ptr, ste, arena); } case Dict_kind: { - return optimize_dict(expr_ptr, arena); + return optimize_dict(expr_ptr, ste, arena); } case ListComp_kind: { - return optimize_list_comp(expr_ptr, arena); + return optimize_list_comp(expr_ptr, ste, arena); } case GeneratorExp_kind: { - return optimize_generator_exp(expr_ptr, arena); + return optimize_generator_exp(expr_ptr, ste, arena); } case Yield_kind: { - return optimize_yield(expr_ptr, arena); + return optimize_yield(expr_ptr, ste, arena); } case Compare_kind: { - return optimize_compare(expr_ptr, arena); + return optimize_compare(expr_ptr, ste, arena); } case Call_kind: { - return optimize_call(expr_ptr, arena); + return optimize_call(expr_ptr, ste, arena); } case Repr_kind: { - return optimize_repr(expr_ptr, arena); + return optimize_repr(expr_ptr, ste, arena); } case Attribute_kind: { - return optimize_attribute(expr_ptr, arena); + return optimize_attribute(expr_ptr, ste, arena); } case Subscript_kind: { - return optimize_subscript(expr_ptr, arena); + return optimize_subscript(expr_ptr, ste, arena); } case List_kind: { - return optimize_expr_seq(&expr->v.List.elts, arena); + return optimize_expr_seq(&expr->v.List.elts, ste, arena); } case Tuple_kind: { - return optimize_tuple(expr_ptr, arena); + return optimize_tuple(expr_ptr, ste, arena); } case Name_kind: { - return optimize_name(expr_ptr, arena); + return optimize_name(expr_ptr, ste, arena); } case Num_kind: case Str_kind: @@ -869,38 +887,38 @@ } static int -optimize_function_def(stmt_ty* stmt_ptr, PyArena* arena) +optimize_function_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_arguments(&stmt->v.FunctionDef.args, arena)) + if (!optimize_arguments(&stmt->v.FunctionDef.args, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, arena)) + if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, arena)) + if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, ste, arena)) return 0; return 1; } static int -optimize_class_def(stmt_ty* stmt_ptr, PyArena* arena) +optimize_class_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.ClassDef.bases, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.bases, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.ClassDef.body, arena)) + if (!optimize_stmt_seq(&stmt->v.ClassDef.body, ste, arena)) return 0; return 1; } static int -optimize_return(stmt_ty* stmt_ptr, PyArena* arena) +optimize_return(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Return.value != NULL) { expr_ty value; - if (!optimize_expr(&stmt->v.Return.value, arena)) + if (!optimize_expr(&stmt->v.Return.value, ste, arena)) return 0; value = stmt->v.Return.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -910,87 +928,87 @@ } static int -optimize_delete(stmt_ty* stmt_ptr, PyArena* arena) +optimize_delete(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Delete.targets, arena)) + if (!optimize_expr_seq(&stmt->v.Delete.targets, ste, arena)) return 0; return 1; } static int -optimize_assign(stmt_ty* stmt_ptr, PyArena* arena) +optimize_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Assign.targets, arena)) + if (!optimize_expr_seq(&stmt->v.Assign.targets, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.Assign.value, arena)) + if (!optimize_expr(&stmt->v.Assign.value, ste, arena)) return 0; return 1; } static int -optimize_aug_assign(stmt_ty* stmt_ptr, PyArena* arena) +optimize_aug_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.AugAssign.target, arena)) + if (!optimize_expr(&stmt->v.AugAssign.target, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.AugAssign.value, arena)) + if (!optimize_expr(&stmt->v.AugAssign.value, ste, arena)) return 0; return 1; } static int -optimize_print(stmt_ty* stmt_ptr, PyArena* arena) +optimize_print(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Print.dest != NULL) - if (!optimize_expr(&stmt->v.Print.dest, arena)) + if (!optimize_expr(&stmt->v.Print.dest, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.Print.values, arena)) + if (!optimize_expr_seq(&stmt->v.Print.values, ste, arena)) return 0; return 1; } static int -optimize_for(stmt_ty* stmt_ptr, PyArena* arena) +optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.target, arena)) + if (!optimize_expr(&stmt->v.For.target, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.For.iter, arena)) + if (!optimize_expr(&stmt->v.For.iter, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.body, arena)) + if (!optimize_stmt_seq(&stmt->v.For.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.For.orelse, ste, arena)) return 0; return 1; } static int -optimize_while(stmt_ty* stmt_ptr, PyArena* arena) +optimize_while(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.While.test, arena)) + if (!optimize_expr(&stmt->v.While.test, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.body, arena)) + if (!optimize_stmt_seq(&stmt->v.While.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.While.orelse, ste, arena)) return 0; return 1; } static int -optimize_if(stmt_ty* stmt_ptr, PyArena* arena) +optimize_if(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.If.test, arena)) + if (!optimize_expr(&stmt->v.If.test, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.body, arena)) + if (!optimize_stmt_seq(&stmt->v.If.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.If.orelse, ste, arena)) return 0; if (stmt->v.If.test->kind == UnaryOp_kind && @@ -1020,174 +1038,187 @@ } static int -optimize_with(stmt_ty* stmt_ptr, PyArena* arena) +optimize_with(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.With.context_expr, arena)) + if (!optimize_expr(&stmt->v.With.context_expr, ste, arena)) return 0; if (stmt->v.With.optional_vars != NULL) - if (!optimize_expr(&stmt->v.With.optional_vars, arena)) + if (!optimize_expr(&stmt->v.With.optional_vars, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.With.body, arena)) + if (!optimize_stmt_seq(&stmt->v.With.body, ste, arena)) return 0; return 1; } static int -optimize_raise(stmt_ty* stmt_ptr, PyArena* arena) +optimize_raise(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Raise.type != NULL) - if (!optimize_expr(&stmt->v.Raise.type, arena)) + if (!optimize_expr(&stmt->v.Raise.type, ste, arena)) return 0; if (stmt->v.Raise.inst != NULL) - if (!optimize_expr(&stmt->v.Raise.inst, arena)) + if (!optimize_expr(&stmt->v.Raise.inst, ste, arena)) return 0; if (stmt->v.Raise.tback != NULL) - if (!optimize_expr(&stmt->v.Raise.tback, arena)) + if (!optimize_expr(&stmt->v.Raise.tback, ste, arena)) return 0; return 1; } static int -optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena) +optimize_excepthandler(excepthandler_ty* exc_ptr, PySTEntryObject* ste, + PyArena* arena) { excepthandler_ty exc = *exc_ptr; if (exc->v.ExceptHandler.type != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.type, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.type, ste, arena)) return 0; if (exc->v.ExceptHandler.name != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.name, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.name, ste, arena)) return 0; - if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, arena)) + if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, ste, arena)) return 0; return 1; } static int -optimize_try_except(stmt_ty* stmt_ptr, PyArena* arena) +optimize_try_except(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryExcept.body, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.body, ste, arena)) return 0; - if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, arena)) + if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, ste, arena)) return 0; return 1; } static int -optimize_try_finally(stmt_ty* stmt_ptr, PyArena* arena) +optimize_try_finally(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryFinally.body, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, ste, arena)) return 0; return 1; } static int -optimize_assert(stmt_ty* stmt_ptr, PyArena* arena) +optimize_assert(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Assert.test, arena)) + if (!optimize_expr(&stmt->v.Assert.test, ste, arena)) return 0; if (stmt->v.Assert.msg != NULL) - if (!optimize_expr(&stmt->v.Assert.msg, arena)) + if (!optimize_expr(&stmt->v.Assert.msg, ste, arena)) return 0; return 1; } static int -optimize_exec(stmt_ty* stmt_ptr, PyArena* arena) +optimize_exec(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Exec.body, arena)) + if (!optimize_expr(&stmt->v.Exec.body, ste, arena)) return 0; if (stmt->v.Exec.globals != NULL) - if (!optimize_expr(&stmt->v.Exec.globals, arena)) + if (!optimize_expr(&stmt->v.Exec.globals, ste, arena)) return 0; if (stmt->v.Exec.locals != NULL) - if (!optimize_expr(&stmt->v.Exec.locals, arena)) + if (!optimize_expr(&stmt->v.Exec.locals, ste, arena)) return 0; return 1; } static int -optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena) +optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; switch (stmt->kind) { case FunctionDef_kind: { - return optimize_function_def(stmt_ptr, arena); + int rc; + ste = PySymtable_Lookup(ste->ste_table, *stmt_ptr); + if (ste == NULL) + return 0; + rc = optimize_function_def(stmt_ptr, ste, arena); + Py_DECREF(ste); + return rc; } case ClassDef_kind: { - return optimize_class_def(stmt_ptr, arena); + int rc; + ste = PySymtable_Lookup(ste->ste_table, *stmt_ptr); + if (ste == NULL) + return 0; + rc = optimize_class_def(stmt_ptr, ste, arena); + Py_DECREF(ste); + return rc; } case Return_kind: { - return optimize_return(stmt_ptr, arena); + return optimize_return(stmt_ptr, ste, arena); } case Delete_kind: { - return optimize_delete(stmt_ptr, arena); + return optimize_delete(stmt_ptr, ste, arena); } case Assign_kind: { - return optimize_assign(stmt_ptr, arena); + return optimize_assign(stmt_ptr, ste, arena); } case AugAssign_kind: { - return optimize_aug_assign(stmt_ptr, arena); + return optimize_aug_assign(stmt_ptr, ste, arena); } case Print_kind: { - return optimize_print(stmt_ptr, arena); + return optimize_print(stmt_ptr, ste, arena); } case For_kind: { - return optimize_for(stmt_ptr, arena); + return optimize_for(stmt_ptr, ste, arena); } case While_kind: { - return optimize_while(stmt_ptr, arena); + return optimize_while(stmt_ptr, ste, arena); } case If_kind: { - return optimize_if(stmt_ptr, arena); + return optimize_if(stmt_ptr, ste, arena); } case With_kind: { - return optimize_with(stmt_ptr, arena); + return optimize_with(stmt_ptr, ste, arena); } case Raise_kind: { - return optimize_raise(stmt_ptr, arena); + return optimize_raise(stmt_ptr, ste, arena); } case TryExcept_kind: { - return optimize_try_except(stmt_ptr, arena); + return optimize_try_except(stmt_ptr, ste, arena); } case TryFinally_kind: { - return optimize_try_finally(stmt_ptr, arena); + return optimize_try_finally(stmt_ptr, ste, arena); } case Assert_kind: { - return optimize_assert(stmt_ptr, arena); + return optimize_assert(stmt_ptr, ste, arena); } case Exec_kind: { - return optimize_exec(stmt_ptr, arena); + return optimize_exec(stmt_ptr, ste, arena); } case Expr_kind: { - return optimize_expr(&stmt->v.Expr.value, arena); + return optimize_expr(&stmt->v.Expr.value, ste, arena); } case Import_kind: case ImportFrom_kind: @@ -1211,8 +1242,14 @@ * Optimize an AST. */ int -PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena) +PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, PyArena* arena) { - return optimize_mod(mod_ptr, arena); + int rc; + PySTEntryObject* ste = PySymtable_Lookup(st, *mod_ptr); + if (ste == NULL) + return 0; + rc = optimize_mod(mod_ptr, ste, arena); + Py_DECREF(ste); + return rc; } Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Sun Jun 1 16:55:05 2008 @@ -1386,9 +1386,20 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) - if (!PyAST_Optimize(&mod, arena)) - return NULL; + if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) { + PyFutureFeatures* future; + struct symtable* st; + + if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, flags)) { + if (!PyAST_Optimize(&mod, st, arena)) { + PyObject_Free(future); + PySymtable_Free(st); + return NULL; + } + PyObject_Free(future); + PySymtable_Free(st); + } + } return mod; } else { @@ -1414,9 +1425,20 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) - if (!PyAST_Optimize(&mod, arena)) - return NULL; + if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) { + PyFutureFeatures* future; + struct symtable* st; + + if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, flags)) { + if (!PyAST_Optimize(&mod, st, arena)) { + PySymtable_Free(st); + PyObject_Free(future); + return NULL; + } + PySymtable_Free(st); + PyObject_Free(future); + } + } return mod; } else { From buildbot at python.org Sun Jun 1 16:58:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 14:58:19 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080601145819.C03B21E4009@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/288 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 17:18:22 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 1 Jun 2008 17:18:22 +0200 (CEST) Subject: [Python-checkins] r63854 - in python/branches/tlee-ast-optimize: Doc/c-api/bytearray.rst Doc/c-api/concrete.rst Doc/c-api/file.rst Doc/c-api/string.rst Doc/c-api/type.rst Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/library/basehttpserver.rst Doc/library/cgihttpserver.rst Doc/library/cmd.rst Doc/library/codecs.rst Doc/library/commands.rst Doc/library/cookie.rst Doc/library/cookielib.rst Doc/library/easydialogs.rst Doc/library/ftplib.rst Doc/library/httplib.rst Doc/library/os.rst Doc/library/poplib.rst Doc/library/re.rst Doc/library/simplehttpserver.rst Doc/library/smtplib.rst Doc/library/socket.rst Doc/library/stdtypes.rst Doc/library/telnetlib.rst Doc/library/urllib2.rst Doc/library/userdict.rst Doc/tutorial/controlflow.rst Doc/tutorial/interpreter.rst Doc/using/cmdline.rst Doc/whatsnew/2.6.rst Include/Python.h Include/bytearrayobject.h Include/bytesobject.h Include/fileobject.h Include/floatobject.h Include/formatter_string.h Include/formatter_unicode.h Include/intobject.h Include/longobject.h Include/object.h Include/py_curses.h Include/pyerrors.h Include/pyport.h Include/pythonrun.h Include/stringobject.h Include/unicodeobject.h Include/warnings.h Lib/UserString.py Lib/bsddb/test/test_all.py Lib/collections.py Lib/commands.py Lib/ctypes/test/test_pointers.py Lib/distutils/command/bdist_wininst.py Lib/distutils/command/wininst-6.0.exe Lib/distutils/command/wininst-7.1.exe Lib/distutils/command/wininst-9.0-amd64.exe Lib/distutils/command/wininst-9.0.exe Lib/distutils/tests/test_build_ext.py Lib/ftplib.py Lib/heapq.py Lib/httplib.py Lib/lib-tk/Tkinter.py Lib/locale.py Lib/poplib.py Lib/smtplib.py Lib/socket.py Lib/sqlite3/test/dbapi.py Lib/sre_parse.py Lib/subprocess.py Lib/tarfile.py Lib/telnetlib.py Lib/test/pydoc_mod.py Lib/test/test___all__.py Lib/test/test_bsddb3.py Lib/test/test_ftplib.py Lib/test/test_httplib.py Lib/test/test_math.py Lib/test/test_poplib.py Lib/test/test_py3kwarn.py Lib/test/test_smtplib.py Lib/test/test_socket.py Lib/test/test_subprocess.py Lib/test/test_support.py Lib/test/test_sys.py Lib/test/test_tarfile.py Lib/test/test_telnetlib.py Lib/test/test_urllib.py Lib/test/test_urllib2.py Lib/test/test_urllib2net.py Lib/test/test_userstring.py Lib/urllib.py Lib/urllib2.py Lib/xmlrpclib.py Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/ae/_AEmodule.c Mac/Modules/cf/_CFmodule.c Mac/Modules/cf/pycfbridge.c Mac/Modules/file/_Filemodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndihooks.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Misc/NEWS Modules/_bsddb.c Modules/_bytesio.c Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_csv.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_curses_panel.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_heapqmodule.c Modules/_hotshot.c Modules/_json.c Modules/_localemodule.c Modules/_lsprof.c Modules/_sqlite/cache.c Modules/_sqlite/connection.c Modules/_sqlite/connection.h Modules/_sqlite/cursor.c Modules/_sqlite/cursor.h Modules/_sqlite/module.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_sre.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/almodule.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/bsddbmodule.c Modules/bz2module.c Modules/cPickle.c Modules/cStringIO.c Modules/cdmodule.c Modules/cgensupport.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/clmodule.c Modules/datetimemodule.c Modules/dbmmodule.c Modules/dlmodule.c Modules/errnomodule.c Modules/fcntlmodule.c Modules/flmodule.c Modules/fmmodule.c Modules/gcmodule.c Modules/gdbmmodule.c Modules/glmodule.c Modules/grpmodule.c Modules/imageop.c Modules/imgfile.c Modules/itertoolsmodule.c Modules/linuxaudiodev.c Modules/main.c Modules/mathmodule.c Modules/md5module.c Modules/mmapmodule.c Modules/nismodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pwdmodule.c Modules/pyexpat.c Modules/readline.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/shamodule.c Modules/socketmodule.c Modules/spwdmodule.c Modules/stropmodule.c Modules/sunaudiodev.c Modules/svmodule.c Modules/syslogmodule.c Modules/termios.c Modules/threadmodule.c Modules/timemodule.c Modules/unicodedata.c Modules/zipimport.c Modules/zlibmodule.c Objects/abstract.c Objects/boolobject.c Objects/bufferobject.c Objects/bytearrayobject.c Objects/bytes_methods.c Objects/bytesobject.c Objects/cellobject.c Objects/classobject.c Objects/codeobject.c Objects/complexobject.c Objects/descrobject.c Objects/dictobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/methodobject.c Objects/moduleobject.c Objects/object.c Objects/rangeobject.c Objects/setobject.c Objects/sliceobject.c Objects/stringlib/formatter.h Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/stringobject.c Objects/structseq.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_hashlib.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/_ssl.vcproj PC/VS8.0/_tkinter.vcproj PC/VS8.0/bdist_wininst.vcproj PC/VS8.0/debug.vsprops PC/VS8.0/kill_python.vcproj PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyd.vsprops PC/VS8.0/pyd_d.vsprops PC/VS8.0/pyproject.vsprops PC/VS8.0/python.vcproj PC/VS8.0/pythoncore.vcproj PC/VS8.0/release.vsprops PC/VS8.0/sqlite3.vcproj PC/VS8.0/x64.vsprops PC/_msi.c PC/_subprocess.c PC/_winreg.c PC/bdist_wininst/install.c PC/msvcrtmodule.c PC/winsound.c PCbuild/pythoncore.vcproj Parser/asdl_c.py Parser/tokenizer.c Python/Python-ast.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/codecs.c Python/compile.c Python/errors.c Python/formatter_string.c Python/formatter_unicode.c Python/future.c Python/getargs.c Python/import.c Python/mactoolboxglue.c Python/marshal.c Python/modsupport.c Python/mysnprintf.c Python/peephole.c Python/pystrtod.c Python/pythonrun.c Python/structmember.c Python/symtable.c Python/sysmodule.c Python/traceback.c RISCOS/Modules/drawfmodule.c RISCOS/Modules/riscosmodule.c RISCOS/Modules/swimodule.c configure.in setup.py Message-ID: <20080601151822.A676A1E4009@bag.python.org> Author: thomas.lee Date: Sun Jun 1 17:18:10 2008 New Revision: 63854 Log: Merged revisions 63669-63853 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r63670 | thomas.heller | 2008-05-26 21:42:40 +1000 (Mon, 26 May 2008) | 4 lines On Windows, we must build a debug version iff running a debug build of Python ........ r63672 | christian.heimes | 2008-05-26 22:29:14 +1000 (Mon, 26 May 2008) | 4 lines First step of the C API rename: renamed Include/bytesobject.h to Include/bytearrayobject.h renamed Include/stringobject.h to Include/bytesobject.h added Include/stringobject.h with aliases ........ r63673 | benjamin.peterson | 2008-05-26 22:29:46 +1000 (Mon, 26 May 2008) | 2 lines some updates to string formatting section in whatsnew ........ r63675 | christian.heimes | 2008-05-26 22:51:38 +1000 (Mon, 26 May 2008) | 1 line Renamed PyString to PyBytes ........ r63677 | christian.heimes | 2008-05-26 23:01:01 +1000 (Mon, 26 May 2008) | 3 lines Renamed bytesobject.c to bytearrayobject.c Renamed stringobject.c to bytesobject.c Fixed Windows builds ........ r63678 | benjamin.peterson | 2008-05-26 23:01:25 +1000 (Mon, 26 May 2008) | 2 lines put a big note on configure.in asking people to run autoconf ........ r63679 | christian.heimes | 2008-05-26 23:15:11 +1000 (Mon, 26 May 2008) | 1 line Updated NEWS ........ r63685 | christian.heimes | 2008-05-26 23:51:41 +1000 (Mon, 26 May 2008) | 2 lines Used vs9to8.py to port all VS9.0 changes to 8.0 Updated VS7.1 and VC6 project files ........ r63686 | benjamin.peterson | 2008-05-27 00:02:09 +1000 (Tue, 27 May 2008) | 2 lines note that PyString and has been aliased to PyBytes ........ r63688 | benjamin.peterson | 2008-05-27 00:29:09 +1000 (Tue, 27 May 2008) | 2 lines fix a minor typo ........ r63690 | benjamin.peterson | 2008-05-27 00:51:54 +1000 (Tue, 27 May 2008) | 2 lines fix typo (thank Georg) ........ r63691 | georg.brandl | 2008-05-27 01:01:48 +1000 (Tue, 27 May 2008) | 2 lines Add renaming notices to 3.0 http package members. ........ r63696 | benjamin.peterson | 2008-05-27 01:54:26 +1000 (Tue, 27 May 2008) | 2 lines add PyByteArray docs ........ r63698 | benjamin.peterson | 2008-05-27 02:22:27 +1000 (Tue, 27 May 2008) | 2 lines add __all__ to test_support ........ r63704 | benjamin.peterson | 2008-05-27 03:43:53 +1000 (Tue, 27 May 2008) | 2 lines turn PyErr_WarnPy3k into a macro ........ r63714 | gregory.p.smith | 2008-05-27 05:03:35 +1000 (Tue, 27 May 2008) | 2 lines Define macros so that this still compiles on Python prior to r63675. ........ r63718 | gregory.p.smith | 2008-05-27 05:29:14 +1000 (Tue, 27 May 2008) | 3 lines Allow BerlekeyDB up through 4.7. I doubt any of our unixy buildbots even have that installed yet but the module code supports it. ........ r63719 | benjamin.peterson | 2008-05-27 05:37:11 +1000 (Tue, 27 May 2008) | 2 lines wrap line ........ r63721 | benjamin.peterson | 2008-05-27 05:41:53 +1000 (Tue, 27 May 2008) | 2 lines warn about some members of the commands module ........ r63724 | gregory.p.smith | 2008-05-27 06:22:14 +1000 (Tue, 27 May 2008) | 6 lines Fixes issue2791: subprocess.Popen.communicate leaked a file descripton until the last reference to the Popen instance was dropped. Adding explicit close() calls fixes it. Candidate for backport to release25-maint. ........ r63725 | benjamin.peterson | 2008-05-27 06:41:45 +1000 (Tue, 27 May 2008) | 2 lines take Brett's advice on a few warnings ........ r63726 | benjamin.peterson | 2008-05-27 06:43:24 +1000 (Tue, 27 May 2008) | 2 lines fix minor grammar typo ........ r63728 | gregory.p.smith | 2008-05-27 07:16:34 +1000 (Tue, 27 May 2008) | 4 lines Fix issue2589: there was a potential integer overflow leading to memory corruption on esoteric platforms and incorrect behavior on normal platforms. ........ r63732 | benjamin.peterson | 2008-05-27 07:44:26 +1000 (Tue, 27 May 2008) | 2 lines remove duplication in test module ........ r63734 | gregory.p.smith | 2008-05-27 08:07:28 +1000 (Tue, 27 May 2008) | 3 lines Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is passed in. (The assert won't prevent this in non-debug builds). ........ r63736 | benjamin.peterson | 2008-05-27 11:18:39 +1000 (Tue, 27 May 2008) | 2 lines remove some __getslice__ ........ r63738 | benjamin.peterson | 2008-05-27 11:42:29 +1000 (Tue, 27 May 2008) | 4 lines Improvements for test_py3kwarn - Always show warnings so they are always catchable - Make test_os_path_walk faster by walking a less populous directory ........ r63742 | gregory.p.smith | 2008-05-27 18:40:09 +1000 (Tue, 27 May 2008) | 3 lines Disable the use of BerkeleyDB 4.6 on platforms that appear to have issues with it. ........ r63744 | lars.gustaebel | 2008-05-27 22:39:23 +1000 (Tue, 27 May 2008) | 3 lines Do not close external file objects passed to tarfile.open(mode='w:bz2') when the TarFile is closed. ........ r63745 | jesus.cea | 2008-05-27 23:26:02 +1000 (Tue, 27 May 2008) | 1 line Better integration between Python testing and bsddb3 ........ r63754 | benjamin.peterson | 2008-05-28 11:12:35 +1000 (Wed, 28 May 2008) | 2 lines update tutorial function with more appropiate one from Eric Smith ........ r63755 | mark.hammond | 2008-05-28 11:54:55 +1000 (Wed, 28 May 2008) | 2 lines bdist_wininst now works correctly when both --skip-build and --plat-name are specified. ........ r63757 | georg.brandl | 2008-05-28 21:21:39 +1000 (Wed, 28 May 2008) | 2 lines #2989: add PyType_Modified(). ........ r63758 | benjamin.peterson | 2008-05-28 21:51:41 +1000 (Wed, 28 May 2008) | 2 lines fix spelling ........ r63760 | georg.brandl | 2008-05-29 01:41:36 +1000 (Thu, 29 May 2008) | 2 lines #2990: prevent inconsistent state while updating method cache. ........ r63767 | brett.cannon | 2008-05-29 15:08:50 +1000 (Thu, 29 May 2008) | 4 lines UserString.MutableString has been removed in Python 3.0. Works on issue #2877. Thanks Quentin Gallet-Gilles for the patch. ........ r63775 | georg.brandl | 2008-05-29 17:18:17 +1000 (Thu, 29 May 2008) | 2 lines Two fixes in bytearray docs. ........ r63776 | georg.brandl | 2008-05-29 17:18:49 +1000 (Thu, 29 May 2008) | 2 lines #2906: accept lists for options, and some cosmetic fixes in Tkinter. ........ r63781 | georg.brandl | 2008-05-29 17:38:37 +1000 (Thu, 29 May 2008) | 2 lines #2988: add note about catching CookieError when parsing untrusted cookie data. ........ r63782 | georg.brandl | 2008-05-29 17:45:26 +1000 (Thu, 29 May 2008) | 2 lines #2985: allow i8 in XMLRPC responses. ........ r63784 | raymond.hettinger | 2008-05-29 18:38:23 +1000 (Thu, 29 May 2008) | 1 line Fix two typos. ........ r63787 | georg.brandl | 2008-05-30 00:35:39 +1000 (Fri, 30 May 2008) | 2 lines Revert #2990 patch; it's not necessary as Armin showed. ........ r63788 | facundo.batista | 2008-05-30 02:39:26 +1000 (Fri, 30 May 2008) | 6 lines Fixed the semantic of timeout for socket.create_connection and all the upper level libraries that use it, including urllib2. Added and fixed some tests, and changed docs correspondingly. Thanks to John J Lee for the patch and the pusing, :) ........ r63791 | thomas.heller | 2008-05-30 05:18:12 +1000 (Fri, 30 May 2008) | 1 line Fix compiler warning. ........ r63792 | thomas.heller | 2008-05-30 05:42:34 +1000 (Fri, 30 May 2008) | 1 line ctypes NULL function pointers have a boolean False value now. ........ r63799 | brett.cannon | 2008-05-30 07:23:33 +1000 (Fri, 30 May 2008) | 1 line Turn off debugging output for building bsddb. ........ r63800 | brett.cannon | 2008-05-30 07:28:55 +1000 (Fri, 30 May 2008) | 1 line Note that UserList and UserString were moved to 'collections' in 3.0. ........ r63802 | mark.dickinson | 2008-05-30 12:46:53 +1000 (Fri, 30 May 2008) | 2 lines Fix typo in testSum ........ r63805 | raymond.hettinger | 2008-05-30 16:37:27 +1000 (Fri, 30 May 2008) | 1 line Issue 2784: fix leaks in exception exit. ........ r63806 | raymond.hettinger | 2008-05-30 16:49:47 +1000 (Fri, 30 May 2008) | 1 line Issue 2855: Fix obscure crasher by slowing down the entire module. Mimics what was done to dictionaries in r59223. ........ r63807 | raymond.hettinger | 2008-05-30 17:16:53 +1000 (Fri, 30 May 2008) | 1 line Issue 2903: Add __name__ in globals for namedtuple namespace. ........ r63808 | georg.brandl | 2008-05-30 17:54:16 +1000 (Fri, 30 May 2008) | 2 lines #2999: fix name of third parameter in unicode.replace()'s docstring. ........ r63814 | eric.smith | 2008-05-31 04:10:04 +1000 (Sat, 31 May 2008) | 1 line Refactor and clean up str.format() code (and helpers) in advance of optimizations. ........ r63817 | raymond.hettinger | 2008-05-31 04:20:50 +1000 (Sat, 31 May 2008) | 8 lines * Mark intermedidate computes values (hi, lo, yr) as volatile. * Expand comments. * Swap variable names in the sum_exact code so that x and y are consistently chosen as the larger and smaller magnitude values respectively. ........ r63818 | georg.brandl | 2008-05-31 05:12:13 +1000 (Sat, 31 May 2008) | 2 lines getloadavg() is not available on Windows. ........ r63819 | georg.brandl | 2008-05-31 05:17:29 +1000 (Sat, 31 May 2008) | 2 lines Better quote with single quotes. ........ r63823 | benjamin.peterson | 2008-05-31 06:44:39 +1000 (Sat, 31 May 2008) | 2 lines fix grammar ........ r63824 | marc-andre.lemburg | 2008-05-31 06:52:18 +1000 (Sat, 31 May 2008) | 5 lines Update the locale module alias table. Closes #3011. ........ r63827 | raymond.hettinger | 2008-05-31 13:24:31 +1000 (Sat, 31 May 2008) | 1 line Implement heapq in terms of less-than (to match list.sort()). ........ r63828 | mark.hammond | 2008-05-31 15:11:07 +1000 (Sat, 31 May 2008) | 2 lines Fix bdist_wininst --user-access-control for win2k ........ r63829 | mark.summerfield | 2008-05-31 23:05:34 +1000 (Sat, 31 May 2008) | 4 lines Added a note to [] that special forms & special chars lose their meaning and backrefs can't be used inside [] ........ r63830 | georg.brandl | 2008-06-01 00:40:09 +1000 (Sun, 01 Jun 2008) | 2 lines #3010: clarification about stdin/use_rawinput. ........ r63831 | georg.brandl | 2008-06-01 00:45:55 +1000 (Sun, 01 Jun 2008) | 2 lines #3005: add explaining sentence to easydialogs docs. ........ r63839 | gerhard.haering | 2008-06-01 07:33:27 +1000 (Sun, 01 Jun 2008) | 2 lines Fixed rowcount for SELECT statements. They're -1 now (again), for better DB-API 2.0 compliance. ........ r63846 | martin.v.loewis | 2008-06-01 17:20:46 +1000 (Sun, 01 Jun 2008) | 2 lines New environment variable PYTHONIOENCODING. ........ r63848 | martin.v.loewis | 2008-06-01 18:06:17 +1000 (Sun, 01 Jun 2008) | 2 lines Move sys_stream and sys_isatty out of the have-langinfo block. ........ r63849 | martin.v.loewis | 2008-06-01 18:19:02 +1000 (Sun, 01 Jun 2008) | 2 lines Typo: encoding -> codeset. ........ Added: python/branches/tlee-ast-optimize/Doc/c-api/bytearray.rst - copied unchanged from r63849, /python/trunk/Doc/c-api/bytearray.rst python/branches/tlee-ast-optimize/Include/bytearrayobject.h - copied unchanged from r63849, /python/trunk/Include/bytearrayobject.h python/branches/tlee-ast-optimize/Include/bytesobject.h - copied unchanged from r63849, /python/trunk/Include/bytesobject.h python/branches/tlee-ast-optimize/Include/stringobject.h - copied unchanged from r63849, /python/trunk/Include/stringobject.h python/branches/tlee-ast-optimize/Objects/bytearrayobject.c - copied unchanged from r63849, /python/trunk/Objects/bytearrayobject.c python/branches/tlee-ast-optimize/Objects/bytesobject.c - copied unchanged from r63849, /python/trunk/Objects/bytesobject.c python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj - copied unchanged from r63849, /python/trunk/PC/VS8.0/_bsddb44.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_hashlib.vcproj - copied unchanged from r63849, /python/trunk/PC/VS8.0/_hashlib.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.vcproj - copied unchanged from r63849, /python/trunk/PC/VS8.0/kill_python.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj - copied unchanged from r63849, /python/trunk/PC/VS8.0/sqlite3.vcproj Removed: python/branches/tlee-ast-optimize/Include/formatter_string.h python/branches/tlee-ast-optimize/Include/formatter_unicode.h python/branches/tlee-ast-optimize/Objects/stringobject.c Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/c-api/concrete.rst python/branches/tlee-ast-optimize/Doc/c-api/file.rst python/branches/tlee-ast-optimize/Doc/c-api/string.rst python/branches/tlee-ast-optimize/Doc/c-api/type.rst python/branches/tlee-ast-optimize/Doc/includes/noddy2.c python/branches/tlee-ast-optimize/Doc/includes/noddy3.c python/branches/tlee-ast-optimize/Doc/includes/noddy4.c python/branches/tlee-ast-optimize/Doc/includes/run-func.c python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst python/branches/tlee-ast-optimize/Doc/library/cgihttpserver.rst python/branches/tlee-ast-optimize/Doc/library/cmd.rst python/branches/tlee-ast-optimize/Doc/library/codecs.rst python/branches/tlee-ast-optimize/Doc/library/commands.rst python/branches/tlee-ast-optimize/Doc/library/cookie.rst python/branches/tlee-ast-optimize/Doc/library/cookielib.rst python/branches/tlee-ast-optimize/Doc/library/easydialogs.rst python/branches/tlee-ast-optimize/Doc/library/ftplib.rst python/branches/tlee-ast-optimize/Doc/library/httplib.rst python/branches/tlee-ast-optimize/Doc/library/os.rst python/branches/tlee-ast-optimize/Doc/library/poplib.rst python/branches/tlee-ast-optimize/Doc/library/re.rst python/branches/tlee-ast-optimize/Doc/library/simplehttpserver.rst python/branches/tlee-ast-optimize/Doc/library/smtplib.rst python/branches/tlee-ast-optimize/Doc/library/socket.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/telnetlib.rst python/branches/tlee-ast-optimize/Doc/library/urllib2.rst python/branches/tlee-ast-optimize/Doc/library/userdict.rst python/branches/tlee-ast-optimize/Doc/tutorial/controlflow.rst python/branches/tlee-ast-optimize/Doc/tutorial/interpreter.rst python/branches/tlee-ast-optimize/Doc/using/cmdline.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Include/Python.h python/branches/tlee-ast-optimize/Include/fileobject.h python/branches/tlee-ast-optimize/Include/floatobject.h python/branches/tlee-ast-optimize/Include/intobject.h python/branches/tlee-ast-optimize/Include/longobject.h python/branches/tlee-ast-optimize/Include/object.h python/branches/tlee-ast-optimize/Include/py_curses.h python/branches/tlee-ast-optimize/Include/pyerrors.h python/branches/tlee-ast-optimize/Include/pyport.h python/branches/tlee-ast-optimize/Include/pythonrun.h python/branches/tlee-ast-optimize/Include/unicodeobject.h python/branches/tlee-ast-optimize/Include/warnings.h python/branches/tlee-ast-optimize/Lib/UserString.py python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py python/branches/tlee-ast-optimize/Lib/collections.py python/branches/tlee-ast-optimize/Lib/commands.py python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py python/branches/tlee-ast-optimize/Lib/distutils/command/bdist_wininst.py python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-6.0.exe python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-7.1.exe python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-9.0-amd64.exe python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-9.0.exe python/branches/tlee-ast-optimize/Lib/distutils/tests/test_build_ext.py python/branches/tlee-ast-optimize/Lib/ftplib.py python/branches/tlee-ast-optimize/Lib/heapq.py python/branches/tlee-ast-optimize/Lib/httplib.py python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py python/branches/tlee-ast-optimize/Lib/locale.py python/branches/tlee-ast-optimize/Lib/poplib.py python/branches/tlee-ast-optimize/Lib/smtplib.py python/branches/tlee-ast-optimize/Lib/socket.py python/branches/tlee-ast-optimize/Lib/sqlite3/test/dbapi.py python/branches/tlee-ast-optimize/Lib/sre_parse.py python/branches/tlee-ast-optimize/Lib/subprocess.py python/branches/tlee-ast-optimize/Lib/tarfile.py python/branches/tlee-ast-optimize/Lib/telnetlib.py python/branches/tlee-ast-optimize/Lib/test/pydoc_mod.py python/branches/tlee-ast-optimize/Lib/test/test___all__.py python/branches/tlee-ast-optimize/Lib/test/test_bsddb3.py python/branches/tlee-ast-optimize/Lib/test/test_ftplib.py python/branches/tlee-ast-optimize/Lib/test/test_httplib.py python/branches/tlee-ast-optimize/Lib/test/test_math.py python/branches/tlee-ast-optimize/Lib/test/test_poplib.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py python/branches/tlee-ast-optimize/Lib/test/test_socket.py python/branches/tlee-ast-optimize/Lib/test/test_subprocess.py python/branches/tlee-ast-optimize/Lib/test/test_support.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_tarfile.py python/branches/tlee-ast-optimize/Lib/test/test_telnetlib.py python/branches/tlee-ast-optimize/Lib/test/test_urllib.py python/branches/tlee-ast-optimize/Lib/test/test_urllib2.py python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py python/branches/tlee-ast-optimize/Lib/test/test_userstring.py python/branches/tlee-ast-optimize/Lib/urllib.py python/branches/tlee-ast-optimize/Lib/urllib2.py python/branches/tlee-ast-optimize/Lib/xmlrpclib.py python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c python/branches/tlee-ast-optimize/Mac/Modules/Nav.c python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c python/branches/tlee-ast-optimize/Makefile.pre.in python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_bsddb.c python/branches/tlee-ast-optimize/Modules/_bytesio.c python/branches/tlee-ast-optimize/Modules/_codecsmodule.c python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c python/branches/tlee-ast-optimize/Modules/_csv.c python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c python/branches/tlee-ast-optimize/Modules/_curses_panel.c python/branches/tlee-ast-optimize/Modules/_cursesmodule.c python/branches/tlee-ast-optimize/Modules/_elementtree.c python/branches/tlee-ast-optimize/Modules/_fileio.c python/branches/tlee-ast-optimize/Modules/_hashopenssl.c python/branches/tlee-ast-optimize/Modules/_heapqmodule.c python/branches/tlee-ast-optimize/Modules/_hotshot.c python/branches/tlee-ast-optimize/Modules/_json.c python/branches/tlee-ast-optimize/Modules/_localemodule.c python/branches/tlee-ast-optimize/Modules/_lsprof.c python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.h python/branches/tlee-ast-optimize/Modules/_sqlite/module.c python/branches/tlee-ast-optimize/Modules/_sqlite/row.c python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c python/branches/tlee-ast-optimize/Modules/_sre.c python/branches/tlee-ast-optimize/Modules/_ssl.c python/branches/tlee-ast-optimize/Modules/_struct.c python/branches/tlee-ast-optimize/Modules/_testcapimodule.c python/branches/tlee-ast-optimize/Modules/_tkinter.c python/branches/tlee-ast-optimize/Modules/almodule.c python/branches/tlee-ast-optimize/Modules/arraymodule.c python/branches/tlee-ast-optimize/Modules/audioop.c python/branches/tlee-ast-optimize/Modules/binascii.c python/branches/tlee-ast-optimize/Modules/bsddbmodule.c python/branches/tlee-ast-optimize/Modules/bz2module.c python/branches/tlee-ast-optimize/Modules/cPickle.c python/branches/tlee-ast-optimize/Modules/cStringIO.c python/branches/tlee-ast-optimize/Modules/cdmodule.c python/branches/tlee-ast-optimize/Modules/cgensupport.c python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c python/branches/tlee-ast-optimize/Modules/clmodule.c python/branches/tlee-ast-optimize/Modules/datetimemodule.c python/branches/tlee-ast-optimize/Modules/dbmmodule.c python/branches/tlee-ast-optimize/Modules/dlmodule.c python/branches/tlee-ast-optimize/Modules/errnomodule.c python/branches/tlee-ast-optimize/Modules/fcntlmodule.c python/branches/tlee-ast-optimize/Modules/flmodule.c python/branches/tlee-ast-optimize/Modules/fmmodule.c python/branches/tlee-ast-optimize/Modules/gcmodule.c python/branches/tlee-ast-optimize/Modules/gdbmmodule.c python/branches/tlee-ast-optimize/Modules/glmodule.c python/branches/tlee-ast-optimize/Modules/grpmodule.c python/branches/tlee-ast-optimize/Modules/imageop.c python/branches/tlee-ast-optimize/Modules/imgfile.c python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c python/branches/tlee-ast-optimize/Modules/main.c python/branches/tlee-ast-optimize/Modules/mathmodule.c python/branches/tlee-ast-optimize/Modules/md5module.c python/branches/tlee-ast-optimize/Modules/mmapmodule.c python/branches/tlee-ast-optimize/Modules/nismodule.c python/branches/tlee-ast-optimize/Modules/operator.c python/branches/tlee-ast-optimize/Modules/ossaudiodev.c python/branches/tlee-ast-optimize/Modules/parsermodule.c python/branches/tlee-ast-optimize/Modules/posixmodule.c python/branches/tlee-ast-optimize/Modules/pwdmodule.c python/branches/tlee-ast-optimize/Modules/pyexpat.c python/branches/tlee-ast-optimize/Modules/readline.c python/branches/tlee-ast-optimize/Modules/selectmodule.c python/branches/tlee-ast-optimize/Modules/sha256module.c python/branches/tlee-ast-optimize/Modules/sha512module.c python/branches/tlee-ast-optimize/Modules/shamodule.c python/branches/tlee-ast-optimize/Modules/socketmodule.c python/branches/tlee-ast-optimize/Modules/spwdmodule.c python/branches/tlee-ast-optimize/Modules/stropmodule.c python/branches/tlee-ast-optimize/Modules/sunaudiodev.c python/branches/tlee-ast-optimize/Modules/svmodule.c python/branches/tlee-ast-optimize/Modules/syslogmodule.c python/branches/tlee-ast-optimize/Modules/termios.c python/branches/tlee-ast-optimize/Modules/threadmodule.c python/branches/tlee-ast-optimize/Modules/timemodule.c python/branches/tlee-ast-optimize/Modules/unicodedata.c python/branches/tlee-ast-optimize/Modules/zipimport.c python/branches/tlee-ast-optimize/Modules/zlibmodule.c python/branches/tlee-ast-optimize/Objects/abstract.c python/branches/tlee-ast-optimize/Objects/boolobject.c python/branches/tlee-ast-optimize/Objects/bufferobject.c python/branches/tlee-ast-optimize/Objects/bytes_methods.c python/branches/tlee-ast-optimize/Objects/cellobject.c python/branches/tlee-ast-optimize/Objects/classobject.c python/branches/tlee-ast-optimize/Objects/codeobject.c python/branches/tlee-ast-optimize/Objects/complexobject.c python/branches/tlee-ast-optimize/Objects/descrobject.c python/branches/tlee-ast-optimize/Objects/dictobject.c python/branches/tlee-ast-optimize/Objects/exceptions.c python/branches/tlee-ast-optimize/Objects/fileobject.c python/branches/tlee-ast-optimize/Objects/floatobject.c python/branches/tlee-ast-optimize/Objects/frameobject.c python/branches/tlee-ast-optimize/Objects/funcobject.c python/branches/tlee-ast-optimize/Objects/genobject.c python/branches/tlee-ast-optimize/Objects/intobject.c python/branches/tlee-ast-optimize/Objects/listobject.c python/branches/tlee-ast-optimize/Objects/longobject.c python/branches/tlee-ast-optimize/Objects/methodobject.c python/branches/tlee-ast-optimize/Objects/moduleobject.c python/branches/tlee-ast-optimize/Objects/object.c python/branches/tlee-ast-optimize/Objects/rangeobject.c python/branches/tlee-ast-optimize/Objects/setobject.c python/branches/tlee-ast-optimize/Objects/sliceobject.c python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h python/branches/tlee-ast-optimize/Objects/structseq.c python/branches/tlee-ast-optimize/Objects/tupleobject.c python/branches/tlee-ast-optimize/Objects/typeobject.c python/branches/tlee-ast-optimize/Objects/unicodeobject.c python/branches/tlee-ast-optimize/Objects/weakrefobject.c python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/bdist_wininst.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/debug.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln python/branches/tlee-ast-optimize/PC/VS8.0/pyd.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/pyd_d.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/release.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/x64.vsprops python/branches/tlee-ast-optimize/PC/_msi.c python/branches/tlee-ast-optimize/PC/_subprocess.c python/branches/tlee-ast-optimize/PC/_winreg.c python/branches/tlee-ast-optimize/PC/bdist_wininst/install.c python/branches/tlee-ast-optimize/PC/msvcrtmodule.c python/branches/tlee-ast-optimize/PC/winsound.c python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj python/branches/tlee-ast-optimize/Parser/asdl_c.py python/branches/tlee-ast-optimize/Parser/tokenizer.c python/branches/tlee-ast-optimize/Python/Python-ast.c python/branches/tlee-ast-optimize/Python/_warnings.c python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/ceval.c python/branches/tlee-ast-optimize/Python/codecs.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Python/errors.c python/branches/tlee-ast-optimize/Python/formatter_string.c python/branches/tlee-ast-optimize/Python/formatter_unicode.c python/branches/tlee-ast-optimize/Python/future.c python/branches/tlee-ast-optimize/Python/getargs.c python/branches/tlee-ast-optimize/Python/import.c python/branches/tlee-ast-optimize/Python/mactoolboxglue.c python/branches/tlee-ast-optimize/Python/marshal.c python/branches/tlee-ast-optimize/Python/modsupport.c python/branches/tlee-ast-optimize/Python/mysnprintf.c python/branches/tlee-ast-optimize/Python/peephole.c python/branches/tlee-ast-optimize/Python/pystrtod.c python/branches/tlee-ast-optimize/Python/pythonrun.c python/branches/tlee-ast-optimize/Python/structmember.c python/branches/tlee-ast-optimize/Python/symtable.c python/branches/tlee-ast-optimize/Python/sysmodule.c python/branches/tlee-ast-optimize/Python/traceback.c python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c python/branches/tlee-ast-optimize/configure.in python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Doc/c-api/concrete.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/concrete.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/concrete.rst Sun Jun 1 17:18:10 2008 @@ -64,6 +64,7 @@ .. toctree:: + bytearray.rst string.rst unicode.rst buffer.rst Modified: python/branches/tlee-ast-optimize/Doc/c-api/file.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/file.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/file.rst Sun Jun 1 17:18:10 2008 @@ -130,6 +130,14 @@ .. versionadded:: 2.3 +.. cfunction:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors) + + Set the file's encoding for Unicode output to *enc*, and its error + mode to *err*. Return 1 on success and 0 on failure. + + .. versionadded:: 2.6 + + .. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag) .. index:: single: softspace (file attribute) Modified: python/branches/tlee-ast-optimize/Doc/c-api/string.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/string.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/string.rst Sun Jun 1 17:18:10 2008 @@ -2,12 +2,16 @@ .. _stringobjects: -String Objects --------------- +String/Bytes Objects +-------------------- These functions raise :exc:`TypeError` when expecting a string parameter and are called with a non-string parameter. +.. note:: + These functions have been renamed to PyBytes_* in Python 3.x. The PyBytes + names are also available in 2.6. + .. index:: object: string @@ -120,7 +124,7 @@ .. cfunction:: PyObject* PyString_FromFormatV(const char *format, va_list vargs) - Identical to :func:`PyString_FromFormat` except that it takes exactly two + Identical to :cfunc:`PyString_FromFormat` except that it takes exactly two arguments. Modified: python/branches/tlee-ast-optimize/Doc/c-api/type.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/type.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/type.rst Sun Jun 1 17:18:10 2008 @@ -37,7 +37,16 @@ .. cfunction:: unsigned int PyType_ClearCache(void) - Clears the internal lookup cache. Return the current version tag. + Clear the internal lookup cache. Return the current version tag. + + .. versionadded:: 2.6 + + +.. cfunction:: void PyType_Modified(PyTypeObject *type) + + Invalidate the internal lookup cache for the type and all of its + subtypes. This function must be called after any manual + modification of the attributes or base classes of the type. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy2.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy2.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy2.c Sun Jun 1 17:18:10 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -90,7 +90,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -109,7 +109,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy3.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy3.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy3.c Sun Jun 1 17:18:10 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -93,7 +93,7 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "The first attribute value must be a string"); return -1; @@ -121,7 +121,7 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "The last attribute value must be a string"); return -1; @@ -153,7 +153,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -162,7 +162,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy4.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy4.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy4.c Sun Jun 1 17:18:10 2008 @@ -57,14 +57,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -124,7 +124,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -143,7 +143,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/run-func.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/run-func.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/run-func.c Sun Jun 1 17:18:10 2008 @@ -13,7 +13,7 @@ } Py_Initialize(); - pName = PyString_FromString(argv[1]); + pName = PyBytes_FromString(argv[1]); /* Error checking of pName left out */ pModule = PyImport_Import(pName); Modified: python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/basehttpserver.rst Sun Jun 1 17:18:10 2008 @@ -1,10 +1,14 @@ - :mod:`BaseHTTPServer` --- Basic HTTP server =========================================== .. module:: BaseHTTPServer :synopsis: Basic HTTP server (base class for SimpleHTTPServer and CGIHTTPServer). +.. note:: + The :mod:`BaseHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. index:: pair: WWW; server Modified: python/branches/tlee-ast-optimize/Doc/library/cgihttpserver.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/cgihttpserver.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/cgihttpserver.rst Sun Jun 1 17:18:10 2008 @@ -1,4 +1,3 @@ - :mod:`CGIHTTPServer` --- CGI-capable HTTP request handler ========================================================= @@ -7,6 +6,11 @@ scripts. .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`CGIHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + The :mod:`CGIHTTPServer` module defines a request-handler class, interface compatible with :class:`BaseHTTPServer.BaseHTTPRequestHandler` and inherits Modified: python/branches/tlee-ast-optimize/Doc/library/cmd.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/cmd.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/cmd.rst Sun Jun 1 17:18:10 2008 @@ -26,7 +26,12 @@ The optional arguments *stdin* and *stdout* specify the input and output file objects that the Cmd instance or subclass instance will use for input and - output. If not specified, they will default to *sys.stdin* and *sys.stdout*. + output. If not specified, they will default to :data:`sys.stdin` and + :data:`sys.stdout`. + + If you want a given *stdin* to be used, make sure to set the instance's + :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be + ignored. .. versionchanged:: 2.3 The *stdin* and *stdout* parameters were added. Modified: python/branches/tlee-ast-optimize/Doc/library/codecs.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/codecs.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/codecs.rst Sun Jun 1 17:18:10 2008 @@ -295,7 +295,8 @@ ------------------ The :mod:`codecs` module defines a set of base classes which define the -interface and can also be used to easily write you own codecs for use in Python. +interface and can also be used to easily write your own codecs for use in +Python. Each codec has to define four interfaces to make it usable as codec in Python: stateless encoder, stateless decoder, stream reader and stream writer. The Modified: python/branches/tlee-ast-optimize/Doc/library/commands.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/commands.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/commands.rst Sun Jun 1 17:18:10 2008 @@ -16,6 +16,12 @@ processes and retrieving their results. Using the :mod:`subprocess` module is preferable to using the :mod:`commands` module. +.. warning:: + + In 3.x, :func:`getstatus` and two undocumented functions (:func:`mk2arg` and + :func:`mkarg`) have been removed. Also, :func:`getstatusoutput` and + :func:`getoutput` have been moved to the :mod:`subprocess` module. + The :mod:`commands` module defines the following functions: @@ -44,6 +50,7 @@ This function is nonobvious and useless, also the name is misleading in the presence of :func:`getstatusoutput`. + Example:: >>> import commands Modified: python/branches/tlee-ast-optimize/Doc/library/cookie.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/cookie.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/cookie.rst Sun Jun 1 17:18:10 2008 @@ -1,4 +1,3 @@ - :mod:`Cookie` --- HTTP state management ======================================= @@ -7,6 +6,11 @@ .. moduleauthor:: Timothy O'Malley .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`Cookie` module has been renamed to :mod:`http.cookies` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + The :mod:`Cookie` module defines classes for abstracting the concept of cookies, an HTTP state management mechanism. It supports both simple string-only @@ -18,6 +22,12 @@ MSIE 3.0x doesn't follow the character rules outlined in those specs. As a result, the parsing rules used are a bit less strict. +.. note:: + + On encountering an invalid cookie, :exc:`CookieError` is raised, so if your + cookie data comes from a browser you should always prepare for invalid data + and catch :exc:`CookieError` on parsing. + .. exception:: CookieError Modified: python/branches/tlee-ast-optimize/Doc/library/cookielib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/cookielib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/cookielib.rst Sun Jun 1 17:18:10 2008 @@ -1,4 +1,3 @@ - :mod:`cookielib` --- Cookie handling for HTTP clients ===================================================== @@ -7,6 +6,11 @@ .. moduleauthor:: John J. Lee .. sectionauthor:: John J. Lee +.. note:: + The :mod:`cookielib` module has been renamed to :mod:`http.cookiejar` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. versionadded:: 2.4 Modified: python/branches/tlee-ast-optimize/Doc/library/easydialogs.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/easydialogs.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/easydialogs.rst Sun Jun 1 17:18:10 2008 @@ -9,10 +9,12 @@ The :mod:`EasyDialogs` module contains some simple dialogs for the Macintosh. -All routines take an optional resource ID parameter *id* with which one can -override the :const:`DLOG` resource used for the dialog, provided that the -dialog items correspond (both type and item number) to those in the default -:const:`DLOG` resource. See source code for details. +The dialogs get launched in a separate application which appears in the dock and +must be clicked on for the dialogs be displayed. All routines take an optional +resource ID parameter *id* with which one can override the :const:`DLOG` +resource used for the dialog, provided that the dialog items correspond (both +type and item number) to those in the default :const:`DLOG` resource. See source +code for details. .. warning:: Modified: python/branches/tlee-ast-optimize/Doc/library/ftplib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ftplib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ftplib.rst Sun Jun 1 17:18:10 2008 @@ -44,8 +44,8 @@ the method call ``login(user, passwd, acct)`` is made (where *passwd* and *acct* default to the empty string when not given). The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the - connection attempt (if is not specified, or passed as None, the global - default timeout setting will be used). + connection attempt (if is not specified, the global default timeout setting + will be used). .. versionchanged:: 2.6 *timeout* was added. @@ -126,10 +126,8 @@ made. The optional *timeout* parameter specifies a timeout in seconds for the - connection attempt. If is not specified, or passed as None, the object - timeout is used (the timeout that you passed when instantiating the class); - if the object timeout is also None, the global default timeout setting will - be used. + connection attempt. If no *timeout* is passed, the global default timeout + setting will be used. .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/tlee-ast-optimize/Doc/library/httplib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/httplib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/httplib.rst Sun Jun 1 17:18:10 2008 @@ -1,10 +1,14 @@ - :mod:`httplib` --- HTTP protocol client ======================================= .. module:: httplib :synopsis: HTTP and HTTPS protocol client (requires sockets). +.. note:: + The :mod:`httplib` module has been renamed to :mod:`http.client` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + .. index:: pair: HTTP; protocol @@ -40,7 +44,7 @@ be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line. If the optional *timeout* parameter is given, blocking operations (like connection attempts) will timeout after that many seconds - (if it is not given or ``None``, the global default timeout setting is used). + (if it is not given, the global default timeout setting is used). For example, the following calls all create instances that connect to the server at the same host and port:: Modified: python/branches/tlee-ast-optimize/Doc/library/os.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/os.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/os.rst Sun Jun 1 17:18:10 2008 @@ -2031,7 +2031,7 @@ Return the number of processes in the system run queue averaged over the last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was - unobtainable. + unobtainable. Availability: Unix. .. versionadded:: 2.3 Modified: python/branches/tlee-ast-optimize/Doc/library/poplib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/poplib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/poplib.rst Sun Jun 1 17:18:10 2008 @@ -29,8 +29,8 @@ This class implements the actual POP3 protocol. The connection is created when the instance is initialized. If *port* is omitted, the standard POP3 port (110) is used. The optional *timeout* parameter specifies a timeout in seconds for the - connection attempt (if not specified, or passed as None, the global default - timeout setting will be used). + connection attempt (if not specified, the global default timeout setting will + be used). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/tlee-ast-optimize/Doc/library/re.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/re.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/re.rst Sun Jun 1 17:18:10 2008 @@ -181,6 +181,12 @@ ``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any character except ``'^'``. + Note that inside ``[]`` the special forms and special characters lose + their meanings and only the syntaxes described here are valid. For + example, ``+``, ``*``, ``(``, ``)``, and so on are treated as + literals inside ``[]``, and backreferences cannot be used inside + ``[]``. + ``'|'`` ``A|B``, where A and B can be arbitrary REs, creates a regular expression that will match either A or B. An arbitrary number of REs can be separated by the Modified: python/branches/tlee-ast-optimize/Doc/library/simplehttpserver.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/simplehttpserver.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/simplehttpserver.rst Sun Jun 1 17:18:10 2008 @@ -6,6 +6,11 @@ :synopsis: This module provides a basic request handler for HTTP servers. .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`SimpleHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + The :mod:`SimpleHTTPServer` module defines a single class, :class:`SimpleHTTPRequestHandler`, which is interface-compatible with Modified: python/branches/tlee-ast-optimize/Doc/library/smtplib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/smtplib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/smtplib.rst Sun Jun 1 17:18:10 2008 @@ -25,8 +25,8 @@ with those parameters during initialization. An :exc:`SMTPConnectError` is raised if the specified host doesn't respond correctly. The optional *timeout* parameter specifies a timeout in seconds for blocking operations - like the connection attempt (if not specified, or passed as None, the global - default timeout setting will be used). + like the connection attempt (if not specified, the global default timeout + setting will be used). For normal use, you should only require the initialization/connect, :meth:`sendmail`, and :meth:`quit` methods. An example is included below. @@ -45,8 +45,8 @@ and *certfile* are also optional, and can contain a PEM formatted private key and certificate chain file for the SSL connection. The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the - connection attempt (if not specified, or passed as None, the global default - timeout setting will be used). + connection attempt (if not specified, the global default timeout setting + will be used). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/tlee-ast-optimize/Doc/library/socket.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/socket.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/socket.rst Sun Jun 1 17:18:10 2008 @@ -207,12 +207,11 @@ .. function:: create_connection(address[, timeout]) - Connects to the *address* received (as usual, a ``(host, port)`` pair), with an - optional timeout for the connection. Especially useful for higher-level - protocols, it is not normally used directly from application-level code. - Passing the optional *timeout* parameter will set the timeout on the socket - instance (if it is not given or ``None``, the global default timeout setting is - used). + Convenience function. Connect to *address* (a 2-tuple ``(host, port)``), + and return the socket object. Passing the optional *timeout* parameter will + set the timeout on the socket instance before attempting to connect. If no + *timeout* is supplied, the global default timeout setting returned by + :func:`getdefaulttimeout` is used. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Sun Jun 1 17:18:10 2008 @@ -2165,6 +2165,13 @@ .. versionadded:: 2.3 +.. attribute:: file.errors + + The Unicode error handler used to along with the encoding. + + .. versionadded:: 2.6 + + .. attribute:: file.mode The I/O mode for the file. If the file was created using the :func:`open` Modified: python/branches/tlee-ast-optimize/Doc/library/telnetlib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/telnetlib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/telnetlib.rst Sun Jun 1 17:18:10 2008 @@ -28,6 +28,11 @@ :class:`Telnet` represents a connection to a Telnet server. The instance is initially not connected by default; the :meth:`open` method must be used to establish a connection. Alternatively, the host name and optional port + and timeout can be passed to the constructor, in which case the connection to + the server will be established before the constructor returns. The optional + *timeout* parameter specifies a timeout in seconds for the connection attempt (if + not specified, the global default timeout setting will be used). + number can be passed to the constructor, to, in which case the connection to the server will be established before the constructor returns. The optional *timeout* parameter specifies a timeout in seconds for blocking operations @@ -128,8 +133,7 @@ Connect to a host. The optional second argument is the port number, which defaults to the standard Telnet port (23). The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the connection - attempt (if not specified, or passed as None, the global default timeout - setting will be used). + attempt (if not specified, the global default timeout setting will be used). Do not try to reopen an already connected instance. Modified: python/branches/tlee-ast-optimize/Doc/library/urllib2.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/urllib2.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/urllib2.rst Sun Jun 1 17:18:10 2008 @@ -27,9 +27,9 @@ returns a string in this format. The optional *timeout* parameter specifies a timeout in seconds for blocking - operations like the connection attempt (if not specified, or passed as - ``None``, the global default timeout setting will be used). This actually - only works for HTTP, HTTPS, FTP and FTPS connections. + operations like the connection attempt (if not specified, the global default + timeout setting will be used). This actually only works for HTTP, HTTPS, + FTP and FTPS connections. This function returns a file-like object with two additional methods: @@ -411,9 +411,9 @@ the same as those of :func:`urlopen` (which simply calls the :meth:`open` method on the currently installed global :class:`OpenerDirector`). The optional *timeout* parameter specifies a timeout in seconds for blocking - operations like the connection attempt (if not specified, or passed as - ``None``, the global default timeout setting will be used; this actually only - works for HTTP, HTTPS, FTP and FTPS connections). + operations like the connection attempt (if not specified, the global default + timeout setting will be usedi). The timeout feature actually works only for + HTTP, HTTPS, FTP and FTPS connections). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/tlee-ast-optimize/Doc/library/userdict.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/userdict.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/userdict.rst Sun Jun 1 17:18:10 2008 @@ -100,6 +100,12 @@ defaulting to the empty list ``[]``. *list* can be any iterable, e.g. a real Python list or a :class:`UserList` object. + .. note:: + The :class:`UserList` class has been moved to the :mod:`collections` + module in Python 3.0. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + + In addition to supporting the methods and operations of mutable sequences (see section :ref:`typesseq`), :class:`UserList` instances provide the following attribute: @@ -167,6 +173,12 @@ :class:`UserString` (or a subclass) or an arbitrary sequence which can be converted into a string using the built-in :func:`str` function. + .. note:: + The :class:`UserString` class has been moved to the :mod:`collections` + module in Python 3.0. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + + .. class:: MutableString([sequence]) @@ -178,6 +190,9 @@ mutable object as dictionary key, which would be otherwise very error prone and hard to track down. + .. deprecated:: 2.6 + The :class:`MutableString` class has been removed in Python 3.0. + In addition to supporting the methods and operations of string and Unicode objects (see section :ref:`string-methods`), :class:`UserString` instances provide the following attribute: Modified: python/branches/tlee-ast-optimize/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tutorial/controlflow.rst (original) +++ python/branches/tlee-ast-optimize/Doc/tutorial/controlflow.rst Sun Jun 1 17:18:10 2008 @@ -445,8 +445,8 @@ up in a tuple. Before the variable number of arguments, zero or more normal arguments may occur. :: - def fprintf(file, template, *args): - file.write(template.format(args)) + def write_multiple_items(file, separator, *args): + file.write(separator.join(args)) .. _tut-unpacking-arguments: Modified: python/branches/tlee-ast-optimize/Doc/tutorial/interpreter.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tutorial/interpreter.rst (original) +++ python/branches/tlee-ast-optimize/Doc/tutorial/interpreter.rst Sun Jun 1 17:18:10 2008 @@ -51,8 +51,8 @@ A second way of starting the interpreter is ``python -c command [arg] ...``, which executes the statement(s) in *command*, analogous to the shell's :option:`-c` option. Since Python statements often contain spaces or other -characters that are special to the shell, it is best to quote *command* in its -entirety with double quotes. +characters that are special to the shell, it is usually advised to quote +*command* in its entirety with single quotes. Some Python modules are also useful as scripts. These can be invoked using ``python -m module [arg] ...``, which executes the source file for *module* as Modified: python/branches/tlee-ast-optimize/Doc/using/cmdline.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/using/cmdline.rst (original) +++ python/branches/tlee-ast-optimize/Doc/using/cmdline.rst Sun Jun 1 17:18:10 2008 @@ -481,6 +481,13 @@ .. versionadded:: 2.6 +.. envvar:: PYTHONIOENCODING + + Overrides the encoding used for stdin/stdout/stderr, in the syntax + encodingname:errorhandler, with the :errors part being optional. + + .. versionadded:: 2.6 + .. envvar:: PYTHONNOUSERSITE Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Sun Jun 1 17:18:10 2008 @@ -526,9 +526,9 @@ PEP 3101: Advanced String Formatting ===================================================== -In Python 3.0, the `%` operator is supplemented by a more powerful -string formatting method, :meth:`format`. Support for the -:meth:`format` method has been backported to Python 2.6. +In Python 3.0, the `%` operator is supplemented by a more powerful string +formatting method, :meth:`format`. Support for the :meth:`str.format` method +has been backported to Python 2.6. In 2.6, both 8-bit and Unicode strings have a `.format()` method that treats the string as a template and takes the arguments to be formatted. @@ -649,8 +649,11 @@ .. seealso:: + :ref:`formatstrings` + The reference format fields. + :pep:`3101` - Advanced String Formatting - PEP written by Talin. + PEP written by Talin. Implemented by Eric Smith. .. ====================================================================== Modified: python/branches/tlee-ast-optimize/Include/Python.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/Python.h (original) +++ python/branches/tlee-ast-optimize/Include/Python.h Sun Jun 1 17:18:10 2008 @@ -94,6 +94,7 @@ /* #include "memoryobject.h" */ #include "bufferobject.h" #include "bytesobject.h" +#include "bytearrayobject.h" #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" Modified: python/branches/tlee-ast-optimize/Include/fileobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/fileobject.h (original) +++ python/branches/tlee-ast-optimize/Include/fileobject.h Sun Jun 1 17:18:10 2008 @@ -24,6 +24,7 @@ int f_newlinetypes; /* Types of newlines seen */ int f_skipnextlf; /* Skip next \n */ PyObject *f_encoding; + PyObject *f_errors; PyObject *weakreflist; /* List of weak references */ int unlocked_count; /* Num. currently running sections of code using f_fp with the GIL released. */ @@ -37,6 +38,7 @@ PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); +PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); Modified: python/branches/tlee-ast-optimize/Include/floatobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/floatobject.h (original) +++ python/branches/tlee-ast-optimize/Include/floatobject.h Sun Jun 1 17:18:10 2008 @@ -115,6 +115,12 @@ /* free list api */ PyAPI_FUNC(void) PyFloat_CompactFreeList(size_t *, size_t *, size_t *); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Deleted: python/branches/tlee-ast-optimize/Include/formatter_string.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/formatter_string.h Sun Jun 1 17:18:10 2008 +++ (empty file) @@ -1,12 +0,0 @@ -PyObject * -string__format__(PyObject *self, PyObject *args); - -PyObject * -string_long__format__(PyObject *self, PyObject *args); - -PyObject * -string_int__format__(PyObject *self, PyObject *args); - -PyObject * -string_float__format__(PyObject *self, PyObject *args); - Deleted: python/branches/tlee-ast-optimize/Include/formatter_unicode.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/formatter_unicode.h Sun Jun 1 17:18:10 2008 +++ (empty file) @@ -1,12 +0,0 @@ -PyObject * -unicode__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_long__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_int__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_float__format__(PyObject *self, PyObject *args); - Modified: python/branches/tlee-ast-optimize/Include/intobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/intobject.h (original) +++ python/branches/tlee-ast-optimize/Include/intobject.h Sun Jun 1 17:18:10 2008 @@ -68,6 +68,12 @@ a leading "0" */ PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Modified: python/branches/tlee-ast-optimize/Include/longobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/longobject.h (original) +++ python/branches/tlee-ast-optimize/Include/longobject.h Sun Jun 1 17:18:10 2008 @@ -119,6 +119,12 @@ a leading "0", instead of the prefix "0o" */ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Modified: python/branches/tlee-ast-optimize/Include/object.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/object.h (original) +++ python/branches/tlee-ast-optimize/Include/object.h Sun Jun 1 17:18:10 2008 @@ -460,6 +460,7 @@ PyObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(unsigned int) PyType_ClearCache(void); +PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); /* Generic operations on objects */ PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); @@ -514,7 +515,7 @@ PyAPI_FUNC(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) +#define PyObject_REPR(obj) PyBytes_AS_STRING(PyObject_Repr(obj)) /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ @@ -608,7 +609,7 @@ #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) -#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) +#define Py_TPFLAGS_BYTES_SUBCLASS (1L<<27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) Modified: python/branches/tlee-ast-optimize/Include/py_curses.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/py_curses.h (original) +++ python/branches/tlee-ast-optimize/Include/py_curses.h Sun Jun 1 17:18:10 2008 @@ -146,7 +146,7 @@ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ - return PyString_FromString(X()); } + return PyBytes_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ Modified: python/branches/tlee-ast-optimize/Include/pyerrors.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pyerrors.h (original) +++ python/branches/tlee-ast-optimize/Include/pyerrors.h Sun Jun 1 17:18:10 2008 @@ -104,7 +104,7 @@ #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ - ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ + ? PyBytes_AS_STRING(((PyClassObject*)(x))->cl_name) \ : (char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) \ Modified: python/branches/tlee-ast-optimize/Include/pyport.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pyport.h (original) +++ python/branches/tlee-ast-optimize/Include/pyport.h Sun Jun 1 17:18:10 2008 @@ -135,9 +135,9 @@ * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * - * PyString_FromFormat + * PyBytes_FromFormat * PyErr_Format - * PyString_FromFormatV + * PyBytes_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for Modified: python/branches/tlee-ast-optimize/Include/pythonrun.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pythonrun.h (original) +++ python/branches/tlee-ast-optimize/Include/pythonrun.h Sun Jun 1 17:18:10 2008 @@ -125,7 +125,7 @@ PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyInt_Init(void); PyAPI_FUNC(void) _PyFloat_Init(void); -PyAPI_FUNC(int) PyBytes_Init(void); +PyAPI_FUNC(int) PyByteArray_Init(void); /* Various internal finalizers */ PyAPI_FUNC(void) _PyExc_Fini(void); @@ -137,11 +137,11 @@ PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); -PyAPI_FUNC(void) PyString_Fini(void); +PyAPI_FUNC(void) PyBytes_Fini(void); PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); -PyAPI_FUNC(void) PyBytes_Fini(void); +PyAPI_FUNC(void) PyByteArray_Fini(void); /* Stuff with no proper home (yet) */ PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); Modified: python/branches/tlee-ast-optimize/Include/unicodeobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/unicodeobject.h (original) +++ python/branches/tlee-ast-optimize/Include/unicodeobject.h Sun Jun 1 17:18:10 2008 @@ -553,6 +553,12 @@ PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, + Py_UNICODE *format_spec, + Py_ssize_t format_spec_len); + /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H Modified: python/branches/tlee-ast-optimize/Include/warnings.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/warnings.h (original) +++ python/branches/tlee-ast-optimize/Include/warnings.h Sun Jun 1 17:18:10 2008 @@ -9,7 +9,9 @@ PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, const char *, PyObject *); -PyAPI_FUNC(int) PyErr_WarnPy3k(const char *, Py_ssize_t); + +#define PyErr_WarnPy3k(msg, stacklevel) \ + (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) /* DEPRECATED: Use PyErr_WarnEx() instead. */ #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) Modified: python/branches/tlee-ast-optimize/Lib/UserString.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/UserString.py (original) +++ python/branches/tlee-ast-optimize/Lib/UserString.py Sun Jun 1 17:18:10 2008 @@ -146,6 +146,9 @@ A faster and better solution is to rewrite your program using lists.""" def __init__(self, string=""): + from warnings import warnpy3k + warnpy3k('the class UserString.MutableString has been removed in ' + 'Python 3.0', stacklevel=2) self.data = string def __hash__(self): raise TypeError, "unhashable type (it is mutable)" Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py (original) +++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_all.py Sun Jun 1 17:18:10 2008 @@ -67,11 +67,20 @@ return path -# NOTE: This path is overridden by a unique one and cleaned up -# afterwards when run under regrtest via Lib/test/test_bsddb3.py. -get_new_path.prefix="/tmp/z-Berkeley_DB" +# This path can be overriden via "set_test_path_prefix()". +import os, os.path +get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB") get_new_path.num=0 +def get_test_path_prefix() : + return get_new_path.prefix + +def set_test_path_prefix(path) : + get_new_path.prefix=path + +def remove_test_path_directory() : + test_support.rmtree(get_new_path.prefix) + try : import threading get_new_path.mutex=threading.Lock() @@ -100,12 +109,6 @@ def suite(module_prefix='', timing_check=None): - try: - # this is special, it used to segfault the interpreter - import test_1413192 - except: - pass - test_modules = [ 'test_associate', 'test_basics', Modified: python/branches/tlee-ast-optimize/Lib/collections.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/collections.py (original) +++ python/branches/tlee-ast-optimize/Lib/collections.py Sun Jun 1 17:18:10 2008 @@ -88,8 +88,9 @@ if verbose: print template - # Execute the template string in a temporary namespace - namespace = dict(itemgetter=_itemgetter) + # Execute the template string in a temporary namespace and + # support tracing utilities by setting a value for frame.f_globals['__name__'] + namespace = dict(itemgetter=_itemgetter, __name__='namedtuple_%s' % typename) try: exec template in namespace except SyntaxError, e: Modified: python/branches/tlee-ast-optimize/Lib/commands.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/commands.py (original) +++ python/branches/tlee-ast-optimize/Lib/commands.py Sun Jun 1 17:18:10 2008 @@ -63,6 +63,8 @@ # Make command argument from directory and pathname (prefix space, add quotes). # def mk2arg(head, x): + from warnings import warnpy3k + warnpy3k("In 3.x, mk2arg has been removed.") import os return mkarg(os.path.join(head, x)) @@ -75,6 +77,8 @@ # with backslash. # def mkarg(x): + from warnings import warnpy3k + warnpy3k("in 3.x, mkarg has been removed.") if '\'' not in x: return ' \'' + x + '\'' s = ' "' Modified: python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py (original) +++ python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pointers.py Sun Jun 1 17:18:10 2008 @@ -175,5 +175,13 @@ self.assertRaises(TypeError, c_void_p, 3.14) # make sure floats are NOT accepted self.assertRaises(TypeError, c_void_p, object()) # nor other objects + def test_pointers_bool(self): + # NULL pointers have a boolean False value, non-NULL pointers True. + self.failUnlessEqual(bool(POINTER(c_int)()), False) + self.failUnlessEqual(bool(pointer(c_int())), True) + + self.failUnlessEqual(bool(CFUNCTYPE(None)(0)), False) + self.failUnlessEqual(bool(CFUNCTYPE(None)(42)), True) + if __name__ == '__main__': unittest.main() Modified: python/branches/tlee-ast-optimize/Lib/distutils/command/bdist_wininst.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/command/bdist_wininst.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/command/bdist_wininst.py Sun Jun 1 17:18:10 2008 @@ -79,6 +79,12 @@ def finalize_options (self): if self.bdist_dir is None: + if self.skip_build and self.plat_name: + # If build is skipped and plat_name is overridden, bdist will + # not see the correct 'plat_name' - so set that up manually. + bdist = self.distribution.get_command_obj('bdist') + bdist.plat_name = self.plat_name + # next the command will be initialized using that name bdist_base = self.get_finalized_command('bdist').bdist_base self.bdist_dir = os.path.join(bdist_base, 'wininst') if not self.target_version: Modified: python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-6.0.exe ============================================================================== Binary files. No diff available. Modified: python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-7.1.exe ============================================================================== Binary files. No diff available. Modified: python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-9.0-amd64.exe ============================================================================== Binary files. No diff available. Modified: python/branches/tlee-ast-optimize/Lib/distutils/command/wininst-9.0.exe ============================================================================== Binary files. No diff available. Modified: python/branches/tlee-ast-optimize/Lib/distutils/tests/test_build_ext.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/tests/test_build_ext.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/tests/test_build_ext.py Sun Jun 1 17:18:10 2008 @@ -28,6 +28,10 @@ dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]}) dist.package_dir = self.tmp_dir cmd = build_ext(dist) + if os.name == "nt": + # On Windows, we must build a debug version iff running + # a debug build of Python + cmd.debug = sys.executable.endswith("_d.exe") cmd.build_lib = self.tmp_dir cmd.build_temp = self.tmp_dir Modified: python/branches/tlee-ast-optimize/Lib/ftplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ftplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/ftplib.py Sun Jun 1 17:18:10 2008 @@ -44,6 +44,7 @@ from socket import getfqdn; socket.getfqdn = getfqdn; del getfqdn except ImportError: import socket +from socket import _GLOBAL_DEFAULT_TIMEOUT __all__ = ["FTP","Netrc"] @@ -71,7 +72,6 @@ # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) CRLF = '\r\n' - # The class itself class FTP: @@ -109,14 +109,15 @@ # Initialize host to localhost, port to standard ftp port # Optional arguments are host (for connect()), # and user, passwd, acct (for login()) - def __init__(self, host='', user='', passwd='', acct='', timeout=None): + def __init__(self, host='', user='', passwd='', acct='', + timeout=_GLOBAL_DEFAULT_TIMEOUT): self.timeout = timeout if host: self.connect(host) if user: self.login(user, passwd, acct) - def connect(self, host='', port=0, timeout=None): + def connect(self, host='', port=0, timeout=-999): '''Connect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port) @@ -125,7 +126,7 @@ self.host = host if port > 0: self.port = port - if timeout is not None: + if timeout != -999: self.timeout = timeout self.sock = socket.create_connection((self.host, self.port), self.timeout) self.af = self.sock.family Modified: python/branches/tlee-ast-optimize/Lib/heapq.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/heapq.py (original) +++ python/branches/tlee-ast-optimize/Lib/heapq.py Sun Jun 1 17:18:10 2008 @@ -167,7 +167,7 @@ def heappushpop(heap, item): """Fast version of a heappush followed by a heappop.""" - if heap and item > heap[0]: + if heap and heap[0] < item: item, heap[0] = heap[0], item _siftup(heap, 0) return item @@ -240,10 +240,11 @@ while pos > startpos: parentpos = (pos - 1) >> 1 parent = heap[parentpos] - if parent <= newitem: - break - heap[pos] = parent - pos = parentpos + if newitem < parent: + heap[pos] = parent + pos = parentpos + continue + break heap[pos] = newitem # The child indices of heap index pos are already heaps, and we want to make @@ -294,7 +295,7 @@ while childpos < endpos: # Set childpos to index of smaller child. rightpos = childpos + 1 - if rightpos < endpos and heap[rightpos] <= heap[childpos]: + if rightpos < endpos and not heap[childpos] < heap[rightpos]: childpos = rightpos # Move the smaller child up. heap[pos] = heap[childpos] Modified: python/branches/tlee-ast-optimize/Lib/httplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/httplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/httplib.py Sun Jun 1 17:18:10 2008 @@ -639,7 +639,8 @@ debuglevel = 0 strict = 0 - def __init__(self, host, port=None, strict=None, timeout=None): + def __init__(self, host, port=None, strict=None, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.timeout = timeout self.sock = None self._buffer = [] @@ -1055,7 +1056,7 @@ default_port = HTTPS_PORT def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=None, timeout=None): + strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): HTTPConnection.__init__(self, host, port, strict, timeout) self.key_file = key_file self.cert_file = cert_file Modified: python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py Sun Jun 1 17:18:10 2008 @@ -30,7 +30,7 @@ tk.mainloop() """ -__version__ = "$Revision$" +__version__ = "$Revision: 63501 $" import sys if sys.platform == "win32": @@ -1053,6 +1053,12 @@ if k[-1] == '_': k = k[:-1] if callable(v): v = self._register(v) + elif isinstance(v, (tuple, list)): + for item in v: + if not isinstance(item, (basestring, int)): + break + else: + v = ' '.join(map(str, v)) res = res + ('-'+k, v) return res def nametowidget(self, name): @@ -1092,7 +1098,6 @@ if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name) - #print '+ Tkinter created command', name return name register = _register def _root(self): @@ -1747,10 +1752,11 @@ after=widget - pack it after you have packed widget anchor=NSEW (or subset) - position widget according to given direction - before=widget - pack it before you will pack widget + before=widget - pack it before you will pack widget expand=bool - expand widget if parent size grows fill=NONE or X or Y or BOTH - fill widget if widget grows in=master - use master to contain this widget + in_=master - see 'in' option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction @@ -1788,29 +1794,26 @@ Base class to use the methods place_* in every widget.""" def place_configure(self, cnf={}, **kw): """Place a widget in the parent widget. Use as options: - in=master - master relative to which the widget is placed. + in=master - master relative to which the widget is placed + in_=master - see 'in' option description x=amount - locate anchor of this widget at position x of master y=amount - locate anchor of this widget at position y of master relx=amount - locate anchor of this widget between 0.0 and 1.0 relative to width of master (1.0 is right edge) - rely=amount - locate anchor of this widget between 0.0 and 1.0 + rely=amount - locate anchor of this widget between 0.0 and 1.0 relative to height of master (1.0 is bottom edge) - anchor=NSEW (or subset) - position anchor according to given direction + anchor=NSEW (or subset) - position anchor according to given direction width=amount - width of this widget in pixel height=amount - height of this widget in pixel relwidth=amount - width of this widget between 0.0 and 1.0 relative to width of master (1.0 is the same width - as the master) - relheight=amount - height of this widget between 0.0 and 1.0 + as the master) + relheight=amount - height of this widget between 0.0 and 1.0 relative to height of master (1.0 is the same - height as the master) - bordermode="inside" or "outside" - whether to take border width of master widget - into account - """ - for k in ['in_']: - if kw.has_key(k): - kw[k[:-1]] = kw[k] - del kw[k] + height as the master) + bordermode="inside" or "outside" - whether to take border width of + master widget into account + """ self.tk.call( ('place', 'configure', self._w) + self._options(cnf, kw)) @@ -1845,6 +1848,7 @@ column=number - use cell identified with given column (starting with 0) columnspan=number - this widget will span several columns in=master - use master to contain this widget + in_=master - see 'in' option description ipadx=amount - add internal padding in x direction ipady=amount - add internal padding in y direction padx=amount - add padding in x direction Modified: python/branches/tlee-ast-optimize/Lib/locale.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/locale.py (original) +++ python/branches/tlee-ast-optimize/Lib/locale.py Sun Jun 1 17:18:10 2008 @@ -615,6 +615,33 @@ # updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5' # updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5' # +# MAL 2008-05-30: +# Updated alias mapping to most recent locale.alias file +# from X.org distribution using makelocalealias.py. +# +# These are the differences compared to the old mapping (Python 2.5 +# and older): +# +# updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2' +# updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2' +# updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr at cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr_yu.cp1251 at cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251' +# updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2' +# updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr_yu.iso88595 at cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' +# updated 'sr_yu.microsoftcp1251 at cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251' +# updated 'sr_yu.utf8 at cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8' +# updated 'sr_yu at cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' + locale_alias = { 'a3': 'a3_AZ.KOI8-C', 'a3_az': 'a3_AZ.KOI8-C', @@ -623,30 +650,46 @@ 'af_za': 'af_ZA.ISO8859-1', 'af_za.iso88591': 'af_ZA.ISO8859-1', 'am': 'am_ET.UTF-8', + 'am_et': 'am_ET.UTF-8', 'american': 'en_US.ISO8859-1', 'american.iso88591': 'en_US.ISO8859-1', 'ar': 'ar_AA.ISO8859-6', 'ar_aa': 'ar_AA.ISO8859-6', 'ar_aa.iso88596': 'ar_AA.ISO8859-6', 'ar_ae': 'ar_AE.ISO8859-6', + 'ar_ae.iso88596': 'ar_AE.ISO8859-6', 'ar_bh': 'ar_BH.ISO8859-6', + 'ar_bh.iso88596': 'ar_BH.ISO8859-6', 'ar_dz': 'ar_DZ.ISO8859-6', + 'ar_dz.iso88596': 'ar_DZ.ISO8859-6', 'ar_eg': 'ar_EG.ISO8859-6', 'ar_eg.iso88596': 'ar_EG.ISO8859-6', 'ar_iq': 'ar_IQ.ISO8859-6', + 'ar_iq.iso88596': 'ar_IQ.ISO8859-6', 'ar_jo': 'ar_JO.ISO8859-6', + 'ar_jo.iso88596': 'ar_JO.ISO8859-6', 'ar_kw': 'ar_KW.ISO8859-6', + 'ar_kw.iso88596': 'ar_KW.ISO8859-6', 'ar_lb': 'ar_LB.ISO8859-6', + 'ar_lb.iso88596': 'ar_LB.ISO8859-6', 'ar_ly': 'ar_LY.ISO8859-6', + 'ar_ly.iso88596': 'ar_LY.ISO8859-6', 'ar_ma': 'ar_MA.ISO8859-6', + 'ar_ma.iso88596': 'ar_MA.ISO8859-6', 'ar_om': 'ar_OM.ISO8859-6', + 'ar_om.iso88596': 'ar_OM.ISO8859-6', 'ar_qa': 'ar_QA.ISO8859-6', + 'ar_qa.iso88596': 'ar_QA.ISO8859-6', 'ar_sa': 'ar_SA.ISO8859-6', 'ar_sa.iso88596': 'ar_SA.ISO8859-6', 'ar_sd': 'ar_SD.ISO8859-6', + 'ar_sd.iso88596': 'ar_SD.ISO8859-6', 'ar_sy': 'ar_SY.ISO8859-6', + 'ar_sy.iso88596': 'ar_SY.ISO8859-6', 'ar_tn': 'ar_TN.ISO8859-6', + 'ar_tn.iso88596': 'ar_TN.ISO8859-6', 'ar_ye': 'ar_YE.ISO8859-6', + 'ar_ye.iso88596': 'ar_YE.ISO8859-6', 'arabic': 'ar_AA.ISO8859-6', 'arabic.iso88596': 'ar_AA.ISO8859-6', 'az': 'az_AZ.ISO8859-9E', @@ -662,6 +705,7 @@ 'bg_bg.iso88595': 'bg_BG.ISO8859-5', 'bg_bg.koi8r': 'bg_BG.KOI8-R', 'bg_bg.microsoftcp1251': 'bg_BG.CP1251', + 'bn_in': 'bn_IN.UTF-8', 'bokmal': 'nb_NO.ISO8859-1', 'bokm\xe5l': 'nb_NO.ISO8859-1', 'br': 'br_FR.ISO8859-1', @@ -669,7 +713,12 @@ 'br_fr.iso88591': 'br_FR.ISO8859-1', 'br_fr.iso885914': 'br_FR.ISO8859-14', 'br_fr.iso885915': 'br_FR.ISO8859-15', + 'br_fr.iso885915 at euro': 'br_FR.ISO8859-15', + 'br_fr.utf8 at euro': 'br_FR.UTF-8', 'br_fr at euro': 'br_FR.ISO8859-15', + 'bs': 'bs_BA.ISO8859-2', + 'bs_ba': 'bs_BA.ISO8859-2', + 'bs_ba.iso88592': 'bs_BA.ISO8859-2', 'bulgarian': 'bg_BG.CP1251', 'c': 'C', 'c-french': 'fr_CA.ISO8859-1', @@ -682,6 +731,8 @@ 'ca_es': 'ca_ES.ISO8859-1', 'ca_es.iso88591': 'ca_ES.ISO8859-1', 'ca_es.iso885915': 'ca_ES.ISO8859-15', + 'ca_es.iso885915 at euro': 'ca_ES.ISO8859-15', + 'ca_es.utf8 at euro': 'ca_ES.UTF-8', 'ca_es at euro': 'ca_ES.ISO8859-15', 'catalan': 'ca_ES.ISO8859-1', 'cextend': 'en_US.ISO8859-1', @@ -691,7 +742,7 @@ 'croatian': 'hr_HR.ISO8859-2', 'cs': 'cs_CZ.ISO8859-2', 'cs_cs': 'cs_CZ.ISO8859-2', - 'cs_cs.iso88592': 'cs_CZ.ISO8859-2', + 'cs_cs.iso88592': 'cs_CS.ISO8859-2', 'cs_cz': 'cs_CZ.ISO8859-2', 'cs_cz.iso88592': 'cs_CZ.ISO8859-2', 'cy': 'cy_GB.ISO8859-1', @@ -717,10 +768,14 @@ 'de_at': 'de_AT.ISO8859-1', 'de_at.iso88591': 'de_AT.ISO8859-1', 'de_at.iso885915': 'de_AT.ISO8859-15', + 'de_at.iso885915 at euro': 'de_AT.ISO8859-15', + 'de_at.utf8 at euro': 'de_AT.UTF-8', 'de_at at euro': 'de_AT.ISO8859-15', 'de_be': 'de_BE.ISO8859-1', 'de_be.iso88591': 'de_BE.ISO8859-1', 'de_be.iso885915': 'de_BE.ISO8859-15', + 'de_be.iso885915 at euro': 'de_BE.ISO8859-15', + 'de_be.utf8 at euro': 'de_BE.UTF-8', 'de_be at euro': 'de_BE.ISO8859-15', 'de_ch': 'de_CH.ISO8859-1', 'de_ch.iso88591': 'de_CH.ISO8859-1', @@ -732,10 +787,14 @@ 'de_de.885915 at euro': 'de_DE.ISO8859-15', 'de_de.iso88591': 'de_DE.ISO8859-1', 'de_de.iso885915': 'de_DE.ISO8859-15', + 'de_de.iso885915 at euro': 'de_DE.ISO8859-15', + 'de_de.utf8 at euro': 'de_DE.UTF-8', 'de_de at euro': 'de_DE.ISO8859-15', 'de_lu': 'de_LU.ISO8859-1', 'de_lu.iso88591': 'de_LU.ISO8859-1', 'de_lu.iso885915': 'de_LU.ISO8859-15', + 'de_lu.iso885915 at euro': 'de_LU.ISO8859-15', + 'de_lu.utf8 at euro': 'de_LU.UTF-8', 'de_lu at euro': 'de_LU.ISO8859-15', 'deutsch': 'de_DE.ISO8859-1', 'dutch': 'nl_NL.ISO8859-1', @@ -755,6 +814,7 @@ 'en_be': 'en_BE.ISO8859-1', 'en_be at euro': 'en_BE.ISO8859-15', 'en_bw': 'en_BW.ISO8859-1', + 'en_bw.iso88591': 'en_BW.ISO8859-1', 'en_ca': 'en_CA.ISO8859-1', 'en_ca.iso88591': 'en_CA.ISO8859-1', 'en_gb': 'en_GB.ISO8859-1', @@ -763,15 +823,20 @@ 'en_gb.iso885915': 'en_GB.ISO8859-15', 'en_gb at euro': 'en_GB.ISO8859-15', 'en_hk': 'en_HK.ISO8859-1', + 'en_hk.iso88591': 'en_HK.ISO8859-1', 'en_ie': 'en_IE.ISO8859-1', 'en_ie.iso88591': 'en_IE.ISO8859-1', 'en_ie.iso885915': 'en_IE.ISO8859-15', + 'en_ie.iso885915 at euro': 'en_IE.ISO8859-15', + 'en_ie.utf8 at euro': 'en_IE.UTF-8', 'en_ie at euro': 'en_IE.ISO8859-15', 'en_in': 'en_IN.ISO8859-1', 'en_nz': 'en_NZ.ISO8859-1', 'en_nz.iso88591': 'en_NZ.ISO8859-1', 'en_ph': 'en_PH.ISO8859-1', + 'en_ph.iso88591': 'en_PH.ISO8859-1', 'en_sg': 'en_SG.ISO8859-1', + 'en_sg.iso88591': 'en_SG.ISO8859-1', 'en_uk': 'en_GB.ISO8859-1', 'en_us': 'en_US.ISO8859-1', 'en_us.88591': 'en_US.ISO8859-1', @@ -787,6 +852,7 @@ 'en_za.iso885915': 'en_ZA.ISO8859-15', 'en_za at euro': 'en_ZA.ISO8859-15', 'en_zw': 'en_ZW.ISO8859-1', + 'en_zw.iso88591': 'en_ZW.ISO8859-1', 'eng_gb': 'en_GB.ISO8859-1', 'eng_gb.8859': 'en_GB.ISO8859-1', 'english': 'en_EN.ISO8859-1', @@ -822,6 +888,8 @@ 'es_es.88591': 'es_ES.ISO8859-1', 'es_es.iso88591': 'es_ES.ISO8859-1', 'es_es.iso885915': 'es_ES.ISO8859-15', + 'es_es.iso885915 at euro': 'es_ES.ISO8859-15', + 'es_es.utf8 at euro': 'es_ES.UTF-8', 'es_es at euro': 'es_ES.ISO8859-15', 'es_gt': 'es_GT.ISO8859-1', 'es_gt.iso88591': 'es_GT.ISO8859-1', @@ -850,6 +918,7 @@ 'es_sv.iso885915': 'es_SV.ISO8859-15', 'es_sv at euro': 'es_SV.ISO8859-15', 'es_us': 'es_US.ISO8859-1', + 'es_us.iso88591': 'es_US.ISO8859-1', 'es_uy': 'es_UY.ISO8859-1', 'es_uy.iso88591': 'es_UY.ISO8859-1', 'es_uy.iso885915': 'es_UY.ISO8859-15', @@ -870,6 +939,8 @@ 'eu_es': 'eu_ES.ISO8859-1', 'eu_es.iso88591': 'eu_ES.ISO8859-1', 'eu_es.iso885915': 'eu_ES.ISO8859-15', + 'eu_es.iso885915 at euro': 'eu_ES.ISO8859-15', + 'eu_es.utf8 at euro': 'eu_ES.UTF-8', 'eu_es at euro': 'eu_ES.ISO8859-15', 'fa': 'fa_IR.UTF-8', 'fa_ir': 'fa_IR.UTF-8', @@ -879,6 +950,7 @@ 'fi_fi.88591': 'fi_FI.ISO8859-1', 'fi_fi.iso88591': 'fi_FI.ISO8859-1', 'fi_fi.iso885915': 'fi_FI.ISO8859-15', + 'fi_fi.iso885915 at euro': 'fi_FI.ISO8859-15', 'fi_fi.utf8 at euro': 'fi_FI.UTF-8', 'fi_fi at euro': 'fi_FI.ISO8859-15', 'finnish': 'fi_FI.ISO8859-1', @@ -893,6 +965,8 @@ 'fr_be.88591': 'fr_BE.ISO8859-1', 'fr_be.iso88591': 'fr_BE.ISO8859-1', 'fr_be.iso885915': 'fr_BE.ISO8859-15', + 'fr_be.iso885915 at euro': 'fr_BE.ISO8859-15', + 'fr_be.utf8 at euro': 'fr_BE.UTF-8', 'fr_be at euro': 'fr_BE.ISO8859-15', 'fr_ca': 'fr_CA.ISO8859-1', 'fr_ca.88591': 'fr_CA.ISO8859-1', @@ -908,11 +982,15 @@ 'fr_fr.88591': 'fr_FR.ISO8859-1', 'fr_fr.iso88591': 'fr_FR.ISO8859-1', 'fr_fr.iso885915': 'fr_FR.ISO8859-15', + 'fr_fr.iso885915 at euro': 'fr_FR.ISO8859-15', + 'fr_fr.utf8 at euro': 'fr_FR.UTF-8', 'fr_fr at euro': 'fr_FR.ISO8859-15', 'fr_lu': 'fr_LU.ISO8859-1', 'fr_lu.88591': 'fr_LU.ISO8859-1', 'fr_lu.iso88591': 'fr_LU.ISO8859-1', 'fr_lu.iso885915': 'fr_LU.ISO8859-15', + 'fr_lu.iso885915 at euro': 'fr_LU.ISO8859-15', + 'fr_lu.utf8 at euro': 'fr_LU.UTF-8', 'fr_lu at euro': 'fr_LU.ISO8859-15', 'fran\xe7ais': 'fr_FR.ISO8859-1', 'fre_fr': 'fr_FR.ISO8859-1', @@ -926,6 +1004,8 @@ 'ga_ie.iso88591': 'ga_IE.ISO8859-1', 'ga_ie.iso885914': 'ga_IE.ISO8859-14', 'ga_ie.iso885915': 'ga_IE.ISO8859-15', + 'ga_ie.iso885915 at euro': 'ga_IE.ISO8859-15', + 'ga_ie.utf8 at euro': 'ga_IE.UTF-8', 'ga_ie at euro': 'ga_IE.ISO8859-15', 'galego': 'gl_ES.ISO8859-1', 'galician': 'gl_ES.ISO8859-1', @@ -945,9 +1025,12 @@ 'gl_es': 'gl_ES.ISO8859-1', 'gl_es.iso88591': 'gl_ES.ISO8859-1', 'gl_es.iso885915': 'gl_ES.ISO8859-15', + 'gl_es.iso885915 at euro': 'gl_ES.ISO8859-15', + 'gl_es.utf8 at euro': 'gl_ES.UTF-8', 'gl_es at euro': 'gl_ES.ISO8859-15', 'greek': 'el_GR.ISO8859-7', 'greek.iso88597': 'el_GR.ISO8859-7', + 'gu_in': 'gu_IN.UTF-8', 'gv': 'gv_GB.ISO8859-1', 'gv_gb': 'gv_GB.ISO8859-1', 'gv_gb.iso88591': 'gv_GB.ISO8859-1', @@ -998,6 +1081,8 @@ 'it_it.88591': 'it_IT.ISO8859-1', 'it_it.iso88591': 'it_IT.ISO8859-1', 'it_it.iso885915': 'it_IT.ISO8859-15', + 'it_it.iso885915 at euro': 'it_IT.ISO8859-15', + 'it_it.utf8 at euro': 'it_IT.UTF-8', 'it_it at euro': 'it_IT.ISO8859-15', 'italian': 'it_IT.ISO8859-1', 'italian.iso88591': 'it_IT.ISO8859-1', @@ -1037,6 +1122,8 @@ 'kl_gl.iso88591': 'kl_GL.ISO8859-1', 'kl_gl.iso885915': 'kl_GL.ISO8859-15', 'kl_gl at euro': 'kl_GL.ISO8859-15', + 'km_kh': 'km_KH.UTF-8', + 'kn_in': 'kn_IN.UTF-8', 'ko': 'ko_KR.eucKR', 'ko_kr': 'ko_KR.eucKR', 'ko_kr.euc': 'ko_KR.eucKR', @@ -1049,6 +1136,8 @@ 'kw_gb.iso885914': 'kw_GB.ISO8859-14', 'kw_gb.iso885915': 'kw_GB.ISO8859-15', 'kw_gb at euro': 'kw_GB.ISO8859-15', + 'ky': 'ky_KG.UTF-8', + 'ky_kg': 'ky_KG.UTF-8', 'lithuanian': 'lt_LT.ISO8859-13', 'lo': 'lo_LA.MULELAO-1', 'lo_la': 'lo_LA.MULELAO-1', @@ -1071,6 +1160,7 @@ 'mk_mk.cp1251': 'mk_MK.CP1251', 'mk_mk.iso88595': 'mk_MK.ISO8859-5', 'mk_mk.microsoftcp1251': 'mk_MK.CP1251', + 'mr_in': 'mr_IN.UTF-8', 'ms': 'ms_MY.ISO8859-1', 'ms_my': 'ms_MY.ISO8859-1', 'ms_my.iso88591': 'ms_MY.ISO8859-1', @@ -1088,11 +1178,15 @@ 'nl_be.88591': 'nl_BE.ISO8859-1', 'nl_be.iso88591': 'nl_BE.ISO8859-1', 'nl_be.iso885915': 'nl_BE.ISO8859-15', + 'nl_be.iso885915 at euro': 'nl_BE.ISO8859-15', + 'nl_be.utf8 at euro': 'nl_BE.UTF-8', 'nl_be at euro': 'nl_BE.ISO8859-15', 'nl_nl': 'nl_NL.ISO8859-1', 'nl_nl.88591': 'nl_NL.ISO8859-1', 'nl_nl.iso88591': 'nl_NL.ISO8859-1', 'nl_nl.iso885915': 'nl_NL.ISO8859-15', + 'nl_nl.iso885915 at euro': 'nl_NL.ISO8859-15', + 'nl_nl.utf8 at euro': 'nl_NL.UTF-8', 'nl_nl at euro': 'nl_NL.ISO8859-15', 'nn': 'nn_NO.ISO8859-1', 'nn_no': 'nn_NO.ISO8859-1', @@ -1109,6 +1203,12 @@ 'no_no at euro': 'no_NO.ISO8859-15', 'norwegian': 'no_NO.ISO8859-1', 'norwegian.iso88591': 'no_NO.ISO8859-1', + 'nr': 'nr_ZA.ISO8859-1', + 'nr_za': 'nr_ZA.ISO8859-1', + 'nr_za.iso88591': 'nr_ZA.ISO8859-1', + 'nso': 'nso_ZA.ISO8859-15', + 'nso_za': 'nso_ZA.ISO8859-15', + 'nso_za.iso885915': 'nso_ZA.ISO8859-15', 'ny': 'ny_NO.ISO8859-1', 'ny_no': 'ny_NO.ISO8859-1', 'ny_no.88591': 'ny_NO.ISO8859-1', @@ -1121,6 +1221,7 @@ 'oc_fr.iso88591': 'oc_FR.ISO8859-1', 'oc_fr.iso885915': 'oc_FR.ISO8859-15', 'oc_fr at euro': 'oc_FR.ISO8859-15', + 'pa_in': 'pa_IN.UTF-8', 'pd': 'pd_US.ISO8859-1', 'pd_de': 'pd_DE.ISO8859-1', 'pd_de.iso88591': 'pd_DE.ISO8859-1', @@ -1156,6 +1257,7 @@ 'pt_pt.88591': 'pt_PT.ISO8859-1', 'pt_pt.iso88591': 'pt_PT.ISO8859-1', 'pt_pt.iso885915': 'pt_PT.ISO8859-15', + 'pt_pt.iso885915 at euro': 'pt_PT.ISO8859-15', 'pt_pt.utf8 at euro': 'pt_PT.UTF-8', 'pt_pt at euro': 'pt_PT.ISO8859-15', 'ro': 'ro_RO.ISO8859-2', @@ -1174,13 +1276,19 @@ 'ru_ua.microsoftcp1251': 'ru_UA.CP1251', 'rumanian': 'ro_RO.ISO8859-2', 'russian': 'ru_RU.ISO8859-5', + 'rw': 'rw_RW.ISO8859-1', + 'rw_rw': 'rw_RW.ISO8859-1', + 'rw_rw.iso88591': 'rw_RW.ISO8859-1', 'se_no': 'se_NO.UTF-8', - 'serbocroatian': 'sh_YU.ISO8859-2', - 'sh': 'sh_YU.ISO8859-2', + 'serbocroatian': 'sr_CS.ISO8859-2', + 'sh': 'sr_CS.ISO8859-2', 'sh_hr': 'sh_HR.ISO8859-2', - 'sh_hr.iso88592': 'sh_HR.ISO8859-2', - 'sh_sp': 'sh_YU.ISO8859-2', - 'sh_yu': 'sh_YU.ISO8859-2', + 'sh_hr.iso88592': 'hr_HR.ISO8859-2', + 'sh_sp': 'sr_CS.ISO8859-2', + 'sh_yu': 'sr_CS.ISO8859-2', + 'si': 'si_LK.UTF-8', + 'si_lk': 'si_LK.UTF-8', + 'sinhala': 'si_LK.UTF-8', 'sk': 'sk_SK.ISO8859-2', 'sk_sk': 'sk_SK.ISO8859-2', 'sk_sk.iso88592': 'sk_SK.ISO8859-2', @@ -1191,8 +1299,8 @@ 'slovak': 'sk_SK.ISO8859-2', 'slovene': 'sl_SI.ISO8859-2', 'slovenian': 'sl_SI.ISO8859-2', - 'sp': 'sp_YU.ISO8859-5', - 'sp_yu': 'sp_YU.ISO8859-5', + 'sp': 'sr_CS.ISO8859-5', + 'sp_yu': 'sr_CS.ISO8859-5', 'spanish': 'es_ES.ISO8859-1', 'spanish.iso88591': 'es_ES.ISO8859-1', 'spanish_spain': 'es_ES.ISO8859-1', @@ -1200,21 +1308,35 @@ 'sq': 'sq_AL.ISO8859-2', 'sq_al': 'sq_AL.ISO8859-2', 'sq_al.iso88592': 'sq_AL.ISO8859-2', - 'sr': 'sr_YU.ISO8859-5', - 'sr at cyrillic': 'sr_YU.ISO8859-5', - 'sr_sp': 'sr_SP.ISO8859-2', - 'sr_yu': 'sr_YU.ISO8859-5', - 'sr_yu.cp1251 at cyrillic': 'sr_YU.CP1251', - 'sr_yu.iso88592': 'sr_YU.ISO8859-2', - 'sr_yu.iso88595': 'sr_YU.ISO8859-5', - 'sr_yu.iso88595 at cyrillic': 'sr_YU.ISO8859-5', - 'sr_yu.microsoftcp1251 at cyrillic': 'sr_YU.CP1251', - 'sr_yu.utf8 at cyrillic': 'sr_YU.UTF-8', - 'sr_yu at cyrillic': 'sr_YU.ISO8859-5', + 'sr': 'sr_CS.ISO8859-5', + 'sr at cyrillic': 'sr_CS.ISO8859-5', + 'sr at latn': 'sr_CS.ISO8859-2', + 'sr_cs.iso88592': 'sr_CS.ISO8859-2', + 'sr_cs.iso88592 at latn': 'sr_CS.ISO8859-2', + 'sr_cs.iso88595': 'sr_CS.ISO8859-5', + 'sr_cs.utf8 at latn': 'sr_CS.UTF-8', + 'sr_cs at latn': 'sr_CS.ISO8859-2', + 'sr_sp': 'sr_CS.ISO8859-2', + 'sr_yu': 'sr_CS.ISO8859-5', + 'sr_yu.cp1251 at cyrillic': 'sr_CS.CP1251', + 'sr_yu.iso88592': 'sr_CS.ISO8859-2', + 'sr_yu.iso88595': 'sr_CS.ISO8859-5', + 'sr_yu.iso88595 at cyrillic': 'sr_CS.ISO8859-5', + 'sr_yu.microsoftcp1251 at cyrillic': 'sr_CS.CP1251', + 'sr_yu.utf8 at cyrillic': 'sr_CS.UTF-8', + 'sr_yu at cyrillic': 'sr_CS.ISO8859-5', + 'ss': 'ss_ZA.ISO8859-1', + 'ss_za': 'ss_ZA.ISO8859-1', + 'ss_za.iso88591': 'ss_ZA.ISO8859-1', + 'st': 'st_ZA.ISO8859-1', + 'st_za': 'st_ZA.ISO8859-1', + 'st_za.iso88591': 'st_ZA.ISO8859-1', 'sv': 'sv_SE.ISO8859-1', 'sv_fi': 'sv_FI.ISO8859-1', 'sv_fi.iso88591': 'sv_FI.ISO8859-1', 'sv_fi.iso885915': 'sv_FI.ISO8859-15', + 'sv_fi.iso885915 at euro': 'sv_FI.ISO8859-15', + 'sv_fi.utf8 at euro': 'sv_FI.UTF-8', 'sv_fi at euro': 'sv_FI.ISO8859-15', 'sv_se': 'sv_SE.ISO8859-1', 'sv_se.88591': 'sv_SE.ISO8859-1', @@ -1239,9 +1361,15 @@ 'tl': 'tl_PH.ISO8859-1', 'tl_ph': 'tl_PH.ISO8859-1', 'tl_ph.iso88591': 'tl_PH.ISO8859-1', + 'tn': 'tn_ZA.ISO8859-15', + 'tn_za': 'tn_ZA.ISO8859-15', + 'tn_za.iso885915': 'tn_ZA.ISO8859-15', 'tr': 'tr_TR.ISO8859-9', 'tr_tr': 'tr_TR.ISO8859-9', 'tr_tr.iso88599': 'tr_TR.ISO8859-9', + 'ts': 'ts_ZA.ISO8859-1', + 'ts_za': 'ts_ZA.ISO8859-1', + 'ts_za.iso88591': 'ts_ZA.ISO8859-1', 'tt': 'tt_RU.TATAR-CYR', 'tt_ru': 'tt_RU.TATAR-CYR', 'tt_ru.koi8c': 'tt_RU.KOI8-C', @@ -1263,6 +1391,11 @@ 'ur_pk.microsoftcp1256': 'ur_PK.CP1256', 'uz': 'uz_UZ.UTF-8', 'uz_uz': 'uz_UZ.UTF-8', + 'uz_uz.iso88591': 'uz_UZ.ISO8859-1', + 'uz_uz.utf8 at cyrillic': 'uz_UZ.UTF-8', + 'uz_uz at cyrillic': 'uz_UZ.UTF-8', + 've': 've_ZA.UTF-8', + 've_za': 've_ZA.UTF-8', 'vi': 'vi_VN.TCVN', 'vi_vn': 'vi_VN.TCVN', 'vi_vn.tcvn': 'vi_VN.TCVN', @@ -1273,7 +1406,11 @@ 'wa_be': 'wa_BE.ISO8859-1', 'wa_be.iso88591': 'wa_BE.ISO8859-1', 'wa_be.iso885915': 'wa_BE.ISO8859-15', + 'wa_be.iso885915 at euro': 'wa_BE.ISO8859-15', 'wa_be at euro': 'wa_BE.ISO8859-15', + 'xh': 'xh_ZA.ISO8859-1', + 'xh_za': 'xh_ZA.ISO8859-1', + 'xh_za.iso88591': 'xh_ZA.ISO8859-1', 'yi': 'yi_US.CP1255', 'yi_us': 'yi_US.CP1255', 'yi_us.cp1255': 'yi_US.CP1255', @@ -1291,6 +1428,10 @@ 'zh_tw': 'zh_TW.big5', 'zh_tw.big5': 'zh_TW.big5', 'zh_tw.euc': 'zh_TW.eucTW', + 'zh_tw.euctw': 'zh_TW.eucTW', + 'zu': 'zu_ZA.ISO8859-1', + 'zu_za': 'zu_ZA.ISO8859-1', + 'zu_za.iso88591': 'zu_ZA.ISO8859-1', } # Modified: python/branches/tlee-ast-optimize/Lib/poplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/poplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/poplib.py Sun Jun 1 17:18:10 2008 @@ -76,7 +76,8 @@ """ - def __init__(self, host, port=POP3_PORT, timeout=None): + def __init__(self, host, port=POP3_PORT, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.host = host self.port = port self.sock = socket.create_connection((host, port), timeout) Modified: python/branches/tlee-ast-optimize/Lib/smtplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/smtplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/smtplib.py Sun Jun 1 17:18:10 2008 @@ -220,7 +220,8 @@ ehlo_resp = None does_esmtp = 0 - def __init__(self, host='', port=0, local_hostname=None, timeout=None): + def __init__(self, host='', port=0, local_hostname=None, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Initialize a new instance. If specified, `host' is the name of the remote host to which to @@ -741,7 +742,8 @@ certificate chain file for the SSL connection. """ def __init__(self, host='', port=0, local_hostname=None, - keyfile=None, certfile=None, timeout=None): + keyfile=None, certfile=None, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.keyfile = keyfile self.certfile = certfile SMTP.__init__(self, host, port, local_hostname, timeout) Modified: python/branches/tlee-ast-optimize/Lib/socket.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/socket.py (original) +++ python/branches/tlee-ast-optimize/Lib/socket.py Sun Jun 1 17:18:10 2008 @@ -480,14 +480,17 @@ raise StopIteration return line +_GLOBAL_DEFAULT_TIMEOUT = object() -def create_connection(address, timeout=None): - """Connect to address (host, port) with an optional timeout. +def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT): + """Connect to *address* and return the socket object. - Provides access to socketobject timeout for higher-level - protocols. Passing a timeout will set the timeout on the - socket instance (if not present, or passed as None, the - default global timeout setting will be used). + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`getdefaulttimeout` + is used. """ msg = "getaddrinfo returns an empty list" @@ -497,7 +500,7 @@ sock = None try: sock = socket(af, socktype, proto) - if timeout is not None: + if timeout is not _GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) sock.connect(sa) return sock Modified: python/branches/tlee-ast-optimize/Lib/sqlite3/test/dbapi.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/sqlite3/test/dbapi.py (original) +++ python/branches/tlee-ast-optimize/Lib/sqlite3/test/dbapi.py Sun Jun 1 17:18:10 2008 @@ -297,6 +297,15 @@ self.cu.execute("update test set name='bar'") self.failUnlessEqual(self.cu.rowcount, 2) + def CheckRowcountSelect(self): + """ + pysqlite does not know the rowcount of SELECT statements, because we + don't fetch all rows after executing the select statement. The rowcount + has thus to be -1. + """ + self.cu.execute("select 5 union select 6") + self.failUnlessEqual(self.cu.rowcount, -1) + def CheckRowcountExecutemany(self): self.cu.execute("delete from test") self.cu.executemany("insert into test(name) values (?)", [(1,), (2,), (3,)]) Modified: python/branches/tlee-ast-optimize/Lib/sre_parse.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/sre_parse.py (original) +++ python/branches/tlee-ast-optimize/Lib/sre_parse.py Sun Jun 1 17:18:10 2008 @@ -139,8 +139,6 @@ return self.data[index] def __setitem__(self, index, code): self.data[index] = code - def __getslice__(self, start, stop): - return SubPattern(self.pattern, self.data[start:stop]) def insert(self, index, code): self.data.insert(index, code) def append(self, code): Modified: python/branches/tlee-ast-optimize/Lib/subprocess.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/subprocess.py (original) +++ python/branches/tlee-ast-optimize/Lib/subprocess.py Sun Jun 1 17:18:10 2008 @@ -661,8 +661,10 @@ self.stdin.close() elif self.stdout: stdout = self.stdout.read() + self.stdout.close() elif self.stderr: stderr = self.stderr.read() + self.stderr.close() self.wait() return (stdout, stderr) Modified: python/branches/tlee-ast-optimize/Lib/tarfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/tarfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/tarfile.py Sun Jun 1 17:18:10 2008 @@ -692,7 +692,6 @@ if self.mode == "w": raw = self.bz2obj.flush() self.fileobj.write(raw) - self.fileobj.close() # class _BZ2Proxy #------------------------ Modified: python/branches/tlee-ast-optimize/Lib/telnetlib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/telnetlib.py (original) +++ python/branches/tlee-ast-optimize/Lib/telnetlib.py Sun Jun 1 17:18:10 2008 @@ -184,13 +184,13 @@ """ - def __init__(self, host=None, port=0, timeout=None): + def __init__(self, host=None, port=0, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Constructor. When called without arguments, create an unconnected instance. - With a hostname argument, it connects the instance; a port - number is optional. - + With a hostname argument, it connects the instance; port number + and timeout are optional. """ self.debuglevel = DEBUGLEVEL self.host = host @@ -208,23 +208,21 @@ if host is not None: self.open(host, port, timeout) - def open(self, host, port=0, timeout=None): + def open(self, host, port=0, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """Connect to a host. The optional second argument is the port number, which defaults to the standard telnet port (23). Don't try to reopen an already connected instance. - """ self.eof = 0 if not port: port = TELNET_PORT self.host = host self.port = port - if timeout is not None: - self.timeout = timeout - self.sock = socket.create_connection((host, port), self.timeout) + self.timeout = timeout + self.sock = socket.create_connection((host, port), timeout) def __del__(self): """Destructor -- close the connection.""" Modified: python/branches/tlee-ast-optimize/Lib/test/pydoc_mod.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/pydoc_mod.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/pydoc_mod.py Sun Jun 1 17:18:10 2008 @@ -25,30 +25,3 @@ def nodoc_func(): pass -"""This is a test module for test_pydoc""" - -__author__ = "Benjamin Peterson" -__credits__ = "Nobody" -__version__ = "1.2.3.4" - - -class A: - """Hello and goodbye""" - def __init__(): - """Wow, I have no function!""" - pass - -class B(object): - NO_MEANING = "eggs" - pass - -def doc_func(): - """ - This function solves all of the world's problems: - hunger - lack of Python - war - """ - -def nodoc_func(): - pass Modified: python/branches/tlee-ast-optimize/Lib/test/test___all__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test___all__.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test___all__.py Sun Jun 1 17:18:10 2008 @@ -144,6 +144,7 @@ self.check_all("tarfile") self.check_all("telnetlib") self.check_all("tempfile") + self.check_all("test.test_support") self.check_all("textwrap") self.check_all("threading") self.check_all("timeit") Modified: python/branches/tlee-ast-optimize/Lib/test/test_bsddb3.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_bsddb3.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_bsddb3.py Sun Jun 1 17:18:10 2008 @@ -52,13 +52,13 @@ def test_main(): from bsddb import db from bsddb.test import test_all - test_all.get_new_path.prefix = os.path.join(tempfile.gettempdir(), - 'z-test_bsddb3-%s' % - os.getpid()) + test_all.set_test_path_prefix(os.path.join(tempfile.gettempdir(), + 'z-test_bsddb3-%s' % + os.getpid())) # Please leave this print in, having this show up in the buildbots # makes diagnosing problems a lot easier. print >>sys.stderr, db.DB_VERSION_STRING - print >>sys.stderr, 'Test path prefix: ', test_all.get_new_path.prefix + print >>sys.stderr, 'Test path prefix: ', test_all.get_test_path_prefix() try: run_unittest(test_all.suite(module_prefix='bsddb.test.', timing_check=TimingCheck)) @@ -67,7 +67,7 @@ # one lying around. This might be by a different user, so just # ignore errors. We should always make a unique name now. try: - rmtree(test_all.get_new_path.prefix) + test_all.remove_test_path_directory() except: pass Modified: python/branches/tlee-ast-optimize/Lib/test/test_ftplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_ftplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_ftplib.py Sun Jun 1 17:18:10 2008 @@ -53,35 +53,52 @@ # connects ftp = ftplib.FTP(HOST) self.evt.wait() - ftp.sock.close() + ftp.close() def testTimeoutDefault(self): - # default - ftp = ftplib.FTP(HOST) + # default -- use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(ftp.sock.gettimeout(), 30) + self.evt.wait() + ftp.close() + + def testTimeoutNone(self): + # no timeout -- do not use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + ftp = ftplib.FTP("localhost", timeout=None) + finally: + socket.setdefaulttimeout(None) self.assertTrue(ftp.sock.gettimeout() is None) self.evt.wait() - ftp.sock.close() + ftp.close() def testTimeoutValue(self): # a value ftp = ftplib.FTP(HOST, timeout=30) self.assertEqual(ftp.sock.gettimeout(), 30) self.evt.wait() - ftp.sock.close() + ftp.close() def testTimeoutConnect(self): ftp = ftplib.FTP() ftp.connect(HOST, timeout=30) self.assertEqual(ftp.sock.gettimeout(), 30) self.evt.wait() - ftp.sock.close() + ftp.close() def testTimeoutDifferentOrder(self): ftp = ftplib.FTP(timeout=30) ftp.connect(HOST) self.assertEqual(ftp.sock.gettimeout(), 30) self.evt.wait() - ftp.sock.close() + ftp.close() def testTimeoutDirectAccess(self): ftp = ftplib.FTP() @@ -89,18 +106,6 @@ ftp.connect(HOST) self.assertEqual(ftp.sock.gettimeout(), 30) self.evt.wait() - ftp.sock.close() - - def testTimeoutNone(self): - # None, having other default - previous = socket.getdefaulttimeout() - socket.setdefaulttimeout(30) - try: - ftp = ftplib.FTP(HOST, timeout=None) - finally: - socket.setdefaulttimeout(previous) - self.assertEqual(ftp.sock.gettimeout(), 30) - self.evt.wait() ftp.close() Modified: python/branches/tlee-ast-optimize/Lib/test/test_httplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_httplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_httplib.py Sun Jun 1 17:18:10 2008 @@ -214,27 +214,32 @@ '''This will prove that the timeout gets through HTTPConnection and into the socket. ''' - # default - httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT) - httpConn.connect() - self.assertTrue(httpConn.sock.gettimeout() is None) - httpConn.close() - - # a value - httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) - httpConn.connect() + # default -- use global socket timeout + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT) + httpConn.connect() + finally: + socket.setdefaulttimeout(None) self.assertEqual(httpConn.sock.gettimeout(), 30) httpConn.close() - # None, having other default - previous = socket.getdefaulttimeout() + # no timeout -- do not use global socket default + self.assert_(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=None) httpConn.connect() finally: - socket.setdefaulttimeout(previous) + socket.setdefaulttimeout(None) + self.assertEqual(httpConn.sock.gettimeout(), None) + httpConn.close() + + # a value + httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30) + httpConn.connect() self.assertEqual(httpConn.sock.gettimeout(), 30) httpConn.close() Modified: python/branches/tlee-ast-optimize/Lib/test/test_math.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_math.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_math.py Sun Jun 1 17:18:10 2008 @@ -740,7 +740,7 @@ OverflowError), ([2.**1023, 2.**1023, -1e307], OverflowError), ([1e16, 1., 1e-16], 10000000000000002.0), - ([1e16-2., 1.-2.**53, -(1e16-2.), -(1.-2.**53)], 0.0), + ([1e16-2., 1.-2.**-53, -(1e16-2.), -(1.-2.**-53)], 0.0), ] for i, (vals, s) in enumerate(test_values): Modified: python/branches/tlee-ast-optimize/Lib/test/test_poplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_poplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_poplib.py Sun Jun 1 17:18:10 2008 @@ -40,28 +40,29 @@ pop.sock.close() def testTimeoutDefault(self): - # default - pop = poplib.POP3(HOST, self.port) - self.assertTrue(pop.sock.gettimeout() is None) - pop.sock.close() - - def testTimeoutValue(self): - # a value - pop = poplib.POP3(HOST, self.port, timeout=30) + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + pop = poplib.POP3("localhost", self.port) + finally: + socket.setdefaulttimeout(None) self.assertEqual(pop.sock.gettimeout(), 30) pop.sock.close() def testTimeoutNone(self): - # None, having other default - previous = socket.getdefaulttimeout() + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: pop = poplib.POP3(HOST, self.port, timeout=None) finally: - socket.setdefaulttimeout(previous) - self.assertEqual(pop.sock.gettimeout(), 30) + socket.setdefaulttimeout(None) + self.assertTrue(pop.sock.gettimeout() is None) pop.sock.close() + def testTimeoutValue(self): + pop = poplib.POP3("localhost", self.port, timeout=30) + self.assertEqual(pop.sock.gettimeout(), 30) + pop.sock.close() def test_main(verbose=None): Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py Sun Jun 1 17:18:10 2008 @@ -207,15 +207,32 @@ for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"): mod = __import__(path_mod) with catch_warning() as w: - # Since os3exmpath just imports it from ntpath - warnings.simplefilter("always") - mod.walk(".", dumbo, None) + mod.walk("crashers", dumbo, None) self.assertEquals(str(w.message), msg) + def test_commands_members(self): + import commands + members = {"mk2arg" : 2, "mkarg" : 1, "getstatus" : 1} + for name, arg_count in members.items(): + with catch_warning(record=False): + warnings.filterwarnings("error") + func = getattr(commands, name) + self.assertRaises(DeprecationWarning, func, *([None]*arg_count)) + + def test_mutablestring_removal(self): + # UserString.MutableString has been removed in 3.0. + import UserString + with catch_warning(record=False): + warnings.filterwarnings("error", ".*MutableString", + DeprecationWarning) + self.assertRaises(DeprecationWarning, UserString.MutableString) + def test_main(): - run_unittest(TestPy3KWarnings, - TestStdlibRemovals) + with catch_warning(record=True): + warnings.simplefilter("always") + run_unittest(TestPy3KWarnings, + TestStdlibRemovals) if __name__ == '__main__': test_main() Modified: python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py Sun Jun 1 17:18:10 2008 @@ -54,41 +54,43 @@ def testBasic1(self): # connects smtp = smtplib.SMTP(HOST, self.port) - smtp.sock.close() + smtp.close() def testBasic2(self): # connects, include port in host name smtp = smtplib.SMTP("%s:%s" % (HOST, self.port)) - smtp.sock.close() + smtp.close() def testLocalHostName(self): # check that supplied local_hostname is used smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost") self.assertEqual(smtp.local_hostname, "testhost") - smtp.sock.close() + smtp.close() def testTimeoutDefault(self): - # default - smtp = smtplib.SMTP(HOST, self.port) - self.assertTrue(smtp.sock.gettimeout() is None) - smtp.sock.close() - - def testTimeoutValue(self): - # a value - smtp = smtplib.SMTP(HOST, self.port, timeout=30) + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + smtp = smtplib.SMTP(HOST, self.port) + finally: + socket.setdefaulttimeout(None) self.assertEqual(smtp.sock.gettimeout(), 30) - smtp.sock.close() + smtp.close() def testTimeoutNone(self): - # None, having other default - previous = socket.getdefaulttimeout() + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: smtp = smtplib.SMTP(HOST, self.port, timeout=None) finally: - socket.setdefaulttimeout(previous) + socket.setdefaulttimeout(None) + self.assertTrue(smtp.sock.gettimeout() is None) + smtp.close() + + def testTimeoutValue(self): + smtp = smtplib.SMTP(HOST, self.port, timeout=30) self.assertEqual(smtp.sock.gettimeout(), 30) - smtp.sock.close() + smtp.close() # Test server thread using the specified SMTP server class Modified: python/branches/tlee-ast-optimize/Lib/test/test_socket.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_socket.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_socket.py Sun Jun 1 17:18:10 2008 @@ -901,8 +901,25 @@ testTimeoutDefault = _justAccept def _testTimeoutDefault(self): - self.cli = socket.create_connection((HOST, self.port)) - self.assertTrue(self.cli.gettimeout() is None) + # passing no explicit timeout uses socket's global default + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(42) + try: + self.cli = socket.create_connection((HOST, self.port)) + finally: + socket.setdefaulttimeout(None) + self.assertEquals(self.cli.gettimeout(), 42) + + testTimeoutNone = _justAccept + def _testTimeoutNone(self): + # None timeout means the same as sock.settimeout(None) + self.assert_(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + self.cli = socket.create_connection((HOST, self.port), timeout=None) + finally: + socket.setdefaulttimeout(None) + self.assertEqual(self.cli.gettimeout(), None) testTimeoutValueNamed = _justAccept def _testTimeoutValueNamed(self): @@ -914,17 +931,6 @@ self.cli = socket.create_connection((HOST, self.port), 30) self.assertEqual(self.cli.gettimeout(), 30) - testTimeoutNone = _justAccept - def _testTimeoutNone(self): - previous = socket.getdefaulttimeout() - socket.setdefaulttimeout(30) - try: - self.cli = socket.create_connection((HOST, self.port), timeout=None) - finally: - socket.setdefaulttimeout(previous) - self.assertEqual(self.cli.gettimeout(), 30) - - class NetworkConnectionBehaviourTest(SocketTCPTest, ThreadableTest): def __init__(self, methodName='runTest'): Modified: python/branches/tlee-ast-optimize/Lib/test/test_subprocess.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_subprocess.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_subprocess.py Sun Jun 1 17:18:10 2008 @@ -287,14 +287,12 @@ stderr=subprocess.PIPE) (stdout, stderr) = p.communicate() self.assertEqual(stdout, None) - # When running with a pydebug build, the # of references is outputted - # to stderr, so just check if stderr at least started with "pinapple" - self.assert_(stderr.startswith("pineapple")) + self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple") def test_communicate(self): p = subprocess.Popen([sys.executable, "-c", - 'import sys,os;' \ - 'sys.stderr.write("pineapple");' \ + 'import sys,os;' + 'sys.stderr.write("pineapple");' 'sys.stdout.write(sys.stdin.read())'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, @@ -304,6 +302,22 @@ self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple") + # This test is Linux specific for simplicity to at least have + # some coverage. It is not a platform specific bug. + if os.path.isdir('/proc/%d/fd' % os.getpid()): + # Test for the fd leak reported in http://bugs.python.org/issue2791. + def test_communicate_pipe_fd_leak(self): + fd_directory = '/proc/%d/fd' % os.getpid() + num_fds_before_popen = len(os.listdir(fd_directory)) + p = subprocess.Popen([sys.executable, '-c', 'print()'], + stdout=subprocess.PIPE) + p.communicate() + num_fds_after_communicate = len(os.listdir(fd_directory)) + del p + num_fds_after_destruction = len(os.listdir(fd_directory)) + self.assertEqual(num_fds_before_popen, num_fds_after_destruction) + self.assertEqual(num_fds_before_popen, num_fds_after_communicate) + def test_communicate_returns(self): # communicate() should return None if no redirection is active p = subprocess.Popen([sys.executable, "-c", Modified: python/branches/tlee-ast-optimize/Lib/test/test_support.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_support.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_support.py Sun Jun 1 17:18:10 2008 @@ -13,6 +13,19 @@ import warnings import unittest +__all__ = ["Error", "TestFailed", "TestSkipped", "ResourceDenied", "import_module", + "verbose", "use_resources", "max_memuse", "record_original_stdout", + "get_original_stdout", "unload", "unlink", "rmtree", "forget", + "is_resource_enabled", "requires", "find_unused_port", "bind_port", + "fcmp", "have_unicode", "is_jython", "TESTFN", "HOST", "FUZZ", + "findfile", "verify", "vereq", "sortdict", "check_syntax_error", + "open_urlresource", "WarningMessage", "catch_warning", "CleanImport", + "EnvironmentVarGuard", "TransientResource", "captured_output", + "captured_stdout", "TransientResource", "transient_internet", + "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest", + "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", + "threading_cleanup", "reap_children"] + class Error(Exception): """Base class for regression test exceptions.""" @@ -584,11 +597,7 @@ _1G = 1024 * _1M _2G = 2 * _1G -# Hack to get at the maximum value an internal index can take. -class _Dummy: - def __getslice__(self, i, j): - return j -MAX_Py_ssize_t = _Dummy()[:] +MAX_Py_ssize_t = sys.maxsize def set_memlimit(limit): import re Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Sun Jun 1 17:18:10 2008 @@ -385,6 +385,26 @@ ## self.assert_(r[0][2] > 100, r[0][2]) ## self.assert_(r[1][2] > 100, r[1][2]) + def test_ioencoding(self): + import subprocess,os + env = dict(os.environ) + + # Test character: cent sign, encoded as 0x4A (ASCII J) in CP424, + # not representable in ASCII. + + env["PYTHONIOENCODING"] = "cp424" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, unichr(0xa2).encode("cp424")) + + env["PYTHONIOENCODING"] = "ascii:replace" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, '?') + + def test_main(): test.test_support.run_unittest(SysModuleTest) Modified: python/branches/tlee-ast-optimize/Lib/test/test_tarfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_tarfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_tarfile.py Sun Jun 1 17:18:10 2008 @@ -529,7 +529,19 @@ self.assertEqual(float(tarinfo.pax_headers["ctime"]), 1041808783.0) -class WriteTest(unittest.TestCase): +class WriteTestBase(unittest.TestCase): + # Put all write tests in here that are supposed to be tested + # in all possible mode combinations. + + def test_fileobj_no_close(self): + fobj = StringIO.StringIO() + tar = tarfile.open(fileobj=fobj, mode=self.mode) + tar.addfile(tarfile.TarInfo("foo")) + tar.close() + self.assert_(fobj.closed is False, "external fileobjs must never closed") + + +class WriteTest(WriteTestBase): mode = "w:" @@ -652,7 +664,7 @@ shutil.rmtree(tempdir) -class StreamWriteTest(unittest.TestCase): +class StreamWriteTest(WriteTestBase): mode = "w|" Modified: python/branches/tlee-ast-optimize/Lib/test/test_telnetlib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_telnetlib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_telnetlib.py Sun Jun 1 17:18:10 2008 @@ -40,34 +40,36 @@ telnet.sock.close() def testTimeoutDefault(self): - # default - telnet = telnetlib.Telnet(HOST, self.port) - self.assertTrue(telnet.sock.gettimeout() is None) - telnet.sock.close() - - def testTimeoutValue(self): - # a value - telnet = telnetlib.Telnet(HOST, self.port, timeout=30) - self.assertEqual(telnet.sock.gettimeout(), 30) - telnet.sock.close() - - def testTimeoutDifferentOrder(self): - telnet = telnetlib.Telnet(timeout=30) - telnet.open(HOST, self.port) + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet("localhost", self.port) + finally: + socket.setdefaulttimeout(None) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() def testTimeoutNone(self): # None, having other default - previous = socket.getdefaulttimeout() + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: telnet = telnetlib.Telnet(HOST, self.port, timeout=None) finally: - socket.setdefaulttimeout(previous) + socket.setdefaulttimeout(None) + self.assertTrue(telnet.sock.gettimeout() is None) + telnet.sock.close() + + def testTimeoutValue(self): + telnet = telnetlib.Telnet("localhost", self.port, timeout=30) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() + def testTimeoutOpen(self): + telnet = telnetlib.Telnet() + telnet.open("localhost", self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() def test_main(verbose=None): Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllib.py Sun Jun 1 17:18:10 2008 @@ -568,6 +568,7 @@ # . Facundo # # def server(evt): +# import socket, time # serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # serv.settimeout(3) # serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) @@ -592,6 +593,7 @@ # class FTPWrapperTests(unittest.TestCase): # # def setUp(self): +# import ftplib, time, threading # ftplib.FTP.port = 9093 # self.evt = threading.Event() # threading.Thread(target=server, args=(self.evt,)).start() @@ -603,31 +605,37 @@ # def testBasic(self): # # connects # ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) -# ftp.ftp.sock.close() +# ftp.close() # -# def testTimeoutDefault(self): -# # default -# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) -# self.assertTrue(ftp.ftp.sock.gettimeout() is None) -# ftp.ftp.sock.close() -# -# def testTimeoutValue(self): -# # a value -# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) +# def testTimeoutNone(self): +# # global default timeout is ignored +# import socket +# self.assert_(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) # self.assertEqual(ftp.ftp.sock.gettimeout(), 30) -# ftp.ftp.sock.close() +# ftp.close() # -# def testTimeoutNone(self): -# # None, having other default -# previous = socket.getdefaulttimeout() +# def testTimeoutDefault(self): +# # global default timeout is used +# import socket +# self.assert_(socket.getdefaulttimeout() is None) # socket.setdefaulttimeout(30) # try: # ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) # finally: -# socket.setdefaulttimeout(previous) +# socket.setdefaulttimeout(None) # self.assertEqual(ftp.ftp.sock.gettimeout(), 30) -# ftp.ftp.close() +# ftp.close() # +# def testTimeoutValue(self): +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], +# timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllib2.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllib2.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllib2.py Sun Jun 1 17:18:10 2008 @@ -2,6 +2,7 @@ from test import test_support import os +import socket import StringIO import urllib2 @@ -551,14 +552,15 @@ class NullFTPHandler(urllib2.FTPHandler): def __init__(self, data): self.data = data - def connect_ftp(self, user, passwd, host, port, dirs, timeout=None): + def connect_ftp(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.user, self.passwd = user, passwd self.host, self.port = host, port self.dirs = dirs self.ftpwrapper = MockFTPWrapper(self.data) return self.ftpwrapper - import ftplib, socket + import ftplib data = "rheum rhaponicum" h = NullFTPHandler(data) o = h.parent = MockOpener() @@ -691,7 +693,7 @@ self.req_headers = [] self.data = None self.raise_on_endheaders = False - def __call__(self, host, timeout=None): + def __call__(self, host, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.host = host self.timeout = timeout return self Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py Sun Jun 1 17:18:10 2008 @@ -189,46 +189,58 @@ class TimeoutTest(unittest.TestCase): def test_http_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) u = _urlopen_with_retry("http://www.python.org") self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - def test_http_NoneWithdefault(self): - prev = socket.getdefaulttimeout() + def test_http_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry("http://www.python.org") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) + + def test_http_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(60) try: u = _urlopen_with_retry("http://www.python.org", timeout=None) - self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) finally: - socket.setdefaulttimeout(prev) + socket.setdefaulttimeout(None) + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - def test_http_Value(self): + def test_http_timeout(self): u = _urlopen_with_retry("http://www.python.org", timeout=120) self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) - def test_http_NoneNodefault(self): - u = _urlopen_with_retry("http://www.python.org", timeout=None) - self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/" def test_ftp_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) u = _urlopen_with_retry(self.FTP_HOST) self.assertTrue(u.fp.fp._sock.gettimeout() is None) - def test_ftp_NoneWithdefault(self): - prev = socket.getdefaulttimeout() + def test_ftp_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(60) try: - u = _urlopen_with_retry(self.FTP_HOST, timeout=None) - self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + u = _urlopen_with_retry(self.FTP_HOST) finally: - socket.setdefaulttimeout(prev) + socket.setdefaulttimeout(None) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) - def test_ftp_NoneNodefault(self): - u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + def test_ftp_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + finally: + socket.setdefaulttimeout(None) self.assertTrue(u.fp.fp._sock.gettimeout() is None) - def test_ftp_Value(self): + def test_ftp_timeout(self): u = _urlopen_with_retry(self.FTP_HOST, timeout=60) self.assertEqual(u.fp.fp._sock.gettimeout(), 60) Modified: python/branches/tlee-ast-optimize/Lib/test/test_userstring.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_userstring.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_userstring.py Sun Jun 1 17:18:10 2008 @@ -4,8 +4,8 @@ import string from test import test_support, string_tests - from UserString import UserString, MutableString +import warnings class UserStringTest( string_tests.CommonTest, @@ -135,7 +135,10 @@ self.assertEqual(s, "") def test_main(): - test_support.run_unittest(UserStringTest, MutableStringTest) + with test_support.catch_warning(record=False): + warnings.filterwarnings("ignore", ".*MutableString", + DeprecationWarning) + test_support.run_unittest(UserStringTest, MutableStringTest) if __name__ == "__main__": test_main() Modified: python/branches/tlee-ast-optimize/Lib/urllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/urllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/urllib.py Sun Jun 1 17:18:10 2008 @@ -832,7 +832,8 @@ class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" - def __init__(self, user, passwd, host, port, dirs, timeout=None): + def __init__(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.user = user self.passwd = passwd self.host = host Modified: python/branches/tlee-ast-optimize/Lib/urllib2.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/urllib2.py (original) +++ python/branches/tlee-ast-optimize/Lib/urllib2.py Sun Jun 1 17:18:10 2008 @@ -117,7 +117,7 @@ __version__ = sys.version[:3] _opener = None -def urlopen(url, data=None, timeout=None): +def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): global _opener if _opener is None: _opener = build_opener() @@ -359,7 +359,7 @@ if result is not None: return result - def open(self, fullurl, data=None, timeout=None): + def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): # accept a URL or a Request object if isinstance(fullurl, basestring): req = Request(fullurl, data) Modified: python/branches/tlee-ast-optimize/Lib/xmlrpclib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/xmlrpclib.py (original) +++ python/branches/tlee-ast-optimize/Lib/xmlrpclib.py Sun Jun 1 17:18:10 2008 @@ -897,6 +897,7 @@ self.append(int(data)) self._value = 0 dispatch["i4"] = end_int + dispatch["i8"] = end_int dispatch["int"] = end_int def end_double(self, data): Modified: python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c Sun Jun 1 17:18:10 2008 @@ -77,17 +77,17 @@ if (!PyArg_ParseTuple(args, "l", &n)) return NULL; - v = PyString_FromStringAndSize((char *)NULL, n); + v = PyBytes_FromStringAndSize((char *)NULL, n); if (v == NULL) return NULL; - err = FSRead(self->fRefNum, &n, PyString_AsString(v)); + err = FSRead(self->fRefNum, &n, PyBytes_AsString(v)); if (err && err != eofErr) { PyMac_Error(err); Py_DECREF(v); return NULL; } - _PyString_Resize(&v, n); + _PyBytes_Resize(&v, n); return v; } @@ -301,8 +301,8 @@ return NULL; if ((err = FSpGetFInfo(&fss, &info)) != noErr) return PyErr_Mac(MacOS_Error, err); - creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4); - type = PyString_FromStringAndSize((char *)&info.fdType, 4); + creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4); + type = PyBytes_FromStringAndSize((char *)&info.fdType, 4); res = Py_BuildValue("OO", creator, type); Py_DECREF(creator); Py_DECREF(type); @@ -623,7 +623,7 @@ ** some of the image and sound processing interfaces on the mac:-( */ { - PyStringObject *p = 0; + PyBytesObject *p = 0; long off = (long)&(p->ob_sval[0]); if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0) Modified: python/branches/tlee-ast-optimize/Mac/Modules/Nav.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/Nav.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/Nav.c Sun Jun 1 17:18:10 2008 @@ -139,11 +139,11 @@ NavGetDefaultDialogOptions(opt); while ( PyDict_Next(d, &pos, &key, &value) ) { - if ( !key || !value || !PyString_Check(key) ) { + if ( !key || !value || !PyBytes_Check(key) ) { PyErr_SetString(ErrorObject, "DialogOption has non-string key"); return 0; } - keystr = PyString_AsString(key); + keystr = PyBytes_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { PyErr_NoMemory(); @@ -932,7 +932,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Nav.error"); + ErrorObject = PyBytes_FromString("Nav.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c Sun Jun 1 17:18:10 2008 @@ -835,9 +835,9 @@ OSErr err; size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) + if ( (res = PyBytes_FromStringAndSize(NULL, size)) == NULL ) return NULL; - if ( (ptr = PyString_AsString(res)) == NULL ) + if ( (ptr = PyBytes_AsString(res)) == NULL ) return NULL; if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) return PyMac_Error(err); Modified: python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c Sun Jun 1 17:18:10 2008 @@ -392,7 +392,7 @@ { char buf[100]; sprintf(buf, "", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFTypeRefObj_hash(CFTypeRefObject *self) @@ -596,7 +596,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFArrayRefObj_hash(CFArrayRefObject *self) @@ -836,7 +836,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self) @@ -1029,7 +1029,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self) @@ -1206,7 +1206,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyString_FromStringAndSize(data, size); + _res = (PyObject *)PyBytes_FromStringAndSize(data, size); return _res; } @@ -1437,7 +1437,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDataRefObj_hash(CFDataRefObject *self) @@ -1702,7 +1702,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyString_FromString(data); + _res = (PyObject *)PyBytes_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) Modified: python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c Sun Jun 1 17:18:10 2008 @@ -146,7 +146,7 @@ int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ return (*dst != NULL); } #endif - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ CFIndex size; UniChar *unichars; - if (PyString_Check(src)) { + if (PyBytes_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); Modified: python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c Sun Jun 1 17:18:10 2008 @@ -915,7 +915,7 @@ size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); - rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); + rv = PyBytes_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; @@ -1315,7 +1315,7 @@ PyMac_Error(err); return NULL; } - _res = PyString_FromString(strbuf); + _res = PyBytes_FromString(strbuf); return _res; } @@ -1372,7 +1372,7 @@ static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSSpec_set_data NULL @@ -1393,7 +1393,7 @@ self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #define FSSpec_hash NULL @@ -1925,7 +1925,7 @@ static PyObject *FSRef_get_data(FSRefObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSRef_set_data NULL @@ -3038,7 +3038,7 @@ if (!PyArg_ParseTuple(_args, "O", &obj)) return NULL; - if (PyString_Check(obj)) { + if (PyBytes_Check(obj)) { Py_INCREF(obj); return obj; } @@ -3201,7 +3201,7 @@ } /* On OSX we now try a pathname */ - if ( PyString_Check(v) || PyUnicode_Check(v)) { + if ( PyBytes_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; Modified: python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c Sun Jun 1 17:18:10 2008 @@ -1457,7 +1457,7 @@ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } @@ -1510,14 +1510,14 @@ static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); } #define BMObj_set_bitmap_data NULL static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); } #define BMObj_set_pixmap_data NULL @@ -6500,10 +6500,10 @@ int rowbytes; char *data; - if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, + if ( !PyArg_ParseTuple(_args, "O!iO&", &PyBytes_Type, &source, &rowbytes, PyMac_GetRect, &bounds) ) return NULL; - data = PyString_AsString(source); + data = PyBytes_AsString(source); if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) return PyErr_NoMemory(); ptr->baseAddr = (Ptr)data; @@ -6527,15 +6527,15 @@ BitMap *ptr; PyObject *source; - if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) + if ( !PyArg_ParseTuple(_args, "O!", &PyBytes_Type, &source) ) return NULL; - if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { + if ( PyBytes_Size(source) != sizeof(BitMap) && PyBytes_Size(source) != sizeof(PixMap) ) { PyErr_Format(PyExc_TypeError, "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)", - PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); + PyBytes_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } - ptr = (BitMapPtr)PyString_AsString(source); + ptr = (BitMapPtr)PyBytes_AsString(source); if ( (_res = BMObj_New(ptr)) == NULL ) { return NULL; } Modified: python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c Sun Jun 1 17:18:10 2008 @@ -608,7 +608,7 @@ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) ) return NULL; cp = GetPixBaseAddr(pm)+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } Modified: python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c Sun Jun 1 17:18:10 2008 @@ -520,7 +520,7 @@ state = HGetState(self->ob_itself); HLock(self->ob_itself); - res = PyString_FromStringAndSize( + res = PyBytes_FromStringAndSize( *self->ob_itself, GetHandleSize(self->ob_itself)); HUnlock(self->ob_itself); @@ -537,10 +537,10 @@ if ( v == NULL ) return -1; - if ( !PyString_Check(v) ) + if ( !PyBytes_Check(v) ) return -1; - size = PyString_Size(v); - data = PyString_AsString(v); + size = PyBytes_Size(v); + data = PyBytes_AsString(v); /* XXXX Do I need the GetState/SetState calls? */ SetHandleSize(self->ob_itself, size); if ( MemError()) Modified: python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c Sun Jun 1 17:18:10 2008 @@ -105,12 +105,12 @@ flavorType, &byteCount); if (_err != noErr) return PyMac_Error(_err); - _res = PyString_FromStringAndSize(NULL, (int)byteCount); + _res = PyBytes_FromStringAndSize(NULL, (int)byteCount); if ( _res == NULL ) return NULL; _err = GetScrapFlavorData(_self->ob_itself, flavorType, &byteCount, - PyString_AS_STRING(_res)); + PyBytes_AS_STRING(_res)); if (_err != noErr) { Py_XDECREF(_res); return PyMac_Error(_err); Modified: python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c Sun Jun 1 17:18:10 2008 @@ -500,7 +500,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Sndihooks.error"); + ErrorObject = PyBytes_FromString("Sndihooks.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c Sun Jun 1 17:18:10 2008 @@ -2580,7 +2580,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int WinObj_hash(WindowObject *self) Modified: python/branches/tlee-ast-optimize/Makefile.pre.in ============================================================================== --- python/branches/tlee-ast-optimize/Makefile.pre.in (original) +++ python/branches/tlee-ast-optimize/Makefile.pre.in Sun Jun 1 17:18:10 2008 @@ -303,6 +303,7 @@ Objects/boolobject.o \ Objects/bufferobject.o \ Objects/bytes_methods.o \ + Objects/bytearrayobject.o \ Objects/bytesobject.o \ Objects/cellobject.o \ Objects/classobject.o \ @@ -329,7 +330,6 @@ Objects/rangeobject.o \ Objects/setobject.o \ Objects/sliceobject.o \ - Objects/stringobject.o \ Objects/structseq.o \ Objects/tupleobject.o \ Objects/typeobject.o \ @@ -585,6 +585,7 @@ Include/bitset.h \ Include/boolobject.h \ Include/bytes_methods.h \ + Include/bytearrayobject.h \ Include/bytesobject.h \ Include/bufferobject.h \ Include/cellobject.h \ Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sun Jun 1 17:18:10 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- New environment variable PYTHONIOENCODING. + - Patch #2488: Add sys.maxsize. - Issue #2353: file.xreadlines() now emits a Py3k warning. @@ -36,6 +38,9 @@ Extension Modules ----------------- +- The heapq module does comparisons using LT instead of LE. This + makes its implementation match that used by list.sort(). + - Issue #2819: add full-precision summation function to math module, based on Hettinger's ASPN Python Cookbook recipe. @@ -63,6 +68,21 @@ Library ------- +- Issue #3011: locale module alias table was updated to the latest version + from the X.org locale.alias file + +- Issue #1797 (partial fix): ctypes NULL function pointers have a + False boolean value now. + +- Issue #2985: Allow 64-bit integer responses (````) in XMLRPC + transfers. + +- Issue #2877: The UserString.MutableString class has been removed in + Python 3.0. + +- Do not close external file objects passed to tarfile.open(mode='w:bz2') + when the TarFile is closed. + - Issue #2959: For consistency with other file-like objects, gzip's GzipFile.close() can now be called multiple times without raising an exception. @@ -233,6 +253,17 @@ - ``Lib/lib-old`` is now added to sys.path. +C API +----- + +- Add ``PyType_Modified()`` as a public API to clear the type cache. + +- The PyBytes functions have been renamed to PyByteArray. + +- The PyString functions have been renamed to PyBytes. A batch of + defines were added so that the linker still sees the original + PyString names. + What's New in Python 2.6 alpha 3? ================================= @@ -400,8 +431,7 @@ which provide the functions through their libm. The files also contains several helpers and constants for math. -- Added a new convenience function, PyErr_WarnPy3k, for issuing Py3k - warnings. +- Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings. What's New in Python 2.6 alpha 2? Modified: python/branches/tlee-ast-optimize/Modules/_bsddb.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_bsddb.c (original) +++ python/branches/tlee-ast-optimize/Modules/_bsddb.c Sun Jun 1 17:18:10 2008 @@ -104,6 +104,17 @@ typedef int Py_ssize_t; #endif +#if (PY_VERSION_HEX < 0x02060000) /* really: before python trunk r63675 */ +/* This code now uses PyBytes* API function names instead of PyString*. + * These #defines map to their equivalent on earlier python versions. */ +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_FromString PyString_FromString +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define PyBytes_Check PyString_Check +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define PyBytes_AS_STRING PyString_AS_STRING +#endif + #ifdef WITH_THREAD /* These are for when calling Python --> C */ @@ -398,7 +409,7 @@ /* no need to do anything, the structure has already been zeroed */ } - else if (PyString_Check(keyobj)) { + else if (PyBytes_Check(keyobj)) { /* verify access method type */ type = _DB_get_type(self); if (type == -1) @@ -417,15 +428,15 @@ * the code check for DB_THREAD and forceably set DBT_MALLOC * when we otherwise would leave flags 0 to indicate that. */ - key->data = malloc(PyString_GET_SIZE(keyobj)); + key->data = malloc(PyBytes_GET_SIZE(keyobj)); if (key->data == NULL) { PyErr_SetString(PyExc_MemoryError, "Key memory allocation failed"); return 0; } - memcpy(key->data, PyString_AS_STRING(keyobj), - PyString_GET_SIZE(keyobj)); + memcpy(key->data, PyBytes_AS_STRING(keyobj), + PyBytes_GET_SIZE(keyobj)); key->flags = DB_DBT_REALLOC; - key->size = PyString_GET_SIZE(keyobj); + key->size = PyBytes_GET_SIZE(keyobj); } else if (PyInt_Check(keyobj)) { @@ -535,7 +546,7 @@ p=DummyString; assert(s==0); } - return PyString_FromStringAndSize(p,s); + return PyBytes_FromStringAndSize(p,s); } static PyObject *BuildValue_S(const void *p,int s) @@ -1291,12 +1302,12 @@ else if (PyInt_Check(result)) { retval = PyInt_AsLong(result); } - else if (PyString_Check(result)) { + else if (PyBytes_Check(result)) { char* data; Py_ssize_t size; CLEAR_DBT(*secKey); - PyString_AsStringAndSize(result, &data, &size); + PyBytes_AsStringAndSize(result, &data, &size); secKey->flags = DB_DBT_APPMALLOC; /* DB will free */ secKey->data = malloc(size); /* TODO, check this */ if (secKey->data) { @@ -4412,7 +4423,7 @@ if (!retp) break; flags=DB_NEXT; /* Prepare for next loop pass */ for (i=0; ibuf, self->string_size); + return PyBytes_FromStringAndSize(self->buf, self->string_size); } PyDoc_STRVAR(isatty_doc, @@ -244,7 +244,7 @@ output = self->buf + self->pos; self->pos += size; - return PyString_FromStringAndSize(output, size); + return PyBytes_FromStringAndSize(output, size); } @@ -307,7 +307,7 @@ self->pos -= size; } - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(readlines_doc, @@ -349,7 +349,7 @@ return NULL; while ((n = get_line(self, &output)) != 0) { - line = PyString_FromStringAndSize(output, n); + line = PyBytes_FromStringAndSize(output, n); if (!line) goto on_error; if (PyList_Append(result, line) == -1) { @@ -455,7 +455,7 @@ if (!next || n == 0) return NULL; - return PyString_FromStringAndSize(next, n); + return PyBytes_FromStringAndSize(next, n); } PyDoc_STRVAR(seek_doc, Modified: python/branches/tlee-ast-optimize/Modules/_codecsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_codecsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_codecsmodule.c Sun Jun 1 17:18:10 2008 @@ -168,7 +168,7 @@ if (!PyArg_ParseTuple(args, "s#|z:escape_decode", &data, &size, &errors)) return NULL; - return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), + return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL), size); } @@ -182,21 +182,21 @@ Py_ssize_t len; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyString_Type, &str, &errors)) + &PyBytes_Type, &str, &errors)) return NULL; - str = PyString_Repr(str, 0); + str = PyBytes_Repr(str, 0); if (!str) return NULL; /* The string will be quoted. Unquote, similar to unicode-escape. */ - buf = PyString_AS_STRING (str); - len = PyString_GET_SIZE (str); + buf = PyBytes_AS_STRING (str); + len = PyBytes_GET_SIZE (str); memmove(buf, buf+1, len-2); - if (_PyString_Resize(&str, len-2) < 0) + if (_PyBytes_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyString_Size(str)); + return codec_tuple(str, PyBytes_Size(str)); } #ifdef Py_USING_UNICODE @@ -640,7 +640,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } @@ -656,7 +656,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } @@ -676,13 +676,13 @@ if (PyUnicode_Check(obj)) { data = PyUnicode_AS_DATA(obj); size = PyUnicode_GET_DATA_SIZE(obj); - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } } Modified: python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c Sun Jun 1 17:18:10 2008 @@ -668,7 +668,7 @@ if (i != 0) { if (i < 0) return NULL; - return PyString_FromString("[...]"); + return PyBytes_FromString("[...]"); } aslist = PySequence_List(deque); @@ -677,16 +677,16 @@ return NULL; } if (((dequeobject *)deque)->maxlen != -1) - fmt = PyString_FromFormat("deque(%%r, maxlen=%i)", + fmt = PyBytes_FromFormat("deque(%%r, maxlen=%i)", ((dequeobject *)deque)->maxlen); else - fmt = PyString_FromString("deque(%r)"); + fmt = PyBytes_FromString("deque(%r)"); if (fmt == NULL) { Py_DECREF(aslist); Py_ReprLeave(deque); return NULL; } - result = PyString_Format(fmt, aslist); + result = PyBytes_Format(fmt, aslist); Py_DECREF(fmt); Py_DECREF(aslist); Py_ReprLeave(deque); @@ -1298,14 +1298,14 @@ if (baserepr == NULL) return NULL; if (dd->default_factory == NULL) - defrepr = PyString_FromString("None"); + defrepr = PyBytes_FromString("None"); else { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { if (status < 0) return NULL; - defrepr = PyString_FromString("..."); + defrepr = PyBytes_FromString("..."); } else defrepr = PyObject_Repr(dd->default_factory); @@ -1315,9 +1315,9 @@ Py_DECREF(baserepr); return NULL; } - result = PyString_FromFormat("defaultdict(%s, %s)", - PyString_AS_STRING(defrepr), - PyString_AS_STRING(baserepr)); + result = PyBytes_FromFormat("defaultdict(%s, %s)", + PyBytes_AS_STRING(defrepr), + PyBytes_AS_STRING(baserepr)); Py_DECREF(defrepr); Py_DECREF(baserepr); return result; Modified: python/branches/tlee-ast-optimize/Modules/_csv.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_csv.c (original) +++ python/branches/tlee-ast-optimize/Modules/_csv.c Sun Jun 1 17:18:10 2008 @@ -176,7 +176,7 @@ return Py_None; } else - return PyString_FromStringAndSize((char*)&c, 1); + return PyBytes_FromStringAndSize((char*)&c, 1); } static PyObject * @@ -235,16 +235,16 @@ if (src == NULL) *target = dflt; else { - if (src == Py_None || PyString_Size(src) == 0) + if (src == Py_None || PyBytes_Size(src) == 0) *target = '\0'; - else if (!PyString_Check(src) || PyString_Size(src) != 1) { + else if (!PyBytes_Check(src) || PyBytes_Size(src) != 1) { PyErr_Format(PyExc_TypeError, "\"%s\" must be an 1-character string", name); return -1; } else { - char *s = PyString_AsString(src); + char *s = PyBytes_AsString(src); if (s == NULL) return -1; *target = s[0]; @@ -257,7 +257,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) { if (src == NULL) - *target = PyString_FromString(dflt); + *target = PyBytes_FromString(dflt); else { if (src == Py_None) *target = NULL; @@ -528,7 +528,7 @@ { PyObject *field; - field = PyString_FromStringAndSize(self->field, self->field_len); + field = PyBytes_FromStringAndSize(self->field, self->field_len); if (field == NULL) return -1; self->field_len = 0; @@ -787,8 +787,8 @@ } ++self->line_num; - line = PyString_AsString(lineobj); - linelen = PyString_Size(lineobj); + line = PyBytes_AsString(lineobj); + linelen = PyBytes_Size(lineobj); if (line == NULL || linelen < 0) { Py_DECREF(lineobj); @@ -976,7 +976,7 @@ rec_len++;\ } while(0) - lineterm = PyString_AsString(dialect->lineterminator); + lineterm = PyBytes_AsString(dialect->lineterminator); if (lineterm == NULL) return -1; @@ -1101,7 +1101,7 @@ int terminator_len; char *terminator; - terminator_len = PyString_Size(self->dialect->lineterminator); + terminator_len = PyBytes_Size(self->dialect->lineterminator); if (terminator_len == -1) return 0; @@ -1109,7 +1109,7 @@ if (!join_check_rec_size(self, self->rec_len + terminator_len)) return 0; - terminator = PyString_AsString(self->dialect->lineterminator); + terminator = PyBytes_AsString(self->dialect->lineterminator); if (terminator == NULL) return 0; memmove(self->rec + self->rec_len, terminator, terminator_len); @@ -1161,9 +1161,9 @@ break; } - if (PyString_Check(field)) { + if (PyBytes_Check(field)) { append_ok = join_append(self, - PyString_AS_STRING(field), + PyBytes_AS_STRING(field), "ed, len == 1); Py_DECREF(field); } @@ -1179,7 +1179,7 @@ if (str == NULL) return NULL; - append_ok = join_append(self, PyString_AS_STRING(str), + append_ok = join_append(self, PyBytes_AS_STRING(str), "ed, len == 1); Py_DECREF(str); } Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c Sun Jun 1 17:18:10 2008 @@ -477,7 +477,7 @@ static PyObject * CDataType_from_buffer_copy(PyObject *type, PyObject *args) { - void *buffer; + const void *buffer; Py_ssize_t buffer_len; Py_ssize_t offset = 0; PyObject *obj, *result; @@ -684,8 +684,8 @@ if (-1 == PyType_Type.tp_setattro(self, key, value)) return -1; - if (value && PyString_Check(key) && - 0 == strcmp(PyString_AS_STRING(key), "_fields_")) + if (value && PyBytes_Check(key) && + 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 1); return 0; } @@ -698,8 +698,8 @@ if (-1 == PyObject_GenericSetAttr(self, key, value)) return -1; - if (PyString_Check(key) && - 0 == strcmp(PyString_AS_STRING(key), "_fields_")) + if (PyBytes_Check(key) && + 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 0); return 0; } @@ -1025,7 +1025,7 @@ size = Py_TYPE(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr); if (size < 0) return -1; - } else if (-1 == PyString_AsStringAndSize(value, &ptr, &size)) { + } else if (-1 == PyBytes_AsStringAndSize(value, &ptr, &size)) { return -1; } if (size > self->b_size) { @@ -1042,7 +1042,7 @@ static PyObject * CharArray_get_raw(CDataObject *self) { - return PyString_FromStringAndSize(self->b_ptr, self->b_size); + return PyBytes_FromStringAndSize(self->b_ptr, self->b_size); } static PyObject * @@ -1053,7 +1053,7 @@ for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') break; - return PyString_FromStringAndSize(self->b_ptr, i); + return PyBytes_FromStringAndSize(self->b_ptr, i); } static int @@ -1074,14 +1074,14 @@ conversion_mode_errors); if (!value) return -1; - } else if (!PyString_Check(value)) { + } else if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "string expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else Py_INCREF(value); - size = PyString_GET_SIZE(value); + size = PyBytes_GET_SIZE(value); if (size > self->b_size) { PyErr_SetString(PyExc_ValueError, "string too long"); @@ -1089,7 +1089,7 @@ return -1; } - ptr = PyString_AS_STRING(value); + ptr = PyBytes_AS_STRING(value); memcpy(self->b_ptr, ptr, size); if (size < self->b_size) self->b_ptr[size] = '\0'; @@ -1128,7 +1128,7 @@ "can't delete attribute"); return -1; } - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1402,7 +1402,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyUnicode_Check(value) || PyString_Check(value)) { + if (PyUnicode_Check(value) || PyBytes_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("Z"); @@ -1466,7 +1466,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyString_Check(value) || PyUnicode_Check(value)) { + if (PyBytes_Check(value) || PyUnicode_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1552,7 +1552,7 @@ return (PyObject *)parg; } /* string */ - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1623,10 +1623,10 @@ } /* c_char_p, c_wchar_p */ stgd = PyObject_stgdict(value); - if (stgd && CDataObject_Check(value) && stgd->proto && PyString_Check(stgd->proto)) { + if (stgd && CDataObject_Check(value) && stgd->proto && PyBytes_Check(stgd->proto)) { PyCArgObject *parg; - switch (PyString_AS_STRING(stgd->proto)[0]) { + switch (PyBytes_AS_STRING(stgd->proto)[0]) { case 'z': /* c_char_p */ case 'Z': /* c_wchar_p */ parg = new_CArgObject(); @@ -1683,13 +1683,13 @@ if (suffix == NULL) #ifdef WORDS_BIGENDIAN - suffix = PyString_InternFromString("_le"); + suffix = PyBytes_InternFromString("_le"); #else - suffix = PyString_InternFromString("_be"); + suffix = PyBytes_InternFromString("_be"); #endif Py_INCREF(name); - PyString_Concat(&name, suffix); + PyBytes_Concat(&name, suffix); if (name == NULL) return NULL; @@ -1744,7 +1744,7 @@ dict = PyObject_stgdict((PyObject *)self); assert(dict); /* Cannot be NULL for CDataObject instances */ - fmt = PyString_AsString(dict->proto); + fmt = PyBytes_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -1779,9 +1779,9 @@ proto = PyObject_GetAttrString((PyObject *)result, "_type_"); /* new ref */ if (!proto - || !PyString_Check(proto) - || 1 != strlen(PyString_AS_STRING(proto)) - || !strchr(SIMPLE_TYPE_CHARS, PyString_AS_STRING(proto)[0])) { + || !PyBytes_Check(proto) + || 1 != strlen(PyBytes_AS_STRING(proto)) + || !strchr(SIMPLE_TYPE_CHARS, PyBytes_AS_STRING(proto)[0])) { PyErr_Format(PyExc_AttributeError, "class must define a '_type_' attribute which must be\n" "a single character string containing one of '%s'.", @@ -1790,12 +1790,12 @@ Py_DECREF(result); return NULL; } - fmt = getentry(PyString_AS_STRING(proto)); + fmt = getentry(PyBytes_AS_STRING(proto)); if (fmt == NULL) { Py_DECREF(result); PyErr_Format(PyExc_ValueError, "_type_ '%s' not supported", - PyString_AS_STRING(proto)); + PyBytes_AS_STRING(proto)); return NULL; } @@ -1835,7 +1835,7 @@ Overrides the SimpleType_from_param generic method. */ if (result->tp_base == &Simple_Type) { - switch (PyString_AS_STRING(proto)[0]) { + switch (PyBytes_AS_STRING(proto)[0]) { case 'z': /* c_char_p */ ml = &c_char_p_method; stgdict->flags |= TYPEFLAG_ISPOINTER; @@ -1940,7 +1940,7 @@ assert(dict); /* I think we can rely on this being a one-character string */ - fmt = PyString_AsString(dict->proto); + fmt = PyBytes_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -2290,7 +2290,7 @@ #endif target = target->b_base; } - return PyString_FromStringAndSize(string, cp-string); + return PyBytes_FromStringAndSize(string, cp-string); } /* @@ -2435,7 +2435,7 @@ _unpickle, Py_TYPE(_self), PyObject_GetAttrString(_self, "__dict__"), - PyString_FromStringAndSize(self->b_ptr, self->b_size)); + PyBytes_FromStringAndSize(self->b_ptr, self->b_size)); } static PyObject * @@ -2984,9 +2984,9 @@ dict = PyType_stgdict(arg); if (dict /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ - && PyString_Check(dict->proto) + && PyBytes_Check(dict->proto) /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ - && (strchr("PzZ", PyString_AS_STRING(dict->proto)[0]))) { + && (strchr("PzZ", PyBytes_AS_STRING(dict->proto)[0]))) { return 1; } @@ -3071,8 +3071,8 @@ return 1; } #endif - if (PyString_Check(obj) || PyUnicode_Check(obj)) { - *pname = PyString_AsString(obj); + if (PyBytes_Check(obj) || PyUnicode_Check(obj)) { + *pname = PyBytes_AsString(obj); return *pname ? 1 : 0; } PyErr_SetString(PyExc_TypeError, @@ -3422,7 +3422,7 @@ /* We HAVE already checked that the tuple can be parsed with "i|zO", so... */ Py_ssize_t tsize = PyTuple_GET_SIZE(item); flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0)); - name = tsize > 1 ? PyString_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; + name = tsize > 1 ? PyBytes_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL; switch (flag & (PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID)) { @@ -3476,7 +3476,7 @@ "NULL stgdict unexpected"); goto error; } - if (PyString_Check(dict->proto)) { + if (PyBytes_Check(dict->proto)) { PyErr_Format( PyExc_TypeError, "%s 'out' parameter must be passed as default value", @@ -3774,16 +3774,36 @@ { #ifdef MS_WIN32 if (self->index) - return PyString_FromFormat("", + return PyBytes_FromFormat("", self->index - 0x1000, Py_TYPE(self)->tp_name, self); #endif - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } +static int +Pointer_nonzero(CDataObject *self) +{ + return *(void **)self->b_ptr != NULL; +} + +static PyNumberMethods Pointer_as_number = { + 0, /* nb_add */ + 0, /* nb_subtract */ + 0, /* nb_multiply */ + 0, /* nb_divide */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + (inquiry)Pointer_nonzero, /* nb_nonzero */ +}; + PyTypeObject CFuncPtr_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_ctypes.CFuncPtr", @@ -3795,7 +3815,7 @@ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)CFuncPtr_repr, /* tp_repr */ - 0, /* tp_as_number */ + &Pointer_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ @@ -3888,7 +3908,7 @@ } if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyString_AsString(name); + char *field = PyBytes_AsString(name); if (field == NULL) { PyErr_Clear(); field = "???"; @@ -4090,7 +4110,7 @@ type, so this cannot be NULL */ if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = (char *)self->b_ptr; - return PyString_FromStringAndSize(ptr + ilow, len); + return PyBytes_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; @@ -4147,9 +4167,9 @@ char *dest; if (slicelen <= 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (step == 1) { - return PyString_FromStringAndSize(ptr + start, + return PyBytes_FromStringAndSize(ptr + start, slicelen); } dest = (char *)PyMem_Malloc(slicelen); @@ -4162,7 +4182,7 @@ dest[i] = ptr[cur]; } - np = PyString_FromStringAndSize(dest, slicelen); + np = PyBytes_FromStringAndSize(dest, slicelen); PyMem_Free(dest); return np; } @@ -4572,12 +4592,12 @@ static PyObject *format; if (Py_TYPE(self)->tp_base != &Simple_Type) { - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } if (format == NULL) { - format = PyString_InternFromString("%s(%r)"); + format = PyBytes_InternFromString("%s(%r)"); if (format == NULL) return NULL; } @@ -4586,7 +4606,7 @@ if (val == NULL) return NULL; - name = PyString_FromString(Py_TYPE(self)->tp_name); + name = PyBytes_FromString(Py_TYPE(self)->tp_name); if (name == NULL) { Py_DECREF(val); return NULL; @@ -4598,7 +4618,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; } @@ -4832,7 +4852,7 @@ assert(itemdict); if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = *(char **)self->b_ptr; - return PyString_FromStringAndSize(ptr + ilow, len); + return PyBytes_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; @@ -4929,9 +4949,9 @@ char *dest; if (len <= 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (step == 1) { - return PyString_FromStringAndSize(ptr + start, + return PyBytes_FromStringAndSize(ptr + start, len); } dest = (char *)PyMem_Malloc(len); @@ -4940,7 +4960,7 @@ for (cur = start, i = 0; i < len; cur += step, i++) { dest[i] = ptr[cur]; } - np = PyString_FromStringAndSize(dest, len); + np = PyBytes_FromStringAndSize(dest, len); PyMem_Free(dest); return np; } @@ -5003,26 +5023,6 @@ Pointer_subscript, }; -static int -Pointer_nonzero(CDataObject *self) -{ - return *(void **)self->b_ptr != NULL; -} - -static PyNumberMethods Pointer_as_number = { - 0, /* nb_add */ - 0, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - (inquiry)Pointer_nonzero, /* nb_nonzero */ -}; - PyTypeObject Pointer_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_ctypes._Pointer", @@ -5140,7 +5140,7 @@ ++methods; } - s = PyString_FromString(comerror_doc); + s = PyBytes_FromString(comerror_doc); if (s == NULL) goto error; status = PyDict_SetItemString(dict, "__doc__", s); @@ -5166,8 +5166,8 @@ string_at(const char *ptr, int size) { if (size == -1) - return PyString_FromString(ptr); - return PyString_FromStringAndSize(ptr, size); + return PyBytes_FromString(ptr); + return PyBytes_FromStringAndSize(ptr, size); } static int @@ -5181,8 +5181,8 @@ return 1; dict = PyType_stgdict(arg); if (dict) { - if (PyString_Check(dict->proto) - && (strchr("sPzUZXO", PyString_AS_STRING(dict->proto)[0]))) { + if (PyBytes_Check(dict->proto) + && (strchr("sPzUZXO", PyBytes_AS_STRING(dict->proto)[0]))) { /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ return 1; } Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c Sun Jun 1 17:18:10 2008 @@ -107,15 +107,15 @@ PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_srcfile = PyString_FromString(filename); + py_srcfile = PyBytes_FromString(filename); if (!py_srcfile) goto bad; - py_funcname = PyString_FromString(funcname); + py_funcname = PyBytes_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyDict_New(); if (!py_globals) goto bad; empty_tuple = PyTuple_New(0); if (!empty_tuple) goto bad; - empty_string = PyString_FromString(""); + empty_string = PyBytes_FromString(""); if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ @@ -460,7 +460,7 @@ static PyObject *context; if (context == NULL) - context = PyString_InternFromString("_ctypes.DllGetClassObject"); + context = PyBytes_InternFromString("_ctypes.DllGetClassObject"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { @@ -539,7 +539,7 @@ static PyObject *context; if (context == NULL) - context = PyString_InternFromString("_ctypes.DllCanUnloadNow"); + context = PyBytes_InternFromString("_ctypes.DllCanUnloadNow"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c Sun Jun 1 17:18:10 2008 @@ -370,7 +370,7 @@ self->tag, self); break; } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } static PyMemberDef PyCArgType_members[] = { @@ -518,9 +518,9 @@ return 0; } - if (PyString_Check(obj)) { + if (PyBytes_Check(obj)) { pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyString_AS_STRING(obj); + pa->value.p = PyBytes_AS_STRING(obj); Py_INCREF(obj); pa->keep = obj; return 0; @@ -781,7 +781,7 @@ PyObject *tp, *v, *tb, *s, *cls_str, *msg_str; va_start(vargs, fmt); - s = PyString_FromFormatV(fmt, vargs); + s = PyBytes_FromFormatV(fmt, vargs); va_end(vargs); if (!s) return; @@ -790,18 +790,18 @@ PyErr_NormalizeException(&tp, &v, &tb); cls_str = PyObject_Str(tp); if (cls_str) { - PyString_ConcatAndDel(&s, cls_str); - PyString_ConcatAndDel(&s, PyString_FromString(": ")); + PyBytes_ConcatAndDel(&s, cls_str); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(": ")); if (s == NULL) goto error; } else PyErr_Clear(); msg_str = PyObject_Str(v); if (msg_str) - PyString_ConcatAndDel(&s, msg_str); + PyBytes_ConcatAndDel(&s, msg_str); else { PyErr_Clear(); - PyString_ConcatAndDel(&s, PyString_FromString("???")); + PyBytes_ConcatAndDel(&s, PyBytes_FromString("???")); if (s == NULL) goto error; } @@ -1105,7 +1105,7 @@ if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) return NULL; #ifdef _UNICODE - name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); + name = alloca((PyBytes_Size(nameobj) + 1) * sizeof(WCHAR)); if (!name) { PyErr_NoMemory(); return NULL; @@ -1113,14 +1113,14 @@ { int r; - char *aname = PyString_AsString(nameobj); + char *aname = PyBytes_AsString(nameobj); if(!aname) return NULL; - r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyString_Size(nameobj) + 1); + r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyBytes_Size(nameobj) + 1); name[r] = 0; } #else - name = PyString_AsString(nameobj); + name = PyBytes_AsString(nameobj); if(!name) return NULL; #endif @@ -1613,9 +1613,9 @@ Py_INCREF(result); return result; } - if (PyString_CheckExact(cls)) { - buf = alloca(strlen(PyString_AS_STRING(cls)) + 3 + 1); - sprintf(buf, "LP_%s", PyString_AS_STRING(cls)); + if (PyBytes_CheckExact(cls)) { + buf = alloca(strlen(PyBytes_AS_STRING(cls)) + 3 + 1); + sprintf(buf, "LP_%s", PyBytes_AS_STRING(cls)); result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type), "s(O){}", buf, Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c Sun Jun 1 17:18:10 2008 @@ -272,7 +272,7 @@ name = ((PyTypeObject *)self->proto)->tp_name; if (bits) - result = PyString_FromFormat( + result = PyBytes_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -280,7 +280,7 @@ #endif name, self->offset, size, bits); else - result = PyString_FromFormat( + result = PyBytes_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -1164,12 +1164,12 @@ static PyObject * c_set(void *ptr, PyObject *value, Py_ssize_t size) { - if (!PyString_Check(value) || (1 != PyString_Size(value))) { + if (!PyBytes_Check(value) || (1 != PyBytes_Size(value))) { PyErr_Format(PyExc_TypeError, "one character string expected"); return NULL; } - *(char *)ptr = PyString_AS_STRING(value)[0]; + *(char *)ptr = PyBytes_AS_STRING(value)[0]; _RET(value); } @@ -1177,7 +1177,7 @@ static PyObject * c_get(void *ptr, Py_ssize_t size) { - return PyString_FromStringAndSize((char *)ptr, 1); + return PyBytes_FromStringAndSize((char *)ptr, 1); } #ifdef CTYPES_UNICODE @@ -1187,7 +1187,7 @@ { Py_ssize_t len; - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1262,7 +1262,7 @@ /* It's easier to calculate in characters than in bytes */ length /= sizeof(wchar_t); - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1301,21 +1301,21 @@ PyObject *result; size_t slen; - result = PyString_FromString((char *)ptr); + result = PyBytes_FromString((char *)ptr); if (!result) return NULL; /* chop off at the first NUL character, if any. * On error, result will be deallocated and set to NULL. */ - slen = strlen(PyString_AS_STRING(result)); + slen = strlen(PyBytes_AS_STRING(result)); size = min(size, (Py_ssize_t)slen); if (result->ob_refcnt == 1) { /* shorten the result */ - _PyString_Resize(&result, size); + _PyBytes_Resize(&result, size); return result; } else /* cannot shorten the result */ - return PyString_FromStringAndSize(ptr, size); + return PyBytes_FromStringAndSize(ptr, size); } static PyObject * @@ -1324,7 +1324,7 @@ char *data; Py_ssize_t size; - data = PyString_AsString(value); + data = PyBytes_AsString(value); if (!data) return NULL; size = strlen(data); @@ -1356,8 +1356,8 @@ Py_INCREF(value); return value; } - if (PyString_Check(value)) { - *(char **)ptr = PyString_AS_STRING(value); + if (PyBytes_Check(value)) { + *(char **)ptr = PyBytes_AS_STRING(value); Py_INCREF(value); return value; } else if (PyUnicode_Check(value)) { @@ -1366,7 +1366,7 @@ conversion_mode_errors); if (str == NULL) return NULL; - *(char **)ptr = PyString_AS_STRING(str); + *(char **)ptr = PyBytes_AS_STRING(str); return str; } else if (PyInt_Check(value) || PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG @@ -1395,7 +1395,7 @@ return NULL; } #endif - return PyString_FromString(*(char **)ptr); + return PyBytes_FromString(*(char **)ptr); } else { Py_INCREF(Py_None); return Py_None; @@ -1411,7 +1411,7 @@ Py_INCREF(value); return value; } - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1502,7 +1502,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyString_Check(value)) { + } else if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); Modified: python/branches/tlee-ast-optimize/Modules/_curses_panel.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_curses_panel.c (original) +++ python/branches/tlee-ast-optimize/Modules/_curses_panel.c Sun Jun 1 17:18:10 2008 @@ -472,7 +472,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyString_FromString(PyCursesVersion); + v = PyBytes_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/_cursesmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_cursesmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_cursesmodule.c Sun Jun 1 17:18:10 2008 @@ -198,9 +198,9 @@ { if (PyInt_Check(obj)) { *ch = (chtype) PyInt_AsLong(obj); - } else if(PyString_Check(obj) - && (PyString_Size(obj) == 1)) { - *ch = (chtype) *PyString_AsString(obj); + } else if(PyBytes_Check(obj) + && (PyBytes_Size(obj) == 1)) { + *ch = (chtype) *PyBytes_AsString(obj); } else { return 0; } @@ -886,9 +886,9 @@ return Py_BuildValue("c", rtn); else #if defined(__NetBSD__) - return PyString_FromString(unctrl(rtn)); + return PyBytes_FromString(unctrl(rtn)); #else - return PyString_FromString((char *)keyname(rtn)); + return PyBytes_FromString((char *)keyname(rtn)); #endif } @@ -943,7 +943,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyString_FromString(rtn); + return PyBytes_FromString(rtn); } static PyObject * @@ -1095,7 +1095,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyString_FromString(rtn); + return PyBytes_FromString(rtn); } static PyObject * @@ -1757,7 +1757,7 @@ ch = erasechar(); - return PyString_FromStringAndSize(&ch, 1); + return PyBytes_FromStringAndSize(&ch, 1); } static PyObject * @@ -2114,7 +2114,7 @@ } knp = keyname(ch); - return PyString_FromString((knp == NULL) ? "" : (char *)knp); + return PyBytes_FromString((knp == NULL) ? "" : (char *)knp); } #endif @@ -2125,7 +2125,7 @@ ch = killchar(); - return PyString_FromStringAndSize(&ch, 1); + return PyBytes_FromStringAndSize(&ch, 1); } static PyObject * @@ -2496,7 +2496,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString( capname ); + return PyBytes_FromString( capname ); } static PyObject * @@ -2520,7 +2520,7 @@ return NULL; } - return PyString_FromString(result); + return PyBytes_FromString(result); } static PyObject * @@ -2547,14 +2547,14 @@ if (PyInt_Check(temp)) ch = (chtype) PyInt_AsLong(temp); - else if (PyString_Check(temp)) - ch = (chtype) *PyString_AsString(temp); + else if (PyBytes_Check(temp)) + ch = (chtype) *PyBytes_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; } - return PyString_FromString(unctrl(ch)); + return PyBytes_FromString(unctrl(ch)); } static PyObject * @@ -2569,8 +2569,8 @@ if (PyInt_Check(temp)) ch = (int) PyInt_AsLong(temp); - else if (PyString_Check(temp)) - ch = (int) *PyString_AsString(temp); + else if (PyBytes_Check(temp)) + ch = (int) *PyBytes_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; @@ -2753,7 +2753,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyString_FromString(PyCursesVersion); + v = PyBytes_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/_elementtree.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_elementtree.c (original) +++ python/branches/tlee-ast-optimize/Modules/_elementtree.c Sun Jun 1 17:18:10 2008 @@ -103,7 +103,7 @@ #define PyDict_CheckExact PyDict_Check #if (PY_VERSION_HEX < 0x02020000) #define PyList_CheckExact PyList_Check -#define PyString_CheckExact PyString_Check +#define PyBytes_CheckExact PyBytes_Check #if (PY_VERSION_HEX >= 0x01060000) #define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */ #endif @@ -173,7 +173,7 @@ switch (PyList_GET_SIZE(list)) { case 0: Py_DECREF(list); - return PyString_FromString(""); + return PyBytes_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); Py_INCREF(result); @@ -748,9 +748,9 @@ return 0; } #endif - if (PyString_Check(tag)) { - char *p = PyString_AS_STRING(tag); - for (i = 0; i < PyString_GET_SIZE(tag); i++) { + if (PyBytes_Check(tag)) { + char *p = PyBytes_AS_STRING(tag); + for (i = 0; i < PyBytes_GET_SIZE(tag); i++) { if (p[i] == '{') check = 0; else if (p[i] == '}') @@ -818,7 +818,7 @@ if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { PyObject* text = element_get_text(item); if (text == Py_None) - return PyString_FromString(""); + return PyBytes_FromString(""); Py_XINCREF(text); return text; } @@ -1154,12 +1154,12 @@ PyObject* repr; char buffer[100]; - repr = PyString_FromString("tag)); + PyBytes_ConcatAndDel(&repr, PyObject_Repr(self->tag)); sprintf(buffer, " at %p>", self); - PyString_ConcatAndDel(&repr, PyString_FromString(buffer)); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(buffer)); return repr; } @@ -1617,14 +1617,14 @@ Py_INCREF(data); self->data = data; } else { /* more than one item; use a list to collect items */ - if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && - PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) { + if (PyBytes_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && + PyBytes_CheckExact(data) && PyBytes_GET_SIZE(data) == 1) { /* expat often generates single character data sections; handle the most common case by resizing the existing string... */ - Py_ssize_t size = PyString_GET_SIZE(self->data); - if (_PyString_Resize(&self->data, size + 1) < 0) + Py_ssize_t size = PyBytes_GET_SIZE(self->data); + if (_PyBytes_Resize(&self->data, size + 1) < 0) return NULL; - PyString_AS_STRING(self->data)[size] = PyString_AS_STRING(data)[0]; + PyBytes_AS_STRING(self->data)[size] = PyBytes_AS_STRING(data)[0]; } else if (PyList_CheckExact(self->data)) { if (PyList_Append(self->data, data) < 0) return NULL; @@ -1896,7 +1896,7 @@ return PyUnicode_DecodeUTF8(string, size, "strict"); #endif - return PyString_FromStringAndSize(string, size); + return PyBytes_FromStringAndSize(string, size); } LOCAL(PyObject*) @@ -1910,7 +1910,7 @@ PyObject* value; /* look the 'raw' name up in the names dictionary */ - key = PyString_FromStringAndSize(string, size); + key = PyBytes_FromStringAndSize(string, size); if (!key) return NULL; @@ -1932,8 +1932,8 @@ break; if (i != size) { /* convert to universal name */ - tag = PyString_FromStringAndSize(NULL, size+1); - p = PyString_AS_STRING(tag); + tag = PyBytes_FromStringAndSize(NULL, size+1); + p = PyBytes_AS_STRING(tag); p[0] = '{'; memcpy(p+1, string, size); size++; @@ -1947,7 +1947,7 @@ #if defined(Py_USING_UNICODE) /* inline makestring, to avoid duplicating the source string if it's not an utf-8 string */ - p = PyString_AS_STRING(tag); + p = PyBytes_AS_STRING(tag); if (checkstring(p, size)) { value = PyUnicode_DecodeUTF8(p, size, "strict"); Py_DECREF(tag); @@ -2004,7 +2004,7 @@ } else { PyErr_Format( PyExc_SyntaxError, "undefined entity &%s;: line %ld, column %ld", - PyString_AS_STRING(key), + PyBytes_AS_STRING(key), EXPAT(GetErrorLineNumber)(self->parser), EXPAT(GetErrorColumnNumber)(self->parser) ); @@ -2435,13 +2435,13 @@ return NULL; } - if (!PyString_CheckExact(buffer) || PyString_GET_SIZE(buffer) == 0) { + if (!PyBytes_CheckExact(buffer) || PyBytes_GET_SIZE(buffer) == 0) { Py_DECREF(buffer); break; } res = expat_parse( - self, PyString_AS_STRING(buffer), PyString_GET_SIZE(buffer), 0 + self, PyBytes_AS_STRING(buffer), PyBytes_GET_SIZE(buffer), 0 ); Py_DECREF(buffer); @@ -2503,7 +2503,7 @@ if (event_set == Py_None) { /* default is "end" only */ - target->end_event_obj = PyString_FromString("end"); + target->end_event_obj = PyBytes_FromString("end"); Py_RETURN_NONE; } @@ -2513,9 +2513,9 @@ for (i = 0; i < PyTuple_GET_SIZE(event_set); i++) { PyObject* item = PyTuple_GET_ITEM(event_set, i); char* event; - if (!PyString_Check(item)) + if (!PyBytes_Check(item)) goto error; - event = PyString_AS_STRING(item); + event = PyBytes_AS_STRING(item); if (strcmp(event, "start") == 0) { Py_INCREF(item); target->start_event_obj = item; @@ -2587,7 +2587,7 @@ char buffer[100]; sprintf(buffer, "Expat %d.%d.%d", XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } else { PyErr_SetString(PyExc_AttributeError, name); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/_fileio.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_fileio.c (original) +++ python/branches/tlee-ast-optimize/Modules/_fileio.c Sun Jun 1 17:18:10 2008 @@ -392,14 +392,14 @@ Py_ssize_t total = 0; int n; - result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); + result = PyBytes_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); if (result == NULL) return NULL; while (1) { Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyString_GET_SIZE(result) < newsize) { - if (_PyString_Resize(&result, newsize) < 0) { + if (PyBytes_GET_SIZE(result) < newsize) { + if (_PyBytes_Resize(&result, newsize) < 0) { if (total == 0) { Py_DECREF(result); return NULL; @@ -411,7 +411,7 @@ Py_BEGIN_ALLOW_THREADS errno = 0; n = read(self->fd, - PyString_AS_STRING(result) + total, + PyBytes_AS_STRING(result) + total, newsize - total); Py_END_ALLOW_THREADS if (n == 0) @@ -430,8 +430,8 @@ total += n; } - if (PyString_GET_SIZE(result) > total) { - if (_PyString_Resize(&result, total) < 0) { + if (PyBytes_GET_SIZE(result) > total) { + if (_PyBytes_Resize(&result, total) < 0) { /* This should never happen, but just in case */ Py_DECREF(result); return NULL; @@ -460,10 +460,10 @@ return fileio_readall(self); } - bytes = PyString_FromStringAndSize(NULL, size); + bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; - ptr = PyString_AS_STRING(bytes); + ptr = PyBytes_AS_STRING(bytes); Py_BEGIN_ALLOW_THREADS errno = 0; @@ -478,7 +478,7 @@ } if (n != size) { - if (_PyString_Resize(&bytes, n) < 0) { + if (_PyBytes_Resize(&bytes, n) < 0) { Py_DECREF(bytes); return NULL; } @@ -690,9 +690,9 @@ fileio_repr(PyFileIOObject *self) { if (self->fd < 0) - return PyString_FromFormat("_fileio._FileIO(-1)"); + return PyBytes_FromFormat("_fileio._FileIO(-1)"); - return PyString_FromFormat("_fileio._FileIO(%d, '%s')", + return PyBytes_FromFormat("_fileio._FileIO(%d, '%s')", self->fd, mode_string(self)); } @@ -816,7 +816,7 @@ static PyObject * get_mode(PyFileIOObject *self, void *closure) { - return PyString_FromString(mode_string(self)); + return PyBytes_FromString(mode_string(self)); } static PyGetSetDef fileio_getsetlist[] = { Modified: python/branches/tlee-ast-optimize/Modules/_hashopenssl.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_hashopenssl.c (original) +++ python/branches/tlee-ast-optimize/Modules/_hashopenssl.c Sun Jun 1 17:18:10 2008 @@ -103,7 +103,7 @@ digest_size = EVP_MD_CTX_size(&temp_ctx); EVP_DigestFinal(&temp_ctx, digest, NULL); - retval = PyString_FromStringAndSize((const char *)digest, digest_size); + retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); EVP_MD_CTX_cleanup(&temp_ctx); return retval; } @@ -130,10 +130,10 @@ /* Create a new string */ /* NOTE: not thread safe! modifying an already created string object */ /* (not a problem because we hold the GIL by default) */ - retval = PyString_FromStringAndSize(NULL, digest_size * 2); + retval = PyBytes_FromStringAndSize(NULL, digest_size * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -220,8 +220,8 @@ { char buf[100]; PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>", - PyString_AsString(((EVPobject *)self)->name), self); - return PyString_FromString(buf); + PyBytes_AsString(((EVPobject *)self)->name), self); + return PyBytes_FromString(buf); } #if HASH_OBJ_CONSTRUCTOR @@ -421,7 +421,7 @@ /* used in the init function to setup a constructor */ #define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ - CONST_ ## NAME ## _name_obj = PyString_FromString(#NAME); \ + CONST_ ## NAME ## _name_obj = PyBytes_FromString(#NAME); \ if (EVP_get_digestbyname(#NAME)) { \ CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ Modified: python/branches/tlee-ast-optimize/Modules/_heapqmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_heapqmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_heapqmodule.c Sun Jun 1 17:18:10 2008 @@ -28,12 +28,12 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(parent, newitem, Py_LE); + cmp = PyObject_RichCompareBool(newitem, parent, Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) break; Py_INCREF(parent); Py_DECREF(PyList_GET_ITEM(heap, pos)); @@ -69,14 +69,14 @@ rightpos = childpos + 1; if (rightpos < endpos) { cmp = PyObject_RichCompareBool( - PyList_GET_ITEM(heap, rightpos), PyList_GET_ITEM(heap, childpos), - Py_LE); + PyList_GET_ITEM(heap, rightpos), + Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) childpos = rightpos; } /* Move the smaller child up. */ @@ -214,10 +214,10 @@ return item; } - cmp = PyObject_RichCompareBool(item, PyList_GET_ITEM(heap, 0), Py_LE); + cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT); if (cmp == -1) return NULL; - if (cmp == 1) { + if (cmp == 0) { Py_INCREF(item); return item; } @@ -270,6 +270,7 @@ { PyObject *heap=NULL, *elem, *iterable, *sol, *it, *oldelem; Py_ssize_t i, n; + int cmp; if (!PyArg_ParseTuple(args, "nO:nlargest", &n, &iterable)) return NULL; @@ -312,7 +313,12 @@ else goto sortit; } - if (PyObject_RichCompareBool(elem, sol, Py_LE)) { + cmp = PyObject_RichCompareBool(sol, elem, Py_LT); + if (cmp == -1) { + Py_DECREF(elem); + goto fail; + } + if (cmp == 0) { Py_DECREF(elem); continue; } @@ -362,12 +368,12 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(newitem, parent, Py_LE); + cmp = PyObject_RichCompareBool(parent, newitem, Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) break; Py_INCREF(parent); Py_DECREF(PyList_GET_ITEM(heap, pos)); @@ -403,14 +409,14 @@ rightpos = childpos + 1; if (rightpos < endpos) { cmp = PyObject_RichCompareBool( - PyList_GET_ITEM(heap, childpos), PyList_GET_ITEM(heap, rightpos), - Py_LE); + PyList_GET_ITEM(heap, childpos), + Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) childpos = rightpos; } /* Move the smaller child up. */ @@ -434,6 +440,7 @@ { PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem; Py_ssize_t i, n; + int cmp; if (!PyArg_ParseTuple(args, "nO:nsmallest", &n, &iterable)) return NULL; @@ -477,7 +484,12 @@ else goto sortit; } - if (PyObject_RichCompareBool(los, elem, Py_LE)) { + cmp = PyObject_RichCompareBool(elem, los, Py_LT); + if (cmp == -1) { + Py_DECREF(elem); + goto fail; + } + if (cmp == 0) { Py_DECREF(elem); continue; } @@ -658,6 +670,6 @@ m = Py_InitModule3("_heapq", heapq_methods, module_doc); if (m == NULL) return; - PyModule_AddObject(m, "__about__", PyString_FromString(__about__)); + PyModule_AddObject(m, "__about__", PyBytes_FromString(__about__)); } Modified: python/branches/tlee-ast-optimize/Modules/_hotshot.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_hotshot.c (original) +++ python/branches/tlee-ast-optimize/Modules/_hotshot.c Sun Jun 1 17:18:10 2008 @@ -326,7 +326,7 @@ return ERR_EOF; } } - *pvalue = PyString_FromStringAndSize(buf, len); + *pvalue = PyBytes_FromStringAndSize(buf, len); free(buf); if (*pvalue == NULL) { return ERR_EXCEPTION; @@ -562,7 +562,7 @@ self->index - written); self->index -= written; if (written == 0) { - char *s = PyString_AsString(self->logfilename); + char *s = PyBytes_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -570,7 +570,7 @@ } if (written > 0) { if (fflush(self->logfp)) { - char *s = PyString_AsString(self->logfilename); + char *s = PyBytes_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -792,7 +792,7 @@ self->next_fileno++; Py_DECREF(obj); if (pack_define_file(self, fileno, - PyString_AS_STRING(fcode->co_filename)) < 0) + PyBytes_AS_STRING(fcode->co_filename)) < 0) return -1; } else { @@ -810,7 +810,7 @@ PyObject *name = PyDict_GetItem(dict, obj); if (name == NULL) { if (pack_define_func(self, fileno, fcode->co_firstlineno, - PyString_AS_STRING(fcode->co_name)) < 0) { + PyBytes_AS_STRING(fcode->co_name)) < 0) { Py_DECREF(obj); return -1; } @@ -1471,7 +1471,7 @@ len = PyList_GET_SIZE(temp); for (i = 0; i < len; ++i) { PyObject *item = PyList_GET_ITEM(temp, i); - buffer = PyString_AsString(item); + buffer = PyBytes_AsString(item); if (buffer == NULL) { pack_add_info(self, "sys-path-entry", ""); PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Modules/_json.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_json.c (original) +++ python/branches/tlee-ast-optimize/Modules/_json.c Sun Jun 1 17:18:10 2008 @@ -70,11 +70,11 @@ input_unicode = PyUnicode_AS_UNICODE(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyString_FromStringAndSize(NULL, output_size); + rval = PyBytes_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -92,14 +92,14 @@ if (output_size > 2 + (input_chars * MAX_EXPANSION)) { output_size = 2 + (input_chars * MAX_EXPANSION); } - if (_PyString_Resize(&rval, output_size) == -1) { + if (_PyBytes_Resize(&rval, output_size) == -1) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { + if (_PyBytes_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -116,15 +116,15 @@ char *output; char *input_str; - input_chars = PyString_GET_SIZE(pystr); - input_str = PyString_AS_STRING(pystr); + input_chars = PyBytes_GET_SIZE(pystr); + input_str = PyBytes_AS_STRING(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyString_FromStringAndSize(NULL, output_size); + rval = PyBytes_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -154,14 +154,14 @@ if (output_size > 2 + (input_chars * MIN_EXPANSION)) { output_size = 2 + (input_chars * MIN_EXPANSION); } - if (_PyString_Resize(&rval, output_size) == -1) { + if (_PyBytes_Resize(&rval, output_size) == -1) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { + if (_PyBytes_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -215,7 +215,7 @@ ustr = PyUnicode_FromUnicode(&c, 0); } if (joinstr == NULL) { - joinstr = PyString_InternFromString("join"); + joinstr = PyBytes_InternFromString("join"); } if (joinstr == NULL || ustr == NULL) { return NULL; @@ -227,10 +227,10 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) { PyObject *rval; - Py_ssize_t len = PyString_GET_SIZE(pystr); + Py_ssize_t len = PyBytes_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; - char *buf = PyString_AS_STRING(pystr); + char *buf = PyBytes_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; @@ -555,7 +555,7 @@ if (encoding == NULL) { encoding = DEFAULT_ENCODING; } - if (PyString_Check(pystr)) { + if (PyBytes_Check(pystr)) { return scanstring_str(pystr, end, encoding, strict); } else if (PyUnicode_Check(pystr)) { @@ -576,7 +576,7 @@ py_encode_basestring_ascii(PyObject* self, PyObject *pystr) { /* METH_O */ - if (PyString_Check(pystr)) { + if (PyBytes_Check(pystr)) { return ascii_escape_str(pystr); } else if (PyUnicode_Check(pystr)) { Modified: python/branches/tlee-ast-optimize/Modules/_localemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_localemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_localemodule.c Sun Jun 1 17:18:10 2008 @@ -119,7 +119,7 @@ if (isupper(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -134,7 +134,7 @@ if (islower(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -149,7 +149,7 @@ if (isalpha(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -175,7 +175,7 @@ PyErr_SetString(Error, "unsupported locale setting"); return NULL; } - result_object = PyString_FromString(result); + result_object = PyBytes_FromString(result); if (!result_object) return NULL; /* record changes to LC_CTYPE */ @@ -190,7 +190,7 @@ PyErr_SetString(Error, "locale query failed"); return NULL; } - result_object = PyString_FromString(result); + result_object = PyBytes_FromString(result); } return result_object; } @@ -216,7 +216,7 @@ involved herein */ #define RESULT_STRING(s)\ - x = PyString_FromString(l->s);\ + x = PyBytes_FromString(l->s);\ if (!x) goto failed;\ PyDict_SetItemString(result, #s, x);\ Py_XDECREF(x) @@ -284,9 +284,9 @@ if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2)) return NULL; /* If both arguments are byte strings, use strcoll. */ - if (PyString_Check(os1) && PyString_Check(os2)) - return PyInt_FromLong(strcoll(PyString_AS_STRING(os1), - PyString_AS_STRING(os2))); + if (PyBytes_Check(os1) && PyBytes_Check(os2)) + return PyInt_FromLong(strcoll(PyBytes_AS_STRING(os1), + PyBytes_AS_STRING(os2))); /* If neither argument is unicode, it's an error. */ if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) { PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings"); @@ -368,7 +368,7 @@ return PyErr_NoMemory(); strxfrm(buf, s, n2); } - result = PyString_FromString(buf); + result = PyBytes_FromString(buf); PyMem_Free(buf); return result; } @@ -563,13 +563,13 @@ return NULL; /* Check whether this is a supported constant. GNU libc sometimes returns numeric values in the char* return value, which would - crash PyString_FromString. */ + crash PyBytes_FromString. */ for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) { /* Check NULL as a workaround for GNU libc's returning NULL instead of an empty string for nl_langinfo(ERA). */ const char *result = nl_langinfo(item); - return PyString_FromString(result != NULL ? result : ""); + return PyBytes_FromString(result != NULL ? result : ""); } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; @@ -588,7 +588,7 @@ char *in; if (!PyArg_ParseTuple(args, "z", &in)) return 0; - return PyString_FromString(gettext(in)); + return PyBytes_FromString(gettext(in)); } PyDoc_STRVAR(dgettext__doc__, @@ -601,7 +601,7 @@ char *domain, *in; if (!PyArg_ParseTuple(args, "zz", &domain, &in)) return 0; - return PyString_FromString(dgettext(domain, in)); + return PyBytes_FromString(dgettext(domain, in)); } PyDoc_STRVAR(dcgettext__doc__, @@ -615,7 +615,7 @@ int category; if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category)) return 0; - return PyString_FromString(dcgettext(domain,msgid,category)); + return PyBytes_FromString(dcgettext(domain,msgid,category)); } PyDoc_STRVAR(textdomain__doc__, @@ -633,7 +633,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyString_FromString(domain); + return PyBytes_FromString(domain); } PyDoc_STRVAR(bindtextdomain__doc__, @@ -651,7 +651,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyString_FromString(dirname); + return PyBytes_FromString(dirname); } #ifdef HAVE_BIND_TEXTDOMAIN_CODESET @@ -667,7 +667,7 @@ return NULL; codeset = bind_textdomain_codeset(domain, codeset); if (codeset) - return PyString_FromString(codeset); + return PyBytes_FromString(codeset); Py_RETURN_NONE; } #endif @@ -760,7 +760,7 @@ Error = PyErr_NewException("locale.Error", NULL, NULL); PyDict_SetItemString(d, "Error", Error); - x = PyString_FromString(locale__doc__); + x = PyBytes_FromString(locale__doc__); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/_lsprof.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_lsprof.c (original) +++ python/branches/tlee-ast-optimize/Modules/_lsprof.c Sun Jun 1 17:18:10 2008 @@ -179,8 +179,8 @@ /* built-in function: look up the module name */ PyObject *mod = fn->m_module; char *modname; - if (mod && PyString_Check(mod)) { - modname = PyString_AS_STRING(mod); + if (mod && PyBytes_Check(mod)) { + modname = PyBytes_AS_STRING(mod); } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); @@ -193,11 +193,11 @@ modname = "__builtin__"; } if (strcmp(modname, "__builtin__") != 0) - return PyString_FromFormat("<%s.%s>", + return PyBytes_FromFormat("<%s.%s>", modname, fn->m_ml->ml_name); else - return PyString_FromFormat("<%s>", + return PyBytes_FromFormat("<%s>", fn->m_ml->ml_name); } else { @@ -205,7 +205,7 @@ repr(getattr(type(__self__), __name__)) */ PyObject *self = fn->m_self; - PyObject *name = PyString_FromString(fn->m_ml->ml_name); + PyObject *name = PyBytes_FromString(fn->m_ml->ml_name); if (name != NULL) { PyObject *mo = _PyType_Lookup(Py_TYPE(self), name); Py_XINCREF(mo); @@ -218,7 +218,7 @@ } } PyErr_Clear(); - return PyString_FromFormat("", + return PyBytes_FromFormat("", fn->m_ml->ml_name); } } Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c Sun Jun 1 17:18:10 2008 @@ -241,12 +241,12 @@ if (!fmt_args) { return NULL; } - template = PyString_FromString("%s <- %s ->%s\n"); + template = PyBytes_FromString("%s <- %s ->%s\n"); if (!template) { Py_DECREF(fmt_args); return NULL; } - display_str = PyString_Format(template, fmt_args); + display_str = PyBytes_Format(template, fmt_args); Py_DECREF(template); Py_DECREF(fmt_args); if (!display_str) { Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c Sun Jun 1 17:18:10 2008 @@ -84,8 +84,8 @@ Py_INCREF(&PyUnicode_Type); self->text_factory = (PyObject*)&PyUnicode_Type; - if (PyString_Check(database) || PyUnicode_Check(database)) { - if (PyString_Check(database)) { + if (PyBytes_Check(database) || PyUnicode_Check(database)) { + if (PyBytes_Check(database)) { database_utf8 = database; Py_INCREF(database_utf8); } else { @@ -96,7 +96,7 @@ } Py_BEGIN_ALLOW_THREADS - rc = sqlite3_open(PyString_AsString(database_utf8), &self->db); + rc = sqlite3_open(PyBytes_AsString(database_utf8), &self->db); Py_END_ALLOW_THREADS Py_DECREF(database_utf8); @@ -111,7 +111,7 @@ if (class_attr) { class_attr_str = PyObject_Str(class_attr); if (class_attr_str) { - if (strcmp(PyString_AsString(class_attr_str), "") == 0) { + if (strcmp(PyBytes_AsString(class_attr_str), "") == 0) { /* In the APSW Connection object, the first entry after * PyObject_HEAD is the sqlite3* we want to get hold of. * Luckily, this is the same layout as we have in our @@ -134,7 +134,7 @@ } if (!isolation_level) { - isolation_level = PyString_FromString(""); + isolation_level = PyBytes_FromString(""); if (!isolation_level) { return -1; } @@ -499,12 +499,12 @@ } else { sqlite3_result_blob(context, buffer, buflen, SQLITE_TRANSIENT); } - } else if (PyString_Check(py_val)) { - sqlite3_result_text(context, PyString_AsString(py_val), -1, SQLITE_TRANSIENT); + } else if (PyBytes_Check(py_val)) { + sqlite3_result_text(context, PyBytes_AsString(py_val), -1, SQLITE_TRANSIENT); } else if (PyUnicode_Check(py_val)) { stringval = PyUnicode_AsUTF8String(py_val); if (stringval) { - sqlite3_result_text(context, PyString_AsString(stringval), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, PyBytes_AsString(stringval), -1, SQLITE_TRANSIENT); Py_DECREF(stringval); } } else { @@ -963,21 +963,21 @@ Py_INCREF(isolation_level); self->isolation_level = isolation_level; - begin_statement = PyString_FromString("BEGIN "); + begin_statement = PyBytes_FromString("BEGIN "); if (!begin_statement) { return -1; } - PyString_Concat(&begin_statement, isolation_level); + PyBytes_Concat(&begin_statement, isolation_level); if (!begin_statement) { return -1; } - self->begin_statement = PyMem_Malloc(PyString_Size(begin_statement) + 2); + self->begin_statement = PyMem_Malloc(PyBytes_Size(begin_statement) + 2); if (!self->begin_statement) { return -1; } - strcpy(self->begin_statement, PyString_AsString(begin_statement)); + strcpy(self->begin_statement, PyBytes_AsString(begin_statement)); Py_DECREF(begin_statement); } @@ -1152,8 +1152,8 @@ goto finally; } - string1 = PyString_FromStringAndSize((const char*)text1_data, text1_length); - string2 = PyString_FromStringAndSize((const char*)text2_data, text2_length); + string1 = PyBytes_FromStringAndSize((const char*)text1_data, text1_length); + string2 = PyBytes_FromStringAndSize((const char*)text2_data, text2_length); if (!string1 || !string2) { goto finally; /* failed to allocate strings */ @@ -1259,7 +1259,7 @@ goto finally; } - if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyString_Type, &name, &callable)) { + if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyBytes_Type, &name, &callable)) { goto finally; } @@ -1268,7 +1268,7 @@ goto finally; } - chk = PyString_AsString(uppercase_name); + chk = PyBytes_AsString(uppercase_name); while (*chk) { if ((*chk >= '0' && *chk <= '9') || (*chk >= 'A' && *chk <= 'Z') @@ -1293,7 +1293,7 @@ } rc = sqlite3_create_collation(self->db, - PyString_AsString(uppercase_name), + PyBytes_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, (callable != Py_None) ? pysqlite_collation_callback : NULL); Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h Sun Jun 1 17:18:10 2008 @@ -80,7 +80,7 @@ /* Determines how bytestrings from SQLite are converted to Python objects: * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created. - * - PyString_Type: PyStrings are created as-is. + * - PyBytes_Type: PyStrings are created as-is. * - Any custom callable: Any object returned from the callable called with the bytestring * as single parameter. */ Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c Sun Jun 1 17:18:10 2008 @@ -101,10 +101,7 @@ self->arraysize = 1; - self->rowcount = PyInt_FromLong(-1L); - if (!self->rowcount) { - return -1; - } + self->rowcount = -1L; Py_INCREF(Py_None); self->row_factory = Py_None; @@ -130,7 +127,6 @@ Py_XDECREF(self->row_cast_map); Py_XDECREF(self->description); Py_XDECREF(self->lastrowid); - Py_XDECREF(self->rowcount); Py_XDECREF(self->row_factory); Py_XDECREF(self->next_row); @@ -182,7 +178,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyString_FromStringAndSize(type_start, pos - type_start); + key = PyBytes_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -207,7 +203,7 @@ * 'NUMBER(10)' to be treated as 'NUMBER', for example. * In other words, it will work as people expect it to work.*/ if (*pos == ' ' || *pos == '(' || *pos == 0) { - py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyBytes_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; } @@ -252,7 +248,7 @@ if ((*pos == '[') && (pos > colname) && (*(pos-1) == ' ')) { pos--; } - return PyString_FromStringAndSize(colname, pos - colname); + return PyBytes_FromStringAndSize(colname, pos - colname); } } } @@ -277,7 +273,7 @@ } if (is_ascii) { - return PyString_FromString(val_str); + return PyBytes_FromString(val_str); } else { return PyUnicode_DecodeUTF8(val_str, strlen(val_str), NULL); } @@ -331,7 +327,7 @@ Py_INCREF(Py_None); converted = Py_None; } else { - item = PyString_FromStringAndSize(val_str, nbytes); + item = PyBytes_FromStringAndSize(val_str, nbytes); if (!item) { return NULL; } @@ -374,8 +370,8 @@ colname , val_str); PyErr_SetString(pysqlite_OperationalError, buf); } - } else if (self->connection->text_factory == (PyObject*)&PyString_Type) { - converted = PyString_FromString(val_str); + } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) { + converted = PyBytes_FromString(val_str); } else { converted = PyObject_CallFunction(self->connection->text_factory, "s", val_str); } @@ -427,12 +423,12 @@ int statement_type; PyObject* descriptor; PyObject* second_argument = NULL; - long rowcount = 0; int allow_8bit_chars; if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) { return NULL; } + /* Make shooting yourself in the foot with not utf-8 decodable 8-bit-strings harder */ allow_8bit_chars = ((self->connection->text_factory != (PyObject*)&PyUnicode_Type) && (self->connection->text_factory != (PyObject*)&PyUnicode_Type && pysqlite_OptimizedUnicode)); @@ -446,7 +442,7 @@ return NULL; } - if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -468,7 +464,7 @@ return NULL; } - if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -503,21 +499,22 @@ rc = pysqlite_statement_reset(self->statement); } - if (PyString_Check(operation)) { - operation_cstr = PyString_AsString(operation); + if (PyBytes_Check(operation)) { + operation_cstr = PyBytes_AsString(operation); } else { operation_bytestr = PyUnicode_AsUTF8String(operation); if (!operation_bytestr) { goto error; } - operation_cstr = PyString_AsString(operation_bytestr); + operation_cstr = PyBytes_AsString(operation_bytestr); } - /* reset description */ + /* reset description and rowcount */ Py_DECREF(self->description); Py_INCREF(Py_None); self->description = Py_None; + self->rowcount = -1L; func_args = PyTuple_New(1); if (!func_args) { @@ -693,7 +690,10 @@ case STATEMENT_DELETE: case STATEMENT_INSERT: case STATEMENT_REPLACE: - rowcount += (long)sqlite3_changes(self->connection->db); + if (self->rowcount == -1L) { + self->rowcount = 0L; + } + self->rowcount += (long)sqlite3_changes(self->connection->db); } Py_DECREF(self->lastrowid); @@ -728,13 +728,9 @@ Py_XDECREF(parameters_list); if (PyErr_Occurred()) { - Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(-1L); + self->rowcount = -1L; return NULL; } else { - Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(rowcount); - Py_INCREF(self); return (PyObject*)self; } @@ -768,15 +764,15 @@ return NULL; } - if (PyString_Check(script_obj)) { - script_cstr = PyString_AsString(script_obj); + if (PyBytes_Check(script_obj)) { + script_cstr = PyBytes_AsString(script_obj); } else if (PyUnicode_Check(script_obj)) { script_str = PyUnicode_AsUTF8String(script_obj); if (!script_str) { return NULL; } - script_cstr = PyString_AsString(script_str); + script_cstr = PyBytes_AsString(script_str); } else { PyErr_SetString(PyExc_ValueError, "script argument must be unicode or string."); return NULL; @@ -1028,7 +1024,7 @@ {"description", T_OBJECT, offsetof(pysqlite_Cursor, description), RO}, {"arraysize", T_INT, offsetof(pysqlite_Cursor, arraysize), 0}, {"lastrowid", T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), RO}, - {"rowcount", T_OBJECT, offsetof(pysqlite_Cursor, rowcount), RO}, + {"rowcount", T_LONG, offsetof(pysqlite_Cursor, rowcount), RO}, {"row_factory", T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0}, {NULL} }; Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.h (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.h Sun Jun 1 17:18:10 2008 @@ -37,7 +37,7 @@ PyObject* row_cast_map; int arraysize; PyObject* lastrowid; - PyObject* rowcount; + long rowcount; PyObject* row_factory; pysqlite_Statement* statement; Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/module.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/module.c Sun Jun 1 17:18:10 2008 @@ -137,7 +137,7 @@ /* a basic type is adapted; there's a performance optimization if that's not the case * (99 % of all usages) */ if (type == &PyInt_Type || type == &PyLong_Type || type == &PyFloat_Type - || type == &PyString_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { + || type == &PyBytes_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { pysqlite_BaseTypeAdapted = 1; } @@ -367,13 +367,13 @@ Py_DECREF(tmp_obj); } - if (!(tmp_obj = PyString_FromString(PYSQLITE_VERSION))) { + if (!(tmp_obj = PyBytes_FromString(PYSQLITE_VERSION))) { goto error; } PyDict_SetItemString(dict, "version", tmp_obj); Py_DECREF(tmp_obj); - if (!(tmp_obj = PyString_FromString(sqlite3_libversion()))) { + if (!(tmp_obj = PyBytes_FromString(sqlite3_libversion()))) { goto error; } PyDict_SetItemString(dict, "sqlite_version", tmp_obj); Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/row.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/row.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/row.c Sun Jun 1 17:18:10 2008 @@ -86,13 +86,13 @@ item = PyTuple_GetItem(self->data, _idx); Py_XINCREF(item); return item; - } else if (PyString_Check(idx)) { - key = PyString_AsString(idx); + } else if (PyBytes_Check(idx)) { + key = PyBytes_AsString(idx); nitems = PyTuple_Size(self->description); for (i = 0; i < nitems; i++) { - compare_key = PyString_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); + compare_key = PyBytes_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); if (!compare_key) { return NULL; } Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c Sun Jun 1 17:18:10 2008 @@ -60,7 +60,7 @@ self->st = NULL; self->in_use = 0; - if (PyString_Check(sql)) { + if (PyBytes_Check(sql)) { sql_str = sql; Py_INCREF(sql_str); } else if (PyUnicode_Check(sql)) { @@ -77,7 +77,7 @@ self->in_weakreflist = NULL; self->sql = sql_str; - sql_cstr = PyString_AsString(sql_str); + sql_cstr = PyBytes_AsString(sql_str); rc = sqlite3_prepare(connection->db, sql_cstr, @@ -119,7 +119,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_CheckExact(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyString_CheckExact(parameter)) { + } else if (PyBytes_CheckExact(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_CheckExact(parameter)) { paramtype = TYPE_UNICODE; @@ -131,7 +131,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_Check(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyString_Check(parameter)) { + } else if (PyBytes_Check(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_Check(parameter)) { paramtype = TYPE_UNICODE; @@ -140,7 +140,7 @@ } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyString_AS_STRING(parameter); + string = PyBytes_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); @@ -164,12 +164,12 @@ rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_STRING: - string = PyString_AS_STRING(parameter); + string = PyBytes_AS_STRING(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_UNICODE: stringval = PyUnicode_AsUTF8String(parameter); - string = PyString_AsString(stringval); + string = PyBytes_AsString(stringval); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); break; @@ -197,7 +197,7 @@ } if (PyInt_CheckExact(obj) || PyLong_CheckExact(obj) - || PyFloat_CheckExact(obj) || PyString_CheckExact(obj) + || PyFloat_CheckExact(obj) || PyBytes_CheckExact(obj) || PyUnicode_CheckExact(obj) || PyBuffer_Check(obj)) { return 0; } else { @@ -326,7 +326,7 @@ char* sql_cstr; sqlite3_stmt* new_st; - sql_cstr = PyString_AsString(self->sql); + sql_cstr = PyBytes_AsString(self->sql); rc = sqlite3_prepare(self->db, sql_cstr, Modified: python/branches/tlee-ast-optimize/Modules/_sre.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sre.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sre.c Sun Jun 1 17:18:10 2008 @@ -1715,7 +1715,7 @@ size = PyObject_Length(string); #endif - if (PyString_Check(string) || bytes == size) + if (PyBytes_Check(string) || bytes == size) charsize = 1; #if defined(HAVE_UNICODE) else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE))) @@ -1949,7 +1949,7 @@ if (!args) return NULL; - name = PyString_FromString(module); + name = PyBytes_FromString(module); if (!name) return NULL; mod = PyImport_Import(name); @@ -3416,7 +3416,7 @@ Py_DECREF(x); } - x = PyString_FromString(copyright); + x = PyBytes_FromString(copyright); if (x) { PyDict_SetItemString(d, "copyright", x); Py_DECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/_ssl.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ssl.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ssl.c Sun Jun 1 17:18:10 2008 @@ -491,13 +491,13 @@ static PyObject * PySSL_server(PySSLObject *self) { - return PyString_FromString(self->server); + return PyBytes_FromString(self->server); } static PyObject * PySSL_issuer(PySSLObject *self) { - return PyString_FromString(self->issuer); + return PyBytes_FromString(self->issuer); } static PyObject * @@ -515,7 +515,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail; } - name_obj = PyString_FromStringAndSize(namebuf, buflen); + name_obj = PyBytes_FromStringAndSize(namebuf, buflen); if (name_obj == NULL) goto fail; @@ -603,8 +603,8 @@ /* fprintf(stderr, "RDN level %d, attribute %s: %s\n", entry->set, - PyString_AS_STRING(PyTuple_GET_ITEM(attr, 0)), - PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1))); + PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 0)), + PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 1))); */ if (attr == NULL) goto fail1; @@ -711,7 +711,7 @@ goto fail; } - v = PyString_FromString("DirName"); + v = PyBytes_FromString("DirName"); if (v == NULL) { Py_DECREF(t); goto fail; @@ -742,13 +742,13 @@ t = PyTuple_New(2); if (t == NULL) goto fail; - v = PyString_FromStringAndSize(buf, (vptr - buf)); + v = PyBytes_FromStringAndSize(buf, (vptr - buf)); if (v == NULL) { Py_DECREF(t); goto fail; } PyTuple_SET_ITEM(t, 0, v); - v = PyString_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); + v = PyBytes_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); if (v == NULL) { Py_DECREF(t); goto fail; @@ -849,7 +849,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - sn_obj = PyString_FromStringAndSize(buf, len); + sn_obj = PyBytes_FromStringAndSize(buf, len); if (sn_obj == NULL) goto fail1; if (PyDict_SetItemString(retval, "serialNumber", sn_obj) < 0) { @@ -866,7 +866,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotBefore = PyString_FromStringAndSize(buf, len); + pnotBefore = PyBytes_FromStringAndSize(buf, len); if (pnotBefore == NULL) goto fail1; if (PyDict_SetItemString(retval, "notBefore", pnotBefore) < 0) { @@ -884,7 +884,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotAfter = PyString_FromStringAndSize(buf, len); + pnotAfter = PyBytes_FromStringAndSize(buf, len); if (pnotAfter == NULL) goto fail1; if (PyDict_SetItemString(retval, "notAfter", pnotAfter) < 0) { @@ -981,7 +981,7 @@ PySSL_SetError(self, len, __FILE__, __LINE__); return NULL; } - retval = PyString_FromStringAndSize((const char *) bytes_buf, len); + retval = PyBytes_FromStringAndSize((const char *) bytes_buf, len); OPENSSL_free(bytes_buf); return retval; @@ -1028,7 +1028,7 @@ if (cipher_name == NULL) { PyTuple_SET_ITEM(retval, 0, Py_None); } else { - v = PyString_FromString(cipher_name); + v = PyBytes_FromString(cipher_name); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 0, v); @@ -1037,7 +1037,7 @@ if (cipher_protocol == NULL) { PyTuple_SET_ITEM(retval, 1, Py_None); } else { - v = PyString_FromString(cipher_protocol); + v = PyBytes_FromString(cipher_protocol); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 1, v); @@ -1211,7 +1211,7 @@ if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; - if (!(buf = PyString_FromStringAndSize((char *) 0, len))) + if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) return NULL; /* first check if there are bytes ready to be read */ @@ -1233,14 +1233,14 @@ return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { /* should contain a zero-length string */ - _PyString_Resize(&buf, 0); + _PyBytes_Resize(&buf, 0); return buf; } } do { err = 0; PySSL_BEGIN_ALLOW_THREADS - count = SSL_read(self->ssl, PyString_AsString(buf), len); + count = SSL_read(self->ssl, PyBytes_AsString(buf), len); err = SSL_get_error(self->ssl, count); PySSL_END_ALLOW_THREADS if(PyErr_CheckSignals()) { @@ -1257,7 +1257,7 @@ (SSL_get_shutdown(self->ssl) == SSL_RECEIVED_SHUTDOWN)) { - _PyString_Resize(&buf, 0); + _PyBytes_Resize(&buf, 0); return buf; } else { sockstate = SOCKET_OPERATION_OK; @@ -1276,7 +1276,7 @@ return PySSL_SetError(self, count, __FILE__, __LINE__); } if (count != len) - _PyString_Resize(&buf, count); + _PyBytes_Resize(&buf, count); return buf; } @@ -1362,11 +1362,11 @@ { int bytes; - if (!PyString_Check(arg)) + if (!PyBytes_Check(arg)) return PyErr_Format(PyExc_TypeError, "RAND_egd() expected string, found %s", Py_TYPE(arg)->tp_name); - bytes = RAND_egd(PyString_AS_STRING(arg)); + bytes = RAND_egd(PyBytes_AS_STRING(arg)); if (bytes == -1) { PyErr_SetString(PySSLErrorObject, "EGD connection failed or EGD did not return " Modified: python/branches/tlee-ast-optimize/Modules/_struct.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_struct.c (original) +++ python/branches/tlee-ast-optimize/Modules/_struct.c Sun Jun 1 17:18:10 2008 @@ -413,7 +413,7 @@ if (msg == NULL) return -1; rval = PyErr_WarnEx(PyExc_DeprecationWarning, - PyString_AS_STRING(msg), 2); + PyBytes_AS_STRING(msg), 2); Py_DECREF(msg); if (rval == 0) return 0; @@ -446,7 +446,7 @@ static PyObject * nu_char(const char *p, const formatdef *f) { - return PyString_FromStringAndSize(p, 1); + return PyBytes_FromStringAndSize(p, 1); } static PyObject * @@ -610,12 +610,12 @@ static int np_char(char *p, PyObject *v, const formatdef *f) { - if (!PyString_Check(v) || PyString_Size(v) != 1) { + if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) { PyErr_SetString(StructError, "char format require string of length 1"); return -1; } - *p = *PyString_AsString(v); + *p = *PyBytes_AsString(v); return 0; } @@ -1335,7 +1335,7 @@ char c; Py_ssize_t size, len, num, itemsize, x; - fmt = PyString_AS_STRING(self->s_format); + fmt = PyBytes_AS_STRING(self->s_format); f = whichtable((char **)&fmt); @@ -1503,12 +1503,12 @@ const formatdef *e = code->fmtdef; const char *res = startfrom + code->offset; if (e->format == 's') { - v = PyString_FromStringAndSize(res, code->size); + v = PyBytes_FromStringAndSize(res, code->size); } else if (e->format == 'p') { Py_ssize_t n = *(unsigned char*)res; if (n >= code->size) n = code->size - 1; - v = PyString_FromStringAndSize(res + 1, n); + v = PyBytes_FromStringAndSize(res + 1, n); } else { v = e->unpack(res, e); } @@ -1542,9 +1542,9 @@ assert(soself->s_codes != NULL); if (inputstr == NULL) goto fail; - if (PyString_Check(inputstr) && - PyString_GET_SIZE(inputstr) == soself->s_size) { - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + if (PyBytes_Check(inputstr) && + PyBytes_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyBytes_AS_STRING(inputstr)); } args = PyTuple_Pack(1, inputstr); if (args == NULL) @@ -1637,27 +1637,27 @@ const formatdef *e = code->fmtdef; char *res = buf + code->offset; if (e->format == 's') { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(StructError, "argument for 's' must be a string"); return -1; } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > code->size) n = code->size; if (n > 0) - memcpy(res, PyString_AS_STRING(v), n); + memcpy(res, PyBytes_AS_STRING(v), n); } else if (e->format == 'p') { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(StructError, "argument for 'p' must be a string"); return -1; } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > (code->size - 1)) n = code->size - 1; if (n > 0) - memcpy(res + 1, PyString_AS_STRING(v), n); + memcpy(res + 1, PyBytes_AS_STRING(v), n); if (n > 255) n = 255; *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); @@ -1700,12 +1700,12 @@ } /* Allocate a new string */ - result = PyString_FromStringAndSize((char *)NULL, soself->s_size); + result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size); if (result == NULL) return NULL; /* Call the guts */ - if ( s_pack_internal(soself, args, 0, PyString_AS_STRING(result)) != 0 ) { + if ( s_pack_internal(soself, args, 0, PyBytes_AS_STRING(result)) != 0 ) { Py_DECREF(result); return NULL; } @@ -2061,7 +2061,7 @@ { PyObject *ver, *m; - ver = PyString_FromString("0.2"); + ver = PyBytes_FromString("0.2"); if (ver == NULL) return; Modified: python/branches/tlee-ast-optimize/Modules/_testcapimodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_testcapimodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_testcapimodule.c Sun Jun 1 17:18:10 2008 @@ -691,7 +691,7 @@ } #endif -/* Some tests of PyString_FromFormat(). This needs more tests. */ +/* Some tests of PyBytes_FromFormat(). This needs more tests. */ static PyObject * test_string_from_format(PyObject *self, PyObject *args) { @@ -699,10 +699,10 @@ char *msg; #define CHECK_1_FORMAT(FORMAT, TYPE) \ - result = PyString_FromFormat(FORMAT, (TYPE)1); \ + result = PyBytes_FromFormat(FORMAT, (TYPE)1); \ if (result == NULL) \ return NULL; \ - if (strcmp(PyString_AsString(result), "1")) { \ + if (strcmp(PyBytes_AsString(result), "1")) { \ msg = FORMAT " failed at 1"; \ goto Fail; \ } \ Modified: python/branches/tlee-ast-optimize/Modules/_tkinter.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_tkinter.c (original) +++ python/branches/tlee-ast-optimize/Modules/_tkinter.c Sun Jun 1 17:18:10 2008 @@ -335,8 +335,8 @@ static char * AsString(PyObject *value, PyObject *tmp) { - if (PyString_Check(value)) - return PyString_AsString(value); + if (PyBytes_Check(value)) + return PyBytes_AsString(value); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { PyObject *v = PyUnicode_AsUTF8String(value); @@ -347,7 +347,7 @@ return NULL; } Py_DECREF(v); - return PyString_AsString(v); + return PyBytes_AsString(v); } #endif else { @@ -359,7 +359,7 @@ return NULL; } Py_DECREF(v); - return PyString_AsString(v); + return PyBytes_AsString(v); } } @@ -462,13 +462,13 @@ * Could be a quoted string containing funnies, e.g. {"}. * Return the string itself. */ - return PyString_FromString(list); + return PyBytes_FromString(list); } if (argc == 0) - v = PyString_FromString(""); + v = PyBytes_FromString(""); else if (argc == 1) - v = PyString_FromString(argv[0]); + v = PyBytes_FromString(argv[0]); else if ((v = PyTuple_New(argc)) != NULL) { int i; PyObject *w; @@ -530,10 +530,10 @@ return result; /* Fall through, returning arg. */ } - else if (PyString_Check(arg)) { + else if (PyBytes_Check(arg)) { int argc; char **argv; - char *list = PyString_AsString(arg); + char *list = PyBytes_AsString(arg); if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { Py_INCREF(arg); @@ -541,7 +541,7 @@ } Tcl_Free(FREECAST argv); if (argc > 1) - return Split(PyString_AsString(arg)); + return Split(PyBytes_AsString(arg)); /* Fall through, returning arg. */ } Py_INCREF(arg); @@ -747,12 +747,12 @@ static PyObject * PyTclObject_str(PyTclObject *self) { - if (self->string && PyString_Check(self->string)) { + if (self->string && PyBytes_Check(self->string)) { Py_INCREF(self->string); return self->string; } /* XXX Could cache value if it is an ASCII string. */ - return PyString_FromString(Tcl_GetString(self->value)); + return PyBytes_FromString(Tcl_GetString(self->value)); } static char* @@ -778,16 +778,16 @@ #ifdef Py_USING_UNICODE if (i == len) /* It is an ASCII string. */ - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); else { self->string = PyUnicode_DecodeUTF8(s, len, "strict"); if (!self->string) { PyErr_Clear(); - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); } } #else - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); #endif if (!self->string) return NULL; @@ -820,7 +820,7 @@ char buf[50]; PyOS_snprintf(buf, 50, "<%s object at %p>", self->value->typePtr->name, self->value); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int @@ -839,7 +839,7 @@ static PyObject* get_typename(PyTclObject* obj, void* ignored) { - return PyString_FromString(obj->value->typePtr->name); + return PyBytes_FromString(obj->value->typePtr->name); } @@ -908,9 +908,9 @@ { Tcl_Obj *result; - if (PyString_Check(value)) - return Tcl_NewStringObj(PyString_AS_STRING(value), - PyString_GET_SIZE(value)); + if (PyBytes_Check(value)) + return Tcl_NewStringObj(PyBytes_AS_STRING(value), + PyBytes_GET_SIZE(value)); else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyInt_Check(value)) @@ -999,17 +999,17 @@ } if (i == value->length) - result = PyString_FromStringAndSize(s, len); + result = PyBytes_FromStringAndSize(s, len); else { /* Convert UTF-8 to Unicode string */ result = PyUnicode_DecodeUTF8(s, len, "strict"); if (result == NULL) { PyErr_Clear(); - result = PyString_FromStringAndSize(s, len); + result = PyBytes_FromStringAndSize(s, len); } } #else - result = PyString_FromStringAndSize(value->bytes, value->length); + result = PyBytes_FromStringAndSize(value->bytes, value->length); #endif return result; } @@ -1023,7 +1023,7 @@ if (value->typePtr == app->ByteArrayType) { int size; char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); - return PyString_FromStringAndSize(data, size); + return PyBytes_FromStringAndSize(data, size); } if (value->typePtr == app->DoubleType) { @@ -1092,7 +1092,7 @@ int size; char *c; c = Tcl_GetStringFromObj(value, &size); - return PyString_FromStringAndSize(c, size); + return PyBytes_FromStringAndSize(c, size); #endif } @@ -1204,19 +1204,19 @@ } if (*p == '\0') - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); else { /* Convert UTF-8 to Unicode string */ p = strchr(p, '\0'); res = PyUnicode_DecodeUTF8(s, (int)(p-s), "strict"); if (res == NULL) { PyErr_Clear(); - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); } } #else p = strchr(p, '\0'); - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); #endif } return res; @@ -1370,7 +1370,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL ckfree(cmd); } @@ -1396,7 +1396,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1419,7 +1419,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1443,7 +1443,7 @@ res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1466,7 +1466,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1511,8 +1511,8 @@ varname_converter(PyObject *in, void *_out) { char **out = (char**)_out; - if (PyString_Check(in)) { - *out = PyString_AsString(in); + if (PyBytes_Check(in)) { + *out = PyBytes_AsString(in); return 1; } if (PyTclObject_Check(in)) { @@ -1676,7 +1676,7 @@ res = FromObj(self, tres); } else { - res = PyString_FromString(Tcl_GetString(tres)); + res = PyBytes_FromString(Tcl_GetString(tres)); } } LEAVE_OVERLAP_TCL @@ -1920,7 +1920,7 @@ goto finally; for (i = 0; i < argc; i++) { - PyObject *s = PyString_FromString(argv[i]); + PyObject *s = PyBytes_FromString(argv[i]); if (!s || PyTuple_SetItem(v, i, s)) { Py_DECREF(v); v = NULL; @@ -1961,7 +1961,7 @@ PyObject *res = NULL; if (s) { - res = PyString_FromString(s); + res = PyBytes_FromString(s); ckfree(s); } @@ -2011,7 +2011,7 @@ return PythonCmd_Error(interp); for (i = 0; i < (argc - 1); i++) { - PyObject *s = PyString_FromString(argv[i + 1]); + PyObject *s = PyBytes_FromString(argv[i + 1]); if (!s || PyTuple_SetItem(arg, i, s)) { Py_DECREF(arg); return PythonCmd_Error(interp); @@ -2406,7 +2406,7 @@ PyOS_snprintf(buf, sizeof(buf), "", v, v->func == NULL ? ", handler deleted" : ""); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -3087,7 +3087,7 @@ static void ins_string(PyObject *d, char *name, char *val) { - PyObject *v = PyString_FromString(val); + PyObject *v = PyBytes_FromString(val); if (v) { PyDict_SetItemString(d, name, v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/almodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/almodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/almodule.c Sun Jun 1 17:18:10 2008 @@ -84,7 +84,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString((char *) value.ptr); + return PyBytes_FromString((char *) value.ptr); default: PyErr_SetString(ErrorObject, "unknown element type"); return NULL; @@ -149,12 +149,12 @@ PyErr_SetString(ErrorObject, "unknown element type"); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_BadArgument(); return -1; } - param->value.ptr = PyString_AS_STRING(value); - param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ + param->value.ptr = PyBytes_AS_STRING(value); + param->sizeIn = PyBytes_GET_SIZE(value)+1; /*account for NUL*/ break; case AL_SET_VAL: case AL_VECTOR_VAL: @@ -765,12 +765,12 @@ return NULL; } size *= ch; - v = PyString_FromStringAndSize((char *) NULL, size * framecount); + v = PyBytes_FromStringAndSize((char *) NULL, size * framecount); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); + alReadFrames(self->port, (void *) PyBytes_AS_STRING(v), framecount); Py_END_ALLOW_THREADS return v; @@ -1068,12 +1068,12 @@ width = ALgetwidth(c); #endif /* AL_405 */ ALfreeconfig(c); - v = PyString_FromStringAndSize((char *)NULL, width * count); + v = PyBytes_FromStringAndSize((char *)NULL, width * count); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); + ret = ALreadsamps(self->port, (void *) PyBytes_AsString(v), count); Py_END_ALLOW_THREADS if (ret == -1) { Py_DECREF(v); @@ -1498,7 +1498,7 @@ Py_INCREF(item); break; case AL_STRING_VAL: - item = PyString_FromString(pvs[i].value.ptr); + item = PyBytes_FromString(pvs[i].value.ptr); PyMem_DEL(pvs[i].value.ptr); break; case AL_MATRIX_VAL: @@ -1725,7 +1725,7 @@ PyDict_SetItemString(v, "elementType", item); Py_DECREF(item); - item = PyString_FromString(pinfo.name); + item = PyBytes_FromString(pinfo.name); PyDict_SetItemString(v, "name", item); Py_DECREF(item); @@ -1920,7 +1920,7 @@ return NULL; if ((name = ALgetname(device, descriptor)) == NULL) return NULL; - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/arraymodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/arraymodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/arraymodule.c Sun Jun 1 17:18:10 2008 @@ -104,7 +104,7 @@ static PyObject * c_getitem(arrayobject *ap, Py_ssize_t i) { - return PyString_FromStringAndSize(&((char *)ap->ob_item)[i], 1); + return PyBytes_FromStringAndSize(&((char *)ap->ob_item)[i], 1); } static int @@ -1414,7 +1414,7 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyString_FromStringAndSize(self->ob_item, + return PyBytes_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } @@ -1494,7 +1494,7 @@ array_get_typecode(arrayobject *a, void *closure) { char tc = a->ob_descr->typecode; - return PyString_FromStringAndSize(&tc, 1); + return PyBytes_FromStringAndSize(&tc, 1); } static PyObject * @@ -1578,7 +1578,7 @@ typecode = a->ob_descr->typecode; if (len == 0) { PyOS_snprintf(buf, sizeof(buf), "array('%c')", typecode); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } if (typecode == 'c') @@ -1593,9 +1593,9 @@ Py_XDECREF(v); PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); - s = PyString_FromString(buf); - PyString_ConcatAndDel(&s, t); - PyString_ConcatAndDel(&s, PyString_FromString(")")); + s = PyBytes_FromString(buf); + PyBytes_ConcatAndDel(&s, t); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); return s; } @@ -1881,7 +1881,7 @@ return NULL; if (!(initial == NULL || PyList_Check(initial) - || PyString_Check(initial) || PyTuple_Check(initial) + || PyBytes_Check(initial) || PyTuple_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { it = PyObject_GetIter(initial); if (it == NULL) @@ -1924,7 +1924,7 @@ } Py_DECREF(v); } - } else if (initial != NULL && PyString_Check(initial)) { + } else if (initial != NULL && PyBytes_Check(initial)) { PyObject *t_initial, *v; t_initial = PyTuple_Pack(1, initial); if (t_initial == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/audioop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/audioop.c (original) +++ python/branches/tlee-ast-optimize/Modules/audioop.c Sun Jun 1 17:18:10 2008 @@ -474,7 +474,7 @@ /* Passing a short** for an 's' argument is correct only if the string contents is aligned for interpretation - as short[]. Due to the definition of PyStringObject, + as short[]. Due to the definition of PyBytesObject, this is currently (Python 2.6) the case. */ if ( !PyArg_ParseTuple(args, "s#s#:findfit", (char**)&cp1, &len1, (char**)&cp2, &len2) ) @@ -759,10 +759,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -801,10 +801,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/2); + rv = PyBytes_FromStringAndSize(NULL, len/2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size*2 ) { @@ -846,10 +846,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*2); + rv = PyBytes_FromStringAndSize(NULL, len*2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -903,10 +903,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len1); + rv = PyBytes_FromStringAndSize(NULL, len1); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len1; i += size ) { if ( size == 1 ) val1 = (int)*CHARP(cp1, i); @@ -949,10 +949,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -985,10 +985,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1023,10 +1023,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len/size)*size2); + rv = PyBytes_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1157,7 +1157,7 @@ nbytes / bytes_per_frame != ceiling) str = NULL; else - str = PyString_FromStringAndSize(NULL, nbytes); + str = PyBytes_FromStringAndSize(NULL, nbytes); if (str == NULL) { PyErr_SetString(PyExc_MemoryError, @@ -1165,7 +1165,7 @@ goto exit; } } - ncp = PyString_AsString(str); + ncp = PyBytes_AsString(str); for (;;) { while (d < 0) { @@ -1182,13 +1182,13 @@ goto exit; /* We have checked before that the length * of the string fits into int. */ - len = (int)(ncp - PyString_AsString(str)); + len = (int)(ncp - PyBytes_AsString(str)); if (len == 0) { /*don't want to resize to zero length*/ - rv = PyString_FromStringAndSize("", 0); + rv = PyBytes_FromStringAndSize("", 0); Py_DECREF(str); str = rv; - } else if (_PyString_Resize(&str, len) < 0) + } else if (_PyBytes_Resize(&str, len) < 0) goto exit; rv = Py_BuildValue("(O(iO))", str, d, samps); Py_DECREF(samps); @@ -1255,10 +1255,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/size); + rv = PyBytes_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1289,10 +1289,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + rv = PyBytes_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1323,10 +1323,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/size); + rv = PyBytes_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1357,10 +1357,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + rv = PyBytes_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1393,10 +1393,10 @@ return 0; } - str = PyString_FromStringAndSize(NULL, len/(size*2)); + str = PyBytes_FromStringAndSize(NULL, len/(size*2)); if ( str == 0 ) return 0; - ncp = (signed char *)PyString_AsString(str); + ncp = (signed char *)PyBytes_AsString(str); /* Decode state, should have (value, step) */ if ( state == Py_None ) { @@ -1509,10 +1509,10 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyString_FromStringAndSize(NULL, len*size*2); + str = PyBytes_FromStringAndSize(NULL, len*size*2); if ( str == 0 ) return 0; - ncp = (signed char *)PyString_AsString(str); + ncp = (signed char *)PyBytes_AsString(str); step = stepsizeTable[index]; bufferstep = 0; Modified: python/branches/tlee-ast-optimize/Modules/binascii.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/binascii.c (original) +++ python/branches/tlee-ast-optimize/Modules/binascii.c Sun Jun 1 17:18:10 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) +#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyBytesObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -203,9 +203,9 @@ ascii_len--; /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { /* XXX is it really best to add NULs if there's no more data */ @@ -280,9 +280,9 @@ } /* We're lazy and allocate to much (fixed up later) */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyString_AsString(rv); + ascii_data = (unsigned char *)PyBytes_AsString(rv); /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); @@ -304,8 +304,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -354,9 +354,9 @@ bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); bin_len = 0; for( ; ascii_len > 0; ascii_len--, ascii_data++) { @@ -415,13 +415,13 @@ /* And set string size correctly. If the result string is empty ** (because the input was all invalid) return the shared empty - ** string instead; _PyString_Resize() won't do this for us. + ** string instead; _PyBytes_Resize() won't do this for us. */ if (bin_len > 0) - _PyString_Resize(&rv, bin_len); + _PyBytes_Resize(&rv, bin_len); else { Py_DECREF(rv); - rv = PyString_FromString(""); + rv = PyBytes_FromString(""); } return rv; } @@ -448,9 +448,9 @@ /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing newline. Note that 'b' gets encoded as 'Yg==\n' (1 in, 5 out). */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyString_AsString(rv); + ascii_data = (unsigned char *)PyBytes_AsString(rv); for( ; bin_len > 0 ; bin_len--, bin_data++ ) { /* Shift the data into our buffer */ @@ -474,8 +474,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -498,9 +498,9 @@ /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ - if ( (rv=PyString_FromStringAndSize(NULL, len+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, len+2)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); for( ; len > 0 ; len--, ascii_data++ ) { /* Get the byte and look it up */ @@ -534,8 +534,8 @@ Py_DECREF(rv); return NULL; } - _PyString_Resize( - &rv, (bin_data - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize( + &rv, (bin_data - (unsigned char *)PyBytes_AsString(rv))); if (rv) { PyObject *rrv = Py_BuildValue("Oi", rv, done); Py_DECREF(rv); @@ -559,9 +559,9 @@ return NULL; /* Worst case: output is twice as big as input (fixed later) */ - if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; - out_data = (unsigned char *)PyString_AsString(rv); + out_data = (unsigned char *)PyBytes_AsString(rv); for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ @@ -627,8 +627,8 @@ leftchar <<= (6-leftbits); *ascii_data++ = table_b2a_hqx[leftchar & 0x3f]; } - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -647,14 +647,14 @@ /* Empty string is a special case */ if ( in_len == 0 ) - return PyString_FromString(""); + return PyBytes_FromString(""); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; - if ( (rv=PyString_FromStringAndSize(NULL, out_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, out_len)) == NULL ) return NULL; out_len_left = out_len; - out_data = (unsigned char *)PyString_AsString(rv); + out_data = (unsigned char *)PyBytes_AsString(rv); /* ** We need two macros here to get/put bytes and handle @@ -673,9 +673,9 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ - _PyString_Resize(&rv, 2*out_len); \ + _PyBytes_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ - out_data = (unsigned char *)PyString_AsString(rv) \ + out_data = (unsigned char *)PyBytes_AsString(rv) \ + out_len; \ out_len_left = out_len-1; \ out_len = out_len * 2; \ @@ -723,8 +723,8 @@ OUTBYTE(in_byte); } } - _PyString_Resize(&rv, (out_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (out_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -923,10 +923,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; - retval = PyString_FromStringAndSize(NULL, arglen*2); + retval = PyBytes_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; - retbuf = PyString_AsString(retval); + retbuf = PyBytes_AsString(retval); if (!retbuf) goto finally; @@ -989,10 +989,10 @@ return NULL; } - retval = PyString_FromStringAndSize(NULL, (arglen/2)); + retval = PyBytes_FromStringAndSize(NULL, (arglen/2)); if (!retval) return NULL; - retbuf = PyString_AsString(retval); + retbuf = PyBytes_AsString(retval); if (!retbuf) goto finally; @@ -1106,7 +1106,7 @@ out++; } } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1306,7 +1306,7 @@ } } } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1354,7 +1354,7 @@ return; d = PyModule_GetDict(m); - x = PyString_FromString(doc_binascii); + x = PyBytes_FromString(doc_binascii); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/bsddbmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/bsddbmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/bsddbmodule.c Sun Jun 1 17:18:10 2008 @@ -312,7 +312,7 @@ return NULL; } - result = PyString_FromStringAndSize(data, (int)drec.size); + result = PyBytes_FromStringAndSize(data, (int)drec.size); if (data != buf) free(data); return result; } @@ -424,7 +424,7 @@ if (dp->di_type == DB_RECNO) item = PyInt_FromLong(*((int*)data)); else - item = PyString_FromStringAndSize(data, + item = PyBytes_FromStringAndSize(data, (int)krec.size); if (data != buf) free(data); if (item == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/bz2module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/bz2module.c (original) +++ python/branches/tlee-ast-optimize/Modules/bz2module.c Sun Jun 1 17:18:10 2008 @@ -34,7 +34,7 @@ #error "Large file support, but neither off_t nor fpos_t is large enough." #endif -#define BUF(v) PyString_AS_STRING((PyStringObject *)v) +#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) #define MODE_CLOSED 0 #define MODE_READ 1 @@ -241,7 +241,7 @@ int univ_newline = f->f_univ_newline; total_v_size = n > 0 ? n : 100; - v = PyString_FromStringAndSize((char *)NULL, total_v_size); + v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; @@ -307,7 +307,7 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, total_v_size) < 0) + if (_PyBytes_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -315,7 +315,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyString_Resize(&v, used_v_size); + _PyBytes_Resize(&v, used_v_size); return v; } @@ -438,10 +438,10 @@ /* This is a hacked version of Python's * fileobject.c:readahead_get_line_skip(). */ -static PyStringObject * +static PyBytesObject * Util_ReadAheadGetLineSkip(BZ2FileObject *f, int skip, int bufsize) { - PyStringObject* s; + PyBytesObject* s; char *bufptr; char *buf; int len; @@ -452,17 +452,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyStringObject *) - PyString_FromStringAndSize(NULL, skip); + return (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip); bufptr = memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyStringObject *) - PyString_FromStringAndSize(NULL, skip+len); + s = (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) Util_DropReadAhead(f); @@ -476,7 +476,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyString_AS_STRING(s)+skip, bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -509,7 +509,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -531,7 +531,7 @@ "more than a Python string can hold"); goto cleanup; } - ret = PyString_FromStringAndSize((char *)NULL, buffersize); + ret = PyBytes_FromStringAndSize((char *)NULL, buffersize); if (ret == NULL) goto cleanup; bytesread = 0; @@ -557,14 +557,14 @@ } if (bytesrequested < 0) { buffersize = Util_NewBufferSize(buffersize); - if (_PyString_Resize(&ret, buffersize) < 0) + if (_PyBytes_Resize(&ret, buffersize) < 0) goto cleanup; } else { break; } } if (bytesread != buffersize) - _PyString_Resize(&ret, bytesread); + _PyBytes_Resize(&ret, bytesread); cleanup: RELEASE_LOCK(self); @@ -594,7 +594,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -607,7 +607,7 @@ } if (sizehint == 0) - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); else ret = Util_GetLine(self, (sizehint < 0) ? 0 : sizehint); @@ -701,17 +701,17 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyString_FromStringAndSize( + big_buffer = PyBytes_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - _PyString_Resize(&big_buffer, buffersize); - buffer = PyString_AS_STRING(big_buffer); + _PyBytes_Resize(&big_buffer, buffersize); + buffer = PyBytes_AS_STRING(big_buffer); } continue; } @@ -720,7 +720,7 @@ while (p != NULL) { /* Process complete lines */ p++; - line = PyString_FromStringAndSize(q, p-q); + line = PyBytes_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -743,7 +743,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyString_FromStringAndSize(buffer, nfilled); + line = PyBytes_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -753,7 +753,7 @@ Py_DECREF(line); goto error; } - PyString_Concat(&line, rest); + PyBytes_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -915,7 +915,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { const char *buffer; Py_ssize_t len; if (PyObject_AsCharBuffer(v, &buffer, &len)) { @@ -926,7 +926,7 @@ "strings"); goto error; } - line = PyString_FromStringAndSize(buffer, + line = PyBytes_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -942,9 +942,9 @@ Py_BEGIN_ALLOW_THREADS for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyString_GET_SIZE(line); + len = PyBytes_GET_SIZE(line); BZ2_bzWrite (&bzerror, self->fp, - PyString_AS_STRING(line), len); + PyBytes_AS_STRING(line), len); if (bzerror != BZ_OK) { Py_BLOCK_THREADS Util_CatchBZ2Error(bzerror); @@ -1224,13 +1224,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyString_FromString("\r"); + return PyBytes_FromString("\r"); case NEWLINE_LF: - return PyString_FromString("\n"); + return PyBytes_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyString_FromString("\r\n"); + return PyBytes_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -1448,7 +1448,7 @@ static PyObject * BZ2File_iternext(BZ2FileObject *self) { - PyStringObject* ret; + PyBytesObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { PyErr_SetString(PyExc_ValueError, @@ -1457,7 +1457,7 @@ } ret = Util_ReadAheadGetLineSkip(self, 0, READAHEAD_BUFSIZE); RELEASE_LOCK(self); - if (ret == NULL || PyString_GET_SIZE(ret) == 0) { + if (ret == NULL || PyBytes_GET_SIZE(ret) == 0) { Py_XDECREF(ret); return NULL; } @@ -1559,7 +1559,7 @@ return NULL; if (datasize == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); ACQUIRE_LOCK(self); if (!self->running) { @@ -1568,7 +1568,7 @@ goto error; } - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1591,7 +1591,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); goto error; } @@ -1601,7 +1601,7 @@ } } - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1636,7 +1636,7 @@ } self->running = 0; - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1657,7 +1657,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) + if (_PyBytes_Resize(&ret, bufsize) < 0) goto error; bzs->next_out = BUF(ret); bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) @@ -1667,7 +1667,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1849,7 +1849,7 @@ goto error; } - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1868,7 +1868,7 @@ if (bzs->avail_in != 0) { Py_DECREF(self->unused_data); self->unused_data = - PyString_FromStringAndSize(bzs->next_in, + PyBytes_FromStringAndSize(bzs->next_in, bzs->avail_in); } self->running = 0; @@ -1882,7 +1882,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); goto error; } @@ -1894,7 +1894,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1930,7 +1930,7 @@ } #endif - self->unused_data = PyString_FromString(""); + self->unused_data = PyBytes_FromString(""); if (!self->unused_data) goto error; @@ -2063,7 +2063,7 @@ * data in one shot. We will check it later anyway. */ bufsize = datasize + (datasize/100+1) + 600; - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2095,7 +2095,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2106,7 +2106,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); return ret; @@ -2134,9 +2134,9 @@ return NULL; if (datasize == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2175,7 +2175,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2186,7 +2186,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); return ret; @@ -2223,7 +2223,7 @@ if (m == NULL) return; - PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); + PyModule_AddObject(m, "__author__", PyBytes_FromString(__author__)); Py_INCREF(&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); Modified: python/branches/tlee-ast-optimize/Modules/cPickle.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cPickle.c (original) +++ python/branches/tlee-ast-optimize/Modules/cPickle.c Sun Jun 1 17:18:10 2008 @@ -393,13 +393,13 @@ if (format) args = Py_VaBuildValue(format, va); va_end(va); if (format && ! args) return NULL; - if (stringformat && !(retval=PyString_FromString(stringformat))) + if (stringformat && !(retval=PyBytes_FromString(stringformat))) return NULL; if (retval) { if (args) { PyObject *v; - v=PyString_Format(retval, args); + v=PyBytes_Format(retval, args); Py_DECREF(retval); Py_DECREF(args); if (! v) return NULL; @@ -477,7 +477,7 @@ n = (int)_n; if (s == NULL) { if (!( self->buf_size )) return 0; - py_str = PyString_FromStringAndSize(self->write_buf, + py_str = PyBytes_FromStringAndSize(self->write_buf, self->buf_size); if (!py_str) return -1; @@ -490,7 +490,7 @@ if (n > WRITE_BUF_SIZE) { if (!( py_str = - PyString_FromStringAndSize(s, n))) + PyBytes_FromStringAndSize(s, n))) return -1; } else { @@ -655,7 +655,7 @@ Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyString_AsString(str))) return -1; + if (! (*s = PyBytes_AsString(str))) return -1; return n; } @@ -670,13 +670,13 @@ return -1; } - if ((str_size = PyString_Size(str)) < 0) + if ((str_size = PyBytes_Size(str)) < 0) return -1; Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyString_AsString(str))) + if (! (*s = PyBytes_AsString(str))) return -1; return str_size; @@ -1078,9 +1078,9 @@ "to pickle"); goto finally; } - repr = PyString_FromStringAndSize(NULL, (int)nbytes); + repr = PyBytes_FromStringAndSize(NULL, (int)nbytes); if (repr == NULL) goto finally; - pdata = (unsigned char *)PyString_AS_STRING(repr); + pdata = (unsigned char *)PyBytes_AS_STRING(repr); i = _PyLong_AsByteArray((PyLongObject *)args, pdata, nbytes, 1 /* little endian */, 1 /* signed */); @@ -1121,14 +1121,14 @@ if (!( repr = PyObject_Repr(args))) goto finally; - if ((size = PyString_Size(repr)) < 0) + if ((size = PyBytes_Size(repr)) < 0) goto finally; if (self->write_func(self, &l, 1) < 0) goto finally; if (self->write_func(self, - PyString_AS_STRING((PyStringObject *)repr), + PyBytes_AS_STRING((PyBytesObject *)repr), size) < 0) goto finally; @@ -1177,7 +1177,7 @@ int size, len; PyObject *repr=0; - if ((size = PyString_Size(args)) < 0) + if ((size = PyBytes_Size(args)) < 0) return -1; if (!self->bin) { @@ -1188,9 +1188,9 @@ if (!( repr = PyObject_Repr(args))) return -1; - if ((len = PyString_Size(repr)) < 0) + if ((len = PyBytes_Size(repr)) < 0) goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); + repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1207,7 +1207,7 @@ int i; char c_str[5]; - if ((size = PyString_Size(args)) < 0) + if ((size = PyBytes_Size(args)) < 0) return -1; if (size < 256) { @@ -1233,8 +1233,8 @@ } else { if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)args), + PyBytes_AS_STRING( + (PyBytesObject *)args), size) < 0) return -1; } @@ -1264,13 +1264,13 @@ static const char *hexdigit = "0123456789ABCDEF"; - repr = PyString_FromStringAndSize(NULL, 6 * size); + repr = PyBytes_FromStringAndSize(NULL, 6 * size); if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyString_AS_STRING(repr); + p = q = PyBytes_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; /* Map 16-bit characters to '\uxxxx' */ @@ -1287,7 +1287,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyString_Resize(&repr, p - q); + _PyBytes_Resize(&repr, p - q); return repr; } @@ -1310,9 +1310,9 @@ if (!repr) return -1; - if ((len = PyString_Size(repr)) < 0) + if ((len = PyBytes_Size(repr)) < 0) goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); + repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1332,7 +1332,7 @@ if (!( repr = PyUnicode_AsUTF8String(args))) return -1; - if ((size = PyString_Size(repr)) < 0) + if ((size = PyBytes_Size(repr)) < 0) goto err; if (size > INT_MAX) return -1; /* string too large */ @@ -1351,7 +1351,7 @@ PDATA_APPEND(self->file, repr, -1); } else { - if (self->write_func(self, PyString_AS_STRING(repr), + if (self->write_func(self, PyBytes_AS_STRING(repr), size) < 0) goto err; } @@ -1861,12 +1861,12 @@ goto finally; - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(name)) < 0) + if ((module_size = PyBytes_Size(module)) < 0 || + (name_size = PyBytes_Size(name)) < 0) goto finally; - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)name); + module_str = PyBytes_AS_STRING((PyBytesObject *)module); + name_str = PyBytes_AS_STRING((PyBytesObject *)name); if (self->write_func(self, &inst, 1) < 0) goto finally; @@ -1961,12 +1961,12 @@ if (!( module = whichmodule(args, global_name))) goto finally; - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(global_name)) < 0) + if ((module_size = PyBytes_Size(module)) < 0 || + (name_size = PyBytes_Size(global_name)) < 0) goto finally; - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)global_name); + module_str = PyBytes_AS_STRING((PyBytesObject *)module); + name_str = PyBytes_AS_STRING((PyBytesObject *)global_name); /* XXX This can be doing a relative import. Clearly it shouldn't, but I don't know how to stop it. :-( */ @@ -2099,7 +2099,7 @@ if (pid != Py_None) { if (!self->bin) { - if (!PyString_Check(pid)) { + if (!PyBytes_Check(pid)) { PyErr_SetString(PicklingError, "persistent id must be string"); goto finally; @@ -2108,12 +2108,12 @@ if (self->write_func(self, &persid, 1) < 0) goto finally; - if ((size = PyString_Size(pid)) < 0) + if ((size = PyBytes_Size(pid)) < 0) goto finally; if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)pid), + PyBytes_AS_STRING( + (PyBytesObject *)pid), size) < 0) goto finally; @@ -2194,8 +2194,8 @@ use_newobj = 0; } else { - use_newobj = PyString_Check(temp) && - strcmp(PyString_AS_STRING(temp), + use_newobj = PyBytes_Check(temp) && + strcmp(PyBytes_AS_STRING(temp), "__newobj__") == 0; Py_DECREF(temp); } @@ -2362,14 +2362,14 @@ break; case 's': - if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { + if ((type == &PyBytes_Type) && (PyBytes_GET_SIZE(args) < 2)) { res = save_string(self, args, 0); goto finally; } #ifdef Py_USING_UNICODE case 'u': - if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { + if ((type == &PyUnicode_Type) && (PyBytes_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } @@ -2391,7 +2391,7 @@ switch (type->tp_name[0]) { case 's': - if (type == &PyString_Type) { + if (type == &PyBytes_Type) { res = save_string(self, args, 1); goto finally; } @@ -2526,7 +2526,7 @@ if (t == NULL) goto finally; - if (PyString_Check(t)) { + if (PyBytes_Check(t)) { res = save_global(self, args, t); goto finally; } @@ -2640,8 +2640,8 @@ for (rsize = 0, i = l; --i >= 0; ) { k = data->data[i]; - if (PyString_Check(k)) - rsize += PyString_GET_SIZE(k); + if (PyBytes_Check(k)) + rsize += PyBytes_GET_SIZE(k); else if (PyInt_Check(k)) { /* put */ ik = PyInt_AS_LONG((PyIntObject*)k); @@ -2676,17 +2676,17 @@ } /* Now generate the result */ - r = PyString_FromStringAndSize(NULL, rsize); + r = PyBytes_FromStringAndSize(NULL, rsize); if (r == NULL) goto err; - s = PyString_AS_STRING((PyStringObject *)r); + s = PyBytes_AS_STRING((PyBytesObject *)r); for (i = 0; i < l; i++) { k = data->data[i]; - if (PyString_Check(k)) { - ssize = PyString_GET_SIZE(k); + if (PyBytes_Check(k)) { + ssize = PyBytes_GET_SIZE(k); if (ssize) { - p=PyString_AS_STRING((PyStringObject *)k); + p=PyBytes_AS_STRING((PyBytesObject *)k); while (--ssize >= 0) *s++ = *p++; } @@ -3410,7 +3410,7 @@ goto insecure; /********************************************/ - str = PyString_DecodeEscape(p, len, NULL, 0, NULL); + str = PyBytes_DecodeEscape(p, len, NULL, 0, NULL); free(s); if (str) { PDATA_PUSH(self->stack, str, -1); @@ -3439,7 +3439,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyString_FromStringAndSize(s, l))) + if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); @@ -3461,7 +3461,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; + if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); return 0; @@ -3688,12 +3688,12 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); + module_name = PyBytes_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { if (len < 2) return bad_readline(); - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3772,7 +3772,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); + module_name = PyBytes_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { @@ -3780,7 +3780,7 @@ Py_DECREF(module_name); return bad_readline(); } - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3805,7 +3805,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - pid = PyString_FromStringAndSize(s, len - 1); + pid = PyBytes_FromStringAndSize(s, len - 1); if (!pid) return -1; if (PyList_Check(self->pers_func)) { @@ -3938,7 +3938,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; + if (!( py_str = PyBytes_FromStringAndSize(s, len - 1))) return -1; value = PyDict_GetItem(self->memo, py_str); if (! value) { @@ -4064,8 +4064,8 @@ * confirm that pair is really a 2-tuple of strings. */ if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || - !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || - !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { + !PyBytes_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || + !PyBytes_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { Py_DECREF(py_code); PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " "isn't a 2-tuple of strings", code); @@ -4098,7 +4098,7 @@ if ((l = self->readline_func(self, &s)) < 0) return -1; if (l < 2) return bad_readline(); if (!( len=self->stack->length )) return stackUnderflow(); - if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; + if (!( py_str = PyBytes_FromStringAndSize(s, l - 1))) return -1; value=self->stack->data[len-1]; l=PyDict_SetItem(self->memo, py_str, value); Py_DECREF(py_str); @@ -5568,7 +5568,7 @@ { PyObject *copyreg, *t, *r; -#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; +#define INIT_STR(S) if (!( S ## _str=PyBytes_InternFromString(#S))) return -1; if (PyType_Ready(&Unpicklertype) < 0) return -1; @@ -5736,7 +5736,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - v = PyString_FromString(rev); + v = PyBytes_FromString(rev); PyDict_SetItemString(d, "__version__", v); Py_XDECREF(v); @@ -5755,7 +5755,7 @@ /* These are purely informational; no code uses them. */ /* File format version we write. */ - format_version = PyString_FromString("2.0"); + format_version = PyBytes_FromString("2.0"); /* Format versions we can read. */ compatible_formats = Py_BuildValue("[sssss]", "1.0", /* Original protocol 0 */ Modified: python/branches/tlee-ast-optimize/Modules/cStringIO.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cStringIO.c (original) +++ python/branches/tlee-ast-optimize/Modules/cStringIO.c Sun Jun 1 17:18:10 2008 @@ -119,7 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; - return PyString_FromStringAndSize(((IOobject*)self)->buf, + return PyBytes_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,7 +137,7 @@ } else s=self->string_size; - return PyString_FromStringAndSize(self->buf, s); + return PyBytes_FromStringAndSize(self->buf, s); } PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); @@ -177,7 +177,7 @@ if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); @@ -215,7 +215,7 @@ n -= m; self->pos -= m; } - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); @@ -238,7 +238,7 @@ goto err; if (n == 0) break; - line = PyString_FromStringAndSize (output, n); + line = PyBytes_FromStringAndSize (output, n); if (!line) goto err; if (PyList_Append (result, line) == -1) { @@ -315,7 +315,7 @@ next = IO_readline((IOobject *)self, NULL); if (!next) return NULL; - if (!PyString_GET_SIZE(next)) { + if (!PyBytes_GET_SIZE(next)) { Py_DECREF(next); PyErr_SetNone(PyExc_StopIteration); return NULL; @@ -456,7 +456,7 @@ while ((s = PyIter_Next(it)) != NULL) { Py_ssize_t n; char *c; - if (PyString_AsStringAndSize(s, &c, &n) == -1) { + if (PyBytes_AsStringAndSize(s, &c, &n) == -1) { Py_DECREF(it); Py_DECREF(s); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/cdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/cdmodule.c Sun Jun 1 17:18:10 2008 @@ -239,19 +239,19 @@ if (!PyArg_ParseTuple(args, "i:readda", &numframes)) return NULL; - result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); + result = PyBytes_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); if (result == NULL) return NULL; n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyString_AsString(result), numframes); + (CDFRAME *) PyBytes_AsString(result), numframes); if (n == -1) { Py_DECREF(result); PyErr_SetFromErrno(CdError); return NULL; } if (n < numframes) - _PyString_Resize(&result, n * sizeof(CDFRAME)); + _PyBytes_Resize(&result, n * sizeof(CDFRAME)); return result; } @@ -468,7 +468,7 @@ PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); switch (type) { case cd_audio: - v = PyString_FromStringAndSize(data, CDDA_DATASIZE); + v = PyBytes_FromStringAndSize(data, CDDA_DATASIZE); break; case cd_pnum: case cd_index: @@ -484,15 +484,15 @@ #undef ptr break; case cd_catalog: - v = PyString_FromStringAndSize(NULL, 13); - p = PyString_AsString(v); + v = PyBytes_FromStringAndSize(NULL, 13); + p = PyBytes_AsString(v); for (i = 0; i < 13; i++) *p++ = ((char *) data)[i] + '0'; break; case cd_ident: #define ptr ((struct cdident *) data) - v = PyString_FromStringAndSize(NULL, 12); - p = PyString_AsString(v); + v = PyBytes_FromStringAndSize(NULL, 12); + p = PyBytes_AsString(v); CDsbtoa(p, ptr->country, 2); p += 2; CDsbtoa(p, ptr->owner, 3); Modified: python/branches/tlee-ast-optimize/Modules/cgensupport.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cgensupport.c (original) +++ python/branches/tlee-ast-optimize/Modules/cgensupport.c Sun Jun 1 17:18:10 2008 @@ -119,10 +119,10 @@ PyObject *v; if (!PyArg_GetObject(args, nargs, i, &v)) return 0; - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { return PyErr_BadArgument(); } - *p_arg = PyString_AsString(v); + *p_arg = PyBytes_AsString(v); return 1; } Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h (original) +++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h Sun Jun 1 17:18:10 2008 @@ -261,7 +261,7 @@ const MultibyteCodec *codec; const char *enc; - if (!PyString_Check(encoding)) { + if (!PyBytes_Check(encoding)) { PyErr_SetString(PyExc_TypeError, "encoding name must be a string."); return NULL; @@ -271,7 +271,7 @@ if (cofunc == NULL) return NULL; - enc = PyString_AS_STRING(encoding); + enc = PyBytes_AS_STRING(encoding); for (codec = codec_list; codec->encoding[0]; codec++) if (strcmp(codec->encoding, enc) == 0) break; Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c (original) +++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c Sun Jun 1 17:18:10 2008 @@ -85,7 +85,7 @@ else if (strcmp(errors, "replace") == 0) return ERROR_REPLACE; else - return PyString_FromString(errors); + return PyBytes_FromString(errors); } static PyObject * @@ -93,8 +93,8 @@ { PyObject *args, *cb, *r; - assert(PyString_Check(errors)); - cb = PyCodec_LookupError(PyString_AS_STRING(errors)); + assert(PyBytes_Check(errors)); + cb = PyCodec_LookupError(PyBytes_AS_STRING(errors)); if (cb == NULL) return NULL; @@ -129,7 +129,7 @@ return self->errors; } - return PyString_FromString(errors); + return PyBytes_FromString(errors); } static int @@ -138,12 +138,12 @@ { PyObject *cb; - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "errors must be a string"); return -1; } - cb = internal_error_callback(PyString_AS_STRING(value)); + cb = internal_error_callback(PyBytes_AS_STRING(value)); if (cb == NULL) return -1; @@ -166,15 +166,15 @@ Py_ssize_t orgpos, orgsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - - PyString_AS_STRING(buf->outobj)); - orgsize = PyString_GET_SIZE(buf->outobj); - if (_PyString_Resize(&buf->outobj, orgsize + ( + PyBytes_AS_STRING(buf->outobj)); + orgsize = PyBytes_GET_SIZE(buf->outobj); + if (_PyBytes_Resize(&buf->outobj, orgsize + ( esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) return -1; - buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; - buf->outbuf_end = (unsigned char *)PyString_AS_STRING(buf->outobj) - + PyString_GET_SIZE(buf->outobj); + buf->outbuf = (unsigned char *)PyBytes_AS_STRING(buf->outobj) +orgpos; + buf->outbuf_end = (unsigned char *)PyBytes_AS_STRING(buf->outobj) + + PyBytes_GET_SIZE(buf->outobj); return 0; } @@ -322,10 +322,10 @@ goto errorexit; } - retstrsize = PyString_GET_SIZE(retstr); + retstrsize = PyBytes_GET_SIZE(retstr); REQUIRE_ENCODEBUFFER(buf, retstrsize); - memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); + memcpy(buf->outbuf, PyBytes_AS_STRING(retstr), retstrsize); buf->outbuf += retstrsize; newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); @@ -468,16 +468,16 @@ Py_ssize_t finalsize, r = 0; if (datalen == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; - buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); + buf.outobj = PyBytes_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; - buf.outbuf = (unsigned char *)PyString_AS_STRING(buf.outobj); - buf.outbuf_end = buf.outbuf + PyString_GET_SIZE(buf.outobj); + buf.outbuf = (unsigned char *)PyBytes_AS_STRING(buf.outobj); + buf.outbuf_end = buf.outbuf + PyBytes_GET_SIZE(buf.outobj); while (buf.inbuf < buf.inbuf_end) { Py_ssize_t inleft, outleft; @@ -512,10 +512,10 @@ } finalsize = (Py_ssize_t)((char *)buf.outbuf - - PyString_AS_STRING(buf.outobj)); + PyBytes_AS_STRING(buf.outobj)); - if (finalsize != PyString_GET_SIZE(buf.outobj)) - if (_PyString_Resize(&buf.outobj, finalsize) == -1) + if (finalsize != PyBytes_GET_SIZE(buf.outobj)) + if (_PyBytes_Resize(&buf.outobj, finalsize) == -1) goto errorexit; Py_XDECREF(buf.excobj); @@ -1222,35 +1222,35 @@ if (cres == NULL) goto errorexit; - if (!PyString_Check(cres)) { + if (!PyBytes_Check(cres)) { PyErr_SetString(PyExc_TypeError, "stream function returned a " "non-string object"); goto errorexit; } - endoffile = (PyString_GET_SIZE(cres) == 0); + endoffile = (PyBytes_GET_SIZE(cres) == 0); if (self->pendingsize > 0) { PyObject *ctr; char *ctrdata; - rsize = PyString_GET_SIZE(cres) + self->pendingsize; - ctr = PyString_FromStringAndSize(NULL, rsize); + rsize = PyBytes_GET_SIZE(cres) + self->pendingsize; + ctr = PyBytes_FromStringAndSize(NULL, rsize); if (ctr == NULL) goto errorexit; - ctrdata = PyString_AS_STRING(ctr); + ctrdata = PyBytes_AS_STRING(ctr); memcpy(ctrdata, self->pending, self->pendingsize); memcpy(ctrdata + self->pendingsize, - PyString_AS_STRING(cres), - PyString_GET_SIZE(cres)); + PyBytes_AS_STRING(cres), + PyBytes_GET_SIZE(cres)); Py_DECREF(cres); cres = ctr; self->pendingsize = 0; } - rsize = PyString_GET_SIZE(cres); - if (decoder_prepare_buffer(&buf, PyString_AS_STRING(cres), + rsize = PyBytes_GET_SIZE(cres); + if (decoder_prepare_buffer(&buf, PyBytes_AS_STRING(cres), rsize) != 0) goto errorexit; @@ -1585,7 +1585,7 @@ if (pwrt == NULL) return NULL; - if (PyString_Size(pwrt) > 0) { + if (PyBytes_Size(pwrt) > 0) { PyObject *wr; wr = PyObject_CallMethod(self->stream, "write", "O", pwrt); if (wr == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/clmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/clmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/clmodule.c Sun Jun 1 17:18:10 2008 @@ -111,7 +111,7 @@ return NULL; retry: - compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); + compressedBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); if (compressedBuffer == NULL) return NULL; @@ -120,7 +120,7 @@ if (clCompressImage(compressionScheme, width, height, originalFormat, compressionRatio, (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(compressedBuffer)) + (void *) PyBytes_AsString(compressedBuffer)) == FAILURE || error_handler_called) { Py_DECREF(compressedBuffer); if (!error_handler_called) @@ -135,7 +135,7 @@ } if (compressedBufferSize < frameBufferSize) - _PyString_Resize(&compressedBuffer, compressedBufferSize); + _PyBytes_Resize(&compressedBuffer, compressedBufferSize); return compressedBuffer; } @@ -155,14 +155,14 @@ frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); + frameBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); if (frameBuffer == NULL) return NULL; error_handler_called = 0; if (clDecompressImage(compressionScheme, width, height, originalFormat, compressedBufferSize, compressedBuffer, - (void *) PyString_AsString(frameBuffer)) + (void *) PyBytes_AsString(frameBuffer)) == FAILURE || error_handler_called) { Py_DECREF(frameBuffer); if (!error_handler_called) @@ -236,14 +236,14 @@ if (error_handler_called) return NULL; - data = PyString_FromStringAndSize(NULL, size); + data = PyBytes_FromStringAndSize(NULL, size); if (data == NULL) return NULL; error_handler_called = 0; if (clCompress(SELF->ob_compressorHdl, numberOfFrames, (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(data)) == FAILURE || + (void *) PyBytes_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -252,7 +252,7 @@ } if (compressedBufferSize < size) - if (_PyString_Resize(&data, compressedBufferSize)) + if (_PyBytes_Resize(&data, compressedBufferSize)) return NULL; if (compressedBufferSize > size) { @@ -285,14 +285,14 @@ if (error_handler_called) return NULL; - data = PyString_FromStringAndSize(NULL, dataSize); + data = PyBytes_FromStringAndSize(NULL, dataSize); if (data == NULL) return NULL; error_handler_called = 0; if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, compressedDataSize, (void *) compressedData, - (void *) PyString_AsString(data)) == FAILURE || + (void *) PyBytes_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -514,7 +514,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); + PyBytes_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -563,7 +563,7 @@ return NULL; } - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * @@ -775,7 +775,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); + PyBytes_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -818,7 +818,7 @@ return NULL; } - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/datetimemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/datetimemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/datetimemodule.c Sun Jun 1 17:18:10 2008 @@ -945,7 +945,7 @@ else result = PyObject_CallMethod(tzinfo, "tzname", "O", tzinfoarg); - if (result != NULL && result != Py_None && ! PyString_Check(result)) { + if (result != NULL && result != Py_None && ! PyBytes_Check(result)) { PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " "return None or a string, not '%s'", Py_TYPE(result)->tp_name); @@ -1044,27 +1044,27 @@ { PyObject *temp; - assert(PyString_Check(repr)); + assert(PyBytes_Check(repr)); assert(tzinfo); if (tzinfo == Py_None) return repr; /* Get rid of the trailing ')'. */ - assert(PyString_AsString(repr)[PyString_Size(repr)-1] == ')'); - temp = PyString_FromStringAndSize(PyString_AsString(repr), - PyString_Size(repr) - 1); + assert(PyBytes_AsString(repr)[PyBytes_Size(repr)-1] == ')'); + temp = PyBytes_FromStringAndSize(PyBytes_AsString(repr), + PyBytes_Size(repr) - 1); Py_DECREF(repr); if (temp == NULL) return NULL; repr = temp; /* Append ", tzinfo=". */ - PyString_ConcatAndDel(&repr, PyString_FromString(", tzinfo=")); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(", tzinfo=")); /* Append repr(tzinfo). */ - PyString_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); + PyBytes_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); /* Add a closing paren. */ - PyString_ConcatAndDel(&repr, PyString_FromString(")")); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(")")); return repr; } @@ -1090,7 +1090,7 @@ DayNames[wday], MonthNames[GET_MONTH(date) - 1], GET_DAY(date), hours, minutes, seconds, GET_YEAR(date)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* Add an hours & minutes UTC offset string to buf. buf has no more than @@ -1141,7 +1141,7 @@ else sprintf(freplacement, "%06d", 0); - return PyString_FromStringAndSize(freplacement, strlen(freplacement)); + return PyBytes_FromStringAndSize(freplacement, strlen(freplacement)); } /* I sure don't want to reproduce the strftime code from the time module, @@ -1174,7 +1174,7 @@ int ntoappend; /* # of bytes to append to output buffer */ assert(object && format && timetuple); - assert(PyString_Check(format)); + assert(PyBytes_Check(format)); /* Give up if the year is before 1900. * Python strftime() plays games with the year, and different @@ -1205,13 +1205,13 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ - totalnew = PyString_Size(format) + 1; /* realistic if no %z/%Z/%f */ - newfmt = PyString_FromStringAndSize(NULL, totalnew); + totalnew = PyBytes_Size(format) + 1; /* realistic if no %z/%Z/%f */ + newfmt = PyBytes_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; - pnew = PyString_AsString(newfmt); + pnew = PyBytes_AsString(newfmt); usednew = 0; - pin = PyString_AsString(format); + pin = PyBytes_AsString(format); while ((ch = *pin++) != '\0') { if (ch != '%') { ptoappend = pin - 1; @@ -1229,7 +1229,7 @@ /* format utcoffset */ char buf[100]; PyObject *tzinfo = get_tzinfo_member(object); - zreplacement = PyString_FromString(""); + zreplacement = PyBytes_FromString(""); if (zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { assert(tzinfoarg != NULL); @@ -1240,19 +1240,19 @@ tzinfoarg) < 0) goto Done; Py_DECREF(zreplacement); - zreplacement = PyString_FromString(buf); + zreplacement = PyBytes_FromString(buf); if (zreplacement == NULL) goto Done; } } assert(zreplacement != NULL); - ptoappend = PyString_AS_STRING(zreplacement); - ntoappend = PyString_GET_SIZE(zreplacement); + ptoappend = PyBytes_AS_STRING(zreplacement); + ntoappend = PyBytes_GET_SIZE(zreplacement); } else if (ch == 'Z') { /* format tzname */ if (Zreplacement == NULL) { PyObject *tzinfo = get_tzinfo_member(object); - Zreplacement = PyString_FromString(""); + Zreplacement = PyBytes_FromString(""); if (Zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { PyObject *temp; @@ -1260,7 +1260,7 @@ temp = call_tzname(tzinfo, tzinfoarg); if (temp == NULL) goto Done; if (temp != Py_None) { - assert(PyString_Check(temp)); + assert(PyBytes_Check(temp)); /* Since the tzname is getting * stuffed into the format, we * have to double any % signs @@ -1274,7 +1274,7 @@ Py_DECREF(temp); if (Zreplacement == NULL) goto Done; - if (!PyString_Check(Zreplacement)) { + if (!PyBytes_Check(Zreplacement)) { PyErr_SetString(PyExc_TypeError, "tzname.replace() did not return a string"); goto Done; } @@ -1284,8 +1284,8 @@ } } assert(Zreplacement != NULL); - ptoappend = PyString_AS_STRING(Zreplacement); - ntoappend = PyString_GET_SIZE(Zreplacement); + ptoappend = PyBytes_AS_STRING(Zreplacement); + ntoappend = PyBytes_GET_SIZE(Zreplacement); } else if (ch == 'f') { /* format microseconds */ @@ -1295,9 +1295,9 @@ goto Done; } assert(freplacement != NULL); - assert(PyString_Check(freplacement)); - ptoappend = PyString_AS_STRING(freplacement); - ntoappend = PyString_GET_SIZE(freplacement); + assert(PyBytes_Check(freplacement)); + ptoappend = PyBytes_AS_STRING(freplacement); + ntoappend = PyBytes_GET_SIZE(freplacement); } else { /* percent followed by neither z nor Z */ @@ -1318,10 +1318,10 @@ PyErr_NoMemory(); goto Done; } - if (_PyString_Resize(&newfmt, bigger) < 0) + if (_PyBytes_Resize(&newfmt, bigger) < 0) goto Done; totalnew = bigger; - pnew = PyString_AsString(newfmt) + usednew; + pnew = PyBytes_AsString(newfmt) + usednew; } memcpy(pnew, ptoappend, ntoappend); pnew += ntoappend; @@ -1329,7 +1329,7 @@ assert(usednew <= totalnew); } /* end while() */ - if (_PyString_Resize(&newfmt, usednew) < 0) + if (_PyBytes_Resize(&newfmt, usednew) < 0) goto Done; { PyObject *time = PyImport_ImportModuleNoBlock("time"); @@ -2007,18 +2007,18 @@ delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d, %d)", + return PyBytes_FromFormat("%s(%d, %d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d)", + return PyBytes_FromFormat("%s(%d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); - return PyString_FromFormat("%s(%d)", + return PyBytes_FromFormat("%s(%d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self)); } @@ -2062,7 +2062,7 @@ pbuf += n; } - return PyString_FromStringAndSize(buf, pbuf - buf); + return PyBytes_FromStringAndSize(buf, pbuf - buf); Fail: PyErr_SetString(PyExc_SystemError, "goofy result from PyOS_snprintf"); @@ -2241,15 +2241,15 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) == 1 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && + MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) { PyDateTime_Date *me; me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); me->hashcode = -1; } @@ -2447,7 +2447,7 @@ type_name, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } static PyObject * @@ -2456,7 +2456,7 @@ char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* str() calls the appropriate isoformat() method. */ @@ -2485,7 +2485,7 @@ static char *keywords[] = {"format", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyString_Type, &format)) + &PyBytes_Type, &format)) return NULL; tuple = PyObject_CallMethod((PyObject *)self, "timetuple", "()"); @@ -2506,9 +2506,9 @@ return NULL; /* Check for str or unicode */ - if (PyString_Check(format)) { + if (PyBytes_Check(format)) { /* If format is zero length, return str(self) */ - if (PyString_GET_SIZE(format) == 0) + if (PyBytes_GET_SIZE(format) == 0) return PyObject_Str((PyObject *)self); } else if (PyUnicode_Check(format)) { /* If format is zero length, return str(self) */ @@ -2651,7 +2651,7 @@ { return Py_BuildValue( "(N)", - PyString_FromStringAndSize((char *)self->data, + PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_DATE_DATASIZE)); } @@ -3107,9 +3107,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && + ((unsigned char) (PyBytes_AS_STRING(state)[0])) < 24) { PyDateTime_Time *me; char aware; @@ -3125,7 +3125,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); me->hashcode = -1; @@ -3211,7 +3211,7 @@ else PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d)", type_name, h, m); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); if (result != NULL && HASTZINFO(self)) result = append_keyword_tzinfo(result, self->tzinfo); return result; @@ -3238,7 +3238,7 @@ _PyDateTime_TIME_DATASIZE); isoformat_time(pdatetime, buf, sizeof(buf)); - result = PyString_FromString(buf); + result = PyBytes_FromString(buf); if (result == NULL || ! HASTZINFO(self) || self->tzinfo == Py_None) return result; @@ -3248,7 +3248,7 @@ Py_DECREF(result); return NULL; } - PyString_ConcatAndDel(&result, PyString_FromString(buf)); + PyBytes_ConcatAndDel(&result, PyBytes_FromString(buf)); return result; } @@ -3261,7 +3261,7 @@ static char *keywords[] = {"format", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyString_Type, &format)) + &PyBytes_Type, &format)) return NULL; /* Python's strftime does insane things with the year part of the @@ -3360,7 +3360,7 @@ /* Reduce this to a hash of another object. */ if (offset == 0) - temp = PyString_FromStringAndSize((char *)self->data, + temp = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); else { int hour; @@ -3448,7 +3448,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyString_FromStringAndSize((char *)self->data, + basestate = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) @@ -3635,9 +3635,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && + MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) { PyDateTime_DateTime *me; char aware; @@ -3653,7 +3653,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); me->hashcode = -1; @@ -4162,7 +4162,7 @@ GET_YEAR(self), GET_MONTH(self), GET_DAY(self), DATE_GET_HOUR(self), DATE_GET_MINUTE(self)); } - baserepr = PyString_FromString(buffer); + baserepr = PyBytes_FromString(buffer); if (baserepr == NULL || ! HASTZINFO(self)) return baserepr; return append_keyword_tzinfo(baserepr, self->tzinfo); @@ -4190,7 +4190,7 @@ assert(cp != NULL); *cp++ = sep; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); if (result == NULL || ! HASTZINFO(self)) return result; @@ -4200,7 +4200,7 @@ Py_DECREF(result); return NULL; } - PyString_ConcatAndDel(&result, PyString_FromString(buffer)); + PyBytes_ConcatAndDel(&result, PyBytes_FromString(buffer)); return result; } @@ -4306,7 +4306,7 @@ /* Reduce this to a hash of another object. */ if (n == OFFSET_NAIVE) - temp = PyString_FromStringAndSize( + temp = PyBytes_FromStringAndSize( (char *)self->data, _PyDateTime_DATETIME_DATASIZE); else { @@ -4529,7 +4529,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyString_FromStringAndSize((char *)self->data, + basestate = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_DATETIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) Modified: python/branches/tlee-ast-optimize/Modules/dbmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/dbmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/dbmmodule.c Sun Jun 1 17:18:10 2008 @@ -104,7 +104,7 @@ drec = dbm_fetch(dp->di_dbm, krec); if ( drec.dptr == 0 ) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)key)); + PyBytes_AS_STRING((PyBytesObject *)key)); return NULL; } if ( dbm_error(dp->di_dbm) ) { @@ -112,7 +112,7 @@ PyErr_SetString(DbmError, ""); return NULL; } - return PyString_FromStringAndSize(drec.dptr, drec.dsize); + return PyBytes_FromStringAndSize(drec.dptr, drec.dsize); } static int @@ -136,7 +136,7 @@ if ( dbm_delete(dp->di_dbm, krec) < 0 ) { dbm_clearerr(dp->di_dbm); PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)v)); + PyBytes_AS_STRING((PyBytesObject *)v)); return -1; } } else { @@ -166,7 +166,7 @@ { datum key, val; - if (PyString_AsStringAndSize(v, (char **)&key.dptr, + if (PyBytes_AsStringAndSize(v, (char **)&key.dptr, (Py_ssize_t *)&key.dsize)) { return -1; } @@ -222,7 +222,7 @@ return NULL; for (key = dbm_firstkey(dp->di_dbm); key.dptr; key = dbm_nextkey(dp->di_dbm)) { - item = PyString_FromStringAndSize(key.dptr, key.dsize); + item = PyBytes_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { Py_DECREF(v); return NULL; @@ -269,7 +269,7 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyString_FromStringAndSize(val.dptr, val.dsize); + return PyBytes_FromStringAndSize(val.dptr, val.dsize); else { Py_INCREF(defvalue); return defvalue; @@ -292,16 +292,16 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyString_FromStringAndSize(val.dptr, val.dsize); + return PyBytes_FromStringAndSize(val.dptr, val.dsize); if (defvalue == NULL) { - defvalue = PyString_FromStringAndSize(NULL, 0); + defvalue = PyBytes_FromStringAndSize(NULL, 0); if (defvalue == NULL) return NULL; } else Py_INCREF(defvalue); - val.dptr = PyString_AS_STRING(defvalue); - val.dsize = PyString_GET_SIZE(defvalue); + val.dptr = PyBytes_AS_STRING(defvalue); + val.dsize = PyBytes_GET_SIZE(defvalue); if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) { dbm_clearerr(dp->di_dbm); PyErr_SetString(DbmError, "cannot add item to database"); @@ -404,7 +404,7 @@ d = PyModule_GetDict(m); if (DbmError == NULL) DbmError = PyErr_NewException("dbm.error", NULL, NULL); - s = PyString_FromString(which_dbm); + s = PyBytes_FromString(which_dbm); if (s != NULL) { PyDict_SetItemString(d, "library", s); Py_DECREF(s); Modified: python/branches/tlee-ast-optimize/Modules/dlmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/dlmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/dlmodule.c Sun Jun 1 17:18:10 2008 @@ -58,8 +58,8 @@ { char *name; PyUnivPtr *func; - if (PyString_Check(args)) { - name = PyString_AS_STRING(args); + if (PyBytes_Check(args)) { + name = PyBytes_AS_STRING(args); } else { PyErr_Format(PyExc_TypeError, "expected string, found %.200s", Py_TYPE(args)->tp_name); @@ -88,14 +88,14 @@ return NULL; } name = PyTuple_GetItem(args, 0); - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "function name must be a string"); return NULL; } func = (long (*)(long, long, long, long, long, long, long, long, long, long)) - dlsym(xp->dl_handle, PyString_AsString(name)); + dlsym(xp->dl_handle, PyBytes_AsString(name)); if (func == NULL) { PyErr_SetString(PyExc_ValueError, dlerror()); return NULL; @@ -109,8 +109,8 @@ PyObject *v = PyTuple_GetItem(args, i); if (PyInt_Check(v)) alist[i-1] = PyInt_AsLong(v); - else if (PyString_Check(v)) - alist[i-1] = (long)PyString_AsString(v); + else if (PyBytes_Check(v)) + alist[i-1] = (long)PyBytes_AsString(v); else if (v == Py_None) alist[i-1] = (long) ((char *)NULL); else { Modified: python/branches/tlee-ast-optimize/Modules/errnomodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/errnomodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/errnomodule.c Sun Jun 1 17:18:10 2008 @@ -21,7 +21,7 @@ static void _inscode(PyObject *d, PyObject *de, char *name, int code) { - PyObject *u = PyString_FromString(name); + PyObject *u = PyBytes_FromString(name); PyObject *v = PyInt_FromLong((long) code); /* Don't bother checking for errors; they'll be caught at the end Modified: python/branches/tlee-ast-optimize/Modules/fcntlmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/fcntlmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/fcntlmodule.c Sun Jun 1 17:18:10 2008 @@ -55,7 +55,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } PyErr_Clear(); @@ -164,7 +164,7 @@ return PyInt_FromLong(ret); } else { - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } } @@ -185,7 +185,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Modules/flmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/flmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/flmodule.c Sun Jun 1 17:18:10 2008 @@ -324,7 +324,7 @@ /* "label" is an exception, getmember only works for char pointers, not for char arrays */ if (strcmp(name, "label") == 0) - return PyString_FromString(g->ob_generic->label); + return PyBytes_FromString(g->ob_generic->label); return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); } @@ -343,12 +343,12 @@ /* "label" is an exception: setmember doesn't set strings; and FORMS wants you to call a function to set the label */ if (strcmp(name, "label") == 0) { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(PyExc_TypeError, "label attr must be string"); return -1; } - fl_set_object_label(g->ob_generic, PyString_AsString(v)); + fl_set_object_label(g->ob_generic, PyBytes_AsString(v)); return 0; } @@ -369,7 +369,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", g, g->ob_generic->objclass); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyTypeObject GenericObjecttype = { @@ -530,7 +530,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString (str); + return PyBytes_FromString (str); } /* int func (object) */ @@ -628,7 +628,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString (str); + return PyBytes_FromString (str); } static PyObject * @@ -1594,7 +1594,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", f, f->ob_form->window); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyTypeObject Formtype = { @@ -2027,7 +2027,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * @@ -2046,7 +2046,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } @@ -2061,7 +2061,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/fmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/fmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/fmmodule.c Sun Jun 1 17:18:10 2008 @@ -66,7 +66,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); return NULL; } - return PyString_FromStringAndSize(fontname, len); + return PyBytes_FromStringAndSize(fontname, len); } static PyObject * @@ -79,7 +79,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); return NULL; } - return PyString_FromStringAndSize(comment, len); + return PyBytes_FromStringAndSize(comment, len); } static PyObject * @@ -200,7 +200,7 @@ PyObject *v; if (fontlist == NULL) return; - v = PyString_FromString(fontname); + v = PyBytes_FromString(fontname); if (v == NULL) err = -1; else { @@ -240,7 +240,7 @@ static PyObject * fm_fontpath(PyObject *self) { - return PyString_FromString(fmfontpath()); + return PyBytes_FromString(fmfontpath()); } static PyMethodDef fm_methods[] = { Modified: python/branches/tlee-ast-optimize/Modules/gcmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/gcmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/gcmodule.c Sun Jun 1 17:18:10 2008 @@ -639,8 +639,8 @@ char *cname; /* simple version of instance_repr */ PyObject *classname = inst->in_class->cl_name; - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); + if (classname != NULL && PyBytes_Check(classname)) + cname = PyBytes_AsString(classname); else cname = "?"; PySys_WriteStderr("gc: %.100s <%.100s instance at %p>\n", @@ -754,7 +754,7 @@ double t1 = 0.0; if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); + delstr = PyBytes_InternFromString("__del__"); if (delstr == NULL) Py_FatalError("gc couldn't allocate \"__del__\""); } @@ -898,7 +898,7 @@ if (PyErr_Occurred()) { if (gc_str == NULL) - gc_str = PyString_FromString("garbage collection"); + gc_str = PyBytes_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); } Modified: python/branches/tlee-ast-optimize/Modules/gdbmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/gdbmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/gdbmmodule.c Sun Jun 1 17:18:10 2008 @@ -128,10 +128,10 @@ drec = gdbm_fetch(dp->di_dbm, krec); if (drec.dptr == 0) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)key)); + PyBytes_AS_STRING((PyBytesObject *)key)); return NULL; } - v = PyString_FromStringAndSize(drec.dptr, drec.dsize); + v = PyBytes_FromStringAndSize(drec.dptr, drec.dsize); free(drec.dptr); return v; } @@ -155,7 +155,7 @@ if (w == NULL) { if (gdbm_delete(dp->di_dbm, krec) < 0) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)v)); + PyBytes_AS_STRING((PyBytesObject *)v)); return -1; } } @@ -188,14 +188,14 @@ "GDBM object has already been closed"); return -1; } - if (!PyString_Check(arg)) { + if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, "gdbm key must be string, not %.100s", arg->ob_type->tp_name); return -1; } - key.dptr = PyString_AS_STRING(arg); - key.dsize = PyString_GET_SIZE(arg); + key.dptr = PyBytes_AS_STRING(arg); + key.dsize = PyBytes_GET_SIZE(arg); return gdbm_exists(dp->di_dbm, key); } @@ -255,7 +255,7 @@ key = gdbm_firstkey(dp->di_dbm); while (key.dptr) { - item = PyString_FromStringAndSize(key.dptr, key.dsize); + item = PyBytes_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { free(key.dptr); Py_DECREF(v); @@ -306,7 +306,7 @@ check_dbmobject_open(dp); key = gdbm_firstkey(dp->di_dbm); if (key.dptr) { - v = PyString_FromStringAndSize(key.dptr, key.dsize); + v = PyBytes_FromStringAndSize(key.dptr, key.dsize); free(key.dptr); return v; } @@ -338,7 +338,7 @@ check_dbmobject_open(dp); nextkey = gdbm_nextkey(dp->di_dbm, key); if (nextkey.dptr) { - v = PyString_FromStringAndSize(nextkey.dptr, nextkey.dsize); + v = PyBytes_FromStringAndSize(nextkey.dptr, nextkey.dsize); free(nextkey.dptr); return v; } @@ -541,7 +541,7 @@ DbmError = PyErr_NewException("gdbm.error", NULL, NULL); if (DbmError != NULL) { PyDict_SetItemString(d, "error", DbmError); - s = PyString_FromString(dbmmodule_open_flags); + s = PyBytes_FromString(dbmmodule_open_flags); PyDict_SetItemString(d, "open_flags", s); Py_DECREF(s); } Modified: python/branches/tlee-ast-optimize/Modules/glmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/glmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/glmodule.c Sun Jun 1 17:18:10 2008 @@ -593,7 +593,7 @@ #if 0 /* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { + if (!PyBytes_Check(s) || PyBytes_Size(s) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to lrectwrite has wrong size"); return NULL; @@ -623,10 +623,10 @@ if (!PyArg_GetShort(args, 4, 3, &y2)) return NULL; pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + parray = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (parray == NULL) return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); + lrectread(x1, y1, x2, y2, (unsigned long *) PyBytes_AsString(parray)); return parray; } @@ -642,10 +642,10 @@ if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) return 0; size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); + rv = PyBytes_FromStringAndSize((char *)NULL, size*sizeof(long)); if ( rv == NULL ) return NULL; - parray = (unsigned long *)PyString_AsString(rv); + parray = (unsigned long *)PyBytes_AsString(rv); size_ret = readdisplay(x1, y1, x2, y2, parray, hints); if ( size_ret != size ) { printf("gl_readdisplay: got %ld pixels, expected %ld\n", @@ -700,16 +700,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyString_Size(unpacked) != pixcount*sizeof(long)) { + if (PyBytes_Size(unpacked) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to packrect has wrong size"); return NULL; } - packed = PyString_FromStringAndSize((char *)NULL, packedcount); + packed = PyBytes_FromStringAndSize((char *)NULL, packedcount); if (packed == NULL) return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); + parray = (unsigned long *) PyBytes_AsString(unpacked); + p = (unsigned char *) PyBytes_AsString(packed); for (y = 0; y < height; y += packfactor, parray += packfactor*width) { for (x = 0; x < width; x += packfactor) { pixel = parray[x]; @@ -758,16 +758,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyString_Size(packed) != packedcount) { + if (PyBytes_Size(packed) != packedcount) { PyErr_SetString(PyExc_RuntimeError, "string arg to unpackrect has wrong size"); return NULL; } - unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + unpacked = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (unpacked == NULL) return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); + parray = (unsigned long *) PyBytes_AsString(unpacked); + p = (unsigned char *) PyBytes_AsString(packed); if (packfactor == 1 && width*height > 0) { /* Just expand bytes to longs */ register int x = width * height; @@ -799,7 +799,7 @@ { char buf[20]; gversion(buf); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } Modified: python/branches/tlee-ast-optimize/Modules/grpmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/grpmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/grpmodule.c Sun Jun 1 17:18:10 2008 @@ -47,7 +47,7 @@ return NULL; } for (member = p->gr_mem; *member != NULL; member++) { - PyObject *x = PyString_FromString(*member); + PyObject *x = PyBytes_FromString(*member); if (x == NULL || PyList_Append(w, x) != 0) { Py_XDECREF(x); Py_DECREF(w); @@ -58,13 +58,13 @@ } #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) - SET(setIndex++, PyString_FromString(p->gr_name)); + SET(setIndex++, PyBytes_FromString(p->gr_name)); #ifdef __VMS SET(setIndex++, Py_None); Py_INCREF(Py_None); #else if (p->gr_passwd) - SET(setIndex++, PyString_FromString(p->gr_passwd)); + SET(setIndex++, PyBytes_FromString(p->gr_passwd)); else { SET(setIndex++, Py_None); Py_INCREF(Py_None); @@ -113,7 +113,7 @@ py_str_name = PyObject_Str(pyo_name); if (!py_str_name) return NULL; - name = PyString_AS_STRING(py_str_name); + name = PyBytes_AS_STRING(py_str_name); if ((p = getgrnam(name)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name); Modified: python/branches/tlee-ast-optimize/Modules/imageop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/imageop.c (original) +++ python/branches/tlee-ast-optimize/Modules/imageop.c Sun Jun 1 17:18:10 2008 @@ -54,7 +54,7 @@ return 1; if (bcos == NULL) { /* cache string object for future use */ - bcos = PyString_FromString("backward_compatible"); + bcos = PyBytes_FromString("backward_compatible"); if (bcos == NULL) return 1; } @@ -97,11 +97,11 @@ xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; - rv = PyString_FromStringAndSize(NULL, + rv = PyBytes_FromStringAndSize(NULL, (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); if ( rv == 0 ) return 0; - ncp = (char *)PyString_AsString(rv); + ncp = (char *)PyBytes_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; newy2 += ystep; @@ -150,10 +150,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, newx*newy*size); + rv = PyBytes_FromStringAndSize(NULL, newx*newy*size); if ( rv == 0 ) return 0; - ncp = (char *)PyString_AsString(rv); + ncp = (char *)PyBytes_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; for( iy = 0; iy < newy; iy++ ) { @@ -195,10 +195,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); if ( width == 1 ) { memcpy(ncp, cp, maxx); /* Copy first line */ @@ -245,10 +245,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+7)/8); + rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; ovalue = 0; @@ -286,10 +286,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+1)/2); + rv = PyBytes_FromStringAndSize(NULL, (len+1)/2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -325,10 +325,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+3)/4); + rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -363,10 +363,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+7)/8); + rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; ovalue = 0; @@ -409,10 +409,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+3)/4); + rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 1; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -449,10 +449,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; for ( i=0; i < nlen; i++ ) { @@ -486,10 +486,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -522,10 +522,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -559,10 +559,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */ @@ -603,10 +603,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen*4); + rv = PyBytes_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: RRRBBGGG @@ -653,10 +653,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { if (backward_compatible) { @@ -698,10 +698,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen*4); + rv = PyBytes_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { value = *cp++; Modified: python/branches/tlee-ast-optimize/Modules/imgfile.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/imgfile.c (original) +++ python/branches/tlee-ast-optimize/Modules/imgfile.c Sun Jun 1 17:18:10 2008 @@ -130,12 +130,12 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); + rv = PyBytes_FromStringAndSize((char *)NULL, xsize*ysize*zsize); if ( rv == NULL ) { iclose(image); return NULL; } - cdatap = PyString_AsString(rv); + cdatap = PyBytes_AsString(rv); idatap = (long *)cdatap; if (top_to_bottom) { @@ -319,7 +319,7 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); + rv = PyBytes_FromStringAndSize(NULL, xwtd*ywtd*zsize); if ( rv == NULL ) { iclose(image); return NULL; @@ -328,7 +328,7 @@ xfac = (float)xsize/(float)xwtd; yfac = (float)ysize/(float)ywtd; PyFPE_END_PROTECT(yfac) - cdatap = PyString_AsString(rv); + cdatap = PyBytes_AsString(rv); idatap = (long *)cdatap; if ( extended ) { Modified: python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c Sun Jun 1 17:18:10 2008 @@ -2904,12 +2904,12 @@ PyObject *result; if (lz->cnt != PY_SSIZE_T_MAX) - return PyString_FromFormat("count(%zd)", lz->cnt); + return PyBytes_FromFormat("count(%zd)", lz->cnt); cnt_repr = PyObject_Repr(lz->long_cnt); if (cnt_repr == NULL) return NULL; - result = PyString_FromFormat("count(%s)", PyString_AS_STRING(cnt_repr)); + result = PyBytes_FromFormat("count(%s)", PyBytes_AS_STRING(cnt_repr)); Py_DECREF(cnt_repr); return result; } @@ -3221,11 +3221,11 @@ return NULL; if (ro->cnt == -1) - result = PyString_FromFormat("repeat(%s)", - PyString_AS_STRING(objrepr)); + result = PyBytes_FromFormat("repeat(%s)", + PyBytes_AS_STRING(objrepr)); else - result = PyString_FromFormat("repeat(%s, %zd)", - PyString_AS_STRING(objrepr), ro->cnt); + result = PyBytes_FromFormat("repeat(%s, %zd)", + PyBytes_AS_STRING(objrepr), ro->cnt); Py_DECREF(objrepr); return result; } Modified: python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c Sun Jun 1 17:18:10 2008 @@ -162,17 +162,17 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyString_AS_STRING(rv); + cp = PyBytes_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; } self->x_icount += count; - _PyString_Resize(&rv, count); + _PyBytes_Resize(&rv, count); return rv; } Modified: python/branches/tlee-ast-optimize/Modules/main.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/main.c (original) +++ python/branches/tlee-ast-optimize/Modules/main.c Sun Jun 1 17:18:10 2008 @@ -99,6 +99,7 @@ PYTHONHOME : alternate directory (or %c).\n\ The default module search path uses %s.\n\ PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\ +PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ "; @@ -195,7 +196,7 @@ { PyObject *argv0 = NULL, *importer = NULL; - if ((argv0 = PyString_FromString(filename)) && + if ((argv0 = PyBytes_FromString(filename)) && (importer = PyImport_GetImporter(argv0)) && (importer->ob_type != &PyNullImporter_Type)) { Modified: python/branches/tlee-ast-optimize/Modules/mathmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/mathmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/mathmodule.c Sun Jun 1 17:18:10 2008 @@ -318,14 +318,20 @@ value semantics across iterations (i.e. handling -Inf + Inf). Note 2: No provision is made for intermediate overflow handling; - therefore, sum([1e+308, 1e-308, 1e+308]) returns result 1e+308 while + therefore, sum([1e+308, 1e-308, 1e+308]) returns 1e+308 while sum([1e+308, 1e+308, 1e-308]) raises an OverflowError due to the overflow of the first partial sum. - Note 3: Aggressively optimizing compilers can potentially eliminate the - residual values needed for accurate summation. For instance, the statements - "hi = x + y; lo = y - (hi - x);" could be mis-transformed to - "hi = x + y; lo = 0.0;" which defeats the computation of residuals. + Note 3: The itermediate values lo, yr, and hi are declared volatile so + aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. + Also, the volatile declaration forces the values to be stored in memory as + regular doubles instead of extended long precision (80-bit) values. This + prevents double rounding because any addition or substraction of two doubles + can be resolved exactly into double-sized hi and lo values. As long as the + hi value gets forced into a double before yr and lo are computed, the extra + bits in downstream extended precision operations (x87 for example) will be + exactly zero and therefore can be losslessly stored back into a double, + thereby preventing double rounding. Note 4: A similar implementation is in Modules/cmathmodule.c. Be sure to update both when making changes. @@ -402,7 +408,8 @@ { PyObject *item, *iter, *sum = NULL; Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - double x, y, hi, lo=0.0, ps[NUM_PARTIALS], *p = ps; + double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile double hi, yr, lo; iter = PyObject_GetIter(seq); if (iter == NULL) @@ -428,10 +435,12 @@ for (i = j = 0; j < n; j++) { /* for y in partials */ y = p[j]; + if (fabs(x) < fabs(y)) { + t = x; x = y; y = t; + } hi = x + y; - lo = fabs(x) < fabs(y) - ? x - (hi - y) - : y - (hi - x); + yr = hi - x; + lo = y - yr; if (lo != 0.0) p[i++] = lo; x = hi; @@ -451,38 +460,41 @@ } } + hi = 0.0; if (n > 0) { hi = p[--n]; if (Py_IS_FINITE(hi)) { /* sum_exact(ps, hi) from the top, stop when the sum becomes inexact. */ while (n > 0) { - x = p[--n]; - y = hi; + x = hi; + y = p[--n]; + assert(fabs(y) < fabs(x)); hi = x + y; - assert(fabs(x) < fabs(y)); - lo = x - (hi - y); + yr = hi - x; + lo = y - yr; if (lo != 0.0) break; } - /* Little dance to allow half-even rounding across multiple partials. - Needed so that sum([1e-16, 1, 1e16]) will round-up to two instead - of down to zero (the 1e16 makes the 1 slightly closer to two). */ + /* Make half-even rounding work across multiple partials. Needed + so that sum([1e-16, 1, 1e16]) will round-up the last digit to + two instead of down to zero (the 1e-16 makes the 1 slightly + closer to two). With a potential 1 ULP rounding error fixed-up, + math.sum() can guarantee commutativity. */ if (n > 0 && ((lo < 0.0 && p[n-1] < 0.0) || (lo > 0.0 && p[n-1] > 0.0))) { y = lo * 2.0; x = hi + y; - if (y == (x - hi)) + yr = x - hi; + if (y == yr) hi = x; } } - else { /* raise corresponding error */ + else { /* raise exception corresponding to a special value */ errno = Py_IS_NAN(hi) ? EDOM : ERANGE; if (is_error(hi)) goto _sum_error; } } - else /* default */ - hi = 0.0; sum = PyFloat_FromDouble(hi); _sum_error: Modified: python/branches/tlee-ast-optimize/Modules/md5module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/md5module.c (original) +++ python/branches/tlee-ast-optimize/Modules/md5module.c Sun Jun 1 17:18:10 2008 @@ -80,7 +80,7 @@ mdContext = self->md5; md5_finish(&mdContext, aDigest); - return PyString_FromStringAndSize((char *)aDigest, 16); + return PyBytes_FromStringAndSize((char *)aDigest, 16); } PyDoc_STRVAR(digest_doc, @@ -113,7 +113,7 @@ c = (c>9) ? c+'a'-10 : c + '0'; hexdigest[j++] = c; } - return PyString_FromStringAndSize((char*)hexdigest, 32); + return PyBytes_FromStringAndSize((char*)hexdigest, 32); } @@ -165,7 +165,7 @@ static PyObject * md5_get_name(PyObject *self, void *closure) { - return PyString_FromStringAndSize("MD5", 3); + return PyBytes_FromStringAndSize("MD5", 3); } static PyGetSetDef md5_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/mmapmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/mmapmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/mmapmodule.c Sun Jun 1 17:18:10 2008 @@ -222,7 +222,7 @@ else ++eol; /* we're interested in the position after the newline. */ - result = PyString_FromStringAndSize(start, (eol - start)); + result = PyBytes_FromStringAndSize(start, (eol - start)); self->pos += (eol - start); return result; } @@ -700,7 +700,7 @@ PyErr_SetString(PyExc_IndexError, "mmap index out of range"); return NULL; } - return PyString_FromStringAndSize(self->data + i, 1); + return PyBytes_FromStringAndSize(self->data + i, 1); } static PyObject * @@ -718,7 +718,7 @@ else if ((size_t)ihigh > self->size) ihigh = self->size; - return PyString_FromStringAndSize(self->data + ilow, ihigh-ilow); + return PyBytes_FromStringAndSize(self->data + ilow, ihigh-ilow); } static PyObject * @@ -736,7 +736,7 @@ "mmap index out of range"); return NULL; } - return PyString_FromStringAndSize(self->data + i, 1); + return PyBytes_FromStringAndSize(self->data + i, 1); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; @@ -747,9 +747,9 @@ } if (slicelen <= 0) - return PyString_FromStringAndSize("", 0); + return PyBytes_FromStringAndSize("", 0); else if (step == 1) - return PyString_FromStringAndSize(self->data + start, + return PyBytes_FromStringAndSize(self->data + start, slicelen); else { char *result_buf = (char *)PyMem_Malloc(slicelen); @@ -762,7 +762,7 @@ cur += step, i++) { result_buf[i] = self->data[cur]; } - result = PyString_FromStringAndSize(result_buf, + result = PyBytes_FromStringAndSize(result_buf, slicelen); PyMem_Free(result_buf); return result; @@ -815,19 +815,19 @@ "mmap object doesn't support slice deletion"); return -1; } - if (! (PyString_Check(v)) ) { + if (! (PyBytes_Check(v)) ) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyString_Size(v) != (ihigh - ilow)) { + if (PyBytes_Size(v) != (ihigh - ilow)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(v); + buf = PyBytes_AsString(v); memcpy(self->data + ilow, buf, ihigh-ilow); return 0; } @@ -847,14 +847,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (! (PyString_Check(v) && PyString_Size(v)==1) ) { + if (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(v); + buf = PyBytes_AsString(v); self->data[i] = buf[0]; return 0; } @@ -882,14 +882,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (!PyString_Check(value) || PyString_Size(value) != 1) { + if (!PyBytes_Check(value) || PyBytes_Size(value) != 1) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(value); + buf = PyBytes_AsString(value); self->data[i] = buf[0]; return 0; } @@ -906,12 +906,12 @@ "mmap object doesn't support slice deletion"); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyString_Size(value) != slicelen) { + if (PyBytes_Size(value) != slicelen) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; @@ -922,7 +922,7 @@ if (slicelen == 0) return 0; else if (step == 1) { - const char *buf = PyString_AsString(value); + const char *buf = PyBytes_AsString(value); if (buf == NULL) return -1; @@ -931,7 +931,7 @@ } else { Py_ssize_t cur, i; - const char *buf = PyString_AsString(value); + const char *buf = PyBytes_AsString(value); if (buf == NULL) return -1; Modified: python/branches/tlee-ast-optimize/Modules/nismodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/nismodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/nismodule.c Sun Jun 1 17:18:10 2008 @@ -115,8 +115,8 @@ if (invallen > 0 && inval[invallen-1] == '\0') invallen--; } - key = PyString_FromStringAndSize(inkey, inkeylen); - val = PyString_FromStringAndSize(inval, invallen); + key = PyBytes_FromStringAndSize(inkey, inkeylen); + val = PyBytes_FromStringAndSize(inval, invallen); if (key == NULL || val == NULL) { /* XXX error -- don't know how to handle */ PyErr_Clear(); @@ -146,7 +146,7 @@ if ((err = yp_get_default_domain(&domain)) != 0) return nis_error(err); - res = PyString_FromStringAndSize (domain, strlen(domain)); + res = PyBytes_FromStringAndSize (domain, strlen(domain)); return res; } @@ -178,7 +178,7 @@ len--; if (err != 0) return nis_error(err); - res = PyString_FromStringAndSize (match, len); + res = PyBytes_FromStringAndSize (match, len); free (match); return res; } @@ -398,7 +398,7 @@ if ((list = PyList_New(0)) == NULL) return NULL; for (maps = maps; maps; maps = maps->next) { - PyObject *str = PyString_FromString(maps->map); + PyObject *str = PyBytes_FromString(maps->map); if (!str || PyList_Append(list, str) < 0) { Py_DECREF(list); Modified: python/branches/tlee-ast-optimize/Modules/operator.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/operator.c (original) +++ python/branches/tlee-ast-optimize/Modules/operator.c Sun Jun 1 17:18:10 2008 @@ -508,19 +508,19 @@ } #endif - if (!PyString_Check(attr)) { + if (!PyBytes_Check(attr)) { PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); return NULL; } - s = PyString_AS_STRING(attr); + s = PyBytes_AS_STRING(attr); Py_INCREF(obj); for (;;) { PyObject *newobj, *str; p = strchr(s, '.'); - str = p ? PyString_FromStringAndSize(s, (p-s)) : - PyString_FromString(s); + str = p ? PyBytes_FromStringAndSize(s, (p-s)) : + PyBytes_FromString(s); if (str == NULL) { Py_DECREF(obj); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/ossaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/ossaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/ossaudiodev.c Sun Jun 1 17:18:10 2008 @@ -366,10 +366,10 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyString_AS_STRING(rv); + cp = PyBytes_AS_STRING(rv); Py_BEGIN_ALLOW_THREADS count = read(self->fd, cp, size); @@ -381,7 +381,7 @@ return NULL; } self->icount += count; - _PyString_Resize(&rv, count); + _PyBytes_Resize(&rv, count); return rv; } @@ -811,20 +811,20 @@ Py_INCREF(rval); } else if (strcmp(name, "name") == 0) { - rval = PyString_FromString(self->devicename); + rval = PyBytes_FromString(self->devicename); } else if (strcmp(name, "mode") == 0) { /* No need for a "default" in this switch: from newossobject(), self->mode can only be one of these three values. */ switch(self->mode) { case O_RDONLY: - rval = PyString_FromString("r"); + rval = PyBytes_FromString("r"); break; case O_RDWR: - rval = PyString_FromString("rw"); + rval = PyBytes_FromString("rw"); break; case O_WRONLY: - rval = PyString_FromString("w"); + rval = PyBytes_FromString("w"); break; } } @@ -913,12 +913,12 @@ if (labels == NULL || names == NULL) goto error2; for (i = 0; i < num_controls; i++) { - s = PyString_FromString(control_labels[i]); + s = PyBytes_FromString(control_labels[i]); if (s == NULL) goto error2; PyList_SET_ITEM(labels, i, s); - s = PyString_FromString(control_names[i]); + s = PyBytes_FromString(control_names[i]); if (s == NULL) goto error2; PyList_SET_ITEM(names, i, s); Modified: python/branches/tlee-ast-optimize/Modules/parsermodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/parsermodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/parsermodule.c Sun Jun 1 17:18:10 2008 @@ -105,14 +105,14 @@ } if (TYPE(n) == encoding_decl) - (void) addelem(v, i+1, PyString_FromString(STR(n))); + (void) addelem(v, i+1, PyBytes_FromString(STR(n))); return (v); } else if (ISTERMINAL(TYPE(n))) { PyObject *result = mkseq(2 + lineno + col_offset); if (result != NULL) { (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); - (void) addelem(result, 1, PyString_FromString(STR(n))); + (void) addelem(result, 1, PyBytes_FromString(STR(n))); if (lineno == 1) (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); if (col_offset == 1) @@ -689,7 +689,7 @@ temp = PySequence_GetItem(elem, 1); if (temp == NULL) return 0; - if (!PyString_Check(temp)) { + if (!PyBytes_Check(temp)) { PyErr_Format(parser_error, "second item in terminal node must be a string," " found %s", @@ -714,10 +714,10 @@ Py_DECREF(o); } } - len = PyString_GET_SIZE(temp) + 1; + len = PyBytes_GET_SIZE(temp) + 1; strn = (char *)PyObject_MALLOC(len); if (strn != NULL) - (void) memcpy(strn, PyString_AS_STRING(temp), len); + (void) memcpy(strn, PyBytes_AS_STRING(temp), len); Py_DECREF(temp); } else if (!ISNONTERMINAL(type)) { @@ -800,10 +800,10 @@ } if (res && encoding) { Py_ssize_t len; - len = PyString_GET_SIZE(encoding) + 1; + len = PyBytes_GET_SIZE(encoding) + 1; res->n_str = (char *)PyObject_MALLOC(len); if (res->n_str != NULL) - (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len); + (void) memcpy(res->n_str, PyBytes_AS_STRING(encoding), len); Py_DECREF(encoding); Py_DECREF(tuple); } Modified: python/branches/tlee-ast-optimize/Modules/posixmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/posixmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/posixmodule.c Sun Jun 1 17:18:10 2008 @@ -375,12 +375,12 @@ char *p = strchr(*e, '='); if (p == NULL) continue; - k = PyString_FromStringAndSize(*e, (int)(p-*e)); + k = PyBytes_FromStringAndSize(*e, (int)(p-*e)); if (k == NULL) { PyErr_Clear(); continue; } - v = PyString_FromString(p+1); + v = PyBytes_FromString(p+1); if (v == NULL) { PyErr_Clear(); Py_DECREF(k); @@ -400,13 +400,13 @@ rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ - PyObject *v = PyString_FromString(buffer); + PyObject *v = PyBytes_FromString(buffer); PyDict_SetItemString(d, "BEGINLIBPATH", v); Py_DECREF(v); } rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ - PyObject *v = PyString_FromString(buffer); + PyObject *v = PyBytes_FromString(buffer); PyDict_SetItemString(d, "ENDLIBPATH", v); Py_DECREF(v); } @@ -1598,7 +1598,7 @@ #endif if (ret == NULL) return posix_error(); - return PyString_FromString(ret); + return PyBytes_FromString(ret); } #endif @@ -1620,7 +1620,7 @@ #endif if (ret == NULL) return posix_error(); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } #endif @@ -1968,7 +1968,7 @@ Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #ifdef Py_USING_UNICODE @@ -2174,7 +2174,7 @@ /* Skip over . and .. */ if (strcmp(FileData.cFileName, ".") != 0 && strcmp(FileData.cFileName, "..") != 0) { - v = PyString_FromString(FileData.cFileName); + v = PyBytes_FromString(FileData.cFileName); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2262,7 +2262,7 @@ /* Leave Case of Name Alone -- In Native Form */ /* (Removed Forced Lowercasing Code) */ - v = PyString_FromString(namebuf); + v = PyBytes_FromString(namebuf); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2312,7 +2312,7 @@ (NAMLEN(ep) == 1 || (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) continue; - v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); + v = PyBytes_FromStringAndSize(ep->d_name, NAMLEN(ep)); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2397,7 +2397,7 @@ return PyUnicode_Decode(outbuf, strlen(outbuf), Py_FileSystemDefaultEncoding, NULL); } - return PyString_FromString(outbuf); + return PyBytes_FromString(outbuf); } /* end of posix__getfullpathname */ #endif /* MS_WINDOWS */ @@ -3062,7 +3062,7 @@ /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { #endif - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3292,7 +3292,7 @@ { goto fail_2; } - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3525,7 +3525,7 @@ { goto fail_2; } - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3895,7 +3895,7 @@ "unable to determine login name"); } else - result = PyString_FromString(name); + result = PyBytes_FromString(name); errno = old_errno; return result; @@ -5884,7 +5884,7 @@ return posix_error_with_allocated_filename(path); PyMem_Free(path); - v = PyString_FromStringAndSize(buf, n); + v = PyBytes_FromStringAndSize(buf, n); #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -6289,18 +6289,18 @@ errno = EINVAL; return posix_error(); } - buffer = PyString_FromStringAndSize((char *)NULL, size); + buffer = PyBytes_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - n = read(fd, PyString_AsString(buffer), size); + n = read(fd, PyBytes_AsString(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) - _PyString_Resize(&buffer, n); + _PyBytes_Resize(&buffer, n); return buffer; } @@ -6647,11 +6647,11 @@ /* XXX This can leak memory -- not easy to fix :-( */ len = strlen(s1) + strlen(s2) + 2; /* len includes space for a trailing \0; the size arg to - PyString_FromStringAndSize does not count that */ - newstr = PyString_FromStringAndSize(NULL, (int)len - 1); + PyBytes_FromStringAndSize does not count that */ + newstr = PyBytes_FromStringAndSize(NULL, (int)len - 1); if (newstr == NULL) return PyErr_NoMemory(); - newenv = PyString_AS_STRING(newstr); + newenv = PyBytes_AS_STRING(newstr); PyOS_snprintf(newenv, len, "%s=%s", s1, s2); if (putenv(newenv)) { Py_DECREF(newstr); @@ -6727,7 +6727,7 @@ "strerror() argument out of range"); return NULL; } - return PyString_FromString(message); + return PyBytes_FromString(message); } @@ -7009,7 +7009,7 @@ #endif if (name == NULL) return PyErr_NoMemory(); - result = PyString_FromString(name); + result = PyBytes_FromString(name); free(name); return result; } @@ -7066,7 +7066,7 @@ Py_XDECREF(err); return NULL; } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } #endif @@ -7095,13 +7095,13 @@ *valuep = PyInt_AS_LONG(arg); return 1; } - if (PyString_Check(arg)) { + if (PyBytes_Check(arg)) { /* look up the value in the table using a binary search */ size_t lo = 0; size_t mid; size_t hi = tablesize; int cmp; - char *confname = PyString_AS_STRING(arg); + char *confname = PyBytes_AS_STRING(arg); while (lo < hi) { mid = (lo + hi) / 2; cmp = strcmp(confname, table[mid].name); @@ -7431,12 +7431,12 @@ } else { if ((unsigned int)len >= sizeof(buffer)) { - result = PyString_FromStringAndSize(NULL, len-1); + result = PyBytes_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyString_AS_STRING(result), len); + confstr(name, PyBytes_AS_STRING(result), len); } else - result = PyString_FromStringAndSize(buffer, len-1); + result = PyBytes_FromStringAndSize(buffer, len-1); } } return result; @@ -8225,11 +8225,11 @@ } /* Allocate bytes */ - result = PyString_FromStringAndSize(NULL, howMany); + result = PyBytes_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) - PyString_AS_STRING(result))) { + PyBytes_AS_STRING(result))) { Py_DECREF(result); return win32_error("CryptGenRandom", NULL); } @@ -8259,11 +8259,11 @@ "negative argument not allowed"); /* Allocate bytes */ - result = PyString_FromStringAndSize(NULL, howMany); + result = PyBytes_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (RAND_pseudo_bytes((unsigned char*) - PyString_AS_STRING(result), + PyBytes_AS_STRING(result), howMany) < 0) { Py_DECREF(result); return PyErr_Format(PyExc_ValueError, Modified: python/branches/tlee-ast-optimize/Modules/pwdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/pwdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/pwdmodule.c Sun Jun 1 17:18:10 2008 @@ -49,7 +49,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/tlee-ast-optimize/Modules/pyexpat.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/pyexpat.c (original) +++ python/branches/tlee-ast-optimize/Modules/pyexpat.c Sun Jun 1 17:18:10 2008 @@ -153,7 +153,7 @@ { PyObject *name = hinfo->nameobj; if (name == NULL) { - name = PyString_FromString(hinfo->name); + name = PyBytes_FromString(hinfo->name); hinfo->nameobj = name; } Py_XINCREF(name); @@ -205,7 +205,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromStringAndSize((const char *)str, len); + return PyBytes_FromStringAndSize((const char *)str, len); } /* Callback routines */ @@ -267,16 +267,16 @@ PyObject *filename = NULL; if (handler_info[slot].tb_code == NULL) { - code = PyString_FromString(""); + code = PyBytes_FromString(""); if (code == NULL) goto failed; - name = PyString_FromString(func_name); + name = PyBytes_FromString(func_name); if (name == NULL) goto failed; nulltuple = PyTuple_New(0); if (nulltuple == NULL) goto failed; - filename = PyString_FromString(__FILE__); + filename = PyBytes_FromString(__FILE__); handler_info[slot].tb_code = PyCode_New(0, /* argcount */ 0, /* nlocals */ @@ -971,13 +971,13 @@ goto finally; /* XXX what to do if it returns a Unicode string? */ - if (!PyString_Check(str)) { + if (!PyBytes_Check(str)) { PyErr_Format(PyExc_TypeError, "read() did not return a string object (type=%.400s)", Py_TYPE(str)->tp_name); goto finally; } - len = PyString_GET_SIZE(str); + len = PyBytes_GET_SIZE(str); if (len > buf_size) { PyErr_Format(PyExc_ValueError, "read() returned too much data: " @@ -985,7 +985,7 @@ buf_size, len); goto finally; } - memcpy(buf, PyString_AsString(str), len); + memcpy(buf, PyBytes_AsString(str), len); finally: Py_XDECREF(arg); Py_XDECREF(str); @@ -1094,7 +1094,7 @@ = XML_GetInputContext(self->itself, &offset, &size); if (buffer != NULL) - return PyString_FromStringAndSize(buffer + offset, + return PyBytes_FromStringAndSize(buffer + offset, size - offset); else Py_RETURN_NONE; @@ -1511,7 +1511,7 @@ #define APPEND(list, str) \ do { \ - PyObject *o = PyString_FromString(str); \ + PyObject *o = PyBytes_FromString(str); \ if (o != NULL) \ PyList_Append(list, o); \ Py_XDECREF(o); \ @@ -1862,7 +1862,7 @@ while (rev[i] != ' ' && rev[i] != '\0') ++i; - return PyString_FromStringAndSize(rev, i); + return PyBytes_FromStringAndSize(rev, i); } /* Initialization function for the module */ @@ -1889,7 +1889,7 @@ MODULE_INITFUNC(void) { PyObject *m, *d; - PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); + PyObject *errmod_name = PyBytes_FromString(MODULE_NAME ".errors"); PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; @@ -1899,7 +1899,7 @@ if (errmod_name == NULL) return; - modelmod_name = PyString_FromString(MODULE_NAME ".model"); + modelmod_name = PyBytes_FromString(MODULE_NAME ".model"); if (modelmod_name == NULL) return; Modified: python/branches/tlee-ast-optimize/Modules/readline.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/readline.c (original) +++ python/branches/tlee-ast-optimize/Modules/readline.c Sun Jun 1 17:18:10 2008 @@ -421,7 +421,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyString_FromString(rl_completer_word_break_characters); + return PyBytes_FromString(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -471,7 +471,7 @@ if (!PyArg_ParseTuple(args, "i:index", &idx)) return NULL; if ((hist_ent = history_get(idx))) - return PyString_FromString(hist_ent->line); + return PyBytes_FromString(hist_ent->line); else { Py_RETURN_NONE; } @@ -503,7 +503,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyString_FromString(rl_line_buffer); + return PyBytes_FromString(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -676,7 +676,7 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyString_FromString(matches[i+1]); + s = PyBytes_FromString(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) @@ -725,7 +725,7 @@ result = NULL; } else { - char *s = PyString_AsString(r); + char *s = PyBytes_AsString(r); if (s == NULL) goto error; result = strdup(s); Modified: python/branches/tlee-ast-optimize/Modules/selectmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/selectmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/selectmodule.c Sun Jun 1 17:18:10 2008 @@ -1219,7 +1219,7 @@ "data=0x%lx udata=%p>", (unsigned long)(s->e.ident), s->e.filter, s->e.flags, s->e.fflags, (long)(s->e.data), s->e.udata); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int Modified: python/branches/tlee-ast-optimize/Modules/sha256module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sha256module.c (original) +++ python/branches/tlee-ast-optimize/Modules/sha256module.c Sun Jun 1 17:18:10 2008 @@ -432,7 +432,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); + return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA256_hexdigest__doc__, @@ -452,10 +452,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -510,9 +510,9 @@ SHA256_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 32) - return PyString_FromStringAndSize("SHA256", 6); + return PyBytes_FromStringAndSize("SHA256", 6); else - return PyString_FromStringAndSize("SHA224", 6); + return PyBytes_FromStringAndSize("SHA224", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/sha512module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sha512module.c (original) +++ python/branches/tlee-ast-optimize/Modules/sha512module.c Sun Jun 1 17:18:10 2008 @@ -498,7 +498,7 @@ SHAcopy(self, &temp); sha512_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); + return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA512_hexdigest__doc__, @@ -518,10 +518,10 @@ sha512_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -576,9 +576,9 @@ SHA512_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 64) - return PyString_FromStringAndSize("SHA512", 6); + return PyBytes_FromStringAndSize("SHA512", 6); else - return PyString_FromStringAndSize("SHA384", 6); + return PyBytes_FromStringAndSize("SHA384", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/shamodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/shamodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/shamodule.c Sun Jun 1 17:18:10 2008 @@ -380,7 +380,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); + return PyBytes_FromStringAndSize((const char *)digest, sizeof(digest)); } PyDoc_STRVAR(SHA_hexdigest__doc__, @@ -400,10 +400,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, sizeof(digest) * 2); + retval = PyBytes_FromStringAndSize(NULL, sizeof(digest) * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -463,7 +463,7 @@ static PyObject * SHA_get_name(PyObject *self, void *closure) { - return PyString_FromStringAndSize("SHA1", 4); + return PyBytes_FromStringAndSize("SHA1", 4); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/socketmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/socketmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/socketmodule.c Sun Jun 1 17:18:10 2008 @@ -911,7 +911,7 @@ set_gaierror(error); return NULL; } - return PyString_FromString(buf); + return PyBytes_FromString(buf); } @@ -955,7 +955,7 @@ sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #endif @@ -1002,14 +1002,14 @@ #ifdef linux if (a->sun_path[0] == 0) { /* Linux abstract namespace */ addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyString_FromStringAndSize(a->sun_path, + return PyBytes_FromStringAndSize(a->sun_path, addrlen); } else #endif /* linux */ { /* regular NULL-terminated string */ - return PyString_FromString(a->sun_path); + return PyBytes_FromString(a->sun_path); } } #endif /* AF_UNIX */ @@ -1362,7 +1362,7 @@ addr = (struct sockaddr_sco *)addr_ret; _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; - straddr = PyString_AsString(args); + straddr = PyBytes_AsString(args); if (straddr == NULL) { PyErr_SetString(socket_error, "getsockaddrarg: " "wrong format"); @@ -1854,16 +1854,16 @@ "getsockopt buflen out of range"); return NULL; } - buf = PyString_FromStringAndSize((char *)NULL, buflen); + buf = PyBytes_FromStringAndSize((char *)NULL, buflen); if (buf == NULL) return NULL; res = getsockopt(s->sock_fd, level, optname, - (void *)PyString_AS_STRING(buf), &buflen); + (void *)PyBytes_AS_STRING(buf), &buflen); if (res < 0) { Py_DECREF(buf); return s->errorhandler(); } - _PyString_Resize(&buf, buflen); + _PyBytes_Resize(&buf, buflen); return buf; #endif /* __BEOS__ */ } @@ -2386,12 +2386,12 @@ } /* Allocate a new string. */ - buf = PyString_FromStringAndSize((char *) 0, recvlen); + buf = PyBytes_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; /* Call the guts */ - outlen = sock_recv_guts(s, PyString_AS_STRING(buf), recvlen, flags); + outlen = sock_recv_guts(s, PyBytes_AS_STRING(buf), recvlen, flags); if (outlen < 0) { /* An error occurred, release the string and return an error. */ @@ -2401,7 +2401,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyString_Resize(&buf, outlen) < 0) + if (_PyBytes_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ return NULL; } @@ -2560,11 +2560,11 @@ return NULL; } - buf = PyString_FromStringAndSize((char *) 0, recvlen); + buf = PyBytes_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; - outlen = sock_recvfrom_guts(s, PyString_AS_STRING(buf), + outlen = sock_recvfrom_guts(s, PyBytes_AS_STRING(buf), recvlen, flags, &addr); if (outlen < 0) { goto finally; @@ -2573,7 +2573,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyString_Resize(&buf, outlen) < 0) + if (_PyBytes_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ goto finally; } @@ -2941,7 +2941,7 @@ (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } @@ -3057,7 +3057,7 @@ if (res < 0) return set_error(); buf[sizeof buf - 1] = '\0'; - return PyString_FromString(buf); + return PyBytes_FromString(buf); } PyDoc_STRVAR(gethostname_doc, @@ -3143,7 +3143,7 @@ if (h->h_aliases) { for (pch = h->h_aliases; *pch != NULL; pch++) { int status; - tmp = PyString_FromString(*pch); + tmp = PyBytes_FromString(*pch); if (tmp == NULL) goto err; @@ -3432,7 +3432,7 @@ PyErr_SetString(socket_error, "port/proto not found"); return NULL; } - return PyString_FromString(sp->s_name); + return PyBytes_FromString(sp->s_name); } PyDoc_STRVAR(getservbyport_doc, @@ -3734,7 +3734,7 @@ if (inet_aton != NULL) { #endif if (inet_aton(ip_addr, &buf)) - return PyString_FromStringAndSize((char *)(&buf), + return PyBytes_FromStringAndSize((char *)(&buf), sizeof(buf)); PyErr_SetString(socket_error, @@ -3763,7 +3763,7 @@ return NULL; } } - return PyString_FromStringAndSize((char *) &packed_addr, + return PyBytes_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); #ifdef USE_INET_ATON_WEAKLINK @@ -3797,7 +3797,7 @@ memcpy(&packed_addr, packed_str, addr_len); - return PyString_FromString(inet_ntoa(packed_addr)); + return PyBytes_FromString(inet_ntoa(packed_addr)); } #ifdef HAVE_INET_PTON @@ -3840,11 +3840,11 @@ "illegal IP address string passed to inet_pton"); return NULL; } else if (af == AF_INET) { - return PyString_FromStringAndSize(packed, + return PyBytes_FromStringAndSize(packed, sizeof(struct in_addr)); #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { - return PyString_FromStringAndSize(packed, + return PyBytes_FromStringAndSize(packed, sizeof(struct in6_addr)); #endif } else { @@ -3871,7 +3871,7 @@ char ip[INET_ADDRSTRLEN + 1]; #endif - /* Guarantee NUL-termination for PyString_FromString() below */ + /* Guarantee NUL-termination for PyBytes_FromString() below */ memset((void *) &ip[0], '\0', sizeof(ip)); if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { @@ -3903,7 +3903,7 @@ PyErr_SetFromErrno(socket_error); return NULL; } else { - return PyString_FromString(retval); + return PyBytes_FromString(retval); } /* NOTREACHED */ @@ -3944,9 +3944,9 @@ idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); if (!idna) return NULL; - hptr = PyString_AsString(idna); - } else if (PyString_Check(hobj)) { - hptr = PyString_AsString(hobj); + hptr = PyBytes_AsString(idna); + } else if (PyBytes_Check(hobj)) { + hptr = PyBytes_AsString(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); @@ -3955,8 +3955,8 @@ if (PyInt_Check(pobj)) { PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); pptr = pbuf; - } else if (PyString_Check(pobj)) { - pptr = PyString_AsString(pobj); + } else if (PyBytes_Check(pobj)) { + pptr = PyBytes_AsString(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { Modified: python/branches/tlee-ast-optimize/Modules/spwdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/spwdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/spwdmodule.c Sun Jun 1 17:18:10 2008 @@ -60,7 +60,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/tlee-ast-optimize/Modules/stropmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/stropmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/stropmodule.c Sun Jun 1 17:18:10 2008 @@ -47,7 +47,7 @@ i = i+1; } if (j < i) { - item = PyString_FromStringAndSize(s+j, i-j); + item = PyBytes_FromStringAndSize(s+j, i-j); if (item == NULL) goto finally; @@ -61,7 +61,7 @@ i = i+1; } if (maxsplit && (countsplit >= maxsplit) && i < len) { - item = PyString_FromStringAndSize( + item = PyBytes_FromStringAndSize( s+i, len - i); if (item == NULL) goto finally; @@ -122,7 +122,7 @@ i = j = 0; while (i+n <= len) { if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) { - item = PyString_FromStringAndSize(s+j, i-j); + item = PyBytes_FromStringAndSize(s+j, i-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -137,7 +137,7 @@ else i++; } - item = PyString_FromStringAndSize(s+j, len-j); + item = PyBytes_FromStringAndSize(s+j, len-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -189,7 +189,7 @@ if (seqlen == 1) { /* Optimization if there's only one item */ PyObject *item = PySequence_GetItem(seq, 0); - if (item && !PyString_Check(item)) { + if (item && !PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(item); @@ -198,9 +198,9 @@ return item; } - if (!(res = PyString_FromStringAndSize((char*)NULL, sz))) + if (!(res = PyBytes_FromStringAndSize((char*)NULL, sz))) return NULL; - p = PyString_AsString(res); + p = PyBytes_AsString(res); /* optimize for lists, since it's the most common case. all others * (tuples and arbitrary sequences) just use the sequence abstract @@ -209,29 +209,29 @@ if (PyList_Check(seq)) { for (i = 0; i < seqlen; i++) { PyObject *item = PyList_GET_ITEM(seq, i); - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); return NULL; } - slen = PyString_GET_SIZE(item); + slen = PyBytes_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) + if (_PyBytes_Resize(&res, sz * 2) < 0) return NULL; sz *= 2; - p = PyString_AsString(res) + reslen; + p = PyBytes_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyString_AS_STRING(item), slen); + memcpy(p, PyBytes_AS_STRING(item), slen); p += slen; reslen += slen; } - _PyString_Resize(&res, reslen); + _PyBytes_Resize(&res, reslen); return res; } @@ -245,33 +245,33 @@ /* This is now type safe */ for (i = 0; i < seqlen; i++) { PyObject *item = getitemfunc(seq, i); - if (!item || !PyString_Check(item)) { + if (!item || !PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); Py_XDECREF(item); return NULL; } - slen = PyString_GET_SIZE(item); + slen = PyBytes_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) { + if (_PyBytes_Resize(&res, sz * 2) < 0) { Py_DECREF(item); return NULL; } sz *= 2; - p = PyString_AsString(res) + reslen; + p = PyBytes_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyString_AS_STRING(item), slen); + memcpy(p, PyBytes_AS_STRING(item), slen); p += slen; reslen += slen; Py_DECREF(item); } - _PyString_Resize(&res, reslen); + _PyBytes_Resize(&res, reslen); return res; } @@ -369,7 +369,7 @@ Py_ssize_t len, i, j; - if (PyString_AsStringAndSize(args, &s, &len)) + if (PyBytes_AsStringAndSize(args, &s, &len)) return NULL; i = 0; @@ -392,7 +392,7 @@ return args; } else - return PyString_FromStringAndSize(s+i, j-i); + return PyBytes_FromStringAndSize(s+i, j-i); } @@ -450,12 +450,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -489,12 +489,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -529,12 +529,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; if (0 < n) { int c = Py_CHARMASK(*s++); @@ -610,12 +610,12 @@ } /* Second pass: create output string and fill it */ - out = PyString_FromStringAndSize(NULL, i+j); + out = PyBytes_FromStringAndSize(NULL, i+j); if (out == NULL) return NULL; i = 0; - q = PyString_AS_STRING(out); + q = PyBytes_AS_STRING(out); for (p = string; p < e; p++) { if (*p == '\t') { @@ -695,12 +695,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -898,10 +898,10 @@ return NULL; } - result = PyString_FromStringAndSize((char *)NULL, 256); + result = PyBytes_FromStringAndSize((char *)NULL, 256); if (result == NULL) return NULL; - c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result); + c = (unsigned char *) PyBytes_AS_STRING((PyBytesObject *)result); for (i = 0; i < 256; i++) c[i]=(unsigned char)i; for (i = 0; i < fromlen; i++) @@ -942,12 +942,12 @@ } table = table1; - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); + inlen = PyBytes_GET_SIZE(input_obj); + result = PyBytes_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AsString(input_obj); + output_start = output = PyBytes_AsString(result); + input = PyBytes_AsString(input_obj); if (dellen == 0) { /* If no deletions are required, use faster code */ @@ -983,7 +983,7 @@ } /* Fix the size of the resulting string */ if (inlen > 0) - _PyString_Resize(&result, output - output_start); + _PyBytes_Resize(&result, output - output_start); return result; } @@ -1169,7 +1169,7 @@ Py_XINCREF(newstr); } else { - newstr = PyString_FromStringAndSize(new_s, out_len); + newstr = PyBytes_FromStringAndSize(new_s, out_len); PyMem_FREE(new_s); } return newstr; @@ -1222,7 +1222,7 @@ if (isspace(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "whitespace", s); @@ -1232,7 +1232,7 @@ if (islower(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "lowercase", s); @@ -1242,7 +1242,7 @@ if (isupper(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "uppercase", s); } Modified: python/branches/tlee-ast-optimize/Modules/sunaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sunaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/sunaudiodev.c Sun Jun 1 17:18:10 2008 @@ -135,11 +135,11 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - if (!(cp = PyString_AsString(rv))) + if (!(cp = PyBytes_AsString(rv))) goto finally; count = read(self->x_fd, cp, size); Modified: python/branches/tlee-ast-optimize/Modules/svmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/svmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/svmodule.c Sun Jun 1 17:18:10 2008 @@ -47,13 +47,13 @@ if (!PyArg_Parse(args, "i", &invert)) return NULL; - if (!(output = PyString_FromStringAndSize( + if (!(output = PyBytes_FromStringAndSize( NULL, (int)(self->ob_info.width * self->ob_info.height * factor)))) { return NULL; } - if (!(outstr = PyString_AsString(output))) { + if (!(outstr = PyBytes_AsString(output))) { Py_DECREF(output); return NULL; } @@ -152,9 +152,9 @@ fieldsize = self->ob_info.width * self->ob_info.height / 2; obcapture = (char*)self->ob_capture; - if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) + if (!(f1 = PyBytes_FromStringAndSize(obcapture, fieldsize))) goto finally; - if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, + if (!(f2 = PyBytes_FromStringAndSize(obcapture + fieldsize, fieldsize))) goto finally; ret = PyTuple_Pack(2, f1, f2); @@ -535,12 +535,12 @@ goto finally; } - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) goto finally; /* XXX -- need to do something about the bitvector */ { - char* str = PyString_AsString(videodata); + char* str = PyBytes_AsString(videodata); if (!str) goto finally; @@ -615,10 +615,10 @@ if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) return sv_error(); - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) return NULL; - str = PyString_AsString(videodata); + str = PyBytes_AsString(videodata); if (!str) goto finally; @@ -849,11 +849,11 @@ return NULL; } - if (!(output = PyString_FromStringAndSize(NULL, + if (!(output = PyBytes_FromStringAndSize(NULL, (int)(width * height * factor)))) return NULL; - str = PyString_AsString(output); + str = PyBytes_AsString(output); if (!str) { Py_DECREF(output); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/syslogmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/syslogmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/syslogmodule.c Sun Jun 1 17:18:10 2008 @@ -71,7 +71,7 @@ S_ident_o = new_S_ident_o; Py_INCREF(S_ident_o); - openlog(PyString_AsString(S_ident_o), logopt, facility); + openlog(PyBytes_AsString(S_ident_o), logopt, facility); Py_INCREF(Py_None); return Py_None; Modified: python/branches/tlee-ast-optimize/Modules/termios.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/termios.c (original) +++ python/branches/tlee-ast-optimize/Modules/termios.c Sun Jun 1 17:18:10 2008 @@ -91,7 +91,7 @@ return NULL; for (i = 0; i < NCCS; i++) { ch = (char)mode.c_cc[i]; - v = PyString_FromStringAndSize(&ch, 1); + v = PyBytes_FromStringAndSize(&ch, 1); if (v == NULL) goto err; PyList_SetItem(cc, i, v); @@ -183,8 +183,8 @@ for (i = 0; i < NCCS; i++) { v = PyList_GetItem(cc, i); - if (PyString_Check(v) && PyString_Size(v) == 1) - mode.c_cc[i] = (cc_t) * PyString_AsString(v); + if (PyBytes_Check(v) && PyBytes_Size(v) == 1) + mode.c_cc[i] = (cc_t) * PyBytes_AsString(v); else if (PyInt_Check(v)) mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { Modified: python/branches/tlee-ast-optimize/Modules/threadmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/threadmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/threadmodule.c Sun Jun 1 17:18:10 2008 @@ -190,7 +190,7 @@ Py_XINCREF(kw); self->kw = kw; self->dict = NULL; /* making sure */ - self->key = PyString_FromFormat("thread.local.%p", self); + self->key = PyBytes_FromFormat("thread.local.%p", self); if (self->key == NULL) goto err; Modified: python/branches/tlee-ast-optimize/Modules/timemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/timemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/timemodule.c Sun Jun 1 17:18:10 2008 @@ -488,7 +488,7 @@ e.g. an empty format, or %Z when the timezone is unknown. */ PyObject *ret; - ret = PyString_FromStringAndSize(outbuf, buflen); + ret = PyBytes_FromStringAndSize(outbuf, buflen); free(outbuf); return ret; } @@ -548,7 +548,7 @@ p = asctime(&buf); if (p[24] == '\n') p[24] = '\0'; - return PyString_FromString(p); + return PyBytes_FromString(p); } PyDoc_STRVAR(asctime_doc, @@ -584,7 +584,7 @@ } if (p[24] == '\n') p[24] = '\0'; - return PyString_FromString(p); + return PyBytes_FromString(p); } PyDoc_STRVAR(ctime_doc, Modified: python/branches/tlee-ast-optimize/Modules/unicodedata.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/unicodedata.c (original) +++ python/branches/tlee-ast-optimize/Modules/unicodedata.c Sun Jun 1 17:18:10 2008 @@ -258,7 +258,7 @@ if (old->category_changed != 0xFF) index = old->category_changed; } - return PyString_FromString(_PyUnicode_CategoryNames[index]); + return PyBytes_FromString(_PyUnicode_CategoryNames[index]); } PyDoc_STRVAR(unicodedata_bidirectional__doc__, @@ -290,7 +290,7 @@ else if (old->bidir_changed != 0xFF) index = old->bidir_changed; } - return PyString_FromString(_PyUnicode_BidirectionalNames[index]); + return PyBytes_FromString(_PyUnicode_BidirectionalNames[index]); } PyDoc_STRVAR(unicodedata_combining__doc__, @@ -379,7 +379,7 @@ if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyString_FromString(_PyUnicode_EastAsianWidthNames[index]); + return PyBytes_FromString(_PyUnicode_EastAsianWidthNames[index]); } PyDoc_STRVAR(unicodedata_decomposition__doc__, @@ -411,7 +411,7 @@ if (self) { const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); if (old->category_changed == 0) - return PyString_FromString(""); /* unassigned */ + return PyBytes_FromString(""); /* unassigned */ } if (code < 0 || code >= 0x110000) @@ -450,7 +450,7 @@ decomp[i] = '\0'; - return PyString_FromString(decomp); + return PyBytes_FromString(decomp); } static void @@ -515,7 +515,7 @@ /* Hangul Decomposition adds three characters in a single step, so we need atleast that much room. */ if (space < 3) { - Py_ssize_t newsize = PyString_GET_SIZE(result) + 10; + Py_ssize_t newsize = PyBytes_GET_SIZE(result) + 10; space += 10; if (PyUnicode_Resize(&result, newsize) == -1) return NULL; Modified: python/branches/tlee-ast-optimize/Modules/zipimport.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/zipimport.c (original) +++ python/branches/tlee-ast-optimize/Modules/zipimport.c Sun Jun 1 17:18:10 2008 @@ -154,11 +154,11 @@ } } - self->archive = PyString_FromString(buf); + self->archive = PyBytes_FromString(buf); if (self->archive == NULL) return -1; - self->prefix = PyString_FromString(prefix); + self->prefix = PyBytes_FromString(prefix); if (self->prefix == NULL) return -1; @@ -191,10 +191,10 @@ char *archive = "???"; char *prefix = ""; - if (self->archive != NULL && PyString_Check(self->archive)) - archive = PyString_AsString(self->archive); - if (self->prefix != NULL && PyString_Check(self->prefix)) - prefix = PyString_AsString(self->prefix); + if (self->archive != NULL && PyBytes_Check(self->archive)) + archive = PyBytes_AsString(self->archive); + if (self->prefix != NULL && PyBytes_Check(self->prefix)) + prefix = PyBytes_AsString(self->prefix); if (prefix != NULL && *prefix) PyOS_snprintf(buf, sizeof(buf), "", @@ -203,7 +203,7 @@ PyOS_snprintf(buf, sizeof(buf), "", archive); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } /* return fullname.split(".")[-1] */ @@ -263,7 +263,7 @@ subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return MI_ERROR; @@ -336,12 +336,12 @@ /* add __path__ to the module *before* the code gets executed */ PyObject *pkgpath, *fullpath; - char *prefix = PyString_AsString(self->prefix); + char *prefix = PyBytes_AsString(self->prefix); char *subname = get_subname(fullname); int err; - fullpath = PyString_FromFormat("%s%c%s%s", - PyString_AsString(self->archive), + fullpath = PyBytes_FromFormat("%s%c%s%s", + PyBytes_AsString(self->archive), SEP, *prefix ? prefix : "", subname); @@ -418,9 +418,9 @@ } path = buf; #endif - len = PyString_Size(self->archive); + len = PyBytes_Size(self->archive); if ((size_t)len < strlen(path) && - strncmp(path, PyString_AsString(self->archive), len) == 0 && + strncmp(path, PyBytes_AsString(self->archive), len) == 0 && path[len] == SEP) { path = path + len + 1; } @@ -430,7 +430,7 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); return NULL; } - return get_data(PyString_AsString(self->archive), toc_entry); + return get_data(PyBytes_AsString(self->archive), toc_entry); } static PyObject * @@ -467,7 +467,7 @@ } subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -480,7 +480,7 @@ toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) - return get_data(PyString_AsString(self->archive), toc_entry); + return get_data(PyBytes_AsString(self->archive), toc_entry); /* we have the module, but no source */ Py_INCREF(Py_None); @@ -843,13 +843,13 @@ PyMarshal_ReadShortFromFile(fp); /* local header size */ file_offset += l; /* Start of file data */ - raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ? + raw_data = PyBytes_FromStringAndSize((char *)NULL, compress == 0 ? data_size : data_size + 1); if (raw_data == NULL) { fclose(fp); return NULL; } - buf = PyString_AsString(raw_data); + buf = PyBytes_AsString(raw_data); err = fseek(fp, file_offset, 0); if (err == 0) @@ -907,8 +907,8 @@ unmarshal_code(char *pathname, PyObject *data, time_t mtime) { PyObject *code; - char *buf = PyString_AsString(data); - Py_ssize_t size = PyString_Size(data); + char *buf = PyBytes_AsString(data); + Py_ssize_t size = PyBytes_Size(data); if (size <= 9) { PyErr_SetString(ZipImportError, @@ -953,14 +953,14 @@ static PyObject * normalize_line_endings(PyObject *source) { - char *buf, *q, *p = PyString_AsString(source); + char *buf, *q, *p = PyBytes_AsString(source); PyObject *fixed_source; if (!p) return NULL; /* one char extra for trailing \n and one for terminating \0 */ - buf = (char *)PyMem_Malloc(PyString_Size(source) + 2); + buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2); if (buf == NULL) { PyErr_SetString(PyExc_MemoryError, "zipimport: no memory to allocate " @@ -979,7 +979,7 @@ } *q++ = '\n'; /* add trailing \n */ *q = '\0'; - fixed_source = PyString_FromString(buf); + fixed_source = PyBytes_FromString(buf); PyMem_Free(buf); return fixed_source; } @@ -995,7 +995,7 @@ if (fixed_source == NULL) return NULL; - code = Py_CompileString(PyString_AsString(fixed_source), pathname, + code = Py_CompileString(PyBytes_AsString(fixed_source), pathname, Py_file_input); Py_DECREF(fixed_source); return code; @@ -1054,7 +1054,7 @@ { PyObject *data, *code; char *modpath; - char *archive = PyString_AsString(self->archive); + char *archive = PyBytes_AsString(self->archive); if (archive == NULL) return NULL; @@ -1063,7 +1063,7 @@ if (data == NULL) return NULL; - modpath = PyString_AsString(PyTuple_GetItem(toc_entry, 0)); + modpath = PyBytes_AsString(PyTuple_GetItem(toc_entry, 0)); if (isbytecode) { code = unmarshal_code(modpath, data, mtime); @@ -1088,7 +1088,7 @@ subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -1098,7 +1098,7 @@ strcpy(path + len, zso->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s%c%s\n", - PyString_AsString(self->archive), + PyBytes_AsString(self->archive), SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { @@ -1120,7 +1120,7 @@ continue; } if (code != NULL && p_modpath != NULL) - *p_modpath = PyString_AsString( + *p_modpath = PyBytes_AsString( PyTuple_GetItem(toc_entry, 0)); return code; } Modified: python/branches/tlee-ast-optimize/Modules/zlibmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/zlibmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/zlibmodule.c Sun Jun 1 17:18:10 2008 @@ -96,12 +96,12 @@ if (self == NULL) return NULL; self->is_initialised = 0; - self->unused_data = PyString_FromString(""); + self->unused_data = PyBytes_FromString(""); if (self->unused_data == NULL) { Py_DECREF(self); return NULL; } - self->unconsumed_tail = PyString_FromString(""); + self->unconsumed_tail = PyBytes_FromString(""); if (self->unconsumed_tail == NULL) { Py_DECREF(self); return NULL; @@ -174,7 +174,7 @@ err=deflateEnd(&zst); if (err == Z_OK) - ReturnVal = PyString_FromStringAndSize((char *)output, + ReturnVal = PyBytes_FromStringAndSize((char *)output, zst.total_out); else zlib_error(zst, err, "while finishing compression"); @@ -211,12 +211,12 @@ zst.avail_in = length; zst.avail_out = r_strlen; - if (!(result_str = PyString_FromStringAndSize(NULL, r_strlen))) + if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen))) return NULL; zst.zalloc = (alloc_func)NULL; zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)PyString_AS_STRING(result_str); + zst.next_out = (Byte *)PyBytes_AS_STRING(result_str); zst.next_in = (Byte *)input; err = inflateInit2(&zst, wsize); @@ -256,11 +256,11 @@ /* fall through */ case(Z_OK): /* need more memory */ - if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { + if (_PyBytes_Resize(&result_str, r_strlen << 1) < 0) { inflateEnd(&zst); goto error; } - zst.next_out = (unsigned char *)PyString_AS_STRING(result_str) \ + zst.next_out = (unsigned char *)PyBytes_AS_STRING(result_str) \ + r_strlen; zst.avail_out = r_strlen; r_strlen = r_strlen << 1; @@ -278,7 +278,7 @@ goto error; } - _PyString_Resize(&result_str, zst.total_out); + _PyBytes_Resize(&result_str, zst.total_out); return result_str; error: @@ -400,7 +400,7 @@ if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) return NULL; - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -409,7 +409,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), Z_NO_FLUSH); @@ -418,9 +418,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) + if (_PyBytes_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -440,7 +440,7 @@ RetVal = NULL; goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -479,7 +479,7 @@ /* limit amount of data allocated to max_length */ if (max_length && length > max_length) length = max_length; - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -488,7 +488,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); @@ -510,9 +510,9 @@ if (max_length && length > max_length) length = max_length; - if (_PyString_Resize(&RetVal, length) < 0) + if (_PyBytes_Resize(&RetVal, length) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + old_length; self->zst.avail_out = length - old_length; @@ -525,7 +525,7 @@ of specified size. Return the unconsumed tail in an attribute.*/ if(max_length) { Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, + self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); if(!self->unconsumed_tail) { Py_DECREF(RetVal); @@ -542,7 +542,7 @@ */ if (err == Z_STREAM_END) { Py_XDECREF(self->unused_data); /* Free original empty string */ - self->unused_data = PyString_FromStringAndSize( + self->unused_data = PyBytes_FromStringAndSize( (char *)self->zst.next_in, self->zst.avail_in); if (self->unused_data == NULL) { Py_DECREF(RetVal); @@ -559,7 +559,7 @@ goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -589,10 +589,10 @@ /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in doing any work at all; just return an empty string. */ if (flushmode == Z_NO_FLUSH) { - return PyString_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); } - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -600,7 +600,7 @@ start_total_out = self->zst.total_out; self->zst.avail_in = 0; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), flushmode); @@ -609,9 +609,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) + if (_PyBytes_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -646,7 +646,7 @@ goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -778,7 +778,7 @@ PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); return NULL; } - if (!(retval = PyString_FromStringAndSize(NULL, length))) + if (!(retval = PyBytes_FromStringAndSize(NULL, length))) return NULL; @@ -786,7 +786,7 @@ start_total_out = self->zst.total_out; self->zst.avail_out = length; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval); + self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_FINISH); @@ -795,9 +795,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) { - if (_PyString_Resize(&retval, length << 1) < 0) + if (_PyBytes_Resize(&retval, length << 1) < 0) goto error; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval) + length; + self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval) + length; self->zst.avail_out = length; length = length << 1; @@ -819,7 +819,7 @@ goto error; } } - _PyString_Resize(&retval, self->zst.total_out - start_total_out); + _PyBytes_Resize(&retval, self->zst.total_out - start_total_out); error: @@ -1027,7 +1027,7 @@ PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); - ver = PyString_FromString(ZLIB_VERSION); + ver = PyBytes_FromString(ZLIB_VERSION); if (ver != NULL) PyModule_AddObject(m, "ZLIB_VERSION", ver); Modified: python/branches/tlee-ast-optimize/Objects/abstract.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/abstract.c (original) +++ python/branches/tlee-ast-optimize/Objects/abstract.c Sun Jun 1 17:18:10 2008 @@ -105,7 +105,7 @@ /* cache a hashed version of the attribute string */ if (hintstrobj == NULL) { - hintstrobj = PyString_InternFromString("__length_hint__"); + hintstrobj = PyBytes_InternFromString("__length_hint__"); if (hintstrobj == NULL) goto defaultcase; } @@ -227,7 +227,7 @@ null_error(); return -1; } - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return -1; ret = PyObject_DelItem(o, okey); @@ -729,21 +729,21 @@ /* Initialize cached value */ if (str__format__ == NULL) { /* Initialize static variable needed by _PyType_Lookup */ - str__format__ = PyString_InternFromString("__format__"); + str__format__ = PyBytes_InternFromString("__format__"); if (str__format__ == NULL) goto done; } /* If no format_spec is provided, use an empty string */ if (format_spec == NULL) { - empty = PyString_FromStringAndSize(NULL, 0); + empty = PyBytes_FromStringAndSize(NULL, 0); format_spec = empty; } /* Check the format_spec type, and make sure it's str or unicode */ if (PyUnicode_Check(format_spec)) spec_is_unicode = 1; - else if (PyString_Check(format_spec)) + else if (PyBytes_Check(format_spec)) spec_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -823,7 +823,7 @@ /* Check the result type, and make sure it's str or unicode */ if (PyUnicode_Check(result)) result_is_unicode = 1; - else if (PyString_Check(result)) + else if (PyBytes_Check(result)) result_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -1541,7 +1541,7 @@ const char *type_name; static PyObject *int_name = NULL; if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); + int_name = PyBytes_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1567,7 +1567,7 @@ non_integral_error: if (PyInstance_Check(integral)) { - type_name = PyString_AS_STRING(((PyInstanceObject *)integral) + type_name = PyBytes_AS_STRING(((PyInstanceObject *)integral) ->in_class->cl_name); } else { @@ -1589,7 +1589,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); + trunc_name = PyBytes_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1629,9 +1629,9 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyString_Check(o)) - return int_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); + if (PyBytes_Check(o)) + return int_from_string(PyBytes_AS_STRING(o), + PyBytes_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), @@ -1674,7 +1674,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); + trunc_name = PyBytes_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1716,13 +1716,13 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyString_Check(o)) + if (PyBytes_Check(o)) /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. */ - return long_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); + return long_from_string(PyBytes_AS_STRING(o), + PyBytes_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ @@ -2413,7 +2413,7 @@ if (key == NULL) return null_error(); - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return NULL; r = PyObject_GetItem(o, okey); @@ -2432,7 +2432,7 @@ return -1; } - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return -1; r = PyObject_SetItem(o, okey, value); @@ -2760,7 +2760,7 @@ PyObject *bases; if (__bases__ == NULL) { - __bases__ = PyString_InternFromString("__bases__"); + __bases__ = PyBytes_InternFromString("__bases__"); if (__bases__ == NULL) return NULL; } @@ -2838,7 +2838,7 @@ int retval = 0; if (__class__ == NULL) { - __class__ = PyString_InternFromString("__class__"); + __class__ = PyBytes_InternFromString("__class__"); if (__class__ == NULL) return -1; } @@ -2914,7 +2914,7 @@ return 1; if (name == NULL) { - name = PyString_InternFromString("__instancecheck__"); + name = PyBytes_InternFromString("__instancecheck__"); if (name == NULL) return -1; } @@ -2998,7 +2998,7 @@ PyErr_Fetch(&t, &v, &tb); if (name == NULL) { - name = PyString_InternFromString("__subclasscheck__"); + name = PyBytes_InternFromString("__subclasscheck__"); if (name == NULL) return -1; } Modified: python/branches/tlee-ast-optimize/Objects/boolobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/boolobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/boolobject.c Sun Jun 1 17:18:10 2008 @@ -25,10 +25,10 @@ if (self->ob_ival) s = true_str ? true_str : - (true_str = PyString_InternFromString("True")); + (true_str = PyBytes_InternFromString("True")); else s = false_str ? false_str : - (false_str = PyString_InternFromString("False")); + (false_str = PyBytes_InternFromString("False")); Py_XINCREF(s); return s; } Modified: python/branches/tlee-ast-optimize/Objects/bufferobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bufferobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bufferobject.c Sun Jun 1 17:18:10 2008 @@ -287,13 +287,13 @@ const char *status = self->b_readonly ? "read-only" : "read-write"; if ( self->b_base == NULL ) - return PyString_FromFormat("<%s buffer ptr %p, size %zd at %p>", + return PyBytes_FromFormat("<%s buffer ptr %p, size %zd at %p>", status, self->b_ptr, self->b_size, self); else - return PyString_FromFormat( + return PyBytes_FromFormat( "<%s buffer for %p, size %zd, offset %zd at %p>", status, self->b_base, @@ -318,7 +318,7 @@ * underlying memory is immutable. b_readonly is a necessary but not * sufficient condition for a buffer to be hashable. Perhaps it would * be better to only allow hashing if the underlying object is known to - * be immutable (e.g. PyString_Check() is true). Another idea would + * be immutable (e.g. PyBytes_Check() is true). Another idea would * be to call tp_hash on the underlying object and see if it raises * an error. */ if ( !self->b_readonly ) @@ -349,7 +349,7 @@ Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - return PyString_FromStringAndSize((const char *)ptr, size); + return PyBytes_FromStringAndSize((const char *)ptr, size); } /* Sequence methods */ @@ -401,10 +401,10 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; - ob = PyString_FromStringAndSize(NULL, size + count); + ob = PyBytes_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; - p = PyString_AS_STRING(ob); + p = PyBytes_AS_STRING(ob); memcpy(p, ptr1, size); memcpy(p + size, ptr2, count); @@ -426,11 +426,11 @@ count = 0; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - ob = PyString_FromStringAndSize(NULL, size * count); + ob = PyBytes_FromStringAndSize(NULL, size * count); if ( ob == NULL ) return NULL; - p = PyString_AS_STRING(ob); + p = PyBytes_AS_STRING(ob); while ( count-- ) { memcpy(p, ptr, size); @@ -454,7 +454,7 @@ PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } - return PyString_FromStringAndSize((char *)ptr + idx, 1); + return PyBytes_FromStringAndSize((char *)ptr + idx, 1); } static PyObject * @@ -472,7 +472,7 @@ right = size; if ( right < left ) right = left; - return PyString_FromStringAndSize((char *)ptr + left, + return PyBytes_FromStringAndSize((char *)ptr + left, right - left); } @@ -501,9 +501,9 @@ } if (slicelength <= 0) - return PyString_FromStringAndSize("", 0); + return PyBytes_FromStringAndSize("", 0); else if (step == 1) - return PyString_FromStringAndSize((char *)p + start, + return PyBytes_FromStringAndSize((char *)p + start, stop - start); else { PyObject *result; @@ -518,7 +518,7 @@ result_buf[i] = source_buf[cur]; } - result = PyString_FromStringAndSize(result_buf, + result = PyBytes_FromStringAndSize(result_buf, slicelength); PyMem_Free(result_buf); return result; Modified: python/branches/tlee-ast-optimize/Objects/bytes_methods.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytes_methods.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytes_methods.c Sun Jun 1 17:18:10 2008 @@ -462,11 +462,11 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyString_AS_STRING(newobj); + s = PyBytes_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -490,11 +490,11 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyString_AS_STRING(newobj); + s = PyBytes_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -520,10 +520,10 @@ int previous_is_cased = 0; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); @@ -553,10 +553,10 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); @@ -589,10 +589,10 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); Modified: python/branches/tlee-ast-optimize/Objects/cellobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/cellobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/cellobject.c Sun Jun 1 17:18:10 2008 @@ -73,9 +73,9 @@ cell_repr(PyCellObject *op) { if (op->ob_ref == NULL) - return PyString_FromFormat("", op); + return PyBytes_FromFormat("", op); - return PyString_FromFormat("", + return PyBytes_FromFormat("", op, op->ob_ref->ob_type->tp_name, op->ob_ref); } Modified: python/branches/tlee-ast-optimize/Objects/classobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/classobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/classobject.c Sun Jun 1 17:18:10 2008 @@ -32,21 +32,21 @@ PyClassObject *op, *dummy; static PyObject *docstr, *modstr, *namestr; if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); + docstr= PyBytes_InternFromString("__doc__"); if (docstr == NULL) return NULL; } if (modstr == NULL) { - modstr= PyString_InternFromString("__module__"); + modstr= PyBytes_InternFromString("__module__"); if (modstr == NULL) return NULL; } if (namestr == NULL) { - namestr= PyString_InternFromString("__name__"); + namestr= PyBytes_InternFromString("__name__"); if (namestr == NULL) return NULL; } - if (name == NULL || !PyString_Check(name)) { + if (name == NULL || !PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "PyClass_New: name must be a string"); return NULL; @@ -101,13 +101,13 @@ } if (getattrstr == NULL) { - getattrstr = PyString_InternFromString("__getattr__"); + getattrstr = PyBytes_InternFromString("__getattr__"); if (getattrstr == NULL) goto alloc_error; - setattrstr = PyString_InternFromString("__setattr__"); + setattrstr = PyBytes_InternFromString("__setattr__"); if (setattrstr == NULL) goto alloc_error; - delattrstr = PyString_InternFromString("__delattr__"); + delattrstr = PyBytes_InternFromString("__delattr__"); if (delattrstr == NULL) goto alloc_error; } @@ -222,7 +222,7 @@ class_getattr(register PyClassObject *op, PyObject *name) { register PyObject *v; - register char *sname = PyString_AsString(name); + register char *sname = PyBytes_AsString(name); PyClassObject *klass; descrgetfunc f; @@ -253,7 +253,7 @@ if (v == NULL) { PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); + PyBytes_AS_STRING(op->cl_name), sname); return NULL; } f = TP_DESCR_GET(v->ob_type); @@ -316,9 +316,9 @@ static char * set_name(PyClassObject *c, PyObject *v) { - if (v == NULL || !PyString_Check(v)) + if (v == NULL || !PyBytes_Check(v)) return "__name__ must be a string object"; - if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v)) + if (strlen(PyBytes_AS_STRING(v)) != (size_t)PyBytes_GET_SIZE(v)) return "__name__ must not contain null bytes"; set_slot(&c->cl_name, v); return ""; @@ -333,9 +333,9 @@ "classes are read-only in restricted mode"); return -1; } - sname = PyString_AsString(name); + sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); + Py_ssize_t n = PyBytes_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { char *err = NULL; if (strcmp(sname, "__dict__") == 0) @@ -365,7 +365,7 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); + PyBytes_AS_STRING(op->cl_name), sname); return rv; } else @@ -377,15 +377,15 @@ { PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); char *name; - if (op->cl_name == NULL || !PyString_Check(op->cl_name)) + if (op->cl_name == NULL || !PyBytes_Check(op->cl_name)) name = "?"; else - name = PyString_AsString(op->cl_name); - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", name, op); + name = PyBytes_AsString(op->cl_name); + if (mod == NULL || !PyBytes_Check(mod)) + return PyBytes_FromFormat("", name, op); else - return PyString_FromFormat("", - PyString_AsString(mod), + return PyBytes_FromFormat("", + PyBytes_AsString(mod), name, op); } @@ -397,21 +397,21 @@ PyObject *res; Py_ssize_t m, n; - if (name == NULL || !PyString_Check(name)) + if (name == NULL || !PyBytes_Check(name)) return class_repr(op); - if (mod == NULL || !PyString_Check(mod)) { + if (mod == NULL || !PyBytes_Check(mod)) { Py_INCREF(name); return name; } - m = PyString_GET_SIZE(mod); - n = PyString_GET_SIZE(name); - res = PyString_FromStringAndSize((char *)NULL, m+1+n); + m = PyBytes_GET_SIZE(mod); + n = PyBytes_GET_SIZE(name); + res = PyBytes_FromStringAndSize((char *)NULL, m+1+n); if (res != NULL) { - char *s = PyString_AS_STRING(res); - memcpy(s, PyString_AS_STRING(mod), m); + char *s = PyBytes_AS_STRING(res); + memcpy(s, PyBytes_AS_STRING(mod), m); s += m; *s++ = '.'; - memcpy(s, PyString_AS_STRING(name), n); + memcpy(s, PyBytes_AS_STRING(name), n); } return res; } @@ -541,7 +541,7 @@ static PyObject *initstr; if (initstr == NULL) { - initstr = PyString_InternFromString("__init__"); + initstr = PyBytes_InternFromString("__init__"); if (initstr == NULL) return NULL; } @@ -634,7 +634,7 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); + delstr = PyBytes_InternFromString("__del__"); if (delstr == NULL) PyErr_WriteUnraisable((PyObject*)inst); } @@ -696,7 +696,7 @@ instance_getattr1(register PyInstanceObject *inst, PyObject *name) { register PyObject *v; - register char *sname = PyString_AsString(name); + register char *sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -716,7 +716,7 @@ if (v == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), sname); + PyBytes_AS_STRING(inst->in_class->cl_name), sname); } return v; } @@ -779,7 +779,7 @@ assert(PyInstance_Check(pinst)); inst = (PyInstanceObject *)pinst; - assert(PyString_Check(name)); + assert(PyBytes_Check(name)); v = PyDict_GetItem(inst->in_dict, name); if (v == NULL) @@ -795,8 +795,8 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), - PyString_AS_STRING(name)); + PyBytes_AS_STRING(inst->in_class->cl_name), + PyBytes_AS_STRING(name)); return rv; } else @@ -807,9 +807,9 @@ instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v) { PyObject *func, *args, *res, *tmp; - char *sname = PyString_AsString(name); + char *sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); + Py_ssize_t n = PyBytes_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -875,7 +875,7 @@ static PyObject *reprstr; if (reprstr == NULL) { - reprstr = PyString_InternFromString("__repr__"); + reprstr = PyBytes_InternFromString("__repr__"); if (reprstr == NULL) return NULL; } @@ -889,16 +889,16 @@ classname = inst->in_class->cl_name; mod = PyDict_GetItemString(inst->in_class->cl_dict, "__module__"); - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); + if (classname != NULL && PyBytes_Check(classname)) + cname = PyBytes_AsString(classname); else cname = "?"; - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", + if (mod == NULL || !PyBytes_Check(mod)) + return PyBytes_FromFormat("", cname, inst); else - return PyString_FromFormat("<%s.%s instance at %p>", - PyString_AsString(mod), + return PyBytes_FromFormat("<%s.%s instance at %p>", + PyBytes_AsString(mod), cname, inst); } res = PyEval_CallObject(func, (PyObject *)NULL); @@ -914,7 +914,7 @@ static PyObject *strstr; if (strstr == NULL) { - strstr = PyString_InternFromString("__str__"); + strstr = PyBytes_InternFromString("__str__"); if (strstr == NULL) return NULL; } @@ -939,7 +939,7 @@ static PyObject *hashstr, *eqstr, *cmpstr; if (hashstr == NULL) { - hashstr = PyString_InternFromString("__hash__"); + hashstr = PyBytes_InternFromString("__hash__"); if (hashstr == NULL) return -1; } @@ -952,7 +952,7 @@ address. If an __eq__ or __cmp__ method exists, there must be a __hash__. */ if (eqstr == NULL) { - eqstr = PyString_InternFromString("__eq__"); + eqstr = PyBytes_InternFromString("__eq__"); if (eqstr == NULL) return -1; } @@ -962,7 +962,7 @@ return -1; PyErr_Clear(); if (cmpstr == NULL) { - cmpstr = PyString_InternFromString("__cmp__"); + cmpstr = PyBytes_InternFromString("__cmp__"); if (cmpstr == NULL) return -1; } @@ -1014,7 +1014,7 @@ Py_ssize_t outcome; if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); + lenstr = PyBytes_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1063,7 +1063,7 @@ PyObject *res; if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1090,7 +1090,7 @@ if (value == NULL) { if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); + delitemstr = PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1098,7 +1098,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); + setitemstr = PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1135,7 +1135,7 @@ PyObject *func, *res; if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1154,7 +1154,7 @@ static PyObject *getslicestr; if (getslicestr == NULL) { - getslicestr = PyString_InternFromString("__getslice__"); + getslicestr = PyBytes_InternFromString("__getslice__"); if (getslicestr == NULL) return NULL; } @@ -1166,7 +1166,7 @@ PyErr_Clear(); if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1194,7 +1194,7 @@ if (item == NULL) { if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); + delitemstr = PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1202,7 +1202,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); + setitemstr = PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1236,7 +1236,7 @@ if (value == NULL) { if (delslicestr == NULL) { delslicestr = - PyString_InternFromString("__delslice__"); + PyBytes_InternFromString("__delslice__"); if (delslicestr == NULL) return -1; } @@ -1247,7 +1247,7 @@ PyErr_Clear(); if (delitemstr == NULL) { delitemstr = - PyString_InternFromString("__delitem__"); + PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1263,7 +1263,7 @@ else { if (setslicestr == NULL) { setslicestr = - PyString_InternFromString("__setslice__"); + PyBytes_InternFromString("__setslice__"); if (setslicestr == NULL) return -1; } @@ -1274,7 +1274,7 @@ PyErr_Clear(); if (setitemstr == NULL) { setitemstr = - PyString_InternFromString("__setitem__"); + PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1311,7 +1311,7 @@ */ if(__contains__ == NULL) { - __contains__ = PyString_InternFromString("__contains__"); + __contains__ = PyBytes_InternFromString("__contains__"); if(__contains__ == NULL) return -1; } @@ -1417,7 +1417,7 @@ } if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); + coerce_obj = PyBytes_InternFromString("__coerce__"); if (coerce_obj == NULL) return NULL; } @@ -1504,7 +1504,7 @@ PyObject *coerced; if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); + coerce_obj = PyBytes_InternFromString("__coerce__"); if (coerce_obj == NULL) return -1; } @@ -1552,7 +1552,7 @@ #define UNARY(funcname, methodname) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) { o = PyBytes_InternFromString(methodname); \ if (o == NULL) return NULL; } \ return generic_unary_op(self, o); \ } @@ -1561,7 +1561,7 @@ #define UNARY_FB(funcname, methodname, funcname_fb) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) { o = PyBytes_InternFromString(methodname); \ if (o == NULL) return NULL; } \ if (PyObject_HasAttr((PyObject*)self, o)) \ return generic_unary_op(self, o); \ @@ -1630,7 +1630,7 @@ assert(PyInstance_Check(v)); if (cmp_obj == NULL) { - cmp_obj = PyString_InternFromString("__cmp__"); + cmp_obj = PyBytes_InternFromString("__cmp__"); if (cmp_obj == NULL) return -2; } @@ -1738,7 +1738,7 @@ static PyObject *nonzerostr; if (nonzerostr == NULL) { - nonzerostr = PyString_InternFromString("__nonzero__"); + nonzerostr = PyBytes_InternFromString("__nonzero__"); if (nonzerostr == NULL) return -1; } @@ -1747,7 +1747,7 @@ return -1; PyErr_Clear(); if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); + lenstr = PyBytes_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1787,7 +1787,7 @@ static PyObject *indexstr = NULL; if (indexstr == NULL) { - indexstr = PyString_InternFromString("__index__"); + indexstr = PyBytes_InternFromString("__index__"); if (indexstr == NULL) return NULL; } @@ -1814,7 +1814,7 @@ PyObject *truncated; static PyObject *int_name; if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); + int_name = PyBytes_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1929,7 +1929,7 @@ if (name_op == NULL) return -1; for (i = 0; i < NAME_OPS; ++i) { - name_op[i] = PyString_InternFromString(_name_op[i]); + name_op[i] = PyBytes_InternFromString(_name_op[i]); if (name_op[i] == NULL) return -1; } @@ -2012,12 +2012,12 @@ PyObject *func; if (iterstr == NULL) { - iterstr = PyString_InternFromString("__iter__"); + iterstr = PyBytes_InternFromString("__iter__"); if (iterstr == NULL) return NULL; } if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -2055,7 +2055,7 @@ PyObject *func; if (nextstr == NULL) { - nextstr = PyString_InternFromString("next"); + nextstr = PyBytes_InternFromString("next"); if (nextstr == NULL) return NULL; } @@ -2087,7 +2087,7 @@ PyErr_Clear(); PyErr_Format(PyExc_AttributeError, "%.200s instance has no __call__ method", - PyString_AsString(inst->in_class->cl_name)); + PyBytes_AsString(inst->in_class->cl_name)); return NULL; } /* We must check and increment the recursion depth here. Scenario: @@ -2261,7 +2261,7 @@ { static PyObject *docstr; if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); + docstr= PyBytes_InternFromString("__doc__"); if (docstr == NULL) return NULL; } @@ -2384,12 +2384,12 @@ return NULL; PyErr_Clear(); } - else if (!PyString_Check(funcname)) { + else if (!PyBytes_Check(funcname)) { Py_DECREF(funcname); funcname = NULL; } else - sfuncname = PyString_AS_STRING(funcname); + sfuncname = PyBytes_AS_STRING(funcname); if (klass == NULL) klassname = NULL; else { @@ -2399,28 +2399,28 @@ return NULL; PyErr_Clear(); } - else if (!PyString_Check(klassname)) { + else if (!PyBytes_Check(klassname)) { Py_DECREF(klassname); klassname = NULL; } else - sklassname = PyString_AS_STRING(klassname); + sklassname = PyBytes_AS_STRING(klassname); } if (self == NULL) - result = PyString_FromFormat("", + result = PyBytes_FromFormat("", sklassname, sfuncname); else { /* XXX Shouldn't use repr() here! */ PyObject *selfrepr = PyObject_Repr(self); if (selfrepr == NULL) goto fail; - if (!PyString_Check(selfrepr)) { + if (!PyBytes_Check(selfrepr)) { Py_DECREF(selfrepr); goto fail; } - result = PyString_FromFormat("", + result = PyBytes_FromFormat("", sklassname, sfuncname, - PyString_AS_STRING(selfrepr)); + PyBytes_AS_STRING(selfrepr)); Py_DECREF(selfrepr); } fail: @@ -2472,8 +2472,8 @@ PyErr_Clear(); return; } - if (PyString_Check(name)) { - strncpy(buf, PyString_AS_STRING(name), bufsize); + if (PyBytes_Check(name)) { + strncpy(buf, PyBytes_AS_STRING(name), bufsize); buf[bufsize-1] = '\0'; } Py_DECREF(name); Modified: python/branches/tlee-ast-optimize/Objects/codeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/codeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/codeobject.c Sun Jun 1 17:18:10 2008 @@ -32,10 +32,10 @@ for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); - if (v == NULL || !PyString_CheckExact(v)) { + if (v == NULL || !PyBytes_CheckExact(v)) { Py_FatalError("non-string found in code slot"); } - PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); + PyBytes_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); } } @@ -57,9 +57,9 @@ varnames == NULL || !PyTuple_Check(varnames) || freevars == NULL || !PyTuple_Check(freevars) || cellvars == NULL || !PyTuple_Check(cellvars) || - name == NULL || !PyString_Check(name) || - filename == NULL || !PyString_Check(filename) || - lnotab == NULL || !PyString_Check(lnotab) || + name == NULL || !PyBytes_Check(name) || + filename == NULL || !PyBytes_Check(filename) || + lnotab == NULL || !PyBytes_Check(lnotab) || !PyObject_CheckReadBuffer(code)) { PyErr_BadInternalCall(); return NULL; @@ -71,11 +71,11 @@ /* Intern selected string constants */ for (i = PyTuple_Size(consts); --i >= 0; ) { PyObject *v = PyTuple_GetItem(consts, i); - if (!PyString_Check(v)) + if (!PyBytes_Check(v)) continue; - if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) + if (!all_name_chars((unsigned char *)PyBytes_AS_STRING(v))) continue; - PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); + PyBytes_InternInPlace(&PyTuple_GET_ITEM(consts, i)); } co = PyObject_NEW(PyCodeObject, &PyCode_Type); if (co != NULL) { @@ -145,10 +145,10 @@ for (i = 0; i < len; i++) { item = PyTuple_GET_ITEM(tup, i); - if (PyString_CheckExact(item)) { + if (PyBytes_CheckExact(item)) { Py_INCREF(item); } - else if (!PyString_Check(item)) { + else if (!PyBytes_Check(item)) { PyErr_Format( PyExc_TypeError, "name tuples must contain only " @@ -158,9 +158,9 @@ return NULL; } else { - item = PyString_FromStringAndSize( - PyString_AS_STRING(item), - PyString_GET_SIZE(item)); + item = PyBytes_FromStringAndSize( + PyBytes_AS_STRING(item), + PyBytes_GET_SIZE(item)); if (item == NULL) { Py_DECREF(newtuple); return NULL; @@ -281,14 +281,14 @@ if (co->co_firstlineno != 0) lineno = co->co_firstlineno; - if (co->co_filename && PyString_Check(co->co_filename)) - filename = PyString_AS_STRING(co->co_filename); - if (co->co_name && PyString_Check(co->co_name)) - name = PyString_AS_STRING(co->co_name); + if (co->co_filename && PyBytes_Check(co->co_filename)) + filename = PyBytes_AS_STRING(co->co_filename); + if (co->co_name && PyBytes_Check(co->co_name)) + name = PyBytes_AS_STRING(co->co_name); PyOS_snprintf(buf, sizeof(buf), "", name, co, filename, lineno); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int @@ -508,8 +508,8 @@ int PyCode_Addr2Line(PyCodeObject *co, int addrq) { - int size = PyString_Size(co->co_lnotab) / 2; - unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); + int size = PyBytes_Size(co->co_lnotab) / 2; + unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab); int line = co->co_firstlineno; int addr = 0; while (--size >= 0) { @@ -604,8 +604,8 @@ int size, addr, line; unsigned char* p; - p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); - size = PyString_GET_SIZE(co->co_lnotab) / 2; + p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab); + size = PyBytes_GET_SIZE(co->co_lnotab) / 2; addr = 0; line = co->co_firstlineno; Modified: python/branches/tlee-ast-optimize/Objects/complexobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/complexobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/complexobject.c Sun Jun 1 17:18:10 2008 @@ -303,7 +303,7 @@ cv.imag = 0.; if (complex_str == NULL) { - if (!(complex_str = PyString_InternFromString("__complex__"))) + if (!(complex_str = PyBytes_InternFromString("__complex__"))) return cv; } @@ -421,7 +421,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_REPR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -429,7 +429,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_STR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static long @@ -876,9 +876,9 @@ #endif Py_ssize_t len; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + s = PyBytes_AS_STRING(v); + len = PyBytes_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -1064,7 +1064,7 @@ Py_INCREF(r); return r; } - if (PyString_Check(r) || PyUnicode_Check(r)) { + if (PyBytes_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -1073,7 +1073,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL; @@ -1081,7 +1081,7 @@ /* XXX Hack to support classes with __complex__ method */ if (complexstr == NULL) { - complexstr = PyString_InternFromString("__complex__"); + complexstr = PyBytes_InternFromString("__complex__"); if (complexstr == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/Objects/descrobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/descrobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/descrobject.c Sun Jun 1 17:18:10 2008 @@ -15,8 +15,8 @@ static char * descr_name(PyDescrObject *descr) { - if (descr->d_name != NULL && PyString_Check(descr->d_name)) - return PyString_AS_STRING(descr->d_name); + if (descr->d_name != NULL && PyBytes_Check(descr->d_name)) + return PyBytes_AS_STRING(descr->d_name); else return "?"; } @@ -24,7 +24,7 @@ static PyObject * descr_repr(PyDescrObject *descr, char *format) { - return PyString_FromFormat(format, descr_name(descr), + return PyBytes_FromFormat(format, descr_name(descr), descr->d_type->tp_name); } @@ -314,7 +314,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_method->ml_doc); + return PyBytes_FromString(descr->d_method->ml_doc); } static PyMemberDef descr_members[] = { @@ -335,7 +335,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_member->doc); + return PyBytes_FromString(descr->d_member->doc); } static PyGetSetDef member_getset[] = { @@ -350,7 +350,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_getset->doc); + return PyBytes_FromString(descr->d_getset->doc); } static PyGetSetDef getset_getset[] = { @@ -365,7 +365,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_base->doc); + return PyBytes_FromString(descr->d_base->doc); } static PyGetSetDef wrapperdescr_getset[] = { @@ -576,7 +576,7 @@ if (descr != NULL) { Py_XINCREF(type); descr->d_type = type; - descr->d_name = PyString_InternFromString(name); + descr->d_name = PyBytes_InternFromString(name); if (descr->d_name == NULL) { Py_DECREF(descr); descr = NULL; @@ -922,7 +922,7 @@ static PyObject * wrapper_repr(wrapperobject *wp) { - return PyString_FromFormat("", + return PyBytes_FromFormat("", wp->descr->d_base->name, wp->self->ob_type->tp_name, wp->self); @@ -947,7 +947,7 @@ { char *s = wp->descr->d_base->name; - return PyString_FromString(s); + return PyBytes_FromString(s); } static PyObject * @@ -960,7 +960,7 @@ return Py_None; } else { - return PyString_FromString(s); + return PyBytes_FromString(s); } } Modified: python/branches/tlee-ast-optimize/Objects/dictobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/dictobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/dictobject.c Sun Jun 1 17:18:10 2008 @@ -224,7 +224,7 @@ { register PyDictObject *mp; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyString_FromString(""); + dummy = PyBytes_FromString(""); if (dummy == NULL) return NULL; #ifdef SHOW_CONVERSION_COUNTS @@ -373,7 +373,7 @@ * this assumption allows testing for errors during PyObject_RichCompareBool() * to be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_RichCompareBool(); we can always - * use _PyString_Eq() directly. + * use _PyBytes_Eq() directly. * * This is valuable because dicts with only string keys are very common. */ @@ -391,7 +391,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyString_CheckExact(key)) { + if (!PyBytes_CheckExact(key)) { #ifdef SHOW_CONVERSION_COUNTS ++converted; #endif @@ -405,7 +405,7 @@ if (ep->me_key == dummy) freeslot = ep; else { - if (ep->me_hash == hash && _PyString_Eq(ep->me_key, key)) + if (ep->me_hash == hash && _PyBytes_Eq(ep->me_key, key)) return ep; freeslot = NULL; } @@ -420,7 +420,7 @@ if (ep->me_key == key || (ep->me_hash == hash && ep->me_key != dummy - && _PyString_Eq(ep->me_key, key))) + && _PyBytes_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; @@ -626,8 +626,8 @@ PyThreadState *tstate; if (!PyDict_Check(op)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) { @@ -680,8 +680,8 @@ assert(key); assert(value); mp = (PyDictObject *)op; - if (PyString_CheckExact(key)) { - hash = ((PyStringObject *)key)->ob_shash; + if (PyBytes_CheckExact(key)) { + hash = ((PyBytesObject *)key)->ob_shash; if (hash == -1) hash = PyObject_Hash(key); } @@ -728,8 +728,8 @@ return -1; } assert(key); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -982,11 +982,11 @@ i = Py_ReprEnter((PyObject *)mp); if (i != 0) { - return i > 0 ? PyString_FromString("{...}") : NULL; + return i > 0 ? PyBytes_FromString("{...}") : NULL; } if (mp->ma_used == 0) { - result = PyString_FromString("{}"); + result = PyBytes_FromString("{}"); goto Done; } @@ -994,7 +994,7 @@ if (pieces == NULL) goto Done; - colon = PyString_FromString(": "); + colon = PyBytes_FromString(": "); if (colon == NULL) goto Done; @@ -1006,8 +1006,8 @@ /* Prevent repr from deleting value during key format. */ Py_INCREF(value); s = PyObject_Repr(key); - PyString_Concat(&s, colon); - PyString_ConcatAndDel(&s, PyObject_Repr(value)); + PyBytes_Concat(&s, colon); + PyBytes_ConcatAndDel(&s, PyObject_Repr(value)); Py_DECREF(value); if (s == NULL) goto Done; @@ -1019,29 +1019,29 @@ /* Add "{}" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("{"); + s = PyBytes_FromString("{"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString("}"); + s = PyBytes_FromString("}"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: @@ -1064,8 +1064,8 @@ long hash; PyDictEntry *ep; assert(mp->ma_table != NULL); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1081,7 +1081,7 @@ static PyObject *missing_str = NULL; if (missing_str == NULL) missing_str = - PyString_InternFromString("__missing__"); + PyBytes_InternFromString("__missing__"); missing = _PyType_Lookup(Py_TYPE(mp), missing_str); if (missing != NULL) return PyObject_CallFunctionObjArgs(missing, @@ -1794,8 +1794,8 @@ long hash; PyDictEntry *ep; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1827,8 +1827,8 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1856,8 +1856,8 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1902,8 +1902,8 @@ "pop(): dictionary is empty"); return NULL; } - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -2133,8 +2133,8 @@ PyDictObject *mp = (PyDictObject *)op; PyDictEntry *ep; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -2260,7 +2260,7 @@ PyDict_GetItemString(PyObject *v, const char *key) { PyObject *kv, *rv; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return NULL; rv = PyDict_GetItem(v, kv); @@ -2273,10 +2273,10 @@ { PyObject *kv; int err; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return -1; - PyString_InternInPlace(&kv); /* XXX Should we really? */ + PyBytes_InternInPlace(&kv); /* XXX Should we really? */ err = PyDict_SetItem(v, kv, item); Py_DECREF(kv); return err; @@ -2287,7 +2287,7 @@ { PyObject *kv; int err; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return -1; err = PyDict_DelItem(v, kv); Modified: python/branches/tlee-ast-optimize/Objects/exceptions.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/exceptions.c (original) +++ python/branches/tlee-ast-optimize/Objects/exceptions.c Sun Jun 1 17:18:10 2008 @@ -44,7 +44,7 @@ return NULL; } - self->message = PyString_FromString(""); + self->message = PyBytes_FromString(""); if (!self->message) { Py_DECREF(self); return NULL; @@ -104,7 +104,7 @@ switch (PyTuple_GET_SIZE(self->args)) { case 0: - out = PyString_FromString(""); + out = PyBytes_FromString(""); break; case 1: out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0)); @@ -133,13 +133,13 @@ dot = strrchr(name, '.'); if (dot != NULL) name = dot+1; - repr = PyString_FromString(name); + repr = PyBytes_FromString(name); if (!repr) { Py_DECREF(repr_suffix); return NULL; } - PyString_ConcatAndDel(&repr, repr_suffix); + PyBytes_ConcatAndDel(&repr, repr_suffix); return repr; } @@ -610,7 +610,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyString_FromString("[Errno %s] %s: %s"); + fmt = PyBytes_FromString("[Errno %s] %s: %s"); if (!fmt) return NULL; @@ -645,7 +645,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -654,7 +654,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyString_FromString("[Errno %s] %s"); + fmt = PyBytes_FromString("[Errno %s] %s"); if (!fmt) return NULL; @@ -681,7 +681,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -841,7 +841,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyString_FromString("[Error %s] %s: %s"); + fmt = PyBytes_FromString("[Error %s] %s: %s"); if (!fmt) return NULL; @@ -876,7 +876,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -885,7 +885,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyString_FromString("[Error %s] %s"); + fmt = PyBytes_FromString("[Error %s] %s"); if (!fmt) return NULL; @@ -912,7 +912,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -1109,21 +1109,21 @@ str = PyObject_Str(Py_None); if (!str) return NULL; /* Don't fiddle with non-string return (shouldn't happen anyway) */ - if (!PyString_Check(str)) return str; + if (!PyBytes_Check(str)) return str; /* XXX -- do all the additional formatting with filename and lineno here */ have_filename = (self->filename != NULL) && - PyString_Check(self->filename); + PyBytes_Check(self->filename); have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); if (!have_filename && !have_lineno) return str; - bufsize = PyString_GET_SIZE(str) + 64; + bufsize = PyBytes_GET_SIZE(str) + 64; if (have_filename) - bufsize += PyString_GET_SIZE(self->filename); + bufsize += PyBytes_GET_SIZE(self->filename); buffer = PyMem_MALLOC(bufsize); if (buffer == NULL) @@ -1131,19 +1131,19 @@ if (have_filename && have_lineno) PyOS_snprintf(buffer, bufsize, "%s (%s, line %ld)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename)), + PyBytes_AS_STRING(str), + my_basename(PyBytes_AS_STRING(self->filename)), PyInt_AsLong(self->lineno)); else if (have_filename) PyOS_snprintf(buffer, bufsize, "%s (%s)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename))); + PyBytes_AS_STRING(str), + my_basename(PyBytes_AS_STRING(self->filename))); else /* only have_lineno */ PyOS_snprintf(buffer, bufsize, "%s (line %ld)", - PyString_AS_STRING(str), + PyBytes_AS_STRING(str), PyInt_AsLong(self->lineno)); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); PyMem_FREE(buffer); if (result == NULL) @@ -1250,7 +1250,7 @@ return NULL; } - if (!PyString_Check(attr)) { + if (!PyBytes_Check(attr)) { PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); return NULL; } @@ -1262,7 +1262,7 @@ static int set_string(PyObject **attr, const char *value) { - PyObject *obj = PyString_FromString(value); + PyObject *obj = PyBytes_FromString(value); if (!obj) return -1; Py_CLEAR(*attr); @@ -1345,7 +1345,7 @@ "object"); if (!obj) return -1; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); *start = ((PyUnicodeErrorObject *)exc)->start; if (*start<0) *start = 0; @@ -1415,7 +1415,7 @@ if (!obj) return -1; *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); if (*end<1) *end = 1; if (*end>size) @@ -1506,11 +1506,11 @@ Py_CLEAR(self->reason); if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyString_Type, &self->encoding, + &PyBytes_Type, &self->encoding, objecttype, &self->object, &self->start, &self->end, - &PyString_Type, &self->reason)) { + &PyBytes_Type, &self->reason)) { self->encoding = self->object = self->reason = NULL; return -1; } @@ -1590,20 +1590,20 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't encode character u'\\%s' in position %zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), badchar_str, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't encode characters in position %zd-%zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -1642,7 +1642,7 @@ if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) return -1; return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyString_Type); + kwds, &PyBytes_Type); } static PyObject * @@ -1654,21 +1654,21 @@ /* FromFormat does not support %02x, so format that separately */ char byte[4]; PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyString_AS_STRING(uself->object)[uself->start])&0xff); - return PyString_FromFormat( + ((int)PyBytes_AS_STRING(uself->object)[uself->start])&0xff); + return PyBytes_FromFormat( "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), byte, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't decode bytes in position %zd-%zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -1718,7 +1718,7 @@ &PyUnicode_Type, &self->object, &self->start, &self->end, - &PyString_Type, &self->reason)) { + &PyBytes_Type, &self->reason)) { self->object = self->reason = NULL; return -1; } @@ -1744,18 +1744,18 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyString_FromFormat( + return PyBytes_FromFormat( "can't translate character u'\\%s' in position %zd: %.400s", badchar_str, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "can't translate characters in position %zd-%zd: %.400s", uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -2111,7 +2111,7 @@ (PyBaseExceptionObject *)PyExc_RecursionErrorInst; PyObject *args_tuple; PyObject *exc_message; - exc_message = PyString_FromString("maximum recursion depth exceeded"); + exc_message = PyBytes_FromString("maximum recursion depth exceeded"); if (!exc_message) Py_FatalError("cannot allocate argument for RuntimeError " "pre-allocation"); Modified: python/branches/tlee-ast-optimize/Objects/fileobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/fileobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/fileobject.c Sun Jun 1 17:18:10 2008 @@ -26,7 +26,7 @@ #include #endif -#define BUF(v) PyString_AS_STRING((PyStringObject *)v) +#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) #ifndef DONT_HAVE_ERRNO_H #include @@ -155,11 +155,12 @@ Py_DECREF(f->f_name); Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); + Py_DECREF(f->f_errors); Py_INCREF(name); f->f_name = name; - f->f_mode = PyString_FromString(mode); + f->f_mode = PyBytes_FromString(mode); f->f_close = close; f->f_softspace = 0; @@ -170,6 +171,8 @@ f->f_skipnextlf = 0; Py_INCREF(Py_None); f->f_encoding = Py_None; + Py_INCREF(Py_None); + f->f_errors = Py_None; if (f->f_mode == NULL) return NULL; @@ -367,7 +370,7 @@ PyFileObject *f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); if (f != NULL) { - PyObject *o_name = PyString_FromString(name); + PyObject *o_name = PyBytes_FromString(name); if (o_name == NULL) return NULL; if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { @@ -435,19 +438,38 @@ } /* Set the encoding used to output Unicode strings. - Returh 1 on success, 0 on failure. */ + Return 1 on success, 0 on failure. */ int PyFile_SetEncoding(PyObject *f, const char *enc) { + return PyFile_SetEncodingAndErrors(f, enc, NULL); +} + +int +PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors) +{ PyFileObject *file = (PyFileObject*)f; - PyObject *str = PyString_FromString(enc); + PyObject *str, *oerrors; assert(PyFile_Check(f)); + str = PyBytes_FromString(enc); if (!str) return 0; + if (errors) { + oerrors = PyString_FromString(errors); + if (!oerrors) { + Py_DECREF(str); + return 0; + } + } else { + oerrors = Py_None; + Py_INCREF(Py_None); + } Py_DECREF(file->f_encoding); file->f_encoding = str; + Py_DECREF(file->f_errors); + file->f_errors = oerrors; return 1; } @@ -491,6 +513,7 @@ Py_XDECREF(f->f_name); Py_XDECREF(f->f_mode); Py_XDECREF(f->f_encoding); + Py_XDECREF(f->f_errors); drop_readahead(f); Py_TYPE(f)->tp_free((PyObject *)f); } @@ -502,20 +525,20 @@ #ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); - const char *name_str = name ? PyString_AsString(name) : "?"; - ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", + const char *name_str = name ? PyBytes_AsString(name) : "?"; + ret = PyBytes_FromFormat("<%s file u'%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", name_str, - PyString_AsString(f->f_mode), + PyBytes_AsString(f->f_mode), f); Py_XDECREF(name); return ret; #endif } else { - return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", + return PyBytes_FromFormat("<%s file '%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", - PyString_AsString(f->f_name), - PyString_AsString(f->f_mode), + PyBytes_AsString(f->f_name), + PyBytes_AsString(f->f_mode), f); } } @@ -935,7 +958,7 @@ "requested number of bytes is more than a Python string can hold"); return NULL; } - v = PyString_FromStringAndSize((char *)NULL, buffersize); + v = PyBytes_FromStringAndSize((char *)NULL, buffersize); if (v == NULL) return NULL; bytesread = 0; @@ -966,7 +989,7 @@ } if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); - if (_PyString_Resize(&v, buffersize) < 0) + if (_PyBytes_Resize(&v, buffersize) < 0) return NULL; } else { /* Got what was requested. */ @@ -974,7 +997,7 @@ } } if (bytesread != buffersize) - _PyString_Resize(&v, bytesread); + _PyBytes_Resize(&v, bytesread); return v; } @@ -1092,7 +1115,7 @@ size_t increment; /* amount to increment the buffer */ size_t prev_v_size; - /* Optimize for normal case: avoid _PyString_Resize if at all + /* Optimize for normal case: avoid _PyBytes_Resize if at all * possible via first reading into stack buffer "buf". */ total_v_size = INITBUFSIZE; /* start small and pray */ @@ -1110,7 +1133,7 @@ clearerr(fp); if (PyErr_CheckSignals()) return NULL; - v = PyString_FromStringAndSize(buf, pvfree - buf); + v = PyBytes_FromStringAndSize(buf, pvfree - buf); return v; } /* fgets read *something* */ @@ -1139,7 +1162,7 @@ assert(p > pvfree && *(p-1) == '\0'); --p; /* don't include \0 from fgets */ } - v = PyString_FromStringAndSize(buf, p - buf); + v = PyBytes_FromStringAndSize(buf, p - buf); return v; } /* yuck: fgets overwrote all the newlines, i.e. the entire @@ -1160,7 +1183,7 @@ * into its buffer. */ total_v_size = MAXBUFSIZE << 1; - v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size); + v = PyBytes_FromStringAndSize((char*)NULL, (int)total_v_size); if (v == NULL) return v; /* copy over everything except the last null byte */ @@ -1215,13 +1238,13 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, (int)total_v_size) < 0) + if (_PyBytes_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) - _PyString_Resize(&v, p - BUF(v)); + _PyBytes_Resize(&v, p - BUF(v)); return v; #undef INITBUFSIZE #undef MAXBUFSIZE @@ -1253,7 +1276,7 @@ return getline_via_fgets(f, fp); #endif total_v_size = n > 0 ? n : 100; - v = PyString_FromStringAndSize((char *)NULL, total_v_size); + v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; buf = BUF(v); @@ -1326,7 +1349,7 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, total_v_size) < 0) + if (_PyBytes_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -1334,7 +1357,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyString_Resize(&v, used_v_size); + _PyBytes_Resize(&v, used_v_size); return v; } @@ -1379,7 +1402,7 @@ result = PyEval_CallObject(reader, args); Py_DECREF(reader); Py_DECREF(args); - if (result != NULL && !PyString_Check(result) && + if (result != NULL && !PyBytes_Check(result) && !PyUnicode_Check(result)) { Py_DECREF(result); result = NULL; @@ -1388,9 +1411,9 @@ } } - if (n < 0 && result != NULL && PyString_Check(result)) { - char *s = PyString_AS_STRING(result); - Py_ssize_t len = PyString_GET_SIZE(result); + if (n < 0 && result != NULL && PyBytes_Check(result)) { + char *s = PyBytes_AS_STRING(result); + Py_ssize_t len = PyBytes_GET_SIZE(result); if (len == 0) { Py_DECREF(result); result = NULL; @@ -1399,10 +1422,10 @@ } else if (s[len-1] == '\n') { if (result->ob_refcnt == 1) - _PyString_Resize(&result, len-1); + _PyBytes_Resize(&result, len-1); else { PyObject *v; - v = PyString_FromStringAndSize(s, len-1); + v = PyBytes_FromStringAndSize(s, len-1); Py_DECREF(result); result = v; } @@ -1450,7 +1473,7 @@ if (!PyArg_ParseTuple(args, "|i:readline", &n)) return NULL; if (n == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (n < 0) n = 0; return get_line(f, n); @@ -1516,18 +1539,18 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyString_FromStringAndSize( + big_buffer = PyBytes_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) + if ( _PyBytes_Resize(&big_buffer, buffersize) < 0 ) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); } continue; } @@ -1536,7 +1559,7 @@ do { /* Process complete lines */ p++; - line = PyString_FromStringAndSize(q, p-q); + line = PyBytes_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -1555,7 +1578,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyString_FromStringAndSize(buffer, nfilled); + line = PyBytes_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -1565,7 +1588,7 @@ Py_DECREF(line); goto error; } - PyString_Concat(&line, rest); + PyBytes_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -1672,7 +1695,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { const char *buffer; if (((f->f_binary && PyObject_AsReadBuffer(v, @@ -1685,7 +1708,7 @@ "writelines() argument must be a sequence of strings"); goto error; } - line = PyString_FromStringAndSize(buffer, + line = PyBytes_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -1701,8 +1724,8 @@ errno = 0; for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyString_GET_SIZE(line); - nwritten = fwrite(PyString_AS_STRING(line), + len = PyBytes_GET_SIZE(line); + nwritten = fwrite(PyBytes_AS_STRING(line), 1, len, f->f_fp); if (nwritten != len) { FILE_ABORT_ALLOW_THREADS(f) @@ -1879,6 +1902,8 @@ "file name"}, {"encoding", T_OBJECT, OFF(f_encoding), RO, "file encoding"}, + {"errors", T_OBJECT, OFF(f_errors), RO, + "Unicode error handler"}, /* getattr(f, "closed") is implemented without this table */ {NULL} /* Sentinel */ }; @@ -1896,13 +1921,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyString_FromString("\r"); + return PyBytes_FromString("\r"); case NEWLINE_LF: - return PyString_FromString("\n"); + return PyBytes_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyString_FromString("\r\n"); + return PyBytes_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -2004,10 +2029,10 @@ horrified by the recursive call: maximum recursion depth is limited by logarithmic buffer growth to about 50 even when reading a 1gb line. */ -static PyStringObject * +static PyBytesObject * readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { - PyStringObject* s; + PyBytesObject* s; char *bufptr; char *buf; Py_ssize_t len; @@ -2018,17 +2043,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyStringObject *) - PyString_FromStringAndSize(NULL, skip); + return (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip); bufptr = (char *)memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyStringObject *) - PyString_FromStringAndSize(NULL, skip+len); + s = (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) drop_readahead(f); @@ -2043,7 +2068,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyString_AS_STRING(s)+skip, bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -2055,13 +2080,13 @@ static PyObject * file_iternext(PyFileObject *f) { - PyStringObject* l; + PyBytesObject* l; if (f->f_fp == NULL) return err_closed(); l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); - if (l == NULL || PyString_GET_SIZE(l) == 0) { + if (l == NULL || PyBytes_GET_SIZE(l) == 0) { Py_XDECREF(l); return NULL; } @@ -2078,7 +2103,7 @@ assert(type != NULL && type->tp_alloc != NULL); if (not_yet_string == NULL) { - not_yet_string = PyString_InternFromString(""); + not_yet_string = PyBytes_InternFromString(""); if (not_yet_string == NULL) return NULL; } @@ -2093,6 +2118,8 @@ ((PyFileObject *)self)->f_mode = not_yet_string; Py_INCREF(Py_None); ((PyFileObject *)self)->f_encoding = Py_None; + Py_INCREF(Py_None); + ((PyFileObject *)self)->f_errors = Py_None; ((PyFileObject *)self)->weakreflist = NULL; ((PyFileObject *)self)->unlocked_count = 0; } @@ -2294,8 +2321,10 @@ #ifdef Py_USING_UNICODE if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { - char *cenc = PyString_AS_STRING(enc); - value = PyUnicode_AsEncodedString(v, cenc, "strict"); + char *cenc = PyBytes_AS_STRING(enc); + char *errors = fobj->f_errors == Py_None ? + "strict" : PyBytes_AS_STRING(fobj->f_errors); + value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) return -1; } else { @@ -2365,7 +2394,7 @@ return 0; } else if (!PyErr_Occurred()) { - PyObject *v = PyString_FromString(s); + PyObject *v = PyBytes_FromString(s); int err; if (v == NULL) return -1; Modified: python/branches/tlee-ast-optimize/Objects/floatobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/floatobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/floatobject.c Sun Jun 1 17:18:10 2008 @@ -14,9 +14,6 @@ #include #endif -#include "formatter_string.h" - - #ifdef _OSF_SOURCE /* OSF1 5.1 doesn't make this available with XOPEN_SOURCE_EXTENDED defined */ extern int finite(double); @@ -185,9 +182,9 @@ if (pend) *pend = NULL; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + s = PyBytes_AS_STRING(v); + len = PyBytes_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -488,7 +485,7 @@ char buf[100]; format_float(buf, sizeof(buf), v, PREC_REPR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -496,7 +493,7 @@ { char buf[100]; format_float(buf, sizeof(buf), v, PREC_STR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } /* Comparison is pretty much a nightmare. When comparing float to float, @@ -1221,7 +1218,7 @@ return float_subtype_new(type, args, kwds); /* Wimp out */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x)) return NULL; - if (PyString_Check(x)) + if (PyBytes_Check(x)) return PyFloat_FromString(x, NULL); return PyNumber_Float(x); } @@ -1272,13 +1269,13 @@ char* s; float_format_type r; - if (!PyString_Check(arg)) { + if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", Py_TYPE(arg)->tp_name); return NULL; } - s = PyString_AS_STRING(arg); + s = PyBytes_AS_STRING(arg); if (strcmp(s, "double") == 0) { r = double_format; } @@ -1294,11 +1291,11 @@ switch (r) { case unknown_format: - return PyString_FromString("unknown"); + return PyBytes_FromString("unknown"); case ieee_little_endian_format: - return PyString_FromString("IEEE, little-endian"); + return PyBytes_FromString("IEEE, little-endian"); case ieee_big_endian_format: - return PyString_FromString("IEEE, big-endian"); + return PyBytes_FromString("IEEE, big-endian"); default: Py_FatalError("insane float_format or double_format"); return NULL; @@ -1397,27 +1394,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_float__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyFloat_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_float__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyFloat_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); Modified: python/branches/tlee-ast-optimize/Objects/frameobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/frameobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/frameobject.c Sun Jun 1 17:18:10 2008 @@ -114,7 +114,7 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; @@ -137,7 +137,7 @@ } /* We're now ready to look at the bytecode. */ - PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); + PyBytes_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); min_addr = MIN(new_lasti, f->f_lasti); max_addr = MAX(new_lasti, f->f_lasti); @@ -548,7 +548,7 @@ int _PyFrame_Init() { - builtin_object = PyString_InternFromString("__builtins__"); + builtin_object = PyBytes_InternFromString("__builtins__"); return (builtin_object != NULL); } @@ -728,7 +728,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; - assert(PyString_Check(key)); + assert(PyBytes_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); @@ -776,7 +776,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = PyObject_GetItem(dict, key); - assert(PyString_Check(key)); + assert(PyBytes_Check(key)); /* We only care about NULLs if clear is true. */ if (value == NULL) { PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Objects/funcobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/funcobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/funcobject.c Sun Jun 1 17:18:10 2008 @@ -28,7 +28,7 @@ consts = ((PyCodeObject *)code)->co_consts; if (PyTuple_Size(consts) >= 1) { doc = PyTuple_GetItem(consts, 0); - if (!PyString_Check(doc) && !PyUnicode_Check(doc)) + if (!PyBytes_Check(doc) && !PyUnicode_Check(doc)) doc = Py_None; } else @@ -42,7 +42,7 @@ Otherwise, use None. */ if (!__name__) { - __name__ = PyString_InternFromString("__name__"); + __name__ = PyBytes_InternFromString("__name__"); if (!__name__) { Py_DECREF(op); return NULL; @@ -254,7 +254,7 @@ PyErr_Format(PyExc_ValueError, "%s() requires a code object with %zd free vars," " not %zd", - PyString_AsString(op->func_name), + PyBytes_AsString(op->func_name), nclosure, nfree); return -1; } @@ -281,7 +281,7 @@ return -1; /* Not legal to del f.func_name or to set it to anything * other than a string object. */ - if (value == NULL || !PyString_Check(value)) { + if (value == NULL || !PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -380,7 +380,7 @@ &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; - if (name != Py_None && !PyString_Check(name)) { + if (name != Py_None && !PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); return NULL; @@ -409,7 +409,7 @@ if (nfree != nclosure) return PyErr_Format(PyExc_ValueError, "%s requires closure of length %zd, not %zd", - PyString_AS_STRING(code->co_name), + PyBytes_AS_STRING(code->co_name), nfree, nclosure); if (nclosure) { Py_ssize_t i; @@ -465,8 +465,8 @@ static PyObject* func_repr(PyFunctionObject *op) { - return PyString_FromFormat("", - PyString_AsString(op->func_name), + return PyBytes_FromFormat("", + PyBytes_AsString(op->func_name), op); } Modified: python/branches/tlee-ast-optimize/Objects/genobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/genobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/genobject.c Sun Jun 1 17:18:10 2008 @@ -285,10 +285,10 @@ gen_repr(PyGenObject *gen) { char *code_name; - code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name); + code_name = PyBytes_AsString(((PyCodeObject *)gen->gi_code)->co_name); if (code_name == NULL) return NULL; - return PyString_FromFormat("", + return PyBytes_FromFormat("", code_name, gen); } Modified: python/branches/tlee-ast-optimize/Objects/intobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/intobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/intobject.c Sun Jun 1 17:18:10 2008 @@ -3,7 +3,6 @@ #include "Python.h" #include -#include "formatter_string.h" static PyObject *int_int(PyIntObject *v); @@ -368,7 +367,7 @@ if (*end != '\0') { bad: slen = strlen(s) < 200 ? strlen(s) : 200; - sobj = PyString_FromStringAndSize(s, slen); + sobj = PyBytes_FromStringAndSize(s, slen); if (sobj == NULL) return NULL; srepr = PyObject_Repr(sobj); @@ -377,7 +376,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -965,11 +964,11 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyString_Check(x)) { + if (PyBytes_Check(x)) { /* Since PyInt_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != PyString_Size(x)) { + char *string = PyBytes_AS_STRING(x); + if (strlen(string) != PyBytes_Size(x)) { /* create a repr() of the input string, * just like PyInt_FromString does */ PyObject *srepr; @@ -978,7 +977,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -1106,7 +1105,7 @@ if (negative) *--p = '-'; - return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p); + return PyBytes_FromStringAndSize(p, &buf[sizeof(buf)] - p); } static PyObject * @@ -1116,27 +1115,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_int__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyInt_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_int__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyInt_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); Modified: python/branches/tlee-ast-optimize/Objects/listobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/listobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/listobject.c Sun Jun 1 17:18:10 2008 @@ -174,7 +174,7 @@ } if (i < 0 || i >= Py_SIZE(op)) { if (indexerr == NULL) - indexerr = PyString_FromString( + indexerr = PyBytes_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; @@ -349,11 +349,11 @@ i = Py_ReprEnter((PyObject*)v); if (i != 0) { - return i > 0 ? PyString_FromString("[...]") : NULL; + return i > 0 ? PyBytes_FromString("[...]") : NULL; } if (Py_SIZE(v) == 0) { - result = PyString_FromString("[]"); + result = PyBytes_FromString("[]"); goto Done; } @@ -379,29 +379,29 @@ /* Add "[]" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("["); + s = PyBytes_FromString("["); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString("]"); + s = PyBytes_FromString("]"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: @@ -433,7 +433,7 @@ { if (i < 0 || i >= Py_SIZE(a)) { if (indexerr == NULL) - indexerr = PyString_FromString( + indexerr = PyBytes_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; Modified: python/branches/tlee-ast-optimize/Objects/longobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/longobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/longobject.c Sun Jun 1 17:18:10 2008 @@ -6,7 +6,6 @@ #include "Python.h" #include "longintrepr.h" -#include "formatter_string.h" #include @@ -1200,7 +1199,7 @@ _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) { register PyLongObject *a = (PyLongObject *)aa; - PyStringObject *str; + PyBytesObject *str; Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; @@ -1229,10 +1228,10 @@ "long is too large to format"); return NULL; } - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); + str = (PyBytesObject *) PyBytes_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + sz; + p = PyBytes_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1258,7 +1257,7 @@ do { char cdigit = (char)(accum & (base - 1)); cdigit += (cdigit < 10) ? '0' : 'a'-10; - assert(p > PyString_AS_STRING(str)); + assert(p > PyBytes_AS_STRING(str)); *--p = cdigit; accumbits -= basebits; accum >>= basebits; @@ -1310,7 +1309,7 @@ do { digit nextrem = (digit)(rem / base); char c = (char)(rem - nextrem * base); - assert(p > PyString_AS_STRING(str)); + assert(p > PyBytes_AS_STRING(str)); c += (c < 10) ? '0' : 'a'-10; *--p = c; rem = nextrem; @@ -1348,14 +1347,14 @@ } if (sign) *--p = sign; - if (p != PyString_AS_STRING(str)) { - char *q = PyString_AS_STRING(str); + if (p != PyBytes_AS_STRING(str)) { + char *q = PyBytes_AS_STRING(str); assert(p > q); do { } while ((*q++ = *p++) != '\0'); q--; - _PyString_Resize((PyObject **)&str, - (Py_ssize_t) (q - PyString_AS_STRING(str))); + _PyBytes_Resize((PyObject **)&str, + (Py_ssize_t) (q - PyBytes_AS_STRING(str))); } return (PyObject *)str; } @@ -1719,7 +1718,7 @@ onError: Py_XDECREF(z); slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; - strobj = PyString_FromStringAndSize(orig_str, slen); + strobj = PyBytes_FromStringAndSize(orig_str, slen); if (strobj == NULL) return NULL; strrepr = PyObject_Repr(strobj); @@ -1728,7 +1727,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(strrepr)); + base, PyBytes_AS_STRING(strrepr)); Py_DECREF(strrepr); return NULL; } @@ -3332,11 +3331,11 @@ return PyLong_FromLong(0L); if (base == -909) return PyNumber_Long(x); - else if (PyString_Check(x)) { + else if (PyBytes_Check(x)) { /* Since PyLong_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != PyString_Size(x)) { + char *string = PyBytes_AS_STRING(x); + if (strlen(string) != PyBytes_Size(x)) { /* create a repr() of the input string, * just like PyLong_FromString does. */ PyObject *srepr; @@ -3345,11 +3344,11 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } - return PyLong_FromString(PyString_AS_STRING(x), NULL, base); + return PyLong_FromString(PyBytes_AS_STRING(x), NULL, base); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) @@ -3414,27 +3413,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_long__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyLong_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_long__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyLong_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); Modified: python/branches/tlee-ast-optimize/Objects/methodobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/methodobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/methodobject.c Sun Jun 1 17:18:10 2008 @@ -149,7 +149,7 @@ const char *doc = m->m_ml->ml_doc; if (doc != NULL) - return PyString_FromString(doc); + return PyBytes_FromString(doc); Py_INCREF(Py_None); return Py_None; } @@ -157,7 +157,7 @@ static PyObject * meth_get__name__(PyCFunctionObject *m, void *closure) { - return PyString_FromString(m->m_ml->ml_name); + return PyBytes_FromString(m->m_ml->ml_name); } static int @@ -202,9 +202,9 @@ meth_repr(PyCFunctionObject *m) { if (m->m_self == NULL) - return PyString_FromFormat("", + return PyBytes_FromFormat("", m->m_ml->ml_name); - return PyString_FromFormat("", + return PyBytes_FromFormat("", m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_self); @@ -333,7 +333,7 @@ i = 0; for (c = chain; c != NULL; c = c->link) { for (ml = c->methods; ml->ml_name != NULL; ml++) { - PyList_SetItem(v, i, PyString_FromString(ml->ml_name)); + PyList_SetItem(v, i, PyBytes_FromString(ml->ml_name)); i++; } } @@ -360,7 +360,7 @@ if (strcmp(name, "__doc__") == 0) { const char *doc = self->ob_type->tp_doc; if (doc != NULL) - return PyString_FromString(doc); + return PyBytes_FromString(doc); } } while (chain != NULL) { Modified: python/branches/tlee-ast-optimize/Objects/moduleobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/moduleobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/moduleobject.c Sun Jun 1 17:18:10 2008 @@ -22,7 +22,7 @@ m = PyObject_GC_New(PyModuleObject, &PyModule_Type); if (m == NULL) return NULL; - nameobj = PyString_FromString(name); + nameobj = PyBytes_FromString(name); m->md_dict = PyDict_New(); if (m->md_dict == NULL || nameobj == NULL) goto fail; @@ -68,12 +68,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (nameobj = PyDict_GetItemString(d, "__name__")) == NULL || - !PyString_Check(nameobj)) + !PyBytes_Check(nameobj)) { PyErr_SetString(PyExc_SystemError, "nameless module"); return NULL; } - return PyString_AsString(nameobj); + return PyBytes_AsString(nameobj); } char * @@ -88,12 +88,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || - !PyString_Check(fileobj)) + !PyBytes_Check(fileobj)) { PyErr_SetString(PyExc_SystemError, "module filename missing"); return NULL; } - return PyString_AsString(fileobj); + return PyBytes_AsString(fileobj); } void @@ -117,8 +117,8 @@ /* First, clear only names starting with a single underscore */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyBytes_Check(key)) { + char *s = PyBytes_AsString(key); if (s[0] == '_' && s[1] != '_') { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[1] %s\n", s); @@ -130,8 +130,8 @@ /* Next, clear all names except for __builtins__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyBytes_Check(key)) { + char *s = PyBytes_AsString(key); if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); @@ -195,9 +195,9 @@ filename = PyModule_GetFilename((PyObject *)m); if (filename == NULL) { PyErr_Clear(); - return PyString_FromFormat("", name); + return PyBytes_FromFormat("", name); } - return PyString_FromFormat("", name, filename); + return PyBytes_FromFormat("", name, filename); } /* We only need a traverse function, no clear function: If the module Modified: python/branches/tlee-ast-optimize/Objects/object.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/object.c (original) +++ python/branches/tlee-ast-optimize/Objects/object.c Sun Jun 1 17:18:10 2008 @@ -357,9 +357,9 @@ } #endif if (v == NULL) - return PyString_FromString(""); + return PyBytes_FromString(""); else if (Py_TYPE(v)->tp_repr == NULL) - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(v)->tp_name, v); else { PyObject *res; @@ -377,7 +377,7 @@ return NULL; } #endif - if (!PyString_Check(res)) { + if (!PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", Py_TYPE(res)->tp_name); @@ -394,8 +394,8 @@ PyObject *res; int type_ok; if (v == NULL) - return PyString_FromString(""); - if (PyString_CheckExact(v)) { + return PyBytes_FromString(""); + if (PyBytes_CheckExact(v)) { Py_INCREF(v); return v; } @@ -416,7 +416,7 @@ Py_LeaveRecursiveCall(); if (res == NULL) return NULL; - type_ok = PyString_Check(res); + type_ok = PyBytes_Check(res); #ifdef Py_USING_UNICODE type_ok = type_ok || PyUnicode_Check(res); #endif @@ -447,7 +447,7 @@ return NULL; } #endif - assert(PyString_Check(res)); + assert(PyBytes_Check(res)); return res; } @@ -461,7 +461,7 @@ static PyObject *unicodestr; if (v == NULL) { - res = PyString_FromString(""); + res = PyBytes_FromString(""); if (res == NULL) return NULL; str = PyUnicode_FromEncodedObject(res, NULL, "strict"); @@ -475,7 +475,7 @@ check this before trying the __unicode__ method. */ if (unicodestr == NULL) { - unicodestr= PyString_InternFromString("__unicode__"); + unicodestr= PyBytes_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } @@ -492,7 +492,7 @@ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), PyUnicode_GET_SIZE(v)); } - if (PyString_CheckExact(v)) { + if (PyBytes_CheckExact(v)) { Py_INCREF(v); res = v; } @@ -1084,7 +1084,7 @@ if (Py_TYPE(v)->tp_getattr != NULL) return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); - w = PyString_InternFromString(name); + w = PyBytes_InternFromString(name); if (w == NULL) return NULL; res = PyObject_GetAttr(v, w); @@ -1112,7 +1112,7 @@ if (Py_TYPE(v)->tp_setattr != NULL) return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); - s = PyString_InternFromString(name); + s = PyBytes_InternFromString(name); if (s == NULL) return -1; res = PyObject_SetAttr(v, s, w); @@ -1125,7 +1125,7 @@ { PyTypeObject *tp = Py_TYPE(v); - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name @@ -1147,10 +1147,10 @@ if (tp->tp_getattro != NULL) return (*tp->tp_getattro)(v, name); if (tp->tp_getattr != NULL) - return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); + return (*tp->tp_getattr)(v, PyBytes_AS_STRING(name)); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); return NULL; } @@ -1172,7 +1172,7 @@ PyTypeObject *tp = Py_TYPE(v); int err; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1194,14 +1194,14 @@ else Py_INCREF(name); - PyString_InternInPlace(&name); + PyBytes_InternInPlace(&name); if (tp->tp_setattro != NULL) { err = (*tp->tp_setattro)(v, name, value); Py_DECREF(name); return err; } if (tp->tp_setattr != NULL) { - err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); + err = (*tp->tp_setattr)(v, PyBytes_AS_STRING(name), value); Py_DECREF(name); return err; } @@ -1212,14 +1212,14 @@ "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); else PyErr_Format(PyExc_TypeError, "'%.100s' object has only read-only attributes " "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); return -1; } @@ -1271,7 +1271,7 @@ Py_ssize_t dictoffset; PyObject **dictptr; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1386,7 +1386,7 @@ PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1401,7 +1401,7 @@ PyObject **dictptr; int res = -1; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1469,13 +1469,13 @@ if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); goto done; } PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1682,7 +1682,7 @@ int i; for (i = 0; i < PyList_GET_SIZE(list); ++i) { PyObject *item = PyList_GET_ITEM(list, i); - if (PyString_Check(item)) { + if (PyBytes_Check(item)) { result = PyDict_SetItem(dict, item, Py_None); if (result < 0) break; @@ -1904,7 +1904,7 @@ static PyObject * none_repr(PyObject *op) { - return PyString_FromString("None"); + return PyBytes_FromString("None"); } /* ARGUSED */ @@ -1946,7 +1946,7 @@ static PyObject * NotImplemented_repr(PyObject *op) { - return PyString_FromString("NotImplemented"); + return PyBytes_FromString("NotImplemented"); } static PyTypeObject PyNotImplemented_Type = { @@ -1983,10 +1983,10 @@ if (PyType_Ready(&PyBool_Type) < 0) Py_FatalError("Can't initialize 'bool'"); - if (PyType_Ready(&PyString_Type) < 0) + if (PyType_Ready(&PyBytes_Type) < 0) Py_FatalError("Can't initialize 'str'"); - if (PyType_Ready(&PyBytes_Type) < 0) + if (PyType_Ready(&PyByteArray_Type) < 0) Py_FatalError("Can't initialize 'bytes'"); if (PyType_Ready(&PyList_Type) < 0) Modified: python/branches/tlee-ast-optimize/Objects/rangeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/rangeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/rangeobject.c Sun Jun 1 17:18:10 2008 @@ -113,16 +113,16 @@ PyObject *rtn; if (r->start == 0 && r->step == 1) - rtn = PyString_FromFormat("xrange(%ld)", + rtn = PyBytes_FromFormat("xrange(%ld)", r->start + r->len * r->step); else if (r->step == 1) - rtn = PyString_FromFormat("xrange(%ld, %ld)", + rtn = PyBytes_FromFormat("xrange(%ld, %ld)", r->start, r->start + r->len * r->step); else - rtn = PyString_FromFormat("xrange(%ld, %ld, %ld)", + rtn = PyBytes_FromFormat("xrange(%ld, %ld, %ld)", r->start, r->start + r->len * r->step, r->step); Modified: python/branches/tlee-ast-optimize/Objects/setobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/setobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/setobject.c Sun Jun 1 17:18:10 2008 @@ -94,7 +94,9 @@ else { if (entry->hash == hash) { startkey = entry->key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (table == so->table && entry->key == startkey) { @@ -125,7 +127,9 @@ break; if (entry->hash == hash && entry->key != dummy) { startkey = entry->key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (table == so->table && entry->key == startkey) { @@ -147,7 +151,7 @@ /* * Hacked up version of set_lookkey which can assume keys are always strings; - * This means we can always use _PyString_Eq directly and not have to check to + * This means we can always use _PyBytes_Eq directly and not have to check to * see if the comparison altered the table. */ static setentry * @@ -164,7 +168,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyString_CheckExact(key)) { + if (!PyBytes_CheckExact(key)) { so->lookup = set_lookkey; return set_lookkey(so, key, hash); } @@ -175,7 +179,7 @@ if (entry->key == dummy) freeslot = entry; else { - if (entry->hash == hash && _PyString_Eq(entry->key, key)) + if (entry->hash == hash && _PyBytes_Eq(entry->key, key)) return entry; freeslot = NULL; } @@ -190,7 +194,7 @@ if (entry->key == key || (entry->hash == hash && entry->key != dummy - && _PyString_Eq(entry->key, key))) + && _PyBytes_Eq(entry->key, key))) return entry; if (entry->key == dummy && freeslot == NULL) freeslot = entry; @@ -377,8 +381,8 @@ register long hash; register Py_ssize_t n_used; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -424,8 +428,8 @@ PyObject *old_key; assert (PyAnySet_Check(so)); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -614,7 +618,7 @@ if (status != 0) { if (status < 0) return NULL; - return PyString_FromFormat("%s(...)", so->ob_type->tp_name); + return PyBytes_FromFormat("%s(...)", so->ob_type->tp_name); } keys = PySequence_List((PyObject *)so); @@ -625,8 +629,8 @@ if (listrepr == NULL) goto done; - result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, - PyString_AS_STRING(listrepr)); + result = PyBytes_FromFormat("%s(%s)", so->ob_type->tp_name, + PyBytes_AS_STRING(listrepr)); Py_DECREF(listrepr); done: Py_ReprLeave((PyObject*)so); @@ -681,8 +685,8 @@ long hash; setentry *entry; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -979,7 +983,7 @@ register PySetObject *so = NULL; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyString_FromString(""); + dummy = PyBytes_FromString(""); if (dummy == NULL) return NULL; } @@ -2318,7 +2322,7 @@ /* Exercise direct iteration */ i = 0, count = 0; while (_PySet_Next((PyObject *)dup, &i, &x)) { - s = PyString_AsString(x); + s = PyBytes_AsString(x); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); count++; } Modified: python/branches/tlee-ast-optimize/Objects/sliceobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/sliceobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/sliceobject.c Sun Jun 1 17:18:10 2008 @@ -19,7 +19,7 @@ static PyObject * ellipsis_repr(PyObject *op) { - return PyString_FromString("Ellipsis"); + return PyBytes_FromString("Ellipsis"); } static PyTypeObject PyEllipsis_Type = { @@ -228,14 +228,14 @@ { PyObject *s, *comma; - s = PyString_FromString("slice("); - comma = PyString_FromString(", "); - PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); - PyString_ConcatAndDel(&s, PyString_FromString(")")); + s = PyBytes_FromString("slice("); + comma = PyBytes_FromString(", "); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->start)); + PyBytes_Concat(&s, comma); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->stop)); + PyBytes_Concat(&s, comma); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->step)); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); Py_DECREF(comma); return s; } Modified: python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h (original) +++ python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h Sun Jun 1 17:18:10 2008 @@ -102,12 +102,13 @@ if failure, sets the exception */ static int -parse_internal_render_format_spec(PyObject *format_spec, +parse_internal_render_format_spec(STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len, InternalFormatSpec *format, char default_type) { - STRINGLIB_CHAR *ptr = STRINGLIB_STR(format_spec); - STRINGLIB_CHAR *end = ptr + STRINGLIB_LEN(format_spec); + STRINGLIB_CHAR *ptr = format_spec; + STRINGLIB_CHAR *end = format_spec + format_spec_len; /* end-ptr is used throughout this code to specify the length of the input string */ @@ -756,56 +757,31 @@ /************************************************************************/ /*********** built in formatters ****************************************/ /************************************************************************/ -#ifdef FORMAT_STRING PyObject * -FORMAT_STRING(PyObject* value, PyObject* args) +FORMAT_STRING(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - PyObject *format_spec; - PyObject *result = NULL; -#if PY_VERSION_HEX < 0x03000000 - PyObject *tmp = NULL; -#endif InternalFormatSpec format; - - /* If 2.x, we accept either str or unicode, and try to convert it - to the right type. In 3.x, we insist on only unicode */ -#if PY_VERSION_HEX >= 0x03000000 - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", - &format_spec)) - goto done; -#else - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyString_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = STRINGLIB_TOSTR(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; -#endif + PyObject *result = NULL; /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, 's')) + if (!parse_internal_render_format_spec(format_spec, format_spec_len, + &format, 's')) goto done; /* type conversion? */ switch (format.type) { case 's': /* no type conversion needed, already a string. do the formatting */ - result = format_string_internal(value, &format); + result = format_string_internal(obj, &format); break; default: /* unknown */ @@ -826,35 +802,31 @@ } done: -#if PY_VERSION_HEX < 0x03000000 - Py_XDECREF(tmp); -#endif return result; } -#endif /* FORMAT_STRING */ #if defined FORMAT_LONG || defined FORMAT_INT static PyObject* -format_int_or_long(PyObject* value, PyObject* args, IntOrLongToString tostring) +format_int_or_long(PyObject* obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len, + IntOrLongToString tostring) { - PyObject *format_spec; PyObject *result = NULL; PyObject *tmp = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", - &format_spec)) - goto done; - /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, 'd')) + if (!parse_internal_render_format_spec(format_spec, + format_spec_len, + &format, 'd')) goto done; /* type conversion? */ @@ -868,7 +840,7 @@ case 'n': /* no type conversion needed, already an int (or long). do the formatting */ - result = format_int_or_long_internal(value, &format, tostring); + result = format_int_or_long_internal(obj, &format, tostring); break; case 'e': @@ -879,10 +851,10 @@ case 'G': case '%': /* convert to float */ - tmp = PyNumber_Float(value); + tmp = PyNumber_Float(obj); if (tmp == NULL) goto done; - result = format_float_internal(value, &format); + result = format_float_internal(obj, &format); break; default: @@ -917,9 +889,12 @@ #endif PyObject * -FORMAT_LONG(PyObject* value, PyObject* args) +FORMAT_LONG(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - return format_int_or_long(value, args, long_format); + return format_int_or_long(obj, format_spec, format_spec_len, + long_format); } #endif /* FORMAT_LONG */ @@ -935,32 +910,35 @@ } PyObject * -FORMAT_INT(PyObject* value, PyObject* args) +FORMAT_INT(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - return format_int_or_long(value, args, int_format); + return format_int_or_long(obj, format_spec, format_spec_len, + int_format); } #endif /* FORMAT_INT */ #ifdef FORMAT_FLOAT PyObject * -FORMAT_FLOAT(PyObject *value, PyObject *args) +FORMAT_FLOAT(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - PyObject *format_spec; PyObject *result = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", &format_spec)) - goto done; - /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, '\0')) + if (!parse_internal_render_format_spec(format_spec, + format_spec_len, + &format, '\0')) goto done; /* type conversion? */ @@ -979,7 +957,7 @@ case 'n': case '%': /* no conversion, already a float. do the formatting */ - result = format_float_internal(value, &format); + result = format_float_internal(obj, &format); break; default: Modified: python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h (original) +++ python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h Sun Jun 1 17:18:10 2008 @@ -496,7 +496,7 @@ #if PY_VERSION_HEX >= 0x03000000 assert(PyUnicode_Check(result)); #else - assert(PyString_Check(result) || PyUnicode_Check(result)); + assert(PyBytes_Check(result) || PyUnicode_Check(result)); /* Convert result to our type. We could be str, and result could be unicode */ Modified: python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h (original) +++ python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h Sun Jun 1 17:18:10 2008 @@ -6,7 +6,7 @@ compiled as unicode. */ #define STRINGLIB_IS_UNICODE 0 -#define STRINGLIB_OBJECT PyStringObject +#define STRINGLIB_OBJECT PyBytesObject #define STRINGLIB_CHAR char #define STRINGLIB_TYPE_NAME "string" #define STRINGLIB_PARSE_CODE "S" @@ -16,13 +16,13 @@ #define STRINGLIB_TOUPPER toupper #define STRINGLIB_TOLOWER tolower #define STRINGLIB_FILL memset -#define STRINGLIB_STR PyString_AS_STRING -#define STRINGLIB_LEN PyString_GET_SIZE -#define STRINGLIB_NEW PyString_FromStringAndSize -#define STRINGLIB_RESIZE _PyString_Resize -#define STRINGLIB_CHECK PyString_Check +#define STRINGLIB_STR PyBytes_AS_STRING +#define STRINGLIB_LEN PyBytes_GET_SIZE +#define STRINGLIB_NEW PyBytes_FromStringAndSize +#define STRINGLIB_RESIZE _PyBytes_Resize +#define STRINGLIB_CHECK PyBytes_Check #define STRINGLIB_CMP memcmp #define STRINGLIB_TOSTR PyObject_Str -#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping +#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping #endif /* !STRINGLIB_STRINGDEFS_H */ Deleted: python/branches/tlee-ast-optimize/Objects/stringobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringobject.c Sun Jun 1 17:18:10 2008 +++ (empty file) @@ -1,5176 +0,0 @@ -/* String object implementation */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" - -#include "formatter_string.h" - -#include - -#ifdef COUNT_ALLOCS -int null_strings, one_strings; -#endif - -static PyStringObject *characters[UCHAR_MAX + 1]; -static PyStringObject *nullstring; - -/* This dictionary holds all interned strings. Note that references to - strings in this dictionary are *not* counted in the string's ob_refcnt. - When the interned string reaches a refcnt of 0 the string deallocation - function will delete the reference from this dictionary. - - Another way to look at this is that to say that the actual reference - count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) -*/ -static PyObject *interned; - -/* - For both PyString_FromString() and PyString_FromStringAndSize(), the - parameter `size' denotes number of characters to allocate, not counting any - null terminating character. - - For PyString_FromString(), the parameter `str' points to a null-terminated - string containing exactly `size' bytes. - - For PyString_FromStringAndSize(), the parameter the parameter `str' is - either NULL or else points to a string containing at least `size' bytes. - For PyString_FromStringAndSize(), the string in the `str' parameter does - not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyString_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyString_FromStringAndSize() will allocate `size+1' - bytes (setting the last byte to the null terminating character) and you can - fill in the data yourself. If `str' is non-NULL then the resulting - PyString object must be treated as immutable and you must not fill in nor - alter the data yourself, since the strings may be shared. - - The PyObject member `op->ob_size', which denotes the number of "extra - items" in a variable-size object, will contain the number of bytes - allocated for string data, not counting the null terminating character. It - is therefore equal to the equal to the `size' parameter (for - PyString_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyString_FromString()). -*/ -PyObject * -PyString_FromStringAndSize(const char *str, Py_ssize_t size) -{ - register PyStringObject *op; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyString_FromStringAndSize"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && str != NULL && - (op = characters[*str & UCHAR_MAX]) != NULL) - { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - if (str != NULL) - Py_MEMCPY(op->ob_sval, str, size); - op->ob_sval[size] = '\0'; - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1 && str != NULL) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromString(const char *str) -{ - register size_t size; - register PyStringObject *op; - - assert(str != NULL); - size = strlen(str); - if (size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string is too long for a Python string"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, str, size+1); - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t n = 0; - const char* f; - char *s; - PyObject* string; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f; - while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*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. */ - n += 20; - break; - case 's': - s = va_arg(count, char*); - n += strlen(s); - 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: - /* step 2: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyString_FromStringAndSize(NULL, n); - if (!string) - return NULL; - - s = PyString_AsString(string); - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - Py_ssize_t i; - int longflag = 0; - int size_tflag = 0; - /* parse the width.precision part (we're only - interested in the precision value, if any) */ - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - if (*f == '.') { - f++; - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - } - while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - f++; - /* 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': - if (longflag) - sprintf(s, "%ld", va_arg(vargs, long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "d", - va_arg(vargs, Py_ssize_t)); - else - sprintf(s, "%d", va_arg(vargs, int)); - s += strlen(s); - break; - case 'u': - if (longflag) - sprintf(s, "%lu", - va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "u", - va_arg(vargs, size_t)); - else - sprintf(s, "%u", - va_arg(vargs, unsigned int)); - s += strlen(s); - break; - case 'i': - sprintf(s, "%i", va_arg(vargs, int)); - s += strlen(s); - break; - case 'x': - sprintf(s, "%x", va_arg(vargs, int)); - s += strlen(s); - break; - case 's': - p = va_arg(vargs, char*); - i = strlen(p); - if (n > 0 && i > n) - i = n; - Py_MEMCPY(s, p, i); - s += i; - break; - case 'p': - sprintf(s, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (s[1] == 'X') - s[1] = 'x'; - else if (s[1] != 'x') { - memmove(s+2, s, strlen(s)+1); - s[0] = '0'; - s[1] = 'x'; - } - s += strlen(s); - break; - case '%': - *s++ = '%'; - break; - default: - strcpy(s, p); - s += strlen(s); - goto end; - } - } else - *s++ = *f; - } - - end: - _PyString_Resize(&string, s - PyString_AS_STRING(string)); - return string; -} - -PyObject * -PyString_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyString_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - - -PyObject *PyString_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsDecodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsDecodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Decode via the codec registry */ - v = PyCodec_Decode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsDecodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsDecodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -PyObject *PyString_Encode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsEncodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsEncodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsEncodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsEncodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -static void -string_dealloc(PyObject *op) -{ - switch (PyString_CHECK_INTERNED(op)) { - case SSTATE_NOT_INTERNED: - break; - - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(op) = 3; - if (PyDict_DelItem(interned, op) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; - - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); - - default: - Py_FatalError("Inconsistent interned string state."); - } - Py_TYPE(op)->tp_free(op); -} - -/* Unescape a backslash-escaped string. If unicode is non-zero, - the string is a u-literal. If recode_encoding is non-zero, - the string is UTF-8 encoded and should be re-encoded in the - specified encoding. */ - -PyObject *PyString_DecodeEscape(const char *s, - Py_ssize_t len, - const char *errors, - Py_ssize_t unicode, - const char *recode_encoding) -{ - int c; - char *p, *buf; - const char *end; - PyObject *v; - Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyString_FromStringAndSize((char *)NULL, newlen); - if (v == NULL) - return NULL; - p = buf = PyString_AsString(v); - end = s + len; - while (s < end) { - if (*s != '\\') { - non_esc: -#ifdef Py_USING_UNICODE - if (recode_encoding && (*s & 0x80)) { - PyObject *u, *w; - char *r; - const char* t; - Py_ssize_t rn; - t = s; - /* Decode non-ASCII bytes as UTF-8. */ - while (t < end && (*t & 0x80)) t++; - u = PyUnicode_DecodeUTF8(s, t - s, errors); - if(!u) goto failed; - - /* Recode them in target encoding. */ - w = PyUnicode_AsEncodedString( - u, recode_encoding, errors); - Py_DECREF(u); - if (!w) goto failed; - - /* Append bytes to output buffer. */ - assert(PyString_Check(w)); - r = PyString_AS_STRING(w); - rn = PyString_GET_SIZE(w); - Py_MEMCPY(p, r, rn); - p += rn; - Py_DECREF(w); - s = t; - } else { - *p++ = *s++; - } -#else - *p++ = *s++; -#endif - continue; - } - s++; - if (s==end) { - PyErr_SetString(PyExc_ValueError, - "Trailing \\ in string"); - goto failed; - } - switch (*s++) { - /* XXX This assumes ASCII! */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - c = (c<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - c = (c<<3) + *s++ - '0'; - } - *p++ = c; - break; - case 'x': - if (s+1 < end && - isxdigit(Py_CHARMASK(s[0])) && - isxdigit(Py_CHARMASK(s[1]))) - { - unsigned int x = 0; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x = c - '0'; - else if (islower(c)) - x = 10 + c - 'a'; - else - x = 10 + c - 'A'; - x = x << 4; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x += c - '0'; - else if (islower(c)) - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - *p++ = x; - break; - } - if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); - goto failed; - } - if (strcmp(errors, "replace") == 0) { - *p++ = '?'; - } else if (strcmp(errors, "ignore") == 0) - /* do nothing */; - else { - PyErr_Format(PyExc_ValueError, - "decoding error; " - "unknown error handling code: %.400s", - errors); - goto failed; - } -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif - default: - *p++ = '\\'; - s--; - goto non_esc; /* an arbitry number of unescaped - UTF-8 bytes may follow. */ - } - } - if (p-buf < newlen) - _PyString_Resize(&v, p - buf); - return v; - failed: - Py_DECREF(v); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* object api */ - -static Py_ssize_t -string_getsize(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return -1; - return len; -} - -static /*const*/ char * -string_getbuffer(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return NULL; - return s; -} - -Py_ssize_t -PyString_Size(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getsize(op); - return Py_SIZE(op); -} - -/*const*/ char * -PyString_AsString(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getbuffer(op); - return ((PyStringObject *)op) -> ob_sval; -} - -int -PyString_AsStringAndSize(register PyObject *obj, - register char **s, - register Py_ssize_t *len) -{ - if (s == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (!PyString_Check(obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(obj)) { - obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); - if (obj == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " - "%.200s found", Py_TYPE(obj)->tp_name); - return -1; - } - } - - *s = PyString_AS_STRING(obj); - if (len != NULL) - *len = PyString_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) { - PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); - return -1; - } - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#include "stringlib/stringdefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" - -#define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping -#include "stringlib/localeutil.h" - - - -static int -string_print(PyStringObject *op, FILE *fp, int flags) -{ - Py_ssize_t i, str_len; - char c; - int quote; - - /* XXX Ought to check for interrupts when writing long strings */ - if (! PyString_CheckExact(op)) { - int ret; - /* A str subclass may have its own __str__ method. */ - op = (PyStringObject *) PyObject_Str((PyObject *)op); - if (op == NULL) - return -1; - ret = string_print(op, fp, flags); - Py_DECREF(op); - return ret; - } - if (flags & Py_PRINT_RAW) { - char *data = op->ob_sval; - Py_ssize_t size = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - while (size > INT_MAX) { - /* Very long strings cannot be written atomically. - * But don't write exactly INT_MAX bytes at a time - * to avoid memory aligment issues. - */ - const int chunk_size = INT_MAX & ~0x3FFF; - fwrite(data, 1, chunk_size, fp); - data += chunk_size; - size -= chunk_size; - } -#ifdef __VMS - if (size) fwrite(data, (int)size, 1, fp); -#else - fwrite(data, 1, (int)size, fp); -#endif - Py_END_ALLOW_THREADS - return 0; - } - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - str_len = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - fputc(quote, fp); - for (i = 0; i < str_len; i++) { - /* Since strings are immutable and the caller should have a - reference, accessing the interal buffer should not be an issue - with the GIL released. */ - c = op->ob_sval[i]; - if (c == quote || c == '\\') - fprintf(fp, "\\%c", c); - else if (c == '\t') - fprintf(fp, "\\t"); - else if (c == '\n') - fprintf(fp, "\\n"); - else if (c == '\r') - fprintf(fp, "\\r"); - else if (c < ' ' || c >= 0x7f) - fprintf(fp, "\\x%02x", c & 0xff); - else - fputc(c, fp); - } - fputc(quote, fp); - Py_END_ALLOW_THREADS - return 0; -} - -PyObject * -PyString_Repr(PyObject *obj, int smartquotes) -{ - register PyStringObject* op = (PyStringObject*) obj; - size_t newsize = 2 + 4 * Py_SIZE(op); - PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_SIZE(op)) { - PyErr_SetString(PyExc_OverflowError, - "string is too large to make repr"); - return NULL; - } - v = PyString_FromStringAndSize((char *)NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (smartquotes && - memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - p = PyString_AS_STRING(v); - *p++ = quote; - for (i = 0; i < Py_SIZE(op); i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyString_AS_STRING(v)) >= 5); - c = op->ob_sval[i]; - if (c == quote || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c < ' ' || c >= 0x7f) { - /* For performance, we don't want to call - PyOS_snprintf here (extra layers of - function call). */ - sprintf(p, "\\x%02x", c & 0xff); - p += 4; - } - else - *p++ = c; - } - assert(newsize - (p - PyString_AS_STRING(v)) >= 1); - *p++ = quote; - *p = '\0'; - _PyString_Resize( - &v, (p - PyString_AS_STRING(v))); - return v; - } -} - -static PyObject * -string_repr(PyObject *op) -{ - return PyString_Repr(op, 1); -} - -static PyObject * -string_str(PyObject *s) -{ - assert(PyString_Check(s)); - if (PyString_CheckExact(s)) { - Py_INCREF(s); - return s; - } - else { - /* Subtype -- return genuine string with the same value. */ - PyStringObject *t = (PyStringObject *) s; - return PyString_FromStringAndSize(t->ob_sval, Py_SIZE(t)); - } -} - -static Py_ssize_t -string_length(PyStringObject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -string_concat(register PyStringObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register PyStringObject *op; - if (!PyString_Check(bb)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(bb)) - return PyUnicode_Concat((PyObject *)a, bb); -#endif - if (PyBytes_Check(bb)) - return PyBytes_Concat((PyObject *)a, bb); - PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str' and '%.200s' objects", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyStringObject *)bb) - /* Optimize cases with empty left or right operand */ - if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyString_CheckExact(a) && PyString_CheckExact(b)) { - if (Py_SIZE(a) == 0) { - Py_INCREF(bb); - return bb; - } - Py_INCREF(a); - return (PyObject *)a; - } - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - Py_MEMCPY(op->ob_sval + Py_SIZE(a), b->ob_sval, Py_SIZE(b)); - op->ob_sval[size] = '\0'; - return (PyObject *) op; -#undef b -} - -static PyObject * -string_repeat(register PyStringObject *a, register Py_ssize_t n) -{ - register Py_ssize_t i; - register Py_ssize_t j; - register Py_ssize_t size; - register PyStringObject *op; - size_t nbytes; - if (n < 0) - n = 0; - /* watch out for overflows: the size can overflow int, - * and the # of bytes needed can overflow size_t - */ - size = Py_SIZE(a) * n; - if (n && size / n != Py_SIZE(a)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - if (size == Py_SIZE(a) && PyString_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - nbytes = (size_t)size; - if (nbytes + sizeof(PyStringObject) <= nbytes) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + nbytes); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - op->ob_sval[size] = '\0'; - if (Py_SIZE(a) == 1 && n > 0) { - memset(op->ob_sval, a->ob_sval[0] , n); - return (PyObject *) op; - } - i = 0; - if (i < size) { - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - i = Py_SIZE(a); - } - while (i < size) { - j = (i <= size-i) ? i : size-i; - Py_MEMCPY(op->ob_sval+i, op->ob_sval, j); - i += j; - } - return (PyObject *) op; -} - -/* String slice a[i:j] consists of characters a[i] ... a[j-1] */ - -static PyObject * -string_slice(register PyStringObject *a, register Py_ssize_t i, - register Py_ssize_t j) - /* j -- may be negative! */ -{ - if (i < 0) - i = 0; - if (j < 0) - j = 0; /* Avoid signed/unsigned bug in next line */ - if (j > Py_SIZE(a)) - j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) { - /* It's the same as a */ - Py_INCREF(a); - return (PyObject *)a; - } - if (j < i) - j = i; - return PyString_FromStringAndSize(a->ob_sval + i, j-i); -} - -static int -string_contains(PyObject *str_obj, PyObject *sub_obj) -{ - if (!PyString_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(sub_obj)) - return PyUnicode_Contains(str_obj, sub_obj); -#endif - if (!PyString_Check(sub_obj)) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, " - "not %.200s", Py_TYPE(sub_obj)->tp_name); - return -1; - } - } - - return stringlib_contains_obj(str_obj, sub_obj); -} - -static PyObject * -string_item(PyStringObject *a, register Py_ssize_t i) -{ - char pchar; - PyObject *v; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - pchar = a->ob_sval[i]; - v = (PyObject *)characters[pchar & UCHAR_MAX]; - if (v == NULL) - v = PyString_FromStringAndSize(&pchar, 1); - else { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(v); - } - return v; -} - -static PyObject* -string_richcompare(PyStringObject *a, PyStringObject *b, int op) -{ - int c; - Py_ssize_t len_a, len_b; - Py_ssize_t min_len; - PyObject *result; - - /* Make sure both arguments are strings. */ - if (!(PyString_Check(a) && PyString_Check(b))) { - result = Py_NotImplemented; - goto out; - } - if (a == b) { - switch (op) { - case Py_EQ:case Py_LE:case Py_GE: - result = Py_True; - goto out; - case Py_NE:case Py_LT:case Py_GT: - result = Py_False; - goto out; - } - } - if (op == Py_EQ) { - /* Supporting Py_NE here as well does not save - much time, since Py_NE is rarely used. */ - if (Py_SIZE(a) == Py_SIZE(b) - && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0)) { - result = Py_True; - } else { - result = Py_False; - } - goto out; - } - len_a = Py_SIZE(a); len_b = Py_SIZE(b); - min_len = (len_a < len_b) ? len_a : len_b; - if (min_len > 0) { - c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); - if (c==0) - c = memcmp(a->ob_sval, b->ob_sval, min_len); - } else - c = 0; - if (c == 0) - c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: assert(0); break; /* unreachable */ - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - out: - Py_INCREF(result); - return result; -} - -int -_PyString_Eq(PyObject *o1, PyObject *o2) -{ - PyStringObject *a = (PyStringObject*) o1; - PyStringObject *b = (PyStringObject*) o2; - return Py_SIZE(a) == Py_SIZE(b) - && *a->ob_sval == *b->ob_sval - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; -} - -static long -string_hash(PyStringObject *a) -{ - register Py_ssize_t len; - register unsigned char *p; - register long x; - - if (a->ob_shash != -1) - return a->ob_shash; - len = Py_SIZE(a); - p = (unsigned char *) a->ob_sval; - x = *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= Py_SIZE(a); - if (x == -1) - x = -2; - a->ob_shash = x; - return x; -} - -static PyObject* -string_subscript(PyStringObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyString_GET_SIZE(self); - return string_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - char* source_buf; - char* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyString_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyString_FromStringAndSize("", 0); - } - else if (start == 0 && step == 1 && - slicelength == PyString_GET_SIZE(self) && - PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else if (step == 1) { - return PyString_FromStringAndSize( - PyString_AS_STRING(self) + start, - slicelength); - } - else { - source_buf = PyString_AsString((PyObject*)self); - result_buf = (char *)PyMem_Malloc(slicelength); - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyString_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "string indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static Py_ssize_t -string_buffer_getreadbuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = (void *)self->ob_sval; - return Py_SIZE(self); -} - -static Py_ssize_t -string_buffer_getwritebuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "Cannot use string as modifiable buffer"); - return -1; -} - -static Py_ssize_t -string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = self->ob_sval; - return Py_SIZE(self); -} - -static int -string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags) -{ - return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self), - 0, flags); -} - -static PySequenceMethods string_as_sequence = { - (lenfunc)string_length, /*sq_length*/ - (binaryfunc)string_concat, /*sq_concat*/ - (ssizeargfunc)string_repeat, /*sq_repeat*/ - (ssizeargfunc)string_item, /*sq_item*/ - (ssizessizeargfunc)string_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - (objobjproc)string_contains /*sq_contains*/ -}; - -static PyMappingMethods string_as_mapping = { - (lenfunc)string_length, - (binaryfunc)string_subscript, - 0, -}; - -static PyBufferProcs string_as_buffer = { - (readbufferproc)string_buffer_getreadbuf, - (writebufferproc)string_buffer_getwritebuf, - (segcountproc)string_buffer_getsegcount, - (charbufferproc)string_buffer_getcharbuf, - (getbufferproc)string_buffer_getbuffer, - 0, /* XXX */ -}; - - - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - - -/* Don't call if length < 2 */ -#define Py_STRING_MATCH(target, offset, pattern, length) \ - (target[offset] == pattern[0] && \ - target[offset+length-1] == pattern[length-1] && \ - !memcmp(target+offset+1, pattern+1, length-2) ) - - -/* Overallocate the initial list to reduce the number of reallocs for small - split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three - resizes, to sizes 4, 8, then 16. Most observed string splits are for human - text (roughly 11 words per line) and field delimited data (usually 1-10 - fields). For large strings the split algorithms are bandwidth limited - so increasing the preallocation likely will not improve things.*/ - -#define MAX_PREALLOC 12 - -/* 5 splits gives 6 elements */ -#define PREALLOC_SIZE(maxsplit) \ - (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) - -#define SPLIT_APPEND(data, left, right) \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); - -#define SPLIT_ADD(data, left, right) { \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (count < MAX_PREALLOC) { \ - PyList_SET_ITEM(list, count, str); \ - } else { \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); \ - } \ - count++; } - -/* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SIZE(list) = count - -#define SKIP_SPACE(s, i, len) { while (i=0 && isspace(Py_CHARMASK(s[i]))) i--; } -#define RSKIP_NONSPACE(s, i) { while (i>=0 && !isspace(Py_CHARMASK(s[i]))) i--; } - -Py_LOCAL_INLINE(PyObject *) -split_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = 0; - - while (maxsplit-- > 0) { - SKIP_SPACE(s, i, len); - if (i==len) break; - j = i; i++; - SKIP_NONSPACE(s, i, len); - if (j == 0 && i == len && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, j, i); - } - - if (i < len) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to end of string */ - SKIP_SPACE(s, i, len); - if (i != len) - SPLIT_ADD(s, i, len); - } - FIX_PREALLOC_SIZE(list); - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -split_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = 0; - while ((j < len) && (maxcount-- > 0)) { - for(; j list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are removed\n\ -from the result."); - -static PyObject * -string_split(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s = PyString_AS_STRING(self), *sub; - PyObject *list, *str, *subobj = Py_None; -#ifdef USE_FAST - Py_ssize_t pos; -#endif - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return split_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return split_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - -#ifdef USE_FAST - i = j = 0; - while (maxsplit-- > 0) { - pos = fastsearch(s+i, len-i, sub, n, FAST_SEARCH); - if (pos < 0) - break; - j = i+pos; - SPLIT_ADD(s, i, j); - i = j + n; - } -#else - i = j = 0; - while ((j+n <= len) && (maxsplit-- > 0)) { - for (; j+n <= len; j++) { - if (Py_STRING_MATCH(s, j, sub, n)) { - SPLIT_ADD(s, i, j); - i = j = j + n; - break; - } - } - } -#endif - SPLIT_ADD(s, i, len); - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in S, and returns the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, returns S and two empty strings."); - -static PyObject * -string_partition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_partition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (tail, sep, head)\n\ -\n\ -Searches for the separator sep in S, starting at the end of S, and returns\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, returns two empty strings and S."); - -static PyObject * -string_rpartition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_rpartition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = len-1; - - while (maxsplit-- > 0) { - RSKIP_SPACE(s, i); - if (i<0) break; - j = i; i--; - RSKIP_NONSPACE(s, i); - if (j == len-1 && i < 0 && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, i + 1, j + 1); - } - if (i >= 0) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to beginning of string */ - RSKIP_SPACE(s, i); - if (i >= 0) - SPLIT_ADD(s, 0, i + 1); - - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = len - 1; - while ((i >= 0) && (maxcount-- > 0)) { - for (; i >= 0; i--) { - if (s[i] == ch) { - SPLIT_ADD(s, i + 1, j + 1); - j = i = i - 1; - break; - } - } - } - if (i < 0 && count == 0 && PyString_CheckExact(self)) { - /* ch not in self, so just use self as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - } - else if (j >= -1) { - SPLIT_ADD(s, 0, j + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string, starting at the end of the string and working\n\ -to the front. If maxsplit is given, at most maxsplit splits are\n\ -done. If sep is not specified or is None, any whitespace string\n\ -is a separator."); - -static PyObject * -string_rsplit(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s, *sub; - PyObject *list, *str, *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return rsplit_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return rsplit_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - - j = len; - i = j - n; - - s = PyString_AS_STRING(self); - while ( (i >= 0) && (maxsplit-- > 0) ) { - for (; i>=0; i--) { - if (Py_STRING_MATCH(s, i, sub, n)) { - SPLIT_ADD(s, i + n, j); - j = i; - i -= n; - break; - } - } - } - SPLIT_ADD(s, 0, j); - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - -onError: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(join__doc__, -"S.join(sequence) -> string\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."); - -static PyObject * -string_join(PyStringObject *self, PyObject *orig) -{ - char *sep = PyString_AS_STRING(self); - const Py_ssize_t seplen = PyString_GET_SIZE(self); - PyObject *res = NULL; - char *p; - Py_ssize_t seqlen = 0; - size_t sz = 0; - Py_ssize_t i; - PyObject *seq, *item; - - seq = PySequence_Fast(orig, ""); - if (seq == NULL) { - return NULL; - } - - seqlen = PySequence_Size(seq); - if (seqlen == 0) { - Py_DECREF(seq); - return PyString_FromString(""); - } - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyString_CheckExact(item) || PyUnicode_CheckExact(item)) { - Py_INCREF(item); - Py_DECREF(seq); - return item; - } - } - - /* There are at least two things to join, or else we have a subclass - * of the builtin types in the sequence. - * Do a pre-pass to figure out the total amount of space we'll - * need (sz), see whether any argument is absurd, and defer to - * the Unicode join if appropriate. - */ - for (i = 0; i < seqlen; i++) { - const size_t old_sz = sz; - item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyString_Check(item)){ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(item)) { - /* Defer to Unicode join. - * CAUTION: There's no gurantee that the - * original sequence can be iterated over - * again, so we must pass seq here. - */ - PyObject *result; - result = PyUnicode_Join((PyObject *)self, seq); - Py_DECREF(seq); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string," - " %.80s found", - i, Py_TYPE(item)->tp_name); - Py_DECREF(seq); - return NULL; - } - sz += PyString_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"); - Py_DECREF(seq); - return NULL; - } - } - - /* Allocate result space. */ - res = PyString_FromStringAndSize((char*)NULL, sz); - if (res == NULL) { - Py_DECREF(seq); - return NULL; - } - - /* Catenate everything. */ - p = PyString_AS_STRING(res); - for (i = 0; i < seqlen; ++i) { - size_t n; - item = PySequence_Fast_GET_ITEM(seq, i); - n = PyString_GET_SIZE(item); - Py_MEMCPY(p, PyString_AS_STRING(item), n); - p += n; - if (i < seqlen - 1) { - Py_MEMCPY(p, sep, seplen); - p += seplen; - } - } - - Py_DECREF(seq); - return res; -} - -PyObject * -_PyString_Join(PyObject *sep, PyObject *x) -{ - assert(sep != NULL && PyString_Check(sep)); - assert(x != NULL); - return string_join((PyStringObject *)sep, x); -} - -Py_LOCAL_INLINE(void) -string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len) -{ - if (*end > len) - *end = len; - else if (*end < 0) - *end += len; - if (*end < 0) - *end = 0; - if (*start < 0) - *start += len; - if (*start < 0) - *start = 0; -} - -Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyStringObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - const char *sub; - Py_ssize_t sub_len; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - PyObject *obj_start=Py_None, *obj_end=Py_None; - - if (!PyArg_ParseTuple(args, "O|OO:find/rfind/index/rindex", &subobj, - &obj_start, &obj_end)) - return -2; - /* To support None in "start" and "end" arguments, meaning - the same as if they were not passed. - */ - if (obj_start != Py_None) - if (!_PyEval_SliceIndex(obj_start, &start)) - return -2; - if (obj_end != Py_None) - if (!_PyEval_SliceIndex(obj_end, &end)) - return -2; - - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - sub_len = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Find( - (PyObject *)self, subobj, start, end, dir); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) - /* XXX - the "expected a character buffer object" is pretty - confusing for a non-expert. remap to something else ? */ - return -2; - - if (dir > 0) - return stringlib_find_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); - else - return stringlib_rfind_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); -} - - -PyDoc_STRVAR(find__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_find(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(index__doc__, -"S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -string_index(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_rfind(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -string_rindex(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self); - char *sep = PyString_AS_STRING(sepobj); - Py_ssize_t seplen = PyString_GET_SIZE(sepobj); - Py_ssize_t i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_strip(PyStringObject *self, int striptype) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyStringObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyString_Check(sep)) - return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep)) { - PyObject *uniself = PyUnicode_FromObject((PyObject *)self); - PyObject *res; - if (uniself==NULL) - return NULL; - res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, - striptype, sep); - Py_DECREF(uniself); - return res; - } -#endif - PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else - "%s arg must be None or str", -#endif - STRIPNAME(striptype)); - return NULL; - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_strip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_lstrip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_rstrip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -PyDoc_STRVAR(lower__doc__, -"S.lower() -> string\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */ -#ifndef _tolower -#define _tolower tolower -#endif - -static PyObject * -string_lower(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (isupper(c)) - s[i] = _tolower(c); - } - - return newobj; -} - -PyDoc_STRVAR(upper__doc__, -"S.upper() -> string\n\ -\n\ -Return a copy of the string S converted to uppercase."); - -#ifndef _toupper -#define _toupper toupper -#endif - -static PyObject * -string_upper(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (islower(c)) - s[i] = _toupper(c); - } - - return newobj; -} - -PyDoc_STRVAR(title__doc__, -"S.title() -> string\n\ -\n\ -Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -static PyObject* -string_title(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - int previous_is_cased = 0; - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - if (!previous_is_cased) - c = toupper(c); - previous_is_cased = 1; - } else if (isupper(c)) { - if (previous_is_cased) - c = tolower(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *s_new++ = c; - } - return newobj; -} - -PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> string\n\ -\n\ -Return a copy of the string S with only its first character\n\ -capitalized."); - -static PyObject * -string_capitalize(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) - *s_new = toupper(c); - else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) - *s_new = tolower(c); - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(count__doc__, -"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 interpreted\n\ -as in slice notation."); - -static PyObject * -string_count(PyStringObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyString_AS_STRING(self), *sub; - Py_ssize_t sub_len; - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - - if (!PyArg_ParseTuple(args, "O|O&O&:count", &sub_obj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; - - if (PyString_Check(sub_obj)) { - sub = PyString_AS_STRING(sub_obj); - sub_len = PyString_GET_SIZE(sub_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sub_obj)) { - Py_ssize_t count; - count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); - if (count == -1) - return NULL; - else - return PyInt_FromSsize_t(count); - } -#endif - else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) - return NULL; - - string_adjust_indices(&start, &end, PyString_GET_SIZE(self)); - - return PyInt_FromSsize_t( - stringlib_count(str + start, end - start, sub, sub_len) - ); -} - -PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> string\n\ -\n\ -Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."); - -static PyObject * -string_swapcase(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - *s_new = toupper(c); - } - else if (isupper(c)) { - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(translate__doc__, -"S.translate(table [,deletechars]) -> string\n\ -\n\ -Return a copy of the string S, where all characters occurring\n\ -in the optional argument deletechars are removed, and the\n\ -remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256."); - -static PyObject * -string_translate(PyStringObject *self, PyObject *args) -{ - register char *input, *output; - const char *table; - register Py_ssize_t i, c, changed = 0; - PyObject *input_obj = (PyObject*)self; - const char *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - PyObject *tableobj, *delobj = NULL; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (PyString_Check(tableobj)) { - table = PyString_AS_STRING(tableobj); - tablen = PyString_GET_SIZE(tableobj); - } - else if (tableobj == Py_None) { - table = NULL; - tablen = 256; - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(tableobj)) { - /* Unicode .translate() does not support the deletechars - parameter; instead a mapping to None will cause characters - to be deleted. */ - if (delobj != NULL) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } - return PyUnicode_Translate((PyObject *)self, tableobj, NULL); - } -#endif - else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) - return NULL; - - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - if (delobj != NULL) { - if (PyString_Check(delobj)) { - del_table = PyString_AS_STRING(delobj); - dellen = PyString_GET_SIZE(delobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(delobj)) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } -#endif - else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) - return NULL; - } - else { - del_table = NULL; - dellen = 0; - } - - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AS_STRING(input_obj); - - if (dellen == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed || !PyString_CheckExact(input_obj)) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed && PyString_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - _PyString_Resize(&result, output - output_start); - return result; -} - - -#define FORWARD 1 -#define REVERSE -1 - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - -/* String ops must return a string. */ -/* If the object is subclass of string, create a copy */ -Py_LOCAL(PyStringObject *) -return_self(PyStringObject *self) -{ - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return self; - } - return (PyStringObject *)PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, int target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - -Py_LOCAL(Py_ssize_t) -findstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings always match at the first attempt */ - if (pattern_len == 0) - return (direction > 0) ? start : end; - - end -= pattern_len; - - if (direction < 0) { - for (; end >= start; end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) - return end; - } else { - for (; start <= end; start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) - return start; - } - return -1; -} - -Py_LOCAL_INLINE(Py_ssize_t) -countstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings match everywhere */ - if (pattern_len == 0 || maxcount == 0) { - if (target_len+1 < maxcount) - return target_len+1; - return maxcount; - } - - end -= pattern_len; - if (direction < 0) { - for (; (end >= start); end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) break; - end -= pattern_len-1; - } - } else { - for (; (start <= end); start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) - break; - start += pattern_len-1; - } - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_interleave(PyStringObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyString_AS_STRING(self); - result_s = PyString_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_delete_single_character(PyStringObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyStringObject *) -replace_delete_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, 1, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character_in_place(PyStringObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyStringObject *result; - - /* The result string will be the same size */ - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring_in_place(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyStringObject *result; - - /* The result string will be the same size */ - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - offset = findstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD); - if (offset == -1) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character(PyStringObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyStringObject *) -replace(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyString_GET_SIZE(self) == 0) { - /* nothing to do; return the original string */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original string */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' string everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self string to generate a non-empty string */ - /* Special case so the remaining code always gets a non-empty string */ - if (PyString_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' string */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both strings have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - -PyDoc_STRVAR(replace__doc__, -"S.replace (old, new[, count]) -> string\n\ -\n\ -Return a copy of string S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -string_replace(PyStringObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to; - const char *from_s, *to_s; - Py_ssize_t from_len, to_len; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (PyString_Check(from)) { - from_s = PyString_AS_STRING(from); - from_len = PyString_GET_SIZE(from); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(from)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) - return NULL; - - if (PyString_Check(to)) { - to_s = PyString_AS_STRING(to); - to_len = PyString_GET_SIZE(to); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(to)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) - return NULL; - - return (PyObject *)replace((PyStringObject *) self, - from_s, from_len, - to_s, to_len, count); -} - -/** End DALKE **/ - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyString_GET_SIZE(self); - Py_ssize_t slen; - const char* sub; - const char* str; - - if (PyString_Check(substr)) { - sub = PyString_AS_STRING(substr); - slen = PyString_GET_SIZE(substr); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(substr)) - return PyUnicode_Tailmatch((PyObject *)self, - substr, start, end, direction); -#endif - else if (PyObject_AsCharBuffer(substr, &sub, &slen)) - return -1; - str = PyString_AS_STRING(self); - - string_adjust_indices(&start, &end, len); - - if (direction < 0) { - /* startswith */ - if (start+slen > len) - return 0; - } else { - /* endswith */ - if (end-start < slen || start > len) - return 0; - - if (end-slen > start) - start = end - slen; - } - if (end-start >= slen) - return ! memcmp(str+start, sub, slen); - return 0; -} - - -PyDoc_STRVAR(startswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -string_startswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, -1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -string_endswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, +1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[,errors]]) -> object\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeEncodeErrors."); - -static PyObject * -string_encode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) - return NULL; - v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(decode__doc__, -"S.decode([encoding[,errors]]) -> object\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registerd with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -string_decode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) - return NULL; - v = PyString_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> string\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."); - -static PyObject* -string_expandtabs(PyStringObject *self, PyObject *args) -{ - const char *e, *p, *qe; - char *q; - Py_ssize_t i, j, incr; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */ - for (p = PyString_AS_STRING(self); p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = PyString_FromStringAndSize(NULL, i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = PyString_AS_STRING(u); /* next output char */ - qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */ - - for (p = PyString_AS_STRING(self); 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; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - - return u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - - u = PyString_FromStringAndSize(NULL, - left + PyString_GET_SIZE(self) + right); - if (u) { - if (left) - memset(PyString_AS_STRING(u), fill, left); - Py_MEMCPY(PyString_AS_STRING(u) + left, - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); - if (right) - memset(PyString_AS_STRING(u) + left + PyString_GET_SIZE(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> string\n" -"\n" -"Return S left justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -string_ljust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, 0, width - PyString_GET_SIZE(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> string\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)"); - -static PyObject * -string_rjust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, width - PyString_GET_SIZE(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> string\n" -"\n" -"Return S centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_center(PyStringObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - PyString_GET_SIZE(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> string\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."); - -static PyObject * -string_zfill(PyStringObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (PyString_GET_SIZE(self) >= width) { - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self) - ); - } - - fill = width - PyString_GET_SIZE(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = PyString_AS_STRING(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} - -PyDoc_STRVAR(isspace__doc__, -"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."); - -static PyObject* -string_isspace(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isspace(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isspace(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalpha__doc__, -"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."); - -static PyObject* -string_isalpha(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalpha(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalpha(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalnum__doc__, -"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."); - -static PyObject* -string_isalnum(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalnum(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalnum(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isdigit__doc__, -"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."); - -static PyObject* -string_isdigit(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isdigit(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isdigit(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(islower__doc__, -"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."); - -static PyObject* -string_islower(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(islower(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (isupper(*p)) - return PyBool_FromLong(0); - else if (!cased && islower(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(isupper__doc__, -"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."); - -static PyObject* -string_isupper(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (islower(*p)) - return PyBool_FromLong(0); - else if (!cased && isupper(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(istitle__doc__, -"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. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -static PyObject* -string_istitle(PyStringObject *self, PyObject *uncased) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (isupper(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (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(splitlines__doc__, -"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\ -is given and true."); - -static PyObject* -string_splitlines(PyStringObject *self, PyObject *args) -{ - register Py_ssize_t i; - register Py_ssize_t j; - Py_ssize_t len; - int keepends = 0; - PyObject *list; - PyObject *str; - char *data; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - data = PyString_AS_STRING(self); - len = PyString_GET_SIZE(self); - - /* This does not use the preallocated list because splitlines is - usually run with hundreds of newlines. The overhead of - switching between PyList_SET_ITEM and append causes about a - 2-3% slowdown for that common case. A smarter implementation - could move the if check out, so the SET_ITEMs are done first - and the appends only done when the prealloc buffer is full. - That's too much work for little gain.*/ - - list = PyList_New(0); - if (!list) - goto onError; - - for (i = j = 0; i < len; ) { - Py_ssize_t eol; - - /* Find a line and append it */ - while (i < len && data[i] != '\n' && data[i] != '\r') - 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); - } - - return list; - - onError: - Py_XDECREF(list); - return NULL; -} - -#undef SPLIT_APPEND -#undef SPLIT_ADD -#undef MAX_PREALLOC -#undef PREALLOC_SIZE - -static PyObject * -string_getnewargs(PyStringObject *v) -{ - return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); -} - - -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> unicode\n\ -\n\ -"); - -PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> unicode\n\ -\n\ -"); - - -static PyMethodDef -string_methods[] = { - /* Counterparts of the obsolete stropmodule functions; except - string.maketrans(). */ - {"join", (PyCFunction)string_join, METH_O, join__doc__}, - {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, - {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, - {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, - {"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__}, - {"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__}, - {"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__}, - {"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__}, - {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, - {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, - capitalize__doc__}, - {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, - {"endswith", (PyCFunction)string_endswith, METH_VARARGS, - endswith__doc__}, - {"partition", (PyCFunction)string_partition, METH_O, partition__doc__}, - {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, - {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, - {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, - {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, - {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, - {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction)string_rpartition, METH_O, - rpartition__doc__}, - {"startswith", (PyCFunction)string_startswith, METH_VARARGS, - startswith__doc__}, - {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, - swapcase__doc__}, - {"translate", (PyCFunction)string_translate, METH_VARARGS, - translate__doc__}, - {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, - {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, - {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, - {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, - {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) string__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, - {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, - {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, - splitlines__doc__}, - {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"object", 0}; - - if (type != &PyString_Type) - return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) - return NULL; - if (x == NULL) - return PyString_FromString(""); - return PyObject_Str(x); -} - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyString_Type)); - tmp = string_new(&PyString_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyString_CheckExact(tmp)); - n = PyString_GET_SIZE(tmp); - pnew = type->tp_alloc(type, n); - if (pnew != NULL) { - Py_MEMCPY(PyString_AS_STRING(pnew), PyString_AS_STRING(tmp), n+1); - ((PyStringObject *)pnew)->ob_shash = - ((PyStringObject *)tmp)->ob_shash; - ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; - } - Py_DECREF(tmp); - return pnew; -} - -static PyObject * -basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, - "The basestring type cannot be instantiated"); - return NULL; -} - -static PyObject * -string_mod(PyObject *v, PyObject *w) -{ - if (!PyString_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyString_Format(v, w); -} - -PyDoc_STRVAR(basestring_doc, -"Type basestring cannot be instantiated; it is the base for str and unicode."); - -static PyNumberMethods string_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - string_mod, /*nb_remainder*/ -}; - - -PyTypeObject PyBaseString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "basestring", - 0, - 0, - 0, /* 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 | Py_TPFLAGS_BASETYPE, /* tp_flags */ - basestring_doc, /* 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 */ - 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 */ - basestring_new, /* tp_new */ - 0, /* tp_free */ -}; - -PyDoc_STRVAR(string_doc, -"str(object) -> string\n\ -\n\ -Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."); - -PyTypeObject PyString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", - sizeof(PyStringObject), - sizeof(char), - string_dealloc, /* tp_dealloc */ - (printfunc)string_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - string_repr, /* tp_repr */ - &string_as_number, /* tp_as_number */ - &string_as_sequence, /* tp_as_sequence */ - &string_as_mapping, /* tp_as_mapping */ - (hashfunc)string_hash, /* tp_hash */ - 0, /* tp_call */ - string_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - string_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)string_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - string_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - string_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -void -PyString_Concat(register PyObject **pv, register PyObject *w) -{ - register PyObject *v; - if (*pv == NULL) - return; - if (w == NULL || !PyString_Check(*pv)) { - Py_DECREF(*pv); - *pv = NULL; - return; - } - v = string_concat((PyStringObject *) *pv, w); - Py_DECREF(*pv); - *pv = v; -} - -void -PyString_ConcatAndDel(register PyObject **pv, register PyObject *w) -{ - PyString_Concat(pv, w); - Py_XDECREF(w); -} - - -/* The following function breaks the notion that strings are immutable: - it changes the size of a string. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new string object and destroying the old one, only - more efficiently. In any case, don't use this if the string may - already be known to some other part of the code... - Note that if there's not enough memory to resize the string, the original - string object at *pv is deallocated, *pv is set to NULL, an "out of - memory" exception is set, and -1 is returned. Else (on success) 0 is - returned, and the value in *pv may or may not be the same as on input. - As always, an extra byte is allocated for a trailing \0 byte (newsize - does *not* include that), and a trailing \0 byte is stored. -*/ - -int -_PyString_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyObject *v; - register PyStringObject *sv; - v = *pv; - if (!PyString_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyString_CHECK_INTERNED(v)) { - *pv = 0; - Py_DECREF(v); - PyErr_BadInternalCall(); - return -1; - } - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference(v); - *pv = (PyObject *) - PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize); - if (*pv == NULL) { - PyObject_Del(v); - PyErr_NoMemory(); - return -1; - } - _Py_NewReference(*pv); - sv = (PyStringObject *) *pv; - Py_SIZE(sv) = newsize; - sv->ob_sval[newsize] = '\0'; - sv->ob_shash = -1; /* invalidate cached hash value */ - return 0; -} - -/* Helpers for formatstring */ - -Py_LOCAL_INLINE(PyObject *) -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -Py_LOCAL_INLINE(int) -formatfloat(char *buf, 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)*/ - char fmt[20]; - double x; - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "float argument required, " - "not %.200s", Py_TYPE(v)->tp_name); - return -1; - } - if (prec < 0) - prec = 6; - if (type == 'f' && fabs(x)/1e25 >= 1e25) - 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 - - 'f' formats: - 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; - } - PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); - PyOS_ascii_formatd(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -/* _PyString_FormatLong emulates the format codes d, u, o, x and X, and - * the F_ALT flag, for Python's long (unbounded) ints. It's not used for - * Python's regular ints. - * Return value: a new PyString*, or NULL if error. - * . *pbuf is set to point into it, - * *plen set to the # of chars following that. - * Caller must decref it when done using pbuf. - * The string starting at *pbuf is of the form - * "-"? ("0x" | "0X")? digit+ - * "0x"/"0X" are present only for x and X conversions, with F_ALT - * set in flags. The case of hex digits will be correct, - * There will be at least prec digits, zero-filled on the left if - * necessary to get that many. - * val object to be converted - * flags bitmask of format flags; only F_ALT is looked at - * prec minimum number of digits; 0-fill on left if needed - * type a character in [duoxX]; u acts the same as d - * - * CAUTION: o, x and X conversions on regular ints can never - * produce a '-' sign, but can for Python's unbounded ints. - */ -PyObject* -_PyString_FormatLong(PyObject *val, int flags, int prec, int type, - char **pbuf, int *plen) -{ - PyObject *result = NULL; - char *buf; - Py_ssize_t i; - int sign; /* 1 if '-', else 0 */ - int len; /* number of characters */ - Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; - - switch (type) { - case 'd': - case 'u': - result = Py_TYPE(val)->tp_str(val); - break; - case 'o': - result = Py_TYPE(val)->tp_as_number->nb_oct(val); - break; - case 'x': - case 'X': - numnondigits = 2; - result = Py_TYPE(val)->tp_as_number->nb_hex(val); - break; - default: - assert(!"'type' not in [duoxX]"); - } - if (!result) - return NULL; - - buf = PyString_AsString(result); - if (!buf) { - Py_DECREF(result); - return NULL; - } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyString_Size(result); - if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); - return NULL; - } - len = (int)llen; - if (buf[len-1] == 'L') { - --len; - buf[len] = '\0'; - } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); - skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); - } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyString_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); - return NULL; - } - b1 = PyString_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; - for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyString_AS_STRING(result); - len = numnondigits + prec; - } - - /* Fix up case for hex conversions. */ - if (type == 'X') { - /* Need to convert all lower case letters to upper case. - and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') - buf[i] -= 'a'-'A'; - } - *pbuf = buf; - *plen = len; - return result; -} - -Py_LOCAL_INLINE(int) -formatint(char *buf, 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) - + 1 + 1 = 24 */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", - Py_TYPE(v)->tp_name); - return -1; - } - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - 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 - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in unicodeobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - if (sign[0]) - PyOS_snprintf(buf, buflen, fmt, -x); - else - PyOS_snprintf(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -Py_LOCAL_INLINE(int) -formatchar(char *buf, size_t buflen, PyObject *v) -{ - /* presume that the buffer is at least 2 characters long */ - if (PyString_Check(v)) { - if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) - return -1; - } - else { - if (!PyArg_Parse(v, "b;%c requires int or char", &buf[0])) - return -1; - } - buf[1] = '\0'; - return 1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the floats, ints, & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject * -PyString_Format(PyObject *format, PyObject *args) -{ - char *fmt, *res; - Py_ssize_t arglen, argidx; - Py_ssize_t reslen, rescnt, fmtcnt; - int args_owned = 0; - PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE - PyObject *v, *w; -#endif - PyObject *dict = NULL; - if (format == NULL || !PyString_Check(format) || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - orig_args = args; - fmt = PyString_AS_STRING(format); - fmtcnt = PyString_GET_SIZE(format); - reslen = rescnt = fmtcnt + 100; - result = PyString_FromStringAndSize((char *)NULL, reslen); - if (result == NULL) - return NULL; - res = PyString_AsString(result); - if (PyTuple_Check(args)) { - arglen = PyTuple_GET_SIZE(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyString_Resize(&result, reslen) < 0) - return NULL; - res = PyString_AS_STRING(result) - + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - int c = '\0'; - int fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; - int sign; - Py_ssize_t len; - char formatbuf[FORMATBUFLEN]; - /* For format{float,int,char}() */ -#ifdef Py_USING_UNICODE - char *fmt_start = fmt; - Py_ssize_t argidx_start = argidx; -#endif - - fmt++; - if (*fmt == '(') { - char *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto error; - } - ++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 error; - } - key = PyString_FromStringAndSize(keystart, - keylen); - if (key == NULL) - goto error; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto error; - } - width = PyInt_AsLong(v); - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - width = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((width*10) / 10 != width) { - PyErr_SetString( - PyExc_ValueError, - "width too big"); - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString( - PyExc_TypeError, - "* wants int"); - goto error; - } - prec = PyInt_AsLong(v); - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((prec*10) / 10 != prec) { - PyErr_SetString( - PyExc_ValueError, - "prec too big"); - goto error; - } - 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 error; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - } - sign = 0; - fill = ' '; - switch (c) { - case '%': - pbuf = "%"; - len = 1; - break; - case 's': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE - if (temp != NULL && PyUnicode_Check(temp)) { - Py_DECREF(temp); - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - /* Fall through */ - case 'r': - if (c == 'r') - temp = PyObject_Repr(v); - if (temp == NULL) - goto error; - if (!PyString_Check(temp)) { - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - Py_DECREF(temp); - goto error; - } - pbuf = PyString_AS_STRING(temp); - len = PyString_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 (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, - sizeof(formatbuf), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto error; - sign = 1; - } - else if (PyLong_Check(iobj)) { - int ilen; - - isnumok = 1; - temp = _PyString_FormatLong(iobj, flags, - prec, c, &pbuf, &ilen); - Py_DECREF(iobj); - len = ilen; - if (!temp) - goto error; - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", c, Py_TYPE(v)->tp_name); - goto error; - } - 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), - flags, prec, c, v); - if (len < 0) - goto error; - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - case 'c': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf), v); - if (len < 0) - goto error; - break; - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - c, c, - (Py_ssize_t)(fmt - 1 - - PyString_AsString(format))); - goto error; - } - 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_DECREF(result); - Py_XDECREF(temp); - return PyErr_NoMemory(); - } - if (_PyString_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - return NULL; - } - res = PyString_AS_STRING(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - 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')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_MEMCPY(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 error; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto error; - } - if (args_owned) { - Py_DECREF(args); - } - _PyString_Resize(&result, reslen - rescnt); - return result; - -#ifdef Py_USING_UNICODE - unicode: - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - /* Fiddle args right (remove the first argidx arguments) */ - if (PyTuple_Check(orig_args) && argidx > 0) { - PyObject *v; - Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx; - v = PyTuple_New(n); - if (v == NULL) - goto error; - while (--n >= 0) { - PyObject *w = PyTuple_GET_ITEM(orig_args, n + argidx); - Py_INCREF(w); - PyTuple_SET_ITEM(v, n, w); - } - args = v; - } else { - Py_INCREF(orig_args); - args = orig_args; - } - args_owned = 1; - /* Take what we have of the result and let the Unicode formatting - function format the rest of the input. */ - rescnt = res - PyString_AS_STRING(result); - if (_PyString_Resize(&result, rescnt)) - goto error; - fmtcnt = PyString_GET_SIZE(format) - \ - (fmt - PyString_AS_STRING(format)); - format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); - if (format == NULL) - goto error; - v = PyUnicode_Format(format, args); - Py_DECREF(format); - if (v == NULL) - goto error; - /* Paste what we have (result) to what the Unicode formatting - function returned (v) and return the result (or error) */ - w = PyUnicode_Concat(result, v); - Py_DECREF(result); - Py_DECREF(v); - Py_DECREF(args); - return w; -#endif /* Py_USING_UNICODE */ - - error: - Py_DECREF(result); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -void -PyString_InternInPlace(PyObject **p) -{ - register PyStringObject *s = (PyStringObject *)(*p); - PyObject *t; - if (s == NULL || !PyString_Check(s)) - Py_FatalError("PyString_InternInPlace: strings only please!"); - /* If it's a string subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyString_CheckExact(s)) - return; - if (PyString_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - t = PyDict_GetItem(interned, (PyObject *)s); - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - return; - } - /* The two references in interned are not counted by refcnt. - The string deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; -} - -void -PyString_InternImmortal(PyObject **p) -{ - PyString_InternInPlace(p); - if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } -} - - -PyObject * -PyString_InternFromString(const char *cp) -{ - PyObject *s = PyString_FromString(cp); - if (s == NULL) - return NULL; - PyString_InternInPlace(&s); - return s; -} - -void -PyString_Fini(void) -{ - int i; - for (i = 0; i < UCHAR_MAX + 1; i++) { - Py_XDECREF(characters[i]); - characters[i] = NULL; - } - Py_XDECREF(nullstring); - nullstring = NULL; -} - -void _Py_ReleaseInternedStrings(void) -{ - PyObject *keys; - PyStringObject *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_ReleaseInternedStrings() is intended to help a leak - detector, interned 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 = (PyStringObject *) PyList_GET_ITEM(keys, i); - switch (s->ob_sstate) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += Py_SIZE(s); - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += Py_SIZE(s); - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->ob_sstate = 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; -} Modified: python/branches/tlee-ast-optimize/Objects/structseq.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/structseq.c (original) +++ python/branches/tlee-ast-optimize/Objects/structseq.c Sun Jun 1 17:18:10 2008 @@ -270,7 +270,7 @@ Py_DECREF(tup); return NULL; } - crepr = PyString_AsString(repr); + crepr = PyBytes_AsString(repr); if (crepr == NULL) { Py_DECREF(tup); Py_DECREF(repr); @@ -306,7 +306,7 @@ *pbuf++ = ')'; *pbuf = '\0'; - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * Modified: python/branches/tlee-ast-optimize/Objects/tupleobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/tupleobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/tupleobject.c Sun Jun 1 17:18:10 2008 @@ -218,7 +218,7 @@ n = Py_SIZE(v); if (n == 0) - return PyString_FromString("()"); + return PyBytes_FromString("()"); /* While not mutable, it is still possible to end up with a cycle in a tuple through an object that stores itself within a tuple (and thus @@ -226,7 +226,7 @@ possible within a type. */ i = Py_ReprEnter((PyObject *)v); if (i != 0) { - return i > 0 ? PyString_FromString("(...)") : NULL; + return i > 0 ? PyBytes_FromString("(...)") : NULL; } pieces = PyTuple_New(n); @@ -246,29 +246,29 @@ /* Add "()" decorations to the first and last items. */ assert(n > 0); - s = PyString_FromString("("); + s = PyBytes_FromString("("); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyTuple_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString(n == 1 ? ",)" : ")"); + s = PyBytes_FromString(n == 1 ? ",)" : ")"); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, n-1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyTuple_SET_ITEM(pieces, n-1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: Modified: python/branches/tlee-ast-optimize/Objects/typeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/typeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/typeobject.c Sun Jun 1 17:18:10 2008 @@ -19,10 +19,10 @@ >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ - ((PyStringObject *)(name))->ob_shash) + ((PyBytesObject *)(name))->ob_shash) #define MCACHE_CACHEABLE_NAME(name) \ - PyString_CheckExact(name) && \ - PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE + PyBytes_CheckExact(name) && \ + PyBytes_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { unsigned int version; @@ -32,7 +32,6 @@ static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]; static unsigned int next_version_tag = 0; -static void type_modified(PyTypeObject *); unsigned int PyType_ClearCache(void) @@ -47,12 +46,12 @@ } next_version_tag = 0; /* mark all version tags as invalid */ - type_modified(&PyBaseObject_Type); + PyType_Modified(&PyBaseObject_Type); return cur_version_tag; } -static void -type_modified(PyTypeObject *type) +void +PyType_Modified(PyTypeObject *type) { /* Invalidate any cached data for the specified type and all subclasses. This function is called after the base @@ -86,7 +85,7 @@ ref = PyList_GET_ITEM(raw, i); ref = PyWeakref_GET_OBJECT(ref); if (ref != Py_None) { - type_modified((PyTypeObject *)ref); + PyType_Modified((PyTypeObject *)ref); } } } @@ -172,7 +171,7 @@ Py_INCREF(Py_None); } /* mark all version tags as invalid */ - type_modified(&PyBaseObject_Type); + PyType_Modified(&PyBaseObject_Type); return 1; } bases = type->tp_bases; @@ -218,7 +217,7 @@ s = type->tp_name; else s++; - return PyString_FromString(s); + return PyBytes_FromString(s); } } @@ -237,14 +236,14 @@ "can't delete %s.__name__", type->tp_name); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "can only assign string to %s.__name__, not '%s'", type->tp_name, Py_TYPE(value)->tp_name); return -1; } - if (strlen(PyString_AS_STRING(value)) - != (size_t)PyString_GET_SIZE(value)) { + if (strlen(PyBytes_AS_STRING(value)) + != (size_t)PyBytes_GET_SIZE(value)) { PyErr_Format(PyExc_ValueError, "__name__ must not contain null bytes"); return -1; @@ -257,7 +256,7 @@ Py_DECREF(et->ht_name); et->ht_name = value; - type->tp_name = PyString_AS_STRING(value); + type->tp_name = PyBytes_AS_STRING(value); return 0; } @@ -280,9 +279,9 @@ else { s = strrchr(type->tp_name, '.'); if (s != NULL) - return PyString_FromStringAndSize( + return PyBytes_FromStringAndSize( type->tp_name, (Py_ssize_t)(s - type->tp_name)); - return PyString_FromString("__builtin__"); + return PyBytes_FromString("__builtin__"); } } @@ -300,7 +299,7 @@ return -1; } - type_modified(type); + PyType_Modified(type); return PyDict_SetItemString(type->tp_dict, "__module__", value); } @@ -328,7 +327,7 @@ int res = PyDict_SetItemString(type->tp_dict, "__abstractmethods__", value); if (res == 0) { - type_modified(type); + PyType_Modified(type); if (value && PyObject_IsTrue(value)) { type->tp_flags |= Py_TPFLAGS_IS_ABSTRACT; } @@ -556,7 +555,7 @@ { PyObject *result; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) - return PyString_FromString(type->tp_doc); + return PyBytes_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); if (result == NULL) { result = Py_None; @@ -645,7 +644,7 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyString_Check(mod)) { + else if (!PyBytes_Check(mod)) { Py_DECREF(mod); mod = NULL; } @@ -658,14 +657,14 @@ else kind = "type"; - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) { - rtn = PyString_FromFormat("<%s '%s.%s'>", + if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) { + rtn = PyBytes_FromFormat("<%s '%s.%s'>", kind, - PyString_AS_STRING(mod), - PyString_AS_STRING(name)); + PyBytes_AS_STRING(mod), + PyBytes_AS_STRING(name)); } else - rtn = PyString_FromFormat("<%s '%s'>", kind, type->tp_name); + rtn = PyBytes_FromFormat("<%s '%s'>", kind, type->tp_name); Py_XDECREF(mod); Py_DECREF(name); @@ -1137,7 +1136,7 @@ PyObject *res; if (*attrobj == NULL) { - *attrobj = PyString_InternFromString(attrstr); + *attrobj = PyBytes_InternFromString(attrstr); if (*attrobj == NULL) return NULL; } @@ -1329,7 +1328,7 @@ } if (name == NULL) return NULL; - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { Py_DECREF(name); return NULL; } @@ -1351,7 +1350,7 @@ o = class_name(o); PyErr_Format(PyExc_TypeError, "duplicate base class %s", - o ? PyString_AS_STRING(o) : "?"); + o ? PyBytes_AS_STRING(o) : "?"); Py_XDECREF(o); return -1; } @@ -1397,7 +1396,7 @@ while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { PyObject *name = class_name(k); off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", - name ? PyString_AS_STRING(name) : "?"); + name ? PyBytes_AS_STRING(name) : "?"); Py_XDECREF(name); if (--n && (size_t)(off+1) < sizeof(buf)) { buf[off++] = ','; @@ -1621,7 +1620,7 @@ from the custom MRO */ type_mro_modified(type, type->tp_bases); - type_modified(type); + PyType_Modified(type); return 0; } @@ -1750,7 +1749,7 @@ PyObject *descr; if (dict_str == NULL) { - dict_str = PyString_InternFromString("__dict__"); + dict_str = PyBytes_InternFromString("__dict__"); if (dict_str == NULL) return NULL; } @@ -1899,14 +1898,14 @@ unsigned char *p; Py_ssize_t i, n; - if (!PyString_Check(s)) { + if (!PyBytes_Check(s)) { PyErr_Format(PyExc_TypeError, "__slots__ items must be strings, not '%.200s'", Py_TYPE(s)->tp_name); return 0; } - p = (unsigned char *) PyString_AS_STRING(s); - n = PyString_GET_SIZE(s); + p = (unsigned char *) PyBytes_AS_STRING(s); + n = PyBytes_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the length to 1 so that the loop will balk on the trailing \0. */ if (n == 0) @@ -2108,7 +2107,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyString_Check(slots) || PyUnicode_Check(slots)) + if (PyBytes_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); @@ -2146,8 +2145,8 @@ char *s; if (!valid_identifier(tmp)) goto bad_slots; - assert(PyString_Check(tmp)); - s = PyString_AS_STRING(tmp); + assert(PyBytes_Check(tmp)); + s = PyBytes_AS_STRING(tmp); if (strcmp(s, "__dict__") == 0) { if (!may_add_dict || add_dict) { PyErr_SetString(PyExc_TypeError, @@ -2179,7 +2178,7 @@ for (i = j = 0; i < nslots; i++) { char *s; tmp = PyTuple_GET_ITEM(slots, i); - s = PyString_AS_STRING(tmp); + s = PyBytes_AS_STRING(tmp); if ((add_dict && strcmp(s, "__dict__") == 0) || (add_weak && strcmp(s, "__weakref__") == 0)) continue; @@ -2272,7 +2271,7 @@ type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; - type->tp_name = PyString_AS_STRING(name); + type->tp_name = PyBytes_AS_STRING(name); /* Set tp_base and tp_bases */ type->tp_bases = bases; @@ -2305,14 +2304,14 @@ */ { PyObject *doc = PyDict_GetItemString(dict, "__doc__"); - if (doc != NULL && PyString_Check(doc)) { - const size_t n = (size_t)PyString_GET_SIZE(doc); + if (doc != NULL && PyBytes_Check(doc)) { + const size_t n = (size_t)PyBytes_GET_SIZE(doc); char *tp_doc = (char *)PyObject_MALLOC(n+1); if (tp_doc == NULL) { Py_DECREF(type); return NULL; } - memcpy(tp_doc, PyString_AS_STRING(doc), n+1); + memcpy(tp_doc, PyBytes_AS_STRING(doc), n+1); type->tp_doc = tp_doc; } } @@ -2335,7 +2334,7 @@ slotoffset = base->tp_basicsize; if (slots != NULL) { for (i = 0; i < nslots; i++, mp++) { - mp->name = PyString_AS_STRING( + mp->name = PyBytes_AS_STRING( PyTuple_GET_ITEM(slots, i)); mp->type = T_OBJECT_EX; mp->offset = slotoffset; @@ -2536,7 +2535,7 @@ /* Give up */ PyErr_Format(PyExc_AttributeError, "type object '%.50s' has no attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); + type->tp_name, PyBytes_AS_STRING(name)); return NULL; } @@ -2855,7 +2854,7 @@ if (sorted_methods == NULL) goto error; if (comma == NULL) { - comma = PyString_InternFromString(", "); + comma = PyBytes_InternFromString(", "); if (comma == NULL) goto error; } @@ -2863,7 +2862,7 @@ "O", sorted_methods); if (joined == NULL) goto error; - joined_str = PyString_AsString(joined); + joined_str = PyBytes_AsString(joined); if (joined_str == NULL) goto error; @@ -2897,20 +2896,20 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyString_Check(mod)) { + else if (!PyBytes_Check(mod)) { Py_DECREF(mod); mod = NULL; } name = type_name(type, NULL); if (name == NULL) return NULL; - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) - rtn = PyString_FromFormat("<%s.%s object at %p>", - PyString_AS_STRING(mod), - PyString_AS_STRING(name), + if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) + rtn = PyBytes_FromFormat("<%s.%s object at %p>", + PyBytes_AS_STRING(mod), + PyBytes_AS_STRING(name), self); else - rtn = PyString_FromFormat("<%s object at %p>", + rtn = PyBytes_FromFormat("<%s object at %p>", type->tp_name, self); Py_XDECREF(mod); Py_DECREF(name); @@ -3070,7 +3069,7 @@ static PyObject *copyreg_str; if (!copyreg_str) { - copyreg_str = PyString_InternFromString("copy_reg"); + copyreg_str = PyBytes_InternFromString("copy_reg"); if (copyreg_str == NULL) return NULL; } @@ -3376,7 +3375,7 @@ return NULL; if (PyUnicode_Check(format_spec)) { self_as_str = PyObject_Unicode(self); - } else if (PyString_Check(format_spec)) { + } else if (PyBytes_Check(format_spec)) { self_as_str = PyObject_Str(self); } else { PyErr_SetString(PyExc_TypeError, "argument to __format__ must be unicode or str"); @@ -3619,7 +3618,7 @@ type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; else if (PyType_IsSubtype(base, &PyLong_Type)) type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; - else if (PyType_IsSubtype(base, &PyString_Type)) + else if (PyType_IsSubtype(base, &PyBytes_Type)) type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; #ifdef Py_USING_UNICODE else if (PyType_IsSubtype(base, &PyUnicode_Type)) @@ -3958,7 +3957,7 @@ */ if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { if (type->tp_doc != NULL) { - PyObject *doc = PyString_FromString(type->tp_doc); + PyObject *doc = PyBytes_FromString(type->tp_doc); if (doc == NULL) goto error; PyDict_SetItemString(type->tp_dict, "__doc__", doc); @@ -4846,7 +4845,7 @@ descrgetfunc f; if (getitem_str == NULL) { - getitem_str = PyString_InternFromString("__getitem__"); + getitem_str = PyBytes_InternFromString("__getitem__"); if (getitem_str == NULL) return NULL; } @@ -5214,7 +5213,7 @@ return res; } PyErr_Clear(); - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -5322,13 +5321,13 @@ static PyObject *getattr_str = NULL; if (getattr_str == NULL) { - getattr_str = PyString_InternFromString("__getattr__"); + getattr_str = PyBytes_InternFromString("__getattr__"); if (getattr_str == NULL) return NULL; } if (getattribute_str == NULL) { getattribute_str = - PyString_InternFromString("__getattribute__"); + PyBytes_InternFromString("__getattribute__"); if (getattribute_str == NULL) return NULL; } @@ -5469,7 +5468,7 @@ static PyObject *get_str = NULL; if (get_str == NULL) { - get_str = PyString_InternFromString("__get__"); + get_str = PyBytes_InternFromString("__get__"); if (get_str == NULL) return NULL; } @@ -5539,7 +5538,7 @@ Py_ssize_t i, n; if (new_str == NULL) { - new_str = PyString_InternFromString("__new__"); + new_str = PyBytes_InternFromString("__new__"); if (new_str == NULL) return NULL; } @@ -6069,7 +6068,7 @@ if (initialized) return; for (p = slotdefs; p->name; p++) { - p->name_strobj = PyString_InternFromString(p->name); + p->name_strobj = PyBytes_InternFromString(p->name); if (!p->name_strobj) Py_FatalError("Out of memory interning slotdef names"); } @@ -6092,7 +6091,7 @@ update_subclasses() recursion below, but carefully: they each have their own conditions on which to stop recursing into subclasses. */ - type_modified(type); + PyType_Modified(type); init_slotdefs(); pp = ptrs; @@ -6284,12 +6283,12 @@ superobject *su = (superobject *)self; if (su->obj_type) - return PyString_FromFormat( + return PyBytes_FromFormat( ", <%s object>>", su->type ? su->type->tp_name : "NULL", su->obj_type->tp_name); else - return PyString_FromFormat( + return PyBytes_FromFormat( ", NULL>", su->type ? su->type->tp_name : "NULL"); } @@ -6303,9 +6302,9 @@ if (!skip) { /* We want __class__ to return the class of the super object (i.e. super, or a subclass), not the class of su->obj. */ - skip = (PyString_Check(name) && - PyString_GET_SIZE(name) == 9 && - strcmp(PyString_AS_STRING(name), "__class__") == 0); + skip = (PyBytes_Check(name) && + PyBytes_GET_SIZE(name) == 9 && + strcmp(PyBytes_AS_STRING(name), "__class__") == 0); } if (!skip) { @@ -6397,7 +6396,7 @@ PyObject *class_attr; if (class_str == NULL) { - class_str = PyString_FromString("__class__"); + class_str = PyBytes_FromString("__class__"); if (class_str == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/Objects/unicodeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/unicodeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/unicodeobject.c Sun Jun 1 17:18:10 2008 @@ -42,8 +42,6 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "formatter_unicode.h" - #include "unicodeobject.h" #include "ucnhash.h" @@ -1080,11 +1078,11 @@ #endif /* Coerce object */ - if (PyString_Check(obj)) { - s = PyString_AS_STRING(obj); - len = PyString_GET_SIZE(obj); + if (PyBytes_Check(obj)) { + s = PyBytes_AS_STRING(obj); + len = PyBytes_GET_SIZE(obj); } - else if (PyBytes_Check(obj)) { + else if (PyByteArray_Check(obj)) { /* Python 2.x specific */ PyErr_Format(PyExc_TypeError, "decoding bytearray is not supported"); @@ -1254,7 +1252,7 @@ v = PyCodec_Encode(unicode, encoding, errors); if (v == NULL) goto onError; - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -1654,13 +1652,13 @@ char * start; if (size == 0) - return PyString_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); - v = PyString_FromStringAndSize(NULL, cbAllocated); + v = PyBytes_FromStringAndSize(NULL, cbAllocated); if (v == NULL) return NULL; - start = out = PyString_AS_STRING(v); + start = out = PyBytes_AS_STRING(v); for (;i < size; ++i) { Py_UNICODE ch = s[i]; @@ -1726,7 +1724,7 @@ *out++ = '-'; } - _PyString_Resize(&v, out - start); + _PyBytes_Resize(&v, out - start); return v; } @@ -1991,10 +1989,10 @@ nallocated = size * 4; if (nallocated / 4 != size) /* overflow! */ return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, nallocated); + v = PyBytes_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; - p = PyString_AS_STRING(v); + p = PyBytes_AS_STRING(v); } for (i = 0; i < size;) { @@ -2042,13 +2040,13 @@ /* This was stack allocated. */ nneeded = p - stackbuf; assert(nneeded <= nallocated); - v = PyString_FromStringAndSize(stackbuf, nneeded); + v = PyBytes_FromStringAndSize(stackbuf, nneeded); } else { /* Cut back to size actually needed. */ - nneeded = p - PyString_AS_STRING(v); + nneeded = p - PyBytes_AS_STRING(v); assert(nneeded <= nallocated); - _PyString_Resize(&v, nneeded); + _PyBytes_Resize(&v, nneeded); } return v; @@ -2276,12 +2274,12 @@ 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) pairs++; #endif - v = PyString_FromStringAndSize(NULL, + v = PyBytes_FromStringAndSize(NULL, 4 * (size - pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyString_AS_STRING(v); + p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2541,12 +2539,12 @@ if (s[i] >= 0x10000) pairs++; #endif - v = PyString_FromStringAndSize(NULL, + v = PyBytes_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyString_AS_STRING(v); + p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2889,7 +2887,7 @@ escape. */ - repr = PyString_FromStringAndSize(NULL, + repr = PyBytes_FromStringAndSize(NULL, 2 #ifdef Py_UNICODE_WIDE + 10*size @@ -2900,7 +2898,7 @@ if (repr == NULL) return NULL; - p = PyString_AS_STRING(repr); + p = PyBytes_AS_STRING(repr); if (quotes) { *p++ = 'u'; @@ -2912,7 +2910,7 @@ /* Escape quotes and backslashes */ if ((quotes && - ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { + ch == (Py_UNICODE) PyBytes_AS_STRING(repr)[1]) || ch == '\\') { *p++ = '\\'; *p++ = (char) ch; continue; @@ -2998,10 +2996,10 @@ *p++ = (char) ch; } if (quotes) - *p++ = PyString_AS_STRING(repr)[1]; + *p++ = PyBytes_AS_STRING(repr)[1]; *p = '\0'; - _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); + _PyBytes_Resize(&repr, p - PyBytes_AS_STRING(repr)); return repr; } @@ -3150,16 +3148,16 @@ static const char *hexdigit = "0123456789abcdef"; #ifdef Py_UNICODE_WIDE - repr = PyString_FromStringAndSize(NULL, 10 * size); + repr = PyBytes_FromStringAndSize(NULL, 10 * size); #else - repr = PyString_FromStringAndSize(NULL, 6 * size); + repr = PyBytes_FromStringAndSize(NULL, 6 * size); #endif if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyString_AS_STRING(repr); + p = q = PyBytes_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; #ifdef Py_UNICODE_WIDE @@ -3218,7 +3216,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyString_Resize(&repr, p - q); + _PyBytes_Resize(&repr, p - q); return repr; } @@ -3458,12 +3456,12 @@ /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ - res = PyString_FromStringAndSize(NULL, size); + res = PyBytes_FromStringAndSize(NULL, size); if (res == NULL) goto onError; if (size == 0) return res; - str = PyString_AS_STRING(res); + str = PyBytes_AS_STRING(res); ressize = size; while (p ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) + if (_PyBytes_Resize(&res, requiredsize)) goto onError; - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* generate replacement (temporarily (mis)uses p) */ @@ -3560,17 +3558,17 @@ /* 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-PyString_AS_STRING(res); + 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 (_PyString_Resize(&res, requiredsize)) { + if (_PyBytes_Resize(&res, requiredsize)) { Py_DECREF(repunicode); goto onError; } - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* check if there is anything unencodable in the replacement @@ -3591,10 +3589,10 @@ } } /* Resize if we allocated to much */ - respos = str-PyString_AS_STRING(res); + respos = str-PyBytes_AS_STRING(res); if (respos 0) { - char *s = PyString_AS_STRING(*repr) + n; + 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; @@ -4329,7 +4327,7 @@ } return x; } - else if (PyString_Check(x)) + else if (PyBytes_Check(x)) return x; else { /* wrong return value */ @@ -4343,11 +4341,11 @@ static int charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) { - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); + Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); /* exponentially overallocate to minimize reallocations */ if (requiredsize < 2*outsize) requiredsize = 2*outsize; - if (_PyString_Resize(outobj, requiredsize)) { + if (_PyBytes_Resize(outobj, requiredsize)) { return 0; } return 1; @@ -4368,7 +4366,7 @@ { PyObject *rep; char *outstart; - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); + Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); if (Py_TYPE(mapping) == &EncodingMapType) { int res = encoding_map_lookup(c, mapping); @@ -4378,7 +4376,7 @@ if (outsize unicode\n\ +"S.replace (old, new[, count]) -> unicode\n\ \n\ Return a copy of S with all occurrences of substring\n\ -old replaced by new. If the optional argument maxsplit is\n\ -given, only the first maxsplit occurrences are replaced."); +old replaced by new. If the optional argument count is\n\ +given, only the first count occurrences are replaced."); static PyObject* unicode_replace(PyUnicodeObject *self, PyObject *args) @@ -7863,6 +7861,35 @@ \n\ "); +static PyObject * +unicode__format__(PyObject *self, PyObject *args) +{ + PyObject *format_spec; + PyObject *result = NULL; + PyObject *tmp = NULL; + + /* If 2.x, convert format_spec to the same type as value */ + /* This is to allow things like u''.format('') */ + if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) + goto done; + if (!(PyBytes_Check(format_spec) || PyUnicode_Check(format_spec))) { + PyErr_Format(PyExc_TypeError, "__format__ arg must be str " + "or unicode, not %s", Py_TYPE(format_spec)->tp_name); + goto done; + } + tmp = PyObject_Unicode(format_spec); + if (tmp == NULL) + goto done; + format_spec = tmp; + + result = _PyUnicode_FormatAdvanced(self, + PyUnicode_AS_UNICODE(format_spec), + PyUnicode_GET_SIZE(format_spec)); +done: + Py_XDECREF(tmp); + return result; +} + PyDoc_STRVAR(p_format__doc__, "S.__format__(format_spec) -> unicode\n\ \n\ @@ -8071,8 +8098,8 @@ str = _PyUnicode_AsDefaultEncodedString((PyObject *)self, NULL); if (str == NULL) return -1; - *ptr = (void *) PyString_AS_STRING(str); - return PyString_GET_SIZE(str); + *ptr = (void *) PyBytes_AS_STRING(str); + return PyBytes_GET_SIZE(str); } /* Helpers for PyUnicode_Format() */ @@ -8191,7 +8218,7 @@ PyObject *str; /* temporary string object. */ PyUnicodeObject *result; - str = _PyString_FormatLong(val, flags, prec, type, &buf, &len); + str = _PyBytes_FormatLong(val, flags, prec, type, &buf, &len); if (!str) return NULL; result = _PyUnicode_New(len); @@ -8293,10 +8320,10 @@ buf[0] = PyUnicode_AS_UNICODE(v)[0]; } - else if (PyString_Check(v)) { - if (PyString_GET_SIZE(v) != 1) + else if (PyBytes_Check(v)) { + if (PyBytes_GET_SIZE(v) != 1) goto onError; - buf[0] = (Py_UNICODE)PyString_AS_STRING(v)[0]; + buf[0] = (Py_UNICODE)PyBytes_AS_STRING(v)[0]; } else { @@ -8579,10 +8606,10 @@ goto onError; if (PyUnicode_Check(temp)) /* nothing to do */; - else if (PyString_Check(temp)) { + else if (PyBytes_Check(temp)) { /* convert to string to Unicode */ - unicode = PyUnicode_Decode(PyString_AS_STRING(temp), - PyString_GET_SIZE(temp), + unicode = PyUnicode_Decode(PyBytes_AS_STRING(temp), + PyBytes_GET_SIZE(temp), NULL, "strict"); Py_DECREF(temp); Modified: python/branches/tlee-ast-optimize/Objects/weakrefobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/weakrefobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/weakrefobject.c Sun Jun 1 17:18:10 2008 @@ -166,8 +166,8 @@ "__name__"); if (nameobj == NULL) PyErr_Clear(); - else if (PyString_Check(nameobj)) - name = PyString_AS_STRING(nameobj); + else if (PyBytes_Check(nameobj)) + name = PyBytes_AS_STRING(nameobj); PyOS_snprintf(buffer, sizeof(buffer), name ? "" : "", @@ -177,7 +177,7 @@ name); Py_XDECREF(nameobj); } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* Weak references only support equality, not ordering. Two weak references @@ -448,7 +448,7 @@ "", proxy, Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name, PyWeakref_GET_OBJECT(proxy)); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } Modified: python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp (original) +++ python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp Sun Jun 1 17:18:10 2008 @@ -237,6 +237,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Objects\bytearrayobject.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytesobject.c # End Source File # Begin Source File @@ -643,10 +647,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Objects\stringobject.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\stropmodule.c # End Source File # Begin Source File Modified: python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj Sun Jun 1 17:18:10 2008 @@ -443,6 +443,9 @@ RelativePath="..\..\Objects\bufferobject.c"> + + - - @@ -423,7 +418,7 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj Sun Jun 1 17:18:10 2008 @@ -56,6 +56,7 @@ /> @@ -431,6 +437,7 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj Sun Jun 1 17:18:10 2008 @@ -53,12 +53,9 @@ /> @@ -446,12 +428,9 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj Sun Jun 1 17:18:10 2008 @@ -27,7 +27,7 @@ > - - Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj Sun Jun 1 17:18:10 2008 @@ -56,7 +56,7 @@ /> + @@ -104,6 +107,96 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/debug.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/debug.vsprops (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/debug.vsprops Sun Jun 1 17:18:10 2008 @@ -8,4 +8,8 @@ Name="VCCLCompilerTool" PreprocessorDefinitions="_DEBUG" /> - \ No newline at end of file + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj Sun Jun 1 17:18:10 2008 @@ -67,6 +67,7 @@ /> + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj Sun Jun 1 17:18:10 2008 @@ -62,6 +62,7 @@ /> + + + + @@ -1363,11 +1371,15 @@ > + + - - Modified: python/branches/tlee-ast-optimize/PC/VS8.0/release.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/release.vsprops (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/release.vsprops Sun Jun 1 17:18:10 2008 @@ -8,4 +8,8 @@ Name="VCCLCompilerTool" PreprocessorDefinitions="NDEBUG" /> + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/x64.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/x64.vsprops (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/x64.vsprops Sun Jun 1 17:18:10 2008 @@ -15,4 +15,8 @@ Name="VCLinkerTool" TargetMachine="17" /> + Modified: python/branches/tlee-ast-optimize/PC/_msi.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_msi.c (original) +++ python/branches/tlee-ast-optimize/PC/_msi.c Sun Jun 1 17:18:10 2008 @@ -35,7 +35,7 @@ return NULL; } - oresult = PyString_FromString(cresult); + oresult = PyBytes_FromString(cresult); RpcStringFree(&cresult); return oresult; @@ -136,14 +136,14 @@ PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab); if (result == NULL) return -1; - if (!PyString_Check(result)) { + if (!PyBytes_Check(result)) { PyErr_Format(PyExc_TypeError, "Incorrect return type %s from getnextcabinet", result->ob_type->tp_name); Py_DECREF(result); return FALSE; } - strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab)); + strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab)); return TRUE; } return FALSE; @@ -507,7 +507,7 @@ PyErr_SetString(PyExc_NotImplementedError, "FILETIME result"); return NULL; case VT_LPSTR: - result = PyString_FromStringAndSize(sval, ssize); + result = PyBytes_FromStringAndSize(sval, ssize); if (sval != sbuf) free(sval); return result; @@ -539,9 +539,9 @@ if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data)) return NULL; - if (PyString_Check(data)) { + if (PyBytes_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR, - 0, NULL, PyString_AsString(data)); + 0, NULL, PyBytes_AsString(data)); } else if (PyInt_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, PyInt_AsLong(data), NULL, NULL); Modified: python/branches/tlee-ast-optimize/PC/_subprocess.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_subprocess.c (original) +++ python/branches/tlee-ast-optimize/PC/_subprocess.c Sun Jun 1 17:18:10 2008 @@ -304,42 +304,42 @@ if (!keys || !values) goto error; - out = PyString_FromStringAndSize(NULL, 2048); + out = PyBytes_FromStringAndSize(NULL, 2048); if (! out) goto error; - p = PyString_AS_STRING(out); + p = PyBytes_AS_STRING(out); for (i = 0; i < envsize; i++) { int ksize, vsize, totalsize; PyObject* key = PyList_GET_ITEM(keys, i); PyObject* value = PyList_GET_ITEM(values, i); - if (! PyString_Check(key) || ! PyString_Check(value)) { + if (! PyBytes_Check(key) || ! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } - ksize = PyString_GET_SIZE(key); - vsize = PyString_GET_SIZE(value); - totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 + + ksize = PyBytes_GET_SIZE(key); + vsize = PyBytes_GET_SIZE(value); + totalsize = (p - PyBytes_AS_STRING(out)) + ksize + 1 + vsize + 1 + 1; - if (totalsize > PyString_GET_SIZE(out)) { - int offset = p - PyString_AS_STRING(out); - _PyString_Resize(&out, totalsize + 1024); - p = PyString_AS_STRING(out) + offset; + if (totalsize > PyBytes_GET_SIZE(out)) { + int offset = p - PyBytes_AS_STRING(out); + _PyBytes_Resize(&out, totalsize + 1024); + p = PyBytes_AS_STRING(out) + offset; } - memcpy(p, PyString_AS_STRING(key), ksize); + memcpy(p, PyBytes_AS_STRING(key), ksize); p += ksize; *p++ = '='; - memcpy(p, PyString_AS_STRING(value), vsize); + memcpy(p, PyBytes_AS_STRING(value), vsize); p += vsize; *p++ = '\0'; } /* add trailing null byte */ *p++ = '\0'; - _PyString_Resize(&out, p - PyString_AS_STRING(out)); + _PyBytes_Resize(&out, p - PyBytes_AS_STRING(out)); /* PyObject_Print(out, stdout, 0); */ @@ -413,7 +413,7 @@ NULL, inherit_handles, creation_flags, - environment ? PyString_AS_STRING(environment) : NULL, + environment ? PyBytes_AS_STRING(environment) : NULL, current_directory, &si, &pi); @@ -516,7 +516,7 @@ if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyString_FromString(filename); + return PyBytes_FromString(filename); } static PyMethodDef sp_functions[] = { Modified: python/branches/tlee-ast-optimize/PC/_winreg.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_winreg.c (original) +++ python/branches/tlee-ast-optimize/PC/_winreg.c Sun Jun 1 17:18:10 2008 @@ -424,7 +424,7 @@ PyHKEYObject *pyhkey = (PyHKEYObject *)ob; char resBuf[160]; wsprintf(resBuf, "", pyhkey->hkey); - return PyString_FromString(resBuf); + return PyBytes_FromString(resBuf); } static int @@ -767,11 +767,11 @@ return FALSE; need_decref = 1; } - if (!PyString_Check(value)) + if (!PyBytes_Check(value)) return FALSE; *retDataSize = 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)value)); + PyBytes_AS_STRING( + (PyBytesObject *)value)); } *retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize); if (*retDataBuf==NULL){ @@ -782,8 +782,8 @@ strcpy((char *)*retDataBuf, ""); else strcpy((char *)*retDataBuf, - PyString_AS_STRING( - (PyStringObject *)value)); + PyBytes_AS_STRING( + (PyBytesObject *)value)); if (need_decref) Py_DECREF(value); break; @@ -808,7 +808,7 @@ PyObject *t; t = PyList_GET_ITEM( (PyListObject *)value,j); - if (PyString_Check(t)) { + if (PyBytes_Check(t)) { obs[j] = t; Py_INCREF(t); } else if (PyUnicode_Check(t)) { @@ -821,8 +821,8 @@ } else goto reg_multi_fail; size += 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)obs[j])); + PyBytes_AS_STRING( + (PyBytesObject *)obs[j])); } *retDataSize = size + 1; @@ -839,11 +839,11 @@ PyObject *t; t = obs[j]; strcpy(P, - PyString_AS_STRING( - (PyStringObject *)t)); + PyBytes_AS_STRING( + (PyBytesObject *)t)); P += 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)t)); + PyBytes_AS_STRING( + (PyBytesObject *)t)); Py_DECREF(obs[j]); } /* And doubly-terminate the list... */ @@ -1085,7 +1085,7 @@ if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx"); - retStr = PyString_FromStringAndSize(tmpbuf, len); + retStr = PyBytes_FromStringAndSize(tmpbuf, len); return retStr; /* can be NULL */ } @@ -1303,17 +1303,17 @@ != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); - retStr = PyString_FromStringAndSize(NULL, bufSize); + retStr = PyBytes_FromStringAndSize(NULL, bufSize); if (retStr == NULL) return NULL; - retBuf = PyString_AS_STRING(retStr); + retBuf = PyBytes_AS_STRING(retStr); if ((rc = RegQueryValue(hKey, subKey, retBuf, &bufSize)) != ERROR_SUCCESS) { Py_DECREF(retStr); return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); } - _PyString_Resize(&retStr, strlen(retBuf)); + _PyBytes_Resize(&retStr, strlen(retBuf)); return retStr; } @@ -1414,14 +1414,14 @@ return NULL; } /* XXX - need Unicode support */ - str = PyString_AsString(obStrVal); + str = PyBytes_AsString(obStrVal); if (str == NULL) return NULL; - len = PyString_Size(obStrVal); + len = PyBytes_Size(obStrVal); if (obSubKey == Py_None) subKey = NULL; else { - subKey = PyString_AsString(obSubKey); + subKey = PyBytes_AsString(obSubKey); if (subKey == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/PC/bdist_wininst/install.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/bdist_wininst/install.c (original) +++ python/branches/tlee-ast-optimize/PC/bdist_wininst/install.c Sun Jun 1 17:18:10 2008 @@ -2115,11 +2115,6 @@ { HKEY hk; char key_name[80]; - OSVERSIONINFO winverinfo; - winverinfo.dwOSVersionInfoSize = sizeof(winverinfo); - // If less than XP, then we can't do it (and its not necessary). - if (!GetVersionEx(&winverinfo) || winverinfo.dwMajorVersion < 5) - return FALSE; // no Python version info == we can't know yet. if (target_version[0] == '\0') return FALSE; @@ -2135,6 +2130,23 @@ return TRUE; } +// Returns TRUE if the platform supports UAC. +BOOL PlatformSupportsUAC() +{ + // Note that win2k does seem to support ShellExecute with 'runas', + // but does *not* support IsUserAnAdmin - so we just pretend things + // only work on XP and later. + BOOL bIsWindowsXPorLater; + OSVERSIONINFO winverinfo; + winverinfo.dwOSVersionInfoSize = sizeof(winverinfo); + if (!GetVersionEx(&winverinfo)) + return FALSE; // something bad has gone wrong + bIsWindowsXPorLater = + ( (winverinfo.dwMajorVersion > 5) || + ( (winverinfo.dwMajorVersion == 5) && (winverinfo.dwMinorVersion >= 1) )); + return bIsWindowsXPorLater; +} + // Spawn ourself as an elevated application. On failure, a message is // displayed to the user - but this app will always terminate, even // on error. @@ -2190,7 +2202,7 @@ // See if we need to do the Vista UAC magic. if (strcmp(user_access_control, "force")==0) { - if (!MyIsUserAnAdmin()) { + if (PlatformSupportsUAC() && !MyIsUserAnAdmin()) { SpawnUAC(); return 0; } @@ -2198,7 +2210,7 @@ } else if (strcmp(user_access_control, "auto")==0) { // Check if it looks like we need UAC control, based // on how Python itself was installed. - if (!MyIsUserAnAdmin() && NeedAutoUAC()) { + if (PlatformSupportsUAC() && !MyIsUserAnAdmin() && NeedAutoUAC()) { SpawnUAC(); return 0; } Modified: python/branches/tlee-ast-optimize/PC/msvcrtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/msvcrtmodule.c (original) +++ python/branches/tlee-ast-optimize/PC/msvcrtmodule.c Sun Jun 1 17:18:10 2008 @@ -140,7 +140,7 @@ ch = _getch(); Py_END_ALLOW_THREADS s[0] = ch; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } static PyObject * @@ -172,7 +172,7 @@ ch = _getche(); Py_END_ALLOW_THREADS s[0] = ch; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } static PyObject * Modified: python/branches/tlee-ast-optimize/PC/winsound.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/winsound.c (original) +++ python/branches/tlee-ast-optimize/PC/winsound.c Sun Jun 1 17:18:10 2008 @@ -151,7 +151,7 @@ static void add_define(PyObject *dict, const char *key, long value) { - PyObject *k=PyString_FromString(key); + PyObject *k=PyBytes_FromString(key); PyObject *v=PyLong_FromLong(value); if(v&&k) { Modified: python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj Sun Jun 1 17:18:10 2008 @@ -659,6 +659,10 @@ > + + @@ -1371,6 +1375,10 @@ > + + @@ -1491,10 +1499,6 @@ > - - Modified: python/branches/tlee-ast-optimize/Parser/asdl_c.py ============================================================================== --- python/branches/tlee-ast-optimize/Parser/asdl_c.py (original) +++ python/branches/tlee-ast-optimize/Parser/asdl_c.py Sun Jun 1 17:18:10 2008 @@ -375,7 +375,7 @@ # there's really nothing more we can do if this fails ... self.emit("if (tmp == NULL) goto failed;", 1) error = "expected some sort of %s, but got %%.400s" % name - format = "PyErr_Format(PyExc_TypeError, \"%s\", PyString_AS_STRING(tmp));" + format = "PyErr_Format(PyExc_TypeError, \"%s\", PyBytes_AS_STRING(tmp));" self.emit(format % error, 1, reflow=False) self.emit("failed:", 0) self.emit("Py_XDECREF(tmp);", 1) @@ -710,7 +710,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyString_FromString(fields[i]); + PyObject *field = PyBytes_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -729,7 +729,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyString_FromString(attrs[i]); + s = PyBytes_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -803,7 +803,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -821,7 +821,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } Modified: python/branches/tlee-ast-optimize/Parser/tokenizer.c ============================================================================== --- python/branches/tlee-ast-optimize/Parser/tokenizer.c (original) +++ python/branches/tlee-ast-optimize/Parser/tokenizer.c Sun Jun 1 17:18:10 2008 @@ -12,7 +12,7 @@ #ifndef PGEN #include "unicodeobject.h" -#include "stringobject.h" +#include "bytesobject.h" #include "fileobject.h" #include "codecs.h" #include "abstract.h" @@ -344,7 +344,7 @@ 1) NULL: need to call tok->decoding_readline to get a new line 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and stored the result in tok->decoding_buffer - 3) PyStringObject *: previous call to fp_readl did not have enough room + 3) PyBytesObject *: previous call to fp_readl did not have enough room (in the s buffer) to copy entire contents of the line read by tok->decoding_readline. tok->decoding_buffer has the overflow. In this case, fp_readl is called in a loop (with an expanded buffer) @@ -375,7 +375,7 @@ return error_ret(tok); } else { tok->decoding_buffer = NULL; - if (PyString_CheckExact(buf)) + if (PyBytes_CheckExact(buf)) utf8 = buf; } if (utf8 == NULL) { @@ -384,10 +384,10 @@ if (utf8 == NULL) return error_ret(tok); } - str = PyString_AsString(utf8); - utf8len = PyString_GET_SIZE(utf8); + str = PyBytes_AsString(utf8); + utf8len = PyBytes_GET_SIZE(utf8); if (utf8len > size) { - tok->decoding_buffer = PyString_FromStringAndSize(str+size, utf8len-size); + tok->decoding_buffer = PyBytes_FromStringAndSize(str+size, utf8len-size); if (tok->decoding_buffer == NULL) { Py_DECREF(utf8); return error_ret(tok); @@ -591,7 +591,7 @@ utf8 = translate_into_utf8(str, tok->enc); if (utf8 == NULL) return error_ret(tok); - str = PyString_AsString(utf8); + str = PyBytes_AsString(utf8); } #endif for (s = str;; s++) { @@ -624,7 +624,7 @@ "unknown encoding: %s", tok->enc); return error_ret(tok); } - str = PyString_AsString(utf8); + str = PyBytes_AsString(utf8); } #endif assert(tok->decoding_buffer == NULL); @@ -706,11 +706,11 @@ return 0; enc = ((PyFileObject *)sysstdin)->f_encoding; - if (enc == NULL || !PyString_Check(enc)) + if (enc == NULL || !PyBytes_Check(enc)) return 0; Py_INCREF(enc); - encoding = PyString_AsString(enc); + encoding = PyBytes_AsString(enc); decoded = PyUnicode_Decode(*inp, strlen(*inp), encoding, NULL); if (decoded == NULL) goto error_clear; @@ -720,9 +720,9 @@ if (utf8 == NULL) goto error_clear; - assert(PyString_Check(utf8)); - converted = new_string(PyString_AS_STRING(utf8), - PyString_GET_SIZE(utf8)); + assert(PyBytes_Check(utf8)); + converted = new_string(PyBytes_AS_STRING(utf8), + PyBytes_GET_SIZE(utf8)); Py_DECREF(utf8); if (converted == NULL) goto error_nomem; @@ -1609,8 +1609,8 @@ /* convert source to original encondig */ PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len); if (lineobj != NULL) { - int linelen = PyString_Size(lineobj); - const char *line = PyString_AsString(lineobj); + int linelen = PyBytes_Size(lineobj); + const char *line = PyBytes_AsString(lineobj); text = PyObject_MALLOC(linelen + 1); if (text != NULL && line != NULL) { if (linelen) @@ -1624,7 +1624,7 @@ PyObject *offsetobj = dec_utf8(tok->encoding, tok->buf, *offset-1); if (offsetobj) { - *offset = PyString_Size(offsetobj) + 1; + *offset = PyBytes_Size(offsetobj) + 1; Py_DECREF(offsetobj); } } Modified: python/branches/tlee-ast-optimize/Python/Python-ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/Python-ast.c (original) +++ python/branches/tlee-ast-optimize/Python/Python-ast.c Sun Jun 1 17:18:10 2008 @@ -499,7 +499,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyString_FromString(fields[i]); + PyObject *field = PyBytes_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -518,7 +518,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyString_FromString(attrs[i]); + s = PyBytes_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -592,7 +592,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -610,7 +610,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -3320,7 +3320,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -4448,7 +4448,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5318,7 +5318,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5356,7 +5356,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5474,7 +5474,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5496,7 +5496,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5558,7 +5558,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5588,7 +5588,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5642,7 +5642,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5808,7 +5808,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; Modified: python/branches/tlee-ast-optimize/Python/_warnings.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/_warnings.c (original) +++ python/branches/tlee-ast-optimize/Python/_warnings.c Sun Jun 1 17:18:10 2008 @@ -44,7 +44,7 @@ int result; if (warnings_str == NULL) { - warnings_str = PyString_InternFromString("warnings"); + warnings_str = PyBytes_InternFromString("warnings"); if (warnings_str == NULL) return NULL; } @@ -132,7 +132,7 @@ return NULL; if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyString_AsString(action); + return PyBytes_AsString(action); } m = PyImport_ImportModule(MODULE_NAME); @@ -144,7 +144,7 @@ return NULL; action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME); if (action != NULL) - return PyString_AsString(action); + return PyBytes_AsString(action); PyErr_SetString(PyExc_ValueError, MODULE_NAME "." DEFAULT_ACTION_NAME " not found"); @@ -184,17 +184,17 @@ if (rc == -1) return NULL; else if (rc == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); - mod_str = PyString_AsString(filename); + mod_str = PyBytes_AsString(filename); if (mod_str == NULL) return NULL; - len = PyString_Size(filename); + len = PyBytes_Size(filename); if (len < 0) return NULL; if (len >= 3 && strncmp(mod_str + (len - 3), ".py", 3) == 0) { - module = PyString_FromStringAndSize(mod_str, len-3); + module = PyBytes_FromStringAndSize(mod_str, len-3); } else { module = filename; @@ -258,7 +258,7 @@ /* Print " source_line\n" */ PyFile_WriteString(" ", f_stderr); if (sourceline) { - char *source_line_str = PyString_AS_STRING(sourceline); + char *source_line_str = PyBytes_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || *source_line_str == '\014') source_line_str++; @@ -267,7 +267,7 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); + Py_DisplaySourceLine(f_stderr, PyBytes_AS_STRING(filename), lineno); PyErr_Clear(); } @@ -359,7 +359,7 @@ const char *err_str = "???"; if (to_str != NULL) - err_str = PyString_AS_STRING(to_str); + err_str = PyBytes_AS_STRING(to_str); PyErr_Format(PyExc_RuntimeError, "Unrecognized action (%s) in warnings.filters:\n %s", action, err_str); @@ -380,7 +380,7 @@ else { const char *msg = "functions overriding warnings.showwarning() " "must support the 'line' argument"; - const char *text_char = PyString_AS_STRING(text); + const char *text_char = PyBytes_AS_STRING(text); if (strcmp(msg, text_char) == 0) { /* Prevent infinite recursion by using built-in implementation @@ -484,7 +484,7 @@ /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); if (*module == NULL) { - *module = PyString_FromString(""); + *module = PyBytes_FromString(""); if (*module == NULL) goto handle_error; } @@ -494,8 +494,8 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); if (*filename != NULL) { - Py_ssize_t len = PyString_Size(*filename); - const char *file_str = PyString_AsString(*filename); + Py_ssize_t len = PyBytes_Size(*filename); + const char *file_str = PyBytes_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) goto handle_error; @@ -507,7 +507,7 @@ (tolower(file_str[len-1]) == 'c' || tolower(file_str[len-1]) == 'o')) { - *filename = PyString_FromStringAndSize(file_str, len-1); + *filename = PyBytes_FromStringAndSize(file_str, len-1); if (*filename == NULL) goto handle_error; } @@ -515,7 +515,7 @@ Py_INCREF(*filename); } else { - const char *module_str = PyString_AsString(*module); + const char *module_str = PyBytes_AsString(*module); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { @@ -530,14 +530,14 @@ } else if (!is_true) { Py_DECREF(*filename); - *filename = PyString_FromString("__main__"); + *filename = PyBytes_FromString("__main__"); if (*filename == NULL) goto handle_error; } } else { /* embedded interpreters don't have sys.argv, see bug #839151 */ - *filename = PyString_FromString("__main__"); + *filename = PyBytes_FromString("__main__"); if (*filename == NULL) goto handle_error; } @@ -649,12 +649,12 @@ PyObject *returned; if (get_source_name == NULL) { - get_source_name = PyString_InternFromString("get_source"); + get_source_name = PyBytes_InternFromString("get_source"); if (!get_source_name) return NULL; } if (splitlines_name == NULL) { - splitlines_name = PyString_InternFromString("splitlines"); + splitlines_name = PyBytes_InternFromString("splitlines"); if (!splitlines_name) return NULL; } @@ -711,7 +711,7 @@ PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) { PyObject *res; - PyObject *message = PyString_FromString(text); + PyObject *message = PyBytes_FromString(text); if (message == NULL) return -1; @@ -745,15 +745,15 @@ const char *module_str, PyObject *registry) { PyObject *res; - PyObject *message = PyString_FromString(text); - PyObject *filename = PyString_FromString(filename_str); + PyObject *message = PyBytes_FromString(text); + PyObject *filename = PyBytes_FromString(filename_str); PyObject *module = NULL; int ret = -1; if (message == NULL || filename == NULL) goto exit; if (module_str != NULL) { - module = PyString_FromString(module_str); + module = PyBytes_FromString(module_str); if (module == NULL) goto exit; } @@ -775,15 +775,6 @@ } -int -PyErr_WarnPy3k(const char *text, Py_ssize_t stacklevel) -{ - if (Py_Py3kWarningFlag) - return PyErr_WarnEx(PyExc_DeprecationWarning, text, stacklevel); - return 0; -} - - PyDoc_STRVAR(warn_doc, "Issue a warning, or maybe ignore it or raise an exception."); @@ -812,7 +803,7 @@ if (!strcmp(action, "ignore")) { if (ignore_str == NULL) { - ignore_str = PyString_InternFromString("ignore"); + ignore_str = PyBytes_InternFromString("ignore"); if (ignore_str == NULL) return NULL; } @@ -820,7 +811,7 @@ } else if (!strcmp(action, "error")) { if (error_str == NULL) { - error_str = PyString_InternFromString("error"); + error_str = PyBytes_InternFromString("error"); if (error_str == NULL) return NULL; } @@ -828,7 +819,7 @@ } else if (!strcmp(action, "default")) { if (default_str == NULL) { - default_str = PyString_InternFromString("default"); + default_str = PyBytes_InternFromString("default"); if (default_str == NULL) return NULL; } @@ -901,7 +892,7 @@ if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) return; - default_action = PyString_InternFromString("default"); + default_action = PyBytes_InternFromString("default"); if (default_action == NULL) return; if (PyModule_AddObject(m, DEFAULT_ACTION_NAME, default_action) < 0) Modified: python/branches/tlee-ast-optimize/Python/ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ast.c (original) +++ python/branches/tlee-ast-optimize/Python/ast.c Sun Jun 1 17:18:10 2008 @@ -46,7 +46,7 @@ static identifier new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyString_InternFromString(n); + PyObject* id = PyBytes_InternFromString(n); PyArena_AddPyObject(arena, id); return id; } @@ -352,7 +352,7 @@ switch (e->kind) { case Attribute_kind: if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Attribute.attr), "None")) { + !strcmp(PyBytes_AS_STRING(e->v.Attribute.attr), "None")) { return ast_error(n, "assignment to None"); } e->v.Attribute.ctx = ctx; @@ -362,7 +362,7 @@ break; case Name_kind: if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Name.id), "None")) { + !strcmp(PyBytes_AS_STRING(e->v.Name.id), "None")) { return ast_error(n, "assignment to None"); } e->v.Name.ctx = ctx; @@ -1276,7 +1276,7 @@ if (errstr) { char *s = ""; char buf[128]; - s = PyString_AsString(errstr); + s = PyBytes_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { @@ -1921,7 +1921,7 @@ return NULL; } key = e->v.Name.id; - if (!strcmp(PyString_AS_STRING(key), "None")) { + if (!strcmp(PyBytes_AS_STRING(key), "None")) { ast_error(CHILD(ch, 0), "assignment to None"); return NULL; } @@ -2050,7 +2050,7 @@ "expression not possible"); return NULL; case Name_kind: { - const char *var_name = PyString_AS_STRING(expr1->v.Name.id); + const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); if (var_name[0] == 'N' && !strcmp(var_name, "None")) { ast_error(ch, "assignment to None"); return NULL; @@ -2326,10 +2326,10 @@ /* length of string plus one for the dot */ len += strlen(STR(CHILD(n, i))) + 1; len--; /* the last name doesn't have a dot */ - str = PyString_FromStringAndSize(NULL, len); + str = PyBytes_FromStringAndSize(NULL, len); if (!str) return NULL; - s = PyString_AS_STRING(str); + s = PyBytes_AS_STRING(str); if (!s) return NULL; for (i = 0; i < NCH(n); i += 2) { @@ -2340,13 +2340,13 @@ } --s; *s = '\0'; - PyString_InternInPlace(&str); + PyBytes_InternInPlace(&str); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); } break; case STAR: - str = PyString_InternFromString("*"); + str = PyBytes_InternFromString("*"); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); default: @@ -3196,10 +3196,10 @@ u = NULL; } else { /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ - u = PyString_FromStringAndSize((char *)NULL, len * 4); + u = PyBytes_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) return NULL; - p = buf = PyString_AsString(u); + p = buf = PyBytes_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { @@ -3218,8 +3218,8 @@ Py_DECREF(u); return NULL; } - r = PyString_AsString(w); - rn = PyString_Size(w); + r = PyBytes_AsString(w); + rn = PyBytes_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", @@ -3318,11 +3318,11 @@ return v; #endif } else { - return PyString_FromStringAndSize(s, len); + return PyBytes_FromStringAndSize(s, len); } } - return PyString_DecodeEscape(s, len, NULL, unicode, + return PyBytes_DecodeEscape(s, len, NULL, unicode, need_encoding ? c->c_encoding : NULL); } @@ -3343,8 +3343,8 @@ s = parsestr(c, STR(CHILD(n, i))); if (s == NULL) goto onError; - if (PyString_Check(v) && PyString_Check(s)) { - PyString_ConcatAndDel(&v, s); + if (PyBytes_Check(v) && PyBytes_Check(s)) { + PyBytes_ConcatAndDel(&v, s); if (v == NULL) goto onError; } Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Sun Jun 1 17:18:10 2008 @@ -249,7 +249,7 @@ return NULL; /* Strings and tuples return a result of the same type. */ - if (PyString_Check(seq)) + if (PyBytes_Check(seq)) return filterstring(func, seq); #ifdef Py_USING_UNICODE if (PyUnicode_Check(seq)) @@ -383,7 +383,7 @@ return NULL; } s[0] = (char)x; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } PyDoc_STRVAR(chr_doc, @@ -671,7 +671,7 @@ return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } - if (!PyString_Check(cmd) && + if (!PyBytes_Check(cmd) && !PyUnicode_Check(cmd)) { PyErr_SetString(PyExc_TypeError, "eval() arg 1 must be a string or code object"); @@ -688,7 +688,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyString_AsStringAndSize(cmd, &str, NULL)) { + if (PyBytes_AsStringAndSize(cmd, &str, NULL)) { Py_XDECREF(tmp); return NULL; } @@ -833,7 +833,7 @@ } #endif - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "getattr(): attribute name must be string"); return NULL; @@ -889,7 +889,7 @@ } #endif - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return NULL; @@ -1208,7 +1208,7 @@ return NULL; } res = (*nb->nb_hex)(v); - if (res && !PyString_Check(res)) { + if (res && !PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__hex__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1268,13 +1268,13 @@ PyObject *s; if (!PyArg_ParseTuple(args, "S:intern", &s)) return NULL; - if (!PyString_CheckExact(s)) { + if (!PyBytes_CheckExact(s)) { PyErr_SetString(PyExc_TypeError, "can't intern subclass of string"); return NULL; } Py_INCREF(s); - PyString_InternInPlace(&s); + PyBytes_InternInPlace(&s); return s; } @@ -1476,7 +1476,7 @@ return NULL; } res = (*nb->nb_oct)(v); - if (res && !PyString_Check(res)) { + if (res && !PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__oct__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1511,16 +1511,16 @@ long ord; Py_ssize_t size; - if (PyString_Check(obj)) { - size = PyString_GET_SIZE(obj); + if (PyBytes_Check(obj)) { + size = PyBytes_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyString_AS_STRING(obj)); + ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); return PyInt_FromLong(ord); } - } else if (PyBytes_Check(obj)) { - size = PyBytes_GET_SIZE(obj); + } else if (PyByteArray_Check(obj)) { + size = PyByteArray_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); + ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj)); return PyInt_FromLong(ord); } @@ -1591,14 +1591,14 @@ Py_RETURN_NONE; } - if (sep && sep != Py_None && !PyString_Check(sep) && + if (sep && sep != Py_None && !PyBytes_Check(sep) && !PyUnicode_Check(sep)) { PyErr_Format(PyExc_TypeError, "sep must be None, str or unicode, not %.200s", sep->ob_type->tp_name); return NULL; } - if (end && end != Py_None && !PyString_Check(end) && + if (end && end != Py_None && !PyBytes_Check(end) && !PyUnicode_Check(end)) { PyErr_Format(PyExc_TypeError, "end must be None, str or unicode, not %.200s", @@ -1967,7 +1967,7 @@ po = PyObject_Str(v); if (po == NULL) return NULL; - prompt = PyString_AsString(po); + prompt = PyBytes_AsString(po); if (prompt == NULL) return NULL; } @@ -1995,7 +1995,7 @@ result = NULL; } else { - result = PyString_FromStringAndSize(s, len-1); + result = PyBytes_FromStringAndSize(s, len-1); } } PyMem_FREE(s); @@ -2324,14 +2324,14 @@ return PyFloat_FromDouble(f_result); } if (PyFloat_CheckExact(item)) { - PyFPE_START_PROTECT("add", return 0) + PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) f_result += PyFloat_AS_DOUBLE(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); continue; } if (PyInt_CheckExact(item)) { - PyFPE_START_PROTECT("add", return 0) + PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) f_result += (double)PyInt_AS_LONG(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); @@ -2637,8 +2637,8 @@ SETBUILTIN("basestring", &PyBaseString_Type); SETBUILTIN("bool", &PyBool_Type); /* SETBUILTIN("memoryview", &PyMemoryView_Type); */ - SETBUILTIN("bytearray", &PyBytes_Type); - SETBUILTIN("bytes", &PyString_Type); + SETBUILTIN("bytearray", &PyByteArray_Type); + SETBUILTIN("bytes", &PyBytes_Type); SETBUILTIN("buffer", &PyBuffer_Type); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX @@ -2658,7 +2658,7 @@ SETBUILTIN("set", &PySet_Type); SETBUILTIN("slice", &PySlice_Type); SETBUILTIN("staticmethod", &PyStaticMethod_Type); - SETBUILTIN("str", &PyString_Type); + SETBUILTIN("str", &PyBytes_Type); SETBUILTIN("super", &PySuper_Type); SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); @@ -2756,7 +2756,7 @@ { PyObject *result; Py_ssize_t i, j; - Py_ssize_t len = PyString_Size(strobj); + Py_ssize_t len = PyBytes_Size(strobj); Py_ssize_t outlen = len; if (func == Py_None) { @@ -2764,12 +2764,12 @@ * as no character is ever false and __getitem__ * does return this character. If it's a subclass * we must go through the __getitem__ loop */ - if (PyString_CheckExact(strobj)) { + if (PyBytes_CheckExact(strobj)) { Py_INCREF(strobj); return strobj; } } - if ((result = PyString_FromStringAndSize(NULL, len)) == NULL) + if ((result = PyBytes_FromStringAndSize(NULL, len)) == NULL) return NULL; for (i = j = 0; i < len; ++i) { @@ -2799,16 +2799,16 @@ } if (ok) { Py_ssize_t reslen; - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "can't filter str to str:" " __getitem__ returned different type"); Py_DECREF(item); goto Fail_1; } - reslen = PyString_GET_SIZE(item); + reslen = PyBytes_GET_SIZE(item); if (reslen == 1) { - PyString_AS_STRING(result)[j++] = - PyString_AS_STRING(item)[0]; + PyBytes_AS_STRING(result)[j++] = + PyBytes_AS_STRING(item)[0]; } else { /* do we need more space? */ Py_ssize_t need = j + reslen + len-i-1; @@ -2816,15 +2816,15 @@ /* overallocate, to avoid reallocations */ if (need<2*outlen) need = 2*outlen; - if (_PyString_Resize(&result, need)) { + if (_PyBytes_Resize(&result, need)) { Py_DECREF(item); return NULL; } outlen = need; } memcpy( - PyString_AS_STRING(result) + j, - PyString_AS_STRING(item), + PyBytes_AS_STRING(result) + j, + PyBytes_AS_STRING(item), reslen ); j += reslen; @@ -2834,7 +2834,7 @@ } if (j < outlen) - _PyString_Resize(&result, j); + _PyBytes_Resize(&result, j); return result; Modified: python/branches/tlee-ast-optimize/Python/ceval.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ceval.c (original) +++ python/branches/tlee-ast-optimize/Python/ceval.c Sun Jun 1 17:18:10 2008 @@ -739,7 +739,7 @@ consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + co->co_nlocals; - first_instr = (unsigned char*) PyString_AS_STRING(co->co_code); + first_instr = (unsigned char*) PyBytes_AS_STRING(co->co_code); /* An explanation is in order for the next line. f->f_lasti now refers to the index of the last instruction @@ -766,7 +766,7 @@ lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co->co_filename); + filename = PyBytes_AsString(co->co_filename); #endif why = WHY_NOT; @@ -1147,8 +1147,8 @@ goto slow_add; x = PyInt_FromLong(i); } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { + else if (PyBytes_CheckExact(v) && + PyBytes_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_vx; @@ -1349,8 +1349,8 @@ goto slow_iadd; x = PyInt_FromLong(i); } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { + else if (PyBytes_CheckExact(v) && + PyBytes_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_v; @@ -1576,9 +1576,9 @@ err = PyFile_WriteObject(v, w, Py_PRINT_RAW); if (err == 0) { /* XXX move into writeobject() ? */ - if (PyString_Check(v)) { - char *s = PyString_AS_STRING(v); - Py_ssize_t len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + char *s = PyBytes_AS_STRING(v); + Py_ssize_t len = PyBytes_GET_SIZE(v); if (len == 0 || !isspace(Py_CHARMASK(s[len-1])) || s[len-1] == ' ') @@ -1705,7 +1705,7 @@ retval = POP(); } else if (PyExceptionClass_Check(v) || - PyString_Check(v)) { + PyBytes_Check(v)) { w = POP(); u = POP(); PyErr_Restore(v, w, u); @@ -1869,11 +1869,11 @@ case LOAD_GLOBAL: w = GETITEM(names, oparg); - if (PyString_CheckExact(w)) { + if (PyBytes_CheckExact(w)) { /* Inline the PyDict_GetItem() calls. WARNING: this is an extreme speed hack. Do not try this at home. */ - long hash = ((PyStringObject *)w)->ob_shash; + long hash = ((PyBytesObject *)w)->ob_shash; if (hash != -1) { PyDictObject *d; PyDictEntry *e; @@ -2726,7 +2726,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), defcount ? "at most" : "exactly", co->co_argcount, kwcount ? "non-keyword " : "", @@ -2756,10 +2756,10 @@ PyObject *keyword = kws[2*i]; PyObject *value = kws[2*i + 1]; int j; - if (keyword == NULL || !PyString_Check(keyword)) { + if (keyword == NULL || !PyBytes_Check(keyword)) { PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", - PyString_AsString(co->co_name)); + PyBytes_AsString(co->co_name)); goto fail; } /* XXX slow -- speed up using dictionary? */ @@ -2781,8 +2781,8 @@ PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected " "keyword argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(keyword)); + PyBytes_AsString(co->co_name), + PyBytes_AsString(keyword)); goto fail; } PyDict_SetItem(kwdict, keyword, value); @@ -2793,8 +2793,8 @@ "%.200s() got multiple " "values for keyword " "argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(keyword)); + PyBytes_AsString(co->co_name), + PyBytes_AsString(keyword)); goto fail; } Py_INCREF(value); @@ -2808,7 +2808,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), ((co->co_flags & CO_VARARGS) || defcount) ? "at least" : "exactly", @@ -2834,7 +2834,7 @@ if (argcount > 0 || kwcount > 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), argcount + kwcount); goto fail; } @@ -2860,11 +2860,11 @@ list so that we can march over it more efficiently? */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { - cellname = PyString_AS_STRING( + cellname = PyBytes_AS_STRING( PyTuple_GET_ITEM(co->co_cellvars, i)); found = 0; for (j = 0; j < nargs; j++) { - argname = PyString_AS_STRING( + argname = PyBytes_AS_STRING( PyTuple_GET_ITEM(co->co_varnames, j)); if (strcmp(cellname, argname) == 0) { c = PyCell_New(GETLOCAL(j)); @@ -3522,13 +3522,13 @@ if (PyMethod_Check(func)) return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) - return PyString_AsString(((PyFunctionObject*)func)->func_name); + return PyBytes_AsString(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else if (PyClass_Check(func)) - return PyString_AsString(((PyClassObject*)func)->cl_name); + return PyBytes_AsString(((PyClassObject*)func)->cl_name); else if (PyInstance_Check(func)) { - return PyString_AsString( + return PyBytes_AsString( ((PyInstanceObject*)func)->in_class->cl_name); } else { return func->ob_type->tp_name; @@ -3767,7 +3767,7 @@ "for keyword argument '%.200s'", PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), - PyString_AsString(key)); + PyBytes_AsString(key)); Py_DECREF(key); Py_DECREF(value); Py_DECREF(kwdict); @@ -4086,7 +4086,7 @@ length = PyTuple_Size(w); for (i = 0; i < length; i += 1) { PyObject *exc = PyTuple_GET_ITEM(w, i); - if (PyString_Check(exc)) { + if (PyBytes_Check(exc)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4109,7 +4109,7 @@ } } else { - if (PyString_Check(w)) { + if (PyBytes_Check(w)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4149,7 +4149,7 @@ if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, "cannot import name %.230s", - PyString_AsString(name)); + PyBytes_AsString(name)); } return x; } @@ -4191,8 +4191,8 @@ break; } if (skip_leading_underscores && - PyString_Check(name) && - PyString_AS_STRING(name)[0] == '_') + PyBytes_Check(name) && + PyBytes_AS_STRING(name)[0] == '_') { Py_DECREF(name); continue; @@ -4251,12 +4251,12 @@ PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); - if (PyString_Check(pvalue)) { + if (PyBytes_Check(pvalue)) { PyObject *newmsg; - newmsg = PyString_FromFormat( + newmsg = PyBytes_FromFormat( "Error when calling the metaclass bases\n" " %s", - PyString_AS_STRING(pvalue)); + PyBytes_AS_STRING(pvalue)); if (newmsg != NULL) { Py_DECREF(pvalue); pvalue = newmsg; @@ -4297,7 +4297,7 @@ } else if (locals == Py_None) locals = globals; - if (!PyString_Check(prog) && + if (!PyBytes_Check(prog) && !PyUnicode_Check(prog) && !PyCode_Check(prog) && !PyFile_Check(prog)) { @@ -4327,7 +4327,7 @@ } else if (PyFile_Check(prog)) { FILE *fp = PyFile_AsFile(prog); - char *name = PyString_AsString(PyFile_Name(prog)); + char *name = PyBytes_AsString(PyFile_Name(prog)); PyCompilerFlags cf; if (name == NULL) return -1; @@ -4353,7 +4353,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyString_AsStringAndSize(prog, &str, NULL)) + if (PyBytes_AsStringAndSize(prog, &str, NULL)) return -1; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, @@ -4378,7 +4378,7 @@ if (!obj) return; - obj_str = PyString_AsString(obj); + obj_str = PyBytes_AsString(obj); if (!obj_str) return; @@ -4391,8 +4391,8 @@ { /* This function implements 'variable += expr' when both arguments are strings. */ - Py_ssize_t v_len = PyString_GET_SIZE(v); - Py_ssize_t w_len = PyString_GET_SIZE(w); + Py_ssize_t v_len = PyBytes_GET_SIZE(v); + Py_ssize_t w_len = PyBytes_GET_SIZE(w); Py_ssize_t new_len = v_len + w_len; if (new_len < 0) { PyErr_SetString(PyExc_OverflowError, @@ -4441,12 +4441,12 @@ } } - if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) { + if (v->ob_refcnt == 1 && !PyBytes_CHECK_INTERNED(v)) { /* Now we own the last reference to 'v', so we can resize it * in-place. */ - if (_PyString_Resize(&v, new_len) != 0) { - /* XXX if _PyString_Resize() fails, 'v' has been + if (_PyBytes_Resize(&v, new_len) != 0) { + /* XXX if _PyBytes_Resize() fails, 'v' has been * deallocated so it cannot be put back into * 'variable'. The MemoryError is raised when there * is no value in 'variable', which might (very @@ -4455,13 +4455,13 @@ return NULL; } /* copy 'w' into the newly allocated area of 'v' */ - memcpy(PyString_AS_STRING(v) + v_len, - PyString_AS_STRING(w), w_len); + memcpy(PyBytes_AS_STRING(v) + v_len, + PyBytes_AS_STRING(w), w_len); return v; } else { /* When in-place resizing is not an option. */ - PyString_Concat(&v, w); + PyBytes_Concat(&v, w); return v; } } Modified: python/branches/tlee-ast-optimize/Python/codecs.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/codecs.c (original) +++ python/branches/tlee-ast-optimize/Python/codecs.c Sun Jun 1 17:18:10 2008 @@ -61,10 +61,10 @@ return NULL; } - v = PyString_FromStringAndSize(NULL, len); + v = PyBytes_FromStringAndSize(NULL, len); if (v == NULL) return NULL; - p = PyString_AS_STRING(v); + p = PyBytes_AS_STRING(v); for (i = 0; i < len; i++) { register char ch = string[i]; if (ch == ' ') @@ -112,7 +112,7 @@ v = normalizestring(encoding); if (v == NULL) goto onError; - PyString_InternInPlace(&v); + PyBytes_InternInPlace(&v); /* First, try to lookup the name in the registry dictionary */ result = PyDict_GetItem(interp->codec_search_cache, v); @@ -190,7 +190,7 @@ if (errors) { PyObject *v; - v = PyString_FromString(errors); + v = PyBytes_FromString(errors); if (v == NULL) { Py_DECREF(args); return NULL; @@ -451,7 +451,7 @@ if (string != NULL) { PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", - PyString_AS_STRING(string)); + PyBytes_AS_STRING(string)); Py_DECREF(string); } } Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Sun Jun 1 17:18:10 2008 @@ -210,15 +210,15 @@ { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ - const char *p, *name = PyString_AsString(ident); + const char *p, *name = PyBytes_AsString(ident); char *buffer; size_t nlen, plen; - if (privateobj == NULL || !PyString_Check(privateobj) || + if (privateobj == NULL || !PyBytes_Check(privateobj) || name == NULL || name[0] != '_' || name[1] != '_') { Py_INCREF(ident); return ident; } - p = PyString_AsString(privateobj); + p = PyBytes_AsString(privateobj); nlen = strlen(name); /* Don't mangle __id__ or names with dots. @@ -242,11 +242,11 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); - ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); + ident = PyBytes_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ - buffer = PyString_AS_STRING(ident); + buffer = PyBytes_AS_STRING(ident); buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); @@ -274,7 +274,7 @@ PyCompilerFlags local_flags; if (!__doc__) { - __doc__ = PyString_InternFromString("__doc__"); + __doc__ = PyBytes_InternFromString("__doc__"); if (!__doc__) return NULL; } @@ -563,7 +563,7 @@ { char tmpname[256]; PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyString_FromString(tmpname); + return PyBytes_FromString(tmpname); } /* Allocate a new block and return a pointer to it. @@ -1216,7 +1216,7 @@ int addNone = 1; static PyObject *module; if (!module) { - module = PyString_InternFromString(""); + module = PyBytes_InternFromString(""); if (!module) return NULL; } @@ -1268,8 +1268,8 @@ PyOS_snprintf(buf, sizeof(buf), "unknown scope for %.100s in %.100s(%s) in %s\n" "symbols: %s\nlocals: %s\nglobals: %s\n", - PyString_AS_STRING(name), - PyString_AS_STRING(c->u->u_name), + PyBytes_AS_STRING(name), + PyBytes_AS_STRING(c->u->u_name), PyObject_REPR(c->u->u_ste->ste_id), c->c_filename, PyObject_REPR(c->u->u_ste->ste_symbols), @@ -1327,9 +1327,9 @@ printf("lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), - PyString_AS_STRING(c->u->u_name), + PyBytes_AS_STRING(c->u->u_name), reftype, arg, - PyString_AS_STRING(co->co_name), + PyBytes_AS_STRING(co->co_name), PyObject_REPR(co->co_freevars)); Py_FatalError("compiler_make_closure()"); } @@ -1364,7 +1364,7 @@ for (i = 0; i < n; i++) { expr_ty arg = (expr_ty)asdl_seq_GET(args->args, i); if (arg->kind == Tuple_kind) { - PyObject *id = PyString_FromFormat(".%d", i); + PyObject *id = PyBytes_FromFormat(".%d", i); if (id == NULL) { return 0; } @@ -1457,7 +1457,7 @@ Py_XDECREF(c->u->u_private); c->u->u_private = s->v.ClassDef.name; Py_INCREF(c->u->u_private); - str = PyString_InternFromString("__name__"); + str = PyBytes_InternFromString("__name__"); if (!str || !compiler_nameop(c, str, Load)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1465,7 +1465,7 @@ } Py_DECREF(str); - str = PyString_InternFromString("__module__"); + str = PyBytes_InternFromString("__module__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1532,7 +1532,7 @@ assert(e->kind == Lambda_kind); if (!name) { - name = PyString_InternFromString(""); + name = PyBytes_InternFromString(""); if (!name) return 0; } @@ -1922,7 +1922,7 @@ If there is a dot in name, we need to split it and emit a LOAD_ATTR for each name. */ - const char *src = PyString_AS_STRING(name); + const char *src = PyBytes_AS_STRING(name); const char *dot = strchr(src, '.'); if (dot) { /* Consume the base module name to get the first attribute */ @@ -1931,7 +1931,7 @@ /* NB src is only defined when dot != NULL */ PyObject *attr; dot = strchr(src, '.'); - attr = PyString_FromStringAndSize(src, + attr = PyBytes_FromStringAndSize(src, dot ? dot - src : strlen(src)); if (!attr) return -1; @@ -1980,10 +1980,10 @@ } else { identifier tmp = alias->name; - const char *base = PyString_AS_STRING(alias->name); + const char *base = PyBytes_AS_STRING(alias->name); char *dot = strchr(base, '.'); if (dot) - tmp = PyString_FromStringAndSize(base, + tmp = PyBytes_FromStringAndSize(base, dot - base); r = compiler_nameop(c, tmp, Store); if (dot) { @@ -2026,7 +2026,7 @@ } if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), + if (!strcmp(PyBytes_AS_STRING(s->v.ImportFrom.module), "__future__")) { Py_DECREF(level); Py_DECREF(names); @@ -2046,7 +2046,7 @@ alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; - if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { + if (i == 0 && *PyBytes_AS_STRING(alias->name) == '*') { assert(n == 1); ADDOP(c, IMPORT_STAR); return 1; @@ -2076,7 +2076,7 @@ if (Py_OptimizeFlag) return 1; if (assertion_error == NULL) { - assertion_error = PyString_InternFromString("AssertionError"); + assertion_error = PyBytes_InternFromString("AssertionError"); if (assertion_error == NULL) return 0; } @@ -2359,7 +2359,7 @@ /* First check for assignment to __debug__. Param? */ if ((ctx == Store || ctx == AugStore || ctx == Del) - && !strcmp(PyString_AS_STRING(name), "__debug__")) { + && !strcmp(PyBytes_AS_STRING(name), "__debug__")) { return compiler_error(c, "can not assign to __debug__"); } @@ -2397,7 +2397,7 @@ } /* XXX Leave assert here, but handle __doc__ and the like better */ - assert(scope || PyString_AS_STRING(name)[0] == '_'); + assert(scope || PyBytes_AS_STRING(name)[0] == '_'); switch (optype) { case OP_DEREF: @@ -2411,7 +2411,7 @@ PyErr_Format(PyExc_SyntaxError, "can not delete variable '%s' referenced " "in nested scope", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); Py_DECREF(mangled); return 0; case Param: @@ -2796,7 +2796,7 @@ 0)))->iter; if (!name) { - name = PyString_FromString(""); + name = PyBytes_FromString(""); if (!name) return 0; } @@ -2845,7 +2845,7 @@ case Name_kind: /* __debug__ is not assignable, so we can optimize * it away in if and while statements */ - if (strcmp(PyString_AS_STRING(e->v.Name.id), + if (strcmp(PyBytes_AS_STRING(e->v.Name.id), "__debug__") == 0) return ! Py_OptimizeFlag; /* fall through */ @@ -2887,12 +2887,12 @@ assert(s->kind == With_kind); if (!enter_attr) { - enter_attr = PyString_InternFromString("__enter__"); + enter_attr = PyBytes_InternFromString("__enter__"); if (!enter_attr) return 0; } if (!exit_attr) { - exit_attr = PyString_InternFromString("__exit__"); + exit_attr = PyBytes_InternFromString("__exit__"); if (!exit_attr) return 0; } @@ -3498,10 +3498,10 @@ { memset(a, 0, sizeof(struct assembler)); a->a_lineno = firstlineno; - a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); + a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); if (!a->a_bytecode) return 0; - a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); + a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; a->a_postorder = (basicblock **)PyObject_Malloc( @@ -3613,17 +3613,17 @@ if (d_bytecode > 255) { int j, nbytes, ncodes = d_bytecode / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyString_Resize(&a->a_lnotab, len) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; for (j = 0; j < ncodes; j++) { *lnotab++ = 255; *lnotab++ = 0; @@ -3635,17 +3635,17 @@ if (d_lineno > 255) { int j, nbytes, ncodes = d_lineno / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyString_Resize(&a->a_lnotab, len) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; *lnotab++ = d_bytecode; *lnotab++ = 255; d_bytecode = 0; @@ -3657,13 +3657,13 @@ a->a_lnotab_off += ncodes * 2; } - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (a->a_lnotab_off + 2 >= len) { - if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; a->a_lnotab_off += 2; if (d_bytecode) { @@ -3688,7 +3688,7 @@ assemble_emit(struct assembler *a, struct instr *i) { int size, arg = 0, ext = 0; - Py_ssize_t len = PyString_GET_SIZE(a->a_bytecode); + Py_ssize_t len = PyBytes_GET_SIZE(a->a_bytecode); char *code; size = instrsize(i); @@ -3699,10 +3699,10 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { - if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) + if (_PyBytes_Resize(&a->a_bytecode, len * 2) < 0) return 0; } - code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; + code = PyBytes_AS_STRING(a->a_bytecode) + a->a_offset; a->a_offset += size; if (size == 6) { assert(i->i_hasarg); @@ -3875,7 +3875,7 @@ freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); if (!freevars) goto error; - filename = PyString_FromString(c->c_filename); + filename = PyBytes_FromString(c->c_filename); if (!filename) goto error; @@ -3995,9 +3995,9 @@ goto error; } - if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) + if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) goto error; - if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0) + if (_PyBytes_Resize(&a.a_bytecode, a.a_offset) < 0) goto error; co = makecode(c, &a); Modified: python/branches/tlee-ast-optimize/Python/errors.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/errors.c (original) +++ python/branches/tlee-ast-optimize/Python/errors.c Sun Jun 1 17:18:10 2008 @@ -66,7 +66,7 @@ void PyErr_SetString(PyObject *exception, const char *string) { - PyObject *value = PyString_FromString(string); + PyObject *value = PyBytes_FromString(string); PyErr_SetObject(exception, value); Py_XDECREF(value); } @@ -351,7 +351,7 @@ PyObject * PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); Py_XDECREF(name); return result; @@ -430,7 +430,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, ierr, name); @@ -469,7 +469,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( PyExc_WindowsError, ierr, name); @@ -527,7 +527,7 @@ va_start(vargs); #endif - string = PyString_FromFormatV(format, vargs); + string = PyBytes_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); va_end(vargs); @@ -559,7 +559,7 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, + modulename = PyBytes_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; @@ -611,7 +611,7 @@ if (moduleName == NULL) PyFile_WriteString("", f); else { - char* modstr = PyString_AsString(moduleName); + char* modstr = PyBytes_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions") != 0) { @@ -665,7 +665,7 @@ Py_DECREF(tmp); } if (filename != NULL) { - tmp = PyString_FromString(filename); + tmp = PyBytes_FromString(filename); if (tmp == NULL) PyErr_Clear(); else { @@ -742,7 +742,7 @@ char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - return PyString_FromString(p); + return PyBytes_FromString(p); } return NULL; } Modified: python/branches/tlee-ast-optimize/Python/formatter_string.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/formatter_string.c (original) +++ python/branches/tlee-ast-optimize/Python/formatter_string.c Sun Jun 1 17:18:10 2008 @@ -4,12 +4,11 @@ of int.__float__, etc., that take and return string objects */ #include "Python.h" -#include "formatter_string.h" - #include "../Objects/stringlib/stringdefs.h" -#define FORMAT_STRING string__format__ -#define FORMAT_LONG string_long__format__ -#define FORMAT_INT string_int__format__ -#define FORMAT_FLOAT string_float__format__ +#define FORMAT_STRING _PyBytes_FormatAdvanced +#define FORMAT_LONG _PyLong_FormatAdvanced +#define FORMAT_INT _PyInt_FormatAdvanced +#define FORMAT_FLOAT _PyFloat_FormatAdvanced + #include "../Objects/stringlib/formatter.h" Modified: python/branches/tlee-ast-optimize/Python/formatter_unicode.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/formatter_unicode.c (original) +++ python/branches/tlee-ast-optimize/Python/formatter_unicode.c Sun Jun 1 17:18:10 2008 @@ -2,12 +2,12 @@ built-in formatter for unicode. That is, unicode.__format__(). */ #include "Python.h" -#include "formatter_unicode.h" - #include "../Objects/stringlib/unicodedefs.h" -#define FORMAT_STRING unicode__format__ +#define FORMAT_STRING _PyUnicode_FormatAdvanced + /* don't define FORMAT_LONG and FORMAT_FLOAT, since we can live with only the string versions of those. The builtin format() will convert them to unicode. */ + #include "../Objects/stringlib/formatter.h" Modified: python/branches/tlee-ast-optimize/Python/future.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/future.c (original) +++ python/branches/tlee-ast-optimize/Python/future.c Sun Jun 1 17:18:10 2008 @@ -20,7 +20,7 @@ names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyString_AsString(name->name); + const char *feature = PyBytes_AsString(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { @@ -59,7 +59,7 @@ static PyObject *future; if (!future) { - future = PyString_InternFromString("__future__"); + future = PyBytes_InternFromString("__future__"); if (!future) return 0; } Modified: python/branches/tlee-ast-optimize/Python/getargs.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/getargs.c (original) +++ python/branches/tlee-ast-optimize/Python/getargs.c Sun Jun 1 17:18:10 2008 @@ -418,7 +418,7 @@ n++; } - if (!PySequence_Check(arg) || PyString_Check(arg)) { + if (!PySequence_Check(arg) || PyBytes_Check(arg)) { levels[0] = 0; PyOS_snprintf(msgbuf, bufsize, toplevel ? "expected %d arguments, not %.50s" : @@ -765,8 +765,8 @@ case 'c': {/* char */ char *p = va_arg(*p_va, char *); - if (PyString_Check(arg) && PyString_Size(arg) == 1) - *p = PyString_AS_STRING(arg)[0]; + if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1) + *p = PyBytes_AS_STRING(arg)[0]; else return converterr("char", arg, msgbuf, bufsize); break; @@ -777,9 +777,9 @@ void **p = (void **)va_arg(*p_va, char **); FETCH_SIZE; - if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); + if (PyBytes_Check(arg)) { + *p = PyBytes_AS_STRING(arg); + STORE_SIZE(PyBytes_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -787,8 +787,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); + *p = PyBytes_AS_STRING(uarg); + STORE_SIZE(PyBytes_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -802,20 +802,20 @@ } else { char **p = va_arg(*p_va, char **); - if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); + if (PyBytes_Check(arg)) + *p = PyBytes_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); + *p = PyBytes_AS_STRING(uarg); } #endif else return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -831,9 +831,9 @@ *p = 0; STORE_SIZE(0); } - else if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); + else if (PyBytes_Check(arg)) { + *p = PyBytes_AS_STRING(arg); + STORE_SIZE(PyBytes_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -841,8 +841,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); + *p = PyBytes_AS_STRING(uarg); + STORE_SIZE(PyBytes_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -858,15 +858,15 @@ if (arg == Py_None) *p = 0; - else if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); + else if (PyBytes_Check(arg)) + *p = PyBytes_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); + *p = PyBytes_AS_STRING(uarg); } #endif else @@ -878,11 +878,11 @@ if (arg == Py_None) *q = 0; else - *q = PyString_Size(arg); + *q = PyBytes_Size(arg); format++; } else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyString_Size(arg)) + (Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -923,7 +923,7 @@ arg, msgbuf, bufsize); /* Encode object */ - if (!recode_strings && PyString_Check(arg)) { + if (!recode_strings && PyBytes_Check(arg)) { s = arg; Py_INCREF(s); } @@ -946,7 +946,7 @@ if (s == NULL) return converterr("(encoding failed)", arg, msgbuf, bufsize); - if (!PyString_Check(s)) { + if (!PyBytes_Check(s)) { Py_DECREF(s); return converterr( "(encoder failed to return a string)", @@ -956,7 +956,7 @@ return converterr("string", arg, msgbuf, bufsize); #endif } - size = PyString_GET_SIZE(s); + size = PyBytes_GET_SIZE(s); /* Write output; output is guaranteed to be 0-terminated */ if (*format == '#') { @@ -1013,7 +1013,7 @@ } } memcpy(*buffer, - PyString_AS_STRING(s), + PyBytes_AS_STRING(s), size + 1); STORE_SIZE(size); } else { @@ -1030,7 +1030,7 @@ PyMem_Free()ing it after usage */ - if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) + if ((Py_ssize_t)strlen(PyBytes_AS_STRING(s)) != size) { Py_DECREF(s); return converterr( @@ -1049,7 +1049,7 @@ arg, msgbuf, bufsize); } memcpy(*buffer, - PyString_AS_STRING(s), + PyBytes_AS_STRING(s), size + 1); } Py_DECREF(s); @@ -1083,7 +1083,7 @@ case 'S': { /* string object */ PyObject **p = va_arg(*p_va, PyObject **); - if (PyString_Check(arg)) + if (PyBytes_Check(arg)) *p = arg; else return converterr("string", arg, msgbuf, bufsize); @@ -1473,12 +1473,12 @@ while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; char *ks; - if (!PyString_Check(key)) { + if (!PyBytes_Check(key)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return cleanreturn(0, freelist); } - ks = PyString_AsString(key); + ks = PyBytes_AsString(key); for (i = 0; i < len; i++) { if (!strcmp(ks, kwlist[i])) { match = 1; Modified: python/branches/tlee-ast-optimize/Python/import.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/import.c (original) +++ python/branches/tlee-ast-optimize/Python/import.c Sun Jun 1 17:18:10 2008 @@ -467,8 +467,8 @@ while (PyDict_Next(modules, &pos, &key, &value)) { if (value->ob_refcnt != 1) continue; - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); + if (PyBytes_Check(key) && PyModule_Check(value)) { + name = PyBytes_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -486,8 +486,8 @@ /* Next, delete all modules (still skipping __builtin__ and sys) */ pos = 0; while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); + if (PyBytes_Check(key) && PyModule_Check(value)) { + name = PyBytes_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -665,7 +665,7 @@ /* Remember the filename as the __file__ attribute */ v = NULL; if (pathname != NULL) { - v = PyString_FromString(pathname); + v = PyBytes_FromString(pathname); if (v == NULL) PyErr_Clear(); } @@ -1002,7 +1002,7 @@ PySys_WriteStderr("import %s # directory %s\n", name, pathname); d = PyModule_GetDict(m); - file = PyString_FromString(pathname); + file = PyBytes_FromString(pathname); if (file == NULL) goto error; path = Py_BuildValue("[O]", file); @@ -1214,15 +1214,15 @@ Py_DECREF(meta_path); } - if (path != NULL && PyString_Check(path)) { + if (path != NULL && PyBytes_Check(path)) { /* The only type of submodule allowed inside a "frozen" package are other frozen modules or packages. */ - if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) { + if (PyBytes_Size(path) + 1 + strlen(name) >= (size_t)buflen) { PyErr_SetString(PyExc_ImportError, "full frozen module name too long"); return NULL; } - strcpy(buf, PyString_AsString(path)); + strcpy(buf, PyBytes_AsString(path)); strcat(buf, "."); strcat(buf, name); strcpy(name, buf); @@ -1291,14 +1291,14 @@ } else #endif - if (!PyString_Check(v)) + if (!PyBytes_Check(v)) continue; - len = PyString_GET_SIZE(v); + len = PyBytes_GET_SIZE(v); if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyString_AS_STRING(v)); + strcpy(buf, PyBytes_AS_STRING(v)); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */ @@ -1963,7 +1963,7 @@ if (m == NULL) goto err_return; d = PyModule_GetDict(m); - s = PyString_InternFromString(name); + s = PyBytes_InternFromString(name); if (s == NULL) goto err_return; err = PyDict_SetItemString(d, "__path__", s); @@ -1992,7 +1992,7 @@ PyObject *pname; PyObject *result; - pname = PyString_FromString(name); + pname = PyBytes_FromString(name); if (pname == NULL) return NULL; result = PyImport_Import(pname); @@ -2165,17 +2165,17 @@ return Py_None; if (namestr == NULL) { - namestr = PyString_InternFromString("__name__"); + namestr = PyBytes_InternFromString("__name__"); if (namestr == NULL) return NULL; } if (pathstr == NULL) { - pathstr = PyString_InternFromString("__path__"); + pathstr = PyBytes_InternFromString("__path__"); if (pathstr == NULL) return NULL; } if (pkgstr == NULL) { - pkgstr = PyString_InternFromString("__package__"); + pkgstr = PyBytes_InternFromString("__package__"); if (pkgstr == NULL) return NULL; } @@ -2187,12 +2187,12 @@ if ((pkgname != NULL) && (pkgname != Py_None)) { /* __package__ is set, so use it */ Py_ssize_t len; - if (!PyString_Check(pkgname)) { + if (!PyBytes_Check(pkgname)) { PyErr_SetString(PyExc_ValueError, "__package__ set to non-string"); return NULL; } - len = PyString_GET_SIZE(pkgname); + len = PyBytes_GET_SIZE(pkgname); if (len == 0) { if (level > 0) { PyErr_SetString(PyExc_ValueError, @@ -2206,24 +2206,24 @@ "Package name too long"); return NULL; } - strcpy(buf, PyString_AS_STRING(pkgname)); + strcpy(buf, PyBytes_AS_STRING(pkgname)); } else { /* __package__ not set, so figure it out and set it */ modname = PyDict_GetItem(globals, namestr); - if (modname == NULL || !PyString_Check(modname)) + if (modname == NULL || !PyBytes_Check(modname)) return Py_None; modpath = PyDict_GetItem(globals, pathstr); if (modpath != NULL) { /* __path__ is set, so modname is already the package name */ - Py_ssize_t len = PyString_GET_SIZE(modname); + Py_ssize_t len = PyBytes_GET_SIZE(modname); int error; if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long"); return NULL; } - strcpy(buf, PyString_AS_STRING(modname)); + strcpy(buf, PyBytes_AS_STRING(modname)); error = PyDict_SetItem(globals, pkgstr, modname); if (error) { PyErr_SetString(PyExc_ValueError, @@ -2232,7 +2232,7 @@ } } else { /* Normal module, so work out the package name if any */ - char *start = PyString_AS_STRING(modname); + char *start = PyBytes_AS_STRING(modname); char *lastdot = strrchr(start, '.'); size_t len; int error; @@ -2258,7 +2258,7 @@ } strncpy(buf, start, len); buf[len] = '\0'; - pkgname = PyString_FromString(buf); + pkgname = PyBytes_FromString(buf); if (pkgname == NULL) { return NULL; } @@ -2394,13 +2394,13 @@ } return 0; } - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "Item in ``from list'' not a string"); Py_DECREF(item); return 0; } - if (PyString_AS_STRING(item)[0] == '*') { + if (PyBytes_AS_STRING(item)[0] == '*') { PyObject *all; Py_DECREF(item); /* See if the package defines __all__ */ @@ -2419,7 +2419,7 @@ } hasit = PyObject_HasAttr(mod, item); if (!hasit) { - char *subname = PyString_AS_STRING(item); + char *subname = PyBytes_AS_STRING(item); PyObject *submod; char *p; if (buflen + strlen(subname) >= MAXPATHLEN) { @@ -2585,7 +2585,7 @@ subname = name; else { PyObject *parentname, *parent; - parentname = PyString_FromStringAndSize(name, (subname-name)); + parentname = PyBytes_FromStringAndSize(name, (subname-name)); if (parentname == NULL) { imp_modules_reloading_clear(); return NULL; @@ -2594,7 +2594,7 @@ if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - PyString_AS_STRING(parentname)); + PyBytes_AS_STRING(parentname)); Py_DECREF(parentname); imp_modules_reloading_clear(); return NULL; @@ -2639,7 +2639,7 @@ done using whatever import hooks are installed in the current environment, e.g. by "rexec". A dummy list ["__doc__"] is passed as the 4th argument so that - e.g. PyImport_Import(PyString_FromString("win32com.client.gencache")) + e.g. PyImport_Import(PyBytes_FromString("win32com.client.gencache")) will return instead of . */ PyObject * @@ -2655,10 +2655,10 @@ /* Initialize constant string objects */ if (silly_list == NULL) { - import_str = PyString_InternFromString("__import__"); + import_str = PyBytes_InternFromString("__import__"); if (import_str == NULL) return NULL; - builtins_str = PyString_InternFromString("__builtins__"); + builtins_str = PyBytes_InternFromString("__builtins__"); if (builtins_str == NULL) return NULL; silly_list = Py_BuildValue("[s]", "__doc__"); @@ -2726,7 +2726,7 @@ buf[2] = (char) ((pyc_magic >> 16) & 0xff); buf[3] = (char) ((pyc_magic >> 24) & 0xff); - return PyString_FromStringAndSize(buf, 4); + return PyBytes_FromStringAndSize(buf, 4); } static PyObject * Modified: python/branches/tlee-ast-optimize/Python/mactoolboxglue.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/mactoolboxglue.c (original) +++ python/branches/tlee-ast-optimize/Python/mactoolboxglue.c Sun Jun 1 17:18:10 2008 @@ -52,7 +52,7 @@ buf[0] = '\0'; } else { - char *input = PyString_AsString(rv); + char *input = PyBytes_AsString(rv); if (!input) { PyErr_Clear(); buf[0] = '\0'; @@ -124,7 +124,7 @@ if (!rv) goto error; - input = PyString_AsString(rv); + input = PyBytes_AsString(rv); if (!input) goto error; @@ -159,12 +159,12 @@ PyMac_GetOSType(PyObject *v, OSType *pr) { uint32_t tmp; - if (!PyString_Check(v) || PyString_Size(v) != 4) { + if (!PyBytes_Check(v) || PyBytes_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)&tmp, PyString_AsString(v), 4); + memcpy((char *)&tmp, PyBytes_AsString(v), 4); *pr = (OSType)ntohl(tmp); return 1; } @@ -174,7 +174,7 @@ PyMac_BuildOSType(OSType t) { uint32_t tmp = htonl((uint32_t)t); - return PyString_FromStringAndSize((char *)&tmp, 4); + return PyBytes_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -190,13 +190,13 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf) { int len; - if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { + if (!PyBytes_Check(v) || (len = PyBytes_Size(v)) > 255) { PyErr_SetString(PyExc_TypeError, "Str255 arg must be string of at most 255 chars"); return 0; } pbuf[0] = len; - memcpy((char *)(pbuf+1), PyString_AsString(v), len); + memcpy((char *)(pbuf+1), PyBytes_AsString(v), len); return 1; } @@ -208,7 +208,7 @@ PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); return NULL; } - return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); } PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); } Modified: python/branches/tlee-ast-optimize/Python/marshal.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/marshal.c (original) +++ python/branches/tlee-ast-optimize/Python/marshal.c Sun Jun 1 17:18:10 2008 @@ -64,18 +64,18 @@ Py_ssize_t size, newsize; if (p->str == NULL) return; /* An error already occurred */ - size = PyString_Size(p->str); + size = PyBytes_Size(p->str); newsize = size + size + 1024; if (newsize > 32*1024*1024) { newsize = size + 1024*1024; } - if (_PyString_Resize(&p->str, newsize) != 0) { + if (_PyBytes_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; } else { - p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size; + p->ptr = PyBytes_AS_STRING((PyBytesObject *)p->str) + size; p->end = - PyString_AS_STRING((PyStringObject *)p->str) + newsize; + PyBytes_AS_STRING((PyBytesObject *)p->str) + newsize; *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char); } } @@ -239,8 +239,8 @@ } } #endif - else if (PyString_CheckExact(v)) { - if (p->strings && PyString_CHECK_INTERNED(v)) { + else if (PyBytes_CheckExact(v)) { + if (p->strings && PyBytes_CHECK_INTERNED(v)) { PyObject *o = PyDict_GetItem(p->strings, v); if (o) { long w = PyInt_AsLong(o); @@ -265,7 +265,7 @@ else { w_byte(TYPE_STRING, p); } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > INT_MAX) { /* huge strings are not supported */ p->depth--; @@ -273,7 +273,7 @@ return; } w_long((long)n, p); - w_string(PyString_AS_STRING(v), (int)n, p); + w_string(PyBytes_AS_STRING(v), (int)n, p); } #ifdef Py_USING_UNICODE else if (PyUnicode_CheckExact(v)) { @@ -285,14 +285,14 @@ return; } w_byte(TYPE_UNICODE, p); - n = PyString_GET_SIZE(utf8); + n = PyBytes_GET_SIZE(utf8); if (n > INT_MAX) { p->depth--; p->error = 1; return; } w_long((long)n, p); - w_string(PyString_AS_STRING(utf8), (int)n, p); + w_string(PyBytes_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } #endif @@ -713,12 +713,12 @@ retval = NULL; break; } - v = PyString_FromStringAndSize((char *)NULL, n); + v = PyBytes_FromStringAndSize((char *)NULL, n); if (v == NULL) { retval = NULL; break; } - if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { + if (r_string(PyBytes_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); @@ -726,7 +726,7 @@ break; } if (type == TYPE_INTERNED) { - PyString_InternInPlace(&v); + PyBytes_InternInPlace(&v); if (PyList_Append(p->strings, v) < 0) { retval = NULL; break; @@ -1113,11 +1113,11 @@ { WFILE wf; wf.fp = NULL; - wf.str = PyString_FromStringAndSize((char *)NULL, 50); + wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; - wf.ptr = PyString_AS_STRING((PyStringObject *)wf.str); - wf.end = wf.ptr + PyString_Size(wf.str); + wf.ptr = PyBytes_AS_STRING((PyBytesObject *)wf.str); + wf.end = wf.ptr + PyBytes_Size(wf.str); wf.error = 0; wf.depth = 0; wf.version = version; @@ -1125,14 +1125,14 @@ w_object(x, &wf); Py_XDECREF(wf.strings); if (wf.str != NULL) { - char *base = PyString_AS_STRING((PyStringObject *)wf.str); + char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, "too much marshall data for a string"); return NULL; } - _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + _PyBytes_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); } if (wf.error) { Py_XDECREF(wf.str); Modified: python/branches/tlee-ast-optimize/Python/modsupport.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/modsupport.c (original) +++ python/branches/tlee-ast-optimize/Python/modsupport.c Sun Jun 1 17:18:10 2008 @@ -65,7 +65,7 @@ return NULL; d = PyModule_GetDict(m); if (methods != NULL) { - n = PyString_FromString(name); + n = PyBytes_FromString(name); if (n == NULL) return NULL; for (ml = methods; ml->ml_name != NULL; ml++) { @@ -92,7 +92,7 @@ Py_DECREF(n); } if (doc != NULL) { - v = PyString_FromString(doc); + v = PyBytes_FromString(doc); if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { Py_XDECREF(v); return NULL; @@ -391,7 +391,7 @@ { char p[1]; p[0] = (char)va_arg(*p_va, int); - return PyString_FromStringAndSize(p, 1); + return PyBytes_FromStringAndSize(p, 1); } case 's': @@ -423,7 +423,7 @@ } n = (Py_ssize_t)m; } - v = PyString_FromStringAndSize(str, n); + v = PyBytes_FromStringAndSize(str, n); } return v; } @@ -633,7 +633,7 @@ int PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) { - PyObject *o = PyString_FromString(value); + PyObject *o = PyBytes_FromString(value); if (!o) return -1; if (PyModule_AddObject(m, name, o) == 0) Modified: python/branches/tlee-ast-optimize/Python/mysnprintf.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/mysnprintf.c (original) +++ python/branches/tlee-ast-optimize/Python/mysnprintf.c Sun Jun 1 17:18:10 2008 @@ -54,18 +54,28 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) { int len; /* # bytes written, excluding \0 */ -#ifndef HAVE_SNPRINTF +#ifdef HAVE_SNPRINTF +#define _PyOS_vsnprintf_EXTRA_SPACE 1 +#else +#define _PyOS_vsnprintf_EXTRA_SPACE 512 char *buffer; #endif assert(str != NULL); assert(size > 0); assert(format != NULL); + /* We take a size_t as input but return an int. Sanity check + * our input so that it won't cause an overflow in the + * vsnprintf return value or the buffer malloc size. */ + if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) { + len = -666; + goto Done; + } #ifdef HAVE_SNPRINTF len = vsnprintf(str, size, format, va); #else /* Emulate it. */ - buffer = PyMem_MALLOC(size + 512); + buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE); if (buffer == NULL) { len = -666; goto Done; @@ -75,7 +85,7 @@ if (len < 0) /* ignore the error */; - else if ((size_t)len >= size + 512) + else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); else { @@ -86,8 +96,10 @@ str[to_copy] = '\0'; } PyMem_FREE(buffer); -Done: #endif - str[size-1] = '\0'; +Done: + if (size > 0) + str[size-1] = '\0'; return len; +#undef _PyOS_vsnprintf_EXTRA_SPACE } Modified: python/branches/tlee-ast-optimize/Python/peephole.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/peephole.c (original) +++ python/branches/tlee-ast-optimize/Python/peephole.c Sun Jun 1 17:18:10 2008 @@ -141,15 +141,15 @@ goto exitUnchanged; /* Bypass optimization when the lineno table is too complex */ - assert(PyString_Check(lineno_obj)); - lineno = (unsigned char*)PyString_AS_STRING(lineno_obj); - tabsiz = PyString_GET_SIZE(lineno_obj); + assert(PyBytes_Check(lineno_obj)); + lineno = (unsigned char*)PyBytes_AS_STRING(lineno_obj); + tabsiz = PyBytes_GET_SIZE(lineno_obj); if (memchr(lineno, 255, tabsiz) != NULL) goto exitUnchanged; /* Avoid situations where jump retargeting could overflow */ - assert(PyString_Check(code)); - codelen = PyString_GET_SIZE(code); + assert(PyBytes_Check(code)); + codelen = PyBytes_GET_SIZE(code); if (codelen > 32700) goto exitUnchanged; @@ -158,7 +158,7 @@ if (codestr == NULL) goto exitUnchanged; codestr = (unsigned char *)memcpy(codestr, - PyString_AS_STRING(code), codelen); + PyBytes_AS_STRING(code), codelen); /* Verify that RETURN_VALUE terminates the codestring. This allows the various transformation patterns to look ahead several @@ -347,7 +347,7 @@ } assert(h + nops == codelen); - code = PyString_FromStringAndSize((char *)codestr, h); + code = PyBytes_FromStringAndSize((char *)codestr, h); PyMem_Free(addrmap); PyMem_Free(codestr); PyMem_Free(blocks); Modified: python/branches/tlee-ast-optimize/Python/pystrtod.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pystrtod.c (original) +++ python/branches/tlee-ast-optimize/Python/pystrtod.c Sun Jun 1 17:18:10 2008 @@ -364,7 +364,7 @@ /* At this point, p points just past the right-most character we want to format. We need to add the grouping string for the characters between buffer and p. */ - return _PyString_InsertThousandsGrouping(buffer, len, p, + return _PyBytes_InsertThousandsGrouping(buffer, len, p, buf_size, NULL, 1); } Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Sun Jun 1 17:18:10 2008 @@ -134,10 +134,19 @@ PyThreadState *tstate; PyObject *bimod, *sysmod; char *p; -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) - char *codeset; - char *saved_locale; + char *icodeset; /* On Windows, input codeset may theoretically + differ from output codeset. */ + char *codeset = NULL; + char *errors = NULL; + int free_codeset = 0; + int overridden = 0; PyObject *sys_stream, *sys_isatty; +#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) + char *saved_locale, *loc_codeset; +#endif +#ifdef MS_WINDOWS + char ibuf[128]; + char buf[128]; #endif extern void _Py_ReadyTypes(void); @@ -171,7 +180,7 @@ if (!_PyInt_Init()) Py_FatalError("Py_Initialize: can't init ints"); - if (!PyBytes_Init()) + if (!PyByteArray_Init()) Py_FatalError("Py_Initialize: can't init bytearray"); _PyFloat_Init(); @@ -240,38 +249,75 @@ _PyGILState_Init(interp, tstate); #endif /* WITH_THREAD */ + if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { + p = icodeset = codeset = strdup(p); + free_codeset = 1; + errors = strchr(p, ':'); + if (errors) { + *errors = '\0'; + errors++; + } + overridden = 1; + } + #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) /* On Unix, set the file system encoding according to the user's preference, if the CODESET names a well-known Python codec, and Py_FileSystemDefaultEncoding isn't initialized by other means. Also set the encoding of - stdin and stdout if these are terminals. */ + stdin and stdout if these are terminals, unless overridden. */ - saved_locale = strdup(setlocale(LC_CTYPE, NULL)); - setlocale(LC_CTYPE, ""); - codeset = nl_langinfo(CODESET); - if (codeset && *codeset) { - PyObject *enc = PyCodec_Encoder(codeset); - if (enc) { - codeset = strdup(codeset); - Py_DECREF(enc); - } else { - codeset = NULL; - PyErr_Clear(); + if (!overridden || !Py_FileSystemDefaultEncoding) { + saved_locale = strdup(setlocale(LC_CTYPE, NULL)); + setlocale(LC_CTYPE, ""); + loc_codeset = nl_langinfo(CODESET); + if (loc_codeset && *loc_codeset) { + PyObject *enc = PyCodec_Encoder(loc_codeset); + if (enc) { + loc_codeset = strdup(loc_codeset); + Py_DECREF(enc); + } else { + loc_codeset = NULL; + PyErr_Clear(); + } + } else + loc_codeset = NULL; + setlocale(LC_CTYPE, saved_locale); + free(saved_locale); + + if (!overridden) { + codeset = icodeset = loc_codeset; + free_codeset = 1; + } + + /* Initialize Py_FileSystemDefaultEncoding from + locale even if PYTHONIOENCODING is set. */ + if (!Py_FileSystemDefaultEncoding) { + Py_FileSystemDefaultEncoding = loc_codeset; + if (!overridden) + free_codeset = 0; } - } else - codeset = NULL; - setlocale(LC_CTYPE, saved_locale); - free(saved_locale); + } +#endif + +#ifdef MS_WINDOWS + if (!overridden) { + icodeset = ibuf; + codeset = buf; + sprintf(ibuf, "cp%d", GetConsoleCP()); + sprintf(buf, "cp%d", GetConsoleOutputCP()); + } +#endif if (codeset) { sys_stream = PySys_GetObject("stdin"); sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, icodeset, errors)) Py_FatalError("Cannot set codeset of stdin"); } Py_XDECREF(sys_isatty); @@ -280,9 +326,10 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stdout"); } Py_XDECREF(sys_isatty); @@ -291,19 +338,17 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stderr"); } Py_XDECREF(sys_isatty); - if (!Py_FileSystemDefaultEncoding) - Py_FileSystemDefaultEncoding = codeset; - else + if (free_codeset) free(codeset); } -#endif } void @@ -452,8 +497,8 @@ PyTuple_Fini(); PyList_Fini(); PySet_Fini(); - PyString_Fini(); PyBytes_Fini(); + PyByteArray_Fini(); PyInt_Fini(); PyFloat_Fini(); PyDict_Fini(); @@ -701,12 +746,12 @@ } v = PySys_GetObject("ps1"); if (v == NULL) { - PySys_SetObject("ps1", v = PyString_FromString(">>> ")); + PySys_SetObject("ps1", v = PyBytes_FromString(">>> ")); Py_XDECREF(v); } v = PySys_GetObject("ps2"); if (v == NULL) { - PySys_SetObject("ps2", v = PyString_FromString("... ")); + PySys_SetObject("ps2", v = PyBytes_FromString("... ")); Py_XDECREF(v); } for (;;) { @@ -753,16 +798,16 @@ v = PyObject_Str(v); if (v == NULL) PyErr_Clear(); - else if (PyString_Check(v)) - ps1 = PyString_AsString(v); + else if (PyBytes_Check(v)) + ps1 = PyBytes_AsString(v); } w = PySys_GetObject("ps2"); if (w != NULL) { w = PyObject_Str(w); if (w == NULL) PyErr_Clear(); - else if (PyString_Check(w)) - ps2 = PyString_AsString(w); + else if (PyBytes_Check(w)) + ps2 = PyBytes_AsString(w); } arena = PyArena_New(); if (arena == NULL) { @@ -855,7 +900,7 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, "__file__") == NULL) { - PyObject *f = PyString_FromString(filename); + PyObject *f = PyBytes_FromString(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, "__file__", f) < 0) { @@ -939,7 +984,7 @@ goto finally; if (v == Py_None) *filename = NULL; - else if (! (*filename = PyString_AsString(v))) + else if (! (*filename = PyBytes_AsString(v))) goto finally; Py_DECREF(v); @@ -971,7 +1016,7 @@ goto finally; if (v == Py_None) *text = NULL; - else if (! (*text = PyString_AsString(v))) + else if (! (*text = PyBytes_AsString(v))) goto finally; Py_DECREF(v); return 1; @@ -1194,7 +1239,7 @@ if (moduleName == NULL) err = PyFile_WriteString("", f); else { - char* modstr = PyString_AsString(moduleName); + char* modstr = PyBytes_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); @@ -1218,8 +1263,8 @@ */ if (s == NULL) err = -1; - else if (!PyString_Check(s) || - PyString_GET_SIZE(s) != 0) + else if (!PyBytes_Check(s) || + PyBytes_GET_SIZE(s) != 0) err = PyFile_WriteString(": ", f); if (err == 0) err = PyFile_WriteObject(s, f, Py_PRINT_RAW); @@ -1566,7 +1611,7 @@ if (value != NULL) { u = PyObject_Str(value); if (u != NULL) { - msg = PyString_AsString(u); + msg = PyBytes_AsString(u); } } if (msg == NULL) Modified: python/branches/tlee-ast-optimize/Python/structmember.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/structmember.c (original) +++ python/branches/tlee-ast-optimize/Python/structmember.c Sun Jun 1 17:18:10 2008 @@ -16,7 +16,7 @@ if (v != NULL) { for (i = 0; i < n; i++) PyList_SetItem(v, i, - PyString_FromString(mlist[i].name)); + PyBytes_FromString(mlist[i].name)); if (PyErr_Occurred()) { Py_DECREF(v); v = NULL; @@ -103,13 +103,13 @@ v = Py_None; } else - v = PyString_FromString(*(char**)addr); + v = PyBytes_FromString(*(char**)addr); break; case T_STRING_INPLACE: - v = PyString_FromString((char*)addr); + v = PyBytes_FromString((char*)addr); break; case T_CHAR: - v = PyString_FromStringAndSize((char*)addr, 1); + v = PyBytes_FromStringAndSize((char*)addr, 1); break; case T_OBJECT: v = *(PyObject **)addr; @@ -310,8 +310,8 @@ Py_XDECREF(oldv); break; case T_CHAR: - if (PyString_Check(v) && PyString_Size(v) == 1) { - *(char*)addr = PyString_AsString(v)[0]; + if (PyBytes_Check(v) && PyBytes_Size(v) == 1) { + *(char*)addr = PyBytes_AsString(v)[0]; } else { PyErr_BadArgument(); Modified: python/branches/tlee-ast-optimize/Python/symtable.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/symtable.c (original) +++ python/branches/tlee-ast-optimize/Python/symtable.c Sun Jun 1 17:18:10 2008 @@ -87,9 +87,9 @@ PyOS_snprintf(buf, sizeof(buf), "", - PyString_AS_STRING(ste->ste_name), + PyBytes_AS_STRING(ste->ste_name), PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static void @@ -180,7 +180,7 @@ static identifier top = NULL, lambda = NULL, genexpr = NULL; #define GET_IDENTIFIER(VAR) \ - ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) + ((VAR) ? (VAR) : ((VAR) = PyBytes_InternFromString(# VAR))) #define DUPLICATE_ARGUMENT \ "duplicate argument '%s' in function definition" @@ -372,7 +372,7 @@ if (flags & DEF_PARAM) { PyErr_Format(PyExc_SyntaxError, "name '%s' is local and global", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); return 0; } SET_SCOPE(dict, name, GLOBAL_EXPLICIT); @@ -487,19 +487,19 @@ PyOS_snprintf(buf, sizeof(buf), "import * is not allowed in function '%.100s' " "because it is %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; case OPT_BARE_EXEC: PyOS_snprintf(buf, sizeof(buf), "unqualified exec is not allowed in function " "'%.100s' it %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; default: PyOS_snprintf(buf, sizeof(buf), "function '%.100s' uses import * and bare exec, " "which are illegal because it %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; } @@ -800,7 +800,7 @@ if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, - PyString_AsString(name)); + PyBytes_AsString(name)); PyErr_SyntaxLocation(st->st_filename, st->st_cur->ste_lineno); goto error; @@ -914,7 +914,7 @@ PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++st->st_cur->ste_tmpname); - tmp = PyString_InternFromString(tmpname); + tmp = PyBytes_InternFromString(tmpname); if (!tmp) return 0; if (!symtable_add_def(st, tmp, DEF_LOCAL)) @@ -1065,7 +1065,7 @@ asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyString_AS_STRING(name); + char *c_name = PyBytes_AS_STRING(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; @@ -1219,7 +1219,7 @@ static int symtable_implicit_arg(struct symtable *st, int pos) { - PyObject *id = PyString_FromFormat(".%d", pos); + PyObject *id = PyBytes_FromFormat(".%d", pos); if (id == NULL) return 0; if (!symtable_add_def(st, id, DEF_PARAM)) { @@ -1327,10 +1327,10 @@ */ PyObject *store_name; PyObject *name = (a->asname == NULL) ? a->name : a->asname; - const char *base = PyString_AS_STRING(name); + const char *base = PyBytes_AS_STRING(name); char *dot = strchr(base, '.'); if (dot) { - store_name = PyString_FromStringAndSize(base, dot - base); + store_name = PyBytes_FromStringAndSize(base, dot - base); if (!store_name) return 0; } @@ -1338,7 +1338,7 @@ store_name = name; Py_INCREF(store_name); } - if (strcmp(PyString_AS_STRING(name), "*")) { + if (strcmp(PyBytes_AS_STRING(name), "*")) { int r = symtable_add_def(st, store_name, DEF_IMPORT); Py_DECREF(store_name); return r; Modified: python/branches/tlee-ast-optimize/Python/sysmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/sysmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/sysmodule.c Sun Jun 1 17:18:10 2008 @@ -229,7 +229,7 @@ static PyObject * sys_getdefaultencoding(PyObject *self) { - return PyString_FromString(PyUnicode_GetDefaultEncoding()); + return PyBytes_FromString(PyUnicode_GetDefaultEncoding()); } PyDoc_STRVAR(getdefaultencoding_doc, @@ -261,7 +261,7 @@ sys_getfilesystemencoding(PyObject *self) { if (Py_FileSystemDefaultEncoding) - return PyString_FromString(Py_FileSystemDefaultEncoding); + return PyBytes_FromString(Py_FileSystemDefaultEncoding); Py_INCREF(Py_None); return Py_None; } @@ -290,7 +290,7 @@ int i; for (i = 0; i < 7; ++i) { if (whatstrings[i] == NULL) { - name = PyString_InternFromString(whatnames[i]); + name = PyBytes_InternFromString(whatnames[i]); if (name == NULL) return -1; whatstrings[i] = name; @@ -891,7 +891,7 @@ if (list == NULL) return NULL; for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - PyObject *name = PyString_FromString( + PyObject *name = PyBytes_FromString( PyImport_Inittab[i].name); if (name == NULL) break; @@ -931,7 +931,7 @@ if (warnoptions == NULL) return; } - str = PyString_FromString(s); + str = PyBytes_FromString(s); if (str != NULL) { PyList_Append(warnoptions, str); Py_DECREF(str); @@ -1232,9 +1232,6 @@ PyObject *m, *v, *sysdict; PyObject *sysin, *sysout, *syserr; char *s; -#ifdef MS_WINDOWS - char buf[128]; -#endif m = Py_InitModule3("sys", sys_methods, sys_doc); if (m == NULL) @@ -1272,23 +1269,6 @@ syserr = PyFile_FromFile(stderr, "", "w", _check_and_flush); if (PyErr_Occurred()) return NULL; -#ifdef MS_WINDOWS - if(isatty(_fileno(stdin)) && PyFile_Check(sysin)) { - sprintf(buf, "cp%d", GetConsoleCP()); - if (!PyFile_SetEncoding(sysin, buf)) - return NULL; - } - if(isatty(_fileno(stdout)) && PyFile_Check(sysout)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(sysout, buf)) - return NULL; - } - if(isatty(_fileno(stderr)) && PyFile_Check(syserr)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(syserr, buf)) - return NULL; - } -#endif PyDict_SetItemString(sysdict, "stdin", sysin); PyDict_SetItemString(sysdict, "stdout", sysout); @@ -1306,7 +1286,7 @@ Py_XDECREF(syserr); SET_SYS_FROM_STRING("version", - PyString_FromString(Py_GetVersion())); + PyBytes_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyInt_FromLong(PY_VERSION_HEX)); svnversion_init(); @@ -1337,15 +1317,15 @@ SET_SYS_FROM_STRING("api_version", PyInt_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", - PyString_FromString(Py_GetCopyright())); + PyBytes_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", - PyString_FromString(Py_GetPlatform())); + PyBytes_FromString(Py_GetPlatform())); SET_SYS_FROM_STRING("executable", - PyString_FromString(Py_GetProgramFullPath())); + PyBytes_FromString(Py_GetProgramFullPath())); SET_SYS_FROM_STRING("prefix", - PyString_FromString(Py_GetPrefix())); + PyBytes_FromString(Py_GetPrefix())); SET_SYS_FROM_STRING("exec_prefix", - PyString_FromString(Py_GetExecPrefix())); + PyBytes_FromString(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxsize", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("maxint", @@ -1372,13 +1352,13 @@ else value = "little"; SET_SYS_FROM_STRING("byteorder", - PyString_FromString(value)); + PyBytes_FromString(value)); } #ifdef MS_COREDLL SET_SYS_FROM_STRING("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); SET_SYS_FROM_STRING("winver", - PyString_FromString(PyWin_DLLVersionString)); + PyBytes_FromString(PyWin_DLLVersionString)); #endif if (warnoptions == NULL) { warnoptions = PyList_New(0); @@ -1423,7 +1403,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); + w = PyBytes_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; @@ -1468,14 +1448,14 @@ if (i == 0) { char* fn = decc$translate_vms(argv[0]); if ((fn == (char *)0) || fn == (char *)-1) - v = PyString_FromString(argv[0]); + v = PyBytes_FromString(argv[0]); else - v = PyString_FromString( + v = PyBytes_FromString( decc$translate_vms(argv[0])); } else - v = PyString_FromString(argv[i]); + v = PyBytes_FromString(argv[i]); #else - PyObject *v = PyString_FromString(argv[i]); + PyObject *v = PyBytes_FromString(argv[i]); #endif if (v == NULL) { Py_DECREF(av); @@ -1579,7 +1559,7 @@ #endif /* Unix */ } #endif /* All others */ - a = PyString_FromStringAndSize(argv0, n); + a = PyBytes_FromStringAndSize(argv0, n); if (a == NULL) Py_FatalError("no mem for sys.path insertion"); if (PyList_Insert(path, 0, a) < 0) Modified: python/branches/tlee-ast-optimize/Python/traceback.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/traceback.c (original) +++ python/branches/tlee-ast-optimize/Python/traceback.c Sun Jun 1 17:18:10 2008 @@ -155,12 +155,12 @@ PyErr_Clear(); break; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { size_t len; - len = PyString_GET_SIZE(v); + len = PyBytes_GET_SIZE(v); if (len + 1 + taillen >= MAXPATHLEN) continue; /* Too long */ - strcpy(namebuf, PyString_AsString(v)); + strcpy(namebuf, PyBytes_AsString(v)); if (strlen(namebuf) != len) continue; /* v contains '\0' */ if (len > 0 && namebuf[len-1] != SEP) @@ -238,10 +238,10 @@ while (tb != NULL && err == 0) { if (depth <= limit) { err = tb_displayline(f, - PyString_AsString( + PyBytes_AsString( tb->tb_frame->f_code->co_filename), tb->tb_lineno, - PyString_AsString(tb->tb_frame->f_code->co_name)); + PyBytes_AsString(tb->tb_frame->f_code->co_name)); } depth--; tb = tb->tb_next; Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c Sun Jun 1 17:18:10 2008 @@ -333,7 +333,7 @@ char *dtable; if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); + { int m=PyBytes_Size(value); if(m<0||!PyInt_Check(key)) return NULL; size+=m+2; } @@ -350,9 +350,9 @@ memset(dtable,0,size-8); n=0; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); + { int m=PyBytes_Size(value); *dtable=(char)PyInt_AsLong(key); - strcpy(dtable+1,PyString_AsString(value)); + strcpy(dtable+1,PyBytes_AsString(value)); dtable+=m+2; } Py_INCREF(Py_None);return Py_None; @@ -609,8 +609,8 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(2); if (list) - { PyList_SetItem(list, 0, PyString_FromString("size")); - PyList_SetItem(list, 1, PyString_FromString("start")); + { PyList_SetItem(list, 0, PyBytes_FromString("size")); + PyList_SetItem(list, 1, PyBytes_FromString("start")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -659,6 +659,6 @@ { PyObject *m, *d; m = Py_InitModule("drawf", DrawFMethods); d = PyModule_GetDict(m); - DrawFError=PyString_FromString("drawf.error"); + DrawFError=PyBytes_FromString("drawf.error"); PyDict_SetItemString(d,"error",DrawFError); } Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c Sun Jun 1 17:18:10 2008 @@ -79,9 +79,9 @@ char *buf; e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); if(e) return riscos_oserror(); - obj=PyString_FromStringAndSize(NULL,-len); + obj=PyBytes_FromStringAndSize(NULL,-len); if(obj==NULL) return NULL; - buf=PyString_AsString(obj); + buf=PyBytes_AsString(obj); e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); if(len!=1) return riscos_error("Error expanding path"); if(!e) return obj; @@ -131,7 +131,7 @@ { Py_DECREF(d);return riscos_oserror(); } if(count) - { v=PyString_FromString(buf); + { v=PyBytes_FromString(buf); if(!v) { Py_DECREF(d);return 0;} if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} } @@ -320,7 +320,7 @@ char *name,*value; if(!PyArg_ParseTuple(args,"s:getenv",&name)) return NULL; value=getenv(name); - if(value) return PyString_FromString(value); + if(value) return PyBytes_FromString(value); Py_INCREF(Py_None); return Py_None; } @@ -371,7 +371,7 @@ os_VARTYPE_EXPANDED,&size,(int *)&context,0)) { PyObject *v; value[size]='\0'; - v = PyString_FromString(value); + v = PyBytes_FromString(value); if (v == NULL) continue; PyDict_SetItemString(dict, context, v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c Sun Jun 1 17:18:10 2008 @@ -66,10 +66,10 @@ b->length=4*size; b->heap=1; if(init) - { if(PyString_Check(init)) - { int n=PyString_Size(init); + { if(PyBytes_Check(init)) + { int n=PyBytes_Size(init); if (n>4*size) n=4*size; - memcpy(b->block,PyString_AsString(init),n); + memcpy(b->block,PyBytes_AsString(init),n); memset((char*)b->block+n,0,4*size-n); } else @@ -113,7 +113,7 @@ { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } - return PyString_FromStringAndSize((char*)self->block+s,e-s); + return PyBytes_FromStringAndSize((char*)self->block+s,e-s); } static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) @@ -125,7 +125,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyBytes_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) @@ -137,7 +137,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyBytes_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) @@ -296,9 +296,9 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(3); if (list) - { PyList_SetItem(list, 0, PyString_FromString("length")); - PyList_SetItem(list, 1, PyString_FromString("start")); - PyList_SetItem(list, 2, PyString_FromString("end")); + { PyList_SetItem(list, 0, PyBytes_FromString("length")); + PyList_SetItem(list, 1, PyBytes_FromString("start")); + PyList_SetItem(list, 2, PyBytes_FromString("end")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -402,7 +402,7 @@ for(;*fmt;fmt++) { switch(*fmt) { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; - case 's':v=PyString_FromString((char*)(r.r[rno++])); break; + case 's':v=PyBytes_FromString((char*)(r.r[rno++])); break; case '.':rno++; continue; case '*':v=PyInt_FromLong((long)carry); break; } @@ -421,7 +421,7 @@ if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL; if (l==-1) l = strlen(s); - return PyString_FromStringAndSize((char*)s, l); + return PyBytes_FromStringAndSize((char*)s, l); } static char swi_string__doc__[] = Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Sun Jun 1 17:18:10 2008 @@ -1,4 +1,7 @@ -dnl Process this file with autoconf 2.0 or later to make a configure script. +dnl *********************************************** +dnl * Please run autoreconf to test your changes! * +dnl *********************************************** +dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.63). # Set VERSION so we only need to edit in one place (i.e., here) m4_define(PYTHON_VERSION, 2.6) Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Sun Jun 1 17:18:10 2008 @@ -5,6 +5,7 @@ import sys, os, imp, re, optparse from glob import glob +from platform import machine as platform_machine from distutils import log from distutils import sysconfig @@ -687,13 +688,39 @@ # a release. Most open source OSes come with one or more # versions of BerkeleyDB already installed. - max_db_ver = (4, 5) # XXX(gregory.p.smith): 4.6 "works" but seems to - # have issues on many platforms. I've temporarily - # disabled 4.6 to see what the odd platform - # buildbots say. + max_db_ver = (4, 7) min_db_ver = (3, 3) db_setup_debug = False # verbose debug prints from this script? + def allow_db_ver(db_ver): + """Returns a boolean if the given BerkeleyDB version is acceptable. + + Args: + db_ver: A tuple of the version to verify. + """ + if not (min_db_ver <= db_ver <= max_db_ver): + return False + # Use this function to filter out known bad configurations. + if (4, 6) == db_ver[:2]: + # BerkeleyDB 4.6.x is not stable on many architectures. + arch = platform_machine() + if arch not in ('i386', 'i486', 'i586', 'i686', + 'x86_64', 'ia64'): + return False + return True + + def gen_db_minor_ver_nums(major): + if major == 4: + for x in range(max_db_ver[1]+1): + if allow_db_ver((4, x)): + yield x + elif major == 3: + for x in (3,): + if allow_db_ver((3, x)): + yield x + else: + raise ValueError("unknown major BerkeleyDB version", major) + # construct a list of paths to look for the header file in on # top of the normal inc_dirs. db_inc_paths = [ @@ -708,7 +735,7 @@ '/sw/include/db3', ] # 4.x minor number specific paths - for x in range(max_db_ver[1]+1): + for x in gen_db_minor_ver_nums(4): db_inc_paths.append('/usr/include/db4%d' % x) db_inc_paths.append('/usr/include/db4.%d' % x) db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) @@ -718,7 +745,7 @@ # MacPorts default (http://www.macports.org/) db_inc_paths.append('/opt/local/include/db4%d' % x) # 3.x minor number specific paths - for x in (3,): + for x in gen_db_minor_ver_nums(3): db_inc_paths.append('/usr/include/db3%d' % x) db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) db_inc_paths.append('/usr/local/include/db3%d' % x) @@ -733,10 +760,10 @@ for dn in inc_dirs: std_variants.append(os.path.join(dn, 'db3')) std_variants.append(os.path.join(dn, 'db4')) - for x in range(max_db_ver[1]+1): + for x in gen_db_minor_ver_nums(4): std_variants.append(os.path.join(dn, "db4%d"%x)) std_variants.append(os.path.join(dn, "db4.%d"%x)) - for x in (3,): + for x in gen_db_minor_ver_nums(3): std_variants.append(os.path.join(dn, "db3%d"%x)) std_variants.append(os.path.join(dn, "db3.%d"%x)) @@ -771,7 +798,7 @@ continue if ( (not db_ver_inc_map.has_key(db_ver)) and - (db_ver <= max_db_ver and db_ver >= min_db_ver) ): + allow_db_ver(db_ver) ): # save the include directory with the db.h version # (first occurrence only) db_ver_inc_map[db_ver] = d @@ -815,8 +842,9 @@ if db_setup_debug: print "db lib: ", dblib, "not found" except db_found: - print "bsddb using BerkeleyDB lib:", db_ver, dblib - print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir + if db_setup_debug: + print "bsddb using BerkeleyDB lib:", db_ver, dblib + print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir db_incs = [db_incdir] dblibs = [dblib] # We add the runtime_library_dirs argument because the From python-checkins at python.org Sun Jun 1 17:27:17 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 17:27:17 +0200 (CEST) Subject: [Python-checkins] r63855 - in doctools/trunk: doc/builders.rst sphinx/builder.py sphinx/environment.py sphinx/latexwriter.py sphinx/textwriter.py Message-ID: <20080601152717.438C11E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 17:27:16 2008 New Revision: 63855 Log: Add a preliminary text writer, mainly for producing pydoc-compatible topic help. Added: doctools/trunk/sphinx/textwriter.py Modified: doctools/trunk/doc/builders.rst doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/latexwriter.py Modified: doctools/trunk/doc/builders.rst ============================================================================== --- doctools/trunk/doc/builders.rst (original) +++ doctools/trunk/doc/builders.rst Sun Jun 1 17:27:16 2008 @@ -51,6 +51,16 @@ Its name is ``latex``. +.. class:: TextBuilder + + This builder produces a text file for each reST file -- this is almost the + same as the reST source, but with much of the markup stripped for better + readability. + + Its name is ``text``. + + .. versionadded:: 0.4 + .. class:: ChangesBuilder This builder produces an HTML overview of all :dir:`versionadded`, Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sun Jun 1 17:27:16 2008 @@ -28,6 +28,7 @@ from sphinx.util import ensuredir, relative_uri, SEP, os_path from sphinx.htmlhelp import build_hhx from sphinx.htmlwriter import HTMLWriter, HTMLTranslator, SmartyPantsHTMLTranslator +from sphinx.textwriter import TextWriter from sphinx.latexwriter import LaTeXWriter from sphinx.environment import BuildEnvironment, NoUri from sphinx.highlighting import PygmentsBridge @@ -223,7 +224,7 @@ self.info(bold('build succeeded.')) def write(self, build_docnames, updated_docnames, method='update'): - if build_docnames is None: + if build_docnames is None or build_docnames == ['__all__']: # build_all build_docnames = self.env.found_docs if method == 'update': @@ -980,6 +981,56 @@ def finish(self): pass + +class TextBuilder(Builder): + name = 'text' + out_suffix = '.txt' + + def init(self): + pass + + def get_outdated_docs(self): + for docname in self.env.found_docs: + if docname not in self.env.all_docs: + yield docname + continue + targetname = self.env.doc2path(docname, self.outdir, self.out_suffix) + try: + targetmtime = path.getmtime(targetname) + except Exception: + targetmtime = 0 + try: + srcmtime = path.getmtime(self.env.doc2path(docname)) + if srcmtime > targetmtime: + yield docname + except EnvironmentError: + # source doesn't exist anymore + pass + + def get_target_uri(self, docname, typ=None): + return '' + + def prepare_writing(self, docnames): + self.writer = TextWriter(self) + + def write_doc(self, docname, doctree): + destination = StringOutput(encoding='utf-8') + self.writer.write(doctree, destination) + outfilename = path.join(self.outdir, os_path(docname) + self.out_suffix) + ensuredir(path.dirname(outfilename)) # normally different from self.outdir + try: + f = codecs.open(outfilename, 'w', 'utf-8') + try: + f.write(self.writer.output) + finally: + f.close() + except (IOError, OSError), err: + self.warn("Error writing file %s: %s" % (outfilename, err)) + + def finish(self): + pass + + # compatibility alias WebHTMLBuilder = PickleHTMLBuilder @@ -992,6 +1043,7 @@ 'web': PickleHTMLBuilder, 'htmlhelp': HTMLHelpBuilder, 'latex': LaTeXBuilder, + 'text': TextBuilder, 'changes': ChangesBuilder, 'linkcheck': CheckExternalLinksBuilder, } Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Sun Jun 1 17:27:16 2008 @@ -1004,8 +1004,12 @@ includes = getinc(docname) # previous if not previous: + # if no previous sibling, go to parent previous = parents[0][0] else: + # else, go to previous sibling, or if it has children, to + # the last of its children, or if that has children, to the + # last of those, and so forth while 1: previncs = getinc(previous) if previncs: @@ -1014,10 +1018,14 @@ break # next if includes: + # if it has children, go to first of them next = includes[0] elif next: + # else, if next sibling, go to it pass else: + # else, go to the next sibling of the parent, if present, + # else the grandparent's sibling, if present, and so forth for parname, parindex in parents: parincs = getinc(parname) if parincs and parindex + 1 < len(parincs): Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Sun Jun 1 17:27:16 2008 @@ -993,6 +993,9 @@ def depart_Text(self, node): pass + def visit_comment(self, node): + raise nodes.SkipNode + def visit_system_message(self, node): pass def depart_system_message(self, node): Added: doctools/trunk/sphinx/textwriter.py ============================================================================== --- (empty file) +++ doctools/trunk/sphinx/textwriter.py Sun Jun 1 17:27:16 2008 @@ -0,0 +1,595 @@ +# -*- coding: utf-8 -*- +""" + sphinx.textwriter + ~~~~~~~~~~~~~~~~~ + + Custom docutils writer for plain text. + + :copyright: 2008 by Georg Brandl. + :license: BSD. +""" + +import re +import textwrap + +from docutils import nodes, writers + +from sphinx import addnodes + + +class TextWriter(writers.Writer): + supported = ('text',) + settings_spec = ('No options here.', '', ()) + settings_defaults = {} + + output = None + + def __init__(self, builder): + writers.Writer.__init__(self) + self.builder = builder + + def translate(self): + visitor = TextTranslator(self.document, self.builder) + self.document.walkabout(visitor) + self.output = visitor.body + +# monkey-patch... +new_wordsep_re = re.compile( + r'(\s+|' # any whitespace + r'(?<=\s)(?::[a-z-]+:)?`\S+|' # interpreted text start + r'[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|' # hyphenated words + r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash +textwrap.TextWrapper.wordsep_re = new_wordsep_re + +MAXWIDTH = 70 +STDINDENT = 3 + + +class TextTranslator(nodes.NodeVisitor): + sectionchars = '*=-~"+' + + def __init__(self, document, builder): + nodes.NodeVisitor.__init__(self, document) + + self.states = [[]] + self.stateindent = [0] + self.sectionlevel = 0 + self.table = None + + def add_text(self, text): + self.states[-1].append((-1, text)) + def new_state(self, indent=STDINDENT): + self.states.append([]) + self.stateindent.append(indent) + def end_state(self, wrap=True, end=[''], first=None): + content = self.states.pop() + maxindent = sum(self.stateindent) + indent = self.stateindent.pop() + result = [] + toformat = [] + def do_format(): + if not toformat: + return + if wrap: + res = textwrap.wrap(''.join(toformat), width=MAXWIDTH-maxindent) + else: + res = ''.join(toformat).splitlines() + if end: + res += end + result.append((indent, res)) + for itemindent, item in content: + if itemindent == -1: + toformat.append(item) + else: + do_format() + result.append((indent + itemindent, item)) + toformat = [] + do_format() + if first is not None and result: + itemindent, item = result[0] + if item: + result.insert(0, (itemindent - indent, [first + item[0]])) + result[1] = (itemindent, item[1:]) + self.states[-1].extend(result) + + def visit_document(self, node): + self.new_state(0) + def depart_document(self, node): + self.end_state() + self.body = '\n'.join(line and (' '*indent + line) + for indent, lines in self.states[0] + for line in lines) + # XXX header/footer? + + def visit_highlightlang(self, node): + raise nodes.SkipNode + + def visit_section(self, node): + self._title_char = self.sectionchars[self.sectionlevel] + self.sectionlevel += 1 + def depart_section(self, node): + self.sectionlevel -= 1 + + def visit_topic(self, node): + self.new_state(0) + def depart_topic(self, node): + self.end_state() + + visit_sidebar = visit_topic + depart_sidebar = depart_topic + + def visit_rubric(self, node): + self.new_state(0) + self.add_text('-[ ') + def depart_rubric(self, node): + self.add_text(' ]-') + self.end_state() + + def visit_glossary(self, node): + pass + def depart_glossary(self, node): + pass + + def visit_title(self, node): + if isinstance(node.parent, nodes.Admonition): + self.add_text(node.astext()+': ') + raise nodes.SkipNode + self.new_state(0) + def depart_title(self, node): + if isinstance(node.parent, nodes.section): + char = self._title_char + else: + char = '^' + text = ''.join(x[1] for x in self.states.pop() if x[0] == -1) + self.stateindent.pop() + self.states[-1].append((0, ['', text, '%s' % (char * len(text)), ''])) + + def visit_module(self, node): + if node.has_key('platform'): + self.new_state(0) + self.add_text('Platform: %s' % node['platform']) + self.end_state() + raise nodes.SkipNode + + def visit_desc(self, node): + pass + def depart_desc(self, node): + pass + + def visit_desc_signature(self, node): + self.new_state(0) + if node.parent['desctype'] in ('class', 'exception'): + self.add_text('%s ' % node.parent['desctype']) + def depart_desc_signature(self, node): + # XXX: wrap signatures in a way that makes sense + self.end_state(wrap=False, end=None) + + def visit_desc_name(self, node): + pass + def depart_desc_name(self, node): + pass + + def visit_desc_classname(self, node): + pass + def depart_desc_classname(self, node): + pass + + def visit_desc_type(self, node): + pass + def depart_desc_type(self, node): + pass + + def visit_desc_parameterlist(self, node): + self.add_text('(') + self.first_param = 1 + def depart_desc_parameterlist(self, node): + self.add_text(')') + + def visit_desc_parameter(self, node): + if not self.first_param: + self.add_text(', ') + else: + self.first_param = 0 + self.add_text(node.astext()) + raise nodes.SkipNode + + def visit_desc_optional(self, node): + self.add_text('[') + def depart_desc_optional(self, node): + self.add_text(']') + + def visit_refcount(self, node): + pass + def depart_refcount(self, node): + pass + + def visit_desc_content(self, node): + self.new_state() + self.add_text('\n') + def depart_desc_content(self, node): + self.end_state() + + def visit_figure(self, node): + self.new_state() + def depart_figure(self, node): + self.end_state() + + def visit_caption(self, node): + pass + def depart_caption(self, node): + pass + + def visit_productionlist(self, node): + self.new_state() + names = [] + for production in node: + names.append(production['tokenname']) + maxlen = max(len(name) for name in names) + for production in node: + if production['tokenname']: + self.add_text(production['tokenname'].ljust(maxlen) + ' ::=') + lastname = production['tokenname'] + else: + self.add_text('%s ' % (' '*len(lastname))) + self.add_text(production.astext() + '\n') + self.end_state(wrap=False) + raise nodes.SkipNode + + def visit_seealso(self, node): + self.new_state() + def depart_seealso(self, node): + self.end_state(first='') + + def visit_footnote(self, node): + self._footnote = node.children[0].astext().strip() + self.new_state(len(self._footnote) + 3) + def depart_footnote(self, node): + self.end_state(first='[%s] ' % self._footnote) + + def visit_label(self, node): + raise nodes.SkipNode + + def visit_tabular_col_spec(self, node): + raise nodes.SkipNode + + def visit_colspec(self, node): + self.table[0].append(node['colwidth']) + raise nodes.SkipNode + + def visit_tgroup(self, node): + pass + def depart_tgroup(self, node): + pass + + def visit_thead(self, node): + pass + def depart_thead(self, node): + pass + + def visit_tbody(self, node): + self.table.append('sep') + def depart_tbody(self, node): + pass + + def visit_row(self, node): + self.table.append([]) + def depart_row(self, node): + pass + + def visit_entry(self, node): + if node.has_key('morerows') or node.has_key('morecols'): + raise NotImplementedError('Column or row spanning cells are ' + 'not implemented.') + self.new_state(0) + def depart_entry(self, node): + text = '\n'.join('\n'.join(x[1]) for x in self.states.pop()) + self.stateindent.pop() + self.table[-1].append(text) + + def visit_table(self, node): + if self.table: + raise NotImplementedError('Nested tables are not supported.') + self.new_state(0) + self.table = [[]] + def depart_table(self, node): + lines = self.table[1:] + fmted_rows = [] + colwidths = self.table[0] + realwidths = colwidths[:] + separator = 0 + # don't allow paragraphs in table cells for now + for line in lines: + if line == 'sep': + separator = len(fmted_rows) + else: + cells = [] + for i, cell in enumerate(line): + par = textwrap.wrap(cell, width=colwidths[i]) + maxwidth = max(map(len, par)) if par else 0 + realwidths[i] = max(realwidths[i], maxwidth) + cells.append(par) + fmted_rows.append(cells) + + def writesep(char='-'): + out = ['+'] + for width in realwidths: + out.append(char * (width+2)) + out.append('+') + self.add_text(''.join(out) + '\n') + + def writerow(row): + lines = map(None, *row) + for line in lines: + out = ['|'] + for i, cell in enumerate(line): + if cell: + out.append(' ' + cell.ljust(realwidths[i]+1)) + else: + out.append(' ' * (realwidths[i] + 2)) + out.append('|') + self.add_text(''.join(out) + '\n') + + for i, row in enumerate(fmted_rows): + if separator and i == separator: + writesep('=') + else: + writesep('-') + writerow(row) + writesep('-') + self.table = None + self.end_state(wrap=False) + + def visit_acks(self, node): + self.new_state(0) + self.add_text(', '.join(n.astext() for n in node.children[0].children) + '.') + self.end_state() + raise nodes.SkipNode + + def visit_image(self, node): + self.add_text('[image]') + + def visit_transition(self, node): + indent = sum(self.stateindent) + self.new_state(0) + self.add_text('=' * (MAXWIDTH - indent)) + self.end_state() + raise nodes.SkipNode + + def visit_bullet_list(self, node): + self._list_counter = -1 + def depart_bullet_list(self, node): + pass + + def visit_enumerated_list(self, node): + self._list_counter = 0 + def depart_enumerated_list(self, node): + pass + + def visit_definition_list(self, node): + self._list_counter = -2 + def depart_definition_list(self, node): + pass + + def visit_list_item(self, node): + if self._list_counter == -1: + # bullet list + self.new_state(2) + elif self._list_counter == -2: + # definition list + pass + else: + # enumerated list + self._list_counter += 1 + self.new_state(len(str(self._list_counter)) + 2) + def depart_list_item(self, node): + if self._list_counter == -1: + self.end_state(first='* ', end=None) + elif self._list_counter == -2: + pass + else: + self.end_state(first='%s. ' % self._list_counter, end=None) + + def visit_definition_list_item(self, node): + self._li_has_classifier = len(node) >= 2 and \ + isinstance(node[1], nodes.classifier) + def depart_definition_list_item(self, node): + pass + + def visit_term(self, node): + self.new_state(0) + def depart_term(self, node): + if not self._li_has_classifier: + self.end_state(end=None) + + def visit_classifier(self, node): + self.add_text(' : ') + def depart_classifier(self, node): + self.end_state(end=None) + + def visit_definition(self, node): + self.new_state() + def depart_definition(self, node): + self.end_state() + + def visit_field_list(self, node): + pass + def depart_field_list(self, node): + pass + + def visit_field(self, node): + pass + def depart_field(self, node): + pass + + def visit_field_name(self, node): + self.new_state(0) + def depart_field_name(self, node): + self.add_text(':') + self.end_state(end=None) + + def visit_field_body(self, node): + self.new_state() + def depart_field_body(self, node): + self.end_state() + + def visit_centered(self, node): + pass + def depart_centered(self, node): + pass + + def visit_admonition(self, node): + self.new_state(0) + def depart_admonition(self, node): + self.end_state() + + def _make_visit_admonition(name): + def visit_admonition(self, node): + self.new_state(2) + return visit_admonition + def _make_depart_admonition(name): + def depart_admonition(self, node): + self.end_state(first=name.capitalize() + ': ') + return depart_admonition + + visit_attention = _make_visit_admonition('attention') + depart_attention = _make_depart_admonition('attention') + visit_caution = _make_visit_admonition('caution') + depart_caution = _make_depart_admonition('caution') + visit_danger = _make_visit_admonition('danger') + depart_danger = _make_depart_admonition('danger') + visit_error = _make_visit_admonition('error') + depart_error = _make_depart_admonition('error') + visit_hint = _make_visit_admonition('hint') + depart_hint = _make_depart_admonition('hint') + visit_important = _make_visit_admonition('important') + depart_important = _make_depart_admonition('important') + visit_note = _make_visit_admonition('note') + depart_note = _make_depart_admonition('note') + visit_tip = _make_visit_admonition('tip') + depart_tip = _make_depart_admonition('tip') + visit_warning = _make_visit_admonition('warning') + depart_warning = _make_depart_admonition('warning') + + def visit_versionmodified(self, node): + self.new_state(0) + if node['type'] == 'versionadded': + tmpl = 'Added in version %s' + elif node['type'] == 'versionchanged': + tmpl = 'Changed in version %s' + elif node['type'] == 'deprecated': + tmpl = 'Deprecated in version %s' + if node.children: + self.add_text(tmpl % node['version'] + ': ') + else: + self.add_text(tmpl % node['version'] + '.') + def depart_versionmodified(self, node): + self.end_state() + + def visit_literal_block(self, node): + self.new_state() + def depart_literal_block(self, node): + self.end_state(wrap=False) + + def visit_doctest_block(self, node): + self.new_state(0) + def depart_doctest_block(self, node): + self.end_state(wrap=False) + + def visit_line_block(self, node): + self.new_state(0) + def depart_line_block(self, node): + self.end_state(wrap=False) + + def visit_line(self, node): + pass + def depart_line(self, node): + pass + + def visit_block_quote(self, node): + self.new_state() + def depart_block_quote(self, node): + self.end_state() + + def visit_compact_paragraph(self, node): + pass + def depart_compact_paragraph(self, node): + pass + + def visit_paragraph(self, node): + if not isinstance(node.parent, nodes.Admonition) or \ + isinstance(node.parent, addnodes.seealso): + self.new_state(0) + def depart_paragraph(self, node): + if not isinstance(node.parent, nodes.Admonition) or \ + isinstance(node.parent, addnodes.seealso): + self.end_state() + + def visit_target(self, node): + raise nodes.SkipNode + + def visit_index(self, node): + raise nodes.SkipNode + + def visit_substitution_definition(self, node): + raise nodes.SkipNode + + def visit_pending_xref(self, node): + pass + def depart_pending_xref(self, node): + pass + + def visit_reference(self, node): + pass + def depart_reference(self, node): + pass + + def visit_emphasis(self, node): + self.add_text('*') + def depart_emphasis(self, node): + self.add_text('*') + + def visit_literal_emphasis(self, node): + self.add_text('*') + def depart_literal_emphasis(self, node): + self.add_text('*') + + def visit_strong(self, node): + self.add_text('**') + def depart_strong(self, node): + self.add_text('**') + + def visit_title_reference(self, node): + self.add_text('*') + def depart_title_reference(self, node): + self.add_text('*') + + def visit_literal(self, node): + self.add_text('``') + def depart_literal(self, node): + self.add_text('``') + + def visit_footnote_reference(self, node): + self.add_text('[%s]' % node.astext()) + raise nodes.SkipNode + + def visit_Text(self, node): + self.add_text(node.astext()) + def depart_Text(self, node): + pass + + def visit_problematic(self, node): + self.add_text('>>') + def depart_problematic(self, node): + self.add_text('<<') + + def visit_system_message(self, node): + self.new_state(0) + self.add_text('' % node.astext()) + self.end_state() + raise nodes.SkipNode + + def visit_comment(self, node): + raise nodes.SkipNode + + def unknown_visit(self, node): + raise NotImplementedError("Unknown node: " + node.__class__.__name__) From python-checkins at python.org Sun Jun 1 18:16:18 2008 From: python-checkins at python.org (robert.schuppenies) Date: Sun, 1 Jun 2008 18:16:18 +0200 (CEST) Subject: [Python-checkins] r63856 - in python/trunk: Doc/library/sys.rst Lib/test/test_sys.py Misc/NEWS Objects/bytesobject.c Objects/dictobject.c Objects/listobject.c Objects/longobject.c Objects/typeobject.c Python/sysmodule.c Message-ID: <20080601161618.AF56E1E400C@bag.python.org> Author: robert.schuppenies Date: Sun Jun 1 18:16:17 2008 New Revision: 63856 Log: Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. Modified: python/trunk/Doc/library/sys.rst python/trunk/Lib/test/test_sys.py python/trunk/Misc/NEWS python/trunk/Objects/bytesobject.c python/trunk/Objects/dictobject.c python/trunk/Objects/listobject.c python/trunk/Objects/longobject.c python/trunk/Objects/typeobject.c python/trunk/Python/sysmodule.c Modified: python/trunk/Doc/library/sys.rst ============================================================================== --- python/trunk/Doc/library/sys.rst (original) +++ python/trunk/Doc/library/sys.rst Sun Jun 1 18:16:17 2008 @@ -409,6 +409,16 @@ :func:`setrecursionlimit`. +.. function:: getsizeof(object) + + Return the size of an object in bytes. The object can be any type of + object. All built-in objects will return correct results, but this + does not have to hold true for third-party extensions as it is implementation + specific. + + .. versionadded:: 2.6 + + .. function:: _getframe([depth]) Return a frame object from the call stack. If optional integer *depth* is Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Sun Jun 1 18:16:17 2008 @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- import unittest, test.test_support -import sys, cStringIO +import sys, cStringIO, os class SysModuleTest(unittest.TestCase): @@ -405,8 +405,155 @@ self.assertEqual(out, '?') +class SizeofTest(unittest.TestCase): + + def setUp(self): + import struct + self.i = len(struct.pack('i', 0)) + self.l = len(struct.pack('l', 0)) + self.p = len(struct.pack('P', 0)) + self.headersize = self.l + self.p + if hasattr(sys, "gettotalrefcount"): + self.headersize += 2 * self.p + self.file = open(test.test_support.TESTFN, 'wb') + + def tearDown(self): + self.file.close() + os.remove(test.test_support.TESTFN) + + def check_sizeof(self, o, size): + result = sys.getsizeof(o) + msg = 'wrong size for %s: got %d, expected %d' \ + % (type(o), result, size) + self.assertEqual(result, size, msg) + + def align(self, value): + mod = value % self.p + if mod != 0: + return value - mod + self.p + else: + return value + + def test_align(self): + self.assertTrue( (self.align(0) % self.p) == 0 ) + self.assertTrue( (self.align(1) % self.p) == 0 ) + self.assertTrue( (self.align(3) % self.p) == 0 ) + self.assertTrue( (self.align(4) % self.p) == 0 ) + self.assertTrue( (self.align(7) % self.p) == 0 ) + self.assertTrue( (self.align(8) % self.p) == 0 ) + self.assertTrue( (self.align(9) % self.p) == 0 ) + + def test_standardtypes(self): + i = self.i + l = self.l + p = self.p + h = self.headersize + # bool + self.check_sizeof(True, h + l) + # buffer + self.check_sizeof(buffer(''), h + 2*p + 2*l + self.align(i) +l) + # bytearray + self.check_sizeof(bytes(), h + self.align(i) + l + p) + # cell + def get_cell(): + x = 42 + def inner(): + return x + return inner + self.check_sizeof(get_cell().func_closure[0], h + p) + # old-style class + class class_oldstyle(): + def method(): + pass + self.check_sizeof(class_oldstyle, h + 6*p) + # instance + self.check_sizeof(class_oldstyle(), h + 3*p) + # method + self.check_sizeof(class_oldstyle().method, h + 4*p) + # code + self.check_sizeof(get_cell().func_code, h + self.align(4*i) + 8*p +\ + self.align(i) + 2*p) + # complex + self.check_sizeof(complex(0,1), h + 2*8) + # enumerate + self.check_sizeof(enumerate([]), h + l + 3*p) + # reverse + self.check_sizeof(reversed(''), h + l + p ) + # file + self.check_sizeof(self.file, h + 4*p + self.align(2*i) + 4*p +\ + self.align(3*i) + 3*p + self.align(i)) + # float + self.check_sizeof(float(0), h + 8) + # function + def func(): pass + self.check_sizeof(func, h + 9 * l) + class c(): + @staticmethod + def foo(): + pass + @classmethod + def bar(cls): + pass + # staticmethod + self.check_sizeof(foo, h + l) + # classmethod + self.check_sizeof(bar, h + l) + # generator + def get_gen(): yield 1 + self.check_sizeof(get_gen(), h + p + self.align(i) + 2*p) + # integer + self.check_sizeof(1, h + l) + # builtin_function_or_method + self.check_sizeof(abs, h + 3*p) + # module + self.check_sizeof(unittest, h + p) + # xange + self.check_sizeof(xrange(1), h + 3*p) + # slice + self.check_sizeof(slice(0), h + 3*p) + + h += l + # new-style class + class class_newstyle(object): + def method(): + pass + # type (PyTypeObject + PyNumberMethods + PyMappingMethods + + # PySequenceMethods + PyBufferProcs) + len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p + self.check_sizeof(class_newstyle, h + \ + len_typeobject + 42*p + 10*p + 3*p + 6*p) + + + def test_specialtypes(self): + i = self.i + l = self.l + p = self.p + h = self.headersize + # dict + self.check_sizeof({}, h + 3*l + 3*p + 8*(l + 2*p)) + longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} + self.check_sizeof(longdict, h + 3*l + 3*p + 8*(l + 2*p) + 16*(l + 2*p)) + # list + self.check_sizeof([], h + l + p + l) + self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) + + h += l + # long + self.check_sizeof(0L, h + self.align(2)) + self.check_sizeof(1L, h + self.align(2)) + self.check_sizeof(-1L, h + self.align(2)) + self.check_sizeof(32768L, h + self.align(2) + 2) + self.check_sizeof(32768L*32768L-1, h + self.align(2) + 2) + self.check_sizeof(32768L*32768L, h + self.align(2) + 4) + # string + self.check_sizeof('', h + l + self.align(i + 1)) + self.check_sizeof('abc', h + l + self.align(i + 1) + 3) + + def test_main(): - test.test_support.run_unittest(SysModuleTest) + test_classes = (SysModuleTest, SizeofTest) + + test.test_support.run_unittest(*test_classes) if __name__ == "__main__": test_main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 1 18:16:17 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. + - New environment variable PYTHONIOENCODING. - Patch #2488: Add sys.maxsize. Modified: python/trunk/Objects/bytesobject.c ============================================================================== --- python/trunk/Objects/bytesobject.c (original) +++ python/trunk/Objects/bytesobject.c Sun Jun 1 18:16:17 2008 @@ -3917,6 +3917,17 @@ return NULL; } +PyDoc_STRVAR(sizeof__doc__, +"S.__sizeof__() -> size of S in bytes"); + +static PyObject * +string_sizeof(PyBytesObject *v) +{ + Py_ssize_t res; + res = sizeof(PyBytesObject) + v->ob_size * v->ob_type->tp_itemsize; + return PyInt_FromSsize_t(res); +} + #undef SPLIT_APPEND #undef SPLIT_ADD #undef MAX_PREALLOC @@ -4024,6 +4035,8 @@ expandtabs__doc__}, {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, splitlines__doc__}, + {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, + sizeof__doc__}, {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Sun Jun 1 18:16:17 2008 @@ -2032,6 +2032,16 @@ return dictiter_new(dict, &PyDictIterItem_Type); } +static PyObject * +dict_sizeof(PyDictObject *mp) +{ + Py_ssize_t res; + + res = sizeof(PyDictObject) + sizeof(mp->ma_table); + if (mp->ma_table != mp->ma_smalltable) + res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry); + return PyInt_FromSsize_t(res); +} PyDoc_STRVAR(has_key__doc__, "D.has_key(k) -> True if D has a key k, else False"); @@ -2041,6 +2051,9 @@ PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); +PyDoc_STRVAR(sizeof__doc__, +"D.__sizeof__() -> size of D in bytes"); + PyDoc_STRVAR(get__doc__, "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); @@ -2092,6 +2105,8 @@ contains__doc__}, {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, + {"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS, + sizeof__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, has_key__doc__}, {"get", (PyCFunction)dict_get, METH_VARARGS, Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Sun Jun 1 18:16:17 2008 @@ -2420,6 +2420,15 @@ return 0; } +static PyObject * +list_sizeof(PyListObject *self) +{ + Py_ssize_t res; + + res = sizeof(PyListObject) + self->allocated * sizeof(void*); + return PyInt_FromSsize_t(res); +} + static PyObject *list_iter(PyObject *seq); static PyObject *list_reversed(PyListObject* seq, PyObject* unused); @@ -2427,6 +2436,8 @@ "x.__getitem__(y) <==> x[y]"); PyDoc_STRVAR(reversed_doc, "L.__reversed__() -- return a reverse iterator over the list"); +PyDoc_STRVAR(sizeof_doc, +"L.__sizeof__() -- size of L in bytes"); PyDoc_STRVAR(append_doc, "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, @@ -2452,6 +2463,7 @@ static PyMethodDef list_methods[] = { {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, getitem_doc}, {"__reversed__",(PyCFunction)list_reversed, METH_NOARGS, reversed_doc}, + {"__sizeof__", (PyCFunction)list_sizeof, METH_NOARGS, sizeof_doc}, {"append", (PyCFunction)listappend, METH_O, append_doc}, {"insert", (PyCFunction)listinsert, METH_VARARGS, insert_doc}, {"extend", (PyCFunction)listextend, METH_O, extend_doc}, Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Sun Jun 1 18:16:17 2008 @@ -3436,6 +3436,17 @@ return NULL; } +static PyObject * +long_sizeof(PyLongObject *v) +{ + Py_ssize_t res; + + res = sizeof(PyLongObject) + abs(v->ob_size) * sizeof(digit); + if (v->ob_size != 0) + res -= sizeof(digit); + return PyInt_FromSsize_t(res); +} + #if 0 static PyObject * long_is_finite(PyObject *v) @@ -3455,6 +3466,8 @@ "Truncating an Integral returns itself."}, {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, {"__format__", (PyCFunction)long__format__, METH_VARARGS}, + {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, + "Returns size in bytes"}, {NULL, NULL} /* sentinel */ }; Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Sun Jun 1 18:16:17 2008 @@ -3397,6 +3397,20 @@ return result; } +static PyObject * +object_sizeof(PyObject *self, PyObject *args) +{ + Py_ssize_t res, isize; + + res = 0; + isize = self->ob_type->tp_itemsize; + if (isize > 0) + res = self->ob_type->ob_size * isize; + res += self->ob_type->tp_basicsize; + + return PyInt_FromSsize_t(res); +} + static PyMethodDef object_methods[] = { {"__reduce_ex__", object_reduce_ex, METH_VARARGS, PyDoc_STR("helper for pickle")}, @@ -3406,6 +3420,8 @@ object_subclasshook_doc}, {"__format__", object_format, METH_VARARGS, PyDoc_STR("default object formatter")}, + {"__sizeof__", object_sizeof, METH_NOARGS, + PyDoc_STR("__sizeof__() -> size of object in bytes")}, {0} }; Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Sun Jun 1 18:16:17 2008 @@ -640,6 +640,45 @@ #endif /* USE_MALLOPT */ static PyObject * +sys_getsizeof(PyObject *self, PyObject *args) +{ + static PyObject * str__sizeof__ = NULL; + + /* Initialize static variable needed by _PyType_Lookup */ + if (str__sizeof__ == NULL) { + str__sizeof__ = PyString_InternFromString("__sizeof__"); + if (str__sizeof__ == NULL) + return NULL; + } + + /* Type objects */ + if (PyType_Check(args)){ + PyObject *method = _PyType_Lookup(Py_TYPE(args), + str__sizeof__); + if (method == NULL) { + PyErr_Format(PyExc_TypeError, + "Type %.100s doesn't define __sizeof__", + Py_TYPE(args)->tp_name); + return NULL; + } + return PyObject_CallFunctionObjArgs(method, args, NULL); + } + /* Instance of old-style classes */ + else if(PyInstance_Check(args)) + return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); + /* Old-style class */ + else if (PyClass_Check(args)) + return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); + else + return PyObject_CallMethod(args, "__sizeof__", NULL); +} + +PyDoc_STRVAR(getsizeof_doc, +"getsizeof(object) -> int\n\ +\n\ +Return the size of object in bytes."); + +static PyObject * sys_getrefcount(PyObject *self, PyObject *arg) { return PyInt_FromSsize_t(arg->ob_refcnt); @@ -850,6 +889,7 @@ {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, getrecursionlimit_doc}, + {"getsizeof", sys_getsizeof, METH_O, getsizeof_doc}, {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, #ifdef MS_WINDOWS {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, @@ -1031,6 +1071,7 @@ getprofile() -- get the global profiling function\n\ getrefcount() -- return the reference count for an object (plus one :-)\n\ getrecursionlimit() -- return the max recursion depth for the interpreter\n\ +getsizeof() -- return the size of an object in bytes\n\ gettrace() -- get the global debug tracing function\n\ setcheckinterval() -- control how often the interpreter checks for events\n\ setdlopenflags() -- set the flags to be used for dlopen() calls\n\ From python-checkins at python.org Sun Jun 1 18:29:03 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 1 Jun 2008 18:29:03 +0200 (CEST) Subject: [Python-checkins] r63857 - in python/branches/tlee-ast-optimize: Include/compile.h Include/optimize.h Python/bltinmodule.c Python/compile.c Python/optimize.c Python/pythonrun.c Message-ID: <20080601162903.740E01E4009@bag.python.org> Author: thomas.lee Date: Sun Jun 1 18:29:02 2008 New Revision: 63857 Log: Reverting earlier changes. Need to tread a little more carefully here. Modified: python/branches/tlee-ast-optimize/Include/compile.h python/branches/tlee-ast-optimize/Include/optimize.h python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Python/optimize.c python/branches/tlee-ast-optimize/Python/pythonrun.c Modified: python/branches/tlee-ast-optimize/Include/compile.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/compile.h (original) +++ python/branches/tlee-ast-optimize/Include/compile.h Sun Jun 1 18:29:02 2008 @@ -32,8 +32,6 @@ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, PyCompilerFlags *, PyArena *); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); -PyAPI_FUNC(int) PyAST_BuildSymbolInfo(struct _mod *, PyFutureFeatures**, - struct symtable**, const char*, PyCompilerFlags*); #define ERR_LATE_FUTURE \ "from __future__ imports must occur at the beginning of the file" Modified: python/branches/tlee-ast-optimize/Include/optimize.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/optimize.h (original) +++ python/branches/tlee-ast-optimize/Include/optimize.h Sun Jun 1 18:29:02 2008 @@ -5,8 +5,7 @@ extern "C" { #endif -PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, - PyArena* arena); +PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena); #ifdef __cplusplus }; Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Sun Jun 1 18:29:02 2008 @@ -6,7 +6,6 @@ #include "node.h" #include "code.h" #include "eval.h" -#include "symtable.h" #include "optimize.h" #include @@ -516,8 +515,6 @@ else { PyArena *arena; mod_ty mod; - struct symtable* st; - PyFutureFeatures* future; arena = PyArena_New(); mod = PyAST_obj2mod(cmd, arena, mode); @@ -525,15 +522,9 @@ PyArena_Free(arena); return NULL; } - if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, &cf)) { - PyArena_Free(arena); - return NULL; - } if (!(supplied_flags & PyCF_NO_OPTIMIZE)) { - if (!PyAST_Optimize(&mod, st, arena)) { + if (!PyAST_Optimize(&mod, arena)) { PyArena_Free(arena); - PySymtable_Free(st); - PyObject_Free(future); return NULL; } } Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Sun Jun 1 18:29:02 2008 @@ -180,31 +180,6 @@ static PyCodeObject *assemble(struct compiler *, int addNone); static PyObject *__doc__; -int -PyAST_BuildSymbolInfo(mod_ty mod, PyFutureFeatures** f, struct symtable** st, - const char* filename, PyCompilerFlags* cf) -{ - int merged; - - *f = PyFuture_FromAST(mod, filename); - if (*f == NULL) - return 0; - - merged = (*f)->ff_features | (cf ? cf->cf_flags : 0); - (*f)->ff_features = merged; - - *st = PySymtable_Build(mod, filename, *f); - if (*st == NULL) { - PyObject_Free(*st); - return 0; - } - - if (cf != NULL) - cf->cf_flags = merged; - - return 1; -} - PyObject * _Py_Mangle(PyObject *privateobj, PyObject *ident) { @@ -272,6 +247,7 @@ struct compiler c; PyCodeObject *co = NULL; PyCompilerFlags local_flags; + int merged; if (!__doc__) { __doc__ = PyBytes_InternFromString("__doc__"); @@ -283,13 +259,25 @@ return NULL; c.c_filename = filename; c.c_arena = arena; + c.c_future = PyFuture_FromAST(mod, filename); + if (c.c_future == NULL) + goto finally; if (!flags) { local_flags.cf_flags = 0; flags = &local_flags; } - if (!PyAST_BuildSymbolInfo(mod, &c.c_future, &c.c_st, filename, flags)) - goto finally; - c.c_flags = flags; + merged = c.c_future->ff_features | flags->cf_flags; + c.c_future->ff_features = merged; + flags->cf_flags = merged; + c.c_flags = flags; + c.c_nestlevel = 0; + + c.c_st = PySymtable_Build(mod, filename, c.c_future); + if (c.c_st == NULL) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_SystemError, "no symtable"); + goto finally; + } /* XXX initialize to NULL for now, need to handle */ c.c_encoding = NULL; @@ -312,15 +300,8 @@ return NULL; mod = PyAST_FromNode(n, NULL, filename, arena); if (mod != NULL) { - PyFutureFeatures* future; - struct symtable* st; - - if (PyAST_BuildSymbolInfo(mod, &future, &st, filename, NULL)) { - if (PyAST_Optimize(&mod, st, arena)) { - co = PyAST_Compile(mod, filename, NULL, arena); - } - PyObject_Free(future); - PySymtable_Free(st); + if (PyAST_Optimize(&mod, arena)) { + co = PyAST_Compile(mod, filename, NULL, arena); } } PyArena_Free(arena); @@ -330,10 +311,10 @@ static void compiler_free(struct compiler *c) { - if (c->c_st != NULL) - PySymtable_Free(c->c_st); - if (c->c_future) - PyObject_Free(c->c_future); + if (c->c_st) + PySymtable_Free(c->c_st); + if (c->c_future) + PyObject_Free(c->c_future); Py_DECREF(c->c_stack); } Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 1 18:29:02 2008 @@ -4,22 +4,14 @@ #include "pyerrors.h" #include "node.h" #include "ast.h" -#include "symtable.h" -static int optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_comprehension(comprehension_ty* comp_ptr, - PySTEntryObject* ste, PyArena* arena); -static int optimize_excepthandler(excepthandler_ty* exc_ptr, - PySTEntryObject* ste, PyArena* arena); -static int optimize_keyword(keyword_ty* kwd_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, - PyArena* arena); +static int optimize_expr(expr_ty* expr_ptr, PyArena* arena); +static int optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena); +static int optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena); +static int optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena); +static int optimize_keyword(keyword_ty* kwd_ptr, PyArena* arena); +static int optimize_arguments(arguments_ty* args_ptr, PyArena* arena); +static int optimize_slice(slice_ty* slice_ptr, PyArena* arena); /** * Determine the constant value of a given expression. It's assumed that @@ -141,12 +133,12 @@ * Optimize a sequence of expressions. */ static int -optimize_expr_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_expr_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), arena)) return 0; return 1; } @@ -194,8 +186,7 @@ * Replaces the AST node at `n' with a Pass() node. */ static asdl_seq* -_asdl_seq_replace_with_pass(asdl_seq* seq, int n, int lineno, int col_offset, - PyArena* arena) +_asdl_seq_replace_with_pass(asdl_seq* seq, int n, int lineno, int col_offset, PyArena* arena) { stmt_ty pass = Pass(lineno, col_offset, arena); if (pass == NULL) @@ -208,13 +199,13 @@ * Optimize a sequence of statements. */ static int -optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_stmt_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { stmt_ty stmt = asdl_seq_GET(seq, n); - if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), arena)) return 0; if (stmt->kind == If_kind) { @@ -252,59 +243,57 @@ } static int -optimize_comprehension_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_comprehension_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { comprehension_ty* comp; comp = (comprehension_ty*)&asdl_seq_GET(seq, n); - if (!optimize_comprehension(comp, ste, arena)) + if (!optimize_comprehension(comp, arena)) return 0; } return 1; } static int -optimize_excepthandler_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_excepthandler_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { excepthandler_ty* excepthandler; excepthandler = (excepthandler_ty*)&asdl_seq_GET(seq, n); - if (!optimize_excepthandler(excepthandler, ste, arena)) + if (!optimize_excepthandler(excepthandler, arena)) return 0; } return 1; } static int -optimize_keyword_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_keyword_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), arena)) return 0; return 1; } static int -optimize_slice_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_slice_seq(asdl_seq** seq_ptr, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), arena)) return 0; return 1; } static int -optimize_mod(mod_ty* mod_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_mod(mod_ty* mod_ptr, PyArena* arena) { asdl_seq** body; mod_ty mod = *mod_ptr; @@ -327,7 +316,7 @@ } case Expression_kind: { - return optimize_expr(&mod->v.Expression.body, ste, arena); + return optimize_expr(&mod->v.Expression.body, arena); } default: PyErr_Format(PyExc_ValueError, "unknown mod_ty kind: %d", @@ -335,28 +324,28 @@ return 0; }; - return optimize_stmt_seq(body, ste, arena); + return optimize_stmt_seq(body, arena); } static int -optimize_bool_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_bool_op(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.BoolOp.values, ste, arena)) + if (!optimize_expr_seq(&expr->v.BoolOp.values, arena)) return 0; return 1; } static int -optimize_bin_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_bin_op(expr_ty* expr_ptr, PyArena* arena) { PyObject* left; PyObject* right; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.BinOp.left, ste, arena)) + if (!optimize_expr(&expr->v.BinOp.left, arena)) return 0; - if (!optimize_expr(&expr->v.BinOp.right, ste, arena)) + if (!optimize_expr(&expr->v.BinOp.right, arena)) return 0; /* @@ -483,11 +472,11 @@ } static int -optimize_unary_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_unary_op(expr_ty* expr_ptr, PyArena* arena) { PyObject* operand; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.UnaryOp.operand, ste, arena)) + if (!optimize_expr(&expr->v.UnaryOp.operand, arena)) return 0; operand = _expr_constant_value(expr->v.UnaryOp.operand); if (operand != NULL) { @@ -548,82 +537,76 @@ } static int -optimize_lambda(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_lambda(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - /* XXX: do we need to look up ste again? */ - if (!optimize_expr(&expr->v.Lambda.body, ste, arena)) + if (!optimize_expr(&expr->v.Lambda.body, arena)) return 0; return 1; } -static int optimize_if_exp(expr_ty* expr_ptr, PySTEntryObject* ste, - PyArena* arena) { +static int optimize_if_exp(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.IfExp.test, ste, arena)) + if (!optimize_expr(&expr->v.IfExp.test, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.body, ste, arena)) + if (!optimize_expr(&expr->v.IfExp.body, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.orelse, ste, arena)) + if (!optimize_expr(&expr->v.IfExp.orelse, arena)) return 0; return 1; } -static int optimize_dict(expr_ty* expr_ptr, PySTEntryObject* ste, - PyArena* arena) -{ +static int optimize_dict(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Dict.keys, ste, arena)) + if (!optimize_expr_seq(&expr->v.Dict.keys, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Dict.values, ste, arena)) + if (!optimize_expr_seq(&expr->v.Dict.values, arena)) return 0; return 1; } static int -optimize_comprehension(comprehension_ty* comp_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena) { comprehension_ty comp = *comp_ptr; - if (!optimize_expr(&comp->target, ste, arena)) + if (!optimize_expr(&comp->target, arena)) return 0; - if (!optimize_expr(&comp->iter, ste, arena)) + if (!optimize_expr(&comp->iter, arena)) return 0; - if (!optimize_expr_seq(&comp->ifs, ste, arena)) + if (!optimize_expr_seq(&comp->ifs, arena)) return 0; return 1; } static int -optimize_list_comp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_list_comp(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.ListComp.elt, ste, arena)) + if (!optimize_expr(&expr->v.ListComp.elt, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.ListComp.generators, ste, arena)) + if (!optimize_comprehension_seq(&expr->v.ListComp.generators, arena)) return 0; return 1; } static int -optimize_generator_exp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_generator_exp(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.GeneratorExp.elt, ste, arena)) + if (!optimize_expr(&expr->v.GeneratorExp.elt, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, ste, - arena)) + if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, arena)) return 0; return 1; } static int -optimize_yield(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_yield(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; if (expr->v.Yield.value != NULL) { expr_ty value; - if (!optimize_expr(&expr->v.Yield.value, ste, arena)) + if (!optimize_expr(&expr->v.Yield.value, arena)) return 0; value = expr->v.Yield.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -633,101 +616,100 @@ } static int -optimize_compare(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_compare(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Compare.left, ste, arena)) + if (!optimize_expr(&expr->v.Compare.left, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Compare.comparators, ste, arena)) + if (!optimize_expr_seq(&expr->v.Compare.comparators, arena)) return 0; return 1; } static int -optimize_keyword(keyword_ty* keyword_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_keyword(keyword_ty* keyword_ptr, PyArena* arena) { keyword_ty keyword = *keyword_ptr; - if (!optimize_expr(&keyword->value, ste, arena)) + if (!optimize_expr(&keyword->value, arena)) return 0; return 1; } static int -optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_arguments(arguments_ty* args_ptr, PyArena* arena) { arguments_ty args = *args_ptr; - if (!optimize_expr_seq(&args->args, ste, arena)) + if (!optimize_expr_seq(&args->args, arena)) return 0; - if (!optimize_expr_seq(&args->defaults, ste, arena)) + if (!optimize_expr_seq(&args->defaults, arena)) return 0; return 1; } static int -optimize_call(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_call(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Call.func, ste, arena)) + if (!optimize_expr(&expr->v.Call.func, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Call.args, ste, arena)) + if (!optimize_expr_seq(&expr->v.Call.args, arena)) return 0; - if (!optimize_keyword_seq(&expr->v.Call.keywords, ste, arena)) + if (!optimize_keyword_seq(&expr->v.Call.keywords, arena)) return 0; if (expr->v.Call.starargs != NULL) - if (!optimize_expr(&expr->v.Call.starargs, ste, arena)) + if (!optimize_expr(&expr->v.Call.starargs, arena)) return 0; if (expr->v.Call.kwargs != NULL) - if (!optimize_expr(&expr->v.Call.kwargs, ste, arena)) + if (!optimize_expr(&expr->v.Call.kwargs, arena)) return 0; return 1; } static int -optimize_repr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_repr(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Repr.value, ste, arena)) + if (!optimize_expr(&expr->v.Repr.value, arena)) return 0; return 1; } static int -optimize_attribute(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_attribute(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Attribute.value, ste, arena)) + if (!optimize_expr(&expr->v.Attribute.value, arena)) return 0; return 1; } static int -optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_slice(slice_ty* slice_ptr, PyArena* arena) { slice_ty slice = *slice_ptr; switch (slice->kind) { case Slice_kind: { if (slice->v.Slice.lower != NULL) - if (!optimize_expr(&slice->v.Slice.lower, ste, arena)) + if (!optimize_expr(&slice->v.Slice.lower, arena)) return 0; if (slice->v.Slice.upper != NULL) - if (!optimize_expr(&slice->v.Slice.upper, ste, arena)) + if (!optimize_expr(&slice->v.Slice.upper, arena)) return 0; if (slice->v.Slice.step != NULL) - if (!optimize_expr(&slice->v.Slice.step, ste, arena)) + if (!optimize_expr(&slice->v.Slice.step, arena)) return 0; break; } case ExtSlice_kind: { - if (!optimize_slice_seq(&slice->v.ExtSlice.dims, ste, arena)) + if (!optimize_slice_seq(&slice->v.ExtSlice.dims, arena)) return 0; break; } case Index_kind: { - if (!optimize_expr(&slice->v.Index.value, ste, arena)) + if (!optimize_expr(&slice->v.Index.value, arena)) return 0; break; } @@ -744,21 +726,21 @@ } static int -optimize_subscript(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_subscript(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Subscript.value, ste, arena)) + if (!optimize_expr(&expr->v.Subscript.value, arena)) return 0; - if (!optimize_slice(&expr->v.Subscript.slice, ste, arena)) + if (!optimize_slice(&expr->v.Subscript.slice, arena)) return 0; return 1; } static int -optimize_tuple(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_tuple(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Tuple.elts, ste, arena)) + if (!optimize_expr_seq(&expr->v.Tuple.elts, arena)) return 0; if (_is_sequence_of_constants(expr->v.Tuple.elts)) { @@ -774,7 +756,7 @@ } static int -optimize_name(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_name(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; const char* id = PyString_AS_STRING(expr->v.Name.id); @@ -801,77 +783,77 @@ } static int -optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_expr(expr_ty* expr_ptr, PyArena* arena) { expr_ty expr = *expr_ptr; switch (expr->kind) { case BoolOp_kind: { - return optimize_bool_op(expr_ptr, ste, arena); + return optimize_bool_op(expr_ptr, arena); } case BinOp_kind: { - return optimize_bin_op(expr_ptr, ste, arena); + return optimize_bin_op(expr_ptr, arena); } case UnaryOp_kind: { - return optimize_unary_op(expr_ptr, ste, arena); + return optimize_unary_op(expr_ptr, arena); } case Lambda_kind: { - return optimize_lambda(expr_ptr, ste, arena); + return optimize_lambda(expr_ptr, arena); } case IfExp_kind: { - return optimize_if_exp(expr_ptr, ste, arena); + return optimize_if_exp(expr_ptr, arena); } case Dict_kind: { - return optimize_dict(expr_ptr, ste, arena); + return optimize_dict(expr_ptr, arena); } case ListComp_kind: { - return optimize_list_comp(expr_ptr, ste, arena); + return optimize_list_comp(expr_ptr, arena); } case GeneratorExp_kind: { - return optimize_generator_exp(expr_ptr, ste, arena); + return optimize_generator_exp(expr_ptr, arena); } case Yield_kind: { - return optimize_yield(expr_ptr, ste, arena); + return optimize_yield(expr_ptr, arena); } case Compare_kind: { - return optimize_compare(expr_ptr, ste, arena); + return optimize_compare(expr_ptr, arena); } case Call_kind: { - return optimize_call(expr_ptr, ste, arena); + return optimize_call(expr_ptr, arena); } case Repr_kind: { - return optimize_repr(expr_ptr, ste, arena); + return optimize_repr(expr_ptr, arena); } case Attribute_kind: { - return optimize_attribute(expr_ptr, ste, arena); + return optimize_attribute(expr_ptr, arena); } case Subscript_kind: { - return optimize_subscript(expr_ptr, ste, arena); + return optimize_subscript(expr_ptr, arena); } case List_kind: { - return optimize_expr_seq(&expr->v.List.elts, ste, arena); + return optimize_expr_seq(&expr->v.List.elts, arena); } case Tuple_kind: { - return optimize_tuple(expr_ptr, ste, arena); + return optimize_tuple(expr_ptr, arena); } case Name_kind: { - return optimize_name(expr_ptr, ste, arena); + return optimize_name(expr_ptr, arena); } case Num_kind: case Str_kind: @@ -887,38 +869,38 @@ } static int -optimize_function_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_function_def(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_arguments(&stmt->v.FunctionDef.args, ste, arena)) + if (!optimize_arguments(&stmt->v.FunctionDef.args, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, ste, arena)) + if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, arena)) return 0; return 1; } static int -optimize_class_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_class_def(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.ClassDef.bases, ste, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.bases, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, ste, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.ClassDef.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.ClassDef.body, arena)) return 0; return 1; } static int -optimize_return(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_return(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Return.value != NULL) { expr_ty value; - if (!optimize_expr(&stmt->v.Return.value, ste, arena)) + if (!optimize_expr(&stmt->v.Return.value, arena)) return 0; value = stmt->v.Return.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -928,87 +910,87 @@ } static int -optimize_delete(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_delete(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Delete.targets, ste, arena)) + if (!optimize_expr_seq(&stmt->v.Delete.targets, arena)) return 0; return 1; } static int -optimize_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_assign(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Assign.targets, ste, arena)) + if (!optimize_expr_seq(&stmt->v.Assign.targets, arena)) return 0; - if (!optimize_expr(&stmt->v.Assign.value, ste, arena)) + if (!optimize_expr(&stmt->v.Assign.value, arena)) return 0; return 1; } static int -optimize_aug_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_aug_assign(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.AugAssign.target, ste, arena)) + if (!optimize_expr(&stmt->v.AugAssign.target, arena)) return 0; - if (!optimize_expr(&stmt->v.AugAssign.value, ste, arena)) + if (!optimize_expr(&stmt->v.AugAssign.value, arena)) return 0; return 1; } static int -optimize_print(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_print(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Print.dest != NULL) - if (!optimize_expr(&stmt->v.Print.dest, ste, arena)) + if (!optimize_expr(&stmt->v.Print.dest, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.Print.values, ste, arena)) + if (!optimize_expr_seq(&stmt->v.Print.values, arena)) return 0; return 1; } static int -optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_for(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.target, ste, arena)) + if (!optimize_expr(&stmt->v.For.target, arena)) return 0; - if (!optimize_expr(&stmt->v.For.iter, ste, arena)) + if (!optimize_expr(&stmt->v.For.iter, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.For.body, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.orelse, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.For.orelse, arena)) return 0; return 1; } static int -optimize_while(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_while(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.While.test, ste, arena)) + if (!optimize_expr(&stmt->v.While.test, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.While.body, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.orelse, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.While.orelse, arena)) return 0; return 1; } static int -optimize_if(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_if(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.If.test, ste, arena)) + if (!optimize_expr(&stmt->v.If.test, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.If.body, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.orelse, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.If.orelse, arena)) return 0; if (stmt->v.If.test->kind == UnaryOp_kind && @@ -1038,187 +1020,174 @@ } static int -optimize_with(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_with(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.With.context_expr, ste, arena)) + if (!optimize_expr(&stmt->v.With.context_expr, arena)) return 0; if (stmt->v.With.optional_vars != NULL) - if (!optimize_expr(&stmt->v.With.optional_vars, ste, arena)) + if (!optimize_expr(&stmt->v.With.optional_vars, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.With.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.With.body, arena)) return 0; return 1; } static int -optimize_raise(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_raise(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Raise.type != NULL) - if (!optimize_expr(&stmt->v.Raise.type, ste, arena)) + if (!optimize_expr(&stmt->v.Raise.type, arena)) return 0; if (stmt->v.Raise.inst != NULL) - if (!optimize_expr(&stmt->v.Raise.inst, ste, arena)) + if (!optimize_expr(&stmt->v.Raise.inst, arena)) return 0; if (stmt->v.Raise.tback != NULL) - if (!optimize_expr(&stmt->v.Raise.tback, ste, arena)) + if (!optimize_expr(&stmt->v.Raise.tback, arena)) return 0; return 1; } static int -optimize_excepthandler(excepthandler_ty* exc_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena) { excepthandler_ty exc = *exc_ptr; if (exc->v.ExceptHandler.type != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.type, ste, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.type, arena)) return 0; if (exc->v.ExceptHandler.name != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.name, ste, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.name, arena)) return 0; - if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, ste, arena)) + if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, arena)) return 0; return 1; } static int -optimize_try_except(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_try_except(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryExcept.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.body, arena)) return 0; - if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, ste, arena)) + if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, arena)) return 0; return 1; } static int -optimize_try_finally(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_try_finally(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryFinally.body, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.body, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, ste, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, arena)) return 0; return 1; } static int -optimize_assert(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_assert(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Assert.test, ste, arena)) + if (!optimize_expr(&stmt->v.Assert.test, arena)) return 0; if (stmt->v.Assert.msg != NULL) - if (!optimize_expr(&stmt->v.Assert.msg, ste, arena)) + if (!optimize_expr(&stmt->v.Assert.msg, arena)) return 0; return 1; } static int -optimize_exec(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_exec(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Exec.body, ste, arena)) + if (!optimize_expr(&stmt->v.Exec.body, arena)) return 0; if (stmt->v.Exec.globals != NULL) - if (!optimize_expr(&stmt->v.Exec.globals, ste, arena)) + if (!optimize_expr(&stmt->v.Exec.globals, arena)) return 0; if (stmt->v.Exec.locals != NULL) - if (!optimize_expr(&stmt->v.Exec.locals, ste, arena)) + if (!optimize_expr(&stmt->v.Exec.locals, arena)) return 0; return 1; } static int -optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena) { stmt_ty stmt = *stmt_ptr; switch (stmt->kind) { case FunctionDef_kind: { - int rc; - ste = PySymtable_Lookup(ste->ste_table, *stmt_ptr); - if (ste == NULL) - return 0; - rc = optimize_function_def(stmt_ptr, ste, arena); - Py_DECREF(ste); - return rc; + return optimize_function_def(stmt_ptr, arena); } case ClassDef_kind: { - int rc; - ste = PySymtable_Lookup(ste->ste_table, *stmt_ptr); - if (ste == NULL) - return 0; - rc = optimize_class_def(stmt_ptr, ste, arena); - Py_DECREF(ste); - return rc; + return optimize_class_def(stmt_ptr, arena); } case Return_kind: { - return optimize_return(stmt_ptr, ste, arena); + return optimize_return(stmt_ptr, arena); } case Delete_kind: { - return optimize_delete(stmt_ptr, ste, arena); + return optimize_delete(stmt_ptr, arena); } case Assign_kind: { - return optimize_assign(stmt_ptr, ste, arena); + return optimize_assign(stmt_ptr, arena); } case AugAssign_kind: { - return optimize_aug_assign(stmt_ptr, ste, arena); + return optimize_aug_assign(stmt_ptr, arena); } case Print_kind: { - return optimize_print(stmt_ptr, ste, arena); + return optimize_print(stmt_ptr, arena); } case For_kind: { - return optimize_for(stmt_ptr, ste, arena); + return optimize_for(stmt_ptr, arena); } case While_kind: { - return optimize_while(stmt_ptr, ste, arena); + return optimize_while(stmt_ptr, arena); } case If_kind: { - return optimize_if(stmt_ptr, ste, arena); + return optimize_if(stmt_ptr, arena); } case With_kind: { - return optimize_with(stmt_ptr, ste, arena); + return optimize_with(stmt_ptr, arena); } case Raise_kind: { - return optimize_raise(stmt_ptr, ste, arena); + return optimize_raise(stmt_ptr, arena); } case TryExcept_kind: { - return optimize_try_except(stmt_ptr, ste, arena); + return optimize_try_except(stmt_ptr, arena); } case TryFinally_kind: { - return optimize_try_finally(stmt_ptr, ste, arena); + return optimize_try_finally(stmt_ptr, arena); } case Assert_kind: { - return optimize_assert(stmt_ptr, ste, arena); + return optimize_assert(stmt_ptr, arena); } case Exec_kind: { - return optimize_exec(stmt_ptr, ste, arena); + return optimize_exec(stmt_ptr, arena); } case Expr_kind: { - return optimize_expr(&stmt->v.Expr.value, ste, arena); + return optimize_expr(&stmt->v.Expr.value, arena); } case Import_kind: case ImportFrom_kind: @@ -1242,14 +1211,8 @@ * Optimize an AST. */ int -PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, PyArena* arena) +PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena) { - int rc; - PySTEntryObject* ste = PySymtable_Lookup(st, *mod_ptr); - if (ste == NULL) - return 0; - rc = optimize_mod(mod_ptr, ste, arena); - Py_DECREF(ste); - return rc; + return optimize_mod(mod_ptr, arena); } Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Sun Jun 1 18:29:02 2008 @@ -1431,20 +1431,9 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) { - PyFutureFeatures* future; - struct symtable* st; - - if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, flags)) { - if (!PyAST_Optimize(&mod, st, arena)) { - PyObject_Free(future); - PySymtable_Free(st); - return NULL; - } - PyObject_Free(future); - PySymtable_Free(st); - } - } + if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) + if (!PyAST_Optimize(&mod, arena)) + return NULL; return mod; } else { @@ -1470,20 +1459,9 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) { - PyFutureFeatures* future; - struct symtable* st; - - if (!PyAST_BuildSymbolInfo(mod, &future, &st, filename, flags)) { - if (!PyAST_Optimize(&mod, st, arena)) { - PySymtable_Free(st); - PyObject_Free(future); - return NULL; - } - PySymtable_Free(st); - PyObject_Free(future); - } - } + if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) + if (!PyAST_Optimize(&mod, arena)) + return NULL; return mod; } else { From buildbot at python.org Sun Jun 1 18:35:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 16:35:00 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080601163500.EA5841E4009@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/75 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 18:41:32 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 18:41:32 +0200 (CEST) Subject: [Python-checkins] r63858 - in python/trunk/Doc: Makefile README.txt Message-ID: <20080601164132.515D11E400F@bag.python.org> Author: georg.brandl Date: Sun Jun 1 18:41:31 2008 New Revision: 63858 Log: Add plain text make target. Modified: python/trunk/Doc/Makefile python/trunk/Doc/README.txt Modified: python/trunk/Doc/Makefile ============================================================================== --- python/trunk/Doc/Makefile (original) +++ python/trunk/Doc/Makefile Sun Jun 1 18:41:31 2008 @@ -21,6 +21,7 @@ @echo " web to make file usable by Sphinx.web" @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " text to make plain text files" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " coverage to check documentation coverage for library and C API" @@ -75,6 +76,10 @@ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." +text: BUILDER = text +text: build + @echo "Build finished; the text files are in build/text." + changes: BUILDER = changes changes: build @echo "The overview file is in build/changes." Modified: python/trunk/Doc/README.txt ============================================================================== --- python/trunk/Doc/README.txt (original) +++ python/trunk/Doc/README.txt Sun Jun 1 18:41:31 2008 @@ -51,6 +51,8 @@ * "latex", which builds LaTeX source files that can be run with "pdflatex" to produce PDF documents. + * "text", which builds a plain text file for each source file. + * "linkcheck", which checks all external references to see whether they are broken, redirected or malformed, and outputs this information to stdout as well as a plain-text (.txt) file. From python-checkins at python.org Sun Jun 1 18:42:16 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 18:42:16 +0200 (CEST) Subject: [Python-checkins] r63859 - in python/trunk: Lib/test/test_sys.py Objects/bytesobject.c Objects/dictobject.c Objects/listobject.c Objects/longobject.c Objects/typeobject.c Python/sysmodule.c Message-ID: <20080601164216.DD4371E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 18:42:16 2008 New Revision: 63859 Log: Some style nits. Also clarify in the docstrings what __sizeof__ does. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Objects/bytesobject.c python/trunk/Objects/dictobject.c python/trunk/Objects/listobject.c python/trunk/Objects/longobject.c python/trunk/Objects/typeobject.c python/trunk/Python/sysmodule.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Sun Jun 1 18:42:16 2008 @@ -419,7 +419,7 @@ def tearDown(self): self.file.close() - os.remove(test.test_support.TESTFN) + test.test_support.unlink(test.test_support.TESTFN) def check_sizeof(self, o, size): result = sys.getsizeof(o) @@ -435,13 +435,13 @@ return value def test_align(self): - self.assertTrue( (self.align(0) % self.p) == 0 ) - self.assertTrue( (self.align(1) % self.p) == 0 ) - self.assertTrue( (self.align(3) % self.p) == 0 ) - self.assertTrue( (self.align(4) % self.p) == 0 ) - self.assertTrue( (self.align(7) % self.p) == 0 ) - self.assertTrue( (self.align(8) % self.p) == 0 ) - self.assertTrue( (self.align(9) % self.p) == 0 ) + self.assertEqual(self.align(0) % self.p, 0) + self.assertEqual(self.align(1) % self.p, 0) + self.assertEqual(self.align(3) % self.p, 0) + self.assertEqual(self.align(4) % self.p, 0) + self.assertEqual(self.align(7) % self.p, 0) + self.assertEqual(self.align(8) % self.p, 0) + self.assertEqual(self.align(9) % self.p, 0) def test_standardtypes(self): i = self.i @@ -507,7 +507,7 @@ self.check_sizeof(abs, h + 3*p) # module self.check_sizeof(unittest, h + p) - # xange + # xrange self.check_sizeof(xrange(1), h + 3*p) # slice self.check_sizeof(slice(0), h + 3*p) @@ -520,8 +520,8 @@ # type (PyTypeObject + PyNumberMethods + PyMappingMethods + # PySequenceMethods + PyBufferProcs) len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p - self.check_sizeof(class_newstyle, h + \ - len_typeobject + 42*p + 10*p + 3*p + 6*p) + self.check_sizeof(class_newstyle, + h + len_typeobject + 42*p + 10*p + 3*p + 6*p) def test_specialtypes(self): Modified: python/trunk/Objects/bytesobject.c ============================================================================== --- python/trunk/Objects/bytesobject.c (original) +++ python/trunk/Objects/bytesobject.c Sun Jun 1 18:42:16 2008 @@ -3918,7 +3918,7 @@ } PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in bytes"); +"S.__sizeof__() -> size of S in memory, in bytes"); static PyObject * string_sizeof(PyBytesObject *v) Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Sun Jun 1 18:42:16 2008 @@ -2052,7 +2052,7 @@ PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); PyDoc_STRVAR(sizeof__doc__, -"D.__sizeof__() -> size of D in bytes"); +"D.__sizeof__() -> size of D in memory, in bytes"); PyDoc_STRVAR(get__doc__, "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Sun Jun 1 18:42:16 2008 @@ -2437,7 +2437,7 @@ PyDoc_STRVAR(reversed_doc, "L.__reversed__() -- return a reverse iterator over the list"); PyDoc_STRVAR(sizeof_doc, -"L.__sizeof__() -- size of L in bytes"); +"L.__sizeof__() -- size of L in memory, in bytes"); PyDoc_STRVAR(append_doc, "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Sun Jun 1 18:42:16 2008 @@ -3467,7 +3467,7 @@ {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, {"__format__", (PyCFunction)long__format__, METH_VARARGS}, {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, - "Returns size in bytes"}, + "Returns size in memory, in bytes"}, {NULL, NULL} /* sentinel */ }; Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Sun Jun 1 18:42:16 2008 @@ -3421,7 +3421,7 @@ {"__format__", object_format, METH_VARARGS, PyDoc_STR("default object formatter")}, {"__sizeof__", object_sizeof, METH_NOARGS, - PyDoc_STR("__sizeof__() -> size of object in bytes")}, + PyDoc_STR("__sizeof__() -> size of object in memory, in bytes")}, {0} }; Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Sun Jun 1 18:42:16 2008 @@ -664,9 +664,9 @@ return PyObject_CallFunctionObjArgs(method, args, NULL); } /* Instance of old-style classes */ - else if(PyInstance_Check(args)) + else if (PyInstance_Check(args)) return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); - /* Old-style class */ + /* Old-style classes */ else if (PyClass_Check(args)) return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); else From buildbot at python.org Sun Jun 1 18:42:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 16:42:21 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080601164221.505DF1E4009@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/3739 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 18:44:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 16:44:24 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080601164424.E09331E4009@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/939 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_descrtut make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 18:45:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 16:45:02 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080601164502.BBBCF1E4009@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/373 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: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 18:57:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 16:57:31 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080601165731.246B31E4009@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/1504 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: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 19:05:57 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 19:05:57 +0200 (CEST) Subject: [Python-checkins] r63860 - python/trunk/Lib/test/test_descrtut.py Message-ID: <20080601170557.278A31E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 1 19:05:56 2008 New Revision: 63860 Log: Fix test_descrtut. Modified: python/trunk/Lib/test/test_descrtut.py Modified: python/trunk/Lib/test/test_descrtut.py ============================================================================== --- python/trunk/Lib/test/test_descrtut.py (original) +++ python/trunk/Lib/test/test_descrtut.py Sun Jun 1 19:05:56 2008 @@ -208,6 +208,7 @@ '__setattr__', '__setitem__', '__setslice__', + '__sizeof__', '__str__', '__subclasshook__', 'append', From buildbot at python.org Sun Jun 1 19:10:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 17:10:45 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080601171045.8EA7B1E4009@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/40 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 19:11:09 2008 From: python-checkins at python.org (robert.schuppenies) Date: Sun, 1 Jun 2008 19:11:09 +0200 (CEST) Subject: [Python-checkins] r63861 - python/trunk/Lib/test/test_sys.py Message-ID: <20080601171109.978631E4009@bag.python.org> Author: robert.schuppenies Date: Sun Jun 1 19:11:09 2008 New Revision: 63861 Log: Fix test_sys. Modified: python/trunk/Lib/test/test_sys.py Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Sun Jun 1 19:11:09 2008 @@ -452,8 +452,6 @@ self.check_sizeof(True, h + l) # buffer self.check_sizeof(buffer(''), h + 2*p + 2*l + self.align(i) +l) - # bytearray - self.check_sizeof(bytes(), h + self.align(i) + l + p) # cell def get_cell(): x = 42 From buildbot at python.org Sun Jun 1 19:17:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 17:17:17 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080601171717.A3D7B1E4009@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3474 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 19:30:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 17:30:51 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080601173051.462181E4009@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3140 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 19:50:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 17:50:01 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu trunk Message-ID: <20080601175001.3C5611E4009@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%20trunk/builds/624 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Jun 1 20:38:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 18:38:15 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20080601183815.53CBD1E400A@bag.python.org> The Buildbot has detected a new failure of sparc Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%20trunk/builds/467 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_descrtut test_sys ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/trunk.klose-debian-sparc/build/Lib/test/test_sys.py", line 456, in test_standardtypes self.check_sizeof(bytes(), h + self.align(i) + l + p) File "/home/pybot/buildarea-sid/trunk.klose-debian-sparc/build/Lib/test/test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 32, expected 28 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 21:01:25 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 1 Jun 2008 21:01:25 +0200 (CEST) Subject: [Python-checkins] r63863 - in python/trunk/Tools: README bgen/README Message-ID: <20080601190125.7BB821E4019@bag.python.org> Author: benjamin.peterson Date: Sun Jun 1 21:01:25 2008 New Revision: 63863 Log: add a warning about bgen being removed Modified: python/trunk/Tools/README python/trunk/Tools/bgen/README Modified: python/trunk/Tools/README ============================================================================== --- python/trunk/Tools/README (original) +++ python/trunk/Tools/README Sun Jun 1 21:01:25 2008 @@ -9,6 +9,7 @@ bgen Generate complete extension modules from a description. Still under development! + WARNING: bgen has been removed in 3.0 compiler Tools used to maintain the compiler package in the standard library. Modified: python/trunk/Tools/bgen/README ============================================================================== --- python/trunk/Tools/bgen/README (original) +++ python/trunk/Tools/bgen/README Sun Jun 1 21:01:25 2008 @@ -5,3 +5,5 @@ complete source code for Python extension module. For examples of its use, see the Mac Python source distribution (available separately from the Python ftp archives). Note that BGEN is not Mac specific! + +WARNING: bgen has been removed in 3.0. From python-checkins at python.org Sun Jun 1 21:24:36 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 21:24:36 +0200 (CEST) Subject: [Python-checkins] r63865 - python/trunk/Tools/README Message-ID: <20080601192436.7446B1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 1 21:24:36 2008 New Revision: 63865 Log: Spaces vs. tabs. Modified: python/trunk/Tools/README Modified: python/trunk/Tools/README ============================================================================== --- python/trunk/Tools/README (original) +++ python/trunk/Tools/README Sun Jun 1 21:24:36 2008 @@ -9,7 +9,7 @@ bgen Generate complete extension modules from a description. Still under development! - WARNING: bgen has been removed in 3.0 + WARNING: bgen has been removed in 3.0. compiler Tools used to maintain the compiler package in the standard library. From buildbot at python.org Sun Jun 1 21:45:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 19:45:20 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080601194520.620C81E400A@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/429 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 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_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From okkotonushi at googlemail.com Sun Jun 1 21:50:48 2008 From: okkotonushi at googlemail.com (Robert Schuppenies) Date: Sun, 01 Jun 2008 21:50:48 +0200 Subject: [Python-checkins] r63860 - python/trunk/Lib/test/test_descrtut.py In-Reply-To: <20080601170557.278A31E4009@bag.python.org> References: <20080601170557.278A31E4009@bag.python.org> Message-ID: <4842FD98.9050905@gmail.com> Thanks for fixing this. I wasn't aware of this test and neglected it. Also thanks for the style nits. So much for my first checkin :) I start to favor the checkin mailing list. Very interesting. cheers, robert From buildbot at python.org Sun Jun 1 21:53:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 19:53:46 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080601195346.600B21E4015@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/66 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 21:56:09 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 1 Jun 2008 21:56:09 +0200 (CEST) Subject: [Python-checkins] r63868 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080601195609.793A61E400A@bag.python.org> Author: guilherme.polo Date: Sun Jun 1 21:56:09 2008 New Revision: 63868 Log: Fixed an option name at ttk.rst; Updated method insert of Treeview so it accept values other than strings. Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Sun Jun 1 21:56:09 2008 @@ -695,7 +695,7 @@ +----------------+--------------------------------------------------------+ | option | description | +================+========================================================+ - | column | A list of column identifiers, specifying the number of | + | columns | A list of column identifiers, specifying the number of | | | columns and their names. | +----------------+--------------------------------------------------------+ | displaycolumns | A list of column identifiers (either symbolic or | Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sun Jun 1 21:56:09 2008 @@ -1185,6 +1185,7 @@ opts, values = _format_optdict(kw, ignore='values'), kw.get('values') # values may need special formatting if any value contains a space if values: + values = map(str, values) opts += ("-values", ' '.join(('{%s}' if ' ' in v else '%s') % v for v in values)) if iid: Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sun Jun 1 21:56:09 2008 @@ -1185,6 +1185,7 @@ opts, values = _format_optdict(kw, ignore='values'), kw.get('values') # values may need special formatting if any value contains a space if values: + values = map(str, values) opts += ("-values", ' '.join(('{%s}' if ' ' in v else '%s') % v for v in values)) if iid: From python-checkins at python.org Sun Jun 1 22:25:48 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 22:25:48 +0200 (CEST) Subject: [Python-checkins] r63870 - doctools/trunk/sphinx/builder.py Message-ID: <20080601202548.F29FA1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 1 22:25:48 2008 New Revision: 63870 Log: Add a default for colorfunc. Modified: doctools/trunk/sphinx/builder.py Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sun Jun 1 22:25:48 2008 @@ -107,7 +107,7 @@ """ raise NotImplementedError - def status_iterator(self, iterable, summary, colorfunc): + def status_iterator(self, iterable, summary, colorfunc=darkgreen): l = -1 for item in iterable: if l == -1: From python-checkins at python.org Sun Jun 1 22:33:58 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 22:33:58 +0200 (CEST) Subject: [Python-checkins] r63871 - in python/trunk: Doc/Makefile Doc/README.txt Doc/tools/sphinxext/pyspecific.py Lib/pydoc.py Lib/pydoc_topics.py Message-ID: <20080601203358.09B8B1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 1 22:33:55 2008 New Revision: 63871 Log: Generate pydoc's topic help from the reST docs via Sphinx' new text writer. Added: python/trunk/Lib/pydoc_topics.py Modified: python/trunk/Doc/Makefile python/trunk/Doc/README.txt python/trunk/Doc/tools/sphinxext/pyspecific.py python/trunk/Lib/pydoc.py Modified: python/trunk/Doc/Makefile ============================================================================== --- python/trunk/Doc/Makefile (original) +++ python/trunk/Doc/Makefile Sun Jun 1 22:33:55 2008 @@ -98,6 +98,11 @@ @echo "Testing of doctests in the sources finished, look at the " \ "results in build/doctest/output.txt" +pydoc-topics: BUILDER = pydoc-topics +pydoc-topics: build + @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ + "into the Lib/ directory" + clean: -rm -rf build/* -rm -rf tools/sphinx Modified: python/trunk/Doc/README.txt ============================================================================== --- python/trunk/Doc/README.txt (original) +++ python/trunk/Doc/README.txt Sun Jun 1 22:33:55 2008 @@ -64,6 +64,11 @@ * "coverage", which builds a coverage overview for standard library modules and C API. + * "pydoc-topics", which builds a Python module containing a dictionary + with plain text documentation for the labels defined in + `tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic + and keyword help. + A "make update" updates the Subversion checkouts in `tools/`. Modified: python/trunk/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/trunk/Doc/tools/sphinxext/pyspecific.py (original) +++ python/trunk/Doc/tools/sphinxext/pyspecific.py Sun Jun 1 22:33:55 2008 @@ -20,5 +20,71 @@ return [refnode], [] +# Support for building "topic help" for pydoc + +pydoc_topic_labels = [ + 'assert', 'assignment', 'atom-identifiers', 'atom-literals', + 'attribute-access', 'attribute-references', 'augassign', 'binary', + 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', + 'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans', + 'break', 'callable-types', 'calls', 'class', 'coercion-rules', + 'comparisons', 'compound', 'context-managers', 'continue', 'conversions', + 'customization', 'debugger', 'del', 'dict', 'dynamic-features', 'else', + 'exceptions', 'exec', 'execmodel', 'exprlists', 'floating', 'for', + 'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if', + 'imaginary', 'import', 'in', 'integers', 'lambda', 'lists', 'naming', + 'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power', + 'print', 'raise', 'return', 'sequence-methods', 'sequence-types', + 'shifting', 'slicings', 'specialattrs', 'specialnames', + 'string-conversions', 'string-methods', 'strings', 'subscriptions', 'truth', + 'try', 'types', 'typesfunctions', 'typesmapping', 'typesmethods', + 'typesmodules', 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', + 'yield' +] + +from os import path +from time import asctime +from pprint import pformat +from docutils.io import StringOutput +from docutils.utils import new_document +from sphinx.builder import Builder +from sphinx.textwriter import TextWriter + +class PydocTopicsBuilder(Builder): + name = 'pydoc-topics' + + def init(self): + self.topics = {} + + def get_outdated_docs(self): + return 'all pydoc topics' + + def get_target_uri(self, docname, typ=None): + return '' # no URIs + + def write(self, *ignored): + writer = TextWriter(self) + for label in self.status_iterator(pydoc_topic_labels, 'building topics... '): + if label not in self.env.labels: + self.warn('label %r not in documentation' % label) + continue + docname, labelid, sectname = self.env.labels[label] + doctree = self.env.get_and_resolve_doctree(docname, self) + document = new_document('
') + document.append(doctree.ids[labelid]) + destination = StringOutput(encoding='utf-8') + writer.write(document, destination) + self.topics[label] = writer.output + + def finish(self): + f = open(path.join(self.outdir, 'pydoc_topics.py'), 'w') + try: + f.write('# Autogenerated by Sphinx on %s\n' % asctime()) + f.write('topics = ' + pformat(self.topics) + '\n') + finally: + f.close() + + def setup(app): app.add_role('issue', issue_role) + app.add_builder(PydocTopicsBuilder) Modified: python/trunk/Lib/pydoc.py ============================================================================== --- python/trunk/Lib/pydoc.py (original) +++ python/trunk/Lib/pydoc.py Sun Jun 1 22:33:55 2008 @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: Latin-1 -*- +# -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online @@ -1523,142 +1523,149 @@ return class Helper: + + # These dictionaries map a topic name to either an alias, or a tuple + # (label, seealso-items). The "label" is the label of the corresponding + # section in the .rst file under Doc/ and an index into the dictionary + # in pydoc_topics.py. + # + # CAUTION: if you change one of these dictionaries, be sure to adapt the + # list of needed labels in Doc/tools/sphinxext/pyspecific.py and + # regenerate the pydoc_topics.py file by running + # make pydoc-topics + # in Doc/ and copying the output file into the Lib/ directory. + keywords = { 'and': 'BOOLEAN', 'as': 'with', - 'assert': ('ref/assert', ''), - 'break': ('ref/break', 'while for'), - 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), - 'continue': ('ref/continue', 'while for'), - 'def': ('ref/function', ''), - 'del': ('ref/del', 'BASICMETHODS'), + 'assert': ('assert', ''), + 'break': ('break', 'while for'), + 'class': ('class', 'CLASSES SPECIALMETHODS'), + 'continue': ('continue', 'while for'), + 'def': ('function', ''), + 'del': ('del', 'BASICMETHODS'), 'elif': 'if', - 'else': ('ref/if', 'while for'), - 'except': 'try', - 'exec': ('ref/exec', ''), - 'finally': 'try', - 'for': ('ref/for', 'break continue while'), - 'from': 'import', - 'global': ('ref/global', 'NAMESPACES'), - 'if': ('ref/if', 'TRUTHVALUE'), - 'import': ('ref/import', 'MODULES'), - 'in': ('ref/comparisons', 'SEQUENCEMETHODS2'), + 'else': ('else', 'while for'), + 'except': 'except', + 'exec': ('exec', ''), + 'finally': 'finally', + 'for': ('for', 'break continue while'), + 'from': 'from', + 'global': ('global', 'NAMESPACES'), + 'if': ('if', 'TRUTHVALUE'), + 'import': ('import', 'MODULES'), + 'in': ('in', 'SEQUENCEMETHODS2'), 'is': 'COMPARISON', - 'lambda': ('ref/lambdas', 'FUNCTIONS'), + 'lambda': ('lambda', 'FUNCTIONS'), 'not': 'BOOLEAN', 'or': 'BOOLEAN', - 'pass': ('ref/pass', ''), - 'print': ('ref/print', ''), - 'raise': ('ref/raise', 'EXCEPTIONS'), - 'return': ('ref/return', 'FUNCTIONS'), - 'try': ('ref/try', 'EXCEPTIONS'), - 'while': ('ref/while', 'break continue if TRUTHVALUE'), - 'with': ('ref/with', 'CONTEXTMANAGERS EXCEPTIONS yield'), - 'yield': ('ref/yield', ''), + 'pass': ('pass', ''), + 'print': ('print', ''), + 'raise': ('raise', 'EXCEPTIONS'), + 'return': ('return', 'FUNCTIONS'), + 'try': ('try', 'EXCEPTIONS'), + 'while': ('while', 'break continue if TRUTHVALUE'), + 'with': ('with', 'CONTEXTMANAGERS EXCEPTIONS yield'), + 'yield': ('yield', ''), } topics = { - 'TYPES': ('ref/types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), - 'STRINGS': ('ref/strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), - 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), - 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), - 'UNICODE': ('ref/strings', 'encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES'), - 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), - 'INTEGER': ('ref/integers', 'int range'), - 'FLOAT': ('ref/floating', 'float math'), - 'COMPLEX': ('ref/imaginary', 'complex cmath'), - 'SEQUENCES': ('lib/typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), + 'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS ' + 'FUNCTIONS CLASSES MODULES FILES inspect'), + 'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING ' + 'TYPES'), + 'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'), + 'FORMATTING': ('formatstrings', 'OPERATORS'), + 'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS ' + 'FORMATTING TYPES'), + 'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'), + 'INTEGER': ('integers', 'int range'), + 'FLOAT': ('floating', 'float math'), + 'COMPLEX': ('imaginary', 'complex cmath'), + 'SEQUENCES': ('typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), 'MAPPINGS': 'DICTIONARIES', - 'FUNCTIONS': ('lib/typesfunctions', 'def TYPES'), - 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), - 'CODEOBJECTS': ('lib/bltin-code-objects', 'compile FUNCTIONS TYPES'), - 'TYPEOBJECTS': ('lib/bltin-type-objects', 'types TYPES'), + 'FUNCTIONS': ('typesfunctions', 'def TYPES'), + 'METHODS': ('typesmethods', 'class def CLASSES TYPES'), + 'CODEOBJECTS': ('bltin-code-objects', 'compile FUNCTIONS TYPES'), + 'TYPEOBJECTS': ('bltin-type-objects', 'types TYPES'), 'FRAMEOBJECTS': 'TYPES', 'TRACEBACKS': 'TYPES', - 'NONE': ('lib/bltin-null-object', ''), - 'ELLIPSIS': ('lib/bltin-ellipsis-object', 'SLICINGS'), - 'FILES': ('lib/bltin-file-objects', ''), - 'SPECIALATTRIBUTES': ('lib/specialattrs', ''), - 'CLASSES': ('ref/types', 'class SPECIALMETHODS PRIVATENAMES'), - 'MODULES': ('lib/typesmodules', 'import'), + 'NONE': ('bltin-null-object', ''), + 'ELLIPSIS': ('bltin-ellipsis-object', 'SLICINGS'), + 'FILES': ('bltin-file-objects', ''), + 'SPECIALATTRIBUTES': ('specialattrs', ''), + 'CLASSES': ('types', 'class SPECIALMETHODS PRIVATENAMES'), + 'MODULES': ('typesmodules', 'import'), 'PACKAGES': 'import', - 'EXPRESSIONS': ('ref/summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES BACKQUOTES'), + 'EXPRESSIONS': ('operator-summary', 'lambda or and not in is BOOLEAN ' + 'COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER ' + 'UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES ' + 'LISTS DICTIONARIES BACKQUOTES'), 'OPERATORS': 'EXPRESSIONS', 'PRECEDENCE': 'EXPRESSIONS', - 'OBJECTS': ('ref/objects', 'TYPES'), - 'SPECIALMETHODS': ('ref/specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), - 'BASICMETHODS': ('ref/customization', 'cmp hash repr str SPECIALMETHODS'), - 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'ATTRIBUTES SPECIALMETHODS'), - 'CALLABLEMETHODS': ('ref/callable-types', 'CALLS SPECIALMETHODS'), - 'SEQUENCEMETHODS1': ('ref/sequence-types', 'SEQUENCES SEQUENCEMETHODS2 SPECIALMETHODS'), - 'SEQUENCEMETHODS2': ('ref/sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 SPECIALMETHODS'), - 'MAPPINGMETHODS': ('ref/sequence-types', 'MAPPINGS SPECIALMETHODS'), - 'NUMBERMETHODS': ('ref/numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), - 'EXECUTION': ('ref/execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), - 'NAMESPACES': ('ref/naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), - 'DYNAMICFEATURES': ('ref/dynamic-features', ''), + 'OBJECTS': ('objects', 'TYPES'), + 'SPECIALMETHODS': ('specialnames', 'BASICMETHODS ATTRIBUTEMETHODS ' + 'CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS ' + 'SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), + 'BASICMETHODS': ('customization', 'cmp hash repr str SPECIALMETHODS'), + 'ATTRIBUTEMETHODS': ('attribute-access', 'ATTRIBUTES SPECIALMETHODS'), + 'CALLABLEMETHODS': ('callable-types', 'CALLS SPECIALMETHODS'), + 'SEQUENCEMETHODS1': ('sequence-types', 'SEQUENCES SEQUENCEMETHODS2 ' + 'SPECIALMETHODS'), + 'SEQUENCEMETHODS2': ('sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 ' + 'SPECIALMETHODS'), + 'MAPPINGMETHODS': ('sequence-types', 'MAPPINGS SPECIALMETHODS'), + 'NUMBERMETHODS': ('numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT ' + 'SPECIALMETHODS'), + 'EXECUTION': ('execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), + 'NAMESPACES': ('naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), + 'DYNAMICFEATURES': ('dynamic-features', ''), 'SCOPING': 'NAMESPACES', 'FRAMES': 'NAMESPACES', - 'EXCEPTIONS': ('ref/exceptions', 'try except finally raise'), - 'COERCIONS': ('ref/coercion-rules','CONVERSIONS'), - 'CONVERSIONS': ('ref/conversions', 'COERCIONS'), - 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), - 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), - 'PRIVATENAMES': ('ref/atom-identifiers', ''), - 'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), + 'EXCEPTIONS': ('exceptions', 'try except finally raise'), + 'COERCIONS': ('coercion-rules','CONVERSIONS'), + 'CONVERSIONS': ('conversions', 'COERCIONS'), + 'IDENTIFIERS': ('identifiers', 'keywords SPECIALIDENTIFIERS'), + 'SPECIALIDENTIFIERS': ('id-classes', ''), + 'PRIVATENAMES': ('atom-identifiers', ''), + 'LITERALS': ('atom-literals', 'STRINGS BACKQUOTES NUMBERS ' + 'TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), 'TUPLES': 'SEQUENCES', - 'TUPLELITERALS': ('ref/exprlists', 'TUPLES LITERALS'), - 'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'), - 'LISTLITERALS': ('ref/lists', 'LISTS LITERALS'), - 'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'), - 'DICTIONARYLITERALS': ('ref/dict', 'DICTIONARIES LITERALS'), - 'BACKQUOTES': ('ref/string-conversions', 'repr str STRINGS LITERALS'), - 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), - 'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'), - 'SLICINGS': ('ref/slicings', 'SEQUENCEMETHODS2'), - 'CALLS': ('ref/calls', 'EXPRESSIONS'), - 'POWER': ('ref/power', 'EXPRESSIONS'), - 'UNARY': ('ref/unary', 'EXPRESSIONS'), - 'BINARY': ('ref/binary', 'EXPRESSIONS'), - 'SHIFTING': ('ref/shifting', 'EXPRESSIONS'), - 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), - 'COMPARISON': ('ref/comparisons', 'EXPRESSIONS BASICMETHODS'), - 'BOOLEAN': ('ref/Booleans', 'EXPRESSIONS TRUTHVALUE'), + 'TUPLELITERALS': ('exprlists', 'TUPLES LITERALS'), + 'LISTS': ('typesseq-mutable', 'LISTLITERALS'), + 'LISTLITERALS': ('lists', 'LISTS LITERALS'), + 'DICTIONARIES': ('typesmapping', 'DICTIONARYLITERALS'), + 'DICTIONARYLITERALS': ('dict', 'DICTIONARIES LITERALS'), + 'BACKQUOTES': ('string-conversions', 'repr str STRINGS LITERALS'), + 'ATTRIBUTES': ('attribute-references', 'getattr hasattr setattr ' + 'ATTRIBUTEMETHODS'), + 'SUBSCRIPTS': ('subscriptions', 'SEQUENCEMETHODS1'), + 'SLICINGS': ('slicings', 'SEQUENCEMETHODS2'), + 'CALLS': ('calls', 'EXPRESSIONS'), + 'POWER': ('power', 'EXPRESSIONS'), + 'UNARY': ('unary', 'EXPRESSIONS'), + 'BINARY': ('binary', 'EXPRESSIONS'), + 'SHIFTING': ('shifting', 'EXPRESSIONS'), + 'BITWISE': ('bitwise', 'EXPRESSIONS'), + 'COMPARISON': ('comparisons', 'EXPRESSIONS BASICMETHODS'), + 'BOOLEAN': ('booleans', 'EXPRESSIONS TRUTHVALUE'), 'ASSERTION': 'assert', - 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), - 'AUGMENTEDASSIGNMENT': ('ref/augassign', 'NUMBERMETHODS'), + 'ASSIGNMENT': ('assignment', 'AUGMENTEDASSIGNMENT'), + 'AUGMENTEDASSIGNMENT': ('augassign', 'NUMBERMETHODS'), 'DELETION': 'del', 'PRINTING': 'print', 'RETURNING': 'return', 'IMPORTING': 'import', 'CONDITIONAL': 'if', - 'LOOPING': ('ref/compound', 'for while break continue'), - 'TRUTHVALUE': ('lib/truth', 'if while and or not BASICMETHODS'), - 'DEBUGGING': ('lib/module-pdb', 'pdb'), - 'CONTEXTMANAGERS': ('ref/context-managers', 'with'), + 'LOOPING': ('compound', 'for while break continue'), + 'TRUTHVALUE': ('truth', 'if while and or not BASICMETHODS'), + 'DEBUGGING': ('debugger', 'pdb'), + 'CONTEXTMANAGERS': ('context-managers', 'with'), } def __init__(self, input, output): self.input = input self.output = output - self.docdir = None - execdir = os.path.dirname(sys.executable) - homedir = os.environ.get('PYTHONHOME') - join = os.path.join - for dir in [os.environ.get('PYTHONDOCS'), - homedir and os.path.join(homedir, 'doc'), - join(execdir, 'doc'), # for Windows - join(sys.prefix, 'doc/python-docs-' + split(sys.version)[0]), - join(sys.prefix, 'doc/python-' + split(sys.version)[0]), - join(sys.prefix, 'doc/python-docs-' + sys.version[:3]), - join(sys.prefix, 'doc/python-' + sys.version[:3]), - join(sys.prefix, 'Resources/English.lproj/Documentation')]: - if dir and os.path.isdir(join(dir, 'lib')): - self.docdir = dir - break - if dir and os.path.isdir(join(dir, 'html', 'lib')): - self.docdir = join(dir, 'html') - break def __repr__(self): if inspect.stack()[1][3] == '?': @@ -1761,14 +1768,12 @@ self.list(self.topics.keys()) def showtopic(self, topic): - if not self.docdir: + try: + import pydoc_topics + except ImportError: self.output.write(''' -Sorry, topic and keyword documentation is not available because the Python -HTML documentation files could not be found. If you have installed them, -please set the environment variable PYTHONDOCS to indicate their location. - -On the Microsoft Windows operating system, the files can be built by -running "hh -decompile . PythonNN.chm" in the C:\PythonNN\Doc> directory. +Sorry, topic and keyword documentation is not available because the +module "pydoc_topics" could not be found. ''') return target = self.topics.get(topic, self.keywords.get(topic)) @@ -1778,31 +1783,15 @@ if type(target) is type(''): return self.showtopic(target) - filename, xrefs = target - filename = self.docdir + '/' + filename + '.html' + label, xrefs = target try: - file = open(filename) - except: - self.output.write('could not read docs from %s\n' % filename) + doc = pydoc_topics.topics[label] + except KeyError: + self.output.write('no documentation found for %s\n' % repr(topic)) return - - divpat = re.compile(']*navigat.*?', re.I | re.S) - addrpat = re.compile('.*?', re.I | re.S) - document = re.sub(addrpat, '', re.sub(divpat, '', file.read())) - file.close() - - import htmllib, formatter, StringIO - buffer = StringIO.StringIO() - parser = htmllib.HTMLParser( - formatter.AbstractFormatter(formatter.DumbWriter(buffer))) - parser.start_table = parser.do_p - parser.end_table = lambda parser=parser: parser.do_p({}) - parser.start_tr = parser.do_br - parser.start_td = parser.start_th = lambda a, b=buffer: b.write('\t') - parser.feed(document) - buffer = replace(buffer.getvalue(), '\xa0', ' ', '\n', '\n ') - pager(' ' + strip(buffer) + '\n') + pager(strip(doc) + '\n') if xrefs: + import StringIO, formatter buffer = StringIO.StringIO() formatter.DumbWriter(buffer).send_flowing_data( 'Related help topics: ' + join(split(xrefs), ', ') + '\n') Added: python/trunk/Lib/pydoc_topics.py ============================================================================== --- (empty file) +++ python/trunk/Lib/pydoc_topics.py Sun Jun 1 22:33:55 2008 @@ -0,0 +1,83 @@ +# Autogenerated by Sphinx on Sun Jun 1 22:23:15 2008 +topics = {'assert': u'\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError, expression2\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', + 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be a sequence with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets. (This rule is relaxed as of\n Python 1.5; in earlier versions, the object had to be a tuple.\n Since strings are sequences, an assignment like ``a, b = "xy"`` is\n now legal as long as the string has the right length.)\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` statement in the\n current code block: the name is bound to the object in the current\n local namespace.\n\n * Otherwise: the name is bound to the object in the current global\n namespace.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be a sequence with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield a plain integer. If it is negative, the\n sequence\'s length is added to it. The resulting value must be a\n nonnegative integer less than the sequence\'s length, and the\n sequence is asked to assign the assigned object to its item with\n that index. If the index is out of range, ``IndexError`` is raised\n (assignment to a subscripted sequence cannot add new items to a\n list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to (small) integers. If either\n bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n(In the current implementation, the syntax for targets is taken to be\nthe same as for expressions, and invalid syntax is rejected during the\ncode generation phase, causing less detailed error messages.)\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= target augop (expression_list | yield_expression)\n augop ::= "+=" | "-=" | "*=" | "/=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the initial value is\nretrieved with a ``getattr()`` and the result is assigned with a\n``setattr()``. Notice that the two methods do not necessarily refer\nto the same variable. When ``getattr()`` refers to a class variable,\n``setattr()`` still writes to an instance variable. For example:\n\n class A:\n x = 3 # class variable\n a = A()\n a.x += 1 # writes a.x as 4 leaving A.x as 3\n', + 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', + 'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\n literal ::= stringliteral | integer | longinteger\n | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value. The value may be approximated in the case of floating\npoint and imaginary (complex) literals. See section *Literals* for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n", + 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of ``x.name``)\nfor class instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for ``self``). ``name`` is the attribute name.\n This method should return the (computed) attribute value or raise\n an ``AttributeError`` exception.\n\n Note that if the attribute is found through the normal mechanism,\n ``__getattr__()`` is not called. (This is an intentional asymmetry\n between ``__getattr__()`` and ``__setattr__()``.) This is done both\n for efficiency reasons and because otherwise ``__setattr__()``\n would have no way to access other attributes of the instance. Note\n that at least for instance variables, you can fake total control by\n not inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n ``__getattribute__()`` method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If ``__setattr__()`` wants to assign to an instance attribute, it\n should not simply execute ``self.name = value`` --- this would\n cause a recursive call to itself. Instead, it should insert the\n value in the dictionary of instance attributes, e.g.,\n ``self.__dict__[name] = value``. For new-style classes, rather\n than accessing the instance dictionary, it should call the base\n class method with the same name, for example,\n ``object.__setattr__(self, name, value)``.\n\nobject.__delattr__(self, name)\n\n Like ``__setattr__()`` but for attribute deletion instead of\n assignment. This should only be implemented if ``del obj.name`` is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines\n ``__getattr__()``, the latter will not be called unless\n ``__getattribute__()`` either calls it explicitly or raises an\n ``AttributeError``. This method should return the (computed)\n attribute value or raise an ``AttributeError`` exception. In order\n to avoid infinite recursion in this method, its implementation\n should always call the base class method with the same name to\n access any attributes it needs, for example,\n ``object.__getattribute__(self, name)``.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in the\nclass dictionary of another new-style class, known as the *owner*\nclass. In the examples below, "the attribute" refers to the attribute\nwhose name is the key of the property in the owner class\'\n``__dict__``. Descriptors can only be implemented as new-style\nclasses themselves.\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or ``None`` when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an\n ``AttributeError`` exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: ``__get__()``, ``__set__()``, and\n``__delete__()``. If any of those methods are defined for an object,\nit is said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, ``a.x`` has a\nlookup chain starting with ``a.__dict__[\'x\']``, then\n``type(a).__dict__[\'x\']``, and continuing through the base classes of\n``type(a)`` excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass ``object()`` or\n``type()``).\n\nThe starting point for descriptor invocation is a binding, ``a.x``.\nHow the arguments are assembled depends on ``a``:\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: ``x.__get__(a)``.\n\nInstance Binding\n If binding to a new-style object instance, ``a.x`` is transformed\n into the call: ``type(a).__dict__[\'x\'].__get__(a, type(a))``.\n\nClass Binding\n If binding to a new-style class, ``A.x`` is transformed into the\n call: ``A.__dict__[\'x\'].__get__(None, A)``.\n\nSuper Binding\n If ``a`` is an instance of ``super``, then the binding ``super(B,\n obj).m()`` searches ``obj.__class__.__mro__`` for the base class\n ``A`` immediately preceding ``B`` and then invokes the descriptor\n with the call: ``A.__dict__[\'m\'].__get__(obj, A)``.\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. Normally, data\ndescriptors define both ``__get__()`` and ``__set__()``, while non-\ndata descriptors have just the ``__get__()`` method. Data descriptors\nalways override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances. [3]\n\nPython methods (including ``staticmethod()`` and ``classmethod()``)\nare implemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe ``property()`` function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n Added in version 2.2.\n\nNotes on using *__slots__*\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises ``AttributeError``. If\n dynamic assignment of new variables is desired, then add\n ``\'__dict__\'`` to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding ``\'__dict__\'`` to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes defining\n *__slots__* do not support weak references to its instances. If weak\n reference support is needed, then add ``\'__weakref__\'`` to the\n sequence of strings in the *__slots__* declaration.\n\n Changed in version 2.3: Previously, adding ``\'__weakref__\'`` to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* If a class defines a slot also defined in a base class, the instance\n variable defined by the base class slot is inaccessible (except by\n retrieving its descriptor directly from the base class). This\n renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__*.\n\n* *__slots__* do not work for classes derived from "variable-length"\n built-in types such as ``long``, ``str`` and ``tuple``.\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings may\n also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n', + 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance. This\nobject is then asked to produce the attribute whose name is the\nidentifier. If this attribute is not available, the exception\n``AttributeError`` is raised. Otherwise, the type and value of the\nobject produced is determined by the object. Multiple evaluations of\nthe same attribute reference may yield different objects.\n', + 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= target augop (expression_list | yield_expression)\n augop ::= "+=" | "-=" | "*=" | "/=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the initial value is\nretrieved with a ``getattr()`` and the result is assigned with a\n``setattr()``. Notice that the two methods do not necessarily refer\nto the same variable. When ``getattr()`` refers to a class variable,\n``setattr()`` still writes to an instance variable. For example:\n\n class A:\n x = 3 # class variable\n a = A()\n a.x += 1 # writes a.x as 4 leaving A.x as 3\n', + 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n | m_expr "%" u_expr\n a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe ``*`` (multiplication) operator yields the product of its\narguments. The arguments must either both be numbers, or one argument\nmust be an integer (plain or long) and the other must be a sequence.\nIn the former case, the numbers are converted to a common type and\nthen multiplied together. In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe ``/`` (division) and ``//`` (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the \'floor\' function applied to the result. Division by zero\nraises the ``ZeroDivisionError`` exception.\n\nThe ``%`` (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n``ZeroDivisionError`` exception. The arguments may be floating point\nnumbers, e.g., ``3.14%0.7`` equals ``0.34`` (since ``3.14`` equals\n``4*0.7 + 0.34``.) The modulo operator always yields a result with\nthe same sign as its second operand (or zero); the absolute value of\nthe result is strictly smaller than the absolute value of the second\noperand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: ``x == (x/y)*y + (x%y)``. Integer division and\nmodulo are also connected with the built-in function ``divmod()``:\n``divmod(x, y) == (x/y, x%y)``. These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere ``x/y`` is replaced by ``floor(x/y)`` or ``floor(x/y) - 1`` [3].\n\nIn addition to performing the modulo operation on numbers, the ``%``\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\n*String Formatting Operations*.\n\nDeprecated in version 2.3: The floor division operator, the modulo\noperator, and the ``divmod()`` function are no longer defined for\ncomplex numbers. Instead, convert to a floating point number using\nthe ``abs()`` function if appropriate.\n\nThe ``+`` (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe ``-`` (subtraction) operator yields the difference of its\narguments. The numeric arguments are first converted to a common\ntype.\n', + 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n and_expr ::= shift_expr | and_expr "&" shift_expr\n xor_expr ::= and_expr | xor_expr "^" and_expr\n or_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe ``&`` operator yields the bitwise AND of its arguments, which must\nbe plain or long integers. The arguments are converted to a common\ntype.\n\nThe ``^`` operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers. The arguments are\nconverted to a common type.\n\nThe ``|`` operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers. The arguments are converted to\na common type.\n', + 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin ``compile()`` function and can be extracted from function objects\nthrough their ``func_code`` attribute. See also the ``code`` module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the ``exec`` statement or the built-in ``eval()``\nfunction.\n\nSee *The standard type hierarchy* for more information.\n', + 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see *Slicings*). It\nsupports no special operations. There is exactly one ellipsis object,\nnamed ``Ellipsis`` (a built-in name).\n\nIt is written as ``Ellipsis``.\n', + 'bltin-file-objects': u'\nFile Objects\n************\n\nFile objects are implemented using C\'s ``stdio`` package and can be\ncreated with the built-in ``open()`` function. File objects are also\nreturned by some other built-in functions and methods, such as\n``os.popen()`` and ``os.fdopen()`` and the ``makefile()`` method of\nsocket objects. Temporary files can be created using the ``tempfile``\nmodule, and high-level file operations such as copying, moving, and\ndeleting files and directories can be achieved with the ``shutil``\nmodule.\n\nWhen a file operation fails for an I/O-related reason, the exception\n``IOError`` is raised. This includes situations where the operation\nis not defined for some reason, like ``seek()`` on a tty device or\nwriting a file opened for reading.\n\nFiles have the following methods:\n\nfile.close()\n\n Close the file. A closed file cannot be read or written any more.\n Any operation which requires that the file be open will raise a\n ``ValueError`` after the file has been closed. Calling ``close()``\n more than once is allowed.\n\n As of Python 2.5, you can avoid having to call this method\n explicitly if you use the ``with`` statement. For example, the\n following code will automatically close *f* when the ``with`` block\n is exited:\n\n from __future__ import with_statement\n\n with open("hello.txt") as f:\n for line in f:\n print line\n\n In older versions of Python, you would have needed to do this to\n get the same effect:\n\n f = open("hello.txt")\n try:\n for line in f:\n print line\n finally:\n f.close()\n\n Note: Not all "file-like" types in Python support use as a context\n manager for the ``with`` statement. If your code is intended to\n work with any file-like object, you can use the function\n ``contextlib.closing()`` instead of using the object directly.\n\nfile.flush()\n\n Flush the internal buffer, like ``stdio``\'s ``fflush``. This may\n be a no-op on some file-like objects.\n\nfile.fileno()\n\n Return the integer "file descriptor" that is used by the underlying\n implementation to request I/O operations from the operating system.\n This can be useful for other, lower level interfaces that use file\n descriptors, such as the ``fcntl`` module or ``os.read()`` and\n friends.\n\n Note: File-like objects which do not have a real file descriptor should\n *not* provide this method!\n\nfile.isatty()\n\n Return ``True`` if the file is connected to a tty(-like) device,\n else ``False``.\n\n Note: If a file-like object is not associated with a real file, this\n method should *not* be implemented.\n\nfile.next()\n\n A file object is its own iterator, for example ``iter(f)`` returns\n *f* (unless *f* is closed). When a file is used as an iterator,\n typically in a ``for`` loop (for example, ``for line in f: print\n line``), the ``next()`` method is called repeatedly. This method\n returns the next input line, or raises ``StopIteration`` when EOF\n is hit when the file is open for reading (behavior is undefined\n when the file is open for writing). In order to make a ``for``\n loop the most efficient way of looping over the lines of a file (a\n very common operation), the ``next()`` method uses a hidden read-\n ahead buffer. As a consequence of using a read-ahead buffer,\n combining ``next()`` with other file methods (like ``readline()``)\n does not work right. However, using ``seek()`` to reposition the\n file to an absolute position will flush the read-ahead buffer.\n\n Added in version 2.3.\n\nfile.read([size])\n\n Read at most *size* bytes from the file (less if the read hits EOF\n before obtaining *size* bytes). If the *size* argument is negative\n or omitted, read all data until EOF is reached. The bytes are\n returned as a string object. An empty string is returned when EOF\n is encountered immediately. (For certain files, like ttys, it\n makes sense to continue reading after an EOF is hit.) Note that\n this method may call the underlying C function ``fread`` more than\n once in an effort to acquire as close to *size* bytes as possible.\n Also note that when in non-blocking mode, less data than what was\n requested may be returned, even if no *size* parameter was given.\n\nfile.readline([size])\n\n Read one entire line from the file. A trailing newline character\n is kept in the string (but may be absent when a file ends with an\n incomplete line). [6] If the *size* argument is present and non-\n negative, it is a maximum byte count (including the trailing\n newline) and an incomplete line may be returned. An empty string is\n returned *only* when EOF is encountered immediately.\n\n Note: Unlike ``stdio``\'s ``fgets``, the returned string contains null\n characters (``\'\\0\'``) if they occurred in the input.\n\nfile.readlines([sizehint])\n\n Read until EOF using ``readline()`` and return a list containing\n the lines thus read. If the optional *sizehint* argument is\n present, instead of reading up to EOF, whole lines totalling\n approximately *sizehint* bytes (possibly after rounding up to an\n internal buffer size) are read. Objects implementing a file-like\n interface may choose to ignore *sizehint* if it cannot be\n implemented, or cannot be implemented efficiently.\n\nfile.xreadlines()\n\n This method returns the same thing as ``iter(f)``.\n\n Added in version 2.1.\n\n Deprecated in version 2.3: Use ``for line in file`` instead.\n\nfile.seek(offset[, whence])\n\n Set the file\'s current position, like ``stdio``\'s ``fseek``. The\n *whence* argument is optional and defaults to ``os.SEEK_SET`` or\n ``0`` (absolute file positioning); other values are ``os.SEEK_CUR``\n or ``1`` (seek relative to the current position) and\n ``os.SEEK_END`` or ``2`` (seek relative to the file\'s end). There\n is no return value.\n\n For example, ``f.seek(2, os.SEEK_CUR)`` advances the position by\n two and ``f.seek(-3, os.SEEK_END)`` sets the position to the third\n to last.\n\n Note that if the file is opened for appending (mode ``\'a\'`` or\n ``\'a+\'``), any ``seek()`` operations will be undone at the next\n write. If the file is only opened for writing in append mode (mode\n ``\'a\'``), this method is essentially a no-op, but it remains useful\n for files opened in append mode with reading enabled (mode\n ``\'a+\'``). If the file is opened in text mode (without ``\'b\'``),\n only offsets returned by ``tell()`` are legal. Use of other\n offsets causes undefined behavior.\n\n Note that not all file objects are seekable.\n\n Changed in version 2.6: Passing float values as offset has been\n deprecated.\n\nfile.tell()\n\n Return the file\'s current position, like ``stdio``\'s ``ftell``.\n\n Note: On Windows, ``tell()`` can return illegal values (after an\n ``fgets``) when reading files with Unix-style line-endings. Use\n binary mode (``\'rb\'``) to circumvent this problem.\n\nfile.truncate([size])\n\n Truncate the file\'s size. If the optional *size* argument is\n present, the file is truncated to (at most) that size. The size\n defaults to the current position. The current file position is not\n changed. Note that if a specified size exceeds the file\'s current\n size, the result is platform-dependent: possibilities include that\n the file may remain unchanged, increase to the specified size as if\n zero-filled, or increase to the specified size with undefined new\n content. Availability: Windows, many Unix variants.\n\nfile.write(str)\n\n Write a string to the file. There is no return value. Due to\n buffering, the string may not actually show up in the file until\n the ``flush()`` or ``close()`` method is called.\n\nfile.writelines(sequence)\n\n Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings.\n There is no return value. (The name is intended to match\n ``readlines()``; ``writelines()`` does not add line separators.)\n\nFiles support the iterator protocol. Each iteration returns the same\nresult as ``file.readline()``, and iteration ends when the\n``readline()`` method returns an empty string.\n\nFile objects also offer a number of other interesting attributes.\nThese are not required for file-like objects, but should be\nimplemented if they make sense for the particular object.\n\nfile.closed\n\n bool indicating the current state of the file object. This is a\n read-only attribute; the ``close()`` method changes the value. It\n may not be available on all file-like objects.\n\nfile.encoding\n\n The encoding that this file uses. When Unicode strings are written\n to a file, they will be converted to byte strings using this\n encoding. In addition, when the file is connected to a terminal,\n the attribute gives the encoding that the terminal is likely to use\n (that information might be incorrect if the user has misconfigured\n the terminal). The attribute is read-only and may not be present\n on all file-like objects. It may also be ``None``, in which case\n the file uses the system default encoding for converting Unicode\n strings.\n\n Added in version 2.3.\n\nfile.errors\n\n The Unicode error handler used to along with the encoding.\n\n Added in version 2.6.\n\nfile.mode\n\n The I/O mode for the file. If the file was created using the\n ``open()`` built-in function, this will be the value of the *mode*\n parameter. This is a read-only attribute and may not be present on\n all file-like objects.\n\nfile.name\n\n If the file object was created using ``open()``, the name of the\n file. Otherwise, some string that indicates the source of the file\n object, of the form ``<...>``. This is a read-only attribute and\n may not be present on all file-like objects.\n\nfile.newlines\n\n If Python was built with the *--with-universal-newlines* option to\n **configure** (the default) this read-only attribute exists, and\n for files opened in universal newline read mode it keeps track of\n the types of newlines encountered while reading the file. The\n values it can take are ``\'\\r\'``, ``\'\\n\'``, ``\'\\r\\n\'``, ``None``\n (unknown, no newlines read yet) or a tuple containing all the\n newline types seen, to indicate that multiple newline conventions\n were encountered. For files not opened in universal newline read\n mode the value of this attribute will be ``None``.\n\nfile.softspace\n\n Boolean that indicates whether a space character needs to be\n printed before another value when using the ``print`` statement.\n Classes that are trying to simulate a file object should also have\n a writable ``softspace`` attribute, which should be initialized to\n zero. This will be automatic for most classes implemented in\n Python (care may be needed for objects that override attribute\n access); types implemented in C will have to provide a writable\n ``softspace`` attribute.\n\n Note: This attribute is not used to control the ``print`` statement,\n but to allow the implementation of ``print`` to keep track of its\n internal state.\n', + 'bltin-null-object': u"\nThe Null Object\n***************\n\nThis object is returned by functions that don't explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named ``None`` (a built-in name).\n\nIt is written as ``None``.\n", + 'bltin-type-objects': u"\nType Objects\n************\n\nType objects represent the various object types. An object's type is\naccessed by the built-in function ``type()``. There are no special\noperations on types. The standard module ``types`` defines names for\nall standard built-in types.\n\nTypes are written like this: ````.\n", + 'booleans': u'\nBoolean operations\n******************\n\nBoolean operations have the lowest priority of all Python operations:\n\n expression ::= conditional_expression | lambda_form\n old_expression ::= or_test | old_lambda_form\n conditional_expression ::= or_test ["if" or_test "else" expression]\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: ``False``, ``None``, numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true.\n\nThe operator ``not`` yields ``True`` if its argument is false,\n``False`` otherwise.\n\nThe expression ``x if C else y`` first evaluates *C* (*not* *x*); if\n*C* is true, *x* is evaluated and its value is returned; otherwise,\n*y* is evaluated and its value is returned.\n\nAdded in version 2.5.\n\nThe expression ``x and y`` first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression ``x or y`` first evaluates *x*; if *x* is true, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\n(Note that neither ``and`` nor ``or`` restrict the value and type they\nreturn to ``False`` and ``True``, but rather return the last evaluated\nargument. This is sometimes useful, e.g., if ``s`` is a string that\nshould be replaced by a default value if it is empty, the expression\n``s or \'foo\'`` yields the desired value. Because ``not`` has to\ninvent a value anyway, it does not bother to return a value of the\nsame type as its argument, so e.g., ``not \'foo\'`` yields ``False``,\nnot ``\'\'``.)\n', + 'break': u'\nThe ``break`` statement\n***********************\n\n break_stmt ::= "break"\n\n``break`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition\nwithin that loop.\n\nIt terminates the nearest enclosing loop, skipping the optional\n``else`` clause if the loop has one.\n\nIf a ``for`` loop is terminated by ``break``, the loop control target\nkeeps its current value.\n\nWhen ``break`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nleaving the loop.\n', + 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n', + 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a function) with a possibly\nempty series of arguments:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section *Function definitions* for the\nsyntax of formal parameter lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\nNote: An implementation may provide builtin functions whose positional\n parameters do not have names, even if they are \'named\' for the\n purpose of documentation, and which therefore cannot be supplied by\n keyword. In CPython, this is the case for functions implemented in\n C that use ``PyArg_ParseTuple`` to parse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to a sequence. Elements from this\nsequence are treated as if they were additional positional arguments;\nif there are positional arguments *x1*,...,*xN* , and ``expression``\nevaluates to a sequence *y1*,...,*yM*, this is equivalent to a call\nwith M+N positional arguments *x1*,...,*xN*,*y1*,...,*yM*.\n\nA consequence of this is that although the ``*expression`` syntax\nappears *after* any keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax ``(sublist)`` cannot be\nused as keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', + 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. A class object is then created using the inheritance list for\nthe base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with ``self.name = value``.\nBoth class and instance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n', + 'coercion-rules': u"\nCoercion rules\n**************\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3.0, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don't define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from ``object``) never invoke the\n ``__coerce__()`` method in response to a binary operator; the only\n time ``__coerce__()`` is invoked is when the built-in function\n ``coerce()`` is called.\n\n* For most intents and purposes, an operator that returns\n ``NotImplemented`` is treated the same as one that is not\n implemented at all.\n\n* Below, ``__op__()`` and ``__rop__()`` are used to signify the\n generic method names corresponding to an operator; ``__iop__()`` is\n used for the corresponding in-place operator. For example, for the\n operator '``+``', ``__add__()`` and ``__radd__()`` are used for the\n left and right variant of the binary operator, and ``__iadd__()``\n for the in-place variant.\n\n* For objects *x* and *y*, first ``x.__op__(y)`` is tried. If this is\n not implemented or returns ``NotImplemented``, ``y.__rop__(x)`` is\n tried. If this is also not implemented or returns\n ``NotImplemented``, a ``TypeError`` exception is raised. But see\n the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base's ``__rop__()`` method, the right operand's ``__rop__()``\n method is tried *before* the left operand's ``__op__()`` method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand's ``__op__()`` method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is called\n before that type's ``__op__()`` or ``__rop__()`` method is called,\n but no sooner. If the coercion returns an object of a different\n type for the operand whose coercion is invoked, part of the process\n is redone using the new object.\n\n* When an in-place operator (like '``+=``') is used, if the left\n operand implements ``__iop__()``, it is invoked without any\n coercion. When the operation falls back to ``__op__()`` and/or\n ``__rop__()``, the normal coercion rules apply.\n\n* In *x*``+``*y*, if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In *x*``*``*y*, if one operator is a sequence that implements\n sequence repetition, and the other is an integer (``int`` or\n ``long``), sequence repetition is invoked.\n\n* Rich comparisons (implemented by methods ``__eq__()`` and so on)\n never use coercion. Three-way comparison (implemented by\n ``__cmp__()``) does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types ``int``,\n ``long`` and ``float`` do not use coercion; the type ``complex``\n however does use it. The difference can become apparent when\n subclassing these types. Over time, the type ``complex`` may be\n fixed to avoid coercion. All these types implement a\n ``__coerce__()`` method, for use by the built-in ``coerce()``\n function.\n", + 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe forms ``<>`` and ``!=`` are equivalent; for consistency with C,\n``!=`` is preferred; where ``!=`` is mentioned below ``<>`` is also\naccepted. The ``<>`` spelling is considered obsolescent.\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nobjects of different types *always* compare unequal, and are ordered\nconsistently but arbitrarily. You can control comparison behavior of\nobjects of non-builtin types by defining a ``__cmp__`` method or rich\ncomparison methods like ``__gt__``, described in section *Special\nmethod names*.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the ``in`` and ``not in``\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n Unicode and 8-bit strings are fully interoperable in this behavior.\n [4]\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``cmp([1,2,x], [1,2,y])`` returns\n the same as ``cmp(x,y)``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of builtin types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nThe operators ``in`` and ``not in`` test for collection membership.\n``x in s`` evaluates to true if *x* is a member of the collection *s*,\nand false otherwise. ``x not in s`` returns the negation of ``x in\ns``. The collection membership test has traditionally been bound to\nsequences; an object is a member of a collection if the collection is\na sequence and contains an element equal to that object. However, it\nmake sense for many other object types to support membership tests\nwithout being a sequence. In particular, dictionaries (for keys) and\nsets support membership testing.\n\nFor the list and tuple types, ``x in y`` is true if and only if there\nexists an index *i* such that ``x == y[i]`` is true.\n\nFor the Unicode and string types, ``x in y`` is true if and only if\n*x* is a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nNote, *x* and *y* need not be the same type; consequently, ``u\'ab\' in\n\'abc\'`` will return ``True``. Empty strings are always considered to\nbe a substring of any other string, so ``"" in "abc"`` will return\n``True``.\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength ``1``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` and do\ndefine ``__getitem__()``, ``x in y`` is true if and only if there is a\nnon-negative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value.\n', + 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements. Function and class\ndefinitions are also syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print`` statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the ``else`` clause, if present, is executed, and the loop\nterminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function ``range()`` returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s ``for i := a to b\ndo``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nWarning: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An internal\n counter is used to keep track of which item is used next, and this\n is incremented on each iteration. When this counter has reached the\n length of the sequence the loop terminates. This means that if the\n suite deletes the current (or a previous) item from the sequence,\n the next item will be skipped (since it gets the index of the\n current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["," target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, a tuple containing an item compatible with the\nexception, or, in the (deprecated) case of string exceptions, is the\nraised string itself (note that the object identities must match, i.e.\nit must be the same string object, not just a string with the same\nvalue).\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nAdded in version 2.5.\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" expression ["as" target] ":" suite\n\nThe execution of the ``with`` statement proceeds as follows:\n\n1. The context expression is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__enter__()`` method is invoked.\n\n3. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 5 below.\n\n4. The suite is executed.\n\n5. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nNote: In Python 2.5, the ``with`` statement is only allowed when the\n ``with_statement`` feature has been enabled. It is always enabled\n in Python 2.6.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier [, "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called.\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Expression lists*. Note that the lambda form is\nmerely a shorthand for a simplified function definition; a function\ndefined in a "``def``" statement can be passed around or assigned to\nanother name just like a function defined by a lambda form. The\n"``def``" form is actually more powerful since it allows the execution\nof multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. A class object is then created using the inheritance list for\nthe base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with ``self.name = value``.\nBoth class and instance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n', + 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nAdded in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n-[ Footnotes ]-\n\n[1] Since Python 2.2, a gradual merging of types and classes has been\n started that makes this and a few other assertions made in this\n manual not 100% accurate and complete: for example, it *is* now\n possible in some cases to change an object\'s type, under certain\n controlled conditions. Until this manual undergoes extensive\n revision, it must now be taken as authoritative only regarding\n "classic classes", that are still the default, for compatibility\n purposes, in Python 2.2 and 2.3. For more information, see\n http://www.python.org/doc/newstyle/.\n\n[2] This, and other statements, are only roughly true for instances of\n new-style classes.\n\n[3] A descriptor can define any combination of ``__get__()``,\n ``__set__()`` and ``__delete__()``. If it does not define\n ``__get__()``, then accessing the attribute even on an instance\n will return the descriptor object itself. If the descriptor\n defines ``__set__()`` and/or ``__delete__()``, it is a data\n descriptor; if it defines neither, it is a non-data descriptor.\n\n[4] For operands of the same type, it is assumed that if the non-\n reflected method (such as ``__add__()``) fails the operation is\n not supported, which is why the reflected method is not called.\n', + 'continue': u'\nThe ``continue`` statement\n**************************\n\n continue_stmt ::= "continue"\n\n``continue`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition or\n``finally`` clause within that loop. It continues with the next cycle\nof the nearest enclosing loop.\n\nWhen ``continue`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nstarting the next loop cycle.\n', + 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at *Coercion rules*. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the other\n is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n', + 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. ``__new__()`` is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of ``__new__()`` should be the new object instance (usually\n an instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s ``__new__()`` method using\n ``super(currentclass, cls).__new__(cls[, ...])`` with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If ``__new__()`` returns an instance of *cls*, then the new\n instance\'s ``__init__()`` method will be invoked like\n ``__init__(self[, ...])``, where *self* is the new instance and the\n remaining arguments are the same as were passed to ``__new__()``.\n\n If ``__new__()`` does not return an instance of *cls*, then the new\n instance\'s ``__init__()`` method will not be invoked.\n\n ``__new__()`` is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called when the instance is created. The arguments are those\n passed to the class constructor expression. If a base class has an\n ``__init__()`` method, the derived class\'s ``__init__()`` method,\n if any, must explicitly call it to ensure proper initialization of\n the base class part of the instance; for example:\n ``BaseClass.__init__(self, [args...])``. As a special constraint\n on constructors, no value may be returned; doing so will cause a\n ``TypeError`` to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a ``__del__()`` method,\n the derived class\'s ``__del__()`` method, if any, must explicitly\n call it to ensure proper deletion of the base class part of the\n instance. Note that it is possible (though not recommended!) for\n the ``__del__()`` method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n ``__del__()`` methods are called for objects that still exist when\n the interpreter exits.\n\n Note: ``del x`` doesn\'t directly call ``x.__del__()`` --- the former\n decrements the reference count for ``x`` by one, and the latter\n is only called when ``x``\'s reference count reaches zero. Some\n common situations that may prevent the reference count of an\n object from going to zero include: circular references between\n objects (e.g., a doubly-linked list or a tree data structure with\n parent and child pointers); a reference to the object on the\n stack frame of a function that caught an exception (the traceback\n stored in ``sys.exc_traceback`` keeps the stack frame alive); or\n a reference to the object on the stack frame that raised an\n unhandled exception in interactive mode (the traceback stored in\n ``sys.last_traceback`` keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing ``None`` in\n ``sys.exc_traceback`` or ``sys.last_traceback``. Circular\n references which are garbage are detected when the option cycle\n detector is enabled (it\'s on by default), but can only be cleaned\n up if there are no Python-level ``__del__()`` methods involved.\n Refer to the documentation for the ``gc`` module for more\n information about how ``__del__()`` methods are handled by the\n cycle detector, particularly the description of the ``garbage``\n value.\n\n Warning: Due to the precarious circumstances under which ``__del__()``\n methods are invoked, exceptions that occur during their execution\n are ignored, and a warning is printed to ``sys.stderr`` instead.\n Also, when ``__del__()`` is invoked in response to a module being\n deleted (e.g., when execution of the program is done), other\n globals referenced by the ``__del__()`` method may already have\n been deleted. For this reason, ``__del__()`` methods should do\n the absolute minimum needed to maintain external invariants.\n Starting with version 1.5, Python guarantees that globals whose\n name begins with a single underscore are deleted from their\n module before other globals are deleted; if no other references\n to such globals exist, this may help in assuring that imported\n modules are still available at the time when the ``__del__()``\n method is called.\n\nobject.__repr__(self)\n\n Called by the ``repr()`` built-in function and by string\n conversions (reverse quotes) to compute the "official" string\n representation of an object. If at all possible, this should look\n like a valid Python expression that could be used to recreate an\n object with the same value (given an appropriate environment). If\n this is not possible, a string of the form ``<...some useful\n description...>`` should be returned. The return value must be a\n string object. If a class defines ``__repr__()`` but not\n ``__str__()``, then ``__repr__()`` is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the ``str()`` built-in function and by the ``print``\n statement to compute the "informal" string representation of an\n object. This differs from ``__repr__()`` in that it does not have\n to be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n Added in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to ``__cmp__()`` below. The\n correspondence between operator symbols and method names is as\n follows: ``xy`` call ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and\n ``x>=y`` calls ``x.__ge__(y)``.\n\n A rich comparison method may return the singleton\n ``NotImplemented`` if it does not implement the operation for a\n given pair of arguments. By convention, ``False`` and ``True`` are\n returned for a successful comparison. However, these methods can\n return any value, so if the comparison operator is used in a\n Boolean context (e.g., in the condition of an ``if`` statement),\n Python will call ``bool()`` on the value to determine if the result\n is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of ``x==y`` does not imply that ``x!=y`` is false.\n Accordingly, when defining ``__eq__()``, one should also define\n ``__ne__()`` so that the operators will behave as expected. See\n the paragraph on ``__hash__()`` for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, ``__lt__()`` and ``__gt__()`` are each\n other\'s reflection, ``__le__()`` and ``__ge__()`` are each other\'s\n reflection, and ``__eq__()`` and ``__ne__()`` are their own\n reflection.\n\n Arguments to rich comparison methods are never coerced.\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if ``self < other``,\n zero if ``self == other``, a positive integer if ``self > other``.\n If no ``__cmp__()``, ``__eq__()`` or ``__ne__()`` operation is\n defined, class instances are compared by object identity\n ("address"). See also the description of ``__hash__()`` for some\n important notes on creating *hashable* objects which support custom\n comparison operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by ``__cmp__()`` has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called for the key object for dictionary operations, and by the\n built-in function ``hash()``. Should return an integer usable as a\n hash value for dictionary operations. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g., using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a ``__cmp__()`` or ``__eq__()`` method\n it should not define a ``__hash__()`` operation either; if it\n defines ``__cmp__()`` or ``__eq__()`` but not ``__hash__()``, its\n instances will not be usable as dictionary keys. If a class\n defines mutable objects and implements a ``__cmp__()`` or\n ``__eq__()`` method, it should not implement ``__hash__()``, since\n the dictionary implementation requires that a key\'s hash value is\n immutable (if the object\'s hash value changes, it will be in the\n wrong hash bucket).\n\n User-defined classes have ``__cmp__()`` and ``__hash__()`` methods\n by default; with them, all objects compare unequal and\n ``x.__hash__()`` returns ``id(x)``.\n\n Changed in version 2.5: ``__hash__()`` may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing, and the built-in operation\n ``bool()``; should return ``False`` or ``True``, or their integer\n equivalents ``0`` or ``1``. When this method is not defined,\n ``__len__()`` is called, if it is defined (see below). If a class\n defines neither ``__len__()`` nor ``__nonzero__()``, all its\n instances are considered true.\n\nobject.__unicode__(self)\n\n Called to implement ``unicode()`` builtin; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n', + 'debugger': u'\n``pdb`` --- The Python Debugger\n*******************************\n\nThe module ``pdb`` defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n``Pdb``. This is currently undocumented but easily understood by\nreading the source. The extension interface uses the modules ``bdb``\n(undocumented) and ``cmd``.\n\nThe debugger\'s prompt is ``(Pdb)``. Typical usage to run a program\nunder control of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\n``pdb.py`` can also be invoked as a script to debug other scripts.\nFor example:\n\n python -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nAdded in version 2.4: Restarting post-mortem behavior added.\n\nTypical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print spam\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print spam\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\n Execute the *statement* (given as a string) under debugger control.\n The debugger prompt appears before any code is executed; you can\n set breakpoints and type ``continue``, or you can step through the\n statement using ``step`` or ``next`` (all these commands are\n explained below). The optional *globals* and *locals* arguments\n specify the environment in which the code is executed; by default\n the dictionary of the module ``__main__`` is used. (See the\n explanation of the ``exec`` statement or the ``eval()`` built-in\n function.)\n\npdb.runeval(expression[, globals[, locals]])\n\n Evaluate the *expression* (given as a string) under debugger\n control. When ``runeval()`` returns, it returns the value of the\n expression. Otherwise this function is similar to ``run()``.\n\npdb.runcall(function[, argument, ...])\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When ``runcall()`` returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem([traceback])\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n ``sys.last_traceback``.\n', + 'del': u'\nThe ``del`` statement\n*********************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather that spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a ``global``\nstatement in the same code block. If the name is unbound, a\n``NameError`` exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n', + 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n\nA dictionary display yields a new dictionary object.\n\nThe key/datum pairs are evaluated from left to right to define the\nentries of the dictionary: each key object is used as a key into the\ndictionary to store the corresponding datum.\n\nRestrictions on the types of the key values are listed earlier in\nsection *The standard type hierarchy*. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', + 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- ``import *`` --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a ``SyntaxError``.\n\nIf ``exec`` is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n``SyntaxError`` unless the exec explicitly specifies the local\nnamespace for the ``exec``. (In other words, ``exec obj`` would be\nillegal, but ``exec obj in ns`` would be legal.)\n\nThe ``eval()``, ``execfile()``, and ``input()`` functions and the\n``exec`` statement do not have access to the full environment for\nresolving names. Names may be resolved in the local and global\nnamespaces of the caller. Free variables are not resolved in the\nnearest enclosing namespace, but in the global namespace. [1] The\n``exec`` statement and the ``eval()`` and ``execfile()`` functions\nhave optional arguments to override the global and local namespace.\nIf only one namespace is specified, it is used for both.\n', + 'else': u'\nThe ``if`` statement\n********************\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n', + 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the ``raise`` statement. Exception\nhandlers are specified with the ``try`` ... ``except`` statement. The\n``finally`` clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n``SystemExit``.\n\nExceptions are identified by class instances. The ``except`` clause\nis selected depending on the class of the instance: it must reference\nthe class of the instance or a base class thereof. The instance can\nbe received by the handler and can carry additional information about\nthe exceptional condition.\n\nExceptions can also be identified by strings, in which case the\n``except`` clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nWarning: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the ``try`` statement in section *The try\nstatement* and ``raise`` statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by these\n operations is not available at the time the module is compiled.\n', + 'exec': u'\nThe ``exec`` statement\n**********************\n\n exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code. The first\nexpression should evaluate to either a string, an open file object, or\na code object. If it is a string, the string is parsed as a suite of\nPython statements which is then executed (unless a syntax error\noccurs). If it is an open file, the file is parsed until EOF and\nexecuted. If it is a code object, it is simply executed. In all\ncases, the code that\'s executed is expected to be valid as file input\n(see section *File input*). Be aware that the ``return`` and\n``yield`` statements may not be used outside of function definitions\neven within the context of code passed to the ``exec`` statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope. If only the first expression after ``in`` is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables. If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code. For example, the current implementation may\nadd a reference to the dictionary of the built-in module\n``__builtin__`` under the key ``__builtins__`` (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function ``eval()``. The built-in functions\n``globals()`` and ``locals()`` return the current global and local\ndictionary, respectively, which may be useful to pass around for use\nby ``exec``.\n', + 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function ``execfile()`` is a code block. The string argument\npassed to the built-in function ``eval()`` and to the ``exec``\nstatement is a code block. The expression read and evaluated by the\nbuilt-in function ``input()`` is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a ``NameError`` exception is raised.\nIf the name refers to a local variable that has not been bound, a\n``UnboundLocalError`` exception is raised. ``UnboundLocalError`` is a\nsubclass of ``NameError``.\n\nThe following constructs bind names: formal parameters to functions,\n``import`` statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, ``for`` loop header, or in\nthe second position of an ``except`` clause header. The ``import``\nstatement of the form "``from ...import *``" binds all names defined\nin the imported module, except those beginning with an underscore.\nThis form may only be used at the module level.\n\nA target occurring in a ``del`` statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a ``SyntaxError``.\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtin namespace, the namespace of\nthe module ``__builtin__``. The global namespace is searched first.\nIf the name is not found there, the builtin namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe built-in namespace associated with the execution of a code block\nis actually found by looking up the name ``__builtins__`` in its\nglobal namespace; this should be a dictionary or a module (in the\nlatter case the module\'s dictionary is used). By default, when in the\n``__main__`` module, ``__builtins__`` is the built-in module\n``__builtin__`` (note: no \'s\'); when in any other module,\n``__builtins__`` is an alias for the dictionary of the ``__builtin__``\nmodule itself. ``__builtins__`` can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\nNote: Users should not touch ``__builtins__``; it is strictly an\n implementation detail. Users wanting to override values in the\n built-in namespace should ``import`` the ``__builtin__`` (no \'s\')\n module and modify its attributes appropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n``__main__``.\n\nThe global statement has the same scope as a name binding operation in\nthe same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- ``import *`` --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a ``SyntaxError``.\n\nIf ``exec`` is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n``SyntaxError`` unless the exec explicitly specifies the local\nnamespace for the ``exec``. (In other words, ``exec obj`` would be\nillegal, but ``exec obj in ns`` would be legal.)\n\nThe ``eval()``, ``execfile()``, and ``input()`` functions and the\n``exec`` statement do not have access to the full environment for\nresolving names. Names may be resolved in the local and global\nnamespaces of the caller. Free variables are not resolved in the\nnearest enclosing namespace, but in the global namespace. [1] The\n``exec`` statement and the ``eval()`` and ``execfile()`` functions\nhave optional arguments to override the global and local namespace.\nIf only one namespace is specified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the ``raise`` statement. Exception\nhandlers are specified with the ``try`` ... ``except`` statement. The\n``finally`` clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n``SystemExit``.\n\nExceptions are identified by class instances. The ``except`` clause\nis selected depending on the class of the instance: it must reference\nthe class of the instance or a base class thereof. The instance can\nbe received by the handler and can carry additional information about\nthe exceptional condition.\n\nExceptions can also be identified by strings, in which case the\n``except`` clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nWarning: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the ``try`` statement in section *The try\nstatement* and ``raise`` statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by these\n operations is not available at the time the module is compiled.\n', + 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: ``()``.)\n', + 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, ``077e010`` is legal, and denotes the same number as\n``77e10``. The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator ``-`` and the\nliteral ``1``.\n', + 'for': u'\nThe ``for`` statement\n*********************\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the ``else`` clause, if present, is executed, and the loop\nterminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function ``range()`` returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s ``for i := a to b\ndo``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nWarning: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An internal\n counter is used to keep track of which item is used next, and this\n is incremented on each iteration. When this counter has reached the\n length of the sequence the loop terminates. This means that if the\n suite deletes the current (or a previous) item from the sequence,\n the next item will be skipped (since it gets the index of the\n current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', + 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe ``str.format()`` method and the ``Formatter`` class share the same\nsyntax for format strings (although in the case of ``Formatter``,\nsubclasses can define their own format string syntax.)\n\nFormat strings contain "replacement fields" surrounded by curly braces\n``{}``. Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n``{{`` and ``}}``.\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" field_name ["!" conversion] [":" format_spec] "}"\n field_name ::= (identifier | integer) ("." attribute_name | "[" element_index "]")*\n attribute_name ::= identifier\n element_index ::= integer\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field starts with a\n*field_name*, which can either be a number (for a positional\nargument), or an identifier (for keyword arguments). Following this\nis an optional *conversion* field, which is preceded by an exclamation\npoint ``\'!\'``, and a *format_spec*, which is preceded by a colon\n``\':\'``.\n\nThe *field_name* itself begins with either a number or a keyword. If\nit\'s a number, it refers to a positional argument, and if it\'s a\nkeyword it refers to a named keyword argument. This can be followed\nby any number of index or attribute expressions. An expression of the\nform ``\'.name\'`` selects the named attribute using ``getattr()``,\nwhile an expression of the form ``\'[index]\'`` does an index lookup\nusing ``__getitem__()``.\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the\n``__format__()`` method of the value itself. However, in some cases\nit is desirable to force a type to be formatted as a string,\noverriding its own definition of formatting. By converting the value\nto a string before calling ``__format__()``, the normal formatting\nlogic is bypassed.\n\nTwo conversion flags are currently supported: ``\'!s\'`` which calls\n``str()`` on the value, and ``\'!r\'`` which calls ``repr()``.\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define it\'s\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nFor example, suppose you wanted to have a replacement field whose\nfield width is determined by another variable:\n\n "A man with two {0:{1}}".format("noses", 10)\n\nThis would first evaluate the inner replacement field, making the\nformat string effectively:\n\n "A man with two {0:10}"\n\nThen the outer replacement field would be evaluated, producing:\n\n "noses "\n\nWhich is subsitituted into the string, yielding:\n\n "A man with two noses "\n\n(The extra space is because we specified a field width of 10, and\nbecause left alignment is the default for strings.)\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*.) They can also be passed directly to the\nbuiltin ``format()`` function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string (``""``) produces\nthe same result as if you had called ``str()`` on the value.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][0][width][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "x" | "X" | "%"\n\nThe *fill* character can be any character other than \'}\' (which\nsignifies the end of the field). The presence of a fill character is\nsignaled by the *next* character, which must be one of the alignment\noptions. If the second character of *format_spec* is not a valid\nalignment option, then it is assumed that both the fill character and\nthe alignment option are absent.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'<\'`` | Forces the field to be left-aligned within the available |\n | | space (This is the default.) |\n +-----------+------------------------------------------------------------+\n | ``\'>\'`` | Forces the field to be right-aligned within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n | ``\'=\'`` | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | ``\'^\'`` | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'+\'`` | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | ``\'-\'`` | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nIf the *width* field is preceded by a zero (``\'0\'``) character, this\nenables zero-padding. This is equivalent to an *alignment* type of\n``\'=\'`` and a *fill* character of ``\'0\'``.\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value. For\nnon-number types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is ignored for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'b\'`` | Binary. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | ``\'c\'`` | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | ``\'d\'`` | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | ``\'o\'`` | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | ``\'x\'`` | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'X\'`` | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'d\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | None | the same as ``\'d\'`` |\n +-----------+------------------------------------------------------------+\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'e\'`` | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n +-----------+------------------------------------------------------------+\n | ``\'E\'`` | Exponent notation. Same as ``\'e\'`` except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | ``\'f\'`` | Fixed point. Displays the number as a fixed-point number. |\n +-----------+------------------------------------------------------------+\n | ``\'F\'`` | Fixed point. Same as ``\'f\'``. |\n +-----------+------------------------------------------------------------+\n | ``\'g\'`` | General format. This prints the number as a fixed-point |\n | | number, unless the number is too large, in which case it |\n | | switches to ``\'e\'`` exponent notation. |\n +-----------+------------------------------------------------------------+\n | ``\'G\'`` | General format. Same as ``\'g\'`` except switches to ``\'E\'`` |\n | | if the number gets to large. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'g\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | ``\'%\'`` | Percentage. Multiplies the number by 100 and displays in |\n | | fixed (``\'f\'``) format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | the same as ``\'g\'`` |\n +-----------+------------------------------------------------------------+\n', + 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier [, "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called.\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Expression lists*. Note that the lambda form is\nmerely a shorthand for a simplified function definition; a function\ndefined in a "``def``" statement can be passed around or assigned to\nanother name just like a function defined by a lambda form. The\n"``def``" form is actually more powerful since it allows the execution\nof multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n', + 'global': u'\nThe ``global`` statement\n************************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe ``global`` statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without ``global``, although free variables may refer to\nglobals without being declared global.\n\nNames listed in a ``global`` statement must not be used in the same\ncode block textually preceding that ``global`` statement.\n\nNames listed in a ``global`` statement must not be defined as formal\nparameters or in a ``for`` loop control target, ``class`` definition,\nfunction definition, or ``import`` statement.\n\n(The current implementation does not enforce the latter two\nrestrictions, but programs should not abuse this freedom, as future\nimplementations may enforce them or silently change the meaning of the\nprogram.)\n\n**Programmer\'s note:** the ``global`` is a directive to the parser.\nIt applies only to code parsed at the same time as the ``global``\nstatement. In particular, a ``global`` statement contained in an\n``exec`` statement does not affect the code block *containing* the\n``exec`` statement, and code contained in an ``exec`` statement is\nunaffected by ``global`` statements in the code containing the\n``exec`` statement. The same applies to the ``eval()``,\n``execfile()`` and ``compile()`` functions.\n', + 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n``_*``\n Not imported by ``from module import *``. The special identifier\n ``_`` is used in the interactive interpreter to store the result of\n the last evaluation; it is stored in the ``__builtin__`` module.\n When not in interactive mode, ``_`` has no special meaning and is\n not defined. See section *The import statement*.\n\n Note: The name ``_`` is often used in conjunction with\n internationalization; refer to the documentation for the\n ``gettext`` module for more information on this convention.\n\n``__*__``\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library);\n applications should not expect to define additional names using\n this convention. The set of names of this class defined by Python\n may be extended in future versions. See section *Special method\n names*.\n\n``__*``\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', + 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n identifier ::= (letter|"_") (letter | digit | "_")*\n letter ::= lowercase | uppercase\n lowercase ::= "a"..."z"\n uppercase ::= "A"..."Z"\n digit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n and del from not while\n as elif global or with\n assert else if pass yield\n break except import print\n class exec in raise\n continue finally is return\n def for lambda try\n\nChanged in version 2.4: ``None`` became a constant and is now\nrecognized by the compiler as a name for the built-in object ``None``.\nAlthough it is not a keyword, you cannot assign a different object to\nit.\n\nChanged in version 2.5: Both ``as`` and ``with`` are only recognized\nwhen the ``with_statement`` future feature has been enabled. It will\nalways be enabled in Python 2.6. See section *The with statement* for\ndetails. Note that using ``as`` and ``with`` as identifiers will\nalways issue a warning, even when the ``with_statement`` future\ndirective is not in effect.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n``_*``\n Not imported by ``from module import *``. The special identifier\n ``_`` is used in the interactive interpreter to store the result of\n the last evaluation; it is stored in the ``__builtin__`` module.\n When not in interactive mode, ``_`` has no special meaning and is\n not defined. See section *The import statement*.\n\n Note: The name ``_`` is often used in conjunction with\n internationalization; refer to the documentation for the\n ``gettext`` module for more information on this convention.\n\n``__*__``\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library);\n applications should not expect to define additional names using\n this convention. The set of names of this class defined by Python\n may be extended in future versions. See section *Special method\n names*.\n\n``__*``\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', + 'if': u'\nThe ``if`` statement\n********************\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n', + 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., ``(3+4j)``. Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', + 'import': u'\nThe ``import`` statement\n************************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the ``import`` statement occurs). The\nfirst form (without ``from``) repeats these steps for each identifier\nin the list. The form with ``from`` performs step (1) once, and then\nperforms step (2) repeatedly.\n\nIn this context, to "initialize" a built-in or extension module means\nto call an initialization function that the module must provide for\nthe purpose (in the reference implementation, the function\'s name is\nobtained by prepending string "init" to the module\'s name); to\n"initialize" a Python-coded module means to execute the module\'s body.\n\nThe system maintains a table of modules that have been or are being\ninitialized, indexed by module name. This table is accessible as\n``sys.modules``. When a module name is found in this table, step (1)\nis finished. If not, a search for a module definition is started.\nWhen a module is found, it is loaded. Details of the module searching\nand loading process are implementation and platform specific. It\ngenerally involves searching for a "built-in" module with the given\nname and then searching a list of locations given as ``sys.path``.\n\nIf a built-in module is found, its built-in initialization code is\nexecuted and step (1) is finished. If no matching file is found,\n``ImportError`` is raised. If a file is found, it is parsed, yielding\nan executable code block. If a syntax error occurs, ``SyntaxError``\nis raised. Otherwise, an empty module of the given name is created\nand inserted in the module table, and then the code block is executed\nin the context of this module. Exceptions during this execution\nterminate step (1).\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of ``import`` statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by ``as``,\nthe name following ``as`` is used as the local name for the module.\n\nThe ``from`` form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of ``import``, an alternate local name\ncan be supplied by specifying "``as`` localname". If a name is not\nfound, ``ImportError`` is raised. If the list of identifiers is\nreplaced by a star (``\'*\'``), all public names defined in the module\nare bound in the local namespace of the ``import`` statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named ``__all__``; if defined, it\nmust be a sequence of strings which are names defined or imported by\nthat module. The names given in ``__all__`` are all considered public\nand are required to exist. If ``__all__`` is not defined, the set of\npublic names includes all names found in the module\'s namespace which\ndo not begin with an underscore character (``\'_\'``). ``__all__``\nshould contain the entire public API. It is intended to avoid\naccidentally exporting items that are not part of the API (such as\nlibrary modules which were imported and used within the module).\n\nThe ``from`` form with ``*`` may only occur in a module scope. If the\nwild card form of import --- ``import *`` --- is used in a function\nand the function contains or is a nested block with free variables,\nthe compiler will raise a ``SyntaxError``.\n\n**Hierarchical module names:** when the module names contains one or\nmore dots, the module search path is carried out differently. The\nsequence of identifiers up to the last dot is used to find a\n"package"; the final identifier is then searched inside the package.\nA package is generally a subdirectory of a directory on ``sys.path``\nthat has a file ``__init__.py``. [XXX Can\'t be bothered to spell this\nout right now; see the URL\nhttp://www.python.org/doc/essays/packages.html for more details, also\nabout how the module search works from inside a package.]\n\nThe built-in function ``__import__()`` is provided to support\napplications that determine which modules need to be loaded\ndynamically; refer to *Built-in Functions* for additional information.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.5 are ``absolute_import``,\n``division``, ``generators``, ``nested_scopes`` and\n``with_statement``. ``generators`` and ``nested_scopes`` are\nredundant in Python version 2.3 and above because they are always\nenabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module ``__future__``, described later, and it\nwill be imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an ``exec`` statement or calls to the builtin\nfunctions ``compile()`` and ``execfile()`` that occur in a module\n``M`` containing a future statement will, by default, use the new\nsyntax or semantics associated with the future statement. This can,\nstarting with Python 2.2 be controlled by optional arguments to\n``compile()`` --- see the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n', + 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe forms ``<>`` and ``!=`` are equivalent; for consistency with C,\n``!=`` is preferred; where ``!=`` is mentioned below ``<>`` is also\naccepted. The ``<>`` spelling is considered obsolescent.\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nobjects of different types *always* compare unequal, and are ordered\nconsistently but arbitrarily. You can control comparison behavior of\nobjects of non-builtin types by defining a ``__cmp__`` method or rich\ncomparison methods like ``__gt__``, described in section *Special\nmethod names*.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the ``in`` and ``not in``\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n Unicode and 8-bit strings are fully interoperable in this behavior.\n [4]\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``cmp([1,2,x], [1,2,y])`` returns\n the same as ``cmp(x,y)``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of builtin types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nThe operators ``in`` and ``not in`` test for collection membership.\n``x in s`` evaluates to true if *x* is a member of the collection *s*,\nand false otherwise. ``x not in s`` returns the negation of ``x in\ns``. The collection membership test has traditionally been bound to\nsequences; an object is a member of a collection if the collection is\na sequence and contains an element equal to that object. However, it\nmake sense for many other object types to support membership tests\nwithout being a sequence. In particular, dictionaries (for keys) and\nsets support membership testing.\n\nFor the list and tuple types, ``x in y`` is true if and only if there\nexists an index *i* such that ``x == y[i]`` is true.\n\nFor the Unicode and string types, ``x in y`` is true if and only if\n*x* is a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nNote, *x* and *y* need not be the same type; consequently, ``u\'ab\' in\n\'abc\'`` will return ``True``. Empty strings are always considered to\nbe a substring of any other string, so ``"" in "abc"`` will return\n``True``.\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength ``1``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` and do\ndefine ``__getitem__()``, ``x in y`` is true if and only if there is a\nnon-negative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value.\n', + 'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\n longinteger ::= integer ("l" | "L")\n integer ::= decimalinteger | octinteger | hexinteger\n decimalinteger ::= nonzerodigit digit* | "0"\n octinteger ::= "0" octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n nonzerodigit ::= "1"..."9"\n octdigit ::= "0"..."7"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case ``\'l\'`` and upper case ``\'L\'`` are allowed as\nsuffix for long integers, it is strongly recommended to always use\n``\'L\'``, since the letter ``\'l\'`` looks too much like the digit\n``\'1\'``.\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1] There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n 7 2147483647 0177\n 3L 79228162514264337593543950336L 0377L 0x100000000L\n 79228162514264337593543950336 0xdeadbeef\n', + 'lambda': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: ``()``.)\n', + 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | list_comprehension] "]"\n list_comprehension ::= expression list_for\n list_for ::= "for" target_list "in" old_expression_list [list_iter]\n old_expression_list ::= old_expression [("," old_expression)+ [","]]\n list_iter ::= list_for | list_if\n list_if ::= "if" old_expression [list_iter]\n\nA list display yields a new list object. Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order. When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one ``for`` clause and zero or\nmore ``for`` or ``if`` clauses. In this case, the elements of the new\nlist are those that would be produced by considering each of the\n``for`` or ``if`` clauses a block, nesting from left to right, and\nevaluating the expression to produce a list element each time the\ninnermost block is reached [1].\n', + 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function ``execfile()`` is a code block. The string argument\npassed to the built-in function ``eval()`` and to the ``exec``\nstatement is a code block. The expression read and evaluated by the\nbuilt-in function ``input()`` is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a ``NameError`` exception is raised.\nIf the name refers to a local variable that has not been bound, a\n``UnboundLocalError`` exception is raised. ``UnboundLocalError`` is a\nsubclass of ``NameError``.\n\nThe following constructs bind names: formal parameters to functions,\n``import`` statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, ``for`` loop header, or in\nthe second position of an ``except`` clause header. The ``import``\nstatement of the form "``from ...import *``" binds all names defined\nin the imported module, except those beginning with an underscore.\nThis form may only be used at the module level.\n\nA target occurring in a ``del`` statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a ``SyntaxError``.\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtin namespace, the namespace of\nthe module ``__builtin__``. The global namespace is searched first.\nIf the name is not found there, the builtin namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe built-in namespace associated with the execution of a code block\nis actually found by looking up the name ``__builtins__`` in its\nglobal namespace; this should be a dictionary or a module (in the\nlatter case the module\'s dictionary is used). By default, when in the\n``__main__`` module, ``__builtins__`` is the built-in module\n``__builtin__`` (note: no \'s\'); when in any other module,\n``__builtins__`` is an alias for the dictionary of the ``__builtin__``\nmodule itself. ``__builtins__`` can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\nNote: Users should not touch ``__builtins__``; it is strictly an\n implementation detail. Users wanting to override values in the\n built-in namespace should ``import`` the ``__builtin__`` (no \'s\')\n module and modify its attributes appropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n``__main__``.\n\nThe global statement has the same scope as a name binding operation in\nthe same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- ``import *`` --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a ``SyntaxError``.\n\nIf ``exec`` is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n``SyntaxError`` unless the exec explicitly specifies the local\nnamespace for the ``exec``. (In other words, ``exec obj`` would be\nillegal, but ``exec obj in ns`` would be legal.)\n\nThe ``eval()``, ``execfile()``, and ``input()`` functions and the\n``exec`` statement do not have access to the full environment for\nresolving names. Names may be resolved in the local and global\nnamespaces of the caller. Free variables are not resolved in the\nnearest enclosing namespace, but in the global namespace. [1] The\n``exec`` statement and the ``eval()`` and ``execfile()`` functions\nhave optional arguments to override the global and local namespace.\nIf only one namespace is specified, it is used for both.\n', + 'numbers': u"\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator '``-``' and\nthe literal ``1``.\n", + 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``//``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For\n instance, to evaluate the expression *x*``+``*y*, where *x* is an\n instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()`` (described below). Note\n that ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator (``/``) is implemented by these methods. The\n ``__truediv__()`` method is used when ``__future__.division`` is in\n effect, otherwise ``__div__()`` is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; ``TypeError`` will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with\n reflected (swapped) operands. These functions are only called if\n the left operand does not support the corresponding operation and\n the operands are of different types. [4] For instance, to evaluate\n the expression *x*``-``*y*, where *y* is an instance of a class\n that has an ``__rsub__()`` method, ``y.__rsub__(x)`` is called if\n ``x.__sub__(y)`` returns *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left operand\'s\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand\'s\n non-reflected method. This behavior allows subclasses to\n override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n operations (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n operation falls back to the normal methods. For instance, to\n evaluate the expression *x*``+=``*y*, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of *x*``+``*y*.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``long()``, and ``float()``. Should return a value of\n the appropriate type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions ``oct()`` and ``hex()``.\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n Added in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or ``None`` if conversion is impossible. When\n the common type would be the type of ``other``, it is sufficient to\n return ``None``, since the interpreter will also ask the other\n object to attempt a coercion (but sometimes, if the implementation\n of the other type cannot be changed, it is useful to do the\n conversion to the other type here). A return value of\n ``NotImplemented`` is equivalent to returning ``None``.\n', + 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'``is``\' operator compares the\nidentity of two objects; the ``id()`` function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The ``type()`` function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable. (Implementation note: the current implementation uses a\nreference-counting scheme with (optional) delayed detection of\ncyclically linked garbage, which collects most objects as soon as they\nbecome unreachable, but is not guaranteed to collect garbage\ncontaining circular references. See the documentation of the ``gc``\nmodule for information on controlling the collection of cyclic\ngarbage.)\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'``try``...``except``\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a ``close()`` method. Programs\nare strongly recommended to explicitly close such objects. The\n\'``try``...``finally``\' statement provides a convenient way to do\nthis.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after ``a = 1; b =\n1``, ``a`` and ``b`` may or may not refer to the same object with the\nvalue one, depending on the implementation, but after ``c = []; d =\n[]``, ``c`` and ``d`` are guaranteed to refer to two different,\nunique, newly created empty lists. (Note that ``c = d = []`` assigns\nthe same object to both ``c`` and ``d``.)\n', + 'operator-summary': u'\nSummary\n*******\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section *Comparisons* --- and exponentiation, which groups\nfrom right to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| ``lambda`` | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| ``or`` | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| ``and`` | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| ``not`` *x* | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``in``, ``not`` ``in`` | Membership tests |\n+-------------------------------------------------+---------------------------------------+\n| ``is``, ``is not`` | Identity tests |\n+-------------------------------------------------+---------------------------------------+\n| ``<``, ``<=``, ``>``, ``>=``, ``<>``, ``!=``, | Comparisons |\n| ``==`` | |\n+-------------------------------------------------+---------------------------------------+\n| ``|`` | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| ``^`` | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| ``&`` | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| ``<<``, ``>>`` | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| ``+``, ``-`` | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| ``*``, ``/``, ``%`` | Multiplication, division, remainder |\n+-------------------------------------------------+---------------------------------------+\n| ``+x``, ``-x`` | Positive, negative |\n+-------------------------------------------------+---------------------------------------+\n| ``~x`` | Bitwise not |\n+-------------------------------------------------+---------------------------------------+\n| ``**`` | Exponentiation |\n+-------------------------------------------------+---------------------------------------+\n| ``x.attribute`` | Attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index]`` | Subscription |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index:index]`` | Slicing |\n+-------------------------------------------------+---------------------------------------+\n| ``f(arguments...)`` | Function call |\n+-------------------------------------------------+---------------------------------------+\n| ``(expressions...)`` | Binding or tuple display |\n+-------------------------------------------------+---------------------------------------+\n| ``[expressions...]`` | List display |\n+-------------------------------------------------+---------------------------------------+\n| ``{key:datum...}`` | Dictionary display |\n+-------------------------------------------------+---------------------------------------+\n| ```expressions...``` | String conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks" the\n control variables of each ``for`` it contains into the containing\n scope. However, this behavior is deprecated, and relying on it\n will not work in Python 3.0\n\n[2] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it\n may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that ``-1e-100 % 1e100`` have the same\n sign as ``1e100``, the computed result is ``-1e-100 + 1e100``,\n which is numerically exactly equal to ``1e100``. Function\n ``fmod()`` in the ``math`` module returns a result whose sign\n matches the sign of the first argument instead, and so returns\n ``-1e-100`` in this case. Which approach is more appropriate\n depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for ``floor(x/y)`` to be one larger than ``(x-x%y)/y``\n due to rounding. In such cases, Python returns the latter result,\n in order to preserve that ``divmod(x,y)[0] * y + x % y`` be very\n close to ``x``.\n\n[4] While comparisons between unicode strings make sense at the byte\n level, they may be counter-intuitive to users. For example, the\n strings ``u"\\u00C7"`` and ``u"\\u0043\\u0327"`` compare differently,\n even though they both represent the same unicode character (LATIN\n CAPTITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using ``unicodedata.normalize()``.\n\n[5] The implementation computes this efficiently, without constructing\n lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of the\n sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to ``{}``.\n', + 'pass': u'\nThe ``pass`` statement\n**********************\n\n pass_stmt ::= "pass"\n\n``pass`` is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', + 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): ``-1**2`` results in ``-1``.\n\nThe power operator has the same semantics as the built-in ``pow()``\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, ``10**2`` returns ``100``, but\n``10**-2`` returns ``0.01``. (This last feature was added in Python\n2.2. In Python 2.1 and before, if both arguments were of integer types\nand the second argument was negative, an exception was raised).\n\nRaising ``0.0`` to a negative power results in a\n``ZeroDivisionError``. Raising a negative number to a fractional power\nresults in a ``ValueError``.\n', + 'print': u'\nThe ``print`` statement\n***********************\n\n print_stmt ::= "print" ([expression ("," expression)* [","]\n | ">>" expression [("," expression)+ [","])\n\n``print`` evaluates each expression in turn and writes the resulting\nobject to standard output (see below). If an object is not a string,\nit is first converted to a string using the rules for string\nconversions. The (resulting or original) string is then written. A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline. This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is ``\'\\n\'``, or (3) when the last write operation on standard\noutput was not a ``print`` statement. (In some cases it may be\nfunctional to write an empty string to standard output for this\nreason.)\n\nNote: Objects which act like file objects but which are not the built-in\n file objects often do not properly emulate this aspect of the file\n object\'s behavior, so it is best not to rely on this.\n\nA ``\'\\n\'`` character is written at the end, unless the ``print``\nstatement ends with a comma. This is the only action if the statement\ncontains just the keyword ``print``.\n\nStandard output is defined as the file object named ``stdout`` in the\nbuilt-in module ``sys``. If no such object exists, or if it does not\nhave a ``write()`` method, a ``RuntimeError`` exception is raised.\n\n``print`` also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n"``print`` chevron." In this form, the first expression after the\n``>>`` must evaluate to a "file-like" object, specifically an object\nthat has a ``write()`` method as described above. With this extended\nform, the subsequent expressions are printed to this file object. If\nthe first expression evaluates to ``None``, then ``sys.stdout`` is\nused as the file for output.\n', + 'raise': u'\nThe ``raise`` statement\n***********************\n\n raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, ``raise`` re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a ``TypeError`` exception is raised indicating that\nthis is an error (if running under IDLE, a ``Queue.Empty`` exception\nis raised instead).\n\nOtherwise, ``raise`` evaluates the expressions to get three objects,\nusing ``None`` as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be ``None``.\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is ``None``, an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not ``None``, it must be a traceback\nobject (see section *The standard type hierarchy*), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or ``None``, a ``TypeError`` exception is raised.\nThe three-expression form of ``raise`` is useful to re-raise an\nexception transparently in an except clause, but ``raise`` with no\nexpressions should be preferred if the exception to be re-raised was\nthe most recently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n', + 'return': u'\nThe ``return`` statement\n************************\n\n return_stmt ::= "return" [expression_list]\n\n``return`` may only occur syntactically nested in a function\ndefinition, not within a nested class definition.\n\nIf an expression list is present, it is evaluated, else ``None`` is\nsubstituted.\n\n``return`` leaves the current function call with the expression list\n(or ``None``) as return value.\n\nWhen ``return`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nleaving the function.\n\nIn a generator function, the ``return`` statement is not allowed to\ninclude an **expression_list**. In that context, a bare ``return``\nindicates that the generator is done and will cause ``StopIteration``\nto be raised.\n', + 'sequence-methods': u'\nAdditional methods for emulation of sequence types\n**************************************************\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine ``__getslice__()``; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated in version 2.0: Support slice objects as parameters to\n the ``__getitem__()`` method. (However, built-in types in CPython\n currently still implement ``__getslice__()``. Therefore, you have\n to override it in derived classes when implementing slicing.)\n\n Called to implement evaluation of ``self[i:j]``. The returned\n object should be of the same type as *self*. Note that missing *i*\n or *j* in the slice expression are replaced by zero or\n ``sys.maxint``, respectively. If negative indexes are used in the\n slice, the length of the sequence is added to that index. If the\n instance does not implement the ``__len__()`` method, an\n ``AttributeError`` is raised. No guarantee is made that indexes\n adjusted this way are not still negative. Indexes which are\n greater than the length of the sequence are not modified. If no\n ``__getslice__()`` is found, a slice object is created instead, and\n passed to ``__getitem__()`` instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``.\n\n This method is deprecated. If no ``__setslice__()`` is found, or\n for extended slicing of the form ``self[i:j:k]``, a slice object is\n created, and passed to ``__setitem__()``, instead of\n ``__setslice__()`` being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``. This method is deprecated. If no\n ``__delslice__()`` is found, or for extended slicing of the form\n ``self[i:j:k]``, a slice object is created, and passed to\n ``__delitem__()``, instead of ``__delslice__()`` being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, ``__getitem__()``, ``__setitem__()`` or\n``__delitem__()`` is called with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n``__getitem__()``, ``__setitem__()`` and ``__delitem__()`` support\nslice objects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to ``max()``; these are necessary because of the\nhandling of negative indices before the ``__*slice__()`` methods are\ncalled. When negative indexes are used, the ``__*item__()`` methods\nreceive them as provided, but the ``__*slice__()`` methods get a\n"cooked" form of the index values. For each negative index value, the\nlength of the sequence is added to the index before calling the method\n(which may still result in a negative index); this is the customary\nhandling of negative indexes by the built-in sequence types, and the\n``__*item__()`` methods are expected to do this as well. However,\nsince they should already be doing that, negative indexes cannot be\npassed in; they must be constrained to the bounds of the sequence\nbefore being passed to the ``__*item__()`` methods. Calling ``max(0,\ni)`` conveniently returns the proper value.\n', + 'sequence-types': u"\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which ``0 <= k < N``\nwhere *N* is the length of the sequence, or slice objects, which\ndefine a range of items. (For backwards compatibility, the method\n``__getslice__()`` (see below) can also be defined to handle simple,\nbut not extended slices.) It is also recommended that mappings provide\nthe methods ``keys()``, ``values()``, ``items()``, ``has_key()``,\n``get()``, ``clear()``, ``setdefault()``, ``iterkeys()``,\n``itervalues()``, ``iteritems()``, ``pop()``, ``popitem()``,\n``copy()``, and ``update()`` behaving similar to those for Python's\nstandard dictionary objects. The ``UserDict`` module provides a\n``DictMixin`` class to help create those methods from a base set of\n``__getitem__()``, ``__setitem__()``, ``__delitem__()``, and\n``keys()``. Mutable sequences should provide methods ``append()``,\n``count()``, ``index()``, ``extend()``, ``insert()``, ``pop()``,\n``remove()``, ``reverse()`` and ``sort()``, like Python standard list\nobjects. Finally, sequence types should implement addition (meaning\nconcatenation) and multiplication (meaning repetition) by defining the\nmethods ``__add__()``, ``__radd__()``, ``__iadd__()``, ``__mul__()``,\n``__rmul__()`` and ``__imul__()`` described below; they should not\ndefine ``__coerce__()`` or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n``__contains__()`` method to allow efficient use of the ``in``\noperator; for mappings, ``in`` should be equivalent of ``has_key()``;\nfor sequences, it should search through the values. It is further\nrecommended that both mappings and sequences implement the\n``__iter__()`` method to allow efficient iteration through the\ncontainer; for mappings, ``__iter__()`` should be the same as\n``iterkeys()``; for sequences, it should iterate through the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function ``len()``. Should return\n the length of the object, an integer ``>=`` 0. Also, an object\n that doesn't define a ``__nonzero__()`` method and whose\n ``__len__()`` method returns zero is considered to be false in a\n Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of ``self[key]``. For sequence\n types, the accepted keys should be integers and slice objects.\n Note that the special interpretation of negative indexes (if the\n class wishes to emulate a sequence type) is up to the\n ``__getitem__()`` method. If *key* is of an inappropriate type,\n ``TypeError`` may be raised; if of a value outside the set of\n indexes for the sequence (after any special interpretation of\n negative values), ``IndexError`` should be raised. For mapping\n types, if *key* is missing (not in the container), ``KeyError``\n should be raised.\n\n Note: ``for`` loops expect that an ``IndexError`` will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the ``__getitem__()`` method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the ``__getitem__()``\n method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method ``iterkeys()``.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the ``reversed()`` builtin to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the ``__reversed__()`` method is not provided, the\n ``reversed()`` builtin will fall back to using the sequence\n protocol (``__len__()`` and ``__getitem__()``). Objects should\n normally only provide ``__reversed__()`` if they do not support the\n sequence protocol and an efficient implementation of reverse\n iteration is possible.\n\n Added in version 2.6.\n\nThe membership test operators (``in`` and ``not in``) are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n", + 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by ``pow(2, n)``. A\nleft shift by *n* bits is defined as multiplication with ``pow(2,\nn)``. Negative shift counts raise a ``ValueError`` exception.\n', + 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or ``del`` statements. The syntax for a\nslicing:\n\n slicing ::= simple_slicing | extended_slicing\n simple_slicing ::= primary "[" short_slice "]"\n extended_slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice | ellipsis\n proper_slice ::= short_slice | long_slice\n short_slice ::= [lower_bound] ":" [upper_bound]\n long_slice ::= short_slice ":" [stride]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n ellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n``sys.maxint``, respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that ``i <= k < j`` where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in ``Ellipsis`` object. The conversion of a proper\nslice is a slice object (see section *The standard type hierarchy*)\nwhose ``start``, ``stop`` and ``step`` attributes are the values of\nthe expressions given as lower bound, upper bound and stride,\nrespectively, substituting ``None`` for missing expressions.\n', + 'specialattrs': u"\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the ``dir()`` built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object's\n (writable) attributes.\n\nobject.__methods__\n\n Deprecated in version 2.2: Use the built-in function ``dir()`` to\n get a list of an object's attributes. This attribute is no longer\n available.\n\nobject.__members__\n\n Deprecated in version 2.2: Use the built-in function ``dir()`` to\n get a list of an object's attributes. This attribute is no longer\n available.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object. If there are no base\n classes, this will be an empty tuple.\n\nclass.__name__\n\n The name of the class or type.\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found in\n the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list ``[1, 2]`` is considered equal to\n ``[1.0, 2.0]``, and similarly for tuples.\n\n[3] They must have since the parser can't tell the type of the\n operands.\n\n[4] To format only a tuple you should therefore provide a singleton\n tuple whose only element is the tuple to be formatted.\n\n[5] These numbers are fairly arbitrary. They are intended to avoid\n printing endless strings of meaningless digits without hampering\n correct use and without having to know the exact precision of\n floating point values on a particular machine.\n\n[6] The advantage of leaving the newline on is that returning an empty\n string is then an unambiguous EOF indication. It is also possible\n (in cases where it might matter, for example, if you want to make\n an exact copy of a file while scanning its lines) to tell whether\n the last line of a file ended in a newline or not (yes this\n happens!).\n", + 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named ``__getitem__()``, and ``x`` is an instance of this\nclass, then ``x[i]`` is equivalent [2] to ``x.__getitem__(i)``.\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined.\n\nFor new-style classes, special methods are only guaranteed to work if\ndefined in an object\'s class, not in the object\'s instance dictionary.\nThat explains why this won\'t work:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n``NodeList`` interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. ``__new__()`` is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of ``__new__()`` should be the new object instance (usually\n an instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s ``__new__()`` method using\n ``super(currentclass, cls).__new__(cls[, ...])`` with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If ``__new__()`` returns an instance of *cls*, then the new\n instance\'s ``__init__()`` method will be invoked like\n ``__init__(self[, ...])``, where *self* is the new instance and the\n remaining arguments are the same as were passed to ``__new__()``.\n\n If ``__new__()`` does not return an instance of *cls*, then the new\n instance\'s ``__init__()`` method will not be invoked.\n\n ``__new__()`` is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called when the instance is created. The arguments are those\n passed to the class constructor expression. If a base class has an\n ``__init__()`` method, the derived class\'s ``__init__()`` method,\n if any, must explicitly call it to ensure proper initialization of\n the base class part of the instance; for example:\n ``BaseClass.__init__(self, [args...])``. As a special constraint\n on constructors, no value may be returned; doing so will cause a\n ``TypeError`` to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a ``__del__()`` method,\n the derived class\'s ``__del__()`` method, if any, must explicitly\n call it to ensure proper deletion of the base class part of the\n instance. Note that it is possible (though not recommended!) for\n the ``__del__()`` method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n ``__del__()`` methods are called for objects that still exist when\n the interpreter exits.\n\n Note: ``del x`` doesn\'t directly call ``x.__del__()`` --- the former\n decrements the reference count for ``x`` by one, and the latter\n is only called when ``x``\'s reference count reaches zero. Some\n common situations that may prevent the reference count of an\n object from going to zero include: circular references between\n objects (e.g., a doubly-linked list or a tree data structure with\n parent and child pointers); a reference to the object on the\n stack frame of a function that caught an exception (the traceback\n stored in ``sys.exc_traceback`` keeps the stack frame alive); or\n a reference to the object on the stack frame that raised an\n unhandled exception in interactive mode (the traceback stored in\n ``sys.last_traceback`` keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing ``None`` in\n ``sys.exc_traceback`` or ``sys.last_traceback``. Circular\n references which are garbage are detected when the option cycle\n detector is enabled (it\'s on by default), but can only be cleaned\n up if there are no Python-level ``__del__()`` methods involved.\n Refer to the documentation for the ``gc`` module for more\n information about how ``__del__()`` methods are handled by the\n cycle detector, particularly the description of the ``garbage``\n value.\n\n Warning: Due to the precarious circumstances under which ``__del__()``\n methods are invoked, exceptions that occur during their execution\n are ignored, and a warning is printed to ``sys.stderr`` instead.\n Also, when ``__del__()`` is invoked in response to a module being\n deleted (e.g., when execution of the program is done), other\n globals referenced by the ``__del__()`` method may already have\n been deleted. For this reason, ``__del__()`` methods should do\n the absolute minimum needed to maintain external invariants.\n Starting with version 1.5, Python guarantees that globals whose\n name begins with a single underscore are deleted from their\n module before other globals are deleted; if no other references\n to such globals exist, this may help in assuring that imported\n modules are still available at the time when the ``__del__()``\n method is called.\n\nobject.__repr__(self)\n\n Called by the ``repr()`` built-in function and by string\n conversions (reverse quotes) to compute the "official" string\n representation of an object. If at all possible, this should look\n like a valid Python expression that could be used to recreate an\n object with the same value (given an appropriate environment). If\n this is not possible, a string of the form ``<...some useful\n description...>`` should be returned. The return value must be a\n string object. If a class defines ``__repr__()`` but not\n ``__str__()``, then ``__repr__()`` is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the ``str()`` built-in function and by the ``print``\n statement to compute the "informal" string representation of an\n object. This differs from ``__repr__()`` in that it does not have\n to be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n Added in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to ``__cmp__()`` below. The\n correspondence between operator symbols and method names is as\n follows: ``xy`` call ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and\n ``x>=y`` calls ``x.__ge__(y)``.\n\n A rich comparison method may return the singleton\n ``NotImplemented`` if it does not implement the operation for a\n given pair of arguments. By convention, ``False`` and ``True`` are\n returned for a successful comparison. However, these methods can\n return any value, so if the comparison operator is used in a\n Boolean context (e.g., in the condition of an ``if`` statement),\n Python will call ``bool()`` on the value to determine if the result\n is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of ``x==y`` does not imply that ``x!=y`` is false.\n Accordingly, when defining ``__eq__()``, one should also define\n ``__ne__()`` so that the operators will behave as expected. See\n the paragraph on ``__hash__()`` for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, ``__lt__()`` and ``__gt__()`` are each\n other\'s reflection, ``__le__()`` and ``__ge__()`` are each other\'s\n reflection, and ``__eq__()`` and ``__ne__()`` are their own\n reflection.\n\n Arguments to rich comparison methods are never coerced.\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if ``self < other``,\n zero if ``self == other``, a positive integer if ``self > other``.\n If no ``__cmp__()``, ``__eq__()`` or ``__ne__()`` operation is\n defined, class instances are compared by object identity\n ("address"). See also the description of ``__hash__()`` for some\n important notes on creating *hashable* objects which support custom\n comparison operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by ``__cmp__()`` has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called for the key object for dictionary operations, and by the\n built-in function ``hash()``. Should return an integer usable as a\n hash value for dictionary operations. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g., using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a ``__cmp__()`` or ``__eq__()`` method\n it should not define a ``__hash__()`` operation either; if it\n defines ``__cmp__()`` or ``__eq__()`` but not ``__hash__()``, its\n instances will not be usable as dictionary keys. If a class\n defines mutable objects and implements a ``__cmp__()`` or\n ``__eq__()`` method, it should not implement ``__hash__()``, since\n the dictionary implementation requires that a key\'s hash value is\n immutable (if the object\'s hash value changes, it will be in the\n wrong hash bucket).\n\n User-defined classes have ``__cmp__()`` and ``__hash__()`` methods\n by default; with them, all objects compare unequal and\n ``x.__hash__()`` returns ``id(x)``.\n\n Changed in version 2.5: ``__hash__()`` may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing, and the built-in operation\n ``bool()``; should return ``False`` or ``True``, or their integer\n equivalents ``0`` or ``1``. When this method is not defined,\n ``__len__()`` is called, if it is defined (see below). If a class\n defines neither ``__len__()`` nor ``__nonzero__()``, all its\n instances are considered true.\n\nobject.__unicode__(self)\n\n Called to implement ``unicode()`` builtin; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of ``x.name``)\nfor class instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for ``self``). ``name`` is the attribute name.\n This method should return the (computed) attribute value or raise\n an ``AttributeError`` exception.\n\n Note that if the attribute is found through the normal mechanism,\n ``__getattr__()`` is not called. (This is an intentional asymmetry\n between ``__getattr__()`` and ``__setattr__()``.) This is done both\n for efficiency reasons and because otherwise ``__setattr__()``\n would have no way to access other attributes of the instance. Note\n that at least for instance variables, you can fake total control by\n not inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n ``__getattribute__()`` method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If ``__setattr__()`` wants to assign to an instance attribute, it\n should not simply execute ``self.name = value`` --- this would\n cause a recursive call to itself. Instead, it should insert the\n value in the dictionary of instance attributes, e.g.,\n ``self.__dict__[name] = value``. For new-style classes, rather\n than accessing the instance dictionary, it should call the base\n class method with the same name, for example,\n ``object.__setattr__(self, name, value)``.\n\nobject.__delattr__(self, name)\n\n Like ``__setattr__()`` but for attribute deletion instead of\n assignment. This should only be implemented if ``del obj.name`` is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines\n ``__getattr__()``, the latter will not be called unless\n ``__getattribute__()`` either calls it explicitly or raises an\n ``AttributeError``. This method should return the (computed)\n attribute value or raise an ``AttributeError`` exception. In order\n to avoid infinite recursion in this method, its implementation\n should always call the base class method with the same name to\n access any attributes it needs, for example,\n ``object.__getattribute__(self, name)``.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in the\nclass dictionary of another new-style class, known as the *owner*\nclass. In the examples below, "the attribute" refers to the attribute\nwhose name is the key of the property in the owner class\'\n``__dict__``. Descriptors can only be implemented as new-style\nclasses themselves.\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or ``None`` when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an\n ``AttributeError`` exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: ``__get__()``, ``__set__()``, and\n``__delete__()``. If any of those methods are defined for an object,\nit is said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, ``a.x`` has a\nlookup chain starting with ``a.__dict__[\'x\']``, then\n``type(a).__dict__[\'x\']``, and continuing through the base classes of\n``type(a)`` excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass ``object()`` or\n``type()``).\n\nThe starting point for descriptor invocation is a binding, ``a.x``.\nHow the arguments are assembled depends on ``a``:\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: ``x.__get__(a)``.\n\nInstance Binding\n If binding to a new-style object instance, ``a.x`` is transformed\n into the call: ``type(a).__dict__[\'x\'].__get__(a, type(a))``.\n\nClass Binding\n If binding to a new-style class, ``A.x`` is transformed into the\n call: ``A.__dict__[\'x\'].__get__(None, A)``.\n\nSuper Binding\n If ``a`` is an instance of ``super``, then the binding ``super(B,\n obj).m()`` searches ``obj.__class__.__mro__`` for the base class\n ``A`` immediately preceding ``B`` and then invokes the descriptor\n with the call: ``A.__dict__[\'m\'].__get__(obj, A)``.\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. Normally, data\ndescriptors define both ``__get__()`` and ``__set__()``, while non-\ndata descriptors have just the ``__get__()`` method. Data descriptors\nalways override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances. [3]\n\nPython methods (including ``staticmethod()`` and ``classmethod()``)\nare implemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe ``property()`` function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n Added in version 2.2.\n\nNotes on using *__slots__*\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises ``AttributeError``. If\n dynamic assignment of new variables is desired, then add\n ``\'__dict__\'`` to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding ``\'__dict__\'`` to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes defining\n *__slots__* do not support weak references to its instances. If weak\n reference support is needed, then add ``\'__weakref__\'`` to the\n sequence of strings in the *__slots__* declaration.\n\n Changed in version 2.3: Previously, adding ``\'__weakref__\'`` to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* If a class defines a slot also defined in a base class, the instance\n variable defined by the base class slot is inaccessible (except by\n retrieving its descriptor directly from the base class). This\n renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__*.\n\n* *__slots__* do not work for classes derived from "variable-length"\n built-in types such as ``long``, ``str`` and ``tuple``.\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings may\n also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using ``type()``. A\nclass definition is read into a separate namespace and the value of\nclass name is bound to the result of ``type(name, bases, dict)``.\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of ``type()``. This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing the\n role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s ``__new__()``\nmethod -- ``type.__new__()`` can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom ``__call__()`` method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for ``name``,\n ``bases``, and ``dict``. Upon class creation, the callable is used\n instead of the built-in ``type()``.\n\n Added in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If ``dict[\'__metaclass__\']`` exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, ``x(arg1, arg2, ...)`` is a shorthand for\n ``x.__call__(arg1, arg2, ...)``.\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which ``0 <= k < N``\nwhere *N* is the length of the sequence, or slice objects, which\ndefine a range of items. (For backwards compatibility, the method\n``__getslice__()`` (see below) can also be defined to handle simple,\nbut not extended slices.) It is also recommended that mappings provide\nthe methods ``keys()``, ``values()``, ``items()``, ``has_key()``,\n``get()``, ``clear()``, ``setdefault()``, ``iterkeys()``,\n``itervalues()``, ``iteritems()``, ``pop()``, ``popitem()``,\n``copy()``, and ``update()`` behaving similar to those for Python\'s\nstandard dictionary objects. The ``UserDict`` module provides a\n``DictMixin`` class to help create those methods from a base set of\n``__getitem__()``, ``__setitem__()``, ``__delitem__()``, and\n``keys()``. Mutable sequences should provide methods ``append()``,\n``count()``, ``index()``, ``extend()``, ``insert()``, ``pop()``,\n``remove()``, ``reverse()`` and ``sort()``, like Python standard list\nobjects. Finally, sequence types should implement addition (meaning\nconcatenation) and multiplication (meaning repetition) by defining the\nmethods ``__add__()``, ``__radd__()``, ``__iadd__()``, ``__mul__()``,\n``__rmul__()`` and ``__imul__()`` described below; they should not\ndefine ``__coerce__()`` or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n``__contains__()`` method to allow efficient use of the ``in``\noperator; for mappings, ``in`` should be equivalent of ``has_key()``;\nfor sequences, it should search through the values. It is further\nrecommended that both mappings and sequences implement the\n``__iter__()`` method to allow efficient iteration through the\ncontainer; for mappings, ``__iter__()`` should be the same as\n``iterkeys()``; for sequences, it should iterate through the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function ``len()``. Should return\n the length of the object, an integer ``>=`` 0. Also, an object\n that doesn\'t define a ``__nonzero__()`` method and whose\n ``__len__()`` method returns zero is considered to be false in a\n Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of ``self[key]``. For sequence\n types, the accepted keys should be integers and slice objects.\n Note that the special interpretation of negative indexes (if the\n class wishes to emulate a sequence type) is up to the\n ``__getitem__()`` method. If *key* is of an inappropriate type,\n ``TypeError`` may be raised; if of a value outside the set of\n indexes for the sequence (after any special interpretation of\n negative values), ``IndexError`` should be raised. For mapping\n types, if *key* is missing (not in the container), ``KeyError``\n should be raised.\n\n Note: ``for`` loops expect that an ``IndexError`` will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the ``__getitem__()`` method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of ``self[key]``. Same note as for\n ``__getitem__()``. This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the ``__getitem__()``\n method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method ``iterkeys()``.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the ``reversed()`` builtin to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the ``__reversed__()`` method is not provided, the\n ``reversed()`` builtin will fall back to using the sequence\n protocol (``__len__()`` and ``__getitem__()``). Objects should\n normally only provide ``__reversed__()`` if they do not support the\n sequence protocol and an efficient implementation of reverse\n iteration is possible.\n\n Added in version 2.6.\n\nThe membership test operators (``in`` and ``not in``) are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine ``__getslice__()``; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated in version 2.0: Support slice objects as parameters to\n the ``__getitem__()`` method. (However, built-in types in CPython\n currently still implement ``__getslice__()``. Therefore, you have\n to override it in derived classes when implementing slicing.)\n\n Called to implement evaluation of ``self[i:j]``. The returned\n object should be of the same type as *self*. Note that missing *i*\n or *j* in the slice expression are replaced by zero or\n ``sys.maxint``, respectively. If negative indexes are used in the\n slice, the length of the sequence is added to that index. If the\n instance does not implement the ``__len__()`` method, an\n ``AttributeError`` is raised. No guarantee is made that indexes\n adjusted this way are not still negative. Indexes which are\n greater than the length of the sequence are not modified. If no\n ``__getslice__()`` is found, a slice object is created instead, and\n passed to ``__getitem__()`` instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``.\n\n This method is deprecated. If no ``__setslice__()`` is found, or\n for extended slicing of the form ``self[i:j:k]``, a slice object is\n created, and passed to ``__setitem__()``, instead of\n ``__setslice__()`` being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of ``self[i:j]``. Same notes for *i*\n and *j* as for ``__getslice__()``. This method is deprecated. If no\n ``__delslice__()`` is found, or for extended slicing of the form\n ``self[i:j:k]``, a slice object is created, and passed to\n ``__delitem__()``, instead of ``__delslice__()`` being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, ``__getitem__()``, ``__setitem__()`` or\n``__delitem__()`` is called with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n``__getitem__()``, ``__setitem__()`` and ``__delitem__()`` support\nslice objects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to ``max()``; these are necessary because of the\nhandling of negative indices before the ``__*slice__()`` methods are\ncalled. When negative indexes are used, the ``__*item__()`` methods\nreceive them as provided, but the ``__*slice__()`` methods get a\n"cooked" form of the index values. For each negative index value, the\nlength of the sequence is added to the index before calling the method\n(which may still result in a negative index); this is the customary\nhandling of negative indexes by the built-in sequence types, and the\n``__*item__()`` methods are expected to do this as well. However,\nsince they should already be doing that, negative indexes cannot be\npassed in; they must be constrained to the bounds of the sequence\nbefore being passed to the ``__*item__()`` methods. Calling ``max(0,\ni)`` conveniently returns the proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``//``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For\n instance, to evaluate the expression *x*``+``*y*, where *x* is an\n instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()`` (described below). Note\n that ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator (``/``) is implemented by these methods. The\n ``__truediv__()`` method is used when ``__future__.division`` is in\n effect, otherwise ``__div__()`` is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; ``TypeError`` will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``%``, ``divmod()``,\n ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with\n reflected (swapped) operands. These functions are only called if\n the left operand does not support the corresponding operation and\n the operands are of different types. [4] For instance, to evaluate\n the expression *x*``-``*y*, where *y* is an instance of a class\n that has an ``__rsub__()`` method, ``y.__rsub__(x)`` is called if\n ``x.__sub__(y)`` returns *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left operand\'s\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand\'s\n non-reflected method. This behavior allows subclasses to\n override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n operations (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n operation falls back to the normal methods. For instance, to\n evaluate the expression *x*``+=``*y*, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of *x*``+``*y*.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``long()``, and ``float()``. Should return a value of\n the appropriate type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions ``oct()`` and ``hex()``.\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n Added in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or ``None`` if conversion is impossible. When\n the common type would be the type of ``other``, it is sufficient to\n return ``None``, since the interpreter will also ask the other\n object to attempt a coercion (but sometimes, if the implementation\n of the other type cannot be changed, it is useful to do the\n conversion to the other type here). A return value of\n ``NotImplemented`` is equivalent to returning ``None``.\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3.0, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from ``object``) never invoke the\n ``__coerce__()`` method in response to a binary operator; the only\n time ``__coerce__()`` is invoked is when the built-in function\n ``coerce()`` is called.\n\n* For most intents and purposes, an operator that returns\n ``NotImplemented`` is treated the same as one that is not\n implemented at all.\n\n* Below, ``__op__()`` and ``__rop__()`` are used to signify the\n generic method names corresponding to an operator; ``__iop__()`` is\n used for the corresponding in-place operator. For example, for the\n operator \'``+``\', ``__add__()`` and ``__radd__()`` are used for the\n left and right variant of the binary operator, and ``__iadd__()``\n for the in-place variant.\n\n* For objects *x* and *y*, first ``x.__op__(y)`` is tried. If this is\n not implemented or returns ``NotImplemented``, ``y.__rop__(x)`` is\n tried. If this is also not implemented or returns\n ``NotImplemented``, a ``TypeError`` exception is raised. But see\n the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s ``__rop__()`` method, the right operand\'s ``__rop__()``\n method is tried *before* the left operand\'s ``__op__()`` method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s ``__op__()`` method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is called\n before that type\'s ``__op__()`` or ``__rop__()`` method is called,\n but no sooner. If the coercion returns an object of a different\n type for the operand whose coercion is invoked, part of the process\n is redone using the new object.\n\n* When an in-place operator (like \'``+=``\') is used, if the left\n operand implements ``__iop__()``, it is invoked without any\n coercion. When the operation falls back to ``__op__()`` and/or\n ``__rop__()``, the normal coercion rules apply.\n\n* In *x*``+``*y*, if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In *x*``*``*y*, if one operator is a sequence that implements\n sequence repetition, and the other is an integer (``int`` or\n ``long``), sequence repetition is invoked.\n\n* Rich comparisons (implemented by methods ``__eq__()`` and so on)\n never use coercion. Three-way comparison (implemented by\n ``__cmp__()``) does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types ``int``,\n ``long`` and ``float`` do not use coercion; the type ``complex``\n however does use it. The difference can become apparent when\n subclassing these types. Over time, the type ``complex`` may be\n fixed to avoid coercion. All these types implement a\n ``__coerce__()`` method, for use by the built-in ``coerce()``\n function.\n\n\nWith Statement Context Managers\n===============================\n\nAdded in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n-[ Footnotes ]-\n\n[1] Since Python 2.2, a gradual merging of types and classes has been\n started that makes this and a few other assertions made in this\n manual not 100% accurate and complete: for example, it *is* now\n possible in some cases to change an object\'s type, under certain\n controlled conditions. Until this manual undergoes extensive\n revision, it must now be taken as authoritative only regarding\n "classic classes", that are still the default, for compatibility\n purposes, in Python 2.2 and 2.3. For more information, see\n http://www.python.org/doc/newstyle/.\n\n[2] This, and other statements, are only roughly true for instances of\n new-style classes.\n\n[3] A descriptor can define any combination of ``__get__()``,\n ``__set__()`` and ``__delete__()``. If it does not define\n ``__get__()``, then accessing the attribute even on an instance\n will return the descriptor object itself. If the descriptor\n defines ``__set__()`` and/or ``__delete__()``, it is a data\n descriptor; if it defines neither, it is a non-data descriptor.\n\n[4] For operands of the same type, it is assumed that if the non-\n reflected method (such as ``__add__()``) fails the operation is\n not supported, which is why the reflected method is not called.\n', + 'string-conversions': u'\nString conversions\n******************\n\nA string conversion is an expression list enclosed in reverse (a.k.a.\nbackward) quotes:\n\n string_conversion ::= "\'" expression_list "\'"\n\nA string conversion evaluates the contained expression list and\nconverts the resulting object into a string according to rules\nspecific to its type.\n\nIf the object is a string, a number, ``None``, or a tuple, list or\ndictionary containing only objects whose type is one of these, the\nresulting string is a valid Python expression which can be passed to\nthe built-in function ``eval()`` to yield an expression with the same\nvalue (or an approximation, if floating point numbers are involved).\n\n(In particular, converting a string adds quotes around it and converts\n"funny" characters to escape sequences that are safe to print.)\n\nRecursive objects (for example, lists or dictionaries that contain a\nreference to themselves, directly or indirectly) use ``...`` to\nindicate a recursive reference, and the result cannot be passed to\n``eval()`` to get an equal value (``SyntaxError`` will be raised\ninstead).\n\nThe built-in function ``repr()`` performs exactly the same conversion\nin its argument as enclosing it in parentheses and reverse quotes\ndoes. The built-in function ``str()`` performs a similar but more\nuser-friendly conversion.\n', + 'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Note that none of these methods take keyword\narguments.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbuffer, xrange* section. To output formatted strings use template\nstrings or the ``%`` operator described in the *String Formatting\nOperations* section. Also, see the ``re`` module for string functions\nbased on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with only its first character\n capitalized.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of occurrences of substring *sub* in the range\n [*start*, *end*]. Optional arguments *start* and *end* are\n interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n Added in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n Added in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the range [*start*, *end*].\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\nstr.format(format_string, *args, **kwargs)\n\n Perform a string formatting operation. The *format_string*\n argument can contain literal text or replacement fields delimited\n by braces ``{}``. Each replacement field contains either the\n numeric index of a positional argument, or the name of a keyword\n argument. Returns a copy of *format_string* where each replacement\n field is replaced with the string value of the corresponding\n argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3.0,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n Added in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters in the string are lowercase and\n there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters in the string are uppercase and\n there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(seq)\n\n Return a string which is the concatenation of the strings in the\n sequence *seq*. The separator between elements is the string\n providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n Added in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within s[start,end]. Optional\n arguments *start* and *end* are interpreted as in slice notation.\n Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n Added in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n Added in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string: words start with\n uppercase characters, all remaining cased characters are lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n Added in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string converted to uppercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than ``len(s)``.\n\n Added in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that that can be used to form decimal-radix\n numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n', + 'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= ""\'" longstringitem* ""\'"\n | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | escapeseq\n longstringitem ::= longstringchar | escapeseq\n shortstringchar ::= \n longstringchar ::= \n escapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the **stringprefix** and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section *Encoding declarations*.\n\nIn plain English: String literals can be enclosed in matching single\nquotes (``\'``) or double quotes (``"``). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash (``\\``)\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter ``\'r\'`` or\n``\'R\'``; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of ``\'u\'`` or\n``\'U\'`` makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. The two prefix characters may be\ncombined; in this case, ``\'u\'`` must appear before ``\'r\'``.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either ``\'`` or ``"``.)\n\nUnless an ``\'r\'`` or ``\'R\'`` prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| ``\\newline`` | Ignored | |\n+-------------------+-----------------------------------+---------+\n| ``\\\\`` | Backslash (``\\``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\\'`` | Single quote (``\'``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\"`` | Double quote (``"``) | |\n+-------------------+-----------------------------------+---------+\n| ``\\a`` | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| ``\\b`` | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| ``\\f`` | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| ``\\n`` | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| ``\\N{name}`` | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\r`` | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| ``\\t`` | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| ``\\uxxxx`` | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\Uxxxxxxxx`` | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| ``\\v`` | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| ``\\ooo`` | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| ``\\xhh`` | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can be\n encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n outside the Basic Multilingual Plane (BMP) will be encoded using a\n surrogate pair if Python is compiled to use 16-bit code units (the\n default). Individual code units which form parts of a surrogate\n pair can be encoded using this escape sequence.\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the byte\n with the given value; it is not necessary that the byte encodes a\n character in the source character set. In a Unicode literal, these\n escapes denote a Unicode character with the given value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an ``\'r\'`` or ``\'R\'`` prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n``r"\\n"`` consists of two characters: a backslash and a lowercase\n``\'n\'``. String quotes can be escaped with a backslash, but the\nbackslash remains in the string; for example, ``r"\\""`` is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; ``r"\\"`` is not a valid string literal (even a raw string\ncannot end in an odd number of backslashes). Specifically, *a raw\nstring cannot end in a single backslash* (since the backslash would\nescape the following quote character). Note also that a single\nbackslash followed by a newline is interpreted as those two characters\nas part of the string, *not* as a line continuation.\n\nWhen an ``\'r\'`` or ``\'R\'`` prefix is used in conjunction with a\n``\'u\'`` or ``\'U\'`` prefix, then the ``\\uXXXX`` and ``\\UXXXXXXXX``\nescape sequences are processed while *all other backslashes are left\nin the string*. For example, the string literal ``ur"\\u0062\\n"``\nconsists of three Unicode characters: \'LATIN SMALL LETTER B\', \'REVERSE\nSOLIDUS\', and \'LATIN SMALL LETTER N\'. Backslashes can be escaped with\na preceding backslash; however, both remain in the string. As a\nresult, ``\\uXXXX`` escape sequences are only recognized when there are\nan odd number of backslashes.\n', + 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., ``x[-1]`` selects the last item of\n``x``.) The resulting value must be a nonnegative integer less than\nthe number of items in the sequence, and the subscription selects the\nitem whose index is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', + 'truth': u"\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an ``if`` or\n``while`` condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* ``None``\n\n* ``False``\n\n* zero of any numeric type, for example, ``0``, ``0L``, ``0.0``,\n ``0j``.\n\n* any empty sequence, for example, ``''``, ``()``, ``[]``.\n\n* any empty mapping, for example, ``{}``.\n\n* instances of user-defined classes, if the class defines a\n ``__nonzero__()`` or ``__len__()`` method, when that method returns\n the integer zero or ``bool`` value ``False``. [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn ``0`` or ``False`` for false and ``1`` or ``True`` for true,\nunless otherwise stated. (Important exception: the Boolean operations\n``or`` and ``and`` always return one of their operands.)\n", + 'try': u'\nThe ``try`` statement\n*********************\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["," target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n``try``...``except``...``finally`` did not work. ``try``...``except``\nhad to be nested in ``try``...``finally``.\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object, a tuple containing an item compatible with the\nexception, or, in the (deprecated) case of string exceptions, is the\nraised string itself (note that the object identities must match, i.e.\nit must be the same string object, not just a string with the same\nvalue).\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the ``sys`` module:\n``sys.exc_type`` receives the object identifying the exception;\n``sys.exc_value`` receives the exception\'s parameter;\n``sys.exc_traceback`` receives a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. These details are also available through the\n``sys.exc_info()`` function, which returns a tuple ``(exc_type,\nexc_value, exc_traceback)``. Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n', + 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name ``None``.\n It is used to signify the absence of a value in many situations,\n e.g., it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``NotImplemented``. Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n ``Ellipsis``. It is used to indicate the presence of the ``...``\n syntax in a slice. Its truth value is true.\n\n``numbers.Number``\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n ``numbers.Integral``\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception ``OverflowError`` is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values False and True are the only\n Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ``"False"`` or\n ``"True"`` are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n ``numbers.Real`` (``float``)\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these is\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n ``numbers.Complex``\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number ``z`` can be retrieved through the read-only\n attributes ``z.real`` and ``z.imag``.\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function ``len()`` returns the number of\n items of a sequence. When the length of a sequence is *n*, the\n index set contains the numbers 0, 1, ..., *n*-1. Item *i* of\n sequence *a* is selected by ``a[i]``.\n\n Sequences also support slicing: ``a[i:j]`` selects all items with\n index *k* such that *i* ``<=`` *k* ``<`` *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: ``a[i:j:k]`` selects all items of *a* with index *x*\n where ``x = i + n*k``, *n* ``>=`` ``0`` and *i* ``<=`` *x* ``<``\n *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions ``chr()`` and ``ord()`` convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0-127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions ``chr()`` and ``ord()`` implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in ``sys.maxunicode``, and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions ``unichr()`` and\n ``ord()`` convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method ``encode()`` and the\n built-in function ``unicode()``.\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and ``del`` (delete) statements.\n\n There is currently a single intrinsic mutable sequence type:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n The extension module ``array`` provides an additional example of\n a mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function ``len()``\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n ``set()`` constructor and can be modified afterwards by several\n methods, such as ``add()``.\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in ``frozenset()`` constructor. As a frozenset is\n immutable and *hashable*, it can be used again as an element of\n another set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation ``a[k]`` selects the item indexed by\n ``k`` from the mapping ``a``; this can be used in expressions and\n as the target of assignments or ``del`` statements. The built-in\n function ``len()`` returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., ``1`` and\n ``1.0``) then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the ``{...}``\n notation (see section *Dictionary displays*).\n\n The extension modules ``dbm``, ``gdbm``, and ``bsddb`` provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section *Calls*) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section *Function definitions*). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | ``func_doc`` | The function\'s documentation | Writable |\n | | string, or ``None`` if | |\n | | unavailable | |\n +-------------------------+---------------------------------+-------------+\n | ``__doc__`` | Another way of spelling | Writable |\n | | ``func_doc`` | |\n +-------------------------+---------------------------------+-------------+\n | ``func_name`` | The function\'s name | Writable |\n +-------------------------+---------------------------------+-------------+\n | ``__name__`` | Another way of spelling | Writable |\n | | ``func_name`` | |\n +-------------------------+---------------------------------+-------------+\n | ``__module__`` | The name of the module the | Writable |\n | | function was defined in, or | |\n | | ``None`` if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_defaults`` | A tuple containing default | Writable |\n | | argument values for those | |\n | | arguments that have defaults, | |\n | | or ``None`` if no arguments | |\n | | have a default value | |\n +-------------------------+---------------------------------+-------------+\n | ``func_code`` | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_globals`` | A reference to the dictionary | Read-only |\n | | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_dict`` | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | ``func_closure`` | ``None`` or a tuple of cells | Read-only |\n | | that contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: ``func_name`` is now writable.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or ``None``) and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: ``im_self`` is the class instance\n object, ``im_func`` is the function object; ``im_class`` is the\n class of ``im_self`` for bound methods or the class that asked\n for the method for unbound methods; ``__doc__`` is the method\'s\n documentation (same as ``im_func.__doc__``); ``__name__`` is the\n method name (same as ``im_func.__name__``); ``__module__`` is\n the name of the module the method was defined in, or ``None`` if\n unavailable.\n\n Changed in version 2.2: ``im_self`` used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For 3.0 forward-compatibility,\n ``im_func`` is also available as ``__func__``, and ``im_self``\n as ``__self__``.\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its ``im_self``\n attribute is ``None`` and the method object is said to be\n unbound. When one is created by retrieving a user-defined\n function object from a class via one of its instances, its\n ``im_self`` attribute is the instance, and the method object is\n said to be bound. In either case, the new method\'s ``im_class``\n attribute is the class from which the retrieval takes place, and\n its ``im_func`` attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the ``im_func``\n attribute of the new instance is not the original method object\n but its ``im_func`` attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its ``im_self``\n attribute is the class itself (the same as the ``im_class``\n attribute), and its ``im_func`` attribute is the function object\n underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function (``im_func``) is called, with the\n restriction that the first argument must be an instance of the\n proper class (``im_class``) or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function (``im_func``) is called, inserting the class\n instance (``im_self``) in front of the argument list. For\n instance, when ``C`` is a class which contains a definition for\n a function ``f()``, and ``x`` is an instance of ``C``, calling\n ``x.f(1)`` is equivalent to calling ``C.f(x, 1)``.\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in ``im_self`` will actually\n be the class itself, so that calling either ``x.f(1)`` or\n ``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is\n the underlying function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the ``yield`` statement (see\n section *The yield statement*) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s ``next()`` method will cause the function to\n execute until it provides a value using the ``yield`` statement.\n When the function executes a ``return`` statement or falls off\n the end, a ``StopIteration`` exception is raised and the\n iterator will have reached the end of the set of values to be\n returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are ``len()`` and ``math.sin()``\n (``math`` is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: ``__doc__`` is the function\'s documentation\n string, or ``None`` if unavailable; ``__name__`` is the\n function\'s name; ``__self__`` is set to ``None`` (but see the\n next item); ``__module__`` is the name of the module the\n function was defined in or ``None`` if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n ``alist.append()``, assuming *alist* is a list object. In this\n case, the special read-only attribute ``__self__`` is set to the\n object denoted by *list*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override ``__new__()``. The arguments of the call are passed to\n ``__new__()`` and, in the typical case, to ``__init__()`` to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s ``__init__()``\n method if it has one. Any arguments are passed on to the\n ``__init__()`` method. If there is no ``__init__()`` method,\n the class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a ``__call__()`` method;\n ``x(arguments)`` is a shorthand for ``x.__call__(arguments)``.\n\nModules\n Modules are imported by the ``import`` statement (see section *The\n import statement*). A module object has a namespace implemented by\n a dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., ``m.x`` is equivalent to ``m.__dict__["x"]``. A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., ``m.x = 1`` is equivalent to ``m.__dict__["x"] = 1``.\n\n Special read-only attribute: ``__dict__`` is the module\'s namespace\n as a dictionary object.\n\n Predefined (writable) attributes: ``__name__`` is the module\'s\n name; ``__doc__`` is the module\'s documentation string, or ``None``\n if unavailable; ``__file__`` is the pathname of the file from which\n the module was loaded, if it was loaded from a file. The\n ``__file__`` attribute is not present for C modules that are\n statically linked into the interpreter; for extension modules\n loaded dynamically from a shared library, it is the pathname of the\n shared library file.\n\nClasses\n Class objects are created by class definitions (see section *Class\n definitions*). A class has a namespace implemented by a dictionary\n object. Class attribute references are translated to lookups in\n this dictionary, e.g., ``C.x`` is translated to\n ``C.__dict__["x"]``. When the attribute name is not found there,\n the attribute search continues in the base classes. The search is\n depth-first, left-to-right in the order of occurrence in the base\n class list.\n\n When a class attribute reference (for class ``C``, say) would yield\n a user-defined function object or an unbound user-defined method\n object whose associated class is either ``C`` or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose ``im_class`` attribute is ``C``. When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose ``im_class`` and ``im_self`` attributes are\n both ``C``. When it would yield a static method object, it is\n transformed into the object wrapped by the static method object.\n See section *Implementing Descriptors* for another way in which\n attributes retrieved from a class may differ from those actually\n contained in its ``__dict__``.\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: ``__name__`` is the class name; ``__module__``\n is the module name in which the class was defined; ``__dict__`` is\n the dictionary containing the class\'s namespace; ``__bases__`` is a\n tuple (possibly empty or a singleton) containing the base classes,\n in the order of their occurrence in the base class list;\n ``__doc__`` is the class\'s documentation string, or None if\n undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it ``C``) of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n ``im_class`` attribute is ``C`` and whose ``im_self`` attribute is\n the instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class ``C``; see\n above under "Classes". See section *Implementing Descriptors* for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s ``__dict__``. If no class attribute is found, and the\n object\'s class has a ``__getattr__()`` method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n ``__setattr__()`` or ``__delattr__()`` method, this is called\n instead of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n *Special method names*.\n\n Special attributes: ``__dict__`` is the attribute dictionary;\n ``__class__`` is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the ``open()`` built-in function, and also by ``os.popen()``,\n ``os.fdopen()``, and the ``makefile()`` method of socket objects\n (and perhaps by other functions or methods provided by extension\n modules). The objects ``sys.stdin``, ``sys.stdout`` and\n ``sys.stderr`` are initialized to file objects corresponding to the\n interpreter\'s standard input, output and error streams. See *File\n Objects* for complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: ``co_name`` gives the function\n name; ``co_argcount`` is the number of positional arguments\n (including arguments with default values); ``co_nlocals`` is the\n number of local variables used by the function (including\n arguments); ``co_varnames`` is a tuple containing the names of\n the local variables (starting with the argument names);\n ``co_cellvars`` is a tuple containing the names of local\n variables that are referenced by nested functions;\n ``co_freevars`` is a tuple containing the names of free\n variables; ``co_code`` is a string representing the sequence of\n bytecode instructions; ``co_consts`` is a tuple containing the\n literals used by the bytecode; ``co_names`` is a tuple\n containing the names used by the bytecode; ``co_filename`` is\n the filename from which the code was compiled;\n ``co_firstlineno`` is the first line number of the function;\n ``co_lnotab`` is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); ``co_stacksize`` is the required stack size\n (including local variables); ``co_flags`` is an integer encoding\n a number of flags for the interpreter.\n\n The following flag bits are defined for ``co_flags``: bit\n ``0x04`` is set if the function uses the ``*arguments`` syntax\n to accept an arbitrary number of positional arguments; bit\n ``0x08`` is set if the function uses the ``**keywords`` syntax\n to accept arbitrary keyword arguments; bit ``0x20`` is set if\n the function is a generator.\n\n Future feature declarations (``from __future__ import\n division``) also use bits in ``co_flags`` to indicate whether a\n code object was compiled with a particular feature enabled: bit\n ``0x2000`` is set if the function was compiled with future\n division enabled; bits ``0x10`` and ``0x1000`` were used in\n earlier versions of Python.\n\n Other bits in ``co_flags`` are reserved for internal use.\n\n If a code object represents a function, the first item in\n ``co_consts`` is the documentation string of the function, or\n ``None`` if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: ``f_back`` is to the previous\n stack frame (towards the caller), or ``None`` if this is the\n bottom stack frame; ``f_code`` is the code object being executed\n in this frame; ``f_locals`` is the dictionary used to look up\n local variables; ``f_globals`` is used for global variables;\n ``f_builtins`` is used for built-in (intrinsic) names;\n ``f_restricted`` is a flag indicating whether the function is\n executing in restricted execution mode; ``f_lasti`` gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: ``f_trace``, if not ``None``, is a\n function called at the start of each source code line (this is\n used by the debugger); ``f_exc_type``, ``f_exc_value``,\n ``f_exc_traceback`` represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are None); ``f_lineno``\n is the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n *The try statement*.) It is accessible as ``sys.exc_traceback``,\n and also as the third item of the tuple returned by\n ``sys.exc_info()``. The latter is the preferred interface,\n since it works correctly when the program is using multiple\n threads. When the program contains no suitable handler, the\n stack trace is written (nicely formatted) to the standard error\n stream; if the interpreter is interactive, it is also made\n available to the user as ``sys.last_traceback``.\n\n Special read-only attributes: ``tb_next`` is the next level in\n the stack trace (towards the frame where the exception\n occurred), or ``None`` if there is no next level; ``tb_frame``\n points to the execution frame of the current level;\n ``tb_lineno`` gives the line number where the exception\n occurred; ``tb_lasti`` indicates the precise instruction. The\n line number and last instruction in the traceback may differ\n from the line number of its frame object if the exception\n occurred in a ``try`` statement with no matching except clause\n or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., ``a[i:j:step]``,\n ``a[i:j, k:l]``, or ``a[..., i:j]``. They are also created by\n the built-in ``slice()`` function.\n\n Special read-only attributes: ``start`` is the lower bound;\n ``stop`` is the upper bound; ``step`` is the step value; each is\n ``None`` if omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n Added in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n ``staticmethod()`` constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in ``classmethod()`` constructor.\n', + 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: ``func(argument-list)``.\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee *Function definitions* for more information.\n', + 'typesmapping': u'\nMapping Types --- ``dict``\n**************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin ``list``, ``set``, and ``tuple`` classes, and the ``collections``\nmodule.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as ``1`` and ``1.0``) then they can be used interchangeably to\nindex the same dictionary entry. (Note however, that since computers\nstore floating-point numbers as approximations it is usually unwise to\nuse them as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of\n``key: value`` pairs within braces, for example: ``{\'jack\': 4098,\n\'sjoerd\': 4127}`` or ``{4098: \'jack\', 4127: \'sjoerd\'}``, or by the\n``dict`` constructor.\n\nclass dict([arg])\n\n Return a new dictionary initialized from an optional positional\n argument or from a set of keyword arguments. If no arguments are\n given, return a new empty dictionary. If the positional argument\n *arg* is a mapping object, return a dictionary mapping the same\n keys to the same values as does the mapping object. Otherwise the\n positional argument must be a sequence, a container that supports\n iteration, or an iterator object. The elements of the argument\n must each also be of one of those kinds, and each must in turn\n contain exactly two objects. The first is used as a key in the new\n dictionary, and the second as the key\'s value. If a given key is\n seen more than once, the last value associated with it is retained\n in the new dictionary.\n\n If keyword arguments are given, the keywords themselves with their\n associated values are added as items to the dictionary. If a key is\n specified both in the positional argument and as a keyword\n argument, the value associated with the keyword is retained in the\n dictionary. For example, these all return a dictionary equal to\n ``{"one": 2, "two": 3}``:\n\n * ``dict(one=2, two=3)``\n\n * ``dict({\'one\': 2, \'two\': 3})``\n\n * ``dict(zip((\'one\', \'two\'), (2, 3)))``\n\n * ``dict([[\'two\', 3], [\'one\', 2]])``\n\n The first example only works for keys that are valid Python\n identifiers; the others work with any valid keys.\n\n Added in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a ``KeyError`` if\n *key* is not in the map.\n\n Added in version 2.5: If a subclass of dict defines a method\n ``__missing__()``, if the key *key* is not present, the\n ``d[key]`` operation calls that method with the key *key* as\n argument. The ``d[key]`` operation then returns or raises\n whatever is returned or raised by the ``__missing__(key)`` call\n if the key is not present. No other operations or methods invoke\n ``__missing__()``. If ``__missing__()`` is not defined,\n ``KeyError`` is raised. ``__missing__()`` must be a method; it\n cannot be an instance variable. For an example, see\n ``collections.defaultdict``.\n\n d[key] = value\n\n Set ``d[key]`` to *value*.\n\n del d[key]\n\n Remove ``d[key]`` from *d*. Raises a ``KeyError`` if *key* is\n not in the map.\n\n key in d\n\n Return ``True`` if *d* has a key *key*, else ``False``.\n\n Added in version 2.2.\n\n key not in d\n\n Equivalent to ``not key in d``.\n\n Added in version 2.2.\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n ``fromkeys()`` is a class method that returns a new dictionary.\n *value* defaults to ``None``.\n\n Added in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to ``None``,\n so that this method never raises a ``KeyError``.\n\n has_key(key)\n\n ``dict.has_key(key)`` is equivalent to ``key in d``, but\n deprecated.\n\n items()\n\n Return a copy of the dictionary\'s list of ``(key, value)``\n pairs.\n\n Note: Keys and values are listed in an arbitrary order which is non-\n random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If\n ``items()``, ``keys()``, ``values()``, ``iteritems()``,\n ``iterkeys()``, and ``itervalues()`` are called with no\n intervening modifications to the dictionary, the lists will\n directly correspond. This allows the creation of ``(value,\n key)`` pairs using ``zip()``: ``pairs = zip(d.values(),\n d.keys())``. The same relationship holds for the\n ``iterkeys()`` and ``itervalues()`` methods: ``pairs =\n zip(d.itervalues(), d.iterkeys())`` provides the same value\n for ``pairs``. Another way to create the same list is ``pairs\n = [(v, k) for (k, v) in d.iteritems()]``.\n\n iteritems()\n\n Return an iterator over the dictionary\'s ``(key, value)`` pairs.\n See the note for ``dict.items()``.\n\n Added in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n ``dict.items()``.\n\n Added in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for ``dict.items()``.\n\n Added in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for ``dict.items()``.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a ``KeyError`` is raised.\n\n Added in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary ``(key, value)`` pair from the\n dictionary.\n\n ``popitem()`` is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling ``popitem()`` raises a ``KeyError``.\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to ``None``.\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return ``None``.\n\n ``update()`` accepts either another dictionary object or an\n iterable of key/value pairs (as a tuple or other iterable of\n length two). If keyword arguments are specified, the dictionary\n is then is updated with those key/value pairs: ``d.update(red=1,\n blue=2)``.\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for ``dict.items()``.\n', + 'typesmethods': u"\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as ``append()`` on\nlists) and class instance methods. Built-in methods are described\nwith the types that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: ``m.im_self`` is the object on which the method\noperates, and ``m.im_func`` is the function implementing the method.\nCalling ``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to\ncalling ``m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)``.\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its ``im_self`` attribute\nwill be ``None`` and if called, an explicit ``self`` object must be\npassed as the first argument. In this case, ``self`` must be an\ninstance of the unbound method's class (or a subclass of that class),\notherwise a ``TypeError`` is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object (``meth.im_func``), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set a method attribute results in a ``TypeError`` being\nraised. In order to set a method attribute, you need to explicitly\nset it on the underlying function object:\n\n class C:\n def method(self):\n pass\n\n c = C()\n c.method.im_func.whoami = 'my name is c'\n\nSee *The standard type hierarchy* for more information.\n", + 'typesmodules': u"\nModules\n*******\n\nThe only special operation on a module is attribute access:\n``m.name``, where *m* is a module and *name* accesses a name defined\nin *m*'s symbol table. Module attributes can be assigned to. (Note\nthat the ``import`` statement is not, strictly speaking, an operation\non a module object; ``import foo`` does not require a module object\nnamed *foo* to exist, rather it requires an (external) *definition*\nfor a module named *foo* somewhere.)\n\nA special member of every module is ``__dict__``. This is the\ndictionary containing the module's symbol table. Modifying this\ndictionary will actually change the module's symbol table, but direct\nassignment to the ``__dict__`` attribute is not possible (you can\nwrite ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but\nyou can't write ``m.__dict__ = {}``). Modifying ``__dict__`` directly\nis not recommended.\n\nModules built into the interpreter are written like this: ````. If loaded from a file, they are written as\n````.\n", + 'typesseq': u'\nSequence Types --- ``str``, ``unicode``, ``list``, ``tuple``, ``buffer``, ``xrange``\n************************************************************************************\n\nThere are six sequence types: strings, Unicode strings, lists, tuples,\nbuffers, and xrange objects. (For other containers see the built in\n``dict``, ``list``, ``set``, and ``tuple`` classes, and the\n``collections`` module.)\n\nString literals are written in single or double quotes: ``\'xyzzy\'``,\n``"frobozz"``. See *String literals* for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding ``\'u\'`` character: ``u\'abc\'``, ``u"def"``. In\naddition to the functionality described here, there are also string-\nspecific methods described in the *String Methods* section. Lists are\nconstructed with square brackets, separating items with commas: ``[a,\nb, c]``. Tuples are constructed by the comma operator (not within\nsquare brackets), with or without enclosing parentheses, but an empty\ntuple must have the enclosing parentheses, such as ``a, b, c`` or\n``()``. A single item tuple must have a trailing comma, such as\n``(d,)``.\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the builtin function ``buffer()``. They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n``xrange()`` function. They don\'t support slicing, concatenation or\nrepetition, and using ``in``, ``not in``, ``min()`` or ``max()`` on\nthem is inefficient.\n\nMost sequence types support the following operations. The ``in`` and\n``not in`` operations have the same priorities as the comparison\noperations. The ``+`` and ``*`` operations have the same priority as\nthe corresponding numeric operations. [3] Additional methods are\nprovided for *Mutable Sequence Types*.\n\nThis table lists the sequence operations sorted in ascending priority\n(operations in the same box have the same priority). In the table,\n*s* and *t* are sequences of the same type; *n*, *i* and *j* are\nintegers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| ``x in s`` | ``True`` if an item of *s* is | (1) |\n| | equal to *x*, else ``False`` | |\n+--------------------+----------------------------------+------------+\n| ``x not in s`` | ``False`` if an item of *s* is | (1) |\n| | equal to *x*, else ``True`` | |\n+--------------------+----------------------------------+------------+\n| ``s + t`` | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| ``s * n, n * s`` | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| ``s[i]`` | *i*\'th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j:k]`` | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| ``len(s)`` | length of *s* | |\n+--------------------+----------------------------------+------------+\n| ``min(s)`` | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``max(s)`` | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see *Comparisons* in the language\nreference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the ``in`` and ``not\n in`` operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than ``0`` are treated as ``0`` (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that ``[[]]`` is a one-element list containing\n an empty list, so all three elements of ``[[]] * 3`` are (pointers\n to) this single empty list. Modifying any of the elements of\n ``lists`` modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of the\n string: ``len(s) + i`` or ``len(s) + j`` is substituted. But note\n that ``-0`` is still ``0``.\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that ``i <= k < j``. If *i* or *j* is\n greater than ``len(s)``, use ``len(s)``. If *i* is omitted or\n ``None``, use ``0``. If *j* is omitted or ``None``, use\n ``len(s)``. If *i* is greater than or equal to *j*, the slice is\n empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index ``x = i + n*k`` such that ``0 <= n <\n (j-i)/k``. In other words, the indices are ``i``, ``i+k``,\n ``i+2*k``, ``i+3*k`` and so on, stopping when *j* is reached (but\n never including *j*). If *i* or *j* is greater than ``len(s)``,\n use ``len(s)``. If *i* or *j* are omitted or ``None``, they become\n "end" values (which end depends on the sign of *k*). Note, *k*\n cannot be zero. If *k* is ``None``, it is treated like ``1``.\n\n6. If *s* and *t* are both strings, some Python implementations such\n as CPython can usually perform an in-place optimization for\n assignments of the form ``s=s+t`` or ``s+=t``. When applicable,\n this optimization makes quadratic run-time much less likely. This\n optimization is both version and implementation dependent. For\n performance sensitive code, it is preferable to use the\n ``str.join()`` method which assures consistent linear concatenation\n performance across versions and implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Note that none of these methods take keyword\narguments.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, unicode, list, tuple,\nbuffer, xrange* section. To output formatted strings use template\nstrings or the ``%`` operator described in the *String Formatting\nOperations* section. Also, see the ``re`` module for string functions\nbased on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with only its first character\n capitalized.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of occurrences of substring *sub* in the range\n [*start*, *end*]. Optional arguments *start* and *end* are\n interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n ``\'strict\'``, meaning that encoding errors raise ``UnicodeError``.\n Other possible values are ``\'ignore\'``, ``\'replace\'`` and any other\n name registered via ``codecs.register_error()``, see section *Codec\n Base Classes*.\n\n Added in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\n Added in version 2.0.\n\n Changed in version 2.3: Support for ``\'xmlcharrefreplace\'`` and\n ``\'backslashreplace\'`` and other error handling schemes added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the range [*start*, *end*].\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\nstr.format(format_string, *args, **kwargs)\n\n Perform a string formatting operation. The *format_string*\n argument can contain literal text or replacement fields delimited\n by braces ``{}``. Each replacement field contains either the\n numeric index of a positional argument, or the name of a keyword\n argument. Returns a copy of *format_string* where each replacement\n field is replaced with the string value of the corresponding\n argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3.0,\n and should be preferred to the ``%`` formatting described in\n *String Formatting Operations* in new code.\n\n Added in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters in the string are lowercase and\n there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters in the string are uppercase and\n there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(seq)\n\n Return a string which is the concatenation of the strings in the\n sequence *seq*. The separator between elements is the string\n providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n Added in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within s[start,end]. Optional\n arguments *start* and *end* are interpreted as in slice notation.\n Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n Added in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\n Added in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string: words start with\n uppercase characters, all remaining cased characters are lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the ``maketrans()`` helper function in the ``string``\n module to create a translation table. For string objects, set the\n *table* argument to ``None`` for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n Added in version 2.6: Support for a ``None`` *table* argument.\n\n For Unicode objects, the ``translate()`` method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or ``None``. Unmapped characters\n are left untouched. Characters mapped to ``None`` are deleted.\n Note, a more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see ``encodings.cp1251``\n for an example).\n\nstr.upper()\n\n Return a copy of the string converted to uppercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than ``len(s)``.\n\n Added in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return ``True`` if there are only numeric characters in S,\n ``False`` otherwise. Numeric characters include digit characters,\n and all characters that have the Unicode numeric value property,\n e.g. U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return ``True`` if there are only decimal characters in S,\n ``False`` otherwise. Decimal characters include digit characters,\n and all characters that that can be used to form decimal-radix\n numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the\n``%`` operator (modulo). This is also known as the string\n*formatting* or *interpolation* operator. Given ``format % values``\n(where *format* is a string or Unicode object), ``%`` conversion\nspecifications in *format* are replaced with zero or more elements of\n*values*. The effect is similar to the using ``sprintf`` in the C\nlanguage. If *format* is a Unicode object, or if any of the objects\nbeing converted using the ``%s`` conversion are Unicode objects, the\nresult will also be a Unicode object.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [4] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ``\'%\'`` character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\n characters (for example, ``(somename)``).\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an ``\'*\'``\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a ``\'.\'`` (dot) followed by the\n precision. If specified as ``\'*\'`` (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the ``\'%\'`` character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(#)03d quote types.\' % \\\n... {\'language\': "Python", "#": 2}\nPython has 002 quote types.\n\nIn this case no ``*`` specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| ``\'#\'`` | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| ``\'0\'`` | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'-\'`` | The converted value is left adjusted (overrides the ``\'0\'`` |\n| | conversion if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| ``\' \'`` | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'+\'`` | A sign character (``\'+\'`` or ``\'-\'``) will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier (``h``, ``l``, or ``L``) may be present, but is\nignored as it is not necessary for Python -- so e.g. ``%ld`` is\nidentical to ``%d``.\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| ``\'d\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'i\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'o\'`` | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'u\'`` | Obselete type -- it is identical to ``\'d\'``. | (7) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'x\'`` | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'X\'`` | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'e\'`` | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'E\'`` | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'f\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'F\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'g\'`` | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'G\'`` | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'c\'`` | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'r\'`` | String (converts any python object using ``repr()``). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'s\'`` | String (converts any python object using ``str()``). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'%\'`` | No argument is converted, results in a ``\'%\'`` | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero (``\'0\'``) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading ``\'0x\'`` or ``\'0X\'`` (depending\n on whether the ``\'x\'`` or ``\'X\'`` format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The ``%r`` conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a ``unicode`` string, the\n resulting string will also be ``unicode``.\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, ``%s`` conversions do\nnot assume that ``\'\\0\'`` is the end of the string.\n\nFor safety reasons, floating point precisions are clipped to 50;\n``%f`` conversions for numbers whose absolute value is over 1e25 are\nreplaced by ``%g`` conversions. [5] All other errors raise\nexceptions.\n\nAdditional string operations are defined in standard modules\n``string`` and ``re``.\n\n\nXRange Type\n===========\n\nThe ``xrange`` type is an immutable sequence which is commonly used\nfor looping. The advantage of the ``xrange`` type is that an\n``xrange`` object will always take the same amount of memory, no\nmatter the size of the range it represents. There are no consistent\nperformance advantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the ``len()`` function.\n\n\nMutable Sequence Types\n======================\n\nList objects support additional operations that allow in-place\nmodification of the object. Other mutable sequence types (when added\nto the language) should also support these operations. Strings and\ntuples are immutable sequence types: such objects cannot be modified\nonce created. The following operations are defined on mutable sequence\ntypes (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | (2) |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (4) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (6) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])`` | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted multiple\n parameters and implicitly joined them into a tuple; this no longer\n works in Python 2.0. Use of this misfeature has been deprecated\n since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the list length is added, as for slice indices. If it is\n still negative, it is truncated to zero, as for slice indices.\n\n Changed in version 2.3: Previously, ``index()`` didn\'t have\n arguments for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n ``insert()`` method, the list length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The ``pop()`` method is only supported by the list and array types.\n The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n7. The ``sort()`` and ``reverse()`` methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The ``sort()`` method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: ``cmp=lambda x,y:\n cmp(x.lower(), y.lower())``. The default value is ``None``.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once.\n\n Changed in version 2.3: Support for ``None`` as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the ``sort()`` method is guaranteed to be\n stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. While a list is being sorted, the effect of attempting to mutate,\n or even inspect, the list is undefined. The C implementation of\n Python 2.3 and newer makes the list appear empty for the duration,\n and raises ``ValueError`` if it can detect that the list has been\n mutated during a sort.\n', + 'typesseq-mutable': u"\nMutable Sequence Types\n**********************\n\nList objects support additional operations that allow in-place\nmodification of the object. Other mutable sequence types (when added\nto the language) should also support these operations. Strings and\ntuples are immutable sequence types: such objects cannot be modified\nonce created. The following operations are defined on mutable sequence\ntypes (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | (2) |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (4) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (6) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])`` | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted multiple\n parameters and implicitly joined them into a tuple; this no longer\n works in Python 2.0. Use of this misfeature has been deprecated\n since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the list length is added, as for slice indices. If it is\n still negative, it is truncated to zero, as for slice indices.\n\n Changed in version 2.3: Previously, ``index()`` didn't have\n arguments for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n ``insert()`` method, the list length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The ``pop()`` method is only supported by the list and array types.\n The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n7. The ``sort()`` and ``reverse()`` methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don't return the\n sorted or reversed list.\n\n8. The ``sort()`` method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: ``cmp=lambda x,y:\n cmp(x.lower(), y.lower())``. The default value is ``None``.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once.\n\n Changed in version 2.3: Support for ``None`` as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the ``sort()`` method is guaranteed to be\n stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. While a list is being sorted, the effect of attempting to mutate,\n or even inspect, the list is undefined. The C implementation of\n Python 2.3 and newer makes the list appear empty for the duration,\n and raises ``ValueError`` if it can detect that the list has been\n mutated during a sort.\n", + 'unary': u'\nUnary arithmetic operations\n***************************\n\nAll unary arithmetic (and bitwise) operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary ``-`` (minus) operator yields the negation of its numeric\nargument.\n\nThe unary ``+`` (plus) operator yields its numeric argument unchanged.\n\nThe unary ``~`` (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of ``x`` is\ndefined as ``-(x+1)``. It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n``TypeError`` exception is raised.\n', + 'while': u'\nThe ``while`` statement\n***********************\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n', + 'with': u'\nThe ``with`` statement\n**********************\n\nAdded in version 2.5.\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" expression ["as" target] ":" suite\n\nThe execution of the ``with`` statement proceeds as follows:\n\n1. The context expression is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__enter__()`` method is invoked.\n\n3. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 5 below.\n\n4. The suite is executed.\n\n5. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nNote: In Python 2.5, the ``with`` statement is only allowed when the\n ``with_statement`` feature has been enabled. It is always enabled\n in Python 2.6.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n', + 'yield': u'\nThe ``yield`` statement\n***********************\n\n yield_stmt ::= yield_expression\n\nThe ``yield`` statement is only used when defining a generator\nfunction, and is only used in the body of the generator function.\nUsing a ``yield`` statement in a function definition is sufficient to\ncause that definition to create a generator function instead of a\nnormal function.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator. The body of the\ngenerator function is executed by calling the generator\'s ``next()``\nmethod repeatedly until it raises an exception.\n\nWhen a ``yield`` statement is executed, the state of the generator is\nfrozen and the value of **expression_list** is returned to\n``next()``\'s caller. By "frozen" we mean that all local state is\nretained, including the current bindings of local variables, the\ninstruction pointer, and the internal evaluation stack: enough\ninformation is saved so that the next time ``next()`` is invoked, the\nfunction can proceed exactly as if the ``yield`` statement were just\nanother external call.\n\nAs of Python version 2.5, the ``yield`` statement is now allowed in\nthe ``try`` clause of a ``try`` ... ``finally`` construct. If the\ngenerator is not resumed before it is finalized (by reaching a zero\nreference count or by being garbage collected), the generator-\niterator\'s ``close()`` method will be called, allowing any pending\n``finally`` clauses to execute.\n\nNote: In Python 2.2, the ``yield`` statement was only allowed when the\n ``generators`` feature has been enabled. This ``__future__`` import\n statement was used to enable the feature:\n\n from __future__ import generators\n\nSee also:\n\n **PEP 0255** - Simple Generators\n The proposal for adding generators and the ``yield`` statement\n to Python.\n\n **PEP 0342** - Coroutines via Enhanced Generators\n The proposal that, among other generator enhancements, proposed\n allowing ``yield`` to appear inside a ``try`` ... ``finally``\n block.\n'} From musiccomposition at gmail.com Sun Jun 1 22:38:39 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Sun, 1 Jun 2008 15:38:39 -0500 Subject: [Python-checkins] r63871 - in python/trunk: Doc/Makefile Doc/README.txt Doc/tools/sphinxext/pyspecific.py Lib/pydoc.py Lib/pydoc_topics.py In-Reply-To: <20080601203358.09B8B1E400A@bag.python.org> References: <20080601203358.09B8B1E400A@bag.python.org> Message-ID: <1afaf6160806011338o1b9ad219y6e8b6d74b2466a75@mail.gmail.com> Should pydoc_topics be private (_pydoc_topics)? -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." From buildbot at python.org Sun Jun 1 22:43:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 20:43:09 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080601204309.415641E400F@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3476 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_htmlparser make: *** [buildbottest] Error 1 sincerely, -The Buildbot From g.brandl at gmx.net Sun Jun 1 22:43:36 2008 From: g.brandl at gmx.net (Georg Brandl) Date: Sun, 01 Jun 2008 22:43:36 +0200 Subject: [Python-checkins] r63871 - in python/trunk: Doc/Makefile Doc/README.txt Doc/tools/sphinxext/pyspecific.py Lib/pydoc.py Lib/pydoc_topics.py In-Reply-To: <1afaf6160806011338o1b9ad219y6e8b6d74b2466a75@mail.gmail.com> References: <20080601203358.09B8B1E400A@bag.python.org> <1afaf6160806011338o1b9ad219y6e8b6d74b2466a75@mail.gmail.com> Message-ID: Benjamin Peterson schrieb: > Should pydoc_topics be private (_pydoc_topics)? It could be, but I don't think anyone will mind. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. From g.brandl at gmx.net Sun Jun 1 22:51:50 2008 From: g.brandl at gmx.net (Georg Brandl) Date: Sun, 01 Jun 2008 22:51:50 +0200 Subject: [Python-checkins] r63860 - python/trunk/Lib/test/test_descrtut.py In-Reply-To: <4842FD98.9050905@gmail.com> References: <20080601170557.278A31E4009@bag.python.org> <4842FD98.9050905@gmail.com> Message-ID: Robert Schuppenies schrieb: > Thanks for fixing this. I wasn't aware of this test and neglected > it. Also thanks for the style nits. So much for my first checkin :) > > I start to favor the checkin mailing list. Very interesting. I hope you don't mind that I directly checked the fixes in instead of pointing them out to you -- they were so minor that I felt it was a waste of your time :) Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. From python-checkins at python.org Sun Jun 1 23:19:15 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 23:19:15 +0200 (CEST) Subject: [Python-checkins] r63873 - in python/trunk: Doc/library/htmllib.rst Doc/library/sgmllib.rst Lib/htmllib.py Lib/sgmllib.py Lib/test/test_htmllib.py Lib/test/test_py3kwarn.py Lib/test/test_sgmllib.py Misc/NEWS Message-ID: <20080601211915.1367A1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 1 23:19:14 2008 New Revision: 63873 Log: Deprecate htmllib and sgmllib for 3.0. Modified: python/trunk/Doc/library/htmllib.rst python/trunk/Doc/library/sgmllib.rst python/trunk/Lib/htmllib.py python/trunk/Lib/sgmllib.py python/trunk/Lib/test/test_htmllib.py python/trunk/Lib/test/test_py3kwarn.py python/trunk/Lib/test/test_sgmllib.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/htmllib.rst ============================================================================== --- python/trunk/Doc/library/htmllib.rst (original) +++ python/trunk/Doc/library/htmllib.rst Sun Jun 1 23:19:14 2008 @@ -1,9 +1,12 @@ - :mod:`htmllib` --- A parser for HTML documents ============================================== .. module:: htmllib :synopsis: A parser for HTML documents. + :deprecated: + +.. deprecated:: 2.6 + The :mod:`htmllib` module has been removed in Python 3.0. .. index:: Modified: python/trunk/Doc/library/sgmllib.rst ============================================================================== --- python/trunk/Doc/library/sgmllib.rst (original) +++ python/trunk/Doc/library/sgmllib.rst Sun Jun 1 23:19:14 2008 @@ -1,10 +1,12 @@ - :mod:`sgmllib` --- Simple SGML parser ===================================== .. module:: sgmllib :synopsis: Only as much of an SGML parser as needed to parse HTML. - + :deprecated: + +.. deprecated:: 2.6 + The :mod:`sgmllib` module has been removed in Python 3.0. .. index:: single: SGML Modified: python/trunk/Lib/htmllib.py ============================================================================== --- python/trunk/Lib/htmllib.py (original) +++ python/trunk/Lib/htmllib.py Sun Jun 1 23:19:14 2008 @@ -4,6 +4,11 @@ http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html """ +from warnings import warnpy3k +warnpy3k("the htmllib module has been removed in Python 3.0", + stacklevel=2) +del warnpy3k + import sgmllib from formatter import AS_IS Modified: python/trunk/Lib/sgmllib.py ============================================================================== --- python/trunk/Lib/sgmllib.py (original) +++ python/trunk/Lib/sgmllib.py Sun Jun 1 23:19:14 2008 @@ -9,6 +9,11 @@ # not supported at all. +from warnings import warnpy3k +warnpy3k("the sgmllib module has been removed in Python 3.0", + stacklevel=2) +del warnpy3k + import markupbase import re Modified: python/trunk/Lib/test/test_htmllib.py ============================================================================== --- python/trunk/Lib/test/test_htmllib.py (original) +++ python/trunk/Lib/test/test_htmllib.py Sun Jun 1 23:19:14 2008 @@ -1,8 +1,8 @@ import formatter -import htmllib import unittest from test import test_support +htmllib = test_support.import_module('htmllib', deprecated=True) class AnchorCollector(htmllib.HTMLParser): Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Sun Jun 1 23:19:14 2008 @@ -137,7 +137,7 @@ # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', 'Bastion', 'compiler', 'dircache', 'fpformat', - 'ihooks', 'mhlib', 'statvfs') + 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', Modified: python/trunk/Lib/test/test_sgmllib.py ============================================================================== --- python/trunk/Lib/test/test_sgmllib.py (original) +++ python/trunk/Lib/test/test_sgmllib.py Sun Jun 1 23:19:14 2008 @@ -1,8 +1,8 @@ import pprint import re -import sgmllib import unittest from test import test_support +sgmllib = test_support.import_module('sgmllib', deprecated=True) class EventCollector(sgmllib.SGMLParser): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 1 23:19:14 2008 @@ -70,8 +70,11 @@ Library ------- -- Issue #3011: locale module alias table was updated to the latest version - from the X.org locale.alias file +- The sgmllib and htmllib modules have been deprecated for removal + in Python 3.0. + +- Issue #3011: locale module alias table was updated to the latest + version from the X.org locale.alias file. - Issue #1797 (partial fix): ctypes NULL function pointers have a False boolean value now. From buildbot at python.org Sun Jun 1 23:22:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 21:22:56 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080601212256.544821E400A@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/364 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc 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_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 1 23:26:23 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 23:26:23 +0200 (CEST) Subject: [Python-checkins] r63875 - peps/trunk/pep-3108.txt Message-ID: <20080601212624.018451E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 1 23:26:23 2008 New Revision: 63875 Log: htmllib and sgmllib are done. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Sun Jun 1 23:26:23 2008 @@ -568,9 +568,9 @@ + All functionality is supported by string interpolation. -* htmllib (TODO need to remove use in pydoc) +* htmllib [done: 2.6, 3.0] - + Superceded by HTMLParser. + + Superseded by HTMLParser. * ihooks [done: 2.6, 3.0] @@ -598,7 +598,7 @@ + subprocess module replaces it [#pep-0324]_. -* sgmllib (TODO cannot remove until htmllib is removed) +* sgmllib [done: 2.6, 3.0] + Does not fully parse SGML. + In the stdlib for support to htmllib which is slated for removal. From python-checkins at python.org Sun Jun 1 23:29:14 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 1 Jun 2008 23:29:14 +0200 (CEST) Subject: [Python-checkins] r63877 - peps/trunk/pep-3108.txt Message-ID: <20080601212914.9EC6B1E4013@bag.python.org> Author: georg.brandl Date: Sun Jun 1 23:29:14 2008 New Revision: 63877 Log: There is nothing left to do for thread in 2.6. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Sun Jun 1 23:29:14 2008 @@ -617,7 +617,7 @@ + ``os.statvfs`` now returns a tuple with attributes. -* thread [done: 3.0] (TODO deprecate direct importation in 2.6; same for dummy_thread) +* thread [done: 2.6, 3.0] + People should use 'threading' instead. From buildbot at python.org Sun Jun 1 23:32:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 21:32:35 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080601213236.130A81E400A@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/923 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 2 00:00:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 22:00:19 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080601220020.DA33D1E400E@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/3745 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_pickletools test_socket_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 2 00:03:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 22:03:21 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080601220321.B5A831E4011@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/980 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 2 00:15:51 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 2 Jun 2008 00:15:51 +0200 (CEST) Subject: [Python-checkins] r63878 - doctools/trunk/CHANGES Message-ID: <20080601221552.010C81E400A@bag.python.org> Author: georg.brandl Date: Mon Jun 2 00:15:51 2008 New Revision: 63878 Log: Add changelog entry. Modified: doctools/trunk/CHANGES Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Mon Jun 2 00:15:51 2008 @@ -36,6 +36,8 @@ * Let the "previous" and "next" to more logical documents, so that by following "next" links you can traverse the entire TOC tree. +* Added TextBuilder to create plain-text output. + Bugs fixed ---------- From buildbot at python.org Mon Jun 2 00:19:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 01 Jun 2008 22:19:51 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080601221951.BE8D51E400A@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1422 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 2 00:57:48 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 2 Jun 2008 00:57:48 +0200 (CEST) Subject: [Python-checkins] r63879 - in python/trunk/Include: bytearrayobject.h bytesobject.h Message-ID: <20080601225748.391D91E400E@bag.python.org> Author: gregory.p.smith Date: Mon Jun 2 00:57:47 2008 New Revision: 63879 Log: Make the _H #define's match the header file names. Fix comments to mention the correct type names. Modified: python/trunk/Include/bytearrayobject.h python/trunk/Include/bytesobject.h Modified: python/trunk/Include/bytearrayobject.h ============================================================================== --- python/trunk/Include/bytearrayobject.h (original) +++ python/trunk/Include/bytearrayobject.h Mon Jun 2 00:57:47 2008 @@ -1,7 +1,7 @@ -/* Bytes object interface */ +/* ByteArray object interface */ -#ifndef Py_BYTESOBJECT_H -#define Py_BYTESOBJECT_H +#ifndef Py_BYTEARRAYOBJECT_H +#define Py_BYTEARRAYOBJECT_H #ifdef __cplusplus extern "C" { #endif @@ -50,4 +50,4 @@ #ifdef __cplusplus } #endif -#endif /* !Py_BYTESOBJECT_H */ +#endif /* !Py_BYTEARRAYOBJECT_H */ Modified: python/trunk/Include/bytesobject.h ============================================================================== --- python/trunk/Include/bytesobject.h (original) +++ python/trunk/Include/bytesobject.h Mon Jun 2 00:57:47 2008 @@ -1,8 +1,8 @@ -/* String object interface */ +/* Bytes (String) object interface */ -#ifndef Py_STRINGOBJECT_H -#define Py_STRINGOBJECT_H +#ifndef Py_BYTESOBJECT_H +#define Py_BYTESOBJECT_H #ifdef __cplusplus extern "C" { #endif @@ -197,4 +197,4 @@ #ifdef __cplusplus } #endif -#endif /* !Py_STRINGOBJECT_H */ +#endif /* !Py_BYTESOBJECT_H */ From python-checkins at python.org Mon Jun 2 01:09:39 2008 From: python-checkins at python.org (collin.winter) Date: Mon, 2 Jun 2008 01:09:39 +0200 (CEST) Subject: [Python-checkins] r63880 - in sandbox/trunk/2to3/lib2to3: fixer_base.py fixer_util.py fixes/basefix.py fixes/fix_apply.py fixes/fix_basestring.py fixes/fix_buffer.py fixes/fix_callable.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_exec.py fixes/fix_execfile.py fixes/fix_filter.py fixes/fix_funcattrs.py fixes/fix_future.py fixes/fix_has_key.py fixes/fix_idioms.py fixes/fix_import.py fixes/fix_imports.py fixes/fix_input.py fixes/fix_intern.py fixes/fix_itertools.py fixes/fix_itertools_imports.py fixes/fix_long.py fixes/fix_map.py fixes/fix_methodattrs.py fixes/fix_ne.py fixes/fix_next.py fixes/fix_nonzero.py fixes/fix_numliterals.py fixes/fix_print.py fixes/fix_raise.py fixes/fix_raw_input.py fixes/fix_renames.py fixes/fix_repr.py fixes/fix_standarderror.py fixes/fix_throw.py fixes/fix_tuple_params.py fixes/fix_types.py fixes/fix_unicode.py fixes/fix_ws_comma.py fixes/fix_xrange.py fixes/fix_xreadlines.py fixes/fix_zip.py fixes/util.py tests/test_fixers.py tests/test_util.py Message-ID: <20080601230939.EE2B01E400A@bag.python.org> Author: collin.winter Date: Mon Jun 2 01:09:38 2008 New Revision: 63880 Log: Move lib2to3/fixes/{basefix,util}.py down to lib2to3/. This is step 1 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. Added: sandbox/trunk/2to3/lib2to3/fixer_base.py - copied, changed from r63870, /sandbox/trunk/2to3/lib2to3/fixes/basefix.py sandbox/trunk/2to3/lib2to3/fixer_util.py - copied, changed from r63870, /sandbox/trunk/2to3/lib2to3/fixes/util.py Removed: sandbox/trunk/2to3/lib2to3/fixes/basefix.py sandbox/trunk/2to3/lib2to3/fixes/util.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py sandbox/trunk/2to3/lib2to3/fixes/fix_except.py sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py sandbox/trunk/2to3/lib2to3/fixes/fix_future.py sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py sandbox/trunk/2to3/lib2to3/fixes/fix_import.py sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_input.py sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_long.py sandbox/trunk/2to3/lib2to3/fixes/fix_map.py sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py sandbox/trunk/2to3/lib2to3/fixes/fix_next.py sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py sandbox/trunk/2to3/lib2to3/fixes/fix_print.py sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py sandbox/trunk/2to3/lib2to3/fixes/fix_types.py sandbox/trunk/2to3/lib2to3/fixes/fix_unicode.py sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py sandbox/trunk/2to3/lib2to3/tests/test_util.py Copied: sandbox/trunk/2to3/lib2to3/fixer_base.py (from r63870, /sandbox/trunk/2to3/lib2to3/fixes/basefix.py) ============================================================================== --- /sandbox/trunk/2to3/lib2to3/fixes/basefix.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_base.py Mon Jun 2 01:09:38 2008 @@ -14,9 +14,9 @@ from sets import Set as set # Local imports -from ..patcomp import PatternCompiler -from .. import pygram -from .util import does_tree_import +from .patcomp import PatternCompiler +from . import pygram +from .fixer_util import does_tree_import class BaseFix(object): Copied: sandbox/trunk/2to3/lib2to3/fixer_util.py (from r63870, /sandbox/trunk/2to3/lib2to3/fixes/util.py) ============================================================================== --- /sandbox/trunk/2to3/lib2to3/fixes/util.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_util.py Mon Jun 2 01:09:38 2008 @@ -2,10 +2,10 @@ # Author: Collin Winter # Local imports -from ..pgen2 import token -from ..pytree import Leaf, Node -from ..pygram import python_symbols as syms -from .. import patcomp +from .pgen2 import token +from .pytree import Leaf, Node +from .pygram import python_symbols as syms +from . import patcomp ########################################################### Deleted: sandbox/trunk/2to3/lib2to3/fixes/basefix.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/basefix.py Mon Jun 2 01:09:38 2008 +++ (empty file) @@ -1,188 +0,0 @@ -# Copyright 2006 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Base class for fixers (optional, but recommended).""" - -# Python imports -import logging -import itertools - -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - -# Local imports -from ..patcomp import PatternCompiler -from .. import pygram -from .util import does_tree_import - -class BaseFix(object): - - """Optional base class for fixers. - - The subclass name must be FixFooBar where FooBar is the result of - removing underscores and capitalizing the words of the fix name. - For example, the class name for a fixer named 'has_key' should be - FixHasKey. - """ - - PATTERN = None # Most subclasses should override with a string literal - pattern = None # Compiled pattern, set by compile_pattern() - options = None # Options object passed to initializer - filename = None # The filename (set by set_filename) - logger = None # A logger (set by set_filename) - numbers = itertools.count(1) # For new_name() - used_names = set() # A set of all used NAMEs - order = "post" # Does the fixer prefer pre- or post-order traversal - explicit = False # Is this ignored by refactor.py -f all? - run_order = 5 # Fixers will be sorted by run order before execution - # Lower numbers will be run first. - - # Shortcut for access to Python grammar symbols - syms = pygram.python_symbols - - def __init__(self, options, log): - """Initializer. Subclass may override. - - Args: - options: an optparse.Values instance which can be used - to inspect the command line options. - log: a list to append warnings and other messages to. - """ - self.options = options - self.log = log - self.compile_pattern() - - def compile_pattern(self): - """Compiles self.PATTERN into self.pattern. - - Subclass may override if it doesn't want to use - self.{pattern,PATTERN} in .match(). - """ - if self.PATTERN is not None: - self.pattern = PatternCompiler().compile_pattern(self.PATTERN) - - def set_filename(self, filename): - """Set the filename, and a logger derived from it. - - The main refactoring tool should call this. - """ - self.filename = filename - self.logger = logging.getLogger(filename) - - def match(self, node): - """Returns match for a given parse tree node. - - Should return a true or false object (not necessarily a bool). - It may return a non-empty dict of matching sub-nodes as - returned by a matching pattern. - - Subclass may override. - """ - results = {"node": node} - return self.pattern.match(node, results) and results - - def transform(self, node, results): - """Returns the transformation for a given parse tree node. - - Args: - node: the root of the parse tree that matched the fixer. - results: a dict mapping symbolic names to part of the match. - - Returns: - None, or a node that is a modified copy of the - argument node. The node argument may also be modified in-place to - effect the same change. - - Subclass *must* override. - """ - raise NotImplementedError() - - def parenthesize(self, node): - """Wrapper around pygram.parenthesize().""" - return pygram.parenthesize(node) - - def new_name(self, template="xxx_todo_changeme"): - """Return a string suitable for use as an identifier - - The new name is guaranteed not to conflict with other identifiers. - """ - name = template - while name in self.used_names: - name = template + str(self.numbers.next()) - self.used_names.add(name) - return name - - def log_message(self, message): - if self.first_log: - self.first_log = False - self.log.append("### In file %s ###" % self.filename) - self.log.append(message) - - def cannot_convert(self, node, reason=None): - """Warn the user that a given chunk of code is not valid Python 3, - but that it cannot be converted automatically. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - for_output = node.clone() - for_output.set_prefix("") - msg = "Line %d: could not convert: %s" - self.log_message(msg % (lineno, for_output)) - if reason: - self.log_message(reason) - - def warning(self, node, reason): - """Used for warning the user about possible uncertainty in the - translation. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - self.log_message("Line %d: %s" % (lineno, reason)) - - def start_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the start of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - self.used_names = tree.used_names - self.set_filename(filename) - self.numbers = itertools.count(1) - self.first_log = True - - def finish_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the conclusion of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - pass - - -class ConditionalFix(BaseFix): - """ Base class for fixers which not execute if an import is found. """ - - # This is the name of the import which, if found, will cause the test to be skipped - skip_on = None - - def start_tree(self, *args): - super(ConditionalFix, self).start_tree(*args) - self._should_skip = None - - def should_skip(self, node): - if self._should_skip is not None: - return self._should_skip - pkg = self.skip_on.split(".") - name = pkg[-1] - pkg = ".".join(pkg[:-1]) - self._should_skip = does_tree_import(pkg, name, node) - return self._should_skip Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py Mon Jun 2 01:09:38 2008 @@ -8,10 +8,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Call, Comma +from .. import fixer_base +from ..fixer_util import Call, Comma -class FixApply(basefix.BaseFix): +class FixApply(fixer_base.BaseFix): PATTERN = """ power< 'apply' Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py Mon Jun 2 01:09:38 2008 @@ -2,10 +2,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBasestring(basefix.BaseFix): +class FixBasestring(fixer_base.BaseFix): PATTERN = "'basestring'" Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py Mon Jun 2 01:09:38 2008 @@ -4,11 +4,11 @@ """Fixer that changes buffer(...) into memoryview(...).""" # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBuffer(basefix.BaseFix): +class FixBuffer(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py Mon Jun 2 01:09:38 2008 @@ -7,10 +7,10 @@ # Local imports from .. import pytree -from . import basefix -from .util import Call, Name, String +from .. import fixer_base +from ..fixer_util import Call, Name, String -class FixCallable(basefix.BaseFix): +class FixCallable(fixer_base.BaseFix): # Ignore callable(*args) or use of keywords. # Either could be a hint that the builtin callable() is not being used. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Mon Jun 2 01:09:38 2008 @@ -27,15 +27,15 @@ from .. import pytree from .. import patcomp from ..pgen2 import token -from . import basefix -from .util import Name, Call, LParen, RParen, ArgList, Dot, set -from . import util +from .. import fixer_base +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from .. import fixer_util -iter_exempt = util.consuming_calls | set(["iter"]) +iter_exempt = fixer_util.consuming_calls | set(["iter"]) -class FixDict(basefix.BaseFix): +class FixDict(fixer_base.BaseFix): PATTERN = """ power< head=any+ trailer< '.' method=('keys'|'items'|'values'| @@ -92,7 +92,7 @@ return results["func"].value in iter_exempt else: # list(d.keys()) -> list(d.keys()), etc. - return results["func"].value in util.consuming_calls + return results["func"].value in fixer_util.consuming_calls if not isiter: return False # for ... in d.iterkeys() -> for ... in d.keys(), etc. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_except.py Mon Jun 2 01:09:38 2008 @@ -24,8 +24,8 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Assign, Attr, Name, is_tuple, is_list, reversed +from .. import fixer_base +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed def find_excepts(nodes): for i, n in enumerate(nodes): @@ -33,7 +33,7 @@ if n.children[0].value == 'except': yield (n, nodes[i+2]) -class FixExcept(basefix.BaseFix): +class FixExcept(fixer_base.BaseFix): PATTERN = """ try_stmt< 'try' ':' suite Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py Mon Jun 2 01:09:38 2008 @@ -11,11 +11,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Comma, Name, Call +from .. import fixer_base +from ..fixer_util import Comma, Name, Call -class FixExec(basefix.BaseFix): +class FixExec(fixer_base.BaseFix): PATTERN = """ exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py Mon Jun 2 01:09:38 2008 @@ -8,11 +8,11 @@ """ from .. import pytree -from . import basefix -from .util import Comma, Name, Call, LParen, RParen, Dot +from .. import fixer_base +from ..fixer_util import Comma, Name, Call, LParen, RParen, Dot -class FixExecfile(basefix.BaseFix): +class FixExecfile(fixer_base.BaseFix): PATTERN = """ power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py Mon Jun 2 01:09:38 2008 @@ -15,10 +15,10 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context -class FixFilter(basefix.ConditionalFix): +class FixFilter(fixer_base.ConditionalFix): PATTERN = """ filter_lambda=power< Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py Mon Jun 2 01:09:38 2008 @@ -2,11 +2,11 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixFuncattrs(basefix.BaseFix): +class FixFuncattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_future.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_future.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_future.py Mon Jun 2 01:09:38 2008 @@ -5,10 +5,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixFuture(basefix.BaseFix): +class FixFuture(fixer_base.BaseFix): PATTERN = """import_from< 'from' module_name="__future__" 'import' any >""" # This should be run last -- some things check for the import Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py Mon Jun 2 01:09:38 2008 @@ -32,11 +32,11 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixHasKey(basefix.BaseFix): +class FixHasKey(fixer_base.BaseFix): PATTERN = """ anchor=power< Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py Mon Jun 2 01:09:38 2008 @@ -28,13 +28,13 @@ # Author: Jacques Frechet, Collin Winter # Local imports -from . import basefix -from .util import Call, Comma, Name, Node, syms +from .. import fixer_base +from ..fixer_util import Call, Comma, Name, Node, syms CMP = "(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)" TYPE = "power< 'type' trailer< '(' x=any ')' > >" -class FixIdioms(basefix.BaseFix): +class FixIdioms(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_import.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_import.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_import.py Mon Jun 2 01:09:38 2008 @@ -11,11 +11,11 @@ """ # Local imports -from . import basefix +from .. import fixer_base from os.path import dirname, join, exists, pathsep -from .util import FromImport +from ..fixer_util import FromImport -class FixImport(basefix.BaseFix): +class FixImport(fixer_base.BaseFix): PATTERN = """ import_from< type='from' imp=any 'import' any > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Mon Jun 2 01:09:38 2008 @@ -8,8 +8,8 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set import __builtin__ builtin_names = [name for name in dir(__builtin__) if name not in ("__name__", "__doc__")] @@ -297,7 +297,7 @@ yield """bare_name=%s""" % alternates(bare) -class FixImports(basefix.BaseFix): +class FixImports(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_input.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_input.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_input.py Mon Jun 2 01:09:38 2008 @@ -2,15 +2,15 @@ # Author: Andre Roberge # Local imports -from . import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name from .. import patcomp context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >") -class FixInput(basefix.BaseFix): +class FixInput(fixer_base.BaseFix): PATTERN = """ power< 'input' args=trailer< '(' [any] ')' > > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py Mon Jun 2 01:09:38 2008 @@ -7,11 +7,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Attr +from .. import fixer_base +from ..fixer_util import Name, Attr -class FixIntern(basefix.BaseFix): +class FixIntern(fixer_base.BaseFix): PATTERN = """ power< 'intern' Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py Mon Jun 2 01:09:38 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixItertools(basefix.BaseFix): +class FixItertools(fixer_base.BaseFix): it_funcs = "('imap'|'ifilter'|'izip'|'ifilterfalse')" PATTERN = """ power< it='itertools' Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py Mon Jun 2 01:09:38 2008 @@ -1,10 +1,10 @@ """ Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """ # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixItertoolsImports(basefix.BaseFix): +class FixItertoolsImports(fixer_base.BaseFix): PATTERN = """ import_from< 'from' 'itertools' 'import' imports=any > """ %(locals()) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_long.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_long.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_long.py Mon Jun 2 01:09:38 2008 @@ -8,11 +8,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Number +from .. import fixer_base +from ..fixer_util import Name, Number -class FixLong(basefix.BaseFix): +class FixLong(fixer_base.BaseFix): PATTERN = """ (long_type = 'long' | number = NUMBER) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_map.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_map.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_map.py Mon Jun 2 01:09:38 2008 @@ -21,11 +21,11 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context from ..pygram import python_symbols as syms -class FixMap(basefix.ConditionalFix): +class FixMap(fixer_base.ConditionalFix): PATTERN = """ map_none=power< Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py Mon Jun 2 01:09:38 2008 @@ -3,8 +3,8 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name MAP = { "im_func" : "__func__", @@ -12,7 +12,7 @@ "im_class" : "__self__.__class__" } -class FixMethodattrs(basefix.BaseFix): +class FixMethodattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > """ Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py Mon Jun 2 01:09:38 2008 @@ -6,10 +6,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix +from .. import fixer_base -class FixNe(basefix.BaseFix): +class FixNe(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_next.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_next.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Mon Jun 2 01:09:38 2008 @@ -8,13 +8,13 @@ # Local imports from ..pgen2 import token from ..pygram import python_symbols as syms -from . import basefix -from .util import Name, Call, find_binding, any +from .. import fixer_base +from ..fixer_util import Name, Call, find_binding, any bind_warning = "Calls to builtin next() possibly shadowed by global binding" -class FixNext(basefix.BaseFix): +class FixNext(fixer_base.BaseFix): PATTERN = """ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py Mon Jun 2 01:09:38 2008 @@ -2,10 +2,10 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name, syms +from .. import fixer_base +from ..fixer_util import Name, syms -class FixNonzero(basefix.BaseFix): +class FixNonzero(fixer_base.BaseFix): PATTERN = """ classdef< 'class' any+ ':' suite< any* Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py Mon Jun 2 01:09:38 2008 @@ -5,11 +5,11 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Number, set +from .. import fixer_base +from ..fixer_util import Number, set -class FixNumliterals(basefix.BaseFix): +class FixNumliterals(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_print.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_print.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_print.py Mon Jun 2 01:09:38 2008 @@ -17,8 +17,8 @@ from .. import patcomp from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Comma, String, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Comma, String, is_tuple parend_expr = patcomp.compile_pattern( @@ -26,7 +26,7 @@ ) -class FixPrint(basefix.ConditionalFix): +class FixPrint(fixer_base.ConditionalFix): PATTERN = """ simple_stmt< bare='print' any > | print_stmt Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py Mon Jun 2 01:09:38 2008 @@ -24,10 +24,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Attr, ArgList, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Attr, ArgList, is_tuple -class FixRaise(basefix.BaseFix): +class FixRaise(fixer_base.BaseFix): PATTERN = """ raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py Mon Jun 2 01:09:38 2008 @@ -2,10 +2,10 @@ # Author: Andre Roberge # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixRawInput(basefix.BaseFix): +class FixRawInput(fixer_base.BaseFix): PATTERN = """ power< name='raw_input' trailer< '(' [any] ')' > > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py Mon Jun 2 01:09:38 2008 @@ -7,8 +7,8 @@ # based on Collin Winter's fix_import # Local imports -from .import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set MAPPING = {"sys": {"maxint" : "maxsize"}, } @@ -39,7 +39,7 @@ #yield """bare_name=%s""" % alternates(bare) -class FixRenames(basefix.BaseFix): +class FixRenames(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py Mon Jun 2 01:09:38 2008 @@ -4,11 +4,11 @@ """Fixer that transforms `xyzzy` into repr(xyzzy).""" # Local imports -from .import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name -class FixRepr(basefix.BaseFix): +class FixRepr(fixer_base.BaseFix): PATTERN = """ atom < '`' expr=any '`' > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py Mon Jun 2 01:09:38 2008 @@ -4,11 +4,11 @@ """Fixer for StandardError -> Exception.""" # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixStandarderror(basefix.BaseFix): +class FixStandarderror(fixer_base.BaseFix): PATTERN = """ 'StandardError' Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py Mon Jun 2 01:09:38 2008 @@ -10,10 +10,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, ArgList, Attr, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, ArgList, Attr, is_tuple -class FixThrow(basefix.BaseFix): +class FixThrow(fixer_base.BaseFix): PATTERN = """ power< any trailer< '.' 'throw' > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py Mon Jun 2 01:09:38 2008 @@ -21,14 +21,14 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Assign, Name, Newline, Number, Subscript, syms +from .. import fixer_base +from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms def is_docstring(stmt): return isinstance(stmt, pytree.Node) and \ stmt.children[0].type == token.STRING -class FixTupleParams(basefix.BaseFix): +class FixTupleParams(fixer_base.BaseFix): PATTERN = """ funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_types.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_types.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_types.py Mon Jun 2 01:09:38 2008 @@ -21,8 +21,8 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name _TYPE_MAPPING = { 'BooleanType' : 'bool', @@ -51,7 +51,7 @@ _pats = ["power< 'types' trailer< '.' name='%s' > >" % t for t in _TYPE_MAPPING] -class FixTypes(basefix.BaseFix): +class FixTypes(fixer_base.BaseFix): PATTERN = '|'.join(_pats) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_unicode.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_unicode.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_unicode.py Mon Jun 2 01:09:38 2008 @@ -4,9 +4,9 @@ import re from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixUnicode(basefix.BaseFix): +class FixUnicode(fixer_base.BaseFix): PATTERN = "STRING | NAME<'unicode' | 'unichr'>" Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py Mon Jun 2 01:09:38 2008 @@ -7,9 +7,9 @@ from .. import pytree from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixWsComma(basefix.BaseFix): +class FixWsComma(fixer_base.BaseFix): explicit = True # The user must ask for this fixers Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py Mon Jun 2 01:09:38 2008 @@ -4,12 +4,12 @@ """Fixer that changes xrange(...) into range(...).""" # Local imports -from .import basefix -from .util import Name, Call, consuming_calls +from .. import fixer_base +from ..fixer_util import Name, Call, consuming_calls from .. import patcomp -class FixXrange(basefix.BaseFix): +class FixXrange(fixer_base.BaseFix): PATTERN = """ power< (name='range'|name='xrange') trailer< '(' [any] ')' > any* > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py Mon Jun 2 01:09:38 2008 @@ -4,11 +4,11 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixXreadlines(basefix.BaseFix): +class FixXreadlines(fixer_base.BaseFix): PATTERN = """ power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py Mon Jun 2 01:09:38 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name, Call, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, in_special_context -class FixZip(basefix.ConditionalFix): +class FixZip(fixer_base.ConditionalFix): PATTERN = """ power< 'zip' args=trailer< '(' [any] ')' > Deleted: sandbox/trunk/2to3/lib2to3/fixes/util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/util.py Mon Jun 2 01:09:38 2008 +++ (empty file) @@ -1,366 +0,0 @@ -"""Utility functions, node construction macros, etc.""" -# Author: Collin Winter - -# Local imports -from ..pgen2 import token -from ..pytree import Leaf, Node -from ..pygram import python_symbols as syms -from .. import patcomp - - -########################################################### -### Common node-construction "macros" -########################################################### - -def KeywordArg(keyword, value): - return Node(syms.argument, - [keyword, Leaf(token.EQUAL, '='), value]) - -def LParen(): - return Leaf(token.LPAR, "(") - -def RParen(): - return Leaf(token.RPAR, ")") - -def Assign(target, source): - """Build an assignment statement""" - if not isinstance(target, list): - target = [target] - if not isinstance(source, list): - source.set_prefix(" ") - source = [source] - - return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) - -def Name(name, prefix=None): - """Return a NAME leaf""" - return Leaf(token.NAME, name, prefix=prefix) - -def Attr(obj, attr): - """A node tuple for obj.attr""" - return [obj, Node(syms.trailer, [Dot(), attr])] - -def Comma(): - """A comma leaf""" - return Leaf(token.COMMA, ",") - -def Dot(): - """A period (.) leaf""" - return Leaf(token.DOT, ".") - -def ArgList(args, lparen=LParen(), rparen=RParen()): - """A parenthesised argument list, used by Call()""" - return Node(syms.trailer, - [lparen.clone(), - Node(syms.arglist, args), - rparen.clone()]) - -def Call(func_name, args, prefix=None): - """A function call""" - node = Node(syms.power, [func_name, ArgList(args)]) - if prefix is not None: - node.set_prefix(prefix) - return node - -def Newline(): - """A newline literal""" - return Leaf(token.NEWLINE, "\n") - -def BlankLine(): - """A blank line""" - return Leaf(token.NEWLINE, "") - -def Number(n, prefix=None): - return Leaf(token.NUMBER, n, prefix=prefix) - -def Subscript(index_node): - """A numeric or string subscript""" - return Node(syms.trailer, [Leaf(token.LBRACE, '['), - index_node, - Leaf(token.RBRACE, ']')]) - -def String(string, prefix=None): - """A string leaf""" - return Leaf(token.STRING, string, prefix=prefix) - -def ListComp(xp, fp, it, test=None): - """A list comprehension of the form [xp for fp in it if test]. - - If test is None, the "if test" part is omitted. - """ - xp.set_prefix("") - fp.set_prefix(" ") - it.set_prefix(" ") - for_leaf = Leaf(token.NAME, "for") - for_leaf.set_prefix(" ") - in_leaf = Leaf(token.NAME, "in") - in_leaf.set_prefix(" ") - inner_args = [for_leaf, fp, in_leaf, it] - if test: - test.set_prefix(" ") - if_leaf = Leaf(token.NAME, "if") - if_leaf.set_prefix(" ") - inner_args.append(Node(syms.comp_if, [if_leaf, test])) - inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) - return Node(syms.atom, - [Leaf(token.LBRACE, "["), - inner, - Leaf(token.RBRACE, "]")]) - -def FromImport(package_name, name_leafs): - """ Return an import statement in the form: - from package import name_leafs""" - # XXX: May not handle dotted imports properly (eg, package_name='foo.bar') - assert package_name == '.' or '.' not in package.name, "FromImport has "\ - "not been tested with dotted package names -- use at your own "\ - "peril!" - - for leaf in name_leafs: - # Pull the leaves out of their old tree - leaf.remove() - - children = [Leaf(token.NAME, 'from'), - Leaf(token.NAME, package_name, prefix=" "), - Leaf(token.NAME, 'import', prefix=" "), - Node(syms.import_as_names, name_leafs)] - imp = Node(syms.import_from, children) - return imp - - -########################################################### -### Determine whether a node represents a given literal -########################################################### - -def is_tuple(node): - """Does the node represent a tuple literal?""" - if isinstance(node, Node) and node.children == [LParen(), RParen()]: - return True - return (isinstance(node, Node) - and len(node.children) == 3 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[1], Node) - and isinstance(node.children[2], Leaf) - and node.children[0].value == "(" - and node.children[2].value == ")") - -def is_list(node): - """Does the node represent a list literal?""" - return (isinstance(node, Node) - and len(node.children) > 1 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[-1], Leaf) - and node.children[0].value == "[" - and node.children[-1].value == "]") - -########################################################### -### Common portability code. This allows fixers to do, eg, -### "from .util import set" and forget about it. -########################################################### - -try: - any = any -except NameError: - def any(l): - for o in l: - if o: - return True - return False - -try: - set = set -except NameError: - from sets import Set as set - -try: - reversed = reversed -except NameError: - def reversed(l): - return l[::-1] - -########################################################### -### Misc -########################################################### - - -consuming_calls = set(["sorted", "list", "set", "any", "all", "tuple", "sum", - "min", "max"]) - -def attr_chain(obj, attr): - """Follow an attribute chain. - - If you have a chain of objects where a.foo -> b, b.foo-> c, etc, - use this to iterate over all objects in the chain. Iteration is - terminated by getattr(x, attr) is None. - - Args: - obj: the starting object - attr: the name of the chaining attribute - - Yields: - Each successive object in the chain. - """ - next = getattr(obj, attr) - while next: - yield next - next = getattr(next, attr) - -p0 = """for_stmt< 'for' any 'in' node=any ':' any* > - | comp_for< 'for' any 'in' node=any any* > - """ -p1 = """ -power< - ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | - 'any' | 'all' | (any* trailer< '.' 'join' >) ) - trailer< '(' node=any ')' > - any* -> -""" -p2 = """ -power< - 'sorted' - trailer< '(' arglist ')' > - any* -> -""" -pats_built = False -def in_special_context(node): - """ Returns true if node is in an environment where all that is required - of it is being itterable (ie, it doesn't matter if it returns a list - or an itterator). - See test_map_nochange in test_fixers.py for some examples and tests. - """ - global p0, p1, p2, pats_built - if not pats_built: - p1 = patcomp.compile_pattern(p1) - p0 = patcomp.compile_pattern(p0) - p2 = patcomp.compile_pattern(p2) - pats_built = True - patterns = [p0, p1, p2] - for pattern, parent in zip(patterns, attr_chain(node, "parent")): - results = {} - if pattern.match(parent, results) and results["node"] is node: - return True - return False - -########################################################### -### The following functions are to find bindings in a suite -########################################################### - -def make_suite(node): - if node.type == syms.suite: - return node - node = node.clone() - parent, node.parent = node.parent, None - suite = Node(syms.suite, [node]) - suite.parent = parent - return suite - -def does_tree_import(package, name, node): - """ Returns true if name is imported from package at the - top level of the tree which node belongs to. - To cover the case of an import like 'import foo', use - Null for the package and 'foo' for the name. """ - # Scamper up to the top level namespace - while node.type != syms.file_input: - assert node.parent, "Tree is insane! root found before "\ - "file_input node was found." - node = node.parent - - binding = find_binding(name, node, package) - return bool(binding) - -_def_syms = set([syms.classdef, syms.funcdef]) -def find_binding(name, node, package=None): - """ Returns the node which binds variable name, otherwise None. - If optional argument package is supplied, only imports will - be returned. - See test cases for examples.""" - for child in node.children: - ret = None - if child.type == syms.for_stmt: - if _find(name, child.children[1]): - return child - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type in (syms.if_stmt, syms.while_stmt): - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type == syms.try_stmt: - n = find_binding(name, make_suite(child.children[2]), package) - if n: - ret = n - else: - for i, kid in enumerate(child.children[3:]): - if kid.type == token.COLON and kid.value == ":": - # i+3 is the colon, i+4 is the suite - n = find_binding(name, make_suite(child.children[i+4]), package) - if n: ret = n - elif child.type in _def_syms and child.children[1].value == name: - ret = child - elif _is_import_binding(child, name, package): - ret = child - elif child.type == syms.simple_stmt: - ret = find_binding(name, child, package) - elif child.type == syms.expr_stmt: - if _find(name, child.children[0]): - ret = child - - if ret: - if not package: - return ret - if ret.type in (syms.import_name, syms.import_from): - return ret - return None - -_block_syms = set([syms.funcdef, syms.classdef, syms.trailer]) -def _find(name, node): - nodes = [node] - while nodes: - node = nodes.pop() - if node.type > 256 and node.type not in _block_syms: - nodes.extend(node.children) - elif node.type == token.NAME and node.value == name: - return node - return None - -def _is_import_binding(node, name, package=None): - """ Will reuturn node if node will import name, or node - will import * from package. None is returned otherwise. - See test cases for examples. """ - - if node.type == syms.import_name and not package: - imp = node.children[1] - if imp.type == syms.dotted_as_names: - for child in imp.children: - if child.type == syms.dotted_as_name: - if child.children[2].value == name: - return node - elif child.type == token.NAME and child.value == name: - return node - elif imp.type == syms.dotted_as_name: - last = imp.children[-1] - if last.type == token.NAME and last.value == name: - return node - elif imp.type == token.NAME and imp.value == name: - return node - elif node.type == syms.import_from: - # unicode(...) is used to make life easier here, because - # from a.b import parses to ['import', ['a', '.', 'b'], ...] - if package and unicode(node.children[1]).strip() != package: - return None - n = node.children[3] - if package and _find('as', n): - # See test_from_import_as for explanation - return None - elif n.type == syms.import_as_names and _find(name, n): - return node - elif n.type == syms.import_as_name: - child = n.children[2] - if child.type == token.NAME and child.value == name: - return node - elif n.type == token.NAME and n.value == name: - return node - elif package and n.type == token.STAR: - return node - return None Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Mon Jun 2 01:09:38 2008 @@ -10,13 +10,14 @@ # Python imports import unittest +from itertools import chain from os.path import dirname, pathsep # Local imports from .. import pygram from .. import pytree from .. import refactor -from ..fixes import util +from .. import fixer_util class Options: @@ -33,7 +34,6 @@ self.fixer_log = [] self.filename = "" - from itertools import chain for order in (self.refactor.pre_order.values(),\ self.refactor.post_order.values()): for fixer in chain(*order): @@ -1107,7 +1107,7 @@ self.check(b, a) def test_unchanged(self): - for wrapper in util.consuming_calls: + for wrapper in fixer_util.consuming_calls: s = "s = %s(d.keys())" % wrapper self.unchanged(s) @@ -1300,7 +1300,7 @@ self.unchanged("x in range(10, 3, 9)") def test_in_consuming_context(self): - for call in util.consuming_calls: + for call in fixer_util.consuming_calls: self.unchanged("a = %s(range(10))" % call) class Test_raw_input(FixerTestCase): Modified: sandbox/trunk/2to3/lib2to3/tests/test_util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_util.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_util.py Mon Jun 2 01:09:38 2008 @@ -10,7 +10,8 @@ # Local imports from .. import pytree -from ..fixes import util +from .. import fixer_util +from ..fixer_util import Attr, Name def parse(code, strip_levels=0): @@ -25,13 +26,13 @@ class MacroTestCase(support.TestCase): def assertStr(self, node, string): if isinstance(node, (tuple, list)): - node = pytree.Node(util.syms.simple_stmt, node) + node = pytree.Node(fixer_util.syms.simple_stmt, node) self.assertEqual(str(node), string) class Test_is_tuple(support.TestCase): def is_tuple(self, string): - return util.is_tuple(parse(string, strip_levels=2)) + return fixer_util.is_tuple(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_tuple("(a, b)")) @@ -47,7 +48,7 @@ class Test_is_list(support.TestCase): def is_list(self, string): - return util.is_list(parse(string, strip_levels=2)) + return fixer_util.is_list(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_list("[]")) @@ -62,23 +63,18 @@ class Test_Attr(MacroTestCase): def test(self): - from ..fixes.util import Attr, Name call = parse("foo()", strip_levels=2) self.assertStr(Attr(Name("a"), Name("b")), "a.b") self.assertStr(Attr(call, Name("b")), "foo().b") def test_returns(self): - from ..fixes.util import Attr, Name - attr = Attr(Name("a"), Name("b")) self.assertEqual(type(attr), list) class Test_Name(MacroTestCase): def test(self): - from ..fixes.util import Name - self.assertStr(Name("a"), "a") self.assertStr(Name("foo.foo().bar"), "foo.foo().bar") self.assertStr(Name("a", prefix="b"), "ba") @@ -88,7 +84,7 @@ def _find_bind_rec(self, name, node): # Search a tree for a binding -- used to find the starting # point for these tests. - c = util.find_binding(name, node) + c = fixer_util.find_binding(name, node) if c: return c for child in node.children: c = self._find_bind_rec(name, child) @@ -98,7 +94,7 @@ node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) - return util.does_tree_import(package, name, node) + return fixer_util.does_tree_import(package, name, node) def try_with(self, string): failing_tests = (("a", "a", "from a import b"), @@ -130,7 +126,7 @@ class Test_find_binding(support.TestCase): def find_binding(self, name, string, package=None): - return util.find_binding(name, parse(string), package) + return fixer_util.find_binding(name, parse(string), package) def test_simple_assignment(self): self.failUnless(self.find_binding("a", "a = b")) From python-checkins at python.org Mon Jun 2 01:44:47 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 2 Jun 2008 01:44:47 +0200 (CEST) Subject: [Python-checkins] r63881 - in python/branches/release25-maint: Lib/subprocess.py Lib/test/test_subprocess.py Misc/NEWS Message-ID: <20080601234447.18FF11E400A@bag.python.org> Author: gregory.p.smith Date: Mon Jun 2 01:44:46 2008 New Revision: 63881 Log: Backport r62724 from trunk. Fixes issue 2791. subprocess.Popen.communicate now closes its stdout and stderr fds as soon as it is finished with them. Modified: python/branches/release25-maint/Lib/subprocess.py python/branches/release25-maint/Lib/test/test_subprocess.py python/branches/release25-maint/Misc/NEWS Modified: python/branches/release25-maint/Lib/subprocess.py ============================================================================== --- python/branches/release25-maint/Lib/subprocess.py (original) +++ python/branches/release25-maint/Lib/subprocess.py Mon Jun 2 01:44:46 2008 @@ -660,8 +660,10 @@ self.stdin.close() elif self.stdout: stdout = self.stdout.read() + self.stdout.close() elif self.stderr: stderr = self.stderr.read() + self.stderr.close() self.wait() return (stdout, stderr) Modified: python/branches/release25-maint/Lib/test/test_subprocess.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_subprocess.py (original) +++ python/branches/release25-maint/Lib/test/test_subprocess.py Mon Jun 2 01:44:46 2008 @@ -304,6 +304,22 @@ self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple") + # This test is Linux specific for simplicity to at least have + # some coverage. It is not a platform specific bug. + if os.path.isdir('/proc/%d/fd' % os.getpid()): + # Test for the fd leak reported in http://bugs.python.org/issue2791. + def test_communicate_pipe_fd_leak(self): + fd_directory = '/proc/%d/fd' % os.getpid() + num_fds_before_popen = len(os.listdir(fd_directory)) + p = subprocess.Popen([sys.executable, '-c', 'print()'], + stdout=subprocess.PIPE) + p.communicate() + num_fds_after_communicate = len(os.listdir(fd_directory)) + del p + num_fds_after_destruction = len(os.listdir(fd_directory)) + self.assertEqual(num_fds_before_popen, num_fds_after_destruction) + self.assertEqual(num_fds_before_popen, num_fds_after_communicate) + def test_communicate_returns(self): # communicate() should return None if no redirection is active p = subprocess.Popen([sys.executable, "-c", Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Jun 2 01:44:46 2008 @@ -82,6 +82,10 @@ - Bug #1433694: minidom's .normalize() failed to set .nextSibling for last child element. +- Issue #2791: subprocess.Popen.communicate explicitly closes its + stdout and stderr fds rather than leaving them open until the + instance is destroyed. + Extension Modules ----------------- From python-checkins at python.org Mon Jun 2 01:48:47 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 2 Jun 2008 01:48:47 +0200 (CEST) Subject: [Python-checkins] r63882 - in python/trunk: Doc/library/threading.rst Lib/test/test_threading.py Lib/threading.py Misc/NEWS Message-ID: <20080601234847.8C6DC1E400A@bag.python.org> Author: gregory.p.smith Date: Mon Jun 2 01:48:47 2008 New Revision: 63882 Log: Adds a Thread.getIdent() method to provide the _get_ident() value for any given threading.Thread object. feature request issue 2871. Modified: python/trunk/Doc/library/threading.rst python/trunk/Lib/test/test_threading.py python/trunk/Lib/threading.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/threading.rst ============================================================================== --- python/trunk/Doc/library/threading.rst (original) +++ python/trunk/Doc/library/threading.rst Mon Jun 2 01:48:47 2008 @@ -651,6 +651,17 @@ constructor. +.. method:: Thread.getIdent() + + Return the 'thread identifier' of this thread or None if the thread has not + been started. This is a nonzero integer. See the :mod:`thread` module's + :func:`get_ident()` function. Thread identifiers may be recycled when a + thread exits and another thread is created. The identifier is returned + even after the thread has exited. + + .. versionadded:: 2.6 + + .. method:: Thread.isAlive() Return whether the thread is alive. Modified: python/trunk/Lib/test/test_threading.py ============================================================================== --- python/trunk/Lib/test/test_threading.py (original) +++ python/trunk/Lib/test/test_threading.py Mon Jun 2 01:48:47 2008 @@ -3,6 +3,7 @@ import test.test_support from test.test_support import verbose import random +import re import sys import threading import thread @@ -72,6 +73,8 @@ for i in range(NUMTASKS): t = TestThread(""%i, self, sema, mutex, numrunning) threads.append(t) + self.failUnlessEqual(t.getIdent(), None) + self.assert_(re.match('', repr(t))) t.start() if verbose: @@ -79,6 +82,8 @@ for t in threads: t.join(NUMTASKS) self.assert_(not t.isAlive()) + self.failIfEqual(t.getIdent(), 0) + self.assert_(re.match('', repr(t))) if verbose: print 'all tasks done' self.assertEqual(numrunning.get(), 0) Modified: python/trunk/Lib/threading.py ============================================================================== --- python/trunk/Lib/threading.py (original) +++ python/trunk/Lib/threading.py Mon Jun 2 01:48:47 2008 @@ -414,6 +414,7 @@ self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon() + self.__ident = None self.__started = Event() self.__stopped = False self.__block = Condition(Lock()) @@ -434,7 +435,9 @@ if self.__stopped: status = "stopped" if self.__daemonic: - status = status + " daemon" + status += " daemon" + if self.__ident is not None: + status += " %s" % self.__ident return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status) def start(self): @@ -481,9 +484,10 @@ def __bootstrap_inner(self): try: + self.__ident = _get_ident() self.__started.set() _active_limbo_lock.acquire() - _active[_get_ident()] = self + _active[self.__ident] = self del _limbo[self] _active_limbo_lock.release() if __debug__: @@ -635,6 +639,10 @@ assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) + def getIdent(self): + assert self.__initialized, "Thread.__init__() not called" + return self.__ident + def isAlive(self): assert self.__initialized, "Thread.__init__() not called" return self.__started.isSet() and not self.__stopped Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 2 01:48:47 2008 @@ -67,6 +67,8 @@ - Issue #2870: cmathmodule.c compile error. +- Added a threading.Thread.getIdent() method. + Library ------- From python-checkins at python.org Mon Jun 2 02:07:25 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 2 Jun 2008 02:07:25 +0200 (CEST) Subject: [Python-checkins] r63883 - in python/branches/release25-maint: Misc/NEWS Python/mysnprintf.c Message-ID: <20080602000725.B63EE1E400A@bag.python.org> Author: gregory.p.smith Date: Mon Jun 2 02:07:25 2008 New Revision: 63883 Log: - Issue #2588, #2589: Fix potential integer underflow and overflow conditions in the PyOS_vsnprintf C API function. This is a backport of r63728 and r63734 from trunk. Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/mysnprintf.c Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Jun 2 02:07:25 2008 @@ -41,6 +41,9 @@ less than zero will now raise a SystemError and return NULL to indicate a bug in the calling C code. +- Issue #2588, #2589: Fix potential integer underflow and overflow + conditions in the PyOS_vsnprintf C API function. + Library ------- Modified: python/branches/release25-maint/Python/mysnprintf.c ============================================================================== --- python/branches/release25-maint/Python/mysnprintf.c (original) +++ python/branches/release25-maint/Python/mysnprintf.c Mon Jun 2 02:07:25 2008 @@ -54,18 +54,28 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) { int len; /* # bytes written, excluding \0 */ -#ifndef HAVE_SNPRINTF +#ifdef HAVE_SNPRINTF +#define _PyOS_vsnprintf_EXTRA_SPACE 1 +#else +#define _PyOS_vsnprintf_EXTRA_SPACE 512 char *buffer; #endif assert(str != NULL); assert(size > 0); assert(format != NULL); + /* We take a size_t as input but return an int. Sanity check + * our input so that it won't cause an overflow in the + * vsnprintf return value or the buffer malloc size. */ + if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) { + len = -666; + goto Done; + } #ifdef HAVE_SNPRINTF len = vsnprintf(str, size, format, va); #else /* Emulate it. */ - buffer = PyMem_MALLOC(size + 512); + buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE); if (buffer == NULL) { len = -666; goto Done; @@ -75,7 +85,7 @@ if (len < 0) /* ignore the error */; - else if ((size_t)len >= size + 512) + else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); else { @@ -86,8 +96,10 @@ str[to_copy] = '\0'; } PyMem_FREE(buffer); -Done: #endif - str[size-1] = '\0'; +Done: + if (size > 0) + str[size-1] = '\0'; return len; +#undef _PyOS_vsnprintf_EXTRA_SPACE } From buildbot at python.org Mon Jun 2 02:24:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Jun 2008 00:24:46 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080602002446.CCE661E400A@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1424 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Jun 2 02:58:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 02 Jun 2008 00:58:52 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 2.5 Message-ID: <20080602005852.E9C161E400A@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%202.5/builds/584 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 2 03:57:38 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 2 Jun 2008 03:57:38 +0200 (CEST) Subject: [Python-checkins] r63884 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080602015738.529391E400A@bag.python.org> Author: guilherme.polo Date: Mon Jun 2 03:57:37 2008 New Revision: 63884 Log: First support class added: a themed OptionMenu, just like the OptionMenu already present in tkinter but this one uses ttk Menubutton instead Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Mon Jun 2 03:57:37 2008 @@ -19,7 +19,9 @@ __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", - "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview"] + "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", + # Extensions + "OptionMenu"] import Tkinter @@ -1314,3 +1316,46 @@ def yview(self, *args): """Query or modify vertical position of the treeview.""" return self.tk.call(self._w, "yview", *args) + + +# Extensions + +class OptionMenu(Menubutton): + """Themed OptionMenu which allows the user to select a value from a + menu.""" + + def __init__(self, master, variable, value, *values, **kwargs): + """Construct a themed OptionMenu widget with the parent master, + the resource textvariable set to variable, the initially selected + value specified by the value parameter, the other menu values + given by *values and an additional keyword argument command.""" + kw = {'textvariable': variable, 'style': kwargs.pop('style', None)} + Menubutton.__init__(self, master, **kw) + + menu = self.__menu = Tkinter.Menu(self, name="menu", tearoff=0) + self.menuname = menu._w + + callback = kwargs.pop('command', None) + if kwargs: + raise Tkinter.TclError('unknown option -%s' % ( + next(kwargs.iterkeys()))) + + menu.add_command(label=value, + command=Tkinter._setit(variable, value, callback)) + for v in values: + menu.add_command(label=v, + command=Tkinter._setit(variable, v, callback)) + self['menu'] = menu + + + def __getitem__(self, item): + if item == 'menu': + return self.__menu + + return Menubutton.__getitem__(self, item) + + + def destroy(self): + """Destroy this widget and the associated menu.""" + Menubutton.destroy(self) + self.__menu = None Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Mon Jun 2 03:57:37 2008 @@ -19,7 +19,9 @@ __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", - "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview"] + "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", + # Extensions + "OptionMenu"] import tkinter @@ -1314,3 +1316,46 @@ def yview(self, *args): """Query or modify vertical position of the treeview.""" return self.tk.call(self._w, "yview", *args) + + +# Extensions + +class OptionMenu(Menubutton): + """Themed OptionMenu which allows the user to select a value from a + menu.""" + + def __init__(self, master, variable, value, *values, **kwargs): + """Construct a themed OptionMenu widget with the parent master, + the resource textvariable set to variable, the initially selected + value specified by the value parameter, the other menu values + given by *values and an additional keyword argument command.""" + kw = {'textvariable': variable, 'style': kwargs.pop('style', None)} + Menubutton.__init__(self, master, **kw) + + menu = self.__menu = tkinter.Menu(self, name="menu", tearoff=0) + self.menuname = menu._w + + callback = kwargs.pop('command', None) + if kwargs: + raise tkinter.TclError('unknown option -%s' % ( + next(iter(kwargs.keys())))) + + menu.add_command(label=value, + command=tkinter._setit(variable, value, callback)) + for v in values: + menu.add_command(label=v, + command=tkinter._setit(variable, v, callback)) + self['menu'] = menu + + + def __getitem__(self, item): + if item == 'menu': + return self.__menu + + return Menubutton.__getitem__(self, item) + + + def destroy(self): + """Destroy this widget and the associated menu.""" + Menubutton.destroy(self) + self.__menu = None From python-checkins at python.org Mon Jun 2 03:59:39 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 2 Jun 2008 03:59:39 +0200 (CEST) Subject: [Python-checkins] r63885 - sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Message-ID: <20080602015939.815701E400A@bag.python.org> Author: guilherme.polo Date: Mon Jun 2 03:59:39 2008 New Revision: 63885 Log: New idlelib uses the just added ttk OptionMenu at dynOptionMenu now. Modified: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Modified: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Mon Jun 2 03:59:39 2008 @@ -1,6 +1,6 @@ Index: Lib/idlelib/AutoCompleteWindow.py =================================================================== ---- Lib/idlelib/AutoCompleteWindow.py (revision 63734) +--- Lib/idlelib/AutoCompleteWindow.py (revision 63867) +++ Lib/idlelib/AutoCompleteWindow.py (working copy) @@ -4,7 +4,11 @@ from Tkinter import * @@ -16,7 +16,7 @@ KEYPRESS_VIRTUAL_EVENT_NAME = "<>" Index: Lib/idlelib/ToolTip.py =================================================================== ---- Lib/idlelib/ToolTip.py (revision 63734) +--- Lib/idlelib/ToolTip.py (revision 63867) +++ Lib/idlelib/ToolTip.py (working copy) @@ -3,7 +3,8 @@ # may be useful for some purposes in (or almost in ;) the current project scope @@ -28,6 +28,33 @@ class ToolTipBase: +Index: Lib/idlelib/configSectionNameDialog.py +=================================================================== +--- Lib/idlelib/configSectionNameDialog.py (revision 63867) ++++ Lib/idlelib/configSectionNameDialog.py (working copy) +@@ -4,7 +4,12 @@ + """ + from Tkinter import * + import tkMessageBox ++from idlelib.configHandler import idleConf + ++TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') ++if TTK: ++ from ttk import * ++ + class GetCfgSectionNameDialog(Toplevel): + def __init__(self,parent,title,message,usedNames): + """ +@@ -55,6 +60,9 @@ + width=8,command=self.Cancel) + self.buttonCancel.grid(row=0,column=1,padx=5,pady=5) + ++ if TTK: ++ frameButton['style'] = 'RootColor.TFrame' ++ + def NameOk(self): + #simple validity check for a sensible + #ConfigParser file section name Index: Lib/idlelib/stylist.py =================================================================== --- Lib/idlelib/stylist.py (revision 0) @@ -62,36 +89,9 @@ + return + + w.configure(**self.styles[style]) -Index: Lib/idlelib/configSectionNameDialog.py -=================================================================== ---- Lib/idlelib/configSectionNameDialog.py (revision 63734) -+++ Lib/idlelib/configSectionNameDialog.py (working copy) -@@ -4,7 +4,12 @@ - """ - from Tkinter import * - import tkMessageBox -+from idlelib.configHandler import idleConf - -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class GetCfgSectionNameDialog(Toplevel): - def __init__(self,parent,title,message,usedNames): - """ -@@ -55,6 +60,9 @@ - width=8,command=self.Cancel) - self.buttonCancel.grid(row=0,column=1,padx=5,pady=5) - -+ if TTK: -+ frameButton['style'] = 'RootColor.TFrame' -+ - def NameOk(self): - #simple validity check for a sensible - #ConfigParser file section name Index: Lib/idlelib/PyShell.py =================================================================== ---- Lib/idlelib/PyShell.py (revision 63734) +--- Lib/idlelib/PyShell.py (revision 63867) +++ Lib/idlelib/PyShell.py (working copy) @@ -22,14 +22,26 @@ print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ @@ -143,7 +143,7 @@ flist = PyShellFileList(root) Index: Lib/idlelib/Debugger.py =================================================================== ---- Lib/idlelib/Debugger.py (revision 63734) +--- Lib/idlelib/Debugger.py (revision 63867) +++ Lib/idlelib/Debugger.py (working copy) @@ -4,8 +4,11 @@ from Tkinter import * @@ -175,7 +175,7 @@ self.repr.maxstring = 60 Index: Lib/idlelib/configDialog.py =================================================================== ---- Lib/idlelib/configDialog.py (revision 63734) +--- Lib/idlelib/configDialog.py (revision 63867) +++ Lib/idlelib/configDialog.py (working copy) @@ -7,7 +7,6 @@ @@ -396,7 +396,7 @@ if self.themeIsBuiltin.get(): #a default theme Index: Lib/idlelib/ReplaceDialog.py =================================================================== ---- Lib/idlelib/ReplaceDialog.py (revision 63734) +--- Lib/idlelib/ReplaceDialog.py (revision 63867) +++ Lib/idlelib/ReplaceDialog.py (working copy) @@ -11,9 +11,12 @@ dialog.open(text) @@ -430,7 +430,7 @@ self.do_find(0) Index: Lib/idlelib/tabbedpages.py =================================================================== ---- Lib/idlelib/tabbedpages.py (revision 63734) +--- Lib/idlelib/tabbedpages.py (revision 63867) +++ Lib/idlelib/tabbedpages.py (working copy) @@ -1,490 +1,4 @@ -"""An implementation of tabbed pages using only standard Tkinter. @@ -929,7 +929,7 @@ + from idlelib.tabbedpages_old import TabbedPageSet Index: Lib/idlelib/keybindingDialog.py =================================================================== ---- Lib/idlelib/keybindingDialog.py (revision 63734) +--- Lib/idlelib/keybindingDialog.py (revision 63867) +++ Lib/idlelib/keybindingDialog.py (working copy) @@ -5,6 +5,12 @@ import tkMessageBox @@ -956,7 +956,7 @@ Index: Lib/idlelib/configHelpSourceEdit.py =================================================================== ---- Lib/idlelib/configHelpSourceEdit.py (revision 63734) +--- Lib/idlelib/configHelpSourceEdit.py (revision 63867) +++ Lib/idlelib/configHelpSourceEdit.py (working copy) @@ -6,7 +6,12 @@ from Tkinter import * @@ -997,7 +997,7 @@ ("HTML Files", "*.htm *.html", "TEXT"), Index: Lib/idlelib/GrepDialog.py =================================================================== ---- Lib/idlelib/GrepDialog.py (revision 63734) +--- Lib/idlelib/GrepDialog.py (revision 63867) +++ Lib/idlelib/GrepDialog.py (working copy) @@ -4,7 +4,11 @@ from Tkinter import * @@ -1058,7 +1058,7 @@ - self.top.withdraw() Index: Lib/idlelib/EditorWindow.py =================================================================== ---- Lib/idlelib/EditorWindow.py (revision 63734) +--- Lib/idlelib/EditorWindow.py (revision 63867) +++ Lib/idlelib/EditorWindow.py (working copy) @@ -365,7 +365,7 @@ self.menudict = menudict = {} @@ -1071,7 +1071,7 @@ if sys.platform == 'darwin' and '.framework' in sys.executable: Index: Lib/idlelib/aboutDialog.py =================================================================== ---- Lib/idlelib/aboutDialog.py (revision 63734) +--- Lib/idlelib/aboutDialog.py (revision 63867) +++ Lib/idlelib/aboutDialog.py (working copy) @@ -1,13 +1,17 @@ -"""About Dialog for IDLE @@ -1242,7 +1242,7 @@ Index: Lib/idlelib/config-main.def =================================================================== ---- Lib/idlelib/config-main.def (revision 63734) +--- Lib/idlelib/config-main.def (revision 63867) +++ Lib/idlelib/config-main.def (working copy) @@ -49,6 +49,7 @@ print-command-posix=lpr %s @@ -1254,7 +1254,7 @@ width= 80 Index: Lib/idlelib/IOBinding.py =================================================================== ---- Lib/idlelib/IOBinding.py (revision 63734) +--- Lib/idlelib/IOBinding.py (revision 63867) +++ Lib/idlelib/IOBinding.py (working copy) @@ -18,6 +18,9 @@ @@ -1268,7 +1268,7 @@ except ImportError: Index: Lib/idlelib/ScrolledList.py =================================================================== ---- Lib/idlelib/ScrolledList.py (revision 63734) +--- Lib/idlelib/ScrolledList.py (revision 63867) +++ Lib/idlelib/ScrolledList.py (working copy) @@ -1,5 +1,9 @@ from Tkinter import * @@ -1282,7 +1282,7 @@ default = "(None)" Index: Lib/idlelib/textView.py =================================================================== ---- Lib/idlelib/textView.py (revision 63734) +--- Lib/idlelib/textView.py (revision 63867) +++ Lib/idlelib/textView.py (working copy) @@ -1,10 +1,13 @@ -"""Simple text browser for IDLE @@ -1327,9 +1327,34 @@ def Ok(self, event=None): self.destroy() +Index: Lib/idlelib/CallTipWindow.py +=================================================================== +--- Lib/idlelib/CallTipWindow.py (revision 63867) ++++ Lib/idlelib/CallTipWindow.py (working copy) +@@ -5,7 +5,11 @@ + + """ + from Tkinter import * ++from idlelib.configHandler import idleConf + ++if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): ++ from ttk import * ++ + HIDE_VIRTUAL_EVENT_NAME = "<>" + HIDE_SEQUENCES = ("", "") + CHECKHIDE_VIRTUAL_EVENT_NAME = "<>" +@@ -163,6 +167,8 @@ + def calltip_hide(self, event): + self.calltip.hidetip() + ++# XXX Bugged test ++ + def main(): + # Test code + c=container() Index: Lib/idlelib/SearchDialogBase.py =================================================================== ---- Lib/idlelib/SearchDialogBase.py (revision 63734) +--- Lib/idlelib/SearchDialogBase.py (revision 63867) +++ Lib/idlelib/SearchDialogBase.py (working copy) @@ -1,35 +1,40 @@ from Tkinter import * @@ -1532,34 +1557,9 @@ + btns[opts['text']] = Button(f, **opts).grid(row=self.row, padx=6, + pady=6, column=column) + column += 1 -Index: Lib/idlelib/CallTipWindow.py -=================================================================== ---- Lib/idlelib/CallTipWindow.py (revision 63734) -+++ Lib/idlelib/CallTipWindow.py (working copy) -@@ -5,7 +5,11 @@ - - """ - from Tkinter import * -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - HIDE_VIRTUAL_EVENT_NAME = "<>" - HIDE_SEQUENCES = ("", "") - CHECKHIDE_VIRTUAL_EVENT_NAME = "<>" -@@ -163,6 +167,8 @@ - def calltip_hide(self, event): - self.calltip.hidetip() - -+# XXX Bugged test -+ - def main(): - # Test code - c=container() Index: Lib/idlelib/SearchDialog.py =================================================================== ---- Lib/idlelib/SearchDialog.py (revision 63734) +--- Lib/idlelib/SearchDialog.py (revision 63867) +++ Lib/idlelib/SearchDialog.py (working copy) @@ -21,10 +21,10 @@ return _setup(text).find_selection(text) @@ -2071,7 +2071,7 @@ + root.mainloop() Index: Lib/idlelib/TreeWidget.py =================================================================== ---- Lib/idlelib/TreeWidget.py (revision 63734) +--- Lib/idlelib/TreeWidget.py (revision 63867) +++ Lib/idlelib/TreeWidget.py (working copy) @@ -21,6 +21,12 @@ import ZoomHeight @@ -2198,9 +2198,9 @@ + root.mainloop() Index: Lib/idlelib/dynOptionMenuWidget.py =================================================================== ---- Lib/idlelib/dynOptionMenuWidget.py (revision 63734) +--- Lib/idlelib/dynOptionMenuWidget.py (revision 63867) +++ Lib/idlelib/dynOptionMenuWidget.py (working copy) -@@ -2,34 +2,41 @@ +@@ -2,34 +2,38 @@ OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness """ @@ -2212,7 +2212,7 @@ +from configHandler import idleConf +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: -+ from ttk import Style ++ from ttk import * + class DynOptionMenu(OptionMenu): - """ @@ -2232,9 +2232,6 @@ - #self.menu=self['menu'] - self.variable=variable - self.command=kwargs.get('command') -+ if TTK: # XXX Ideally this should be a ttk Menubutton -+ bg = Style(master).configure('.', 'background') -+ self.configure(bg=bg, highlightbackground=bg) - def SetMenu(self,valueList,value=None): + def SetMenu(self, valueList, value=None): @@ -2255,7 +2252,7 @@ self.variable.set(value) Index: Lib/idlelib/MultiStatusBar.py =================================================================== ---- Lib/idlelib/MultiStatusBar.py (revision 63734) +--- Lib/idlelib/MultiStatusBar.py (revision 63867) +++ Lib/idlelib/MultiStatusBar.py (working copy) @@ -1,5 +1,9 @@ from Tkinter import * From python-checkins at python.org Mon Jun 2 05:15:02 2008 From: python-checkins at python.org (collin.winter) Date: Mon, 2 Jun 2008 05:15:02 +0200 (CEST) Subject: [Python-checkins] r63886 - in sandbox/trunk/2to3: 2to3 lib2to3/refactor.py lib2to3/tests/test_all_fixers.py lib2to3/tests/test_fixers.py Message-ID: <20080602031502.322401E400A@bag.python.org> Author: collin.winter Date: Mon Jun 2 05:15:01 2008 New Revision: 63886 Log: Allow refactoring tools to specify a directory for fixer modules. This is step 2 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. Step 1: r63880. Modified: sandbox/trunk/2to3/2to3 sandbox/trunk/2to3/lib2to3/refactor.py sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/2to3 ============================================================================== --- sandbox/trunk/2to3/2to3 (original) +++ sandbox/trunk/2to3/2to3 Mon Jun 2 05:15:01 2008 @@ -2,4 +2,4 @@ from lib2to3 import refactor import sys -sys.exit(refactor.main()) +sys.exit(refactor.main("lib2to3/fixes")) Modified: sandbox/trunk/2to3/lib2to3/refactor.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/refactor.py (original) +++ sandbox/trunk/2to3/lib2to3/refactor.py Mon Jun 2 05:15:01 2008 @@ -30,11 +30,13 @@ from . import fixes from . import pygram -def main(args=None): +def main(fixer_dir, args=None): """Main program. - - Call without arguments to use sys.argv[1:] as the arguments; or - call with a list of arguments (excluding sys.argv[0]). + + Args: + fixer_dir: directory where fixer modules are located. + args: optional; a list of command line arguments. If omitted, + sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). """ @@ -57,7 +59,7 @@ options, args = parser.parse_args(args) if options.list_fixes: print "Available transformations for the -f/--fix option:" - for fixname in get_all_fix_names(): + for fixname in get_all_fix_names(fixer_dir): print fixname if not args: return 0 @@ -76,7 +78,7 @@ logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO) # Initialize the refactoring tool - rt = RefactoringTool(options) + rt = RefactoringTool(fixer_dir, options) # Refactor all files and directories passed as arguments if not rt.errors: @@ -87,10 +89,10 @@ return int(bool(rt.errors)) -def get_all_fix_names(): +def get_all_fix_names(fixer_dir): """Return a sorted list of all available fix names.""" fix_names = [] - names = os.listdir(os.path.dirname(fixes.__file__)) + names = os.listdir(fixer_dir) names.sort() for name in names: if name.startswith("fix_") and name.endswith(".py"): @@ -138,11 +140,14 @@ class RefactoringTool(object): - def __init__(self, options): + def __init__(self, fixer_dir, options): """Initializer. - The argument is an optparse.Values instance. + Args: + fixer_dir: directory in which to find fixer modules. + options: an optparse.Values instance. """ + self.fixer_dir = fixer_dir self.options = options self.errors = [] self.logger = logging.getLogger("RefactoringTool") @@ -167,14 +172,15 @@ want a pre-order AST traversal, and post_order is the list that want post-order traversal. """ + fixer_pkg = ".".join(self.fixer_dir.split(os.path.sep)) pre_order_fixers = [] post_order_fixers = [] fix_names = self.options.fix if not fix_names or "all" in fix_names: - fix_names = get_all_fix_names() + fix_names = get_all_fix_names(self.fixer_dir) for fix_name in fix_names: try: - mod = __import__("lib2to3.fixes.fix_" + fix_name, {}, {}, ["*"]) + mod = __import__(fixer_pkg + ".fix_" + fix_name, {}, {}, ["*"]) except ImportError: self.log_error("Can't find transformation %s", fix_name) continue Modified: sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py Mon Jun 2 05:15:01 2008 @@ -29,7 +29,7 @@ def setUp(self): options = Options(fix=["all", "idioms", "ws_comma", "buffer"], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) def test_all_project_files(self): for filepath in support.all_project_files(): Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Mon Jun 2 05:15:01 2008 @@ -30,7 +30,7 @@ class FixerTestCase(support.TestCase): def setUp(self): options = Options(fix=[self.fixer], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) self.fixer_log = [] self.filename = "" @@ -70,7 +70,7 @@ fix = [self.fixer] fix.extend(names) options = Options(fix=fix, print_function=False) - r = refactor.RefactoringTool(options) + r = refactor.RefactoringTool("lib2to3/fixes", options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): From python-checkins at python.org Mon Jun 2 22:36:39 2008 From: python-checkins at python.org (walter.doerwald) Date: Mon, 2 Jun 2008 22:36:39 +0200 (CEST) Subject: [Python-checkins] r63899 - in python/trunk: Lib/test/test_unicodedata.py Modules/unicodedata.c Message-ID: <20080602203639.CFEE61E4015@bag.python.org> Author: walter.doerwald Date: Mon Jun 2 22:36:03 2008 New Revision: 63899 Log: Change all functions that expect one unicode character to accept a pair of surrogates in narrow builds. Fixes issue #1706460. Modified: python/trunk/Lib/test/test_unicodedata.py python/trunk/Modules/unicodedata.c Modified: python/trunk/Lib/test/test_unicodedata.py ============================================================================== --- python/trunk/Lib/test/test_unicodedata.py (original) +++ python/trunk/Lib/test/test_unicodedata.py Mon Jun 2 22:36:03 2008 @@ -103,6 +103,7 @@ self.assertEqual(self.db.digit(u'9'), 9) self.assertEqual(self.db.digit(u'\u215b', None), None) self.assertEqual(self.db.digit(u'\u2468'), 9) + self.assertEqual(self.db.digit(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.digit) self.assertRaises(TypeError, self.db.digit, u'xx') @@ -113,6 +114,7 @@ self.assertEqual(self.db.numeric(u'9'), 9) self.assertEqual(self.db.numeric(u'\u215b'), 0.125) self.assertEqual(self.db.numeric(u'\u2468'), 9.0) + self.assertEqual(self.db.numeric(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.numeric) self.assertRaises(TypeError, self.db.numeric, u'xx') @@ -123,6 +125,7 @@ self.assertEqual(self.db.decimal(u'9'), 9) self.assertEqual(self.db.decimal(u'\u215b', None), None) self.assertEqual(self.db.decimal(u'\u2468', None), None) + self.assertEqual(self.db.decimal(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.decimal) self.assertRaises(TypeError, self.db.decimal, u'xx') @@ -132,6 +135,7 @@ self.assertEqual(self.db.category(u'\uFFFE'), 'Cn') self.assertEqual(self.db.category(u'a'), 'Ll') self.assertEqual(self.db.category(u'A'), 'Lu') + self.assertEqual(self.db.category(u'\U00020000'), 'Lo') self.assertRaises(TypeError, self.db.category) self.assertRaises(TypeError, self.db.category, u'xx') @@ -140,6 +144,7 @@ self.assertEqual(self.db.bidirectional(u'\uFFFE'), '') self.assertEqual(self.db.bidirectional(u' '), 'WS') self.assertEqual(self.db.bidirectional(u'A'), 'L') + self.assertEqual(self.db.bidirectional(u'\U00020000'), 'L') self.assertRaises(TypeError, self.db.bidirectional) self.assertRaises(TypeError, self.db.bidirectional, u'xx') @@ -155,6 +160,7 @@ self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) self.assertEqual(self.db.mirrored(u'a'), 0) self.assertEqual(self.db.mirrored(u'\u2201'), 1) + self.assertEqual(self.db.mirrored(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.mirrored) self.assertRaises(TypeError, self.db.mirrored, u'xx') @@ -163,6 +169,7 @@ self.assertEqual(self.db.combining(u'\uFFFE'), 0) self.assertEqual(self.db.combining(u'a'), 0) self.assertEqual(self.db.combining(u'\u20e1'), 230) + self.assertEqual(self.db.combining(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.combining) self.assertRaises(TypeError, self.db.combining, u'xx') @@ -185,6 +192,7 @@ self.assertEqual(eaw(u'\uFF66'), 'H') self.assertEqual(eaw(u'\uFF1F'), 'F') self.assertEqual(eaw(u'\u2010'), 'A') + self.assertEqual(eaw(u'\U00020000'), 'W') class UnicodeMiscTest(UnicodeDatabaseTest): Modified: python/trunk/Modules/unicodedata.c ============================================================================== --- python/trunk/Modules/unicodedata.c (original) +++ python/trunk/Modules/unicodedata.c Mon Jun 2 22:36:03 2008 @@ -54,12 +54,6 @@ return &_PyUnicode_Database_Records[index]; } -static const _PyUnicode_DatabaseRecord* -_getrecord(PyUnicodeObject* v) -{ - return _getrecord_ex(*PyUnicode_AS_UNICODE(v)); -} - /* ------------- Previous-version API ------------------------------------- */ typedef struct previous_version { PyObject_HEAD @@ -92,6 +86,24 @@ return (PyObject*)self; } + +static Py_UCS4 getuchar(PyUnicodeObject *obj) +{ + Py_UNICODE *v = PyUnicode_AS_UNICODE(obj); + + if (PyUnicode_GET_SIZE(obj) == 1) + return *v; +#ifndef Py_UNICODE_WIDE + else if ((PyUnicode_GET_SIZE(obj) == 2) && + (0xD800 <= v[0] && v[0] <= 0xDBFF) && + (0xDC00 <= v[1] && v[1] <= 0xDFFF)) + return (((v[0] & 0x3FF)<<10) | (v[1] & 0x3FF)) + 0x10000; +#endif + PyErr_SetString(PyExc_TypeError, + "need a single Unicode character as parameter"); + return (Py_UCS4)-1; +} + /* --- Module API --------------------------------------------------------- */ PyDoc_STRVAR(unicodedata_decimal__doc__, @@ -108,17 +120,16 @@ PyObject *defobj = NULL; int have_old = 0; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:decimal", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -131,7 +142,7 @@ } if (!have_old) - rc = Py_UNICODE_TODECIMAL(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODECIMAL(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, @@ -159,15 +170,14 @@ PyUnicodeObject *v; PyObject *defobj = NULL; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:digit", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } - rc = Py_UNICODE_TODIGIT(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODIGIT(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a digit"); @@ -195,17 +205,16 @@ PyObject *defobj = NULL; int have_old = 0; double rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:numeric", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -218,7 +227,7 @@ } if (!have_old) - rc = Py_UNICODE_TONUMERIC(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TONUMERIC(c); if (rc == -1.0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a numeric character"); @@ -243,18 +252,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:category", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->category; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->category; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed != 0xFF) index = old->category_changed; } @@ -273,18 +281,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:bidirectional", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->bidirectional; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->bidirectional; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ else if (old->bidir_changed != 0xFF) @@ -305,18 +312,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:combining", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->combining; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->combining; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -335,18 +341,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:mirrored", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->mirrored; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->mirrored; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -364,18 +369,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:east_asian_width", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->east_asian_width; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->east_asian_width; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -396,20 +400,19 @@ char decomp[256]; int code, index, count, i; unsigned int prefix_index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:decomposition", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - code = (int) *PyUnicode_AS_UNICODE(v); + code = (int)c; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) return PyBytes_FromString(""); /* unassigned */ } @@ -1039,20 +1042,18 @@ unicodedata_name(PyObject* self, PyObject* args) { char name[NAME_MAXLEN]; + Py_UCS4 c; PyUnicodeObject* v; PyObject* defobj = NULL; if (!PyArg_ParseTuple(args, "O!|O:name", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - if (!_getucname(self, (Py_UCS4) *PyUnicode_AS_UNICODE(v), - name, sizeof(name))) { + if (!_getucname(self, c, name, sizeof(name))) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "no such name"); return NULL; From python-checkins at python.org Tue Jun 3 00:06:02 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 3 Jun 2008 00:06:02 +0200 (CEST) Subject: [Python-checkins] r63900 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080602220602.CA7531E4018@bag.python.org> Author: guilherme.polo Date: Tue Jun 3 00:05:40 2008 New Revision: 63900 Log: Fixed a bug report from "Jim and Marian Denney" that was causing a ValueError exception to be raised when fetching the data from a treeview item. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 00:05:40 2008 @@ -250,11 +250,17 @@ for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - if hasattr(val, 'find') and val.find(' ') != -1: - # this could be the padding option ("left top right bottom") + try: # could be the padding option, a string of ints val = map(int, val.split()) + except AttributeError: + try: # could be a tuple of strings (or just ints) instead + val = map(int, val) + except TypeError: # just keep the value as is + pass + except ValueError: # just keep the value as is + pass - elif val and hasattr(val, "__len__") and hasattr(val[0], "typename"): + if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 00:05:40 2008 @@ -250,11 +250,17 @@ for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - if hasattr(val, 'find') and val.find(' ') != -1: - # this could be the padding option ("left top right bottom") + try: # could be the padding option, a string of ints val = list(map(int, val.split())) + except AttributeError: + try: # could be a tuple of strings (or just ints) instead + val = list(map(int, val)) + except TypeError: # just keep the value as is + pass + except ValueError: # just keep the value as is + pass - elif val and hasattr(val, "__len__") and hasattr(val[0], "typename"): + if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) From python-checkins at python.org Tue Jun 3 00:18:10 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 3 Jun 2008 00:18:10 +0200 (CEST) Subject: [Python-checkins] r63901 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080602221810.E30BC1E400B@bag.python.org> Author: guilherme.polo Date: Tue Jun 3 00:17:59 2008 New Revision: 63901 Log: Simplified last fix, which will make more sense in the world uses actually. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 00:17:59 2008 @@ -252,12 +252,7 @@ try: # could be the padding option, a string of ints val = map(int, val.split()) - except AttributeError: - try: # could be a tuple of strings (or just ints) instead - val = map(int, val) - except TypeError: # just keep the value as is - pass - except ValueError: # just keep the value as is + except (AttributeError, ValueError): # just keep the value as is pass if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 00:17:59 2008 @@ -252,12 +252,7 @@ try: # could be the padding option, a string of ints val = list(map(int, val.split())) - except AttributeError: - try: # could be a tuple of strings (or just ints) instead - val = list(map(int, val)) - except TypeError: # just keep the value as is - pass - except ValueError: # just keep the value as is + except (AttributeError, ValueError): # just keep the value as is pass if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): From python-checkins at python.org Tue Jun 3 00:19:34 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 00:19:34 +0200 (CEST) Subject: [Python-checkins] r63902 - peps/trunk/pep-3138.txt Message-ID: <20080602221934.E6FB81E4010@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 00:19:25 2008 New Revision: 63902 Log: New version from Atsuo. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 00:19:25 2008 @@ -9,11 +9,12 @@ Created: 05-May-2008 Post-History: + Abstract ======== -This PEP proposes new string representation form for Python 3000. In -Python prior to Python 3000, the repr() built-in function converts +This PEP proposes a new string representation form for Python 3000. In +Python prior to Python 3000, the repr() built-in function converted arbitrary objects to printable ASCII strings for debugging and logging. For Python 3000, a wider range of characters, based on the Unicode standard, should be considered 'printable'. @@ -28,30 +29,39 @@ - Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. - Convert other non-printable characters(0x00-0x1f, 0x7f) and non-ASCII - characters(>=0x80) to '\\xXX'. + characters(>=0x80) to '\\xXX'. -- Backslash-escape quote characters(' or ") and add quote character at - head and tail. +- Backslash-escape quote characters (apostrophe, ') and add the quote + character at the beginning and the end. For Unicode strings, the following additional conversions are done. - Convert leading surrogate pair characters without trailing character - (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. + (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. - Convert 16-bit characters(>=0x100) to '\\uXXXX'. - Convert 21-bit characters(>=0x10000) and surrogate pair characters to - '\\U00xxxxxx'. + '\\U00xxxxxx'. This algorithm converts any string to printable ASCII, and repr() is -used as handy and safe way to print strings for debugging or for +used as a handy and safe way to print strings for debugging or for logging. Although all non-ASCII characters are escaped, this does not matter when most of the string's characters are ASCII. But for other languages, such as Japanese where most characters in a string are not -ASCII, this is very inconvenient. Python 3000 has a lot of nice features -for non-Latin users such as non-ASCII identifiers, so it would be -helpful if Python could also progress in a similar way for printable -output. +ASCII, this is very inconvenient. + +We can use ``print(aJapaneseString)`` to get a readable string, but we +don't have a similar workaround for printing strings from collections +such as lists or tuples. ``print(listOfJapaneseStrings)`` uses repr() to +build the string to be printed, so the resulting strings are always +hex-escaped. Or when ``open(japaneseFilemame)`` raises an exception, the +error message is something like ``IOError: [Errno 2] No such file or +directory: '\u65e5\u672c\u8a9e'``, which isn't helpful. + +Python 3000 has a lot of nice features for non-Latin users such as +non-ASCII identifiers, so it would be helpful if Python could also +progress in a similar way for printable output. Some users might be concerned that such output will mess up their console if they print binary data like images. But this is unlikely to @@ -64,22 +74,53 @@ Specification ============= +- Add a new function to the Python C API ``int PY_UNICODE_ISPRINTABLE + (Py_UNICODE ch)``. This function returns 0 if repr() should escape the + Unicode character ``ch``; otherwise it returns 1. Characters that should + be escaped are defined in the Unicode character database as: + + * Cc (Other, Control) + * Cf (Other, Format) + * Cs (Other, Surrogate) + * Co (Other, Private Use) + * Cn (Other, Not Assigned) + * Zl (Separator, Line), refers to LINE SEPARATOR ('\\u2028'). + * Zp (Separator, Paragraph), refers to PARAGRAPH SEPARATOR ('\\u2029'). + * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in + this category should be escaped to avoid ambiguity. + - The algorithm to build repr() strings should be changed to: - * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. + * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. + + * Convert non-printable ASCII characters(0x00-0x1f, 0x7f) to '\\xXX'. + + * Convert leading surrogate pair characters without trailing character + (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. + + * Convert non-printable characters(PY_UNICODE_ISPRINTABLE() returns 0) + to 'xXX', '\\uXXXX' or '\\U00xxxxxx'. - * Convert other non-printable ASCII characters(0x00-0x1f, 0x7f) to - '\\xXX'. + * Backslash-escape quote characters (apostrophe, 0x27) and add quote + character at the beginning and the end. - * Convert leading surrogate pair characters without trailing character - (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. +- Set the Unicode error-handler for sys.stderr to 'backslashreplace' by + default. - * Convert Unicode whitespace other than ASCII space('\\x20'), and - control characters (categories Z* and C* in the Unicode database), - to '\\xXX', '\\uXXXX' or '\\U00xxxxxx'. +- Add ``'%a'`` string format operator. ``'%a'`` converts any python + object to a string using repr() and then hex-escapes all non-ASCII + characters. The ``'%a'`` format operator generates the same string as + ``'%r'`` in Python 2. -- Set the Unicode error-handler for sys.stdout and sys.stderr to - 'backslashreplace' by default. +- Add a new built-in function, ``ascii()``. This function converts any + python object to a string using repr() and then hex-escapes all non- + ASCII characters. ``ascii()`` generates the same string as ``repr()`` + in Python 2. + +- Add an ``isprintable()`` method to the string type. ``str.isprintable()`` + returns False if repr() should escape any character in the string; + otherwise returns True. The ``isprintable()`` method calls the + `` PY_UNICODE_ISPRINTABLE()`` function internally. Rationale @@ -90,44 +131,29 @@ locale setting, because the locale is not necessarily the same as the output device's locale. For example, it is common for a daemon process to be invoked in an ASCII setting, but writes UTF-8 to its log files. +Also, web applications might want to report the error information in +more readable form based on the HTML page's encoding. -Characters not supported by user's console are hex-escaped on printing, -by the Unicode encoders' error-handler. If the error-handler of the -output file is 'backslashreplace', such characters are hex-escaped -without raising UnicodeEncodeError. For example, if your default -encoding is ASCII, ``print('?')`` will prints '\\xa2'. If your encoding -is ISO-8859-1, '' will be printed. - - -Printable characters --------------------- - -The Unicode standard doesn't define Non-printable characters, so we must -create our own definition. Here we propose to define Non-printable -characters as follows. - -- Non-printable ASCII characters as Python 2. - -- Broken surrogate pair characters. - -- Characters defined in the Unicode character database as - - * Cc (Other, Control) - * Cf (Other, Format) - * Cs (Other, Surrogate) - * Co (Other, Private Use) - * Cn (Other, Not Assigned) - * Zl Separator, Line ('\\u2028', LINE SEPARATOR) - * Zp Separator, Paragraph ('\\u2029', PARAGRAPH SEPARATOR) - * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in - this category should be escaped to avoid ambiguity. - +Characters not supported by the user's console could be hex-escaped on +printing, by the Unicode encoder's error-handler. If the error-handler +of the output file is 'backslashreplace', such characters are hex- +escaped without raising UnicodeEncodeError. For example, if your default +encoding is ASCII, ``print('Hello ?')`` will prints 'Hello \\xa2'. If +your encoding is ISO-8859-1, 'Hello ?' will be printed. + +Default error-handler of sys.stdout is 'strict'. Other applications +reading the output might not understand hex-escaped characters, so +unsupported characters should be trapped when writing. If you need to +escape unsupported characters, you should change error-handler +explicitly. For sys.stderr, default error-handler is set to +'backslashreplace' and printing exceptions or error messages won't +be failed. Alternate Solutions ------------------- To help debugging in non-Latin languages without changing repr(), other -suggestion were made. +suggestions were made. - Supply a tool to print lists or dicts. @@ -142,9 +168,9 @@ For interactive sessions, we can write hooks to restore hex escaped characters to the original characters. But these hooks are called only - when the result of evaluating an expression entered in an interactive - Python session, and doesn't work for the print() function or for - non-interactive sessions. + when printing the result of evaluating an expression entered in an + interactive Python session, and doesn't work for the print() function, + for non-interactive sessions or for logging.debug("%r", ...), etc. - Subclass sys.stdout and sys.stderr. @@ -154,34 +180,91 @@ print("\\"+"u0041")`` should be printed as '\\u0041', not 'A'. But there is no chance to tell file objects apart. -- Make the encoding used by unicode_repr() adjustable. +- Make the encoding used by unicode_repr() adjustable, and make the + existing repr() the default. + + With adjustable repr(), the result of using repr() is unpredictable + and would make it impossible to write correct code involving repr(). + And if current repr() is the default, then the old convention remains + intact and users may expect ASCII strings as the result of repr(). + Third party applications or libraries could be confused when a custom + repr() function is used. - There is no benefit preserving the current repr() behavior to make - application/library authors aware of non-ASCII repr(). And selecting - an encoding on printing is more flexible than having a global setting. + +Backwards Compatibility +======================= + +Changing repr() may break some existing code, especially testing code. +Five of Python's regression tests fail with this modification. If you +need repr() strings without non-ASCII character as Python 2, you can use +the following function. :: + + def repr_ascii(obj): + return str(repr(obj).encode("ASCII", "backslashreplace"), "ASCII") + +For logging or for debugging, the following code can raise +UnicodeEncodeError. :: + + log = open("logfile", "w") + log.write(repr(data)) # UnicodeEncodeError will be raised + # if data contains unsupported characters. + +To avoid exceptions being raised, you can explicitly specify the error- +handler. :: + + log = open("logfile", "w", errors="backslashreplace") + log.write(repr(data)) # Unsupported characters will be escaped. + + +For a console that uses a Unicode-based encoding, for example, en_US. +utf8 or de_DE.utf8, the backslashescape trick doesn't work and all +printable characters are not escaped. This will cause a problem of +similarly drawing characters in Western, Greek and Cyrillic languages. +These languages use similar (but different) alphabets (descended from +the common ancestor) and contain letters that look similar but have +different character codes. For example, it is hard to distinguish Latin +'a', 'e' and 'o' from Cyrillic '\u0430', '\u0435' and '\u043e'. (The visual +representation, of course, very much depends on the fonts used but +usually these letters are almost indistinguishable.) To avoid the +problem, the user can adjust the terminal encoding to get a result +suitable for their environment. Open Issues =========== -- A lot of people use UTF-8 for their encoding, for example, en_US.utf8 - and de_DE.utf8. In such cases, the backslashescape trick doesn't work. +- Is the ``ascii()`` function necessary, or is it sufficient to document + how to do it? If necessary, should ``ascii()`` belong to the builtin + namespace? -Backwards Compatibility -======================= +Rejected Proposals +================== -Changing repr() may break some existing codes, especially testing code. -Five of Python's regression test fail with this modification. If you -need repr() strings without non-ASCII character as Python 2, you can use -following function. +- Add encoding and errors arguments to the builtin print() function, + with defaults of sys.getfilesystemencoding() and 'backslashreplace'. + + Complicated to implement, and in general, this is not seen as a good + idea. [2]_ + +- Use character names to escape characters, instead of hex character + codes. For example, ``repr('\u03b1')`` can be converted to + ``"\N{GREEK SMALL LETTER ALPHA}"``. + + Using character names can be very verbose compared to hex-escape. + e.g., ``repr("\ufbf9")`` is converted to ``"\N{ARABIC LIGATURE UIGHUR + KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM}"``. -:: +- Default error-handler of sys.stdout should be 'backslashreplace'. - def repr_ascii(obj): - return str(repr(obj).encode("ASCII", "backslashreplace"), "ASCII") + Stuff written to stdout might be consumed by another program that + might misinterpret the \ escapes. For interactive session, it is + possible to make 'backslashreplace' error-handler to default, but may + add confusion of the kind "it works in interactive mode but not when + redirecting to a file". +- Hide quoted text - Reference Implementation ======================== @@ -194,6 +277,8 @@ .. [1] Multibyte string on string::string_print (http://bugs.python.org/issue479898) +.. [2] [Python-3000] Displaying strings containing unicode escapes + (http://mail.python.org/pipermail/python-3000/2008-April/013366.html) Copyright ========= From python-checkins at python.org Tue Jun 3 00:23:42 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 00:23:42 +0200 (CEST) Subject: [Python-checkins] r63903 - peps/trunk/pep-3138.txt Message-ID: <20080602222342.6267D1E4016@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 00:23:23 2008 New Revision: 63903 Log: Correct PY_UNICODE_ISPRINTABLE to Py_UNICODE_ISPRINTABLE. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 00:23:23 2008 @@ -74,7 +74,7 @@ Specification ============= -- Add a new function to the Python C API ``int PY_UNICODE_ISPRINTABLE +- Add a new function to the Python C API ``int Py_UNICODE_ISPRINTABLE (Py_UNICODE ch)``. This function returns 0 if repr() should escape the Unicode character ``ch``; otherwise it returns 1. Characters that should be escaped are defined in the Unicode character database as: @@ -98,7 +98,7 @@ * Convert leading surrogate pair characters without trailing character (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. - * Convert non-printable characters(PY_UNICODE_ISPRINTABLE() returns 0) + * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) to 'xXX', '\\uXXXX' or '\\U00xxxxxx'. * Backslash-escape quote characters (apostrophe, 0x27) and add quote @@ -120,7 +120,7 @@ - Add an ``isprintable()`` method to the string type. ``str.isprintable()`` returns False if repr() should escape any character in the string; otherwise returns True. The ``isprintable()`` method calls the - `` PY_UNICODE_ISPRINTABLE()`` function internally. + `` Py_UNICODE_ISPRINTABLE()`` function internally. Rationale From python-checkins at python.org Tue Jun 3 00:26:29 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 00:26:29 +0200 (CEST) Subject: [Python-checkins] r63904 - peps/trunk/pep-3138.txt Message-ID: <20080602222629.BB4891E4018@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 00:26:21 2008 New Revision: 63904 Log: Fix lay-out glitches and remove gmail turd. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 00:26:21 2008 @@ -29,20 +29,20 @@ - Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. - Convert other non-printable characters(0x00-0x1f, 0x7f) and non-ASCII - characters(>=0x80) to '\\xXX'. + characters(>=0x80) to '\\xXX'. - Backslash-escape quote characters (apostrophe, ') and add the quote - character at the beginning and the end. + character at the beginning and the end. For Unicode strings, the following additional conversions are done. - Convert leading surrogate pair characters without trailing character - (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. + (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. - Convert 16-bit characters(>=0x100) to '\\uXXXX'. - Convert 21-bit characters(>=0x10000) and surrogate pair characters to - '\\U00xxxxxx'. + '\\U00xxxxxx'. This algorithm converts any string to printable ASCII, and repr() is used as a handy and safe way to print strings for debugging or for @@ -75,19 +75,19 @@ ============= - Add a new function to the Python C API ``int Py_UNICODE_ISPRINTABLE - (Py_UNICODE ch)``. This function returns 0 if repr() should escape the - Unicode character ``ch``; otherwise it returns 1. Characters that should - be escaped are defined in the Unicode character database as: - - * Cc (Other, Control) - * Cf (Other, Format) - * Cs (Other, Surrogate) - * Co (Other, Private Use) - * Cn (Other, Not Assigned) - * Zl (Separator, Line), refers to LINE SEPARATOR ('\\u2028'). - * Zp (Separator, Paragraph), refers to PARAGRAPH SEPARATOR ('\\u2029'). - * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in - this category should be escaped to avoid ambiguity. + (Py_UNICODE ch)``. This function returns 0 if repr() should escape the + Unicode character ``ch``; otherwise it returns 1. Characters that should + be escaped are defined in the Unicode character database as: + + * Cc (Other, Control) + * Cf (Other, Format) + * Cs (Other, Surrogate) + * Co (Other, Private Use) + * Cn (Other, Not Assigned) + * Zl (Separator, Line), refers to LINE SEPARATOR ('\\u2028'). + * Zp (Separator, Paragraph), refers to PARAGRAPH SEPARATOR ('\\u2029'). + * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in + this category should be escaped to avoid ambiguity. - The algorithm to build repr() strings should be changed to: @@ -105,22 +105,22 @@ character at the beginning and the end. - Set the Unicode error-handler for sys.stderr to 'backslashreplace' by - default. + default. - Add ``'%a'`` string format operator. ``'%a'`` converts any python - object to a string using repr() and then hex-escapes all non-ASCII - characters. The ``'%a'`` format operator generates the same string as - ``'%r'`` in Python 2. + object to a string using repr() and then hex-escapes all non-ASCII + characters. The ``'%a'`` format operator generates the same string as + ``'%r'`` in Python 2. - Add a new built-in function, ``ascii()``. This function converts any - python object to a string using repr() and then hex-escapes all non- - ASCII characters. ``ascii()`` generates the same string as ``repr()`` - in Python 2. + python object to a string using repr() and then hex-escapes all non- + ASCII characters. ``ascii()`` generates the same string as ``repr()`` + in Python 2. - Add an ``isprintable()`` method to the string type. ``str.isprintable()`` - returns False if repr() should escape any character in the string; - otherwise returns True. The ``isprintable()`` method calls the - `` Py_UNICODE_ISPRINTABLE()`` function internally. + returns False if repr() should escape any character in the string; + otherwise returns True. The ``isprintable()`` method calls the + `` Py_UNICODE_ISPRINTABLE()`` function internally. Rationale @@ -157,38 +157,38 @@ - Supply a tool to print lists or dicts. - Strings to be printed for debugging are not only contained by lists or - dicts, but also in many other types of object. File objects contain a - file name in Unicode, exception objects contain a message in Unicode, - etc. These strings should be printed in readable form when repr()ed. - It is unlikely to be possible to implement a tool to print all - possible object types. + Strings to be printed for debugging are not only contained by lists or + dicts, but also in many other types of object. File objects contain a + file name in Unicode, exception objects contain a message in Unicode, + etc. These strings should be printed in readable form when repr()ed. + It is unlikely to be possible to implement a tool to print all + possible object types. - Use sys.displayhook and sys.excepthook. - For interactive sessions, we can write hooks to restore hex escaped - characters to the original characters. But these hooks are called only - when printing the result of evaluating an expression entered in an - interactive Python session, and doesn't work for the print() function, - for non-interactive sessions or for logging.debug("%r", ...), etc. + For interactive sessions, we can write hooks to restore hex escaped + characters to the original characters. But these hooks are called only + when printing the result of evaluating an expression entered in an + interactive Python session, and doesn't work for the print() function, + for non-interactive sessions or for logging.debug("%r", ...), etc. - Subclass sys.stdout and sys.stderr. - It is difficult to implement a subclass to restore hex-escaped - characters since there isn't enough information left by the time it's - a string to undo the escaping correctly in all cases. For example, `` - print("\\"+"u0041")`` should be printed as '\\u0041', not 'A'. But - there is no chance to tell file objects apart. + It is difficult to implement a subclass to restore hex-escaped + characters since there isn't enough information left by the time it's + a string to undo the escaping correctly in all cases. For example, `` + print("\\"+"u0041")`` should be printed as '\\u0041', not 'A'. But + there is no chance to tell file objects apart. - Make the encoding used by unicode_repr() adjustable, and make the - existing repr() the default. + existing repr() the default. - With adjustable repr(), the result of using repr() is unpredictable - and would make it impossible to write correct code involving repr(). - And if current repr() is the default, then the old convention remains - intact and users may expect ASCII strings as the result of repr(). - Third party applications or libraries could be confused when a custom - repr() function is used. + With adjustable repr(), the result of using repr() is unpredictable + and would make it impossible to write correct code involving repr(). + And if current repr() is the default, then the old convention remains + intact and users may expect ASCII strings as the result of repr(). + Third party applications or libraries could be confused when a custom + repr() function is used. Backwards Compatibility @@ -234,37 +234,36 @@ =========== - Is the ``ascii()`` function necessary, or is it sufficient to document - how to do it? If necessary, should ``ascii()`` belong to the builtin - namespace? + how to do it? If necessary, should ``ascii()`` belong to the builtin + namespace? Rejected Proposals ================== - Add encoding and errors arguments to the builtin print() function, - with defaults of sys.getfilesystemencoding() and 'backslashreplace'. + with defaults of sys.getfilesystemencoding() and 'backslashreplace'. - Complicated to implement, and in general, this is not seen as a good - idea. [2]_ + Complicated to implement, and in general, this is not seen as a good + idea. [2]_ - Use character names to escape characters, instead of hex character - codes. For example, ``repr('\u03b1')`` can be converted to - ``"\N{GREEK SMALL LETTER ALPHA}"``. + codes. For example, ``repr('\u03b1')`` can be converted to + ``"\N{GREEK SMALL LETTER ALPHA}"``. - Using character names can be very verbose compared to hex-escape. - e.g., ``repr("\ufbf9")`` is converted to ``"\N{ARABIC LIGATURE UIGHUR - KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM}"``. + Using character names can be very verbose compared to hex-escape. + e.g., ``repr("\ufbf9")`` is converted to ``"\N{ARABIC LIGATURE UIGHUR + KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM}"``. - Default error-handler of sys.stdout should be 'backslashreplace'. - Stuff written to stdout might be consumed by another program that - might misinterpret the \ escapes. For interactive session, it is - possible to make 'backslashreplace' error-handler to default, but may - add confusion of the kind "it works in interactive mode but not when - redirecting to a file". + Stuff written to stdout might be consumed by another program that + might misinterpret the \ escapes. For interactive session, it is + possible to make 'backslashreplace' error-handler to default, but may + add confusion of the kind "it works in interactive mode but not when + redirecting to a file". -- Hide quoted text - Reference Implementation ======================== From python-checkins at python.org Tue Jun 3 00:27:46 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 00:27:46 +0200 (CEST) Subject: [Python-checkins] r63905 - peps/trunk/pep-3138.txt Message-ID: <20080602222746.A164B1E4004@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 00:27:46 2008 New Revision: 63905 Log: Add back missing \\ in front of xXX. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 00:27:46 2008 @@ -99,7 +99,7 @@ (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) - to 'xXX', '\\uXXXX' or '\\U00xxxxxx'. + to '\\xXX', '\\uXXXX' or '\\U00xxxxxx'. * Backslash-escape quote characters (apostrophe, 0x27) and add quote character at the beginning and the end. From python-checkins at python.org Tue Jun 3 00:28:42 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 00:28:42 +0200 (CEST) Subject: [Python-checkins] r63906 - peps/trunk/pep-3138.txt Message-ID: <20080602222842.C15AA1E400C@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 00:28:42 2008 New Revision: 63906 Log: Fix indent on one last set of nested bullets. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 00:28:42 2008 @@ -91,18 +91,18 @@ - The algorithm to build repr() strings should be changed to: - * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. + * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. - * Convert non-printable ASCII characters(0x00-0x1f, 0x7f) to '\\xXX'. + * Convert non-printable ASCII characters(0x00-0x1f, 0x7f) to '\\xXX'. - * Convert leading surrogate pair characters without trailing character - (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. + * Convert leading surrogate pair characters without trailing character + (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. - * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) - to '\\xXX', '\\uXXXX' or '\\U00xxxxxx'. + * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) + to '\\xXX', '\\uXXXX' or '\\U00xxxxxx'. - * Backslash-escape quote characters (apostrophe, 0x27) and add quote - character at the beginning and the end. + * Backslash-escape quote characters (apostrophe, 0x27) and add quote + character at the beginning and the end. - Set the Unicode error-handler for sys.stderr to 'backslashreplace' by default. From python-checkins at python.org Tue Jun 3 00:54:46 2008 From: python-checkins at python.org (barry.warsaw) Date: Tue, 3 Jun 2008 00:54:46 +0200 (CEST) Subject: [Python-checkins] r63907 - peps/trunk/pep-0361.txt Message-ID: <20080602225446.1C71A1E4004@bag.python.org> Author: barry.warsaw Date: Tue Jun 3 00:54:45 2008 New Revision: 63907 Log: first betas now planned for June 11th Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Tue Jun 3 00:54:45 2008 @@ -54,7 +54,7 @@ Feb 29 2008: Python 2.6a1 and 3.0a3 are released Apr 02 2008: Python 2.6a2 and 3.0a4 are released May 08 2008: Python 2.6a3 and 3.0a5 are released - Jun 04 2008: Python 2.6b1 and 3.0b1 planned + Jun 11 2008: Python 2.6b1 and 3.0b1 planned Jul 02 2008: Python 2.6b2 and 3.0b2 planned Aug 06 2008: Python 2.6rc1 and 3.0rc1 planned Aug 20 2008: Python 2.6rc2 and 3.0rc2 planned From python-checkins at python.org Tue Jun 3 01:49:47 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 3 Jun 2008 01:49:47 +0200 (CEST) Subject: [Python-checkins] r63908 - in sandbox/trunk/ttk-gsoc: samples/combo_themes.py src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080602234947.EE83A1E4004@bag.python.org> Author: guilherme.polo Date: Tue Jun 3 01:49:47 2008 New Revision: 63908 Log: Better explanation of the previous fix, and yet another fix over the previous fix (looks good now). Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/combo_themes.py (original) +++ sandbox/trunk/ttk-gsoc/samples/combo_themes.py Tue Jun 3 01:49:47 2008 @@ -28,8 +28,7 @@ # Create a readonly Combobox which will display 4 values at max, # which will cause it to create a scrollbar if there are more # than 4 values in total. - themes_combo = ttk.Combobox(self, values=tuple(themes), - state="readonly", height=4) + themes_combo = ttk.Combobox(self, values=themes, state="readonly", height=4) themes_combo.set(themes[0]) # sets the combobox value to "Pick a theme" # Combobox widget generates a <> virtual event # when the user selects an element. This event is generated after Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 01:49:47 2008 @@ -250,13 +250,14 @@ for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - try: # could be the padding option, a string of ints - val = map(int, val.split()) - except (AttributeError, ValueError): # just keep the value as is - pass - - if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): - val = _list_from_statespec(val) + try: + if ' ' in val: # val could be the padding option + val = map(int, val.split()) + except (AttributeError, TypeError, ValueError): + # it is not a bool, neither a string and not even a tuple or list + # but still could be a statespec value + if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): + val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 01:49:47 2008 @@ -250,13 +250,14 @@ for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - try: # could be the padding option, a string of ints - val = list(map(int, val.split())) - except (AttributeError, ValueError): # just keep the value as is - pass - - if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): - val = _list_from_statespec(val) + try: + if ' ' in val: # could be the padding option + val = list(map(int, val.split())) + except (AttributeError, TypeError, ValueError): + # it is not a bool, neither a string and not even a tuple or list + # but still could be a statespec value + if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): + val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) From python-checkins at python.org Tue Jun 3 02:41:16 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 3 Jun 2008 02:41:16 +0200 (CEST) Subject: [Python-checkins] r63909 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080603004116.1F8411E4004@bag.python.org> Author: guilherme.polo Date: Tue Jun 3 02:41:15 2008 New Revision: 63909 Log: Now, the fix done at r63900 finally seems good. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 02:41:15 2008 @@ -255,7 +255,8 @@ val = map(int, val.split()) except (AttributeError, TypeError, ValueError): # it is not a bool, neither a string and not even a tuple or list - # but still could be a statespec value + pass + else: # but could be a statespec val if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): val = _list_from_statespec(val) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 02:41:15 2008 @@ -251,11 +251,12 @@ for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): try: - if ' ' in val: # could be the padding option + if ' ' in val: # val could be the padding option val = list(map(int, val.split())) except (AttributeError, TypeError, ValueError): # it is not a bool, neither a string and not even a tuple or list - # but still could be a statespec value + pass + else: # but could be a statespec val if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): val = _list_from_statespec(val) From python-checkins at python.org Tue Jun 3 03:30:37 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 3 Jun 2008 03:30:37 +0200 (CEST) Subject: [Python-checkins] r63910 - python/trunk/Lib/test/test_mutex.py Message-ID: <20080603013037.6943C1E400D@bag.python.org> Author: benjamin.peterson Date: Tue Jun 3 03:30:37 2008 New Revision: 63910 Log: make test_mutex more elegant Modified: python/trunk/Lib/test/test_mutex.py Modified: python/trunk/Lib/test/test_mutex.py ============================================================================== --- python/trunk/Lib/test/test_mutex.py (original) +++ python/trunk/Lib/test/test_mutex.py Tue Jun 3 03:30:37 2008 @@ -5,26 +5,28 @@ class MutexTest(unittest.TestCase): - def setUp(self): - self.mutex = mutex.mutex() - - def called_by_mutex(self, some_data): - self.assert_(self.mutex.test(), "mutex not held") - # Nested locking - self.mutex.lock(self.called_by_mutex2, "eggs") - - def called_by_mutex2(self, some_data): - self.assert_(self.ready_for_2, - "called_by_mutex2 called too soon") - def test_lock_and_unlock(self): - self.read_for_2 = False - self.mutex.lock(self.called_by_mutex, "spam") - self.ready_for_2 = True + + def called_by_mutex(some_data): + self.assertEqual(some_data, "spam") + self.assert_(m.test(), "mutex not held") + # Nested locking + m.lock(called_by_mutex2, "eggs") + + def called_by_mutex2(some_data): + self.assertEquals(some_data, "eggs") + self.assert_(m.test(), "mutex not held") + self.assert_(ready_for_2, + "called_by_mutex2 called too soon") + + m = mutex.mutex() + read_for_2 = False + m.lock(called_by_mutex, "spam") + ready_for_2 = True # unlock both locks - self.mutex.unlock() - self.mutex.unlock() - self.failIf(self.mutex.test(), "mutex still held") + m.unlock() + m.unlock() + self.failIf(m.test(), "mutex still held") def test_main(): test.test_support.run_unittest(MutexTest) From buildbot at python.org Tue Jun 3 04:12:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 02:12:58 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080603021258.8318C1E4004@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/3753 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Tue Jun 3 04:31:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 02:31:20 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080603023120.B76961E4013@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3485 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_urllib2 test_urllib2net ====================================================================== ERROR: test_trivial (test.test_urllib2.TrivialTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 36, in test_trivial f = urllib2.urlopen(file_url) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1212, in file_open return self.open_local_file(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1231, in open_local_file localfile = url2pathname(file) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 55, in url2pathname return unquote(pathname) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 621, in test_file r = h.file_open(Request(url)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1212, in file_open return self.open_local_file(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1231, in open_local_file localfile = url2pathname(file) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 55, in url2pathname return unquote(pathname) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 581, in test_ftp r = h.ftp_open(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1301, in ftp_open return addinfourl(fp, headers, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 724, in test_http r = h.do_open(http, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_redirect (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 832, in test_redirect MockHeaders({"location": to_url})) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 565, in http_error_302 new = self.redirect_request(req, fp, code, msg, headers, newurl) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 545, in redirect_request raise HTTPError(req.get_full_url(), code, msg, headers, fp) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 162, in __init__ self.__super_init(fp, hdrs, url, code) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_build_opener (test.test_urllib2.MiscTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 1046, in test_build_opener o = build_opener(FooHandler, BarHandler) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 118, in test_file self._test_urls(urls, self._extra_handlers(), urllib2.urlopen) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 106, in test_ftp self._test_urls(urls, self._extra_handlers()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_close (test.test_urllib2net.CloseSocketTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 76, in test_close response = _urlopen_with_retry("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 222, in test_ftp_basic u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 229, in test_ftp_default_timeout u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 238, in test_ftp_no_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 244, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_http_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 193, in test_http_basic u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 200, in test_http_default_timeout u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 209, in test_http_no_timeout u = _urlopen_with_retry("http://www.python.org", timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 215, in test_http_timeout u = _urlopen_with_retry("http://www.python.org", timeout=120) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 3 10:27:25 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 3 Jun 2008 10:27:25 +0200 (CEST) Subject: [Python-checkins] r63912 - in python/branches/tlee-ast-optimize: Lib/ctypes/test/__init__.py Lib/test/test_mutex.py Lib/test/test_unicodedata.py Modules/_ctypes/libffi/fficonfig.py.in Modules/unicodedata.c setup.py Message-ID: <20080603082725.B9FDE1E4004@bag.python.org> Author: thomas.lee Date: Tue Jun 3 10:27:25 2008 New Revision: 63912 Log: Merged revisions 63894-63911 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r63897 | thomas.heller | 2008-06-03 04:41:30 +1000 (Tue, 03 Jun 2008) | 1 line Fix misspelled sys.platform name and misspelled filename. ........ r63898 | thomas.heller | 2008-06-03 06:07:46 +1000 (Tue, 03 Jun 2008) | 1 line Fix the -x flag so that is does work. ........ r63899 | walter.doerwald | 2008-06-03 06:36:03 +1000 (Tue, 03 Jun 2008) | 3 lines Change all functions that expect one unicode character to accept a pair of surrogates in narrow builds. Fixes issue #1706460. ........ r63910 | benjamin.peterson | 2008-06-03 11:30:37 +1000 (Tue, 03 Jun 2008) | 2 lines make test_mutex more elegant ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Lib/ctypes/test/__init__.py python/branches/tlee-ast-optimize/Lib/test/test_mutex.py python/branches/tlee-ast-optimize/Lib/test/test_unicodedata.py python/branches/tlee-ast-optimize/Modules/_ctypes/libffi/fficonfig.py.in python/branches/tlee-ast-optimize/Modules/unicodedata.c python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Lib/ctypes/test/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ctypes/test/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/ctypes/test/__init__.py Tue Jun 3 10:27:25 2008 @@ -178,7 +178,7 @@ elif flag == "-u": use_resources.extend(value.split(",")) elif flag == "-x": - exclude.append(value.split(",")) + exclude.extend(value.split(",")) mask = "test_*.py" if args: Modified: python/branches/tlee-ast-optimize/Lib/test/test_mutex.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_mutex.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_mutex.py Tue Jun 3 10:27:25 2008 @@ -5,26 +5,28 @@ class MutexTest(unittest.TestCase): - def setUp(self): - self.mutex = mutex.mutex() - - def called_by_mutex(self, some_data): - self.assert_(self.mutex.test(), "mutex not held") - # Nested locking - self.mutex.lock(self.called_by_mutex2, "eggs") - - def called_by_mutex2(self, some_data): - self.assert_(self.ready_for_2, - "called_by_mutex2 called too soon") - def test_lock_and_unlock(self): - self.read_for_2 = False - self.mutex.lock(self.called_by_mutex, "spam") - self.ready_for_2 = True + + def called_by_mutex(some_data): + self.assertEqual(some_data, "spam") + self.assert_(m.test(), "mutex not held") + # Nested locking + m.lock(called_by_mutex2, "eggs") + + def called_by_mutex2(some_data): + self.assertEquals(some_data, "eggs") + self.assert_(m.test(), "mutex not held") + self.assert_(ready_for_2, + "called_by_mutex2 called too soon") + + m = mutex.mutex() + read_for_2 = False + m.lock(called_by_mutex, "spam") + ready_for_2 = True # unlock both locks - self.mutex.unlock() - self.mutex.unlock() - self.failIf(self.mutex.test(), "mutex still held") + m.unlock() + m.unlock() + self.failIf(m.test(), "mutex still held") def test_main(): test.test_support.run_unittest(MutexTest) Modified: python/branches/tlee-ast-optimize/Lib/test/test_unicodedata.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_unicodedata.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_unicodedata.py Tue Jun 3 10:27:25 2008 @@ -103,6 +103,7 @@ self.assertEqual(self.db.digit(u'9'), 9) self.assertEqual(self.db.digit(u'\u215b', None), None) self.assertEqual(self.db.digit(u'\u2468'), 9) + self.assertEqual(self.db.digit(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.digit) self.assertRaises(TypeError, self.db.digit, u'xx') @@ -113,6 +114,7 @@ self.assertEqual(self.db.numeric(u'9'), 9) self.assertEqual(self.db.numeric(u'\u215b'), 0.125) self.assertEqual(self.db.numeric(u'\u2468'), 9.0) + self.assertEqual(self.db.numeric(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.numeric) self.assertRaises(TypeError, self.db.numeric, u'xx') @@ -123,6 +125,7 @@ self.assertEqual(self.db.decimal(u'9'), 9) self.assertEqual(self.db.decimal(u'\u215b', None), None) self.assertEqual(self.db.decimal(u'\u2468', None), None) + self.assertEqual(self.db.decimal(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.decimal) self.assertRaises(TypeError, self.db.decimal, u'xx') @@ -132,6 +135,7 @@ self.assertEqual(self.db.category(u'\uFFFE'), 'Cn') self.assertEqual(self.db.category(u'a'), 'Ll') self.assertEqual(self.db.category(u'A'), 'Lu') + self.assertEqual(self.db.category(u'\U00020000'), 'Lo') self.assertRaises(TypeError, self.db.category) self.assertRaises(TypeError, self.db.category, u'xx') @@ -140,6 +144,7 @@ self.assertEqual(self.db.bidirectional(u'\uFFFE'), '') self.assertEqual(self.db.bidirectional(u' '), 'WS') self.assertEqual(self.db.bidirectional(u'A'), 'L') + self.assertEqual(self.db.bidirectional(u'\U00020000'), 'L') self.assertRaises(TypeError, self.db.bidirectional) self.assertRaises(TypeError, self.db.bidirectional, u'xx') @@ -155,6 +160,7 @@ self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) self.assertEqual(self.db.mirrored(u'a'), 0) self.assertEqual(self.db.mirrored(u'\u2201'), 1) + self.assertEqual(self.db.mirrored(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.mirrored) self.assertRaises(TypeError, self.db.mirrored, u'xx') @@ -163,6 +169,7 @@ self.assertEqual(self.db.combining(u'\uFFFE'), 0) self.assertEqual(self.db.combining(u'a'), 0) self.assertEqual(self.db.combining(u'\u20e1'), 230) + self.assertEqual(self.db.combining(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.combining) self.assertRaises(TypeError, self.db.combining, u'xx') @@ -185,6 +192,7 @@ self.assertEqual(eaw(u'\uFF66'), 'H') self.assertEqual(eaw(u'\uFF1F'), 'F') self.assertEqual(eaw(u'\u2010'), 'A') + self.assertEqual(eaw(u'\U00020000'), 'W') class UnicodeMiscTest(UnicodeDatabaseTest): Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/libffi/fficonfig.py.in ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/libffi/fficonfig.py.in (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/libffi/fficonfig.py.in Tue Jun 3 10:27:25 2008 @@ -25,7 +25,7 @@ 'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'], 'PA': ['src/pa/linux.S', 'src/pa/ffi.c'], 'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'], - 'PA_HPUX': ['src/pa/hpux32.s', 'src/pa/ffi.c'], + 'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'], } ffi_srcdir = '@srcdir@' Modified: python/branches/tlee-ast-optimize/Modules/unicodedata.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/unicodedata.c (original) +++ python/branches/tlee-ast-optimize/Modules/unicodedata.c Tue Jun 3 10:27:25 2008 @@ -54,12 +54,6 @@ return &_PyUnicode_Database_Records[index]; } -static const _PyUnicode_DatabaseRecord* -_getrecord(PyUnicodeObject* v) -{ - return _getrecord_ex(*PyUnicode_AS_UNICODE(v)); -} - /* ------------- Previous-version API ------------------------------------- */ typedef struct previous_version { PyObject_HEAD @@ -92,6 +86,24 @@ return (PyObject*)self; } + +static Py_UCS4 getuchar(PyUnicodeObject *obj) +{ + Py_UNICODE *v = PyUnicode_AS_UNICODE(obj); + + if (PyUnicode_GET_SIZE(obj) == 1) + return *v; +#ifndef Py_UNICODE_WIDE + else if ((PyUnicode_GET_SIZE(obj) == 2) && + (0xD800 <= v[0] && v[0] <= 0xDBFF) && + (0xDC00 <= v[1] && v[1] <= 0xDFFF)) + return (((v[0] & 0x3FF)<<10) | (v[1] & 0x3FF)) + 0x10000; +#endif + PyErr_SetString(PyExc_TypeError, + "need a single Unicode character as parameter"); + return (Py_UCS4)-1; +} + /* --- Module API --------------------------------------------------------- */ PyDoc_STRVAR(unicodedata_decimal__doc__, @@ -108,17 +120,16 @@ PyObject *defobj = NULL; int have_old = 0; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:decimal", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -131,7 +142,7 @@ } if (!have_old) - rc = Py_UNICODE_TODECIMAL(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODECIMAL(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, @@ -159,15 +170,14 @@ PyUnicodeObject *v; PyObject *defobj = NULL; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:digit", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } - rc = Py_UNICODE_TODIGIT(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODIGIT(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a digit"); @@ -195,17 +205,16 @@ PyObject *defobj = NULL; int have_old = 0; double rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:numeric", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -218,7 +227,7 @@ } if (!have_old) - rc = Py_UNICODE_TONUMERIC(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TONUMERIC(c); if (rc == -1.0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a numeric character"); @@ -243,18 +252,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:category", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->category; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->category; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed != 0xFF) index = old->category_changed; } @@ -273,18 +281,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:bidirectional", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->bidirectional; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->bidirectional; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ else if (old->bidir_changed != 0xFF) @@ -305,18 +312,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:combining", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->combining; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->combining; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -335,18 +341,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:mirrored", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->mirrored; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->mirrored; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -364,18 +369,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:east_asian_width", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->east_asian_width; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->east_asian_width; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -396,20 +400,19 @@ char decomp[256]; int code, index, count, i; unsigned int prefix_index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:decomposition", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - code = (int) *PyUnicode_AS_UNICODE(v); + code = (int)c; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) return PyBytes_FromString(""); /* unassigned */ } @@ -1039,20 +1042,18 @@ unicodedata_name(PyObject* self, PyObject* args) { char name[NAME_MAXLEN]; + Py_UCS4 c; PyUnicodeObject* v; PyObject* defobj = NULL; if (!PyArg_ParseTuple(args, "O!|O:name", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - if (!_getucname(self, (Py_UCS4) *PyUnicode_AS_UNICODE(v), - name, sizeof(name))) { + if (!_getucname(self, c, name, sizeof(name))) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "no such name"); return NULL; Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Tue Jun 3 10:27:25 2008 @@ -1607,7 +1607,7 @@ # finding some -z option for the Sun compiler. extra_link_args.append('-mimpure-text') - elif sys.platform.startswith('hpux'): + elif sys.platform.startswith('hp-ux'): extra_link_args.append('-fPIC') ext = Extension('_ctypes', From python-checkins at python.org Tue Jun 3 11:19:26 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 3 Jun 2008 11:19:26 +0200 (CEST) Subject: [Python-checkins] r63913 - in python/branches/tlee-ast-optimize: Include/compile.h Python/compile.c Message-ID: <20080603091926.0472F1E4004@bag.python.org> Author: thomas.lee Date: Tue Jun 3 11:19:25 2008 New Revision: 63913 Log: Implement PyAST_CompileEx, allowing symtable construction to occur without necessarily performing a compile. Modified: python/branches/tlee-ast-optimize/Include/compile.h python/branches/tlee-ast-optimize/Python/compile.c Modified: python/branches/tlee-ast-optimize/Include/compile.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/compile.h (original) +++ python/branches/tlee-ast-optimize/Include/compile.h Tue Jun 3 11:19:25 2008 @@ -27,10 +27,18 @@ #define FUTURE_PRINT_FUNCTION "print_function" #define FUTURE_UNICODE_LITERALS "unicode_literals" +typedef struct { + const char* ci_filename; + PyFutureFeatures* ci_future; + struct symtable* ci_symtable; + PyCompilerFlags* ci_flags; +} PyCompilerInfo; struct _mod; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, PyCompilerFlags *, PyArena *); +PyAPI_FUNC(PyCodeObject *) PyAST_CompileEx(struct _mod *, + PyCompilerInfo *, PyArena *); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); #define ERR_LATE_FUTURE \ Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Tue Jun 3 11:19:25 2008 @@ -241,13 +241,13 @@ } PyCodeObject * -PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags, - PyArena *arena) +PyAST_CompileEx(mod_ty mod, PyCompilerInfo* info, PyArena* arena) { struct compiler c; PyCodeObject *co = NULL; PyCompilerFlags local_flags; int merged; + PyCompilerFlags* flags = info->ci_flags; if (!__doc__) { __doc__ = PyBytes_InternFromString("__doc__"); @@ -257,9 +257,9 @@ if (!compiler_init(&c)) return NULL; - c.c_filename = filename; + c.c_filename = info->ci_filename; c.c_arena = arena; - c.c_future = PyFuture_FromAST(mod, filename); + c.c_future = info->ci_future; if (c.c_future == NULL) goto finally; if (!flags) { @@ -272,7 +272,7 @@ c.c_flags = flags; c.c_nestlevel = 0; - c.c_st = PySymtable_Build(mod, filename, c.c_future); + c.c_st = PySymtable_Build(mod, info->ci_filename, c.c_future); if (c.c_st == NULL) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, "no symtable"); @@ -291,6 +291,32 @@ } PyCodeObject * +PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags, + PyArena *arena) +{ + PyCompilerInfo info; + PyCodeObject* result; + + info.ci_filename = filename; + info.ci_flags = flags; + info.ci_future = PyFuture_FromAST(mod, filename); + if (info.ci_future == NULL) + return NULL; + info.ci_symtable = PySymtable_Build(mod, filename, info.ci_future); + if (info.ci_symtable == NULL) { + PyObject_Free(info.ci_future); + return NULL; + } + + result = PyAST_CompileEx(mod, &info, arena); + + PyObject_Free(info.ci_future); + PySymtable_Free(info.ci_symtable); + + return result; +} + +PyCodeObject * PyNode_Compile(struct _node *n, const char *filename) { PyCodeObject *co = NULL; @@ -311,10 +337,6 @@ static void compiler_free(struct compiler *c) { - if (c->c_st) - PySymtable_Free(c->c_st); - if (c->c_future) - PyObject_Free(c->c_future); Py_DECREF(c->c_stack); } From python-checkins at python.org Tue Jun 3 12:23:15 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 3 Jun 2008 12:23:15 +0200 (CEST) Subject: [Python-checkins] r63914 - python/trunk/Lib/lib-tk/Tkinter.py Message-ID: <20080603102315.903311E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 3 12:23:15 2008 New Revision: 63914 Log: Fix Tkinter sequence passing. #2906. Modified: python/trunk/Lib/lib-tk/Tkinter.py Modified: python/trunk/Lib/lib-tk/Tkinter.py ============================================================================== --- python/trunk/Lib/lib-tk/Tkinter.py (original) +++ python/trunk/Lib/lib-tk/Tkinter.py Tue Jun 3 12:23:15 2008 @@ -1054,11 +1054,17 @@ if callable(v): v = self._register(v) elif isinstance(v, (tuple, list)): + nv = [] for item in v: if not isinstance(item, (basestring, int)): break + elif isinstance(item, int): + nv.append('%d' % item) + else: + # format it to proper Tcl code if it contains space + nv.append(('{%s}' if ' ' in item else '%s') % item) else: - v = ' '.join(map(str, v)) + v = ' '.join(nv) res = res + ('-'+k, v) return res def nametowidget(self, name): From python-checkins at python.org Tue Jun 3 12:26:22 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 3 Jun 2008 12:26:22 +0200 (CEST) Subject: [Python-checkins] r63916 - python/branches/release25-maint/Lib/lib-tk/Tkinter.py Message-ID: <20080603102622.2575B1E401D@bag.python.org> Author: georg.brandl Date: Tue Jun 3 12:26:21 2008 New Revision: 63916 Log: Fix tkinter sequence passing. #2906. Backport from r63914. Modified: python/branches/release25-maint/Lib/lib-tk/Tkinter.py Modified: python/branches/release25-maint/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/release25-maint/Lib/lib-tk/Tkinter.py (original) +++ python/branches/release25-maint/Lib/lib-tk/Tkinter.py Tue Jun 3 12:26:21 2008 @@ -1056,11 +1056,17 @@ if callable(v): v = self._register(v) elif isinstance(v, (tuple, list)): + nv = [] for item in v: if not isinstance(item, (basestring, int)): break + elif isinstance(item, int): + nv.append('%d' % item) + else: + # format it to proper Tcl code if it contains space + nv.append(('{%s}' if ' ' in item else '%s') % item) else: - v = ' '.join(map(str, v)) + v = ' '.join(nv) res = res + ('-'+k, v) return res def nametowidget(self, name): From buildbot at python.org Tue Jun 3 12:54:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 10:54:42 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080603105443.1BADC1E401E@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/76 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 3 13:47:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 11:47:46 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 2.5 Message-ID: <20080603114746.ECAF21E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%202.5/builds/253 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Jun 3 14:01:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 12:01:57 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.0 Message-ID: <20080603120157.34ECD1E4004@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%203.0/builds/1061 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: walter.doerwald BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 3 15:15:06 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 3 Jun 2008 15:15:06 +0200 (CEST) Subject: [Python-checkins] r63919 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py idlelib_ttk.diff Message-ID: <20080603131506.8E91C1E4019@bag.python.org> Author: guilherme.polo Date: Tue Jun 3 15:15:06 2008 New Revision: 63919 Log: Added a set_menu method for OptionMenu; idlelib_ttk: Removed some duplicated code which got there accidently; It uses ttk Scrollbar at EditorWindow; No longer Message usage, changed it to a simple Label; Some other minor fixes. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Tue Jun 3 15:15:06 2008 @@ -1332,33 +1332,42 @@ the resource textvariable set to variable, the initially selected value specified by the value parameter, the other menu values given by *values and an additional keyword argument command.""" - kw = {'textvariable': variable, 'style': kwargs.pop('style', None)} + kw = {'textvariable': variable, 'style': kwargs.pop('style', None), + 'direction': kwargs.pop('direction', None)} Menubutton.__init__(self, master, **kw) - menu = self.__menu = Tkinter.Menu(self, name="menu", tearoff=0) - self.menuname = menu._w - - callback = kwargs.pop('command', None) + self._menu = Tkinter.Menu(self, name="menu", tearoff=0) + self._callback = kwargs.pop('command', None) + self._variable = variable if kwargs: raise Tkinter.TclError('unknown option -%s' % ( next(kwargs.iterkeys()))) - menu.add_command(label=value, - command=Tkinter._setit(variable, value, callback)) - for v in values: - menu.add_command(label=v, - command=Tkinter._setit(variable, v, callback)) - self['menu'] = menu + self['menu'] = self._menu + self.set_menu(value, *((value, ) + values)) def __getitem__(self, item): if item == 'menu': - return self.__menu + return self._menu return Menubutton.__getitem__(self, item) + def set_menu(self, default=None, *values): + """Build a new menu of radiobuttons with *values and optionally + a default value.""" + menu = self._menu + menu.delete(0, 'end') + for v in values: + menu.add_radiobutton(label=v, + command=Tkinter._setit(self._variable, v, self._callback)) + + if default: + self._variable.set(default) + + def destroy(self): """Destroy this widget and the associated menu.""" Menubutton.destroy(self) - self.__menu = None + self._menu = None Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Tue Jun 3 15:15:06 2008 @@ -1332,33 +1332,42 @@ the resource textvariable set to variable, the initially selected value specified by the value parameter, the other menu values given by *values and an additional keyword argument command.""" - kw = {'textvariable': variable, 'style': kwargs.pop('style', None)} + kw = {'textvariable': variable, 'style': kwargs.pop('style', None), + 'direction': kwargs.pop('direction', None)} Menubutton.__init__(self, master, **kw) - menu = self.__menu = tkinter.Menu(self, name="menu", tearoff=0) - self.menuname = menu._w - - callback = kwargs.pop('command', None) + self._menu = tkinter.Menu(self, name="menu", tearoff=0) + self._callback = kwargs.pop('command', None) + self._variable = variable if kwargs: raise tkinter.TclError('unknown option -%s' % ( next(iter(kwargs.keys())))) - menu.add_command(label=value, - command=tkinter._setit(variable, value, callback)) - for v in values: - menu.add_command(label=v, - command=tkinter._setit(variable, v, callback)) - self['menu'] = menu + self['menu'] = self._menu + self.set_menu(value, *((value, ) + values)) def __getitem__(self, item): if item == 'menu': - return self.__menu + return self._menu return Menubutton.__getitem__(self, item) + def set_menu(self, default=None, *values): + """Build a new menu of radiobuttons with *values and optionally + a default value.""" + menu = self['menu'] + menu.delete(0, 'end') + for v in values: + menu.add_radiobutton(label=v, + command=tkinter._setit(self._variable, v, self._callback)) + + if default: + self._variable.set(default) + + def destroy(self): """Destroy this widget and the associated menu.""" Menubutton.destroy(self) - self.__menu = None + self._menu = None Modified: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Tue Jun 3 15:15:06 2008 @@ -1,6 +1,6 @@ Index: Lib/idlelib/AutoCompleteWindow.py =================================================================== ---- Lib/idlelib/AutoCompleteWindow.py (revision 63867) +--- Lib/idlelib/AutoCompleteWindow.py (revision 63916) +++ Lib/idlelib/AutoCompleteWindow.py (working copy) @@ -4,7 +4,11 @@ from Tkinter import * @@ -16,7 +16,7 @@ KEYPRESS_VIRTUAL_EVENT_NAME = "<>" Index: Lib/idlelib/ToolTip.py =================================================================== ---- Lib/idlelib/ToolTip.py (revision 63867) +--- Lib/idlelib/ToolTip.py (revision 63916) +++ Lib/idlelib/ToolTip.py (working copy) @@ -3,7 +3,8 @@ # may be useful for some purposes in (or almost in ;) the current project scope @@ -30,7 +30,7 @@ Index: Lib/idlelib/configSectionNameDialog.py =================================================================== ---- Lib/idlelib/configSectionNameDialog.py (revision 63867) +--- Lib/idlelib/configSectionNameDialog.py (revision 63916) +++ Lib/idlelib/configSectionNameDialog.py (working copy) @@ -4,7 +4,12 @@ """ @@ -45,53 +45,45 @@ class GetCfgSectionNameDialog(Toplevel): def __init__(self,parent,title,message,usedNames): """ -@@ -55,6 +60,9 @@ +@@ -25,8 +30,6 @@ + self.CreateWidgets() + self.withdraw() #hide while setting geometry + self.update_idletasks() +- #needs to be done here so that the winfo_reqwidth is valid +- self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) + self.geometry("+%d+%d" % + ((parent.winfo_rootx()+((parent.winfo_width()/2) + -(self.winfo_reqwidth()/2)), +@@ -40,11 +43,10 @@ + self.fontSize=StringVar(self) + self.frameMain = Frame(self,borderwidth=2,relief=SUNKEN) + self.frameMain.pack(side=TOP,expand=TRUE,fill=BOTH) +- self.messageInfo=Message(self.frameMain,anchor=W,justify=LEFT,padx=5,pady=5, +- text=self.message)#,aspect=200) ++ self.messageInfo= Label(self.frameMain, text=self.message) + entryName=Entry(self.frameMain,textvariable=self.name,width=30) + entryName.focus_set() +- self.messageInfo.pack(padx=5,pady=5)#,expand=TRUE,fill=BOTH) ++ self.messageInfo.pack(padx=5,pady=5) + entryName.pack(padx=5,pady=5) + frameButtons=Frame(self) + frameButtons.pack(side=BOTTOM,fill=X) +@@ -55,6 +57,12 @@ width=8,command=self.Cancel) self.buttonCancel.grid(row=0,column=1,padx=5,pady=5) + if TTK: -+ frameButton['style'] = 'RootColor.TFrame' ++ self.messageInfo['padding'] = 5 ++ frameButtons['style'] = 'RootColor.TFrame' ++ else: ++ self.messageInfo.configure(padx=5, pady=5) + def NameOk(self): #simple validity check for a sensible #ConfigParser file section name -Index: Lib/idlelib/stylist.py -=================================================================== ---- Lib/idlelib/stylist.py (revision 0) -+++ Lib/idlelib/stylist.py (revision 0) -@@ -0,0 +1,29 @@ -+from configHandler import idleConf -+ -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+ -+class PoorManStyle(object): -+ def __init__(self, parent, styles=None, cfgstyles=None): -+ self.parent = parent -+ self.cfgstyles = cfgstyles -+ self.styles = styles -+ -+ def configure(self, style, lookup=None, background=None): -+ if style not in self.cfgstyles: # passed wrong style probably -+ return -+ -+ widget = getattr(self.parent, self.cfgstyles[style]) -+ if lookup: -+ return widget.cget('bg') -+ -+ widget.configure(bg=background) -+ -+ def style_it(self, w, style): -+ if TTK: -+ w['style'] = style -+ return -+ -+ if not style in self.styles: # may not need to be styled -+ return -+ -+ w.configure(**self.styles[style]) Index: Lib/idlelib/PyShell.py =================================================================== ---- Lib/idlelib/PyShell.py (revision 63867) +--- Lib/idlelib/PyShell.py (revision 63916) +++ Lib/idlelib/PyShell.py (working copy) @@ -22,14 +22,26 @@ print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ @@ -143,7 +135,7 @@ flist = PyShellFileList(root) Index: Lib/idlelib/Debugger.py =================================================================== ---- Lib/idlelib/Debugger.py (revision 63867) +--- Lib/idlelib/Debugger.py (revision 63916) +++ Lib/idlelib/Debugger.py (working copy) @@ -4,8 +4,11 @@ from Tkinter import * @@ -175,7 +167,7 @@ self.repr.maxstring = 60 Index: Lib/idlelib/configDialog.py =================================================================== ---- Lib/idlelib/configDialog.py (revision 63867) +--- Lib/idlelib/configDialog.py (revision 63916) +++ Lib/idlelib/configDialog.py (working copy) @@ -7,7 +7,6 @@ @@ -396,7 +388,7 @@ if self.themeIsBuiltin.get(): #a default theme Index: Lib/idlelib/ReplaceDialog.py =================================================================== ---- Lib/idlelib/ReplaceDialog.py (revision 63867) +--- Lib/idlelib/ReplaceDialog.py (revision 63916) +++ Lib/idlelib/ReplaceDialog.py (working copy) @@ -11,9 +11,12 @@ dialog.open(text) @@ -430,7 +422,7 @@ self.do_find(0) Index: Lib/idlelib/tabbedpages.py =================================================================== ---- Lib/idlelib/tabbedpages.py (revision 63867) +--- Lib/idlelib/tabbedpages.py (revision 63916) +++ Lib/idlelib/tabbedpages.py (working copy) @@ -1,490 +1,4 @@ -"""An implementation of tabbed pages using only standard Tkinter. @@ -929,7 +921,7 @@ + from idlelib.tabbedpages_old import TabbedPageSet Index: Lib/idlelib/keybindingDialog.py =================================================================== ---- Lib/idlelib/keybindingDialog.py (revision 63867) +--- Lib/idlelib/keybindingDialog.py (revision 63916) +++ Lib/idlelib/keybindingDialog.py (working copy) @@ -5,6 +5,12 @@ import tkMessageBox @@ -956,7 +948,7 @@ Index: Lib/idlelib/configHelpSourceEdit.py =================================================================== ---- Lib/idlelib/configHelpSourceEdit.py (revision 63867) +--- Lib/idlelib/configHelpSourceEdit.py (revision 63916) +++ Lib/idlelib/configHelpSourceEdit.py (working copy) @@ -6,7 +6,12 @@ from Tkinter import * @@ -997,7 +989,7 @@ ("HTML Files", "*.htm *.html", "TEXT"), Index: Lib/idlelib/GrepDialog.py =================================================================== ---- Lib/idlelib/GrepDialog.py (revision 63867) +--- Lib/idlelib/GrepDialog.py (revision 63916) +++ Lib/idlelib/GrepDialog.py (working copy) @@ -4,7 +4,11 @@ from Tkinter import * @@ -1058,9 +1050,20 @@ - self.top.withdraw() Index: Lib/idlelib/EditorWindow.py =================================================================== ---- Lib/idlelib/EditorWindow.py (revision 63867) +--- Lib/idlelib/EditorWindow.py (revision 63916) +++ Lib/idlelib/EditorWindow.py (working copy) -@@ -365,7 +365,7 @@ +@@ -19,6 +19,10 @@ + import aboutDialog, textView, configDialog + import macosxSupport + ++if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): ++ from ttk import Scrollbar ++ ++ + # The default tab setting for a Text widget, in average-width characters. + TK_TABWIDTH_DEFAULT = 8 + +@@ -365,7 +369,7 @@ self.menudict = menudict = {} for name, label in self.menu_specs: underline, label = prepstr(label) @@ -1071,7 +1074,7 @@ if sys.platform == 'darwin' and '.framework' in sys.executable: Index: Lib/idlelib/aboutDialog.py =================================================================== ---- Lib/idlelib/aboutDialog.py (revision 63867) +--- Lib/idlelib/aboutDialog.py (revision 63916) +++ Lib/idlelib/aboutDialog.py (working copy) @@ -1,13 +1,17 @@ -"""About Dialog for IDLE @@ -1242,7 +1245,7 @@ Index: Lib/idlelib/config-main.def =================================================================== ---- Lib/idlelib/config-main.def (revision 63867) +--- Lib/idlelib/config-main.def (revision 63916) +++ Lib/idlelib/config-main.def (working copy) @@ -49,6 +49,7 @@ print-command-posix=lpr %s @@ -1254,7 +1257,7 @@ width= 80 Index: Lib/idlelib/IOBinding.py =================================================================== ---- Lib/idlelib/IOBinding.py (revision 63867) +--- Lib/idlelib/IOBinding.py (revision 63916) +++ Lib/idlelib/IOBinding.py (working copy) @@ -18,6 +18,9 @@ @@ -1268,7 +1271,7 @@ except ImportError: Index: Lib/idlelib/ScrolledList.py =================================================================== ---- Lib/idlelib/ScrolledList.py (revision 63867) +--- Lib/idlelib/ScrolledList.py (revision 63916) +++ Lib/idlelib/ScrolledList.py (working copy) @@ -1,5 +1,9 @@ from Tkinter import * @@ -1282,7 +1285,7 @@ default = "(None)" Index: Lib/idlelib/textView.py =================================================================== ---- Lib/idlelib/textView.py (revision 63867) +--- Lib/idlelib/textView.py (revision 63916) +++ Lib/idlelib/textView.py (working copy) @@ -1,10 +1,13 @@ -"""Simple text browser for IDLE @@ -1329,7 +1332,7 @@ Index: Lib/idlelib/CallTipWindow.py =================================================================== ---- Lib/idlelib/CallTipWindow.py (revision 63867) +--- Lib/idlelib/CallTipWindow.py (revision 63916) +++ Lib/idlelib/CallTipWindow.py (working copy) @@ -5,7 +5,11 @@ @@ -1354,7 +1357,7 @@ c=container() Index: Lib/idlelib/SearchDialogBase.py =================================================================== ---- Lib/idlelib/SearchDialogBase.py (revision 63867) +--- Lib/idlelib/SearchDialogBase.py (revision 63916) +++ Lib/idlelib/SearchDialogBase.py (working copy) @@ -1,35 +1,40 @@ from Tkinter import * @@ -1559,7 +1562,7 @@ + column += 1 Index: Lib/idlelib/SearchDialog.py =================================================================== ---- Lib/idlelib/SearchDialog.py (revision 63867) +--- Lib/idlelib/SearchDialog.py (revision 63916) +++ Lib/idlelib/SearchDialog.py (working copy) @@ -21,10 +21,10 @@ return _setup(text).find_selection(text) @@ -1574,504 +1577,9 @@ def default_command(self, event=None): if not self.engine.getprog(): -Index: Lib/idlelib/tabbedpages_old.py -=================================================================== ---- Lib/idlelib/tabbedpages_old.py (revision 0) -+++ Lib/idlelib/tabbedpages_old.py (revision 0) -@@ -0,0 +1,490 @@ -+"""An implementation of tabbed pages using only standard Tkinter. -+ -+Originally developed for use in IDLE. Based on tabpage.py. -+ -+Classes exported: -+TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. -+TabSet -- A widget containing tabs (buttons) in one or more rows. -+ -+""" -+from Tkinter import * -+ -+class InvalidNameError(Exception): pass -+class AlreadyExistsError(Exception): pass -+ -+ -+class TabSet(Frame): -+ """A widget containing tabs (buttons) in one or more rows. -+ -+ Only one tab may be selected at a time. -+ -+ """ -+ def __init__(self, page_set, select_command, -+ tabs=None, n_rows=1, max_tabs_per_row=5, -+ expand_tabs=False, **kw): -+ """Constructor arguments: -+ -+ select_command -- A callable which will be called when a tab is -+ selected. It is called with the name of the selected tab as an -+ argument. -+ -+ tabs -- A list of strings, the names of the tabs. Should be specified in -+ the desired tab order. The first tab will be the default and first -+ active tab. If tabs is None or empty, the TabSet will be initialized -+ empty. -+ -+ n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is -+ None, then the number of rows will be decided by TabSet. See -+ _arrange_tabs() for details. -+ -+ max_tabs_per_row -- Used for deciding how many rows of tabs are needed, -+ when the number of rows is not constant. See _arrange_tabs() for -+ details. -+ -+ """ -+ Frame.__init__(self, page_set, **kw) -+ self.select_command = select_command -+ self.n_rows = n_rows -+ self.max_tabs_per_row = max_tabs_per_row -+ self.expand_tabs = expand_tabs -+ self.page_set = page_set -+ -+ self._tabs = {} -+ self._tab2row = {} -+ if tabs: -+ self._tab_names = list(tabs) -+ else: -+ self._tab_names = [] -+ self._selected_tab = None -+ self._tab_rows = [] -+ -+ self.padding_frame = Frame(self, height=2, -+ borderwidth=0, relief=FLAT, -+ background=self.cget('background')) -+ self.padding_frame.pack(side=TOP, fill=X, expand=False) -+ -+ self._arrange_tabs() -+ -+ def add_tab(self, tab_name): -+ """Add a new tab with the name given in tab_name.""" -+ if not tab_name: -+ raise InvalidNameError("Invalid Tab name: '%s'" % tab_name) -+ if tab_name in self._tab_names: -+ raise AlreadyExistsError("Tab named '%s' already exists" %tab_name) -+ -+ self._tab_names.append(tab_name) -+ self._arrange_tabs() -+ -+ def remove_tab(self, tab_name): -+ """Remove the tab named """ -+ if not tab_name in self._tab_names: -+ raise KeyError("No such Tab: '%s" % page_name) -+ -+ self._tab_names.remove(tab_name) -+ self._arrange_tabs() -+ -+ def set_selected_tab(self, tab_name): -+ """Show the tab named as the selected one""" -+ if tab_name == self._selected_tab: -+ return -+ if tab_name is not None and tab_name not in self._tabs: -+ raise KeyError("No such Tab: '%s" % page_name) -+ -+ # deselect the current selected tab -+ if self._selected_tab is not None: -+ self._tabs[self._selected_tab].set_normal() -+ self._selected_tab = None -+ -+ if tab_name is not None: -+ # activate the tab named tab_name -+ self._selected_tab = tab_name -+ tab = self._tabs[tab_name] -+ tab.set_selected() -+ # move the tab row with the selected tab to the bottom -+ tab_row = self._tab2row[tab] -+ tab_row.pack_forget() -+ tab_row.pack(side=TOP, fill=X, expand=0) -+ -+ def _add_tab_row(self, tab_names, expand_tabs): -+ if not tab_names: -+ return -+ -+ tab_row = Frame(self) -+ tab_row.pack(side=TOP, fill=X, expand=0) -+ self._tab_rows.append(tab_row) -+ -+ for tab_name in tab_names: -+ tab = TabSet.TabButton(tab_name, self.select_command, -+ tab_row, self) -+ if expand_tabs: -+ tab.pack(side=LEFT, fill=X, expand=True) -+ else: -+ tab.pack(side=LEFT) -+ self._tabs[tab_name] = tab -+ self._tab2row[tab] = tab_row -+ -+ # tab is the last one created in the above loop -+ tab.is_last_in_row = True -+ -+ def _reset_tab_rows(self): -+ while self._tab_rows: -+ tab_row = self._tab_rows.pop() -+ tab_row.destroy() -+ self._tab2row = {} -+ -+ def _arrange_tabs(self): -+ """ -+ Arrange the tabs in rows, in the order in which they were added. -+ -+ If n_rows >= 1, this will be the number of rows used. Otherwise the -+ number of rows will be calculated according to the number of tabs and -+ max_tabs_per_row. In this case, the number of rows may change when -+ adding/removing tabs. -+ -+ """ -+ # remove all tabs and rows -+ while self._tabs: -+ self._tabs.popitem()[1].destroy() -+ self._reset_tab_rows() -+ -+ if not self._tab_names: -+ return -+ -+ if self.n_rows is not None and self.n_rows > 0: -+ n_rows = self.n_rows -+ else: -+ # calculate the required number of rows -+ n_rows = (len(self._tab_names) - 1) // self.max_tabs_per_row + 1 -+ -+ # not expanding the tabs with more than one row is very ugly -+ expand_tabs = self.expand_tabs or n_rows > 1 -+ i = 0 # index in self._tab_names -+ for row_index in range(n_rows): -+ # calculate required number of tabs in this row -+ n_tabs = (len(self._tab_names) - i - 1) // (n_rows - row_index) + 1 -+ tab_names = self._tab_names[i:i + n_tabs] -+ i += n_tabs -+ self._add_tab_row(tab_names, expand_tabs) -+ -+ # re-select selected tab so it is properly displayed -+ selected = self._selected_tab -+ self.set_selected_tab(None) -+ if selected in self._tab_names: -+ self.set_selected_tab(selected) -+ -+ class TabButton(Frame): -+ """A simple tab-like widget.""" -+ -+ bw = 2 # borderwidth -+ -+ def __init__(self, name, select_command, tab_row, tab_set): -+ """Constructor arguments: -+ -+ name -- The tab's name, which will appear in its button. -+ -+ select_command -- The command to be called upon selection of the -+ tab. It is called with the tab's name as an argument. -+ -+ """ -+ Frame.__init__(self, tab_row, borderwidth=self.bw, relief=RAISED) -+ -+ self.name = name -+ self.select_command = select_command -+ self.tab_set = tab_set -+ self.is_last_in_row = False -+ -+ self.button = Radiobutton( -+ self, text=name, command=self._select_event, -+ padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, -+ highlightthickness=0, selectcolor='', borderwidth=0) -+ self.button.pack(side=LEFT, fill=X, expand=True) -+ -+ self._init_masks() -+ self.set_normal() -+ -+ def _select_event(self, *args): -+ """Event handler for tab selection. -+ -+ With TabbedPageSet, this calls TabbedPageSet.change_page, so that -+ selecting a tab changes the page. -+ -+ Note that this does -not- call set_selected -- it will be called by -+ TabSet.set_selected_tab, which should be called when whatever the -+ tabs are related to changes. -+ -+ """ -+ self.select_command(self.name) -+ return -+ -+ def set_selected(self): -+ """Assume selected look""" -+ self._place_masks(selected=True) -+ -+ def set_normal(self): -+ """Assume normal look""" -+ self._place_masks(selected=False) -+ -+ def _init_masks(self): -+ page_set = self.tab_set.page_set -+ background = page_set.pages_frame.cget('background') -+ # mask replaces the middle of the border with the background color -+ self.mask = Frame(page_set, borderwidth=0, relief=FLAT, -+ background=background) -+ # mskl replaces the bottom-left corner of the border with a normal -+ # left border -+ self.mskl = Frame(page_set, borderwidth=0, relief=FLAT, -+ background=background) -+ self.mskl.ml = Frame(self.mskl, borderwidth=self.bw, -+ relief=RAISED) -+ self.mskl.ml.place(x=0, y=-self.bw, -+ width=2*self.bw, height=self.bw*4) -+ # mskr replaces the bottom-right corner of the border with a normal -+ # right border -+ self.mskr = Frame(page_set, borderwidth=0, relief=FLAT, -+ background=background) -+ self.mskr.mr = Frame(self.mskr, borderwidth=self.bw, -+ relief=RAISED) -+ -+ def _place_masks(self, selected=False): -+ height = self.bw -+ if selected: -+ height += self.bw -+ -+ self.mask.place(in_=self, -+ relx=0.0, x=0, -+ rely=1.0, y=0, -+ relwidth=1.0, width=0, -+ relheight=0.0, height=height) -+ -+ self.mskl.place(in_=self, -+ relx=0.0, x=-self.bw, -+ rely=1.0, y=0, -+ relwidth=0.0, width=self.bw, -+ relheight=0.0, height=height) -+ -+ page_set = self.tab_set.page_set -+ if selected and ((not self.is_last_in_row) or -+ (self.winfo_rootx() + self.winfo_width() < -+ page_set.winfo_rootx() + page_set.winfo_width()) -+ ): -+ # for a selected tab, if its rightmost edge isn't on the -+ # rightmost edge of the page set, the right mask should be one -+ # borderwidth shorter (vertically) -+ height -= self.bw -+ -+ self.mskr.place(in_=self, -+ relx=1.0, x=0, -+ rely=1.0, y=0, -+ relwidth=0.0, width=self.bw, -+ relheight=0.0, height=height) -+ -+ self.mskr.mr.place(x=-self.bw, y=-self.bw, -+ width=2*self.bw, height=height + self.bw*2) -+ -+ # finally, lower the tab set so that all of the frames we just -+ # placed hide it -+ self.tab_set.lower() -+ -+class TabbedPageSet(Frame): -+ """A Tkinter tabbed-pane widget. -+ -+ Constains set of 'pages' (or 'panes') with tabs above for selecting which -+ page is displayed. Only one page will be displayed at a time. -+ -+ Pages may be accessed through the 'pages' attribute, which is a dictionary -+ of pages, using the name given as the key. A page is an instance of a -+ subclass of Tk's Frame widget. -+ -+ The page widgets will be created (and destroyed when required) by the -+ TabbedPageSet. Do not call the page's pack/place/grid/destroy methods. -+ -+ Pages may be added or removed at any time using the add_page() and -+ remove_page() methods. -+ -+ """ -+ class Page(object): -+ """Abstract base class for TabbedPageSet's pages. -+ -+ Subclasses must override the _show() and _hide() methods. -+ -+ """ -+ uses_grid = False -+ -+ def __init__(self, page_set): -+ self.frame = Frame(page_set, borderwidth=2, relief=RAISED) -+ -+ def _show(self): -+ raise NotImplementedError -+ -+ def _hide(self): -+ raise NotImplementedError -+ -+ class PageRemove(Page): -+ """Page class using the grid placement manager's "remove" mechanism.""" -+ uses_grid = True -+ -+ def _show(self): -+ self.frame.grid(row=0, column=0, sticky=NSEW) -+ -+ def _hide(self): -+ self.frame.grid_remove() -+ -+ class PageLift(Page): -+ """Page class using the grid placement manager's "lift" mechanism.""" -+ uses_grid = True -+ -+ def __init__(self, page_set): -+ super(TabbedPageSet.PageLift, self).__init__(page_set) -+ self.frame.grid(row=0, column=0, sticky=NSEW) -+ self.frame.lower() -+ -+ def _show(self): -+ self.frame.lift() -+ -+ def _hide(self): -+ self.frame.lower() -+ -+ class PagePackForget(Page): -+ """Page class using the pack placement manager's "forget" mechanism.""" -+ def _show(self): -+ self.frame.pack(fill=BOTH, expand=True) -+ -+ def _hide(self): -+ self.frame.pack_forget() -+ -+ def __init__(self, parent, page_names=None, page_class=PageLift, -+ n_rows=1, max_tabs_per_row=5, expand_tabs=False, -+ **kw): -+ """Constructor arguments: -+ -+ page_names -- A list of strings, each will be the dictionary key to a -+ page's widget, and the name displayed on the page's tab. Should be -+ specified in the desired page order. The first page will be the default -+ and first active page. If page_names is None or empty, the -+ TabbedPageSet will be initialized empty. -+ -+ n_rows, max_tabs_per_row -- Parameters for the TabSet which will -+ manage the tabs. See TabSet's docs for details. -+ -+ page_class -- Pages can be shown/hidden using three mechanisms: -+ -+ * PageLift - All pages will be rendered one on top of the other. When -+ a page is selected, it will be brought to the top, thus hiding all -+ other pages. Using this method, the TabbedPageSet will not be resized -+ when pages are switched. (It may still be resized when pages are -+ added/removed.) -+ -+ * PageRemove - When a page is selected, the currently showing page is -+ hidden, and the new page shown in its place. Using this method, the -+ TabbedPageSet may resize when pages are changed. -+ -+ * PagePackForget - This mechanism uses the pack placement manager. -+ When a page is shown it is packed, and when it is hidden it is -+ unpacked (i.e. pack_forget). This mechanism may also cause the -+ TabbedPageSet to resize when the page is changed. -+ -+ """ -+ Frame.__init__(self, parent, **kw) -+ -+ self.page_class = page_class -+ self.pages = {} -+ self._pages_order = [] -+ self._current_page = None -+ self._default_page = None -+ -+ self.columnconfigure(0, weight=1) -+ self.rowconfigure(1, weight=1) -+ -+ self.pages_frame = Frame(self) -+ self.pages_frame.grid(row=1, column=0, sticky=NSEW) -+ if self.page_class.uses_grid: -+ self.pages_frame.columnconfigure(0, weight=1) -+ self.pages_frame.rowconfigure(0, weight=1) -+ -+ # the order of the following commands is important -+ self._tab_set = TabSet(self, self.change_page, n_rows=n_rows, -+ max_tabs_per_row=max_tabs_per_row, -+ expand_tabs=expand_tabs) -+ if page_names: -+ for name in page_names: -+ self.add_page(name) -+ self._tab_set.grid(row=0, column=0, sticky=NSEW) -+ -+ self.change_page(self._default_page) -+ -+ def add_page(self, page_name): -+ """Add a new page with the name given in page_name.""" -+ if not page_name: -+ raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) -+ if page_name in self.pages: -+ raise AlreadyExistsError( -+ "TabPage named '%s' already exists" % page_name) -+ -+ self.pages[page_name] = self.page_class(self.pages_frame) -+ self._pages_order.append(page_name) -+ self._tab_set.add_tab(page_name) -+ -+ if len(self.pages) == 1: # adding first page -+ self._default_page = page_name -+ self.change_page(page_name) -+ -+ def remove_page(self, page_name): -+ """Destroy the page whose name is given in page_name.""" -+ if not page_name in self.pages: -+ raise KeyError("No such TabPage: '%s" % page_name) -+ -+ self._pages_order.remove(page_name) -+ -+ # handle removing last remaining, default, or currently shown page -+ if len(self._pages_order) > 0: -+ if page_name == self._default_page: -+ # set a new default page -+ self._default_page = self._pages_order[0] -+ else: -+ self._default_page = None -+ -+ if page_name == self._current_page: -+ self.change_page(self._default_page) -+ -+ self._tab_set.remove_tab(page_name) -+ page = self.pages.pop(page_name) -+ page.frame.destroy() -+ -+ def change_page(self, page_name): -+ """Show the page whose name is given in page_name.""" -+ if self._current_page == page_name: -+ return -+ if page_name is not None and page_name not in self.pages: -+ raise KeyError("No such TabPage: '%s'" % page_name) -+ -+ if self._current_page is not None: -+ self.pages[self._current_page]._hide() -+ self._current_page = None -+ -+ if page_name is not None: -+ self._current_page = page_name -+ self.pages[page_name]._show() -+ -+ self._tab_set.set_selected_tab(page_name) -+ -+if __name__ == '__main__': -+ # test dialog -+ root=Tk() -+ tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, -+ expand_tabs=False, -+ ) -+ tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) -+ Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() -+ Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() -+ Label(tabPage.pages['Baz'].frame, text='Baz').pack() -+ entryPgName=Entry(root) -+ buttonAdd=Button(root, text='Add Page', -+ command=lambda:tabPage.add_page(entryPgName.get())) -+ buttonRemove=Button(root, text='Remove Page', -+ command=lambda:tabPage.remove_page(entryPgName.get())) -+ labelPgName=Label(root, text='name of page to add/remove:') -+ buttonAdd.pack(padx=5, pady=5) -+ buttonRemove.pack(padx=5, pady=5) -+ labelPgName.pack(padx=5) -+ entryPgName.pack(padx=5) -+ root.mainloop() Index: Lib/idlelib/TreeWidget.py =================================================================== ---- Lib/idlelib/TreeWidget.py (revision 63867) +--- Lib/idlelib/TreeWidget.py (revision 63916) +++ Lib/idlelib/TreeWidget.py (working copy) @@ -21,6 +21,12 @@ import ZoomHeight @@ -2106,101 +1614,11 @@ def test(): import PyShell root = Toplevel(PyShell.root) -Index: Lib/idlelib/tabbedpages_new.py -=================================================================== ---- Lib/idlelib/tabbedpages_new.py (revision 0) -+++ Lib/idlelib/tabbedpages_new.py (revision 0) -@@ -0,0 +1,85 @@ -+"""Classes exported: -+ -+TabbedPageSet -- A custom ttk.Notebook used by IDLE. -+""" -+from Tkinter import * -+from ttk import * -+ -+class InvalidNameError(Exception): pass -+class AlreadyExistsError(Exception): pass -+ -+class FramePage(object): -+ def __init__(self, notebook): -+ self.frame = Frame(notebook) -+ -+class TabbedPageSet(Notebook): -+ """ -+ Pages may be accessed through the 'pages' attribute, which is a dictionary -+ of pages, using the name given as the key. A page is an instance of a -+ subclass of ttk's Frame widget. -+ -+ Pages may be added or removed at any time using the add_page() and -+ remove_page() methods. -+ """ -+ -+ def __init__(self, master, page_names=None, **kw): -+ """Constructor arguments: -+ -+ page_names -- A list of strings, each will be the dictionary key to a -+ page's widget, and the name displayed on the page's tab. Should be -+ specified in the desired page order. The first page will be the default -+ and first active page. If page_names is None or empty, the -+ TabbedPageSet will be initialized empty. -+ """ -+ Notebook.__init__(self, master, **kw) -+ -+ self.pages = {} -+ for name in page_names: -+ self.add_page(name) -+ -+ def add_page(self, page_name): -+ """Add a new page with the name given in page_name.""" -+ if not page_name: -+ raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) -+ if page_name in self.pages: -+ raise AlreadyExistsError( -+ "TabPage named '%s' already exists" % page_name) -+ -+ fpage = FramePage(self) -+ self.pages[page_name] = fpage -+ self.add(fpage.frame, text=page_name, padding=6) -+ -+ # workaround for bug #1878298 at tktoolkit sf bug tracker -+ self.event_generate('') -+ -+ def remove_page(self, page_name): -+ if not page_name in self.pages: -+ raise KeyError("No such TabPage: '%s" % page_name) -+ -+ self.forget(self.index(self.pages[page_name].frame)) -+ del self.pages[page_name] -+ -+ # workaround for bug #1878298 at tktoolkit sf bug tracker -+ self.event_generate('') -+ -+if __name__ == '__main__': -+ # test dialog -+ root=Tk() -+ style = Style() -+ style.configure('C.TLabel', padding=20) -+ tabPage=TabbedPageSet(root, page_names=['Foobar','Baz']) -+ tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) -+ Label(tabPage.pages['Foobar'].frame, text='Foo', style='C.TLabel').pack() -+ Label(tabPage.pages['Foobar'].frame, text='Bar', style='C.TLabel').pack() -+ Label(tabPage.pages['Baz'].frame, text='Baz').pack() -+ entryPgName=Entry(root) -+ buttonAdd=Button(root, text='Add Page', -+ command=lambda:tabPage.add_page(entryPgName.get())) -+ buttonRemove=Button(root, text='Remove Page', -+ command=lambda:tabPage.remove_page(entryPgName.get())) -+ labelPgName=Label(root, text='name of page to add/remove:') -+ buttonAdd.pack(padx=5, pady=5) -+ buttonRemove.pack(padx=5, pady=5) -+ labelPgName.pack(padx=5) -+ entryPgName.pack(padx=5) -+ root.mainloop() Index: Lib/idlelib/dynOptionMenuWidget.py =================================================================== ---- Lib/idlelib/dynOptionMenuWidget.py (revision 63867) +--- Lib/idlelib/dynOptionMenuWidget.py (revision 63916) +++ Lib/idlelib/dynOptionMenuWidget.py (working copy) -@@ -2,34 +2,38 @@ +@@ -2,34 +2,41 @@ OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness """ @@ -2241,18 +1659,23 @@ value - initial value to set the optionmenu's menubutton to """ - self['menu'].delete(0,'end') -+ menu = self['menu'] -+ menu.delete(0,'end') - for item in valueList: +- for item in valueList: - self['menu'].add_command(label=item, -- command=_setit(self.variable,item,self.command)) -+ menu.add_command(label=item, -+ command=_setit(self.variable,item,self.command)) - if value: - self.variable.set(value) ++ if TTK: ++ self.set_menu(valueList[0], *valueList[1:]) ++ else: ++ menu = self['menu'] ++ menu.delete(0,'end') ++ for item in valueList: ++ menu.add_command(label=item, + command=_setit(self.variable,item,self.command)) +- if value: +- self.variable.set(value) ++ if value: ++ self.variable.set(value) Index: Lib/idlelib/MultiStatusBar.py =================================================================== ---- Lib/idlelib/MultiStatusBar.py (revision 63867) +--- Lib/idlelib/MultiStatusBar.py (revision 63916) +++ Lib/idlelib/MultiStatusBar.py (working copy) @@ -1,5 +1,9 @@ from Tkinter import * From buildbot at python.org Tue Jun 3 15:43:27 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 13:43:27 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 2.5 Message-ID: <20080603134327.7FB331E4024@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%202.5/builds/500 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 879, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Tue Jun 3 16:14:50 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 16:14:50 +0200 (CEST) Subject: [Python-checkins] r63920 - in peps/trunk: pep-0000.txt pep-0371.txt Message-ID: <20080603141450.D99461E4004@bag.python.org> Author: david.goodger Date: Tue Jun 3 16:14:50 2008 New Revision: 63920 Log: changes from PEP authors; corrections Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue Jun 3 16:14:50 2008 @@ -96,7 +96,7 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes - S 371 Addition of the Processing module Noller, Oudkerk + S 371 Addition of the multiprocessing package Noller, Oudkerk S 3134 Exception Chaining and Embedded Tracebacks Yee S 3135 New Super Spealman, Delaney S 3138 String representation in Python 3000 Ishimoto @@ -475,7 +475,7 @@ S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes SA 370 Per user site-packages directory Heimes - S 371 Addition of the Processing module Noller, Oudkerk + S 371 Addition of the multiprocessing package Noller, Oudkerk SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Tue Jun 3 16:14:50 2008 @@ -1,5 +1,5 @@ PEP: 371 -Title: Addition of the Processing module to standard library +Title: Addition of the multiprocessing package to the standard library Version: $Revision: $ Last-Modified: $Date: $ Author: Jesse Noller @@ -14,22 +14,22 @@ Abstract - This PEP proposes the inclusion of the pyProcessing [1] module into the - python standard library. + This PEP proposes the inclusion of the pyProcessing [1] package into the + Python standard library, renamed to "multiprocessing". - The processing module mimics the standard library threading module and API + The processing package mimics the standard library threading module and API to provide a process-based approach to "threaded programming" allowing end-users to dispatch multiple tasks that effectively side-step the global interpreter lock. - The module also provides server and client modules to provide remote- - sharing and management of objects and tasks so that applications may not - only leverage multiple cores on the local machine, but also distribute - objects and tasks across a cluster of networked machines. + The package also provides server and client functionality (processing.Manager) + to provide remote sharing and management of objects and tasks so that + applications may not only leverage multiple cores on the local machine, + but also distribute objects and tasks across a cluster of networked machines. - While the distributed capabilities of the module are beneficial, the primary + While the distributed capabilities of the package are beneficial, the primary focus of this PEP is the core threading-like API and capabilities of the - module. + package. Rationale @@ -41,20 +41,20 @@ Python programmers who are leveraging multi-core machines. The GIL itself prevents more than a single thread from running within the - interpreter at any given point in time, effectively removing python's + interpreter at any given point in time, effectively removing Python's ability to take advantage of multi-processor systems. While I/O bound applications do not suffer the same slow-down when using threading, they do suffer some performance cost due to the GIL. - The Processing module offers a method to side-step the GIL allowing + The pyProcessing package offers a method to side-step the GIL allowing applications within CPython to take advantage of multi-core architectures without asking users to completely change their programming paradigm (i.e.: dropping threaded programming for another "concurrent" approach - Twisted, etc). - The Processing module offers CPython users a known API (that of the + The Processing package offers CPython users a known API (that of the threading module), with known semantics and easy-scalability. In the - future, the module might not be as relevant should the CPython interpreter + future, the package might not be as relevant should the CPython interpreter enable "true" threading, however for some applications, forking an OS process may sometimes be more desirable than using lightweight threads, especially on those platforms where process creation is fast/optimized. @@ -70,7 +70,7 @@ t.start() t.join() - The pyprocessing module mirrors the API so well, that with a simple change + The pyprocessing package mirrors the API so well, that with a simple change of the import to: from processing import Process as worker @@ -78,17 +78,17 @@ The code now executes through the processing.Process class. This type of compatibility means that, with a minor (in most cases) change in code, users' applications will be able to leverage all cores and processors on a - given machine for parallel execution. In many cases the pyprocessing module + given machine for parallel execution. In many cases the pyprocessing package is even faster than the normal threading approach for I/O bound programs. - This of course, takes into account that the pyprocessing module is in + This of course, takes into account that the pyprocessing package is in optimized C code, while the threading module is not. The "Distributed" Problem - In the discussion on Python-Dev about the inclusion of this module [3] there + In the discussion on Python-Dev about the inclusion of this package [3] there was confusion about the intentions this PEP with an attempt to solve the "Distributed" problem - frequently comparing the functionality of this - module with other solutions like MPI-based communication [4], CORBA, or + package with other solutions like MPI-based communication [4], CORBA, or other distributed object approaches [5]. The "distributed" problem is large and varied. Each programmer working @@ -96,24 +96,24 @@ module/method or a highly customized problem for which no existing solution works. - The acceptance of this module does not preclude or recommend that + The acceptance of this package does not preclude or recommend that programmers working on the "distributed" problem not examine other solutions - for their problem domain. The intent of including this module is to provide + for their problem domain. The intent of including this package is to provide entry-level capabilities for local concurrency and the basic support to spread that concurrency across a network of machines - although the two are - not tightly coupled, the pyprocessing module could in fact, be used in + not tightly coupled, the pyprocessing package could in fact, be used in conjunction with any of the other solutions including MPI/etc. If necessary - it is possible to completely decouple the local concurrency - abilities of the module from the network-capable/shared aspects of the - module. Without serious concerns or cause however, the author of this PEP + abilities of the package from the network-capable/shared aspects of the + package. Without serious concerns or cause however, the author of this PEP does not recommend that approach. Performance Comparison As we all know - there are "lies, damned lies, and benchmarks". These speed comparisons, while aimed at showcasing the performance of the pyprocessing - module, are by no means comprehensive or applicable to all possible use + package, are by no means comprehensive or applicable to all possible use cases or environments. Especially for those platforms with sluggish process forking timing. @@ -157,10 +157,10 @@ threaded (8 threads) 0.007990 seconds processes (8 procs) 0.005512 seconds - As you can see, process forking via the pyprocessing module is faster than + As you can see, process forking via the pyprocessing package is faster than the speed of building and then executing the threaded version of the code. - The second test calculates 50000 fibonacci numbers inside of each thread + The second test calculates 50000 Fibonacci numbers inside of each thread (isolated and shared nothing): cmd: python run_benchmarks.py fibonacci.py @@ -209,7 +209,7 @@ showcase how the current threading implementation does hinder non-I/O applications. Obviously, these tests could be improved to use a queue for coordination of results and chunks of work but that is not required to show - the performance of the module. + the performance of the package and core Processing module. The next test is an I/O bound test. This is normally where we see a steep improvement in the threading module approach versus a single-threaded @@ -264,51 +264,93 @@ processes (8 procs) 0.298625 seconds We finally see threaded performance surpass that of single-threaded - execution, but the pyprocessing module is still faster when increasing the + execution, but the pyprocessing package is still faster when increasing the number of workers. If you stay with one or two threads/workers, then the timing between threads and pyprocessing is fairly close. - Additional benchmarks can be found in the pyprocessing module's source - distribution's examples/ directory. + One item of note however, is that there is an implicit overhead within the + pyprocessing package's Queue implementation due to the object serialization. + + Alec Thomas provided a short example based on the run_benchmarks.py script + to demonstrate this overhead versus the default Queue implementation: + + cmd: run_bench_queue.py + non_threaded (1 iters) 0.010546 seconds + threaded (1 threads) 0.015164 seconds + processes (1 procs) 0.066167 seconds + + non_threaded (2 iters) 0.020768 seconds + threaded (2 threads) 0.041635 seconds + processes (2 procs) 0.084270 seconds + + non_threaded (4 iters) 0.041718 seconds + threaded (4 threads) 0.086394 seconds + processes (4 procs) 0.144176 seconds + + non_threaded (8 iters) 0.083488 seconds + threaded (8 threads) 0.184254 seconds + processes (8 procs) 0.302999 seconds + + Additional benchmarks can be found in the pyprocessing package's source + distribution's examples/ directory. The examples will be included in the + package's documentation. Maintenance - Richard M. Oudkerk - the author of the pyprocessing module has agreed to - maintaing the module within Python SVN. Jesse Noller has volunteered to - also help maintain/document and test the module. + Richard M. Oudkerk - the author of the pyprocessing package has agreed to + maintain the package within Python SVN. Jesse Noller has volunteered to + also help maintain/document and test the package. + +API Naming + + The API of the pyprocessing package is designed to closely mimic that of + the threading and Queue modules. It has been proposed that instead of + adding the package as-is, we rename it to be PEP 8 compliant instead. + + Since the aim of the package is to be a drop-in for the threading + module, the authors feel that the current API should be used. + When the threading and Queue modules are updated to fully reflect + PEP 8, the pyprocessing/multiprocessing naming can be revised. Timing/Schedule Some concerns have been raised about the timing/lateness of this PEP for the 2.6 and 3.0 releases this year, however it is felt by both - the authors and others that the functionality this module offers + the authors and others that the functionality this package offers surpasses the risk of inclusion. - However, taking into account the desire not to destabilize python-core, some - refactoring of pyprocessing's code "into" python-core can be withheld until - the next 2.x/3.x releases. This means that the actual risk to python-core - is minimal, and largely constrained to the actual module itself. + However, taking into account the desire not to destabilize Python-core, some + refactoring of pyprocessing's code "into" Python-core can be withheld until + the next 2.x/3.x releases. This means that the actual risk to Python-core + is minimal, and largely constrained to the actual package itself. Open Issues - * All existing tests for the module should be converted to UnitTest format. + * All existing tests for the package should be converted to UnitTest format. * Existing documentation has to be moved to ReST formatting. * Verify code coverage percentage of existing test suite. * Identify any requirements to achieve a 1.0 milestone if required. * Verify current source tree conforms to standard library practices. - * Rename top-level module from "pyprocessing" to "multiprocessing". + * Rename top-level package from "pyprocessing" to "multiprocessing". * Confirm no "default" remote connection capabilities, if needed enable the remote security mechanisms by default for those classes which offer remote capabilities. * Some of the API (Queue methods qsize(), task_done() and join()) either need to be added, or the reason for their exclusion needs to be identified and documented clearly. + * Add in "multiprocessing.setExecutable()" method to override the default + behavior of the package to spawn processes using the current executable + name rather than the Python interpreter. Note that Mark Hammond has + suggested a factory-style interface for this[7]. + * Also note that the default behavior of process spawning does not make + it compatible with use within IDLE as-is, this will be examined as + a bug-fix or "setExecutable" enhancement. Closed Issues - * Reliance on ctypes: The pyprocessing module's reliance on ctypes prevents - the module from functioning on platforms where ctypes is not supported. - This is not a restriction of this module, but rather ctypes. + * Reliance on ctypes: The pyprocessing package's reliance on ctypes prevents + the package from functioning on platforms where ctypes is not supported. + This is not a restriction of this package, but rather of ctypes. References @@ -330,6 +372,8 @@ Magazine in December 2008: "Python Threads and the Global Interpreter Lock" by Jesse Noller. It has been modified for this PEP. + [7] http://groups.google.com/group/python-dev2/msg/54cf06d15cbcbc34 + Copyright This document has been placed in the public domain. From python-checkins at python.org Tue Jun 3 16:19:58 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 16:19:58 +0200 (CEST) Subject: [Python-checkins] r63921 - peps/trunk/pep-0371.txt Message-ID: <20080603141958.C5F221E4004@bag.python.org> Author: david.goodger Date: Tue Jun 3 16:19:58 2008 New Revision: 63921 Log: re-wrapped text to 70 columns Modified: peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Tue Jun 3 16:19:58 2008 @@ -14,50 +14,54 @@ Abstract - This PEP proposes the inclusion of the pyProcessing [1] package into the - Python standard library, renamed to "multiprocessing". + This PEP proposes the inclusion of the pyProcessing [1] package + into the Python standard library, renamed to "multiprocessing". - The processing package mimics the standard library threading module and API - to provide a process-based approach to "threaded programming" allowing - end-users to dispatch multiple tasks that effectively side-step the global - interpreter lock. - - The package also provides server and client functionality (processing.Manager) - to provide remote sharing and management of objects and tasks so that - applications may not only leverage multiple cores on the local machine, - but also distribute objects and tasks across a cluster of networked machines. - - While the distributed capabilities of the package are beneficial, the primary - focus of this PEP is the core threading-like API and capabilities of the - package. + The processing package mimics the standard library threading + module and API to provide a process-based approach to "threaded + programming" allowing end-users to dispatch multiple tasks that + effectively side-step the global interpreter lock. + + The package also provides server and client functionality + (processing.Manager) to provide remote sharing and management of + objects and tasks so that applications may not only leverage + multiple cores on the local machine, but also distribute objects + and tasks across a cluster of networked machines. + + While the distributed capabilities of the package are beneficial, + the primary focus of this PEP is the core threading-like API and + capabilities of the package. Rationale - The current CPython interpreter implements the Global Interpreter Lock (GIL) - and barring work in Python 3000 or other versions currently planned [2], the - GIL will remain as-is within the CPython interpreter for the foreseeable - future. While the GIL itself enables clean and easy to maintain C code for - the interpreter and extensions base, it is frequently an issue for those - Python programmers who are leveraging multi-core machines. - - The GIL itself prevents more than a single thread from running within the - interpreter at any given point in time, effectively removing Python's - ability to take advantage of multi-processor systems. While I/O bound - applications do not suffer the same slow-down when using threading, they do - suffer some performance cost due to the GIL. - - The pyProcessing package offers a method to side-step the GIL allowing - applications within CPython to take advantage of multi-core architectures - without asking users to completely change their programming paradigm (i.e.: - dropping threaded programming for another "concurrent" approach - Twisted, - etc). - - The Processing package offers CPython users a known API (that of the - threading module), with known semantics and easy-scalability. In the - future, the package might not be as relevant should the CPython interpreter - enable "true" threading, however for some applications, forking an OS - process may sometimes be more desirable than using lightweight threads, - especially on those platforms where process creation is fast/optimized. + The current CPython interpreter implements the Global Interpreter + Lock (GIL) and barring work in Python 3000 or other versions + currently planned [2], the GIL will remain as-is within the + CPython interpreter for the foreseeable future. While the GIL + itself enables clean and easy to maintain C code for the + interpreter and extensions base, it is frequently an issue for + those Python programmers who are leveraging multi-core machines. + + The GIL itself prevents more than a single thread from running + within the interpreter at any given point in time, effectively + removing Python's ability to take advantage of multi-processor + systems. While I/O bound applications do not suffer the same + slow-down when using threading, they do suffer some performance + cost due to the GIL. + + The pyProcessing package offers a method to side-step the GIL + allowing applications within CPython to take advantage of + multi-core architectures without asking users to completely change + their programming paradigm (i.e.: dropping threaded programming + for another "concurrent" approach - Twisted, etc). + + The Processing package offers CPython users a known API (that of + the threading module), with known semantics and easy-scalability. + In the future, the package might not be as relevant should the + CPython interpreter enable "true" threading, however for some + applications, forking an OS process may sometimes be more + desirable than using lightweight threads, especially on those + platforms where process creation is fast/optimized. For example, a simple threaded application: @@ -70,52 +74,56 @@ t.start() t.join() - The pyprocessing package mirrors the API so well, that with a simple change - of the import to: + The pyprocessing package mirrors the API so well, that with a + simple change of the import to: from processing import Process as worker - The code now executes through the processing.Process class. This type of - compatibility means that, with a minor (in most cases) change in code, - users' applications will be able to leverage all cores and processors on a - given machine for parallel execution. In many cases the pyprocessing package - is even faster than the normal threading approach for I/O bound programs. - This of course, takes into account that the pyprocessing package is in - optimized C code, while the threading module is not. + The code now executes through the processing.Process class. This + type of compatibility means that, with a minor (in most cases) + change in code, users' applications will be able to leverage all + cores and processors on a given machine for parallel execution. + In many cases the pyprocessing package is even faster than the + normal threading approach for I/O bound programs. This of course, + takes into account that the pyprocessing package is in optimized C + code, while the threading module is not. The "Distributed" Problem - In the discussion on Python-Dev about the inclusion of this package [3] there - was confusion about the intentions this PEP with an attempt to solve the - "Distributed" problem - frequently comparing the functionality of this - package with other solutions like MPI-based communication [4], CORBA, or - other distributed object approaches [5]. - - The "distributed" problem is large and varied. Each programmer working - within this domain has either very strong opinions about their favorite - module/method or a highly customized problem for which no existing solution - works. + In the discussion on Python-Dev about the inclusion of this + package [3] there was confusion about the intentions this PEP with + an attempt to solve the "Distributed" problem - frequently + comparing the functionality of this package with other solutions + like MPI-based communication [4], CORBA, or other distributed + object approaches [5]. + + The "distributed" problem is large and varied. Each programmer + working within this domain has either very strong opinions about + their favorite module/method or a highly customized problem for + which no existing solution works. The acceptance of this package does not preclude or recommend that - programmers working on the "distributed" problem not examine other solutions - for their problem domain. The intent of including this package is to provide - entry-level capabilities for local concurrency and the basic support to - spread that concurrency across a network of machines - although the two are - not tightly coupled, the pyprocessing package could in fact, be used in + programmers working on the "distributed" problem not examine other + solutions for their problem domain. The intent of including this + package is to provide entry-level capabilities for local + concurrency and the basic support to spread that concurrency + across a network of machines - although the two are not tightly + coupled, the pyprocessing package could in fact, be used in conjunction with any of the other solutions including MPI/etc. - If necessary - it is possible to completely decouple the local concurrency - abilities of the package from the network-capable/shared aspects of the - package. Without serious concerns or cause however, the author of this PEP - does not recommend that approach. + If necessary - it is possible to completely decouple the local + concurrency abilities of the package from the + network-capable/shared aspects of the package. Without serious + concerns or cause however, the author of this PEP does not + recommend that approach. Performance Comparison - As we all know - there are "lies, damned lies, and benchmarks". These speed - comparisons, while aimed at showcasing the performance of the pyprocessing - package, are by no means comprehensive or applicable to all possible use - cases or environments. Especially for those platforms with sluggish process - forking timing. + As we all know - there are "lies, damned lies, and benchmarks". + These speed comparisons, while aimed at showcasing the performance + of the pyprocessing package, are by no means comprehensive or + applicable to all possible use cases or environments. Especially + for those platforms with sluggish process forking timing. All benchmarks were run using the following: * 4 Core Intel Xeon CPU @ 3.00GHz @@ -127,16 +135,17 @@ http://jessenoller.com/code/bench-src.tgz The basic method of execution for these benchmarks is in the - run_benchmarks.py script, which is simply a wrapper to execute a target - function through a single threaded (linear), multi-threaded (via threading), - and multi-process (via pyprocessing) function for a static number of - iterations with increasing numbers of execution loops and/or threads. + run_benchmarks.py script, which is simply a wrapper to execute a + target function through a single threaded (linear), multi-threaded + (via threading), and multi-process (via pyprocessing) function for + a static number of iterations with increasing numbers of execution + loops and/or threads. - The run_benchmarks.py script executes each function 100 times, picking the - best run of that 100 iterations via the timeit module. + The run_benchmarks.py script executes each function 100 times, + picking the best run of that 100 iterations via the timeit module. - First, to identify the overhead of the spawning of the workers, we execute - an function which is simply a pass statement (empty): + First, to identify the overhead of the spawning of the workers, we + execute an function which is simply a pass statement (empty): cmd: python run_benchmarks.py empty_func.py Importing empty_func @@ -157,11 +166,12 @@ threaded (8 threads) 0.007990 seconds processes (8 procs) 0.005512 seconds - As you can see, process forking via the pyprocessing package is faster than - the speed of building and then executing the threaded version of the code. + As you can see, process forking via the pyprocessing package is + faster than the speed of building and then executing the threaded + version of the code. - The second test calculates 50000 Fibonacci numbers inside of each thread - (isolated and shared nothing): + The second test calculates 50000 Fibonacci numbers inside of each + thread (isolated and shared nothing): cmd: python run_benchmarks.py fibonacci.py Importing fibonacci @@ -182,8 +192,8 @@ threaded (8 threads) 1.596824 seconds processes (8 procs) 0.417899 seconds - The third test calculates the sum of all primes below 100000, again sharing - nothing. + The third test calculates the sum of all primes below 100000, + again sharing nothing. cmd: run_benchmarks.py crunch_primes.py Importing crunch_primes @@ -204,17 +214,18 @@ threaded (8 threads) 5.109192 seconds processes (8 procs) 1.077939 seconds - - The reason why tests two and three focused on pure numeric crunching is to - showcase how the current threading implementation does hinder non-I/O - applications. Obviously, these tests could be improved to use a queue for - coordination of results and chunks of work but that is not required to show - the performance of the package and core Processing module. - - The next test is an I/O bound test. This is normally where we see a steep - improvement in the threading module approach versus a single-threaded - approach. In this case, each worker is opening a descriptor to lorem.txt, - randomly seeking within it and writing lines to /dev/null: + The reason why tests two and three focused on pure numeric + crunching is to showcase how the current threading implementation + does hinder non-I/O applications. Obviously, these tests could be + improved to use a queue for coordination of results and chunks of + work but that is not required to show the performance of the + package and core Processing module. + + The next test is an I/O bound test. This is normally where we see + a steep improvement in the threading module approach versus a + single-threaded approach. In this case, each worker is opening a + descriptor to lorem.txt, randomly seeking within it and writing + lines to /dev/null: cmd: python run_benchmarks.py file_io.py Importing file_io @@ -235,14 +246,14 @@ threaded (8 threads) 2.437204 seconds processes (8 procs) 0.203438 seconds - As you can see, pyprocessing is still faster on this I/O operation than - using multiple threads. And using multiple threads is slower than the - single threaded execution itself. - - Finally, we will run a socket-based test to show network I/O performance. - This function grabs a URL from a server on the LAN that is a simple error - page from tomcat. It gets the page 100 times. The network is silent, and a - 10G connection: + As you can see, pyprocessing is still faster on this I/O operation + than using multiple threads. And using multiple threads is slower + than the single threaded execution itself. + + Finally, we will run a socket-based test to show network I/O + performance. This function grabs a URL from a server on the LAN + that is a simple error page from tomcat. It gets the page 100 + times. The network is silent, and a 10G connection: cmd: python run_benchmarks.py url_get.py Importing url_get @@ -263,16 +274,19 @@ threaded (8 threads) 0.659298 seconds processes (8 procs) 0.298625 seconds - We finally see threaded performance surpass that of single-threaded - execution, but the pyprocessing package is still faster when increasing the - number of workers. If you stay with one or two threads/workers, then the - timing between threads and pyprocessing is fairly close. - - One item of note however, is that there is an implicit overhead within the - pyprocessing package's Queue implementation due to the object serialization. + We finally see threaded performance surpass that of + single-threaded execution, but the pyprocessing package is still + faster when increasing the number of workers. If you stay with + one or two threads/workers, then the timing between threads and + pyprocessing is fairly close. + + One item of note however, is that there is an implicit overhead + within the pyprocessing package's Queue implementation due to the + object serialization. - Alec Thomas provided a short example based on the run_benchmarks.py script - to demonstrate this overhead versus the default Queue implementation: + Alec Thomas provided a short example based on the + run_benchmarks.py script to demonstrate this overhead versus the + default Queue implementation: cmd: run_bench_queue.py non_threaded (1 iters) 0.010546 seconds @@ -291,21 +305,23 @@ threaded (8 threads) 0.184254 seconds processes (8 procs) 0.302999 seconds - Additional benchmarks can be found in the pyprocessing package's source - distribution's examples/ directory. The examples will be included in the - package's documentation. + Additional benchmarks can be found in the pyprocessing package's + source distribution's examples/ directory. The examples will be + included in the package's documentation. Maintenance - Richard M. Oudkerk - the author of the pyprocessing package has agreed to - maintain the package within Python SVN. Jesse Noller has volunteered to - also help maintain/document and test the package. + Richard M. Oudkerk - the author of the pyprocessing package has + agreed to maintain the package within Python SVN. Jesse Noller + has volunteered to also help maintain/document and test the + package. API Naming - The API of the pyprocessing package is designed to closely mimic that of - the threading and Queue modules. It has been proposed that instead of - adding the package as-is, we rename it to be PEP 8 compliant instead. + The API of the pyprocessing package is designed to closely mimic + that of the threading and Queue modules. It has been proposed that + instead of adding the package as-is, we rename it to be PEP 8 + compliant instead. Since the aim of the package is to be a drop-in for the threading module, the authors feel that the current API should be used. @@ -314,43 +330,50 @@ Timing/Schedule - Some concerns have been raised about the timing/lateness of this PEP - for the 2.6 and 3.0 releases this year, however it is felt by both - the authors and others that the functionality this package offers - surpasses the risk of inclusion. - - However, taking into account the desire not to destabilize Python-core, some - refactoring of pyprocessing's code "into" Python-core can be withheld until - the next 2.x/3.x releases. This means that the actual risk to Python-core - is minimal, and largely constrained to the actual package itself. + Some concerns have been raised about the timing/lateness of this + PEP for the 2.6 and 3.0 releases this year, however it is felt by + both the authors and others that the functionality this package + offers surpasses the risk of inclusion. + + However, taking into account the desire not to destabilize + Python-core, some refactoring of pyprocessing's code "into" + Python-core can be withheld until the next 2.x/3.x releases. This + means that the actual risk to Python-core is minimal, and largely + constrained to the actual package itself. Open Issues - * All existing tests for the package should be converted to UnitTest format. + * All existing tests for the package should be converted to + UnitTest format. * Existing documentation has to be moved to ReST formatting. * Verify code coverage percentage of existing test suite. - * Identify any requirements to achieve a 1.0 milestone if required. - * Verify current source tree conforms to standard library practices. - * Rename top-level package from "pyprocessing" to "multiprocessing". - * Confirm no "default" remote connection capabilities, if needed enable the - remote security mechanisms by default for those classes which offer remote - capabilities. - * Some of the API (Queue methods qsize(), task_done() and join()) either - need to be added, or the reason for their exclusion needs to be identified - and documented clearly. - * Add in "multiprocessing.setExecutable()" method to override the default - behavior of the package to spawn processes using the current executable - name rather than the Python interpreter. Note that Mark Hammond has - suggested a factory-style interface for this[7]. - * Also note that the default behavior of process spawning does not make - it compatible with use within IDLE as-is, this will be examined as - a bug-fix or "setExecutable" enhancement. + * Identify any requirements to achieve a 1.0 milestone if + required. + * Verify current source tree conforms to standard library + practices. + * Rename top-level package from "pyprocessing" to + "multiprocessing". + * Confirm no "default" remote connection capabilities, if needed + enable the remote security mechanisms by default for those + classes which offer remote capabilities. + * Some of the API (Queue methods qsize(), task_done() and join()) + either need to be added, or the reason for their exclusion needs + to be identified and documented clearly. + * Add in "multiprocessing.setExecutable()" method to override the + default behavior of the package to spawn processes using the + current executable name rather than the Python interpreter. Note + that Mark Hammond has suggested a factory-style interface for + this[7]. + * Also note that the default behavior of process spawning does + not make it compatible with use within IDLE as-is, this will + be examined as a bug-fix or "setExecutable" enhancement. Closed Issues - * Reliance on ctypes: The pyprocessing package's reliance on ctypes prevents - the package from functioning on platforms where ctypes is not supported. - This is not a restriction of this package, but rather of ctypes. + * Reliance on ctypes: The pyprocessing package's reliance on + ctypes prevents the package from functioning on platforms where + ctypes is not supported. This is not a restriction of this + package, but rather of ctypes. References @@ -369,8 +392,9 @@ http://wiki.python.org/moin/ParallelProcessing [6] The original run_benchmark.py code was published in Python - Magazine in December 2008: "Python Threads and the Global Interpreter - Lock" by Jesse Noller. It has been modified for this PEP. + Magazine in December 2008: "Python Threads and the Global + Interpreter Lock" by Jesse Noller. It has been modified for + this PEP. [7] http://groups.google.com/group/python-dev2/msg/54cf06d15cbcbc34 From python-checkins at python.org Tue Jun 3 16:51:01 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 16:51:01 +0200 (CEST) Subject: [Python-checkins] r63922 - peps/trunk/pep-0371.txt Message-ID: <20080603145101.B2F111E4006@bag.python.org> Author: david.goodger Date: Tue Jun 3 16:51:01 2008 New Revision: 63922 Log: fixed SVN keywords Modified: peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Tue Jun 3 16:51:01 2008 @@ -1,7 +1,7 @@ PEP: 371 Title: Addition of the multiprocessing package to the standard library -Version: $Revision: $ -Last-Modified: $Date: $ +Version: $Revision$ +Last-Modified: $Date$ Author: Jesse Noller Richard Oudkerk Status: Draft From python-checkins at python.org Tue Jun 3 16:52:46 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 16:52:46 +0200 (CEST) Subject: [Python-checkins] r63923 - peps/trunk/pep-0371.txt Message-ID: <20080603145246.E796B1E4004@bag.python.org> Author: david.goodger Date: Tue Jun 3 16:52:46 2008 New Revision: 63923 Log: name of second author was missing from HTML Modified: peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Tue Jun 3 16:52:46 2008 @@ -2,7 +2,7 @@ Title: Addition of the multiprocessing package to the standard library Version: $Revision$ Last-Modified: $Date$ -Author: Jesse Noller +Author: Jesse Noller , Richard Oudkerk Status: Draft Type: Standards Track From python-checkins at python.org Tue Jun 3 17:01:13 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 17:01:13 +0200 (CEST) Subject: [Python-checkins] r63924 - peps/trunk/pep-0371.txt Message-ID: <20080603150113.F291A1E4006@bag.python.org> Author: david.goodger Date: Tue Jun 3 17:01:13 2008 New Revision: 63924 Log: fixed propoerties Modified: peps/trunk/pep-0371.txt (props changed) From python-checkins at python.org Tue Jun 3 17:18:49 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 17:18:49 +0200 (CEST) Subject: [Python-checkins] r63925 - in peps/trunk: pep-0364.txt pep-0367.txt pep-0369.txt pep-0370.txt pep-0371.txt pep-3114.txt pep-3129.txt pep-3132.txt pep-3139.txt pep-3140.txt Message-ID: <20080603151849.0F5121E4004@bag.python.org> Author: david.goodger Date: Tue Jun 3 17:18:48 2008 New Revision: 63925 Log: fixed properties Modified: peps/trunk/pep-0364.txt (props changed) peps/trunk/pep-0367.txt (props changed) peps/trunk/pep-0369.txt (props changed) peps/trunk/pep-0370.txt (props changed) peps/trunk/pep-0371.txt (props changed) peps/trunk/pep-3114.txt (props changed) peps/trunk/pep-3129.txt (props changed) peps/trunk/pep-3132.txt (props changed) peps/trunk/pep-3139.txt (props changed) peps/trunk/pep-3140.txt (props changed) From python-checkins at python.org Tue Jun 3 17:35:18 2008 From: python-checkins at python.org (david.goodger) Date: Tue, 3 Jun 2008 17:35:18 +0200 (CEST) Subject: [Python-checkins] r63926 - peps/trunk/pep-3140.txt Message-ID: <20080603153518.CBB141E4004@bag.python.org> Author: david.goodger Date: Tue Jun 3 17:35:18 2008 New Revision: 63926 Log: fixed keyword Modified: peps/trunk/pep-3140.txt Modified: peps/trunk/pep-3140.txt ============================================================================== --- peps/trunk/pep-3140.txt (original) +++ peps/trunk/pep-3140.txt Tue Jun 3 17:35:18 2008 @@ -1,7 +1,7 @@ PEP: 3140 Title: str(container) should call str(item), not repr(item) Version: $Revision$ -Last-Modified: $Date: 2008-05-28 20:38:33 -0600 (Thu, 28 May 2008)$ +Last-Modified: $Date$ Author: Oleg Broytmann , Jim Jewett Discussions-To: python-3000 at python.org From buildbot at python.org Tue Jun 3 18:47:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 03 Jun 2008 16:47:44 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 2.5 Message-ID: <20080603164744.BB4B91E4004@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%202.5/builds/3 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 91, in run svr.serve_a_few() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 217, in handle_request request, client_address = self.get_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 374, in get_request return self.socket.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize 2 tests failed: test_socket test_socketserver ====================================================================== ERROR: testLinuxAbstractNamespace (test.test_socket.TestLinuxAbstractNamespace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socket.py", line 926, in testLinuxAbstractNamespace s1.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize ====================================================================== FAIL: testReadline (test.test_socket.FileObjectClassTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socket.py", line 759, in testReadline self.assertEqual(line, MSG) AssertionError: '\xcb\xcb\xcb\xcbael Gilfix was here\n' != 'Michael Gilfix was here\n' ====================================================================== FAIL: testMaxName (test.test_socket.TestLinuxAbstractNamespace) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socket.py", line 934, in testMaxName self.assertEqual(s.getsockname(), address) AssertionError: '\x00hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh' != '\x00hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh' Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 91, in run svr.serve_a_few() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 217, in handle_request request, client_address = self.get_request() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/SocketServer.py", line 374, in get_request return self.socket.accept() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/socket.py", line 167, in accept sock, addr = self._sock.accept() SystemError: Negative size passed to PyString_FromStringAndSize Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 212, in test_main testall() File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 200, in testall testloop(socket.AF_UNIX, streamservers, MyStreamHandler, teststream) File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 144, in testloop testfunc(proto, addr) File "/home/pybot/buildarea-armeabi/2.5.klose-linux-armeabi/build/Lib/test/test_socketserver.py", line 63, in teststream s.sendall(teststring) File "", line 1, in sendall error: (32, 'Broken pipe') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 3 20:57:03 2008 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 3 Jun 2008 20:57:03 +0200 (CEST) Subject: [Python-checkins] r63887 - in python/trunk: Lib/test/test_datetime.py Misc/NEWS Modules/datetimemodule.c Message-ID: <20080603185703.C00E81E4004@bag.python.org> Author: gregory.p.smith Date: Mon Jun 2 06:05:52 2008 New Revision: 63887 Log: Fix issue 2782: be less strict about the format string type in strftime. Accept unicode and anything else ParseTuple "s#" can deal with. This matches the time.strftime behavior. Modified: python/trunk/Lib/test/test_datetime.py python/trunk/Misc/NEWS python/trunk/Modules/datetimemodule.c Modified: python/trunk/Lib/test/test_datetime.py ============================================================================== --- python/trunk/Lib/test/test_datetime.py (original) +++ python/trunk/Lib/test/test_datetime.py Mon Jun 2 06:05:52 2008 @@ -850,9 +850,13 @@ self.assertRaises(TypeError, t.strftime, "one", "two") # too many args self.assertRaises(TypeError, t.strftime, 42) # arg wrong type + # test that unicode input is allowed (issue 2782) + self.assertEqual(t.strftime(u"%m"), "03") + # A naive object replaces %z and %Z w/ empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") + def test_format(self): dt = self.theclass(2007, 9, 10) self.assertEqual(dt.__format__(''), str(dt)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 2 06:05:52 2008 @@ -72,6 +72,9 @@ Library ------- +- Issue #2782: The datetime module's strftime methods now accept + unicode format strings just as time.strftime always has. + - The sgmllib and htmllib modules have been deprecated for removal in Python 3.0. Modified: python/trunk/Modules/datetimemodule.c ============================================================================== --- python/trunk/Modules/datetimemodule.c (original) +++ python/trunk/Modules/datetimemodule.c Mon Jun 2 06:05:52 2008 @@ -2,6 +2,8 @@ * http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage */ +#define PY_SSIZE_T_CLEAN + #include "Python.h" #include "modsupport.h" #include "structmember.h" @@ -1152,8 +1154,8 @@ * needed. */ static PyObject * -wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, - PyObject *tzinfoarg) +wrap_strftime(PyObject *object, const char *format, size_t format_len, + PyObject *timetuple, PyObject *tzinfoarg) { PyObject *result = NULL; /* guilty until proved innocent */ @@ -1161,20 +1163,19 @@ PyObject *Zreplacement = NULL; /* py string, replacement for %Z */ PyObject *freplacement = NULL; /* py string, replacement for %f */ - char *pin; /* pointer to next char in input format */ - char ch; /* next char in input format */ + const char *pin; /* pointer to next char in input format */ + char ch; /* next char in input format */ PyObject *newfmt = NULL; /* py string, the output format */ char *pnew; /* pointer to available byte in output format */ - int totalnew; /* number bytes total in output format buffer, - exclusive of trailing \0 */ - int usednew; /* number bytes used so far in output format buffer */ + size_t totalnew; /* number bytes total in output format buffer, + exclusive of trailing \0 */ + size_t usednew; /* number bytes used so far in output format buffer */ - char *ptoappend; /* pointer to string to append to output buffer */ - int ntoappend; /* # of bytes to append to output buffer */ + const char *ptoappend; /* ptr to string to append to output buffer */ + size_t ntoappend; /* # of bytes to append to output buffer */ assert(object && format && timetuple); - assert(PyBytes_Check(format)); /* Give up if the year is before 1900. * Python strftime() plays games with the year, and different @@ -1205,13 +1206,13 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ - totalnew = PyBytes_Size(format) + 1; /* realistic if no %z/%Z/%f */ + totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ newfmt = PyBytes_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; pnew = PyBytes_AsString(newfmt); usednew = 0; - pin = PyBytes_AsString(format); + pin = format; while ((ch = *pin++) != '\0') { if (ch != '%') { ptoappend = pin - 1; @@ -1313,7 +1314,7 @@ if (ntoappend == 0) continue; while (usednew + ntoappend > totalnew) { - int bigger = totalnew << 1; + size_t bigger = totalnew << 1; if ((bigger >> 1) != totalnew) { /* overflow */ PyErr_NoMemory(); goto Done; @@ -2480,18 +2481,19 @@ * timetuple() method appropriate to self's class. */ PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyBytes_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; tuple = PyObject_CallMethod((PyObject *)self, "timetuple", "()"); if (tuple == NULL) return NULL; - result = wrap_strftime((PyObject *)self, format, tuple, + result = wrap_strftime((PyObject *)self, format, format_len, tuple, (PyObject *)self); Py_DECREF(tuple); return result; @@ -3256,12 +3258,13 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw) { PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyBytes_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; /* Python's strftime does insane things with the year part of the @@ -3277,7 +3280,8 @@ if (tuple == NULL) return NULL; assert(PyTuple_Size(tuple) == 9); - result = wrap_strftime((PyObject *)self, format, tuple, Py_None); + result = wrap_strftime((PyObject *)self, format, format_len, tuple, + Py_None); Py_DECREF(tuple); return result; } From python-checkins at python.org Tue Jun 3 20:57:06 2008 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 3 Jun 2008 20:57:06 +0200 (CEST) Subject: [Python-checkins] r63888 - in python/trunk: Doc/library/msilib.rst Misc/NEWS PC/_msi.c Message-ID: <20080603185706.2B3F71E400A@bag.python.org> Author: martin.v.loewis Date: Mon Jun 2 10:40:06 2008 New Revision: 63888 Log: Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. Modified: python/trunk/Doc/library/msilib.rst python/trunk/Misc/NEWS python/trunk/PC/_msi.c Modified: python/trunk/Doc/library/msilib.rst ============================================================================== --- python/trunk/Doc/library/msilib.rst (original) +++ python/trunk/Doc/library/msilib.rst Mon Jun 2 10:40:06 2008 @@ -264,6 +264,18 @@ :cfunc:`MsiRecordGetFieldCount`. +.. method:: Record.GetInteger(field) + + Return the value of *field* as an integer where possible. *field* must + be an integer. + + +.. method:: Record.GetString(field) + + Return the value of *field* as a string where possible. *field* must + be an integer. + + .. method:: Record.SetString(field, value) Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an @@ -543,3 +555,4 @@ This module contains definitions for the UIText and ActionText tables, for the standard installer actions. + Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 2 10:40:06 2008 @@ -72,6 +72,9 @@ Library ------- +- Patch #2125: Add GetInteger and GetString methods for + msilib.Record objects. + - Issue #2782: The datetime module's strftime methods now accept unicode format strings just as time.strftime always has. Modified: python/trunk/PC/_msi.c ============================================================================== --- python/trunk/PC/_msi.c (original) +++ python/trunk/PC/_msi.c Mon Jun 2 10:40:06 2008 @@ -339,6 +339,49 @@ } static PyObject* +record_getinteger(msiobj* record, PyObject* args) +{ + unsigned int field; + int status; + + if (!PyArg_ParseTuple(args, "I:GetInteger", &field)) + return NULL; + status = MsiRecordGetInteger(record->h, field); + if (status == MSI_NULL_INTEGER){ + PyErr_SetString(MSIError, "could not convert record field to integer"); + return NULL; + } + return PyInt_FromLong((long) status); +} + +static PyObject* +record_getstring(msiobj* record, PyObject* args) +{ + unsigned int field; + unsigned int status; + char buf[2000]; + char *res = buf; + DWORD size = sizeof(buf); + PyObject* string; + + if (!PyArg_ParseTuple(args, "I:GetString", &field)) + return NULL; + status = MsiRecordGetString(record->h, field, res, &size); + if (status == ERROR_MORE_DATA) { + res = (char*) malloc(size + 1); + if (res == NULL) + return PyErr_NoMemory(); + status = MsiRecordGetString(record->h, field, res, &size); + } + if (status != ERROR_SUCCESS) + return msierror((int) status); + string = PyString_FromString(res); + if (buf != res) + free(res); + return string; +} + +static PyObject* record_cleardata(msiobj* record, PyObject *args) { int status = MsiRecordClearData(record->h); @@ -405,6 +448,10 @@ static PyMethodDef record_methods[] = { { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS, PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")}, + { "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS, + PyDoc_STR("GetInteger(field) -> int\nWraps MsiRecordGetInteger")}, + { "GetString", (PyCFunction)record_getstring, METH_VARARGS, + PyDoc_STR("GetString(field) -> string\nWraps MsiRecordGetString")}, { "SetString", (PyCFunction)record_setstring, METH_VARARGS, PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")}, { "SetStream", (PyCFunction)record_setstream, METH_VARARGS, From python-checkins at python.org Tue Jun 3 20:57:18 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 3 Jun 2008 20:57:18 +0200 (CEST) Subject: [Python-checkins] r63894 - in python/branches/tlee-ast-optimize: Doc/Makefile Doc/README.txt Doc/library/htmllib.rst Doc/library/msilib.rst Doc/library/sgmllib.rst Doc/library/sys.rst Doc/library/threading.rst Doc/tools/sphinxext/pyspecific.py Include/bytearrayobject.h Include/bytesobject.h Lib/htmllib.py Lib/pydoc.py Lib/pydoc_topics.py Lib/sgmllib.py Lib/test/test_datetime.py Lib/test/test_descrtut.py Lib/test/test_htmllib.py Lib/test/test_py3kwarn.py Lib/test/test_sgmllib.py Lib/test/test_sys.py Lib/test/test_threading.py Lib/threading.py Misc/NEWS Modules/datetimemodule.c Objects/bytesobject.c Objects/dictobject.c Objects/listobject.c Objects/longobject.c Objects/typeobject.c PC/_msi.c Python/sysmodule.c Tools/README Tools/bgen/README Message-ID: <20080603185718.1D37F1E4004@bag.python.org> Author: thomas.lee Date: Mon Jun 2 15:14:06 2008 New Revision: 63894 Log: Merged revisions 63854-63893 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r63856 | robert.schuppenies | 2008-06-02 02:16:17 +1000 (Mon, 02 Jun 2008) | 2 lines Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. ........ r63858 | georg.brandl | 2008-06-02 02:41:31 +1000 (Mon, 02 Jun 2008) | 2 lines Add plain text make target. ........ r63859 | georg.brandl | 2008-06-02 02:42:16 +1000 (Mon, 02 Jun 2008) | 2 lines Some style nits. Also clarify in the docstrings what __sizeof__ does. ........ r63860 | georg.brandl | 2008-06-02 03:05:56 +1000 (Mon, 02 Jun 2008) | 2 lines Fix test_descrtut. ........ r63861 | robert.schuppenies | 2008-06-02 03:11:09 +1000 (Mon, 02 Jun 2008) | 2 lines Fix test_sys. ........ r63863 | benjamin.peterson | 2008-06-02 05:01:25 +1000 (Mon, 02 Jun 2008) | 2 lines add a warning about bgen being removed ........ r63865 | georg.brandl | 2008-06-02 05:24:36 +1000 (Mon, 02 Jun 2008) | 2 lines Spaces vs. tabs. ........ r63871 | georg.brandl | 2008-06-02 06:33:55 +1000 (Mon, 02 Jun 2008) | 3 lines Generate pydoc's topic help from the reST docs via Sphinx' new text writer. ........ r63873 | georg.brandl | 2008-06-02 07:19:14 +1000 (Mon, 02 Jun 2008) | 2 lines Deprecate htmllib and sgmllib for 3.0. ........ r63879 | gregory.p.smith | 2008-06-02 08:57:47 +1000 (Mon, 02 Jun 2008) | 3 lines Make the _H #define's match the header file names. Fix comments to mention the correct type names. ........ r63882 | gregory.p.smith | 2008-06-02 09:48:47 +1000 (Mon, 02 Jun 2008) | 3 lines Adds a Thread.getIdent() method to provide the _get_ident() value for any given threading.Thread object. feature request issue 2871. ........ r63887 | gregory.p.smith | 2008-06-02 14:05:52 +1000 (Mon, 02 Jun 2008) | 4 lines Fix issue 2782: be less strict about the format string type in strftime. Accept unicode and anything else ParseTuple "s#" can deal with. This matches the time.strftime behavior. ........ r63888 | martin.v.loewis | 2008-06-02 18:40:06 +1000 (Mon, 02 Jun 2008) | 2 lines Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. ........ Added: python/branches/tlee-ast-optimize/Lib/pydoc_topics.py - copied unchanged from r63888, /python/trunk/Lib/pydoc_topics.py Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/Makefile python/branches/tlee-ast-optimize/Doc/README.txt python/branches/tlee-ast-optimize/Doc/library/htmllib.rst python/branches/tlee-ast-optimize/Doc/library/msilib.rst python/branches/tlee-ast-optimize/Doc/library/sgmllib.rst python/branches/tlee-ast-optimize/Doc/library/sys.rst python/branches/tlee-ast-optimize/Doc/library/threading.rst python/branches/tlee-ast-optimize/Doc/tools/sphinxext/pyspecific.py python/branches/tlee-ast-optimize/Include/bytearrayobject.h python/branches/tlee-ast-optimize/Include/bytesobject.h python/branches/tlee-ast-optimize/Lib/htmllib.py python/branches/tlee-ast-optimize/Lib/pydoc.py python/branches/tlee-ast-optimize/Lib/sgmllib.py python/branches/tlee-ast-optimize/Lib/test/test_datetime.py python/branches/tlee-ast-optimize/Lib/test/test_descrtut.py python/branches/tlee-ast-optimize/Lib/test/test_htmllib.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_sgmllib.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_threading.py python/branches/tlee-ast-optimize/Lib/threading.py python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/datetimemodule.c python/branches/tlee-ast-optimize/Objects/bytesobject.c python/branches/tlee-ast-optimize/Objects/dictobject.c python/branches/tlee-ast-optimize/Objects/listobject.c python/branches/tlee-ast-optimize/Objects/longobject.c python/branches/tlee-ast-optimize/Objects/typeobject.c python/branches/tlee-ast-optimize/PC/_msi.c python/branches/tlee-ast-optimize/Python/sysmodule.c python/branches/tlee-ast-optimize/Tools/README python/branches/tlee-ast-optimize/Tools/bgen/README Modified: python/branches/tlee-ast-optimize/Doc/Makefile ============================================================================== --- python/branches/tlee-ast-optimize/Doc/Makefile (original) +++ python/branches/tlee-ast-optimize/Doc/Makefile Mon Jun 2 15:14:06 2008 @@ -21,6 +21,7 @@ @echo " web to make file usable by Sphinx.web" @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " text to make plain text files" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " coverage to check documentation coverage for library and C API" @@ -75,6 +76,10 @@ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." +text: BUILDER = text +text: build + @echo "Build finished; the text files are in build/text." + changes: BUILDER = changes changes: build @echo "The overview file is in build/changes." @@ -93,6 +98,11 @@ @echo "Testing of doctests in the sources finished, look at the " \ "results in build/doctest/output.txt" +pydoc-topics: BUILDER = pydoc-topics +pydoc-topics: build + @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ + "into the Lib/ directory" + clean: -rm -rf build/* -rm -rf tools/sphinx Modified: python/branches/tlee-ast-optimize/Doc/README.txt ============================================================================== --- python/branches/tlee-ast-optimize/Doc/README.txt (original) +++ python/branches/tlee-ast-optimize/Doc/README.txt Mon Jun 2 15:14:06 2008 @@ -51,6 +51,8 @@ * "latex", which builds LaTeX source files that can be run with "pdflatex" to produce PDF documents. + * "text", which builds a plain text file for each source file. + * "linkcheck", which checks all external references to see whether they are broken, redirected or malformed, and outputs this information to stdout as well as a plain-text (.txt) file. @@ -62,6 +64,11 @@ * "coverage", which builds a coverage overview for standard library modules and C API. + * "pydoc-topics", which builds a Python module containing a dictionary + with plain text documentation for the labels defined in + `tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic + and keyword help. + A "make update" updates the Subversion checkouts in `tools/`. Modified: python/branches/tlee-ast-optimize/Doc/library/htmllib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/htmllib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/htmllib.rst Mon Jun 2 15:14:06 2008 @@ -1,9 +1,12 @@ - :mod:`htmllib` --- A parser for HTML documents ============================================== .. module:: htmllib :synopsis: A parser for HTML documents. + :deprecated: + +.. deprecated:: 2.6 + The :mod:`htmllib` module has been removed in Python 3.0. .. index:: Modified: python/branches/tlee-ast-optimize/Doc/library/msilib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/msilib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/msilib.rst Mon Jun 2 15:14:06 2008 @@ -264,6 +264,18 @@ :cfunc:`MsiRecordGetFieldCount`. +.. method:: Record.GetInteger(field) + + Return the value of *field* as an integer where possible. *field* must + be an integer. + + +.. method:: Record.GetString(field) + + Return the value of *field* as a string where possible. *field* must + be an integer. + + .. method:: Record.SetString(field, value) Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an @@ -543,3 +555,4 @@ This module contains definitions for the UIText and ActionText tables, for the standard installer actions. + Modified: python/branches/tlee-ast-optimize/Doc/library/sgmllib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/sgmllib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/sgmllib.rst Mon Jun 2 15:14:06 2008 @@ -1,10 +1,12 @@ - :mod:`sgmllib` --- Simple SGML parser ===================================== .. module:: sgmllib :synopsis: Only as much of an SGML parser as needed to parse HTML. - + :deprecated: + +.. deprecated:: 2.6 + The :mod:`sgmllib` module has been removed in Python 3.0. .. index:: single: SGML Modified: python/branches/tlee-ast-optimize/Doc/library/sys.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/sys.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/sys.rst Mon Jun 2 15:14:06 2008 @@ -409,6 +409,16 @@ :func:`setrecursionlimit`. +.. function:: getsizeof(object) + + Return the size of an object in bytes. The object can be any type of + object. All built-in objects will return correct results, but this + does not have to hold true for third-party extensions as it is implementation + specific. + + .. versionadded:: 2.6 + + .. function:: _getframe([depth]) Return a frame object from the call stack. If optional integer *depth* is Modified: python/branches/tlee-ast-optimize/Doc/library/threading.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/threading.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/threading.rst Mon Jun 2 15:14:06 2008 @@ -651,6 +651,17 @@ constructor. +.. method:: Thread.getIdent() + + Return the 'thread identifier' of this thread or None if the thread has not + been started. This is a nonzero integer. See the :mod:`thread` module's + :func:`get_ident()` function. Thread identifiers may be recycled when a + thread exits and another thread is created. The identifier is returned + even after the thread has exited. + + .. versionadded:: 2.6 + + .. method:: Thread.isAlive() Return whether the thread is alive. Modified: python/branches/tlee-ast-optimize/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tools/sphinxext/pyspecific.py (original) +++ python/branches/tlee-ast-optimize/Doc/tools/sphinxext/pyspecific.py Mon Jun 2 15:14:06 2008 @@ -20,5 +20,71 @@ return [refnode], [] +# Support for building "topic help" for pydoc + +pydoc_topic_labels = [ + 'assert', 'assignment', 'atom-identifiers', 'atom-literals', + 'attribute-access', 'attribute-references', 'augassign', 'binary', + 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', + 'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans', + 'break', 'callable-types', 'calls', 'class', 'coercion-rules', + 'comparisons', 'compound', 'context-managers', 'continue', 'conversions', + 'customization', 'debugger', 'del', 'dict', 'dynamic-features', 'else', + 'exceptions', 'exec', 'execmodel', 'exprlists', 'floating', 'for', + 'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if', + 'imaginary', 'import', 'in', 'integers', 'lambda', 'lists', 'naming', + 'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power', + 'print', 'raise', 'return', 'sequence-methods', 'sequence-types', + 'shifting', 'slicings', 'specialattrs', 'specialnames', + 'string-conversions', 'string-methods', 'strings', 'subscriptions', 'truth', + 'try', 'types', 'typesfunctions', 'typesmapping', 'typesmethods', + 'typesmodules', 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', + 'yield' +] + +from os import path +from time import asctime +from pprint import pformat +from docutils.io import StringOutput +from docutils.utils import new_document +from sphinx.builder import Builder +from sphinx.textwriter import TextWriter + +class PydocTopicsBuilder(Builder): + name = 'pydoc-topics' + + def init(self): + self.topics = {} + + def get_outdated_docs(self): + return 'all pydoc topics' + + def get_target_uri(self, docname, typ=None): + return '' # no URIs + + def write(self, *ignored): + writer = TextWriter(self) + for label in self.status_iterator(pydoc_topic_labels, 'building topics... '): + if label not in self.env.labels: + self.warn('label %r not in documentation' % label) + continue + docname, labelid, sectname = self.env.labels[label] + doctree = self.env.get_and_resolve_doctree(docname, self) + document = new_document('
') + document.append(doctree.ids[labelid]) + destination = StringOutput(encoding='utf-8') + writer.write(document, destination) + self.topics[label] = writer.output + + def finish(self): + f = open(path.join(self.outdir, 'pydoc_topics.py'), 'w') + try: + f.write('# Autogenerated by Sphinx on %s\n' % asctime()) + f.write('topics = ' + pformat(self.topics) + '\n') + finally: + f.close() + + def setup(app): app.add_role('issue', issue_role) + app.add_builder(PydocTopicsBuilder) Modified: python/branches/tlee-ast-optimize/Include/bytearrayobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/bytearrayobject.h (original) +++ python/branches/tlee-ast-optimize/Include/bytearrayobject.h Mon Jun 2 15:14:06 2008 @@ -1,7 +1,7 @@ -/* Bytes object interface */ +/* ByteArray object interface */ -#ifndef Py_BYTESOBJECT_H -#define Py_BYTESOBJECT_H +#ifndef Py_BYTEARRAYOBJECT_H +#define Py_BYTEARRAYOBJECT_H #ifdef __cplusplus extern "C" { #endif @@ -50,4 +50,4 @@ #ifdef __cplusplus } #endif -#endif /* !Py_BYTESOBJECT_H */ +#endif /* !Py_BYTEARRAYOBJECT_H */ Modified: python/branches/tlee-ast-optimize/Include/bytesobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/bytesobject.h (original) +++ python/branches/tlee-ast-optimize/Include/bytesobject.h Mon Jun 2 15:14:06 2008 @@ -1,8 +1,8 @@ -/* String object interface */ +/* Bytes (String) object interface */ -#ifndef Py_STRINGOBJECT_H -#define Py_STRINGOBJECT_H +#ifndef Py_BYTESOBJECT_H +#define Py_BYTESOBJECT_H #ifdef __cplusplus extern "C" { #endif @@ -197,4 +197,4 @@ #ifdef __cplusplus } #endif -#endif /* !Py_STRINGOBJECT_H */ +#endif /* !Py_BYTESOBJECT_H */ Modified: python/branches/tlee-ast-optimize/Lib/htmllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/htmllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/htmllib.py Mon Jun 2 15:14:06 2008 @@ -4,6 +4,11 @@ http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html """ +from warnings import warnpy3k +warnpy3k("the htmllib module has been removed in Python 3.0", + stacklevel=2) +del warnpy3k + import sgmllib from formatter import AS_IS Modified: python/branches/tlee-ast-optimize/Lib/pydoc.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/pydoc.py (original) +++ python/branches/tlee-ast-optimize/Lib/pydoc.py Mon Jun 2 15:14:06 2008 @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: Latin-1 -*- +# -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online @@ -1523,142 +1523,149 @@ return class Helper: + + # These dictionaries map a topic name to either an alias, or a tuple + # (label, seealso-items). The "label" is the label of the corresponding + # section in the .rst file under Doc/ and an index into the dictionary + # in pydoc_topics.py. + # + # CAUTION: if you change one of these dictionaries, be sure to adapt the + # list of needed labels in Doc/tools/sphinxext/pyspecific.py and + # regenerate the pydoc_topics.py file by running + # make pydoc-topics + # in Doc/ and copying the output file into the Lib/ directory. + keywords = { 'and': 'BOOLEAN', 'as': 'with', - 'assert': ('ref/assert', ''), - 'break': ('ref/break', 'while for'), - 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), - 'continue': ('ref/continue', 'while for'), - 'def': ('ref/function', ''), - 'del': ('ref/del', 'BASICMETHODS'), + 'assert': ('assert', ''), + 'break': ('break', 'while for'), + 'class': ('class', 'CLASSES SPECIALMETHODS'), + 'continue': ('continue', 'while for'), + 'def': ('function', ''), + 'del': ('del', 'BASICMETHODS'), 'elif': 'if', - 'else': ('ref/if', 'while for'), - 'except': 'try', - 'exec': ('ref/exec', ''), - 'finally': 'try', - 'for': ('ref/for', 'break continue while'), - 'from': 'import', - 'global': ('ref/global', 'NAMESPACES'), - 'if': ('ref/if', 'TRUTHVALUE'), - 'import': ('ref/import', 'MODULES'), - 'in': ('ref/comparisons', 'SEQUENCEMETHODS2'), + 'else': ('else', 'while for'), + 'except': 'except', + 'exec': ('exec', ''), + 'finally': 'finally', + 'for': ('for', 'break continue while'), + 'from': 'from', + 'global': ('global', 'NAMESPACES'), + 'if': ('if', 'TRUTHVALUE'), + 'import': ('import', 'MODULES'), + 'in': ('in', 'SEQUENCEMETHODS2'), 'is': 'COMPARISON', - 'lambda': ('ref/lambdas', 'FUNCTIONS'), + 'lambda': ('lambda', 'FUNCTIONS'), 'not': 'BOOLEAN', 'or': 'BOOLEAN', - 'pass': ('ref/pass', ''), - 'print': ('ref/print', ''), - 'raise': ('ref/raise', 'EXCEPTIONS'), - 'return': ('ref/return', 'FUNCTIONS'), - 'try': ('ref/try', 'EXCEPTIONS'), - 'while': ('ref/while', 'break continue if TRUTHVALUE'), - 'with': ('ref/with', 'CONTEXTMANAGERS EXCEPTIONS yield'), - 'yield': ('ref/yield', ''), + 'pass': ('pass', ''), + 'print': ('print', ''), + 'raise': ('raise', 'EXCEPTIONS'), + 'return': ('return', 'FUNCTIONS'), + 'try': ('try', 'EXCEPTIONS'), + 'while': ('while', 'break continue if TRUTHVALUE'), + 'with': ('with', 'CONTEXTMANAGERS EXCEPTIONS yield'), + 'yield': ('yield', ''), } topics = { - 'TYPES': ('ref/types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS FUNCTIONS CLASSES MODULES FILES inspect'), - 'STRINGS': ('ref/strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING TYPES'), - 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), - 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), - 'UNICODE': ('ref/strings', 'encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES'), - 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), - 'INTEGER': ('ref/integers', 'int range'), - 'FLOAT': ('ref/floating', 'float math'), - 'COMPLEX': ('ref/imaginary', 'complex cmath'), - 'SEQUENCES': ('lib/typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), + 'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS ' + 'FUNCTIONS CLASSES MODULES FILES inspect'), + 'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING ' + 'TYPES'), + 'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'), + 'FORMATTING': ('formatstrings', 'OPERATORS'), + 'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS ' + 'FORMATTING TYPES'), + 'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'), + 'INTEGER': ('integers', 'int range'), + 'FLOAT': ('floating', 'float math'), + 'COMPLEX': ('imaginary', 'complex cmath'), + 'SEQUENCES': ('typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), 'MAPPINGS': 'DICTIONARIES', - 'FUNCTIONS': ('lib/typesfunctions', 'def TYPES'), - 'METHODS': ('lib/typesmethods', 'class def CLASSES TYPES'), - 'CODEOBJECTS': ('lib/bltin-code-objects', 'compile FUNCTIONS TYPES'), - 'TYPEOBJECTS': ('lib/bltin-type-objects', 'types TYPES'), + 'FUNCTIONS': ('typesfunctions', 'def TYPES'), + 'METHODS': ('typesmethods', 'class def CLASSES TYPES'), + 'CODEOBJECTS': ('bltin-code-objects', 'compile FUNCTIONS TYPES'), + 'TYPEOBJECTS': ('bltin-type-objects', 'types TYPES'), 'FRAMEOBJECTS': 'TYPES', 'TRACEBACKS': 'TYPES', - 'NONE': ('lib/bltin-null-object', ''), - 'ELLIPSIS': ('lib/bltin-ellipsis-object', 'SLICINGS'), - 'FILES': ('lib/bltin-file-objects', ''), - 'SPECIALATTRIBUTES': ('lib/specialattrs', ''), - 'CLASSES': ('ref/types', 'class SPECIALMETHODS PRIVATENAMES'), - 'MODULES': ('lib/typesmodules', 'import'), + 'NONE': ('bltin-null-object', ''), + 'ELLIPSIS': ('bltin-ellipsis-object', 'SLICINGS'), + 'FILES': ('bltin-file-objects', ''), + 'SPECIALATTRIBUTES': ('specialattrs', ''), + 'CLASSES': ('types', 'class SPECIALMETHODS PRIVATENAMES'), + 'MODULES': ('typesmodules', 'import'), 'PACKAGES': 'import', - 'EXPRESSIONS': ('ref/summary', 'lambda or and not in is BOOLEAN COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES LISTS DICTIONARIES BACKQUOTES'), + 'EXPRESSIONS': ('operator-summary', 'lambda or and not in is BOOLEAN ' + 'COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER ' + 'UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES ' + 'LISTS DICTIONARIES BACKQUOTES'), 'OPERATORS': 'EXPRESSIONS', 'PRECEDENCE': 'EXPRESSIONS', - 'OBJECTS': ('ref/objects', 'TYPES'), - 'SPECIALMETHODS': ('ref/specialnames', 'BASICMETHODS ATTRIBUTEMETHODS CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), - 'BASICMETHODS': ('ref/customization', 'cmp hash repr str SPECIALMETHODS'), - 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'ATTRIBUTES SPECIALMETHODS'), - 'CALLABLEMETHODS': ('ref/callable-types', 'CALLS SPECIALMETHODS'), - 'SEQUENCEMETHODS1': ('ref/sequence-types', 'SEQUENCES SEQUENCEMETHODS2 SPECIALMETHODS'), - 'SEQUENCEMETHODS2': ('ref/sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 SPECIALMETHODS'), - 'MAPPINGMETHODS': ('ref/sequence-types', 'MAPPINGS SPECIALMETHODS'), - 'NUMBERMETHODS': ('ref/numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), - 'EXECUTION': ('ref/execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), - 'NAMESPACES': ('ref/naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), - 'DYNAMICFEATURES': ('ref/dynamic-features', ''), + 'OBJECTS': ('objects', 'TYPES'), + 'SPECIALMETHODS': ('specialnames', 'BASICMETHODS ATTRIBUTEMETHODS ' + 'CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS ' + 'SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), + 'BASICMETHODS': ('customization', 'cmp hash repr str SPECIALMETHODS'), + 'ATTRIBUTEMETHODS': ('attribute-access', 'ATTRIBUTES SPECIALMETHODS'), + 'CALLABLEMETHODS': ('callable-types', 'CALLS SPECIALMETHODS'), + 'SEQUENCEMETHODS1': ('sequence-types', 'SEQUENCES SEQUENCEMETHODS2 ' + 'SPECIALMETHODS'), + 'SEQUENCEMETHODS2': ('sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 ' + 'SPECIALMETHODS'), + 'MAPPINGMETHODS': ('sequence-types', 'MAPPINGS SPECIALMETHODS'), + 'NUMBERMETHODS': ('numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT ' + 'SPECIALMETHODS'), + 'EXECUTION': ('execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), + 'NAMESPACES': ('naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), + 'DYNAMICFEATURES': ('dynamic-features', ''), 'SCOPING': 'NAMESPACES', 'FRAMES': 'NAMESPACES', - 'EXCEPTIONS': ('ref/exceptions', 'try except finally raise'), - 'COERCIONS': ('ref/coercion-rules','CONVERSIONS'), - 'CONVERSIONS': ('ref/conversions', 'COERCIONS'), - 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), - 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), - 'PRIVATENAMES': ('ref/atom-identifiers', ''), - 'LITERALS': ('ref/atom-literals', 'STRINGS BACKQUOTES NUMBERS TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), + 'EXCEPTIONS': ('exceptions', 'try except finally raise'), + 'COERCIONS': ('coercion-rules','CONVERSIONS'), + 'CONVERSIONS': ('conversions', 'COERCIONS'), + 'IDENTIFIERS': ('identifiers', 'keywords SPECIALIDENTIFIERS'), + 'SPECIALIDENTIFIERS': ('id-classes', ''), + 'PRIVATENAMES': ('atom-identifiers', ''), + 'LITERALS': ('atom-literals', 'STRINGS BACKQUOTES NUMBERS ' + 'TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), 'TUPLES': 'SEQUENCES', - 'TUPLELITERALS': ('ref/exprlists', 'TUPLES LITERALS'), - 'LISTS': ('lib/typesseq-mutable', 'LISTLITERALS'), - 'LISTLITERALS': ('ref/lists', 'LISTS LITERALS'), - 'DICTIONARIES': ('lib/typesmapping', 'DICTIONARYLITERALS'), - 'DICTIONARYLITERALS': ('ref/dict', 'DICTIONARIES LITERALS'), - 'BACKQUOTES': ('ref/string-conversions', 'repr str STRINGS LITERALS'), - 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), - 'SUBSCRIPTS': ('ref/subscriptions', 'SEQUENCEMETHODS1'), - 'SLICINGS': ('ref/slicings', 'SEQUENCEMETHODS2'), - 'CALLS': ('ref/calls', 'EXPRESSIONS'), - 'POWER': ('ref/power', 'EXPRESSIONS'), - 'UNARY': ('ref/unary', 'EXPRESSIONS'), - 'BINARY': ('ref/binary', 'EXPRESSIONS'), - 'SHIFTING': ('ref/shifting', 'EXPRESSIONS'), - 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), - 'COMPARISON': ('ref/comparisons', 'EXPRESSIONS BASICMETHODS'), - 'BOOLEAN': ('ref/Booleans', 'EXPRESSIONS TRUTHVALUE'), + 'TUPLELITERALS': ('exprlists', 'TUPLES LITERALS'), + 'LISTS': ('typesseq-mutable', 'LISTLITERALS'), + 'LISTLITERALS': ('lists', 'LISTS LITERALS'), + 'DICTIONARIES': ('typesmapping', 'DICTIONARYLITERALS'), + 'DICTIONARYLITERALS': ('dict', 'DICTIONARIES LITERALS'), + 'BACKQUOTES': ('string-conversions', 'repr str STRINGS LITERALS'), + 'ATTRIBUTES': ('attribute-references', 'getattr hasattr setattr ' + 'ATTRIBUTEMETHODS'), + 'SUBSCRIPTS': ('subscriptions', 'SEQUENCEMETHODS1'), + 'SLICINGS': ('slicings', 'SEQUENCEMETHODS2'), + 'CALLS': ('calls', 'EXPRESSIONS'), + 'POWER': ('power', 'EXPRESSIONS'), + 'UNARY': ('unary', 'EXPRESSIONS'), + 'BINARY': ('binary', 'EXPRESSIONS'), + 'SHIFTING': ('shifting', 'EXPRESSIONS'), + 'BITWISE': ('bitwise', 'EXPRESSIONS'), + 'COMPARISON': ('comparisons', 'EXPRESSIONS BASICMETHODS'), + 'BOOLEAN': ('booleans', 'EXPRESSIONS TRUTHVALUE'), 'ASSERTION': 'assert', - 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), - 'AUGMENTEDASSIGNMENT': ('ref/augassign', 'NUMBERMETHODS'), + 'ASSIGNMENT': ('assignment', 'AUGMENTEDASSIGNMENT'), + 'AUGMENTEDASSIGNMENT': ('augassign', 'NUMBERMETHODS'), 'DELETION': 'del', 'PRINTING': 'print', 'RETURNING': 'return', 'IMPORTING': 'import', 'CONDITIONAL': 'if', - 'LOOPING': ('ref/compound', 'for while break continue'), - 'TRUTHVALUE': ('lib/truth', 'if while and or not BASICMETHODS'), - 'DEBUGGING': ('lib/module-pdb', 'pdb'), - 'CONTEXTMANAGERS': ('ref/context-managers', 'with'), + 'LOOPING': ('compound', 'for while break continue'), + 'TRUTHVALUE': ('truth', 'if while and or not BASICMETHODS'), + 'DEBUGGING': ('debugger', 'pdb'), + 'CONTEXTMANAGERS': ('context-managers', 'with'), } def __init__(self, input, output): self.input = input self.output = output - self.docdir = None - execdir = os.path.dirname(sys.executable) - homedir = os.environ.get('PYTHONHOME') - join = os.path.join - for dir in [os.environ.get('PYTHONDOCS'), - homedir and os.path.join(homedir, 'doc'), - join(execdir, 'doc'), # for Windows - join(sys.prefix, 'doc/python-docs-' + split(sys.version)[0]), - join(sys.prefix, 'doc/python-' + split(sys.version)[0]), - join(sys.prefix, 'doc/python-docs-' + sys.version[:3]), - join(sys.prefix, 'doc/python-' + sys.version[:3]), - join(sys.prefix, 'Resources/English.lproj/Documentation')]: - if dir and os.path.isdir(join(dir, 'lib')): - self.docdir = dir - break - if dir and os.path.isdir(join(dir, 'html', 'lib')): - self.docdir = join(dir, 'html') - break def __repr__(self): if inspect.stack()[1][3] == '?': @@ -1761,14 +1768,12 @@ self.list(self.topics.keys()) def showtopic(self, topic): - if not self.docdir: + try: + import pydoc_topics + except ImportError: self.output.write(''' -Sorry, topic and keyword documentation is not available because the Python -HTML documentation files could not be found. If you have installed them, -please set the environment variable PYTHONDOCS to indicate their location. - -On the Microsoft Windows operating system, the files can be built by -running "hh -decompile . PythonNN.chm" in the C:\PythonNN\Doc> directory. +Sorry, topic and keyword documentation is not available because the +module "pydoc_topics" could not be found. ''') return target = self.topics.get(topic, self.keywords.get(topic)) @@ -1778,31 +1783,15 @@ if type(target) is type(''): return self.showtopic(target) - filename, xrefs = target - filename = self.docdir + '/' + filename + '.html' + label, xrefs = target try: - file = open(filename) - except: - self.output.write('could not read docs from %s\n' % filename) + doc = pydoc_topics.topics[label] + except KeyError: + self.output.write('no documentation found for %s\n' % repr(topic)) return - - divpat = re.compile(']*navigat.*?', re.I | re.S) - addrpat = re.compile('.*?', re.I | re.S) - document = re.sub(addrpat, '', re.sub(divpat, '', file.read())) - file.close() - - import htmllib, formatter, StringIO - buffer = StringIO.StringIO() - parser = htmllib.HTMLParser( - formatter.AbstractFormatter(formatter.DumbWriter(buffer))) - parser.start_table = parser.do_p - parser.end_table = lambda parser=parser: parser.do_p({}) - parser.start_tr = parser.do_br - parser.start_td = parser.start_th = lambda a, b=buffer: b.write('\t') - parser.feed(document) - buffer = replace(buffer.getvalue(), '\xa0', ' ', '\n', '\n ') - pager(' ' + strip(buffer) + '\n') + pager(strip(doc) + '\n') if xrefs: + import StringIO, formatter buffer = StringIO.StringIO() formatter.DumbWriter(buffer).send_flowing_data( 'Related help topics: ' + join(split(xrefs), ', ') + '\n') Modified: python/branches/tlee-ast-optimize/Lib/sgmllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/sgmllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/sgmllib.py Mon Jun 2 15:14:06 2008 @@ -9,6 +9,11 @@ # not supported at all. +from warnings import warnpy3k +warnpy3k("the sgmllib module has been removed in Python 3.0", + stacklevel=2) +del warnpy3k + import markupbase import re Modified: python/branches/tlee-ast-optimize/Lib/test/test_datetime.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_datetime.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_datetime.py Mon Jun 2 15:14:06 2008 @@ -850,9 +850,13 @@ self.assertRaises(TypeError, t.strftime, "one", "two") # too many args self.assertRaises(TypeError, t.strftime, 42) # arg wrong type + # test that unicode input is allowed (issue 2782) + self.assertEqual(t.strftime(u"%m"), "03") + # A naive object replaces %z and %Z w/ empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") + def test_format(self): dt = self.theclass(2007, 9, 10) self.assertEqual(dt.__format__(''), str(dt)) Modified: python/branches/tlee-ast-optimize/Lib/test/test_descrtut.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_descrtut.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_descrtut.py Mon Jun 2 15:14:06 2008 @@ -208,6 +208,7 @@ '__setattr__', '__setitem__', '__setslice__', + '__sizeof__', '__str__', '__subclasshook__', 'append', Modified: python/branches/tlee-ast-optimize/Lib/test/test_htmllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_htmllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_htmllib.py Mon Jun 2 15:14:06 2008 @@ -1,8 +1,8 @@ import formatter -import htmllib import unittest from test import test_support +htmllib = test_support.import_module('htmllib', deprecated=True) class AnchorCollector(htmllib.HTMLParser): Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py Mon Jun 2 15:14:06 2008 @@ -137,7 +137,7 @@ # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', 'Bastion', 'compiler', 'dircache', 'fpformat', - 'ihooks', 'mhlib', 'statvfs') + 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', Modified: python/branches/tlee-ast-optimize/Lib/test/test_sgmllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sgmllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sgmllib.py Mon Jun 2 15:14:06 2008 @@ -1,8 +1,8 @@ import pprint import re -import sgmllib import unittest from test import test_support +sgmllib = test_support.import_module('sgmllib', deprecated=True) class EventCollector(sgmllib.SGMLParser): Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Mon Jun 2 15:14:06 2008 @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- import unittest, test.test_support -import sys, cStringIO +import sys, cStringIO, os class SysModuleTest(unittest.TestCase): @@ -405,8 +405,153 @@ self.assertEqual(out, '?') +class SizeofTest(unittest.TestCase): + + def setUp(self): + import struct + self.i = len(struct.pack('i', 0)) + self.l = len(struct.pack('l', 0)) + self.p = len(struct.pack('P', 0)) + self.headersize = self.l + self.p + if hasattr(sys, "gettotalrefcount"): + self.headersize += 2 * self.p + self.file = open(test.test_support.TESTFN, 'wb') + + def tearDown(self): + self.file.close() + test.test_support.unlink(test.test_support.TESTFN) + + def check_sizeof(self, o, size): + result = sys.getsizeof(o) + msg = 'wrong size for %s: got %d, expected %d' \ + % (type(o), result, size) + self.assertEqual(result, size, msg) + + def align(self, value): + mod = value % self.p + if mod != 0: + return value - mod + self.p + else: + return value + + def test_align(self): + self.assertEqual(self.align(0) % self.p, 0) + self.assertEqual(self.align(1) % self.p, 0) + self.assertEqual(self.align(3) % self.p, 0) + self.assertEqual(self.align(4) % self.p, 0) + self.assertEqual(self.align(7) % self.p, 0) + self.assertEqual(self.align(8) % self.p, 0) + self.assertEqual(self.align(9) % self.p, 0) + + def test_standardtypes(self): + i = self.i + l = self.l + p = self.p + h = self.headersize + # bool + self.check_sizeof(True, h + l) + # buffer + self.check_sizeof(buffer(''), h + 2*p + 2*l + self.align(i) +l) + # cell + def get_cell(): + x = 42 + def inner(): + return x + return inner + self.check_sizeof(get_cell().func_closure[0], h + p) + # old-style class + class class_oldstyle(): + def method(): + pass + self.check_sizeof(class_oldstyle, h + 6*p) + # instance + self.check_sizeof(class_oldstyle(), h + 3*p) + # method + self.check_sizeof(class_oldstyle().method, h + 4*p) + # code + self.check_sizeof(get_cell().func_code, h + self.align(4*i) + 8*p +\ + self.align(i) + 2*p) + # complex + self.check_sizeof(complex(0,1), h + 2*8) + # enumerate + self.check_sizeof(enumerate([]), h + l + 3*p) + # reverse + self.check_sizeof(reversed(''), h + l + p ) + # file + self.check_sizeof(self.file, h + 4*p + self.align(2*i) + 4*p +\ + self.align(3*i) + 3*p + self.align(i)) + # float + self.check_sizeof(float(0), h + 8) + # function + def func(): pass + self.check_sizeof(func, h + 9 * l) + class c(): + @staticmethod + def foo(): + pass + @classmethod + def bar(cls): + pass + # staticmethod + self.check_sizeof(foo, h + l) + # classmethod + self.check_sizeof(bar, h + l) + # generator + def get_gen(): yield 1 + self.check_sizeof(get_gen(), h + p + self.align(i) + 2*p) + # integer + self.check_sizeof(1, h + l) + # builtin_function_or_method + self.check_sizeof(abs, h + 3*p) + # module + self.check_sizeof(unittest, h + p) + # xrange + self.check_sizeof(xrange(1), h + 3*p) + # slice + self.check_sizeof(slice(0), h + 3*p) + + h += l + # new-style class + class class_newstyle(object): + def method(): + pass + # type (PyTypeObject + PyNumberMethods + PyMappingMethods + + # PySequenceMethods + PyBufferProcs) + len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p + self.check_sizeof(class_newstyle, + h + len_typeobject + 42*p + 10*p + 3*p + 6*p) + + + def test_specialtypes(self): + i = self.i + l = self.l + p = self.p + h = self.headersize + # dict + self.check_sizeof({}, h + 3*l + 3*p + 8*(l + 2*p)) + longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} + self.check_sizeof(longdict, h + 3*l + 3*p + 8*(l + 2*p) + 16*(l + 2*p)) + # list + self.check_sizeof([], h + l + p + l) + self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) + + h += l + # long + self.check_sizeof(0L, h + self.align(2)) + self.check_sizeof(1L, h + self.align(2)) + self.check_sizeof(-1L, h + self.align(2)) + self.check_sizeof(32768L, h + self.align(2) + 2) + self.check_sizeof(32768L*32768L-1, h + self.align(2) + 2) + self.check_sizeof(32768L*32768L, h + self.align(2) + 4) + # string + self.check_sizeof('', h + l + self.align(i + 1)) + self.check_sizeof('abc', h + l + self.align(i + 1) + 3) + + def test_main(): - test.test_support.run_unittest(SysModuleTest) + test_classes = (SysModuleTest, SizeofTest) + + test.test_support.run_unittest(*test_classes) if __name__ == "__main__": test_main() Modified: python/branches/tlee-ast-optimize/Lib/test/test_threading.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_threading.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_threading.py Mon Jun 2 15:14:06 2008 @@ -3,6 +3,7 @@ import test.test_support from test.test_support import verbose import random +import re import sys import threading import thread @@ -72,6 +73,8 @@ for i in range(NUMTASKS): t = TestThread(""%i, self, sema, mutex, numrunning) threads.append(t) + self.failUnlessEqual(t.getIdent(), None) + self.assert_(re.match('', repr(t))) t.start() if verbose: @@ -79,6 +82,8 @@ for t in threads: t.join(NUMTASKS) self.assert_(not t.isAlive()) + self.failIfEqual(t.getIdent(), 0) + self.assert_(re.match('', repr(t))) if verbose: print 'all tasks done' self.assertEqual(numrunning.get(), 0) Modified: python/branches/tlee-ast-optimize/Lib/threading.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/threading.py (original) +++ python/branches/tlee-ast-optimize/Lib/threading.py Mon Jun 2 15:14:06 2008 @@ -414,6 +414,7 @@ self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon() + self.__ident = None self.__started = Event() self.__stopped = False self.__block = Condition(Lock()) @@ -434,7 +435,9 @@ if self.__stopped: status = "stopped" if self.__daemonic: - status = status + " daemon" + status += " daemon" + if self.__ident is not None: + status += " %s" % self.__ident return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status) def start(self): @@ -481,9 +484,10 @@ def __bootstrap_inner(self): try: + self.__ident = _get_ident() self.__started.set() _active_limbo_lock.acquire() - _active[_get_ident()] = self + _active[self.__ident] = self del _limbo[self] _active_limbo_lock.release() if __debug__: @@ -635,6 +639,10 @@ assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) + def getIdent(self): + assert self.__initialized, "Thread.__init__() not called" + return self.__ident + def isAlive(self): assert self.__initialized, "Thread.__init__() not called" return self.__started.isSet() and not self.__stopped Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Mon Jun 2 15:14:06 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. + - New environment variable PYTHONIOENCODING. - Patch #2488: Add sys.maxsize. @@ -65,11 +67,22 @@ - Issue #2870: cmathmodule.c compile error. +- Added a threading.Thread.getIdent() method. + Library ------- -- Issue #3011: locale module alias table was updated to the latest version - from the X.org locale.alias file +- Patch #2125: Add GetInteger and GetString methods for + msilib.Record objects. + +- Issue #2782: The datetime module's strftime methods now accept + unicode format strings just as time.strftime always has. + +- The sgmllib and htmllib modules have been deprecated for removal + in Python 3.0. + +- Issue #3011: locale module alias table was updated to the latest + version from the X.org locale.alias file. - Issue #1797 (partial fix): ctypes NULL function pointers have a False boolean value now. Modified: python/branches/tlee-ast-optimize/Modules/datetimemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/datetimemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/datetimemodule.c Mon Jun 2 15:14:06 2008 @@ -2,6 +2,8 @@ * http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage */ +#define PY_SSIZE_T_CLEAN + #include "Python.h" #include "modsupport.h" #include "structmember.h" @@ -1152,8 +1154,8 @@ * needed. */ static PyObject * -wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, - PyObject *tzinfoarg) +wrap_strftime(PyObject *object, const char *format, size_t format_len, + PyObject *timetuple, PyObject *tzinfoarg) { PyObject *result = NULL; /* guilty until proved innocent */ @@ -1161,20 +1163,19 @@ PyObject *Zreplacement = NULL; /* py string, replacement for %Z */ PyObject *freplacement = NULL; /* py string, replacement for %f */ - char *pin; /* pointer to next char in input format */ - char ch; /* next char in input format */ + const char *pin; /* pointer to next char in input format */ + char ch; /* next char in input format */ PyObject *newfmt = NULL; /* py string, the output format */ char *pnew; /* pointer to available byte in output format */ - int totalnew; /* number bytes total in output format buffer, - exclusive of trailing \0 */ - int usednew; /* number bytes used so far in output format buffer */ + size_t totalnew; /* number bytes total in output format buffer, + exclusive of trailing \0 */ + size_t usednew; /* number bytes used so far in output format buffer */ - char *ptoappend; /* pointer to string to append to output buffer */ - int ntoappend; /* # of bytes to append to output buffer */ + const char *ptoappend; /* ptr to string to append to output buffer */ + size_t ntoappend; /* # of bytes to append to output buffer */ assert(object && format && timetuple); - assert(PyBytes_Check(format)); /* Give up if the year is before 1900. * Python strftime() plays games with the year, and different @@ -1205,13 +1206,13 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ - totalnew = PyBytes_Size(format) + 1; /* realistic if no %z/%Z/%f */ + totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ newfmt = PyBytes_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; pnew = PyBytes_AsString(newfmt); usednew = 0; - pin = PyBytes_AsString(format); + pin = format; while ((ch = *pin++) != '\0') { if (ch != '%') { ptoappend = pin - 1; @@ -1313,7 +1314,7 @@ if (ntoappend == 0) continue; while (usednew + ntoappend > totalnew) { - int bigger = totalnew << 1; + size_t bigger = totalnew << 1; if ((bigger >> 1) != totalnew) { /* overflow */ PyErr_NoMemory(); goto Done; @@ -2480,18 +2481,19 @@ * timetuple() method appropriate to self's class. */ PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyBytes_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; tuple = PyObject_CallMethod((PyObject *)self, "timetuple", "()"); if (tuple == NULL) return NULL; - result = wrap_strftime((PyObject *)self, format, tuple, + result = wrap_strftime((PyObject *)self, format, format_len, tuple, (PyObject *)self); Py_DECREF(tuple); return result; @@ -3256,12 +3258,13 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw) { PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyBytes_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; /* Python's strftime does insane things with the year part of the @@ -3277,7 +3280,8 @@ if (tuple == NULL) return NULL; assert(PyTuple_Size(tuple) == 9); - result = wrap_strftime((PyObject *)self, format, tuple, Py_None); + result = wrap_strftime((PyObject *)self, format, format_len, tuple, + Py_None); Py_DECREF(tuple); return result; } Modified: python/branches/tlee-ast-optimize/Objects/bytesobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytesobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytesobject.c Mon Jun 2 15:14:06 2008 @@ -3917,6 +3917,17 @@ return NULL; } +PyDoc_STRVAR(sizeof__doc__, +"S.__sizeof__() -> size of S in memory, in bytes"); + +static PyObject * +string_sizeof(PyBytesObject *v) +{ + Py_ssize_t res; + res = sizeof(PyBytesObject) + v->ob_size * v->ob_type->tp_itemsize; + return PyInt_FromSsize_t(res); +} + #undef SPLIT_APPEND #undef SPLIT_ADD #undef MAX_PREALLOC @@ -4024,6 +4035,8 @@ expandtabs__doc__}, {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, splitlines__doc__}, + {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, + sizeof__doc__}, {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; Modified: python/branches/tlee-ast-optimize/Objects/dictobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/dictobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/dictobject.c Mon Jun 2 15:14:06 2008 @@ -2032,6 +2032,16 @@ return dictiter_new(dict, &PyDictIterItem_Type); } +static PyObject * +dict_sizeof(PyDictObject *mp) +{ + Py_ssize_t res; + + res = sizeof(PyDictObject) + sizeof(mp->ma_table); + if (mp->ma_table != mp->ma_smalltable) + res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry); + return PyInt_FromSsize_t(res); +} PyDoc_STRVAR(has_key__doc__, "D.has_key(k) -> True if D has a key k, else False"); @@ -2041,6 +2051,9 @@ PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); +PyDoc_STRVAR(sizeof__doc__, +"D.__sizeof__() -> size of D in memory, in bytes"); + PyDoc_STRVAR(get__doc__, "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); @@ -2092,6 +2105,8 @@ contains__doc__}, {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, + {"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS, + sizeof__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, has_key__doc__}, {"get", (PyCFunction)dict_get, METH_VARARGS, Modified: python/branches/tlee-ast-optimize/Objects/listobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/listobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/listobject.c Mon Jun 2 15:14:06 2008 @@ -2420,6 +2420,15 @@ return 0; } +static PyObject * +list_sizeof(PyListObject *self) +{ + Py_ssize_t res; + + res = sizeof(PyListObject) + self->allocated * sizeof(void*); + return PyInt_FromSsize_t(res); +} + static PyObject *list_iter(PyObject *seq); static PyObject *list_reversed(PyListObject* seq, PyObject* unused); @@ -2427,6 +2436,8 @@ "x.__getitem__(y) <==> x[y]"); PyDoc_STRVAR(reversed_doc, "L.__reversed__() -- return a reverse iterator over the list"); +PyDoc_STRVAR(sizeof_doc, +"L.__sizeof__() -- size of L in memory, in bytes"); PyDoc_STRVAR(append_doc, "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, @@ -2452,6 +2463,7 @@ static PyMethodDef list_methods[] = { {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, getitem_doc}, {"__reversed__",(PyCFunction)list_reversed, METH_NOARGS, reversed_doc}, + {"__sizeof__", (PyCFunction)list_sizeof, METH_NOARGS, sizeof_doc}, {"append", (PyCFunction)listappend, METH_O, append_doc}, {"insert", (PyCFunction)listinsert, METH_VARARGS, insert_doc}, {"extend", (PyCFunction)listextend, METH_O, extend_doc}, Modified: python/branches/tlee-ast-optimize/Objects/longobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/longobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/longobject.c Mon Jun 2 15:14:06 2008 @@ -3436,6 +3436,17 @@ return NULL; } +static PyObject * +long_sizeof(PyLongObject *v) +{ + Py_ssize_t res; + + res = sizeof(PyLongObject) + abs(v->ob_size) * sizeof(digit); + if (v->ob_size != 0) + res -= sizeof(digit); + return PyInt_FromSsize_t(res); +} + #if 0 static PyObject * long_is_finite(PyObject *v) @@ -3455,6 +3466,8 @@ "Truncating an Integral returns itself."}, {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, {"__format__", (PyCFunction)long__format__, METH_VARARGS}, + {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, + "Returns size in memory, in bytes"}, {NULL, NULL} /* sentinel */ }; Modified: python/branches/tlee-ast-optimize/Objects/typeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/typeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/typeobject.c Mon Jun 2 15:14:06 2008 @@ -3397,6 +3397,20 @@ return result; } +static PyObject * +object_sizeof(PyObject *self, PyObject *args) +{ + Py_ssize_t res, isize; + + res = 0; + isize = self->ob_type->tp_itemsize; + if (isize > 0) + res = self->ob_type->ob_size * isize; + res += self->ob_type->tp_basicsize; + + return PyInt_FromSsize_t(res); +} + static PyMethodDef object_methods[] = { {"__reduce_ex__", object_reduce_ex, METH_VARARGS, PyDoc_STR("helper for pickle")}, @@ -3406,6 +3420,8 @@ object_subclasshook_doc}, {"__format__", object_format, METH_VARARGS, PyDoc_STR("default object formatter")}, + {"__sizeof__", object_sizeof, METH_NOARGS, + PyDoc_STR("__sizeof__() -> size of object in memory, in bytes")}, {0} }; Modified: python/branches/tlee-ast-optimize/PC/_msi.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_msi.c (original) +++ python/branches/tlee-ast-optimize/PC/_msi.c Mon Jun 2 15:14:06 2008 @@ -339,6 +339,49 @@ } static PyObject* +record_getinteger(msiobj* record, PyObject* args) +{ + unsigned int field; + int status; + + if (!PyArg_ParseTuple(args, "I:GetInteger", &field)) + return NULL; + status = MsiRecordGetInteger(record->h, field); + if (status == MSI_NULL_INTEGER){ + PyErr_SetString(MSIError, "could not convert record field to integer"); + return NULL; + } + return PyInt_FromLong((long) status); +} + +static PyObject* +record_getstring(msiobj* record, PyObject* args) +{ + unsigned int field; + unsigned int status; + char buf[2000]; + char *res = buf; + DWORD size = sizeof(buf); + PyObject* string; + + if (!PyArg_ParseTuple(args, "I:GetString", &field)) + return NULL; + status = MsiRecordGetString(record->h, field, res, &size); + if (status == ERROR_MORE_DATA) { + res = (char*) malloc(size + 1); + if (res == NULL) + return PyErr_NoMemory(); + status = MsiRecordGetString(record->h, field, res, &size); + } + if (status != ERROR_SUCCESS) + return msierror((int) status); + string = PyString_FromString(res); + if (buf != res) + free(res); + return string; +} + +static PyObject* record_cleardata(msiobj* record, PyObject *args) { int status = MsiRecordClearData(record->h); @@ -405,6 +448,10 @@ static PyMethodDef record_methods[] = { { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS, PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")}, + { "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS, + PyDoc_STR("GetInteger(field) -> int\nWraps MsiRecordGetInteger")}, + { "GetString", (PyCFunction)record_getstring, METH_VARARGS, + PyDoc_STR("GetString(field) -> string\nWraps MsiRecordGetString")}, { "SetString", (PyCFunction)record_setstring, METH_VARARGS, PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")}, { "SetStream", (PyCFunction)record_setstream, METH_VARARGS, Modified: python/branches/tlee-ast-optimize/Python/sysmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/sysmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/sysmodule.c Mon Jun 2 15:14:06 2008 @@ -640,6 +640,45 @@ #endif /* USE_MALLOPT */ static PyObject * +sys_getsizeof(PyObject *self, PyObject *args) +{ + static PyObject * str__sizeof__ = NULL; + + /* Initialize static variable needed by _PyType_Lookup */ + if (str__sizeof__ == NULL) { + str__sizeof__ = PyString_InternFromString("__sizeof__"); + if (str__sizeof__ == NULL) + return NULL; + } + + /* Type objects */ + if (PyType_Check(args)){ + PyObject *method = _PyType_Lookup(Py_TYPE(args), + str__sizeof__); + if (method == NULL) { + PyErr_Format(PyExc_TypeError, + "Type %.100s doesn't define __sizeof__", + Py_TYPE(args)->tp_name); + return NULL; + } + return PyObject_CallFunctionObjArgs(method, args, NULL); + } + /* Instance of old-style classes */ + else if (PyInstance_Check(args)) + return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); + /* Old-style classes */ + else if (PyClass_Check(args)) + return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); + else + return PyObject_CallMethod(args, "__sizeof__", NULL); +} + +PyDoc_STRVAR(getsizeof_doc, +"getsizeof(object) -> int\n\ +\n\ +Return the size of object in bytes."); + +static PyObject * sys_getrefcount(PyObject *self, PyObject *arg) { return PyInt_FromSsize_t(arg->ob_refcnt); @@ -850,6 +889,7 @@ {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, getrecursionlimit_doc}, + {"getsizeof", sys_getsizeof, METH_O, getsizeof_doc}, {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, #ifdef MS_WINDOWS {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, @@ -1031,6 +1071,7 @@ getprofile() -- get the global profiling function\n\ getrefcount() -- return the reference count for an object (plus one :-)\n\ getrecursionlimit() -- return the max recursion depth for the interpreter\n\ +getsizeof() -- return the size of an object in bytes\n\ gettrace() -- get the global debug tracing function\n\ setcheckinterval() -- control how often the interpreter checks for events\n\ setdlopenflags() -- set the flags to be used for dlopen() calls\n\ Modified: python/branches/tlee-ast-optimize/Tools/README ============================================================================== --- python/branches/tlee-ast-optimize/Tools/README (original) +++ python/branches/tlee-ast-optimize/Tools/README Mon Jun 2 15:14:06 2008 @@ -9,6 +9,7 @@ bgen Generate complete extension modules from a description. Still under development! + WARNING: bgen has been removed in 3.0. compiler Tools used to maintain the compiler package in the standard library. Modified: python/branches/tlee-ast-optimize/Tools/bgen/README ============================================================================== --- python/branches/tlee-ast-optimize/Tools/bgen/README (original) +++ python/branches/tlee-ast-optimize/Tools/bgen/README Mon Jun 2 15:14:06 2008 @@ -5,3 +5,5 @@ complete source code for Python extension module. For examples of its use, see the Mac Python source distribution (available separately from the Python ftp archives). Note that BGEN is not Mac specific! + +WARNING: bgen has been removed in 3.0. From python-checkins at python.org Tue Jun 3 20:57:28 2008 From: python-checkins at python.org (thomas.heller) Date: Tue, 3 Jun 2008 20:57:28 +0200 (CEST) Subject: [Python-checkins] r63897 - in python/trunk: Modules/_ctypes/libffi/fficonfig.py.in setup.py Message-ID: <20080603185728.D22D51E4004@bag.python.org> Author: thomas.heller Date: Mon Jun 2 20:41:30 2008 New Revision: 63897 Log: Fix misspelled sys.platform name and misspelled filename. Modified: python/trunk/Modules/_ctypes/libffi/fficonfig.py.in python/trunk/setup.py Modified: python/trunk/Modules/_ctypes/libffi/fficonfig.py.in ============================================================================== --- python/trunk/Modules/_ctypes/libffi/fficonfig.py.in (original) +++ python/trunk/Modules/_ctypes/libffi/fficonfig.py.in Mon Jun 2 20:41:30 2008 @@ -25,7 +25,7 @@ 'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'], 'PA': ['src/pa/linux.S', 'src/pa/ffi.c'], 'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'], - 'PA_HPUX': ['src/pa/hpux32.s', 'src/pa/ffi.c'], + 'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'], } ffi_srcdir = '@srcdir@' Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Mon Jun 2 20:41:30 2008 @@ -1607,7 +1607,7 @@ # finding some -z option for the Sun compiler. extra_link_args.append('-mimpure-text') - elif sys.platform.startswith('hpux'): + elif sys.platform.startswith('hp-ux'): extra_link_args.append('-fPIC') ext = Extension('_ctypes', From python-checkins at python.org Tue Jun 3 20:57:32 2008 From: python-checkins at python.org (thomas.heller) Date: Tue, 3 Jun 2008 20:57:32 +0200 (CEST) Subject: [Python-checkins] r63898 - python/trunk/Lib/ctypes/test/__init__.py Message-ID: <20080603185732.8134E1E4004@bag.python.org> Author: thomas.heller Date: Mon Jun 2 22:07:46 2008 New Revision: 63898 Log: Fix the -x flag so that is does work. Modified: python/trunk/Lib/ctypes/test/__init__.py Modified: python/trunk/Lib/ctypes/test/__init__.py ============================================================================== --- python/trunk/Lib/ctypes/test/__init__.py (original) +++ python/trunk/Lib/ctypes/test/__init__.py Mon Jun 2 22:07:46 2008 @@ -178,7 +178,7 @@ elif flag == "-u": use_resources.extend(value.split(",")) elif flag == "-x": - exclude.append(value.split(",")) + exclude.extend(value.split(",")) mask = "test_*.py" if args: From python-checkins at python.org Tue Jun 3 22:59:19 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 22:59:19 +0200 (CEST) Subject: [Python-checkins] r63927 - in peps/trunk: pep-0000.txt pep-3138.txt Message-ID: <20080603205919.2281C1E4004@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 22:59:18 2008 New Revision: 63927 Log: Accepted PEP 3138 (changes to repr() in Py3k). Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3138.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Tue Jun 3 22:59:18 2008 @@ -84,6 +84,7 @@ SA 3119 Introducing Abstract Base Classes GvR, Talin SA 3121 Extension Module Initialization & Finalization von L?wis SA 3137 Immutable Bytes and Mutable Buffer GvR + SA 3138 String representation in Python 3000 Ishimoto SA 3141 A Type Hierarchy for Numbers Yasskin Open PEPs (under consideration) @@ -99,7 +100,6 @@ S 371 Addition of the multiprocessing package Noller, Oudkerk S 3134 Exception Chaining and Embedded Tracebacks Yee S 3135 New Super Spealman, Delaney - S 3138 String representation in Python 3000 Ishimoto Finished PEPs (done, implemented in Subversion) @@ -520,7 +520,7 @@ S 3135 New Super Spealman, Delaney SR 3136 Labeled break and continue Chisholm SA 3137 Immutable Bytes and Mutable Buffer GvR - S 3138 String representation in Python 3000 Ishimoto + SA 3138 String representation in Python 3000 Ishimoto SR 3139 Cleaning out sys and the "interpreter" module Peterson SR 3140 str(container) should call str(item), not repr(item) Broytmann, Jewett SA 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Tue Jun 3 22:59:18 2008 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Atsuo Ishimoto -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 05-May-2008 From python-checkins at python.org Tue Jun 3 23:11:27 2008 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 3 Jun 2008 23:11:27 +0200 (CEST) Subject: [Python-checkins] r63928 - peps/trunk/pep-0371.txt Message-ID: <20080603211127.038F51E4010@bag.python.org> Author: guido.van.rossum Date: Tue Jun 3 23:11:26 2008 New Revision: 63928 Log: Update from Jesse addressing API renaming to comply with PEP 8. Modified: peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Tue Jun 3 23:11:26 2008 @@ -219,7 +219,7 @@ does hinder non-I/O applications. Obviously, these tests could be improved to use a queue for coordination of results and chunks of work but that is not required to show the performance of the - package and core Processing module. + package and core processing.process module. The next test is an I/O bound test. This is normally where we see a steep improvement in the threading module approach versus a @@ -318,15 +318,15 @@ API Naming - The API of the pyprocessing package is designed to closely mimic - that of the threading and Queue modules. It has been proposed that - instead of adding the package as-is, we rename it to be PEP 8 - compliant instead. - - Since the aim of the package is to be a drop-in for the threading - module, the authors feel that the current API should be used. - When the threading and Queue modules are updated to fully reflect - PEP 8, the pyprocessing/multiprocessing naming can be revised. + While the aim of the package's API is designed to closely mimic that of + the threading and Queue modules, those modules are not PEP 8 compliant. + It has been decided that instead of adding the package as-is and + therefore perpetuating the non-PEP 8 compliant naming, we will rename + all APIs, classes, etc to be fully PEP 8 compliant. + + This change does affect the ease-of-drop in replacement for those using + the threading module, but that is an acceptable side-effect in the view + of the authors. Timing/Schedule From python-checkins at python.org Wed Jun 4 08:29:58 2008 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 4 Jun 2008 08:29:58 +0200 (CEST) Subject: [Python-checkins] r63929 - in python/trunk: Demo/turtle Demo/turtle/about_turtle.txt Demo/turtle/about_turtledemo.txt Demo/turtle/demohelp.txt Demo/turtle/tdemo_I_dontlike_tiltdemo.py Demo/turtle/tdemo_bytedesign.py Demo/turtle/tdemo_chaos.py Demo/turtle/tdemo_clock.py Demo/turtle/tdemo_colormixer.py Demo/turtle/tdemo_fractalcurves.py Demo/turtle/tdemo_lindenmayer_indian.py Demo/turtle/tdemo_minimal_hanoi.py Demo/turtle/tdemo_paint.py Demo/turtle/tdemo_peace.py Demo/turtle/tdemo_penrose.py Demo/turtle/tdemo_planet_and_moon.py Demo/turtle/tdemo_tree.py Demo/turtle/tdemo_wikipedia.py Demo/turtle/tdemo_yinyang.py Demo/turtle/turtle.cfg Demo/turtle/turtleDemo.py Demo/turtle/turtledemo_two_canvases.py Doc/library/turtle.rst Lib/lib-tk/turtle.py Misc/ACKS Message-ID: <20080604062958.7A10C1E401F@bag.python.org> Author: martin.v.loewis Date: Wed Jun 4 08:29:55 2008 New Revision: 63929 Log: Patch #1513695: New turtle module, with demos. Added: python/trunk/Demo/turtle/ python/trunk/Demo/turtle/about_turtle.txt (contents, props changed) python/trunk/Demo/turtle/about_turtledemo.txt (contents, props changed) python/trunk/Demo/turtle/demohelp.txt (contents, props changed) python/trunk/Demo/turtle/tdemo_I_dontlike_tiltdemo.py (contents, props changed) python/trunk/Demo/turtle/tdemo_bytedesign.py (contents, props changed) python/trunk/Demo/turtle/tdemo_chaos.py (contents, props changed) python/trunk/Demo/turtle/tdemo_clock.py (contents, props changed) python/trunk/Demo/turtle/tdemo_colormixer.py (contents, props changed) python/trunk/Demo/turtle/tdemo_fractalcurves.py (contents, props changed) python/trunk/Demo/turtle/tdemo_lindenmayer_indian.py (contents, props changed) python/trunk/Demo/turtle/tdemo_minimal_hanoi.py (contents, props changed) python/trunk/Demo/turtle/tdemo_paint.py (contents, props changed) python/trunk/Demo/turtle/tdemo_peace.py (contents, props changed) python/trunk/Demo/turtle/tdemo_penrose.py (contents, props changed) python/trunk/Demo/turtle/tdemo_planet_and_moon.py (contents, props changed) python/trunk/Demo/turtle/tdemo_tree.py (contents, props changed) python/trunk/Demo/turtle/tdemo_wikipedia.py (contents, props changed) python/trunk/Demo/turtle/tdemo_yinyang.py (contents, props changed) python/trunk/Demo/turtle/turtle.cfg (contents, props changed) python/trunk/Demo/turtle/turtleDemo.py (contents, props changed) python/trunk/Demo/turtle/turtledemo_two_canvases.py (contents, props changed) Modified: python/trunk/Doc/library/turtle.rst python/trunk/Lib/lib-tk/turtle.py python/trunk/Misc/ACKS Added: python/trunk/Demo/turtle/about_turtle.txt ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/about_turtle.txt Wed Jun 4 08:29:55 2008 @@ -0,0 +1,77 @@ + +======================================================== + A new turtle module for Python +======================================================== + +Turtle graphics is a popular way for introducing programming to +kids. It was part of the original Logo programming language developed +by Wally Feurzig and Seymour Papert in 1966. + +Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it +the command turtle.forward(15), and it moves (on-screen!) 15 pixels in +the direction it is facing, drawing a line as it moves. Give it the +command turtle.left(25), and it rotates in-place 25 degrees clockwise. + +By combining together these and similar commands, intricate shapes and +pictures can easily be drawn. + +----- turtle.py + +This module is an extended reimplementation of turtle.py from the +Python standard distribution up to Python 2.5. (See: http:\\www.python.org) + +It tries to keep the merits of turtle.py and to be (nearly) 100% +compatible with it. This means in the first place to enable the +learning programmer to use all the commands, classes and methods +interactively when using the module from within IDLE run with +the -n switch. + +Roughly it has the following features added: + +- Better animation of the turtle movements, especially of turning the + turtle. So the turtles can more easily be used as a visual feedback + instrument by the (beginning) programmer. + +- Different turtle shapes, gif-images as turtle shapes, user defined + and user controllable turtle shapes, among them compound + (multicolored) shapes. Turtle shapes can be stgretched and tilted, which + makes turtles zu very versatile geometrical objects. + +- Fine control over turtle movement and screen updates via delay(), + and enhanced tracer() and speed() methods. + +- Aliases for the most commonly used commands, like fd for forward etc., + following the early Logo traditions. This reduces the boring work of + typing long sequences of commands, which often occur in a natural way + when kids try to program fancy pictures on their first encounter with + turtle graphcis. + +- Turtles now have an undo()-method with configurable undo-buffer. + +- Some simple commands/methods for creating event driven programs + (mouse-, key-, timer-events). Especially useful for programming games. + +- A scrollable Canvas class. The default scrollable Canvas can be + extended interactively as needed while playing around with the turtle(s). + +- A TurtleScreen class with methods controlling background color or + background image, window and canvas size and other properties of the + TurtleScreen. + +- There is a method, setworldcoordinates(), to install a user defined + coordinate-system for the TurtleScreen. + +- The implementation uses a 2-vector class named Vec2D, derived from tuple. + This class is public, so it can be imported by the application programmer, + which makes certain types of computations very natural and compact. + +- Appearance of the TurtleScreen and the Turtles at startup/import can be + configured by means of a turtle.cfg configuration file. + The default configuration mimics the appearance of the old turtle module. + +- If configured appropriately the module reads in docstrings from a docstring + dictionary in some different language, supplied separately and replaces + the english ones by those read in. There is a utility function + write_docstringdict() to write a dictionary with the original (english) + docstrings to disc, so it can serve as a template for translations. + Added: python/trunk/Demo/turtle/about_turtledemo.txt ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/about_turtledemo.txt Wed Jun 4 08:29:55 2008 @@ -0,0 +1,14 @@ + + -------------------------------------- + About xturtleDemo.py + -------------------------------------- + + Tiny demo Viewer to view turtle graphics example scripts. + + Quickly and dirtyly assembled by Gregor Lingl. + June, 2006 + + For more information see: xturtleDemo - Help + + Have fun! + Added: python/trunk/Demo/turtle/demohelp.txt ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/demohelp.txt Wed Jun 4 08:29:55 2008 @@ -0,0 +1,75 @@ + + + ---------------------------------------------- + + xturtleDemo - Help + + ---------------------------------------------- + + This document has two sections: + + (1) How to use the demo viewer + (2) How to add your own demos to the demo repository + + + (1) How to use the demo viewer. + + Select a demoscript from the example menu. + The (syntax coloured) source code appears in the left + source code window. IT CANNOT BE EDITED, but ONLY VIEWED! + + - Press START button to start the demo. + - Stop execution by pressing the STOP button. + - Clear screen by pressing the CLEAR button. + - Restart by pressing the START button again. + + SPECIAL demos are those which run EVENTDRIVEN. + (For example clock.py - or oldTurtleDemo.py which + in the end expects a mouse click.): + + Press START button to start the demo. + + - Until the EVENTLOOP is entered everything works + as in an ordinary demo script. + + - When the EVENTLOOP is entered, you control the + application by using the mouse and/or keys (or it's + controlled by some timer events) + To stop it you can and must press the STOP button. + + While the EVENTLOOP is running, the examples menu is disabled. + + - Only after having pressed the STOP button, you may + restart it or choose another example script. + + * * * * * * * * + In some rare situations there may occur interferences/conflicts + between events concerning the demo script and those concerning the + demo-viewer. (They run in the same process.) Strange behaviour may be + the consequence and in the worst case you must close and restart the + viewer. + * * * * * * * * + + + (2) How to add your own demos to the demo repository + + - scriptname: must begin with tdemo_ , + so it must have the form tdemo_.py + + - place: same directory as xturtleDemo.py or some + subdirectory, the name of which must also begin with + tdemo_..... + + - requirements on source code: + code must contain a main() function which will + be executed by the viewer (see provided example scripts) + main() may return a string which will be displayed + in the Label below the source code window (when execution + has finished.) + + !! For programs, which are EVENT DRIVEN, main must return + !! the string "EVENTLOOP". This informs the viewer, that the + !! script is still running and must be stopped by the user! + + + Added: python/trunk/Demo/turtle/tdemo_I_dontlike_tiltdemo.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_I_dontlike_tiltdemo.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,58 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo-I_dont_like_tiltdemo.py + +Demostrates + (a) use of a tilted ellipse as + turtle shape + (b) stamping that shape + +We can remove it, if you don't like it. + Without using reset() ;-) + --------------------------------------- +""" +from turtle import * +import time + +def main(): + reset() + shape("circle") + resizemode("user") + + pu(); bk(24*18/6.283); rt(90); pd() + tilt(45) + + pu() + + turtlesize(16,10,5) + color("red", "violet") + for i in range(18): + fd(24) + lt(20) + stamp() + color("red", "") + for i in range(18): + fd(24) + lt(20) + stamp() + + tilt(-15) + turtlesize(3, 1, 4) + color("blue", "yellow") + for i in range(17): + fd(24) + lt(20) + if i%2 == 0: + stamp() + time.sleep(1) + while undobufferentries(): + undo() + ht() + write("OK, OVER!", align="center", font=("Courier", 18, "bold")) + return "Done!" + +if __name__=="__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_bytedesign.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_bytedesign.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,162 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_bytedesign.py + +An example adapted from the example-suite +of PythonCard's turtle graphcis. + +It's based on an article in BYTE magazine +Problem Solving with Logo: Using Turtle +Graphics to Redraw a Design +November 1982, p. 118 - 134 + +------------------------------------------- + +Due to the statement + +t.delay(0) + +in line 152, which sets the animation delay +to 0, this animation runs in "line per line" +mode as fast as possible. +""" + +import math +from turtle import Turtle, mainloop +from time import clock + +# wrapper for any additional drawing routines +# that need to know about each other +class Designer(Turtle): + + def design(self, homePos, scale): + self.up() + for i in range(5): + self.forward(64.65 * scale) + self.down() + self.wheel(self.position(), scale) + self.up() + self.backward(64.65 * scale) + self.right(72) + self.up() + self.goto(homePos) + self.right(36) + self.forward(24.5 * scale) + self.right(198) + self.down() + self.centerpiece(46 * scale, 143.4, scale) + self.tracer(True) + + def wheel(self, initpos, scale): + self.right(54) + for i in range(4): + self.pentpiece(initpos, scale) + self.down() + self.left(36) + for i in range(5): + self.tripiece(initpos, scale) + self.left(36) + for i in range(5): + self.down() + self.right(72) + self.forward(28 * scale) + self.up() + self.backward(28 * scale) + self.left(54) + self.getscreen().update() + + def tripiece(self, initpos, scale): + oldh = self.heading() + self.down() + self.backward(2.5 * scale) + self.tripolyr(31.5 * scale, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.down() + self.backward(2.5 * scale) + self.tripolyl(31.5 * scale, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.left(72) + self.getscreen().update() + + def pentpiece(self, initpos, scale): + oldh = self.heading() + self.up() + self.forward(29 * scale) + self.down() + for i in range(5): + self.forward(18 * scale) + self.right(72) + self.pentr(18 * scale, 75, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.forward(29 * scale) + self.down() + for i in range(5): + self.forward(18 * scale) + self.right(72) + self.pentl(18 * scale, 75, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.left(72) + self.getscreen().update() + + def pentl(self, side, ang, scale): + if side < (2 * scale): return + self.forward(side) + self.left(ang) + self.pentl(side - (.38 * scale), ang, scale) + + def pentr(self, side, ang, scale): + if side < (2 * scale): return + self.forward(side) + self.right(ang) + self.pentr(side - (.38 * scale), ang, scale) + + def tripolyr(self, side, scale): + if side < (4 * scale): return + self.forward(side) + self.right(111) + self.forward(side / 1.78) + self.right(111) + self.forward(side / 1.3) + self.right(146) + self.tripolyr(side * .75, scale) + + def tripolyl(self, side, scale): + if side < (4 * scale): return + self.forward(side) + self.left(111) + self.forward(side / 1.78) + self.left(111) + self.forward(side / 1.3) + self.left(146) + self.tripolyl(side * .75, scale) + + def centerpiece(self, s, a, scale): + self.forward(s); self.left(a) + if s < (7.5 * scale): + return + self.centerpiece(s - (1.2 * scale), a, scale) + +def main(): + t = Designer() + t.speed(0) + t.hideturtle() + t.getscreen().delay(0) + t.tracer(0) + at = clock() + t.design(t.position(), 2) + et = clock() + return "runtime: %.2f sec." % (et-at) + +if __name__ == '__main__': + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_chaos.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_chaos.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,63 @@ +# Datei: chaosplotter.py +# Autor: Gregor Lingl +# Datum: 31. 5. 2008 + +# Ein einfaches Programm zur Demonstration von "chaotischem Verhalten". + +from turtle import * + +def f(x): + return 3.9*x*(1-x) + +def g(x): + return 3.9*(x-x**2) + +def h(x): + return 3.9*x-3.9*x*x + +def coosys(): + penup() + goto(-1,0) + pendown() + goto(n+1,0) + penup() + goto(0, -0.1) + pendown() + goto(-0.1, 1.1) + +def plot(fun, start, farbe): + x = start + pencolor(farbe) + penup() + goto(0, x) + pendown() + dot(5) + for i in range(n): + x=fun(x) + goto(i+1,x) + dot(5) + +def main(): + global n + n = 80 + ox=-250.0 + oy=-150.0 + ex= -2.0*ox / n + ey=300.0 + + reset() + setworldcoordinates(-1.0,-0.1, n+1, 1.1) + speed(0) + hideturtle() + coosys() + plot(f, 0.35, "blue") + plot(g, 0.35, "green") + plot(h, 0.35, "red") + for s in range(100): + setworldcoordinates(0.5*s,-0.1, n+1, 1.1) + + return "Done!" + +if __name__ == "__main__": + main() + mainloop() Added: python/trunk/Demo/turtle/tdemo_clock.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_clock.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,132 @@ +#!/usr/bin/python +# -*- coding: cp1252 -*- +""" turtle-example-suite: + + tdemo_clock.py + +Enhanced clock-program, showing date +and time + ------------------------------------ + Press STOP to exit the program! + ------------------------------------ +""" +from turtle import * +from datetime import datetime + +mode("logo") + +def jump(distanz, winkel=0): + penup() + right(winkel) + forward(distanz) + left(winkel) + pendown() + +def hand(laenge, spitze): + fd(laenge*1.15) + rt(90) + fd(spitze/2.0) + lt(120) + fd(spitze) + lt(120) + fd(spitze) + lt(120) + fd(spitze/2.0) + +def make_hand_shape(name, laenge, spitze): + reset() + jump(-laenge*0.15) + begin_poly() + hand(laenge, spitze) + end_poly() + hand_form = get_poly() + register_shape(name, hand_form) + + +def clockface(radius): + reset() + pensize(7) + for i in range(60): + jump(radius) + if i % 5 == 0: + fd(25) + jump(-radius-25) + else: + dot(3) + jump(-radius) + rt(6) + +def setup(): + global second_hand, minute_hand, hour_hand, writer + mode("logo") + make_hand_shape("second_hand", 125, 25) + make_hand_shape("minute_hand", 130, 25) + make_hand_shape("hour_hand", 90, 25) + clockface(160) + second_hand = Turtle() + second_hand.shape("second_hand") + second_hand.color("gray20", "gray80") + minute_hand = Turtle() + minute_hand.shape("minute_hand") + minute_hand.color("blue1", "red1") + hour_hand = Turtle() + hour_hand.shape("hour_hand") + hour_hand.color("blue3", "red3") + for hand in second_hand, minute_hand, hour_hand: + hand.resizemode("user") + hand.shapesize(1, 1, 3) + hand.speed(0) + ht() + writer = Turtle() + #writer.mode("logo") + writer.ht() + writer.pu() + writer.bk(85) + + +def wochentag(t): + wochentag = ["Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "Sunday"] + return wochentag[t.weekday()] + +def datum(z): + monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June", + "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."] + j = z.year + m = monat[z.month - 1] + t = z.day + return "%s %d %d" % (m, t, j) + +def tick(): + t = datetime.today() + sekunde = t.second + t.microsecond*0.000001 + minute = t.minute + sekunde/60.0 + stunde = t.hour + minute/60.0 + tracer(False) + writer.clear() + writer.home() + writer.forward(65) + writer.write(wochentag(t), + align="center", font=("Courier", 14, "bold")) + writer.back(150) + writer.write(datum(t), + align="center", font=("Courier", 14, "bold")) + writer.forward(85) + tracer(True) + second_hand.setheading(6*sekunde) + minute_hand.setheading(6*minute) + hour_hand.setheading(30*stunde) + tracer(True) + ontimer(tick, 100) + +def main(): + tracer(False) + setup() + tracer(True) + tick() + return "EVENTLOOP" + +if __name__ == "__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_colormixer.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_colormixer.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,58 @@ +# colormixer + +from turtle import Screen, Turtle, mainloop + +class ColorTurtle(Turtle): + + def __init__(self, x, y): + Turtle.__init__(self) + self.shape("turtle") + self.resizemode("user") + self.shapesize(3,3,5) + self.pensize(10) + self._color = [0,0,0] + self.x = x + self._color[x] = y + self.color(self._color) + self.speed(0) + self.left(90) + self.pu() + self.goto(x,0) + self.pd() + self.sety(1) + self.pu() + self.sety(y) + self.pencolor("gray25") + self.ondrag(self.shift) + + def shift(self, x, y): + self.sety(max(0,min(y,1))) + self._color[self.x] = self.ycor() + self.fillcolor(self._color) + setbgcolor() + +def setbgcolor(): + screen.bgcolor(red.ycor(), green.ycor(), blue.ycor()) + +def main(): + global screen, red, green, blue + screen = Screen() + screen.delay(0) + screen.setworldcoordinates(-1, -0.3, 3, 1.3) + + red = ColorTurtle(0, .5) + green = ColorTurtle(1, .5) + blue = ColorTurtle(2, .5) + setbgcolor() + + writer = Turtle() + writer.ht() + writer.pu() + writer.goto(1,1.15) + writer.write("DRAG!",align="center",font=("Arial",30,("bold","italic"))) + return "EVENTLOOP" + +if __name__ == "__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_fractalcurves.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_fractalcurves.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,137 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_fractalCurves.py + +This program draws two fractal-curve-designs: +(1) A hilbert curve (in a box) +(2) A combination of Koch-curves. + +The CurvesTurtle class and the fractal-curve- +methods are taken from the PythonCard example +scripts for turtle-graphics. +""" +from turtle import * +from time import sleep, clock + +class CurvesTurtle(Pen): + # example derived from + # Turtle Geometry: The Computer as a Medium for Exploring Mathematics + # by Harold Abelson and Andrea diSessa + # p. 96-98 + def hilbert(self, size, level, parity): + if level == 0: + return + # rotate and draw first subcurve with opposite parity to big curve + self.left(parity * 90) + self.hilbert(size, level - 1, -parity) + # interface to and draw second subcurve with same parity as big curve + self.forward(size) + self.right(parity * 90) + self.hilbert(size, level - 1, parity) + # third subcurve + self.forward(size) + self.hilbert(size, level - 1, parity) + # fourth subcurve + self.right(parity * 90) + self.forward(size) + self.hilbert(size, level - 1, -parity) + # a final turn is needed to make the turtle + # end up facing outward from the large square + self.left(parity * 90) + + # Visual Modeling with Logo: A Structural Approach to Seeing + # by James Clayson + # Koch curve, after Helge von Koch who introduced this geometric figure in 1904 + # p. 146 + def fractalgon(self, n, rad, lev, dir): + import math + + # if dir = 1 turn outward + # if dir = -1 turn inward + edge = 2 * rad * math.sin(math.pi / n) + self.pu() + self.fd(rad) + self.pd() + self.rt(180 - (90 * (n - 2) / n)) + for i in range(n): + self.fractal(edge, lev, dir) + self.rt(360 / n) + self.lt(180 - (90 * (n - 2) / n)) + self.pu() + self.bk(rad) + self.pd() + + # p. 146 + def fractal(self, dist, depth, dir): + if depth < 1: + self.fd(dist) + return + self.fractal(dist / 3, depth - 1, dir) + self.lt(60 * dir) + self.fractal(dist / 3, depth - 1, dir) + self.rt(120 * dir) + self.fractal(dist / 3, depth - 1, dir) + self.lt(60 * dir) + self.fractal(dist / 3, depth - 1, dir) + +def main(): + ft = CurvesTurtle() + + ft.reset() + ft.speed(0) + ft.ht() + ft.tracer(1,0) + ft.pu() + + size = 6 + ft.setpos(-33*size, -32*size) + ft.pd() + + ta=clock() + ft.fillcolor("red") + ft.fill(True) + ft.fd(size) + + ft.hilbert(size, 6, 1) + + # frame + ft.fd(size) + for i in range(3): + ft.lt(90) + ft.fd(size*(64+i%2)) + ft.pu() + for i in range(2): + ft.fd(size) + ft.rt(90) + ft.pd() + for i in range(4): + ft.fd(size*(66+i%2)) + ft.rt(90) + ft.fill(False) + tb=clock() + res = "Hilbert: %.2fsec. " % (tb-ta) + + sleep(3) + + ft.reset() + ft.speed(0) + ft.ht() + ft.tracer(1,0) + + ta=clock() + ft.color("black", "blue") + ft.fill(True) + ft.fractalgon(3, 250, 4, 1) + ft.fill(True) + ft.color("red") + ft.fractalgon(3, 200, 4, -1) + ft.fill(False) + tb=clock() + res += "Koch: %.2fsec." % (tb-ta) + return res + +if __name__ == '__main__': + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_lindenmayer_indian.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_lindenmayer_indian.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,119 @@ +#!/usr/bin/python +""" turtle-example-suite: + + xtx_lindenmayer_indian.py + +Each morning women in Tamil Nadu, in southern +India, place designs, created by using rice +flour and known as kolam on the thresholds of +their homes. + +These can be described by Lindenmayer systems, +which can easily be implemented with turtle +graphics and Python. + +Two examples are shown here: +(1) the snake kolam +(2) anklets of Krishna + +Taken from Marcia Ascher: Mathematics +Elsewhere, An Exploration of Ideas Across +Cultures + +""" +################################ +# Mini Lindenmayer tool +############################### + +from turtle import * + +def replace( seq, replacementRules, n ): + for i in range(n): + newseq = "" + for element in seq: + newseq = newseq + replacementRules.get(element,element) + seq = newseq + return seq + +def draw( commands, rules ): + for b in commands: + try: + rules[b]() + except TypeError: + try: + draw(rules[b], rules) + except: + pass + + +def main(): + ################################ + # Example 1: Snake kolam + ################################ + + + def r(): + right(45) + + def l(): + left(45) + + def f(): + forward(7.5) + + snake_rules = {"-":r, "+":l, "f":f, "b":"f+f+f--f--f+f+f"} + snake_replacementRules = {"b": "b+f+b--f--b+f+b"} + snake_start = "b--f--b--f" + + drawing = replace(snake_start, snake_replacementRules, 3) + + reset() + speed(3) + tracer(1,0) + ht() + up() + backward(195) + down() + draw(drawing, snake_rules) + + from time import sleep + sleep(3) + + ################################ + # Example 2: Anklets of Krishna + ################################ + + def A(): + color("red") + circle(10,90) + + def B(): + from math import sqrt + color("black") + l = 5/sqrt(2) + forward(l) + circle(l, 270) + forward(l) + + def F(): + color("green") + forward(10) + + krishna_rules = {"a":A, "b":B, "f":F} + krishna_replacementRules = {"a" : "afbfa", "b" : "afbfbfbfa" } + krishna_start = "fbfbfbfb" + + reset() + speed(0) + tracer(3,0) + ht() + left(45) + drawing = replace(krishna_start, krishna_replacementRules, 3) + draw(drawing, krishna_rules) + tracer(1) + return "Done!" + +if __name__=='__main__': + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_minimal_hanoi.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_minimal_hanoi.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,76 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_minimal_hanoi.py + +A minimal 'Towers of Hanoi' animation: +A tower of 6 discs is transferred from the +left to the right peg. + +An imho quite elegant and concise +implementation using a tower class, which +is derived from the built-in type list. + +Discs are turtles with shape "square", but +stretched to rectangles by shapesize() + --------------------------------------- + To exit press STOP button + --------------------------------------- +""" +from turtle import * + +class Disc(Turtle): + def __init__(self, n): + Turtle.__init__(self, shape="square", visible=False) + self.pu() + self.shapesize(1.5, n*1.5, 2) # square-->rectangle + self.fillcolor(n/6., 0, 1-n/6.) + self.st() + +class Tower(list): + "Hanoi tower, a subclass of built-in type list" + def __init__(self, x): + "create an empty tower. x is x-position of peg" + self.x = x + def push(self, d): + d.setx(self.x) + d.sety(-150+34*len(self)) + self.append(d) + def pop(self): + d = list.pop(self) + d.sety(150) + return d + +def hanoi(n, from_, with_, to_): + if n > 0: + hanoi(n-1, from_, to_, with_) + to_.push(from_.pop()) + hanoi(n-1, with_, from_, to_) + +def play(): + onkey(None,"space") + clear() + hanoi(6, t1, t2, t3) + write("press STOP button to exit", + align="center", font=("Courier", 16, "bold")) + +def main(): + global t1, t2, t3 + ht(); penup(); goto(0, -225) # writer turtle + t1 = Tower(-250) + t2 = Tower(0) + t3 = Tower(250) + # make tower of 6 discs + for i in range(6,0,-1): + t1.push(Disc(i)) + # prepare spartanic user interface ;-) + write("press spacebar to start game", + align="center", font=("Courier", 16, "bold")) + onkey(play, "space") + listen() + return "EVENTLOOP" + +if __name__=="__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_paint.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_paint.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,50 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_paint.py + +A simple eventdriven paint program + +- use left mouse button to move turtle +- middle mouse button to change color +- right mouse button do turn filling on/off + ------------------------------------------- + Play around by clicking into the canvas + using all three mouse buttons. + ------------------------------------------- + To exit press STOP button + ------------------------------------------- +""" +from turtle import * + +def switchupdown(x=0, y=0): + if pen()["pendown"]: + end_fill() + up() + else: + down() + begin_fill() + +def changecolor(x=0, y=0): + global colors + colors = colors[1:]+colors[:1] + color(colors[0]) + +def main(): + global colors + shape("circle") + resizemode("user") + shapesize(.5) + width(3) + colors=["red", "green", "blue", "yellow"] + color(colors[0]) + switchupdown() + onscreenclick(goto,1) + onscreenclick(changecolor,2) + onscreenclick(switchupdown,3) + return "EVENTLOOP" + +if __name__ == "__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_peace.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_peace.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,65 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_peace.py + +A very simple drawing suitable as a beginner's +programming example. + +Uses only commands, which are also available in +old turtle.py. + +Intentionally no variables are used except for the +colorloop: +""" + +from turtle import * + +def main(): + peacecolors = ("red3", "orange", "yellow", + "seagreen4", "orchid4", + "royalblue1", "dodgerblue4") + + reset() + s = Screen() + up() + goto(-320,-195) + width(70) + + for pcolor in peacecolors: + color(pcolor) + down() + forward(640) + up() + backward(640) + left(90) + forward(66) + right(90) + + width(25) + color("white") + goto(0,-170) + down() + + circle(170) + left(90) + forward(340) + up() + left(180) + forward(170) + right(45) + down() + forward(170) + up() + backward(170) + left(90) + down() + forward(170) + up() + + goto(0,300) # vanish if hideturtle() is not available ;-) + return "Done!!" + +if __name__ == "__main__": + main() + mainloop() Added: python/trunk/Demo/turtle/tdemo_penrose.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_penrose.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,181 @@ +#!/usr/bin/python +""" xturtle-example-suite: + + xtx_kites_and_darts.py + +Constructs two aperiodic penrose-tilings, +consisting of kites and darts, by the method +of inflation in six steps. + +Starting points are the patterns "sun" +consisting of five kites and "star" +consisting of five darts. + +For more information see: + http://en.wikipedia.org/wiki/Penrose_tiling + ------------------------------------------- +""" +from turtle import * +from math import cos, pi +from time import clock, sleep + +f = (5**0.5-1)/2.0 # (sqrt(5)-1)/2 -- golden ratio +d = 2 * cos(3*pi/10) + +def kite(l): + fl = f * l + lt(36) + fd(l) + rt(108) + fd(fl) + rt(36) + fd(fl) + rt(108) + fd(l) + rt(144) + +def dart(l): + fl = f * l + lt(36) + fd(l) + rt(144) + fd(fl) + lt(36) + fd(fl) + rt(144) + fd(l) + rt(144) + +def inflatekite(l, n): + if n == 0: + px, py = pos() + h, x, y = int(heading()), round(px,3), round(py,3) + tiledict[(h,x,y)] = True + return + fl = f * l + lt(36) + inflatedart(fl, n-1) + fd(l) + rt(144) + inflatekite(fl, n-1) + lt(18) + fd(l*d) + rt(162) + inflatekite(fl, n-1) + lt(36) + fd(l) + rt(180) + inflatedart(fl, n-1) + lt(36) + +def inflatedart(l, n): + if n == 0: + px, py = pos() + h, x, y = int(heading()), round(px,3), round(py,3) + tiledict[(h,x,y)] = False + return + fl = f * l + inflatekite(fl, n-1) + lt(36) + fd(l) + rt(180) + inflatedart(fl, n-1) + lt(54) + fd(l*d) + rt(126) + inflatedart(fl, n-1) + fd(l) + rt(144) + +def draw(l, n, th=2): + clear() + l = l * f**n + shapesize(l/100.0, l/100.0, th) + for k in tiledict: + h, x, y = k + setpos(x, y) + setheading(h) + if tiledict[k]: + shape("kite") + color("black", (0, 0.75, 0)) + else: + shape("dart") + color("black", (0.75, 0, 0)) + stamp() + +def sun(l, n): + for i in range(5): + inflatekite(l, n) + lt(72) + +def star(l,n): + for i in range(5): + inflatedart(l, n) + lt(72) + +def makeshapes(): + tracer(0) + begin_poly() + kite(100) + end_poly() + register_shape("kite", get_poly()) + begin_poly() + dart(100) + end_poly() + register_shape("dart", get_poly()) + tracer(1) + +def start(): + reset() + ht() + pu() + makeshapes() + resizemode("user") + +def test(l=200, n=4, fun=sun, startpos=(0,0), th=2): + global tiledict + goto(startpos) + setheading(0) + tiledict = {} + a = clock() + tracer(0) + fun(l, n) + b = clock() + draw(l, n, th) + tracer(1) + c = clock() + print "Calculation: %7.4f s" % (b - a) + print "Drawing: %7.4f s" % (c - b) + print "Together: %7.4f s" % (c - a) + nk = len([x for x in tiledict if tiledict[x]]) + nd = len([x for x in tiledict if not tiledict[x]]) + print "%d kites and %d darts = %d pieces." % (nk, nd, nk+nd) + +def demo(fun=sun): + start() + for i in range(8): + a = clock() + test(300, i, fun) + b = clock() + t = b - a + if t < 2: + sleep(2 - t) + +def main(): + #title("Penrose-tiling with kites and darts.") + mode("logo") + bgcolor(0.3, 0.3, 0) + demo(sun) + sleep(2) + demo(star) + pencolor("black") + goto(0,-200) + pencolor(0.7,0.7,1) + write("Please wait...", + align="center", font=('Arial Black', 36, 'bold')) + test(600, 8, startpos=(70, 117)) + return "Done" + +if __name__ == "__main__": + msg = main() + mainloop() Added: python/trunk/Demo/turtle/tdemo_planet_and_moon.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_planet_and_moon.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,113 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_planets_and_moon.py + +Gravitational system simulation using the +approximation method from Feynman-lectures, +p.9-8, using turtlegraphics. + +Example: heavy central body, light planet, +very light moon! +Planet has a circular orbit, moon a stable +orbit around the planet. + +You can hold the movement temporarily by pressing +the left mouse button with mouse over the +scrollbar of the canvas. + +""" +from turtle import Shape, Turtle, mainloop, Vec2D as Vec +from time import sleep + +G = 8 + +class GravSys(object): + def __init__(self): + self.planets = [] + self.t = 0 + self.dt = 0.01 + def init(self): + for p in self.planets: + p.init() + def start(self): + for i in range(10000): + self.t += self.dt + for p in self.planets: + p.step() + +class Star(Turtle): + def __init__(self, m, x, v, gravSys, shape): + Turtle.__init__(self, shape=shape) + self.penup() + self.m = m + self.setpos(x) + self.v = v + gravSys.planets.append(self) + self.gravSys = gravSys + self.resizemode("user") + self.pendown() + def init(self): + dt = self.gravSys.dt + self.a = self.acc() + self.v = self.v + 0.5*dt*self.a + def acc(self): + a = Vec(0,0) + for planet in self.gravSys.planets: + if planet != self: + v = planet.pos()-self.pos() + a += (G*planet.m/abs(v)**3)*v + return a + def step(self): + dt = self.gravSys.dt + self.setpos(self.pos() + dt*self.v) + if self.gravSys.planets.index(self) != 0: + self.setheading(self.towards(self.gravSys.planets[0])) + self.a = self.acc() + self.v = self.v + dt*self.a + +## create compound yellow/blue turtleshape for planets + +def main(): + s = Turtle() + s.reset() + s.tracer(0,0) + s.ht() + s.pu() + s.fd(6) + s.lt(90) + s.begin_poly() + s.circle(6, 180) + s.end_poly() + m1 = s.get_poly() + s.begin_poly() + s.circle(6,180) + s.end_poly() + m2 = s.get_poly() + + planetshape = Shape("compound") + planetshape.addcomponent(m1,"orange") + planetshape.addcomponent(m2,"blue") + s.getscreen().register_shape("planet", planetshape) + s.tracer(1,0) + + ## setup gravitational system + gs = GravSys() + sun = Star(1000000, Vec(0,0), Vec(0,-2.5), gs, "circle") + sun.color("yellow") + sun.shapesize(1.8) + sun.pu() + earth = Star(12500, Vec(210,0), Vec(0,195), gs, "planet") + earth.pencolor("green") + earth.shapesize(0.8) + moon = Star(1, Vec(220,0), Vec(0,295), gs, "planet") + moon.pencolor("blue") + moon.shapesize(0.5) + gs.init() + gs.start() + return "Done!" + +if __name__ == '__main__': + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_tree.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_tree.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,63 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_tree.py + +Displays a 'breadth-first-tree' - in contrast +to the classical Logo tree drawing programs, +which use a depth-first-algorithm. + +Uses: +(1) a tree-generator, where the drawing is +quasi the side-effect, whereas the generator +always yields None. +(2) Turtle-cloning: At each branching point the +current pen is cloned. So in the end there +are 1024 turtles. +""" +from turtle import Turtle, mainloop +from time import clock + +def tree(plist, l, a, f): + """ plist is list of pens + l is length of branch + a is half of the angle between 2 branches + f is factor by which branch is shortened + from level to level.""" + if l > 3: + lst = [] + for p in plist: + p.forward(l) + q = p.clone() + p.left(a) + q.right(a) + lst.append(p) + lst.append(q) + for x in tree(lst, l*f, a, f): + yield None + +def maketree(): + p = Turtle() + p.setundobuffer(None) + p.hideturtle() + p.speed(0) + p.tracer(30,0) + p.left(90) + p.penup() + p.forward(-210) + p.pendown() + t = tree([p], 200, 65, 0.6375) + for x in t: + pass + print len(p.getscreen().turtles()) + +def main(): + a=clock() + maketree() + b=clock() + return "done: %.2f sec." % (b-a) + +if __name__ == "__main__": + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_wikipedia.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_wikipedia.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,65 @@ +""" turtle-example-suite: + + tdemo_wikipedia3.py + +This example is +inspired by the Wikipedia article on turtle +graphics. (See example wikipedia1 for URLs) + +First we create (ne-1) (i.e. 35 in this +example) copies of our first turtle p. +Then we let them perform their steps in +parallel. + +Followed by a complete undo(). +""" +from turtle import Screen, Turtle, mainloop +from time import clock, sleep + +def mn_eck(p, ne,sz): + turtlelist = [p] + #create ne-1 additional turtles + for i in range(1,ne): + q = p.clone() + q.rt(360.0/ne) + turtlelist.append(q) + p = q + for i in range(ne): + c = abs(ne/2.0-i)/(ne*.7) + # let those ne turtles make a step + # in parallel: + for t in turtlelist: + t.rt(360./ne) + t.pencolor(1-c,0,c) + t.fd(sz) + +def main(): + s = Screen() + s.bgcolor("black") + p=Turtle() + p.speed(0) + p.hideturtle() + p.pencolor("red") + p.pensize(3) + + s.tracer(36,0) + + at = clock() + mn_eck(p, 36, 19) + et = clock() + z1 = et-at + + sleep(1) + + at = clock() + while any([t.undobufferentries() for t in s.turtles()]): + for t in s.turtles(): + t.undo() + et = clock() + return "Laufzeit: %.3f sec" % (z1+et-at) + + +if __name__ == '__main__': + msg = main() + print msg + mainloop() Added: python/trunk/Demo/turtle/tdemo_yinyang.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/tdemo_yinyang.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,49 @@ +#!/usr/bin/python +""" turtle-example-suite: + + tdemo_yinyang.py + +Another drawing suitable as a beginner's +programming example. + +The small circles are drawn by the circle +command. + +""" + +from turtle import * + +def yin(radius, color1, color2): + width(3) + color("black") + fill(True) + circle(radius/2., 180) + circle(radius, 180) + left(180) + circle(-radius/2., 180) + color(color1) + fill(True) + color(color2) + left(90) + up() + forward(radius*0.375) + right(90) + down() + circle(radius*0.125) + left(90) + fill(False) + up() + backward(radius*0.375) + down() + left(90) + +def main(): + reset() + yin(200, "white", "black") + yin(200, "black", "white") + ht() + return "Done!" + +if __name__ == '__main__': + main() + mainloop() Added: python/trunk/Demo/turtle/turtle.cfg ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/turtle.cfg Wed Jun 4 08:29:55 2008 @@ -0,0 +1,10 @@ +width = 800 +height = 600 +canvwidth = 1200 +canvheight = 900 +shape = arrow +mode = standard +resizemode = auto +fillcolor = "" +title = Python turtle graphics demo. + Added: python/trunk/Demo/turtle/turtleDemo.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/turtleDemo.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,279 @@ +#!/usr/bin/python +import sys +import os + +from Tkinter import * +from idlelib.Percolator import Percolator +from idlelib.ColorDelegator import ColorDelegator +from idlelib.textView import TextViewer + +import turtle +import time + +STARTUP = 1 +READY = 2 +RUNNING = 3 +DONE = 4 +EVENTDRIVEN = 5 + +menufont = ("Arial", 12, NORMAL) +btnfont = ("Arial", 12, 'bold') +txtfont = ('Lucida Console', 8, 'normal') + +def getExampleEntries(): + cwd = os.getcwd() + if "turtleDemo.py" not in os.listdir(cwd): + print "Directory of turtleDemo must be current working directory!" + print "But in your case this is", cwd + sys.exit() + entries1 = [entry for entry in os.listdir(cwd) if + entry.startswith("tdemo_") and + not entry.endswith(".pyc")] + entries2 = [] + for entry in entries1: + if entry.endswith(".py"): + entries2.append(entry) + else: + path = os.path.join(cwd,entry) + sys.path.append(path) + subdir = [entry] + scripts = [script for script in os.listdir(path) if + script.startswith("tdemo_") and + script.endswith(".py")] + entries2.append(subdir+scripts) + return entries2 + +def showDemoHelp(): + TextViewer(demo.root, "Help on turtleDemo", "demohelp.txt") + +def showAboutDemo(): + TextViewer(demo.root, "About turtleDemo", "about_turtledemo.txt") + +def showAboutTurtle(): + TextViewer(demo.root, "About the new turtle module", "about_turtle.txt") + +class DemoWindow(object): + + def __init__(self, filename=None): #, root=None): + self.root = root = turtle._root = Tk() + root.wm_protocol("WM_DELETE_WINDOW", self._destroy) + + ################# + self.mBar = Frame(root, relief=RAISED, borderwidth=2) + self.mBar.pack(fill=X) + + self.ExamplesBtn = self.makeLoadDemoMenu() + self.OptionsBtn = self.makeHelpMenu() + self.mBar.tk_menuBar(self.ExamplesBtn, self.OptionsBtn) #, QuitBtn) + + root.title('Python turtle-graphics examples') + ################# + self.left_frame = left_frame = Frame(root) + self.text_frame = text_frame = Frame(left_frame) + self.vbar = vbar =Scrollbar(text_frame, name='vbar') + self.text = text = Text(text_frame, + name='text', padx=5, wrap='none', + width=45) + vbar['command'] = text.yview + vbar.pack(side=LEFT, fill=Y) + ##################### + self.hbar = hbar =Scrollbar(text_frame, name='hbar', orient=HORIZONTAL) + hbar['command'] = text.xview + hbar.pack(side=BOTTOM, fill=X) + ##################### + text['yscrollcommand'] = vbar.set + text.config(font=txtfont) + text.config(xscrollcommand=hbar.set) + text.pack(side=LEFT, fill=Y, expand=1) + ##################### + self.output_lbl = Label(left_frame, height= 1,text=" --- ", bg = "#ddf", + font = ("Arial", 16, 'normal')) + self.output_lbl.pack(side=BOTTOM, expand=0, fill=X) + ##################### + text_frame.pack(side=LEFT, fill=BOTH, expand=0) + left_frame.pack(side=LEFT, fill=BOTH, expand=0) + self.graph_frame = g_frame = Frame(root) + + turtle.Screen._root = g_frame + turtle.Screen._canvas = turtle.ScrolledCanvas(g_frame, 800, 600, 1000, 800) + #xturtle.Screen._canvas.pack(expand=1, fill="both") + self.screen = _s_ = turtle.Screen() + self.scanvas = _s_._canvas + #xturtle.RawTurtle.canvases = [self.scanvas] + turtle.RawTurtle.screens = [_s_] + + self.scanvas.pack(side=TOP, fill=BOTH, expand=1) + + self.btn_frame = btn_frame = Frame(g_frame, height=100) + self.start_btn = Button(btn_frame, text=" START ", font=btnfont, fg = "white", + disabledforeground = "#fed", command=self.startDemo) + self.start_btn.pack(side=LEFT, fill=X, expand=1) + self.stop_btn = Button(btn_frame, text=" STOP ", font=btnfont, fg = "white", + disabledforeground = "#fed", command = self.stopIt) + self.stop_btn.pack(side=LEFT, fill=X, expand=1) + self.clear_btn = Button(btn_frame, text=" CLEAR ", font=btnfont, fg = "white", + disabledforeground = "#fed", command = self.clearCanvas) + self.clear_btn.pack(side=LEFT, fill=X, expand=1) + + self.btn_frame.pack(side=TOP, fill=BOTH, expand=0) + self.graph_frame.pack(side=TOP, fill=BOTH, expand=1) + + Percolator(text).insertfilter(ColorDelegator()) + self.dirty = False + self.exitflag = False + if filename: + self.loadfile(filename) + self.configGUI(NORMAL, DISABLED, DISABLED, DISABLED, + "Choose example from menu", "black") + self.state = STARTUP + + def _destroy(self): + self.root.destroy() + sys.exit() + + def configGUI(self, menu, start, stop, clear, txt="", color="blue"): + self.ExamplesBtn.config(state=menu) + + self.start_btn.config(state=start) + if start==NORMAL: + self.start_btn.config(bg="#d00") + else: + self.start_btn.config(bg="#fca") + + self.stop_btn.config(state=stop) + if stop==NORMAL: + self.stop_btn.config(bg="#d00") + else: + self.stop_btn.config(bg="#fca") + self.clear_btn.config(state=clear) + + self.clear_btn.config(state=clear) + if clear==NORMAL: + self.clear_btn.config(bg="#d00") + else: + self.clear_btn.config(bg="#fca") + + self.output_lbl.config(text=txt, fg=color) + + + def makeLoadDemoMenu(self): + CmdBtn = Menubutton(self.mBar, text='Examples', underline=0, font=menufont) + CmdBtn.pack(side=LEFT, padx="2m") + CmdBtn.menu = Menu(CmdBtn) + + for entry in getExampleEntries(): + def loadexample(x): + def emit(): + self.loadfile(x) + return emit + if isinstance(entry,str): + CmdBtn.menu.add_command(label=entry[6:-3], underline=0, font=menufont, + command=loadexample(entry)) + else: + _dir, entries = entry[0], entry[1:] + CmdBtn.menu.choices = Menu(CmdBtn.menu) + for e in entries: + CmdBtn.menu.choices.add_command(label=e[6:-3], underline=0, font=menufont, + command = loadexample(os.path.join(_dir,e))) + + CmdBtn.menu.add_cascade(label=_dir[6:], + menu = CmdBtn.menu.choices, font=menufont ) + + CmdBtn['menu'] = CmdBtn.menu + return CmdBtn + + + def makeHelpMenu(self): + CmdBtn = Menubutton(self.mBar, text='Help', underline=0, font = menufont) + CmdBtn.pack(side=LEFT, padx='2m') + CmdBtn.menu = Menu(CmdBtn) + + CmdBtn.menu.add_command(label='About turtle.py', font=menufont, command=showAboutTurtle) + CmdBtn.menu.add_command(label='turtleDemo - Help', font=menufont, command=showDemoHelp) + CmdBtn.menu.add_command(label='About turtleDemo', font=menufont, command=showAboutDemo) + + CmdBtn['menu'] = CmdBtn.menu + return CmdBtn + + def refreshCanvas(self): + if not self.dirty: return + self.screen.clear() + #self.screen.mode("standard") + self.dirty=False + + def loadfile(self,filename): + self.refreshCanvas() + if os.path.exists(filename) and not os.path.isdir(filename): + # load and display file text + f = open(filename,'r') + chars = f.read() + f.close() + self.text.delete("1.0", "end") + self.text.insert("1.0",chars) + direc, fname = os.path.split(filename) + self.root.title(fname[6:-3]+" - an xturtle example") + self.module = __import__(fname[:-3]) + reload(self.module) + self.configGUI(NORMAL, NORMAL, DISABLED, DISABLED, + "Press start button", "red") + self.state = READY + + def startDemo(self): + self.refreshCanvas() + self.dirty = True + turtle.TurtleScreen._RUNNING = True + self.configGUI(DISABLED, DISABLED, NORMAL, DISABLED, + "demo running...", "black") + self.screen.clear() + self.screen.mode("standard") + self.state = RUNNING + + try: + result = self.module.main() + if result == "EVENTLOOP": + self.state = EVENTDRIVEN + else: + self.state = DONE + except turtle.Terminator: + self.state = DONE + result = "stopped!" + if self.state == DONE: + self.configGUI(NORMAL, NORMAL, DISABLED, NORMAL, + result) + elif self.state == EVENTDRIVEN: + self.exitflag = True + self.configGUI(DISABLED, DISABLED, NORMAL, DISABLED, + "use mouse/keys or STOP", "red") + + def clearCanvas(self): + self.refreshCanvas() + self.scanvas.config(cursor="") + self.configGUI(NORMAL, NORMAL, DISABLED, DISABLED) + + def stopIt(self): + if self.exitflag: + self.clearCanvas() + self.exitflag = False + self.configGUI(NORMAL, NORMAL, DISABLED, DISABLED, + "STOPPED!", "red") + turtle.TurtleScreen._RUNNING = False + #print "stopIT: exitflag = True" + else: + turtle.TurtleScreen._RUNNING = False + #print "stopIt: exitflag = False" + +if __name__ == '__main__': + demo = DemoWindow() + RUN = True + while RUN: + try: + print "ENTERING mainloop" + demo.root.mainloop() + except AttributeError: + print "CRASH!!!- WAIT A MOMENT!" + time.sleep(0.3) + print "GOING ON .." + demo.refreshCanvas() +## time.sleep(1) + except: + RUN = FALSE Added: python/trunk/Demo/turtle/turtledemo_two_canvases.py ============================================================================== --- (empty file) +++ python/trunk/Demo/turtle/turtledemo_two_canvases.py Wed Jun 4 08:29:55 2008 @@ -0,0 +1,49 @@ +#!/usr/bin/python +## DEMONSTRATES USE OF 2 CANVASES, SO CANNOT BE RUN IN DEMOVIEWER! +"""turtle example: Using TurtleScreen and RawTurtle +for drawing on two distinct canvases. +""" +from turtle import TurtleScreen, RawTurtle, TK + +root = TK.Tk() +cv1 = TK.Canvas(root, width=300, height=200, bg="#ddffff") +cv2 = TK.Canvas(root, width=300, height=200, bg="#ffeeee") +cv1.pack() +cv2.pack() + +s1 = TurtleScreen(cv1) +s1.bgcolor(0.85, 0.85, 1) +s2 = TurtleScreen(cv2) +s2.bgcolor(1, 0.85, 0.85) + +p = RawTurtle(s1) +q = RawTurtle(s2) + +p.color("red", "white") +p.width(3) +q.color("blue", "black") +q.width(3) + +for t in p,q: + t.shape("turtle") + t.lt(36) + +q.lt(180) + +for i in range(5): + for t in p, q: + t.fd(50) + t.lt(72) +for t in p,q: + t.lt(54) + t.pu() + t.bk(50) + +## Want to get some info? + +print s1, s2 +print p, q +print s1.turtles() +print s2.turtles() + +TK.mainloop() Modified: python/trunk/Doc/library/turtle.rst ============================================================================== --- python/trunk/Doc/library/turtle.rst (original) +++ python/trunk/Doc/library/turtle.rst Wed Jun 4 08:29:55 2008 @@ -1,312 +1,2002 @@ - +======================================== :mod:`turtle` --- Turtle graphics for Tk ======================================== -.. module:: turtle - :platform: Tk - :synopsis: An environment for turtle graphics. -.. moduleauthor:: Guido van Rossum - - -.. sectionauthor:: Moshe Zadka - - -The :mod:`turtle` module provides turtle graphics primitives, in both an -object-oriented and procedure-oriented ways. Because it uses :mod:`Tkinter` for -the underlying graphics, it needs a version of python installed with Tk support. - -The procedural interface uses a pen and a canvas which are automagically created -when any of the functions are called. - -The :mod:`turtle` module defines the following functions: - - -.. function:: degrees() - - Set angle measurement units to degrees. - - -.. function:: radians() - - Set angle measurement units to radians. - - -.. function:: setup(**kwargs) - - Sets the size and position of the main window. Keywords are: - - * ``width``: either a size in pixels or a fraction of the screen. The default is - 50% of the screen. - - * ``height``: either a size in pixels or a fraction of the screen. The default - is 50% of the screen. - - * ``startx``: starting position in pixels from the left edge of the screen. - ``None`` is the default value and centers the window horizontally on screen. - - * ``starty``: starting position in pixels from the top edge of the screen. - ``None`` is the default value and centers the window vertically on screen. - - Examples:: - - # Uses default geometry: 50% x 50% of screen, centered. - setup() - - # Sets window to 200x200 pixels, in upper left of screen - setup (width=200, height=200, startx=0, starty=0) - - # Sets window to 75% of screen by 50% of screen, and centers it. - setup(width=.75, height=0.5, startx=None, starty=None) - - -.. function:: title(title_str) - - Set the window's title to *title*. - - -.. function:: done() - - Enters the Tk main loop. The window will continue to be displayed until the - user closes it or the process is killed. - - -.. function:: reset() - - Clear the screen, re-center the pen, and set variables to the default values. - - -.. function:: clear() - - Clear the screen. - - -.. function:: tracer(flag) - - Set tracing on/off (according to whether flag is true or not). Tracing means - line are drawn more slowly, with an animation of an arrow along the line. - - -.. function:: speed(speed) - - Set the speed of the turtle. Valid values for the parameter *speed* are - ``'fastest'`` (no delay), ``'fast'``, (delay 5ms), ``'normal'`` (delay 10ms), - ``'slow'`` (delay 15ms), and ``'slowest'`` (delay 20ms). - - .. versionadded:: 2.5 - - -.. function:: delay(delay) - - Set the speed of the turtle to *delay*, which is given in ms. - - .. versionadded:: 2.5 - - -.. function:: forward(distance) - - Go forward *distance* steps. - - -.. function:: backward(distance) - - Go backward *distance* steps. - - -.. function:: left(angle) - - Turn left *angle* units. Units are by default degrees, but can be set via the - :func:`degrees` and :func:`radians` functions. - - -.. function:: right(angle) - - Turn right *angle* units. Units are by default degrees, but can be set via the - :func:`degrees` and :func:`radians` functions. - - -.. function:: up() - - Move the pen up --- stop drawing. - - -.. function:: down() - - Move the pen down --- draw when moving. - - -.. function:: width(width) - - Set the line width to *width*. - - -.. function:: color(s) - color((r, g, b)) - color(r, g, b) - - Set the pen color. In the first form, the color is specified as a Tk color - specification as a string. The second form specifies the color as a tuple of - the RGB values, each in the range [0..1]. For the third form, the color is - specified giving the RGB values as three separate parameters (each in the range - [0..1]). - - -.. function:: write(text[, move]) - - Write *text* at the current pen position. If *move* is true, the pen is moved to - the bottom-right corner of the text. By default, *move* is false. - - -.. function:: fill(flag) - - The complete specifications are rather complex, but the recommended usage is: - call ``fill(1)`` before drawing a path you want to fill, and call ``fill(0)`` - when you finish to draw the path. - - -.. function:: begin_fill() - - Switch turtle into filling mode; Must eventually be followed by a corresponding - end_fill() call. Otherwise it will be ignored. - - .. versionadded:: 2.5 - - -.. function:: end_fill() - - End filling mode, and fill the shape; equivalent to ``fill(0)``. - - .. versionadded:: 2.5 - - -.. function:: circle(radius[, extent]) - - Draw a circle with radius *radius* whose center-point is *radius* units left of - the turtle. *extent* determines which part of a circle is drawn: if not given it - defaults to a full circle. - - If *extent* is not a full circle, one endpoint of the arc is the current pen - position. The arc is drawn in a counter clockwise direction if *radius* is - positive, otherwise in a clockwise direction. In the process, the direction of - the turtle is changed by the amount of the *extent*. - - -.. function:: goto(x, y) - goto((x, y)) - - Go to co-ordinates *x*, *y*. The co-ordinates may be specified either as two - separate arguments or as a 2-tuple. - - -.. function:: towards(x, y) - - Return the angle of the line from the turtle's position to the point *x*, *y*. - The co-ordinates may be specified either as two separate arguments, as a - 2-tuple, or as another pen object. - - .. versionadded:: 2.5 - - -.. function:: heading() - - Return the current orientation of the turtle. - - .. versionadded:: 2.3 - - -.. function:: setheading(angle) - - Set the orientation of the turtle to *angle*. - - .. versionadded:: 2.3 - - -.. function:: position() - - Return the current location of the turtle as an ``(x,y)`` pair. - - .. versionadded:: 2.3 - - -.. function:: setx(x) - - Set the x coordinate of the turtle to *x*. - - .. versionadded:: 2.3 - - -.. function:: sety(y) - - Set the y coordinate of the turtle to *y*. - - .. versionadded:: 2.3 - - -.. function:: window_width() - - Return the width of the canvas window. - - .. versionadded:: 2.3 - - -.. function:: window_height() - - Return the height of the canvas window. - - .. versionadded:: 2.3 - -This module also does ``from math import *``, so see the documentation for the -:mod:`math` module for additional constants and functions useful for turtle -graphics. - - -.. function:: demo() - - Exercise the module a bit. - - -.. exception:: Error - - Exception raised on any error caught by this module. - -For examples, see the code of the :func:`demo` function. - -This module defines the following classes: - - -.. class:: Pen() - - Define a pen. All above functions can be called as a methods on the given pen. - The constructor automatically creates a canvas do be drawn on. - - -.. class:: Turtle() - - Define a pen. This is essentially a synonym for ``Pen()``; :class:`Turtle` is an - empty subclass of :class:`Pen`. - - -.. class:: RawPen(canvas) - - Define a pen which draws on a canvas *canvas*. This is useful if you want to - use the module to create graphics in a "real" program. - - -.. _pen-rawpen-objects: - -Turtle, Pen and RawPen Objects ------------------------------- - -Most of the global functions available in the module are also available as -methods of the :class:`Turtle`, :class:`Pen` and :class:`RawPen` classes, -affecting only the state of the given pen. - -The only method which is more powerful as a method is :func:`degrees`, which -takes an optional argument letting you specify the number of units -corresponding to a full circle: - +------------ +Introduction +------------ + +Turtle graphics is a popular way for introducing programming to +kids. It was part of the original Logo programming language developed +by Wally Feurzig and Seymour Papert in 1966. + +Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it +the command turtle.forward(15), and it moves (on-screen!) 15 pixels in +the direction it is facing, drawing a line as it moves. Give it the +command turtle.left(25), and it rotates in-place 25 degrees clockwise. + +By combining together these and similar commands, intricate shapes and +pictures can easily be drawn. + +The module turtle.py is an extended reimplementation of turtle.py from +the Python standard distribution up to version Python 2.5. + +It tries to keep the merits of turtle.py and to be (nearly) 100% +compatible with it. This means in the first place to enable the +learning programmer to use all the commands, classes and methods +interactively when using the module from within IDLE run with +the -n switch. + +The turtle module provides turtle graphics primitives, in both +object-oriented and procedure-oriented ways. Because it uses Tkinter +for the underlying graphics, it needs a version of python installed +with Tk support. + +The objectoriented interface uses essentially two+two classes: + +1. The TurtleScreen class defines graphics windows as a playground for the + drawing turtles. It's constructor needs a Tk-Canvas or a ScrolledCanvas + as argument. It should be used when turtle.py is used as part of some + application. + + Derived from TurtleScreen is the subclass Screen. Screen is implemented + as sort of singleton, so there can exist only one instance of Screen at a + time. It should be used when turtle.py is used as a standalone tool for + doing graphics. + + All methods of TurtleScreen/Screen also exist as functions, i. e. + as part of the procedure-oriented interface. + +2. RawTurtle (alias: RawPen) defines Turtle-objects which draw on a + TurtleScreen. It's constructor needs a Canvas/ScrolledCanvas/Turtlescreen + as argument, so the RawTurtle objects know where to draw. + + Derived from RawTurtle is the subclass Turtle (alias: Pen), which + draws on "the" Screen - instance which is automatically created, + if not already present. + + All methods of RawTurtle/Turtle also exist as functions, i. e. + part of the procedure-oriented interface. + +The procedural interface uses functions which are derived from the methods +of the classes Screen and Turtle. They have the same names as the +corresponding methods. A screen-object is automativally created +whenever a function derived form a Screen-method is called. An (unnamed) +turtle object is automatically created whenever any of the functions +derived from a Turtle method is called. + +To use multiple turtles an a screen one has to use the objectoriented +interface. + + +IMPORTANT NOTE! + +In the following documentation the argumentlist for functions is given. +--->> Methods, of course, have the additional first argument self <<--- +--->> which is omitted here. <<--- + + +-------------------------------------------------- +OVERVIEW over available Turtle and Screen methods: +-------------------------------------------------- + +(A) TURTLE METHODS: +=================== + +I. TURTLE MOTION +----------------- + +MOVE AND DRAW + forward | fd + back | bk | back + right | rt + left | lt + goto | setpos | setposition + setx + sety + setheading | seth + home + circle + dot + stamp + clearstamp + clearstamps + undo + speed + +TELL TURTLE'S STATE + position | pos + towards + xcor + ycor + heading + distance + +SETTING AND MEASUREMENT + degrees + radians + +II. PEN CONTROL +--------------- + +DRAWING STATE + pendown | pd | down + penup | pu | up + pensize | width + pen + isdown + +COLOR CONTROL + color + pencolor + fillcolor + +FILLING + fill + begin_fill + end_fill + +MORE DRAWING CONTROL + reset + clear + write + +III. TURTLE STATE +----------------- + +VISIBILITY + showturtle | st + hideturtle | ht + isvisible + +APPEARANCE + shape + resizemode + shapesize | turtlesize + settiltangle + tiltangle + tilt + +IV. USING EVENTS +---------------- + onclick + onrelease + ondrag + +V. SPECIAL TURTLE METHODS +------------------------- + begin_poly + end_poly + get_poly + clone + getturtle | getpen + getscreen + setundobuffer + undobufferentries + tracer + window_width + window_height + +..EXCURSUS ABOUT THE USE OF COMPOUND SHAPES +..----------------------------------------- + +(B) METHODS OF TurtleScreen/Screen +================================== + +I. WINDOW CONTROL +----------------- + bgcolor + bgpic + clear | clearscreen + reset | resetscreen + screensize + setworldcoordinates + +II. ANIMATION CONTROL +--------------------- + delay + tracer + update + +III. USING SCREEN EVENTS +------------------------ + listen + onkey + onclick | onscreenclick + ontimer + +IV. SETTINGS AND SPECIAL METHODS +-------------------------------- + mode + colormode + getcanvas + getshapes + register_shape | addshape + turtles + window_height + window_width + +V. METHODS SPECIFIC TO Screen +============================= + bye() + exitonclick() + setup() + title() + +---------------end of OVERVIEW --------------------------- + + + +2. METHODS OF RawTurtle/Turtle AND CORRESPONDING FUNCTIONS +========================================================== + +(I) TURTLE MOTION: +------------------ + +(a) --- MOVE (AND DRAW) + + + .. method:: forward(distance) + .. method:: fd(distance) + distance -- a number (integer or float) + + Move the turtle forward by the specified distance, in the direction + the turtle is headed. + + Example (for a Turtle instance named turtle):: + >>> turtle.position() + (0.00, 0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) + + + .. method:: back(distance) + .. method:: bk(distance) + .. method:: backward(distance) + distance -- a number + + call: back(distance) + --or: bk(distance) + --or: backward(distance) + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example (for a Turtle instance named turtle):: + + >>> turtle.position() + (0.00, 0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00, 0.00) + + + .. method:: right(angle) + .. method:: rt(angle) + angle -- a number (integer or float) + + Turn turtle right by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle):: + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 + + + .. method:: left(angle) + .. method:: lt(angle) + angle -- a number (integer or float) + + Turn turtle left by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle):: + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + + .. method:: goto(x, y=None) + .. method:: setpos(x, y=None) + .. method:: setposition(x, y=None) + x -- a number or a pair/vector of numbers + y -- a number None + + call: goto(x, y) # two coordinates + --or: goto((x, y)) # a pair (tuple) of coordinates + --or: goto(vec) # e.g. as returned by pos() + + Move turtle to an absolute position. If the pen is down, + draw line. Do not change the turtle's orientation. + + Example (for a Turtle instance named turtle):: + >>> tp = turtle.pos() + >>> tp + (0.00, 0.00) + >>> turtle.setpos(60,30) + >>> turtle.pos() + (60.00,30.00) + >>> turtle.setpos((20,80)) + >>> turtle.pos() + (20.00,80.00) + >>> turtle.setpos(tp) + >>> turtle.pos() + (0.00,0.00) + + + .. method:: setx(x) + x -- a number (integer or float) + + Set the turtle's first coordinate to x, leave second coordinate + unchanged. + + Example (for a Turtle instance named turtle):: + >>> turtle.position() + (0.00, 240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00, 240.00) + + + .. method:: sety(y) + y -- a number (integer or float) + + Set the turtle's first coordinate to x, leave second coordinate + unchanged. + + Example (for a Turtle instance named turtle):: + >>> turtle.position() + (0.00, 40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00, -10.00) + + + .. method:: setheading(to_angle) + .. method:: seth(to_angle) + to_angle -- a number (integer or float) + + Set the orientation of the turtle to to_angle. + Here are some common directions in degrees: + + =================== ==================== + standard - mode logo-mode + =================== ==================== + 0 - east 0 - north + 90 - north 90 - east + 180 - west 180 - south + 270 - south 270 - west + =================== ==================== + + Example (for a Turtle instance named turtle):: + >>> turtle.setheading(90) + >>> turtle.heading() + 90 + + + .. method:: home(): + Move turtle to the origin - coordinates (0,0) and set it's + heading to it's start-orientation (which depends on mode). + + Example (for a Turtle instance named turtle):: + >>> turtle.home() + + + .. method:: circle(radius, extent=None, steps=None) + radius -- a number + extent (optional) -- a number + steps (optional) -- an integer + + Draw a circle with given radius. The center is radius units left + of the turtle; extent - an angle - determines which part of the + circle is drawn. If extent is not given, draw the entire circle. + If extent is not a full circle, one endpoint of the arc is the + current pen position. Draw the arc in counterclockwise direction + if radius is positive, otherwise in clockwise direction. Finally + the direction of the turtle is changed by the amount of extent. + + As the circle is approximated by an inscribed regular polygon, + steps determines the number of steps to use. If not given, + it will be calculated automatically. Maybe used to draw regular + polygons. + + call: circle(radius) # full circle + --or: circle(radius, extent) # arc + --or: circle(radius, extent, steps) + --or: circle(radius, steps=6) # 6-sided polygon + + Example (for a Turtle instance named turtle):: + >>> turtle.circle(50) + >>> turtle.circle(120, 180) # semicircle + + + .. method:: dot(size=None, *color) + size -- an integer >= 1 (if given) + color -- a colorstring or a numeric color tuple + + Draw a circular dot with diameter size, using color. If size + is not given, the maximum of pensize+4 and 2*pensize is used. + + Example (for a Turtle instance named turtle):: + >>> turtle.dot() + >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) + + + .. method:: stamp(): + Stamp a copy of the turtle shape onto the canvas at the current + turtle position. Return a stamp_id for that stamp, which can be + used to delete it by calling clearstamp(stamp_id). + + Example (for a Turtle instance named turtle):: + >>> turtle.color("blue") + >>> turtle.stamp() + 13 + >>> turtle.fd(50) + + + .. method:: clearstamp(stampid): + stampid - an integer, must be return value of previous stamp() call. + + Delete stamp with given stampid + + Example (for a Turtle instance named turtle):: + >>> turtle.color("blue") + >>> astamp = turtle.stamp() + >>> turtle.fd(50) + >>> turtle.clearstamp(astamp) + + + .. method:: clearstamps(n=None): + n -- an integer + + Delete all or first/last n of turtle's stamps. + If n is None, delete all of pen's stamps, + else if n > 0 delete first n stamps + else if n < 0 delete last n stamps. + + Example (for a Turtle instance named turtle):: + >>> for i in range(8): + ... turtle.stamp(); turtle.fd(30) + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + + + .. method:: undo(): + undo (repeatedly) the last turtle action(s). Number of available + undo actions is determined by the size of the undobuffer. + + Example (for a Turtle instance named turtle):: + >>> for i in range(4): + turtle.fd(50); turtle.lt(80) + + >>> for i in range(8): + turtle.undo() + + + .. method:: speed(speed=None): + speed -- an integer in the range 0..10 or a speedstring (see below) + + Set the turtle's speed to an integer value in the range 0 .. 10. + If no argument is given: return current speed. + + If input is a number greater than 10 or smaller than 0.5, + speed is set to 0. + Speedstrings are mapped to speedvalues as follows: + + * 'fastest' : 0 + * 'fast' : 10 + * 'normal' : 6 + * 'slow' : 3 + * 'slowest' : 1 + + speeds from 1 to 10 enforce increasingly faster animation of + line drawing and turtle turning. + + Attention: + speed = 0 : *no* animation takes place. forward/back makes turtle jump + and likewise left/right make the turtle turn instantly. + + Example (for a Turtle instance named turtle):: + >>> turtle.speed(3) + + +TELL TURTLE'S STATE +------------------- + + + .. method:: position() + .. method:: pos() + Return the turtle's current location (x,y) (as a Vec2D-vector) + + Example (for a Turtle instance named turtle):: + >>> turtle.pos() + (0.00, 240.00) + + + .. method:: towards(x, y=None) + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Return the angle, between the line from turtle-position to position + specified by x, y and the turtle's start orientation. (Depends on + modes - "standard"/"world" or "logo") + + Example (for a Turtle instance named turtle):: + >>> turtle.pos() + (10.00, 10.00) + >>> turtle.towards(0,0) + 225.0 + + + .. method:: xcor() + Return the turtle's x coordinate + + Example (for a Turtle instance named turtle):: + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.xcor() + 50.0 + + + .. method:: ycor() + Return the turtle's y coordinate + + Example (for a Turtle instance named turtle):: + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.ycor() + 86.6025403784 + + + .. method:: heading() + Return the turtle's current heading (value depends on mode). + + Example (for a Turtle instance named turtle):: + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + + + .. method:: distance(x, y=None) + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Return the distance from the turtle to (x,y) in turtle step units. + + Example (for a Turtle instance named turtle):: + >>> turtle.pos() + (0.00, 0.00) + >>> turtle.distance(30,40) + 50.0 + >>> joe = Turtle() + >>> joe.forward(77) + >>> turtle.distance(joe) + 77.0 + + +SETTINGS FOR MEASUREMENT + + + .. method:: degrees(fullcircle=360.0) + fullcircle - a number + + Set angle measurement units, i. e. set number + of 'degrees' for a full circle. Dafault value is + 360 degrees. + + Example (for a Turtle instance named turtle):: + >>> turtle.left(90) + >>> turtle.heading() + 90 + >>> turtle.degrees(400.0) # angle measurement in gon + >>> turtle.heading() + 100 + + + .. method:: radians() + Set the angle measurement units to radians. + + Example (for a Turtle instance named turtle):: + >>> turtle.heading() + 90 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + + +(II) PEN CONTROL: +----------------- + +DRAWING STATE + + + .. method:: pendown() + .. method:: pd() + .. method:: down() + Pull the pen down -- drawing when moving. + + Example (for a Turtle instance named turtle):: + >>> turtle.pendown() + + + .. method:: penup() + .. method:: pu() + .. method:: up() + Pull the pen up -- no drawing when moving. + + Example (for a Turtle instance named turtle):: + >>> turtle.penup() + + + .. method:: pensize(width=None) + .. method:: width(width=None) + width -- positive number + + Set the line thickness to width or return it. If resizemode is set + to "auto" and turtleshape is a polygon, that polygon is drawn with + the same line thickness. If no argument is given, the current pensize + is returned. + + Example (for a Turtle instance named turtle):: + >>> turtle.pensize() + 1 + turtle.pensize(10) # from here on lines of width 10 are drawn + + + .. method:: pen(pen=None, **pendict) + pen -- a dictionary with some or all of the below listed keys. + **pendict -- one or more keyword-arguments with the below + listed keys as keywords. + + Return or set the pen's attributes in a 'pen-dictionary' + with the following key/value pairs: + + * "shown" : True/False + * "pendown" : True/False + * "pencolor" : color-string or color-tuple + * "fillcolor" : color-string or color-tuple + * "pensize" : positive number + * "speed" : number in range 0..10 + * "resizemode" : "auto" or "user" or "noresize" + * "stretchfactor": (positive number, positive number) + * "outline" : positive number + * "tilt" : number + + This dicionary can be used as argument for a subsequent + pen()-call to restore the former pen-state. Moreover one + or more of these attributes can be provided as keyword-arguments. + This can be used to set several pen attributes in one statement. + + Examples (for a Turtle instance named turtle):: + >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', + 'stretchfactor': (1,1), 'speed': 3} + >>> penstate=turtle.pen() + >>> turtle.color("yellow","") + >>> turtle.penup() + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', + 'stretchfactor': (1,1), 'speed': 3} + >>> p.pen(penstate, fillcolor="green") + >>> p.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', + 'stretchfactor': (1,1), 'speed': 3} + + + .. method:: isdown(self): + Return True if pen is down, False if it's up. + + Example (for a Turtle instance named turtle):: + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + + +COLOR CONTROL + + + .. method:: color(*args) + Return or set pencolor and fillcolor. + + Several input formats are allowed. They use 0, 1, 2, or 3 arguments + as follows: + + - color() + Return the current pencolor and the current fillcolor + as a pair of color specification strings as are returned + by pencolor and fillcolor. + - color(colorstring), color((r,g,b)), color(r,g,b) + inputs as in pencolor, set both, fillcolor and pencolor, + to the given value. + - color(colorstring1, colorstring2), + - color((r1,g1,b1), (r2,g2,b2)) + equivalent to pencolor(colorstring1) and fillcolor(colorstring2) + and analogously, if the other input format is used. + + If turtleshape is a polygon, outline and interior of that polygon + is drawn with the newly set colors. + For more info see: pencolor, fillcolor + + Example (for a Turtle instance named turtle):: + >>> turtle.color('red', 'green') + >>> turtle.color() + ('red', 'green') + >>> colormode(255) + >>> color((40, 80, 120), (160, 200, 240)) + >>> color() + ('#285078', '#a0c8f0') + + + .. method:: pencolor(*args) + Return or set the pencolor. + + Four input formats are allowed: + + - pencolor() + Return the current pencolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - pencolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - pencolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - pencolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the outline of that polygon is drawn + with the newly set pencolor. + + Example (for a Turtle instance named turtle):: + >>> turtle.pencolor('brown') + >>> tup = (0.2, 0.8, 0.55) + >>> turtle.pencolor(tup) + >>> turtle.pencolor() + '#33cc8c' + + + .. method:: fillcolor(*args) + """ Return or set the fillcolor. + + Four input formats are allowed: + + - fillcolor() + Return the current fillcolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - fillcolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - fillcolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - fillcolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + Example (for a Turtle instance named turtle):: + >>> turtle.fillcolor('violet') + >>> col = turtle.pencolor() + >>> turtle.fillcolor(col) + >>> turtle.fillcolor(0, .5, 0) + + + See also: Screen method colormode() + + +FILLING + + + .. method:: fill(flag) + flag -- True/False (or 1/0 respectively) + + Call fill(True) before drawing the shape you want to fill, + and fill(False) when done. When used without argument: return + fillstate (True if filling, False else). + + Example (for a Turtle instance named turtle):: + >>> turtle.fill(True) + >>> for _ in range(3): + ... turtle.forward(100) + ... turtle.left(120) + ... + >>> turtle.fill(False) + + + .. method:: begin_fill() + Called just before drawing a shape to be filled. + + Example (for a Turtle instance named turtle):: + >>> turtle.color("black", "red") + >>> turtle.begin_fill() + >>> turtle.circle(60) + >>> turtle.end_fill() + + + .. method:: end_fill() + Fill the shape drawn after the call begin_fill(). + + Example: See begin_fill() + + +MORE DRAWING CONTROL + + + .. method:: reset() + Delete the turtle's drawings from the screen, re-center the turtle + and set variables to the default values. + + Example (for a Turtle instance named turtle):: + >>> turtle.position() + (0.00,-22.00) + >>> turtle.heading() + 100.0 + >>> turtle.reset() + >>> turtle.position() + (0.00,0.00) + >>> turtle.heading() + 0.0 + + + .. method:: clear() + Delete the turtle's drawings from the screen. Do not move turtle. + State and position of the turtle as well as drawings of other + turtles are not affected. + + Examples (for a Turtle instance named turtle): + >>> turtle.clear() + + + .. method:: write(arg, move=False, align='left', font=('Arial', 8, 'normal')) + arg -- info, which is to be written to the TurtleScreen + move (optional) -- True/False + align (optional) -- one of the strings "left", "center" or right" + font (optional) -- a triple (fontname, fontsize, fonttype) + + Write text - the string representation of arg - at the current + turtle position according to align ("left", "center" or right") + and with the given font. + If move is True, the pen is moved to the bottom-right corner + of the text. By default, move is False. + + Example (for a Turtle instance named turtle):: + >>> turtle.write('Home = ', True, align="center") + >>> turtle.write((0,0), True) + + +TURTLE STATE: +------------- + +VISIBILITY + + + .. method:: showturtle() + .. method:: st() + Makes the turtle visible. + + Example (for a Turtle instance named turtle):: + >>> turtle.hideturtle() + >>> turtle.showturtle() + + + .. method:: hideturtle() + .. method:: ht() + Makes the turtle invisible. + It's a good idea to do this while you're in the middle of + doing some complex drawing, because hiding the turtle speeds + up the drawing observably. + + Example (for a Turtle instance named turtle):: + >>> turtle.hideturtle() + + + .. method:: isvisible(self): + Return True if the Turtle is shown, False if it's hidden. + + Example (for a Turtle instance named turtle):: + >>> turtle.hideturtle() + >>> print turtle.isvisible(): + False + + +APPEARANCE + + + .. method:: shape(name=None) + name -- a string, which is a valid shapename + + Set turtle shape to shape with given name or, if name is not given, + return name of current shape. + Shape with name must exist in the TurtleScreen's shape dictionary. + Initially there are the following polygon shapes: + 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'. + To learn about how to deal with shapes see Screen-method register_shape. + + Example (for a Turtle instance named turtle):: + >>> turtle.shape() + 'arrow' + >>> turtle.shape("turtle") + >>> turtle.shape() + 'turtle' + + + .. method:: resizemode(rmode=None) + rmode -- one of the strings "auto", "user", "noresize" + + Set resizemode to one of the values: "auto", "user", "noresize". + If rmode is not given, return current resizemode. + Different resizemodes have the following effects: + + - "auto" adapts the appearance of the turtle + corresponding to the value of pensize. + - "user" adapts the appearance of the turtle according to the + values of stretchfactor and outlinewidth (outline), + which are set by shapesize() + - "noresize" no adaption of the turtle's appearance takes place. + + resizemode("user") is called by a shapesize when used with arguments. + + Examples (for a Turtle instance named turtle):: + >>> turtle.resizemode("noresize") + >>> turtle.resizemode() + 'noresize' + + + .. method:: shapesize(stretch_wid=None, stretch_len=None, outline=None): + stretch_wid -- positive number + stretch_len -- positive number + outline -- positive number + + Return or set the pen's attributes x/y-stretchfactors and/or outline. + Set resizemode to "user". + If and only if resizemode is set to "user", the turtle will be + displayed stretched according to its stretchfactors: + stretch_wid is stretchfactor perpendicular to it's orientation, + stretch_len is stretchfactor in direction of it's orientation, + outline determines the width of the shapes's outline. + + Examples (for a Turtle instance named turtle):: + >>> turtle.resizemode("user") + >>> turtle.shapesize(5, 5, 12) + >>> turtle.shapesize(outline=8) + + + .. method:: tilt(angle) + angle - a number + + Rotate the turtleshape by angle from its current tilt-angle, + but do NOT change the turtle's heading (direction of movement). + + Examples (for a Turtle instance named turtle):: + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + + + .. method:: settiltangle(angle) + angle -- number + + Rotate the turtleshape to point in the direction specified by angle, + regardless of its current tilt-angle. DO NOT change the turtle's + heading (direction of movement). + + Examples (for a Turtle instance named turtle):: + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.settiltangle(45) + >>> stamp() + >>> turtle.fd(50) + >>> turtle.settiltangle(-45) + >>> stamp() + >>> turtle.fd(50) + + + .. method:: tiltangle() + Return the current tilt-angle, i. e. the angle between the + orientation of the turtleshape and the heading of the turtle + (it's direction of movement). + + Examples (for a Turtle instance named turtle):: + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(45) + >>> turtle.tiltangle() + 45 + + +IV. USING EVENTS +---------------- + + + .. method:: onclick(fun, btn=1, add=None) + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. + + Bind fun to mouse-click event on this turtle on canvas. + If fun is None, existing bindings are removed. + Example for the anonymous turtle, i. e. the procedural way:: + + >>> def turn(x, y): + left(360) + + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed + + + .. method:: onrelease(fun, btn=1, add=None): + """ + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. + + Bind fun to mouse-button-release event on this turtle on canvas. + If fun is None, existing bindings are removed. + + Example (for a MyTurtle instance named turtle): + >>> class MyTurtle(Turtle): + ... def glow(self,x,y): + ... self.fillcolor("red") + ... def unglow(self,x,y): + ... self.fillcolor("") + ... + >>> turtle = MyTurtle() + >>> turtle.onclick(turtle.glow) + >>> turtle.onrelease(turtle.unglow) + ### clicking on turtle turns fillcolor red, + ### unclicking turns it to transparent. + + + .. method:: ondrag(fun, btn=1, add=None): + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. + + Bind fun to mouse-move event on this turtle on canvas. + If fun is None, existing bindings are removed. + + Remark: Every sequence of mouse-move-events on a turtle is preceded + by a mouse-click event on that turtle. + If fun is None, existing bindings are removed. + + Example (for a Turtle instance named turtle): + >>> turtle.ondrag(turtle.goto) + ### Subsequently clicking and dragging a Turtle will move it across + ### the screen thereby producing handdrawings (if pen is down). + + +V. SPECIAL TURTLE METHODS +-------------------------- + + + .. method:: begin_poly(): + Start recording the vertices of a polygon. Current turtle position + is first vertex of polygon. + + Example (for a Turtle instance named turtle): + >>> turtle.begin_poly() + + + .. method:: end_poly(): + Stop recording the vertices of a polygon. Current turtle position is + last vertex of polygon. This will be connected with the first vertex. + + Example (for a Turtle instance named turtle): + >>> turtle.end_poly() + + + .. method:: get_poly(): + Return the lastly recorded polygon. + + Example (for a Turtle instance named turtle): + >>> p = turtle.get_poly() + >>> turtle.register_shape("myFavouriteShape", p) + + + .. method:: clone(): + Create and return a clone of the turtle with same position, heading + and turtle properties. + + Example (for a Turtle instance named mick): + mick = Turtle() + joe = mick.clone() + + + .. method:: getturtle(): + Return the Turtleobject itself. + Only reasonable use: as a function to return the 'anonymous turtle': + + Example: + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + >>> turtles() + [] + + + .. method:: getscreen(): + Return the TurtleScreen object, the turtle is drawing on. + So TurtleScreen-methods can be called for that object. + + Example (for a Turtle instance named turtle): + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + + + .. method:: def setundobuffer(size): + size -- an integer or None + + Set or disable undobuffer. + If size is an integer an empty undobuffer of given size is installed. + Size gives the maximum number of turtle-actions that can be undone + by the undo() method/function. + If size is None, no undobuffer is present. + + Example (for a Turtle instance named turtle): + >>> turtle.setundobuffer(42) + + + .. method:: undobufferentries(): + """Return count of entries in the undobuffer. + + Example (for a Turtle instance named turtle): + >>> while undobufferentries(): + ... undo() + + + .. method:: tracer(flag=None, delay=None) + A replica of the corresponding TurtleScreen-method + *Deprecated since Python 2.6* (as RawTurtle method) + + + .. method:: window_width() + .. method:: window_height() + Both are replicas of the corresponding TurtleScreen-methods + *Deprecated since Python 2.6* (as RawTurtle methods) + + +EXCURSUS ABOUT THE USE OF COMPOUND SHAPES +----------------------------------------- + +To use compound turtle shapes, which consist of several polygons +of different color, you must use the helper class Shape +explicitely as described below: + + 1. Create an empty Shape object of type compound + 2. Add as many components to this object as desired, + using the addcomponent() method: + + .. method:: addcomponent(self, poly, fill, outline=None) + poly -- a polygon + fill -- a color, the poly will be filled with + outline -- a color for the poly's outline (if given) + +So it goes like this:: + + >>> s = Shape("compound") + >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s.addcomponent(poly1, "red", "blue") + >>> poly2 = ((0,0),(10,-5),(-10,-5)) + >>> s.addcomponent(poly2, "blue", "red") + +Now add Shape s to the Screen's shapelist ... +.. and use it:: + + >>> register_shape("myshape", s) + >>> shape("myshape") + + +NOTE 1: addcomponent() is a method of class Shape (not of +Turtle nor Screen) and thus there is NO FUNCTION of the same name. + +NOTE 2: class Shape is used internally by the register_shape method +in different ways. + +The application programmer has to deal with the Shape class +ONLY when using compound shapes like shown above! + +NOTE 3: A short description of the class Shape is in section 4. + + + +3. METHODS OF TurtleScreen/Screen AND CORRESPONDING FUNCTIONS +============================================================= + + +WINDOW CONTROL +-------------- + + + .. method:: bgcolor(*args) + args -- a color string or three numbers in the range 0..colormode + or a 3-tuple of such numbers. + + Set or return backgroundcolor of the TurtleScreen. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + 'orange' + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + '#800080' + + + .. method:: bgpic(picname=None) + picname -- a string, name of a gif-file or "nopic". + + Set background image or return name of current backgroundimage. + If picname is a filename, set the corresponing image as background. + If picname is "nopic", delete backgroundimage, if present. + If picname is None, return the filename of the current backgroundimage. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgpic() + 'nopic' + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + 'landscape.gif' + + + .. method:: clear() + .. method:: clearscreen() + Delete all drawings and all turtles from the TurtleScreen. + Reset empty TurtleScreen to it's initial state: white background, + no backgroundimage, no eventbindings and tracing on. + + Example (for a TurtleScreen instance named screen): + screen.clear() + + *Note*: this method is only available as the function named + clearscreen(). (The function clear() is another one derived from + the Turtle-method clear()!). + + + .. method:: reset() + .. method:: resetscreen() + Reset all Turtles on the Screen to their initial state. + + Example (for a TurtleScreen instance named screen): + >>> screen.reset() + + *Note*: this method is pnly available as the function named + resetscreen(). (The function reset() is another one derived from + the Turtle-method reset()!). + + + .. method:: screensize(canvwidth=None, canvheight=None, bg=None): + canvwidth -- positive integer, new width of canvas in pixels + canvheight -- positive integer, new height of canvas in pixels + bg -- colorstring or color-tupel, new backgroundcolor + + If no arguments are given, return current (canvaswidth, canvasheight) + Resize the canvas, the turtles are drawing on. + Do not alter the drawing window. To observe hidden parts of + the canvas use the scrollbars. (So one can make visible those + parts of a drawing, which were outside the canvas before!) + + Example (for a Turtle instance named turtle): + >>> turtle.screensize(2000,1500) + ### e. g. to search for an erroneously escaped turtle ;-) + + + .. method:: setworldcoordinates(llx, lly, urx, ury): + llx -- a number, x-coordinate of lower left corner of canvas + lly -- a number, y-coordinate of lower left corner of canvas + urx -- a number, x-coordinate of upper right corner of canvas + ury -- a number, y-coordinate of upper right corner of canvas + + Set up user coodinate-system and switch to mode 'world' if necessary. + This performs a screen.reset. If mode 'world' is already active, + all drawings are redrawn according to the new coordinates. + + But *ATTENTION*: in user-defined coordinatesystems angles may appear + distorted. (see Screen.mode()) + + Example (for a TurtleScreen instance named screen): + >>> screen.reset() + >>> screen.setworldcoordinates(-50,-7.5,50,7.5) + >>> for _ in range(72): + ... left(10) + ... + >>> for _ in range(8): + ... left(45); fd(2) # a regular octogon + + +ANIMATION CONTROL +----------------- + + + .. method:: delay(delay=None): + delay -- positive integer + + Set or return the drawing delay in milliseconds. (This is sort of + time interval between two consecutived canvas updates.) The longer + the drawing delay, the slower the animation. + + Optional argument: + Example (for a TurtleScreen instance named screen):: + + >>> screen.delay(15) + >>> screen.delay() + 15 + + + .. method:: tracer(n=None, delay=None): + n -- nonnegative integer + delay -- nonnegative integer + + Turn turtle animation on/off and set delay for update drawings. + If n is given, only each n-th regular screen update is really performed. + (Can be used to accelerate the drawing of complex graphics.) + Second argument sets delay value (see delay()) + + Example (for a TurtleScreen instance named screen): + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + ... fd(dist) + ... rt(90) + ... dist += 2 + + + .. method:: update(): + Perform a TurtleScreen update. To be used, when tracer is turned + off. + + See also RawTurtle/Turtle - method speed() + + +USING SCREEN EVENTS +------------------- + + + .. method:: listen(xdummy=None, ydummy=None): + """Set focus on TurtleScreen (in order to collect key-events) + Dummy arguments are provided in order to be able to pass listen + to the onclick method. + + Example (for a TurtleScreen instance named screen): + >>> screen.listen() + + + .. method:: onkey(fun, key): + fun -- a function with no arguments or None + key -- a string: key (e.g. "a") or key-symbol (e.g. "space") + + Bind fun to key-release event of key. If fun is None, event-bindings + are removed. + Remark: in order to be able to register key-events, TurtleScreen + must have focus. (See method listen.) + + Example (for a TurtleScreen instance named screen + and a Turtle instance named turtle):: + + >>> def f(): + ... fd(50) + ... lt(60) + ... + >>> screen.onkey(f, "Up") + >>> screen.listen() + + + .. method:: onclick(fun, btn=1, add=None): + .. method:: onscreenclick(fun, btn=1, add=None): + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas - or None. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. + + Example (for a TurtleScreen instance named screen and a Turtle instance + named turtle):: + + >>> screen.onclick(turtle.goto) + ### Subsequently clicking into the TurtleScreen will + ### make the turtle move to the clicked point. + >>> screen.onclick(None) + + ### event-binding will be removed + + *Note*: this method is only available as the function named + onscreenclick(). (The function onclick() is a different one derived + from the Turtle-method onclick()!). + + + .. method:: ontimer(fun, t=0): + fun -- a function with no arguments. + t -- a number >= 0 + + Install a timer, which calls fun after t milliseconds. + + Example (for a TurtleScreen instance named screen): + + >>> running = True + >>> def f(): + if running: + fd(50) + lt(60) + screen.ontimer(f, 250) + >>> f() ### makes the turtle marching around + >>> running = False + + +SETTINGS AND SPECIAL METHODS + + + .. method:: mode(mode=None): + mode -- on of the strings 'standard', 'logo' or 'world' + + Set turtle-mode ('standard', 'logo' or 'world') and perform reset. + If mode is not given, current mode is returned. + + Mode 'standard' is compatible with old turtle.py. + Mode 'logo' is compatible with most Logo-Turtle-Graphics. + Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in + this mode angles appear distorted if x/y unit-ratio doesn't equal 1. + + ============ ========================= =================== + Mode Initial turtle heading positive angles + ============ ========================= =================== + 'standard' to the right (east) counterclockwise + 'logo' upward (north) clockwise + ============ ========================= =================== + + Examples:: + >>> mode('logo') # resets turtle heading to north + >>> mode() + 'logo' + + + .. method:: colormode(cmode=None): + cmode -- one of the values 1.0 or 255 + + """Return the colormode or set it to 1.0 or 255. + Subsequently r, g, b values of colortriples have to be in + range 0..cmode. + + Example (for a TurtleScreen instance named screen): + >>> screen.colormode() + 1.0 + >>> screen.colormode(255) + >>> turtle.pencolor(240,160,80) + + + .. method:: getcanvas(): + Return the Canvas of this TurtleScreen. Useful for insiders, who + know what to do with a Tkinter-Canvas ;-) + + Example (for a Screen instance named screen): + >>> cv = screen.getcanvas() + >>> cv + + + + .. method:: getshapes(): + """Return a list of names of all currently available turtle shapes. + + Example (for a TurtleScreen instance named screen): + >>> screen.getshapes() + ['arrow', 'blank', 'circle', ... , 'turtle'] + + + .. method:: register_shape(name, shape=None) + .. method:: addshape(name, shape=None) + Arguments: + (1) name is the name of a gif-file and shape is None. + Installs the corresponding image shape. + !! Image-shapes DO NOT rotate when turning the turtle, + !! so they do not display the heading of the turtle! + (2) name is an arbitrary string and shape is a tuple + of pairs of coordinates. Installs the corresponding + polygon shape + (3) name is an arbitrary string and shape is a + (compound) Shape object. Installs the corresponding + compound shape. (See class Shape.) + + Adds a turtle shape to TurtleScreen's shapelist. Only thusly + registered shapes can be used by issueing the command shape(shapename). + + call: register_shape("turtle.gif") + --or: register_shape("tri", ((0,0), (10,10), (-10,10))) + + Example (for a TurtleScreen instance named screen): + >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3))) + + + .. method:: turtles(): + Return the list of turtles on the screen. + + Example (for a TurtleScreen instance named screen): + >>> for turtle in screen.turtles() + ... turtle.color("red") + + + .. method:: window_height(): + Return the height of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_height() + 480 + + + .. method:: window_width(): + Return the width of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_width() + 640 + + +METHODS SPECIFIC TO Screen, not inherited from TurtleScreen +----------------------------------------------------------- + + + .. method:: bye(): + """Shut the turtlegraphics window. + + This is a method of the Screen-class and not available for + TurtleScreen instances. + + Example (for a TurtleScreen instance named screen): + >>> screen.bye() + + + .. method:: exitonclick(): + Bind bye() method to mouseclick on TurtleScreen. + If "using_IDLE" - value in configuration dictionary is False + (default value), enter mainloop. + Remark: If IDLE with -n switch (no subprocess) is used, this value + should be set to True in turtle.cfg. In this case IDLE's own mainloop + is active also for the client script. + + This is a method of the Screen-class and not available for + TurtleScreen instances. + + Example (for a Screen instance named screen): + >>> screen.exitonclick() + + + .. method:: setup(width=_CFG["width"], height=_CFG["height"], + startx=_CFG["leftright"], starty=_CFG["topbottom"]): + Set the size and position of the main window. + Default values of arguments are stored in the configuration dicionary + and can be changed via a turtle.cfg file. + + width -- as integer a size in pixels, as float a fraction of the screen. + Default is 50% of screen. + height -- as integer the height in pixels, as float a fraction of the + screen. Default is 75% of screen. + startx -- if positive, starting position in pixels from the left + edge of the screen, if negative from the right edge + Default, startx=None is to center window horizontally. + starty -- if positive, starting position in pixels from the top + edge of the screen, if negative from the bottom edge + Default, starty=None is to center window vertically. + + Examples (for a Screen instance named screen):: + >>> screen.setup (width=200, height=200, startx=0, starty=0) + # sets window to 200x200 pixels, in upper left of screen + + >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) + # sets window to 75% of screen by 50% of screen and centers + + + .. method:: title(titlestring): + titlestring -- a string, to appear in the titlebar of the + turtle graphics window. + + Set title of turtle-window to titlestring + + This is a method of the Screen-class and not available for + TurtleScreen instances. + + Example (for a Screen instance named screen): + >>> screen.title("Welcome to the turtle-zoo!") + + + +4. THE PUBLIC CLASSES of the module turtle.py +============================================= + + +class RawTurtle(canvas): + canvas -- a Tkinter-Canvas, a ScrolledCanvas or a TurtleScreen + + Alias: RawPen + + Define a turtle. + A description of the methods follows below. All methods are also + available as functions (to control some anonymous turtle) thus + providing a procedural interface to turtlegraphics + +class Turtle() + Subclass of RawTurtle, has the same interface with the additional + property, that Turtle instances draw on a default Screen object, + which is created automatically, when needed for the first time. + +class TurtleScreen(cv) + cv -- a Tkinter-Canvas + Provides screen oriented methods like setbg etc. + A description of the methods follows below. + +class Screen() + Subclass of TurtleScreen, with four methods added. + All methods are also available as functions to conrtol a unique + Screen instance thus belonging to the procedural interface + to turtlegraphics. This Screen instance is automatically created + when needed for the first time. + +class ScrolledCavas(master) + master -- some Tkinter widget to contain the ScrolledCanvas, i.e. + a Tkinter-canvas with scrollbars added. + Used by class Screen, which thus provides automatically a + ScrolledCanvas as playground for the turtles. + +class Shape(type\_, data) + type --- one of the strings "polygon", "image", "compound" + + Data structure modeling shapes. + The pair type\_, data must be as follows: + + type\_ data + + "polygon" a polygon-tuple, i. e. + a tuple of pairs of coordinates + + "image" an image (in this form only used internally!) + + "compound" None + A compund shape has to be constructed using + the addcomponent method + + addcomponent(self, poly, fill, outline=None) + poly -- polygon, i. e. a tuple of pairs of numbers. + fill -- the fillcolor of the component, + outline -- the outline color of the component. + + Example: + >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s = Shape("compound") + >>> s.addcomponent(poly, "red", "blue") + ### .. add more components and then use register_shape() + + See EXCURSUS ABOUT THE USE OF COMPOUND SHAPES + + +class Vec2D(x, y): + A two-dimensional vector class, used as a helper class + for implementing turtle graphics. + May be useful for turtle graphics programs also. + Derived from tuple, so a vector is a tuple! + + Provides (for a, b vectors, k number): + + * a+b vector addition + * a-b vector subtraction + * a*b inner product + * k*a and a*k multiplication with scalar + * \|a\| absolute value of a + * a.rotate(angle) rotation + + + +V. HELP AND CONFIGURATION +========================= + +This section contains subsections on: + +- how to use help +- how to prepare and use translations of the online-help + into other languages +- how to configure the appearance of the graphics window and + the turtles at startup + + +HOW TO USE HELP: +---------------- + +The public methods of the Screen and Turtle classes are documented +extensively via docstrings. So these can be used as online-help +via the Python help facilities: + +- When using IDLE, tooltips show the signatures and first lines of + the docstrings of typed in function-/method calls. + +- calling help on methods or functions display the docstrings. + Examples:: + + >>> help(Screen.bgcolor) + Help on method bgcolor in module turtle: + + bgcolor(self, *args) unbound turtle.Screen method + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example (for a TurtleScreen instance named screen):: + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + 'orange' + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + '#800080' + + >>> help(Turtle.penup) + Help on method penup in module turtle: + + penup(self) unbound turtle.Turtle method + Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + Example (for a Turtle instance named turtle): + >>> turtle.penup() + +The docstrings of the functions which are derived from methods have +a modified form:: + + >>> help(bgcolor) + Help on function bgcolor in module turtle: + + bgcolor(*args) + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example:: + + >>> bgcolor("orange") + >>> bgcolor() + 'orange' + >>> bgcolor(0.5,0,0.5) + >>> bgcolor() + '#800080' + + >>> help(penup) + Help on function penup in module turtle: + + penup() + Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + Example: + >>> penup() + +These modified docstrings are created automatically together with the +function definitions that are derived from the methods at import time. + + +TRANSLATION OF DOCSTRINGS INTO DIFFERENT LANGUAGES +-------------------------------------------------- + +There is a utility to create a dictionary the keys of which are the +method names and the values of which are the docstrings of the public +methods of the classes Screen and Turtle. + +write_docstringdict(filename="turtle_docstringdict"): + filename -- a string, used as filename + + Create and write docstring-dictionary to a Python script + with the given filename. + This function has to be called explicitely, (it is not used by the + turtle-graphics classes). The docstring dictionary will be written + to the Python script .py It is intended to serve as a + template for translation of the docstrings into different languages. + +If you (or your students) want to use turtle.py with online help in +your native language. You have to translate the docstrings and save +the resulting file as e.g. turtle_docstringdict_german.py + +If you have an appropriate entry in your turtle.cfg file this dictionary +will be read in at import time and will replace the original English +docstrings. + +At the time of this writing there exist docstring_dicts in German +and in Italian. (Requests please to glingl at aon.at) + + + +HOW TO CONFIGURE SCREEN AND TURTLES +----------------------------------- + +The built-in default configuration mimics the appearance and +behaviour of the old turtle module in order to retain best possible +compatibility with it. + +If you want to use a different configuration which reflects +better the features of this module or which fits better to +your needs, e. g. for use in a classroom, you can prepare +a configuration file turtle.cfg which will be read at import +time and modify the configuration according to it's settings. + +The built in configuration would correspond to the following +turtle.cfg: + +width = 0.5 +height = 0.75 +leftright = None +topbottom = None +canvwidth = 400 +canvheight = 300 +mode = standard +colormode = 1.0 +delay = 10 +undobuffersize = 1000 +shape = classic +pencolor = black +fillcolor = black +resizemode = noresize +visible = True +language = english +exampleturtle = turtle +examplescreen = screen +title = Python Turtle Graphics +using_IDLE = False + +Short explanation of selected entries: + +- The first four lines correspond to the arguments of the + Screen.setup method +- Line 5 and 6 correspond to the arguments of the Method + Screen.screensize +- shape can be any of the built-in shapes, e.g: arrow, turtle, + etc. For more info try help(shape) +- if you want to use no fillcolor (i. e. turtle transparent), + you have to write: + fillcolor = "" + (All not empty strings must not have quotes in the cfg-file!) +- if you want to reflect the turtle its state, you have to use + resizemode = auto +- if you set, e. g.: language = italian + the docstringdict turtle_docstringdict_italian.py will be + loaded at import time (if present on the import path, e.g. in + the same directory as turtle.py +- the entries exampleturtle and examplescreen define the names + of these objects as they occur in the docstrings. The + transformation of method-docstrings to function-docstrings + will delete these names from the docstrings. (See examples in + section on HELP) +- using_IDLE Set this to True if you regularly work with IDLE + and it's -n - switch. ("No subprocess") This will prevent + exitonclick to enter the mainloop. + +There can be a turtle.cfg file in the directory where turtle.py +is stored and an additional one in the currentworkingdirectory. +The latter will override the settings of the first one. + +The turtledemo directory contains a turtle.cfg file. If you +study it as an example and see its effects when running the +demos (preferably not from within the demo-viewer). + + +VI. Demo scripts +================ + +There is a set of demo scripts in the turtledemo directory +located here ... + + ##### please complete info about path ######################## + +It contains: + +- a set of 15 demo scripts demonstrating differet features + of the new module turtle.py +- a Demo-Viewer turtleDemo.py which can be used to view + the sourcecode of the scripts and run them at the same time + 14 of the examples can be accessed via the Examples Menu. + All of them can also be run standalone. +- The example turtledemo_two_canvases.py demonstrates the + simultaneous use of two canvases with the turtle module. + Therefor it only can be run standalone. +- There is a turtle.cfg file in this directory, which also + serves as an example for how to write and use such files. + +The demoscripts are: + ++----------------+------------------------------+-----------------------+ +|Name | description | features | ++----------------+------------------------------+-----------------------+ +|bytedesign | complex classical | tracer, delay | +| | turtlegraphics pattern | update | ++----------------+------------------------------+-----------------------+ +|chaos | graphs verhust dynamics, | worldcoordinates | +| | proofs that you must not | | +| | trust computers computations| | ++----------------+------------------------------+-----------------------+ +|clock | analog clock showing time | turtles as clock's | +| | of your computer | hands, ontimer | ++----------------+------------------------------+-----------------------+ +|colormixer | experiment with r, g, b | ondrag | ++----------------+------------------------------+-----------------------+ +|fractalcurves | Hilbert & Koch | recursion | ++----------------+------------------------------+-----------------------+ +|lindenmayer | ethnomathematics | L-System | +| | (indian kolams) | | ++----------------+------------------------------+-----------------------+ +|minimal_hanoi | Towers of Hanoi | Rectangular Turtles | +| | | as Hanoi-Discs | +| | | (shape, shapesize) | ++----------------+------------------------------+-----------------------+ +|paint | super minimalistic | onclick | +| | drawing program | | ++----------------+------------------------------+-----------------------+ +|peace | elementary | turtle: appearance | +| | | and animation | ++----------------+------------------------------+-----------------------+ +|penrose | aperiodic tiling with | stamp | +| | kites and darts | | ++----------------+------------------------------+-----------------------+ +|planet_and_moon | simulation of | compound shape | +| | gravitational system | Vec2D | ++----------------+------------------------------+-----------------------+ +|tree | a (graphical) breadth | clone | +| | first tree (using generators)| | ++----------------+------------------------------+-----------------------+ +|wikipedia | a pattern from the wikipedia | clone, undo | +| | article on turtle-graphics | | ++----------------+------------------------------+-----------------------+ +|yingyang | another elementary example | circle | ++----------------+------------------------------+-----------------------+ -.. method:: Turtle.degrees([fullcircle]) +turtledemo_two-canvases: two distinct Tkinter-Canvases +are populated with turtles. Uses class RawTurtle. - *fullcircle* is by default 360. This can cause the pen to have any angular units - whatever: give *fullcircle* ``2*pi`` for radians, or 400 for gradians. +Have fun! \ No newline at end of file Modified: python/trunk/Lib/lib-tk/turtle.py ============================================================================== --- python/trunk/Lib/lib-tk/turtle.py (original) +++ python/trunk/Lib/lib-tk/turtle.py Wed Jun 4 08:29:55 2008 @@ -1,294 +1,3142 @@ -# LogoMation-like turtle graphics +# +# turtle.py: a Tkinter based turtle graphics module for Python +# Version 1.0b1 - 31. 5. 2008 +# +# Copyright (C) 2006 - 2008 Gregor Lingl +# email: glingl at aon.at +# +# This software is provided 'as-is', without any express or implied +# warranty. In no event will the authors be held liable for any damages +# arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not +# claim that you wrote the original software. If you use this software +# in a product, an acknowledgment in the product documentation would be +# appreciated but is not required. +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# 3. This notice may not be removed or altered from any source distribution. + """ Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed -by Wally Feurzeig and Seymour Papert in 1966. +by Wally Feurzig and Seymour Papert in 1966. Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.left(25), and it rotates in-place 25 degrees clockwise. -By combining together these and similar commands, intricate shapes and -pictures can easily be drawn. -""" +By combining together these and similar commands, intricate shapes and +pictures can easily be drawn. + +----- turtle.py + +This module is an extended reimplementation of turtle.py from the +Python standard distribution up to Python 2.5. (See: http:\\www.python.org) + +It tries to keep the merits of turtle.py and to be (nearly) 100% +compatible with it. This means in the first place to enable the +learning programmer to use all the commands, classes and methods +interactively when using the module from within IDLE run with +the -n switch. + +Roughly it has the following features added: + +- Better animation of the turtle movements, especially of turning the + turtle. So the turtles can more easily be used as a visual feedback + instrument by the (beginning) programmer. + +- Different turtle shapes, gif-images as turtle shapes, user defined + and user controllable turtle shapes, among them compound + (multicolored) shapes. Turtle shapes can be stgretched and tilted, which + makes turtles zu very versatile geometrical objects. + +- Fine control over turtle movement and screen updates via delay(), + and enhanced tracer() and speed() methods. + +- Aliases for the most commonly used commands, like fd for forward etc., + following the early Logo traditions. This reduces the boring work of + typing long sequences of commands, which often occur in a natural way + when kids try to program fancy pictures on their first encounter with + turtle graphcis. + +- Turtles now have an undo()-method with configurable undo-buffer. + +- Some simple commands/methods for creating event driven programs + (mouse-, key-, timer-events). Especially useful for programming games. + +- A scrollable Canvas class. The default scrollable Canvas can be + extended interactively as needed while playing around with the turtle(s). + +- A TurtleScreen class with methods controlling background color or + background image, window and canvas size and other properties of the + TurtleScreen. + +- There is a method, setworldcoordinates(), to install a user defined + coordinate-system for the TurtleScreen. + +- The implementation uses a 2-vector class named Vec2D, derived from tuple. + This class is public, so it can be imported by the application programmer, + which makes certain types of computations very natural and compact. + +- Appearance of the TurtleScreen and the Turtles at startup/import can be + configured by means of a turtle.cfg configuration file. + The default configuration mimics the appearance of the old turtle module. + +- If configured appropriately the module reads in docstrings from a docstring + dictionary in some different language, supplied separately and replaces + the english ones by those read in. There is a utility function + write_docstringdict() to write a dictionary with the original (english) + docstrings to disc, so it can serve as a template for translations. + +Behind the scenes there are some features included with possible +extensionsin in mind. These will be commented and documented elsewhere. + +""" + +_ver = "turtle 1.0b1 - for Python 2.6 - 30. 5. 2008, 18:08" + +#print _ver + +import Tkinter as TK +import types +import math +import time +import os + +from os.path import isfile, split, join +from copy import deepcopy + +from math import * ## for compatibility with old turtle module + +_tg_classes = ['ScrolledCanvas', 'TurtleScreen', 'Screen', + 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D'] +_tg_screen_functions = ['addshape', 'bgcolor', 'bgpic', 'bye', + 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas', + 'getshapes', 'listen', 'mode', 'onkey', 'onscreenclick', 'ontimer', + 'register_shape', 'resetscreen', 'screensize', 'setup', + 'setworldcoordinates', 'title', 'tracer', 'turtles', 'update', + 'window_height', 'window_width'] +_tg_turtle_functions = ['back', 'backward', 'begin_fill', 'begin_poly', 'bk', + 'circle', 'clear', 'clearstamp', 'clearstamps', 'clone', 'color', + 'degrees', 'distance', 'dot', 'down', 'end_fill', 'end_poly', 'fd', + 'fill', 'fillcolor', 'forward', 'get_poly', 'getpen', 'getscreen', + 'getturtle', 'goto', 'heading', 'hideturtle', 'home', 'ht', 'isdown', + 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd', + 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', + 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', + 'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', + 'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'showturtle', + 'speed', 'st', 'stamp', 'tilt', 'tiltangle', 'towards', 'tracer', + 'turtlesize', 'undo', 'undobufferentries', 'up', 'width', + 'window_height', 'window_width', 'write', 'xcor', 'ycor'] +_tg_utilities = ['write_docstringdict', 'done', 'mainloop'] +_math_functions = ['acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', + 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log', + 'log10', 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh'] + +__all__ = (_tg_classes + _tg_screen_functions + _tg_turtle_functions + + _tg_utilities + _math_functions) + +_alias_list = ['addshape', 'backward', 'bk', 'fd', 'ht', 'lt', 'pd', 'pos', + 'pu', 'rt', 'seth', 'setpos', 'setposition', 'st', + 'turtlesize', 'up', 'width'] + +_CFG = {"width" : 0.5, # Screen + "height" : 0.75, + "canvwidth" : 400, + "canvheight": 300, + "leftright": None, + "topbottom": None, + "mode": "standard", # TurtleScreen + "colormode": 1.0, + "delay": 10, + "undobuffersize": 1000, # RawTurtle + "shape": "classic", + "pencolor" : "black", + "fillcolor" : "black", + "resizemode" : "noresize", + "visible" : True, + "language": "english", # docstrings + "exampleturtle": "turtle", + "examplescreen": "screen", + "title": "Python Turtle Graphics", + "using_IDLE": False + } + +##print "cwd:", os.getcwd() +##print "__file__:", __file__ +## +##def show(dictionary): +## print "==========================" +## for key in sorted(dictionary.keys()): +## print key, ":", dictionary[key] +## print "==========================" +## print + +def config_dict(filename): + """Convert content of config-file into dictionary.""" + f = open(filename, "r") + cfglines = f.readlines() + f.close() + cfgdict = {} + for line in cfglines: + line = line.strip() + if not line or line.startswith("#"): + continue + try: + key, value = line.split("=") + except: + print "Bad line in config-file %s:\n%s" % (filename,line) + continue + key = key.strip() + value = value.strip() + if value in ["True", "False", "None", "''", '""']: + value = eval(value) + else: + try: + if "." in value: + value = float(value) + else: + value = int(value) + except: + pass # value need not be converted + cfgdict[key] = value + return cfgdict + +def readconfig(cfgdict): + """Read config-files, change configuration-dict accordingly. + + If there is a turtle.cfg file in the current working directory, + read it from there. If this contains an importconfig-value, + say 'myway', construct filename turtle_mayway.cfg else use + turtle.cfg and read it from the import-directory, where + turtle.py is located. + Update configuration dictionary first according to config-file, + in the import directory, then according to config-file in the + current working directory. + If no config-file is found, the default configuration is used. + """ + default_cfg = "turtle.cfg" + cfgdict1 = {} + cfgdict2 = {} + if isfile(default_cfg): + cfgdict1 = config_dict(default_cfg) + #print "1. Loading config-file %s from: %s" % (default_cfg, os.getcwd()) + if "importconfig" in cfgdict1: + default_cfg = "turtle_%s.cfg" % cfgdict1["importconfig"] + try: + head, tail = split(__file__) + cfg_file2 = join(head, default_cfg) + except: + cfg_file2 = "" + if isfile(cfg_file2): + #print "2. Loading config-file %s:" % cfg_file2 + cfgdict2 = config_dict(cfg_file2) +## show(_CFG) +## show(cfgdict2) + _CFG.update(cfgdict2) +## show(_CFG) +## show(cfgdict1) + _CFG.update(cfgdict1) +## show(_CFG) + +try: + readconfig(_CFG) +except: + print "No configfile read, reason unknown" + + +class Vec2D(tuple): + """A 2 dimensional vector class, used as a helper class + for implementing turtle graphics. + May be useful for turtle graphics programs also. + Derived from tuple, so a vector is a tuple! + + Provides (for a, b vectors, k number): + a+b vector addition + a-b vector subtraction + a*b inner product + k*a and a*k multiplication with scalar + |a| absolute value of a + a.rotate(angle) rotation + """ + def __new__(cls, x, y): + return tuple.__new__(cls, (x, y)) + def __add__(self, other): + return Vec2D(self[0]+other[0], self[1]+other[1]) + def __mul__(self, other): + if isinstance(other, Vec2D): + return self[0]*other[0]+self[1]*other[1] + return Vec2D(self[0]*other, self[1]*other) + def __rmul__(self, other): + if isinstance(other, int) or isinstance(other, float): + return Vec2D(self[0]*other, self[1]*other) + def __sub__(self, other): + return Vec2D(self[0]-other[0], self[1]-other[1]) + def __neg__(self): + return Vec2D(-self[0], -self[1]) + def __abs__(self): + return (self[0]**2 + self[1]**2)**0.5 + def rotate(self, angle): + """rotate self counterclockwise by angle + """ + perp = Vec2D(-self[1], self[0]) + angle = angle * math.pi / 180.0 + c, s = math.cos(angle), math.sin(angle) + return Vec2D(self[0]*c+perp[0]*s, self[1]*c+perp[1]*s) + def __getnewargs__(self): + return (self[0], self[1]) + def __repr__(self): + return "(%.2f,%.2f)" % self + + +############################################################################## +### From here up to line : Tkinter - Interface for turtle.py ### +### May be replaced by an interface to some different graphcis-toolkit ### +############################################################################## + +## helper functions for Scrolled Canvas, to forward Canvas-methods +## to ScrolledCanvas class + +def __methodDict(cls, _dict): + """helper function for Scrolled Canvas""" + baseList = list(cls.__bases__) + baseList.reverse() + for _super in baseList: + __methodDict(_super, _dict) + for key, value in cls.__dict__.items(): + if type(value) == types.FunctionType: + _dict[key] = value + +def __methods(cls): + """helper function for Scrolled Canvas""" + _dict = {} + __methodDict(cls, _dict) + return _dict.keys() + +__stringBody = ( + 'def %(method)s(self, *args, **kw): return ' + + 'self.%(attribute)s.%(method)s(*args, **kw)') + +def __forwardmethods(fromClass, toClass, toPart, exclude = ()): + """Helper functions for Scrolled Canvas, used to forward + ScrolledCanvas-methods to Tkinter.Canvas class. + """ + _dict = {} + __methodDict(toClass, _dict) + for ex in _dict.keys(): + if ex[:1] == '_' or ex[-1:] == '_': + del _dict[ex] + for ex in exclude: + if _dict.has_key(ex): + del _dict[ex] + for ex in __methods(fromClass): + if _dict.has_key(ex): + del _dict[ex] + + for method, func in _dict.items(): + d = {'method': method, 'func': func} + if type(toPart) == types.StringType: + execString = \ + __stringBody % {'method' : method, 'attribute' : toPart} + exec execString in d + fromClass.__dict__[method] = d[method] + + +class ScrolledCanvas(TK.Frame): + """Modeled after the scrolled canvas class from Grayons's Tkinter book. + + Used as the default canvas, which pops up automatically when + using turtle graphics functions or the Turtle class. + """ + def __init__(self, master, width=500, height=350, + canvwidth=600, canvheight=500): + TK.Frame.__init__(self, master, width=width, height=height) + self._root = self.winfo_toplevel() + self.width, self.height = width, height + self.canvwidth, self.canvheight = canvwidth, canvheight + self.bg = "white" + self._canvas = TK.Canvas(master, width=width, height=height, + bg=self.bg, relief=TK.SUNKEN, borderwidth=2) + self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, + orient=TK.HORIZONTAL) + self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) + self._canvas.configure(xscrollcommand=self.hscroll.set, + yscrollcommand=self.vscroll.set) + self.rowconfigure(0, weight=1, minsize=0) + self.columnconfigure(0, weight=1, minsize=0) + self._canvas.grid(padx=1, in_ = self, pady=1, row=0, + column=0, rowspan=1, columnspan=1, sticky='news') + self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, + column=1, rowspan=1, columnspan=1, sticky='news') + self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, + column=0, rowspan=1, columnspan=1, sticky='news') + self.reset() + self._root.bind('', self.onResize) + + def reset(self, canvwidth=None, canvheight=None, bg = None): + """Ajust canvas and scrollbars according to given canvas size.""" + if canvwidth: + self.canvwidth = canvwidth + if canvheight: + self.canvheight = canvheight + if bg: + self.bg = bg + self._canvas.config(bg=bg, + scrollregion=(-self.canvwidth//2, -self.canvheight//2, + self.canvwidth//2, self.canvheight//2)) + self._canvas.xview_moveto(0.5*(self.canvwidth - self.width + 30) / + self.canvwidth) + self._canvas.yview_moveto(0.5*(self.canvheight- self.height + 30) / + self.canvheight) + self.adjustScrolls() + + + def adjustScrolls(self): + """ Adjust scrollbars according to window- and canvas-size. + """ + cwidth = self._canvas.winfo_width() + cheight = self._canvas.winfo_height() + self._canvas.xview_moveto(0.5*(self.canvwidth-cwidth)/self.canvwidth) + self._canvas.yview_moveto(0.5*(self.canvheight-cheight)/self.canvheight) + if cwidth < self.canvwidth or cheight < self.canvheight: + self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, + column=0, rowspan=1, columnspan=1, sticky='news') + self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, + column=1, rowspan=1, columnspan=1, sticky='news') + else: + self.hscroll.grid_forget() + self.vscroll.grid_forget() + + def onResize(self, event): + """self-explanatory""" + self.adjustScrolls() + + def bbox(self, *args): + """ 'forward' method, which canvas itself has inherited... + """ + return self._canvas.bbox(*args) + + def cget(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + return self._canvas.cget(*args, **kwargs) + + def config(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.config(*args, **kwargs) + + def bind(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.bind(*args, **kwargs) + + def unbind(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.unbind(*args, **kwargs) + + def focus_force(self): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.focus_force() + +__forwardmethods(ScrolledCanvas, TK.Canvas, '_canvas') + + +class _Root(TK.Tk): + """Root class for Screen based on Tkinter.""" + def __init__(self): + TK.Tk.__init__(self) + + def setupcanvas(self, width, height, cwidth, cheight): + self._canvas = ScrolledCanvas(self, width, height, cwidth, cheight) + self._canvas.pack(expand=1, fill="both") + + def _getcanvas(self): + return self._canvas + + def set_geometry(self, width, height, startx, starty): + self.geometry("%dx%d%+d%+d"%(width, height, startx, starty)) + + def ondestroy(self, destroy): + self.wm_protocol("WM_DELETE_WINDOW", destroy) + + def win_width(self): + return self.winfo_screenwidth() + + def win_height(self): + return self.winfo_screenheight() + +Canvas = TK.Canvas + + +class TurtleScreenBase(object): + """Provide the basic graphics functionality. + Interface between Tkinter and turtle.py. + + To port turtle.py to some different graphics toolkit + a corresponding TurtleScreenBase class has to be implemented. + """ + + @staticmethod + def _blankimage(): + """return a blank image object + """ + img = TK.PhotoImage(width=1, height=1) + img.blank() + return img + + @staticmethod + def _image(filename): + """return an image object containing the + imagedata from a gif-file named filename. + """ + return TK.PhotoImage(file=filename) + + def __init__(self, cv): + self.cv = cv + if isinstance(cv, ScrolledCanvas): + w = self.cv.canvwidth + h = self.cv.canvheight + else: # expected: ordinary TK.Canvas + w = int(self.cv.cget("width")) + h = int(self.cv.cget("height")) + self.cv.config(scrollregion = (-w//2, -h//2, w//2, h//2 )) + self.canvwidth = w + self.canvheight = h + self.xscale = self.yscale = 1.0 + + def _createpoly(self): + """Create an invisible polygon item on canvas self.cv) + """ + return self.cv.create_polygon((0, 0, 0, 0, 0, 0), fill="", outline="") + + def _drawpoly(self, polyitem, coordlist, fill=None, + outline=None, width=None, top=False): + """Configure polygonitem polyitem according to provided + arguments: + coordlist is sequence of coordinates + fill is filling color + outline is outline color + top is a boolean value, which specifies if polyitem + will be put on top of the canvas' displaylist so it + will not be covered by other items. + """ + cl = [] + for x, y in coordlist: + cl.append(x * self.xscale) + cl.append(-y * self.yscale) + self.cv.coords(polyitem, *cl) + if fill is not None: + self.cv.itemconfigure(polyitem, fill=fill) + if outline is not None: + self.cv.itemconfigure(polyitem, outline=outline) + if width is not None: + self.cv.itemconfigure(polyitem, width=width) + if top: + self.cv.tag_raise(polyitem) + + def _createline(self): + """Create an invisible line item on canvas self.cv) + """ + return self.cv.create_line(0, 0, 0, 0, fill="", width=2, + capstyle = TK.ROUND) + + def _drawline(self, lineitem, coordlist=None, + fill=None, width=None, top=False): + """Configure lineitem according to provided arguments: + coordlist is sequence of coordinates + fill is drawing color + width is width of drawn line. + top is a boolean value, which specifies if polyitem + will be put on top of the canvas' displaylist so it + will not be covered by other items. + """ + if coordlist is not None: + cl = [] + for x, y in coordlist: + cl.append(x * self.xscale) + cl.append(-y * self.yscale) + self.cv.coords(lineitem, *cl) + if fill is not None: + self.cv.itemconfigure(lineitem, fill=fill) + if width is not None: + self.cv.itemconfigure(lineitem, width=width) + if top: + self.cv.tag_raise(lineitem) + + def _delete(self, item): + """Delete graphics item from canvas. + If item is"all" delete all graphics items. + """ + self.cv.delete(item) + + def _update(self): + """Redraw graphics items on canvas + """ + self.cv.update() + + def _delay(self, delay): + """Delay subsequent canvas actions for delay ms.""" + self.cv.after(delay) + + def _iscolorstring(self, color): + """Check if the string color is a legal Tkinter color string. + """ + try: + rgb = self.cv.winfo_rgb(color) + ok = True + except TK.TclError: + ok = False + return ok + + def _bgcolor(self, color=None): + """Set canvas' backgroundcolor if color is not None, + else return backgroundcolor.""" + if color is not None: + self.cv.config(bg = color) + self._update() + else: + return self.cv.cget("bg") + + def _write(self, pos, txt, align, font, pencolor): + """Write txt at pos in canvas with specified font + and color. + Return text item and x-coord of right bottom corner + of text's bounding box.""" + x, y = pos + x = x * self.xscale + y = y * self.yscale + anchor = {"left":"sw", "center":"s", "right":"se" } + item = self.cv.create_text(x-1, -y, text = txt, anchor = anchor[align], + fill = pencolor, font = font) + x0, y0, x1, y1 = self.cv.bbox(item) + self.cv.update() + return item, x1-1 + +## def _dot(self, pos, size, color): +## """may be implemented for some other graphics toolkit""" + + def _onclick(self, item, fun, num=1, add=None): + """Bind fun to mouse-click event on turtle. + fun must be a function with two arguments, the coordinates + of the clicked point on the canvas. + num, the number of the mouse-button defaults to 1 + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.tag_bind(item, "" % num, eventfun, add) + + def _onrelease(self, item, fun, num=1, add=None): + """Bind fun to mouse-button-release event on turtle. + fun must be a function with two arguments, the coordinates + of the point on the canvas where mouse button is released. + num, the number of the mouse-button defaults to 1 + + If a turtle is clicked, first _onclick-event will be performed, + then _onscreensclick-event. + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.tag_bind(item, "" % num, + eventfun, add) + + def _ondrag(self, item, fun, num=1, add=None): + """Bind fun to mouse-move-event (with pressed mouse button) on turtle. + fun must be a function with two arguments, the coordinates of the + actual mouse position on the canvas. + num, the number of the mouse-button defaults to 1 + + Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + try: + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + except: + pass + self.cv.tag_bind(item, "" % num, eventfun, add) + + def _onscreenclick(self, fun, num=1, add=None): + """Bind fun to mouse-click event on canvas. + fun must be a function with two arguments, the coordinates + of the clicked point on the canvas. + num, the number of the mouse-button defaults to 1 + + If a turtle is clicked, first _onclick-event will be performed, + then _onscreensclick-event. + """ + if fun is None: + self.cv.unbind("" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.bind("" % num, eventfun, add) + + def _onkey(self, fun, key): + """Bind fun to key-release event of key. + Canvas must have focus. See method listen + """ + if fun is None: + self.cv.unbind("" % key, None) + else: + def eventfun(event): + fun() + self.cv.bind("" % key, eventfun) + + def _listen(self): + """Set focus on canvas (in order to collect key-events) + """ + self.cv.focus_force() + + def _ontimer(self, fun, t): + """Install a timer, which calls fun after t milliseconds. + """ + if t == 0: + self.cv.after_idle(fun) + else: + self.cv.after(t, fun) + + def _createimage(self, image): + """Create and return image item on canvas. + """ + return self.cv.create_image(0, 0, image=image) + + def _drawimage(self, item, (x, y), image): + """Configure image item as to draw image object + at position (x,y) on canvas) + """ + self.cv.coords(item, (x, -y)) + self.cv.itemconfig(item, image=image) + + def _setbgpic(self, item, image): + """Configure image item as to draw image object + at center of canvas. Set item to the first item + in the displaylist, so it will be drawn below + any other item .""" + self.cv.itemconfig(item, image=image) + self.cv.tag_lower(item) + + def _type(self, item): + """Return 'line' or 'polygon' or 'image' depending on + type of item. + """ + return self.cv.type(item) + + def _pointlist(self, item): + """returns list of coordinate-pairs of points of item + Example (for insiders): + >>> from turtle import * + >>> getscreen()._pointlist(getturtle().turtle._item) + [(0.0, 9.9999999999999982), (0.0, -9.9999999999999982), + (9.9999999999999982, 0.0)] + >>> """ + cl = self.cv.coords(item) + pl = [(cl[i], -cl[i+1]) for i in range(0, len(cl), 2)] + return pl + + def _setscrollregion(self, srx1, sry1, srx2, sry2): + self.cv.config(scrollregion=(srx1, sry1, srx2, sry2)) + + def _rescale(self, xscalefactor, yscalefactor): + items = self.cv.find_all() + for item in items: + coordinates = self.cv.coords(item) + newcoordlist = [] + while coordinates: + x, y = coordinates[:2] + newcoordlist.append(x * xscalefactor) + newcoordlist.append(y * yscalefactor) + coordinates = coordinates[2:] + self.cv.coords(item, *newcoordlist) + + def _resize(self, canvwidth=None, canvheight=None, bg=None): + """Resize the canvas, the turtles are drawing on. Does + not alter the drawing window. + """ + # needs amendment + if not isinstance(self.cv, ScrolledCanvas): + return self.canvwidth, self.canvheight + if canvwidth is None and canvheight is None and bg is None: + return self.cv.canvwidth, self.cv.canvheight + if canvwidth is not None: + self.canvwidth = canvwidth + if canvheight is not None: + self.canvheight = canvheight + self.cv.reset(canvwidth, canvheight, bg) + + def _window_size(self): + """ Return the width and height of the turtle window. + """ + width = self.cv.winfo_width() + if width <= 1: # the window isn't managed by a geometry manager + width = self.cv['width'] + height = self.cv.winfo_height() + if height <= 1: # the window isn't managed by a geometry manager + height = self.cv['height'] + return width, height + + +############################################################################## +### End of Tkinter - interface ### +############################################################################## + + +class Terminator (Exception): + """Will be raised in TurtleScreen.update, if _RUNNING becomes False. + + Thus stops execution of turtle graphics script. Main purpose: use in + in the Demo-Viewer turtle.Demo.py. + """ + pass + + +class TurtleGraphicsError(Exception): + """Some TurtleGraphics Error + """ + + +class Shape(object): + """Data structure modeling shapes. + + attribute _type is one of "polygon", "image", "compound" + attribute _data is - depending on _type a poygon-tuple, + an image or a list constructed using the addcomponent method. + """ + def __init__(self, type_, data=None): + self._type = type_ + if type_ == "polygon": + if isinstance(data, list): + data = tuple(data) + elif type_ == "image": + if isinstance(data, str): + if data.lower().endswith(".gif") and isfile(data): + data = TurtleScreen._image(data) + # else data assumed to be Photoimage + elif type_ == "compound": + data = [] + else: + raise TurtleGraphicsError("There is no shape type %s" % type_) + self._data = data + + def addcomponent(self, poly, fill, outline=None): + """Add component to a shape of type compound. + + Arguments: poly is a polygon, i. e. a tuple of number pairs. + fill is the fillcolor of the component, + outline is the outline color of the component. + + call (for a Shapeobject namend s): + -- s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue") + + Example: + >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s = Shape("compound") + >>> s.addcomponent(poly, "red", "blue") + ### .. add more components and then use register_shape() + """ + if self._type != "compound": + raise TurtleGraphicsError("Cannot add component to %s Shape" + % self._type) + if outline is None: + outline = fill + self._data.append([poly, fill, outline]) + + +class Tbuffer(object): + """Ring buffer used as undobuffer for RawTurtle objects.""" + def __init__(self, bufsize=10): + self.bufsize = bufsize + self.buffer = [[None]] * bufsize + self.ptr = -1 + self.cumulate = False + def reset(self, bufsize=None): + if bufsize is None: + for i in range(self.bufsize): + self.buffer[i] = [None] + else: + self.bufsize = bufsize + self.buffer = [[None]] * bufsize + self.ptr = -1 + def push(self, item): + if self.bufsize > 0: + if not self.cumulate: + self.ptr = (self.ptr + 1) % self.bufsize + self.buffer[self.ptr] = item + else: + self.buffer[self.ptr].append(item) + def pop(self): + if self.bufsize > 0: + item = self.buffer[self.ptr] + if item is None: + return None + else: + self.buffer[self.ptr] = [None] + self.ptr = (self.ptr - 1) % self.bufsize + return (item) + def nr_of_items(self): + return self.bufsize - self.buffer.count([None]) + def __repr__(self): + return str(self.buffer) + " " + str(self.ptr) + + + +class TurtleScreen(TurtleScreenBase): + """Provides screen oriented methods like setbg etc. + + Only relies upon the methods of TurtleScreenBase and NOT + upon components of the underlying graphics toolkit - + which is Tkinter in this case. + """ +# _STANDARD_DELAY = 5 + _RUNNING = True + + def __init__(self, cv, mode=_CFG["mode"], + colormode=_CFG["colormode"], delay=_CFG["delay"]): + self._shapes = { + "arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))), + "turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7), + (-7,9), (-9,8), (-6,5), (-7,1), (-5,-3), (-8,-6), + (-6,-8), (-4,-5), (0,-7), (4,-5), (6,-8), (8,-6), + (5,-3), (7,1), (6,5), (9,8), (7,9), (4,7), (1,10), + (2,14))), + "circle" : Shape("polygon", ((10,0), (9.51,3.09), (8.09,5.88), + (5.88,8.09), (3.09,9.51), (0,10), (-3.09,9.51), + (-5.88,8.09), (-8.09,5.88), (-9.51,3.09), (-10,0), + (-9.51,-3.09), (-8.09,-5.88), (-5.88,-8.09), + (-3.09,-9.51), (-0.00,-10.00), (3.09,-9.51), + (5.88,-8.09), (8.09,-5.88), (9.51,-3.09))), + "square" : Shape("polygon", ((10,-10), (10,10), (-10,10), + (-10,-10))), + "triangle" : Shape("polygon", ((10,-5.77), (0,11.55), + (-10,-5.77))), + "classic": Shape("polygon", ((0,0),(-5,-9),(0,-7),(5,-9))), + "blank" : Shape("image", self._blankimage()) + } + + self._bgpics = {"nopic" : ""} + + TurtleScreenBase.__init__(self, cv) + self._mode = mode + self._delayvalue = delay + self._colormode = _CFG["colormode"] + self._keys = [] + self.clear() + + def clear(self): + """Delete all drawings and all turtles from the TurtleScreen. + + Reset empty TurtleScreen to it's initial state: white background, + no backgroundimage, no eventbindings and tracing on. + + No argument. + + Example (for a TurtleScreen instance named screen): + screen.clear() + + Note: this method is not available as function. + """ + self._delayvalue = _CFG["delay"] + self._colormode = _CFG["colormode"] + self._delete("all") + self._bgpic = self._createimage("") + self._bgpicname = "nopic" + self._tracing = 1 + self._updatecounter = 0 + self._turtles = [] + self.bgcolor("white") + for btn in 1, 2, 3: + self.onclick(None, btn) + for key in self._keys[:]: + self.onkey(None, key) + Turtle._pen = None + + def mode(self, mode=None): + """Set turtle-mode ('standard', 'logo' or 'world') and perform reset. + + Optional argument: + mode -- on of the strings 'standard', 'logo' or 'world' + + Mode 'standard' is compatible with turtle.py. + Mode 'logo' is compatible with most Logo-Turtle-Graphics. + Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in + this mode angles appear distorted if x/y unit-ratio doesn't equal 1. + If mode is not given, return the current mode. + + Mode Initial turtle heading positive angles + ------------|-------------------------|------------------- + 'standard' to the right (east) counterclockwise + 'logo' upward (north) clockwise + + Examples: + >>> mode('logo') # resets turtle heading to north + >>> mode() + 'logo' + """ + if mode == None: + return self._mode + mode = mode.lower() + if mode not in ["standard", "logo", "world"]: + raise TurtleGraphicsError("No turtle-graphics-mode %s" % mode) + self._mode = mode + if mode in ["standard", "logo"]: + self._setscrollregion(-self.canvwidth//2, -self.canvheight//2, + self.canvwidth//2, self.canvheight//2) + self.xscale = self.yscale = 1.0 + self.reset() + + def setworldcoordinates(self, llx, lly, urx, ury): + """Set up a user defined coordinate-system. + + Arguments: + llx -- a number, x-coordinate of lower left corner of canvas + lly -- a number, y-coordinate of lower left corner of canvas + urx -- a number, x-coordinate of upper right corner of canvas + ury -- a number, y-coordinate of upper right corner of canvas + + Set up user coodinat-system and switch to mode 'world' if necessary. + This performs a screen.reset. If mode 'world' is already active, + all drawings are redrawn according to the new coordinates. + + But ATTENTION: in user-defined coordinatesystems angles may appear + distorted. (see Screen.mode()) + + Example (for a TurtleScreen instance named screen): + >>> screen.setworldcoordinates(-10,-0.5,50,1.5) + >>> for _ in range(36): + left(10) + forward(0.5) + """ + if self.mode() != "world": + self.mode("world") + xspan = float(urx - llx) + yspan = float(ury - lly) + wx, wy = self._window_size() + self.screensize(wx-20, wy-20) + oldxscale, oldyscale = self.xscale, self.yscale + self.xscale = self.canvwidth / xspan + self.yscale = self.canvheight / yspan + srx1 = llx * self.xscale + sry1 = -ury * self.yscale + srx2 = self.canvwidth + srx1 + sry2 = self.canvheight + sry1 + self._setscrollregion(srx1, sry1, srx2, sry2) + self._rescale(self.xscale/oldxscale, self.yscale/oldyscale) + self.update() + + def register_shape(self, name, shape=None): + """Adds a turtle shape to TurtleScreen's shapelist. + + Arguments: + (1) name is the name of a gif-file and shape is None. + Installs the corresponding image shape. + !! Image-shapes DO NOT rotate when turning the turtle, + !! so they do not display the heading of the turtle! + (2) name is an arbitrary string and shape is a tuple + of pairs of coordinates. Installs the corresponding + polygon shape + (3) name is an arbitrary string and shape is a + (compound) Shape object. Installs the corresponding + compound shape. + To use a shape, you have to issue the command shape(shapename). + + call: register_shape("turtle.gif") + --or: register_shape("tri", ((0,0), (10,10), (-10,10))) + + Example (for a TurtleScreen instance named screen): + >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3))) + + """ + if shape is None: + # image + if name.lower().endswith(".gif"): + shape = Shape("image", self._image(name)) + else: + raise TurtleGraphicsError("Bad arguments for register_shape.\n" + + "Use help(register_shape)" ) + elif isinstance(shape, tuple): + shape = Shape("polygon", shape) + ## else shape assumed to be Shape-instance + self._shapes[name] = shape + # print "shape added:" , self._shapes + + def _colorstr(self, color): + """Return color string corresponding to args. + + Argument may be a string or a tuple of three + numbers corresponding to actual colormode, + i.e. in the range 0<=n<=colormode. + + If the argument doesn't represent a color, + an error is raised. + """ + if len(color) == 1: + color = color[0] + if isinstance(color, str): + if self._iscolorstring(color) or color == "": + return color + else: + raise TurtleGraphicsError("bad color string: %s" % str(color)) + try: + r, g, b = color + except: + raise TurtleGraphicsError("bad color arguments: %s" % str(color)) + if self._colormode == 1.0: + r, g, b = [round(255.0*x) for x in (r, g, b)] + if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)): + raise TurtleGraphicsError("bad color sequence: %s" % str(color)) + return "#%02x%02x%02x" % (r, g, b) + + def _color(self, cstr): + if not cstr.startswith("#"): + return cstr + if len(cstr) == 7: + cl = [int(cstr[i:i+2], 16) for i in (1, 3, 5)] + elif len(cstr) == 4: + cl = [16*int(cstr[h], 16) for h in cstr[1:]] + else: + raise TurtleGraphicsError("bad colorstring: %s" % cstr) + return tuple([c * self._colormode/255 for c in cl]) + + def colormode(self, cmode=None): + """Return the colormode or set it to 1.0 or 255. + + Optional argument: + cmode -- one of the values 1.0 or 255 + + r, g, b values of colortriples have to be in range 0..cmode. + + Example (for a TurtleScreen instance named screen): + >>> screen.colormode() + 1.0 + >>> screen.colormode(255) + >>> turtle.pencolor(240,160,80) + """ + if cmode is None: + return self._colormode + if cmode == 1.0: + self._colormode = float(cmode) + elif cmode == 255: + self._colormode = int(cmode) + + def reset(self): + """Reset all Turtles on the Screen to their initial state. + + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.reset() + """ + for turtle in self._turtles: + turtle._setmode(self._mode) + turtle.reset() + + def turtles(self): + """Return the list of turtles on the screen. + + Example (for a TurtleScreen instance named screen): + >>> screen.turtles() + [] + """ + return self._turtles + + def bgcolor(self, *args): + """Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + 'orange' + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + '#800080' + """ + if args: + color = self._colorstr(args) + else: + color = None + color = self._bgcolor(color) + if color is not None: + color = self._color(color) + return color + + def tracer(self, n=None, delay=None): + """Turns turtle animation on/off and set delay for update drawings. + + Optional arguments: + n -- nonnegative integer + delay -- nonnegative integer + + If n is given, only each n-th regular screen update is really performed. + (Can be used to accelerate the drawing of complex graphics.) + Second arguments sets delay value (see RawTurtle.delay()) + + Example (for a TurtleScreen instance named screen): + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + fd(dist) + rt(90) + dist += 2 + """ + if n is None: + return self._tracing + self._tracing = int(n) + self._updatecounter = 0 + if delay is not None: + self._delayvalue = int(delay) + if self._tracing: + self.update() + + def delay(self, delay=None): + """ Return or set the drawing delay in milliseconds. + + Optional argument: + delay -- positive integer + + Example (for a TurtleScreen instance named screen): + >>> screen.delay(15) + >>> screen.delay() + 15 + """ + if delay is None: + return self._delayvalue + self._delayvalue = int(delay) + + def _incrementudc(self): + "Increment upadate counter.""" + if not TurtleScreen._RUNNING: + TurtleScreen._RUNNNING = True + raise Terminator + if self._tracing > 0: + self._updatecounter += 1 + self._updatecounter %= self._tracing + + def update(self): + """Perform a TurtleScreen update. + """ + for t in self.turtles(): + t._update_data() + t._drawturtle() + self._update() + + def window_width(self): + """ Return the width of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_width() + 640 + """ + return self._window_size()[0] + + def window_height(self): + """ Return the height of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_height() + 480 + """ + return self._window_size()[1] + + def getcanvas(self): + """Return the Canvas of this TurtleScreen. + + No argument. + + Example (for a Screen instance named screen): + >>> cv = screen.getcanvas() + >>> cv + + """ + return self.cv + + def getshapes(self): + """Return a list of names of all currently available turtle shapes. + + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.getshapes() + ['arrow', 'blank', 'circle', ... , 'turtle'] + """ + return sorted(self._shapes.keys()) + + def onclick(self, fun, btn=1, add=None): + """Bind fun to mouse-click event on canvas. + + Arguments: + fun -- a function with two arguments, the coordinates of the + clicked point on the canvas. + num -- the number of the mouse-button, defaults to 1 + + Example (for a TurtleScreen instance named screen + and a Turtle instance named turtle): + + >>> screen.onclick(turtle.goto) + + ### Subsequently clicking into the TurtleScreen will + ### make the turtle move to the clicked point. + >>> screen.onclick(None) + + ### event-binding will be removed + """ + self._onscreenclick(fun, btn, add) + + def onkey(self, fun, key): + """Bind fun to key-release event of key. + + Arguments: + fun -- a function with no arguments + key -- a string: key (e.g. "a") or key-symbol (e.g. "space") + + In order ro be able to register key-events, TurtleScreen + must have focus. (See method listen.) + + Example (for a TurtleScreen instance named screen + and a Turtle instance named turtle): + + >>> def f(): + fd(50) + lt(60) + + + >>> screen.onkey(f, "Up") + >>> screen.listen() + + ### Subsequently the turtle can be moved by + ### repeatedly pressing the up-arrow key, + ### consequently drawing a hexagon + """ + if fun == None: + self._keys.remove(key) + elif key not in self._keys: + self._keys.append(key) + self._onkey(fun, key) + + def listen(self, xdummy=None, ydummy=None): + """Set focus on TurtleScreen (in order to collect key-events) + + No arguments. + Dummy arguments are provided in order + to be able to pass listen to the onclick method. + + Example (for a TurtleScreen instance named screen): + >>> screen.listen() + """ + self._listen() + + def ontimer(self, fun, t=0): + """Install a timer, which calls fun after t milliseconds. + + Arguments: + fun -- a function with no arguments. + t -- a number >= 0 + + Example (for a TurtleScreen instance named screen): + + >>> running = True + >>> def f(): + if running: + fd(50) + lt(60) + screen.ontimer(f, 250) + + >>> f() ### makes the turtle marching around + >>> running = False + """ + self._ontimer(fun, t) + + def bgpic(self, picname=None): + """Set background image or return name of current backgroundimage. + + Optional argument: + picname -- a string, name of a gif-file or "nopic". + + If picname is a filename, set the corresponing image as background. + If picname is "nopic", delete backgroundimage, if present. + If picname is None, return the filename of the current backgroundimage. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgpic() + 'nopic' + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + 'landscape.gif' + """ + if picname is None: + return self._bgpicname + if picname not in self._bgpics: + self._bgpics[picname] = self._image(picname) + self._setbgpic(self._bgpic, self._bgpics[picname]) + self._bgpicname = picname + + def screensize(self, canvwidth=None, canvheight=None, bg=None): + """Resize the canvas, the turtles are drawing on. + + Optional arguments: + canvwidth -- positive integer, new width of canvas in pixels + canvheight -- positive integer, new height of canvas in pixels + bg -- colorstring or color-tupel, new backgroundcolor + If no arguments are given, return current (canvaswidth, canvasheight) + + Do not alter the drawing window. To observe hidden parts of + the canvas use the scrollbars. (Can make visible those parts + of a drawing, which were outside the canvas before!) + + Example (for a Turtle instance named turtle): + >>> turtle.screensize(2000,1500) + ### e. g. to search for an erroneously escaped turtle ;-) + """ + return self._resize(canvwidth, canvheight, bg) + + onscreenclick = onclick + resetscreen = reset + clearscreen = clear + addshape = register_shape + +class TNavigator(object): + """Navigation part of the RawTurtle. + Implements methods for turtle movement. + """ + START_ORIENTATION = { + "standard": Vec2D(1.0, 0.0), + "world" : Vec2D(1.0, 0.0), + "logo" : Vec2D(0.0, 1.0) } + DEFAULT_MODE = "standard" + DEFAULT_ANGLEOFFSET = 0 + DEFAULT_ANGLEORIENT = 1 + + def __init__(self, mode=DEFAULT_MODE): + self._angleOffset = self.DEFAULT_ANGLEOFFSET + self._angleOrient = self.DEFAULT_ANGLEORIENT + self._mode = mode + self.undobuffer = None + self.degrees() + self._mode = None + self._setmode(mode) + TNavigator.reset(self) + + def reset(self): + """reset turtle to its initial values + + Will be overwritten by parent class + """ + self._position = Vec2D(0.0, 0.0) + self._orient = TNavigator.START_ORIENTATION[self._mode] + + def _setmode(self, mode=None): + """Set turtle-mode to 'standard', 'world' or 'logo'. + """ + if mode == None: + return self._mode + if mode not in ["standard", "logo", "world"]: + return + self._mode = mode + if mode in ["standard", "world"]: + self._angleOffset = 0 + self._angleOrient = 1 + else: # mode == "logo": + self._angleOffset = self._fullcircle/4. + self._angleOrient = -1 + + def _setDegreesPerAU(self, fullcircle): + """Helper function for degrees() and radians()""" + self._fullcircle = fullcircle + self._degreesPerAU = 360/fullcircle + if self._mode == "standard": + self._angleOffset = 0 + else: + self._angleOffset = fullcircle/4. + + def degrees(self, fullcircle=360.0): + """ Set angle measurement units to degrees. + + Optional argument: + fullcircle - a number + + Set angle measurement units, i. e. set number + of 'degrees' for a full circle. Dafault value is + 360 degrees. + + Example (for a Turtle instance named turtle): + >>> turtle.left(90) + >>> turtle.heading() + 90 + >>> turtle.degrees(400.0) # angle measurement in gon + >>> turtle.heading() + 100 + + """ + self._setDegreesPerAU(fullcircle) + + def radians(self): + """ Set the angle measurement units to radians. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 90 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + """ + self._setDegreesPerAU(2*math.pi) + + def _go(self, distance): + """move turtle forward by specified distance""" + ende = self._position + self._orient * distance + self._goto(ende) + + def _rotate(self, angle): + """Turn turtle counterclockwise by specified angle if angle > 0.""" + angle *= self._degreesPerAU + self._orient = self._orient.rotate(angle) + + def _goto(self, end): + """move turtle to position end.""" + self._position = end + + def forward(self, distance): + """Move the turtle forward by the specified distance. + + Aliases: forward | fd + + Argument: + distance -- a number (integer or float) + + Move the turtle forward by the specified distance, in the direction + the turtle is headed. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) + """ + self._go(distance) + + def back(self, distance): + """Move the turtle backward by distance. + + Aliases: back | backward | bk + + Argument: + distance -- a number + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00, 0.00) + """ + self._go(-distance) + + def right(self, angle): + """Turn turtle right by angle units. + + Aliases: right | rt + + Argument: + angle -- a number (integer or float) + + Turn turtle right by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 + """ + self._rotate(-angle) + + def left(self, angle): + """Turn turtle left by angle units. + + Aliases: left | lt + + Argument: + angle -- a number (integer or float) + + Turn turtle left by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + """ + self._rotate(angle) + + def pos(self): + """Return the turtle's current location (x,y), as a Vec2D-vector. + + Aliases: pos | position + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (0.00, 240.00) + """ + return self._position + + def xcor(self): + """ Return the turtle's x coordinate. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.xcor() + 50.0 + """ + return self._position[0] + + def ycor(self): + """ Return the turtle's y coordinate + --- + No arguments. + + Example (for a Turtle instance named turtle): + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.ycor() + 86.6025403784 + """ + return self._position[1] + + + def goto(self, x, y=None): + """Move turtle to an absolute position. + + Aliases: setpos | setposition | goto: + + Arguments: + x -- a number or a pair/vector of numbers + y -- a number None + + call: goto(x, y) # two coordinates + --or: goto((x, y)) # a pair (tuple) of coordinates + --or: goto(vec) # e.g. as returned by pos() + + Move turtle to an absolute position. If the pen is down, + a line will be drawn. The turtle's orientation does not change. + + Example (for a Turtle instance named turtle): + >>> tp = turtle.pos() + >>> tp + (0.00, 0.00) + >>> turtle.setpos(60,30) + >>> turtle.pos() + (60.00,30.00) + >>> turtle.setpos((20,80)) + >>> turtle.pos() + (20.00,80.00) + >>> turtle.setpos(tp) + >>> turtle.pos() + (0.00,0.00) + """ + if y is None: + self._goto(Vec2D(*x)) + else: + self._goto(Vec2D(x, y)) + + def home(self): + """Move turtle to the origin - coordinates (0,0). + + No arguments. + + Move turtle to the origin - coordinates (0,0) and set it's + heading to it's start-orientation (which depends on mode). + + Example (for a Turtle instance named turtle): + >>> turtle.home() + """ + self.goto(0, 0) + self.setheading(0) + + def setx(self, x): + """Set the turtle's first coordinate to x + + Argument: + x -- a number (integer or float) + + Set the turtle's first coordinate to x, leave second coordinate + unchanged. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00, 240.00) + """ + self._goto(Vec2D(x, self._position[1])) + + def sety(self, y): + """Set the turtle's second coordinate to y + + Argument: + y -- a number (integer or float) + + Set the turtle's first coordinate to x, second coordinate remains + unchanged. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00, -10.00) + """ + self._goto(Vec2D(self._position[0], y)) + + def distance(self, x, y=None): + """Return the distance from the turtle to (x,y) in turtle step units. + + Arguments: + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (0.00, 0.00) + >>> turtle.distance(30,40) + 50.0 + >>> pen = Turtle() + >>> pen.forward(77) + >>> turtle.distance(pen) + 77.0 + """ + if y is not None: + pos = Vec2D(x, y) + if isinstance(x, Vec2D): + pos = x + elif isinstance(x, tuple): + pos = Vec2D(*x) + elif isinstance(x, TNavigator): + pos = x._position + return abs(pos - self._position) + + def towards(self, x, y=None): + """Return the angle of the line from the turtle's position to (x, y). + + Arguments: + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Return the angle, between the line from turtle-position to position + specified by x, y and the turtle's start orientation. (Depends on + modes - "standard" or "logo") + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (10.00, 10.00) + >>> turtle.towards(0,0) + 225.0 + """ + if y is not None: + pos = Vec2D(x, y) + if isinstance(x, Vec2D): + pos = x + elif isinstance(x, tuple): + pos = Vec2D(*x) + elif isinstance(x, TNavigator): + pos = x._position + x, y = pos - self._position + result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0 + result /= self._degreesPerAU + return (self._angleOffset + self._angleOrient*result) % self._fullcircle + + def heading(self): + """ Return the turtle's current heading. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + """ + x, y = self._orient + result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0 + result /= self._degreesPerAU + return (self._angleOffset + self._angleOrient*result) % self._fullcircle + + def setheading(self, to_angle): + """Set the orientation of the turtle to to_angle. + + Aliases: setheading | seth + + Argument: + to_angle -- a number (integer or float) + + Set the orientation of the turtle to to_angle. + Here are some common directions in degrees: + + standard - mode: logo-mode: + -------------------|-------------------- + 0 - east 0 - north + 90 - north 90 - east + 180 - west 180 - south + 270 - south 270 - west + + Example (for a Turtle instance named turtle): + >>> turtle.setheading(90) + >>> turtle.heading() + 90 + """ + angle = (to_angle - self.heading())*self._angleOrient + full = self._fullcircle + angle = (angle+full/2.)%full - full/2. + self._rotate(angle) + + def circle(self, radius, extent = None, steps = None): + """ Draw a circle with given radius. + + Arguments: + radius -- a number + extent (optional) -- a number + steps (optional) -- an integer + + Draw a circle with given radius. The center is radius units left + of the turtle; extent - an angle - determines which part of the + circle is drawn. If extent is not given, draw the entire circle. + If extent is not a full circle, one endpoint of the arc is the + current pen position. Draw the arc in counterclockwise direction + if radius is positive, otherwise in clockwise direction. Finally + the direction of the turtle is changed by the amount of extent. + + As the circle is approximated by an inscribed regular polygon, + steps determines the number of steps to use. If not given, + it will be calculated automatically. Maybe used to draw regular + polygons. + + call: circle(radius) # full circle + --or: circle(radius, extent) # arc + --or: circle(radius, extent, steps) + --or: circle(radius, steps=6) # 6-sided polygon + + Example (for a Turtle instance named turtle): + >>> turtle.circle(50) + >>> turtle.circle(120, 180) # semicircle + """ + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + speed = self.speed() + if extent is None: + extent = self._fullcircle + if steps is None: + frac = abs(extent)/self._fullcircle + steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) + w = 1.0 * extent / steps + w2 = 0.5 * w + l = 2.0 * radius * math.sin(w2*math.pi/180.0*self._degreesPerAU) + if radius < 0: + l, w, w2 = -l, -w, -w2 + tr = self.tracer() + dl = self._delay() + if speed == 0: + self.tracer(0, 0) + else: + self.speed(0) + self._rotate(w2) + for i in range(steps): + self.speed(speed) + self._go(l) + self.speed(0) + self._rotate(w) + self._rotate(-w2) + if speed == 0: + self.tracer(tr, dl) + self.speed(speed) + if self.undobuffer: + self.undobuffer.cumulate = False + +## three dummy methods to be implemented by child class: + + def speed(self, s=0): + """dummy method - to be overwritten by child class""" + def tracer(self, a=None, b=None): + """dummy method - to be overwritten by child class""" + def _delay(self, n=None): + """dummy method - to be overwritten by child class""" + + fd = forward + bk = back + backward = back + rt = right + lt = left + position = pos + setpos = goto + setposition = goto + seth = setheading + + +class TPen(object): + """Drawing part of the RawTurtle. + Implements drawing properties. + """ + def __init__(self, resizemode=_CFG["resizemode"]): + self._resizemode = resizemode # or "user" or "noresize" + self.undobuffer = None + TPen._reset(self) + + def _reset(self, pencolor=_CFG["pencolor"], + fillcolor=_CFG["fillcolor"]): + self._pensize = 1 + self._shown = True + self._pencolor = pencolor + self._fillcolor = fillcolor + self._drawing = True + self._speed = 3 + self._stretchfactor = (1, 1) + self._tilt = 0 + self._outlinewidth = 1 + ### self.screen = None # to override by child class + + def resizemode(self, rmode=None): + """Set resizemode to one of the values: "auto", "user", "noresize". + + (Optional) Argument: + rmode -- one of the strings "auto", "user", "noresize" + + Different resizemodes have the following effects: + - "auto" adapts the appearance of the turtle + corresponding to the value of pensize. + - "user" adapts the appearance of the turtle according to the + values of stretchfactor and outlinewidth (outline), + which are set by shapesize() + - "noresize" no adaption of the turtle's appearance takes place. + If no argument is given, return current resizemode. + resizemode("user") is called by a call of shapesize with arguments. + + + Examples (for a Turtle instance named turtle): + >>> turtle.resizemode("noresize") + >>> turtle.resizemode() + 'noresize' + """ + if rmode is None: + return self._resizemode + rmode = rmode.lower() + if rmode in ["auto", "user", "noresize"]: + self.pen(resizemode=rmode) + + def pensize(self, width=None): + """Set or return the line thickness. + + Aliases: pensize | width + + Argument: + width -- positive number + + Set the line thickness to width or return it. If resizemode is set + to "auto" and turtleshape is a polygon, that polygon is drawn with + the same line thickness. If no argument is given, current pensize + is returned. + + Example (for a Turtle instance named turtle): + >>> turtle.pensize() + 1 + turtle.pensize(10) # from here on lines of width 10 are drawn + """ + if width is None: + return self._pensize + self.pen(pensize=width) + + + def penup(self): + """Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + Example (for a Turtle instance named turtle): + >>> turtle.penup() + """ + if not self._drawing: + return + self.pen(pendown=False) + + def pendown(self): + """Pull the pen down -- drawing when moving. + + Aliases: pendown | pd | down + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.pendown() + """ + if self._drawing: + return + self.pen(pendown=True) + + def isdown(self): + """Return True if pen is down, False if it's up. + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + """ + return self._drawing + + def speed(self, speed=None): + """ Return or set the turtle's speed. + + Optional argument: + speed -- an integer in the range 0..10 or a speedstring (see below) + + Set the turtle's speed to an integer value in the range 0 .. 10. + If no argument is given: return current speed. + + If input is a number greater than 10 or smaller than 0.5, + speed is set to 0. + Speedstrings are mapped to speedvalues in the following way: + 'fastest' : 0 + 'fast' : 10 + 'normal' : 6 + 'slow' : 3 + 'slowest' : 1 + speeds from 1 to 10 enforce increasingly faster animation of + line drawing and turtle turning. + + Attention: + speed = 0 : *no* animation takes place. forward/back makes turtle jump + and likewise left/right make the turtle turn instantly. + + Example (for a Turtle instance named turtle): + >>> turtle.speed(3) + """ + speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 } + if speed is None: + return self._speed + if speed in speeds: + speed = speeds[speed] + elif 0.5 < speed < 10.5: + speed = int(round(speed)) + else: + speed = 0 + self.pen(speed=speed) + + def color(self, *args): + """Return or set the pencolor and fillcolor. + + Arguments: + Several input formats are allowed. + They use 0, 1, 2, or 3 arguments as follows: + + color() + Return the current pencolor and the current fillcolor + as a pair of color specification strings as are returned + by pencolor and fillcolor. + color(colorstring), color((r,g,b)), color(r,g,b) + inputs as in pencolor, set both, fillcolor and pencolor, + to the given value. + color(colorstring1, colorstring2), + color((r1,g1,b1), (r2,g2,b2)) + equivalent to pencolor(colorstring1) and fillcolor(colorstring2) + and analogously, if the other input format is used. + + If turtleshape is a polygon, outline and interior of that polygon + is drawn with the newly set colors. + For mor info see: pencolor, fillcolor + + Example (for a Turtle instance named turtle): + >>> turtle.color('red', 'green') + >>> turtle.color() + ('red', 'green') + >>> colormode(255) + >>> color((40, 80, 120), (160, 200, 240)) + >>> color() + ('#285078', '#a0c8f0') + """ + if args: + l = len(args) + if l == 1: + pcolor = fcolor = args[0] + elif l == 2: + pcolor, fcolor = args + elif l == 3: + pcolor = fcolor = args + pcolor = self._colorstr(pcolor) + fcolor = self._colorstr(fcolor) + self.pen(pencolor=pcolor, fillcolor=fcolor) + else: + return self._color(self._pencolor), self._color(self._fillcolor) + + def pencolor(self, *args): + """ Return or set the pencolor. + + Arguments: + Four input formats are allowed: + - pencolor() + Return the current pencolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - pencolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - pencolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - pencolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the outline of that polygon is drawn + with the newly set pencolor. + + Example (for a Turtle instance named turtle): + >>> turtle.pencolor('brown') + >>> tup = (0.2, 0.8, 0.55) + >>> turtle.pencolor(tup) + >>> turtle.pencolor() + '#33cc8c' + """ + if args: + color = self._colorstr(args) + if color == self._pencolor: + return + self.pen(pencolor=color) + else: + return self._color(self._pencolor) + + def fillcolor(self, *args): + """ Return or set the fillcolor. + + Arguments: + Four input formats are allowed: + - fillcolor() + Return the current fillcolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - fillcolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - fillcolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - fillcolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + Example (for a Turtle instance named turtle): + >>> turtle.fillcolor('violet') + >>> col = turtle.pencolor() + >>> turtle.fillcolor(col) + >>> turtle.fillcolor(0, .5, 0) + """ + if args: + color = self._colorstr(args) + if color == self._fillcolor: + return + self.pen(fillcolor=color) + else: + return self._color(self._fillcolor) + + def showturtle(self): + """Makes the turtle visible. + + Aliases: showturtle | st -from math import * # Also for export -from time import sleep -import Tkinter + No argument. -speeds = ['fastest', 'fast', 'normal', 'slow', 'slowest'] + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + >>> turtle.showturtle() + """ + self.pen(shown=True) + + def hideturtle(self): + """Makes the turtle invisible. + + Aliases: hideturtle | ht + + No argument. + + It's a good idea to do this while you're in the + middle of a complicated drawing, because hiding + the turtle speeds up the drawing observably. + + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + """ + self.pen(shown=False) + + def isvisible(self): + """Return True if the Turtle is shown, False if it's hidden. + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + >>> print turtle.isvisible(): + False + """ + return self._shown + + def pen(self, pen=None, **pendict): + """Return or set the pen's attributes. + + Arguments: + pen -- a dictionary with some or all of the below listed keys. + **pendict -- one or more keyword-arguments with the below + listed keys as keywords. + + Return or set the pen's attributes in a 'pen-dictionary' + with the following key/value pairs: + "shown" : True/False + "pendown" : True/False + "pencolor" : color-string or color-tuple + "fillcolor" : color-string or color-tuple + "pensize" : positive number + "speed" : number in range 0..10 + "resizemode" : "auto" or "user" or "noresize" + "stretchfactor": (positive number, positive number) + "outline" : positive number + "tilt" : number + + This dicionary can be used as argument for a subsequent + pen()-call to restore the former pen-state. Moreover one + or more of these attributes can be provided as keyword-arguments. + This can be used to set several pen attributes in one statement. + + + Examples (for a Turtle instance named turtle): + >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', + 'stretchfactor': (1,1), 'speed': 3} + >>> penstate=turtle.pen() + >>> turtle.color("yellow","") + >>> turtle.penup() + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', + 'stretchfactor': (1,1), 'speed': 3} + >>> p.pen(penstate, fillcolor="green") + >>> p.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', + 'stretchfactor': (1,1), 'speed': 3} + """ + _pd = {"shown" : self._shown, + "pendown" : self._drawing, + "pencolor" : self._pencolor, + "fillcolor" : self._fillcolor, + "pensize" : self._pensize, + "speed" : self._speed, + "resizemode" : self._resizemode, + "stretchfactor" : self._stretchfactor, + "outline" : self._outlinewidth, + "tilt" : self._tilt + } -class Error(Exception): - pass + if not (pen or pendict): + return _pd -class RawPen: + if isinstance(pen, dict): + p = pen + else: + p = {} + p.update(pendict) - def __init__(self, canvas): - self._canvas = canvas - self._items = [] - self._tracing = 1 - self._arrow = 0 - self._delay = 10 # default delay for drawing - self._angle = 0.0 - self.degrees() - self.reset() + _p_buf = {} + for key in p: + _p_buf[key] = _pd[key] + + if self.undobuffer: + self.undobuffer.push(("pen", _p_buf)) + + newLine = False + if "pendown" in p: + if self._drawing != p["pendown"]: + newLine = True + if "pencolor" in p: + if isinstance(p["pencolor"], tuple): + p["pencolor"] = self._colorstr((p["pencolor"],)) + if self._pencolor != p["pencolor"]: + newLine = True + if "pensize" in p: + if self._pensize != p["pensize"]: + newLine = True + if newLine: + self._newLine() + if "pendown" in p: + self._drawing = p["pendown"] + if "pencolor" in p: + self._pencolor = p["pencolor"] + if "pensize" in p: + self._pensize = p["pensize"] + if "fillcolor" in p: + if isinstance(p["fillcolor"], tuple): + p["fillcolor"] = self._colorstr((p["fillcolor"],)) + self._fillcolor = p["fillcolor"] + if "speed" in p: + self._speed = p["speed"] + if "resizemode" in p: + self._resizemode = p["resizemode"] + if "stretchfactor" in p: + sf = p["stretchfactor"] + if isinstance(sf, (int, float)): + sf = (sf, sf) + self._stretchfactor = sf + if "outline" in p: + self._outlinewidth = p["outline"] + if "shown" in p: + self._shown = p["shown"] + if "tilt" in p: + self._tilt = p["tilt"] + self._update() + +## three dummy methods to be implemented by child class: + + def _newLine(self, usePos = True): + """dummy method - to be overwritten by child class""" + def _update(self, count=True, forced=False): + """dummy method - to be overwritten by child class""" + def _color(self, args): + """dummy method - to be overwritten by child class""" + def _colorstr(self, args): + """dummy method - to be overwritten by child class""" + + width = pensize + up = penup + pu = penup + pd = pendown + down = pendown + st = showturtle + ht = hideturtle - def degrees(self, fullcircle=360.0): - """ Set angle measurement units to degrees. - Example: - >>> turtle.degrees() - """ - # Don't try to change _angle if it is 0, because - # _fullcircle might not be set, yet - if self._angle: - self._angle = (self._angle / self._fullcircle) * fullcircle - self._fullcircle = fullcircle - self._invradian = pi / (fullcircle * 0.5) +class _TurtleImage(object): + """Helper class: Datatype to store Turtle attributes + """ - def radians(self): - """ Set the angle measurement units to radians. + def __init__(self, screen, shapeIndex): + self.screen = screen + self._type = None + self._setshape(shapeIndex) + + def _setshape(self, shapeIndex): + screen = self.screen # RawTurtle.screens[self.screenIndex] + self.shapeIndex = shapeIndex + if self._type == "polygon" == screen._shapes[shapeIndex]._type: + return + if self._type == "image" == screen._shapes[shapeIndex]._type: + return + if self._type in ["image", "polygon"]: + screen._delete(self._item) + elif self._type == "compound": + for item in self._item: + screen._delete(item) + self._type = screen._shapes[shapeIndex]._type + if self._type == "polygon": + self._item = screen._createpoly() + elif self._type == "image": + self._item = screen._createimage(screen._shapes["blank"]._data) + elif self._type == "compound": + self._item = [screen._createpoly() for item in + screen._shapes[shapeIndex]._data] + + +class RawTurtle(TPen, TNavigator): + """Animation part of the RawTurtle. + Puts RawTurtle upon a TurtleScreen and provides tools for + it's animation. + """ + screens = [] - Example: - >>> turtle.radians() - """ - self.degrees(2.0*pi) + def __init__(self, canvas=None, + shape=_CFG["shape"], + undobuffersize=_CFG["undobuffersize"], + visible=_CFG["visible"]): + if isinstance(canvas, Screen): + self.screen = canvas + elif isinstance(canvas, TurtleScreen): + if canvas not in RawTurtle.screens: + RawTurtle.screens.append(canvas) + self.screen = canvas + elif isinstance(canvas, (ScrolledCanvas, Canvas)): + for screen in RawTurtle.screens: + if screen.cv == canvas: + self.screen = screen + break + else: + self.screen = TurtleScreen(canvas) + RawTurtle.screens.append(self.screen) + else: + raise TurtleGraphicsError("bad cavas argument %s" % canvas) + + screen = self.screen + TNavigator.__init__(self, screen.mode()) + TPen.__init__(self) + screen._turtles.append(self) + self.drawingLineItem = screen._createline() + self.turtle = _TurtleImage(screen, shape) + self._poly = None + self._creatingPoly = False + self._fillitem = self._fillpath = None + self._shown = visible + self._hidden_from_screen = False + self.currentLineItem = screen._createline() + self.currentLine = [self._position] + self.items = [self.currentLineItem] + self.stampItems = [] + self._undobuffersize = undobuffersize + self.undobuffer = Tbuffer(undobuffersize) + self._update() def reset(self): - """ Clear the screen, re-center the pen, and set variables to - the default values. + """Delete the turtle's drawings and restore it's default values. - Example: + No argument. +, + Delete the turtle's drawings from the screen, re-center the turtle + and set variables to the default values. + + Example (for a Turtle instance named turtle): >>> turtle.position() - [0.0, -22.0] + (0.00,-22.00) >>> turtle.heading() 100.0 >>> turtle.reset() >>> turtle.position() - [0.0, 0.0] + (0.00,0.00) >>> turtle.heading() 0.0 """ - canvas = self._canvas - self._canvas.update() - width = canvas.winfo_width() - height = canvas.winfo_height() - if width <= 1: - width = canvas['width'] - if height <= 1: - height = canvas['height'] - self._origin = float(width)/2.0, float(height)/2.0 - self._position = self._origin - self._angle = 0.0 - self._drawing = 1 - self._width = 1 - self._color = "black" - self._filling = 0 - self._path = [] - self.clear() - canvas._root().tkraise() - - def clear(self): - """ Clear the screen. The turtle does not move. - - Example: - >>> turtle.clear() - """ - self.fill(0) - canvas = self._canvas - items = self._items - self._items = [] - for item in items: - canvas.delete(item) - self._delete_turtle() - self._draw_turtle() - - def tracer(self, flag): - """ Set tracing on if flag is True, and off if it is False. - Tracing means line are drawn more slowly, with an - animation of an arrow along the line. - - Example: - >>> turtle.tracer(False) # turns off Tracer - """ - self._tracing = flag - if not self._tracing: - self._delete_turtle() - self._draw_turtle() - - def forward(self, distance): - """ Go forward distance steps. - - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.forward(25) - >>> turtle.position() - [25.0, 0.0] - >>> turtle.forward(-75) - >>> turtle.position() - [-50.0, 0.0] - """ - x0, y0 = start = self._position - x1 = x0 + distance * cos(self._angle*self._invradian) - y1 = y0 - distance * sin(self._angle*self._invradian) - self._goto(x1, y1) + TNavigator.reset(self) + TPen._reset(self) + self._clear() + self._drawturtle() + self._update() + + def setundobuffer(self, size): + """Set or disable undobuffer. + + Argument: + size -- an integer or None + + If size is an integer an empty undobuffer of given size is installed. + Size gives the maximum number of turtle-actions that can be undone + by the undo() function. + If size is None, no undobuffer is present. - def backward(self, distance): - """ Go backwards distance steps. - - The turtle's heading does not change. - - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.backward(30) - >>> turtle.position() - [-30.0, 0.0] + Example (for a Turtle instance named turtle): + >>> turtle.setundobuffer(42) """ - self.forward(-distance) - - def left(self, angle): - """ Turn left angle units (units are by default degrees, - but can be set via the degrees() and radians() functions.) - - When viewed from above, the turning happens in-place around - its front tip. + if size is None: + self.undobuffer = None + else: + self.undobuffer = Tbuffer(size) - Example: - >>> turtle.heading() - 22 - >>> turtle.left(45) - >>> turtle.heading() - 67.0 - """ - self._angle = (self._angle + angle) % self._fullcircle - self._draw_turtle() + def undobufferentries(self): + """Return count of entries in the undobuffer. - def right(self, angle): - """ Turn right angle units (units are by default degrees, - but can be set via the degrees() and radians() functions.) + No argument. - When viewed from above, the turning happens in-place around - its front tip. + Example (for a Turtle instance named turtle): + >>> while undobufferentries(): + undo() + """ + if self.undobuffer is None: + return 0 + return self.undobuffer.nr_of_items() + + def _clear(self): + """Delete all of pen's drawings""" + self._fillitem = self._fillpath = None + for item in self.items: + self.screen._delete(item) + self.currentLineItem = self.screen._createline() + self.currentLine = [] + if self._drawing: + self.currentLine.append(self._position) + self.items = [self.currentLineItem] + self.clearstamps() + self.setundobuffer(self._undobuffersize) - Example: - >>> turtle.heading() - 22 - >>> turtle.right(45) - >>> turtle.heading() - 337.0 - """ - self.left(-angle) - def up(self): - """ Pull the pen up -- no drawing when moving. + def clear(self): + """Delete the turtle's drawings from the screen. Do not move turtle. - Example: - >>> turtle.up() - """ - self._drawing = 0 + No arguments. - def down(self): - """ Put the pen down -- draw when moving. + Delete the turtle's drawings from the screen. Do not move turtle. + State and position of the turtle as well as drawings of other + turtles are not affected. - Example: - >>> turtle.down() + Examples (for a Turtle instance named turtle): + >>> turtle.clear() """ - self._drawing = 1 + self._clear() + self._update() - def width(self, width): - """ Set the line to thickness to width. + def _update_data(self): + self.screen._incrementudc() + if self.screen._updatecounter != 0: + return + if len(self.currentLine)>1: + self.screen._drawline(self.currentLineItem, self.currentLine, + self._pencolor, self._pensize) - Example: - >>> turtle.width(10) + def _update(self): + """Perform a Turtle-data update. """ - self._width = float(width) - - def color(self, *args): - """ Set the pen color. - - Three input formats are allowed: - - color(s) - s is a Tk specification string, such as "red" or "yellow" - - color((r, g, b)) - *a tuple* of r, g, and b, which represent, an RGB color, - and each of r, g, and b are in the range [0..1] - - color(r, g, b) - r, g, and b represent an RGB color, and each of r, g, and b - are in the range [0..1] + screen = self.screen + if screen._tracing == 0: + return + elif screen._tracing == 1: + self._update_data() + self._drawturtle() + screen._update() # TurtleScreenBase + screen._delay(screen._delayvalue) # TurtleScreenBase + else: + self._update_data() + if screen._updatecounter == 0: + for t in screen.turtles(): + t._drawturtle() + screen._update() + + def tracer(self, flag=None, delay=None): + """Turns turtle animation on/off and set delay for update drawings. + + Optional arguments: + n -- nonnegative integer + delay -- nonnegative integer + + If n is given, only each n-th regular screen update is really performed. + (Can be used to accelerate the drawing of complex graphics.) + Second arguments sets delay value (see RawTurtle.delay()) + + Example (for a Turtle instance named turtle): + >>> turtle.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + turtle.fd(dist) + turtle.rt(90) + dist += 2 + """ + return self.screen.tracer(flag, delay) + + def _color(self, args): + return self.screen._color(args) - Example: + def _colorstr(self, args): + return self.screen._colorstr(args) - >>> turtle.color('brown') - >>> tup = (0.2, 0.8, 0.55) - >>> turtle.color(tup) - >>> turtle.color(0, .5, 0) + def _cc(self, args): + """Convert colortriples to hexstrings. """ - if not args: - raise Error, "no color arguments" - if len(args) == 1: - color = args[0] - if type(color) == type(""): - # Test the color first - try: - id = self._canvas.create_line(0, 0, 0, 0, fill=color) - except Tkinter.TclError: - raise Error, "bad color string: %r" % (color,) - self._set_color(color) + if isinstance(args, str): + return args + try: + r, g, b = args + except: + raise TurtleGraphicsError("bad color arguments: %s" % str(args)) + if self.screen._colormode == 1.0: + r, g, b = [round(255.0*x) for x in (r, g, b)] + if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)): + raise TurtleGraphicsError("bad color sequence: %s" % str(args)) + return "#%02x%02x%02x" % (r, g, b) + + def clone(self): + """Create and return a clone of the turtle. + + No argument. + + Create and return a clone of the turtle with same position, heading + and turtle properties. + + Example (for a Turtle instance named mick): + mick = Turtle() + joe = mick.clone() + """ + screen = self.screen + self._newLine(self._drawing) + + turtle = self.turtle + self.screen = None + self.turtle = None # too make self deepcopy-able + + q = deepcopy(self) + + self.screen = screen + self.turtle = turtle + + q.screen = screen + q.turtle = _TurtleImage(screen, self.turtle.shapeIndex) + + screen._turtles.append(q) + ttype = screen._shapes[self.turtle.shapeIndex]._type + if ttype == "polygon": + q.turtle._item = screen._createpoly() + elif ttype == "image": + q.turtle._item = screen._createimage(screen._shapes["blank"]._data) + elif ttype == "compound": + q.turtle._item = [screen._createpoly() for item in + screen._shapes[self.turtle.shapeIndex]._data] + q.currentLineItem = screen._createline() + q._update() + return q + + def shape(self, name=None): + """Set turtle shape to shape with given name / return current shapename. + + Optional argument: + name -- a string, which is a valid shapename + + Set turtle shape to shape with given name or, if name is not given, + return name of current shape. + Shape with name must exist in the TurtleScreen's shape dictionary. + Initially there are the following polygon shapes: + 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'. + To learn about how to deal with shapes see Screen-method register_shape. + + Example (for a Turtle instance named turtle): + >>> turtle.shape() + 'arrow' + >>> turtle.shape("turtle") + >>> turtle.shape() + 'turtle' + """ + if name is None: + return self.turtle.shapeIndex + if not name in self.screen.getshapes(): + raise TurtleGraphicsError("There is no shape named %s" % name) + self.turtle._setshape(name) + self._update() + + def shapesize(self, stretch_wid=None, stretch_len=None, outline=None): + """Set/return turtle's stretchfactors/outline. Set resizemode to "user". + + Optinonal arguments: + stretch_wid : positive number + stretch_len : positive number + outline : positive number + + Return or set the pen's attributes x/y-stretchfactors and/or outline. + Set resizemode to "user". + If and only if resizemode is set to "user", the turtle will be displayed + stretched according to its stretchfactors: + stretch_wid is stretchfactor perpendicular to orientation + stretch_len is stretchfactor in direction of turtles orientation. + outline determines the width of the shapes's outline. + + Examples (for a Turtle instance named turtle): + >>> turtle.resizemode("user") + >>> turtle.shapesize(5, 5, 12) + >>> turtle.shapesize(outline=8) + """ + if stretch_wid is None and stretch_len is None and outline == None: + stretch_wid, stretch_len = self._stretchfactor + return stretch_wid, stretch_len, self._outlinewidth + if stretch_wid is not None: + if stretch_len is None: + stretchfactor = stretch_wid, stretch_wid + else: + stretchfactor = stretch_wid, stretch_len + elif stretch_len is not None: + stretchfactor = self._stretchfactor[0], stretch_len + else: + stretchfactor = self._stretchfactor + if outline is None: + outline = self._outlinewidth + self.pen(resizemode="user", + stretchfactor=stretchfactor, outline=outline) + + def settiltangle(self, angle): + """Rotate the turtleshape to point in the specified direction + + Optional argument: + angle -- number + + Rotate the turtleshape to point in the direction specified by angle, + regardless of its current tilt-angle. DO NOT change the turtle's + heading (direction of movement). + + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.settiltangle(45) + >>> stamp() + >>> turtle.fd(50) + >>> turtle.settiltangle(-45) + >>> stamp() + >>> turtle.fd(50) + """ + tilt = -angle * self._degreesPerAU * self._angleOrient + tilt = (tilt * math.pi / 180.0) % (2*math.pi) + self.pen(resizemode="user", tilt=tilt) + + def tiltangle(self): + """Return the current tilt-angle. + + No argument. + + Return the current tilt-angle, i. e. the angle between the + orientation of the turtleshape and the heading of the turtle + (it's direction of movement). + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(45) + >>> turtle.tiltangle() + >>> + """ + tilt = -self._tilt * (180.0/math.pi) * self._angleOrient + return (tilt / self._degreesPerAU) % self._fullcircle + + def tilt(self, angle): + """Rotate the turtleshape by angle. + + Argument: + angle - a number + + Rotate the turtleshape by angle from its current tilt-angle, + but do NOT change the turtle's heading (direction of movement). + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + """ + self.settiltangle(angle + self.tiltangle()) + + def _polytrafo(self, poly): + """Computes transformed polygon shapes from a shape + according to current position and heading. + """ + screen = self.screen + p0, p1 = self._position + e0, e1 = self._orient + e = Vec2D(e0, e1 * screen.yscale / screen.xscale) + e0, e1 = (1.0 / abs(e)) * e + return [(p0+(e1*x+e0*y)/screen.xscale, p1+(-e0*x+e1*y)/screen.yscale) + for (x, y) in poly] + + def _drawturtle(self): + """Manages the correct rendering of the turtle with respect to + it's shape, resizemode, strech and tilt etc.""" + screen = self.screen + shape = screen._shapes[self.turtle.shapeIndex] + ttype = shape._type + titem = self.turtle._item + if self._shown and screen._updatecounter == 0 and screen._tracing > 0: + self._hidden_from_screen = False + tshape = shape._data + if ttype == "polygon": + if self._resizemode == "noresize": + w = 1 + shape = tshape + else: + if self._resizemode == "auto": + lx = ly = max(1, self._pensize/5.0) + w = self._pensize + tiltangle = 0 + elif self._resizemode == "user": + lx, ly = self._stretchfactor + w = self._outlinewidth + tiltangle = self._tilt + shape = [(lx*x, ly*y) for (x, y) in tshape] + t0, t1 = math.sin(tiltangle), math.cos(tiltangle) + shape = [(t1*x+t0*y, -t0*x+t1*y) for (x, y) in shape] + shape = self._polytrafo(shape) + fc, oc = self._fillcolor, self._pencolor + screen._drawpoly(titem, shape, fill=fc, outline=oc, + width=w, top=True) + elif ttype == "image": + screen._drawimage(titem, self._position, tshape) + elif ttype == "compound": + lx, ly = self._stretchfactor + w = self._outlinewidth + for item, (poly, fc, oc) in zip(titem, tshape): + poly = [(lx*x, ly*y) for (x, y) in poly] + poly = self._polytrafo(poly) + screen._drawpoly(item, poly, fill=self._cc(fc), + outline=self._cc(oc), width=w, top=True) + else: + if self._hidden_from_screen: return - try: - r, g, b = color - except: - raise Error, "bad color sequence: %r" % (color,) + if ttype == "polygon": + screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), "", "") + elif ttype == "image": + screen._drawimage(titem, self._position, + screen._shapes["blank"]._data) + elif ttype == "compound": + for item in titem: + screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), "", "") + self._hidden_from_screen = True + +############################## stamp stuff ############################### + + def stamp(self): + """Stamp a copy of the turtleshape onto the canvas and return it's id. + + No argument. + + Stamp a copy of the turtle shape onto the canvas at the current + turtle position. Return a stamp_id for that stamp, which can be + used to delete it by calling clearstamp(stamp_id). + + Example (for a Turtle instance named turtle): + >>> turtle.color("blue") + >>> turtle.stamp() + 13 + >>> turtle.fd(50) + """ + screen = self.screen + shape = screen._shapes[self.turtle.shapeIndex] + ttype = shape._type + tshape = shape._data + if ttype == "polygon": + stitem = screen._createpoly() + if self._resizemode == "noresize": + w = 1 + shape = tshape + else: + if self._resizemode == "auto": + lx = ly = max(1, self._pensize/5.0) + w = self._pensize + tiltangle = 0 + elif self._resizemode == "user": + lx, ly = self._stretchfactor + w = self._outlinewidth + tiltangle = self._tilt + shape = [(lx*x, ly*y) for (x, y) in tshape] + t0, t1 = math.sin(tiltangle), math.cos(tiltangle) + shape = [(t1*x+t0*y, -t0*x+t1*y) for (x, y) in shape] + shape = self._polytrafo(shape) + fc, oc = self._fillcolor, self._pencolor + screen._drawpoly(stitem, shape, fill=fc, outline=oc, + width=w, top=True) + elif ttype == "image": + stitem = screen._createimage("") + screen._drawimage(stitem, self._position, tshape) + elif ttype == "compound": + stitem = [] + for element in tshape: + item = screen._createpoly() + stitem.append(item) + stitem = tuple(stitem) + lx, ly = self._stretchfactor + w = self._outlinewidth + for item, (poly, fc, oc) in zip(stitem, tshape): + poly = [(lx*x, ly*y) for (x, y) in poly] + poly = self._polytrafo(poly) + screen._drawpoly(item, poly, fill=self._cc(fc), + outline=self._cc(oc), width=w, top=True) + self.stampItems.append(stitem) + self.undobuffer.push(("stamp", stitem)) + return stitem + + def _clearstamp(self, stampid): + """does the work for clearstamp() and clearstamps() + """ + if stampid in self.stampItems: + if isinstance(stampid, tuple): + for subitem in stampid: + self.screen._delete(subitem) + else: + self.screen._delete(stampid) + self.stampItems.remove(stampid) + # Delete stampitem from undobuffer if necessary + # if clearstamp is called directly. + item = ("stamp", stampid) + buf = self.undobuffer + if item not in buf.buffer: + return + index = buf.buffer.index(item) + buf.buffer.remove(item) + if index <= buf.ptr: + buf.ptr = (buf.ptr - 1) % buf.bufsize + buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None]) + + def clearstamp(self, stampid): + """Delete stamp with given stampid + + Argument: + stampid - an integer, must be return value of previous stamp() call. + + Example (for a Turtle instance named turtle): + >>> turtle.color("blue") + >>> astamp = turtle.stamp() + >>> turtle.fd(50) + >>> turtle.clearstamp(astamp) + """ + self._clearstamp(stampid) + self._update() + + def clearstamps(self, n=None): + """Delete all or first/last n of turtle's stamps. + + Optional argument: + n -- an integer + + If n is None, delete all of pen's stamps, + else if n > 0 delete first n stamps + else if n < 0 delete last n stamps. + + Example (for a Turtle instance named turtle): + >>> for i in range(8): + turtle.stamp(); turtle.fd(30) + ... + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + """ + if n is None: + toDelete = self.stampItems[:] + elif n >= 0: + toDelete = self.stampItems[:n] else: - try: - r, g, b = args - except: - raise Error, "bad color arguments: %r" % (args,) - assert 0 <= r <= 1 - assert 0 <= g <= 1 - assert 0 <= b <= 1 - x = 255.0 - y = 0.5 - self._set_color("#%02x%02x%02x" % (int(r*x+y), int(g*x+y), int(b*x+y))) - - def _set_color(self,color): - self._color = color - self._draw_turtle() + toDelete = self.stampItems[n:] + for item in toDelete: + self._clearstamp(item) + self._update() + + def _goto(self, end): + """Move the pen to the point end, thereby drawing a line + if pen is down. All other methodes for turtle movement depend + on this one. + """ + ## Version mit undo-stuff + go_modes = ( self._drawing, + self._pencolor, + self._pensize, + isinstance(self._fillpath, list)) + screen = self.screen + undo_entry = ("go", self._position, end, go_modes, + (self.currentLineItem, + self.currentLine[:], + screen._pointlist(self.currentLineItem), + self.items[:]) + ) + if self.undobuffer: + self.undobuffer.push(undo_entry) + start = self._position + if self._speed and screen._tracing == 1: + diff = (end-start) + diffsq = (diff[0]*screen.xscale)**2 + (diff[1]*screen.yscale)**2 + nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) + delta = diff * (1.0/nhops) + for n in range(1, nhops): + if n == 1: + top = True + else: + top = False + self._position = start + delta * n + if self._drawing: + screen._drawline(self.drawingLineItem, + (start, self._position), + self._pencolor, self._pensize, top) + self._update() + if self._drawing: + screen._drawline(self.drawingLineItem, ((0, 0), (0, 0)), + fill="", width=self._pensize) + # Turtle now at end, + if self._drawing: # now update currentLine + self.currentLine.append(end) + if isinstance(self._fillpath, list): + self._fillpath.append(end) + ###### vererbung!!!!!!!!!!!!!!!!!!!!!! + self._position = end + if self._creatingPoly: + self._poly.append(end) + if len(self.currentLine) > 42: # 42! answer to the ultimate question + # of life, the universe and everything + self._newLine() + self._update() #count=True) + + def _undogoto(self, entry): + """Reverse a _goto. Used for undo() + """ + old, new, go_modes, coodata = entry + drawing, pc, ps, filling = go_modes + cLI, cL, pl, items = coodata + screen = self.screen + if abs(self._position - new) > 0.5: + print "undogoto: HALLO-DA-STIMMT-WAS-NICHT!" + # restore former situation + self.currentLineItem = cLI + self.currentLine = cL - def write(self, text, move=False): - """ Write text at the current pen position. - - If move is true, the pen is moved to the bottom-right corner - of the text. By default, move is False. + if pl == [(0, 0), (0, 0)]: + usepc = "" + else: + usepc = pc + screen._drawline(cLI, pl, fill=usepc, width=ps) - Example: - >>> turtle.write('The race is on!') - >>> turtle.write('Home = (0, 0)', True) - """ - x, y = self._position - x = x-1 # correction -- calibrated for Windows - item = self._canvas.create_text(x, y, - text=str(text), anchor="sw", - fill=self._color) - self._items.append(item) - if move: - x0, y0, x1, y1 = self._canvas.bbox(item) - self._goto(x1, y1) - self._draw_turtle() - - def fill(self, flag): - """ Call fill(1) before drawing the shape you - want to fill, and fill(0) when done. + todelete = [i for i in self.items if (i not in items) and + (screen._type(i) == "line")] + for i in todelete: + screen._delete(i) + self.items.remove(i) + + start = old + if self._speed and screen._tracing == 1: + diff = old - new + diffsq = (diff[0]*screen.xscale)**2 + (diff[1]*screen.yscale)**2 + nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) + delta = diff * (1.0/nhops) + for n in range(1, nhops): + if n == 1: + top = True + else: + top = False + self._position = new + delta * n + if drawing: + screen._drawline(self.drawingLineItem, + (start, self._position), + pc, ps, top) + self._update() + if drawing: + screen._drawline(self.drawingLineItem, ((0, 0), (0, 0)), + fill="", width=ps) + # Turtle now at position old, + self._position = old + ## if undo is done during crating a polygon, the last vertex + ## will be deleted. if the polygon is entirel deleted, + ## creatigPoly will be set to False. + ## Polygons created before the last one will not be affected by undo() + if self._creatingPoly: + if len(self._poly) > 0: + self._poly.pop() + if self._poly == []: + self._creatingPoly = False + self._poly = None + if filling: + if self._fillpath == []: + self._fillpath = None + print "Unwahrscheinlich in _undogoto!" + elif self._fillpath is not None: + self._fillpath.pop() + self._update() #count=True) + + def _rotate(self, angle): + """Turns pen clockwise by angle. + """ + if self.undobuffer: + self.undobuffer.push(("rot", angle, self._degreesPerAU)) + angle *= self._degreesPerAU + neworient = self._orient.rotate(angle) + tracing = self.screen._tracing + if tracing == 1 and self._speed > 0: + anglevel = 3.0 * self._speed + steps = 1 + int(abs(angle)/anglevel) + delta = 1.0*angle/steps + for _ in range(steps): + self._orient = self._orient.rotate(delta) + self._update() + self._orient = neworient + self._update() + + def _newLine(self, usePos=True): + """Closes current line item and starts a new one. + Remark: if current line became too long, animation + performance (via _drawline) slowed down considerably. + """ + if len(self.currentLine) > 1: + self.screen._drawline(self.currentLineItem, self.currentLine, + self._pencolor, self._pensize) + self.currentLineItem = self.screen._createline() + self.items.append(self.currentLineItem) + else: + self.screen._drawline(self.currentLineItem, top=True) + self.currentLine = [] + if usePos: + self.currentLine = [self._position] + + def fill(self, flag=None): + """Call fill(True) before drawing a shape to fill, fill(False) when done. + + Optional argument: + flag -- True/False (or 1/0 respectively) + + Call fill(True) before drawing the shape you want to fill, + and fill(False) when done. + When used without argument: return fillstate (True if filling, + False else) - Example: - >>> turtle.fill(1) + Example (for a Turtle instance named turtle): + >>> turtle.fill(True) >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) @@ -296,27 +3144,43 @@ >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) - >>> turtle.fill(0) + >>> turtle.fill(False) """ - if self._filling: - path = tuple(self._path) - smooth = self._filling < 0 - if len(path) > 2: - item = self._canvas._create('polygon', path, - {'fill': self._color, - 'smooth': smooth}) - self._items.append(item) - self._path = [] - self._filling = flag + filling = isinstance(self._fillpath, list) + if flag is None: + return filling + screen = self.screen + entry1 = entry2 = () + if filling: + if len(self._fillpath) > 2: + self.screen._drawpoly(self._fillitem, self._fillpath, + fill=self._fillcolor) + entry1 = ("dofill", self._fillitem) if flag: - self._path.append(self._position) + self._fillitem = self.screen._createpoly() + self.items.append(self._fillitem) + self._fillpath = [self._position] + entry2 = ("beginfill", self._fillitem) # , self._fillpath) + self._newLine() + else: + self._fillitem = self._fillpath = None + if self.undobuffer: + if entry1 == (): + if entry2 != (): + self.undobuffer.push(entry2) + else: + if entry2 == (): + self.undobuffer.push(entry1) + else: + self.undobuffer.push(["seq", entry1, entry2]) + self._update() def begin_fill(self): - """ Called just before drawing a shape to be filled. - Must eventually be followed by a corresponding end_fill() call. - Otherwise it will be ignored. + """Called just before drawing a shape to be filled. - Example: + No argument. + + Example (for a Turtle instance named turtle): >>> turtle.begin_fill() >>> turtle.forward(100) >>> turtle.left(90) @@ -327,13 +3191,14 @@ >>> turtle.forward(100) >>> turtle.end_fill() """ - self._path = [self._position] - self._filling = 1 + self.fill(True) def end_fill(self): - """ Called after drawing a shape to be filled. + """Fill the shape drawn after the call begin_fill(). - Example: + No argument. + + Example (for a Turtle instance named turtle): >>> turtle.begin_fill() >>> turtle.forward(100) >>> turtle.left(90) @@ -344,613 +3209,820 @@ >>> turtle.forward(100) >>> turtle.end_fill() """ - self.fill(0) + self.fill(False) - def circle(self, radius, extent = None): - """ Draw a circle with given radius. - The center is radius units left of the turtle; extent - determines which part of the circle is drawn. If not given, - the entire circle is drawn. + def dot(self, size=None, *color): + """Draw a dot with diameter size, using color. - If extent is not a full circle, one endpoint of the arc is the - current pen position. The arc is drawn in a counter clockwise - direction if radius is positive, otherwise in a clockwise - direction. In the process, the direction of the turtle is - changed by the amount of the extent. + Optional argumentS: + size -- an integer >= 1 (if given) + color -- a colorstring or a numeric color tuple + + Draw a circular dot with diameter size, using color. + If size is not given, the maximum of pensize+4 and 2*pensize is used. + + Example (for a Turtle instance named turtle): + >>> turtle.dot() + >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) + """ + #print "dot-1:", size, color + if not color: + if isinstance(size, (str, tuple)): + color = self._colorstr(size) + size = self._pensize + max(self._pensize, 4) + else: + color = self._pencolor + if not size: + size = self._pensize + max(self._pensize, 4) + else: + if size is None: + size = self._pensize + max(self._pensize, 4) + color = self._colorstr(color) + #print "dot-2:", size, color + if hasattr(self.screen, "_dot"): + item = self.screen._dot(self._position, size, color) + #print "dot:", size, color, "item:", item + self.items.append(item) + if self.undobuffer: + self.undobuffer.push(("dot", item)) + else: + pen = self.pen() + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + try: + if self.resizemode() == 'auto': + self.ht() + self.pendown() + self.pensize(size) + self.pencolor(color) + self.forward(0) + finally: + self.pen(pen) + if self.undobuffer: + self.undobuffer.cumulate = False + + def _write(self, txt, align, font): + """Performs the writing for write() + """ + item, end = self.screen._write(self._position, txt, align, font, + self._pencolor) + self.items.append(item) + if self.undobuffer: + self.undobuffer.push(("wri", item)) + return end + + def write(self, arg, move=False, align="left", font=("Arial", 8, "normal")): + """Write text at the current turtle position. + + Arguments: + arg -- info, which is to be written to the TurtleScreen + move (optional) -- True/False + align (optional) -- one of the strings "left", "center" or right" + font (optional) -- a triple (fontname, fontsize, fonttype) + + Write text - the string representation of arg - at the current + turtle position according to align ("left", "center" or right") + and with the given font. + If move is True, the pen is moved to the bottom-right corner + of the text. By default, move is False. - >>> turtle.circle(50) - >>> turtle.circle(120, 180) # half a circle + Example (for a Turtle instance named turtle): + >>> turtle.write('Home = ', True, align="center") + >>> turtle.write((0,0), True) + """ + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + end = self._write(str(arg), align.lower(), font) + if move: + x, y = self.pos() + self.setpos(end, y) + if self.undobuffer: + self.undobuffer.cumulate = False + + def begin_poly(self): + """Start recording the vertices of a polygon. + + No argument. + + Start recording the vertices of a polygon. Current turtle position + is first point of polygon. + + Example (for a Turtle instance named turtle): + >>> turtle.begin_poly() """ - if extent is None: - extent = self._fullcircle - frac = abs(extent)/self._fullcircle - steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) - w = 1.0 * extent / steps - w2 = 0.5 * w - l = 2.0 * radius * sin(w2*self._invradian) - if radius < 0: - l, w, w2 = -l, -w, -w2 - self.left(w2) - for i in range(steps): - self.forward(l) - self.left(w) - self.right(w2) + self._poly = [self._position] + self._creatingPoly = True - def heading(self): - """ Return the turtle's current heading. + def end_poly(self): + """Stop recording the vertices of a polygon. - Example: - >>> turtle.heading() - 67.0 + No argument. + + Stop recording the vertices of a polygon. Current turtle position is + last point of polygon. This will be connected with the first point. + + Example (for a Turtle instance named turtle): + >>> turtle.end_poly() """ - return self._angle + self._creatingPoly = False - def setheading(self, angle): - """ Set the turtle facing the given angle. + def get_poly(self): + """Return the lastly recorded polygon. - Here are some common directions in degrees: + No argument. + + Example (for a Turtle instance named turtle): + >>> p = turtle.get_poly() + >>> turtle.register_shape("myFavouriteShape", p) + """ + ## check if there is any poly? -- 1st solution: + if self._poly is not None: + return tuple(self._poly) + + def getscreen(self): + """Return the TurtleScreen object, the turtle is drawing on. + + No argument. - 0 - east - 90 - north - 180 - west - 270 - south + Return the TurtleScreen object, the turtle is drawing on. + So TurtleScreen-methods can be called for that object. + + Example (for a Turtle instance named turtle): + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + """ + return self.screen + + def getturtle(self): + """Return the Turtleobject itself. + + No argument. + + Only reasonable use: as a function to return the 'anonymous turtle': Example: - >>> turtle.setheading(90) - >>> turtle.heading() - 90 - >>> turtle.setheading(128) - >>> turtle.heading() - 128 + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + >>> turtles() + [] """ - self._angle = angle - self._draw_turtle() + return self + + getpen = getturtle + + + ################################################################ + ### screen oriented methods recurring to methods of TurtleScreen + ################################################################ def window_width(self): """ Returns the width of the turtle window. - Example: - >>> turtle.window_width() + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_width() 640 """ - width = self._canvas.winfo_width() - if width <= 1: # the window isn't managed by a geometry manager - width = self._canvas['width'] - return width + return self.screen._window_size()[0] def window_height(self): """ Return the height of the turtle window. - Example: - >>> turtle.window_height() - 768 - """ - height = self._canvas.winfo_height() - if height <= 1: # the window isn't managed by a geometry manager - height = self._canvas['height'] - return height + No argument. - def position(self): - """ Return the current (x, y) location of the turtle. + Example (for a TurtleScreen instance named screen): + >>> screen.window_height() + 480 + """ + return self.screen._window_size()[1] - Example: - >>> turtle.position() - [0.0, 240.0] + def _delay(self, delay=None): + """Set delay value which determines speed of turtle animation. """ - x0, y0 = self._origin - x1, y1 = self._position - return [x1-x0, -y1+y0] + return self.screen.delay(delay) - def setx(self, xpos): - """ Set the turtle's x coordinate to be xpos. + ##### event binding methods ##### - Example: - >>> turtle.position() - [10.0, 240.0] - >>> turtle.setx(10) - >>> turtle.position() - [10.0, 240.0] - """ - x0, y0 = self._origin - x1, y1 = self._position - self._goto(x0+xpos, y1) + def onclick(self, fun, btn=1, add=None): + """Bind fun to mouse-click event on this turtle on canvas. - def sety(self, ypos): - """ Set the turtle's y coordinate to be ypos. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.sety(-22) - >>> turtle.position() - [0.0, -22.0] + Example for the anonymous turtle, i. e. the procedural way: + + >>> def turn(x, y): + left(360) + + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed """ - x0, y0 = self._origin - x1, y1 = self._position - self._goto(x1, y0-ypos) + self.screen._onclick(self.turtle._item, fun, btn, add) + self._update() - def towards(self, *args): - """Returs the angle, which corresponds to the line - from turtle-position to point (x,y). + def onrelease(self, fun, btn=1, add=None): + """Bind fun to mouse-button-release event on this turtle on canvas. - Argument can be two coordinates or one pair of coordinates - or a RawPen/Pen instance. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). - Example: - >>> turtle.position() - [10.0, 10.0] - >>> turtle.towards(0,0) - 225.0 + Example (for a MyTurtle instance named joe): + >>> class MyTurtle(Turtle): + def glow(self,x,y): + self.fillcolor("red") + def unglow(self,x,y): + self.fillcolor("") + + >>> joe = MyTurtle() + >>> joe.onclick(joe.glow) + >>> joe.onrelease(joe.unglow) + ### clicking on joe turns fillcolor red, + ### unclicking turns it to transparent. """ - if len(args) == 2: - x, y = args - else: - arg = args[0] - if isinstance(arg, RawPen): - x, y = arg.position() - else: - x, y = arg - x0, y0 = self.position() - dx = x - x0 - dy = y - y0 - return (atan2(dy,dx) / self._invradian) % self._fullcircle + self.screen._onrelease(self.turtle._item, fun, btn, add) + self._update() - def goto(self, *args): - """ Go to the given point. + def ondrag(self, fun, btn=1, add=None): + """Bind fun to mouse-move event on this turtle on canvas. - If the pen is down, then a line will be drawn. The turtle's - orientation does not change. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). - Two input formats are accepted: + Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. - goto(x, y) - go to point (x, y) + Example (for a Turtle instance named turtle): + >>> turtle.ondrag(turtle.goto) - goto((x, y)) - go to point (x, y) + ### Subsequently clicking and dragging a Turtle will + ### move it across the screen thereby producing handdrawings + ### (if pen is down). + """ + self.screen._ondrag(self.turtle._item, fun, btn, add) - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.goto(50, -45) - >>> turtle.position() - [50.0, -45.0] + + def _undo(self, action, data): + """Does the main part of the work for undo() """ - if len(args) == 1: - try: - x, y = args[0] - except: - raise Error, "bad point argument: %r" % (args[0],) - else: - try: - x, y = args - except: - raise Error, "bad coordinates: %r" % (args[0],) - x0, y0 = self._origin - self._goto(x0+x, y0-y) - - def _goto(self, x1, y1): - x0, y0 = self._position - self._position = map(float, (x1, y1)) - if self._filling: - self._path.append(self._position) - if self._drawing: - if self._tracing: - dx = float(x1 - x0) - dy = float(y1 - y0) - distance = hypot(dx, dy) - nhops = int(distance) - item = self._canvas.create_line(x0, y0, x0, y0, - width=self._width, - capstyle="round", - fill=self._color) - try: - for i in range(1, 1+nhops): - x, y = x0 + dx*i/nhops, y0 + dy*i/nhops - self._canvas.coords(item, x0, y0, x, y) - self._draw_turtle((x,y)) - self._canvas.update() - self._canvas.after(self._delay) - # in case nhops==0 - self._canvas.coords(item, x0, y0, x1, y1) - self._canvas.itemconfigure(item, arrow="none") - except Tkinter.TclError: - # Probably the window was closed! - return - else: - item = self._canvas.create_line(x0, y0, x1, y1, - width=self._width, - capstyle="round", - fill=self._color) - self._items.append(item) - self._draw_turtle() - - def speed(self, speed): - """ Set the turtle's speed. - - speed must one of these five strings: - - 'fastest' is a 0 ms delay - 'fast' is a 5 ms delay - 'normal' is a 10 ms delay - 'slow' is a 15 ms delay - 'slowest' is a 20 ms delay + if self.undobuffer is None: + return + if action == "rot": + angle, degPAU = data + self._rotate(-angle*degPAU/self._degreesPerAU) + dummy = self.undobuffer.pop() + elif action == "stamp": + stitem = data[0] + self.clearstamp(stitem) + elif action == "go": + self._undogoto(data) + elif action in ["wri", "dot"]: + item = data[0] + self.screen._delete(item) + self.items.remove(item) + elif action == "dofill": + item = data[0] + self.screen._drawpoly(item, ((0, 0),(0, 0),(0, 0)), + fill="", outline="") + elif action == "beginfill": + item = data[0] + self._fillitem = self._fillpath = None + self.screen._delete(item) + self.items.remove(item) + elif action == "pen": + TPen.pen(self, data[0]) + self.undobuffer.pop() + + def undo(self): + """undo (repeatedly) the last turtle action. + + No argument. + + undo (repeatedly) the last turtle action. + Number of available undo actions is determined by the size of + the undobuffer. + + Example (for a Turtle instance named turtle): + >>> for i in range(4): + turtle.fd(50); turtle.lt(80) - Example: - >>> turtle.speed('slow') + >>> for i in range(8): + turtle.undo() """ - try: - speed = speed.strip().lower() - self._delay = speeds.index(speed) * 5 - except: - raise ValueError("%r is not a valid speed. speed must be " - "one of %s" % (speed, speeds)) + if self.undobuffer is None: + return + item = self.undobuffer.pop() + action = item[0] + data = item[1:] + if action == "seq": + while data: + item = data.pop() + self._undo(item[0], item[1:]) + else: + self._undo(action, data) + turtlesize = shapesize - def delay(self, delay): - """ Set the drawing delay in milliseconds. +RawPen = RawTurtle - This is intended to allow finer control of the drawing speed - than the speed() method +### Screen - Klasse ######################## - Example: - >>> turtle.delay(15) - """ - if int(delay) < 0: - raise ValueError("delay must be greater than or equal to 0") - self._delay = int(delay) - - def _draw_turtle(self, position=[]): - if not self._tracing: - self._canvas.update() - return - if position == []: - position = self._position - x,y = position - distance = 8 - dx = distance * cos(self._angle*self._invradian) - dy = distance * sin(self._angle*self._invradian) - self._delete_turtle() - self._arrow = self._canvas.create_line(x-dx,y+dy,x,y, - width=self._width, - arrow="last", - capstyle="round", - fill=self._color) - self._canvas.update() - - def _delete_turtle(self): - if self._arrow != 0: - self._canvas.delete(self._arrow) - self._arrow = 0 - - -_root = None -_canvas = None -_pen = None -_width = 0.50 # 50% of window width -_height = 0.75 # 75% of window height -_startx = None -_starty = None -_title = "Turtle Graphics" # default title +class Screen(TurtleScreen): + + _root = None + _canvas = None + _title = _CFG["title"] + + # Borg-Idiom -class Pen(RawPen): + _shared_state = {} + + def __new__(cls, *args, **kwargs): + obj = object.__new__(cls, *args, **kwargs) + obj.__dict__ = cls._shared_state + return obj def __init__(self): - global _root, _canvas - if _root is None: - _root = Tkinter.Tk() - _root.wm_protocol("WM_DELETE_WINDOW", self._destroy) - _root.title(_title) - - if _canvas is None: - # XXX Should have scroll bars - _canvas = Tkinter.Canvas(_root, background="white") - _canvas.pack(expand=1, fill="both") + if Screen._root is None: + Screen._root = self._root = _Root() + self._root.title(Screen._title) + self._root.ondestroy(self._destroy) + if Screen._canvas is None: + width = _CFG["width"] + height = _CFG["height"] + canvwidth = _CFG["canvwidth"] + canvheight = _CFG["canvheight"] + leftright = _CFG["leftright"] + topbottom = _CFG["topbottom"] + self._root.setupcanvas(width, height, canvwidth, canvheight) + Screen._canvas = self._root._getcanvas() + self.setup(width, height, leftright, topbottom) + TurtleScreen.__init__(self, Screen._canvas) + Turtle._screen = self + + def setup(self, width=_CFG["width"], height=_CFG["height"], + startx=_CFG["leftright"], starty=_CFG["topbottom"]): + """ Set the size and position of the main window. + + Arguments: + width: as integer a size in pixels, as float a fraction of the screen. + Default is 50% of screen. + height: as integer the height in pixels, as float a fraction of the + screen. Default is 75% of screen. + startx: if positive, starting position in pixels from the left + edge of the screen, if negative from the right edge + Default, startx=None is to center window horizontally. + starty: if positive, starting position in pixels from the top + edge of the screen, if negative from the bottom edge + Default, starty=None is to center window vertically. + + Examples (for a Screen instance named screen): + >>> screen.setup (width=200, height=200, startx=0, starty=0) + + sets window to 200x200 pixels, in upper left of screen - setup(width=_width, height= _height, startx=_startx, starty=_starty) + >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) - RawPen.__init__(self, _canvas) + sets window to 75% of screen by 50% of screen and centers + """ + if not hasattr(self._root, "set_geometry"): + return + sw = self._root.win_width() + sh = self._root.win_height() + if isinstance(width, float) and 0 <= width <= 1: + width = sw*width + if startx is None: + startx = (sw - width) / 2 + if isinstance(height, float) and 0 <= height <= 1: + height = sh*height + if starty is None: + starty = (sh - height) / 2 + self._root.set_geometry(width, height, startx, starty) + + def title(self, titlestring): + """Set title of turtle-window + + Argument: + titlestring -- a string, to appear in the titlebar of the + turtle graphics window. + + This is a method of Screen-class. Not available for TurtleScreen- + objects. + + Example (for a Screen instance named screen): + >>> screen.title("Welcome to the turtle-zoo!") + """ + if Screen._root is not None: + Screen._root.title(titlestring) + Screen._title = titlestring def _destroy(self): - global _root, _canvas, _pen - root = self._canvas._root() - if root is _root: - _pen = None - _root = None - _canvas = None + root = self._root + if root is Screen._root: + Turtle._pen = None + Turtle._screen = None + Screen._root = None + Screen._canvas = None + TurtleScreen._RUNNING = True root.destroy() -def _getpen(): - global _pen - if not _pen: - _pen = Pen() - return _pen + def bye(self): + """Shut the turtlegraphics window. -class Turtle(Pen): - pass + Example (for a TurtleScreen instance named screen): + >>> screen.bye() + """ + self._destroy() -"""For documentation of the following functions see - the RawPen methods with the same names -""" + def exitonclick(self): + """Go into mainloop until the mouse is clicked. -def degrees(): _getpen().degrees() -def radians(): _getpen().radians() -def reset(): _getpen().reset() -def clear(): _getpen().clear() -def tracer(flag): _getpen().tracer(flag) -def forward(distance): _getpen().forward(distance) -def backward(distance): _getpen().backward(distance) -def left(angle): _getpen().left(angle) -def right(angle): _getpen().right(angle) -def up(): _getpen().up() -def down(): _getpen().down() -def width(width): _getpen().width(width) -def color(*args): _getpen().color(*args) -def write(arg, move=0): _getpen().write(arg, move) -def fill(flag): _getpen().fill(flag) -def begin_fill(): _getpen().begin_fill() -def end_fill(): _getpen().end_fill() -def circle(radius, extent=None): _getpen().circle(radius, extent) -def goto(*args): _getpen().goto(*args) -def heading(): return _getpen().heading() -def setheading(angle): _getpen().setheading(angle) -def position(): return _getpen().position() -def window_width(): return _getpen().window_width() -def window_height(): return _getpen().window_height() -def setx(xpos): _getpen().setx(xpos) -def sety(ypos): _getpen().sety(ypos) -def towards(*args): return _getpen().towards(*args) - -def done(): _root.mainloop() -def delay(delay): return _getpen().delay(delay) -def speed(speed): return _getpen().speed(speed) - -for methodname in dir(RawPen): - """ copies RawPen docstrings to module functions of same name """ - if not methodname.startswith("_"): - eval(methodname).__doc__ = RawPen.__dict__[methodname].__doc__ - - -def setup(**geometry): - """ Sets the size and position of the main window. - - Keywords are width, height, startx and starty: - - width: either a size in pixels or a fraction of the screen. - Default is 50% of screen. - height: either the height in pixels or a fraction of the screen. - Default is 75% of screen. - - Setting either width or height to None before drawing will force - use of default geometry as in older versions of turtle.py - - startx: starting position in pixels from the left edge of the screen. - Default is to center window. Setting startx to None is the default - and centers window horizontally on screen. - - starty: starting position in pixels from the top edge of the screen. - Default is to center window. Setting starty to None is the default - and centers window vertically on screen. - - Examples: - >>> setup (width=200, height=200, startx=0, starty=0) - - sets window to 200x200 pixels, in upper left of screen - - >>> setup(width=.75, height=0.5, startx=None, starty=None) - - sets window to 75% of screen by 50% of screen and centers - - >>> setup(width=None) - - forces use of default geometry as in older versions of turtle.py - """ - - global _width, _height, _startx, _starty - - width = geometry.get('width',_width) - if width >= 0 or width is None: - _width = width - else: - raise ValueError, "width can not be less than 0" + No arguments. - height = geometry.get('height',_height) - if height >= 0 or height is None: - _height = height - else: - raise ValueError, "height can not be less than 0" + Bind bye() method to mouseclick on TurtleScreen. + If "using_IDLE" - value in configuration dictionary is False + (default value), enter mainloop. + If IDLE with -n switch (no subprocess) is used, this value should be + set to True in turtle.cfg. In this case IDLE's mainloop + is active also for the client script. - startx = geometry.get('startx', _startx) - if startx >= 0 or startx is None: - _startx = _startx - else: - raise ValueError, "startx can not be less than 0" + This is a method of the Screen-class and not available for + TurtleScreen instances. - starty = geometry.get('starty', _starty) - if starty >= 0 or starty is None: - _starty = starty - else: - raise ValueError, "startx can not be less than 0" + Example (for a Screen instance named screen): + >>> screen.exitonclick() + """ + def exitGracefully(x, y): + """Screen.bye() with two dummy-parameters""" + self.bye() + self.onclick(exitGracefully) + if _CFG["using_IDLE"]: + return + try: + mainloop() + except AttributeError: + exit(0) - if _root and _width and _height: - if 0 < _width <= 1: - _width = _root.winfo_screenwidth() * +width - if 0 < _height <= 1: - _height = _root.winfo_screenheight() * _height - # center window on screen - if _startx is None: - _startx = (_root.winfo_screenwidth() - _width) / 2 +class Turtle(RawTurtle): + """RawTurtle auto-crating (scrolled) canvas. - if _starty is None: - _starty = (_root.winfo_screenheight() - _height) / 2 + When a Turtle object is created or a function derived from some + Turtle method is called a TurtleScreen object is automatically created. + """ + _pen = None + _screen = None - _root.geometry("%dx%d+%d+%d" % (_width, _height, _startx, _starty)) + def __init__(self, + shape=_CFG["shape"], + undobuffersize=_CFG["undobuffersize"], + visible=_CFG["visible"]): + if Turtle._screen is None: + Turtle._screen = Screen() + RawTurtle.__init__(self, Turtle._screen, + shape=shape, + undobuffersize=undobuffersize, + visible=visible) -def title(title): - """Set the window title. +Pen = Turtle - By default this is set to 'Turtle Graphics' +def _getpen(): + """Create the 'anonymous' turtle if not already present.""" + if Turtle._pen is None: + Turtle._pen = Turtle() + return Turtle._pen + +def _getscreen(): + """Create a TurtleScreen if not already present.""" + if Turtle._screen is None: + Turtle._screen = Screen() + return Turtle._screen + +def write_docstringdict(filename="turtle_docstringdict"): + """Create and write docstring-dictionary to file. + + Optional argument: + filename -- a string, used as filename + default value is turtle_docstringdict + + Has to be called explicitely, (not used by the turtle-graphics classes) + The docstring dictionary will be written to the Python script .py + It is intended to serve as a template for translation of the docstrings + into different languages. + """ + docsdict = {} - Example: - >>> title("My Window") + for methodname in _tg_screen_functions: + key = "Screen."+methodname + docsdict[key] = eval(key).__doc__ + for methodname in _tg_turtle_functions: + key = "Turtle."+methodname + docsdict[key] = eval(key).__doc__ + + f = open("%s.py" % filename,"w") + keys = sorted([x for x in docsdict.keys() + if x.split('.')[1] not in _alias_list]) + f.write('docsdict = {\n\n') + for key in keys[:-1]: + f.write('%s :\n' % repr(key)) + f.write(' """%s\n""",\n\n' % docsdict[key]) + key = keys[-1] + f.write('%s :\n' % repr(key)) + f.write(' """%s\n"""\n\n' % docsdict[key]) + f.write("}\n") + f.close() + +def read_docstrings(lang): + """Read in docstrings from lang-specific docstring dictionary. + + Transfer docstrings, translated to lang, from a dictionary-file + to the methods of classes Screen and Turtle and - in revised form - + to the corresponding functions. """ + modname = "turtle_docstringdict_%(language)s" % {'language':lang.lower()} + module = __import__(modname) + docsdict = module.docsdict + for key in docsdict: + #print key + try: + eval(key).im_func.__doc__ = docsdict[key] + except: + print "Bad docstring-entry: %s" % key - global _title - _title = title +_LANGUAGE = _CFG["language"] -def demo(): - reset() - tracer(1) - up() - backward(100) - down() - # draw 3 squares; the last filled - width(3) - for i in range(3): - if i == 2: - fill(1) - for j in range(4): - forward(20) - left(90) - if i == 2: - color("maroon") - fill(0) +try: + if _LANGUAGE != "english": + read_docstrings(_LANGUAGE) +except ImportError: + print "Cannot find docsdict for", _LANGUAGE +except: + print ("Unknown Error when trying to import %s-docstring-dictionary" % + _LANGUAGE) + + +def getmethparlist(ob): + "Get strings describing the arguments for the given object" + argText1 = argText2 = "" + # bit of a hack for methods - turn it into a function + # but we drop the "self" param. + if type(ob)==types.MethodType: + fob = ob.im_func + argOffset = 1 + else: + fob = ob + argOffset = 0 + # Try and build one for Python defined functions + if type(fob) in [types.FunctionType, types.LambdaType]: + try: + counter = fob.func_code.co_argcount + items2 = list(fob.func_code.co_varnames[argOffset:counter]) + realArgs = fob.func_code.co_varnames[argOffset:counter] + defaults = fob.func_defaults or [] + defaults = list(map(lambda name: "=%s" % repr(name), defaults)) + defaults = [""] * (len(realArgs)-len(defaults)) + defaults + items1 = map(lambda arg, dflt: arg+dflt, realArgs, defaults) + if fob.func_code.co_flags & 0x4: + items1.append("*"+fob.func_code.co_varnames[counter]) + items2.append("*"+fob.func_code.co_varnames[counter]) + counter += 1 + if fob.func_code.co_flags & 0x8: + items1.append("**"+fob.func_code.co_varnames[counter]) + items2.append("**"+fob.func_code.co_varnames[counter]) + argText1 = ", ".join(items1) + argText1 = "(%s)" % argText1 + argText2 = ", ".join(items2) + argText2 = "(%s)" % argText2 + except: + pass + return argText1, argText2 + +def _turtle_docrevise(docstr): + """To reduce docstrings from RawTurtle class for functions + """ + import re + if docstr is None: + return None + turtlename = _CFG["exampleturtle"] + newdocstr = docstr.replace("%s." % turtlename,"") + parexp = re.compile(r' \(.+ %s\):' % turtlename) + newdocstr = parexp.sub(":", newdocstr) + return newdocstr + +def _screen_docrevise(docstr): + """To reduce docstrings from TurtleScreen class for functions + """ + import re + if docstr is None: + return None + screenname = _CFG["examplescreen"] + newdocstr = docstr.replace("%s." % screenname,"") + parexp = re.compile(r' \(.+ %s\):' % screenname) + newdocstr = parexp.sub(":", newdocstr) + return newdocstr + +## The following mechanism makes all methods of RawTurtle and Turtle available +## as functions. So we can enhance, change, add, delete methods to these +## classes and do not need to change anything here. + + +for methodname in _tg_screen_functions: + pl1, pl2 = getmethparlist(eval('Screen.' + methodname)) + if pl1 == "": + print ">>>>>>", pl1, pl2 + continue + defstr = ("def %(key)s%(pl1)s: return _getscreen().%(key)s%(pl2)s" % + {'key':methodname, 'pl1':pl1, 'pl2':pl2}) + exec defstr + eval(methodname).__doc__ = _screen_docrevise(eval('Screen.'+methodname).__doc__) + +for methodname in _tg_turtle_functions: + pl1, pl2 = getmethparlist(eval('Turtle.' + methodname)) + if pl1 == "": + print ">>>>>>", pl1, pl2 + continue + defstr = ("def %(key)s%(pl1)s: return _getpen().%(key)s%(pl2)s" % + {'key':methodname, 'pl1':pl1, 'pl2':pl2}) + exec defstr + eval(methodname).__doc__ = _turtle_docrevise(eval('Turtle.'+methodname).__doc__) + + +done = mainloop = TK.mainloop +del pl1, pl2, defstr + +if __name__ == "__main__": + def switchpen(): + if isdown(): + pu() + else: + pd() + + def demo1(): + """Demo of old turtle.py - module""" + reset() + tracer(True) up() - forward(30) + backward(100) down() - width(1) - color("black") - # move out of the way - tracer(0) - up() - right(90) - forward(100) - right(90) - forward(100) - right(180) - down() - # some text - write("startstart", 1) - write("start", 1) - color("red") - # staircase - for i in range(5): - forward(20) - left(90) - forward(20) - right(90) - # filled staircase - fill(1) - for i in range(5): - forward(20) - left(90) - forward(20) - right(90) - fill(0) - tracer(1) - # more text - write("end") - -def demo2(): - # exercises some new and improved features - speed('fast') - width(3) - - # draw a segmented half-circle - setheading(towards(0,0)) - x,y = position() - r = (x**2+y**2)**.5/2.0 - right(90) - pendown = True - for i in range(18): - if pendown: + # draw 3 squares; the last filled + width(3) + for i in range(3): + if i == 2: + fill(1) + for _ in range(4): + forward(20) + left(90) + if i == 2: + color("maroon") + fill(0) up() - pendown = False - else: + forward(30) down() - pendown = True - circle(r,10) - sleep(2) - - reset() - left(90) - - # draw a series of triangles - l = 10 - color("green") - width(3) - left(180) - sp = 5 - for i in range(-2,16): - if i > 0: - color(1.0-0.05*i,0,0.05*i) - fill(1) - color("green") - for j in range(3): - forward(l) - left(120) - l += 10 - left(15) - if sp > 0: - sp = sp-1 - speed(speeds[sp]) - color(0.25,0,0.75) - fill(0) - - # draw and fill a concave shape - left(120) - up() - forward(70) - right(30) - down() - color("red") - speed("fastest") - fill(1) - for i in range(4): - circle(50,90) + width(1) + color("black") + # move out of the way + tracer(False) + up() right(90) - forward(30) + forward(100) right(90) - color("yellow") - fill(0) - left(90) - up() - forward(30) - down(); - - color("red") - - # create a second turtle and make the original pursue and catch it - turtle=Turtle() - turtle.reset() - turtle.left(90) - turtle.speed('normal') - turtle.up() - turtle.goto(280,40) - turtle.left(24) - turtle.down() - turtle.speed('fast') - turtle.color("blue") - turtle.width(2) - speed('fastest') - - # turn default turtle towards new turtle object - setheading(towards(turtle)) - while ( abs(position()[0]-turtle.position()[0])>4 or - abs(position()[1]-turtle.position()[1])>4): - turtle.forward(3.5) - turtle.left(0.6) - # turn default turtle towards new turtle object + forward(100) + right(180) + down() + # some text + write("startstart", 1) + write("start", 1) + color("red") + # staircase + for i in range(5): + forward(20) + left(90) + forward(20) + right(90) + # filled staircase + tracer(True) + fill(1) + for i in range(5): + forward(20) + left(90) + forward(20) + right(90) + fill(0) + # more text + + def demo2(): + """Demo of some new features.""" + speed(1) + st() + pensize(3) + setheading(towards(0, 0)) + radius = distance(0, 0)/2.0 + rt(90) + for _ in range(18): + switchpen() + circle(radius, 10) + write("wait a moment...") + while undobufferentries(): + undo() + reset() + lt(90) + colormode(255) + laenge = 10 + pencolor("green") + pensize(3) + lt(180) + for i in range(-2, 16): + if i > 0: + begin_fill() + fillcolor(255-15*i, 0, 15*i) + for _ in range(3): + fd(laenge) + lt(120) + laenge += 10 + lt(15) + speed((speed()+1)%12) + end_fill() + + lt(120) + pu() + fd(70) + rt(30) + pd() + color("red","yellow") + speed(0) + fill(1) + for _ in range(4): + circle(50, 90) + rt(90) + fd(30) + rt(90) + fill(0) + lt(90) + pu() + fd(30) + pd() + shape("turtle") + + tri = getturtle() + tri.resizemode("auto") + turtle = Turtle() + turtle.resizemode("auto") + turtle.shape("turtle") + turtle.reset() + turtle.left(90) + turtle.speed(0) + turtle.up() + turtle.goto(280, 40) + turtle.lt(30) + turtle.down() + turtle.speed(6) + turtle.color("blue","orange") + turtle.pensize(2) + tri.speed(6) setheading(towards(turtle)) - forward(4) - write("CAUGHT! ", move=True) - - + count = 1 + while tri.distance(turtle) > 4: + turtle.fd(3.5) + turtle.lt(0.6) + tri.setheading(tri.towards(turtle)) + tri.fd(4) + if count % 20 == 0: + turtle.stamp() + tri.stamp() + switchpen() + count += 1 + tri.write("CAUGHT! ", font=("Arial", 16, "bold"), align="right") + tri.pencolor("black") + tri.pencolor("red") + + def baba(xdummy, ydummy): + clearscreen() + bye() + + time.sleep(2) + + while undobufferentries(): + tri.undo() + turtle.undo() + tri.fd(50) + tri.write(" Click me!", font = ("Courier", 12, "bold") ) + tri.onclick(baba, 1) -if __name__ == '__main__': - demo() - sleep(3) + demo1() demo2() - done() + exitonclick() Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Wed Jun 4 08:29:55 2008 @@ -412,6 +412,7 @@ Bjorn Lindqvist Per Lindqvist Eric Lindvall +Gregor Lingl Nick Lockwood Stephanie Lockwood Anne Lord From python-checkins at python.org Wed Jun 4 11:24:42 2008 From: python-checkins at python.org (robert.schuppenies) Date: Wed, 4 Jun 2008 11:24:42 +0200 (CEST) Subject: [Python-checkins] r63930 - in python/branches/okkoto-sizeof: Demo/pdist/cmptree.py Demo/pdist/server.py Demo/turtle Doc/Makefile Doc/README.txt Doc/c-api/concrete.rst Doc/c-api/file.rst Doc/c-api/string.rst Doc/c-api/type.rst Doc/glossary.rst Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/library/_winreg.rst Doc/library/anydbm.rst Doc/library/basehttpserver.rst Doc/library/bsddb.rst Doc/library/calendar.rst Doc/library/cgihttpserver.rst Doc/library/cmd.rst Doc/library/codecs.rst Doc/library/collections.rst Doc/library/commands.rst Doc/library/configparser.rst Doc/library/cookie.rst Doc/library/cookielib.rst Doc/library/copy.rst Doc/library/copyreg.rst Doc/library/dbhash.rst Doc/library/dbm.rst Doc/library/docxmlrpcserver.rst Doc/library/dumbdbm.rst Doc/library/dummy_thread.rst Doc/library/easydialogs.rst Doc/library/ftplib.rst Doc/library/future_builtins.rst Doc/library/gdbm.rst Doc/library/htmllib.rst Doc/library/htmlparser.rst Doc/library/httplib.rst Doc/library/idle.rst Doc/library/logging.rst Doc/library/math.rst Doc/library/msilib.rst Doc/library/os.rst Doc/library/persistence.rst Doc/library/pickle.rst Doc/library/poplib.rst Doc/library/queue.rst Doc/library/re.rst Doc/library/reprlib.rst Doc/library/scrolledtext.rst Doc/library/sgmllib.rst Doc/library/shlex.rst Doc/library/shutil.rst Doc/library/simplehttpserver.rst Doc/library/simplexmlrpcserver.rst Doc/library/smtplib.rst Doc/library/socket.rst Doc/library/socketserver.rst Doc/library/stdtypes.rst Doc/library/string.rst Doc/library/struct.rst Doc/library/sys.rst Doc/library/tarfile.rst Doc/library/telnetlib.rst Doc/library/test.rst Doc/library/thread.rst Doc/library/threading.rst Doc/library/tix.rst Doc/library/tkinter.rst Doc/library/turtle.rst Doc/library/urllib2.rst Doc/library/userdict.rst Doc/library/whichdb.rst Doc/library/xmlrpclib.rst Doc/library/zipfile.rst Doc/reference/expressions.rst Doc/reference/simple_stmts.rst Doc/tools/sphinxext/pyspecific.py Doc/tutorial/controlflow.rst Doc/tutorial/datastructures.rst Doc/tutorial/errors.rst Doc/tutorial/floatingpoint.rst Doc/tutorial/inputoutput.rst Doc/tutorial/interpreter.rst Doc/tutorial/introduction.rst Doc/tutorial/stdlib2.rst Doc/using/cmdline.rst Doc/whatsnew/2.6.rst Include/Python.h Include/bytesobject.h Include/fileobject.h Include/floatobject.h Include/formatter_string.h Include/formatter_unicode.h Include/intobject.h Include/longobject.h Include/object.h Include/py_curses.h Include/pyerrors.h Include/pyport.h Include/pythonrun.h Include/stringobject.h Include/unicodeobject.h Include/warnings.h Lib/BaseHTTPServer.py Lib/SimpleXMLRPCServer.py Lib/UserString.py Lib/bdb.py Lib/bsddb/__init__.py Lib/bsddb/db.py Lib/bsddb/dbtables.py Lib/bsddb/test/test_all.py Lib/bsddb/test/test_lock.py Lib/bsddb/test/test_replication.py Lib/bsddb/test/test_sequence.py Lib/collections.py Lib/commands.py Lib/configparser.py Lib/copy.py Lib/copyreg.py Lib/ctypes/test/__init__.py Lib/ctypes/test/runtests.py Lib/ctypes/test/test_loading.py Lib/ctypes/test/test_pointers.py Lib/ctypes/util.py Lib/distutils/command/bdist_wininst.py Lib/distutils/command/upload.py Lib/distutils/command/wininst-6.0.exe Lib/distutils/command/wininst-7.1.exe Lib/distutils/command/wininst-9.0-amd64.exe Lib/distutils/command/wininst-9.0.exe Lib/distutils/config.py Lib/distutils/dist.py Lib/ftplib.py Lib/gzip.py Lib/heapq.py Lib/htmllib.py Lib/httplib.py Lib/idlelib/Debugger.py Lib/idlelib/ObjectBrowser.py Lib/idlelib/configHandler.py Lib/idlelib/rpc.py Lib/idlelib/run.py Lib/lib-old/ConfigParser.py Lib/lib-old/Queue.py Lib/lib-old/SocketServer.py Lib/lib-old/copy_reg.py Lib/lib-old/repr.py Lib/lib-tk/Dialog.py Lib/lib-tk/FileDialog.py Lib/lib-tk/FixTk.py Lib/lib-tk/ScrolledText.py Lib/lib-tk/SimpleDialog.py Lib/lib-tk/Tix.py Lib/lib-tk/Tkconstants.py Lib/lib-tk/Tkdnd.py Lib/lib-tk/Tkinter.py Lib/lib-tk/tkColorChooser.py Lib/lib-tk/tkCommonDialog.py Lib/lib-tk/tkFileDialog.py Lib/lib-tk/tkFont.py Lib/lib-tk/tkMessageBox.py Lib/lib-tk/tkSimpleDialog.py Lib/lib-tk/turtle.py Lib/lib2to3 Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/pgen2/driver.py Lib/lib2to3/tests/test_fixers.py Lib/locale.py Lib/logging/config.py Lib/logging/handlers.py Lib/os.py Lib/pdb.py Lib/pickle.py Lib/platform.py Lib/poplib.py Lib/pydoc.py Lib/queue.py Lib/re.py Lib/reprlib.py Lib/sgmllib.py Lib/smtplib.py Lib/socket.py Lib/socketserver.py Lib/sqlite3/test/dbapi.py Lib/sre_parse.py Lib/subprocess.py Lib/tarfile.py Lib/telnetlib.py Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/test___all__.py Lib/test/test_bsddb.py Lib/test/test_bsddb3.py Lib/test/test_cfgparser.py Lib/test/test_collections.py Lib/test/test_copy.py Lib/test/test_copyreg.py Lib/test/test_datetime.py Lib/test/test_descrtut.py Lib/test/test_dummy_thread.py Lib/test/test_enumerate.py Lib/test/test_ftplib.py Lib/test/test_generators.py Lib/test/test_genexps.py Lib/test/test_gzip.py Lib/test/test_htmllib.py Lib/test/test_httplib.py Lib/test/test_ioctl.py Lib/test/test_json.py Lib/test/test_logging.py Lib/test/test_math.py Lib/test/test_minidom.py Lib/test/test_mutex.py Lib/test/test_opcodes.py Lib/test/test_platform.py Lib/test/test_poplib.py Lib/test/test_py3kwarn.py Lib/test/test_pyclbr.py Lib/test/test_pydoc.py Lib/test/test_queue.py Lib/test/test_reprlib.py Lib/test/test_sgmllib.py Lib/test/test_smtplib.py Lib/test/test_socket.py Lib/test/test_socketserver.py Lib/test/test_subprocess.py Lib/test/test_support.py Lib/test/test_sys.py Lib/test/test_tarfile.py Lib/test/test_telnetlib.py Lib/test/test_threading.py Lib/test/test_unicodedata.py Lib/test/test_urllib.py Lib/test/test_urllib2.py Lib/test/test_urllib2net.py Lib/test/test_userstring.py Lib/test/test_weakref.py Lib/test/test_wsgiref.py Lib/test/test_zipfile.py Lib/threading.py Lib/urllib.py Lib/urllib2.py Lib/xml/dom/minidom.py Lib/xmlrpclib.py Lib/zipfile.py Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/ae/_AEmodule.c Mac/Modules/cf/_CFmodule.c Mac/Modules/cf/pycfbridge.c Mac/Modules/file/_Filemodule.c Mac/Modules/gestaltmodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndihooks.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Misc/ACKS Misc/NEWS Misc/build.sh Misc/cheatsheet Misc/developers.txt Modules/_bsddb.c Modules/_bytesio.c Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_csv.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_ctypes/libffi/configure Modules/_ctypes/libffi/configure.ac Modules/_ctypes/libffi/fficonfig.py.in Modules/_ctypes/malloc_closure.c Modules/_curses_panel.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_heapqmodule.c Modules/_hotshot.c Modules/_json.c Modules/_localemodule.c Modules/_lsprof.c Modules/_sqlite/cache.c Modules/_sqlite/connection.c Modules/_sqlite/connection.h Modules/_sqlite/cursor.c Modules/_sqlite/cursor.h Modules/_sqlite/module.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_sre.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/almodule.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/bsddb.h Modules/bsddbmodule.c Modules/bz2module.c Modules/cPickle.c Modules/cStringIO.c Modules/cdmodule.c Modules/cgensupport.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/clmodule.c Modules/cmathmodule.c Modules/datetimemodule.c Modules/dbmmodule.c Modules/dlmodule.c Modules/errnomodule.c Modules/fcntlmodule.c Modules/flmodule.c Modules/fmmodule.c Modules/gcmodule.c Modules/gdbmmodule.c Modules/glmodule.c Modules/grpmodule.c Modules/imageop.c Modules/imgfile.c Modules/itertoolsmodule.c Modules/linuxaudiodev.c Modules/main.c Modules/mathmodule.c Modules/md5module.c Modules/mmapmodule.c Modules/nismodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pwdmodule.c Modules/pyexpat.c Modules/readline.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/shamodule.c Modules/socketmodule.c Modules/spwdmodule.c Modules/stropmodule.c Modules/sunaudiodev.c Modules/svmodule.c Modules/syslogmodule.c Modules/termios.c Modules/threadmodule.c Modules/timemodule.c Modules/unicodedata.c Modules/zipimport.c Modules/zlibmodule.c Objects/abstract.c Objects/boolobject.c Objects/bufferobject.c Objects/bytes_methods.c Objects/bytesobject.c Objects/cellobject.c Objects/classobject.c Objects/codeobject.c Objects/complexobject.c Objects/descrobject.c Objects/dictobject.c Objects/enumobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/methodobject.c Objects/moduleobject.c Objects/object.c Objects/rangeobject.c Objects/setobject.c Objects/sliceobject.c Objects/stringlib/formatter.h Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/stringobject.c Objects/structseq.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/_bsddb.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/_ssl.vcproj PC/VS8.0/_tkinter.vcproj PC/VS8.0/bdist_wininst.vcproj PC/VS8.0/debug.vsprops PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyd.vsprops PC/VS8.0/pyd_d.vsprops PC/VS8.0/pyproject.vsprops PC/VS8.0/python.vcproj PC/VS8.0/pythoncore.vcproj PC/VS8.0/release.vsprops PC/VS8.0/x64.vsprops PC/_msi.c PC/_subprocess.c PC/_winreg.c PC/bdist_wininst/install.c PC/msvcrtmodule.c PC/winsound.c PCbuild/pyproject.vsprops PCbuild/pythoncore.vcproj Parser/asdl_c.py Parser/tokenizer.c Python/Python-ast.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/codecs.c Python/compile.c Python/errors.c Python/formatter_string.c Python/formatter_unicode.c Python/future.c Python/getargs.c Python/import.c Python/mactoolboxglue.c Python/marshal.c Python/modsupport.c Python/mysnprintf.c Python/peephole.c Python/pystrtod.c Python/pythonrun.c Python/structmember.c Python/symtable.c Python/sysmodule.c Python/traceback.c README RISCOS/Modules/drawfmodule.c RISCOS/Modules/riscosmodule.c RISCOS/Modules/swimodule.c Tools/README Tools/bgen/README Tools/msi/msi.py Tools/msi/msilib.py Tools/webchecker/wsgui.py configure configure.in pyconfig.h.in setup.py Message-ID: <20080604092442.5B8091E4002@bag.python.org> Author: robert.schuppenies Date: Wed Jun 4 11:24:23 2008 New Revision: 63930 Log: merged from trunk to revision 63929. Added: python/branches/okkoto-sizeof/Demo/turtle/ - copied from r63929, /python/trunk/Demo/turtle/ python/branches/okkoto-sizeof/Doc/library/scrolledtext.rst - copied unchanged from r63929, /python/trunk/Doc/library/scrolledtext.rst python/branches/okkoto-sizeof/Doc/library/tix.rst - copied unchanged from r63929, /python/trunk/Doc/library/tix.rst python/branches/okkoto-sizeof/Doc/library/turtle.rst - copied unchanged from r63929, /python/trunk/Doc/library/turtle.rst python/branches/okkoto-sizeof/Include/bytesobject.h - copied unchanged from r63929, /python/trunk/Include/bytesobject.h python/branches/okkoto-sizeof/Include/stringobject.h - copied unchanged from r63929, /python/trunk/Include/stringobject.h python/branches/okkoto-sizeof/Lib/lib-tk/FileDialog.py - copied unchanged from r63929, /python/trunk/Lib/lib-tk/FileDialog.py python/branches/okkoto-sizeof/Lib/lib-tk/SimpleDialog.py - copied unchanged from r63929, /python/trunk/Lib/lib-tk/SimpleDialog.py python/branches/okkoto-sizeof/Lib/lib-tk/tkFileDialog.py - copied unchanged from r63929, /python/trunk/Lib/lib-tk/tkFileDialog.py python/branches/okkoto-sizeof/Lib/lib-tk/tkSimpleDialog.py - copied unchanged from r63929, /python/trunk/Lib/lib-tk/tkSimpleDialog.py python/branches/okkoto-sizeof/Objects/bytesobject.c - copied unchanged from r63929, /python/trunk/Objects/bytesobject.c Removed: python/branches/okkoto-sizeof/Doc/library/copyreg.rst python/branches/okkoto-sizeof/Doc/library/reprlib.rst python/branches/okkoto-sizeof/Include/formatter_string.h python/branches/okkoto-sizeof/Include/formatter_unicode.h python/branches/okkoto-sizeof/Lib/configparser.py python/branches/okkoto-sizeof/Lib/copyreg.py python/branches/okkoto-sizeof/Lib/lib-old/ConfigParser.py python/branches/okkoto-sizeof/Lib/lib-old/Queue.py python/branches/okkoto-sizeof/Lib/lib-old/SocketServer.py python/branches/okkoto-sizeof/Lib/lib-old/copy_reg.py python/branches/okkoto-sizeof/Lib/lib-old/repr.py python/branches/okkoto-sizeof/Lib/queue.py python/branches/okkoto-sizeof/Lib/reprlib.py python/branches/okkoto-sizeof/Lib/socketserver.py python/branches/okkoto-sizeof/Lib/test/test_copyreg.py python/branches/okkoto-sizeof/Lib/test/test_reprlib.py python/branches/okkoto-sizeof/Objects/stringobject.c Modified: python/branches/okkoto-sizeof/Demo/pdist/cmptree.py python/branches/okkoto-sizeof/Demo/pdist/server.py python/branches/okkoto-sizeof/Doc/Makefile python/branches/okkoto-sizeof/Doc/README.txt python/branches/okkoto-sizeof/Doc/c-api/concrete.rst python/branches/okkoto-sizeof/Doc/c-api/file.rst python/branches/okkoto-sizeof/Doc/c-api/string.rst python/branches/okkoto-sizeof/Doc/c-api/type.rst python/branches/okkoto-sizeof/Doc/glossary.rst python/branches/okkoto-sizeof/Doc/includes/noddy2.c python/branches/okkoto-sizeof/Doc/includes/noddy3.c python/branches/okkoto-sizeof/Doc/includes/noddy4.c python/branches/okkoto-sizeof/Doc/includes/run-func.c python/branches/okkoto-sizeof/Doc/library/_winreg.rst python/branches/okkoto-sizeof/Doc/library/anydbm.rst python/branches/okkoto-sizeof/Doc/library/basehttpserver.rst python/branches/okkoto-sizeof/Doc/library/bsddb.rst python/branches/okkoto-sizeof/Doc/library/calendar.rst python/branches/okkoto-sizeof/Doc/library/cgihttpserver.rst python/branches/okkoto-sizeof/Doc/library/cmd.rst python/branches/okkoto-sizeof/Doc/library/codecs.rst python/branches/okkoto-sizeof/Doc/library/collections.rst python/branches/okkoto-sizeof/Doc/library/commands.rst python/branches/okkoto-sizeof/Doc/library/configparser.rst python/branches/okkoto-sizeof/Doc/library/cookie.rst python/branches/okkoto-sizeof/Doc/library/cookielib.rst python/branches/okkoto-sizeof/Doc/library/copy.rst python/branches/okkoto-sizeof/Doc/library/dbhash.rst python/branches/okkoto-sizeof/Doc/library/dbm.rst python/branches/okkoto-sizeof/Doc/library/docxmlrpcserver.rst python/branches/okkoto-sizeof/Doc/library/dumbdbm.rst python/branches/okkoto-sizeof/Doc/library/dummy_thread.rst python/branches/okkoto-sizeof/Doc/library/easydialogs.rst python/branches/okkoto-sizeof/Doc/library/ftplib.rst python/branches/okkoto-sizeof/Doc/library/future_builtins.rst python/branches/okkoto-sizeof/Doc/library/gdbm.rst python/branches/okkoto-sizeof/Doc/library/htmllib.rst python/branches/okkoto-sizeof/Doc/library/htmlparser.rst python/branches/okkoto-sizeof/Doc/library/httplib.rst python/branches/okkoto-sizeof/Doc/library/idle.rst python/branches/okkoto-sizeof/Doc/library/logging.rst python/branches/okkoto-sizeof/Doc/library/math.rst python/branches/okkoto-sizeof/Doc/library/msilib.rst python/branches/okkoto-sizeof/Doc/library/os.rst python/branches/okkoto-sizeof/Doc/library/persistence.rst python/branches/okkoto-sizeof/Doc/library/pickle.rst python/branches/okkoto-sizeof/Doc/library/poplib.rst python/branches/okkoto-sizeof/Doc/library/queue.rst python/branches/okkoto-sizeof/Doc/library/re.rst python/branches/okkoto-sizeof/Doc/library/sgmllib.rst python/branches/okkoto-sizeof/Doc/library/shlex.rst python/branches/okkoto-sizeof/Doc/library/shutil.rst python/branches/okkoto-sizeof/Doc/library/simplehttpserver.rst python/branches/okkoto-sizeof/Doc/library/simplexmlrpcserver.rst python/branches/okkoto-sizeof/Doc/library/smtplib.rst python/branches/okkoto-sizeof/Doc/library/socket.rst python/branches/okkoto-sizeof/Doc/library/socketserver.rst python/branches/okkoto-sizeof/Doc/library/stdtypes.rst python/branches/okkoto-sizeof/Doc/library/string.rst python/branches/okkoto-sizeof/Doc/library/struct.rst python/branches/okkoto-sizeof/Doc/library/sys.rst python/branches/okkoto-sizeof/Doc/library/tarfile.rst python/branches/okkoto-sizeof/Doc/library/telnetlib.rst python/branches/okkoto-sizeof/Doc/library/test.rst python/branches/okkoto-sizeof/Doc/library/thread.rst python/branches/okkoto-sizeof/Doc/library/threading.rst python/branches/okkoto-sizeof/Doc/library/tkinter.rst python/branches/okkoto-sizeof/Doc/library/urllib2.rst python/branches/okkoto-sizeof/Doc/library/userdict.rst python/branches/okkoto-sizeof/Doc/library/whichdb.rst python/branches/okkoto-sizeof/Doc/library/xmlrpclib.rst python/branches/okkoto-sizeof/Doc/library/zipfile.rst python/branches/okkoto-sizeof/Doc/reference/expressions.rst python/branches/okkoto-sizeof/Doc/reference/simple_stmts.rst python/branches/okkoto-sizeof/Doc/tools/sphinxext/pyspecific.py python/branches/okkoto-sizeof/Doc/tutorial/controlflow.rst python/branches/okkoto-sizeof/Doc/tutorial/datastructures.rst python/branches/okkoto-sizeof/Doc/tutorial/errors.rst python/branches/okkoto-sizeof/Doc/tutorial/floatingpoint.rst python/branches/okkoto-sizeof/Doc/tutorial/inputoutput.rst python/branches/okkoto-sizeof/Doc/tutorial/interpreter.rst python/branches/okkoto-sizeof/Doc/tutorial/introduction.rst python/branches/okkoto-sizeof/Doc/tutorial/stdlib2.rst python/branches/okkoto-sizeof/Doc/using/cmdline.rst python/branches/okkoto-sizeof/Doc/whatsnew/2.6.rst python/branches/okkoto-sizeof/Include/Python.h python/branches/okkoto-sizeof/Include/fileobject.h python/branches/okkoto-sizeof/Include/floatobject.h python/branches/okkoto-sizeof/Include/intobject.h python/branches/okkoto-sizeof/Include/longobject.h python/branches/okkoto-sizeof/Include/object.h python/branches/okkoto-sizeof/Include/py_curses.h python/branches/okkoto-sizeof/Include/pyerrors.h python/branches/okkoto-sizeof/Include/pyport.h python/branches/okkoto-sizeof/Include/pythonrun.h python/branches/okkoto-sizeof/Include/unicodeobject.h python/branches/okkoto-sizeof/Include/warnings.h python/branches/okkoto-sizeof/Lib/BaseHTTPServer.py python/branches/okkoto-sizeof/Lib/SimpleXMLRPCServer.py python/branches/okkoto-sizeof/Lib/UserString.py python/branches/okkoto-sizeof/Lib/bdb.py python/branches/okkoto-sizeof/Lib/bsddb/__init__.py python/branches/okkoto-sizeof/Lib/bsddb/db.py python/branches/okkoto-sizeof/Lib/bsddb/dbtables.py python/branches/okkoto-sizeof/Lib/bsddb/test/test_all.py python/branches/okkoto-sizeof/Lib/bsddb/test/test_lock.py python/branches/okkoto-sizeof/Lib/bsddb/test/test_replication.py python/branches/okkoto-sizeof/Lib/bsddb/test/test_sequence.py python/branches/okkoto-sizeof/Lib/collections.py python/branches/okkoto-sizeof/Lib/commands.py python/branches/okkoto-sizeof/Lib/copy.py python/branches/okkoto-sizeof/Lib/ctypes/test/__init__.py python/branches/okkoto-sizeof/Lib/ctypes/test/runtests.py python/branches/okkoto-sizeof/Lib/ctypes/test/test_loading.py python/branches/okkoto-sizeof/Lib/ctypes/test/test_pointers.py python/branches/okkoto-sizeof/Lib/ctypes/util.py python/branches/okkoto-sizeof/Lib/distutils/command/bdist_wininst.py python/branches/okkoto-sizeof/Lib/distutils/command/upload.py python/branches/okkoto-sizeof/Lib/distutils/command/wininst-6.0.exe python/branches/okkoto-sizeof/Lib/distutils/command/wininst-7.1.exe python/branches/okkoto-sizeof/Lib/distutils/command/wininst-9.0-amd64.exe python/branches/okkoto-sizeof/Lib/distutils/command/wininst-9.0.exe python/branches/okkoto-sizeof/Lib/distutils/config.py python/branches/okkoto-sizeof/Lib/distutils/dist.py python/branches/okkoto-sizeof/Lib/ftplib.py python/branches/okkoto-sizeof/Lib/gzip.py python/branches/okkoto-sizeof/Lib/heapq.py python/branches/okkoto-sizeof/Lib/htmllib.py python/branches/okkoto-sizeof/Lib/httplib.py python/branches/okkoto-sizeof/Lib/idlelib/Debugger.py python/branches/okkoto-sizeof/Lib/idlelib/ObjectBrowser.py python/branches/okkoto-sizeof/Lib/idlelib/configHandler.py python/branches/okkoto-sizeof/Lib/idlelib/rpc.py python/branches/okkoto-sizeof/Lib/idlelib/run.py python/branches/okkoto-sizeof/Lib/lib-tk/Dialog.py (contents, props changed) python/branches/okkoto-sizeof/Lib/lib-tk/FixTk.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/ScrolledText.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/Tix.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/Tkconstants.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/Tkdnd.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/Tkinter.py (contents, props changed) python/branches/okkoto-sizeof/Lib/lib-tk/tkColorChooser.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/tkCommonDialog.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/tkFont.py (contents, props changed) python/branches/okkoto-sizeof/Lib/lib-tk/tkMessageBox.py (props changed) python/branches/okkoto-sizeof/Lib/lib-tk/turtle.py (contents, props changed) python/branches/okkoto-sizeof/Lib/lib2to3/ (props changed) python/branches/okkoto-sizeof/Lib/lib2to3/fixes/fix_imports.py python/branches/okkoto-sizeof/Lib/lib2to3/pgen2/driver.py python/branches/okkoto-sizeof/Lib/lib2to3/tests/test_fixers.py python/branches/okkoto-sizeof/Lib/locale.py python/branches/okkoto-sizeof/Lib/logging/config.py python/branches/okkoto-sizeof/Lib/logging/handlers.py python/branches/okkoto-sizeof/Lib/os.py python/branches/okkoto-sizeof/Lib/pdb.py python/branches/okkoto-sizeof/Lib/pickle.py python/branches/okkoto-sizeof/Lib/platform.py python/branches/okkoto-sizeof/Lib/poplib.py python/branches/okkoto-sizeof/Lib/pydoc.py python/branches/okkoto-sizeof/Lib/re.py python/branches/okkoto-sizeof/Lib/sgmllib.py python/branches/okkoto-sizeof/Lib/smtplib.py python/branches/okkoto-sizeof/Lib/socket.py python/branches/okkoto-sizeof/Lib/sqlite3/test/dbapi.py python/branches/okkoto-sizeof/Lib/sre_parse.py python/branches/okkoto-sizeof/Lib/subprocess.py python/branches/okkoto-sizeof/Lib/tarfile.py python/branches/okkoto-sizeof/Lib/telnetlib.py python/branches/okkoto-sizeof/Lib/test/pickletester.py python/branches/okkoto-sizeof/Lib/test/regrtest.py python/branches/okkoto-sizeof/Lib/test/test___all__.py python/branches/okkoto-sizeof/Lib/test/test_bsddb.py python/branches/okkoto-sizeof/Lib/test/test_bsddb3.py python/branches/okkoto-sizeof/Lib/test/test_cfgparser.py python/branches/okkoto-sizeof/Lib/test/test_collections.py python/branches/okkoto-sizeof/Lib/test/test_copy.py python/branches/okkoto-sizeof/Lib/test/test_datetime.py python/branches/okkoto-sizeof/Lib/test/test_descrtut.py python/branches/okkoto-sizeof/Lib/test/test_dummy_thread.py python/branches/okkoto-sizeof/Lib/test/test_enumerate.py python/branches/okkoto-sizeof/Lib/test/test_ftplib.py python/branches/okkoto-sizeof/Lib/test/test_generators.py python/branches/okkoto-sizeof/Lib/test/test_genexps.py python/branches/okkoto-sizeof/Lib/test/test_gzip.py python/branches/okkoto-sizeof/Lib/test/test_htmllib.py python/branches/okkoto-sizeof/Lib/test/test_httplib.py python/branches/okkoto-sizeof/Lib/test/test_ioctl.py python/branches/okkoto-sizeof/Lib/test/test_json.py python/branches/okkoto-sizeof/Lib/test/test_logging.py python/branches/okkoto-sizeof/Lib/test/test_math.py python/branches/okkoto-sizeof/Lib/test/test_minidom.py python/branches/okkoto-sizeof/Lib/test/test_mutex.py python/branches/okkoto-sizeof/Lib/test/test_opcodes.py python/branches/okkoto-sizeof/Lib/test/test_platform.py python/branches/okkoto-sizeof/Lib/test/test_poplib.py python/branches/okkoto-sizeof/Lib/test/test_py3kwarn.py python/branches/okkoto-sizeof/Lib/test/test_pyclbr.py python/branches/okkoto-sizeof/Lib/test/test_pydoc.py python/branches/okkoto-sizeof/Lib/test/test_queue.py python/branches/okkoto-sizeof/Lib/test/test_sgmllib.py python/branches/okkoto-sizeof/Lib/test/test_smtplib.py python/branches/okkoto-sizeof/Lib/test/test_socket.py python/branches/okkoto-sizeof/Lib/test/test_socketserver.py python/branches/okkoto-sizeof/Lib/test/test_subprocess.py python/branches/okkoto-sizeof/Lib/test/test_support.py python/branches/okkoto-sizeof/Lib/test/test_sys.py python/branches/okkoto-sizeof/Lib/test/test_tarfile.py python/branches/okkoto-sizeof/Lib/test/test_telnetlib.py python/branches/okkoto-sizeof/Lib/test/test_threading.py python/branches/okkoto-sizeof/Lib/test/test_unicodedata.py python/branches/okkoto-sizeof/Lib/test/test_urllib.py python/branches/okkoto-sizeof/Lib/test/test_urllib2.py python/branches/okkoto-sizeof/Lib/test/test_urllib2net.py python/branches/okkoto-sizeof/Lib/test/test_userstring.py python/branches/okkoto-sizeof/Lib/test/test_weakref.py python/branches/okkoto-sizeof/Lib/test/test_wsgiref.py python/branches/okkoto-sizeof/Lib/test/test_zipfile.py python/branches/okkoto-sizeof/Lib/threading.py python/branches/okkoto-sizeof/Lib/urllib.py python/branches/okkoto-sizeof/Lib/urllib2.py python/branches/okkoto-sizeof/Lib/xml/dom/minidom.py python/branches/okkoto-sizeof/Lib/xmlrpclib.py python/branches/okkoto-sizeof/Lib/zipfile.py python/branches/okkoto-sizeof/Mac/Modules/MacOS.c python/branches/okkoto-sizeof/Mac/Modules/Nav.c python/branches/okkoto-sizeof/Mac/Modules/ae/_AEmodule.c python/branches/okkoto-sizeof/Mac/Modules/cf/_CFmodule.c python/branches/okkoto-sizeof/Mac/Modules/cf/pycfbridge.c python/branches/okkoto-sizeof/Mac/Modules/file/_Filemodule.c python/branches/okkoto-sizeof/Mac/Modules/gestaltmodule.c python/branches/okkoto-sizeof/Mac/Modules/qd/_Qdmodule.c python/branches/okkoto-sizeof/Mac/Modules/qdoffs/_Qdoffsmodule.c python/branches/okkoto-sizeof/Mac/Modules/res/_Resmodule.c python/branches/okkoto-sizeof/Mac/Modules/scrap/_Scrapmodule.c python/branches/okkoto-sizeof/Mac/Modules/snd/_Sndihooks.c python/branches/okkoto-sizeof/Mac/Modules/win/_Winmodule.c python/branches/okkoto-sizeof/Makefile.pre.in python/branches/okkoto-sizeof/Misc/ACKS python/branches/okkoto-sizeof/Misc/NEWS python/branches/okkoto-sizeof/Misc/build.sh python/branches/okkoto-sizeof/Misc/cheatsheet python/branches/okkoto-sizeof/Misc/developers.txt python/branches/okkoto-sizeof/Modules/_bsddb.c python/branches/okkoto-sizeof/Modules/_bytesio.c python/branches/okkoto-sizeof/Modules/_codecsmodule.c python/branches/okkoto-sizeof/Modules/_collectionsmodule.c python/branches/okkoto-sizeof/Modules/_csv.c python/branches/okkoto-sizeof/Modules/_ctypes/_ctypes.c python/branches/okkoto-sizeof/Modules/_ctypes/callbacks.c python/branches/okkoto-sizeof/Modules/_ctypes/callproc.c python/branches/okkoto-sizeof/Modules/_ctypes/cfield.c python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure.ac python/branches/okkoto-sizeof/Modules/_ctypes/libffi/fficonfig.py.in python/branches/okkoto-sizeof/Modules/_ctypes/malloc_closure.c python/branches/okkoto-sizeof/Modules/_curses_panel.c python/branches/okkoto-sizeof/Modules/_cursesmodule.c python/branches/okkoto-sizeof/Modules/_elementtree.c python/branches/okkoto-sizeof/Modules/_fileio.c python/branches/okkoto-sizeof/Modules/_hashopenssl.c python/branches/okkoto-sizeof/Modules/_heapqmodule.c python/branches/okkoto-sizeof/Modules/_hotshot.c python/branches/okkoto-sizeof/Modules/_json.c python/branches/okkoto-sizeof/Modules/_localemodule.c python/branches/okkoto-sizeof/Modules/_lsprof.c python/branches/okkoto-sizeof/Modules/_sqlite/cache.c python/branches/okkoto-sizeof/Modules/_sqlite/connection.c python/branches/okkoto-sizeof/Modules/_sqlite/connection.h python/branches/okkoto-sizeof/Modules/_sqlite/cursor.c python/branches/okkoto-sizeof/Modules/_sqlite/cursor.h python/branches/okkoto-sizeof/Modules/_sqlite/module.c python/branches/okkoto-sizeof/Modules/_sqlite/row.c python/branches/okkoto-sizeof/Modules/_sqlite/statement.c python/branches/okkoto-sizeof/Modules/_sre.c python/branches/okkoto-sizeof/Modules/_ssl.c python/branches/okkoto-sizeof/Modules/_struct.c python/branches/okkoto-sizeof/Modules/_testcapimodule.c python/branches/okkoto-sizeof/Modules/_tkinter.c python/branches/okkoto-sizeof/Modules/almodule.c python/branches/okkoto-sizeof/Modules/arraymodule.c python/branches/okkoto-sizeof/Modules/audioop.c python/branches/okkoto-sizeof/Modules/binascii.c python/branches/okkoto-sizeof/Modules/bsddb.h python/branches/okkoto-sizeof/Modules/bsddbmodule.c python/branches/okkoto-sizeof/Modules/bz2module.c python/branches/okkoto-sizeof/Modules/cPickle.c python/branches/okkoto-sizeof/Modules/cStringIO.c python/branches/okkoto-sizeof/Modules/cdmodule.c python/branches/okkoto-sizeof/Modules/cgensupport.c python/branches/okkoto-sizeof/Modules/cjkcodecs/cjkcodecs.h python/branches/okkoto-sizeof/Modules/cjkcodecs/multibytecodec.c python/branches/okkoto-sizeof/Modules/clmodule.c python/branches/okkoto-sizeof/Modules/cmathmodule.c python/branches/okkoto-sizeof/Modules/datetimemodule.c python/branches/okkoto-sizeof/Modules/dbmmodule.c python/branches/okkoto-sizeof/Modules/dlmodule.c python/branches/okkoto-sizeof/Modules/errnomodule.c python/branches/okkoto-sizeof/Modules/fcntlmodule.c python/branches/okkoto-sizeof/Modules/flmodule.c python/branches/okkoto-sizeof/Modules/fmmodule.c python/branches/okkoto-sizeof/Modules/gcmodule.c python/branches/okkoto-sizeof/Modules/gdbmmodule.c python/branches/okkoto-sizeof/Modules/glmodule.c python/branches/okkoto-sizeof/Modules/grpmodule.c python/branches/okkoto-sizeof/Modules/imageop.c python/branches/okkoto-sizeof/Modules/imgfile.c python/branches/okkoto-sizeof/Modules/itertoolsmodule.c python/branches/okkoto-sizeof/Modules/linuxaudiodev.c python/branches/okkoto-sizeof/Modules/main.c python/branches/okkoto-sizeof/Modules/mathmodule.c python/branches/okkoto-sizeof/Modules/md5module.c python/branches/okkoto-sizeof/Modules/mmapmodule.c python/branches/okkoto-sizeof/Modules/nismodule.c python/branches/okkoto-sizeof/Modules/operator.c python/branches/okkoto-sizeof/Modules/ossaudiodev.c python/branches/okkoto-sizeof/Modules/parsermodule.c python/branches/okkoto-sizeof/Modules/posixmodule.c python/branches/okkoto-sizeof/Modules/pwdmodule.c python/branches/okkoto-sizeof/Modules/pyexpat.c python/branches/okkoto-sizeof/Modules/readline.c python/branches/okkoto-sizeof/Modules/selectmodule.c python/branches/okkoto-sizeof/Modules/sha256module.c python/branches/okkoto-sizeof/Modules/sha512module.c python/branches/okkoto-sizeof/Modules/shamodule.c python/branches/okkoto-sizeof/Modules/socketmodule.c python/branches/okkoto-sizeof/Modules/spwdmodule.c python/branches/okkoto-sizeof/Modules/stropmodule.c python/branches/okkoto-sizeof/Modules/sunaudiodev.c python/branches/okkoto-sizeof/Modules/svmodule.c python/branches/okkoto-sizeof/Modules/syslogmodule.c python/branches/okkoto-sizeof/Modules/termios.c python/branches/okkoto-sizeof/Modules/threadmodule.c python/branches/okkoto-sizeof/Modules/timemodule.c python/branches/okkoto-sizeof/Modules/unicodedata.c python/branches/okkoto-sizeof/Modules/zipimport.c python/branches/okkoto-sizeof/Modules/zlibmodule.c python/branches/okkoto-sizeof/Objects/abstract.c python/branches/okkoto-sizeof/Objects/boolobject.c python/branches/okkoto-sizeof/Objects/bufferobject.c python/branches/okkoto-sizeof/Objects/bytes_methods.c python/branches/okkoto-sizeof/Objects/cellobject.c python/branches/okkoto-sizeof/Objects/classobject.c python/branches/okkoto-sizeof/Objects/codeobject.c python/branches/okkoto-sizeof/Objects/complexobject.c python/branches/okkoto-sizeof/Objects/descrobject.c python/branches/okkoto-sizeof/Objects/dictobject.c python/branches/okkoto-sizeof/Objects/enumobject.c python/branches/okkoto-sizeof/Objects/exceptions.c python/branches/okkoto-sizeof/Objects/fileobject.c python/branches/okkoto-sizeof/Objects/floatobject.c python/branches/okkoto-sizeof/Objects/frameobject.c python/branches/okkoto-sizeof/Objects/funcobject.c python/branches/okkoto-sizeof/Objects/genobject.c python/branches/okkoto-sizeof/Objects/intobject.c python/branches/okkoto-sizeof/Objects/listobject.c python/branches/okkoto-sizeof/Objects/longobject.c python/branches/okkoto-sizeof/Objects/methodobject.c python/branches/okkoto-sizeof/Objects/moduleobject.c python/branches/okkoto-sizeof/Objects/object.c python/branches/okkoto-sizeof/Objects/rangeobject.c python/branches/okkoto-sizeof/Objects/setobject.c python/branches/okkoto-sizeof/Objects/sliceobject.c python/branches/okkoto-sizeof/Objects/stringlib/formatter.h python/branches/okkoto-sizeof/Objects/stringlib/string_format.h python/branches/okkoto-sizeof/Objects/stringlib/stringdefs.h python/branches/okkoto-sizeof/Objects/structseq.c python/branches/okkoto-sizeof/Objects/tupleobject.c python/branches/okkoto-sizeof/Objects/typeobject.c python/branches/okkoto-sizeof/Objects/unicodeobject.c python/branches/okkoto-sizeof/Objects/weakrefobject.c python/branches/okkoto-sizeof/PC/VC6/pythoncore.dsp python/branches/okkoto-sizeof/PC/VS7.1/pythoncore.vcproj python/branches/okkoto-sizeof/PC/VS8.0/_bsddb.vcproj python/branches/okkoto-sizeof/PC/VS8.0/_elementtree.vcproj python/branches/okkoto-sizeof/PC/VS8.0/_sqlite3.vcproj python/branches/okkoto-sizeof/PC/VS8.0/_ssl.vcproj python/branches/okkoto-sizeof/PC/VS8.0/_tkinter.vcproj python/branches/okkoto-sizeof/PC/VS8.0/bdist_wininst.vcproj python/branches/okkoto-sizeof/PC/VS8.0/debug.vsprops python/branches/okkoto-sizeof/PC/VS8.0/make_versioninfo.vcproj python/branches/okkoto-sizeof/PC/VS8.0/pcbuild.sln python/branches/okkoto-sizeof/PC/VS8.0/pyd.vsprops python/branches/okkoto-sizeof/PC/VS8.0/pyd_d.vsprops python/branches/okkoto-sizeof/PC/VS8.0/pyproject.vsprops python/branches/okkoto-sizeof/PC/VS8.0/python.vcproj python/branches/okkoto-sizeof/PC/VS8.0/pythoncore.vcproj python/branches/okkoto-sizeof/PC/VS8.0/release.vsprops python/branches/okkoto-sizeof/PC/VS8.0/x64.vsprops python/branches/okkoto-sizeof/PC/_msi.c python/branches/okkoto-sizeof/PC/_subprocess.c python/branches/okkoto-sizeof/PC/_winreg.c python/branches/okkoto-sizeof/PC/bdist_wininst/install.c python/branches/okkoto-sizeof/PC/msvcrtmodule.c python/branches/okkoto-sizeof/PC/winsound.c python/branches/okkoto-sizeof/PCbuild/pyproject.vsprops python/branches/okkoto-sizeof/PCbuild/pythoncore.vcproj python/branches/okkoto-sizeof/Parser/asdl_c.py python/branches/okkoto-sizeof/Parser/tokenizer.c python/branches/okkoto-sizeof/Python/Python-ast.c python/branches/okkoto-sizeof/Python/_warnings.c python/branches/okkoto-sizeof/Python/ast.c python/branches/okkoto-sizeof/Python/bltinmodule.c python/branches/okkoto-sizeof/Python/ceval.c python/branches/okkoto-sizeof/Python/codecs.c python/branches/okkoto-sizeof/Python/compile.c python/branches/okkoto-sizeof/Python/errors.c python/branches/okkoto-sizeof/Python/formatter_string.c python/branches/okkoto-sizeof/Python/formatter_unicode.c python/branches/okkoto-sizeof/Python/future.c python/branches/okkoto-sizeof/Python/getargs.c python/branches/okkoto-sizeof/Python/import.c python/branches/okkoto-sizeof/Python/mactoolboxglue.c python/branches/okkoto-sizeof/Python/marshal.c python/branches/okkoto-sizeof/Python/modsupport.c python/branches/okkoto-sizeof/Python/mysnprintf.c python/branches/okkoto-sizeof/Python/peephole.c python/branches/okkoto-sizeof/Python/pystrtod.c python/branches/okkoto-sizeof/Python/pythonrun.c python/branches/okkoto-sizeof/Python/structmember.c python/branches/okkoto-sizeof/Python/symtable.c python/branches/okkoto-sizeof/Python/sysmodule.c python/branches/okkoto-sizeof/Python/traceback.c python/branches/okkoto-sizeof/README python/branches/okkoto-sizeof/RISCOS/Modules/drawfmodule.c python/branches/okkoto-sizeof/RISCOS/Modules/riscosmodule.c python/branches/okkoto-sizeof/RISCOS/Modules/swimodule.c python/branches/okkoto-sizeof/Tools/README python/branches/okkoto-sizeof/Tools/bgen/README python/branches/okkoto-sizeof/Tools/msi/msi.py python/branches/okkoto-sizeof/Tools/msi/msilib.py python/branches/okkoto-sizeof/Tools/webchecker/wsgui.py python/branches/okkoto-sizeof/configure python/branches/okkoto-sizeof/configure.in python/branches/okkoto-sizeof/pyconfig.h.in python/branches/okkoto-sizeof/setup.py Modified: python/branches/okkoto-sizeof/Demo/pdist/cmptree.py ============================================================================== --- python/branches/okkoto-sizeof/Demo/pdist/cmptree.py (original) +++ python/branches/okkoto-sizeof/Demo/pdist/cmptree.py Wed Jun 4 11:24:23 2008 @@ -1,7 +1,7 @@ """Compare local and remote dictionaries and transfer differing files -- like rdist.""" import sys -from reprlib import repr +from repr import repr import FSProxy import time import os Modified: python/branches/okkoto-sizeof/Demo/pdist/server.py ============================================================================== --- python/branches/okkoto-sizeof/Demo/pdist/server.py (original) +++ python/branches/okkoto-sizeof/Demo/pdist/server.py Wed Jun 4 11:24:23 2008 @@ -4,7 +4,7 @@ import socket import pickle from fnmatch import fnmatch -from reprlib import repr +from repr import repr # Default verbosity (0 = silent, 1 = print connections, 2 = print requests too) Modified: python/branches/okkoto-sizeof/Doc/Makefile ============================================================================== --- python/branches/okkoto-sizeof/Doc/Makefile (original) +++ python/branches/okkoto-sizeof/Doc/Makefile Wed Jun 4 11:24:23 2008 @@ -21,6 +21,7 @@ @echo " web to make file usable by Sphinx.web" @echo " htmlhelp to make HTML files and a HTML help project" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " text to make plain text files" @echo " changes to make an overview over all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " coverage to check documentation coverage for library and C API" @@ -75,6 +76,10 @@ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ "run these through (pdf)latex." +text: BUILDER = text +text: build + @echo "Build finished; the text files are in build/text." + changes: BUILDER = changes changes: build @echo "The overview file is in build/changes." @@ -93,6 +98,11 @@ @echo "Testing of doctests in the sources finished, look at the " \ "results in build/doctest/output.txt" +pydoc-topics: BUILDER = pydoc-topics +pydoc-topics: build + @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ + "into the Lib/ directory" + clean: -rm -rf build/* -rm -rf tools/sphinx Modified: python/branches/okkoto-sizeof/Doc/README.txt ============================================================================== --- python/branches/okkoto-sizeof/Doc/README.txt (original) +++ python/branches/okkoto-sizeof/Doc/README.txt Wed Jun 4 11:24:23 2008 @@ -51,6 +51,8 @@ * "latex", which builds LaTeX source files that can be run with "pdflatex" to produce PDF documents. + * "text", which builds a plain text file for each source file. + * "linkcheck", which checks all external references to see whether they are broken, redirected or malformed, and outputs this information to stdout as well as a plain-text (.txt) file. @@ -62,6 +64,11 @@ * "coverage", which builds a coverage overview for standard library modules and C API. + * "pydoc-topics", which builds a Python module containing a dictionary + with plain text documentation for the labels defined in + `tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic + and keyword help. + A "make update" updates the Subversion checkouts in `tools/`. Modified: python/branches/okkoto-sizeof/Doc/c-api/concrete.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/c-api/concrete.rst (original) +++ python/branches/okkoto-sizeof/Doc/c-api/concrete.rst Wed Jun 4 11:24:23 2008 @@ -64,6 +64,7 @@ .. toctree:: + bytearray.rst string.rst unicode.rst buffer.rst Modified: python/branches/okkoto-sizeof/Doc/c-api/file.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/c-api/file.rst (original) +++ python/branches/okkoto-sizeof/Doc/c-api/file.rst Wed Jun 4 11:24:23 2008 @@ -130,6 +130,14 @@ .. versionadded:: 2.3 +.. cfunction:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors) + + Set the file's encoding for Unicode output to *enc*, and its error + mode to *err*. Return 1 on success and 0 on failure. + + .. versionadded:: 2.6 + + .. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag) .. index:: single: softspace (file attribute) Modified: python/branches/okkoto-sizeof/Doc/c-api/string.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/c-api/string.rst (original) +++ python/branches/okkoto-sizeof/Doc/c-api/string.rst Wed Jun 4 11:24:23 2008 @@ -2,12 +2,16 @@ .. _stringobjects: -String Objects --------------- +String/Bytes Objects +-------------------- These functions raise :exc:`TypeError` when expecting a string parameter and are called with a non-string parameter. +.. note:: + These functions have been renamed to PyBytes_* in Python 3.x. The PyBytes + names are also available in 2.6. + .. index:: object: string @@ -120,7 +124,7 @@ .. cfunction:: PyObject* PyString_FromFormatV(const char *format, va_list vargs) - Identical to :func:`PyString_FromFormat` except that it takes exactly two + Identical to :cfunc:`PyString_FromFormat` except that it takes exactly two arguments. Modified: python/branches/okkoto-sizeof/Doc/c-api/type.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/c-api/type.rst (original) +++ python/branches/okkoto-sizeof/Doc/c-api/type.rst Wed Jun 4 11:24:23 2008 @@ -37,7 +37,16 @@ .. cfunction:: unsigned int PyType_ClearCache(void) - Clears the internal lookup cache. Return the current version tag. + Clear the internal lookup cache. Return the current version tag. + + .. versionadded:: 2.6 + + +.. cfunction:: void PyType_Modified(PyTypeObject *type) + + Invalidate the internal lookup cache for the type and all of its + subtypes. This function must be called after any manual + modification of the attributes or base classes of the type. .. versionadded:: 2.6 Modified: python/branches/okkoto-sizeof/Doc/glossary.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/glossary.rst (original) +++ python/branches/okkoto-sizeof/Doc/glossary.rst Wed Jun 4 11:24:23 2008 @@ -16,6 +16,14 @@ The typical Python prompt of the interactive shell when entering code for an indented code block. + 2to3 + A tool that tries to convert Python 2.x code to Python 3.x code by + handling most of the incompatibilites that can be detected by parsing the + source and traversing the parse tree. + + 2to3 is available in the standard library as :mod:`lib2to3`; a standalone + entry point is provided as :file:`Tools/scripts/2to3`. + argument A value passed to a function or method, assigned to a name local to the body. A function or method may have both positional arguments and @@ -388,9 +396,10 @@ definition), or pass several arguments as a list to a function. See :term:`argument`. - Python 3000 - Nickname for the next major Python version, 3.0 (coined long ago when the - release of version 3 was something in the distant future.) + Python 3000 + Nickname for the next major Python version, 3.0 (coined long ago + when the release of version 3 was something in the distant future.) This + is also abbreviated "Py3k". Pythonic An idea or piece of code which closely follows the most common idioms of Modified: python/branches/okkoto-sizeof/Doc/includes/noddy2.c ============================================================================== --- python/branches/okkoto-sizeof/Doc/includes/noddy2.c (original) +++ python/branches/okkoto-sizeof/Doc/includes/noddy2.c Wed Jun 4 11:24:23 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -90,7 +90,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -109,7 +109,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/okkoto-sizeof/Doc/includes/noddy3.c ============================================================================== --- python/branches/okkoto-sizeof/Doc/includes/noddy3.c (original) +++ python/branches/okkoto-sizeof/Doc/includes/noddy3.c Wed Jun 4 11:24:23 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -93,7 +93,7 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "The first attribute value must be a string"); return -1; @@ -121,7 +121,7 @@ return -1; } - if (! PyString_Check(value)) { + if (! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "The last attribute value must be a string"); return -1; @@ -153,7 +153,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -162,7 +162,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/okkoto-sizeof/Doc/includes/noddy4.c ============================================================================== --- python/branches/okkoto-sizeof/Doc/includes/noddy4.c (original) +++ python/branches/okkoto-sizeof/Doc/includes/noddy4.c Wed Jun 4 11:24:23 2008 @@ -57,14 +57,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyString_FromString(""); + self->first = PyBytes_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyString_FromString(""); + self->last = PyBytes_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -124,7 +124,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyString_FromString("%s %s"); + format = PyBytes_FromString("%s %s"); if (format == NULL) return NULL; } @@ -143,7 +143,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/okkoto-sizeof/Doc/includes/run-func.c ============================================================================== --- python/branches/okkoto-sizeof/Doc/includes/run-func.c (original) +++ python/branches/okkoto-sizeof/Doc/includes/run-func.c Wed Jun 4 11:24:23 2008 @@ -13,7 +13,7 @@ } Py_Initialize(); - pName = PyString_FromString(argv[1]); + pName = PyBytes_FromString(argv[1]); /* Error checking of pName left out */ pModule = PyImport_Import(pName); Modified: python/branches/okkoto-sizeof/Doc/library/_winreg.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/_winreg.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/_winreg.rst Wed Jun 4 11:24:23 2008 @@ -7,6 +7,11 @@ :synopsis: Routines and objects for manipulating the Windows registry. .. sectionauthor:: Mark Hammond +.. note:: + The :mod:`_winreg` module has been renamed to :mod:`winreg` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. + .. versionadded:: 2.0 Modified: python/branches/okkoto-sizeof/Doc/library/anydbm.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/anydbm.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/anydbm.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`anydbm` --- Generic access to DBM-style databases ======================================================= @@ -6,6 +5,11 @@ :synopsis: Generic interface to DBM-style database modules. +.. note:: + The :mod:`anydbm` module has been renamed to :mod:`dbm` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. + .. index:: module: dbhash module: bsddb Modified: python/branches/okkoto-sizeof/Doc/library/basehttpserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/basehttpserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/basehttpserver.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,14 @@ - :mod:`BaseHTTPServer` --- Basic HTTP server =========================================== .. module:: BaseHTTPServer :synopsis: Basic HTTP server (base class for SimpleHTTPServer and CGIHTTPServer). +.. note:: + The :mod:`BaseHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. index:: pair: WWW; server @@ -21,7 +25,7 @@ functioning Web servers. See the :mod:`SimpleHTTPServer` and :mod:`CGIHTTPServer` modules. -The first class, :class:`HTTPServer`, is a :class:`socketserver.TCPServer` +The first class, :class:`HTTPServer`, is a :class:`SocketServer.TCPServer` subclass. It creates and listens at the HTTP socket, dispatching the requests to a handler. Code to create and run the server looks like this:: Modified: python/branches/okkoto-sizeof/Doc/library/bsddb.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/bsddb.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/bsddb.rst Wed Jun 4 11:24:23 2008 @@ -15,15 +15,15 @@ :func:`marshal.dumps` or :func:`pickle.dumps`. The :mod:`bsddb` module requires a Berkeley DB library version from 3.3 thru -4.5. +4.7. .. seealso:: - http://pybsddb.sourceforge.net/ + http://www.jcea.es/programacion/pybsddb.htm The website with documentation for the :mod:`bsddb.db` Python Berkeley DB interface that closely mirrors the object oriented interface provided in - Berkeley DB 3 and 4. + Berkeley DB 4.x itself. http://www.oracle.com/database/berkeley-db/ The Berkeley DB library. Modified: python/branches/okkoto-sizeof/Doc/library/calendar.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/calendar.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/calendar.rst Wed Jun 4 11:24:23 2008 @@ -37,7 +37,7 @@ :class:`Calendar` instances have the following methods: - .. method:: iterweekdays(weekday) + .. method:: iterweekdays() Return an iterator for the week day numbers that will be used for one week. The first value from the iterator will be the same as the value of Modified: python/branches/okkoto-sizeof/Doc/library/cgihttpserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/cgihttpserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/cgihttpserver.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`CGIHTTPServer` --- CGI-capable HTTP request handler ========================================================= @@ -7,6 +6,11 @@ scripts. .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`CGIHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + The :mod:`CGIHTTPServer` module defines a request-handler class, interface compatible with :class:`BaseHTTPServer.BaseHTTPRequestHandler` and inherits Modified: python/branches/okkoto-sizeof/Doc/library/cmd.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/cmd.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/cmd.rst Wed Jun 4 11:24:23 2008 @@ -26,7 +26,12 @@ The optional arguments *stdin* and *stdout* specify the input and output file objects that the Cmd instance or subclass instance will use for input and - output. If not specified, they will default to *sys.stdin* and *sys.stdout*. + output. If not specified, they will default to :data:`sys.stdin` and + :data:`sys.stdout`. + + If you want a given *stdin* to be used, make sure to set the instance's + :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be + ignored. .. versionchanged:: 2.3 The *stdin* and *stdout* parameters were added. Modified: python/branches/okkoto-sizeof/Doc/library/codecs.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/codecs.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/codecs.rst Wed Jun 4 11:24:23 2008 @@ -295,7 +295,8 @@ ------------------ The :mod:`codecs` module defines a set of base classes which define the -interface and can also be used to easily write you own codecs for use in Python. +interface and can also be used to easily write your own codecs for use in +Python. Each codec has to define four interfaces to make it usable as codec in Python: stateless encoder, stateless decoder, stream reader and stream writer. The Modified: python/branches/okkoto-sizeof/Doc/library/collections.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/collections.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/collections.rst Wed Jun 4 11:24:23 2008 @@ -122,7 +122,7 @@ Since some set operations create new sets, the default mixin methods need a way to create new instances from an iterable. The class constructor is assumed to have a signature in the form ``ClassName(iterable)``. - That assumption is factored-out to a singleinternal classmethod called + That assumption is factored-out to an internal classmethod called :meth:`_from_iterable` which calls ``cls(iterable)`` to produce a new set. If the :class:`Set` mixin is being used in a class with a different constructor signature, you will need to override :meth:`from_iterable` Modified: python/branches/okkoto-sizeof/Doc/library/commands.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/commands.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/commands.rst Wed Jun 4 11:24:23 2008 @@ -16,6 +16,12 @@ processes and retrieving their results. Using the :mod:`subprocess` module is preferable to using the :mod:`commands` module. +.. warning:: + + In 3.x, :func:`getstatus` and two undocumented functions (:func:`mk2arg` and + :func:`mkarg`) have been removed. Also, :func:`getstatusoutput` and + :func:`getoutput` have been moved to the :mod:`subprocess` module. + The :mod:`commands` module defines the following functions: @@ -44,6 +50,7 @@ This function is nonobvious and useless, also the name is misleading in the presence of :func:`getstatusoutput`. + Example:: >>> import commands Modified: python/branches/okkoto-sizeof/Doc/library/configparser.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/configparser.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/configparser.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,7 @@ -:mod:`configparser` --- Configuration file parser +:mod:`ConfigParser` --- Configuration file parser ================================================= .. module:: ConfigParser - :synopsis: Old name for the configparser module. - -.. module:: configparser :synopsis: Configuration file parser. .. moduleauthor:: Ken Manheimer @@ -13,9 +10,10 @@ .. sectionauthor:: Christopher G. Petrilli .. note:: - The :mod:`ConfigParser` module has been renamed to :mod:`configparser` in - Python 3.0. It is importable under both names in Python 2.6 and the rest of - the 2.x series. + + The :mod:`ConfigParser` module has been renamed to `configparser` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. .. index:: pair: .ini; file @@ -233,9 +231,9 @@ load the required file or files using :meth:`readfp` before calling :meth:`read` for any optional files:: - import configparser, os + import ConfigParser, os - config = configparser.ConfigParser() + config = ConfigParser.ConfigParser() config.readfp(open('defaults.cfg')) config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')]) @@ -375,10 +373,10 @@ An example of writing to a configuration file:: - import configparser + import ConfigParser + + config = ConfigParser.RawConfigParser() - config = configparser.RawConfigParser() - # When adding sections or items, add them in the reverse order of # how you want them to be displayed in the actual file. # In addition, please note that using RawConfigParser's and the raw @@ -393,16 +391,16 @@ config.set('Section1', 'baz', 'fun') config.set('Section1', 'bar', 'Python') config.set('Section1', 'foo', '%(bar)s is %(baz)s!') - + # Writing our configuration file to 'example.cfg' with open('example.cfg', 'wb') as configfile: config.write(configfile) An example of reading the configuration file again:: - import configparser + import ConfigParser - config = configparser.RawConfigParser() + config = ConfigParser.RawConfigParser() config.read('example.cfg') # getfloat() raises an exception if the value is not a float @@ -419,9 +417,9 @@ To get interpolation, you will need to use a :class:`ConfigParser` or :class:`SafeConfigParser`:: - import configparser + import ConfigParser - config = configparser.ConfigParser() + config = ConfigParser.ConfigParser() config.read('example.cfg') # Set the third, optional argument of get to 1 if you wish to use raw mode. @@ -433,15 +431,15 @@ print config.get('Section1', 'foo', 0, {'bar': 'Documentation', 'baz': 'evil'}) -Defaults are available in all three types of ConfigParsers. They are used in +Defaults are available in all three types of ConfigParsers. They are used in interpolation if an option used is not defined elsewhere. :: - import configparser + import ConfigParser # New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each - config = configparser.SafeConfigParser({'bar': 'Life', 'baz': 'hard'}) + config = ConfigParser.SafeConfigParser({'bar': 'Life', 'baz': 'hard'}) config.read('example.cfg') - + print config.get('Section1', 'foo') # -> "Python is fun!" config.remove_option('Section1', 'bar') config.remove_option('Section1', 'baz') @@ -452,7 +450,7 @@ def opt_move(config, section1, section2, option): try: config.set(section2, option, config.get(section1, option, 1)) - except configparser.NoSectionError: + except ConfigParser.NoSectionError: # Create non-existent section config.add_section(section2) opt_move(config, section1, section2, option) Modified: python/branches/okkoto-sizeof/Doc/library/cookie.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/cookie.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/cookie.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`Cookie` --- HTTP state management ======================================= @@ -7,6 +6,11 @@ .. moduleauthor:: Timothy O'Malley .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`Cookie` module has been renamed to :mod:`http.cookies` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + The :mod:`Cookie` module defines classes for abstracting the concept of cookies, an HTTP state management mechanism. It supports both simple string-only @@ -18,6 +22,12 @@ MSIE 3.0x doesn't follow the character rules outlined in those specs. As a result, the parsing rules used are a bit less strict. +.. note:: + + On encountering an invalid cookie, :exc:`CookieError` is raised, so if your + cookie data comes from a browser you should always prepare for invalid data + and catch :exc:`CookieError` on parsing. + .. exception:: CookieError Modified: python/branches/okkoto-sizeof/Doc/library/cookielib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/cookielib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/cookielib.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`cookielib` --- Cookie handling for HTTP clients ===================================================== @@ -7,6 +6,11 @@ .. moduleauthor:: John J. Lee .. sectionauthor:: John J. Lee +.. note:: + The :mod:`cookielib` module has been renamed to :mod:`http.cookiejar` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. versionadded:: 2.4 Modified: python/branches/okkoto-sizeof/Doc/library/copy.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/copy.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/copy.rst Wed Jun 4 11:24:23 2008 @@ -63,7 +63,7 @@ Classes can use the same interfaces to control copying that they use to control pickling. See the description of module :mod:`pickle` for information on these -methods. The :mod:`copy` module does not use the :mod:`copyreg` registration +methods. The :mod:`copy` module does not use the :mod:`copy_reg` registration module. .. index:: Deleted: python/branches/okkoto-sizeof/Doc/library/copyreg.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/copyreg.rst Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,48 +0,0 @@ -:mod:`copyreg` --- Register :mod:`pickle` support functions -=========================================================== - -.. module:: copy_reg - :synopsis: Old name for the copyreg module. - -.. module:: copyreg - :synopsis: Register pickle support functions. - -.. note:: - The :mod:`copy_reg` module has been renamed to :mod:`copyreg` in Python 3.0. - It is importable under both names in Python 2.6 and the rest of the 2.x - series. - -.. index:: - module: pickle - module: cPickle - module: copy - -The :mod:`copyreg` module provides support for the :mod:`pickle` and -:mod:`cPickle` modules. The :mod:`copy` module is likely to use this in the -future as well. It provides configuration information about object constructors -which are not classes. Such constructors may be factory functions or class -instances. - - -.. function:: constructor(object) - - Declares *object* to be a valid constructor. If *object* is not callable (and - hence not valid as a constructor), raises :exc:`TypeError`. - - -.. function:: pickle(type, function[, constructor]) - - Declares that *function* should be used as a "reduction" function for objects of - type *type*; *type* must not be a "classic" class object. (Classic classes are - handled differently; see the documentation for the :mod:`pickle` module for - details.) *function* should return either a string or a tuple containing two or - three elements. - - The optional *constructor* parameter, if provided, is a callable object which - can be used to reconstruct the object when called with the tuple of arguments - returned by *function* at pickling time. :exc:`TypeError` will be raised if - *object* is a class or *constructor* is not callable. - - See the :mod:`pickle` module for more details on the interface expected of - *function* and *constructor*. - Modified: python/branches/okkoto-sizeof/Doc/library/dbhash.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/dbhash.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/dbhash.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`dbhash` --- DBM-style interface to the BSD database library ================================================================= @@ -6,6 +5,10 @@ :synopsis: DBM-style interface to the BSD database library. .. sectionauthor:: Fred L. Drake, Jr. +.. note:: + The :mod:`dbhash` module has been renamed to :mod:`dbm.bsd` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. .. index:: module: bsddb Modified: python/branches/okkoto-sizeof/Doc/library/dbm.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/dbm.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/dbm.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`dbm` --- Simple "database" interface ========================================== @@ -6,6 +5,11 @@ :platform: Unix :synopsis: The standard "database" interface, based on ndbm. +.. note:: + The :mod:`dbm` module has been renamed to :mod:`dbm.ndbm` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. + The :mod:`dbm` module provides an interface to the Unix "(n)dbm" library. Dbm objects behave like mappings (dictionaries), except that keys and values are Modified: python/branches/okkoto-sizeof/Doc/library/docxmlrpcserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/docxmlrpcserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/docxmlrpcserver.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`DocXMLRPCServer` --- Self-documenting XML-RPC server ========================================================== @@ -7,6 +6,11 @@ .. moduleauthor:: Brian Quinlan .. sectionauthor:: Brian Quinlan +.. note:: + The :mod:`DocXMLRPCServer` module has been merged into :mod:`xmlrpc.server` + in Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. versionadded:: 2.3 Modified: python/branches/okkoto-sizeof/Doc/library/dumbdbm.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/dumbdbm.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/dumbdbm.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,13 @@ - :mod:`dumbdbm` --- Portable DBM implementation ============================================== .. module:: dumbdbm :synopsis: Portable implementation of the simple DBM interface. +.. note:: + The :mod:`dumbdbm` module has been renamed to :mod:`dbm.dumb` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. .. index:: single: databases Modified: python/branches/okkoto-sizeof/Doc/library/dummy_thread.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/dummy_thread.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/dummy_thread.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,15 @@ - :mod:`dummy_thread` --- Drop-in replacement for the :mod:`thread` module ======================================================================== .. module:: dummy_thread :synopsis: Drop-in replacement for the thread module. +.. note:: + The :mod:`dummy_thread` module has been renamed to :mod:`_dummy_thread` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0; however, you should consider using the + high-lever :mod:`dummy_threading` module instead. + This module provides a duplicate interface to the :mod:`thread` module. It is meant to be imported when the :mod:`thread` module is not provided on a Modified: python/branches/okkoto-sizeof/Doc/library/easydialogs.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/easydialogs.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/easydialogs.rst Wed Jun 4 11:24:23 2008 @@ -9,10 +9,12 @@ The :mod:`EasyDialogs` module contains some simple dialogs for the Macintosh. -All routines take an optional resource ID parameter *id* with which one can -override the :const:`DLOG` resource used for the dialog, provided that the -dialog items correspond (both type and item number) to those in the default -:const:`DLOG` resource. See source code for details. +The dialogs get launched in a separate application which appears in the dock and +must be clicked on for the dialogs be displayed. All routines take an optional +resource ID parameter *id* with which one can override the :const:`DLOG` +resource used for the dialog, provided that the dialog items correspond (both +type and item number) to those in the default :const:`DLOG` resource. See source +code for details. .. warning:: Modified: python/branches/okkoto-sizeof/Doc/library/ftplib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/ftplib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/ftplib.rst Wed Jun 4 11:24:23 2008 @@ -44,8 +44,8 @@ the method call ``login(user, passwd, acct)`` is made (where *passwd* and *acct* default to the empty string when not given). The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the - connection attempt (if is not specified, or passed as None, the global - default timeout setting will be used). + connection attempt (if is not specified, the global default timeout setting + will be used). .. versionchanged:: 2.6 *timeout* was added. @@ -126,10 +126,8 @@ made. The optional *timeout* parameter specifies a timeout in seconds for the - connection attempt. If is not specified, or passed as None, the object - timeout is used (the timeout that you passed when instantiating the class); - if the object timeout is also None, the global default timeout setting will - be used. + connection attempt. If no *timeout* is passed, the global default timeout + setting will be used. .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/okkoto-sizeof/Doc/library/future_builtins.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/future_builtins.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/future_builtins.rst Wed Jun 4 11:24:23 2008 @@ -15,7 +15,7 @@ ... code using Python 3-style map and filter ... -The :program:`2to3` tool that ports Python 2 code to Python 3 will recognize +The :term:`2to3` tool that ports Python 2 code to Python 3 will recognize this usage and leave the new builtins alone. .. note:: Modified: python/branches/okkoto-sizeof/Doc/library/gdbm.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/gdbm.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/gdbm.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`gdbm` --- GNU's reinterpretation of dbm ============================================= @@ -6,6 +5,11 @@ :platform: Unix :synopsis: GNU's reinterpretation of dbm. +.. note:: + The :mod:`gdbm` module has been renamed to :mod:`dbm.gnu` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. + .. index:: module: dbm Modified: python/branches/okkoto-sizeof/Doc/library/htmllib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/htmllib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/htmllib.rst Wed Jun 4 11:24:23 2008 @@ -1,9 +1,12 @@ - :mod:`htmllib` --- A parser for HTML documents ============================================== .. module:: htmllib :synopsis: A parser for HTML documents. + :deprecated: + +.. deprecated:: 2.6 + The :mod:`htmllib` module has been removed in Python 3.0. .. index:: @@ -156,6 +159,12 @@ :synopsis: Definitions of HTML general entities. .. sectionauthor:: Fred L. Drake, Jr. +.. note:: + + The :mod:`htmlentitydefs` module has been renamed to :mod:`html.entities` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to Modified: python/branches/okkoto-sizeof/Doc/library/htmlparser.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/htmlparser.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/htmlparser.rst Wed Jun 4 11:24:23 2008 @@ -5,6 +5,12 @@ .. module:: HTMLParser :synopsis: A simple parser that can handle HTML and XHTML. +.. note:: + + The :mod:`HTMLParser` module has been renamed to :mod:`html.parser` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + .. versionadded:: 2.2 @@ -22,7 +28,7 @@ The :class:`HTMLParser` class is instantiated without arguments. - An HTMLParser instance is fed HTML data and calls handler functions when tags + An :class:`HTMLParser` instance is fed HTML data and calls handler functions when tags begin and end. The :class:`HTMLParser` class is meant to be overridden by the user to provide a desired behavior. @@ -92,7 +98,7 @@ ``handle_starttag('a', [('href', 'http://www.cwi.nl/')])``. .. versionchanged:: 2.6 - All entity references from htmlentitydefs are now replaced in the attribute + All entity references from :mod:`htmlentitydefs` are now replaced in the attribute values. Modified: python/branches/okkoto-sizeof/Doc/library/httplib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/httplib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/httplib.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,14 @@ - :mod:`httplib` --- HTTP protocol client ======================================= .. module:: httplib :synopsis: HTTP and HTTPS protocol client (requires sockets). +.. note:: + The :mod:`httplib` module has been renamed to :mod:`http.client` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + .. index:: pair: HTTP; protocol @@ -40,7 +44,7 @@ be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line. If the optional *timeout* parameter is given, blocking operations (like connection attempts) will timeout after that many seconds - (if it is not given or ``None``, the global default timeout setting is used). + (if it is not given, the global default timeout setting is used). For example, the following calls all create instances that connect to the server at the same host and port:: Modified: python/branches/okkoto-sizeof/Doc/library/idle.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/idle.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/idle.rst Wed Jun 4 11:24:23 2008 @@ -10,11 +10,11 @@ single: Python Editor single: Integrated Development Environment -IDLE is the Python IDE built with the :mod:`Tkinter` GUI toolkit. +IDLE is the Python IDE built with the :mod:`tkinter` GUI toolkit. IDLE has the following features: -* coded in 100% pure Python, using the :mod:`Tkinter` GUI toolkit +* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit * cross-platform: works on Windows and Unix (on Mac OS, there are currently problems with Tcl/Tk) Modified: python/branches/okkoto-sizeof/Doc/library/logging.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/logging.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/logging.rst Wed Jun 4 11:24:23 2008 @@ -1299,17 +1299,17 @@ logger2.warning('Jail zesty vixen who grabbed pay from quack.') logger2.error('The five boxing wizards jump quickly.') -At the receiving end, you can set up a receiver using the :mod:`socketserver` +At the receiving end, you can set up a receiver using the :mod:`SocketServer` module. Here is a basic working example:: import cPickle import logging import logging.handlers - import socketserver + import SocketServer import struct - class LogRecordStreamHandler(socketserver.StreamRequestHandler): + class LogRecordStreamHandler(SocketServer.StreamRequestHandler): """Handler for a streaming logging request. This basically logs the record using whatever logging policy is @@ -1351,7 +1351,7 @@ # cycles and network bandwidth! logger.handle(record) - class LogRecordSocketReceiver(socketserver.ThreadingTCPServer): + class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer): """simple TCP socket-based logging receiver suitable for testing. """ @@ -1360,7 +1360,7 @@ def __init__(self, host='localhost', port=logging.handlers.DEFAULT_TCP_LOGGING_PORT, handler=LogRecordStreamHandler): - socketserver.ThreadingTCPServer.__init__(self, (host, port), handler) + SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler) self.abort = 0 self.timeout = 1 self.logname = None @@ -2240,12 +2240,12 @@ .. function:: fileConfig(fname[, defaults]) - Reads the logging configuration from a :mod:`configparser`\-format file named - *fname*. This function can be called several times from an application, - allowing an end user the ability to select from various pre-canned - configurations (if the developer provides a mechanism to present the choices - and load the chosen configuration). Defaults to be passed to the ConfigParser - can be specified in the *defaults* argument. + Reads the logging configuration from a ConfigParser-format file named *fname*. + This function can be called several times from an application, allowing an end + user the ability to select from various pre-canned configurations (if the + developer provides a mechanism to present the choices and load the chosen + configuration). Defaults to be passed to ConfigParser can be specified in the + *defaults* argument. .. function:: listen([port]) @@ -2275,20 +2275,18 @@ Configuration file format ^^^^^^^^^^^^^^^^^^^^^^^^^ -The configuration file format understood by :func:`fileConfig` is -based on :mod:`configparser` functionality. The file must contain -sections called ``[loggers]``, ``[handlers]`` and ``[formatters]`` -which identify by name the entities of each type which are defined in -the file. For each such entity, there is a separate section which -identified how that entity is configured. Thus, for a logger named -``log01`` in the ``[loggers]`` section, the relevant configuration -details are held in a section ``[logger_log01]``. Similarly, a handler -called ``hand01`` in the ``[handlers]`` section will have its -configuration held in a section called ``[handler_hand01]``, while a -formatter called ``form01`` in the ``[formatters]`` section will have -its configuration specified in a section called -``[formatter_form01]``. The root logger configuration must be -specified in a section called ``[logger_root]``. +The configuration file format understood by :func:`fileConfig` is based on +ConfigParser functionality. The file must contain sections called ``[loggers]``, +``[handlers]`` and ``[formatters]`` which identify by name the entities of each +type which are defined in the file. For each such entity, there is a separate +section which identified how that entity is configured. Thus, for a logger named +``log01`` in the ``[loggers]`` section, the relevant configuration details are +held in a section ``[logger_log01]``. Similarly, a handler called ``hand01`` in +the ``[handlers]`` section will have its configuration held in a section called +``[handler_hand01]``, while a formatter called ``form01`` in the +``[formatters]`` section will have its configuration specified in a section +called ``[formatter_form01]``. The root logger configuration must be specified +in a section called ``[logger_root]``. Examples of these sections in the file are given below. :: Modified: python/branches/okkoto-sizeof/Doc/library/math.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/math.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/math.rst Wed Jun 4 11:24:23 2008 @@ -103,6 +103,12 @@ Return the fractional and integer parts of *x*. Both results carry the sign of *x*, and both are floats. +.. function:: sum(iterable) + + Return an accurate floating point sum of values in the iterable. Avoids + loss of precision by tracking multiple intermediate partial sums. The + algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the + typical case where the rounding mode is half-even. .. function:: trunc(x) Modified: python/branches/okkoto-sizeof/Doc/library/msilib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/msilib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/msilib.rst Wed Jun 4 11:24:23 2008 @@ -264,6 +264,18 @@ :cfunc:`MsiRecordGetFieldCount`. +.. method:: Record.GetInteger(field) + + Return the value of *field* as an integer where possible. *field* must + be an integer. + + +.. method:: Record.GetString(field) + + Return the value of *field* as a string where possible. *field* must + be an integer. + + .. method:: Record.SetString(field, value) Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an @@ -543,3 +555,4 @@ This module contains definitions for the UIText and ActionText tables, for the standard installer actions. + Modified: python/branches/okkoto-sizeof/Doc/library/os.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/os.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/os.rst Wed Jun 4 11:24:23 2008 @@ -717,7 +717,8 @@ combined using the bitwise OR operator ``|``. Availability: Windows. -.. data:: O_DIRECT +.. data:: O_ASYNC + O_DIRECT O_DIRECTORY O_NOFOLLOW O_NOATIME @@ -2030,7 +2031,7 @@ Return the number of processes in the system run queue averaged over the last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was - unobtainable. + unobtainable. Availability: Unix. .. versionadded:: 2.3 Modified: python/branches/okkoto-sizeof/Doc/library/persistence.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/persistence.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/persistence.rst Wed Jun 4 11:24:23 2008 @@ -19,7 +19,7 @@ .. toctree:: pickle.rst - copyreg.rst + copy_reg.rst shelve.rst marshal.rst anydbm.rst Modified: python/branches/okkoto-sizeof/Doc/library/pickle.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/pickle.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/pickle.rst Wed Jun 4 11:24:23 2008 @@ -535,7 +535,7 @@ and calls :meth:`__reduce__`. An alternative to implementing a :meth:`__reduce__` method on the object to be -pickled, is to register the callable with the :mod:`copyreg` module. This +pickled, is to register the callable with the :mod:`copy_reg` module. This module provides a way for programs to register "reduction functions" and constructors for user-defined types. Reduction functions have the same semantics and interface as the :meth:`__reduce__` method described above, except @@ -786,7 +786,7 @@ .. seealso:: - Module :mod:`copyreg` + Module :mod:`copy_reg` Pickle interface constructor registration for extension types. Module :mod:`shelve` Modified: python/branches/okkoto-sizeof/Doc/library/poplib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/poplib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/poplib.rst Wed Jun 4 11:24:23 2008 @@ -29,8 +29,8 @@ This class implements the actual POP3 protocol. The connection is created when the instance is initialized. If *port* is omitted, the standard POP3 port (110) is used. The optional *timeout* parameter specifies a timeout in seconds for the - connection attempt (if not specified, or passed as None, the global default - timeout setting will be used). + connection attempt (if not specified, the global default timeout setting will + be used). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/okkoto-sizeof/Doc/library/queue.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/queue.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/queue.rst Wed Jun 4 11:24:23 2008 @@ -2,17 +2,15 @@ =========================================== .. module:: Queue - :synopsis: Old name for the queue module. - -.. module:: queue :synopsis: A synchronized queue class. .. note:: - The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.0. It - is importable under both names in Python 2.6 and the rest of the 2.x series. + The :mod:`Queue` module has been renamed to :mod:`queue` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. -The :mod:`queue` module implements multi-producer, multi-consumer queues. +The :mod:`Queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The :class:`Queue` class in this module implements all the required locking semantics. It depends on the @@ -26,7 +24,7 @@ the entries are kept sorted (using the :mod:`heapq` module) and the lowest valued entry is retrieved first. -The :mod:`queue` module defines the following classes and exceptions: +The :mod:`Queue` module defines the following classes and exceptions: .. class:: Queue(maxsize) @@ -75,7 +73,7 @@ ------------- Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:`PriorityQueue`) -provide the public methods described below. +provide the public methods described below. .. method:: Queue.qsize() @@ -170,20 +168,20 @@ Example of how to wait for enqueued tasks to be completed:: - def worker(): - while True: - item = q.get() - do_work(item) - q.task_done() + def worker(): + while True: + item = q.get() + do_work(item) + q.task_done() - q = Queue() - for i in range(num_worker_threads): + q = Queue() + for i in range(num_worker_threads): t = Thread(target=worker) t.setDaemon(True) - t.start() + t.start() for item in source(): - q.put(item) + q.put(item) q.join() # block until all tasks are done Modified: python/branches/okkoto-sizeof/Doc/library/re.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/re.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/re.rst Wed Jun 4 11:24:23 2008 @@ -181,6 +181,12 @@ ``[^5]`` will match any character except ``'5'``, and ``[^^]`` will match any character except ``'^'``. + Note that inside ``[]`` the special forms and special characters lose + their meanings and only the syntaxes described here are valid. For + example, ``+``, ``*``, ``(``, ``)``, and so on are treated as + literals inside ``[]``, and backreferences cannot be used inside + ``[]``. + ``'|'`` ``A|B``, where A and B can be arbitrary REs, creates a regular expression that will match either A or B. An arbitrary number of REs can be separated by the Deleted: python/branches/okkoto-sizeof/Doc/library/reprlib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/reprlib.rst Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,143 +0,0 @@ - -:mod:`reprlib` --- Alternate :func:`repr` implementation -===================================================== - -.. module:: repr - :synopsis: Old name for the reprlib module. -.. module:: reprlib - :synopsis: Alternate repr() implementation with size limits. -.. sectionauthor:: Fred L. Drake, Jr. - -.. note:: - The :mod:`repr` module has been renamed to :mod:`reprlib` in - Python 3.0. It is importable under both names in Python 2.6 - and the rest of the 2.x series. - - -The :mod:`reprlib` module provides a means for producing object representations -with limits on the size of the resulting strings. This is used in the Python -debugger and may be useful in other contexts as well. - -This module provides a class, an instance, and a function: - - -.. class:: Repr() - - Class which provides formatting services useful in implementing functions - similar to the built-in :func:`repr`; size limits for different object types - are added to avoid the generation of representations which are excessively long. - - -.. data:: aRepr - - This is an instance of :class:`Repr` which is used to provide the :func:`repr` - function described below. Changing the attributes of this object will affect - the size limits used by :func:`repr` and the Python debugger. - - -.. function:: repr(obj) - - This is the :meth:`repr` method of ``aRepr``. It returns a string similar to - that returned by the built-in function of the same name, but with limits on - most sizes. - - -.. _repr-objects: - -Repr Objects ------------- - -:class:`Repr` instances provide several members which can be used to provide -size limits for the representations of different object types, and methods -which format specific object types. - - -.. attribute:: Repr.maxlevel - - Depth limit on the creation of recursive representations. The default is ``6``. - - -.. attribute:: Repr.maxdict - Repr.maxlist - Repr.maxtuple - Repr.maxset - Repr.maxfrozenset - Repr.maxdeque - Repr.maxarray - - Limits on the number of entries represented for the named object type. The - default is ``4`` for :attr:`maxdict`, ``5`` for :attr:`maxarray`, and ``6`` for - the others. - - .. versionadded:: 2.4 - :attr:`maxset`, :attr:`maxfrozenset`, and :attr:`set`. - - -.. attribute:: Repr.maxlong - - Maximum number of characters in the representation for a long integer. Digits - are dropped from the middle. The default is ``40``. - - -.. attribute:: Repr.maxstring - - Limit on the number of characters in the representation of the string. Note - that the "normal" representation of the string is used as the character source: - if escape sequences are needed in the representation, these may be mangled when - the representation is shortened. The default is ``30``. - - -.. attribute:: Repr.maxother - - This limit is used to control the size of object types for which no specific - formatting method is available on the :class:`Repr` object. It is applied in a - similar manner as :attr:`maxstring`. The default is ``20``. - - -.. method:: Repr.repr(obj) - - The equivalent to the built-in :func:`repr` that uses the formatting imposed by - the instance. - - -.. method:: Repr.repr1(obj, level) - - Recursive implementation used by :meth:`repr`. This uses the type of *obj* to - determine which formatting method to call, passing it *obj* and *level*. The - type-specific methods should call :meth:`repr1` to perform recursive formatting, - with ``level - 1`` for the value of *level* in the recursive call. - - -.. method:: Repr.repr_TYPE(obj, level) - :noindex: - - Formatting methods for specific types are implemented as methods with a name - based on the type name. In the method name, **TYPE** is replaced by - ``string.join(string.split(type(obj).__name__, '_'))``. Dispatch to these - methods is handled by :meth:`repr1`. Type-specific methods which need to - recursively format a value should call ``self.repr1(subobj, level - 1)``. - - -.. _subclassing-reprs: - -Subclassing Repr Objects ------------------------- - -The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of -:class:`Repr` to add support for additional built-in object types or to modify -the handling of types already supported. This example shows how special support -for file objects could be added:: - - import repr - import sys - - class MyRepr(repr.Repr): - def repr_file(self, obj, level): - if obj.name in ['', '', '']: - return obj.name - else: - return `obj` - - aRepr = MyRepr() - print aRepr.repr(sys.stdin) # prints '' - Modified: python/branches/okkoto-sizeof/Doc/library/sgmllib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/sgmllib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/sgmllib.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,12 @@ - :mod:`sgmllib` --- Simple SGML parser ===================================== .. module:: sgmllib :synopsis: Only as much of an SGML parser as needed to parse HTML. - + :deprecated: + +.. deprecated:: 2.6 + The :mod:`sgmllib` module has been removed in Python 3.0. .. index:: single: SGML Modified: python/branches/okkoto-sizeof/Doc/library/shlex.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/shlex.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/shlex.rst Wed Jun 4 11:24:23 2008 @@ -63,7 +63,7 @@ .. seealso:: - Module :mod:`configparser` + Module :mod:`ConfigParser` Parser for configuration files similar to the Windows :file:`.ini` files. Modified: python/branches/okkoto-sizeof/Doc/library/shutil.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/shutil.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/shutil.rst Wed Jun 4 11:24:23 2008 @@ -73,8 +73,9 @@ .. function:: copy2(src, dst) - Similar to :func:`copy`, but last access time and last modification time are - copied as well. This is similar to the Unix command :program:`cp -p`. + Similar to :func:`copy`, but metadata is copied as well -- in fact, this is just + :func:`copy` followed by :func:`copystat`. This is similar to the + Unix command :program:`cp -p`. .. function:: copytree(src, dst[, symlinks]) Modified: python/branches/okkoto-sizeof/Doc/library/simplehttpserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/simplehttpserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/simplehttpserver.rst Wed Jun 4 11:24:23 2008 @@ -6,6 +6,11 @@ :synopsis: This module provides a basic request handler for HTTP servers. .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`SimpleHTTPServer` module has been merged into :mod:`http.server` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + The :mod:`SimpleHTTPServer` module defines a single class, :class:`SimpleHTTPRequestHandler`, which is interface-compatible with Modified: python/branches/okkoto-sizeof/Doc/library/simplexmlrpcserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/simplexmlrpcserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/simplexmlrpcserver.rst Wed Jun 4 11:24:23 2008 @@ -1,4 +1,3 @@ - :mod:`SimpleXMLRPCServer` --- Basic XML-RPC server ================================================== @@ -7,6 +6,11 @@ .. moduleauthor:: Brian Quinlan .. sectionauthor:: Fred L. Drake, Jr. +.. note:: + The :mod:`SimpleXMLRPCServer` module has been merged into + :mod:`xmlrpc.server` in Python 3.0. The :term:`2to3` tool will automatically + adapt imports when converting your sources to 3.0. + .. versionadded:: 2.2 @@ -22,7 +26,7 @@ functions that can be called by the XML-RPC protocol. The *requestHandler* parameter should be a factory for request handler instances; it defaults to :class:`SimpleXMLRPCRequestHandler`. The *addr* and *requestHandler* parameters - are passed to the :class:`socketserver.TCPServer` constructor. If *logRequests* + are passed to the :class:`SocketServer.TCPServer` constructor. If *logRequests* is true (the default), requests will be logged; setting this parameter to false will turn off logging. The *allow_none* and *encoding* parameters are passed on to :mod:`xmlrpclib` and control the XML-RPC responses that will be returned @@ -63,7 +67,7 @@ -------------------------- The :class:`SimpleXMLRPCServer` class is based on -:class:`socketserver.TCPServer` and provides a means of creating simple, stand +:class:`SocketServer.TCPServer` and provides a means of creating simple, stand alone XML-RPC servers. Modified: python/branches/okkoto-sizeof/Doc/library/smtplib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/smtplib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/smtplib.rst Wed Jun 4 11:24:23 2008 @@ -25,8 +25,8 @@ with those parameters during initialization. An :exc:`SMTPConnectError` is raised if the specified host doesn't respond correctly. The optional *timeout* parameter specifies a timeout in seconds for blocking operations - like the connection attempt (if not specified, or passed as None, the global - default timeout setting will be used). + like the connection attempt (if not specified, the global default timeout + setting will be used). For normal use, you should only require the initialization/connect, :meth:`sendmail`, and :meth:`quit` methods. An example is included below. @@ -45,8 +45,8 @@ and *certfile* are also optional, and can contain a PEM formatted private key and certificate chain file for the SSL connection. The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the - connection attempt (if not specified, or passed as None, the global default - timeout setting will be used). + connection attempt (if not specified, the global default timeout setting + will be used). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/okkoto-sizeof/Doc/library/socket.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/socket.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/socket.rst Wed Jun 4 11:24:23 2008 @@ -207,12 +207,11 @@ .. function:: create_connection(address[, timeout]) - Connects to the *address* received (as usual, a ``(host, port)`` pair), with an - optional timeout for the connection. Especially useful for higher-level - protocols, it is not normally used directly from application-level code. - Passing the optional *timeout* parameter will set the timeout on the socket - instance (if it is not given or ``None``, the global default timeout setting is - used). + Convenience function. Connect to *address* (a 2-tuple ``(host, port)``), + and return the socket object. Passing the optional *timeout* parameter will + set the timeout on the socket instance before attempting to connect. If no + *timeout* is supplied, the global default timeout setting returned by + :func:`getdefaulttimeout` is used. .. versionadded:: 2.6 @@ -481,7 +480,7 @@ .. seealso:: - Module :mod:`socketserver` + Module :mod:`SocketServer` Classes that simplify writing network servers. Modified: python/branches/okkoto-sizeof/Doc/library/socketserver.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/socketserver.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/socketserver.rst Wed Jun 4 11:24:23 2008 @@ -1,19 +1,18 @@ -:mod:`socketserver` --- A framework for network servers + +:mod:`SocketServer` --- A framework for network servers ======================================================= .. module:: SocketServer - :synopsis: Old name for the socketserver module. - -.. module:: socketserver :synopsis: A framework for network servers. .. note:: - The :mod:`SocketServer` module has been renamed to :mod:`socketserver` in - Python 3.0. It is importable under both names in Python 2.6 and the rest of - the 2.x series. + The :mod:`SocketServer` module has been renamed to `socketserver` in Python + 3.0. The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. -The :mod:`socketserver` module simplifies the task of writing network servers. + +The :mod:`SocketServer` module simplifies the task of writing network servers. There are four basic server classes: :class:`TCPServer` uses the Internet TCP protocol, which provides for continuous streams of data between the client and @@ -220,7 +219,7 @@ users of the server object. .. XXX should the default implementations of these be documented, or should - it be assumed that the user will look at socketserver.py? + it be assumed that the user will look at SocketServer.py? .. function:: finish_request() @@ -244,8 +243,8 @@ .. function:: handle_timeout() - This function is called when the :attr:`timeout` attribute has been set to a - value other than :const:`None` and the timeout period has passed with no + This function is called when the :attr:`timeout` attribute has been set to a + value other than :const:`None` and the timeout period has passed with no requests being received. The default action for forking servers is to collect the status of any child processes that have exited, while in threading servers this method does nothing. @@ -292,27 +291,28 @@ .. function:: finish() - Called after the :meth:`handle` method to perform any clean-up actions required. - The default implementation does nothing. If :meth:`setup` or :meth:`handle` - raise an exception, this function will not be called. + Called after the :meth:`handle` method to perform any clean-up actions + required. The default implementation does nothing. If :meth:`setup` or + :meth:`handle` raise an exception, this function will not be called. .. function:: handle() - This function must do all the work required to service a request. The default - implementation does nothing. Several instance attributes are available to it; - the request is available as :attr:`self.request`; the client address as - :attr:`self.client_address`; and the server instance as :attr:`self.server`, in - case it needs access to per-server information. - - The type of :attr:`self.request` is different for datagram or stream services. - For stream services, :attr:`self.request` is a socket object; for datagram - services, :attr:`self.request` is a string. However, this can be hidden by using - the request handler subclasses :class:`StreamRequestHandler` or - :class:`DatagramRequestHandler`, which override the :meth:`setup` and - :meth:`finish` methods, and provide :attr:`self.rfile` and :attr:`self.wfile` - attributes. :attr:`self.rfile` and :attr:`self.wfile` can be read or written, - respectively, to get the request data or return data to the client. + This function must do all the work required to service a request. The + default implementation does nothing. Several instance attributes are + available to it; the request is available as :attr:`self.request`; the client + address as :attr:`self.client_address`; and the server instance as + :attr:`self.server`, in case it needs access to per-server information. + + The type of :attr:`self.request` is different for datagram or stream + services. For stream services, :attr:`self.request` is a socket object; for + datagram services, :attr:`self.request` is a pair of string and socket. + However, this can be hidden by using the request handler subclasses + :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`, which + override the :meth:`setup` and :meth:`finish` methods, and provide + :attr:`self.rfile` and :attr:`self.wfile` attributes. :attr:`self.rfile` and + :attr:`self.wfile` can be read or written, respectively, to get the request + data or return data to the client. .. function:: setup() @@ -320,3 +320,217 @@ Called before the :meth:`handle` method to perform any initialization actions required. The default implementation does nothing. + +Examples +-------- + +:class:`SocketServer.TCPServer` Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the server side:: + + import SocketServer + + class MyTCPHandler(SocketServer.BaseRequestHandler): + """ + The RequestHandler class for our server. + + It is instantiated once per connection to the server, and must + override the handle() method to implement communication to the + client. + """ + + def handle(self): + # self.request is the TCP socket connected to the client + self.data = self.request.recv(1024).strip() + print "%s wrote:" % self.client_address[0] + print self.data + # just send back the same data, but upper-cased + self.request.send(self.data.upper()) + + if __name__ == "__main__": + HOST, PORT = "localhost", 9999 + + # Create the server, binding to localhost on port 9999 + server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) + + # Activate the server; this will keep running until you + # interrupt the program with Ctrl-C + server.serve_forever() + +An alternative request handler class that makes use of streams (file-like +objects that simplify communication by providing the standard file interface):: + + class MyTCPHandler(SocketServer.StreamRequestHandler): + + def handle(self): + # self.rfile is a file-like object created by the handler; + # we can now use e.g. readline() instead of raw recv() calls + self.data = self.rfile.readline().strip() + print "%s wrote:" % self.client_address[0] + print self.data + # Likewise, self.wfile is a file-like object used to write back + # to the client + self.wfile.write(self.data.upper()) + +The difference is that the ``readline()`` call in the second handler will call +``recv()`` multiple times until it encounters a newline character, while the +single ``recv()`` call in the first handler will just return what has been sent +from the client in one ``send()`` call. + + +This is the client side:: + + import socket + import sys + + HOST, PORT = "localhost", 9999 + data = " ".join(sys.argv[1:]) + + # Create a socket (SOCK_STREAM means a TCP socket) + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + # Connect to server and send data + sock.connect((HOST, PORT)) + sock.send(data + "\n") + + # Receive data from the server and shut down + received = sock.recv(1024) + sock.close() + + print "Sent: %s" % data + print "Received: %s" % received + + +The output of the example should look something like this: + +Server:: + + $ python TCPServer.py + 127.0.0.1 wrote: + hello world with TCP + 127.0.0.1 wrote: + python is nice + +Client:: + + $ python TCPClient.py hello world with TCP + Sent: hello world with TCP + Received: HELLO WORLD WITH TCP + $ python TCPClient.py python is nice + Sent: python is nice + Received: PYTHON IS NICE + + +:class:`SocketServer.UDPServer` Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the server side:: + + import SocketServer + + class MyUDPHandler(SocketServer.BaseRequestHandler): + """ + This class works similar to the TCP handler class, except that + self.request consists of a pair of data and client socket, and since + there is no connection the client address must be given explicitly + when sending data back via sendto(). + """ + + def handle(self): + data = self.request[0].strip() + socket = self.request[1] + print "%s wrote:" % self.client_address[0] + print data + socket.sendto(data.upper(), self.client_address) + + if __name__ == "__main__": + HOST, PORT = "localhost", 9999 + server = SocketServer.UDPServer((HOST, PORT), BaseUDPRequestHandler) + server.serve_forever() + +This is the client side:: + + import socket + import sys + + HOST, PORT = "localhost" + data = " ".join(sys.argv[1:]) + + # SOCK_DGRAM is the socket type to use for UDP sockets + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + + # As you can see, there is no connect() call; UDP has no connections. + # Instead, data is directly sent to the recipient via sendto(). + sock.sendto(data + "\n", (HOST, PORT)) + received = sock.recv(1024) + + print "Sent: %s" % data + print "Received: %s" % received + +The output of the example should look exactly like for the TCP server example. + + +Asynchronous Mixins +~~~~~~~~~~~~~~~~~~~ + +To build asynchronous handlers, use the :class:`ThreadingMixIn` and +:class:`ForkingMixIn` classes. + +An example for the :class:`ThreadingMixIn` class:: + + import socket + import threading + import SocketServer + + class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): + + def handle(self): + data = self.request.recv(1024) + cur_thread = threading.currentThread() + response = "%s: %s" % (cur_thread.getName(), data) + self.request.send(response) + + class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): + pass + + def client(ip, port, message): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect((ip, port)) + sock.send(message) + response = sock.recv(1024) + print "Received: %s" % response + sock.close() + + if __name__ == "__main__": + # Port 0 means to select an arbitrary unused port + HOST, PORT = "localhost", 0 + + server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler) + ip, port = server.server_address + + # Start a thread with the server -- that thread will then start one + # more thread for each request + server_thread = threading.Thread(target=server.serve_forever) + # Exit the server thread when the main thread terminates + server_thread.setDaemon(True) + server_thread.start() + print "Server loop running in thread:", t.getName() + + client(ip, port, "Hello World 1") + client(ip, port, "Hello World 2") + client(ip, port, "Hello World 3") + + server.shutdown() + +The output of the example should look something like this:: + + $ python ThreadedTCPServer.py + Server loop running in thread: Thread-1 + Received: Thread-2: Hello World 1 + Received: Thread-3: Hello World 2 + Received: Thread-4: Hello World 3 + + +The :class:`ForkingMixIn` class is used in the same way, except that the server +will spawn a new process for each request. Modified: python/branches/okkoto-sizeof/Doc/library/stdtypes.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/stdtypes.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/stdtypes.rst Wed Jun 4 11:24:23 2008 @@ -2165,6 +2165,13 @@ .. versionadded:: 2.3 +.. attribute:: file.errors + + The Unicode error handler used to along with the encoding. + + .. versionadded:: 2.6 + + .. attribute:: file.mode The I/O mode for the file. If the file was created using the :func:`open` Modified: python/branches/okkoto-sizeof/Doc/library/string.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/string.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/string.rst Wed Jun 4 11:24:23 2008 @@ -103,16 +103,16 @@ :func:`strip` and :func:`split` is undefined. -.. _string-formatting: +.. _new-string-formatting: String Formatting ----------------- Starting in Python 2.6, the built-in str and unicode classes provide the ability -to do complex variable substitutions and value formatting via the :func:`format` -method described in :pep:`3101`. The :class:`Formatter` class in the -:mod:`string` module allows you to create and customize your own string -formatting behaviors using the same implementation as the built-in +to do complex variable substitutions and value formatting via the +:meth:`str.format` method described in :pep:`3101`. The :class:`Formatter` +class in the :mod:`string` module allows you to create and customize your own +string formatting behaviors using the same implementation as the built-in :meth:`format` method. .. class:: Formatter Modified: python/branches/okkoto-sizeof/Doc/library/struct.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/struct.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/struct.rst Wed Jun 4 11:24:23 2008 @@ -233,6 +233,16 @@ native size and alignment are in effect; standard size and alignment does not enforce any alignment. +Unpacked fields can be named by assigning them to variables or by wrapping +the result in a named tuple:: + + >>> record = 'raymond \x32\x12\x08\x01\x08' + >>> name, serialnum, school, gradelevel = unpack('<10sHHb', record) + + >>> from collections import namedtuple + >>> Student = namedtuple('Student', 'name serialnum school gradelevel') + >>> Student._make(unpack('<10sHHb', s)) + Student(name='raymond ', serialnum=4658, school=264, gradelevel=8) .. seealso:: Modified: python/branches/okkoto-sizeof/Doc/library/sys.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/sys.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/sys.rst Wed Jun 4 11:24:23 2008 @@ -531,6 +531,11 @@ is at least 2\*\*31-1. The largest negative integer is ``-maxint-1`` --- the asymmetry results from the use of 2's complement binary arithmetic. +.. data:: maxsize + + The largest positive integer supported by the platform's Py_ssize_t type, + and thus the maximum size lists, strings, dicts, and many other containers + can have. .. data:: maxunicode Modified: python/branches/okkoto-sizeof/Doc/library/tarfile.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/tarfile.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/tarfile.rst Wed Jun 4 11:24:23 2008 @@ -34,10 +34,8 @@ character devices and block devices and is able to acquire and restore file information like timestamp, access permissions and owner. -* can handle tape devices. - -.. function:: open(name[, mode[, fileobj[, bufsize]]], **kwargs) +.. function:: open(name=None, mode='r', fileobj=None, bufsize=10240, \*\*kwargs) Return a :class:`TarFile` object for the pathname *name*. For detailed information on :class:`TarFile` objects and the keyword arguments that are @@ -78,7 +76,7 @@ for *name*. It is supposed to be at position 0. For special purposes, there is a second format for *mode*: - ``'filemode|[compression]'``. :func:`open` will return a :class:`TarFile` + ``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` object that processes its data as a stream of blocks. No random seeking will be done on the file. If given, *fileobj* may be any object that has a :meth:`read` or :meth:`write` method (depending on the *mode*). *bufsize* @@ -116,7 +114,7 @@ .. class:: TarFile Class for reading and writing tar archives. Do not use this class directly, - better use :func:`open` instead. See :ref:`tarfile-objects`. + better use :func:`tarfile.open` instead. See :ref:`tarfile-objects`. .. function:: is_tarfile(name) @@ -125,7 +123,7 @@ module can read. -.. class:: TarFileCompat(filename[, mode[, compression]]) +.. class:: TarFileCompat(filename, mode='r', compression=TAR_PLAIN) Class for limited access to tar archives with a :mod:`zipfile`\ -like interface. Please consult the documentation of the :mod:`zipfile` module for more details. @@ -167,16 +165,17 @@ .. exception:: ExtractError - Is raised for *non-fatal* errors when using :meth:`extract`, but only if + Is raised for *non-fatal* errors when using :meth:`TarFile.extract`, but only if :attr:`TarFile.errorlevel`\ ``== 2``. .. exception:: HeaderError - Is raised by :meth:`frombuf` if the buffer it gets is invalid. + Is raised by :meth:`TarInfo.frombuf` if the buffer it gets is invalid. .. versionadded:: 2.6 + Each of the following constants defines a tar archive format that the :mod:`tarfile` module is able to create. See section :ref:`tar-formats` for details. @@ -202,12 +201,21 @@ The default format for creating archives. This is currently :const:`GNU_FORMAT`. +The following variables are available on module level: + + +.. data:: ENCODING + + The default character encoding i.e. the value from either + :func:`sys.getfilesystemencoding` or :func:`sys.getdefaultencoding`. + + .. seealso:: Module :mod:`zipfile` Documentation of the :mod:`zipfile` standard module. - `GNU tar manual, Basic Tar Format `_ + `GNU tar manual, Basic Tar Format `_ Documentation for tar archive files, including GNU tar extensions. @@ -223,7 +231,7 @@ object, see :ref:`tarinfo-objects` for details. -.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=None, errors=None, pax_headers=None, debug=0, errorlevel=0) +.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=ENCODING, errors=None, pax_headers=None, debug=0, errorlevel=0) All following arguments are optional and can be accessed as instance attributes as well. @@ -254,18 +262,18 @@ .. versionadded:: 2.6 - If *dereference* is ``False``, add symbolic and hard links to the archive. If it - is ``True``, add the content of the target files to the archive. This has no + If *dereference* is :const:`False`, add symbolic and hard links to the archive. If it + is :const:`True`, add the content of the target files to the archive. This has no effect on systems that do not support symbolic links. - If *ignore_zeros* is ``False``, treat an empty block as the end of the archive. - If it is *True*, skip empty (and invalid) blocks and try to get as many members + If *ignore_zeros* is :const:`False`, treat an empty block as the end of the archive. + If it is :const:`True`, skip empty (and invalid) blocks and try to get as many members as possible. This is only useful for reading concatenated or damaged archives. *debug* can be set from ``0`` (no debug messages) up to ``3`` (all debug messages). The messages are written to ``sys.stderr``. - If *errorlevel* is ``0``, all errors are ignored when using :meth:`extract`. + If *errorlevel* is ``0``, all errors are ignored when using :meth:`TarFile.extract`. Nevertheless, they appear as error messages in the debug output, when debugging is enabled. If ``1``, all *fatal* errors are raised as :exc:`OSError` or :exc:`IOError` exceptions. If ``2``, all *non-fatal* errors are raised as @@ -285,8 +293,8 @@ .. method:: TarFile.open(...) - Alternative constructor. The :func:`open` function on module level is actually a - shortcut to this classmethod. See section :ref:`tarfile-mod` for details. + Alternative constructor. The :func:`tarfile.open` function is actually a + shortcut to this classmethod. .. method:: TarFile.getmember(name) @@ -322,11 +330,11 @@ .. method:: TarFile.next() Return the next member of the archive as a :class:`TarInfo` object, when - :class:`TarFile` is opened for reading. Return ``None`` if there is no more + :class:`TarFile` is opened for reading. Return :const:`None` if there is no more available. -.. method:: TarFile.extractall([path[, members]]) +.. method:: TarFile.extractall(path=".", members=None) Extract all members from the archive to the current working directory or directory *path*. If optional *members* is given, it must be a subset of the @@ -346,7 +354,7 @@ .. versionadded:: 2.5 -.. method:: TarFile.extract(member[, path]) +.. method:: TarFile.extract(member, path="") Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. *member* @@ -355,9 +363,8 @@ .. note:: - Because the :meth:`extract` method allows random access to a tar archive there - are some issues you must take care of yourself. See the description for - :meth:`extractall` above. + The :meth:`extract` method does not take care of several extraction issues. + In most cases you should consider using the :meth:`extractall` method. .. warning:: @@ -369,7 +376,7 @@ Extract a member from the archive as a file object. *member* may be a filename or a :class:`TarInfo` object. If *member* is a regular file, a file-like object is returned. If *member* is a link, a file-like object is constructed from the - link's target. If *member* is none of the above, ``None`` is returned. + link's target. If *member* is none of the above, :const:`None` is returned. .. note:: @@ -377,7 +384,7 @@ :meth:`read`, :meth:`readline`, :meth:`readlines`, :meth:`seek`, :meth:`tell`. -.. method:: TarFile.add(name[, arcname[, recursive[, exclude]]]) +.. method:: TarFile.add(name, arcname=None, recursive=True, exclude=None) Add the file *name* to the archive. *name* may be any type of file (directory, fifo, symbolic link, etc.). If given, *arcname* specifies an alternative name @@ -391,7 +398,7 @@ Added the *exclude* parameter. -.. method:: TarFile.addfile(tarinfo[, fileobj]) +.. method:: TarFile.addfile(tarinfo, fileobj=None) Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is given, ``tarinfo.size`` bytes are read from it and added to the archive. You can @@ -403,7 +410,7 @@ avoid irritation about the file size. -.. method:: TarFile.gettarinfo([name[, arcname[, fileobj]]]) +.. method:: TarFile.gettarinfo(name=None, arcname=None, fileobj=None) Create a :class:`TarInfo` object for either the file *name* or the file object *fileobj* (using :func:`os.fstat` on its file descriptor). You can modify some @@ -451,7 +458,7 @@ :meth:`getmember`, :meth:`getmembers` and :meth:`gettarinfo`. -.. class:: TarInfo([name]) +.. class:: TarInfo(name="") Create a :class:`TarInfo` object. @@ -472,7 +479,7 @@ .. versionadded:: 2.6 -.. method:: TarInfo.tobuf([format[, encoding [, errors]]]) +.. method:: TarInfo.tobuf(format=DEFAULT_FORMAT, encoding=ENCODING, errors='strict') Create a string buffer from a :class:`TarInfo` object. For information on the arguments see the constructor of the :class:`TarFile` class. @@ -604,6 +611,21 @@ tar.extractall() tar.close() +How to extract a subset of a tar archive with :meth:`TarFile.extractall` using +a generator function instead of a list:: + + import os + import tarfile + + def py_files(members): + for tarinfo in members: + if os.path.splitext(tarinfo.name)[1] == ".py": + yield tarinfo + + tar = tarfile.open("sample.tar.gz") + tar.extractall(members=py_files(tar)) + tar.close() + How to create an uncompressed tar archive from a list of filenames:: import tarfile @@ -626,28 +648,6 @@ print "something else." tar.close() -How to create a tar archive with faked information:: - - import tarfile - tar = tarfile.open("sample.tar.gz", "w:gz") - for name in namelist: - tarinfo = tar.gettarinfo(name, "fakeproj-1.0/" + name) - tarinfo.uid = 123 - tarinfo.gid = 456 - tarinfo.uname = "johndoe" - tarinfo.gname = "fake" - tar.addfile(tarinfo, file(name)) - tar.close() - -The *only* way to extract an uncompressed tar stream from ``sys.stdin``:: - - import sys - import tarfile - tar = tarfile.open(mode="r|", fileobj=sys.stdin) - for tarinfo in tar: - tar.extract(tarinfo) - tar.close() - .. _tar-formats: Modified: python/branches/okkoto-sizeof/Doc/library/telnetlib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/telnetlib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/telnetlib.rst Wed Jun 4 11:24:23 2008 @@ -28,6 +28,11 @@ :class:`Telnet` represents a connection to a Telnet server. The instance is initially not connected by default; the :meth:`open` method must be used to establish a connection. Alternatively, the host name and optional port + and timeout can be passed to the constructor, in which case the connection to + the server will be established before the constructor returns. The optional + *timeout* parameter specifies a timeout in seconds for the connection attempt (if + not specified, the global default timeout setting will be used). + number can be passed to the constructor, to, in which case the connection to the server will be established before the constructor returns. The optional *timeout* parameter specifies a timeout in seconds for blocking operations @@ -128,8 +133,7 @@ Connect to a host. The optional second argument is the port number, which defaults to the standard Telnet port (23). The optional *timeout* parameter specifies a timeout in seconds for blocking operations like the connection - attempt (if not specified, or passed as None, the global default timeout - setting will be used). + attempt (if not specified, the global default timeout setting will be used). Do not try to reopen an already connected instance. Modified: python/branches/okkoto-sizeof/Doc/library/test.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/test.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/test.rst Wed Jun 4 11:24:23 2008 @@ -185,6 +185,14 @@ .. module:: test.test_support :synopsis: Support for Python regression tests. +.. note:: + + The :mod:`test.test_support` module has been renamed to :mod:`test.support` + in Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + + + The :mod:`test.test_support` module provides support for Python's regression tests. Modified: python/branches/okkoto-sizeof/Doc/library/thread.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/thread.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/thread.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,15 @@ - :mod:`thread` --- Multiple threads of control ============================================= .. module:: thread :synopsis: Create multiple threads of control within one interpreter. +.. note:: + The :mod:`thread` module has been renamed to :mod:`_thread` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0; however, you should consider using the high-lever + :mod:`threading` module instead. + .. index:: single: light-weight processes Modified: python/branches/okkoto-sizeof/Doc/library/threading.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/threading.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/threading.rst Wed Jun 4 11:24:23 2008 @@ -8,7 +8,7 @@ This module constructs higher-level threading interfaces on top of the lower level :mod:`thread` module. -See also the :mod:`mutex` and :mod:`queue` modules. +See also the :mod:`mutex` and :mod:`Queue` modules. The :mod:`dummy_threading` module is provided for situations where :mod:`threading` cannot be used because :mod:`thread` is missing. @@ -651,6 +651,17 @@ constructor. +.. method:: Thread.getIdent() + + Return the 'thread identifier' of this thread or None if the thread has not + been started. This is a nonzero integer. See the :mod:`thread` module's + :func:`get_ident()` function. Thread identifiers may be recycled when a + thread exits and another thread is created. The identifier is returned + even after the thread has exited. + + .. versionadded:: 2.6 + + .. method:: Thread.isAlive() Return whether the thread is alive. Modified: python/branches/okkoto-sizeof/Doc/library/tkinter.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/tkinter.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/tkinter.rst Wed Jun 4 11:24:23 2008 @@ -11,6 +11,11 @@ platforms, as well as on Windows and Macintosh systems. (Tk itself is not part of Python; it is maintained at ActiveState.) +.. note:: + + :mod:`Tkinter` has been renamed to :mod:`tkinter` in Python 3.0. The + :term:`2to3` tool will automatically adapt imports when converting your + sources to 3.0. .. seealso:: @@ -107,6 +112,9 @@ :mod:`turtle` Turtle graphics in a Tk window. +These have been renamed as well in Python 3.0; they were all made submodules of +the new ``tkinter`` package. + Tkinter Life Preserver ---------------------- Modified: python/branches/okkoto-sizeof/Doc/library/urllib2.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/urllib2.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/urllib2.rst Wed Jun 4 11:24:23 2008 @@ -27,9 +27,9 @@ returns a string in this format. The optional *timeout* parameter specifies a timeout in seconds for blocking - operations like the connection attempt (if not specified, or passed as - ``None``, the global default timeout setting will be used). This actually - only works for HTTP, HTTPS, FTP and FTPS connections. + operations like the connection attempt (if not specified, the global default + timeout setting will be used). This actually only works for HTTP, HTTPS, + FTP and FTPS connections. This function returns a file-like object with two additional methods: @@ -411,9 +411,9 @@ the same as those of :func:`urlopen` (which simply calls the :meth:`open` method on the currently installed global :class:`OpenerDirector`). The optional *timeout* parameter specifies a timeout in seconds for blocking - operations like the connection attempt (if not specified, or passed as - ``None``, the global default timeout setting will be used; this actually only - works for HTTP, HTTPS, FTP and FTPS connections). + operations like the connection attempt (if not specified, the global default + timeout setting will be usedi). The timeout feature actually works only for + HTTP, HTTPS, FTP and FTPS connections). .. versionchanged:: 2.6 *timeout* was added. Modified: python/branches/okkoto-sizeof/Doc/library/userdict.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/userdict.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/userdict.rst Wed Jun 4 11:24:23 2008 @@ -100,6 +100,12 @@ defaulting to the empty list ``[]``. *list* can be any iterable, e.g. a real Python list or a :class:`UserList` object. + .. note:: + The :class:`UserList` class has been moved to the :mod:`collections` + module in Python 3.0. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + + In addition to supporting the methods and operations of mutable sequences (see section :ref:`typesseq`), :class:`UserList` instances provide the following attribute: @@ -167,6 +173,12 @@ :class:`UserString` (or a subclass) or an arbitrary sequence which can be converted into a string using the built-in :func:`str` function. + .. note:: + The :class:`UserString` class has been moved to the :mod:`collections` + module in Python 3.0. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + + .. class:: MutableString([sequence]) @@ -178,6 +190,9 @@ mutable object as dictionary key, which would be otherwise very error prone and hard to track down. + .. deprecated:: 2.6 + The :class:`MutableString` class has been removed in Python 3.0. + In addition to supporting the methods and operations of string and Unicode objects (see section :ref:`string-methods`), :class:`UserString` instances provide the following attribute: Modified: python/branches/okkoto-sizeof/Doc/library/whichdb.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/whichdb.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/whichdb.rst Wed Jun 4 11:24:23 2008 @@ -1,10 +1,14 @@ - :mod:`whichdb` --- Guess which DBM module created a database ============================================================ .. module:: whichdb :synopsis: Guess which DBM-style module created a given database. +.. note:: + The :mod:`whichdb` module's only function has been put into the :mod:`dbm` + module in Python 3.0. The :term:`2to3` tool will automatically adapt imports + when converting your sources to 3.0. + The single function in this module attempts to guess which of the several simple database modules available--\ :mod:`dbm`, :mod:`gdbm`, or :mod:`dbhash`\ Modified: python/branches/okkoto-sizeof/Doc/library/xmlrpclib.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/xmlrpclib.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/xmlrpclib.rst Wed Jun 4 11:24:23 2008 @@ -6,6 +6,11 @@ .. moduleauthor:: Fredrik Lundh .. sectionauthor:: Eric S. Raymond +.. note:: + The :mod:`xmlrpclib` module has been renamed to :mod:`xmlrpc.client` in + Python 3.0. The :term:`2to3` tool will automatically adapt imports when + converting your sources to 3.0. + .. XXX Not everything is documented yet. It might be good to describe Marshaller, Unmarshaller, getparser, dumps, loads, and Transport. Modified: python/branches/okkoto-sizeof/Doc/library/zipfile.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/library/zipfile.rst (original) +++ python/branches/okkoto-sizeof/Doc/library/zipfile.rst Wed Jun 4 11:24:23 2008 @@ -155,11 +155,11 @@ .. method:: ZipFile.open(name[, mode[, pwd]]) Extract a member from the archive as a file-like object (ZipExtFile). *name* is - the name of the file in the archive. The *mode* parameter, if included, must be - one of the following: ``'r'`` (the default), ``'U'``, or ``'rU'``. Choosing - ``'U'`` or ``'rU'`` will enable universal newline support in the read-only - object. *pwd* is the password used for encrypted files. Calling :meth:`open` - on a closed ZipFile will raise a :exc:`RuntimeError`. + the name of the file in the archive, or a :class:`ZipInfo` object. The *mode* + parameter, if included, must be one of the following: ``'r'`` (the default), + ``'U'``, or ``'rU'``. Choosing ``'U'`` or ``'rU'`` will enable universal newline + support in the read-only object. *pwd* is the password used for encrypted files. + Calling :meth:`open` on a closed ZipFile will raise a :exc:`RuntimeError`. .. note:: @@ -178,16 +178,22 @@ create a new file object that will be held by the ZipExtFile, allowing it to operate independently of the ZipFile. + .. note:: + + The :meth:`open`, :meth:`read` and :meth:`extract` methods can take a filename + or a :class:`ZipInfo` object. You will appreciate this when trying to read a + ZIP file that contains members with duplicate names. + .. versionadded:: 2.6 .. method:: ZipFile.extract(member[, path[, pwd]]) - Extract a member from the archive to the current working directory, using its - full name. Its file information is extracted as accurately as possible. - *path* specifies a different directory to extract to. *member* can be a - filename or a :class:`ZipInfo` object. *pwd* is the password used for - encrypted files. + Extract a member from the archive to the current working directory; *member* + must be its full name or a :class:`ZipInfo` object). Its file information is + extracted as accurately as possible. *path* specifies a different directory + to extract to. *member* can be a filename or a :class:`ZipInfo` object. + *pwd* is the password used for encrypted files. .. versionadded:: 2.6 @@ -216,13 +222,14 @@ .. method:: ZipFile.read(name[, pwd]) - Return the bytes of the file in the archive. The archive must be open for read - or append. *pwd* is the password used for encrypted files and, if specified, it - will override the default password set with :meth:`setpassword`. Calling + Return the bytes of the file *name* in the archive. *name* is the name of the + file in the archive, or a :class:`ZipInfo` object. The archive must be open for + read or append. *pwd* is the password used for encrypted files and, if specified, + it will override the default password set with :meth:`setpassword`. Calling :meth:`read` on a closed ZipFile will raise a :exc:`RuntimeError`. .. versionchanged:: 2.6 - *pwd* was added. + *pwd* was added, and *name* can now be a :class:`ZipInfo` object. .. method:: ZipFile.testzip() Modified: python/branches/okkoto-sizeof/Doc/reference/expressions.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/reference/expressions.rst (original) +++ python/branches/okkoto-sizeof/Doc/reference/expressions.rst Wed Jun 4 11:24:23 2008 @@ -1318,10 +1318,9 @@ .. rubric:: Footnotes -.. [#] In Python 2.3, a list comprehension "leaks" the control variables of each - ``for`` it contains into the containing scope. However, this behavior is - deprecated, and relying on it will not work once this bug is fixed in a future - release. +.. [#] In Python 2.3 and later releases, a list comprehension "leaks" the control + variables of each ``for`` it contains into the containing scope. However, this + behavior is deprecated, and relying on it will not work in Python 3.0 .. [#] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be true numerically due to roundoff. For example, and assuming a platform on which Modified: python/branches/okkoto-sizeof/Doc/reference/simple_stmts.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/reference/simple_stmts.rst (original) +++ python/branches/okkoto-sizeof/Doc/reference/simple_stmts.rst Wed Jun 4 11:24:23 2008 @@ -534,7 +534,7 @@ If no expressions are present, :keyword:`raise` re-raises the last exception that was active in the current scope. If no exception is active in the current scope, a :exc:`TypeError` exception is raised indicating that this is an error -(if running under IDLE, a :exc:`queue.Empty` exception is raised instead). +(if running under IDLE, a :exc:`Queue.Empty` exception is raised instead). Otherwise, :keyword:`raise` evaluates the expressions to get three objects, using ``None`` as the value of omitted expressions. The first two objects are Modified: python/branches/okkoto-sizeof/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/branches/okkoto-sizeof/Doc/tools/sphinxext/pyspecific.py (original) +++ python/branches/okkoto-sizeof/Doc/tools/sphinxext/pyspecific.py Wed Jun 4 11:24:23 2008 @@ -20,5 +20,71 @@ return [refnode], [] +# Support for building "topic help" for pydoc + +pydoc_topic_labels = [ + 'assert', 'assignment', 'atom-identifiers', 'atom-literals', + 'attribute-access', 'attribute-references', 'augassign', 'binary', + 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', + 'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans', + 'break', 'callable-types', 'calls', 'class', 'coercion-rules', + 'comparisons', 'compound', 'context-managers', 'continue', 'conversions', + 'customization', 'debugger', 'del', 'dict', 'dynamic-features', 'else', + 'exceptions', 'exec', 'execmodel', 'exprlists', 'floating', 'for', + 'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if', + 'imaginary', 'import', 'in', 'integers', 'lambda', 'lists', 'naming', + 'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power', + 'print', 'raise', 'return', 'sequence-methods', 'sequence-types', + 'shifting', 'slicings', 'specialattrs', 'specialnames', + 'string-conversions', 'string-methods', 'strings', 'subscriptions', 'truth', + 'try', 'types', 'typesfunctions', 'typesmapping', 'typesmethods', + 'typesmodules', 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', + 'yield' +] + +from os import path +from time import asctime +from pprint import pformat +from docutils.io import StringOutput +from docutils.utils import new_document +from sphinx.builder import Builder +from sphinx.textwriter import TextWriter + +class PydocTopicsBuilder(Builder): + name = 'pydoc-topics' + + def init(self): + self.topics = {} + + def get_outdated_docs(self): + return 'all pydoc topics' + + def get_target_uri(self, docname, typ=None): + return '' # no URIs + + def write(self, *ignored): + writer = TextWriter(self) + for label in self.status_iterator(pydoc_topic_labels, 'building topics... '): + if label not in self.env.labels: + self.warn('label %r not in documentation' % label) + continue + docname, labelid, sectname = self.env.labels[label] + doctree = self.env.get_and_resolve_doctree(docname, self) + document = new_document('
') + document.append(doctree.ids[labelid]) + destination = StringOutput(encoding='utf-8') + writer.write(document, destination) + self.topics[label] = writer.output + + def finish(self): + f = open(path.join(self.outdir, 'pydoc_topics.py'), 'w') + try: + f.write('# Autogenerated by Sphinx on %s\n' % asctime()) + f.write('topics = ' + pformat(self.topics) + '\n') + finally: + f.close() + + def setup(app): app.add_role('issue', issue_role) + app.add_builder(PydocTopicsBuilder) Modified: python/branches/okkoto-sizeof/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/controlflow.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/controlflow.rst Wed Jun 4 11:24:23 2008 @@ -445,8 +445,8 @@ up in a tuple. Before the variable number of arguments, zero or more normal arguments may occur. :: - def fprintf(file, format, *args): - file.write(format % args) + def write_multiple_items(file, separator, *args): + file.write(separator.join(args)) .. _tut-unpacking-arguments: Modified: python/branches/okkoto-sizeof/Doc/tutorial/datastructures.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/datastructures.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/datastructures.rst Wed Jun 4 11:24:23 2008 @@ -550,7 +550,7 @@ >>> questions = ['name', 'quest', 'favorite color'] >>> answers = ['lancelot', 'the holy grail', 'blue'] >>> for q, a in zip(questions, answers): - ... print 'What is your %s? It is %s.' % (q, a) + ... print 'What is your {0}? It is {1}.'.format(q, a) ... What is your name? It is lancelot. What is your quest? It is the holy grail. Modified: python/branches/okkoto-sizeof/Doc/tutorial/errors.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/errors.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/errors.rst Wed Jun 4 11:24:23 2008 @@ -132,7 +132,7 @@ s = f.readline() i = int(s.strip()) except IOError as (errno, strerror): - print "I/O error(%s): %s" % (errno, strerror) + print "I/O error({0}): {1}".format(errno, strerror) except ValueError: print "Could not convert data to an integer." except: Modified: python/branches/okkoto-sizeof/Doc/tutorial/floatingpoint.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/floatingpoint.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/floatingpoint.rst Wed Jun 4 11:24:23 2008 @@ -132,9 +132,8 @@ While pathological cases do exist, for most casual use of floating-point arithmetic you'll see the result you expect in the end if you simply round the display of your final results to the number of decimal digits you expect. -:func:`str` usually suffices, and for finer control see the discussion of -Python's ``%`` format operator: the ``%g``, ``%f`` and ``%e`` format codes -supply flexible and easy ways to round float results for display. +:func:`str` usually suffices, and for finer control see the :meth:`str.format` +method's format specifiers in :ref:`formatstrings`. .. _tut-fp-error: Modified: python/branches/okkoto-sizeof/Doc/tutorial/inputoutput.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/inputoutput.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/inputoutput.rst Wed Jun 4 11:24:23 2008 @@ -27,16 +27,13 @@ concatenation operations you can create any layout you can imagine. The standard module :mod:`string` contains some useful operations for padding strings to a given column width; these will be discussed shortly. The second -way is to use the ``%`` operator with a string as the left argument. The ``%`` -operator interprets the left argument much like a :cfunc:`sprintf`\ -style -format string to be applied to the right argument, and returns the string -resulting from this formatting operation. +way is to use the :meth:`str.format` method. One question remains, of course: how do you convert values to strings? Luckily, Python has ways to convert any value to a string: pass it to the :func:`repr` or :func:`str` functions. Reverse quotes (``````) are equivalent to -:func:`repr`, but they are no longer used in modern Python code and will likely -not be in future versions of the language. +:func:`repr`, but they are no longer used in modern Python code and are removed +in future versions of the language. The :func:`str` function is meant to return representations of values which are fairly human-readable, while :func:`repr` is meant to generate representations @@ -94,7 +91,7 @@ 10 100 1000 >>> for x in range(1,11): - ... print '%2d %3d %4d' % (x, x*x, x*x*x) + ... print '{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x) ... 1 1 1 2 4 8 @@ -129,42 +126,91 @@ >>> '3.14159265359'.zfill(5) '3.14159265359' -Using the ``%`` operator looks like this:: +Basic usage of the :meth:`str.format` method looks like this:: + + >>> print 'We are the {0} who say "{1}!"'.format('knights', 'Ni') + We are the knights who say "Ni!" + +The brackets and characters within them (called format fields) are replaced with +the objects passed into the format method. The number in the brackets refers to +the position of the object passed into the format method. :: + + >>> print '{0} and {1}'.format('spam', 'eggs') + spam and eggs + >>> print '{1} and {0}'.format('spam', 'eggs') + eggs and spam + +If keyword arguments are used in the format method, their values are referred to +by using the name of the argument. :: + + >>> print 'This {food} is {adjective}.'.format(food='spam', adjective='absolutely horrible') + This spam is absolutely horrible. + +Positional and keyword arguments can be arbitrarily combined:: + + >>> print 'The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred', other='Georg') + The story of Bill, Manfred, and Georg. + +An optional ``':``` and format specifier can follow the field name. This also +greater control over how the value is formatted. The following example +truncates the Pi to three places after the decimal. >>> import math - >>> print 'The value of PI is approximately %5.3f.' % math.pi + >>> print 'The value of PI is approximately {0:.3f}.'.format(math.pi) The value of PI is approximately 3.142. -If there is more than one format in the string, you need to pass a tuple as -right operand, as in this example:: +Passing an integer after the ``':'`` will cause that field to be a minimum +number of characters wide. This is useful for making tables pretty.:: >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678} >>> for name, phone in table.items(): - ... print '%-10s ==> %10d' % (name, phone) + ... print '{0:10} ==> {1:10d}'.format(name, phone) ... Jack ==> 4098 Dcab ==> 7678 Sjoerd ==> 4127 -Most formats work exactly as in C and require that you pass the proper type; -however, if you don't you get an exception, not a core dump. The ``%s`` format -is more relaxed: if the corresponding argument is not a string object, it is -converted to string using the :func:`str` built-in function. Using ``*`` to -pass the width or precision in as a separate (integer) argument is supported. -The C formats ``%n`` and ``%p`` are not supported. - If you have a really long format string that you don't want to split up, it would be nice if you could reference the variables to be formatted by name -instead of by position. This can be done by using form ``%(name)format``, as -shown here:: +instead of by position. This can be done by simply passing the dict and using +square brackets ``'[]'`` to access the keys :: + + >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678} + >>> print 'Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table) + Jack: 4098; Sjoerd: 4127; Dcab: 8637678 + +This could also be done by passing the table as keyword arguments with the '**' +notation.:: >>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678} - >>> print 'Jack: %(Jack)d; Sjoerd: %(Sjoerd)d; Dcab: %(Dcab)d' % table + >>> print 'Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'.format(**table) Jack: 4098; Sjoerd: 4127; Dcab: 8637678 This is particularly useful in combination with the new built-in :func:`vars` function, which returns a dictionary containing all local variables. +For a complete overview of string formating with :meth:`str.format`, see +:ref:`formatstrings`. + + +Old string formatting +--------------------- + +The ``%`` operator can also be used for string formatting. It interprets the +left argument much like a :cfunc:`sprintf`\ -style format string to be applied +to the right argument, and returns the string resulting from this formatting +operation. For example:: + + >>> import math + >>> print 'The value of PI is approximately %5.3f.' % math.pi + The value of PI is approximately 3.142. + +Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%`` +operator. However, because this old style of formatting will eventually removed +from the language :meth:`str.format` should generally be used. + +More information can be found in the :ref:`string-formatting` section. + .. _tut-files: Modified: python/branches/okkoto-sizeof/Doc/tutorial/interpreter.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/interpreter.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/interpreter.rst Wed Jun 4 11:24:23 2008 @@ -51,8 +51,8 @@ A second way of starting the interpreter is ``python -c command [arg] ...``, which executes the statement(s) in *command*, analogous to the shell's :option:`-c` option. Since Python statements often contain spaces or other -characters that are special to the shell, it is best to quote *command* in its -entirety with double quotes. +characters that are special to the shell, it is usually advised to quote +*command* in its entirety with single quotes. Some Python modules are also useful as scripts. These can be invoked using ``python -m module [arg] ...``, which executes the source file for *module* as Modified: python/branches/okkoto-sizeof/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/introduction.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/introduction.rst Wed Jun 4 11:24:23 2008 @@ -372,9 +372,13 @@ Both strings and Unicode strings support a large number of methods for basic transformations and searching. + :ref:`new-string-formatting` + Information about string formatting with :meth:`str.format` is described + here. + :ref:`string-formatting` - The formatting operations invoked when strings and Unicode strings are the - left operand of the ``%`` operator are described in more detail here. + The old formatting operations invoked when strings and Unicode strings are + the left operand of the ``%`` operator are described in more detail here. .. _tut-unicodestrings: Modified: python/branches/okkoto-sizeof/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/tutorial/stdlib2.rst (original) +++ python/branches/okkoto-sizeof/Doc/tutorial/stdlib2.rst Wed Jun 4 11:24:23 2008 @@ -13,11 +13,11 @@ Output Formatting ================= -The :mod:`reprlib` module provides a version of :func:`repr` customized for +The :mod:`repr` module provides a version of :func:`repr` customized for abbreviated displays of large or deeply nested containers:: - >>> import reprlib - >>> reprlib.repr(set('supercalifragilisticexpialidocious')) + >>> import repr + >>> repr.repr(set('supercalifragilisticexpialidocious')) "set(['a', 'c', 'd', 'e', 'f', 'g', ...])" The :mod:`pprint` module offers more sophisticated control over printing both @@ -116,7 +116,7 @@ >>> for i, filename in enumerate(photofiles): ... base, ext = os.path.splitext(filename) ... newname = t.substitute(d=date, n=i, f=ext) - ... print '%s --> %s' % (filename, newname) + ... print '{0} --> {1}'.format(filename, newname) img_1074.jpg --> Ashley_0.jpg img_1076.jpg --> Ashley_1.jpg @@ -174,7 +174,7 @@ class AsyncZip(threading.Thread): def __init__(self, infile, outfile): - threading.Thread.__init__(self) + threading.Thread.__init__(self) self.infile = infile self.outfile = outfile def run(self): @@ -198,9 +198,9 @@ While those tools are powerful, minor design errors can result in problems that are difficult to reproduce. So, the preferred approach to task coordination is to concentrate all access to a resource in a single thread and then use the -:mod:`queue` module to feed that thread with requests from other threads. -Applications using :class:`Queue` objects for inter-thread communication and -coordination are easier to design, more readable, and more reliable. +:mod:`Queue` module to feed that thread with requests from other threads. +Applications using :class:`Queue.Queue` objects for inter-thread communication +and coordination are easier to design, more readable, and more reliable. .. _tut-logging: @@ -358,11 +358,11 @@ results in decimal floating point and binary floating point. The difference becomes significant if the results are rounded to the nearest cent:: - >>> from decimal import * + >>> from decimal import * >>> Decimal('0.70') * Decimal('1.05') Decimal("0.7350") >>> .70 * 1.05 - 0.73499999999999999 + 0.73499999999999999 The :class:`Decimal` result keeps a trailing zero, automatically inferring four place significance from multiplicands with two place significance. Decimal @@ -380,7 +380,7 @@ >>> sum([Decimal('0.1')]*10) == Decimal('1.0') True >>> sum([0.1]*10) == 1.0 - False + False The :mod:`decimal` module provides arithmetic with as much precision as needed:: Modified: python/branches/okkoto-sizeof/Doc/using/cmdline.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/using/cmdline.rst (original) +++ python/branches/okkoto-sizeof/Doc/using/cmdline.rst Wed Jun 4 11:24:23 2008 @@ -481,6 +481,13 @@ .. versionadded:: 2.6 +.. envvar:: PYTHONIOENCODING + + Overrides the encoding used for stdin/stdout/stderr, in the syntax + encodingname:errorhandler, with the :errors part being optional. + + .. versionadded:: 2.6 + .. envvar:: PYTHONNOUSERSITE Modified: python/branches/okkoto-sizeof/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/okkoto-sizeof/Doc/whatsnew/2.6.rst (original) +++ python/branches/okkoto-sizeof/Doc/whatsnew/2.6.rst Wed Jun 4 11:24:23 2008 @@ -1,5 +1,5 @@ **************************** - What's New in Python 2.6 + What's New in Python 2.6 **************************** .. XXX add trademark info for Apple, Microsoft, SourceForge. @@ -10,42 +10,42 @@ .. $Id: whatsnew26.tex 55746 2007-06-02 18:33:53Z neal.norwitz $ Rules for maintenance: - + * Anyone can add text to this document. Do not spend very much time on the wording of your changes, because your text will probably get rewritten to some degree. - + * The maintainer will go through Misc/NEWS periodically and add changes; it's therefore more important to add your changes to Misc/NEWS than to this file. - + * This is not a complete list of every single change; completeness is the purpose of Misc/NEWS. Some changes I consider too small or esoteric to include. If such a change is added to the text, I'll just remove it. (This is another reason you shouldn't spend too much time on writing your addition.) - + * If you want to draw your new text to the attention of the maintainer, add 'XXX' to the beginning of the paragraph or section. - + * It's OK to just add a fragmentary note about a change. For example: "XXX Describe the transmogrify() function added to the socket module." The maintainer will research the change and write the necessary text. - + * You can comment out your additions if you like, but it's not necessary (especially when a final release is some months away). - + * Credit the author of a patch or bugfix. Just the name is sufficient; the e-mail address isn't necessary. - + * It's helpful to add the bug/patch number in a parenthetical comment. - + XXX Describe the transmogrify() function added to the socket module. (Contributed by P.Y. Developer; :issue:`12345`.) - + This saves the maintainer some effort going through the SVN logs when researching a change. @@ -74,7 +74,7 @@ ================ The development cycle for Python 2.6 also saw the release of the first -alphas of Python 3.0, and the development of 3.0 has influenced +alphas of Python 3.0, and the development of 3.0 has influenced a number of features in 2.6. Python 3.0 is a far-ranging redesign of Python that breaks @@ -83,7 +83,7 @@ Python 3.0. However, not all the changes in 3.0 necessarily break compatibility. In cases where new features won't cause existing code to break, they've been backported to 2.6 and are described in this -document in the appropriate place. Some of the 3.0-derived features +document in the appropriate place. Some of the 3.0-derived features are: * A :meth:`__complex__` method for converting objects to a complex number. @@ -94,7 +94,7 @@ A new command-line switch, :option:`-3`, enables warnings about features that will be removed in Python 3.0. You can run code with this switch to see how much work will be necessary to port -code to 3.0. The value of this switch is available +code to 3.0. The value of this switch is available to Python code as the boolean variable :data:`sys.py3kwarning`, and to C extension code as :cdata:`Py_Py3kWarningFlag`. @@ -116,9 +116,9 @@ Development Changes ================================================== -While 2.6 was being developed, the Python development process -underwent two significant changes: the developer group -switched from SourceForge's issue tracker to a customized +While 2.6 was being developed, the Python development process +underwent two significant changes: the developer group +switched from SourceForge's issue tracker to a customized Roundup installation, and the documentation was converted from LaTeX to reStructuredText. @@ -135,34 +135,34 @@ therefore posted a call for issue trackers, asking volunteers to set up different products and import some of the bugs and patches from SourceForge. Four different trackers were examined: Atlassian's `Jira -`__, -`Launchpad `__, -`Roundup `__, and -`Trac `__. +`__, +`Launchpad `__, +`Roundup `__, and +`Trac `__. The committee eventually settled on Jira and Roundup as the two candidates. Jira is a commercial product that -offers a no-cost hosted instance to free-software projects; Roundup +offers a no-cost hosted instance to free-software projects; Roundup is an open-source project that requires volunteers to administer it and a server to host it. After posting a call for volunteers, a new Roundup installation was set up at http://bugs.python.org. One installation of Roundup can host multiple trackers, and this server now also hosts issue trackers -for Jython and for the Python web site. It will surely find +for Jython and for the Python web site. It will surely find other uses in the future. Where possible, this edition of "What's New in Python" links to the bug/patch item for each change. -Hosting is kindly provided by -`Upfront Systems `__ +Hosting is kindly provided by +`Upfront Systems `__ of Stellenbosch, South Africa. Martin von Loewis put a lot of effort into importing existing bugs and patches from -SourceForge; his scripts for this import operation are at +SourceForge; his scripts for this import operation are at http://svn.python.org/view/tracker/importer/. .. seealso:: - http://bugs.python.org + http://bugs.python.org The Python bug tracker. http://bugs.jython.org: @@ -189,8 +189,8 @@ Unfortunately, converting LaTeX to HTML is fairly complicated, and Fred L. Drake Jr., the Python documentation editor for many years, spent a lot of time wrestling the conversion process into shape. -Occasionally people would suggest converting the documentation into -SGML or, later, XML, but performing a good conversion is a major task +Occasionally people would suggest converting the documentation into +SGML or, later, XML, but performing a good conversion is a major task and no one pursued the task to completion. During the 2.6 development cycle, Georg Brandl put a substantial @@ -222,7 +222,7 @@ statement an optional feature, to be enabled by a ``from __future__ import with_statement`` directive. In 2.6 the statement no longer needs to be specially enabled; this means that :keyword:`with` is now always a -keyword. The rest of this section is a copy of the corresponding +keyword. The rest of this section is a copy of the corresponding section from "What's New in Python 2.5" document; if you read it back when Python 2.5 came out, you can skip the rest of this section. @@ -518,7 +518,7 @@ :pep:`370` - Per-user ``site-packages`` Directory PEP written and implemented by Christian Heimes. - + .. ====================================================================== .. _pep-3101: @@ -526,9 +526,9 @@ PEP 3101: Advanced String Formatting ===================================================== -In Python 3.0, the `%` operator is supplemented by a more powerful -string formatting method, :meth:`format`. Support for the -:meth:`format` method has been backported to Python 2.6. +In Python 3.0, the `%` operator is supplemented by a more powerful string +formatting method, :meth:`format`. Support for the :meth:`str.format` method +has been backported to Python 2.6. In 2.6, both 8-bit and Unicode strings have a `.format()` method that treats the string as a template and takes the arguments to be formatted. @@ -539,7 +539,7 @@ # Use the named keyword arguments uid = 'root' - + 'User ID: {uid} Last seen: {last_login}'.format(uid='root', last_login = '5 Mar 2008 07:20') -> 'User ID: root Last seen: 5 Mar 2008 07:20' @@ -548,8 +548,8 @@ format("Empty dict: {{}}") -> "Empty dict: {}" -Field names can be integers indicating positional arguments, such as -``{0}``, ``{1}``, etc. or names of keyword arguments. You can also +Field names can be integers indicating positional arguments, such as +``{0}``, ``{1}``, etc. or names of keyword arguments. You can also supply compound field names that read attributes or access dictionary keys:: import sys @@ -602,7 +602,7 @@ = (For numeric types only) Pad after the sign. ================ ============================================ -Format specifiers can also include a presentation type, which +Format specifiers can also include a presentation type, which controls how the value is formatted. For example, floating-point numbers can be formatted as a general number or in exponential notation: @@ -649,8 +649,11 @@ .. seealso:: + :ref:`formatstrings` + The reference format fields. + :pep:`3101` - Advanced String Formatting - PEP written by Talin. + PEP written by Talin. Implemented by Eric Smith. .. ====================================================================== @@ -660,10 +663,10 @@ ===================================================== The ``print`` statement becomes the :func:`print` function in Python 3.0. -Making :func:`print` a function makes it easier to change -by doing 'def print(...)' or importing a new function from somewhere else. +Making :func:`print` a function makes it easier to change +by doing 'def print(...)' or importing a new function from somewhere else. -Python 2.6 has a ``__future__`` import that removes ``print`` as language +Python 2.6 has a ``__future__`` import that removes ``print`` as language syntax, letting you use the functional form instead. For example:: from __future__ import print_function @@ -677,7 +680,7 @@ * **args**: positional arguments whose values will be printed out. * **sep**: the separator, which will be printed between arguments. - * **end**: the ending text, which will be printed after all of the + * **end**: the ending text, which will be printed after all of the arguments have been output. * **file**: the file object to which the output will be sent. @@ -693,7 +696,7 @@ PEP 3110: Exception-Handling Changes ===================================================== -One error that Python programmers occasionally make +One error that Python programmers occasionally make is the following:: try: @@ -701,11 +704,11 @@ except TypeError, ValueError: ... -The author is probably trying to catch both +The author is probably trying to catch both :exc:`TypeError` and :exc:`ValueError` exceptions, but this code -actually does something different: it will catch +actually does something different: it will catch :exc:`TypeError` and bind the resulting exception object -to the local name ``"ValueError"``. The correct code +to the local name ``"ValueError"``. The correct code would have specified a tuple:: try: @@ -718,7 +721,7 @@ node that's a tuple. Python 3.0 changes the syntax to make this unambiguous by replacing -the comma with the word "as". To catch an exception and store the +the comma with the word "as". To catch an exception and store the exception object in the variable ``exc``, you must write:: try: @@ -744,13 +747,13 @@ ===================================================== Python 3.0 adopts Unicode as the language's fundamental string type, and -denotes 8-bit literals differently, either as ``b'string'`` -or using a :class:`bytes` constructor. For future compatibility, +denotes 8-bit literals differently, either as ``b'string'`` +or using a :class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:`bytes` as a synonym for the :class:`str` type, and it also supports the ``b''`` notation. There's also a ``__future__`` import that causes all string literals -to become Unicode strings. This means that ``\u`` escape sequences +to become Unicode strings. This means that ``\u`` escape sequences can be used to include Unicode characters:: @@ -786,7 +789,7 @@ the :mod:`io` module: * :class:`RawIOBase`: defines raw I/O operations: :meth:`read`, - :meth:`readinto`, + :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, and :meth:`close`. Most of the methods of this class will often map to a single system call. @@ -799,36 +802,36 @@ .. XXX should 2.6 register them in io.py? -* :class:`BufferedIOBase`: is an abstract base class that - buffers data in memory to reduce the number of +* :class:`BufferedIOBase`: is an abstract base class that + buffers data in memory to reduce the number of system calls used, making I/O processing more efficient. - It supports all of the methods of :class:`RawIOBase`, + It supports all of the methods of :class:`RawIOBase`, and adds a :attr:`raw` attribute holding the underlying raw object. There are four concrete classes implementing this ABC: - :class:`BufferedWriter` and + :class:`BufferedWriter` and :class:`BufferedReader` for objects that only support writing or reading and don't support random access, :class:`BufferedRandom` for objects that support the :meth:`seek` method for random access, - and :class:`BufferedRWPair` for objects such as TTYs that have + and :class:`BufferedRWPair` for objects such as TTYs that have both read and write operations that act upon unconnected streams of data. * :class:`TextIOBase`: Provides functions for reading and writing strings (remember, strings will be Unicode in Python 3.0), - and supporting universal newlines. :class:`TextIOBase` defines - the :meth:`readline` method and supports iteration upon - objects. + and supporting universal newlines. :class:`TextIOBase` defines + the :meth:`readline` method and supports iteration upon + objects. There are two concrete implementations. :class:`TextIOWrapper` wraps a buffered I/O object, supporting all of the methods for - text I/O and adding a :attr:`buffer` attribute for access + text I/O and adding a :attr:`buffer` attribute for access to the underlying object. :class:`StringIO` simply buffers everything in memory without ever writing anything to disk. (In current 2.6 alpha releases, :class:`io.StringIO` is implemented in - pure Python, so it's pretty slow. You should therefore stick with the - existing :mod:`StringIO` module or :mod:`cStringIO` for now. At some + pure Python, so it's pretty slow. You should therefore stick with the + existing :mod:`StringIO` module or :mod:`cStringIO` for now. At some point Python 3.0's :mod:`io` module will be rewritten into C for speed, and perhaps the C implementation will be backported to the 2.x releases.) @@ -836,7 +839,7 @@ In Python 2.6, the underlying implementations haven't been restructured to build on top of the :mod:`io` module's classes. The -module is being provided to make it easier to write code that's +module is being provided to make it easier to write code that's forward-compatible with 3.0, and to save developers the effort of writing their own implementations of buffering and text I/O. @@ -855,7 +858,7 @@ ===================================================== The buffer protocol is a C-level API that lets Python types -exchange pointers into their internal representations. A +exchange pointers into their internal representations. A memory-mapped file can be viewed as a buffer of characters, for example, and this lets another module such as :mod:`re` treat memory-mapped files as a string of characters to be searched. @@ -863,19 +866,19 @@ The primary users of the buffer protocol are numeric-processing packages such as NumPy, which can expose the internal representation of arrays so that callers can write data directly into an array instead -of going through a slower API. This PEP updates the buffer protocol in light of experience +of going through a slower API. This PEP updates the buffer protocol in light of experience from NumPy development, adding a number of new features -such as indicating the shape of an array, +such as indicating the shape of an array, locking memory . -The most important new C API function is +The most important new C API function is ``PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags)``, which takes an object and a set of flags, and fills in the -``Py_buffer`` structure with information +``Py_buffer`` structure with information about the object's memory representation. Objects -can use this operation to lock memory in place +can use this operation to lock memory in place while an external caller could be modifying the contents, -so there's a corresponding +so there's a corresponding ``PyObject_ReleaseBuffer(PyObject *obj, Py_buffer *view)`` to indicate that the external caller is done. @@ -883,7 +886,7 @@ constraints upon the memory returned. Some examples are: * :const:`PyBUF_WRITABLE` indicates that the memory must be writable. - + * :const:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory. * :const:`PyBUF_C_CONTIGUOUS` and :const:`PyBUF_F_CONTIGUOUS` @@ -897,7 +900,7 @@ :pep:`3118` - Revising the buffer protocol PEP written by Travis Oliphant and Carl Banks; implemented by Travis Oliphant. - + .. ====================================================================== @@ -909,16 +912,16 @@ Some object-oriented languages such as Java support interfaces: declarations that a class has a given set of methods or supports a given access protocol. Abstract Base Classes (or ABCs) are an equivalent feature for Python. The ABC -support consists of an :mod:`abc` module containing a metaclass called +support consists of an :mod:`abc` module containing a metaclass called :class:`ABCMeta`, special handling of this metaclass by the :func:`isinstance` and :func:`issubclass` built-ins, and a collection of basic ABCs that the Python developers think will be widely useful. -Let's say you have a particular class and wish to know whether it supports +Let's say you have a particular class and wish to know whether it supports dictionary-style access. The phrase "dictionary-style" is vague, however. -It probably means that accessing items with ``obj[1]`` works. -Does it imply that setting items with ``obj[2] = value`` works? +It probably means that accessing items with ``obj[1]`` works. +Does it imply that setting items with ``obj[2] = value`` works? Or that the object will have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:`update`? Iterating over the object with :func:`iter`? @@ -927,7 +930,7 @@ module. :class:`Iterable` indicates that a class defines :meth:`__iter__`, and :class:`Container` means the class supports ``x in y`` expressions by defining a :meth:`__contains__` method. The basic dictionary interface of -getting items, setting items, and +getting items, setting items, and :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:`MutableMapping` ABC. @@ -935,22 +938,22 @@ to indicate they support that ABC's interface:: import collections - + class Storage(collections.MutableMapping): ... -Alternatively, you could write the class without deriving from +Alternatively, you could write the class without deriving from the desired ABC and instead register the class by calling the ABC's :meth:`register` method:: import collections - + class Storage: ... - + collections.MutableMapping.register(Storage) - + For classes that you write, deriving from the ABC is probably clearer. The :meth:`register` method is useful when you've written a new ABC that can describe an existing type or class, or if you want @@ -963,8 +966,8 @@ PrintableType.register(float) PrintableType.register(str) -Classes should obey the semantics specified by an ABC, but -Python can't check this; it's up to the class author to +Classes should obey the semantics specified by an ABC, but +Python can't check this; it's up to the class author to understand the ABC's requirements and to implement the code accordingly. To check whether an object supports a particular interface, you can @@ -972,11 +975,11 @@ def func(d): if not isinstance(d, collections.MutableMapping): - raise ValueError("Mapping object expected, not %r" % d) + raise ValueError("Mapping object expected, not %r" % d) -(Don't feel that you must now begin writing lots of checks as in the -above example. Python has a strong tradition of duck-typing, where -explicit type-checking isn't done and code simply calls methods on +(Don't feel that you must now begin writing lots of checks as in the +above example. Python has a strong tradition of duck-typing, where +explicit type-checking isn't done and code simply calls methods on an object, trusting that those methods will be there and raising an exception if they aren't. Be judicious in checking for ABCs and only do it where it helps.) @@ -988,46 +991,46 @@ class Drawable(): __metaclass__ = ABCMeta - + def draw(self, x, y, scale=1.0): pass def draw_doubled(self, x, y): self.draw(x, y, scale=2.0) - + class Square(Drawable): def draw(self, x, y, scale): ... - + In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders the object at twice its size and can be implemented in terms of other methods described in :class:`Drawable`. Classes implementing -this ABC therefore don't need to provide their own implementation +this ABC therefore don't need to provide their own implementation of :meth:`draw_doubled`, though they can do so. An implementation -of :meth:`draw` is necessary, though; the ABC can't provide -a useful generic implementation. You -can apply the ``@abstractmethod`` decorator to methods such as -:meth:`draw` that must be implemented; Python will -then raise an exception for classes that +of :meth:`draw` is necessary, though; the ABC can't provide +a useful generic implementation. You +can apply the ``@abstractmethod`` decorator to methods such as +:meth:`draw` that must be implemented; Python will +then raise an exception for classes that don't define the method:: class Drawable(): __metaclass__ = ABCMeta - + @abstractmethod def draw(self, x, y, scale): pass -Note that the exception is only raised when you actually +Note that the exception is only raised when you actually try to create an instance of a subclass without the method:: >>> s=Square() Traceback (most recent call last): File "", line 1, in TypeError: Can't instantiate abstract class Square with abstract methods draw - >>> + >>> Abstract data attributes can be declared using the ``@abstractproperty`` decorator:: @@ -1035,7 +1038,7 @@ def readonly(self): return self._x -Subclasses must then define a :meth:`readonly` property +Subclasses must then define a :meth:`readonly` property .. seealso:: @@ -1056,7 +1059,7 @@ adds support for binary (base-2) integer literals, signalled by a "0b" or "0B" prefix. -Python 2.6 doesn't drop support for a leading 0 signalling +Python 2.6 doesn't drop support for a leading 0 signalling an octal number, but it does add support for "0o" and "0b":: >>> 0o21, 2*8 + 1 @@ -1064,8 +1067,8 @@ >>> 0b101111 47 -The :func:`oct` built-in still returns numbers -prefixed with a leading zero, and a new :func:`bin` +The :func:`oct` built-in still returns numbers +prefixed with a leading zero, and a new :func:`bin` built-in returns the binary representation for a number:: >>> oct(42) @@ -1141,36 +1144,36 @@ round off the results or introduce tiny errors that may break the commutativity and associativity properties; inexact numbers may perform such rounding or introduce small errors. Integers, long -integers, and rational numbers are exact, while floating-point +integers, and rational numbers are exact, while floating-point and complex numbers are inexact. :class:`Complex` is a subclass of :class:`Number`. Complex numbers can undergo the basic operations of addition, subtraction, multiplication, division, and exponentiation, and you can retrieve the -real and imaginary parts and obtain a number's conjugate. Python's built-in +real and imaginary parts and obtain a number's conjugate. Python's built-in complex type is an implementation of :class:`Complex`. -:class:`Real` further derives from :class:`Complex`, and adds -operations that only work on real numbers: :func:`floor`, :func:`trunc`, -rounding, taking the remainder mod N, floor division, -and comparisons. +:class:`Real` further derives from :class:`Complex`, and adds +operations that only work on real numbers: :func:`floor`, :func:`trunc`, +rounding, taking the remainder mod N, floor division, +and comparisons. :class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` and :attr:`denominator` properties, and can be converted to floats. Python 2.6 adds a simple rational-number class, -:class:`Fraction`, in the :mod:`fractions` module. (It's called -:class:`Fraction` instead of :class:`Rational` to avoid +:class:`Fraction`, in the :mod:`fractions` module. (It's called +:class:`Fraction` instead of :class:`Rational` to avoid a name clash with :class:`numbers.Rational`.) :class:`Integral` numbers derive from :class:`Rational`, and -can be shifted left and right with ``<<`` and ``>>``, -combined using bitwise operations such as ``&`` and ``|``, +can be shifted left and right with ``<<`` and ``>>``, +combined using bitwise operations such as ``&`` and ``|``, and can be used as array indexes and slice boundaries. In Python 3.0, the PEP slightly redefines the existing built-ins :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new -one, :func:`math.trunc`, that's been backported to Python 2.6. -:func:`math.trunc` rounds toward zero, returning the closest +one, :func:`math.trunc`, that's been backported to Python 2.6. +:func:`math.trunc` rounds toward zero, returning the closest :class:`Integral` that's between the function's argument and zero. .. seealso:: @@ -1181,7 +1184,7 @@ `Scheme's numerical tower `__, from the Guile manual. `Scheme's number datatypes `__ from the R5RS Scheme specification. - + The :mod:`fractions` Module -------------------------------------------------- @@ -1205,8 +1208,8 @@ >>> a/b Fraction(5, 3) -To help in converting floating-point numbers to rationals, -the float type now has a :meth:`as_integer_ratio()` method that returns +To help in converting floating-point numbers to rationals, +the float type now has a :meth:`as_integer_ratio()` method that returns the numerator and denominator for a fraction that evaluates to the same floating-point value:: @@ -1239,7 +1242,7 @@ >>> def f(**kw): ... print sorted(kw) - ... + ... >>> ud=UserDict.UserDict() >>> ud['a'] = 1 >>> ud['b'] = 'string' @@ -1264,21 +1267,21 @@ * Properties now have three attributes, :attr:`getter`, :attr:`setter` and :attr:`deleter`, that are useful shortcuts for - adding or modifying a getter, setter or deleter function to an + adding or modifying a getter, setter or deleter function to an existing property. You would use them like this:: class C(object): - @property - def x(self): - return self._x - - @x.setter - def x(self, value): - self._x = value - - @x.deleter - def x(self): - del self._x + @property + def x(self): + return self._x + + @x.setter + def x(self, value): + self._x = value + + @x.deleter + def x(self): + del self._x class D(C): @C.x.getter @@ -1290,22 +1293,22 @@ self._x = value / 2 -* C functions and methods that use - :cfunc:`PyComplex_AsCComplex` will now accept arguments that - have a :meth:`__complex__` method. In particular, the functions in the +* C functions and methods that use + :cfunc:`PyComplex_AsCComplex` will now accept arguments that + have a :meth:`__complex__` method. In particular, the functions in the :mod:`cmath` module will now accept objects with this method. This is a backport of a Python 3.0 change. (Contributed by Mark Dickinson; :issue:`1675423`.) A numerical nicety: when creating a complex number from two floats - on systems that support signed zeros (-0 and +0), the - :func:`complex` constructor will now preserve the sign + on systems that support signed zeros (-0 and +0), the + :func:`complex` constructor will now preserve the sign of the zero. (:issue:`1507`) * More floating-point features were also added. The :func:`float` function will now turn the strings ``+nan`` and ``-nan`` into the corresponding - IEEE 754 Not A Number values, and ``+inf`` and ``-inf`` into - positive or negative infinity. This works on any platform with + IEEE 754 Not A Number values, and ``+inf`` and ``-inf`` into + positive or negative infinity. This works on any platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:`1635`.) Other functions in the :mod:`math` module, :func:`isinf` and @@ -1316,11 +1319,11 @@ functions have been improved to give more consistent behaviour across platforms, especially with respect to handling of floating-point exceptions and IEEE 754 special values. - The new functions are: + The new functions are: * :func:`isinf` and :func:`isnan` determine whether a given float is a (positive or negative) infinity or a NaN (Not a Number), - respectively. + respectively. * ``copysign(x, y)`` copies the sign bit of an IEEE 754 number, returning the absolute value of *x* combined with the sign bit of @@ -1350,31 +1353,31 @@ (Contributed by Christian Heimes and Mark Dickinson.) * Changes to the :class:`Exception` interface - as dictated by :pep:`352` continue to be made. For 2.6, + as dictated by :pep:`352` continue to be made. For 2.6, the :attr:`message` attribute is being deprecated in favor of the :attr:`args` attribute. -* The :exc:`GeneratorExit` exception now subclasses - :exc:`BaseException` instead of :exc:`Exception`. This means +* The :exc:`GeneratorExit` exception now subclasses + :exc:`BaseException` instead of :exc:`Exception`. This means that an exception handler that does ``except Exception:`` - will not inadvertently catch :exc:`GeneratorExit`. + will not inadvertently catch :exc:`GeneratorExit`. (Contributed by Chad Austin; :issue:`1537`.) -* Generator objects now have a :attr:`gi_code` attribute that refers to - the original code object backing the generator. +* Generator objects now have a :attr:`gi_code` attribute that refers to + the original code object backing the generator. (Contributed by Collin Winter; :issue:`1473257`.) * The :func:`compile` built-in function now accepts keyword arguments as well as positional parameters. (Contributed by Thomas Wouters; :issue:`1444529`.) -* The :func:`complex` constructor now accepts strings containing +* The :func:`complex` constructor now accepts strings containing parenthesized complex numbers, letting ``complex(repr(cmplx))`` will now round-trip values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:issue:`1491866`) -* The string :meth:`translate` method now accepts ``None`` as the - translation table parameter, which is treated as the identity +* The string :meth:`translate` method now accepts ``None`` as the + translation table parameter, which is treated as the identity transformation. This makes it easier to carry out operations that only delete characters. (Contributed by Bengt Richter; :issue:`1193128`.) @@ -1383,7 +1386,7 @@ method on the objects it receives. This method must return a list of strings containing the names of valid attributes for the object, and lets the object control the value that :func:`dir` produces. - Objects that have :meth:`__getattr__` or :meth:`__getattribute__` + Objects that have :meth:`__getattr__` or :meth:`__getattribute__` methods can use this to advertise pseudo-attributes they will honor. (:issue:`1591665`) @@ -1411,12 +1414,12 @@ * Type objects now have a cache of methods that can reduce the amount of work required to find the correct method implementation for a particular class; once cached, the interpreter doesn't need to - traverse base classes to figure out the right method to call. - The cache is cleared if a base class or the class itself is modified, - so the cache should remain correct even in the face of Python's dynamic + traverse base classes to figure out the right method to call. + The cache is cleared if a base class or the class itself is modified, + so the cache should remain correct even in the face of Python's dynamic nature. - (Original optimization implemented by Armin Rigo, updated for - Python 2.6 by Kevin Jacobs; :issue:`1700288`.) + (Original optimization implemented by Armin Rigo, updated for + Python 2.6 by Kevin Jacobs; :issue:`1700288`.) * All of the functions in the :mod:`struct` module have been rewritten in C, thanks to work at the Need For Speed sprint. @@ -1427,7 +1430,7 @@ these types. (Contributed by Neal Norwitz.) * Unicode strings now use faster code for detecting - whitespace and line breaks; this speeds up the :meth:`split` method + whitespace and line breaks; this speeds up the :meth:`split` method by about 25% and :meth:`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is reduced by using pymalloc for the Unicode string's data. @@ -1468,12 +1471,51 @@ complete list of changes, or look through the Subversion logs for all the details. -* (3.0-warning mode) Python 3.0 will feature a reorganized standard +* (3.0-warning mode) Python 3.0 will feature a reorganized standard library; many outdated modules are being dropped, - and some modules are being renamed or moved into packages. - Python 2.6 running in 3.0-warning mode will warn about these modules + and some modules are being renamed or moved into packages. + Python 2.6 running in 3.0-warning mode will warn about these modules when they are imported. + + The modules that have been renamed are: + + * :mod:`ConfigParser` has become :mod:`configparser`. + * :mod:`copy_reg` has become :mod:`copyreg`. + * :mod:`htmlentitydefs` has become :mod:`html.entities`. + * :mod:`HTMLParser` has become :mod:`html.parser`. + * :mod:`repr` (the module) has become :mod:`reprlib`. + * :mod:`SocketServer` has become :mod:`socketserver`. + * :mod:`Tkinter` has become the :mod:`tkinter` package. + * :mod:`Queue` has become :mod:`queue`. + + .. XXX no warnings anymore for renamed modules! + The list of deprecated modules is: + :mod:`audiodev`, + :mod:`bgenlocations`, + :mod:`buildtools`, + :mod:`bundlebuilder`, + :mod:`Canvas`, + :mod:`compiler`, + :mod:`dircache`, + :mod:`dl`, + :mod:`fpformat`, + :mod:`gensuitemodule`, + :mod:`ihooks`, + :mod:`imageop`, + :mod:`imgfile`, + :mod:`linuxaudiodev`, + :mod:`mhlib`, + :mod:`multifile`, + :mod:`new`, + :mod:`popen2`, + :mod:`pure`, + :mod:`statvfs`, + :mod:`sunaudiodev`, + :mod:`test.testall`, + :mod:`toaiff`. + + Various MacOS modules have been removed: :mod:`_builtinSuites`, :mod:`aepack`, :mod:`aetools`, @@ -1483,68 +1525,57 @@ :mod:`appletrunner`, :mod:`argvemulator`, :mod:`Audio_mac`, - :mod:`audiodev`, :mod:`autoGIL`, - :mod:`bgenlocations`, - :mod:`buildtools`, - :mod:`bundlebuilder`, - :mod:`Canvas`, :mod:`Carbon`, :mod:`cfmfile`, :mod:`CodeWarrior`, :mod:`ColorPicker`, - :mod:`compiler`, - :mod:`cd`, - :mod:`cddb`, - :mod:`cdplayer`, - :mod:`CL` and :mod:`cl`, - :mod:`cd`, - :mod:`cd`, - :mod:`dircache`, - :mod:`dl`, :mod:`EasyDialogs`, :mod:`Explorer`, :mod:`Finder`, :mod:`FrameWork`, :mod:`findertools`, - :mod:`fpformat`, - :mod:`gensuitemodule`, :mod:`ic`, :mod:`icglue`, :mod:`icopen`, - :mod:`ihooks`, - :mod:`imageop`, - :mod:`linuxaudiodev`, :mod:`macerrors`, :mod:`MacOS`, :mod:`macostools`, :mod:`macresource`, - :mod:`mhlib`, :mod:`MiniAEFrame`, - :mod:`multifile`, :mod:`Nav`, :mod:`Netscape`, - :mod:`new`, :mod:`OSATerminology`, :mod:`pimp`, :mod:`PixMapWrapper`, - :mod:`popen2`, - :mod:`pure`, :mod:`StdSuites`, - :mod:`sv`, :mod:`SystemEvents`, :mod:`Terminal`, - :mod:`terminalcommand`, - :mod:`test.testall`, - :mod:`toaiff`, - :mod:`videoreader`. - - The modules that have been renamed are: + :mod:`terminalcommand`. - * :mod:`ConfigParser` has become :mod:`configparser`. - * :mod:`copy_reg` has become :mod:`copyreg`. - * :mod:`SocketServer` has become :mod:`socketserver`. - * :mod:`Queue` has become :mod:`queue`. + A number of old IRIX-specific modules were deprecated: + :mod:`cd`, + :mod:`cddb`, + :mod:`cdplayer`, + :mod:`CL` and :mod:`cl`, + :mod:`DEVICE`, + :mod:`ERRNO`, + :mod:`FILE`, + :mod:`FL` and :mod:`fl`, + :mod:`flp`, + :mod:`fm`, + :mod:`GET`, + :mod:`GLWS`, + :mod:`GL` and :mod:`gl`, + :mod:`IN`, + :mod:`IOCTL`, + :mod:`jpeg`, + :mod:`panelparser`, + :mod:`readcd`, + :mod:`SV` and :mod:`sv`, + :mod:`torgb`, + :mod:`videoreader`, + :mod:`WAIT`. * The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol available, instead of restricting itself to protocol 1. @@ -1554,18 +1585,18 @@ thanks to Mark Dickinson and Christian Heimes, that added some new features and greatly improved the accuracy of the computations. - Five new functions were added: + Five new functions were added: * :func:`polar` converts a complex number to polar form, returning - the modulus and argument of that complex number. + the modulus and argument of that complex number. * :func:`rect` does the opposite, turning a (modulus, argument) pair back into the corresponding complex number. - * :func:`phase` returns the phase or argument of a complex number. + * :func:`phase` returns the phase or argument of a complex number. * :func:`isnan` returns True if either - the real or imaginary part of its argument is a NaN. + the real or imaginary part of its argument is a NaN. * :func:`isinf` returns True if either the real or imaginary part of its argument is infinite. @@ -1588,7 +1619,7 @@ fieldnames)` is a factory function that creates subclasses of the standard tuple whose fields are accessible by name as well as index. For example:: - >>> var_type = collections.namedtuple('variable', + >>> var_type = collections.namedtuple('variable', ... 'id name type size') # Names are separated by spaces or commas. # 'id, name, type, size' would also work. @@ -1607,15 +1638,15 @@ variable(id=1, name='amplitude', type='int', size=4) Where the new :class:`namedtuple` type proved suitable, the standard - library has been modified to return them. For example, - the :meth:`Decimal.as_tuple` method now returns a named tuple with + library has been modified to return them. For example, + the :meth:`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields. (Contributed by Raymond Hettinger.) -* Another change to the :mod:`collections` module is that the +* Another change to the :mod:`collections` module is that the :class:`deque` type now supports an optional *maxlen* parameter; - if supplied, the deque's size will be restricted to no more + if supplied, the deque's size will be restricted to no more than *maxlen* items. Adding more items to a full deque causes old items to be discarded. @@ -1634,7 +1665,7 @@ (Contributed by Raymond Hettinger.) -* The :mod:`ctypes` module now supports a :class:`c_bool` datatype +* The :mod:`ctypes` module now supports a :class:`c_bool` datatype that represents the C99 ``bool`` type. (Contributed by David Remahl; :issue:`1649190`.) @@ -1650,9 +1681,9 @@ (Contributed by Fabian Kreutz.) :: - # Boldface text starting at y=0,x=21 + # Boldface text starting at y=0,x=21 # and affecting the rest of the line. - stdscr.chgat(0,21, curses.A_BOLD) + stdscr.chgat(0,21, curses.A_BOLD) The :class:`Textbox` class in the :mod:`curses.textpad` module now supports editing in insert mode as well as overwrite mode. @@ -1664,7 +1695,7 @@ object, zero-padded on the left to six places. (Contributed by Skip Montanaro; :issue:`1158`.) -* The :mod:`decimal` module was updated to version 1.66 of +* The :mod:`decimal` module was updated to version 1.66 of `the General Decimal Specification `__. New features include some methods for some basic mathematical functions such as :meth:`exp` and :meth:`log10`:: @@ -1676,14 +1707,14 @@ >>> Decimal(1000).log10() Decimal("3") - The :meth:`as_tuple` method of :class:`Decimal` objects now returns a + The :meth:`as_tuple` method of :class:`Decimal` objects now returns a named tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields. - + (Implemented by Facundo Batista and Mark Dickinson. Named tuple support added by Raymond Hettinger.) -* The :mod:`difflib` module's :class:`SequenceMatcher` class - now returns named tuples representing matches. +* The :mod:`difflib` module's :class:`SequenceMatcher` class + now returns named tuples representing matches. In addition to behaving like tuples, the returned values also have :attr:`a`, :attr:`b`, and :attr:`size` attributes. (Contributed by Raymond Hettinger.) @@ -1691,25 +1722,25 @@ * An optional ``timeout`` parameter was added to the :class:`ftplib.FTP` class constructor as well as the :meth:`connect` method, specifying a timeout measured in seconds. (Added by Facundo - Batista.) Also, the :class:`FTP` class's + Batista.) Also, the :class:`FTP` class's :meth:`storbinary` and :meth:`storlines` - now take an optional *callback* parameter that will be called with + now take an optional *callback* parameter that will be called with each block of data after the data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.) -* The :func:`reduce` built-in function is also available in the +* The :func:`reduce` built-in function is also available in the :mod:`functools` module. In Python 3.0, the built-in is dropped and it's only available from :mod:`functools`; currently there are no plans - to drop the built-in in the 2.x series. (Patched by + to drop the built-in in the 2.x series. (Patched by Christian Heimes; :issue:`1739906`.) -* The :func:`glob.glob` function can now return Unicode filenames if +* The :func:`glob.glob` function can now return Unicode filenames if a Unicode path was used and Unicode filenames are matched within the directory. (:issue:`1001604`) * The :mod:`gopherlib` module has been removed. -* A new function in the :mod:`heapq` module: ``merge(iter1, iter2, ...)`` +* A new function in the :mod:`heapq` module: ``merge(iter1, iter2, ...)`` takes any number of iterables that return data *in sorted order*, and returns a new iterator that returns the contents of all the iterators, also in sorted order. For example:: @@ -1718,25 +1749,25 @@ [1, 2, 3, 5, 8, 9, 16] Another new function, ``heappushpop(heap, item)``, - pushes *item* onto *heap*, then pops off and returns the smallest item. + pushes *item* onto *heap*, then pops off and returns the smallest item. This is more efficient than making a call to :func:`heappush` and then :func:`heappop`. (Contributed by Raymond Hettinger.) * An optional ``timeout`` parameter was added to the - :class:`httplib.HTTPConnection` and :class:`HTTPSConnection` + :class:`httplib.HTTPConnection` and :class:`HTTPSConnection` class constructors, specifying a timeout measured in seconds. (Added by Facundo Batista.) -* Most of the :mod:`inspect` module's functions, such as - :func:`getmoduleinfo` and :func:`getargs`, now return named tuples. +* Most of the :mod:`inspect` module's functions, such as + :func:`getmoduleinfo` and :func:`getargs`, now return named tuples. In addition to behaving like tuples, the elements of the return value can also be accessed as attributes. (Contributed by Raymond Hettinger.) - Some new functions in the module include - :func:`isgenerator`, :func:`isgeneratorfunction`, + Some new functions in the module include + :func:`isgenerator`, :func:`isgeneratorfunction`, and :func:`isabstract`. * The :mod:`itertools` module gained several new functions. @@ -1753,25 +1784,25 @@ every possible combination of the elements returned from each iterable. :: itertools.product([1,2,3], [4,5,6]) -> - [(1, 4), (1, 5), (1, 6), - (2, 4), (2, 5), (2, 6), + [(1, 4), (1, 5), (1, 6), + (2, 4), (2, 5), (2, 6), (3, 4), (3, 5), (3, 6)] The optional *repeat* keyword argument is used for taking the - product of an iterable or a set of iterables with themselves, + product of an iterable or a set of iterables with themselves, repeated *N* times. With a single iterable argument, *N*-tuples are returned:: itertools.product([1,2], repeat=3)) -> - [(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), + [(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)] With two iterables, *2N*-tuples are returned. :: itertools(product([1,2], [3,4], repeat=2) -> - [(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4), - (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4), - (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4), + [(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4), + (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4), + (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4), (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)] ``combinations(iterable, r)`` returns sub-sequences of length *r* from @@ -1784,35 +1815,35 @@ [('1', '2', '3')] itertools.combinations('1234', 3) -> - [('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'), + [('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'), ('2', '3', '4')] ``permutations(iter[, r])`` returns all the permutations of length *r* of - the iterable's elements. If *r* is not specified, it will default to the + the iterable's elements. If *r* is not specified, it will default to the number of elements produced by the iterable. :: itertools.permutations([1,2,3,4], 2) -> - [(1, 2), (1, 3), (1, 4), - (2, 1), (2, 3), (2, 4), - (3, 1), (3, 2), (3, 4), + [(1, 2), (1, 3), (1, 4), + (2, 1), (2, 3), (2, 4), + (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)] ``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` that gained a new constructor in Python 2.6. - ``itertools.chain.from_iterable(iterable)`` takes a single + ``itertools.chain.from_iterable(iterable)`` takes a single iterable that should return other iterables. :func:`chain` will then return all the elements of the first iterable, then all the elements of the second, and so on. :: chain.from_iterable([[1,2,3], [4,5,6]]) -> [1, 2, 3, 4, 5, 6] - + (All contributed by Raymond Hettinger.) -* The :mod:`logging` module's :class:`FileHandler` class +* The :mod:`logging` module's :class:`FileHandler` class and its subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, - and :class:`TimedRotatingFileHandler` now - have an optional *delay* parameter to its constructor. If *delay* + and :class:`TimedRotatingFileHandler` now + have an optional *delay* parameter to its constructor. If *delay* is true, opening of the log file is deferred until the first :meth:`emit` call is made. (Contributed by Vinay Sajip.) @@ -1827,16 +1858,16 @@ the forward search. (Contributed by John Lenton.) -* The :mod:`operator` module gained a - :func:`methodcaller` function that takes a name and an optional - set of arguments, returning a callable that will call +* The :mod:`operator` module gained a + :func:`methodcaller` function that takes a name and an optional + set of arguments, returning a callable that will call the named function on any arguments passed to it. For example:: >>> # Equivalent to lambda s: s.replace('old', 'new') >>> replacer = operator.methodcaller('replace', 'old', 'new') >>> replacer('old wine in old bottles') 'new wine in new bottles' - + (Contributed by Georg Brandl, after a suggestion by Gregory Petrosyan.) The :func:`attrgetter` function now accepts dotted names and performs @@ -1850,8 +1881,8 @@ (Contributed by Georg Brandl, after a suggestion by Barry Warsaw.) -* New functions in the :mod:`os` module include - ``fchmod(fd, mode)``, ``fchown(fd, uid, gid)``, +* New functions in the :mod:`os` module include + ``fchmod(fd, mode)``, ``fchown(fd, uid, gid)``, and ``lchmod(path, mode)``, on operating systems that support these functions. :func:`fchmod` and :func:`fchown` let you change the mode and ownership of an opened file, and :func:`lchmod` changes the mode @@ -1865,8 +1896,8 @@ parameter's default value is false. Note that the function can fall into an infinite recursion if there's a symlink that points to a parent directory. (:issue:`1273829`) - -* The ``os.environ`` object's :meth:`clear` method will now unset the + +* The ``os.environ`` object's :meth:`clear` method will now unset the environment variables using :func:`os.unsetenv` in addition to clearing the object's keys. (Contributed by Martin Horcicka; :issue:`1181`.) @@ -1882,23 +1913,23 @@ working directory to the destination ``path``. (Contributed by Richard Barran; :issue:`1339796`.) - On Windows, :func:`os.path.expandvars` will now expand environment variables - in the form "%var%", and "~user" will be expanded into the + On Windows, :func:`os.path.expandvars` will now expand environment variables + in the form "%var%", and "~user" will be expanded into the user's home directory path. (Contributed by Josiah Carlson; :issue:`957650`.) -* The Python debugger provided by the :mod:`pdb` module +* The Python debugger provided by the :mod:`pdb` module gained a new command: "run" restarts the Python program being debugged, and can optionally take new command-line arguments for the program. (Contributed by Rocky Bernstein; :issue:`1393667`.) - The :func:`post_mortem` function, used to enter debugging of a + The :func:`post_mortem` function, used to enter debugging of a traceback, will now use the traceback returned by :func:`sys.exc_info` if no traceback is supplied. (Contributed by Facundo Batista; :issue:`1106316`.) -* The :mod:`pickletools` module now has an :func:`optimize` function - that takes a string containing a pickle and removes some unused +* The :mod:`pickletools` module now has an :func:`optimize` function + that takes a string containing a pickle and removes some unused opcodes, returning a shorter pickle that contains the same data structure. (Contributed by Raymond Hettinger.) @@ -1916,7 +1947,7 @@ +-- StopIteration +-- StandardError ...' - >>> + >>> (Contributed by Paul Moore; :issue:`2439`.) @@ -1933,13 +1964,13 @@ processes faster. (Contributed by Georg Brandl; :issue:`1663329`.) * The :mod:`pyexpat` module's :class:`Parser` objects now allow setting - their :attr:`buffer_size` attribute to change the size of the buffer + their :attr:`buffer_size` attribute to change the size of the buffer used to hold character data. (Contributed by Achim Gaedke; :issue:`1137`.) * The :mod:`Queue` module now provides queue classes that retrieve entries - in different orders. The :class:`PriorityQueue` class stores - queued items in a heap and retrieves them in priority order, + in different orders. The :class:`PriorityQueue` class stores + queued items in a heap and retrieves them in priority order, and :class:`LifoQueue` retrieves the most recently added entries first, meaning that it behaves like a stack. (Contributed by Raymond Hettinger.) @@ -1953,8 +1984,8 @@ The new ``triangular(low, high, mode)`` function returns random numbers following a triangular distribution. The returned values - are between *low* and *high*, not including *high* itself, and - with *mode* as the mode, the most frequently occurring value + are between *low* and *high*, not including *high* itself, and + with *mode* as the mode, the most frequently occurring value in the distribution. (Contributed by Wladmir van der Laan and Raymond Hettinger; :issue:`1681432`.) @@ -1965,8 +1996,8 @@ * The :mod:`rgbimg` module has been removed. -* The :mod:`sched` module's :class:`scheduler` instances now - have a read-only :attr:`queue` attribute that returns the +* The :mod:`sched` module's :class:`scheduler` instances now + have a read-only :attr:`queue` attribute that returns the contents of the scheduler's queue, represented as a list of named tuples with the fields ``(time, priority, action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.) @@ -1975,19 +2006,19 @@ for the Linux :cfunc:`epoll` and BSD :cfunc:`kqueue` system calls. Also, a :meth:`modify` method was added to the existing :class:`poll` objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor - or file object and an event mask, - + or file object and an event mask, + (Contributed by Christian Heimes; :issue:`1657`.) -* The :mod:`sets` module has been deprecated; it's better to +* The :mod:`sets` module has been deprecated; it's better to use the built-in :class:`set` and :class:`frozenset` types. -* Integrating signal handling with GUI handling event loops +* Integrating signal handling with GUI handling event loops like those used by Tkinter or GTk+ has long been a problem; most software ends up polling, waking up every fraction of a second. The :mod:`signal` module can now make this more efficient. Calling ``signal.set_wakeup_fd(fd)`` sets a file descriptor - to be used; when a signal is received, a byte is written to that + to be used; when a signal is received, a byte is written to that file descriptor. There's also a C-level function, :cfunc:`PySignal_SetWakeupFd`, for setting the descriptor. @@ -1996,7 +2027,7 @@ will be passed to :func:`set_wakeup_fd`, and the readable descriptor will be added to the list of descriptors monitored by the event loop via :cfunc:`select` or :cfunc:`poll`. - On receiving a signal, a byte will be written and the main event loop + On receiving a signal, a byte will be written and the main event loop will be woken up, without the need to poll. (Contributed by Adam Olsen; :issue:`1583`.) @@ -2014,7 +2045,7 @@ * The :mod:`smtplib` module now supports SMTP over SSL thanks to the addition of the :class:`SMTP_SSL` class. This class supports an - interface identical to the existing :class:`SMTP` class. Both + interface identical to the existing :class:`SMTP` class. Both class constructors also have an optional ``timeout`` parameter that specifies a timeout for the initial connection attempt, measured in seconds. @@ -2037,35 +2068,35 @@ environments. TIPC addresses are 4- or 5-tuples. (Contributed by Alberto Bertogli; :issue:`1646`.) - A new function, :func:`create_connection`, takes an address - and connects to it using an optional timeout value, returning + A new function, :func:`create_connection`, takes an address + and connects to it using an optional timeout value, returning the connected socket object. * The base classes in the :mod:`SocketServer` module now support - calling a :meth:`handle_timeout` method after a span of inactivity - specified by the server's :attr:`timeout` attribute. (Contributed - by Michael Pomraning.) The :meth:`serve_forever` method + calling a :meth:`handle_timeout` method after a span of inactivity + specified by the server's :attr:`timeout` attribute. (Contributed + by Michael Pomraning.) The :meth:`serve_forever` method now takes an optional poll interval measured in seconds, controlling how often the server will check for a shutdown request. - (Contributed by Pedro Werneck and Jeffrey Yasskin; + (Contributed by Pedro Werneck and Jeffrey Yasskin; :issue:`742598`, :issue:`1193577`.) * The :mod:`struct` module now supports the C99 :ctype:`_Bool` type, - using the format character ``'?'``. + using the format character ``'?'``. (Contributed by David Remahl.) * The :class:`Popen` objects provided by the :mod:`subprocess` module now have :meth:`terminate`, :meth:`kill`, and :meth:`send_signal` methods. On Windows, :meth:`send_signal` only supports the :const:`SIGTERM` signal, and all these methods are aliases for the Win32 API function - :cfunc:`TerminateProcess`. + :cfunc:`TerminateProcess`. (Contributed by Christian Heimes.) - + * A new variable in the :mod:`sys` module, :attr:`float_info`, is an object containing information about the platform's floating-point support derived from the :file:`float.h` file. Attributes of this object - include + include :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest difference between 1.0 and the next largest value representable), and several others. (Contributed by Christian Heimes; @@ -2077,25 +2108,25 @@ variable is initially set on start-up by supplying the :option:`-B` switch to the Python interpreter, or by setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable before - running the interpreter. Python code can subsequently + running the interpreter. Python code can subsequently change the value of this variable to control whether bytecode files are written or not. (Contributed by Neal Norwitz and Georg Brandl.) - Information about the command-line arguments supplied to the Python - interpreter are available as attributes of a ``sys.flags`` named - tuple. For example, the :attr:`verbose` attribute is true if Python + Information about the command-line arguments supplied to the Python + interpreter are available as attributes of a ``sys.flags`` named + tuple. For example, the :attr:`verbose` attribute is true if Python was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. These attributes are all read-only. (Contributed by Christian Heimes.) It's now possible to determine the current profiler and tracer functions - by calling :func:`sys.getprofile` and :func:`sys.gettrace`. + by calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by Georg Brandl; :issue:`1648`.) * The :mod:`tarfile` module now supports POSIX.1-2001 (pax) and POSIX.1-1988 (ustar) format tarfiles, in addition to the GNU tar - format that was already supported. The default format + format that was already supported. The default format is GNU tar; specify the ``format`` parameter to open a file using a different format:: @@ -2110,37 +2141,37 @@ The :meth:`TarFile.add` method now accepts a ``exclude`` argument that's a function that can be used to exclude certain filenames from - an archive. - The function must take a filename and return true if the file + an archive. + The function must take a filename and return true if the file should be excluded or false if it should be archived. The function is applied to both the name initially passed to :meth:`add` and to the names of files in recursively-added directories. - + (All changes contributed by Lars Gust?bel). * An optional ``timeout`` parameter was added to the :class:`telnetlib.Telnet` class constructor, specifying a timeout measured in seconds. (Added by Facundo Batista.) -* The :class:`tempfile.NamedTemporaryFile` class usually deletes - the temporary file it created when the file is closed. This - behaviour can now be changed by passing ``delete=False`` to the +* The :class:`tempfile.NamedTemporaryFile` class usually deletes + the temporary file it created when the file is closed. This + behaviour can now be changed by passing ``delete=False`` to the constructor. (Contributed by Damien Miller; :issue:`1537850`.) - A new class, :class:`SpooledTemporaryFile`, behaves like - a temporary file but stores its data in memory until a maximum size is - exceeded. On reaching that limit, the contents will be written to + A new class, :class:`SpooledTemporaryFile`, behaves like + a temporary file but stores its data in memory until a maximum size is + exceeded. On reaching that limit, the contents will be written to an on-disk temporary file. (Contributed by Dustin J. Mitchell.) The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes - both work as context managers, so you can write + both work as context managers, so you can write ``with tempfile.NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :issue:`2021`.) * The :mod:`test.test_support` module now contains a :func:`EnvironmentVarGuard` context manager that supports temporarily changing environment variables and - automatically restores them to their old values. + automatically restores them to their old values. Another context manager, :class:`TransientResource`, can surround calls to resources that may or may not be available; it will catch and @@ -2149,12 +2180,12 @@ external web site:: with test_support.TransientResource(IOError, errno=errno.ETIMEDOUT): - f = urllib.urlopen('https://sf.net') + f = urllib.urlopen('https://sf.net') ... (Contributed by Brett Cannon.) -* The :mod:`textwrap` module can now preserve existing whitespace +* The :mod:`textwrap` module can now preserve existing whitespace at the beginnings and ends of the newly-created lines by specifying ``drop_whitespace=False`` as an argument:: @@ -2170,22 +2201,22 @@ has a bunch of extra whitespace. - >>> + >>> (Contributed by Dwayne Bailey; :issue:`1581073`.) -* The :mod:`timeit` module now accepts callables as well as strings +* The :mod:`timeit` module now accepts callables as well as strings for the statement being timed and for the setup code. - Two convenience functions were added for creating - :class:`Timer` instances: - ``repeat(stmt, setup, time, repeat, number)`` and + Two convenience functions were added for creating + :class:`Timer` instances: + ``repeat(stmt, setup, time, repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an instance and call the corresponding method. (Contributed by Erik Demaine; :issue:`1533909`.) * An optional ``timeout`` parameter was added to the :func:`urllib.urlopen` function and the - :class:`urllib.ftpwrapper` class constructor, as well as the + :class:`urllib.ftpwrapper` class constructor, as well as the :func:`urllib2.urlopen` function. The parameter specifies a timeout measured in seconds. For example:: @@ -2193,11 +2224,11 @@ Traceback (most recent call last): ... urllib2.URLError: - >>> + >>> - (Added by Facundo Batista.) + (Added by Facundo Batista.) -* The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning` +* The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning` gained an optional *line* argument that can be used to supply the line of source code. (Added as part of :issue:`1631171`, which re-implemented part of the :mod:`warnings` module in C code.) @@ -2206,30 +2237,30 @@ classes can now be prevented from immediately opening and binding to their socket by passing True as the ``bind_and_activate`` constructor parameter. This can be used to modify the instance's - :attr:`allow_reuse_address` attribute before calling the - :meth:`server_bind` and :meth:`server_activate` methods to + :attr:`allow_reuse_address` attribute before calling the + :meth:`server_bind` and :meth:`server_activate` methods to open the socket and begin listening for connections. (Contributed by Peter Parente; :issue:`1599845`.) :class:`SimpleXMLRPCServer` also has a :attr:`_send_traceback_header` - attribute; if true, the exception and formatted traceback are returned - as HTTP headers "X-Exception" and "X-Traceback". This feature is + attribute; if true, the exception and formatted traceback are returned + as HTTP headers "X-Exception" and "X-Traceback". This feature is for debugging purposes only and should not be used on production servers because the tracebacks could possibly reveal passwords or other sensitive - information. (Contributed by Alan McIntyre as part of his + information. (Contributed by Alan McIntyre as part of his project for Google's Summer of Code 2007.) * The :mod:`xmlrpclib` module no longer automatically converts - :class:`datetime.date` and :class:`datetime.time` to the + :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` - instances. (:issue:`1330538`) The code can also handle + :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + instances. (:issue:`1330538`) The code can also handle dates before 1900. (Contributed by Ralf Schmitt; :issue:`2014`.) -* The :mod:`zipfile` module's :class:`ZipFile` class now has - :meth:`extract` and :meth:`extractall` methods that will unpack - a single file or all the files in the archive to the current directory, or +* The :mod:`zipfile` module's :class:`ZipFile` class now has + :meth:`extract` and :meth:`extractall` methods that will unpack + a single file or all the files in the archive to the current directory, or to a specified directory:: z = zipfile.ZipFile('python-251.zip') @@ -2300,12 +2331,12 @@ plistlib: A Property-List Parser -------------------------------------------------- -A commonly-used format on MacOS X is the ``.plist`` format, -which stores basic data types (numbers, strings, lists, +A commonly-used format on MacOS X is the ``.plist`` format, +which stores basic data types (numbers, strings, lists, and dictionaries) and serializes them into an XML-based format. (It's a lot like the XML-RPC serialization of data types.) -Despite being primarily used on MacOS X, the format +Despite being primarily used on MacOS X, the format has nothing Mac-specific about it and the Python implementation works on any platform that Python supports, so the :mod:`plistlib` module has been promoted to the standard library. @@ -2333,7 +2364,7 @@ # read/writePlist accepts file-like objects as well as paths. plistlib.writePlist(data_struct, sys.stdout) - + .. ====================================================================== @@ -2352,25 +2383,25 @@ own implementations of :cfunc:`memmove` and :cfunc:`strerror`, which are in the C89 standard library. -* The BerkeleyDB module now has a C API object, available as +* The BerkeleyDB module now has a C API object, available as ``bsddb.db.api``. This object can be used by other C extensions that wish to use the :mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby; :issue:`1551895`.) -* The new buffer interface, previously described in +* The new buffer interface, previously described in `the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__, adds :cfunc:`PyObject_GetBuffer` and :cfunc:`PyObject_ReleaseBuffer`, as well as a few other functions. * Python's use of the C stdio library is now thread-safe, or at least as thread-safe as the underlying library is. A long-standing potential - bug occurred if one thread closed a file object while another thread - was reading from or writing to the object. In 2.6 file objects - have a reference count, manipulated by the + bug occurred if one thread closed a file object while another thread + was reading from or writing to the object. In 2.6 file objects + have a reference count, manipulated by the :cfunc:`PyFile_IncUseCount` and :cfunc:`PyFile_DecUseCount` - functions. File objects can't be closed unless the reference count - is zero. :cfunc:`PyFile_IncUseCount` should be called while the GIL - is still held, before carrying out an I/O operation using the + functions. File objects can't be closed unless the reference count + is zero. :cfunc:`PyFile_IncUseCount` should be called while the GIL + is still held, before carrying out an I/O operation using the ``FILE *`` pointer, and :cfunc:`PyFile_DecUseCount` should be called immediately after the GIL is re-acquired. (Contributed by Antoine Pitrou and Gregory P. Smith.) @@ -2383,11 +2414,11 @@ thread, the :exc:`ImportError` is raised. (Contributed by Christian Heimes.) -* Several functions return information about the platform's +* Several functions return information about the platform's floating-point support. :cfunc:`PyFloat_GetMax` returns the maximum representable floating point value, - and :cfunc:`PyFloat_GetMin` returns the minimum - positive value. :cfunc:`PyFloat_GetInfo` returns a dictionary + and :cfunc:`PyFloat_GetMin` returns the minimum + positive value. :cfunc:`PyFloat_GetInfo` returns a dictionary containing more information from the :file:`float.h` file, such as ``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"`` (smallest difference between 1.0 and the next largest value @@ -2399,23 +2430,23 @@ and ``PyOS_strnicmp(char*, char*, Py_ssize_t)``. (Contributed by Christian Heimes; :issue:`1635`.) -* Many C extensions define their own little macro for adding - integers and strings to the module's dictionary in the - ``init*`` function. Python 2.6 finally defines standard macros +* Many C extensions define their own little macro for adding + integers and strings to the module's dictionary in the + ``init*`` function. Python 2.6 finally defines standard macros for adding values to a module, :cmacro:`PyModule_AddStringMacro` - and :cmacro:`PyModule_AddIntMacro()`. (Contributed by + and :cmacro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.) * Some macros were renamed in both 3.0 and 2.6 to make it clearer that they are macros, not functions. :cmacro:`Py_Size()` became :cmacro:`Py_SIZE()`, :cmacro:`Py_Type()` became :cmacro:`Py_TYPE()`, and - :cmacro:`Py_Refcnt()` became :cmacro:`Py_REFCNT()`. + :cmacro:`Py_Refcnt()` became :cmacro:`Py_REFCNT()`. The mixed-case macros are still available in Python 2.6 for backward compatibility. (:issue:`1629`) -* Distutils now places C extensions it builds in a +* Distutils now places C extensions it builds in a different directory when running on a debug version of Python. (Contributed by Collin Winter; :issue:`1530959`.) @@ -2427,7 +2458,7 @@ always defined. * A new Makefile target, "make check", prepares the Python source tree - for making a patch: it fixes trailing whitespace in all modified + for making a patch: it fixes trailing whitespace in all modified ``.py`` files, checks whether the documentation has been changed, and reports whether the :file:`Misc/ACKS` and :file:`Misc/NEWS` files have been updated. @@ -2449,35 +2480,35 @@ * The support for Windows 95, 98, ME and NT4 has been dropped. Python 2.6 requires at least Windows 2000 SP4. -* The :mod:`msvcrt` module now supports +* The :mod:`msvcrt` module now supports both the normal and wide char variants of the console I/O - API. The :func:`getwch` function reads a keypress and returns a Unicode + API. The :func:`getwch` function reads a keypress and returns a Unicode value, as does the :func:`getwche` function. The :func:`putwch` function takes a Unicode character and writes it to the console. (Contributed by Christian Heimes.) -* :func:`os.path.expandvars` will now expand environment variables - in the form "%var%", and "~user" will be expanded into the +* :func:`os.path.expandvars` will now expand environment variables + in the form "%var%", and "~user" will be expanded into the user's home directory path. (Contributed by Josiah Carlson.) -* The :mod:`socket` module's socket objects now have an - :meth:`ioctl` method that provides a limited interface to the +* The :mod:`socket` module's socket objects now have an + :meth:`ioctl` method that provides a limited interface to the :cfunc:`WSAIoctl` system interface. -* The :mod:`_winreg` module now has a function, - :func:`ExpandEnvironmentStrings`, +* The :mod:`_winreg` module now has a function, + :func:`ExpandEnvironmentStrings`, that expands environment variable references such as ``%NAME%`` in an input string. The handle objects provided by this - module now support the context protocol, so they can be used + module now support the context protocol, so they can be used in :keyword:`with` statements. (Contributed by Christian Heimes.) - :mod:`_winreg` also has better support for x64 systems, + :mod:`_winreg` also has better support for x64 systems, exposing the :func:`DisableReflectionKey`, :func:`EnableReflectionKey`, and :func:`QueryReflectionKey` functions, which enable and disable registry reflection for 32-bit processes running on 64-bit systems. (:issue:`1753245`) -* The new default compiler on Windows is Visual Studio 2008 (VS 9.0). The +* The new default compiler on Windows is Visual Studio 2008 (VS 9.0). The build directories for Visual Studio 2003 (VS7.1) and 2005 (VS8.0) were moved into the PC/ directory. The new PCbuild directory supports cross compilation for X64, debug builds and Profile Guided Optimization @@ -2500,7 +2531,7 @@ Some of the more notable changes are: -* It's now possible to prevent Python from writing any :file:`.pyc` +* It's now possible to prevent Python from writing any :file:`.pyc` or :file:`.pyo` files by either supplying the :option:`-B` switch or setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable to any non-empty string when running the Python interpreter. These @@ -2521,23 +2552,23 @@ * The :meth:`__init__` method of :class:`collections.deque` now clears any existing contents of the deque before adding elements from the iterable. This change makes the - behavior match that of ``list.__init__()``. + behavior match that of ``list.__init__()``. -* The :class:`Decimal` constructor now accepts leading and trailing +* The :class:`Decimal` constructor now accepts leading and trailing whitespace when passed a string. Previously it would raise an :exc:`InvalidOperation` exception. On the other hand, the :meth:`create_decimal` method of :class:`Context` objects now - explicitly disallows extra whitespace, raising a + explicitly disallows extra whitespace, raising a :exc:`ConversionSyntax` exception. -* Due to an implementation accident, if you passed a file path to +* Due to an implementation accident, if you passed a file path to the built-in :func:`__import__` function, it would actually import - the specified file. This was never intended to work, however, and - the implementation now explicitly checks for this case and raises + the specified file. This was never intended to work, however, and + the implementation now explicitly checks for this case and raises an :exc:`ImportError`. * C API: the :cfunc:`PyImport_Import` and :cfunc:`PyImport_ImportModule` - functions now default to absolute imports, not relative imports. + functions now default to absolute imports, not relative imports. This will affect C extensions that import other modules. * The :mod:`socket` module exception :exc:`socket.error` now inherits @@ -2546,21 +2577,21 @@ (Implemented by Gregory P. Smith; :issue:`1706815`.) * The :mod:`xmlrpclib` module no longer automatically converts - :class:`datetime.date` and :class:`datetime.time` to the + :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`time` instances. (:issue:`1330538`) -* (3.0-warning mode) The :class:`Exception` class now warns - when accessed using slicing or index access; having +* (3.0-warning mode) The :class:`Exception` class now warns + when accessed using slicing or index access; having :class:`Exception` behave like a tuple is being phased out. * (3.0-warning mode) inequality comparisons between two dictionaries or two objects that don't implement comparison methods are reported as warnings. ``dict1 == dict2`` still works, but ``dict1 < dict2`` is being phased out. - + Comparisons between cells, which are an implementation detail of Python's scoping rules, also cause warnings because such comparisons are forbidden entirely in 3.0. @@ -2574,6 +2605,6 @@ ================ The author would like to thank the following people for offering suggestions, -corrections and assistance with various drafts of this article: +corrections and assistance with various drafts of this article: Georg Brandl, Jim Jewett. Modified: python/branches/okkoto-sizeof/Include/Python.h ============================================================================== --- python/branches/okkoto-sizeof/Include/Python.h (original) +++ python/branches/okkoto-sizeof/Include/Python.h Wed Jun 4 11:24:23 2008 @@ -94,6 +94,7 @@ /* #include "memoryobject.h" */ #include "bufferobject.h" #include "bytesobject.h" +#include "bytearrayobject.h" #include "tupleobject.h" #include "listobject.h" #include "dictobject.h" Modified: python/branches/okkoto-sizeof/Include/fileobject.h ============================================================================== --- python/branches/okkoto-sizeof/Include/fileobject.h (original) +++ python/branches/okkoto-sizeof/Include/fileobject.h Wed Jun 4 11:24:23 2008 @@ -24,6 +24,7 @@ int f_newlinetypes; /* Types of newlines seen */ int f_skipnextlf; /* Skip next \n */ PyObject *f_encoding; + PyObject *f_errors; PyObject *weakreflist; /* List of weak references */ int unlocked_count; /* Num. currently running sections of code using f_fp with the GIL released. */ @@ -37,6 +38,7 @@ PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); +PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); Modified: python/branches/okkoto-sizeof/Include/floatobject.h ============================================================================== --- python/branches/okkoto-sizeof/Include/floatobject.h (original) +++ python/branches/okkoto-sizeof/Include/floatobject.h Wed Jun 4 11:24:23 2008 @@ -115,6 +115,12 @@ /* free list api */ PyAPI_FUNC(void) PyFloat_CompactFreeList(size_t *, size_t *, size_t *); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Deleted: python/branches/okkoto-sizeof/Include/formatter_string.h ============================================================================== --- python/branches/okkoto-sizeof/Include/formatter_string.h Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,12 +0,0 @@ -PyObject * -string__format__(PyObject *self, PyObject *args); - -PyObject * -string_long__format__(PyObject *self, PyObject *args); - -PyObject * -string_int__format__(PyObject *self, PyObject *args); - -PyObject * -string_float__format__(PyObject *self, PyObject *args); - Deleted: python/branches/okkoto-sizeof/Include/formatter_unicode.h ============================================================================== --- python/branches/okkoto-sizeof/Include/formatter_unicode.h Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,12 +0,0 @@ -PyObject * -unicode__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_long__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_int__format__(PyObject *self, PyObject *args); - -PyObject * -unicode_float__format__(PyObject *self, PyObject *args); - Modified: python/branches/okkoto-sizeof/Include/intobject.h ============================================================================== --- python/branches/okkoto-sizeof/Include/intobject.h (original) +++ python/branches/okkoto-sizeof/Include/intobject.h Wed Jun 4 11:24:23 2008 @@ -68,6 +68,12 @@ a leading "0" */ PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Modified: python/branches/okkoto-sizeof/Include/longobject.h ============================================================================== --- python/branches/okkoto-sizeof/Include/longobject.h (original) +++ python/branches/okkoto-sizeof/Include/longobject.h Wed Jun 4 11:24:23 2008 @@ -119,6 +119,12 @@ a leading "0", instead of the prefix "0o" */ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + #ifdef __cplusplus } #endif Modified: python/branches/okkoto-sizeof/Include/object.h ============================================================================== --- python/branches/okkoto-sizeof/Include/object.h (original) +++ python/branches/okkoto-sizeof/Include/object.h Wed Jun 4 11:24:23 2008 @@ -460,6 +460,7 @@ PyObject *, PyObject *); PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); PyAPI_FUNC(unsigned int) PyType_ClearCache(void); +PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); /* Generic operations on objects */ PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); @@ -514,7 +515,7 @@ PyAPI_FUNC(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) +#define PyObject_REPR(obj) PyBytes_AS_STRING(PyObject_Repr(obj)) /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ @@ -608,7 +609,7 @@ #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) -#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) +#define Py_TPFLAGS_BYTES_SUBCLASS (1L<<27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) Modified: python/branches/okkoto-sizeof/Include/py_curses.h ============================================================================== --- python/branches/okkoto-sizeof/Include/py_curses.h (original) +++ python/branches/okkoto-sizeof/Include/py_curses.h Wed Jun 4 11:24:23 2008 @@ -146,7 +146,7 @@ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ - return PyString_FromString(X()); } + return PyBytes_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ Modified: python/branches/okkoto-sizeof/Include/pyerrors.h ============================================================================== --- python/branches/okkoto-sizeof/Include/pyerrors.h (original) +++ python/branches/okkoto-sizeof/Include/pyerrors.h Wed Jun 4 11:24:23 2008 @@ -104,7 +104,7 @@ #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ - ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ + ? PyBytes_AS_STRING(((PyClassObject*)(x))->cl_name) \ : (char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) \ Modified: python/branches/okkoto-sizeof/Include/pyport.h ============================================================================== --- python/branches/okkoto-sizeof/Include/pyport.h (original) +++ python/branches/okkoto-sizeof/Include/pyport.h Wed Jun 4 11:24:23 2008 @@ -135,9 +135,9 @@ * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * - * PyString_FromFormat + * PyBytes_FromFormat * PyErr_Format - * PyString_FromFormatV + * PyBytes_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for @@ -454,6 +454,13 @@ extern char * _getpty(int *, int, mode_t, int); #endif +/* On QNX 6, struct termio must be declared by including sys/termio.h + if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must + be included before termios.h or it will generate an error. */ +#ifdef HAVE_SYS_TERMIO_H +#include +#endif + #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) #if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) /* BSDI does not supply a prototype for the 'openpty' and 'forkpty' Modified: python/branches/okkoto-sizeof/Include/pythonrun.h ============================================================================== --- python/branches/okkoto-sizeof/Include/pythonrun.h (original) +++ python/branches/okkoto-sizeof/Include/pythonrun.h Wed Jun 4 11:24:23 2008 @@ -124,7 +124,7 @@ PyAPI_FUNC(int) _PyFrame_Init(void); PyAPI_FUNC(int) _PyInt_Init(void); PyAPI_FUNC(void) _PyFloat_Init(void); -PyAPI_FUNC(int) PyBytes_Init(void); +PyAPI_FUNC(int) PyByteArray_Init(void); /* Various internal finalizers */ PyAPI_FUNC(void) _PyExc_Fini(void); @@ -136,11 +136,11 @@ PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); -PyAPI_FUNC(void) PyString_Fini(void); +PyAPI_FUNC(void) PyBytes_Fini(void); PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); -PyAPI_FUNC(void) PyBytes_Fini(void); +PyAPI_FUNC(void) PyByteArray_Fini(void); /* Stuff with no proper home (yet) */ PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); Modified: python/branches/okkoto-sizeof/Include/unicodeobject.h ============================================================================== --- python/branches/okkoto-sizeof/Include/unicodeobject.h (original) +++ python/branches/okkoto-sizeof/Include/unicodeobject.h Wed Jun 4 11:24:23 2008 @@ -553,6 +553,12 @@ PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, + Py_UNICODE *format_spec, + Py_ssize_t format_spec_len); + /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H Modified: python/branches/okkoto-sizeof/Include/warnings.h ============================================================================== --- python/branches/okkoto-sizeof/Include/warnings.h (original) +++ python/branches/okkoto-sizeof/Include/warnings.h Wed Jun 4 11:24:23 2008 @@ -9,7 +9,9 @@ PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, const char *, PyObject *); -PyAPI_FUNC(int) PyErr_WarnPy3k(const char *, Py_ssize_t); + +#define PyErr_WarnPy3k(msg, stacklevel) \ + (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) /* DEPRECATED: Use PyErr_WarnEx() instead. */ #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) Modified: python/branches/okkoto-sizeof/Lib/BaseHTTPServer.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/BaseHTTPServer.py (original) +++ python/branches/okkoto-sizeof/Lib/BaseHTTPServer.py Wed Jun 4 11:24:23 2008 @@ -74,7 +74,7 @@ import time import socket # For gethostbyaddr() import mimetools -import socketserver +import SocketServer # Default error message template DEFAULT_ERROR_MESSAGE = """\ @@ -94,19 +94,19 @@ def _quote_html(html): return html.replace("&", "&").replace("<", "<").replace(">", ">") -class HTTPServer(socketserver.TCPServer): +class HTTPServer(SocketServer.TCPServer): allow_reuse_address = 1 # Seems to make sense in testing environment def server_bind(self): """Override server_bind to store the server name.""" - socketserver.TCPServer.server_bind(self) + SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname()[:2] self.server_name = socket.getfqdn(host) self.server_port = port -class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): +class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): """HTTP request handler base class. @@ -218,6 +218,12 @@ # where each string is of the form name[/version]. server_version = "BaseHTTP/" + __version__ + # The default request version. This only affects responses up until + # the point where the request line is parsed, so it mainly decides what + # the client gets back when sending a malformed request line. + # Most web servers default to HTTP 0.9, i.e. don't send a status line. + default_request_version = "HTTP/0.9" + def parse_request(self): """Parse a request (internal). @@ -230,7 +236,7 @@ """ self.command = None # set in case of error on the first line - self.request_version = version = "HTTP/0.9" # Default + self.request_version = version = self.default_request_version self.close_connection = 1 requestline = self.raw_requestline if requestline[-2:] == '\r\n': Modified: python/branches/okkoto-sizeof/Lib/SimpleXMLRPCServer.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/SimpleXMLRPCServer.py (original) +++ python/branches/okkoto-sizeof/Lib/SimpleXMLRPCServer.py Wed Jun 4 11:24:23 2008 @@ -101,7 +101,7 @@ import xmlrpclib from xmlrpclib import Fault -import socketserver +import SocketServer import BaseHTTPServer import sys import os @@ -512,7 +512,7 @@ if self.server.logRequests: BaseHTTPServer.BaseHTTPRequestHandler.log_request(self, code, size) -class SimpleXMLRPCServer(socketserver.TCPServer, +class SimpleXMLRPCServer(SocketServer.TCPServer, SimpleXMLRPCDispatcher): """Simple XML-RPC server. @@ -536,7 +536,7 @@ self.logRequests = logRequests SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) - socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) + SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) # [Bug #1222790] If possible, set close-on-exec flag; if a # method spawns a subprocess, the subprocess shouldn't have Modified: python/branches/okkoto-sizeof/Lib/UserString.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/UserString.py (original) +++ python/branches/okkoto-sizeof/Lib/UserString.py Wed Jun 4 11:24:23 2008 @@ -146,6 +146,9 @@ A faster and better solution is to rewrite your program using lists.""" def __init__(self, string=""): + from warnings import warnpy3k + warnpy3k('the class UserString.MutableString has been removed in ' + 'Python 3.0', stacklevel=2) self.data = string def __hash__(self): raise TypeError, "unhashable type (it is mutable)" Modified: python/branches/okkoto-sizeof/Lib/bdb.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bdb.py (original) +++ python/branches/okkoto-sizeof/Lib/bdb.py Wed Jun 4 11:24:23 2008 @@ -325,7 +325,7 @@ # def format_stack_entry(self, frame_lineno, lprefix=': '): - import linecache, reprlib + import linecache, repr frame, lineno = frame_lineno filename = self.canonic(frame.f_code.co_filename) s = '%s(%r)' % (filename, lineno) @@ -338,13 +338,13 @@ else: args = None if args: - s = s + reprlib.repr(args) + s = s + repr.repr(args) else: s = s + '()' if '__return__' in frame.f_locals: rv = frame.f_locals['__return__'] s = s + '->' - s = s + reprlib.repr(rv) + s = s + repr.repr(rv) line = linecache.getline(filename, lineno) if line: s = s + lprefix + line.strip() return s Modified: python/branches/okkoto-sizeof/Lib/bsddb/__init__.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/__init__.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/__init__.py Wed Jun 4 11:24:23 2008 @@ -33,7 +33,7 @@ #---------------------------------------------------------------------- -"""Support for Berkeley DB 3.3 through 4.6 with a simple interface. +"""Support for Berkeley DB 4.x with a simple interface. For the full featured object oriented interface use the bsddb.db module instead. It mirrors the Oracle Berkeley DB C API. @@ -66,13 +66,8 @@ import sys, os -# for backwards compatibility with python versions older than 2.3, the -# iterator interface is dynamically defined and added using a mixin -# class. old python can't tokenize it due to the yield keyword. -if sys.version >= '2.3': - import UserDict - from weakref import ref - exec """ +import UserDict +from weakref import ref class _iter_mixin(UserDict.DictMixin): def _make_iter_cursor(self): cur = _DeadlockWrap(self.db.cursor) @@ -87,67 +82,80 @@ return lambda ref: self._cursor_refs.pop(key, None) def __iter__(self): + self._kill_iteration = False + self._in_iter += 1 try: - cur = self._make_iter_cursor() + try: + cur = self._make_iter_cursor() - # FIXME-20031102-greg: race condition. cursor could - # be closed by another thread before this call. + # FIXME-20031102-greg: race condition. cursor could + # be closed by another thread before this call. - # since we're only returning keys, we call the cursor - # methods with flags=0, dlen=0, dofs=0 - key = _DeadlockWrap(cur.first, 0,0,0)[0] - yield key - - next = cur.next - while 1: - try: - key = _DeadlockWrap(next, 0,0,0)[0] - yield key - except _bsddb.DBCursorClosedError: - cur = self._make_iter_cursor() - # FIXME-20031101-greg: race condition. cursor could - # be closed by another thread before this call. - _DeadlockWrap(cur.set, key,0,0,0) - next = cur.next - except _bsddb.DBNotFoundError: - return - except _bsddb.DBCursorClosedError: - # the database was modified during iteration. abort. - return + # since we're only returning keys, we call the cursor + # methods with flags=0, dlen=0, dofs=0 + key = _DeadlockWrap(cur.first, 0,0,0)[0] + yield key + + next = cur.next + while 1: + try: + key = _DeadlockWrap(next, 0,0,0)[0] + yield key + except _bsddb.DBCursorClosedError: + if self._kill_iteration: + raise RuntimeError('Database changed size ' + 'during iteration.') + cur = self._make_iter_cursor() + # FIXME-20031101-greg: race condition. cursor could + # be closed by another thread before this call. + _DeadlockWrap(cur.set, key,0,0,0) + next = cur.next + except _bsddb.DBNotFoundError: + pass + except _bsddb.DBCursorClosedError: + # the database was modified during iteration. abort. + pass + finally: + self._in_iter -= 1 def iteritems(self): if not self.db: return + self._kill_iteration = False + self._in_iter += 1 try: - cur = self._make_iter_cursor() - - # FIXME-20031102-greg: race condition. cursor could - # be closed by another thread before this call. + try: + cur = self._make_iter_cursor() - kv = _DeadlockWrap(cur.first) - key = kv[0] - yield kv + # FIXME-20031102-greg: race condition. cursor could + # be closed by another thread before this call. - next = cur.next - while 1: - try: - kv = _DeadlockWrap(next) - key = kv[0] - yield kv - except _bsddb.DBCursorClosedError: - cur = self._make_iter_cursor() - # FIXME-20031101-greg: race condition. cursor could - # be closed by another thread before this call. - _DeadlockWrap(cur.set, key,0,0,0) - next = cur.next - except _bsddb.DBNotFoundError: - return - except _bsddb.DBCursorClosedError: - # the database was modified during iteration. abort. - return -""" -else: - class _iter_mixin: pass + kv = _DeadlockWrap(cur.first) + key = kv[0] + yield kv + + next = cur.next + while 1: + try: + kv = _DeadlockWrap(next) + key = kv[0] + yield kv + except _bsddb.DBCursorClosedError: + if self._kill_iteration: + raise RuntimeError('Database changed size ' + 'during iteration.') + cur = self._make_iter_cursor() + # FIXME-20031101-greg: race condition. cursor could + # be closed by another thread before this call. + _DeadlockWrap(cur.set, key,0,0,0) + next = cur.next + except _bsddb.DBNotFoundError: + pass + except _bsddb.DBCursorClosedError: + # the database was modified during iteration. abort. + pass + finally: + self._in_iter -= 1 class _DBWithCursor(_iter_mixin): @@ -176,6 +184,8 @@ # a collection of all DBCursor objects currently allocated # by the _iter_mixin interface. self._cursor_refs = {} + self._in_iter = 0 + self._kill_iteration = False def __del__(self): self.close() @@ -225,6 +235,8 @@ def __setitem__(self, key, value): self._checkOpen() self._closeCursors() + if self._in_iter and key not in self: + self._kill_iteration = True def wrapF(): self.db[key] = value _DeadlockWrap(wrapF) # self.db[key] = value @@ -232,6 +244,8 @@ def __delitem__(self, key): self._checkOpen() self._closeCursors() + if self._in_iter and key in self: + self._kill_iteration = True def wrapF(): del self.db[key] _DeadlockWrap(wrapF) # del self.db[key] Modified: python/branches/okkoto-sizeof/Lib/bsddb/db.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/db.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/db.py Wed Jun 4 11:24:23 2008 @@ -48,4 +48,4 @@ from _bsddb import __version__ if version() < (3, 2, 0): - raise ImportError, "correct BerkeleyDB symbols not found. Perhaps python was statically linked with an older version?" + raise ImportError, "correct Berkeley DB symbols not found. Perhaps python was statically linked with an older version?" Modified: python/branches/okkoto-sizeof/Lib/bsddb/dbtables.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/dbtables.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/dbtables.py Wed Jun 4 11:24:23 2008 @@ -13,7 +13,7 @@ # -- Gregory P. Smith # This provides a simple database table interface built on top of -# the Python BerkeleyDB 3 interface. +# the Python Berkeley DB 3 interface. # _cvsid = '$Id$' @@ -139,7 +139,7 @@ recover=0, dbflags=0): """bsdTableDB(filename, dbhome, create=0, truncate=0, mode=0600) - Open database name in the dbhome BerkeleyDB directory. + Open database name in the dbhome Berkeley DB directory. Use keyword arguments when calling this constructor. """ self.db = None Modified: python/branches/okkoto-sizeof/Lib/bsddb/test/test_all.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/test/test_all.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/test/test_all.py Wed Jun 4 11:24:23 2008 @@ -67,9 +67,20 @@ return path -get_new_path.prefix="/tmp/z-Berkeley_DB" +# This path can be overriden via "set_test_path_prefix()". +import os, os.path +get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB") get_new_path.num=0 +def get_test_path_prefix() : + return get_new_path.prefix + +def set_test_path_prefix(path) : + get_new_path.prefix=path + +def remove_test_path_directory() : + test_support.rmtree(get_new_path.prefix) + try : import threading get_new_path.mutex=threading.Lock() @@ -97,24 +108,18 @@ test_all.verbose = verbose -def suite(): - try: - # this is special, it used to segfault the interpreter - import test_1413192 - except: - pass - +def suite(module_prefix='', timing_check=None): test_modules = [ 'test_associate', 'test_basics', - 'test_compat', 'test_compare', + 'test_compat', + 'test_cursor_pget_bug', 'test_dbobj', 'test_dbshelve', 'test_dbtables', - 'test_early_close', 'test_distributed_transactions', - 'test_replication', + 'test_early_close', 'test_get_none', 'test_join', 'test_lock', @@ -122,15 +127,21 @@ 'test_pickle', 'test_queue', 'test_recno', - 'test_thread', + 'test_replication', 'test_sequence', - 'test_cursor_pget_bug', + 'test_thread', ] alltests = unittest.TestSuite() for name in test_modules: - module = __import__(name) + #module = __import__(name) + # Do it this way so that suite may be called externally via + # python's Lib/test/test_bsddb3. + module = __import__(module_prefix+name, globals(), locals(), name) + alltests.addTest(module.test_suite()) + if timing_check: + alltests.addTest(unittest.makeSuite(timing_check)) return alltests Modified: python/branches/okkoto-sizeof/Lib/bsddb/test/test_lock.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/test/test_lock.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/test/test_lock.py Wed Jun 4 11:24:23 2008 @@ -97,11 +97,7 @@ for t in threads: t.join() - def _DISABLED_test03_lock_timeout(self): - # Disabled as this test crashes the python interpreter built in - # debug mode with: - # Fatal Python error: UNREF invalid object - # the error occurs as marked below. + def test03_lock_timeout(self): self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT) self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT) self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT) @@ -128,8 +124,6 @@ self.assertNotEqual(anID, anID2) lock = self.env.lock_get(anID, "shared lock", db.DB_LOCK_WRITE) start_time=time.time() - # FIXME: I see the UNREF crash as the interpreter trys to exit - # from this call to lock_get. self.assertRaises(db.DBLockNotGrantedError, self.env.lock_get,anID2, "shared lock", db.DB_LOCK_READ) end_time=time.time() Modified: python/branches/okkoto-sizeof/Lib/bsddb/test/test_replication.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/bsddb/test/test_replication.py (original) +++ python/branches/okkoto-sizeof/Lib/bsddb/test/test_replication.py Wed Jun 4 11:24:23 2008 @@ -2,6 +2,7 @@ """ import os +import time import unittest try: @@ -57,10 +58,12 @@ self.dbenvMaster.set_event_notify(confirmed_master) self.dbenvClient.set_event_notify(client_startupdone) - self.dbenvMaster.repmgr_set_local_site("127.0.0.1",46117) - self.dbenvClient.repmgr_set_local_site("127.0.0.1",46118) - self.dbenvMaster.repmgr_add_remote_site("127.0.0.1",46118) - self.dbenvClient.repmgr_add_remote_site("127.0.0.1",46117) + master_port = test_support.find_unused_port() + self.dbenvMaster.repmgr_set_local_site("127.0.0.1", master_port) + client_port = test_support.find_unused_port() + self.dbenvClient.repmgr_set_local_site("127.0.0.1", client_port) + self.dbenvMaster.repmgr_add_remote_site("127.0.0.1", client_port) + self.dbenvClient.repmgr_add_remote_site("127.0.0.1", master_port) self.dbenvMaster.rep_set_nsites(2) self.dbenvClient.rep_set_nsites(2) self.dbenvMaster.rep_set_priority(10) @@ -91,10 +94,9 @@ # The timeout is necessary in BDB 4.5, since DB_EVENT_REP_STARTUPDONE # is not generated if the master has no new transactions. # This is solved in BDB 4.6 (#15542). - import time timeout = time.time()+2 while (time.time()= (4,6) : self.assertTrue(time.time()' is used). - - get(section, option, raw=False, vars=None) - return a string value for the named option. All % interpolations are - expanded in the return values, based on the defaults passed into the - constructor and the DEFAULT section. Additional substitutions may be - provided using the `vars' argument, which must be a dictionary whose - contents override any pre-existing defaults. - - getint(section, options) - like get(), but convert value to an integer - - getfloat(section, options) - like get(), but convert value to a float - - getboolean(section, options) - like get(), but convert value to a boolean (currently case - insensitively defined as 0, false, no, off for False, and 1, true, - yes, on for True). Returns False or True. - - items(section, raw=False, vars=None) - return a list of tuples with (name, value) for each option - in the section. - - remove_section(section) - remove the given file section and all its options - - remove_option(section, option) - remove the given option from the given section - - set(section, option, value) - set the given option - - write(fp) - write the configuration state in .ini format -""" - -import re - -__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError", - "InterpolationError", "InterpolationDepthError", - "InterpolationSyntaxError", "ParsingError", - "MissingSectionHeaderError", - "ConfigParser", "SafeConfigParser", "RawConfigParser", - "DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"] - -DEFAULTSECT = "DEFAULT" - -MAX_INTERPOLATION_DEPTH = 10 - - - -# exception classes -class Error(Exception): - """Base class for ConfigParser exceptions.""" - - def _get_message(self): - """Getter for 'message'; needed only to override deprecation in - BaseException.""" - return self.__message - - def _set_message(self, value): - """Setter for 'message'; needed only to override deprecation in - BaseException.""" - self.__message = value - - # BaseException.message has been deprecated since Python 2.6. To prevent - # DeprecationWarning from popping up over this pre-existing attribute, use - # a new property that takes lookup precedence. - message = property(_get_message, _set_message) - - def __init__(self, msg=''): - self.message = msg - Exception.__init__(self, msg) - - def __repr__(self): - return self.message - - __str__ = __repr__ - -class NoSectionError(Error): - """Raised when no section matches a requested option.""" - - def __init__(self, section): - Error.__init__(self, 'No section: %r' % (section,)) - self.section = section - -class DuplicateSectionError(Error): - """Raised when a section is multiply-created.""" - - def __init__(self, section): - Error.__init__(self, "Section %r already exists" % section) - self.section = section - -class NoOptionError(Error): - """A requested option was not found.""" - - def __init__(self, option, section): - Error.__init__(self, "No option %r in section: %r" % - (option, section)) - self.option = option - self.section = section - -class InterpolationError(Error): - """Base class for interpolation-related exceptions.""" - - def __init__(self, option, section, msg): - Error.__init__(self, msg) - self.option = option - self.section = section - -class InterpolationMissingOptionError(InterpolationError): - """A string substitution required a setting which was not available.""" - - def __init__(self, option, section, rawval, reference): - msg = ("Bad value substitution:\n" - "\tsection: [%s]\n" - "\toption : %s\n" - "\tkey : %s\n" - "\trawval : %s\n" - % (section, option, reference, rawval)) - InterpolationError.__init__(self, option, section, msg) - self.reference = reference - -class InterpolationSyntaxError(InterpolationError): - """Raised when the source text into which substitutions are made - does not conform to the required syntax.""" - -class InterpolationDepthError(InterpolationError): - """Raised when substitutions are nested too deeply.""" - - def __init__(self, option, section, rawval): - msg = ("Value interpolation too deeply recursive:\n" - "\tsection: [%s]\n" - "\toption : %s\n" - "\trawval : %s\n" - % (section, option, rawval)) - InterpolationError.__init__(self, option, section, msg) - -class ParsingError(Error): - """Raised when a configuration file does not follow legal syntax.""" - - def __init__(self, filename): - Error.__init__(self, 'File contains parsing errors: %s' % filename) - self.filename = filename - self.errors = [] - - def append(self, lineno, line): - self.errors.append((lineno, line)) - self.message += '\n\t[line %2d]: %s' % (lineno, line) - -class MissingSectionHeaderError(ParsingError): - """Raised when a key-value pair is found before any section header.""" - - def __init__(self, filename, lineno, line): - Error.__init__( - self, - 'File contains no section headers.\nfile: %s, line: %d\n%r' % - (filename, lineno, line)) - self.filename = filename - self.lineno = lineno - self.line = line - - -class RawConfigParser: - def __init__(self, defaults=None, dict_type=dict): - self._dict = dict_type - self._sections = self._dict() - self._defaults = self._dict() - if defaults: - for key, value in defaults.items(): - self._defaults[self.optionxform(key)] = value - - def defaults(self): - return self._defaults - - def sections(self): - """Return a list of section names, excluding [DEFAULT]""" - # self._sections will never have [DEFAULT] in it - return self._sections.keys() - - def add_section(self, section): - """Create a new section in the configuration. - - Raise DuplicateSectionError if a section by the specified name - already exists. Raise ValueError if name is DEFAULT or any of it's - case-insensitive variants. - """ - if section.lower() == "default": - raise ValueError, 'Invalid section name: %s' % section - - if section in self._sections: - raise DuplicateSectionError(section) - self._sections[section] = self._dict() - - def has_section(self, section): - """Indicate whether the named section is present in the configuration. - - The DEFAULT section is not acknowledged. - """ - return section in self._sections - - def options(self, section): - """Return a list of option names for the given section name.""" - try: - opts = self._sections[section].copy() - except KeyError: - raise NoSectionError(section) - opts.update(self._defaults) - if '__name__' in opts: - del opts['__name__'] - return opts.keys() - - def read(self, filenames): - """Read and parse a filename or a list of filenames. - - Files that cannot be opened are silently ignored; this is - designed so that you can specify a list of potential - configuration file locations (e.g. current directory, user's - home directory, systemwide directory), and all existing - configuration files in the list will be read. A single - filename may also be given. - - Return list of successfully read files. - """ - if isinstance(filenames, basestring): - filenames = [filenames] - read_ok = [] - for filename in filenames: - try: - fp = open(filename) - except IOError: - continue - self._read(fp, filename) - fp.close() - read_ok.append(filename) - return read_ok - - def readfp(self, fp, filename=None): - """Like read() but the argument must be a file-like object. - - The `fp' argument must have a `readline' method. Optional - second argument is the `filename', which if not given, is - taken from fp.name. If fp has no `name' attribute, `' is - used. - - """ - if filename is None: - try: - filename = fp.name - except AttributeError: - filename = '' - self._read(fp, filename) - - def get(self, section, option): - opt = self.optionxform(option) - if section not in self._sections: - if section != DEFAULTSECT: - raise NoSectionError(section) - if opt in self._defaults: - return self._defaults[opt] - else: - raise NoOptionError(option, section) - elif opt in self._sections[section]: - return self._sections[section][opt] - elif opt in self._defaults: - return self._defaults[opt] - else: - raise NoOptionError(option, section) - - def items(self, section): - try: - d2 = self._sections[section] - except KeyError: - if section != DEFAULTSECT: - raise NoSectionError(section) - d2 = self._dict() - d = self._defaults.copy() - d.update(d2) - if "__name__" in d: - del d["__name__"] - return d.items() - - def _get(self, section, conv, option): - return conv(self.get(section, option)) - - def getint(self, section, option): - return self._get(section, int, option) - - def getfloat(self, section, option): - return self._get(section, float, option) - - _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, - '0': False, 'no': False, 'false': False, 'off': False} - - def getboolean(self, section, option): - v = self.get(section, option) - if v.lower() not in self._boolean_states: - raise ValueError, 'Not a boolean: %s' % v - return self._boolean_states[v.lower()] - - def optionxform(self, optionstr): - return optionstr.lower() - - def has_option(self, section, option): - """Check for the existence of a given option in a given section.""" - if not section or section == DEFAULTSECT: - option = self.optionxform(option) - return option in self._defaults - elif section not in self._sections: - return False - else: - option = self.optionxform(option) - return (option in self._sections[section] - or option in self._defaults) - - def set(self, section, option, value): - """Set an option.""" - if not section or section == DEFAULTSECT: - sectdict = self._defaults - else: - try: - sectdict = self._sections[section] - except KeyError: - raise NoSectionError(section) - sectdict[self.optionxform(option)] = value - - def write(self, fp): - """Write an .ini-format representation of the configuration state.""" - if self._defaults: - fp.write("[%s]\n" % DEFAULTSECT) - for (key, value) in self._defaults.items(): - fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) - fp.write("\n") - for section in self._sections: - fp.write("[%s]\n" % section) - for (key, value) in self._sections[section].items(): - if key != "__name__": - fp.write("%s = %s\n" % - (key, str(value).replace('\n', '\n\t'))) - fp.write("\n") - - def remove_option(self, section, option): - """Remove an option.""" - if not section or section == DEFAULTSECT: - sectdict = self._defaults - else: - try: - sectdict = self._sections[section] - except KeyError: - raise NoSectionError(section) - option = self.optionxform(option) - existed = option in sectdict - if existed: - del sectdict[option] - return existed - - def remove_section(self, section): - """Remove a file section.""" - existed = section in self._sections - if existed: - del self._sections[section] - return existed - - # - # Regular expressions for parsing section headers and options. - # - SECTCRE = re.compile( - r'\[' # [ - r'(?P
[^]]+)' # very permissive! - r'\]' # ] - ) - OPTCRE = re.compile( - r'(?P

+ + + +\x20\x20\x20\x20 + +
 
+Credits
       Nobody
+""".strip() + + +# output pattern for missing module +missing_pattern = "no Python documentation found for '%s'" + +def run_pydoc(module_name, *args): + """ + Runs pydoc on the specified module. Returns the stripped + output of pydoc. + """ + cmd = [sys.executable, pydoc.__file__, " ".join(args), module_name] + output = subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read() + return output.strip() + +def get_pydoc_html(module): + "Returns pydoc generated output as html" + doc = pydoc.HTMLDoc() + output = doc.docmodule(module) + loc = doc.getdocloc(pydoc_mod) or "" + if loc: + loc = "
Module Docs" + return output.strip(), loc + +def get_pydoc_text(module): + "Returns pydoc generated output as text" + doc = pydoc.TextDoc() + loc = doc.getdocloc(pydoc_mod) or "" + if loc: + loc = "\nMODULE DOCS\n " + loc + "\n" + + output = doc.docmodule(module) + + # cleanup the extra text formatting that pydoc preforms + patt = re.compile('\b.') + output = patt.sub('', output) + return output.strip(), loc + +def print_diffs(text1, text2): + "Prints unified diffs for two texts" + lines1 = text1.splitlines(True) + lines2 = text2.splitlines(True) + diffs = difflib.unified_diff(lines1, lines2, n=0, fromfile='expected', + tofile='got') + print '\n' + ''.join(diffs) + + +class PyDocDocTest(unittest.TestCase): + + def test_html_doc(self): + result, doc_loc = get_pydoc_html(pydoc_mod) + mod_file = inspect.getabsfile(pydoc_mod) + expected_html = expected_html_pattern % (mod_file, mod_file, doc_loc) + if result != expected_html: + print_diffs(expected_html, result) + self.fail("outputs are not equal, see diff above") + + def test_text_doc(self): + result, doc_loc = get_pydoc_text(pydoc_mod) + expected_text = expected_text_pattern % \ + (inspect.getabsfile(pydoc_mod), doc_loc) + if result != expected_text: + print_diffs(expected_text, result) + self.fail("outputs are not equal, see diff above") + + def test_not_here(self): + missing_module = "test.i_am_not_here" + result = run_pydoc(missing_module) + expected = missing_pattern % missing_module + self.assertEqual(expected, result, + "documentation for missing module found") + + +class TestDescriptions(unittest.TestCase): + + def test_module(self): + # Check that pydocfodder module can be described + from test import pydocfodder + doc = pydoc.render_doc(pydocfodder) + self.assert_("pydocfodder" in doc) + + def test_classic_class(self): + class C: "Classic class" + c = C() + self.assertEqual(pydoc.describe(C), 'class C') + self.assertEqual(pydoc.describe(c), 'instance of C') + expected = 'instance of C in module %s' % __name__ + self.assert_(expected in pydoc.render_doc(c)) + + def test_class(self): + class C(object): "New-style class" + c = C() + + self.assertEqual(pydoc.describe(C), 'class C') + self.assertEqual(pydoc.describe(c), 'C') + expected = 'C in module %s object' % __name__ + self.assert_(expected in pydoc.render_doc(c)) + + +def test_main(): + test.test_support.run_unittest(PyDocDocTest, + TestDescriptions) + +if __name__ == "__main__": + test_main() Modified: python/branches/okkoto-sizeof/Lib/test/test_queue.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_queue.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_queue.py Wed Jun 4 11:24:23 2008 @@ -1,6 +1,6 @@ # Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. -import queue +import Queue import sys import threading import time @@ -107,12 +107,12 @@ try: q.put("full", block=0) self.fail("Didn't appear to block with a full queue") - except queue.Full: + except Queue.Full: pass try: q.put("full", timeout=0.01) self.fail("Didn't appear to time-out with a full queue") - except queue.Full: + except Queue.Full: pass # Test a blocking put self.do_blocking_test(q.put, ("full",), q.get, ()) @@ -124,12 +124,12 @@ try: q.get(block=0) self.fail("Didn't appear to block with an empty queue") - except queue.Empty: + except Queue.Empty: pass try: q.get(timeout=0.01) self.fail("Didn't appear to time-out with an empty queue") - except queue.Empty: + except Queue.Empty: pass # Test a blocking get self.do_blocking_test(q.get, (), q.put, ('empty',)) @@ -191,13 +191,13 @@ class QueueTest(BaseQueueTest): - type2test = queue.Queue + type2test = Queue.Queue class LifoQueueTest(BaseQueueTest): - type2test = queue.LifoQueue + type2test = Queue.LifoQueue class PriorityQueueTest(BaseQueueTest): - type2test = queue.PriorityQueue + type2test = Queue.PriorityQueue @@ -205,21 +205,21 @@ class FailingQueueException(Exception): pass -class FailingQueue(queue.Queue): +class FailingQueue(Queue.Queue): def __init__(self, *args): self.fail_next_put = False self.fail_next_get = False - queue.Queue.__init__(self, *args) + Queue.Queue.__init__(self, *args) def _put(self, item): if self.fail_next_put: self.fail_next_put = False raise FailingQueueException, "You Lose" - return queue.Queue._put(self, item) + return Queue.Queue._put(self, item) def _get(self): if self.fail_next_get: self.fail_next_get = False raise FailingQueueException, "You Lose" - return queue.Queue._get(self) + return Queue.Queue._get(self) class FailingQueueTest(unittest.TestCase, BlockingTestMixin): Deleted: python/branches/okkoto-sizeof/Lib/test/test_reprlib.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_reprlib.py Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,327 +0,0 @@ -""" - Test cases for the repr module - Nick Mathewson -""" - -import sys -import os -import shutil -import unittest - -from test.test_support import run_unittest -from reprlib import repr as r # Don't shadow builtin repr -from reprlib import Repr - - -def nestedTuple(nesting): - t = () - for i in range(nesting): - t = (t,) - return t - -class ReprTests(unittest.TestCase): - - def test_string(self): - eq = self.assertEquals - eq(r("abc"), "'abc'") - eq(r("abcdefghijklmnop"),"'abcdefghijklmnop'") - - s = "a"*30+"b"*30 - expected = repr(s)[:13] + "..." + repr(s)[-14:] - eq(r(s), expected) - - eq(r("\"'"), repr("\"'")) - s = "\""*30+"'"*100 - expected = repr(s)[:13] + "..." + repr(s)[-14:] - eq(r(s), expected) - - def test_tuple(self): - eq = self.assertEquals - eq(r((1,)), "(1,)") - - t3 = (1, 2, 3) - eq(r(t3), "(1, 2, 3)") - - r2 = Repr() - r2.maxtuple = 2 - expected = repr(t3)[:-2] + "...)" - eq(r2.repr(t3), expected) - - def test_container(self): - from array import array - from collections import deque - - eq = self.assertEquals - # Tuples give up after 6 elements - eq(r(()), "()") - eq(r((1,)), "(1,)") - eq(r((1, 2, 3)), "(1, 2, 3)") - eq(r((1, 2, 3, 4, 5, 6)), "(1, 2, 3, 4, 5, 6)") - eq(r((1, 2, 3, 4, 5, 6, 7)), "(1, 2, 3, 4, 5, 6, ...)") - - # Lists give up after 6 as well - eq(r([]), "[]") - eq(r([1]), "[1]") - eq(r([1, 2, 3]), "[1, 2, 3]") - eq(r([1, 2, 3, 4, 5, 6]), "[1, 2, 3, 4, 5, 6]") - eq(r([1, 2, 3, 4, 5, 6, 7]), "[1, 2, 3, 4, 5, 6, ...]") - - # Sets give up after 6 as well - eq(r(set([])), "set([])") - eq(r(set([1])), "set([1])") - eq(r(set([1, 2, 3])), "set([1, 2, 3])") - eq(r(set([1, 2, 3, 4, 5, 6])), "set([1, 2, 3, 4, 5, 6])") - eq(r(set([1, 2, 3, 4, 5, 6, 7])), "set([1, 2, 3, 4, 5, 6, ...])") - - # Frozensets give up after 6 as well - eq(r(frozenset([])), "frozenset([])") - eq(r(frozenset([1])), "frozenset([1])") - eq(r(frozenset([1, 2, 3])), "frozenset([1, 2, 3])") - eq(r(frozenset([1, 2, 3, 4, 5, 6])), "frozenset([1, 2, 3, 4, 5, 6])") - eq(r(frozenset([1, 2, 3, 4, 5, 6, 7])), "frozenset([1, 2, 3, 4, 5, 6, ...])") - - # collections.deque after 6 - eq(r(deque([1, 2, 3, 4, 5, 6, 7])), "deque([1, 2, 3, 4, 5, 6, ...])") - - # Dictionaries give up after 4. - eq(r({}), "{}") - d = {'alice': 1, 'bob': 2, 'charles': 3, 'dave': 4} - eq(r(d), "{'alice': 1, 'bob': 2, 'charles': 3, 'dave': 4}") - d['arthur'] = 1 - eq(r(d), "{'alice': 1, 'arthur': 1, 'bob': 2, 'charles': 3, ...}") - - # array.array after 5. - eq(r(array('i')), "array('i', [])") - eq(r(array('i', [1])), "array('i', [1])") - eq(r(array('i', [1, 2])), "array('i', [1, 2])") - eq(r(array('i', [1, 2, 3])), "array('i', [1, 2, 3])") - eq(r(array('i', [1, 2, 3, 4])), "array('i', [1, 2, 3, 4])") - eq(r(array('i', [1, 2, 3, 4, 5])), "array('i', [1, 2, 3, 4, 5])") - eq(r(array('i', [1, 2, 3, 4, 5, 6])), - "array('i', [1, 2, 3, 4, 5, ...])") - - def test_numbers(self): - eq = self.assertEquals - eq(r(123), repr(123)) - eq(r(123L), repr(123L)) - eq(r(1.0/3), repr(1.0/3)) - - n = 10L**100 - expected = repr(n)[:18] + "..." + repr(n)[-19:] - eq(r(n), expected) - - def test_instance(self): - eq = self.assertEquals - i1 = ClassWithRepr("a") - eq(r(i1), repr(i1)) - - i2 = ClassWithRepr("x"*1000) - expected = repr(i2)[:13] + "..." + repr(i2)[-14:] - eq(r(i2), expected) - - i3 = ClassWithFailingRepr() - eq(r(i3), (""%id(i3))) - - s = r(ClassWithFailingRepr) - self.failUnless(s.startswith("")) - self.failUnless(s.find("...") == 8) - - def test_file(self): - fp = open(unittest.__file__) - self.failUnless(repr(fp).startswith( - "') - # Methods - self.failUnless(repr(''.split).startswith( - '") - # XXX member descriptors - # XXX attribute descriptors - # XXX slot descriptors - # static and class methods - class C: - def foo(cls): pass - x = staticmethod(C.foo) - self.failUnless(repr(x).startswith('" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__)) - eq(repr(sys), "") - - def test_type(self): - eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\ -class foo(object): - pass -''') - from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo - eq(repr(foo.foo), - "" % foo.__name__) - - def test_object(self): - # XXX Test the repr of a type with a really long tp_name but with no - # tp_repr. WIBNI we had ::Inline? :) - pass - - def test_class(self): - touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\ -class bar: - pass -''') - from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar - # Module name may be prefixed with "test.", depending on how run. - self.failUnless(repr(bar.bar).startswith( - "') - # Bound method next - iqux = qux.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() - self.failUnless(repr(iqux.amethod).startswith( - ' 100, r[0][2]) ## self.assert_(r[1][2] > 100, r[1][2]) + def test_ioencoding(self): + import subprocess,os + env = dict(os.environ) + + # Test character: cent sign, encoded as 0x4A (ASCII J) in CP424, + # not representable in ASCII. + + env["PYTHONIOENCODING"] = "cp424" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, unichr(0xa2).encode("cp424")) + + env["PYTHONIOENCODING"] = "ascii:replace" + p = subprocess.Popen([sys.executable, "-c", 'print unichr(0xa2)'], + stdout = subprocess.PIPE, env=env) + out = p.stdout.read().strip() + self.assertEqual(out, '?') + class SizeofTest(unittest.TestCase): @@ -400,7 +419,7 @@ def tearDown(self): self.file.close() - os.remove(test.test_support.TESTFN) + test.test_support.unlink(test.test_support.TESTFN) def check_sizeof(self, o, size): result = sys.getsizeof(o) @@ -416,13 +435,13 @@ return value def test_align(self): - self.assertTrue( (self.align(0) % self.p) == 0 ) - self.assertTrue( (self.align(1) % self.p) == 0 ) - self.assertTrue( (self.align(3) % self.p) == 0 ) - self.assertTrue( (self.align(4) % self.p) == 0 ) - self.assertTrue( (self.align(7) % self.p) == 0 ) - self.assertTrue( (self.align(8) % self.p) == 0 ) - self.assertTrue( (self.align(9) % self.p) == 0 ) + self.assertEqual(self.align(0) % self.p, 0) + self.assertEqual(self.align(1) % self.p, 0) + self.assertEqual(self.align(3) % self.p, 0) + self.assertEqual(self.align(4) % self.p, 0) + self.assertEqual(self.align(7) % self.p, 0) + self.assertEqual(self.align(8) % self.p, 0) + self.assertEqual(self.align(9) % self.p, 0) def test_standardtypes(self): i = self.i @@ -433,8 +452,6 @@ self.check_sizeof(True, h + l) # buffer self.check_sizeof(buffer(''), h + 2*p + 2*l + self.align(i) +l) - # bytearray - self.check_sizeof(bytes(), h + self.align(i) + l + p) # cell def get_cell(): x = 42 @@ -462,7 +479,7 @@ self.check_sizeof(reversed(''), h + l + p ) # file self.check_sizeof(self.file, h + 4*p + self.align(2*i) + 4*p +\ - self.align(3*i) + 2*p + self.align(i)) + self.align(3*i) + 3*p + self.align(i)) # float self.check_sizeof(float(0), h + 8) # function @@ -488,7 +505,7 @@ self.check_sizeof(abs, h + 3*p) # module self.check_sizeof(unittest, h + p) - # xange + # xrange self.check_sizeof(xrange(1), h + 3*p) # slice self.check_sizeof(slice(0), h + 3*p) @@ -501,8 +518,8 @@ # type (PyTypeObject + PyNumberMethods + PyMappingMethods + # PySequenceMethods + PyBufferProcs) len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p - self.check_sizeof(class_newstyle, h + \ - len_typeobject + 42*p + 10*p + 3*p + 6*p) + self.check_sizeof(class_newstyle, + h + len_typeobject + 42*p + 10*p + 3*p + 6*p) def test_specialtypes(self): Modified: python/branches/okkoto-sizeof/Lib/test/test_tarfile.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_tarfile.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_tarfile.py Wed Jun 4 11:24:23 2008 @@ -529,7 +529,19 @@ self.assertEqual(float(tarinfo.pax_headers["ctime"]), 1041808783.0) -class WriteTest(unittest.TestCase): +class WriteTestBase(unittest.TestCase): + # Put all write tests in here that are supposed to be tested + # in all possible mode combinations. + + def test_fileobj_no_close(self): + fobj = StringIO.StringIO() + tar = tarfile.open(fileobj=fobj, mode=self.mode) + tar.addfile(tarfile.TarInfo("foo")) + tar.close() + self.assert_(fobj.closed is False, "external fileobjs must never closed") + + +class WriteTest(WriteTestBase): mode = "w:" @@ -652,7 +664,7 @@ shutil.rmtree(tempdir) -class StreamWriteTest(unittest.TestCase): +class StreamWriteTest(WriteTestBase): mode = "w|" Modified: python/branches/okkoto-sizeof/Lib/test/test_telnetlib.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_telnetlib.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_telnetlib.py Wed Jun 4 11:24:23 2008 @@ -40,34 +40,36 @@ telnet.sock.close() def testTimeoutDefault(self): - # default - telnet = telnetlib.Telnet(HOST, self.port) - self.assertTrue(telnet.sock.gettimeout() is None) - telnet.sock.close() - - def testTimeoutValue(self): - # a value - telnet = telnetlib.Telnet(HOST, self.port, timeout=30) - self.assertEqual(telnet.sock.gettimeout(), 30) - telnet.sock.close() - - def testTimeoutDifferentOrder(self): - telnet = telnetlib.Telnet(timeout=30) - telnet.open(HOST, self.port) + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(30) + try: + telnet = telnetlib.Telnet("localhost", self.port) + finally: + socket.setdefaulttimeout(None) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() def testTimeoutNone(self): # None, having other default - previous = socket.getdefaulttimeout() + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(30) try: telnet = telnetlib.Telnet(HOST, self.port, timeout=None) finally: - socket.setdefaulttimeout(previous) + socket.setdefaulttimeout(None) + self.assertTrue(telnet.sock.gettimeout() is None) + telnet.sock.close() + + def testTimeoutValue(self): + telnet = telnetlib.Telnet("localhost", self.port, timeout=30) self.assertEqual(telnet.sock.gettimeout(), 30) telnet.sock.close() + def testTimeoutOpen(self): + telnet = telnetlib.Telnet() + telnet.open("localhost", self.port, timeout=30) + self.assertEqual(telnet.sock.gettimeout(), 30) + telnet.sock.close() def test_main(verbose=None): Modified: python/branches/okkoto-sizeof/Lib/test/test_threading.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_threading.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_threading.py Wed Jun 4 11:24:23 2008 @@ -3,6 +3,7 @@ import test.test_support from test.test_support import verbose import random +import re import sys import threading import thread @@ -72,6 +73,8 @@ for i in range(NUMTASKS): t = TestThread(""%i, self, sema, mutex, numrunning) threads.append(t) + self.failUnlessEqual(t.getIdent(), None) + self.assert_(re.match('', repr(t))) t.start() if verbose: @@ -79,6 +82,8 @@ for t in threads: t.join(NUMTASKS) self.assert_(not t.isAlive()) + self.failIfEqual(t.getIdent(), 0) + self.assert_(re.match('', repr(t))) if verbose: print 'all tasks done' self.assertEqual(numrunning.get(), 0) Modified: python/branches/okkoto-sizeof/Lib/test/test_unicodedata.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_unicodedata.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_unicodedata.py Wed Jun 4 11:24:23 2008 @@ -103,6 +103,7 @@ self.assertEqual(self.db.digit(u'9'), 9) self.assertEqual(self.db.digit(u'\u215b', None), None) self.assertEqual(self.db.digit(u'\u2468'), 9) + self.assertEqual(self.db.digit(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.digit) self.assertRaises(TypeError, self.db.digit, u'xx') @@ -113,6 +114,7 @@ self.assertEqual(self.db.numeric(u'9'), 9) self.assertEqual(self.db.numeric(u'\u215b'), 0.125) self.assertEqual(self.db.numeric(u'\u2468'), 9.0) + self.assertEqual(self.db.numeric(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.numeric) self.assertRaises(TypeError, self.db.numeric, u'xx') @@ -123,6 +125,7 @@ self.assertEqual(self.db.decimal(u'9'), 9) self.assertEqual(self.db.decimal(u'\u215b', None), None) self.assertEqual(self.db.decimal(u'\u2468', None), None) + self.assertEqual(self.db.decimal(u'\U00020000', None), None) self.assertRaises(TypeError, self.db.decimal) self.assertRaises(TypeError, self.db.decimal, u'xx') @@ -132,6 +135,7 @@ self.assertEqual(self.db.category(u'\uFFFE'), 'Cn') self.assertEqual(self.db.category(u'a'), 'Ll') self.assertEqual(self.db.category(u'A'), 'Lu') + self.assertEqual(self.db.category(u'\U00020000'), 'Lo') self.assertRaises(TypeError, self.db.category) self.assertRaises(TypeError, self.db.category, u'xx') @@ -140,6 +144,7 @@ self.assertEqual(self.db.bidirectional(u'\uFFFE'), '') self.assertEqual(self.db.bidirectional(u' '), 'WS') self.assertEqual(self.db.bidirectional(u'A'), 'L') + self.assertEqual(self.db.bidirectional(u'\U00020000'), 'L') self.assertRaises(TypeError, self.db.bidirectional) self.assertRaises(TypeError, self.db.bidirectional, u'xx') @@ -155,6 +160,7 @@ self.assertEqual(self.db.mirrored(u'\uFFFE'), 0) self.assertEqual(self.db.mirrored(u'a'), 0) self.assertEqual(self.db.mirrored(u'\u2201'), 1) + self.assertEqual(self.db.mirrored(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.mirrored) self.assertRaises(TypeError, self.db.mirrored, u'xx') @@ -163,6 +169,7 @@ self.assertEqual(self.db.combining(u'\uFFFE'), 0) self.assertEqual(self.db.combining(u'a'), 0) self.assertEqual(self.db.combining(u'\u20e1'), 230) + self.assertEqual(self.db.combining(u'\U00020000'), 0) self.assertRaises(TypeError, self.db.combining) self.assertRaises(TypeError, self.db.combining, u'xx') @@ -185,6 +192,7 @@ self.assertEqual(eaw(u'\uFF66'), 'H') self.assertEqual(eaw(u'\uFF1F'), 'F') self.assertEqual(eaw(u'\u2010'), 'A') + self.assertEqual(eaw(u'\U00020000'), 'W') class UnicodeMiscTest(UnicodeDatabaseTest): Modified: python/branches/okkoto-sizeof/Lib/test/test_urllib.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_urllib.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_urllib.py Wed Jun 4 11:24:23 2008 @@ -568,6 +568,7 @@ # . Facundo # # def server(evt): +# import socket, time # serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # serv.settimeout(3) # serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) @@ -592,6 +593,7 @@ # class FTPWrapperTests(unittest.TestCase): # # def setUp(self): +# import ftplib, time, threading # ftplib.FTP.port = 9093 # self.evt = threading.Event() # threading.Thread(target=server, args=(self.evt,)).start() @@ -603,31 +605,37 @@ # def testBasic(self): # # connects # ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) -# ftp.ftp.sock.close() +# ftp.close() # -# def testTimeoutDefault(self): -# # default -# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) -# self.assertTrue(ftp.ftp.sock.gettimeout() is None) -# ftp.ftp.sock.close() -# -# def testTimeoutValue(self): -# # a value -# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], timeout=30) +# def testTimeoutNone(self): +# # global default timeout is ignored +# import socket +# self.assert_(socket.getdefaulttimeout() is None) +# socket.setdefaulttimeout(30) +# try: +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) +# finally: +# socket.setdefaulttimeout(None) # self.assertEqual(ftp.ftp.sock.gettimeout(), 30) -# ftp.ftp.sock.close() +# ftp.close() # -# def testTimeoutNone(self): -# # None, having other default -# previous = socket.getdefaulttimeout() +# def testTimeoutDefault(self): +# # global default timeout is used +# import socket +# self.assert_(socket.getdefaulttimeout() is None) # socket.setdefaulttimeout(30) # try: # ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, []) # finally: -# socket.setdefaulttimeout(previous) +# socket.setdefaulttimeout(None) # self.assertEqual(ftp.ftp.sock.gettimeout(), 30) -# ftp.ftp.close() +# ftp.close() # +# def testTimeoutValue(self): +# ftp = urllib.ftpwrapper("myuser", "mypass", "localhost", 9093, [], +# timeout=30) +# self.assertEqual(ftp.ftp.sock.gettimeout(), 30) +# ftp.close() Modified: python/branches/okkoto-sizeof/Lib/test/test_urllib2.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_urllib2.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_urllib2.py Wed Jun 4 11:24:23 2008 @@ -2,6 +2,7 @@ from test import test_support import os +import socket import StringIO import urllib2 @@ -551,14 +552,15 @@ class NullFTPHandler(urllib2.FTPHandler): def __init__(self, data): self.data = data - def connect_ftp(self, user, passwd, host, port, dirs, timeout=None): + def connect_ftp(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.user, self.passwd = user, passwd self.host, self.port = host, port self.dirs = dirs self.ftpwrapper = MockFTPWrapper(self.data) return self.ftpwrapper - import ftplib, socket + import ftplib data = "rheum rhaponicum" h = NullFTPHandler(data) o = h.parent = MockOpener() @@ -691,7 +693,7 @@ self.req_headers = [] self.data = None self.raise_on_endheaders = False - def __call__(self, host, timeout=None): + def __call__(self, host, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.host = host self.timeout = timeout return self Modified: python/branches/okkoto-sizeof/Lib/test/test_urllib2net.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_urllib2net.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_urllib2net.py Wed Jun 4 11:24:23 2008 @@ -189,46 +189,58 @@ class TimeoutTest(unittest.TestCase): def test_http_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) u = _urlopen_with_retry("http://www.python.org") self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - def test_http_NoneWithdefault(self): - prev = socket.getdefaulttimeout() + def test_http_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry("http://www.python.org") + finally: + socket.setdefaulttimeout(None) + self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) + + def test_http_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(60) try: u = _urlopen_with_retry("http://www.python.org", timeout=None) - self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 60) finally: - socket.setdefaulttimeout(prev) + socket.setdefaulttimeout(None) + self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - def test_http_Value(self): + def test_http_timeout(self): u = _urlopen_with_retry("http://www.python.org", timeout=120) self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) - def test_http_NoneNodefault(self): - u = _urlopen_with_retry("http://www.python.org", timeout=None) - self.assertTrue(u.fp._sock.fp._sock.gettimeout() is None) - FTP_HOST = "ftp://ftp.mirror.nl/pub/mirror/gnu/" def test_ftp_basic(self): + self.assertTrue(socket.getdefaulttimeout() is None) u = _urlopen_with_retry(self.FTP_HOST) self.assertTrue(u.fp.fp._sock.gettimeout() is None) - def test_ftp_NoneWithdefault(self): - prev = socket.getdefaulttimeout() + def test_ftp_default_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) socket.setdefaulttimeout(60) try: - u = _urlopen_with_retry(self.FTP_HOST, timeout=None) - self.assertEqual(u.fp.fp._sock.gettimeout(), 60) + u = _urlopen_with_retry(self.FTP_HOST) finally: - socket.setdefaulttimeout(prev) + socket.setdefaulttimeout(None) + self.assertEqual(u.fp.fp._sock.gettimeout(), 60) - def test_ftp_NoneNodefault(self): - u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + def test_ftp_no_timeout(self): + self.assertTrue(socket.getdefaulttimeout() is None) + socket.setdefaulttimeout(60) + try: + u = _urlopen_with_retry(self.FTP_HOST, timeout=None) + finally: + socket.setdefaulttimeout(None) self.assertTrue(u.fp.fp._sock.gettimeout() is None) - def test_ftp_Value(self): + def test_ftp_timeout(self): u = _urlopen_with_retry(self.FTP_HOST, timeout=60) self.assertEqual(u.fp.fp._sock.gettimeout(), 60) Modified: python/branches/okkoto-sizeof/Lib/test/test_userstring.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_userstring.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_userstring.py Wed Jun 4 11:24:23 2008 @@ -4,8 +4,8 @@ import string from test import test_support, string_tests - from UserString import UserString, MutableString +import warnings class UserStringTest( string_tests.CommonTest, @@ -135,7 +135,10 @@ self.assertEqual(s, "") def test_main(): - test_support.run_unittest(UserStringTest, MutableStringTest) + with test_support.catch_warning(record=False): + warnings.filterwarnings("ignore", ".*MutableString", + DeprecationWarning) + test_support.run_unittest(UserStringTest, MutableStringTest) if __name__ == "__main__": test_main() Modified: python/branches/okkoto-sizeof/Lib/test/test_weakref.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_weakref.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_weakref.py Wed Jun 4 11:24:23 2008 @@ -3,6 +3,7 @@ import unittest import UserList import weakref +import operator from test import test_support @@ -187,6 +188,26 @@ self.assertEqual(L3[:5], p3[:5]) self.assertEqual(L3[2:5], p3[2:5]) + def test_proxy_index(self): + class C: + def __index__(self): + return 10 + o = C() + p = weakref.proxy(o) + self.assertEqual(operator.index(p), 10) + + def test_proxy_div(self): + class C: + def __floordiv__(self, other): + return 42 + def __ifloordiv__(self, other): + return 21 + o = C() + p = weakref.proxy(o) + self.assertEqual(p // 5, 42) + p //= 5 + self.assertEqual(p, 21) + # The PyWeakref_* C API is documented as allowing either NULL or # None as the value for the callback, where either means "no # callback". The "no callback" ref and proxy objects are supposed @@ -1059,7 +1080,7 @@ def _reference(self): return self.__ref.copy() -libreftest = """ Doctest for examples in the library reference: libweakref.tex +libreftest = """ Doctest for examples in the library reference: weakref.rst >>> import weakref >>> class Dict(dict): Modified: python/branches/okkoto-sizeof/Lib/test/test_wsgiref.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_wsgiref.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_wsgiref.py Wed Jun 4 11:24:23 2008 @@ -8,7 +8,7 @@ from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app from wsgiref.simple_server import make_server from StringIO import StringIO -from socketserver import BaseServer +from SocketServer import BaseServer import re, sys from test import test_support Modified: python/branches/okkoto-sizeof/Lib/test/test_zipfile.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_zipfile.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_zipfile.py Wed Jun 4 11:24:23 2008 @@ -132,6 +132,25 @@ for f in (TESTFN2, TemporaryFile(), StringIO()): self.zipOpenTest(f, zipfile.ZIP_STORED) + def testOpenViaZipInfo(self): + # Create the ZIP archive + zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) + zipfp.writestr("name", "foo") + zipfp.writestr("name", "bar") + zipfp.close() + + zipfp = zipfile.ZipFile(TESTFN2, "r") + infos = zipfp.infolist() + data = "" + for info in infos: + data += zipfp.open(info).read() + self.assert_(data == "foobar" or data == "barfoo") + data = "" + for info in infos: + data += zipfp.read(info) + self.assert_(data == "foobar" or data == "barfoo") + zipfp.close() + def zipRandomOpenTest(self, f, compression): self.makeTestArchive(f, compression) Modified: python/branches/okkoto-sizeof/Lib/threading.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/threading.py (original) +++ python/branches/okkoto-sizeof/Lib/threading.py Wed Jun 4 11:24:23 2008 @@ -414,6 +414,7 @@ self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon() + self.__ident = None self.__started = Event() self.__stopped = False self.__block = Condition(Lock()) @@ -434,7 +435,9 @@ if self.__stopped: status = "stopped" if self.__daemonic: - status = status + " daemon" + status += " daemon" + if self.__ident is not None: + status += " %s" % self.__ident return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status) def start(self): @@ -481,9 +484,10 @@ def __bootstrap_inner(self): try: + self.__ident = _get_ident() self.__started.set() _active_limbo_lock.acquire() - _active[_get_ident()] = self + _active[self.__ident] = self del _limbo[self] _active_limbo_lock.release() if __debug__: @@ -635,6 +639,10 @@ assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) + def getIdent(self): + assert self.__initialized, "Thread.__init__() not called" + return self.__ident + def isAlive(self): assert self.__initialized, "Thread.__init__() not called" return self.__started.isSet() and not self.__stopped Modified: python/branches/okkoto-sizeof/Lib/urllib.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/urllib.py (original) +++ python/branches/okkoto-sizeof/Lib/urllib.py Wed Jun 4 11:24:23 2008 @@ -832,7 +832,8 @@ class ftpwrapper: """Class used by open_ftp() for cache of open FTP connections.""" - def __init__(self, user, passwd, host, port, dirs, timeout=None): + def __init__(self, user, passwd, host, port, dirs, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.user = user self.passwd = passwd self.host = host @@ -1321,6 +1322,24 @@ if sys.platform == 'darwin': + + def _CFSetup(sc): + from ctypes import c_int32, c_void_p, c_char_p, c_int + sc.CFStringCreateWithCString.argtypes = [ c_void_p, c_char_p, c_int32 ] + sc.CFStringCreateWithCString.restype = c_void_p + sc.SCDynamicStoreCopyProxies.argtypes = [ c_void_p ] + sc.SCDynamicStoreCopyProxies.restype = c_void_p + sc.CFDictionaryGetValue.argtypes = [ c_void_p, c_void_p ] + sc.CFDictionaryGetValue.restype = c_void_p + sc.CFStringGetLength.argtypes = [ c_void_p ] + sc.CFStringGetLength.restype = c_int32 + sc.CFStringGetCString.argtypes = [ c_void_p, c_char_p, c_int32, c_int32 ] + sc.CFStringGetCString.restype = c_int32 + sc.CFNumberGetValue.argtypes = [ c_void_p, c_int, c_void_p ] + sc.CFNumberGetValue.restype = c_int32 + sc.CFRelease.argtypes = [ c_void_p ] + sc.CFRelease.restype = None + def _CStringFromCFString(sc, value): from ctypes import create_string_buffer length = sc.CFStringGetLength(value) + 1 @@ -1357,6 +1376,7 @@ return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3] sc = cdll.LoadLibrary(find_library("SystemConfiguration")) + _CFSetup(sc) hostIP = None @@ -1369,6 +1389,8 @@ proxyDict = sc.SCDynamicStoreCopyProxies(None) + if proxyDict is None: + return False try: # Check for simple host names: @@ -1422,11 +1444,11 @@ from ctypes.util import find_library sc = cdll.LoadLibrary(find_library("SystemConfiguration")) + _CFSetup(sc) if not sc: return {} - kSCPropNetProxiesHTTPEnable = sc.CFStringCreateWithCString(0, "HTTPEnable", 0) kSCPropNetProxiesHTTPProxy = sc.CFStringCreateWithCString(0, "HTTPProxy", 0) kSCPropNetProxiesHTTPPort = sc.CFStringCreateWithCString(0, "HTTPPort", 0) Modified: python/branches/okkoto-sizeof/Lib/urllib2.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/urllib2.py (original) +++ python/branches/okkoto-sizeof/Lib/urllib2.py Wed Jun 4 11:24:23 2008 @@ -117,7 +117,7 @@ __version__ = sys.version[:3] _opener = None -def urlopen(url, data=None, timeout=None): +def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): global _opener if _opener is None: _opener = build_opener() @@ -359,7 +359,7 @@ if result is not None: return result - def open(self, fullurl, data=None, timeout=None): + def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): # accept a URL or a Request object if isinstance(fullurl, basestring): req = Request(fullurl, data) Modified: python/branches/okkoto-sizeof/Lib/xml/dom/minidom.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/xml/dom/minidom.py (original) +++ python/branches/okkoto-sizeof/Lib/xml/dom/minidom.py Wed Jun 4 11:24:23 2008 @@ -1128,6 +1128,8 @@ self.data = self.nodeValue = data def writexml(self, writer, indent="", addindent="", newl=""): + if "--" in self.data: + raise ValueError("'--' is not allowed in a comment node") writer.write("%s%s" % (indent, self.data, newl)) Modified: python/branches/okkoto-sizeof/Lib/xmlrpclib.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/xmlrpclib.py (original) +++ python/branches/okkoto-sizeof/Lib/xmlrpclib.py Wed Jun 4 11:24:23 2008 @@ -897,6 +897,7 @@ self.append(int(data)) self._value = 0 dispatch["i4"] = end_int + dispatch["i8"] = end_int dispatch["int"] = end_int def end_double(self, data): Modified: python/branches/okkoto-sizeof/Lib/zipfile.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/zipfile.py (original) +++ python/branches/okkoto-sizeof/Lib/zipfile.py Wed Jun 4 11:24:23 2008 @@ -776,10 +776,13 @@ else: zef_file = open(self.filename, 'rb') - # Get info object for name - zinfo = self.getinfo(name) - - filepos = zef_file.tell() + # Make sure we have an info object + if isinstance(name, ZipInfo): + # 'name' is already an info object + zinfo = name + else: + # Get info object for name + zinfo = self.getinfo(name) zef_file.seek(zinfo.header_offset, 0) @@ -884,7 +887,7 @@ if upperdirs and not os.path.exists(upperdirs): os.makedirs(upperdirs) - source = self.open(member.filename, pwd=pwd) + source = self.open(member, pwd=pwd) target = file(targetpath, "wb") shutil.copyfileobj(source, target) source.close() Modified: python/branches/okkoto-sizeof/Mac/Modules/MacOS.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/MacOS.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/MacOS.c Wed Jun 4 11:24:23 2008 @@ -77,17 +77,17 @@ if (!PyArg_ParseTuple(args, "l", &n)) return NULL; - v = PyString_FromStringAndSize((char *)NULL, n); + v = PyBytes_FromStringAndSize((char *)NULL, n); if (v == NULL) return NULL; - err = FSRead(self->fRefNum, &n, PyString_AsString(v)); + err = FSRead(self->fRefNum, &n, PyBytes_AsString(v)); if (err && err != eofErr) { PyMac_Error(err); Py_DECREF(v); return NULL; } - _PyString_Resize(&v, n); + _PyBytes_Resize(&v, n); return v; } @@ -301,8 +301,8 @@ return NULL; if ((err = FSpGetFInfo(&fss, &info)) != noErr) return PyErr_Mac(MacOS_Error, err); - creator = PyString_FromStringAndSize((char *)&info.fdCreator, 4); - type = PyString_FromStringAndSize((char *)&info.fdType, 4); + creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4); + type = PyBytes_FromStringAndSize((char *)&info.fdType, 4); res = Py_BuildValue("OO", creator, type); Py_DECREF(creator); Py_DECREF(type); @@ -623,7 +623,7 @@ ** some of the image and sound processing interfaces on the mac:-( */ { - PyStringObject *p = 0; + PyBytesObject *p = 0; long off = (long)&(p->ob_sval[0]); if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0) Modified: python/branches/okkoto-sizeof/Mac/Modules/Nav.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/Nav.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/Nav.c Wed Jun 4 11:24:23 2008 @@ -139,11 +139,11 @@ NavGetDefaultDialogOptions(opt); while ( PyDict_Next(d, &pos, &key, &value) ) { - if ( !key || !value || !PyString_Check(key) ) { + if ( !key || !value || !PyBytes_Check(key) ) { PyErr_SetString(ErrorObject, "DialogOption has non-string key"); return 0; } - keystr = PyString_AsString(key); + keystr = PyBytes_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { PyErr_NoMemory(); @@ -932,7 +932,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Nav.error"); + ErrorObject = PyBytes_FromString("Nav.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/okkoto-sizeof/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/ae/_AEmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/ae/_AEmodule.c Wed Jun 4 11:24:23 2008 @@ -835,9 +835,9 @@ OSErr err; size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) + if ( (res = PyBytes_FromStringAndSize(NULL, size)) == NULL ) return NULL; - if ( (ptr = PyString_AsString(res)) == NULL ) + if ( (ptr = PyBytes_AsString(res)) == NULL ) return NULL; if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) return PyMac_Error(err); Modified: python/branches/okkoto-sizeof/Mac/Modules/cf/_CFmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/cf/_CFmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/cf/_CFmodule.c Wed Jun 4 11:24:23 2008 @@ -392,7 +392,7 @@ { char buf[100]; sprintf(buf, "", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFTypeRefObj_hash(CFTypeRefObject *self) @@ -596,7 +596,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFArrayRefObj_hash(CFArrayRefObject *self) @@ -836,7 +836,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self) @@ -1029,7 +1029,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self) @@ -1206,7 +1206,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyString_FromStringAndSize(data, size); + _res = (PyObject *)PyBytes_FromStringAndSize(data, size); return _res; } @@ -1437,7 +1437,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFDataRefObj_hash(CFDataRefObject *self) @@ -1702,7 +1702,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyString_FromString(data); + _res = (PyObject *)PyBytes_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) Modified: python/branches/okkoto-sizeof/Mac/Modules/cf/pycfbridge.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/cf/pycfbridge.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/cf/pycfbridge.c Wed Jun 4 11:24:23 2008 @@ -146,7 +146,7 @@ int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ return (*dst != NULL); } #endif - if (PyString_Check(src) || PyUnicode_Check(src)) + if (PyBytes_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ CFIndex size; UniChar *unichars; - if (PyString_Check(src)) { + if (PyBytes_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); Modified: python/branches/okkoto-sizeof/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/file/_Filemodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/file/_Filemodule.c Wed Jun 4 11:24:23 2008 @@ -915,7 +915,7 @@ size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); - rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); + rv = PyBytes_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; @@ -1315,7 +1315,7 @@ PyMac_Error(err); return NULL; } - _res = PyString_FromString(strbuf); + _res = PyBytes_FromString(strbuf); return _res; } @@ -1372,7 +1372,7 @@ static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSSpec_set_data NULL @@ -1393,7 +1393,7 @@ self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #define FSSpec_hash NULL @@ -1925,7 +1925,7 @@ static PyObject *FSRef_get_data(FSRefObject *self, void *closure) { - return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSRef_set_data NULL @@ -3038,7 +3038,7 @@ if (!PyArg_ParseTuple(_args, "O", &obj)) return NULL; - if (PyString_Check(obj)) { + if (PyBytes_Check(obj)) { Py_INCREF(obj); return obj; } @@ -3201,7 +3201,7 @@ } /* On OSX we now try a pathname */ - if ( PyString_Check(v) || PyUnicode_Check(v)) { + if ( PyBytes_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; Modified: python/branches/okkoto-sizeof/Mac/Modules/gestaltmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/gestaltmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/gestaltmodule.c Wed Jun 4 11:24:23 2008 @@ -34,7 +34,7 @@ { OSErr iErr; OSType selector; - long response; + SInt32 response; if (!PyArg_ParseTuple(args, "O&", PyMac_GetOSType, &selector)) return NULL; iErr = Gestalt ( selector, &response ); Modified: python/branches/okkoto-sizeof/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/qd/_Qdmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/qd/_Qdmodule.c Wed Jun 4 11:24:23 2008 @@ -1457,7 +1457,7 @@ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } @@ -1510,14 +1510,14 @@ static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); } #define BMObj_set_bitmap_data NULL static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure) { - return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); + return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); } #define BMObj_set_pixmap_data NULL @@ -6500,10 +6500,10 @@ int rowbytes; char *data; - if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, + if ( !PyArg_ParseTuple(_args, "O!iO&", &PyBytes_Type, &source, &rowbytes, PyMac_GetRect, &bounds) ) return NULL; - data = PyString_AsString(source); + data = PyBytes_AsString(source); if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) return PyErr_NoMemory(); ptr->baseAddr = (Ptr)data; @@ -6527,15 +6527,15 @@ BitMap *ptr; PyObject *source; - if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) + if ( !PyArg_ParseTuple(_args, "O!", &PyBytes_Type, &source) ) return NULL; - if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { + if ( PyBytes_Size(source) != sizeof(BitMap) && PyBytes_Size(source) != sizeof(PixMap) ) { PyErr_Format(PyExc_TypeError, "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)", - PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); + PyBytes_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } - ptr = (BitMapPtr)PyString_AsString(source); + ptr = (BitMapPtr)PyBytes_AsString(source); if ( (_res = BMObj_New(ptr)) == NULL ) { return NULL; } Modified: python/branches/okkoto-sizeof/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/qdoffs/_Qdoffsmodule.c Wed Jun 4 11:24:23 2008 @@ -608,7 +608,7 @@ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) ) return NULL; cp = GetPixBaseAddr(pm)+from; - _res = PyString_FromStringAndSize(cp, length); + _res = PyBytes_FromStringAndSize(cp, length); return _res; } Modified: python/branches/okkoto-sizeof/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/res/_Resmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/res/_Resmodule.c Wed Jun 4 11:24:23 2008 @@ -520,7 +520,7 @@ state = HGetState(self->ob_itself); HLock(self->ob_itself); - res = PyString_FromStringAndSize( + res = PyBytes_FromStringAndSize( *self->ob_itself, GetHandleSize(self->ob_itself)); HUnlock(self->ob_itself); @@ -537,10 +537,10 @@ if ( v == NULL ) return -1; - if ( !PyString_Check(v) ) + if ( !PyBytes_Check(v) ) return -1; - size = PyString_Size(v); - data = PyString_AsString(v); + size = PyBytes_Size(v); + data = PyBytes_AsString(v); /* XXXX Do I need the GetState/SetState calls? */ SetHandleSize(self->ob_itself, size); if ( MemError()) Modified: python/branches/okkoto-sizeof/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/scrap/_Scrapmodule.c Wed Jun 4 11:24:23 2008 @@ -105,12 +105,12 @@ flavorType, &byteCount); if (_err != noErr) return PyMac_Error(_err); - _res = PyString_FromStringAndSize(NULL, (int)byteCount); + _res = PyBytes_FromStringAndSize(NULL, (int)byteCount); if ( _res == NULL ) return NULL; _err = GetScrapFlavorData(_self->ob_itself, flavorType, &byteCount, - PyString_AS_STRING(_res)); + PyBytes_AS_STRING(_res)); if (_err != noErr) { Py_XDECREF(_res); return PyMac_Error(_err); Modified: python/branches/okkoto-sizeof/Mac/Modules/snd/_Sndihooks.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/snd/_Sndihooks.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/snd/_Sndihooks.c Wed Jun 4 11:24:23 2008 @@ -500,7 +500,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyString_FromString("Sndihooks.error"); + ErrorObject = PyBytes_FromString("Sndihooks.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/okkoto-sizeof/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Mac/Modules/win/_Winmodule.c (original) +++ python/branches/okkoto-sizeof/Mac/Modules/win/_Winmodule.c Wed Jun 4 11:24:23 2008 @@ -2580,7 +2580,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int WinObj_hash(WindowObject *self) Modified: python/branches/okkoto-sizeof/Makefile.pre.in ============================================================================== --- python/branches/okkoto-sizeof/Makefile.pre.in (original) +++ python/branches/okkoto-sizeof/Makefile.pre.in Wed Jun 4 11:24:23 2008 @@ -302,6 +302,7 @@ Objects/boolobject.o \ Objects/bufferobject.o \ Objects/bytes_methods.o \ + Objects/bytearrayobject.o \ Objects/bytesobject.o \ Objects/cellobject.o \ Objects/classobject.o \ @@ -328,7 +329,6 @@ Objects/rangeobject.o \ Objects/setobject.o \ Objects/sliceobject.o \ - Objects/stringobject.o \ Objects/structseq.o \ Objects/tupleobject.o \ Objects/typeobject.o \ @@ -375,6 +375,12 @@ build_all_use_profile: $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use" +coverage: + @echo "Building with support for coverage checking:" + $(MAKE) clean + $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov" + + # Build the interpreter $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ @@ -578,6 +584,7 @@ Include/bitset.h \ Include/boolobject.h \ Include/bytes_methods.h \ + Include/bytearrayobject.h \ Include/bytesobject.h \ Include/bufferobject.h \ Include/cellobject.h \ Modified: python/branches/okkoto-sizeof/Misc/ACKS ============================================================================== --- python/branches/okkoto-sizeof/Misc/ACKS (original) +++ python/branches/okkoto-sizeof/Misc/ACKS Wed Jun 4 11:24:23 2008 @@ -228,6 +228,7 @@ Lele Gaifax Santiago Gala Yitzchak Gale +Quentin Gallet-Gilles Raymund Galvin Nitin Ganatra Fred Gansevles @@ -376,6 +377,7 @@ Joseph Koshy Bob Kras Holger Krekel +Michael Kremer Fabian Kreutz Hannu Krosing Andrew Kuchling @@ -410,6 +412,7 @@ Bjorn Lindqvist Per Lindqvist Eric Lindvall +Gregor Lingl Nick Lockwood Stephanie Lockwood Anne Lord @@ -497,6 +500,7 @@ Jason Orendorff Douglas Orr Denis S. Otkidach +Michael Otteneder Russel Owen Ondrej Palkovsky Mike Pall @@ -635,6 +639,7 @@ Rafal Smotrzyk Dirk Soede Paul Sokolovsky +Cody Somerville Clay Spence Per Spilling Joshua Spoerri Modified: python/branches/okkoto-sizeof/Misc/NEWS ============================================================================== --- python/branches/okkoto-sizeof/Misc/NEWS (original) +++ python/branches/okkoto-sizeof/Misc/NEWS Wed Jun 4 11:24:23 2008 @@ -12,85 +12,178 @@ Core and Builtins ----------------- -- Issue #2863: generators now have a ``gen.__name__`` attribute that equals - ``gen.gi_code.co_name``, like ``func.__name___`` that equals - ``func.func_code.co_name``. The repr() of a generator now also contains - this name. +- Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. + +- New environment variable PYTHONIOENCODING. + +- Patch #2488: Add sys.maxsize. + +- Issue #2353: file.xreadlines() now emits a Py3k warning. + +- Issue #2863: generators now have a ``gen.__name__`` attribute that + equals ``gen.gi_code.co_name``, like ``func.__name___`` that equals + ``func.func_code.co_name``. The repr() of a generator now also + contains this name. - Issue #2831: enumerate() now has a ``start`` argument. -- Issue #2801: fix bug in the float.is_integer method where a ValueError - was sometimes incorrectly raised. +- Issue #2801: fix bug in the float.is_integer method where a + ValueError was sometimes incorrectly raised. -- Issue #2790: sys.flags was not properly exposing its bytes_warning attribute. +- Issue #2790: sys.flags was not properly exposing its bytes_warning + attribute. -- Issue #2196: hasattr now lets exceptions which do not inherit Exception - (KeyboardInterrupt, and SystemExit) propagate instead of ignoring them +- Issue #2196: hasattr() now lets exceptions which do not inherit + Exception (KeyboardInterrupt, and SystemExit) propagate instead of + ignoring them. Extension Modules ----------------- +- The heapq module does comparisons using LT instead of LE. This + makes its implementation match that used by list.sort(). + +- Issue #2819: add full-precision summation function to math module, + based on Hettinger's ASPN Python Cookbook recipe. + +- Issue #2592: delegate nb_index and the floor/truediv slots in + weakref.proxy. + +- Support os.O_ASYNC and fcntl.FASYNC if the constants exist on the + platform. + - Support for Windows 9x has been removed from the winsound module. -- bsddb module updated to version 4.6.4. +- bsddb module updated to version 4.7.0. + http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.0 + +- Issue #2858: Fix potential memory corruption when + bsddb.db.DBEnv.lock_get and other bsddb.db object constructors + raised an exception. + +- Issue #2669: bsddb/__init__.py iteration no longer silently fails when + the database has changed size during iteration. It now raises a + RuntimeError in the same manner as a dictionary. + +- Issue #2870: cmathmodule.c compile error. + +- Added a threading.Thread.getIdent() method. Library ------- -- The repr module has been renamed 'reprlib'. The old name is now - deprecated. +- Patch #2125: Add GetInteger and GetString methods for + msilib.Record objects. -- The statvfs module has been deprecated for removal in Python 3.0. +- Issue #2782: The datetime module's strftime methods now accept + unicode format strings just as time.strftime always has. + +- The sgmllib and htmllib modules have been deprecated for removal + in Python 3.0. + +- Issue #3011: locale module alias table was updated to the latest + version from the X.org locale.alias file. + +- Issue #1797 (partial fix): ctypes NULL function pointers have a + False boolean value now. + +- Issue #2985: Allow 64-bit integer responses (````) in XMLRPC + transfers. -- The sunaudiodev and SUNAUDIODEV modules have been deprecated for removal in +- Issue #2877: The UserString.MutableString class has been removed in Python 3.0. -- The WAIT module from IRIX has been deprecated for removal in Python 3.0. +- Do not close external file objects passed to tarfile.open(mode='w:bz2') + when the TarFile is closed. -- The torgb module from IRIX has been deprecated for removal in Python 3.0. +- Issue #2959: For consistency with other file-like objects, gzip's + GzipFile.close() can now be called multiple times without raising + an exception. -- The SV module from IRIX has been deprecated for removal in Python 3.0. +- Issue #1390: Raise ValueError in toxml when an invalid comment would + otherwise be produced. -- The readcd module from IRIX has been deprecated for removal in Python 3.0. +- Issue #2914: TimedRotatingFileHandler now takes an optional keyword + argument "utc" to use UTC time rather than local time. -- The panelparser module from IRIX has been deprecated for removal in - Python 3.0. +- Issue #2929: TimedRotatingFileHandler was using the wrong path when + deleting old log files (filename only instead of full path). + +- Issue #1775025: You can now specify zipfile members to open(), + read() or extract() via a ZipInfo instance. This allows handling + duplicate filenames in zipfiles. --The panel module from IRIX has been deprecated for removal in Python 3.0. +- Issue #961805: Fix Text.edit_modified() in Tkinter. -- The jpeg module from IRIX has been deprecated for removal in Python 3.0. +- Issue #1793: Function ctypes.util.find_msvcrt() added that returns + the name of the C runtime library that Python uses. + ctypes.util.find_library(name) now call this function when name is + 'm' or 'c'. -- The IOCTL module from IRIX has been deprecated for removal in Python 3.0. +- The statvfs module has been deprecated for removal in Python 3.0. -- The IN module from IRIX has been deprecated for removal in Python 3.0. +- The sunaudiodev and SUNAUDIODEV modules have been deprecated for + removal in Python 3.0. -- The imgfile module from IRIX has been deprecated for removal in Python 3.0. +- The WAIT module from IRIX has been deprecated for removal in Python + 3.0. -- The GLWS module from IRIX has been deprecated for removal in Python 3.0. +- The torgb module from IRIX has been deprecated for removal in Python + 3.0. -- The GET module from IRIX has been deprecated for removal in Python 3.0. +- The SV module from IRIX has been deprecated for removal in Python + 3.0. -- The fm module from IRIX has been deprecated for removal in Python 3.0. +- The readcd module from IRIX has been deprecated for removal in + Python 3.0. -- The FL, flp, and fl modules from IRIX have been deprecated for removal in +- The panelparser module from IRIX has been deprecated for removal in Python 3.0. -- The FILE module on IRIX has been deprecated for removal in Python 3.0. +- The panel module from IRIX has been deprecated for removal in Python + 3.0. -- The ERRNO module on IRIX has been deprecated for removal in Python 3.0. +- The jpeg module from IRIX has been deprecated for removal in Python + 3.0. -- The DEVICE, GL, gl, and cgen modules (which indirectly includes cgensupport) - have been deprecated for removal in Python 3.0. +- The IOCTL module from IRIX has been deprecated for removal in Python + 3.0. -- The ConfigParser module has been renamed 'configparser'. The old - name is now deprecated. +- The IN module from IRIX has been deprecated for removal in Python + 3.0. -- The CL, CL_old, and cl modules for IRIX have been deprecated for removal in +- The imgfile module from IRIX has been deprecated for removal in Python 3.0. -- The cdplayer module for IRIX has been deprecated for removal in Python 3.0. +- The GLWS module from IRIX has been deprecated for removal in Python + 3.0. + +- The GET module from IRIX has been deprecated for removal in Python + 3.0. + +- The fm module from IRIX has been deprecated for removal in Python + 3.0. + +- The FL, flp, and fl modules from IRIX have been deprecated for + removal in Python 3.0. + +- The FILE module on IRIX has been deprecated for removal in Python + 3.0. + +- The ERRNO module on IRIX has been deprecated for removal in Python + 3.0. + +- The DEVICE, GL, gl, and cgen modules (which indirectly includes + cgensupport) have been deprecated for removal in Python 3.0. -- The cddb module for IRIX has been deprecated for removal in Python 3.0. +- The CL, CL_old, and cl modules for IRIX have been deprecated for + removal in Python 3.0. + +- The cdplayer module for IRIX has been deprecated for removal in + Python 3.0. + +- The cddb module for IRIX has been deprecated for removal in Python + 3.0. - The cd and CD modules for IRIX have been deprecated for removal in Python 3.0. @@ -98,7 +191,7 @@ - The al and AL modules for IRIX have been deprecated for removal in Python 3.0. -- #1713041: fix pprint's handling of maximum depth. +- Issue #1713041: fix pprint's handling of maximum depth. - The timing module has been deprecated for removal in Python 3.0. @@ -106,19 +199,19 @@ - The multifile module has been deprecated as per PEP 4. -- The SocketServer module has been renamed 'socketserver'. The old - name is now deprecated. - - The imageop module has been deprecated for removal in Python 3.0. -- #2250: Exceptions raised during evaluation of names in rlcompleter's - ``Completer.complete()`` method are now caught and ignored. +- Issue #2250: Exceptions raised during evaluation of names in + rlcompleter's ``Completer.complete()`` method are now caught and + ignored. -- #2659: Added ``break_on_hyphens`` option to textwrap TextWrapper class. +- Issue #2659: Added ``break_on_hyphens`` option to textwrap + TextWrapper class. - The mhlib module has been deprecated for removal in Python 3.0. -- The linuxaudiodev module has been deprecated for removal in Python 3.0. +- The linuxaudiodev module has been deprecated for removal in Python + 3.0. - The ihooks module has been deprecated for removal in Python 3.0. @@ -130,7 +223,8 @@ - The compiler package has been deprecated for removal in Python 3.0. -- The Bastion and rexec modules have been deprecated for removal in Python 3.0. +- The Bastion and rexec modules have been deprecated for removal in + Python 3.0. - The bsddb185 module has been deprecated for removal in Python 3.0. @@ -143,7 +237,8 @@ - The toaiff module has been deprecated for removal in Python 3.0. -- The test.testall module has been deprecated for removal in Python 3.0. +- The test.testall module has been deprecated for removal in Python + 3.0. - The new module has been deprecated for removal in Python 3.0. @@ -161,14 +256,28 @@ - pdb gained the "until" command. -- The Mac Modules (including Carbon) have been deprecated for removal in - 3.0. +- The Mac Modules (including Carbon) have been deprecated for removal + in Python 3.0. Build ----- +- Patch #1722225: Support QNX 6. + - ``Lib/lib-old`` is now added to sys.path. +C API +----- + +- Add ``PyType_Modified()`` as a public API to clear the type cache. + +- The PyBytes functions have been renamed to PyByteArray. + +- The PyString functions have been renamed to PyBytes. A batch of + defines were added so that the linker still sees the original + PyString names. + + What's New in Python 2.6 alpha 3? ================================= @@ -179,51 +288,52 @@ - Issue #2719: backported the ``next()`` builtin from Python 3. -- Issue #2681: The octal literal ``0o8`` was incorrecly acctepted. Now it - properly raises a SyntaxError. +- Issue #2681: The octal literal ``0o8`` was incorrecly acctepted. Now + it properly raises a SyntaxError. -- Patch #2617: Reserved -J and -X arguments for Jython, IronPython and other - implementations of Python. +- Issue #2617: Reserved -J and -X arguments for Jython, IronPython and + other implementations of Python. -- Implemented PEP 370: Per user site-packages directory +- Implemented PEP 370: Per user site-packages directory. Extension Modules ----------------- -- Issue #2670: Fix a failure in urllib2.build_opener(), when passed two - handlers that derive the same default base class. +- Issue #2670: Fix a failure in urllib2.build_opener(), when passed + two handlers that derive the same default base class. - Added kill, terminate and send_signal(sig) to subprocess.Popen. -- Added phase(z) -> phi, polar(z) -> r, phi and rect(r, phi) -> z to the cmath - module. +- Added phase(z) -> phi, polar(z) -> r, phi and rect(r, phi) -> z to + the cmath module. -- Four new methods were added to the math and cmath modules: - acosh, asinh, atanh and log1p. +- Four new methods were added to the math and cmath modules: acosh, + asinh, atanh and log1p. -- zlib.decompressobj().flush(value) no longer crashes the interpreter when - passed a value less than or equal to zero. +- zlib.decompressobj().flush(value) no longer crashes the interpreter + when passed a value less than or equal to zero. -- Issue #1631171: Re-implement the 'warnings' module in C (the original Python - code has been kept as backup). This will allow for using the 'warning's - machinery in such places as the parser where use of pure Python code is not - possible. Both the ``showarning()`` and ``formatwarning()`` gain an - optional 'line' argument which is not called by default for - backwards-compatibility reasons. Setting ``warnings.showwarning()`` to - an implementation that lacks support for the ``line`` argument will raise a - DeprecationWarning. +- Issue #1631171: Re-implement the 'warnings' module in C (the + original Python code has been kept as backup). This will allow for + using the 'warning's machinery in such places as the parser where + use of pure Python code is not possible. Both the ``showarning()`` + and ``formatwarning()`` gain an optional 'line' argument which is + not called by default for backwards-compatibility reasons. Setting + ``warnings.showwarning()`` to an implementation that lacks support + for the ``line`` argument will raise a DeprecationWarning. Library ------- - The audiodev module has been deprecated for removal in Python 3.0. -- Issue #2750: Add the 'json' package. Based on simplejson 1.9 and contributed - by Bob Ippolito. +- Issue #2750: Add the 'json' package. Based on simplejson 1.9 and + contributed by Bob Ippolito. - Issue #1734346: Support Unicode file names for zipfiles. -- Issue #2581: distutils: Vista UAC/elevation support for bdist_wininst +- Issue #2581: distutils: Vista UAC/elevation support for + bdist_wininst. - Issue #2635: Fix bug in 'fix_sentence_endings' textwrap.fill option, where an extra space was added after a word containing (but not @@ -248,11 +358,11 @@ - Issue #2616: The ctypes.pointer() and ctypes.POINTER() functions are now implemented in C for better performance. -- Issue #2408: The ``_types`` module, which was used as in implementation - detail of the public ``types`` module, has been removed and replaced by pure - python code. +- Issue #2408: The ``_types`` module, which was used as in + implementation detail of the public ``types`` module, has been + removed and replaced by pure python code. -- Issue #2513: distutils on Windows is now capable of cross-compiling +- Issue #2513: distutils on Windows is now capable of cross-compiling extension modules between 32 and 64 bit platforms. See the distutls build documentation for more information. @@ -265,49 +375,55 @@ libffi3.0.5 version, apart from some small changes to Modules/_ctypes/libffi/configure.ac. -- Issue #2385: distutils.core.run_script() makes __file__ available, so the - controlled environment will more closely mirror the typical script - environment. This supports setup.py scripts that refer to data files. +- Issue #2385: distutils.core.run_script() makes __file__ available, + so the controlled environment will more closely mirror the typical + script environment. This supports setup.py scripts that refer to + data files. Tests ----- -- Issue #2550: The approach used by client/server code for obtaining ports - to listen on in network-oriented tests has been refined in an effort to - facilitate running multiple instances of the entire regression test suite - in parallel without issue. test_support.bind_port() has been fixed such - that it will always return a unique port -- which wasn't always the case - with the previous implementation, especially if socket options had been - set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The - new implementation of bind_port() will actually raise an exception if it - is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or - SO_REUSEPORT socket option set. Furthermore, if available, bind_port() - will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed. - This currently only applies to Windows. This option prevents any other - sockets from binding to the host/port we've bound to, thus removing the - possibility of the 'non-deterministic' behaviour, as Microsoft puts it, - that occurs when a second SOCK_STREAM socket binds and accepts to a - host/port that's already been bound by another socket. The optional - preferred port parameter to bind_port() has been removed. Under no + +- Issue #2550: The approach used by client/server code for obtaining + ports to listen on in network-oriented tests has been refined in an + effort to facilitate running multiple instances of the entire + regression test suite in parallel without issue. + test_support.bind_port() has been fixed such that it will always + return a unique port -- which wasn't always the case with the + previous implementation, especially if socket options had been set + that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT). The + new implementation of bind_port() will actually raise an exception + if it is passed an AF_INET/SOCK_STREAM socket with either the + SO_REUSEADDR or SO_REUSEPORT socket option set. Furthermore, if + available, bind_port() will set the SO_EXCLUSIVEADDRUSE option on + the socket it's been passed. This currently only applies to + Windows. This option prevents any other sockets from binding to the + host/port we've bound to, thus removing the possibility of the + 'non-deterministic' behaviour, as Microsoft puts it, that occurs + when a second SOCK_STREAM socket binds and accepts to a host/port + that's already been bound by another socket. The optional preferred + port parameter to bind_port() has been removed. Under no circumstances should tests be hard coding ports! - - test_support.find_unused_port() has also been introduced, which will pass - a temporary socket object to bind_port() in order to obtain an unused port. - The temporary socket object is then closed and deleted, and the port is - returned. This method should only be used for obtaining an unused port - in order to pass to an external program (i.e. the -accept [port] argument - to openssl's s_server mode) or as a parameter to a server-oriented class - that doesn't give you direct access to the underlying socket used. - Finally, test_support.HOST has been introduced, which should be used for - the host argument of any relevant socket calls (i.e. bind and connect). + test_support.find_unused_port() has also been introduced, which will + pass a temporary socket object to bind_port() in order to obtain an + unused port. The temporary socket object is then closed and + deleted, and the port is returned. This method should only be used + for obtaining an unused port in order to pass to an external program + (i.e. the -accept [port] argument to openssl's s_server mode) or as + a parameter to a server-oriented class that doesn't give you direct + access to the underlying socket used. + + Finally, test_support.HOST has been introduced, which should be used + for the host argument of any relevant socket calls (i.e. bind and + connect). The following tests were updated to following the new conventions: - test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, + test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib, test_poplib, test_ftplib, test_telnetlib, test_socketserver, test_asynchat and test_socket_ssl. - It is now possible for multiple instances of the regression test suite to - run in parallel without issue. + It is now possible for multiple instances of the regression test + suite to run in parallel without issue. Build ----- @@ -318,18 +434,17 @@ gcc is used as compiler. - Issue #2573: On MacOS X it is now possible to install the framework - with a different name using --with-framework-name=NAME. + with a different name using --with-framework-name=NAME. C API ----- -- Added implementation of copysign, acosh, asinh, atanh and log1p - to the new files Include/pymath.h and Python/pymath.h for - platforms which provide the functions through their libm. The - files also contains several helpers and constants for math. +- Added implementation of copysign, acosh, asinh, atanh and log1p to + the new files Include/pymath.h and Python/pymath.h for platforms + which provide the functions through their libm. The files also + contains several helpers and constants for math. -- Added a new convenience function, PyErr_WarnPy3k, for issuing Py3k - warnings. +- Added a new convenience macro, PyErr_WarnPy3k, for issuing Py3k warnings. What's New in Python 2.6 alpha 2? @@ -340,9 +455,9 @@ Core and builtins ----------------- -- Issue #1733757: The interpreter would hang on shutdown if the tracing - function set by sys.settrace is still active and happens to call - threading.currentThread(). +- Issue #1733757: The interpreter would hang on shutdown if the + tracing function set by sys.settrace is still active and happens to + call threading.currentThread(). - Patch #1442: properly report exceptions when the PYTHONSTARTUP file cannot be executed. @@ -351,10 +466,10 @@ reference on the outer class name. - Patch #1810: compile() can now compile _ast trees as returned by - compile(..., PyCF_ONLY_AST). + ``compile(..., PyCF_ONLY_AST)``. -- Patch #2426: Added sqlite3.Connection.iterdump method to allow easy dumping - of databases. Contributed by Paul Kippes at PyCon 2008. +- Patch #2426: Added sqlite3.Connection.iterdump method to allow easy + dumping of databases. Contributed by Paul Kippes at PyCon 2008. - Patch #2477: Added from __future__ import unicode_literals. @@ -363,52 +478,57 @@ - Issue #2355: add Py3k warning for buffer(). - Issue #1477: With narrow Unicode builds, the unicode escape sequence - \Uxxxxxxxx did not accept values outside the Basic Multilingual Plane. This - affected raw unicode literals and the 'raw-unicode-escape' codec. Now - UTF-16 surrogates are generated in this case, like normal unicode literals - and the 'unicode-escape' codec. + \Uxxxxxxxx did not accept values outside the Basic Multilingual + Plane. This affected raw unicode literals and the + 'raw-unicode-escape' codec. Now UTF-16 surrogates are generated in + this case, like normal unicode literals and the 'unicode-escape' + codec. - Issue #2348: add Py3k warning for file.softspace. -- Issue #2346/#2347: add Py3k warnings for __methods__ and __members__. +- Issue #2346/#2347: add Py3k warnings for __methods__ and + __members__. - Issue #2358: Add a Py3k warning on sys.exc_clear() usage. - Issue #2400: Allow relative imports to "import *". -- Issue 1745. Backport print function with: - from __future__ import print_function +- Issue #1745: Backport print function with ``from __future__ import + print_function``. -- Issue 2332: add new attribute names for instance method objects. - The two changes are: im_self -> __self__ and im_func -> __func__ +- Issue #2332: add new attribute names for instance method objects. + The two changes are: im_self -> __self__ and im_func -> __func__ -- Issue 2379: Raise a Py3K warning for __getitem__ or __getslice__ on +- Issue #2379: Raise a Py3K warning for __getitem__ or __getslice__ on exception instances. - Issue #2371: Add a Py3k warning when catching an exception that - doesn't derive from BaseException. Issue #2341: Add a Py3k warning - when raising an exception that doesn't derive from BaseException. + doesn't derive from BaseException. + +- Issue #2341: Add a Py3k warning when raising an exception that + doesn't derive from BaseException. - Issue #2321: use pymalloc for unicode object string data to reduce memory usage in some circumstances. -- PEP 3127: octal literals now start with "0o". Old-style octal literals - are still valid. There are binary literals with a prefix of "0b". - This also affects int(x, 0). +- PEP 3127: octal literals now start with "0o". Old-style octal + literals are still valid. There are binary literals with a prefix of + "0b". This also affects int(x, 0). - Issue #2359: Adding deprecation warnings for array.{read,write}. -- Issue #1779871: Gnu gcc can now build Python on OS X because the +- Issue #1779871: GNU gcc can now build Python on OS X because the flags -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd are no longer passed. - Add a warning when asserting a non-empty tuple which is always true. -- Issue #2179: speed up with statement execution by storing the exit method - on the stack instead of in a temporary variable (patch by Jeffrey Yaskin) +- Issue #2179: speed up with statement execution by storing the exit + method on the stack instead of in a temporary variable (patch by + Jeffrey Yaskin) -- Issue #2238: Some syntax errors in *args and **kwargs expressions could give - bogus error messages. +- Issue #2238: Some syntax errors in *args and **kwargs expressions + could give bogus error messages. - Issue #2143: Fix embedded readline() hang on SSL socket EOF. @@ -420,20 +540,22 @@ Library ------- -- Issue #2315: logging.handlers: TimedRotatingFileHandler now accounts for - daylight savings time in calculating the next rollover. - -- Issue #2316: logging.handlers: TimedRotatingFileHandler now calculates - rollovers correctly even when nothing is logged for a while. +- Issue #2315: logging.handlers: TimedRotatingFileHandler now accounts + for daylight savings time in calculating the next rollover. -- Issue #2317: logging.handlers: TimedRotatingFileHandler now uses improved - logic for removing old files. +- Issue #2316: logging.handlers: TimedRotatingFileHandler now + calculates rollovers correctly even when nothing is logged for a + while. + +- Issue #2317: logging.handlers: TimedRotatingFileHandler now uses + improved logic for removing old files. + +- Issue #2495: tokenize.untokenize now inserts a space between two + consecutive string literals; previously, ["" ""] was rendered as + [""""], which is incorrect python code. -- Issue #2495: tokenize.untokenize now inserts a space between two consecutive - string literals; previously, ["" ""] was rendered as [""""], which is - incorrect python code. - -- Issue #2248: return the result of the QUIT command. from SMTP.quit(). +- Issue #2248: return the result of the QUIT command. from + SMTP.quit(). - Backport of Python 3.0's io module. @@ -446,58 +568,60 @@ - Issue #2432: give DictReader the dialect and line_num attributes advertised in the docs. -- Issue #2460: Make Ellipsis object copyable. +- Issue #2460: Make Ellipsis object copyable. -- Issue #1681432: Add triangular distribution to the random module +- Issue #1681432: Add triangular distribution to the random module -- Issue #2136: urllib2's auth handler now allows single-quoted realms in the - WWW-Authenticate header. +- Issue #2136: urllib2's auth handler now allows single-quoted realms + in the WWW-Authenticate header. - Issue #2434: Enhanced platform.win32_ver() to also work on Python installation which do not have the win32all package installed. -- Added support to platform.uname() to also report the machine - and processor information on Windows XP and later. As a result, +- Added support to platform.uname() to also report the machine and + processor information on Windows XP and later. As a result, platform.machine() and platform.processor() will report this information as well. -- The library implementing the 2to3 conversion, lib2to3, was added - to the standard distribution. +- The library implementing the 2to3 conversion, lib2to3, was added to + the standard distribution. -- Issue #1747858: Fix chown to work with large uid's and gid's on 64-bit - platforms. +- Issue #1747858: Fix chown to work with large uid's and gid's on + 64-bit platforms. -- Issue #1202: zlib.crc32 and zlib.adler32 no longer return different values - on 32-bit vs. 64-bit python interpreters. Both were correct, but they now - both return a signed integer object for consistency. +- Issue #1202: zlib.crc32 and zlib.adler32 no longer return different + values on 32-bit vs. 64-bit python interpreters. Both were correct, + but they now both return a signed integer object for consistency. - Issue #1158: add %f format (fractions of a second represented as microseconds) to datetime objects. Understood by both strptime and strftime. - Issue #705836: struct.pack(">f", x) now raises OverflowError on all - platforms when x is too large to fit into an IEEE 754 float; previously - it only raised OverflowError on non IEEE 754 platforms. + platforms when x is too large to fit into an IEEE 754 float; + previously it only raised OverflowError on non IEEE 754 platforms. - Issues #2166, #1741 and #1531505: now distutils deals with HOME correctly under win32 -- #1858: distutils: added multiple server support in .pypirc +- Patch #1858: distutils: added multiple server support in .pypirc - Issue #1106316: pdb.post_mortem()'s parameter, "traceback", is now - optional: it defaults to the traceback of the exception that is currently - being handled (is mandatory to be in the middle of an exception, otherwise - it raises ValueError). + optional: it defaults to the traceback of the exception that is + currently being handled (is mandatory to be in the middle of an + exception, otherwise it raises ValueError). - Issue #1193577: A .shutdown() method has been added to SocketServers which terminates the .serve_forever() loop. -- Bug #2220: handle rlcompleter attribute match failure more gracefully. +- Issue #2220: handle rlcompleter attribute match failure more + gracefully. -- Issue #2225: py_compile, when executed as a script, now returns a non- - zero status code if not all files could be compiled successfully. +- Issue #2225: py_compile, when executed as a script, now returns a + non- zero status code if not all files could be compiled + successfully. -- Bug #1725737: In distutil's sdist, exclude RCS, CVS etc. also in the +- Bug #1725737: In distutils' sdist, exclude RCS, CVS etc. also in the root directory, and also exclude .hg, .git, .bzr, and _darcs. - Issue #1872: The struct module typecode for _Bool has been changed @@ -505,19 +629,18 @@ - The bundled libffi copy is now in sync with the recently released libffi3.0.4 version, apart from some small changes to - Modules/_ctypes/libffi/configure.ac. - On OS X, preconfigured libffi files are used. - On all linux systems the --with-system-ffi configure option defaults - to "yes". + Modules/_ctypes/libffi/configure.ac. On OS X, preconfigured libffi + files are used. On all linux systems the --with-system-ffi + configure option defaults to "yes". -- Issue 1577: shutil.move() now calls os.rename() if the destination is a - directory instead of copying-then-remove-source. +- Issue #1577: shutil.move() now calls os.rename() if the destination + is a directory instead of copying-then-remove-source. Tests ----- -- test_nis no longer fails when test.test_support.verbose is true and NIS is - not set up on the testing machine. +- test_nis no longer fails when test.test_support.verbose is true and + NIS is not set up on the testing machine. - Output comparison tests are no longer supported. @@ -527,13 +650,15 @@ - GHOP 290: Convert test_dbm and test_dummy_threading to unittest. -- GHOP 293: Convert test_strftime, test_getargs, and test_pep247 to unittest. +- GHOP 293: Convert test_strftime, test_getargs, and test_pep247 to + unittest. - Issue #2055: Convert test_fcntl to unittest. - Issue 1960: Convert test_gdbm to unittest. -- GHOP 294: Convert test_contains, test_crypt, and test_select to unittest. +- GHOP 294: Convert test_contains, test_crypt, and test_select to + unittest. - GHOP 238: Convert test_tokenize to use doctest. @@ -547,8 +672,8 @@ - A new script 2to3 is now installed, to run the 2.x to 3.x converter. -- Python/memmove.c and Python/strerror.c have been removed; both functions are - in the C89 standard library. +- Python/memmove.c and Python/strerror.c have been removed; both + functions are in the C89 standard library. - Patch #2284: Add -x64 option to rt.bat. @@ -556,7 +681,8 @@ ----- - Patch #2477: Added PyParser_ParseFileFlagsEx() and - PyParser_ParseStringFlagsFilenameEx() + PyParser_ParseStringFlagsFilenameEx(). + What's New in Python 2.6 alpha 1? ================================= @@ -597,56 +723,59 @@ datetime; the class string.Formatter; and the C API PyObject_Format(). -- Fixed several potential crashes, all caused by specially crafted __del__ - methods exploiting objects in temporarily inconsistent state. +- Fixed several potential crashes, all caused by specially crafted + __del__ methods exploiting objects in temporarily inconsistent + state. - Issue #2115: Important speedup in setting __slot__ attributes. Also - prevent a possible crash: an Abstract Base Class would try to access a slot - on a registered virtual subclass. + prevent a possible crash: an Abstract Base Class would try to access + a slot on a registered virtual subclass. -- Fixed repr() and str() of complex numbers with infinity or nan as real or - imaginary part. +- Fixed repr() and str() of complex numbers with infinity or nan as + real or imaginary part. -- Clear all free lists during a gc.collect() of the highest generation in order - to allow pymalloc to free more arenas. Python may give back memory to the - OS earlier. - -- Issue #2045: Fix an infinite recursion triggered when printing a subclass of - collections.defaultdict, if its default_factory is set to a bound method. +- Clear all free lists during a gc.collect() of the highest generation + in order to allow pymalloc to free more arenas. Python may give back + memory to the OS earlier. + +- Issue #2045: Fix an infinite recursion triggered when printing a + subclass of collections.defaultdict, if its default_factory is set + to a bound method. - Fixed a minor memory leak in dictobject.c. The content of the free list was not freed on interpreter shutdown. -- Limit free list of method and builtin function objects to 256 entries - each. +- Limit free list of method and builtin function objects to 256 + entries each. -- Patch #1953: Added ``sys._compact_freelists()`` and the C API functions - ``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` +- Patch #1953: Added ``sys._compact_freelists()`` and the C API + functions ``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList`` to compact the internal free lists of pre-allocted ints and floats. -- Bug #1983: Fixed return type of fork(), fork1() and forkpty() calls. - Python expected the return type int but the fork familie returns pi_t. - -- Issue #1678380: Fix a bug that identifies 0j and -0j when they appear - in the same code unit. - -- Issue #2025 : Add tuple.count() and tuple.index() methods to comply with - the collections.Sequence API. - -- Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and linebreak - detection - -- Added ``PyType_ClearCache()`` and ``sys._clear_type_cache`` to clear the - internal lookup cache for ref leak tests. - -- Patch #1473257: generator objects gain a gi_code attribute. This is the - same object as the func_code attribute of the function that produced the - generator. - -- Issue #1920: "while 0" statements were completely removed by the compiler, - even in the presence of an "else" clause, which is supposed to be run when - the condition is false. Now the compiler correctly emits bytecode for the - "else" suite. +- Issue #1983: Fixed return type of fork(), fork1() and forkpty() + calls. Python expected the return type int but the fork familie + returns pi_t. + +- Issue #1678380: Fix a bug that identifies 0j and -0j when they + appear in the same code unit. + +- Issue #2025: Add tuple.count() and tuple.index() methods to comply + with the collections.Sequence API. + +- Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and + linebreak detection + +- Added ``PyType_ClearCache()`` and ``sys._clear_type_cache`` to clear + the internal lookup cache for ref leak tests. + +- Patch #1473257: generator objects gain a gi_code attribute. This is + the same object as the func_code attribute of the function that + produced the generator. + +- Issue #1920: "while 0" statements were completely removed by the + compiler, even in the presence of an "else" clause, which is + supposed to be run when the condition is false. Now the compiler + correctly emits bytecode for the "else" suite. - A few crashers fixed: weakref_in_del.py (issue #1377858); loosing_dict_ref.py (issue #1303614, test67.py); @@ -656,7 +785,7 @@ suppressed while an extension is loaded by calling SetErrorMode in dynload_win.c. The error is still reported properly. -- Bug #1915: Python compiles with --enable-unicode=no again. However +- Issue #1915: Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support. @@ -671,48 +800,50 @@ - sys.float_info / PyFloat_GetInfo: The floating point information object was converted from a dict to a specialized structseq object. -- Patch #1816: Added sys.flags structseq. It exposes the status of most - command line arguments and PYTHON* environment variables. +- Patch #1816: Added sys.flags structseq. It exposes the status of + most command line arguments and PYTHON* environment variables. -- Objects/structseq.c: Implemented new structseq representation. The patch - makes structseqs (e.g. the return value of os.stat) more readable. +- Objects/structseq.c: Implemented new structseq representation. The + patch makes structseqs (e.g. the return value of os.stat) more + readable. -- Patch #1700288: added a type attribute cache that caches method accesses, - resulting in speedups in heavily object-oriented code. +- Patch #1700288: added a type attribute cache that caches method + accesses, resulting in speedups in heavily object-oriented code. - Bug #1776: __import__() no longer accepts filenames on any platform. The first parameter to __import__() must be a valid module name. - Patch #1668: renamed THREADDEBUG envvar to PYTHONTHREADDEBUG. -- Patch #602345: Add -B command line option, PYTHONDONTWRITEBYTECODE envvar - and sys.dont_write_bytecode attribute. All these can be set to forbid Python - to attempt to write compiled bytecode files. - -- Improve some exception messages when Windows fails to load an extension - module. Now we get for example '%1 is not a valid Win32 application' instead - of 'error code 193'. +- Patch #602345: Add -B command line option, PYTHONDONTWRITEBYTECODE + envvar and sys.dont_write_bytecode attribute. All these can be set + to forbid Python to attempt to write compiled bytecode files. + +- Improve some exception messages when Windows fails to load an + extension module. Now we get for example '%1 is not a valid Win32 + application' instead of 'error code 193'. -- Bug #1481296: Fixed long(float('nan'))!=0L. +- Bug #1481296: Fixed long(float('nan')) != 0L. -- Issue #1640: Added math.isinf(x), math.isnan(x) and math.copysign(x, y) - functions. +- Issue #1640: Added math.isinf(x), math.isnan(x) and math.copysign(x, + y) functions. - Issue #1635: Platform independent creation and representation of NaN - and INF. float("nan"), float("inf") and float("-inf") now work on every - platform with IEEE 754 semantics. + and INF. float("nan"), float("inf") and float("-inf") now work on + every platform with IEEE 754 semantics. -- Compiler now generates simpler and faster code for dictionary literals. - The oparg for BUILD_MAP now indicates an estimated dictionary size. - There is a new opcode, STORE_MAP, for adding entries to the dictionary. +- Compiler now generates simpler and faster code for dictionary + literals. The oparg for BUILD_MAP now indicates an estimated + dictionary size. There is a new opcode, STORE_MAP, for adding + entries to the dictionary. -- Issue #1638: %zd configure test fails on Linux +- Issue #1638: %zd configure test fails on Linux. -- Issue #1620: New property decorator syntax was modifying the decorator - in place instead of creating a new decorator object. +- Issue #1620: New property decorator syntax was modifying the + decorator in place instead of creating a new decorator object. -- Issue #1538: Avoid copying string in split/rsplit if the split - char is not found. +- Issue #1538: Avoid copying string in split/rsplit if the split char + is not found. - Issue #1553: An erroneous __length_hint__ can make list() raise a SystemError. @@ -721,25 +852,26 @@ inside packages with the -m switch via a new module level __package__ attribute. -- Issue #1402: Fix a crash on exit, when another thread is still running, and - if the deallocation of its frames somehow calls the PyGILState_Ensure() / - PyGILState_Release() functions. +- Issue #1402: Fix a crash on exit, when another thread is still + running, and if the deallocation of its frames somehow calls the + PyGILState_Ensure() / PyGILState_Release() functions. - Expose the Py_Py3kWarningFlag as sys.py3kwarning. - Issue #1445: Fix a SystemError when accessing the ``cell_contents`` attribute of an empty cell object. -- Issue #1460: The utf-7 incremental decoder did not accept truncated input. - It now correctly saves its state between chunks of data. +- Issue #1460: The utf-7 incremental decoder did not accept truncated + input. It now correctly saves its state between chunks of data. -- Patch #1739468: Directories and zipfiles containing a __main__.py file can - now be directly executed by passing their name to the interpreter. The - directory/zipfile is automatically inserted as the first entry in sys.path. - -- Issue #1265: Fix a problem with sys.settrace, if the tracing function uses a - generator expression when at the same time the executed code is closing a - paused generator. +- Patch #1739468: Directories and zipfiles containing a __main__.py + file can now be directly executed by passing their name to the + interpreter. The directory/zipfile is automatically inserted as the + first entry in sys.path. + +- Issue #1265: Fix a problem with sys.settrace, if the tracing + function uses a generator expression when at the same time the + executed code is closing a paused generator. - sets and frozensets now have an isdisjoint() method. @@ -747,48 +879,53 @@ - Fix warnings found by the new version of the Coverity checker. -- The enumerate() builtin function is no longer bounded to sequences smaller - than LONG_MAX. Formerly, it raised an OverflowError. Now, automatically - shifts from ints to longs. - -- Issue #1686386: Tuple's tp_repr did not take into account the possibility of - having a self-referential tuple, which is possible from C code. Nor did - object's tp_str consider that a type's tp_str could do something that could - lead to an inifinite recursion. Py_ReprEnter() and Py_EnterRecursiveCall(), - respectively, fixed the issues. - -- Issue #1164: It was possible to trigger deadlock when using the 'print' - statement to write to a file since the GIL was not released as needed. Now - PyObject_Print() does the right thing along with various tp_print - implementations of the built-in types and those in the collections module. - -- Issue #1147: Exceptions were directly allowing string exceptions in their - throw() method even though string exceptions no longer allowed. +- The enumerate() builtin function is no longer bounded to sequences + smaller than LONG_MAX. Formerly, it raised an OverflowError. Now, + automatically shifts from ints to longs. + +- Issue #1686386: Tuple's tp_repr did not take into account the + possibility of having a self-referential tuple, which is possible + from C code. Nor did object's tp_str consider that a type's tp_str + could do something that could lead to an inifinite recursion. + Py_ReprEnter() and Py_EnterRecursiveCall(), respectively, fixed the + issues. + +- Issue #1164: It was possible to trigger deadlock when using the + 'print' statement to write to a file since the GIL was not released + as needed. Now PyObject_Print() does the right thing along with + various tp_print implementations of the built-in types and those in + the collections module. + +- Issue #1147: Exceptions were directly allowing string exceptions in + their throw() method even though string exceptions no longer + allowed. -- Issue #1096: Prevent a segfault from getting the repr of a very deeply nested - list by using the recursion counter. +- Issue #1096: Prevent a segfault from getting the repr of a very + deeply nested list by using the recursion counter. - Issue #1202533: Fix infinite recursion calls triggered by calls to - PyObject_Call() never calling back out to Python code to trigger recursion - depth updates/checks. Required the creation of a static RuntimeError - instance in case normalizing an exception put the recursion check value past - its limit. Fixes crashers infinite_rec_(1|2|4|5).py. + PyObject_Call() never calling back out to Python code to trigger + recursion depth updates/checks. Required the creation of a static + RuntimeError instance in case normalizing an exception put the + recursion check value past its limit. Fixes crashers + infinite_rec_(1|2|4|5).py. -- Patch #1031213: Decode source line in SyntaxErrors back to its original source - encoding. +- Patch #1031213: Decode source line in SyntaxErrors back to its + original source encoding. - Patch #1673759: add a missing overflow check when formatting floats with %G. -- Prevent expandtabs() on string and unicode objects from causing a segfault - when a large width is passed on 32-bit platforms. +- Prevent expandtabs() on string and unicode objects from causing a + segfault when a large width is passed on 32-bit platforms. -- Bug #1733488: Fix compilation of bufferobject.c on AIX. +- Issue #1733488: Fix compilation of bufferobject.c on AIX. -- Bug #1722485: remove docstrings again when running with -OO. +- Issue #1722485: remove docstrings again when running with -OO. - Add new attribute names for function objects. All the func_* become - __*__ attributes. (Some already existed, e.g., __doc__ and __name__.) + __*__ attributes. (Some already existed, e.g., __doc__ and + __name__.) - Add -3 option to the interpreter to warn about features that are deprecated and will be changed/removed in Python 3.0. @@ -797,12 +934,12 @@ calls. - except clauses may now be spelled either "except E, target:" or - "except E as target:". This is to provide forwards compatibility with - Python 3.0. + "except E as target:". This is to provide forwards compatibility + with Python 3.0. - Deprecate BaseException.message as per PEP 352. -- Bug #1303614: don't expose object's __dict__ when the dict is +- Issue #1303614: don't expose object's __dict__ when the dict is inherited from a builtin base. - When __slots__ are set to a unicode string, make it work the same as @@ -827,22 +964,25 @@ warning later). Also, type.__init__() insists on the same signature as supported by type.__new__(). -- Patch #1675423: PyComplex_AsCComplex() now tries to convert an object - to complex using its __complex__() method before falling back to the - __float__() method. Therefore, the functions in the cmath module now - can operate on objects that define a __complex__() method. - -- Patch #1623563: allow __class__ assignment for classes with __slots__. - The old and the new class are still required to have the same slot names. +- Patch #1675423: PyComplex_AsCComplex() now tries to convert an + object to complex using its __complex__() method before falling back + to the __float__() method. Therefore, the functions in the cmath + module now can operate on objects that define a __complex__() + method. + +- Patch #1623563: allow __class__ assignment for classes with + __slots__. The old and the new class are still required to have the + same slot names. + +- Patch #1642547: Fix an error/crash when encountering syntax errors + in complex if statements. + +- Patch #1462488: Python no longer segfaults when + ``object.__reduce_ex__()`` is called with an object that is faking + its type. -- Patch #1642547: Fix an error/crash when encountering syntax errors in - complex if statements. - -- Patch #1462488: Python no longer segfaults when ``object.__reduce_ex__()`` - is called with an object that is faking its type. - -- Patch #1680015: Don't modify __slots__ tuple if it contains an unicode - name. +- Patch #1680015: Don't modify __slots__ tuple if it contains an + unicode name. - Patch #1444529: the builtin compile() now accepts keyword arguments. @@ -850,61 +990,69 @@ case, even when converting the value to a string failed. - The dir() function has been extended to call the __dir__() method on - its argument, if it exists. If not, it will work like before. This allows - customizing the output of dir() in the presence of a __getattr__(). + its argument, if it exists. If not, it will work like before. This + allows customizing the output of dir() in the presence of a + __getattr__(). - Patch #922167: Python no longer segfaults when faced with infinitely self-recursive reload() calls (as reported by bug #742342). -- Patch #1675981: remove unreachable code from ``type.__new__()`` method. +- Patch #1675981: remove unreachable code from ``type.__new__()`` + method. -- Patch #1491866: change the complex() constructor to allow parthensized - forms. This means complex(repr(x)) now works instead of raising a - ValueError. +- Patch #1491866: change the complex() constructor to allow + parthensized forms. This means complex(repr(x)) now works instead of + raising a ValueError. - Patch #703779: unset __file__ in __main__ after running a file. This - makes the filenames the warning module prints much more sensible when - a PYTHONSTARTUP file is used. + makes the filenames the warning module prints much more sensible + when a PYTHONSTARTUP file is used. - Variant of patch #697613: don't exit the interpreter on a SystemExit exception if the -i command line option or PYTHONINSPECT environment - variable is given, but break into the interactive interpreter just like - on other exceptions or normal program exit. + variable is given, but break into the interactive interpreter just + like on other exceptions or normal program exit. -- Patch #1638879: don't accept strings with embedded NUL bytes in long(). +- Patch #1638879: don't accept strings with embedded NUL bytes in + long(). -- Bug #1674503: close the file opened by execfile() in an error condition. +- Bug #1674503: close the file opened by execfile() in an error + condition. - Patch #1674228: when assigning a slice (old-style), check for the sq_ass_slice instead of the sq_slice slot. -- When printing an unraisable error, don't print exceptions. before the name. - This duplicates the behavior whening normally printing exceptions. - -- Bug #1653736: Properly discard third argument to slot_nb_inplace_power. - -- PEP 352: Raising a string exception now triggers a TypeError. Attempting to - catch a string exception raises DeprecationWarning. - -- Bug #1377858: Fix the segfaulting of the interpreter when an object created - a weakref on itself during a __del__ call for new-style classes (classic - classes still have the bug). +- When printing an unraisable error, don't print exceptions. before + the name. This duplicates the behavior whening normally printing + exceptions. + +- Bug #1653736: Properly discard third argument to + slot_nb_inplace_power. + +- PEP 352: Raising a string exception now triggers a TypeError. + Attempting to catch a string exception raises DeprecationWarning. + +- Bug #1377858: Fix the segfaulting of the interpreter when an object + created a weakref on itself during a __del__ call for new-style + classes (classic classes still have the bug). - Bug #1579370: Make PyTraceBack_Here use the current thread, not the frame's thread state. -- patch #1630975: Fix crash when replacing sys.stdout in sitecustomize.py +- patch #1630975: Fix crash when replacing sys.stdout in + sitecustomize.py. -- Prevent seg fault on shutdown which could occur if an object - raised a warning. +- Prevent seg fault on shutdown which could occur if an object raised + a warning. -- Bug #1566280: Explicitly invoke threading._shutdown from Py_Main, - to avoid relying on atexit. +- Bug #1566280: Explicitly invoke threading._shutdown from Py_Main, to + avoid relying on atexit. -- Bug #1590891: random.randrange don't return correct value for big number +- Bug #1590891: random.randrange don't return correct value for big + number. -- Patch #1586791: Better exception messages for some operations on strings, - tuples and lists. +- Patch #1586791: Better exception messages for some operations on + strings, tuples and lists. - Bug #1067760: Deprecate passing floats to file.seek. @@ -912,10 +1060,10 @@ - Bug #1588287: fix invalid assertion for `1,2` in debug builds. -- Bug #1576657: when setting a KeyError for a tuple key, make sure that - the tuple isn't used as the "exception arguments tuple". +- Bug #1576657: when setting a KeyError for a tuple key, make sure + that the tuple isn't used as the "exception arguments tuple". -- Bug #1565514, SystemError not raised on too many nested blocks. +- Bug #1565514: SystemError not raised on too many nested blocks. - Bug #1576174: WindowsError now displays the windows error code again, no longer the posix error code. @@ -923,8 +1071,8 @@ - Patch #1549049: Support long values in structmember, issue warnings if the assigned value for structmember fields gets truncated. -- Update the peephole optimizer to remove more dead code (jumps after returns) - and inline unconditional jumps to returns. +- Update the peephole optimizer to remove more dead code (jumps after + returns) and inline unconditional jumps to returns. - Bug #1545497: when given an explicit base, int() did ignore NULs embedded in the string to convert. @@ -942,12 +1090,12 @@ number of arguments, as was the case in Python 2.4. - Patch #1567691: super() and new.instancemethod() now don't accept - keyword arguments any more (previously they accepted them, but didn't - use them). + keyword arguments any more (previously they accepted them, but + didn't use them). -- Fix a bug in the parser's future statement handling that led to "with" - not being recognized as a keyword after, e.g., this statement: - from __future__ import division, with_statement +- Fix a bug in the parser's future statement handling that led to + "with" not being recognized as a keyword after, e.g., this + statement: from __future__ import division, with_statement - Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)). @@ -955,8 +1103,9 @@ - Allow exception instances to be directly sliced again. -- Bug #1551432: Exceptions do not define an explicit __unicode__ method. This - allows calling unicode() on exceptions classes directly to succeed. +- Bug #1551432: Exceptions do not define an explicit __unicode__ + method. This allows calling unicode() on exceptions classes + directly to succeed. - Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack. Also make sure that every exception class has __module__ set to @@ -976,18 +1125,19 @@ head is the original string if sep was not found. - Bug #1520864: unpacking singleton tuples in list comprehensions and - generator expressions (x for x, in ... ) works again. Fixing this problem - required changing the .pyc magic number. This means that .pyc files - generated before 2.5c2 will be regenerated. + generator expressions (x for x, in ... ) works again. Fixing this + problem required changing the .pyc magic number. This means that + .pyc files generated before 2.5c2 will be regenerated. - ``with`` and ``as`` are now keywords. -- Bug #1664966: Fix crash in exec if Unicode filename can't be decoded. +- Bug #1664966: Fix crash in exec if Unicode filename can't be + decoded. - Issue #1537: Changed GeneratorExit's base class from Exception to BaseException. -- Fix Issue #1703448: A joined thread could show up in the +- Issue #1703448: A joined thread could show up in the threading.enumerate() list after the join() for a brief period until it actually exited. @@ -995,24 +1145,25 @@ Library ------- -- #2274 Add heapq.heappushpop(). +- Patch #2274: Add heapq.heappushpop(). - Add inspect.isabstract(object) to fix bug #2223 - Add a __format__ method to Decimal, to support PEP 3101. -- Add a timing parameter when using trace.Trace to print out timestamps. +- Add a timing parameter when using trace.Trace to print out + timestamps. -- #1627: httplib now ignores negative Content-Length headers. +- Issue #1627: httplib now ignores negative Content-Length headers. -- #900744: If an invalid chunked-encoding header is sent by a server, - httplib will now raise IncompleteRead and close the connection instead - of raising ValueError. +- Issue #900744: If an invalid chunked-encoding header is sent by a + server, httplib will now raise IncompleteRead and close the + connection instead of raising ValueError. -- #1492: The content type of BaseHTTPServer error messages can now be - overridden. +- Issue #1492: The content type of BaseHTTPServer error messages can + now be overridden. -- Issue 1781: ConfigParser now does not let you add the "default" section +- Issue #1781: ConfigParser now does not let you add the "default" section (ignore-case) - Removed uses of dict.has_key() from distutils, and uses of @@ -1020,9 +1171,11 @@ without warnings when '-3' is given. More work like this needs to be done in the rest of the stdlib. -- Issue #1916. Added isgenerator() and isgeneratorfunction() to inspect.py. +- Issue #1916: added isgenerator() and isgeneratorfunction() to + inspect.py. -- #1224: Fixed bad url parsing when path begins with double slash. +- Issue #1224: Fixed bad url parsing when path begins with double + slash. - ctypes instances that are not or do not contain pointers can now be pickled. @@ -1034,89 +1187,93 @@ to fractions.Fraction, to avoid the name clash with the abstract base class numbers.Rational. See discussion in issue #1682. -- The pickletools module now provides an optimize() function - that eliminates unused PUT opcodes from a pickle string. - -- #2021: Allow tempfile.NamedTemporaryFile and SpooledTemporaryFile - to be used in with statements by correctly supporting the context - management protocol. +- The pickletools module now provides an optimize() function that + eliminates unused PUT opcodes from a pickle string. -- #1979: Add rich comparisons to Decimal, and make Decimal comparisons - involving a NaN follow the IEEE 754 standard. +- Patch #2021: Allow tempfile.NamedTemporaryFile and + SpooledTemporaryFile to be used in with statements by correctly + supporting the context management protocol. + +- Patch #1979: Add rich comparisons to Decimal, and make Decimal + comparisons involving a NaN follow the IEEE 754 standard. + +- Issue #2004: tarfile.py: Use mode 0700 for temporary directories and + default permissions for missing directories. + +- Issue #175006: The debugger used to skip the condition of a "while" + statement after the first iteration. Now it correctly steps on the + expression, and breakpoints on the "while" statement are honored on + each loop. -- #2004: tarfile.py: Use mode 0700 for temporary directories and default - permissions for missing directories. - -- #175006: The debugger used to skip the condition of a "while" statement - after the first iteration. Now it correctly steps on the expression, and - breakpoints on the "while" statement are honored on each loop. - -- #1765140: add an optional delay argument to FileHandler and its - subclasses. Defaults to false (existing behaviour), but if true, +- Issue #1765140: add an optional delay argument to FileHandler and + its subclasses. Defaults to false (existing behaviour), but if true, defers opening the file until the first call to emit(). - The pprint module now supports sets and frozensets. -- #1221598: add optional callbacks to ftplib.FTP's storbinary() and - storlines() methods. (Contributed by Phil Schwartz) +- Issue #1221598: add optional callbacks to ftplib.FTP's storbinary() + and storlines() methods. (Contributed by Phil Schwartz) -- #1715: include sub-extension modules in pydoc's text output. +- Issue #1715: include sub-extension modules in pydoc's text output. -- #1836: fix an off-by-one bug in TimedRotatingHandler's rollover - time calculation. +- Issue #1836: fix an off-by-one bug in TimedRotatingHandler's + rollover time calculation. -- #1021: fix a bug to allow basicConfig to accept NOTSET as a level. +- Issue #1021: fix a bug to allow basicConfig to accept NOTSET as a + level. -- #932563: add LoggerAdapter convenience class to make it easier to add - contextual information in logging output. +- Issue #932563: add LoggerAdapter convenience class to make it easier + to add contextual information in logging output. -- #1760556: fix a bug to avoid FileHandler throwing an exception in - flush(). +- Issue #1760556: fix a bug to avoid FileHandler throwing an exception + in flush(). -- Bug #1530959: distutils' build command now uses different build directory - when building extension modules against versions of Python compiled - with ``--with-pydebug``. +- Bug #1530959: distutils' build command now uses different build + directory when building extension modules against versions of Python + compiled with ``--with-pydebug``. -- #1555501: move plistlib from plat-mac directory to general library. +- Issue #1555501: move plistlib from plat-mac directory to general + library. -- #1269: fix a bug in pstats.add_callers() and add a unit test file for - pstats. +- Issue #1269: fix a bug in pstats.add_callers() and add a unit test + file for pstats. -- #1669: don't allow shutil.rmtree() to be called on a symlink to a - directory. +- Issue #1669: don't allow shutil.rmtree() to be called on a symlink + to a directory. -- #1664522: in urllib, don't read non-existing directories in ftp mode, - returning a 0-byte file -- raise an IOError instead. +- Issue #1664522: in urllib, don't read non-existing directories in + ftp mode, returning a 0-byte file -- raise an IOError instead. -- #856047: respect the ``no_proxy`` environment variable when using the - ``http_proxy`` etc. environment variables in urllib. +- Issue #856047: respect the ``no_proxy`` environment variable when + using the ``http_proxy`` etc. environment variables in urllib. -- #1178141: add a getcode() method to the addinfourls that urllib.open() - returns so that you can retrieve the HTTP status code. +- Issue #1178141: add a getcode() method to the addinfourls that + urllib.open() returns so that you can retrieve the HTTP status code. - Issue #1003: Fix zipfile decryption check, it would fail zip files with extended local headers. -- #1189216: Fix the zipfile module to work on archives with headers - past the 2**31 byte boundary. +- Issue #1189216: Fix the zipfile module to work on archives with + headers past the 2**31 byte boundary. -- #1336: fix a race condition in subprocess.Popen if the garbage +- Issue #1336: fix a race condition in subprocess.Popen if the garbage collector kicked in at the wrong time that would cause the process to hang when the child wrote to stderr. -- #1146: fix how textwrap breaks a long word that would start in the - last column of a line. +- Issue #1146: fix how textwrap breaks a long word that would start in + the last column of a line. -- #1693149: trace.py --ignore-module - accept multiple comma-separated - modules to be given. +- Issue #1693149: trace.py --ignore-module - accept multiple + comma-separated modules to be given. -- #1822: MIMEMultipart.is_multipart() behaves correctly for a just-created - (and empty) instance. Thanks Jonathan Share. +- Issue #1822: MIMEMultipart.is_multipart() behaves correctly for a + just-created (and empty) instance. Thanks Jonathan Share. -- #1861: Added an attribute to the sched module which returns an ordered - list of upcoming events (displayed as named tuples). +- Issue #1861: Added an attribute to the sched module which returns an + ordered list of upcoming events (displayed as named tuples). -- #1837: The queue module now also supports a LIFO queue and a priority queue. +- Issue #1837: The queue module now also supports a LIFO queue and a + priority queue. - Patch #1048820: Add insert-mode editing to curses.textpad.Textbox (patch by Stefan Wehr). Also, fix an off-by-one bug in @@ -1133,24 +1290,25 @@ - Issue #1786: pdb should use its own stdin/stdout around an exec call and when creating a recursive instance. -- Issue #1698398 Zipfile.printdir() crashed because the format string - expected a tuple type of length six instead of time.struct_time object. +- Issue #1698398: ZipFile.printdir() crashed because the format string + expected a tuple type of length six instead of time.struct_time + object. - Issue #1780: The Decimal constructor now accepts arbitrary leading and trailing whitespace when constructing from a string. Context.create_decimal no longer accepts trailing newlines. -- Decimal.as_tuple(), difflib.find_longest_match() and inspect functions - that returned a tuple now return a named tuple. +- Decimal.as_tuple(), difflib.find_longest_match() and inspect + functions that returned a tuple now return a named tuple. - Doctest now returns results as a named tuple for readability: (0, 7) --> TestResults(failed=0, attempted=7) -- Issue #846388. re.match is interruptible now, which is particularly +- Issue #846388:q re.match is interruptible now, which is particularly good for long regular expression matches. -- pyexpat, patch #1137: allow setting buffer_size attribute - on Parser objects to set the character data buffer size. +- Patch #1137: allow setting buffer_size attribute on pyexpat Parser + objects to set the character data buffer size. - Issue #1757: The hash of a Decimal instance is no longer affected by the current context. @@ -1160,22 +1318,23 @@ - Issue #1646: Make socket support the TIPC protocol. -- Bug #1742: return os.curdir from os.path.relpath() if both arguments are - equal instead of raising an exception. +- Bug #1742: return os.curdir from os.path.relpath() if both arguments + are equal instead of raising an exception. - Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'. - Patch #1698: allow '@' in username parsed by urlparse.py. -- Issue #1735: TarFile.extractall() now correctly sets directory permissions - and times. +- Issue #1735: TarFile.extractall() now correctly sets directory + permissions and times. - Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint. -- Bug #1687: Fxed plistlib.py restricts to Python int when writing +- Bug #1687: Fxed plistlib.py restricts to Python int when + writing -- Issue #1700: Regular expression inline flags incorrectly handle certain - unicode characters. +- Issue #1700: Regular expression inline flags incorrectly handle + certain unicode characters. - Issue #1689: PEP 3141, numeric abstract base classes. @@ -1184,22 +1343,22 @@ - Issue #1642: Fix segfault in ctypes when trying to delete attributes. -- Issue #1727780: Support loading pickles of random.Random objects created - on 32-bit systems on 64-bit systems, and vice versa. As a consequence - of the change, Random pickles created by Python 2.6 cannot be loaded - in Python 2.5. - -- Issue #1455: The distutils package now supports VS 2005 and VS 2008 for - both the msvccompiler and cygwincompiler. +- Issue #1727780: Support loading pickles of random.Random objects + created on 32-bit systems on 64-bit systems, and vice versa. As a + consequence of the change, Random pickles created by Python 2.6 + cannot be loaded in Python 2.5. + +- Issue #1455: The distutils package now supports VS 2005 and VS 2008 + for both the msvccompiler and cygwincompiler. -- Issue #1531: tarfile.py: Read fileobj from the current offset, do not - seek to the start. +- Issue #1531: tarfile.py: Read fileobj from the current offset, do + not seek to the start. -- Issue #1534: Added a dictionary sys.float_info with information about the - internal floating point type to the sys module. +- Issue #1534: Added a dictionary sys.float_info with information + about the internal floating point type to the sys module. -- Issue 1429818: patch for trace and doctest modules so they play nicely - together. +- Issue #1429818: patch for trace and doctest modules so they play + nicely together. - doctest made a bad assumption that a package's __loader__.get_data() method used universal newlines. @@ -1213,8 +1372,8 @@ - IN module for FreeBSD 8 is added and preexisting FreeBSD 6 and 7 files are updated. -- Issues #1181, #1287: unsetenv() is now called when the os.environ.pop() - and os.environ.clear() methods are used. +- Issues #1181, #1287: unsetenv() is now called when the + os.environ.pop() and os.environ.clear() methods are used. - ctypes will now work correctly on 32-bit systems when Python is configured with --with-system-ffi. @@ -1224,17 +1383,19 @@ - collections.deque() now supports a "maxlen" argument. -- itertools.count() is no longer bounded to LONG_MAX. Formerly, it raised - an OverflowError. Now, automatically shifts from ints to longs. +- itertools.count() is no longer bounded to LONG_MAX. Formerly, it + raised an OverflowError. Now, automatically shifts from ints to + longs. -- Added itertools.product() which forms the Cartesian product of - the input iterables. +- Added itertools.product() which forms the Cartesian product of the + input iterables. - Added itertools.combinations() and itertools.permutations(). - Patch #1541463: optimize performance of cgi.FieldStorage operations. -- Decimal is fully updated to the latest Decimal Specification (v1.66). +- Decimal is fully updated to the latest Decimal Specification + (v1.66). - Bug #1153: repr.repr() now doesn't require set and dictionary items to be orderable to properly represent them. @@ -1243,16 +1404,18 @@ - Bug #1709599: Run test_1565150 only if the file system is NTFS. -- When encountering a password-protected robots.txt file the RobotFileParser - no longer prompts interactively for a username and password (bug 813986). +- When encountering a password-protected robots.txt file the + RobotFileParser no longer prompts interactively for a username and + password (bug 813986). - TarFile.__init__() no longer fails if no name argument is passed and the fileobj argument has no usable name attribute (e.g. StringIO). -- The functools module now provides 'reduce', for forward compatibility - with Python 3000. +- The functools module now provides 'reduce', for forward + compatibility with Python 3000. -- Server-side SSL support and cert verification added, by Bill Janssen. +- Server-side SSL support and cert verification added, by Bill + Janssen. - socket.ssl deprecated; use new ssl module instead. @@ -1261,8 +1424,8 @@ - EUC-KR codec now handles the cheot-ga-keut composed make-up hangul syllables. -- GB18030 codec now can encode additional two-byte characters that - are missing in GBK. +- GB18030 codec now can encode additional two-byte characters that are + missing in GBK. - Add new codecs for UTF-32, UTF-32-LE and UTF-32-BE. @@ -1279,31 +1442,34 @@ - tarfile.py: Added "exclude" keyword argument to TarFile.add(). -- Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute. - -- The urlopen function of urllib2 now has an optional timeout parameter (note - that it actually works with HTTP, HTTPS, FTP and FTPS connections). +- Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple + attribute. -- In ftplib, the FTP.ntransfercmd method, when in passive mode, now uses - the socket.create_connection function, using the timeout specified at - connection time. +- The urlopen function of urllib2 now has an optional timeout + parameter (note that it actually works with HTTP, HTTPS, FTP and + FTPS connections). + +- In ftplib, the FTP.ntransfercmd method, when in passive mode, now + uses the socket.create_connection function, using the timeout + specified at connection time. - Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it - reads a file that ends with incomplete sequence and sizehint argument - for .read() is specified. + reads a file that ends with incomplete sequence and sizehint + argument for .read() is specified. -- Bug #1730389: Change time.strptime() to use ``\s+`` instead of ``\s*`` when - matching spaces in the specified format argument. +- Bug #1730389: Change time.strptime() to use ``\s+`` instead of + ``\s*`` when matching spaces in the specified format argument. -- SF 1668596/1720897: distutils now copies data files - even if package_dir is empty. +- Bugs #1668596/#1720897: distutils now copies data files even if + package_dir is empty. - sha now raises a DeprecationWarning upon import. - md5 now raises a DeprecationWarning upon import. -- Issue1385: The hmac module now computes the correct hmac when using hashes - with a block size other than 64 bytes (such as sha384 and sha512). +- Issue #1385: The hmac module now computes the correct hmac when + using hashes with a block size other than 64 bytes (such as sha384 + and sha512). - mimify now raises a DeprecationWarning upon import. @@ -1318,11 +1484,11 @@ - The posixfile module now raises a DeprecationWarning. -- Remove the gopherlib module. This also leads to the removal of gopher - support in urllib/urllib2. +- Remove the gopherlib module. This also leads to the removal of + gopher support in urllib/urllib2. -- Fix bug in marshal where bad data would cause a segfault due to - lack of an infinite recursion check. +- Fix bug in marshal where bad data would cause a segfault due to lack + of an infinite recursion check. - Removed plat-freebsd2 and plat-freebsd3 directories (and IN.py in the directories). @@ -1331,10 +1497,11 @@ the traceback inadvertently or maliciously closing the comment and injecting HTML into the error page. -- The popen2 module and os.popen* are deprecated. Use the subprocess module. +- The popen2 module and os.popen* are deprecated. Use the subprocess + module. -- Added an optional credentials argument to SMTPHandler, for use with SMTP - servers which require authentication. +- Added an optional credentials argument to SMTPHandler, for use with + SMTP servers which require authentication. - Patch #1695948: Added optional timeout parameter to SocketHandler. @@ -1349,13 +1516,15 @@ ".cpp" too. - As specified in RFC 2616, an HTTP response like 2xx indicates that - the client's request was successfully received, understood, and accepted. - Now in these cases no error is raised in urllib (issue #1177) and urllib2. + the client's request was successfully received, understood, and + accepted. Now in these cases no error is raised in urllib (issue + #1177) and urllib2. -- Bug #1290505: time.strptime's internal cache of locale information is now - properly recreated when the locale is changed. +- Bug #1290505: time.strptime's internal cache of locale information + is now properly recreated when the locale is changed. -- Patch #1685563: remove (don't add) duplicate paths in distutils.MSVCCompiler. +- Patch #1685563: remove (don't add) duplicate paths in + distutils.MSVCCompiler. - Added a timeout parameter to the constructor of other protocols (telnetlib, ftplib, smtplib and poplib). This is second part of the @@ -1373,8 +1542,8 @@ - Patch #1630118: add a SpooledTemporaryFile class to tempfile.py. -- Patch #1273829: os.walk() now has a "followlinks" parameter. If set to - True (which is not the default), it visits symlinks pointing to +- Patch #1273829: os.walk() now has a "followlinks" parameter. If set + to True (which is not the default), it visits symlinks pointing to directories. - Bug #1681228: the webbrowser module now correctly uses the default @@ -1388,72 +1557,76 @@ initialization failed. - Bug #767111: fix long-standing bug in urllib which caused an - AttributeError instead of an IOError when the server's response didn't - contain a valid HTTP status line. + AttributeError instead of an IOError when the server's response + didn't contain a valid HTTP status line. -- Patch #957650: "%var%" environment variable references are now properly - expanded in ntpath.expandvars(), also "~user" home directory references - are recognized and handled on Windows. +- Patch #957650: "%var%" environment variable references are now + properly expanded in ntpath.expandvars(), also "~user" home + directory references are recognized and handled on Windows. -- Patch #1429539: pdb now correctly initializes the __main__ module for - the debugged script, which means that imports from __main__ work +- Patch #1429539: pdb now correctly initializes the __main__ module + for the debugged script, which means that imports from __main__ work correctly now. - The nonobvious commands.getstatus() function is now deprecated. -- Patch #1393667: pdb now has a "run" command which restarts the debugged - Python program, optionally with different arguments. +- Patch #1393667: pdb now has a "run" command which restarts the + debugged Python program, optionally with different arguments. - Patch #1649190: Adding support for _Bool to ctypes as c_bool. -- Patch #1530482: add pydoc.render_doc() which returns the documentation - for a thing instead of paging it to stdout, which pydoc.doc() does. - -- Patch #1533909: the timeit module now accepts callables in addition to - strings for the code to time and the setup code. Also added two - convenience functions for instantiating a Timer and calling its methods. - -- Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" parameter - which can be set to False to prevent the default delete-on-close - behavior. +- Patch #1530482: add pydoc.render_doc() which returns the + documentation for a thing instead of paging it to stdout, which + pydoc.doc() does. + +- Patch #1533909: the timeit module now accepts callables in addition + to strings for the code to time and the setup code. Also added two + convenience functions for instantiating a Timer and calling its + methods. + +- Patch #1537850: tempfile.NamedTemporaryFile now has a "delete" + parameter which can be set to False to prevent the default + delete-on-close behavior. - Patch #1581073: add a flag to textwrap that prevents the dropping of whitespace while wrapping. - Patch #1603688: ConfigParser.SafeConfigParser now checks values that - are set for invalid interpolation sequences that would lead to errors - on reading back those values. + are set for invalid interpolation sequences that would lead to + errors on reading back those values. -- Added support for the POSIX.1-2001 (pax) format to tarfile.py. Extended - and cleaned up the test suite. Added a new testtar.tar. +- Added support for the POSIX.1-2001 (pax) format to + tarfile.py. Extended and cleaned up the test suite. Added a new + testtar.tar. - Patch #1449244: Support Unicode strings in email.message.Message.{set_charset,get_content_charset}. -- Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" to - pydoc's help keywords. +- Patch #1542681: add entries for "with", "as" and "CONTEXTMANAGERS" + to pydoc's help keywords. - Patch #1555098: use str.join() instead of repeated string concatenation in robotparser. - Patch #1635454: the csv.DictWriter class now includes the offending - field names in its exception message if you try to write a record with - a dictionary containing fields not in the CSV field names list. + field names in its exception message if you try to write a record + with a dictionary containing fields not in the CSV field names list. - Patch #1668100: urllib2 now correctly raises URLError instead of OSError if accessing a local file via the file:// protocol fails. - Patch #1677862: Require a space or tab after import in .pth files. -- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they trap - the IndexError caused by passing in an invalid breakpoint number. +- Patch #1192590: Fix pdb's "ignore" and "condition" commands so they + trap the IndexError caused by passing in an invalid breakpoint + number. + +- Patch #1599845: Add an option to disable the implicit calls to + server_bind() and server_activate() in the constructors for + TCPServer, SimpleXMLRPCServer and DocXMLRPCServer. -- Patch #1599845: Add an option to disable the implicit calls to server_bind() - and server_activate() in the constructors for TCPServer, SimpleXMLRPCServer - and DocXMLRPCServer. - -- Bug #1531963: Make SocketServer.TCPServer's server_address always - be equal to calling getsockname() on the server's socket. Fixed by +- Bug #1531963: Make SocketServer.TCPServer's server_address always be + equal to calling getsockname() on the server's socket. Fixed by patch #1545011. - Patch #742598: Add .timeout attribute to SocketServer that calls @@ -1469,20 +1642,21 @@ - Patch #1481079: add support for HTTP_REFERER to CGIHTTPServer. -- Patch #1675424: Added tests for uncovered code in the zipfile module. - The KeyError raised by Zipfile.getinfo for nonexistent names now has - a descriptive message. +- Patch #1675424: Added tests for uncovered code in the zipfile + module. The KeyError raised by Zipfile.getinfo for nonexistent + names now has a descriptive message. - Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', ''). -- unittest now verifies more of its assumptions. In particular, TestCase - and TestSuite subclasses (not instances) are no longer accepted in - TestSuite.addTest(). This should cause no incompatibility since it - never made sense with ordinary subclasses -- the failure just occurred - later, with a more cumbersome exception. +- unittest now verifies more of its assumptions. In particular, + TestCase and TestSuite subclasses (not instances) are no longer + accepted in TestSuite.addTest(). This should cause no + incompatibility since it never made sense with ordinary subclasses + -- the failure just occurred later, with a more cumbersome + exception. -- Patch #787789: allow to pass custom TestRunner instances to unittest's - main() function. +- Patch #787789: allow to pass custom TestRunner instances to + unittest's main() function. - Patches #1550273, #1550272: fix a few bugs in unittest and add a comprehensive test suite for the module. @@ -1490,8 +1664,9 @@ - Patch #1001604: glob.glob() now returns unicode filenames if it was given a unicode argument and os.listdir() returns unicode filenames. -- Patch #1673619: setup.py identifies extension modules it doesn't know how - to build and those it knows how to build but that fail to build. +- Patch #1673619: setup.py identifies extension modules it doesn't + know how to build and those it knows how to build but that fail to + build. - Patch #912410: Replace HTML entity references for attribute values in HTMLParser. @@ -1509,8 +1684,8 @@ - Added itertools.izip_longest(). -- Have the encoding package's search function dynamically import using absolute - import semantics. +- Have the encoding package's search function dynamically import using + absolute import semantics. - Patch #1647484: Renamed GzipFile's filename attribute to name. @@ -1521,16 +1696,16 @@ - Patch #685268: Consider a package's __path__ in imputil. -- Patch 1463026: Support default namespace in XMLGenerator. +- Patch #1463026: Support default namespace in XMLGenerator. -- Patch 1571379: Make trace's --ignore-dir facility work in the face of - relative directory names. +- Patch #1571379: Make trace's --ignore-dir facility work in the face + of relative directory names. -- Bug #1600860: Search for shared python library in LIBDIR, - not lib/python/config, on "linux" and "gnu" systems. +- Bug #1600860: Search for shared python library in LIBDIR, not + lib/python/config, on "linux" and "gnu" systems. -- Patch #1652681: tarfile.py: create nonexistent files in append mode and - allow appending to empty files. +- Patch #1652681: tarfile.py: create nonexistent files in append mode + and allow appending to empty files. - Bug #1124861: Automatically create pipes if GetStdHandle fails in subprocess. @@ -1538,9 +1713,10 @@ - Patch #1634778: add missing encoding aliases for iso8859_15 and iso8859_16. -- Patch #1638243: the compiler package is now able to correctly compile - a with statement; previously, executing code containing a with statement - compiled by the compiler package crashed the interpreter. +- Patch #1638243: the compiler package is now able to correctly + compile a with statement; previously, executing code containing a + with statement compiled by the compiler package crashed the + interpreter. - Bug #1643943: Fix time.strptime's support for the %U directive. @@ -1549,7 +1725,8 @@ - Patch #1627441: close sockets properly in urllib2. -- Bug #494589: make ntpath.expandvars behave according to its docstring. +- Bug #494589: make ntpath.expandvars behave according to its + docstring. - Changed platform module API python_version_tuple() to actually return a tuple (it used to return a list). @@ -1559,8 +1736,8 @@ - Added support for IronPython and Jython to the platform module. -- The sets module has been deprecated. Use the built-in set/frozenset types - instead. +- The sets module has been deprecated. Use the built-in set/frozenset + types instead. - Bug #1610795: make ctypes.util.find_library work on BSD systems. @@ -1580,53 +1757,56 @@ - Bug #411881: logging.handlers: bare except clause removed from SocketHandler.createSocket. Now, only socket.error is trapped. -- Bug #411881: logging: bare except clause removed from LogRecord.__init__. - Now, only ValueError, TypeError and AttributeError are trapped. +- Bug #411881: logging: bare except clause removed from + LogRecord.__init__. Now, only ValueError, TypeError and + AttributeError are trapped. -- Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument. +- Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj + argument. - Patch #1182394 from Shane Holloway: speed up HMAC.hexdigest. -- Patch #1262036: Prevent TarFiles from being added to themselves under - certain conditions. +- Patch #1262036: Prevent TarFiles from being added to themselves + under certain conditions. -- Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell() - work correctly together with readline(). +- Patch #1230446: tarfile.py: fix ExFileObject so that read() and + tell() work correctly together with readline(). -- Patch #1484695: The tarfile module now raises a HeaderError exception - if a buffer given to frombuf() is invalid. +- Patch #1484695: The tarfile module now raises a HeaderError + exception if a buffer given to frombuf() is invalid. - Bug #1503765: Fix a problem in logging.config with spaces in comma- separated lists read from logging config files. -- Patch #1604907: Fix problems in logging.handlers caused at logging shutdown - when syslog handlers fail to initialize because of syslogd problems. +- Patch #1604907: Fix problems in logging.handlers caused at logging + shutdown when syslog handlers fail to initialize because of syslogd + problems. -- Patch #1608267: fix a race condition in os.makedirs() if the directory - to be created is already there. +- Patch #1608267: fix a race condition in os.makedirs() if the + directory to be created is already there. - Patch #1610437: fix a tarfile bug with long filename headers. -- Patch #1371075: Make ConfigParser accept optional dict type - for ordering, sorting, etc. +- Patch #1371075: Make ConfigParser accept optional dict type for + ordering, sorting, etc. - Bug #1563807: _ctypes built on AIX fails with ld ffi error. - Bug #1598620: A ctypes Structure cannot contain itself. -- Patch #1070046: Marshal new-style objects like InstanceType - in xmlrpclib. +- Patch #1070046: Marshal new-style objects like InstanceType in + xmlrpclib. - cStringIO.truncate(-1) now raises an IOError, like StringIO and regular files. - Patch #1472877: Fix Tix subwidget name resolution. -- Patch #1594554: Always close a tkSimpleDialog on ok(), even - if an exception occurs. +- Patch #1594554: Always close a tkSimpleDialog on ok(), even if an + exception occurs. -- Patch #1538878: Don't make tkSimpleDialog dialogs transient if - the parent window is withdrawn. +- Patch #1538878: Don't make tkSimpleDialog dialogs transient if the + parent window is withdrawn. - Bug #1597824: return the registered function from atexit.register() to facilitate usage as a decorator. @@ -1634,8 +1814,8 @@ - Patch #1360200: Use unmangled_version RPM spec field to deal with file name mangling. -- Patch #1359217: Process 2xx response in an ftplib transfer - that precedes an 1xx response. +- Patch #1359217: Process 2xx response in an ftplib transfer that + precedes an 1xx response. - Patch #1355023: support whence argument for GzipFile.seek. @@ -1646,13 +1826,13 @@ weren't passing the message factory on to newly created Maildir/MH objects. -- Patch #1514543: mailbox.py: In the Maildir class, report errors if there's - a filename clash instead of possibly losing a message. (Patch by David - Watson.) - -- Patch #1514544: Try to ensure that messages/indexes have been physically - written to disk after calling .flush() or .close(). (Patch by David - Watson.) +- Patch #1514543: mailbox.py: In the Maildir class, report errors if + there's a filename clash instead of possibly losing a message. + (Patch by David Watson.) + +- Patch #1514544: Try to ensure that messages/indexes have been + physically written to disk after calling .flush() or + .close(). (Patch by David Watson.) - Patch #1592250: Add elide argument to Tkinter.Text.search. @@ -1681,29 +1861,29 @@ - Patch #1567274: Support SMTP over TLS. -- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that - ctypes isn't considered as requiring executable stacks. +- Patch #1560695: Add .note.GNU-stack to ctypes' sysv.S so that ctypes + isn't considered as requiring executable stacks. - ctypes callback functions only support 'fundamental' data types as result type. Raise an error when something else is used. This is a partial fix for Bug #1574584. -- Fix turtle so that time.sleep is imported for the entire library. Allows - the demo2 function to be executed on its own instead of only when the - module is run as a script. +- Fix turtle so that time.sleep is imported for the entire library. + Allows the demo2 function to be executed on its own instead of only + when the module is run as a script. -- Bug #813342: Start the IDLE subprocess with -Qnew if the parent - is started with that option. +- Bug #813342: Start the IDLE subprocess with -Qnew if the parent is + started with that option. - Bug #1565150: Fix subsecond processing for os.utime on Windows. - Support for MSVC 8 was added to bdist_wininst. -- Bug #1446043: correctly raise a LookupError if an encoding name given - to encodings.search_function() contains a dot. +- Bug #1446043: correctly raise a LookupError if an encoding name + given to encodings.search_function() contains a dot. -- Bug #1560617: in pyclbr, return full module name not only for classes, - but also for functions. +- Bug #1560617: in pyclbr, return full module name not only for + classes, but also for functions. - Bug #1457823: cgi.(Sv)FormContentDict's constructor now takes keep_blank_values and strict_parsing keyword arguments. @@ -1714,127 +1894,139 @@ - Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. -- Made the error message for time.strptime when the data data and format do - match be more clear. +- Made the error message for time.strptime when the data data and + format do match be more clear. - Fix a bug in traceback.format_exception_only() that led to an error being raised when print_exc() was called without an exception set. In version 2.4, this printed "None", restored that behavior. -- Make webbrowser.BackgroundBrowser usable in Windows (it wasn't because - the close_fds arg to subprocess.Popen is not supported). +- Make webbrowser.BackgroundBrowser usable in Windows (it wasn't + because the close_fds arg to subprocess.Popen is not supported). -- Reverted patch #1504333 to sgmllib because it introduced an infinite loop. +- Reverted patch #1504333 to sgmllib because it introduced an infinite + loop. -- Patch #1553314: Fix the inspect.py slowdown that was hurting IPython & SAGE - by adding smarter caching in inspect.getmodule() +- Patch #1553314: Fix the inspect.py slowdown that was hurting IPython + & SAGE by adding smarter caching in inspect.getmodule() - Fix missing import of the types module in logging.config. - Patch #1550886: Fix decimal module context management implementation to match the localcontext() example from PEP 343. -- Bug #1545341: The 'classifier' keyword argument to the Distutils setup() - function now accepts tuples as well as lists. +- Bug #1545341: The 'classifier' keyword argument to the Distutils + setup() function now accepts tuples as well as lists. -- Bug #1541863: uuid.uuid1 failed to generate unique identifiers - on systems with low clock resolution. +- Bug #1541863: uuid.uuid1 failed to generate unique identifiers on + systems with low clock resolution. - Bug #1531862: Do not close standard file descriptors in subprocess. -- idle: Honor the "Cancel" action in the save dialog (Debian bug #299092). - -- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the - first chunk fed to the decoder started with a BOM, but was longer than 3 - bytes. - -- The implementation of UnicodeError objects has been simplified (start and end - attributes are now stored directly as Py_ssize_t members). +- idle: Honor the "Cancel" action in the save dialog (Debian bug + #299092). -- Issue829951: In the smtplib module, SMTP.starttls() now complies with - RFC 3207 and forgets any knowledge obtained from the server not obtained - from the TLS negotiation itself. Patch contributed by Bill Fenner. +- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when + the first chunk fed to the decoder started with a BOM, but was + longer than 3 bytes. + +- The implementation of UnicodeError objects has been simplified + (start and end attributes are now stored directly as Py_ssize_t + members). + +- Issue #829951: In the smtplib module, SMTP.starttls() now complies + with RFC 3207 and forgets any knowledge obtained from the server not + obtained from the TLS negotiation itself. Patch contributed by Bill + Fenner. -- Issue1339: The smtplib.SMTP class has been refactored a bit such +- Issue #1339: The smtplib.SMTP class has been refactored a bit such that the SMTP.starttls() caller no longer needs to call ehlo() beforehand. SMTP.starttls() now raises an exception of the server - does not claim to support starttls. Adds the SMTP.ehlo_or_helo_if_needed() - method. Patch contributed by Bill Fenner. + does not claim to support starttls. Adds the + SMTP.ehlo_or_helo_if_needed() method. Patch contributed by Bill + Fenner. -- Patch #1089358: Add signal.siginterrupt, a wrapper around siginterrupt(3). +- Patch #1089358: Add signal.siginterrupt, a wrapper around + siginterrupt(3). Extension Modules ----------------- -- Patch #1657: added select.epoll and select.kqueue +- Patch #1657: added select.epoll and select.kqueue. - Patch #1506171: added operator.methodcaller(). - Patch #1826: operator.attrgetter() now supports dotted attribute paths. -- Patch #1957: syslogmodule: Release GIL when calling syslog(3) +- Patch #1957: syslogmodule: Release GIL when calling syslog(3). -- #2112: mmap.error is now a subclass of EnvironmentError and not a - direct EnvironmentError +- Bug #2112: mmap.error is now a subclass of EnvironmentError and not + a direct EnvironmentError. -- Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ +- Bug #2111: mmap segfaults when trying to write a block opened with + PROT_READ. -- #2063: correct order of utime and stime in os.times() result on Windows. +- Bug #2063: correct order of utime and stime in os.times() result on + Windows. - Patch #1736: Fix file name handling of _msi.FCICreate. - Updated ``big5hkscs`` codec to the HKSCS revision of 2004. -- #1940: make it possible to use curses.filter() before curses.initscr() - as the documentation says. +- Issue #1940: make it possible to use curses.filter() before + curses.initscr() as the documentation says. - Backport of _fileio module from Python 3.0. -- #1087741: mmap.mmap is now a class, not a factory function. It is also - subclassable now. +- Patch #1087741: mmap.mmap is now a class, not a factory function. It + is also subclassable now. - Patch #1648: added ``sys.getprofile()`` and ``sys.gettrace()``. -- Patch #1663329: added ``os.closerange()`` function to quickly close a range - of file descriptors without considering errors. +- Patch #1663329: added ``os.closerange()`` function to quickly close + a range of file descriptors without considering errors. -- Patch 976880: ``mmap`` objects now have an ``rfind`` method that +- Patch #976880: ``mmap`` objects now have an ``rfind`` method that works as expected. ``mmap.find`` also takes an optional ``end`` parameter. -- _winreg's HKEY object has gained __enter__ and __exit__ methods to support - the context manager protocol. The _winreg module also gained a new function - ``ExpandEnvironmentStrings`` to expand REG_EXPAND_SZ keys. +- _winreg's HKEY object has gained __enter__ and __exit__ methods to + support the context manager protocol. The _winreg module also + gained a new function ``ExpandEnvironmentStrings`` to expand + REG_EXPAND_SZ keys. + +- itertools.starmap() now accepts any iterable input. Previously, it + required the function inputs to be tuples. + +- itertools.chain() now has an alternate constructor, + chain.from_iterable(). + +- Issue #1646: Make socket support TIPC. The socket module now has + support for TIPC under Linux, see http://tipc.sf.net/ for more + information. -- itertools.starmap() now accepts any iterable input. Previously, it required - the function inputs to be tuples. - -- itertools.chain() now has an alternate constructor, chain.from_iterable(). - -- Issue #1646: Make socket support TIPC. The socket module now has support - for TIPC under Linux, see http://tipc.sf.net/ for more information. - -- Added interface for Windows' WSAIoctl to socket object and added an example - for a simple network sniffer. +- Added interface for Windows' WSAIoctl to socket object and added an + example for a simple network sniffer. - Bug #1301: Bad assert in _tkinter fixed. - Added bdist_wininst executable for VS 2008. -- Bug #1604: collections.deque.__init__(iterable) now clears any prior contents - before adding elements from the iterable. This fix brings the behavior into - line with that for list.__init__(). +- Bug #1604: collections.deque.__init__(iterable) now clears any prior + contents before adding elements from the iterable. This fix brings + the behavior into line with that for list.__init__(). -- Added wide char functions to msvcrt module: getwch, getwche, putwch and - ungetwch. The functions accept or return unicode. +- Added wide char functions to msvcrt module: getwch, getwche, putwch + and ungetwch. The functions accept or return unicode. - os.access now returns True on Windows for any existing directory. - Added warnpy3k function to the warnings module. -- Marshal.dumps() now expects exact type matches for int, long, float, complex, - tuple, list, dict, set, and frozenset. Formerly, it would silently miscode - subclasses of those types. Now, it raises a ValueError instead. +- Marshal.dumps() now expects exact type matches for int, long, float, + complex, tuple, list, dict, set, and frozenset. Formerly, it would + silently miscode subclasses of those types. Now, it raises a + ValueError instead. - Patch #1388440: Add set_completion_display_matches_hook and get_completion_type to readline. @@ -1850,21 +2042,22 @@ intended for RECNO databases. - pybsddb.sf.net Bug #477182: Load the database flags at database open - time so that opening a database previously created with the DB_DUP or - DB_DUPSORT flag set will keep the proper behavior on subsequent opens. - Specifically: dictionary assignment to a DB object will replace all - values for a given key when the database allows duplicate values. - DB users should use DB.put(k, v) when they want to store duplicates; not - DB[k] = v. + time so that opening a database previously created with the DB_DUP + or DB_DUPSORT flag set will keep the proper behavior on subsequent + opens. Specifically: dictionary assignment to a DB object will + replace all values for a given key when the database allows + duplicate values. DB users should use DB.put(k, v) when they want + to store duplicates; not DB[k] = v. - Add the bsddb.db.DBEnv.lock_id_free method. - Bug #1686475: Support stat'ing open files on Windows again. -- Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters - with ASCII value less than 32. Also, it correctly quotes dots only if - they occur on a single line, as opposed to the previous behavior of - quoting dots if they are the second character of any line. +- Patch #1185447: binascii.b2a_qp() now correctly quotes binary + characters with ASCII value less than 32. Also, it correctly quotes + dots only if they occur on a single line, as opposed to the previous + behavior of quoting dots if they are the second character of any + line. - Bug #1622896: fix a rare corner case where the bz2 module raised an error in spite of a succesful compression. @@ -1875,8 +2068,9 @@ - Patch #1646728: datetime.fromtimestamp fails with negative fractional times. With unittest. -- Patch #1490190: posixmodule now includes os.chflags() and os.lchflags() - functions on platforms where the underlying system calls are available. +- Patch #1490190: posixmodule now includes os.chflags() and + os.lchflags() functions on platforms where the underlying system + calls are available. - Patch #1494140: Add documentation for the new struct.Struct object. @@ -1886,20 +2080,21 @@ - Bug #1653736: Complain about keyword arguments to time.isoformat. -- Bug #1486663: don't reject keyword arguments for subclasses of builtin - types. +- Bug #1486663: don't reject keyword arguments for subclasses of + builtin types. -- Patch #1610575: The struct module now supports the 't' code, for - C99 _Bool. +- Patch #1610575: The struct module now supports the 't' code, for C99 + _Bool. -- Patch #1635058: ensure that htonl and friends never accept or - return negative numbers, per the underlying C implementation. +- Patch #1635058: ensure that htonl and friends never accept or return + negative numbers, per the underlying C implementation. - Patch #1544279: Improve thread-safety of the socket module by moving the sock_addr_t storage out of the socket object. -- Patch #1019808: fix bug that causes an incorrect error to be returned - when a socket timeout is set and a connection attempt fails. +- Patch #1019808: fix bug that causes an incorrect error to be + returned when a socket timeout is set and a connection attempt + fails. - Speed up function calls into the math module. @@ -1925,19 +2120,21 @@ - RLIMIT_SBSIZE was added to the resource module where available. -- Bug #1551427: fix a wrong NULL pointer check in the win32 version - of os.urandom(). +- Bug #1551427: fix a wrong NULL pointer check in the win32 version of + os.urandom(). - Bug #1548092: fix curses.tparm seg fault on invalid input. - Patch #1114: fix curses module compilation on 64-bit AIX, & possibly - other 64-bit LP64 platforms where attr_t is not the same size as a long. - (Contributed by Luke Mewburn.) + other 64-bit LP64 platforms where attr_t is not the same size as a + long. (Contributed by Luke Mewburn.) -- Bug #1550714: fix SystemError from itertools.tee on negative value for n. +- Bug #1550714: fix SystemError from itertools.tee on negative value + for n. - Fixed a few bugs on cjkcodecs: - - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly. + - gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT + correctly. - iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312 codepoints to conform the standard. - iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 0213:2 @@ -1954,8 +2151,9 @@ - Added support for linking the bsddb module against BerkeleyDB 4.5.x and 4.6.x. -- Bug #1633621: if curses.resizeterm() or curses.resize_term() is called, - update _curses.LINES, _curses.COLS, curses.LINES and curses.COLS. +- Bug #1633621: if curses.resizeterm() or curses.resize_term() is + called, update _curses.LINES, _curses.COLS, curses.LINES and + curses.COLS. - Fix an off-by-one bug in locale.strxfrm(). @@ -1975,26 +2173,28 @@ - Refactor test_logging to use unittest. -- Refactor test_profile and test_cprofile to use the same code to profile. +- Refactor test_profile and test_cprofile to use the same code to + profile. -- Make test_runpy reentrant by fixing _check_module to clear out any module - being tested. Was causing an error by __import__ doing a reload on the - second run and thus suppressing bytecode recreation. +- Make test_runpy reentrant by fixing _check_module to clear out any + module being tested. Was causing an error by __import__ doing a + reload on the second run and thus suppressing bytecode recreation. - Capture socket connection resets and timeouts in test_socket_ssl and test_urllib2net and raise test.test_support.ResourceDenied. -- Patch #1559413: Fix test_cmd_line if sys.executable contains a space. +- Patch #1559413: Fix test_cmd_line if sys.executable contains a + space. -- Added test.test_support.TransientResource which is a context manager to - surround calls to resources that are not guaranteed to work even if - test.test_support.requires says that the resource should exist. +- Added test.test_support.TransientResource which is a context manager + to surround calls to resources that are not guaranteed to work even + if test.test_support.requires says that the resource should exist. - Added a test for slicing of an exception. -- Added test.test_support.EnvironmentVarGuard. It's a class that provides a - context manager so that one can temporarily set or unset environment - variables. +- Added test.test_support.EnvironmentVarGuard. It's a class that + provides a context manager so that one can temporarily set or unset + environment variables. - Added some tests for modulefinder. @@ -2003,34 +2203,33 @@ - Fix bsddb test_basics.test06_Transactions to check the version number properly. -- test.test_support.catch_warning is a new context manager that can be used - to catch the warnings issued by the warning framework. - +- test.test_support.catch_warning is a new context manager that can be + used to catch the warnings issued by the warning framework. Tools ----- -- Tools/scripts/reindent.py now creates the backup file using shutil.copy - to preserve user/group and permissions. Added also a --nobackup option - to not create the backup if the user is concerned regarding this. Check - issue 1050828 for more details. - -- Tools/scripts/win_add2path.py was added. The simple script modifes the - PATH environment var of the HKCU tree and adds the python bin and script - directory. +- Tools/scripts/reindent.py now creates the backup file using + shutil.copy to preserve user/group and permissions. Added also a + --nobackup option to not create the backup if the user is concerned + regarding this. Check issue 1050828 for more details. + +- Tools/scripts/win_add2path.py was added. The simple script modifes + the PATH environment var of the HKCU tree and adds the python bin + and script directory. - Tools/18n/pygettext.py was added to the list of scripts installed by Tools/scripts/setup.py (tracker item 642309). -- Added IronPython and Jython support to pybench (part of which - was patch #1563844) +- Added IronPython and Jython support to pybench (part of which was + patch #1563844). -- Made some minor changes to pybench output to allow the user - to see which Python version is running pybench +- Made some minor changes to pybench output to allow the user to see + which Python version is running pybench. - Added support for the new platform module feature - platform.python_implementation(); this will now be saved - in the benchmark pickle + platform.python_implementation(); this will now be saved in the + benchmark pickle. Documentation @@ -2039,8 +2238,9 @@ - RFE #1765140: Updated documentation on FileHandler and subclasses to include new optional delay argument. -- Bug #932563: Added section on getting contextual information into logging - output, and added documentation for the new LoggerAdapter class. +- Bug #932563: Added section on getting contextual information into + logging output, and added documentation for the new LoggerAdapter + class. - Bug #1295: Added information about caching of formatted exception information in the LogRecord by Formatter.format(). @@ -2050,8 +2250,8 @@ - Patch #1698768: updated the "using Python on the Mac" intro. -- Bug #1569057: Document that calling file.next() when the file is open for - writing is undefined. +- Bug #1569057: Document that calling file.next() when the file is + open for writing is undefined. - Patch #1489771: the syntax rules in Python Reference Manual were updated to reflect the current Python syntax. @@ -2078,8 +2278,9 @@ - Bug #1566663: remove obsolete example from datetime docs. - Bug #1541682: Fix example in the "Refcount details" API docs. - Additionally, remove a faulty example showing PySequence_SetItem applied - to a newly created list object and add notes that this isn't a good idea. + Additionally, remove a faulty example showing PySequence_SetItem + applied to a newly created list object and add notes that this isn't + a good idea. Tools/Demos @@ -2088,8 +2289,8 @@ - Patch #1552024: add decorator support to unparse.py demo script. - Make auto-generated python.vim file list built-ins and exceptions in - alphatbetical order. Makes output more deterministic and easier to tell if - the file is stale or not. + alphatbetical order. Makes output more deterministic and easier to + tell if the file is stale or not. - Bug #1546372: Fixed small bugglet in pybench that caused a missing file not to get reported properly. @@ -2098,23 +2299,24 @@ Build ----- -- Have the search path for building extensions follow the declared order in - $CPPFLAGS and $LDFLAGS when adding directories from those environment - variables. +- Have the search path for building extensions follow the declared + order in $CPPFLAGS and $LDFLAGS when adding directories from those + environment variables. - Bug #1983: Added a check to pyport to verify that sizeof(pid_t) is smaller or equal sizeof(long). - Bug #1234: Fixed semaphore errors on AIX 5.2 -- Issue #1726: Remove Python/atof.c from PCBuild/pythoncore.vcproj +- Issue #1726: Remove Python/atof.c from PCBuild/pythoncore.vcproj. -- Removed PCbuild8/ directory and added a new build directory for VS 2005 - based on the VS 2008 build directory to PC/VS8.0. The script - PCbuild/vs8to9.py was added to sync changes from PCbuild to PC/VS8.0. +- Removed PCbuild8/ directory and added a new build directory for VS + 2005 based on the VS 2008 build directory to PC/VS8.0. The script + PCbuild/vs8to9.py was added to sync changes from PCbuild to + PC/VS8.0. -- Moved PCbuild/ directory for VS 2003 to PC/VS7.1 and renamed PCBuild9/ - directory to PCBuild/. +- Moved PCbuild/ directory for VS 2003 to PC/VS7.1 and renamed + PCBuild9/ directory to PCBuild/. - Bug #1699: Define _BSD_SOURCE only on OpenBSD. @@ -2125,20 +2327,22 @@ - Patch #1418: Make the AC_REPLACE_FUNCS object files actually work. - Add a FAST_LOOPS build option that speeds-up looping by trading away - periodic threadstate and signal checking in tight loops. By default, - this option is turned-off. It should only be enabled in debugged, - performance critical applications. + periodic threadstate and signal checking in tight loops. By + default, this option is turned-off. It should only be enabled in + debugged, performance critical applications. -- Patch #786737: Allow building in a tree of symlinks pointing to - a readonly source. +- Patch #786737: Allow building in a tree of symlinks pointing to a + readonly source. - Bug #1737210: Change Manufacturer of Windows installer to PSF. - Bug #1746880: Correctly install DLLs into system32 folder on Win64. -- Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD 4.1+. +- Define _BSD_SOURCE, to get access to POSIX extensions on OpenBSD + 4.1+. -- Stop supporting AtheOS and cause a build error in configure for the platform. +- Stop supporting AtheOS and cause a build error in configure for the + platform. - Bug #1655392: don't add -L/usr/lib/pythonX.Y/config to the LDFLAGS returned by python-config if Python was built with --enable-shared @@ -2151,18 +2355,18 @@ - Disable _XOPEN_SOURCE on NetBSD 1.x. -- configure now checks whether gcc supports the PyArg_ParseTuple format - attribute. +- configure now checks whether gcc supports the PyArg_ParseTuple + format attribute. - Bug #1578513: Cross compilation was broken by a change to configure. Repair so that it's back to how it was in 2.4.3. -- Patch #1576954: Update VC6 build directory; remove redundant - files in VC7. +- Patch #1576954: Update VC6 build directory; remove redundant files + in VC7. - Bug #1568842: Fix test for uintptr_t. -- Patch #1540470, for OpenBSD 4.0. +- Patch #1540470: for OpenBSD 4.0. - Fix build failure on kfreebsd and on the hurd. @@ -2170,45 +2374,48 @@ - Allow Emacs 22 for building the documentation in info format. -- Makefile.pre.in(buildbottest): Run an optional script pybuildbot.identify - to include some information about the build environment. +- Makefile.pre.in(buildbottest): Run an optional script + pybuildbot.identify to include some information about the build + environment. C API ----- -- Unified naming convention for free lists and their limits. All free lists - in Object/ are named ``free_list``, the counter ``numfree`` and the upper - limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. - -- ``PySet_Add()`` can now modify a newly created frozenset. Similarly to - ``PyTuple_SetItem``, it can be used to populate a brand new frozenset; but - it does not steal a reference to the added item. +- Unified naming convention for free lists and their limits. All free + lists in Object/ are named ``free_list``, the counter ``numfree`` + and the upper limit is a macro ``PyName_MAXFREELIST`` inside an + #ifndef block. + +- ``PySet_Add()`` can now modify a newly created frozenset. Similarly + to ``PyTuple_SetItem``, it can be used to populate a brand new + frozenset; but it does not steal a reference to the added item. - Added ``PySet_Check()`` and ``PyFrozenSet_Check()`` to the set API. -- Backport of PyUnicode_FromString(), _FromStringAndSize(), _Format and - _FormatV from Python 3.0. Made PyLong_AsSsize_t and PyLong_FromSsize_t - public functions. +- Backport of PyUnicode_FromString(), _FromStringAndSize(), _Format + and _FormatV from Python 3.0. Made PyLong_AsSsize_t and + PyLong_FromSsize_t public functions. - Patch #1720595: add T_BOOL to the range of structmember types. - Issue #1534: Added ``PyFloat_GetMax()``, ``PyFloat_GetMin()`` and ``PyFloat_GetInfo()`` to the float API. -- Issue #1521: On 64bit platforms, using PyArgs_ParseTuple with the t# of w# - format code incorrectly truncated the length to an int, even when - PY_SSIZE_T_CLEAN is set. The str.decode method used to return incorrect - results with huge strings. - -- Issue #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE - and Py_REFCNT. - -- PEP 3123: Provide forward compatibility with Python 3.0, while keeping - backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and - PyVarObject_HEAD_INIT. +- Issue #1521: On 64bit platforms, using PyArgs_ParseTuple with the t# + of w# format code incorrectly truncated the length to an int, even + when PY_SSIZE_T_CLEAN is set. The str.decode method used to return + incorrect results with huge strings. + +- Issue #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, + Py_TYPE and Py_REFCNT. + +- PEP 3123: Provide forward compatibility with Python 3.0, while + keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, + and PyVarObject_HEAD_INIT. -- Py_ssize_t fields work in structmember when HAVE_LONG_LONG is not defined. +- Py_ssize_t fields work in structmember when HAVE_LONG_LONG is not + defined. - Patch #1733960: Allow T_LONGLONG to accept ints. @@ -2224,26 +2431,27 @@ - Make _PyGILState_NoteThreadState() static, it was not used anywhere outside of pystate.c and should not be necessary. -- ``PyImport_Import`` and ``PyImport_ImportModule`` now always do absolute - imports. In earlier versions they might have used relative imports under - some conditions. +- ``PyImport_Import`` and ``PyImport_ImportModule`` now always do + absolute imports. In earlier versions they might have used relative + imports under some conditions. -- Added case insensitive comparison methods ``PyOS_stricmp(char*, char*)`` - and ``PyOS_strnicmp(char*, char*, Py_ssize_t)``. +- Added case insensitive comparison methods ``PyOS_stricmp(char*, + char*)`` and ``PyOS_strnicmp(char*, char*, Py_ssize_t)``. -- Bug #1542693: remove semi-colon at end of PyImport_ImportModuleEx macro - so it can be used as an expression. +- Bug #1542693: remove semi-colon at end of PyImport_ImportModuleEx + macro so it can be used as an expression. Windows ------- -- Patch #1706: Drop support for Win9x, WinME and NT4. Python now requires - Windows 2000 or greater. The _WINVER and NTDDI_VERSION macros are set to - Win2k for x86/32bit builds and WinXP for AMD64 builds. +- Patch #1706: Drop support for Win9x, WinME and NT4. Python now + requires Windows 2000 or greater. The _WINVER and NTDDI_VERSION + macros are set to Win2k for x86/32bit builds and WinXP for AMD64 + builds. -- Conditionalize definition of _CRT_SECURE_NO_DEPRECATE - and _CRT_NONSTDC_NO_DEPRECATE. +- Conditionalize definition of _CRT_SECURE_NO_DEPRECATE and + _CRT_NONSTDC_NO_DEPRECATE. - Bug #1216: Restore support for Visual Studio 2002. @@ -2255,9 +2463,9 @@ - buildtools now raises a DeprecationWarning. -- Removed the macfs module. It had been deprecated since Python 2.5. This - lead to the deprecation of macostools.touched() as it relied solely on macfs - and was a no-op under OS X. +- Removed the macfs module. It had been deprecated since Python 2.5. + This lead to the deprecation of macostools.touched() as it relied + solely on macfs and was a no-op under OS X. ---- Modified: python/branches/okkoto-sizeof/Misc/build.sh ============================================================================== --- python/branches/okkoto-sizeof/Misc/build.sh (original) +++ python/branches/okkoto-sizeof/Misc/build.sh Wed Jun 4 11:24:23 2008 @@ -67,7 +67,7 @@ # Note: test_XXX (none currently) really leak, but are disabled # so we don't send spam. Any test which really leaks should only # be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(asynchat|cmd_line|popen2|socket|smtplib|sys|threadsignals|urllib2_localnet)" +LEAKY_TESTS="test_(asynchat|cmd_line|popen2|socket|smtplib|sys|threadsignals|urllib2_localnet|httpservers)" # Skip these tests altogether when looking for leaks. These tests # do not need to be stored above in LEAKY_TESTS too. Modified: python/branches/okkoto-sizeof/Misc/cheatsheet ============================================================================== --- python/branches/okkoto-sizeof/Misc/cheatsheet (original) +++ python/branches/okkoto-sizeof/Misc/cheatsheet Wed Jun 4 11:24:23 2008 @@ -1044,7 +1044,7 @@ super(type) Create an unbound super object. Used to call cooperative superclass methods. sum(sequence, Add the values in the sequence and return the sum. - [start]) + [start]) tuple(sequence) Creates a tuple with same elements as sequence. If already a tuple, return itself (not a copy). Returns a type object [see module types] representing @@ -1973,7 +1973,7 @@ sys.path. smtplib SMTP Client class (RFC 821) sndhdr Several routines that help recognizing sound. -socketserver Generic socket server classes. +SocketServer Generic socket server classes. stat Constants and functions for interpreting stat/lstat struct. statcache Maintain a cache of file stats. statvfs Constants for interpreting statvfs struct as returned by Modified: python/branches/okkoto-sizeof/Misc/developers.txt ============================================================================== --- python/branches/okkoto-sizeof/Misc/developers.txt (original) +++ python/branches/okkoto-sizeof/Misc/developers.txt Wed Jun 4 11:24:23 2008 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Robert Schuppenies was given SVN access on 21 May 2008 by MvL, + for GSoC contributions. + - Rodrigo Bernardo Pimentel was given SVN access on 29 April 2008 by MvL, for GSoC contributions. Modified: python/branches/okkoto-sizeof/Modules/_bsddb.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_bsddb.c (original) +++ python/branches/okkoto-sizeof/Modules/_bsddb.c Wed Jun 4 11:24:23 2008 @@ -50,7 +50,7 @@ * * Gregory P. Smith was once again the maintainer. * - * Since January 2008, new maintainer is Jesus Cea . + * Since January 2008, new maintainer is Jesus Cea . * Jesus Cea licenses this code to PSF under a Contributor Agreement. * * Use the pybsddb-users at lists.sf.net mailing list for all questions. @@ -104,6 +104,17 @@ typedef int Py_ssize_t; #endif +#if (PY_VERSION_HEX < 0x02060000) /* really: before python trunk r63675 */ +/* This code now uses PyBytes* API function names instead of PyString*. + * These #defines map to their equivalent on earlier python versions. */ +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_FromString PyString_FromString +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define PyBytes_Check PyString_Check +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define PyBytes_AS_STRING PyString_AS_STRING +#endif + #ifdef WITH_THREAD /* These are for when calling Python --> C */ @@ -398,7 +409,7 @@ /* no need to do anything, the structure has already been zeroed */ } - else if (PyString_Check(keyobj)) { + else if (PyBytes_Check(keyobj)) { /* verify access method type */ type = _DB_get_type(self); if (type == -1) @@ -417,15 +428,15 @@ * the code check for DB_THREAD and forceably set DBT_MALLOC * when we otherwise would leave flags 0 to indicate that. */ - key->data = malloc(PyString_GET_SIZE(keyobj)); + key->data = malloc(PyBytes_GET_SIZE(keyobj)); if (key->data == NULL) { PyErr_SetString(PyExc_MemoryError, "Key memory allocation failed"); return 0; } - memcpy(key->data, PyString_AS_STRING(keyobj), - PyString_GET_SIZE(keyobj)); + memcpy(key->data, PyBytes_AS_STRING(keyobj), + PyBytes_GET_SIZE(keyobj)); key->flags = DB_DBT_REALLOC; - key->size = PyString_GET_SIZE(keyobj); + key->size = PyBytes_GET_SIZE(keyobj); } else if (PyInt_Check(keyobj)) { @@ -535,7 +546,7 @@ p=DummyString; assert(s==0); } - return PyString_FromStringAndSize(p,s); + return PyBytes_FromStringAndSize(p,s); } static PyObject *BuildValue_S(const void *p,int s) @@ -903,7 +914,7 @@ Py_DECREF(self->myenvobj); self->myenvobj = NULL; } - PyObject_Del(self); + Py_DECREF(self); self = NULL; } return self; @@ -1010,7 +1021,7 @@ err = db_env_create(&self->db_env, flags); MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - PyObject_Del(self); + Py_DECREF(self); self = NULL; } else { @@ -1050,20 +1061,27 @@ newDBTxnObject(DBEnvObject* myenv, DBTxnObject *parent, DB_TXN *txn, int flags) { int err; - DB_TXN *parent_txn=NULL; + DB_TXN *parent_txn = NULL; DBTxnObject* self = PyObject_New(DBTxnObject, &DBTxn_Type); if (self == NULL) return NULL; self->in_weakreflist = NULL; + self->children_txns = NULL; + self->children_dbs = NULL; + self->children_cursors = NULL; + self->children_sequences = NULL; + self->flag_prepare = 0; + self->parent_txn = NULL; + self->env = NULL; if (parent && ((PyObject *)parent!=Py_None)) { - parent_txn=parent->txn; + parent_txn = parent->txn; } if (txn) { - self->txn=txn; + self->txn = txn; } else { MYDB_BEGIN_ALLOW_THREADS; #if (DBVER >= 40) @@ -1074,29 +1092,24 @@ MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - PyObject_Del(self); + Py_DECREF(self); return NULL; } } - if (parent_txn) { /* Can't use 'parent' because could be 'parent==Py_None' */ - self->parent_txn=parent; + /* Can't use 'parent' because could be 'parent==Py_None' */ + if (parent_txn) { + self->parent_txn = parent; Py_INCREF(parent); self->env = NULL; - INSERT_IN_DOUBLE_LINKED_LIST(parent->children_txns,self); + INSERT_IN_DOUBLE_LINKED_LIST(parent->children_txns, self); } else { - self->parent_txn=NULL; + self->parent_txn = NULL; Py_INCREF(myenv); self->env = myenv; - INSERT_IN_DOUBLE_LINKED_LIST(myenv->children_txns,self); + INSERT_IN_DOUBLE_LINKED_LIST(myenv->children_txns, self); } - self->children_txns=NULL; - self->children_dbs=NULL; - self->children_cursors=NULL; - self->children_sequences=NULL; - self->flag_prepare=0; - return self; } @@ -1151,7 +1164,7 @@ #endif MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - PyObject_Del(self); + Py_DECREF(self); self = NULL; } @@ -1183,7 +1196,7 @@ self->mydb = mydb; INSERT_IN_DOUBLE_LINKED_LIST(self->mydb->children_sequences,self); - self->txn=NULL; + self->txn = NULL; self->in_weakreflist = NULL; @@ -1191,8 +1204,7 @@ err = db_sequence_create(&self->sequence, self->mydb->db, flags); MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { - Py_DECREF(self->mydb); - PyObject_Del(self); + Py_DECREF(self); self = NULL; } @@ -1290,12 +1302,12 @@ else if (PyInt_Check(result)) { retval = PyInt_AsLong(result); } - else if (PyString_Check(result)) { + else if (PyBytes_Check(result)) { char* data; Py_ssize_t size; CLEAR_DBT(*secKey); - PyString_AsStringAndSize(result, &data, &size); + PyBytes_AsStringAndSize(result, &data, &size); secKey->flags = DB_DBT_APPMALLOC; /* DB will free */ secKey->data = malloc(size); /* TODO, check this */ if (secKey->data) { @@ -4128,6 +4140,26 @@ } +#if (DBVER >= 47) +static PyObject* +DBEnv_log_set_config(DBEnvObject* self, PyObject* args) +{ + int err, flags, onoff; + + if (!PyArg_ParseTuple(args, "ii:log_set_config", + &flags, &onoff)) + return NULL; + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->log_set_config(self->db_env, flags, onoff); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif /* DBVER >= 47 */ + + static PyObject* DBEnv_set_data_dir(DBEnvObject* self, PyObject* args) { @@ -4391,7 +4423,7 @@ if (!retp) break; flags=DB_NEXT; /* Prepare for next loop pass */ for (i=0; i= 47) + MAKE_ENTRY(lock_wait); + MAKE_ENTRY(lock_nowait); +#else MAKE_ENTRY(locks_wait); MAKE_ENTRY(locks_nowait); +#endif MAKE_ENTRY(hash_len); #endif MAKE_ENTRY(regsize); @@ -4844,7 +4881,7 @@ if (log_list) { char **log_list_start; for (log_list_start = log_list; *log_list != NULL; ++log_list) { - item = PyString_FromString (*log_list); + item = PyBytes_FromString (*log_list); if (item == NULL) { Py_DECREF(list); list = NULL; @@ -4944,6 +4981,30 @@ #if (DBVER >= 40) static PyObject* +DBEnv_set_rpc_server(DBEnvObject* self, PyObject* args, PyObject* kwargs) +{ + int err; + char *host; + long cl_timeout=0, sv_timeout=0; + + static char* kwnames[] = { "host", "cl_timeout", "sv_timeout", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|ll:set_rpc_server", kwnames, + &host, &cl_timeout, &sv_timeout)) + return NULL; + CHECK_ENV_NOT_CLOSED(self); + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_rpc_server(self->db_env, NULL, host, cl_timeout, + sv_timeout, 0); + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif + +#if (DBVER >= 40) +static PyObject* DBEnv_set_verbose(DBEnvObject* self, PyObject* args) { int err; @@ -5074,7 +5135,11 @@ DBEnv_rep_get_nsites(DBEnvObject* self, PyObject* args) { int err; +#if (DBVER >= 47) + u_int32_t nsites; +#else int nsites; +#endif if (!PyArg_ParseTuple(args, ":rep_get_nsites")) { return NULL; @@ -5108,7 +5173,11 @@ DBEnv_rep_get_priority(DBEnvObject* self, PyObject* args) { int err; +#if (DBVER >= 47) + u_int32_t priority; +#else int priority; +#endif if (!PyArg_ParseTuple(args, ":rep_get_priority")) { return NULL; @@ -6093,6 +6162,9 @@ {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS}, +#if (DBVER >= 47) + {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS}, +#endif {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS}, {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS}, {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS}, @@ -6139,6 +6211,10 @@ {"txn_recover", (PyCFunction)DBEnv_txn_recover, METH_VARARGS}, #endif #if (DBVER >= 40) + {"set_rpc_server", (PyCFunction)DBEnv_set_rpc_server, + METH_VARARGS||METH_KEYWORDS}, +#endif +#if (DBVER >= 40) {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS}, #if (DBVER >= 42) {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, @@ -6231,7 +6307,7 @@ if (home == NULL) { RETURN_NONE(); } - return PyString_FromString(home); + return PyBytes_FromString(home); } return Py_FindMethod(DBEnv_methods, (PyObject* )self, name); @@ -6547,9 +6623,9 @@ { PyObject* m; PyObject* d; - PyObject* pybsddb_version_s = PyString_FromString( PY_BSDDB_VERSION ); - PyObject* db_version_s = PyString_FromString( DB_VERSION_STRING ); - PyObject* cvsid_s = PyString_FromString( rcs_id ); + PyObject* pybsddb_version_s = PyBytes_FromString( PY_BSDDB_VERSION ); + PyObject* db_version_s = PyBytes_FromString( DB_VERSION_STRING ); + PyObject* cvsid_s = PyBytes_FromString( rcs_id ); PyObject* py_api; /* Initialize the type of the new type objects here; doing it here @@ -6759,6 +6835,7 @@ #if (DBVER < 45) ADD_INT(d, DB_CACHED_COUNTS); #endif + #if (DBVER >= 41) _addIntToDict(d, "DB_CHECKPOINT", 0); #else @@ -6857,14 +6934,25 @@ ADD_INT(d, DB_TIME_NOTGRANTED); ADD_INT(d, DB_TXN_NOT_DURABLE); ADD_INT(d, DB_TXN_WRITE_NOSYNC); - ADD_INT(d, DB_LOG_AUTOREMOVE); - ADD_INT(d, DB_DIRECT_LOG); ADD_INT(d, DB_DIRECT_DB); ADD_INT(d, DB_INIT_REP); ADD_INT(d, DB_ENCRYPT); ADD_INT(d, DB_CHKSUM); #endif +#if (DBVER >= 42) && (DBVER < 47) + ADD_INT(d, DB_LOG_AUTOREMOVE); + ADD_INT(d, DB_DIRECT_LOG); +#endif + +#if (DBVER >= 47) + ADD_INT(d, DB_LOG_DIRECT); + ADD_INT(d, DB_LOG_DSYNC); + ADD_INT(d, DB_LOG_IN_MEMORY); + ADD_INT(d, DB_LOG_AUTO_REMOVE); + ADD_INT(d, DB_LOG_ZERO); +#endif + #if (DBVER >= 44) ADD_INT(d, DB_DSYNC_DB); #endif @@ -6934,14 +7022,17 @@ #endif #if (DBVER >= 43) - ADD_INT(d, DB_DSYNC_LOG); - ADD_INT(d, DB_LOG_INMEMORY); ADD_INT(d, DB_BUFFER_SMALL); ADD_INT(d, DB_SEQ_DEC); ADD_INT(d, DB_SEQ_INC); ADD_INT(d, DB_SEQ_WRAP); #endif +#if (DBVER >= 43) && (DBVER < 47) + ADD_INT(d, DB_LOG_INMEMORY); + ADD_INT(d, DB_DSYNC_LOG); +#endif + #if (DBVER >= 41) ADD_INT(d, DB_ENCRYPT_AES); ADD_INT(d, DB_AUTO_COMMIT); Modified: python/branches/okkoto-sizeof/Modules/_bytesio.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_bytesio.c (original) +++ python/branches/okkoto-sizeof/Modules/_bytesio.c Wed Jun 4 11:24:23 2008 @@ -175,7 +175,7 @@ bytesio_getvalue(BytesIOObject *self) { CHECK_CLOSED(self); - return PyString_FromStringAndSize(self->buf, self->string_size); + return PyBytes_FromStringAndSize(self->buf, self->string_size); } PyDoc_STRVAR(isatty_doc, @@ -244,7 +244,7 @@ output = self->buf + self->pos; self->pos += size; - return PyString_FromStringAndSize(output, size); + return PyBytes_FromStringAndSize(output, size); } @@ -307,7 +307,7 @@ self->pos -= size; } - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(readlines_doc, @@ -349,7 +349,7 @@ return NULL; while ((n = get_line(self, &output)) != 0) { - line = PyString_FromStringAndSize(output, n); + line = PyBytes_FromStringAndSize(output, n); if (!line) goto on_error; if (PyList_Append(result, line) == -1) { @@ -455,7 +455,7 @@ if (!next || n == 0) return NULL; - return PyString_FromStringAndSize(next, n); + return PyBytes_FromStringAndSize(next, n); } PyDoc_STRVAR(seek_doc, Modified: python/branches/okkoto-sizeof/Modules/_codecsmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_codecsmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_codecsmodule.c Wed Jun 4 11:24:23 2008 @@ -168,7 +168,7 @@ if (!PyArg_ParseTuple(args, "s#|z:escape_decode", &data, &size, &errors)) return NULL; - return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), + return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL), size); } @@ -182,21 +182,21 @@ Py_ssize_t len; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyString_Type, &str, &errors)) + &PyBytes_Type, &str, &errors)) return NULL; - str = PyString_Repr(str, 0); + str = PyBytes_Repr(str, 0); if (!str) return NULL; /* The string will be quoted. Unquote, similar to unicode-escape. */ - buf = PyString_AS_STRING (str); - len = PyString_GET_SIZE (str); + buf = PyBytes_AS_STRING (str); + len = PyBytes_GET_SIZE (str); memmove(buf, buf+1, len-2); - if (_PyString_Resize(&str, len-2) < 0) + if (_PyBytes_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyString_Size(str)); + return codec_tuple(str, PyBytes_Size(str)); } #ifdef Py_USING_UNICODE @@ -640,7 +640,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } @@ -656,7 +656,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } @@ -676,13 +676,13 @@ if (PyUnicode_Check(obj)) { data = PyUnicode_AS_DATA(obj); size = PyUnicode_GET_DATA_SIZE(obj); - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; - return codec_tuple(PyString_FromStringAndSize(data, size), + return codec_tuple(PyBytes_FromStringAndSize(data, size), size); } } Modified: python/branches/okkoto-sizeof/Modules/_collectionsmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_collectionsmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_collectionsmodule.c Wed Jun 4 11:24:23 2008 @@ -668,7 +668,7 @@ if (i != 0) { if (i < 0) return NULL; - return PyString_FromString("[...]"); + return PyBytes_FromString("[...]"); } aslist = PySequence_List(deque); @@ -677,16 +677,16 @@ return NULL; } if (((dequeobject *)deque)->maxlen != -1) - fmt = PyString_FromFormat("deque(%%r, maxlen=%i)", + fmt = PyBytes_FromFormat("deque(%%r, maxlen=%i)", ((dequeobject *)deque)->maxlen); else - fmt = PyString_FromString("deque(%r)"); + fmt = PyBytes_FromString("deque(%r)"); if (fmt == NULL) { Py_DECREF(aslist); Py_ReprLeave(deque); return NULL; } - result = PyString_Format(fmt, aslist); + result = PyBytes_Format(fmt, aslist); Py_DECREF(fmt); Py_DECREF(aslist); Py_ReprLeave(deque); @@ -1298,14 +1298,14 @@ if (baserepr == NULL) return NULL; if (dd->default_factory == NULL) - defrepr = PyString_FromString("None"); + defrepr = PyBytes_FromString("None"); else { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { if (status < 0) return NULL; - defrepr = PyString_FromString("..."); + defrepr = PyBytes_FromString("..."); } else defrepr = PyObject_Repr(dd->default_factory); @@ -1315,9 +1315,9 @@ Py_DECREF(baserepr); return NULL; } - result = PyString_FromFormat("defaultdict(%s, %s)", - PyString_AS_STRING(defrepr), - PyString_AS_STRING(baserepr)); + result = PyBytes_FromFormat("defaultdict(%s, %s)", + PyBytes_AS_STRING(defrepr), + PyBytes_AS_STRING(baserepr)); Py_DECREF(defrepr); Py_DECREF(baserepr); return result; Modified: python/branches/okkoto-sizeof/Modules/_csv.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_csv.c (original) +++ python/branches/okkoto-sizeof/Modules/_csv.c Wed Jun 4 11:24:23 2008 @@ -176,7 +176,7 @@ return Py_None; } else - return PyString_FromStringAndSize((char*)&c, 1); + return PyBytes_FromStringAndSize((char*)&c, 1); } static PyObject * @@ -235,16 +235,16 @@ if (src == NULL) *target = dflt; else { - if (src == Py_None || PyString_Size(src) == 0) + if (src == Py_None || PyBytes_Size(src) == 0) *target = '\0'; - else if (!PyString_Check(src) || PyString_Size(src) != 1) { + else if (!PyBytes_Check(src) || PyBytes_Size(src) != 1) { PyErr_Format(PyExc_TypeError, "\"%s\" must be an 1-character string", name); return -1; } else { - char *s = PyString_AsString(src); + char *s = PyBytes_AsString(src); if (s == NULL) return -1; *target = s[0]; @@ -257,7 +257,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) { if (src == NULL) - *target = PyString_FromString(dflt); + *target = PyBytes_FromString(dflt); else { if (src == Py_None) *target = NULL; @@ -528,7 +528,7 @@ { PyObject *field; - field = PyString_FromStringAndSize(self->field, self->field_len); + field = PyBytes_FromStringAndSize(self->field, self->field_len); if (field == NULL) return -1; self->field_len = 0; @@ -787,8 +787,8 @@ } ++self->line_num; - line = PyString_AsString(lineobj); - linelen = PyString_Size(lineobj); + line = PyBytes_AsString(lineobj); + linelen = PyBytes_Size(lineobj); if (line == NULL || linelen < 0) { Py_DECREF(lineobj); @@ -976,7 +976,7 @@ rec_len++;\ } while(0) - lineterm = PyString_AsString(dialect->lineterminator); + lineterm = PyBytes_AsString(dialect->lineterminator); if (lineterm == NULL) return -1; @@ -1101,7 +1101,7 @@ int terminator_len; char *terminator; - terminator_len = PyString_Size(self->dialect->lineterminator); + terminator_len = PyBytes_Size(self->dialect->lineterminator); if (terminator_len == -1) return 0; @@ -1109,7 +1109,7 @@ if (!join_check_rec_size(self, self->rec_len + terminator_len)) return 0; - terminator = PyString_AsString(self->dialect->lineterminator); + terminator = PyBytes_AsString(self->dialect->lineterminator); if (terminator == NULL) return 0; memmove(self->rec + self->rec_len, terminator, terminator_len); @@ -1161,9 +1161,9 @@ break; } - if (PyString_Check(field)) { + if (PyBytes_Check(field)) { append_ok = join_append(self, - PyString_AS_STRING(field), + PyBytes_AS_STRING(field), "ed, len == 1); Py_DECREF(field); } @@ -1179,7 +1179,7 @@ if (str == NULL) return NULL; - append_ok = join_append(self, PyString_AS_STRING(str), + append_ok = join_append(self, PyBytes_AS_STRING(str), "ed, len == 1); Py_DECREF(str); } Modified: python/branches/okkoto-sizeof/Modules/_ctypes/_ctypes.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/_ctypes.c (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/_ctypes.c Wed Jun 4 11:24:23 2008 @@ -477,7 +477,7 @@ static PyObject * CDataType_from_buffer_copy(PyObject *type, PyObject *args) { - void *buffer; + const void *buffer; Py_ssize_t buffer_len; Py_ssize_t offset = 0; PyObject *obj, *result; @@ -684,8 +684,8 @@ if (-1 == PyType_Type.tp_setattro(self, key, value)) return -1; - if (value && PyString_Check(key) && - 0 == strcmp(PyString_AS_STRING(key), "_fields_")) + if (value && PyBytes_Check(key) && + 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 1); return 0; } @@ -698,8 +698,8 @@ if (-1 == PyObject_GenericSetAttr(self, key, value)) return -1; - if (PyString_Check(key) && - 0 == strcmp(PyString_AS_STRING(key), "_fields_")) + if (PyBytes_Check(key) && + 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 0); return 0; } @@ -1025,7 +1025,7 @@ size = Py_TYPE(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr); if (size < 0) return -1; - } else if (-1 == PyString_AsStringAndSize(value, &ptr, &size)) { + } else if (-1 == PyBytes_AsStringAndSize(value, &ptr, &size)) { return -1; } if (size > self->b_size) { @@ -1042,7 +1042,7 @@ static PyObject * CharArray_get_raw(CDataObject *self) { - return PyString_FromStringAndSize(self->b_ptr, self->b_size); + return PyBytes_FromStringAndSize(self->b_ptr, self->b_size); } static PyObject * @@ -1053,7 +1053,7 @@ for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') break; - return PyString_FromStringAndSize(self->b_ptr, i); + return PyBytes_FromStringAndSize(self->b_ptr, i); } static int @@ -1074,14 +1074,14 @@ conversion_mode_errors); if (!value) return -1; - } else if (!PyString_Check(value)) { + } else if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "string expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else Py_INCREF(value); - size = PyString_GET_SIZE(value); + size = PyBytes_GET_SIZE(value); if (size > self->b_size) { PyErr_SetString(PyExc_ValueError, "string too long"); @@ -1089,7 +1089,7 @@ return -1; } - ptr = PyString_AS_STRING(value); + ptr = PyBytes_AS_STRING(value); memcpy(self->b_ptr, ptr, size); if (size < self->b_size) self->b_ptr[size] = '\0'; @@ -1128,7 +1128,7 @@ "can't delete attribute"); return -1; } - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1402,7 +1402,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyUnicode_Check(value) || PyString_Check(value)) { + if (PyUnicode_Check(value) || PyBytes_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("Z"); @@ -1466,7 +1466,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyString_Check(value) || PyUnicode_Check(value)) { + if (PyBytes_Check(value) || PyUnicode_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1552,7 +1552,7 @@ return (PyObject *)parg; } /* string */ - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1623,10 +1623,10 @@ } /* c_char_p, c_wchar_p */ stgd = PyObject_stgdict(value); - if (stgd && CDataObject_Check(value) && stgd->proto && PyString_Check(stgd->proto)) { + if (stgd && CDataObject_Check(value) && stgd->proto && PyBytes_Check(stgd->proto)) { PyCArgObject *parg; - switch (PyString_AS_STRING(stgd->proto)[0]) { + switch (PyBytes_AS_STRING(stgd->proto)[0]) { case 'z': /* c_char_p */ case 'Z': /* c_wchar_p */ parg = new_CArgObject(); @@ -1683,13 +1683,13 @@ if (suffix == NULL) #ifdef WORDS_BIGENDIAN - suffix = PyString_InternFromString("_le"); + suffix = PyBytes_InternFromString("_le"); #else - suffix = PyString_InternFromString("_be"); + suffix = PyBytes_InternFromString("_be"); #endif Py_INCREF(name); - PyString_Concat(&name, suffix); + PyBytes_Concat(&name, suffix); if (name == NULL) return NULL; @@ -1744,7 +1744,7 @@ dict = PyObject_stgdict((PyObject *)self); assert(dict); /* Cannot be NULL for CDataObject instances */ - fmt = PyString_AsString(dict->proto); + fmt = PyBytes_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -1779,9 +1779,9 @@ proto = PyObject_GetAttrString((PyObject *)result, "_type_"); /* new ref */ if (!proto - || !PyString_Check(proto) - || 1 != strlen(PyString_AS_STRING(proto)) - || !strchr(SIMPLE_TYPE_CHARS, PyString_AS_STRING(proto)[0])) { + || !PyBytes_Check(proto) + || 1 != strlen(PyBytes_AS_STRING(proto)) + || !strchr(SIMPLE_TYPE_CHARS, PyBytes_AS_STRING(proto)[0])) { PyErr_Format(PyExc_AttributeError, "class must define a '_type_' attribute which must be\n" "a single character string containing one of '%s'.", @@ -1790,12 +1790,12 @@ Py_DECREF(result); return NULL; } - fmt = getentry(PyString_AS_STRING(proto)); + fmt = getentry(PyBytes_AS_STRING(proto)); if (fmt == NULL) { Py_DECREF(result); PyErr_Format(PyExc_ValueError, "_type_ '%s' not supported", - PyString_AS_STRING(proto)); + PyBytes_AS_STRING(proto)); return NULL; } @@ -1835,7 +1835,7 @@ Overrides the SimpleType_from_param generic method. */ if (result->tp_base == &Simple_Type) { - switch (PyString_AS_STRING(proto)[0]) { + switch (PyBytes_AS_STRING(proto)[0]) { case 'z': /* c_char_p */ ml = &c_char_p_method; stgdict->flags |= TYPEFLAG_ISPOINTER; @@ -1940,7 +1940,7 @@ assert(dict); /* I think we can rely on this being a one-character string */ - fmt = PyString_AsString(dict->proto); + fmt = PyBytes_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -2290,7 +2290,7 @@ #endif target = target->b_base; } - return PyString_FromStringAndSize(string, cp-string); + return PyBytes_FromStringAndSize(string, cp-string); } /* @@ -2435,7 +2435,7 @@ _unpickle, Py_TYPE(_self), PyObject_GetAttrString(_self, "__dict__"), - PyString_FromStringAndSize(self->b_ptr, self->b_size)); + PyBytes_FromStringAndSize(self->b_ptr, self->b_size)); } static PyObject * @@ -2984,9 +2984,9 @@ dict = PyType_stgdict(arg); if (dict /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ - && PyString_Check(dict->proto) + && PyBytes_Check(dict->proto) /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ - && (strchr("PzZ", PyString_AS_STRING(dict->proto)[0]))) { + && (strchr("PzZ", PyBytes_AS_STRING(dict->proto)[0]))) { return 1; } @@ -3071,8 +3071,8 @@ return 1; } #endif - if (PyString_Check(obj) || PyUnicode_Check(obj)) { - *pname = PyString_AsString(obj); + if (PyBytes_Check(obj) || PyUnicode_Check(obj)) { + *pname = PyBytes_AsString(obj); return *pname ? 1 : 0; } PyErr_SetString(PyExc_TypeError, @@ -3422,7 +3422,7 @@ /* We HAVE already checked that the tuple can be parsed with "i|zO", so... */ Py_ssize_t tsize = PyTuple_GET_SIZE(item); flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0)); - name = tsize > 1 ? PyString_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; + name = tsize > 1 ? PyBytes_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL; switch (flag & (PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID)) { @@ -3476,7 +3476,7 @@ "NULL stgdict unexpected"); goto error; } - if (PyString_Check(dict->proto)) { + if (PyBytes_Check(dict->proto)) { PyErr_Format( PyExc_TypeError, "%s 'out' parameter must be passed as default value", @@ -3774,16 +3774,36 @@ { #ifdef MS_WIN32 if (self->index) - return PyString_FromFormat("", + return PyBytes_FromFormat("", self->index - 0x1000, Py_TYPE(self)->tp_name, self); #endif - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } +static int +Pointer_nonzero(CDataObject *self) +{ + return *(void **)self->b_ptr != NULL; +} + +static PyNumberMethods Pointer_as_number = { + 0, /* nb_add */ + 0, /* nb_subtract */ + 0, /* nb_multiply */ + 0, /* nb_divide */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + (inquiry)Pointer_nonzero, /* nb_nonzero */ +}; + PyTypeObject CFuncPtr_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_ctypes.CFuncPtr", @@ -3795,7 +3815,7 @@ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)CFuncPtr_repr, /* tp_repr */ - 0, /* tp_as_number */ + &Pointer_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ @@ -3888,7 +3908,7 @@ } if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyString_AsString(name); + char *field = PyBytes_AsString(name); if (field == NULL) { PyErr_Clear(); field = "???"; @@ -4090,7 +4110,7 @@ type, so this cannot be NULL */ if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = (char *)self->b_ptr; - return PyString_FromStringAndSize(ptr + ilow, len); + return PyBytes_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; @@ -4147,9 +4167,9 @@ char *dest; if (slicelen <= 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (step == 1) { - return PyString_FromStringAndSize(ptr + start, + return PyBytes_FromStringAndSize(ptr + start, slicelen); } dest = (char *)PyMem_Malloc(slicelen); @@ -4162,7 +4182,7 @@ dest[i] = ptr[cur]; } - np = PyString_FromStringAndSize(dest, slicelen); + np = PyBytes_FromStringAndSize(dest, slicelen); PyMem_Free(dest); return np; } @@ -4572,12 +4592,12 @@ static PyObject *format; if (Py_TYPE(self)->tp_base != &Simple_Type) { - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } if (format == NULL) { - format = PyString_InternFromString("%s(%r)"); + format = PyBytes_InternFromString("%s(%r)"); if (format == NULL) return NULL; } @@ -4586,7 +4606,7 @@ if (val == NULL) return NULL; - name = PyString_FromString(Py_TYPE(self)->tp_name); + name = PyBytes_FromString(Py_TYPE(self)->tp_name); if (name == NULL) { Py_DECREF(val); return NULL; @@ -4598,7 +4618,7 @@ if (args == NULL) return NULL; - result = PyString_Format(format, args); + result = PyBytes_Format(format, args); Py_DECREF(args); return result; } @@ -4832,7 +4852,7 @@ assert(itemdict); if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = *(char **)self->b_ptr; - return PyString_FromStringAndSize(ptr + ilow, len); + return PyBytes_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; @@ -4929,9 +4949,9 @@ char *dest; if (len <= 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (step == 1) { - return PyString_FromStringAndSize(ptr + start, + return PyBytes_FromStringAndSize(ptr + start, len); } dest = (char *)PyMem_Malloc(len); @@ -4940,7 +4960,7 @@ for (cur = start, i = 0; i < len; cur += step, i++) { dest[i] = ptr[cur]; } - np = PyString_FromStringAndSize(dest, len); + np = PyBytes_FromStringAndSize(dest, len); PyMem_Free(dest); return np; } @@ -5003,26 +5023,6 @@ Pointer_subscript, }; -static int -Pointer_nonzero(CDataObject *self) -{ - return *(void **)self->b_ptr != NULL; -} - -static PyNumberMethods Pointer_as_number = { - 0, /* nb_add */ - 0, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - (inquiry)Pointer_nonzero, /* nb_nonzero */ -}; - PyTypeObject Pointer_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_ctypes._Pointer", @@ -5140,7 +5140,7 @@ ++methods; } - s = PyString_FromString(comerror_doc); + s = PyBytes_FromString(comerror_doc); if (s == NULL) goto error; status = PyDict_SetItemString(dict, "__doc__", s); @@ -5166,8 +5166,8 @@ string_at(const char *ptr, int size) { if (size == -1) - return PyString_FromString(ptr); - return PyString_FromStringAndSize(ptr, size); + return PyBytes_FromString(ptr); + return PyBytes_FromStringAndSize(ptr, size); } static int @@ -5181,8 +5181,8 @@ return 1; dict = PyType_stgdict(arg); if (dict) { - if (PyString_Check(dict->proto) - && (strchr("sPzUZXO", PyString_AS_STRING(dict->proto)[0]))) { + if (PyBytes_Check(dict->proto) + && (strchr("sPzUZXO", PyBytes_AS_STRING(dict->proto)[0]))) { /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ return 1; } Modified: python/branches/okkoto-sizeof/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/callbacks.c (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/callbacks.c Wed Jun 4 11:24:23 2008 @@ -107,15 +107,15 @@ PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_srcfile = PyString_FromString(filename); + py_srcfile = PyBytes_FromString(filename); if (!py_srcfile) goto bad; - py_funcname = PyString_FromString(funcname); + py_funcname = PyBytes_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyDict_New(); if (!py_globals) goto bad; empty_tuple = PyTuple_New(0); if (!empty_tuple) goto bad; - empty_string = PyString_FromString(""); + empty_string = PyBytes_FromString(""); if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ @@ -460,7 +460,7 @@ static PyObject *context; if (context == NULL) - context = PyString_InternFromString("_ctypes.DllGetClassObject"); + context = PyBytes_InternFromString("_ctypes.DllGetClassObject"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { @@ -539,7 +539,7 @@ static PyObject *context; if (context == NULL) - context = PyString_InternFromString("_ctypes.DllCanUnloadNow"); + context = PyBytes_InternFromString("_ctypes.DllCanUnloadNow"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { Modified: python/branches/okkoto-sizeof/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/callproc.c (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/callproc.c Wed Jun 4 11:24:23 2008 @@ -370,7 +370,7 @@ self->tag, self); break; } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } static PyMemberDef PyCArgType_members[] = { @@ -518,9 +518,9 @@ return 0; } - if (PyString_Check(obj)) { + if (PyBytes_Check(obj)) { pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyString_AS_STRING(obj); + pa->value.p = PyBytes_AS_STRING(obj); Py_INCREF(obj); pa->keep = obj; return 0; @@ -781,7 +781,7 @@ PyObject *tp, *v, *tb, *s, *cls_str, *msg_str; va_start(vargs, fmt); - s = PyString_FromFormatV(fmt, vargs); + s = PyBytes_FromFormatV(fmt, vargs); va_end(vargs); if (!s) return; @@ -790,18 +790,18 @@ PyErr_NormalizeException(&tp, &v, &tb); cls_str = PyObject_Str(tp); if (cls_str) { - PyString_ConcatAndDel(&s, cls_str); - PyString_ConcatAndDel(&s, PyString_FromString(": ")); + PyBytes_ConcatAndDel(&s, cls_str); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(": ")); if (s == NULL) goto error; } else PyErr_Clear(); msg_str = PyObject_Str(v); if (msg_str) - PyString_ConcatAndDel(&s, msg_str); + PyBytes_ConcatAndDel(&s, msg_str); else { PyErr_Clear(); - PyString_ConcatAndDel(&s, PyString_FromString("???")); + PyBytes_ConcatAndDel(&s, PyBytes_FromString("???")); if (s == NULL) goto error; } @@ -1105,7 +1105,7 @@ if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) return NULL; #ifdef _UNICODE - name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); + name = alloca((PyBytes_Size(nameobj) + 1) * sizeof(WCHAR)); if (!name) { PyErr_NoMemory(); return NULL; @@ -1113,14 +1113,14 @@ { int r; - char *aname = PyString_AsString(nameobj); + char *aname = PyBytes_AsString(nameobj); if(!aname) return NULL; - r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyString_Size(nameobj) + 1); + r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyBytes_Size(nameobj) + 1); name[r] = 0; } #else - name = PyString_AsString(nameobj); + name = PyBytes_AsString(nameobj); if(!name) return NULL; #endif @@ -1613,9 +1613,9 @@ Py_INCREF(result); return result; } - if (PyString_CheckExact(cls)) { - buf = alloca(strlen(PyString_AS_STRING(cls)) + 3 + 1); - sprintf(buf, "LP_%s", PyString_AS_STRING(cls)); + if (PyBytes_CheckExact(cls)) { + buf = alloca(strlen(PyBytes_AS_STRING(cls)) + 3 + 1); + sprintf(buf, "LP_%s", PyBytes_AS_STRING(cls)); result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type), "s(O){}", buf, Modified: python/branches/okkoto-sizeof/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/cfield.c (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/cfield.c Wed Jun 4 11:24:23 2008 @@ -272,7 +272,7 @@ name = ((PyTypeObject *)self->proto)->tp_name; if (bits) - result = PyString_FromFormat( + result = PyBytes_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -280,7 +280,7 @@ #endif name, self->offset, size, bits); else - result = PyString_FromFormat( + result = PyBytes_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -1164,12 +1164,12 @@ static PyObject * c_set(void *ptr, PyObject *value, Py_ssize_t size) { - if (!PyString_Check(value) || (1 != PyString_Size(value))) { + if (!PyBytes_Check(value) || (1 != PyBytes_Size(value))) { PyErr_Format(PyExc_TypeError, "one character string expected"); return NULL; } - *(char *)ptr = PyString_AS_STRING(value)[0]; + *(char *)ptr = PyBytes_AS_STRING(value)[0]; _RET(value); } @@ -1177,7 +1177,7 @@ static PyObject * c_get(void *ptr, Py_ssize_t size) { - return PyString_FromStringAndSize((char *)ptr, 1); + return PyBytes_FromStringAndSize((char *)ptr, 1); } #ifdef CTYPES_UNICODE @@ -1187,7 +1187,7 @@ { Py_ssize_t len; - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1262,7 +1262,7 @@ /* It's easier to calculate in characters than in bytes */ length /= sizeof(wchar_t); - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1301,21 +1301,21 @@ PyObject *result; size_t slen; - result = PyString_FromString((char *)ptr); + result = PyBytes_FromString((char *)ptr); if (!result) return NULL; /* chop off at the first NUL character, if any. * On error, result will be deallocated and set to NULL. */ - slen = strlen(PyString_AS_STRING(result)); + slen = strlen(PyBytes_AS_STRING(result)); size = min(size, (Py_ssize_t)slen); if (result->ob_refcnt == 1) { /* shorten the result */ - _PyString_Resize(&result, size); + _PyBytes_Resize(&result, size); return result; } else /* cannot shorten the result */ - return PyString_FromStringAndSize(ptr, size); + return PyBytes_FromStringAndSize(ptr, size); } static PyObject * @@ -1324,7 +1324,7 @@ char *data; Py_ssize_t size; - data = PyString_AsString(value); + data = PyBytes_AsString(value); if (!data) return NULL; size = strlen(data); @@ -1356,8 +1356,8 @@ Py_INCREF(value); return value; } - if (PyString_Check(value)) { - *(char **)ptr = PyString_AS_STRING(value); + if (PyBytes_Check(value)) { + *(char **)ptr = PyBytes_AS_STRING(value); Py_INCREF(value); return value; } else if (PyUnicode_Check(value)) { @@ -1366,7 +1366,7 @@ conversion_mode_errors); if (str == NULL) return NULL; - *(char **)ptr = PyString_AS_STRING(str); + *(char **)ptr = PyBytes_AS_STRING(str); return str; } else if (PyInt_Check(value) || PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG @@ -1395,7 +1395,7 @@ return NULL; } #endif - return PyString_FromString(*(char **)ptr); + return PyBytes_FromString(*(char **)ptr); } else { Py_INCREF(Py_None); return Py_None; @@ -1411,7 +1411,7 @@ Py_INCREF(value); return value; } - if (PyString_Check(value)) { + if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1502,7 +1502,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyString_Check(value)) { + } else if (PyBytes_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); Modified: python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure Wed Jun 4 11:24:23 2008 @@ -20406,6 +20406,9 @@ i?86-*-solaris2.1[0-9]*) TARGET=X86_64; TARGETDIR=x86 ;; + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; i?86-*-*) TARGET=X86; TARGETDIR=x86 ;; Modified: python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure.ac ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure.ac (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/libffi/configure.ac Wed Jun 4 11:24:23 2008 @@ -86,6 +86,9 @@ i?86-*-solaris2.1[[0-9]]*) TARGET=X86_64; TARGETDIR=x86 ;; + i*86-*-nto-qnx*) + TARGET=X86; TARGETDIR=x86 + ;; i?86-*-*) TARGET=X86; TARGETDIR=x86 ;; Modified: python/branches/okkoto-sizeof/Modules/_ctypes/libffi/fficonfig.py.in ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/libffi/fficonfig.py.in (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/libffi/fficonfig.py.in Wed Jun 4 11:24:23 2008 @@ -25,6 +25,7 @@ 'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'], 'PA': ['src/pa/linux.S', 'src/pa/ffi.c'], 'PA_LINUX': ['src/pa/linux.S', 'src/pa/ffi.c'], + 'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'], } ffi_srcdir = '@srcdir@' Modified: python/branches/okkoto-sizeof/Modules/_ctypes/malloc_closure.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ctypes/malloc_closure.c (original) +++ python/branches/okkoto-sizeof/Modules/_ctypes/malloc_closure.c Wed Jun 4 11:24:23 2008 @@ -48,7 +48,11 @@ } #else if (!_pagesize) { +#ifdef _SC_PAGESIZE + _pagesize = sysconf(_SC_PAGESIZE); +#else _pagesize = getpagesize(); +#endif } #endif Modified: python/branches/okkoto-sizeof/Modules/_curses_panel.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_curses_panel.c (original) +++ python/branches/okkoto-sizeof/Modules/_curses_panel.c Wed Jun 4 11:24:23 2008 @@ -472,7 +472,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyString_FromString(PyCursesVersion); + v = PyBytes_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/okkoto-sizeof/Modules/_cursesmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_cursesmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_cursesmodule.c Wed Jun 4 11:24:23 2008 @@ -198,9 +198,9 @@ { if (PyInt_Check(obj)) { *ch = (chtype) PyInt_AsLong(obj); - } else if(PyString_Check(obj) - && (PyString_Size(obj) == 1)) { - *ch = (chtype) *PyString_AsString(obj); + } else if(PyBytes_Check(obj) + && (PyBytes_Size(obj) == 1)) { + *ch = (chtype) *PyBytes_AsString(obj); } else { return 0; } @@ -886,9 +886,9 @@ return Py_BuildValue("c", rtn); else #if defined(__NetBSD__) - return PyString_FromString(unctrl(rtn)); + return PyBytes_FromString(unctrl(rtn)); #else - return PyString_FromString((char *)keyname(rtn)); + return PyBytes_FromString((char *)keyname(rtn)); #endif } @@ -943,7 +943,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyString_FromString(rtn); + return PyBytes_FromString(rtn); } static PyObject * @@ -1095,7 +1095,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyString_FromString(rtn); + return PyBytes_FromString(rtn); } static PyObject * @@ -1757,7 +1757,7 @@ ch = erasechar(); - return PyString_FromStringAndSize(&ch, 1); + return PyBytes_FromStringAndSize(&ch, 1); } static PyObject * @@ -2114,7 +2114,7 @@ } knp = keyname(ch); - return PyString_FromString((knp == NULL) ? "" : (char *)knp); + return PyBytes_FromString((knp == NULL) ? "" : (char *)knp); } #endif @@ -2125,7 +2125,7 @@ ch = killchar(); - return PyString_FromStringAndSize(&ch, 1); + return PyBytes_FromStringAndSize(&ch, 1); } static PyObject * @@ -2496,7 +2496,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString( capname ); + return PyBytes_FromString( capname ); } static PyObject * @@ -2520,7 +2520,7 @@ return NULL; } - return PyString_FromString(result); + return PyBytes_FromString(result); } static PyObject * @@ -2547,14 +2547,14 @@ if (PyInt_Check(temp)) ch = (chtype) PyInt_AsLong(temp); - else if (PyString_Check(temp)) - ch = (chtype) *PyString_AsString(temp); + else if (PyBytes_Check(temp)) + ch = (chtype) *PyBytes_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; } - return PyString_FromString(unctrl(ch)); + return PyBytes_FromString(unctrl(ch)); } static PyObject * @@ -2569,8 +2569,8 @@ if (PyInt_Check(temp)) ch = (int) PyInt_AsLong(temp); - else if (PyString_Check(temp)) - ch = (int) *PyString_AsString(temp); + else if (PyBytes_Check(temp)) + ch = (int) *PyBytes_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; @@ -2753,7 +2753,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyString_FromString(PyCursesVersion); + v = PyBytes_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/okkoto-sizeof/Modules/_elementtree.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_elementtree.c (original) +++ python/branches/okkoto-sizeof/Modules/_elementtree.c Wed Jun 4 11:24:23 2008 @@ -103,7 +103,7 @@ #define PyDict_CheckExact PyDict_Check #if (PY_VERSION_HEX < 0x02020000) #define PyList_CheckExact PyList_Check -#define PyString_CheckExact PyString_Check +#define PyBytes_CheckExact PyBytes_Check #if (PY_VERSION_HEX >= 0x01060000) #define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */ #endif @@ -173,7 +173,7 @@ switch (PyList_GET_SIZE(list)) { case 0: Py_DECREF(list); - return PyString_FromString(""); + return PyBytes_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); Py_INCREF(result); @@ -748,9 +748,9 @@ return 0; } #endif - if (PyString_Check(tag)) { - char *p = PyString_AS_STRING(tag); - for (i = 0; i < PyString_GET_SIZE(tag); i++) { + if (PyBytes_Check(tag)) { + char *p = PyBytes_AS_STRING(tag); + for (i = 0; i < PyBytes_GET_SIZE(tag); i++) { if (p[i] == '{') check = 0; else if (p[i] == '}') @@ -818,7 +818,7 @@ if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { PyObject* text = element_get_text(item); if (text == Py_None) - return PyString_FromString(""); + return PyBytes_FromString(""); Py_XINCREF(text); return text; } @@ -1154,12 +1154,12 @@ PyObject* repr; char buffer[100]; - repr = PyString_FromString("tag)); + PyBytes_ConcatAndDel(&repr, PyObject_Repr(self->tag)); sprintf(buffer, " at %p>", self); - PyString_ConcatAndDel(&repr, PyString_FromString(buffer)); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(buffer)); return repr; } @@ -1617,14 +1617,14 @@ Py_INCREF(data); self->data = data; } else { /* more than one item; use a list to collect items */ - if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && - PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) { + if (PyBytes_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && + PyBytes_CheckExact(data) && PyBytes_GET_SIZE(data) == 1) { /* expat often generates single character data sections; handle the most common case by resizing the existing string... */ - Py_ssize_t size = PyString_GET_SIZE(self->data); - if (_PyString_Resize(&self->data, size + 1) < 0) + Py_ssize_t size = PyBytes_GET_SIZE(self->data); + if (_PyBytes_Resize(&self->data, size + 1) < 0) return NULL; - PyString_AS_STRING(self->data)[size] = PyString_AS_STRING(data)[0]; + PyBytes_AS_STRING(self->data)[size] = PyBytes_AS_STRING(data)[0]; } else if (PyList_CheckExact(self->data)) { if (PyList_Append(self->data, data) < 0) return NULL; @@ -1896,7 +1896,7 @@ return PyUnicode_DecodeUTF8(string, size, "strict"); #endif - return PyString_FromStringAndSize(string, size); + return PyBytes_FromStringAndSize(string, size); } LOCAL(PyObject*) @@ -1910,7 +1910,7 @@ PyObject* value; /* look the 'raw' name up in the names dictionary */ - key = PyString_FromStringAndSize(string, size); + key = PyBytes_FromStringAndSize(string, size); if (!key) return NULL; @@ -1932,8 +1932,8 @@ break; if (i != size) { /* convert to universal name */ - tag = PyString_FromStringAndSize(NULL, size+1); - p = PyString_AS_STRING(tag); + tag = PyBytes_FromStringAndSize(NULL, size+1); + p = PyBytes_AS_STRING(tag); p[0] = '{'; memcpy(p+1, string, size); size++; @@ -1947,7 +1947,7 @@ #if defined(Py_USING_UNICODE) /* inline makestring, to avoid duplicating the source string if it's not an utf-8 string */ - p = PyString_AS_STRING(tag); + p = PyBytes_AS_STRING(tag); if (checkstring(p, size)) { value = PyUnicode_DecodeUTF8(p, size, "strict"); Py_DECREF(tag); @@ -2004,7 +2004,7 @@ } else { PyErr_Format( PyExc_SyntaxError, "undefined entity &%s;: line %ld, column %ld", - PyString_AS_STRING(key), + PyBytes_AS_STRING(key), EXPAT(GetErrorLineNumber)(self->parser), EXPAT(GetErrorColumnNumber)(self->parser) ); @@ -2435,13 +2435,13 @@ return NULL; } - if (!PyString_CheckExact(buffer) || PyString_GET_SIZE(buffer) == 0) { + if (!PyBytes_CheckExact(buffer) || PyBytes_GET_SIZE(buffer) == 0) { Py_DECREF(buffer); break; } res = expat_parse( - self, PyString_AS_STRING(buffer), PyString_GET_SIZE(buffer), 0 + self, PyBytes_AS_STRING(buffer), PyBytes_GET_SIZE(buffer), 0 ); Py_DECREF(buffer); @@ -2503,7 +2503,7 @@ if (event_set == Py_None) { /* default is "end" only */ - target->end_event_obj = PyString_FromString("end"); + target->end_event_obj = PyBytes_FromString("end"); Py_RETURN_NONE; } @@ -2513,9 +2513,9 @@ for (i = 0; i < PyTuple_GET_SIZE(event_set); i++) { PyObject* item = PyTuple_GET_ITEM(event_set, i); char* event; - if (!PyString_Check(item)) + if (!PyBytes_Check(item)) goto error; - event = PyString_AS_STRING(item); + event = PyBytes_AS_STRING(item); if (strcmp(event, "start") == 0) { Py_INCREF(item); target->start_event_obj = item; @@ -2587,7 +2587,7 @@ char buffer[100]; sprintf(buffer, "Expat %d.%d.%d", XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } else { PyErr_SetString(PyExc_AttributeError, name); return NULL; Modified: python/branches/okkoto-sizeof/Modules/_fileio.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_fileio.c (original) +++ python/branches/okkoto-sizeof/Modules/_fileio.c Wed Jun 4 11:24:23 2008 @@ -392,14 +392,14 @@ Py_ssize_t total = 0; int n; - result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); + result = PyBytes_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); if (result == NULL) return NULL; while (1) { Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyString_GET_SIZE(result) < newsize) { - if (_PyString_Resize(&result, newsize) < 0) { + if (PyBytes_GET_SIZE(result) < newsize) { + if (_PyBytes_Resize(&result, newsize) < 0) { if (total == 0) { Py_DECREF(result); return NULL; @@ -411,7 +411,7 @@ Py_BEGIN_ALLOW_THREADS errno = 0; n = read(self->fd, - PyString_AS_STRING(result) + total, + PyBytes_AS_STRING(result) + total, newsize - total); Py_END_ALLOW_THREADS if (n == 0) @@ -430,8 +430,8 @@ total += n; } - if (PyString_GET_SIZE(result) > total) { - if (_PyString_Resize(&result, total) < 0) { + if (PyBytes_GET_SIZE(result) > total) { + if (_PyBytes_Resize(&result, total) < 0) { /* This should never happen, but just in case */ Py_DECREF(result); return NULL; @@ -460,10 +460,10 @@ return fileio_readall(self); } - bytes = PyString_FromStringAndSize(NULL, size); + bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; - ptr = PyString_AS_STRING(bytes); + ptr = PyBytes_AS_STRING(bytes); Py_BEGIN_ALLOW_THREADS errno = 0; @@ -478,7 +478,7 @@ } if (n != size) { - if (_PyString_Resize(&bytes, n) < 0) { + if (_PyBytes_Resize(&bytes, n) < 0) { Py_DECREF(bytes); return NULL; } @@ -690,9 +690,9 @@ fileio_repr(PyFileIOObject *self) { if (self->fd < 0) - return PyString_FromFormat("_fileio._FileIO(-1)"); + return PyBytes_FromFormat("_fileio._FileIO(-1)"); - return PyString_FromFormat("_fileio._FileIO(%d, '%s')", + return PyBytes_FromFormat("_fileio._FileIO(%d, '%s')", self->fd, mode_string(self)); } @@ -816,7 +816,7 @@ static PyObject * get_mode(PyFileIOObject *self, void *closure) { - return PyString_FromString(mode_string(self)); + return PyBytes_FromString(mode_string(self)); } static PyGetSetDef fileio_getsetlist[] = { Modified: python/branches/okkoto-sizeof/Modules/_hashopenssl.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_hashopenssl.c (original) +++ python/branches/okkoto-sizeof/Modules/_hashopenssl.c Wed Jun 4 11:24:23 2008 @@ -103,7 +103,7 @@ digest_size = EVP_MD_CTX_size(&temp_ctx); EVP_DigestFinal(&temp_ctx, digest, NULL); - retval = PyString_FromStringAndSize((const char *)digest, digest_size); + retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); EVP_MD_CTX_cleanup(&temp_ctx); return retval; } @@ -130,10 +130,10 @@ /* Create a new string */ /* NOTE: not thread safe! modifying an already created string object */ /* (not a problem because we hold the GIL by default) */ - retval = PyString_FromStringAndSize(NULL, digest_size * 2); + retval = PyBytes_FromStringAndSize(NULL, digest_size * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -220,8 +220,8 @@ { char buf[100]; PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>", - PyString_AsString(((EVPobject *)self)->name), self); - return PyString_FromString(buf); + PyBytes_AsString(((EVPobject *)self)->name), self); + return PyBytes_FromString(buf); } #if HASH_OBJ_CONSTRUCTOR @@ -421,7 +421,7 @@ /* used in the init function to setup a constructor */ #define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ - CONST_ ## NAME ## _name_obj = PyString_FromString(#NAME); \ + CONST_ ## NAME ## _name_obj = PyBytes_FromString(#NAME); \ if (EVP_get_digestbyname(#NAME)) { \ CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ Modified: python/branches/okkoto-sizeof/Modules/_heapqmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_heapqmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_heapqmodule.c Wed Jun 4 11:24:23 2008 @@ -28,12 +28,12 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(parent, newitem, Py_LE); + cmp = PyObject_RichCompareBool(newitem, parent, Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) break; Py_INCREF(parent); Py_DECREF(PyList_GET_ITEM(heap, pos)); @@ -69,14 +69,14 @@ rightpos = childpos + 1; if (rightpos < endpos) { cmp = PyObject_RichCompareBool( - PyList_GET_ITEM(heap, rightpos), PyList_GET_ITEM(heap, childpos), - Py_LE); + PyList_GET_ITEM(heap, rightpos), + Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) childpos = rightpos; } /* Move the smaller child up. */ @@ -214,10 +214,10 @@ return item; } - cmp = PyObject_RichCompareBool(item, PyList_GET_ITEM(heap, 0), Py_LE); + cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT); if (cmp == -1) return NULL; - if (cmp == 1) { + if (cmp == 0) { Py_INCREF(item); return item; } @@ -270,6 +270,7 @@ { PyObject *heap=NULL, *elem, *iterable, *sol, *it, *oldelem; Py_ssize_t i, n; + int cmp; if (!PyArg_ParseTuple(args, "nO:nlargest", &n, &iterable)) return NULL; @@ -312,7 +313,12 @@ else goto sortit; } - if (PyObject_RichCompareBool(elem, sol, Py_LE)) { + cmp = PyObject_RichCompareBool(sol, elem, Py_LT); + if (cmp == -1) { + Py_DECREF(elem); + goto fail; + } + if (cmp == 0) { Py_DECREF(elem); continue; } @@ -362,12 +368,12 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(newitem, parent, Py_LE); + cmp = PyObject_RichCompareBool(parent, newitem, Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) break; Py_INCREF(parent); Py_DECREF(PyList_GET_ITEM(heap, pos)); @@ -403,14 +409,14 @@ rightpos = childpos + 1; if (rightpos < endpos) { cmp = PyObject_RichCompareBool( - PyList_GET_ITEM(heap, childpos), PyList_GET_ITEM(heap, rightpos), - Py_LE); + PyList_GET_ITEM(heap, childpos), + Py_LT); if (cmp == -1) { Py_DECREF(newitem); return -1; } - if (cmp == 1) + if (cmp == 0) childpos = rightpos; } /* Move the smaller child up. */ @@ -434,6 +440,7 @@ { PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem; Py_ssize_t i, n; + int cmp; if (!PyArg_ParseTuple(args, "nO:nsmallest", &n, &iterable)) return NULL; @@ -477,7 +484,12 @@ else goto sortit; } - if (PyObject_RichCompareBool(los, elem, Py_LE)) { + cmp = PyObject_RichCompareBool(elem, los, Py_LT); + if (cmp == -1) { + Py_DECREF(elem); + goto fail; + } + if (cmp == 0) { Py_DECREF(elem); continue; } @@ -658,6 +670,6 @@ m = Py_InitModule3("_heapq", heapq_methods, module_doc); if (m == NULL) return; - PyModule_AddObject(m, "__about__", PyString_FromString(__about__)); + PyModule_AddObject(m, "__about__", PyBytes_FromString(__about__)); } Modified: python/branches/okkoto-sizeof/Modules/_hotshot.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_hotshot.c (original) +++ python/branches/okkoto-sizeof/Modules/_hotshot.c Wed Jun 4 11:24:23 2008 @@ -326,7 +326,7 @@ return ERR_EOF; } } - *pvalue = PyString_FromStringAndSize(buf, len); + *pvalue = PyBytes_FromStringAndSize(buf, len); free(buf); if (*pvalue == NULL) { return ERR_EXCEPTION; @@ -562,7 +562,7 @@ self->index - written); self->index -= written; if (written == 0) { - char *s = PyString_AsString(self->logfilename); + char *s = PyBytes_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -570,7 +570,7 @@ } if (written > 0) { if (fflush(self->logfp)) { - char *s = PyString_AsString(self->logfilename); + char *s = PyBytes_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -792,7 +792,7 @@ self->next_fileno++; Py_DECREF(obj); if (pack_define_file(self, fileno, - PyString_AS_STRING(fcode->co_filename)) < 0) + PyBytes_AS_STRING(fcode->co_filename)) < 0) return -1; } else { @@ -810,7 +810,7 @@ PyObject *name = PyDict_GetItem(dict, obj); if (name == NULL) { if (pack_define_func(self, fileno, fcode->co_firstlineno, - PyString_AS_STRING(fcode->co_name)) < 0) { + PyBytes_AS_STRING(fcode->co_name)) < 0) { Py_DECREF(obj); return -1; } @@ -1471,7 +1471,7 @@ len = PyList_GET_SIZE(temp); for (i = 0; i < len; ++i) { PyObject *item = PyList_GET_ITEM(temp, i); - buffer = PyString_AsString(item); + buffer = PyBytes_AsString(item); if (buffer == NULL) { pack_add_info(self, "sys-path-entry", ""); PyErr_Clear(); Modified: python/branches/okkoto-sizeof/Modules/_json.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_json.c (original) +++ python/branches/okkoto-sizeof/Modules/_json.c Wed Jun 4 11:24:23 2008 @@ -70,11 +70,11 @@ input_unicode = PyUnicode_AS_UNICODE(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyString_FromStringAndSize(NULL, output_size); + rval = PyBytes_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -92,14 +92,14 @@ if (output_size > 2 + (input_chars * MAX_EXPANSION)) { output_size = 2 + (input_chars * MAX_EXPANSION); } - if (_PyString_Resize(&rval, output_size) == -1) { + if (_PyBytes_Resize(&rval, output_size) == -1) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { + if (_PyBytes_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -116,15 +116,15 @@ char *output; char *input_str; - input_chars = PyString_GET_SIZE(pystr); - input_str = PyString_AS_STRING(pystr); + input_chars = PyBytes_GET_SIZE(pystr); + input_str = PyBytes_AS_STRING(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyString_FromStringAndSize(NULL, output_size); + rval = PyBytes_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -154,14 +154,14 @@ if (output_size > 2 + (input_chars * MIN_EXPANSION)) { output_size = 2 + (input_chars * MIN_EXPANSION); } - if (_PyString_Resize(&rval, output_size) == -1) { + if (_PyBytes_Resize(&rval, output_size) == -1) { return NULL; } - output = PyString_AS_STRING(rval); + output = PyBytes_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { + if (_PyBytes_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -215,7 +215,7 @@ ustr = PyUnicode_FromUnicode(&c, 0); } if (joinstr == NULL) { - joinstr = PyString_InternFromString("join"); + joinstr = PyBytes_InternFromString("join"); } if (joinstr == NULL || ustr == NULL) { return NULL; @@ -227,10 +227,10 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) { PyObject *rval; - Py_ssize_t len = PyString_GET_SIZE(pystr); + Py_ssize_t len = PyBytes_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; - char *buf = PyString_AS_STRING(pystr); + char *buf = PyBytes_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; @@ -555,7 +555,7 @@ if (encoding == NULL) { encoding = DEFAULT_ENCODING; } - if (PyString_Check(pystr)) { + if (PyBytes_Check(pystr)) { return scanstring_str(pystr, end, encoding, strict); } else if (PyUnicode_Check(pystr)) { @@ -576,7 +576,7 @@ py_encode_basestring_ascii(PyObject* self, PyObject *pystr) { /* METH_O */ - if (PyString_Check(pystr)) { + if (PyBytes_Check(pystr)) { return ascii_escape_str(pystr); } else if (PyUnicode_Check(pystr)) { Modified: python/branches/okkoto-sizeof/Modules/_localemodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_localemodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_localemodule.c Wed Jun 4 11:24:23 2008 @@ -119,7 +119,7 @@ if (isupper(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -134,7 +134,7 @@ if (islower(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -149,7 +149,7 @@ if (isalpha(c)) ul[n++] = c; } - ulo = PyString_FromStringAndSize((const char *)ul, n); + ulo = PyBytes_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -175,7 +175,7 @@ PyErr_SetString(Error, "unsupported locale setting"); return NULL; } - result_object = PyString_FromString(result); + result_object = PyBytes_FromString(result); if (!result_object) return NULL; /* record changes to LC_CTYPE */ @@ -190,7 +190,7 @@ PyErr_SetString(Error, "locale query failed"); return NULL; } - result_object = PyString_FromString(result); + result_object = PyBytes_FromString(result); } return result_object; } @@ -216,7 +216,7 @@ involved herein */ #define RESULT_STRING(s)\ - x = PyString_FromString(l->s);\ + x = PyBytes_FromString(l->s);\ if (!x) goto failed;\ PyDict_SetItemString(result, #s, x);\ Py_XDECREF(x) @@ -284,9 +284,9 @@ if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2)) return NULL; /* If both arguments are byte strings, use strcoll. */ - if (PyString_Check(os1) && PyString_Check(os2)) - return PyInt_FromLong(strcoll(PyString_AS_STRING(os1), - PyString_AS_STRING(os2))); + if (PyBytes_Check(os1) && PyBytes_Check(os2)) + return PyInt_FromLong(strcoll(PyBytes_AS_STRING(os1), + PyBytes_AS_STRING(os2))); /* If neither argument is unicode, it's an error. */ if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) { PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings"); @@ -368,7 +368,7 @@ return PyErr_NoMemory(); strxfrm(buf, s, n2); } - result = PyString_FromString(buf); + result = PyBytes_FromString(buf); PyMem_Free(buf); return result; } @@ -563,13 +563,13 @@ return NULL; /* Check whether this is a supported constant. GNU libc sometimes returns numeric values in the char* return value, which would - crash PyString_FromString. */ + crash PyBytes_FromString. */ for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) { /* Check NULL as a workaround for GNU libc's returning NULL instead of an empty string for nl_langinfo(ERA). */ const char *result = nl_langinfo(item); - return PyString_FromString(result != NULL ? result : ""); + return PyBytes_FromString(result != NULL ? result : ""); } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; @@ -588,7 +588,7 @@ char *in; if (!PyArg_ParseTuple(args, "z", &in)) return 0; - return PyString_FromString(gettext(in)); + return PyBytes_FromString(gettext(in)); } PyDoc_STRVAR(dgettext__doc__, @@ -601,7 +601,7 @@ char *domain, *in; if (!PyArg_ParseTuple(args, "zz", &domain, &in)) return 0; - return PyString_FromString(dgettext(domain, in)); + return PyBytes_FromString(dgettext(domain, in)); } PyDoc_STRVAR(dcgettext__doc__, @@ -615,7 +615,7 @@ int category; if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category)) return 0; - return PyString_FromString(dcgettext(domain,msgid,category)); + return PyBytes_FromString(dcgettext(domain,msgid,category)); } PyDoc_STRVAR(textdomain__doc__, @@ -633,7 +633,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyString_FromString(domain); + return PyBytes_FromString(domain); } PyDoc_STRVAR(bindtextdomain__doc__, @@ -651,7 +651,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyString_FromString(dirname); + return PyBytes_FromString(dirname); } #ifdef HAVE_BIND_TEXTDOMAIN_CODESET @@ -667,7 +667,7 @@ return NULL; codeset = bind_textdomain_codeset(domain, codeset); if (codeset) - return PyString_FromString(codeset); + return PyBytes_FromString(codeset); Py_RETURN_NONE; } #endif @@ -760,7 +760,7 @@ Error = PyErr_NewException("locale.Error", NULL, NULL); PyDict_SetItemString(d, "Error", Error); - x = PyString_FromString(locale__doc__); + x = PyBytes_FromString(locale__doc__); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/okkoto-sizeof/Modules/_lsprof.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_lsprof.c (original) +++ python/branches/okkoto-sizeof/Modules/_lsprof.c Wed Jun 4 11:24:23 2008 @@ -179,8 +179,8 @@ /* built-in function: look up the module name */ PyObject *mod = fn->m_module; char *modname; - if (mod && PyString_Check(mod)) { - modname = PyString_AS_STRING(mod); + if (mod && PyBytes_Check(mod)) { + modname = PyBytes_AS_STRING(mod); } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); @@ -193,11 +193,11 @@ modname = "__builtin__"; } if (strcmp(modname, "__builtin__") != 0) - return PyString_FromFormat("<%s.%s>", + return PyBytes_FromFormat("<%s.%s>", modname, fn->m_ml->ml_name); else - return PyString_FromFormat("<%s>", + return PyBytes_FromFormat("<%s>", fn->m_ml->ml_name); } else { @@ -205,7 +205,7 @@ repr(getattr(type(__self__), __name__)) */ PyObject *self = fn->m_self; - PyObject *name = PyString_FromString(fn->m_ml->ml_name); + PyObject *name = PyBytes_FromString(fn->m_ml->ml_name); if (name != NULL) { PyObject *mo = _PyType_Lookup(Py_TYPE(self), name); Py_XINCREF(mo); @@ -218,7 +218,7 @@ } } PyErr_Clear(); - return PyString_FromFormat("", + return PyBytes_FromFormat("", fn->m_ml->ml_name); } } Modified: python/branches/okkoto-sizeof/Modules/_sqlite/cache.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/cache.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/cache.c Wed Jun 4 11:24:23 2008 @@ -241,12 +241,12 @@ if (!fmt_args) { return NULL; } - template = PyString_FromString("%s <- %s ->%s\n"); + template = PyBytes_FromString("%s <- %s ->%s\n"); if (!template) { Py_DECREF(fmt_args); return NULL; } - display_str = PyString_Format(template, fmt_args); + display_str = PyBytes_Format(template, fmt_args); Py_DECREF(template); Py_DECREF(fmt_args); if (!display_str) { Modified: python/branches/okkoto-sizeof/Modules/_sqlite/connection.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/connection.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/connection.c Wed Jun 4 11:24:23 2008 @@ -84,8 +84,8 @@ Py_INCREF(&PyUnicode_Type); self->text_factory = (PyObject*)&PyUnicode_Type; - if (PyString_Check(database) || PyUnicode_Check(database)) { - if (PyString_Check(database)) { + if (PyBytes_Check(database) || PyUnicode_Check(database)) { + if (PyBytes_Check(database)) { database_utf8 = database; Py_INCREF(database_utf8); } else { @@ -96,7 +96,7 @@ } Py_BEGIN_ALLOW_THREADS - rc = sqlite3_open(PyString_AsString(database_utf8), &self->db); + rc = sqlite3_open(PyBytes_AsString(database_utf8), &self->db); Py_END_ALLOW_THREADS Py_DECREF(database_utf8); @@ -111,7 +111,7 @@ if (class_attr) { class_attr_str = PyObject_Str(class_attr); if (class_attr_str) { - if (strcmp(PyString_AsString(class_attr_str), "") == 0) { + if (strcmp(PyBytes_AsString(class_attr_str), "") == 0) { /* In the APSW Connection object, the first entry after * PyObject_HEAD is the sqlite3* we want to get hold of. * Luckily, this is the same layout as we have in our @@ -134,7 +134,7 @@ } if (!isolation_level) { - isolation_level = PyString_FromString(""); + isolation_level = PyBytes_FromString(""); if (!isolation_level) { return -1; } @@ -499,12 +499,12 @@ } else { sqlite3_result_blob(context, buffer, buflen, SQLITE_TRANSIENT); } - } else if (PyString_Check(py_val)) { - sqlite3_result_text(context, PyString_AsString(py_val), -1, SQLITE_TRANSIENT); + } else if (PyBytes_Check(py_val)) { + sqlite3_result_text(context, PyBytes_AsString(py_val), -1, SQLITE_TRANSIENT); } else if (PyUnicode_Check(py_val)) { stringval = PyUnicode_AsUTF8String(py_val); if (stringval) { - sqlite3_result_text(context, PyString_AsString(stringval), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, PyBytes_AsString(stringval), -1, SQLITE_TRANSIENT); Py_DECREF(stringval); } } else { @@ -963,21 +963,21 @@ Py_INCREF(isolation_level); self->isolation_level = isolation_level; - begin_statement = PyString_FromString("BEGIN "); + begin_statement = PyBytes_FromString("BEGIN "); if (!begin_statement) { return -1; } - PyString_Concat(&begin_statement, isolation_level); + PyBytes_Concat(&begin_statement, isolation_level); if (!begin_statement) { return -1; } - self->begin_statement = PyMem_Malloc(PyString_Size(begin_statement) + 2); + self->begin_statement = PyMem_Malloc(PyBytes_Size(begin_statement) + 2); if (!self->begin_statement) { return -1; } - strcpy(self->begin_statement, PyString_AsString(begin_statement)); + strcpy(self->begin_statement, PyBytes_AsString(begin_statement)); Py_DECREF(begin_statement); } @@ -1152,8 +1152,8 @@ goto finally; } - string1 = PyString_FromStringAndSize((const char*)text1_data, text1_length); - string2 = PyString_FromStringAndSize((const char*)text2_data, text2_length); + string1 = PyBytes_FromStringAndSize((const char*)text1_data, text1_length); + string2 = PyBytes_FromStringAndSize((const char*)text2_data, text2_length); if (!string1 || !string2) { goto finally; /* failed to allocate strings */ @@ -1259,7 +1259,7 @@ goto finally; } - if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyString_Type, &name, &callable)) { + if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyBytes_Type, &name, &callable)) { goto finally; } @@ -1268,7 +1268,7 @@ goto finally; } - chk = PyString_AsString(uppercase_name); + chk = PyBytes_AsString(uppercase_name); while (*chk) { if ((*chk >= '0' && *chk <= '9') || (*chk >= 'A' && *chk <= 'Z') @@ -1293,7 +1293,7 @@ } rc = sqlite3_create_collation(self->db, - PyString_AsString(uppercase_name), + PyBytes_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, (callable != Py_None) ? pysqlite_collation_callback : NULL); Modified: python/branches/okkoto-sizeof/Modules/_sqlite/connection.h ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/connection.h (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/connection.h Wed Jun 4 11:24:23 2008 @@ -80,7 +80,7 @@ /* Determines how bytestrings from SQLite are converted to Python objects: * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created. - * - PyString_Type: PyStrings are created as-is. + * - PyBytes_Type: PyStrings are created as-is. * - Any custom callable: Any object returned from the callable called with the bytestring * as single parameter. */ Modified: python/branches/okkoto-sizeof/Modules/_sqlite/cursor.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/cursor.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/cursor.c Wed Jun 4 11:24:23 2008 @@ -101,10 +101,7 @@ self->arraysize = 1; - self->rowcount = PyInt_FromLong(-1L); - if (!self->rowcount) { - return -1; - } + self->rowcount = -1L; Py_INCREF(Py_None); self->row_factory = Py_None; @@ -130,7 +127,6 @@ Py_XDECREF(self->row_cast_map); Py_XDECREF(self->description); Py_XDECREF(self->lastrowid); - Py_XDECREF(self->rowcount); Py_XDECREF(self->row_factory); Py_XDECREF(self->next_row); @@ -182,7 +178,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyString_FromStringAndSize(type_start, pos - type_start); + key = PyBytes_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -207,7 +203,7 @@ * 'NUMBER(10)' to be treated as 'NUMBER', for example. * In other words, it will work as people expect it to work.*/ if (*pos == ' ' || *pos == '(' || *pos == 0) { - py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyBytes_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; } @@ -252,7 +248,7 @@ if ((*pos == '[') && (pos > colname) && (*(pos-1) == ' ')) { pos--; } - return PyString_FromStringAndSize(colname, pos - colname); + return PyBytes_FromStringAndSize(colname, pos - colname); } } } @@ -277,7 +273,7 @@ } if (is_ascii) { - return PyString_FromString(val_str); + return PyBytes_FromString(val_str); } else { return PyUnicode_DecodeUTF8(val_str, strlen(val_str), NULL); } @@ -331,7 +327,7 @@ Py_INCREF(Py_None); converted = Py_None; } else { - item = PyString_FromStringAndSize(val_str, nbytes); + item = PyBytes_FromStringAndSize(val_str, nbytes); if (!item) { return NULL; } @@ -374,8 +370,8 @@ colname , val_str); PyErr_SetString(pysqlite_OperationalError, buf); } - } else if (self->connection->text_factory == (PyObject*)&PyString_Type) { - converted = PyString_FromString(val_str); + } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) { + converted = PyBytes_FromString(val_str); } else { converted = PyObject_CallFunction(self->connection->text_factory, "s", val_str); } @@ -427,12 +423,12 @@ int statement_type; PyObject* descriptor; PyObject* second_argument = NULL; - long rowcount = 0; int allow_8bit_chars; if (!pysqlite_check_thread(self->connection) || !pysqlite_check_connection(self->connection)) { return NULL; } + /* Make shooting yourself in the foot with not utf-8 decodable 8-bit-strings harder */ allow_8bit_chars = ((self->connection->text_factory != (PyObject*)&PyUnicode_Type) && (self->connection->text_factory != (PyObject*)&PyUnicode_Type && pysqlite_OptimizedUnicode)); @@ -446,7 +442,7 @@ return NULL; } - if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -468,7 +464,7 @@ return NULL; } - if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -503,21 +499,22 @@ rc = pysqlite_statement_reset(self->statement); } - if (PyString_Check(operation)) { - operation_cstr = PyString_AsString(operation); + if (PyBytes_Check(operation)) { + operation_cstr = PyBytes_AsString(operation); } else { operation_bytestr = PyUnicode_AsUTF8String(operation); if (!operation_bytestr) { goto error; } - operation_cstr = PyString_AsString(operation_bytestr); + operation_cstr = PyBytes_AsString(operation_bytestr); } - /* reset description */ + /* reset description and rowcount */ Py_DECREF(self->description); Py_INCREF(Py_None); self->description = Py_None; + self->rowcount = -1L; func_args = PyTuple_New(1); if (!func_args) { @@ -693,7 +690,10 @@ case STATEMENT_DELETE: case STATEMENT_INSERT: case STATEMENT_REPLACE: - rowcount += (long)sqlite3_changes(self->connection->db); + if (self->rowcount == -1L) { + self->rowcount = 0L; + } + self->rowcount += (long)sqlite3_changes(self->connection->db); } Py_DECREF(self->lastrowid); @@ -728,13 +728,9 @@ Py_XDECREF(parameters_list); if (PyErr_Occurred()) { - Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(-1L); + self->rowcount = -1L; return NULL; } else { - Py_DECREF(self->rowcount); - self->rowcount = PyInt_FromLong(rowcount); - Py_INCREF(self); return (PyObject*)self; } @@ -768,15 +764,15 @@ return NULL; } - if (PyString_Check(script_obj)) { - script_cstr = PyString_AsString(script_obj); + if (PyBytes_Check(script_obj)) { + script_cstr = PyBytes_AsString(script_obj); } else if (PyUnicode_Check(script_obj)) { script_str = PyUnicode_AsUTF8String(script_obj); if (!script_str) { return NULL; } - script_cstr = PyString_AsString(script_str); + script_cstr = PyBytes_AsString(script_str); } else { PyErr_SetString(PyExc_ValueError, "script argument must be unicode or string."); return NULL; @@ -1028,7 +1024,7 @@ {"description", T_OBJECT, offsetof(pysqlite_Cursor, description), RO}, {"arraysize", T_INT, offsetof(pysqlite_Cursor, arraysize), 0}, {"lastrowid", T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), RO}, - {"rowcount", T_OBJECT, offsetof(pysqlite_Cursor, rowcount), RO}, + {"rowcount", T_LONG, offsetof(pysqlite_Cursor, rowcount), RO}, {"row_factory", T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0}, {NULL} }; Modified: python/branches/okkoto-sizeof/Modules/_sqlite/cursor.h ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/cursor.h (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/cursor.h Wed Jun 4 11:24:23 2008 @@ -37,7 +37,7 @@ PyObject* row_cast_map; int arraysize; PyObject* lastrowid; - PyObject* rowcount; + long rowcount; PyObject* row_factory; pysqlite_Statement* statement; Modified: python/branches/okkoto-sizeof/Modules/_sqlite/module.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/module.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/module.c Wed Jun 4 11:24:23 2008 @@ -137,7 +137,7 @@ /* a basic type is adapted; there's a performance optimization if that's not the case * (99 % of all usages) */ if (type == &PyInt_Type || type == &PyLong_Type || type == &PyFloat_Type - || type == &PyString_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { + || type == &PyBytes_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { pysqlite_BaseTypeAdapted = 1; } @@ -367,13 +367,13 @@ Py_DECREF(tmp_obj); } - if (!(tmp_obj = PyString_FromString(PYSQLITE_VERSION))) { + if (!(tmp_obj = PyBytes_FromString(PYSQLITE_VERSION))) { goto error; } PyDict_SetItemString(dict, "version", tmp_obj); Py_DECREF(tmp_obj); - if (!(tmp_obj = PyString_FromString(sqlite3_libversion()))) { + if (!(tmp_obj = PyBytes_FromString(sqlite3_libversion()))) { goto error; } PyDict_SetItemString(dict, "sqlite_version", tmp_obj); Modified: python/branches/okkoto-sizeof/Modules/_sqlite/row.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/row.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/row.c Wed Jun 4 11:24:23 2008 @@ -86,13 +86,13 @@ item = PyTuple_GetItem(self->data, _idx); Py_XINCREF(item); return item; - } else if (PyString_Check(idx)) { - key = PyString_AsString(idx); + } else if (PyBytes_Check(idx)) { + key = PyBytes_AsString(idx); nitems = PyTuple_Size(self->description); for (i = 0; i < nitems; i++) { - compare_key = PyString_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); + compare_key = PyBytes_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); if (!compare_key) { return NULL; } Modified: python/branches/okkoto-sizeof/Modules/_sqlite/statement.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sqlite/statement.c (original) +++ python/branches/okkoto-sizeof/Modules/_sqlite/statement.c Wed Jun 4 11:24:23 2008 @@ -60,7 +60,7 @@ self->st = NULL; self->in_use = 0; - if (PyString_Check(sql)) { + if (PyBytes_Check(sql)) { sql_str = sql; Py_INCREF(sql_str); } else if (PyUnicode_Check(sql)) { @@ -77,7 +77,7 @@ self->in_weakreflist = NULL; self->sql = sql_str; - sql_cstr = PyString_AsString(sql_str); + sql_cstr = PyBytes_AsString(sql_str); rc = sqlite3_prepare(connection->db, sql_cstr, @@ -119,7 +119,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_CheckExact(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyString_CheckExact(parameter)) { + } else if (PyBytes_CheckExact(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_CheckExact(parameter)) { paramtype = TYPE_UNICODE; @@ -131,7 +131,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_Check(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyString_Check(parameter)) { + } else if (PyBytes_Check(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_Check(parameter)) { paramtype = TYPE_UNICODE; @@ -140,7 +140,7 @@ } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyString_AS_STRING(parameter); + string = PyBytes_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); @@ -164,12 +164,12 @@ rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_STRING: - string = PyString_AS_STRING(parameter); + string = PyBytes_AS_STRING(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_UNICODE: stringval = PyUnicode_AsUTF8String(parameter); - string = PyString_AsString(stringval); + string = PyBytes_AsString(stringval); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); break; @@ -197,7 +197,7 @@ } if (PyInt_CheckExact(obj) || PyLong_CheckExact(obj) - || PyFloat_CheckExact(obj) || PyString_CheckExact(obj) + || PyFloat_CheckExact(obj) || PyBytes_CheckExact(obj) || PyUnicode_CheckExact(obj) || PyBuffer_Check(obj)) { return 0; } else { @@ -326,7 +326,7 @@ char* sql_cstr; sqlite3_stmt* new_st; - sql_cstr = PyString_AsString(self->sql); + sql_cstr = PyBytes_AsString(self->sql); rc = sqlite3_prepare(self->db, sql_cstr, Modified: python/branches/okkoto-sizeof/Modules/_sre.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_sre.c (original) +++ python/branches/okkoto-sizeof/Modules/_sre.c Wed Jun 4 11:24:23 2008 @@ -1715,7 +1715,7 @@ size = PyObject_Length(string); #endif - if (PyString_Check(string) || bytes == size) + if (PyBytes_Check(string) || bytes == size) charsize = 1; #if defined(HAVE_UNICODE) else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE))) @@ -1949,7 +1949,7 @@ if (!args) return NULL; - name = PyString_FromString(module); + name = PyBytes_FromString(module); if (!name) return NULL; mod = PyImport_Import(name); @@ -3416,7 +3416,7 @@ Py_DECREF(x); } - x = PyString_FromString(copyright); + x = PyBytes_FromString(copyright); if (x) { PyDict_SetItemString(d, "copyright", x); Py_DECREF(x); Modified: python/branches/okkoto-sizeof/Modules/_ssl.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_ssl.c (original) +++ python/branches/okkoto-sizeof/Modules/_ssl.c Wed Jun 4 11:24:23 2008 @@ -491,13 +491,13 @@ static PyObject * PySSL_server(PySSLObject *self) { - return PyString_FromString(self->server); + return PyBytes_FromString(self->server); } static PyObject * PySSL_issuer(PySSLObject *self) { - return PyString_FromString(self->issuer); + return PyBytes_FromString(self->issuer); } static PyObject * @@ -515,7 +515,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail; } - name_obj = PyString_FromStringAndSize(namebuf, buflen); + name_obj = PyBytes_FromStringAndSize(namebuf, buflen); if (name_obj == NULL) goto fail; @@ -603,8 +603,8 @@ /* fprintf(stderr, "RDN level %d, attribute %s: %s\n", entry->set, - PyString_AS_STRING(PyTuple_GET_ITEM(attr, 0)), - PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1))); + PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 0)), + PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 1))); */ if (attr == NULL) goto fail1; @@ -711,7 +711,7 @@ goto fail; } - v = PyString_FromString("DirName"); + v = PyBytes_FromString("DirName"); if (v == NULL) { Py_DECREF(t); goto fail; @@ -742,13 +742,13 @@ t = PyTuple_New(2); if (t == NULL) goto fail; - v = PyString_FromStringAndSize(buf, (vptr - buf)); + v = PyBytes_FromStringAndSize(buf, (vptr - buf)); if (v == NULL) { Py_DECREF(t); goto fail; } PyTuple_SET_ITEM(t, 0, v); - v = PyString_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); + v = PyBytes_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); if (v == NULL) { Py_DECREF(t); goto fail; @@ -849,7 +849,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - sn_obj = PyString_FromStringAndSize(buf, len); + sn_obj = PyBytes_FromStringAndSize(buf, len); if (sn_obj == NULL) goto fail1; if (PyDict_SetItemString(retval, "serialNumber", sn_obj) < 0) { @@ -866,7 +866,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotBefore = PyString_FromStringAndSize(buf, len); + pnotBefore = PyBytes_FromStringAndSize(buf, len); if (pnotBefore == NULL) goto fail1; if (PyDict_SetItemString(retval, "notBefore", pnotBefore) < 0) { @@ -884,7 +884,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotAfter = PyString_FromStringAndSize(buf, len); + pnotAfter = PyBytes_FromStringAndSize(buf, len); if (pnotAfter == NULL) goto fail1; if (PyDict_SetItemString(retval, "notAfter", pnotAfter) < 0) { @@ -981,7 +981,7 @@ PySSL_SetError(self, len, __FILE__, __LINE__); return NULL; } - retval = PyString_FromStringAndSize((const char *) bytes_buf, len); + retval = PyBytes_FromStringAndSize((const char *) bytes_buf, len); OPENSSL_free(bytes_buf); return retval; @@ -1028,7 +1028,7 @@ if (cipher_name == NULL) { PyTuple_SET_ITEM(retval, 0, Py_None); } else { - v = PyString_FromString(cipher_name); + v = PyBytes_FromString(cipher_name); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 0, v); @@ -1037,7 +1037,7 @@ if (cipher_protocol == NULL) { PyTuple_SET_ITEM(retval, 1, Py_None); } else { - v = PyString_FromString(cipher_protocol); + v = PyBytes_FromString(cipher_protocol); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 1, v); @@ -1211,7 +1211,7 @@ if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; - if (!(buf = PyString_FromStringAndSize((char *) 0, len))) + if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) return NULL; /* first check if there are bytes ready to be read */ @@ -1233,14 +1233,14 @@ return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { /* should contain a zero-length string */ - _PyString_Resize(&buf, 0); + _PyBytes_Resize(&buf, 0); return buf; } } do { err = 0; PySSL_BEGIN_ALLOW_THREADS - count = SSL_read(self->ssl, PyString_AsString(buf), len); + count = SSL_read(self->ssl, PyBytes_AsString(buf), len); err = SSL_get_error(self->ssl, count); PySSL_END_ALLOW_THREADS if(PyErr_CheckSignals()) { @@ -1257,7 +1257,7 @@ (SSL_get_shutdown(self->ssl) == SSL_RECEIVED_SHUTDOWN)) { - _PyString_Resize(&buf, 0); + _PyBytes_Resize(&buf, 0); return buf; } else { sockstate = SOCKET_OPERATION_OK; @@ -1276,7 +1276,7 @@ return PySSL_SetError(self, count, __FILE__, __LINE__); } if (count != len) - _PyString_Resize(&buf, count); + _PyBytes_Resize(&buf, count); return buf; } @@ -1362,11 +1362,11 @@ { int bytes; - if (!PyString_Check(arg)) + if (!PyBytes_Check(arg)) return PyErr_Format(PyExc_TypeError, "RAND_egd() expected string, found %s", Py_TYPE(arg)->tp_name); - bytes = RAND_egd(PyString_AS_STRING(arg)); + bytes = RAND_egd(PyBytes_AS_STRING(arg)); if (bytes == -1) { PyErr_SetString(PySSLErrorObject, "EGD connection failed or EGD did not return " Modified: python/branches/okkoto-sizeof/Modules/_struct.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_struct.c (original) +++ python/branches/okkoto-sizeof/Modules/_struct.c Wed Jun 4 11:24:23 2008 @@ -413,7 +413,7 @@ if (msg == NULL) return -1; rval = PyErr_WarnEx(PyExc_DeprecationWarning, - PyString_AS_STRING(msg), 2); + PyBytes_AS_STRING(msg), 2); Py_DECREF(msg); if (rval == 0) return 0; @@ -446,7 +446,7 @@ static PyObject * nu_char(const char *p, const formatdef *f) { - return PyString_FromStringAndSize(p, 1); + return PyBytes_FromStringAndSize(p, 1); } static PyObject * @@ -610,12 +610,12 @@ static int np_char(char *p, PyObject *v, const formatdef *f) { - if (!PyString_Check(v) || PyString_Size(v) != 1) { + if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) { PyErr_SetString(StructError, "char format require string of length 1"); return -1; } - *p = *PyString_AsString(v); + *p = *PyBytes_AsString(v); return 0; } @@ -1335,7 +1335,7 @@ char c; Py_ssize_t size, len, num, itemsize, x; - fmt = PyString_AS_STRING(self->s_format); + fmt = PyBytes_AS_STRING(self->s_format); f = whichtable((char **)&fmt); @@ -1503,12 +1503,12 @@ const formatdef *e = code->fmtdef; const char *res = startfrom + code->offset; if (e->format == 's') { - v = PyString_FromStringAndSize(res, code->size); + v = PyBytes_FromStringAndSize(res, code->size); } else if (e->format == 'p') { Py_ssize_t n = *(unsigned char*)res; if (n >= code->size) n = code->size - 1; - v = PyString_FromStringAndSize(res + 1, n); + v = PyBytes_FromStringAndSize(res + 1, n); } else { v = e->unpack(res, e); } @@ -1542,9 +1542,9 @@ assert(soself->s_codes != NULL); if (inputstr == NULL) goto fail; - if (PyString_Check(inputstr) && - PyString_GET_SIZE(inputstr) == soself->s_size) { - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); + if (PyBytes_Check(inputstr) && + PyBytes_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyBytes_AS_STRING(inputstr)); } args = PyTuple_Pack(1, inputstr); if (args == NULL) @@ -1637,27 +1637,27 @@ const formatdef *e = code->fmtdef; char *res = buf + code->offset; if (e->format == 's') { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(StructError, "argument for 's' must be a string"); return -1; } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > code->size) n = code->size; if (n > 0) - memcpy(res, PyString_AS_STRING(v), n); + memcpy(res, PyBytes_AS_STRING(v), n); } else if (e->format == 'p') { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(StructError, "argument for 'p' must be a string"); return -1; } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > (code->size - 1)) n = code->size - 1; if (n > 0) - memcpy(res + 1, PyString_AS_STRING(v), n); + memcpy(res + 1, PyBytes_AS_STRING(v), n); if (n > 255) n = 255; *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); @@ -1700,12 +1700,12 @@ } /* Allocate a new string */ - result = PyString_FromStringAndSize((char *)NULL, soself->s_size); + result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size); if (result == NULL) return NULL; /* Call the guts */ - if ( s_pack_internal(soself, args, 0, PyString_AS_STRING(result)) != 0 ) { + if ( s_pack_internal(soself, args, 0, PyBytes_AS_STRING(result)) != 0 ) { Py_DECREF(result); return NULL; } @@ -2061,7 +2061,7 @@ { PyObject *ver, *m; - ver = PyString_FromString("0.2"); + ver = PyBytes_FromString("0.2"); if (ver == NULL) return; Modified: python/branches/okkoto-sizeof/Modules/_testcapimodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_testcapimodule.c (original) +++ python/branches/okkoto-sizeof/Modules/_testcapimodule.c Wed Jun 4 11:24:23 2008 @@ -691,7 +691,7 @@ } #endif -/* Some tests of PyString_FromFormat(). This needs more tests. */ +/* Some tests of PyBytes_FromFormat(). This needs more tests. */ static PyObject * test_string_from_format(PyObject *self, PyObject *args) { @@ -699,10 +699,10 @@ char *msg; #define CHECK_1_FORMAT(FORMAT, TYPE) \ - result = PyString_FromFormat(FORMAT, (TYPE)1); \ + result = PyBytes_FromFormat(FORMAT, (TYPE)1); \ if (result == NULL) \ return NULL; \ - if (strcmp(PyString_AsString(result), "1")) { \ + if (strcmp(PyBytes_AsString(result), "1")) { \ msg = FORMAT " failed at 1"; \ goto Fail; \ } \ Modified: python/branches/okkoto-sizeof/Modules/_tkinter.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/_tkinter.c (original) +++ python/branches/okkoto-sizeof/Modules/_tkinter.c Wed Jun 4 11:24:23 2008 @@ -335,8 +335,8 @@ static char * AsString(PyObject *value, PyObject *tmp) { - if (PyString_Check(value)) - return PyString_AsString(value); + if (PyBytes_Check(value)) + return PyBytes_AsString(value); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { PyObject *v = PyUnicode_AsUTF8String(value); @@ -347,7 +347,7 @@ return NULL; } Py_DECREF(v); - return PyString_AsString(v); + return PyBytes_AsString(v); } #endif else { @@ -359,7 +359,7 @@ return NULL; } Py_DECREF(v); - return PyString_AsString(v); + return PyBytes_AsString(v); } } @@ -462,13 +462,13 @@ * Could be a quoted string containing funnies, e.g. {"}. * Return the string itself. */ - return PyString_FromString(list); + return PyBytes_FromString(list); } if (argc == 0) - v = PyString_FromString(""); + v = PyBytes_FromString(""); else if (argc == 1) - v = PyString_FromString(argv[0]); + v = PyBytes_FromString(argv[0]); else if ((v = PyTuple_New(argc)) != NULL) { int i; PyObject *w; @@ -530,10 +530,10 @@ return result; /* Fall through, returning arg. */ } - else if (PyString_Check(arg)) { + else if (PyBytes_Check(arg)) { int argc; char **argv; - char *list = PyString_AsString(arg); + char *list = PyBytes_AsString(arg); if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { Py_INCREF(arg); @@ -541,7 +541,7 @@ } Tcl_Free(FREECAST argv); if (argc > 1) - return Split(PyString_AsString(arg)); + return Split(PyBytes_AsString(arg)); /* Fall through, returning arg. */ } Py_INCREF(arg); @@ -747,12 +747,12 @@ static PyObject * PyTclObject_str(PyTclObject *self) { - if (self->string && PyString_Check(self->string)) { + if (self->string && PyBytes_Check(self->string)) { Py_INCREF(self->string); return self->string; } /* XXX Could cache value if it is an ASCII string. */ - return PyString_FromString(Tcl_GetString(self->value)); + return PyBytes_FromString(Tcl_GetString(self->value)); } static char* @@ -778,16 +778,16 @@ #ifdef Py_USING_UNICODE if (i == len) /* It is an ASCII string. */ - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); else { self->string = PyUnicode_DecodeUTF8(s, len, "strict"); if (!self->string) { PyErr_Clear(); - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); } } #else - self->string = PyString_FromStringAndSize(s, len); + self->string = PyBytes_FromStringAndSize(s, len); #endif if (!self->string) return NULL; @@ -820,7 +820,7 @@ char buf[50]; PyOS_snprintf(buf, 50, "<%s object at %p>", self->value->typePtr->name, self->value); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int @@ -839,7 +839,7 @@ static PyObject* get_typename(PyTclObject* obj, void* ignored) { - return PyString_FromString(obj->value->typePtr->name); + return PyBytes_FromString(obj->value->typePtr->name); } @@ -908,9 +908,9 @@ { Tcl_Obj *result; - if (PyString_Check(value)) - return Tcl_NewStringObj(PyString_AS_STRING(value), - PyString_GET_SIZE(value)); + if (PyBytes_Check(value)) + return Tcl_NewStringObj(PyBytes_AS_STRING(value), + PyBytes_GET_SIZE(value)); else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyInt_Check(value)) @@ -999,17 +999,17 @@ } if (i == value->length) - result = PyString_FromStringAndSize(s, len); + result = PyBytes_FromStringAndSize(s, len); else { /* Convert UTF-8 to Unicode string */ result = PyUnicode_DecodeUTF8(s, len, "strict"); if (result == NULL) { PyErr_Clear(); - result = PyString_FromStringAndSize(s, len); + result = PyBytes_FromStringAndSize(s, len); } } #else - result = PyString_FromStringAndSize(value->bytes, value->length); + result = PyBytes_FromStringAndSize(value->bytes, value->length); #endif return result; } @@ -1023,7 +1023,7 @@ if (value->typePtr == app->ByteArrayType) { int size; char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); - return PyString_FromStringAndSize(data, size); + return PyBytes_FromStringAndSize(data, size); } if (value->typePtr == app->DoubleType) { @@ -1092,7 +1092,7 @@ int size; char *c; c = Tcl_GetStringFromObj(value, &size); - return PyString_FromStringAndSize(c, size); + return PyBytes_FromStringAndSize(c, size); #endif } @@ -1204,19 +1204,19 @@ } if (*p == '\0') - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); else { /* Convert UTF-8 to Unicode string */ p = strchr(p, '\0'); res = PyUnicode_DecodeUTF8(s, (int)(p-s), "strict"); if (res == NULL) { PyErr_Clear(); - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); } } #else p = strchr(p, '\0'); - res = PyString_FromStringAndSize(s, (int)(p-s)); + res = PyBytes_FromStringAndSize(s, (int)(p-s)); #endif } return res; @@ -1370,7 +1370,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL ckfree(cmd); } @@ -1396,7 +1396,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1419,7 +1419,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1443,7 +1443,7 @@ res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1466,7 +1466,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyString_FromString(Tkapp_Result(self)); + res = PyBytes_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1511,8 +1511,8 @@ varname_converter(PyObject *in, void *_out) { char **out = (char**)_out; - if (PyString_Check(in)) { - *out = PyString_AsString(in); + if (PyBytes_Check(in)) { + *out = PyBytes_AsString(in); return 1; } if (PyTclObject_Check(in)) { @@ -1676,7 +1676,7 @@ res = FromObj(self, tres); } else { - res = PyString_FromString(Tcl_GetString(tres)); + res = PyBytes_FromString(Tcl_GetString(tres)); } } LEAVE_OVERLAP_TCL @@ -1920,7 +1920,7 @@ goto finally; for (i = 0; i < argc; i++) { - PyObject *s = PyString_FromString(argv[i]); + PyObject *s = PyBytes_FromString(argv[i]); if (!s || PyTuple_SetItem(v, i, s)) { Py_DECREF(v); v = NULL; @@ -1961,7 +1961,7 @@ PyObject *res = NULL; if (s) { - res = PyString_FromString(s); + res = PyBytes_FromString(s); ckfree(s); } @@ -2011,7 +2011,7 @@ return PythonCmd_Error(interp); for (i = 0; i < (argc - 1); i++) { - PyObject *s = PyString_FromString(argv[i + 1]); + PyObject *s = PyBytes_FromString(argv[i + 1]); if (!s || PyTuple_SetItem(arg, i, s)) { Py_DECREF(arg); return PythonCmd_Error(interp); @@ -2406,7 +2406,7 @@ PyOS_snprintf(buf, sizeof(buf), "", v, v->func == NULL ? ", handler deleted" : ""); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -3087,7 +3087,7 @@ static void ins_string(PyObject *d, char *name, char *val) { - PyObject *v = PyString_FromString(val); + PyObject *v = PyBytes_FromString(val); if (v) { PyDict_SetItemString(d, name, v); Py_DECREF(v); Modified: python/branches/okkoto-sizeof/Modules/almodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/almodule.c (original) +++ python/branches/okkoto-sizeof/Modules/almodule.c Wed Jun 4 11:24:23 2008 @@ -84,7 +84,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString((char *) value.ptr); + return PyBytes_FromString((char *) value.ptr); default: PyErr_SetString(ErrorObject, "unknown element type"); return NULL; @@ -149,12 +149,12 @@ PyErr_SetString(ErrorObject, "unknown element type"); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_BadArgument(); return -1; } - param->value.ptr = PyString_AS_STRING(value); - param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ + param->value.ptr = PyBytes_AS_STRING(value); + param->sizeIn = PyBytes_GET_SIZE(value)+1; /*account for NUL*/ break; case AL_SET_VAL: case AL_VECTOR_VAL: @@ -765,12 +765,12 @@ return NULL; } size *= ch; - v = PyString_FromStringAndSize((char *) NULL, size * framecount); + v = PyBytes_FromStringAndSize((char *) NULL, size * framecount); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); + alReadFrames(self->port, (void *) PyBytes_AS_STRING(v), framecount); Py_END_ALLOW_THREADS return v; @@ -1068,12 +1068,12 @@ width = ALgetwidth(c); #endif /* AL_405 */ ALfreeconfig(c); - v = PyString_FromStringAndSize((char *)NULL, width * count); + v = PyBytes_FromStringAndSize((char *)NULL, width * count); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); + ret = ALreadsamps(self->port, (void *) PyBytes_AsString(v), count); Py_END_ALLOW_THREADS if (ret == -1) { Py_DECREF(v); @@ -1498,7 +1498,7 @@ Py_INCREF(item); break; case AL_STRING_VAL: - item = PyString_FromString(pvs[i].value.ptr); + item = PyBytes_FromString(pvs[i].value.ptr); PyMem_DEL(pvs[i].value.ptr); break; case AL_MATRIX_VAL: @@ -1725,7 +1725,7 @@ PyDict_SetItemString(v, "elementType", item); Py_DECREF(item); - item = PyString_FromString(pinfo.name); + item = PyBytes_FromString(pinfo.name); PyDict_SetItemString(v, "name", item); Py_DECREF(item); @@ -1920,7 +1920,7 @@ return NULL; if ((name = ALgetname(device, descriptor)) == NULL) return NULL; - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * Modified: python/branches/okkoto-sizeof/Modules/arraymodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/arraymodule.c (original) +++ python/branches/okkoto-sizeof/Modules/arraymodule.c Wed Jun 4 11:24:23 2008 @@ -104,7 +104,7 @@ static PyObject * c_getitem(arrayobject *ap, Py_ssize_t i) { - return PyString_FromStringAndSize(&((char *)ap->ob_item)[i], 1); + return PyBytes_FromStringAndSize(&((char *)ap->ob_item)[i], 1); } static int @@ -1414,7 +1414,7 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyString_FromStringAndSize(self->ob_item, + return PyBytes_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } @@ -1494,7 +1494,7 @@ array_get_typecode(arrayobject *a, void *closure) { char tc = a->ob_descr->typecode; - return PyString_FromStringAndSize(&tc, 1); + return PyBytes_FromStringAndSize(&tc, 1); } static PyObject * @@ -1578,7 +1578,7 @@ typecode = a->ob_descr->typecode; if (len == 0) { PyOS_snprintf(buf, sizeof(buf), "array('%c')", typecode); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } if (typecode == 'c') @@ -1593,9 +1593,9 @@ Py_XDECREF(v); PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); - s = PyString_FromString(buf); - PyString_ConcatAndDel(&s, t); - PyString_ConcatAndDel(&s, PyString_FromString(")")); + s = PyBytes_FromString(buf); + PyBytes_ConcatAndDel(&s, t); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); return s; } @@ -1881,7 +1881,7 @@ return NULL; if (!(initial == NULL || PyList_Check(initial) - || PyString_Check(initial) || PyTuple_Check(initial) + || PyBytes_Check(initial) || PyTuple_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { it = PyObject_GetIter(initial); if (it == NULL) @@ -1924,7 +1924,7 @@ } Py_DECREF(v); } - } else if (initial != NULL && PyString_Check(initial)) { + } else if (initial != NULL && PyBytes_Check(initial)) { PyObject *t_initial, *v; t_initial = PyTuple_Pack(1, initial); if (t_initial == NULL) { Modified: python/branches/okkoto-sizeof/Modules/audioop.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/audioop.c (original) +++ python/branches/okkoto-sizeof/Modules/audioop.c Wed Jun 4 11:24:23 2008 @@ -474,7 +474,7 @@ /* Passing a short** for an 's' argument is correct only if the string contents is aligned for interpretation - as short[]. Due to the definition of PyStringObject, + as short[]. Due to the definition of PyBytesObject, this is currently (Python 2.6) the case. */ if ( !PyArg_ParseTuple(args, "s#s#:findfit", (char**)&cp1, &len1, (char**)&cp2, &len2) ) @@ -759,10 +759,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -801,10 +801,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/2); + rv = PyBytes_FromStringAndSize(NULL, len/2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size*2 ) { @@ -846,10 +846,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*2); + rv = PyBytes_FromStringAndSize(NULL, len*2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -903,10 +903,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len1); + rv = PyBytes_FromStringAndSize(NULL, len1); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len1; i += size ) { if ( size == 1 ) val1 = (int)*CHARP(cp1, i); @@ -949,10 +949,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { @@ -985,10 +985,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1023,10 +1023,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len/size)*size2); + rv = PyBytes_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1157,7 +1157,7 @@ nbytes / bytes_per_frame != ceiling) str = NULL; else - str = PyString_FromStringAndSize(NULL, nbytes); + str = PyBytes_FromStringAndSize(NULL, nbytes); if (str == NULL) { PyErr_SetString(PyExc_MemoryError, @@ -1165,7 +1165,7 @@ goto exit; } } - ncp = PyString_AsString(str); + ncp = PyBytes_AsString(str); for (;;) { while (d < 0) { @@ -1182,13 +1182,13 @@ goto exit; /* We have checked before that the length * of the string fits into int. */ - len = (int)(ncp - PyString_AsString(str)); + len = (int)(ncp - PyBytes_AsString(str)); if (len == 0) { /*don't want to resize to zero length*/ - rv = PyString_FromStringAndSize("", 0); + rv = PyBytes_FromStringAndSize("", 0); Py_DECREF(str); str = rv; - } else if (_PyString_Resize(&str, len) < 0) + } else if (_PyBytes_Resize(&str, len) < 0) goto exit; rv = Py_BuildValue("(O(iO))", str, d, samps); Py_DECREF(samps); @@ -1255,10 +1255,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/size); + rv = PyBytes_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1289,10 +1289,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + rv = PyBytes_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1323,10 +1323,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len/size); + rv = PyBytes_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1357,10 +1357,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + rv = PyBytes_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyString_AsString(rv); + ncp = (signed char *)PyBytes_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1393,10 +1393,10 @@ return 0; } - str = PyString_FromStringAndSize(NULL, len/(size*2)); + str = PyBytes_FromStringAndSize(NULL, len/(size*2)); if ( str == 0 ) return 0; - ncp = (signed char *)PyString_AsString(str); + ncp = (signed char *)PyBytes_AsString(str); /* Decode state, should have (value, step) */ if ( state == Py_None ) { @@ -1509,10 +1509,10 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyString_FromStringAndSize(NULL, len*size*2); + str = PyBytes_FromStringAndSize(NULL, len*size*2); if ( str == 0 ) return 0; - ncp = (signed char *)PyString_AsString(str); + ncp = (signed char *)PyBytes_AsString(str); step = stepsizeTable[index]; bufferstep = 0; Modified: python/branches/okkoto-sizeof/Modules/binascii.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/binascii.c (original) +++ python/branches/okkoto-sizeof/Modules/binascii.c Wed Jun 4 11:24:23 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) +#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyBytesObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -203,9 +203,9 @@ ascii_len--; /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { /* XXX is it really best to add NULs if there's no more data */ @@ -280,9 +280,9 @@ } /* We're lazy and allocate to much (fixed up later) */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyString_AsString(rv); + ascii_data = (unsigned char *)PyBytes_AsString(rv); /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); @@ -304,8 +304,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -354,9 +354,9 @@ bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); bin_len = 0; for( ; ascii_len > 0; ascii_len--, ascii_data++) { @@ -415,13 +415,13 @@ /* And set string size correctly. If the result string is empty ** (because the input was all invalid) return the shared empty - ** string instead; _PyString_Resize() won't do this for us. + ** string instead; _PyBytes_Resize() won't do this for us. */ if (bin_len > 0) - _PyString_Resize(&rv, bin_len); + _PyBytes_Resize(&rv, bin_len); else { Py_DECREF(rv); - rv = PyString_FromString(""); + rv = PyBytes_FromString(""); } return rv; } @@ -448,9 +448,9 @@ /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing newline. Note that 'b' gets encoded as 'Yg==\n' (1 in, 5 out). */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyString_AsString(rv); + ascii_data = (unsigned char *)PyBytes_AsString(rv); for( ; bin_len > 0 ; bin_len--, bin_data++ ) { /* Shift the data into our buffer */ @@ -474,8 +474,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -498,9 +498,9 @@ /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ - if ( (rv=PyString_FromStringAndSize(NULL, len+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, len+2)) == NULL ) return NULL; - bin_data = (unsigned char *)PyString_AsString(rv); + bin_data = (unsigned char *)PyBytes_AsString(rv); for( ; len > 0 ; len--, ascii_data++ ) { /* Get the byte and look it up */ @@ -534,8 +534,8 @@ Py_DECREF(rv); return NULL; } - _PyString_Resize( - &rv, (bin_data - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize( + &rv, (bin_data - (unsigned char *)PyBytes_AsString(rv))); if (rv) { PyObject *rrv = Py_BuildValue("Oi", rv, done); Py_DECREF(rv); @@ -559,9 +559,9 @@ return NULL; /* Worst case: output is twice as big as input (fixed later) */ - if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; - out_data = (unsigned char *)PyString_AsString(rv); + out_data = (unsigned char *)PyBytes_AsString(rv); for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ @@ -627,8 +627,8 @@ leftchar <<= (6-leftbits); *ascii_data++ = table_b2a_hqx[leftchar & 0x3f]; } - _PyString_Resize(&rv, (ascii_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (ascii_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -647,14 +647,14 @@ /* Empty string is a special case */ if ( in_len == 0 ) - return PyString_FromString(""); + return PyBytes_FromString(""); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; - if ( (rv=PyString_FromStringAndSize(NULL, out_len)) == NULL ) + if ( (rv=PyBytes_FromStringAndSize(NULL, out_len)) == NULL ) return NULL; out_len_left = out_len; - out_data = (unsigned char *)PyString_AsString(rv); + out_data = (unsigned char *)PyBytes_AsString(rv); /* ** We need two macros here to get/put bytes and handle @@ -673,9 +673,9 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ - _PyString_Resize(&rv, 2*out_len); \ + _PyBytes_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ - out_data = (unsigned char *)PyString_AsString(rv) \ + out_data = (unsigned char *)PyBytes_AsString(rv) \ + out_len; \ out_len_left = out_len-1; \ out_len = out_len * 2; \ @@ -723,8 +723,8 @@ OUTBYTE(in_byte); } } - _PyString_Resize(&rv, (out_data - - (unsigned char *)PyString_AsString(rv))); + _PyBytes_Resize(&rv, (out_data - + (unsigned char *)PyBytes_AsString(rv))); return rv; } @@ -923,10 +923,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; - retval = PyString_FromStringAndSize(NULL, arglen*2); + retval = PyBytes_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; - retbuf = PyString_AsString(retval); + retbuf = PyBytes_AsString(retval); if (!retbuf) goto finally; @@ -989,10 +989,10 @@ return NULL; } - retval = PyString_FromStringAndSize(NULL, (arglen/2)); + retval = PyBytes_FromStringAndSize(NULL, (arglen/2)); if (!retval) return NULL; - retbuf = PyString_AsString(retval); + retbuf = PyBytes_AsString(retval); if (!retbuf) goto finally; @@ -1106,7 +1106,7 @@ out++; } } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1306,7 +1306,7 @@ } } } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1354,7 +1354,7 @@ return; d = PyModule_GetDict(m); - x = PyString_FromString(doc_binascii); + x = PyBytes_FromString(doc_binascii); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/okkoto-sizeof/Modules/bsddb.h ============================================================================== --- python/branches/okkoto-sizeof/Modules/bsddb.h (original) +++ python/branches/okkoto-sizeof/Modules/bsddb.h Wed Jun 4 11:24:23 2008 @@ -105,7 +105,7 @@ #error "eek! DBVER can't handle minor versions > 9" #endif -#define PY_BSDDB_VERSION "4.6.5devel2" +#define PY_BSDDB_VERSION "4.7.0" /* Python object definitions */ Modified: python/branches/okkoto-sizeof/Modules/bsddbmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/bsddbmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/bsddbmodule.c Wed Jun 4 11:24:23 2008 @@ -312,7 +312,7 @@ return NULL; } - result = PyString_FromStringAndSize(data, (int)drec.size); + result = PyBytes_FromStringAndSize(data, (int)drec.size); if (data != buf) free(data); return result; } @@ -424,7 +424,7 @@ if (dp->di_type == DB_RECNO) item = PyInt_FromLong(*((int*)data)); else - item = PyString_FromStringAndSize(data, + item = PyBytes_FromStringAndSize(data, (int)krec.size); if (data != buf) free(data); if (item == NULL) { Modified: python/branches/okkoto-sizeof/Modules/bz2module.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/bz2module.c (original) +++ python/branches/okkoto-sizeof/Modules/bz2module.c Wed Jun 4 11:24:23 2008 @@ -34,7 +34,7 @@ #error "Large file support, but neither off_t nor fpos_t is large enough." #endif -#define BUF(v) PyString_AS_STRING((PyStringObject *)v) +#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) #define MODE_CLOSED 0 #define MODE_READ 1 @@ -241,7 +241,7 @@ int univ_newline = f->f_univ_newline; total_v_size = n > 0 ? n : 100; - v = PyString_FromStringAndSize((char *)NULL, total_v_size); + v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; @@ -307,7 +307,7 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, total_v_size) < 0) + if (_PyBytes_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -315,7 +315,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyString_Resize(&v, used_v_size); + _PyBytes_Resize(&v, used_v_size); return v; } @@ -438,10 +438,10 @@ /* This is a hacked version of Python's * fileobject.c:readahead_get_line_skip(). */ -static PyStringObject * +static PyBytesObject * Util_ReadAheadGetLineSkip(BZ2FileObject *f, int skip, int bufsize) { - PyStringObject* s; + PyBytesObject* s; char *bufptr; char *buf; int len; @@ -452,17 +452,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyStringObject *) - PyString_FromStringAndSize(NULL, skip); + return (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip); bufptr = memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyStringObject *) - PyString_FromStringAndSize(NULL, skip+len); + s = (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) Util_DropReadAhead(f); @@ -476,7 +476,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyString_AS_STRING(s)+skip, bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -509,7 +509,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -531,7 +531,7 @@ "more than a Python string can hold"); goto cleanup; } - ret = PyString_FromStringAndSize((char *)NULL, buffersize); + ret = PyBytes_FromStringAndSize((char *)NULL, buffersize); if (ret == NULL) goto cleanup; bytesread = 0; @@ -557,14 +557,14 @@ } if (bytesrequested < 0) { buffersize = Util_NewBufferSize(buffersize); - if (_PyString_Resize(&ret, buffersize) < 0) + if (_PyBytes_Resize(&ret, buffersize) < 0) goto cleanup; } else { break; } } if (bytesread != buffersize) - _PyString_Resize(&ret, bytesread); + _PyBytes_Resize(&ret, bytesread); cleanup: RELEASE_LOCK(self); @@ -594,7 +594,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -607,7 +607,7 @@ } if (sizehint == 0) - ret = PyString_FromString(""); + ret = PyBytes_FromString(""); else ret = Util_GetLine(self, (sizehint < 0) ? 0 : sizehint); @@ -701,17 +701,17 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyString_FromStringAndSize( + big_buffer = PyBytes_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - _PyString_Resize(&big_buffer, buffersize); - buffer = PyString_AS_STRING(big_buffer); + _PyBytes_Resize(&big_buffer, buffersize); + buffer = PyBytes_AS_STRING(big_buffer); } continue; } @@ -720,7 +720,7 @@ while (p != NULL) { /* Process complete lines */ p++; - line = PyString_FromStringAndSize(q, p-q); + line = PyBytes_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -743,7 +743,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyString_FromStringAndSize(buffer, nfilled); + line = PyBytes_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -753,7 +753,7 @@ Py_DECREF(line); goto error; } - PyString_Concat(&line, rest); + PyBytes_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -915,7 +915,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { const char *buffer; Py_ssize_t len; if (PyObject_AsCharBuffer(v, &buffer, &len)) { @@ -926,7 +926,7 @@ "strings"); goto error; } - line = PyString_FromStringAndSize(buffer, + line = PyBytes_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -942,9 +942,9 @@ Py_BEGIN_ALLOW_THREADS for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyString_GET_SIZE(line); + len = PyBytes_GET_SIZE(line); BZ2_bzWrite (&bzerror, self->fp, - PyString_AS_STRING(line), len); + PyBytes_AS_STRING(line), len); if (bzerror != BZ_OK) { Py_BLOCK_THREADS Util_CatchBZ2Error(bzerror); @@ -1224,13 +1224,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyString_FromString("\r"); + return PyBytes_FromString("\r"); case NEWLINE_LF: - return PyString_FromString("\n"); + return PyBytes_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyString_FromString("\r\n"); + return PyBytes_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -1448,7 +1448,7 @@ static PyObject * BZ2File_iternext(BZ2FileObject *self) { - PyStringObject* ret; + PyBytesObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { PyErr_SetString(PyExc_ValueError, @@ -1457,7 +1457,7 @@ } ret = Util_ReadAheadGetLineSkip(self, 0, READAHEAD_BUFSIZE); RELEASE_LOCK(self); - if (ret == NULL || PyString_GET_SIZE(ret) == 0) { + if (ret == NULL || PyBytes_GET_SIZE(ret) == 0) { Py_XDECREF(ret); return NULL; } @@ -1559,7 +1559,7 @@ return NULL; if (datasize == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); ACQUIRE_LOCK(self); if (!self->running) { @@ -1568,7 +1568,7 @@ goto error; } - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1591,7 +1591,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); goto error; } @@ -1601,7 +1601,7 @@ } } - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1636,7 +1636,7 @@ } self->running = 0; - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1657,7 +1657,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) + if (_PyBytes_Resize(&ret, bufsize) < 0) goto error; bzs->next_out = BUF(ret); bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) @@ -1667,7 +1667,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1849,7 +1849,7 @@ goto error; } - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1868,7 +1868,7 @@ if (bzs->avail_in != 0) { Py_DECREF(self->unused_data); self->unused_data = - PyString_FromStringAndSize(bzs->next_in, + PyBytes_FromStringAndSize(bzs->next_in, bzs->avail_in); } self->running = 0; @@ -1882,7 +1882,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); goto error; } @@ -1894,7 +1894,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1930,7 +1930,7 @@ } #endif - self->unused_data = PyString_FromString(""); + self->unused_data = PyBytes_FromString(""); if (!self->unused_data) goto error; @@ -2063,7 +2063,7 @@ * data in one shot. We will check it later anyway. */ bufsize = datasize + (datasize/100+1) + 600; - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2095,7 +2095,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2106,7 +2106,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); return ret; @@ -2134,9 +2134,9 @@ return NULL; if (datasize == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); - ret = PyString_FromStringAndSize(NULL, bufsize); + ret = PyBytes_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2175,7 +2175,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyString_Resize(&ret, bufsize) < 0) { + if (_PyBytes_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2186,7 +2186,7 @@ } if (bzs->avail_out != 0) - _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); return ret; @@ -2223,7 +2223,7 @@ if (m == NULL) return; - PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); + PyModule_AddObject(m, "__author__", PyBytes_FromString(__author__)); Py_INCREF(&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); Modified: python/branches/okkoto-sizeof/Modules/cPickle.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cPickle.c (original) +++ python/branches/okkoto-sizeof/Modules/cPickle.c Wed Jun 4 11:24:23 2008 @@ -105,18 +105,18 @@ /* As the name says, an empty tuple. */ static PyObject *empty_tuple; -/* copyreg.dispatch_table, {type_object: pickling_function} */ +/* copy_reg.dispatch_table, {type_object: pickling_function} */ static PyObject *dispatch_table; /* For EXT[124] opcodes. */ -/* copyreg._extension_registry, {(module_name, function_name): code} */ +/* copy_reg._extension_registry, {(module_name, function_name): code} */ static PyObject *extension_registry; -/* copyreg._inverted_registry, {code: (module_name, function_name)} */ +/* copy_reg._inverted_registry, {code: (module_name, function_name)} */ static PyObject *inverted_registry; -/* copyreg._extension_cache, {code: object} */ +/* copy_reg._extension_cache, {code: object} */ static PyObject *extension_cache; -/* For looking up name pairs in copyreg._extension_registry. */ +/* For looking up name pairs in copy_reg._extension_registry. */ static PyObject *two_tuple; static PyObject *__class___str, *__getinitargs___str, *__dict___str, @@ -393,13 +393,13 @@ if (format) args = Py_VaBuildValue(format, va); va_end(va); if (format && ! args) return NULL; - if (stringformat && !(retval=PyString_FromString(stringformat))) + if (stringformat && !(retval=PyBytes_FromString(stringformat))) return NULL; if (retval) { if (args) { PyObject *v; - v=PyString_Format(retval, args); + v=PyBytes_Format(retval, args); Py_DECREF(retval); Py_DECREF(args); if (! v) return NULL; @@ -477,7 +477,7 @@ n = (int)_n; if (s == NULL) { if (!( self->buf_size )) return 0; - py_str = PyString_FromStringAndSize(self->write_buf, + py_str = PyBytes_FromStringAndSize(self->write_buf, self->buf_size); if (!py_str) return -1; @@ -490,7 +490,7 @@ if (n > WRITE_BUF_SIZE) { if (!( py_str = - PyString_FromStringAndSize(s, n))) + PyBytes_FromStringAndSize(s, n))) return -1; } else { @@ -655,7 +655,7 @@ Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyString_AsString(str))) return -1; + if (! (*s = PyBytes_AsString(str))) return -1; return n; } @@ -670,13 +670,13 @@ return -1; } - if ((str_size = PyString_Size(str)) < 0) + if ((str_size = PyBytes_Size(str)) < 0) return -1; Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyString_AsString(str))) + if (! (*s = PyBytes_AsString(str))) return -1; return str_size; @@ -1078,9 +1078,9 @@ "to pickle"); goto finally; } - repr = PyString_FromStringAndSize(NULL, (int)nbytes); + repr = PyBytes_FromStringAndSize(NULL, (int)nbytes); if (repr == NULL) goto finally; - pdata = (unsigned char *)PyString_AS_STRING(repr); + pdata = (unsigned char *)PyBytes_AS_STRING(repr); i = _PyLong_AsByteArray((PyLongObject *)args, pdata, nbytes, 1 /* little endian */, 1 /* signed */); @@ -1121,14 +1121,14 @@ if (!( repr = PyObject_Repr(args))) goto finally; - if ((size = PyString_Size(repr)) < 0) + if ((size = PyBytes_Size(repr)) < 0) goto finally; if (self->write_func(self, &l, 1) < 0) goto finally; if (self->write_func(self, - PyString_AS_STRING((PyStringObject *)repr), + PyBytes_AS_STRING((PyBytesObject *)repr), size) < 0) goto finally; @@ -1177,7 +1177,7 @@ int size, len; PyObject *repr=0; - if ((size = PyString_Size(args)) < 0) + if ((size = PyBytes_Size(args)) < 0) return -1; if (!self->bin) { @@ -1188,9 +1188,9 @@ if (!( repr = PyObject_Repr(args))) return -1; - if ((len = PyString_Size(repr)) < 0) + if ((len = PyBytes_Size(repr)) < 0) goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); + repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1207,7 +1207,7 @@ int i; char c_str[5]; - if ((size = PyString_Size(args)) < 0) + if ((size = PyBytes_Size(args)) < 0) return -1; if (size < 256) { @@ -1233,8 +1233,8 @@ } else { if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)args), + PyBytes_AS_STRING( + (PyBytesObject *)args), size) < 0) return -1; } @@ -1264,13 +1264,13 @@ static const char *hexdigit = "0123456789ABCDEF"; - repr = PyString_FromStringAndSize(NULL, 6 * size); + repr = PyBytes_FromStringAndSize(NULL, 6 * size); if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyString_AS_STRING(repr); + p = q = PyBytes_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; /* Map 16-bit characters to '\uxxxx' */ @@ -1287,7 +1287,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyString_Resize(&repr, p - q); + _PyBytes_Resize(&repr, p - q); return repr; } @@ -1310,9 +1310,9 @@ if (!repr) return -1; - if ((len = PyString_Size(repr)) < 0) + if ((len = PyBytes_Size(repr)) < 0) goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); + repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1332,7 +1332,7 @@ if (!( repr = PyUnicode_AsUTF8String(args))) return -1; - if ((size = PyString_Size(repr)) < 0) + if ((size = PyBytes_Size(repr)) < 0) goto err; if (size > INT_MAX) return -1; /* string too large */ @@ -1351,7 +1351,7 @@ PDATA_APPEND(self->file, repr, -1); } else { - if (self->write_func(self, PyString_AS_STRING(repr), + if (self->write_func(self, PyBytes_AS_STRING(repr), size) < 0) goto err; } @@ -1861,12 +1861,12 @@ goto finally; - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(name)) < 0) + if ((module_size = PyBytes_Size(module)) < 0 || + (name_size = PyBytes_Size(name)) < 0) goto finally; - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)name); + module_str = PyBytes_AS_STRING((PyBytesObject *)module); + name_str = PyBytes_AS_STRING((PyBytesObject *)name); if (self->write_func(self, &inst, 1) < 0) goto finally; @@ -1961,12 +1961,12 @@ if (!( module = whichmodule(args, global_name))) goto finally; - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(global_name)) < 0) + if ((module_size = PyBytes_Size(module)) < 0 || + (name_size = PyBytes_Size(global_name)) < 0) goto finally; - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)global_name); + module_str = PyBytes_AS_STRING((PyBytesObject *)module); + name_str = PyBytes_AS_STRING((PyBytesObject *)global_name); /* XXX This can be doing a relative import. Clearly it shouldn't, but I don't know how to stop it. :-( */ @@ -2099,7 +2099,7 @@ if (pid != Py_None) { if (!self->bin) { - if (!PyString_Check(pid)) { + if (!PyBytes_Check(pid)) { PyErr_SetString(PicklingError, "persistent id must be string"); goto finally; @@ -2108,12 +2108,12 @@ if (self->write_func(self, &persid, 1) < 0) goto finally; - if ((size = PyString_Size(pid)) < 0) + if ((size = PyBytes_Size(pid)) < 0) goto finally; if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)pid), + PyBytes_AS_STRING( + (PyBytesObject *)pid), size) < 0) goto finally; @@ -2194,8 +2194,8 @@ use_newobj = 0; } else { - use_newobj = PyString_Check(temp) && - strcmp(PyString_AS_STRING(temp), + use_newobj = PyBytes_Check(temp) && + strcmp(PyBytes_AS_STRING(temp), "__newobj__") == 0; Py_DECREF(temp); } @@ -2362,14 +2362,14 @@ break; case 's': - if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { + if ((type == &PyBytes_Type) && (PyBytes_GET_SIZE(args) < 2)) { res = save_string(self, args, 0); goto finally; } #ifdef Py_USING_UNICODE case 'u': - if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { + if ((type == &PyUnicode_Type) && (PyBytes_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } @@ -2391,7 +2391,7 @@ switch (type->tp_name[0]) { case 's': - if (type == &PyString_Type) { + if (type == &PyBytes_Type) { res = save_string(self, args, 1); goto finally; } @@ -2477,7 +2477,7 @@ } /* Get a reduction callable, and call it. This may come from - * copyreg.dispatch_table, the object's __reduce_ex__ method, + * copy_reg.dispatch_table, the object's __reduce_ex__ method, * or the object's __reduce__ method. */ __reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type); @@ -2526,7 +2526,7 @@ if (t == NULL) goto finally; - if (PyString_Check(t)) { + if (PyBytes_Check(t)) { res = save_global(self, args, t); goto finally; } @@ -2640,8 +2640,8 @@ for (rsize = 0, i = l; --i >= 0; ) { k = data->data[i]; - if (PyString_Check(k)) - rsize += PyString_GET_SIZE(k); + if (PyBytes_Check(k)) + rsize += PyBytes_GET_SIZE(k); else if (PyInt_Check(k)) { /* put */ ik = PyInt_AS_LONG((PyIntObject*)k); @@ -2676,17 +2676,17 @@ } /* Now generate the result */ - r = PyString_FromStringAndSize(NULL, rsize); + r = PyBytes_FromStringAndSize(NULL, rsize); if (r == NULL) goto err; - s = PyString_AS_STRING((PyStringObject *)r); + s = PyBytes_AS_STRING((PyBytesObject *)r); for (i = 0; i < l; i++) { k = data->data[i]; - if (PyString_Check(k)) { - ssize = PyString_GET_SIZE(k); + if (PyBytes_Check(k)) { + ssize = PyBytes_GET_SIZE(k); if (ssize) { - p=PyString_AS_STRING((PyStringObject *)k); + p=PyBytes_AS_STRING((PyBytesObject *)k); while (--ssize >= 0) *s++ = *p++; } @@ -3410,7 +3410,7 @@ goto insecure; /********************************************/ - str = PyString_DecodeEscape(p, len, NULL, 0, NULL); + str = PyBytes_DecodeEscape(p, len, NULL, 0, NULL); free(s); if (str) { PDATA_PUSH(self->stack, str, -1); @@ -3439,7 +3439,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyString_FromStringAndSize(s, l))) + if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); @@ -3461,7 +3461,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; + if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); return 0; @@ -3688,12 +3688,12 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); + module_name = PyBytes_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { if (len < 2) return bad_readline(); - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3772,7 +3772,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); + module_name = PyBytes_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { @@ -3780,7 +3780,7 @@ Py_DECREF(module_name); return bad_readline(); } - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { + if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3805,7 +3805,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - pid = PyString_FromStringAndSize(s, len - 1); + pid = PyBytes_FromStringAndSize(s, len - 1); if (!pid) return -1; if (PyList_Check(self->pers_func)) { @@ -3938,7 +3938,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; + if (!( py_str = PyBytes_FromStringAndSize(s, len - 1))) return -1; value = PyDict_GetItem(self->memo, py_str); if (! value) { @@ -4064,8 +4064,8 @@ * confirm that pair is really a 2-tuple of strings. */ if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || - !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || - !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { + !PyBytes_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || + !PyBytes_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { Py_DECREF(py_code); PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " "isn't a 2-tuple of strings", code); @@ -4098,7 +4098,7 @@ if ((l = self->readline_func(self, &s)) < 0) return -1; if (l < 2) return bad_readline(); if (!( len=self->stack->length )) return stackUnderflow(); - if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; + if (!( py_str = PyBytes_FromStringAndSize(s, l - 1))) return -1; value=self->stack->data[len-1]; l=PyDict_SetItem(self->memo, py_str, value); Py_DECREF(py_str); @@ -5568,7 +5568,7 @@ { PyObject *copyreg, *t, *r; -#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; +#define INIT_STR(S) if (!( S ## _str=PyBytes_InternFromString(#S))) return -1; if (PyType_Ready(&Unpicklertype) < 0) return -1; @@ -5591,7 +5591,7 @@ INIT_STR(copyreg); INIT_STR(dispatch_table); - if (!( copyreg = PyImport_ImportModule("copyreg"))) + if (!( copyreg = PyImport_ImportModule("copy_reg"))) return -1; /* This is special because we want to use a different @@ -5710,6 +5710,12 @@ PyObject *format_version; PyObject *compatible_formats; + /* XXX: Should mention that the pickle module will include the C + XXX: optimized implementation automatically. */ + if (PyErr_WarnPy3k("the cPickle module has been removed in " + "Python 3.0", 2) < 0) + return; + Py_TYPE(&Picklertype) = &PyType_Type; Py_TYPE(&Unpicklertype) = &PyType_Type; Py_TYPE(&PdataType) = &PyType_Type; @@ -5730,7 +5736,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - v = PyString_FromString(rev); + v = PyBytes_FromString(rev); PyDict_SetItemString(d, "__version__", v); Py_XDECREF(v); @@ -5749,7 +5755,7 @@ /* These are purely informational; no code uses them. */ /* File format version we write. */ - format_version = PyString_FromString("2.0"); + format_version = PyBytes_FromString("2.0"); /* Format versions we can read. */ compatible_formats = Py_BuildValue("[sssss]", "1.0", /* Original protocol 0 */ Modified: python/branches/okkoto-sizeof/Modules/cStringIO.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cStringIO.c (original) +++ python/branches/okkoto-sizeof/Modules/cStringIO.c Wed Jun 4 11:24:23 2008 @@ -119,7 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; - return PyString_FromStringAndSize(((IOobject*)self)->buf, + return PyBytes_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,7 +137,7 @@ } else s=self->string_size; - return PyString_FromStringAndSize(self->buf, s); + return PyBytes_FromStringAndSize(self->buf, s); } PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); @@ -177,7 +177,7 @@ if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); @@ -215,7 +215,7 @@ n -= m; self->pos -= m; } - return PyString_FromStringAndSize(output, n); + return PyBytes_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); @@ -238,7 +238,7 @@ goto err; if (n == 0) break; - line = PyString_FromStringAndSize (output, n); + line = PyBytes_FromStringAndSize (output, n); if (!line) goto err; if (PyList_Append (result, line) == -1) { @@ -315,7 +315,7 @@ next = IO_readline((IOobject *)self, NULL); if (!next) return NULL; - if (!PyString_GET_SIZE(next)) { + if (!PyBytes_GET_SIZE(next)) { Py_DECREF(next); PyErr_SetNone(PyExc_StopIteration); return NULL; @@ -456,7 +456,7 @@ while ((s = PyIter_Next(it)) != NULL) { Py_ssize_t n; char *c; - if (PyString_AsStringAndSize(s, &c, &n) == -1) { + if (PyBytes_AsStringAndSize(s, &c, &n) == -1) { Py_DECREF(it); Py_DECREF(s); return NULL; Modified: python/branches/okkoto-sizeof/Modules/cdmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cdmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/cdmodule.c Wed Jun 4 11:24:23 2008 @@ -239,19 +239,19 @@ if (!PyArg_ParseTuple(args, "i:readda", &numframes)) return NULL; - result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); + result = PyBytes_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); if (result == NULL) return NULL; n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyString_AsString(result), numframes); + (CDFRAME *) PyBytes_AsString(result), numframes); if (n == -1) { Py_DECREF(result); PyErr_SetFromErrno(CdError); return NULL; } if (n < numframes) - _PyString_Resize(&result, n * sizeof(CDFRAME)); + _PyBytes_Resize(&result, n * sizeof(CDFRAME)); return result; } @@ -468,7 +468,7 @@ PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); switch (type) { case cd_audio: - v = PyString_FromStringAndSize(data, CDDA_DATASIZE); + v = PyBytes_FromStringAndSize(data, CDDA_DATASIZE); break; case cd_pnum: case cd_index: @@ -484,15 +484,15 @@ #undef ptr break; case cd_catalog: - v = PyString_FromStringAndSize(NULL, 13); - p = PyString_AsString(v); + v = PyBytes_FromStringAndSize(NULL, 13); + p = PyBytes_AsString(v); for (i = 0; i < 13; i++) *p++ = ((char *) data)[i] + '0'; break; case cd_ident: #define ptr ((struct cdident *) data) - v = PyString_FromStringAndSize(NULL, 12); - p = PyString_AsString(v); + v = PyBytes_FromStringAndSize(NULL, 12); + p = PyBytes_AsString(v); CDsbtoa(p, ptr->country, 2); p += 2; CDsbtoa(p, ptr->owner, 3); Modified: python/branches/okkoto-sizeof/Modules/cgensupport.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cgensupport.c (original) +++ python/branches/okkoto-sizeof/Modules/cgensupport.c Wed Jun 4 11:24:23 2008 @@ -119,10 +119,10 @@ PyObject *v; if (!PyArg_GetObject(args, nargs, i, &v)) return 0; - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { return PyErr_BadArgument(); } - *p_arg = PyString_AsString(v); + *p_arg = PyBytes_AsString(v); return 1; } Modified: python/branches/okkoto-sizeof/Modules/cjkcodecs/cjkcodecs.h ============================================================================== --- python/branches/okkoto-sizeof/Modules/cjkcodecs/cjkcodecs.h (original) +++ python/branches/okkoto-sizeof/Modules/cjkcodecs/cjkcodecs.h Wed Jun 4 11:24:23 2008 @@ -261,7 +261,7 @@ const MultibyteCodec *codec; const char *enc; - if (!PyString_Check(encoding)) { + if (!PyBytes_Check(encoding)) { PyErr_SetString(PyExc_TypeError, "encoding name must be a string."); return NULL; @@ -271,7 +271,7 @@ if (cofunc == NULL) return NULL; - enc = PyString_AS_STRING(encoding); + enc = PyBytes_AS_STRING(encoding); for (codec = codec_list; codec->encoding[0]; codec++) if (strcmp(codec->encoding, enc) == 0) break; Modified: python/branches/okkoto-sizeof/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cjkcodecs/multibytecodec.c (original) +++ python/branches/okkoto-sizeof/Modules/cjkcodecs/multibytecodec.c Wed Jun 4 11:24:23 2008 @@ -85,7 +85,7 @@ else if (strcmp(errors, "replace") == 0) return ERROR_REPLACE; else - return PyString_FromString(errors); + return PyBytes_FromString(errors); } static PyObject * @@ -93,8 +93,8 @@ { PyObject *args, *cb, *r; - assert(PyString_Check(errors)); - cb = PyCodec_LookupError(PyString_AS_STRING(errors)); + assert(PyBytes_Check(errors)); + cb = PyCodec_LookupError(PyBytes_AS_STRING(errors)); if (cb == NULL) return NULL; @@ -129,7 +129,7 @@ return self->errors; } - return PyString_FromString(errors); + return PyBytes_FromString(errors); } static int @@ -138,12 +138,12 @@ { PyObject *cb; - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "errors must be a string"); return -1; } - cb = internal_error_callback(PyString_AS_STRING(value)); + cb = internal_error_callback(PyBytes_AS_STRING(value)); if (cb == NULL) return -1; @@ -166,15 +166,15 @@ Py_ssize_t orgpos, orgsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - - PyString_AS_STRING(buf->outobj)); - orgsize = PyString_GET_SIZE(buf->outobj); - if (_PyString_Resize(&buf->outobj, orgsize + ( + PyBytes_AS_STRING(buf->outobj)); + orgsize = PyBytes_GET_SIZE(buf->outobj); + if (_PyBytes_Resize(&buf->outobj, orgsize + ( esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) return -1; - buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; - buf->outbuf_end = (unsigned char *)PyString_AS_STRING(buf->outobj) - + PyString_GET_SIZE(buf->outobj); + buf->outbuf = (unsigned char *)PyBytes_AS_STRING(buf->outobj) +orgpos; + buf->outbuf_end = (unsigned char *)PyBytes_AS_STRING(buf->outobj) + + PyBytes_GET_SIZE(buf->outobj); return 0; } @@ -322,10 +322,10 @@ goto errorexit; } - retstrsize = PyString_GET_SIZE(retstr); + retstrsize = PyBytes_GET_SIZE(retstr); REQUIRE_ENCODEBUFFER(buf, retstrsize); - memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); + memcpy(buf->outbuf, PyBytes_AS_STRING(retstr), retstrsize); buf->outbuf += retstrsize; newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); @@ -468,16 +468,16 @@ Py_ssize_t finalsize, r = 0; if (datalen == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; - buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); + buf.outobj = PyBytes_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; - buf.outbuf = (unsigned char *)PyString_AS_STRING(buf.outobj); - buf.outbuf_end = buf.outbuf + PyString_GET_SIZE(buf.outobj); + buf.outbuf = (unsigned char *)PyBytes_AS_STRING(buf.outobj); + buf.outbuf_end = buf.outbuf + PyBytes_GET_SIZE(buf.outobj); while (buf.inbuf < buf.inbuf_end) { Py_ssize_t inleft, outleft; @@ -512,10 +512,10 @@ } finalsize = (Py_ssize_t)((char *)buf.outbuf - - PyString_AS_STRING(buf.outobj)); + PyBytes_AS_STRING(buf.outobj)); - if (finalsize != PyString_GET_SIZE(buf.outobj)) - if (_PyString_Resize(&buf.outobj, finalsize) == -1) + if (finalsize != PyBytes_GET_SIZE(buf.outobj)) + if (_PyBytes_Resize(&buf.outobj, finalsize) == -1) goto errorexit; Py_XDECREF(buf.excobj); @@ -1222,35 +1222,35 @@ if (cres == NULL) goto errorexit; - if (!PyString_Check(cres)) { + if (!PyBytes_Check(cres)) { PyErr_SetString(PyExc_TypeError, "stream function returned a " "non-string object"); goto errorexit; } - endoffile = (PyString_GET_SIZE(cres) == 0); + endoffile = (PyBytes_GET_SIZE(cres) == 0); if (self->pendingsize > 0) { PyObject *ctr; char *ctrdata; - rsize = PyString_GET_SIZE(cres) + self->pendingsize; - ctr = PyString_FromStringAndSize(NULL, rsize); + rsize = PyBytes_GET_SIZE(cres) + self->pendingsize; + ctr = PyBytes_FromStringAndSize(NULL, rsize); if (ctr == NULL) goto errorexit; - ctrdata = PyString_AS_STRING(ctr); + ctrdata = PyBytes_AS_STRING(ctr); memcpy(ctrdata, self->pending, self->pendingsize); memcpy(ctrdata + self->pendingsize, - PyString_AS_STRING(cres), - PyString_GET_SIZE(cres)); + PyBytes_AS_STRING(cres), + PyBytes_GET_SIZE(cres)); Py_DECREF(cres); cres = ctr; self->pendingsize = 0; } - rsize = PyString_GET_SIZE(cres); - if (decoder_prepare_buffer(&buf, PyString_AS_STRING(cres), + rsize = PyBytes_GET_SIZE(cres); + if (decoder_prepare_buffer(&buf, PyBytes_AS_STRING(cres), rsize) != 0) goto errorexit; @@ -1585,7 +1585,7 @@ if (pwrt == NULL) return NULL; - if (PyString_Size(pwrt) > 0) { + if (PyBytes_Size(pwrt) > 0) { PyObject *wr; wr = PyObject_CallMethod(self->stream, "write", "O", pwrt); if (wr == NULL) { Modified: python/branches/okkoto-sizeof/Modules/clmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/clmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/clmodule.c Wed Jun 4 11:24:23 2008 @@ -111,7 +111,7 @@ return NULL; retry: - compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); + compressedBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); if (compressedBuffer == NULL) return NULL; @@ -120,7 +120,7 @@ if (clCompressImage(compressionScheme, width, height, originalFormat, compressionRatio, (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(compressedBuffer)) + (void *) PyBytes_AsString(compressedBuffer)) == FAILURE || error_handler_called) { Py_DECREF(compressedBuffer); if (!error_handler_called) @@ -135,7 +135,7 @@ } if (compressedBufferSize < frameBufferSize) - _PyString_Resize(&compressedBuffer, compressedBufferSize); + _PyBytes_Resize(&compressedBuffer, compressedBufferSize); return compressedBuffer; } @@ -155,14 +155,14 @@ frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); + frameBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); if (frameBuffer == NULL) return NULL; error_handler_called = 0; if (clDecompressImage(compressionScheme, width, height, originalFormat, compressedBufferSize, compressedBuffer, - (void *) PyString_AsString(frameBuffer)) + (void *) PyBytes_AsString(frameBuffer)) == FAILURE || error_handler_called) { Py_DECREF(frameBuffer); if (!error_handler_called) @@ -236,14 +236,14 @@ if (error_handler_called) return NULL; - data = PyString_FromStringAndSize(NULL, size); + data = PyBytes_FromStringAndSize(NULL, size); if (data == NULL) return NULL; error_handler_called = 0; if (clCompress(SELF->ob_compressorHdl, numberOfFrames, (void *) frameBuffer, &compressedBufferSize, - (void *) PyString_AsString(data)) == FAILURE || + (void *) PyBytes_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -252,7 +252,7 @@ } if (compressedBufferSize < size) - if (_PyString_Resize(&data, compressedBufferSize)) + if (_PyBytes_Resize(&data, compressedBufferSize)) return NULL; if (compressedBufferSize > size) { @@ -285,14 +285,14 @@ if (error_handler_called) return NULL; - data = PyString_FromStringAndSize(NULL, dataSize); + data = PyBytes_FromStringAndSize(NULL, dataSize); if (data == NULL) return NULL; error_handler_called = 0; if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, compressedDataSize, (void *) compressedData, - (void *) PyString_AsString(data)) == FAILURE || + (void *) PyBytes_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -514,7 +514,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); + PyBytes_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -563,7 +563,7 @@ return NULL; } - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * @@ -775,7 +775,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyString_FromString((char *) PVbuffer[i])); + PyBytes_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -818,7 +818,7 @@ return NULL; } - return PyString_FromString(name); + return PyBytes_FromString(name); } static PyObject * Modified: python/branches/okkoto-sizeof/Modules/cmathmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/cmathmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/cmathmodule.c Wed Jun 4 11:24:23 2008 @@ -920,7 +920,7 @@ errno = 0; PyFPE_START_PROTECT("arg function", return 0) phi = c_atan2(z); - PyFPE_END_PROTECT(r) + PyFPE_END_PROTECT(phi) if (errno != 0) return math_error(); else Modified: python/branches/okkoto-sizeof/Modules/datetimemodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/datetimemodule.c (original) +++ python/branches/okkoto-sizeof/Modules/datetimemodule.c Wed Jun 4 11:24:23 2008 @@ -2,6 +2,8 @@ * http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage */ +#define PY_SSIZE_T_CLEAN + #include "Python.h" #include "modsupport.h" #include "structmember.h" @@ -945,7 +947,7 @@ else result = PyObject_CallMethod(tzinfo, "tzname", "O", tzinfoarg); - if (result != NULL && result != Py_None && ! PyString_Check(result)) { + if (result != NULL && result != Py_None && ! PyBytes_Check(result)) { PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " "return None or a string, not '%s'", Py_TYPE(result)->tp_name); @@ -1044,27 +1046,27 @@ { PyObject *temp; - assert(PyString_Check(repr)); + assert(PyBytes_Check(repr)); assert(tzinfo); if (tzinfo == Py_None) return repr; /* Get rid of the trailing ')'. */ - assert(PyString_AsString(repr)[PyString_Size(repr)-1] == ')'); - temp = PyString_FromStringAndSize(PyString_AsString(repr), - PyString_Size(repr) - 1); + assert(PyBytes_AsString(repr)[PyBytes_Size(repr)-1] == ')'); + temp = PyBytes_FromStringAndSize(PyBytes_AsString(repr), + PyBytes_Size(repr) - 1); Py_DECREF(repr); if (temp == NULL) return NULL; repr = temp; /* Append ", tzinfo=". */ - PyString_ConcatAndDel(&repr, PyString_FromString(", tzinfo=")); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(", tzinfo=")); /* Append repr(tzinfo). */ - PyString_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); + PyBytes_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); /* Add a closing paren. */ - PyString_ConcatAndDel(&repr, PyString_FromString(")")); + PyBytes_ConcatAndDel(&repr, PyBytes_FromString(")")); return repr; } @@ -1090,7 +1092,7 @@ DayNames[wday], MonthNames[GET_MONTH(date) - 1], GET_DAY(date), hours, minutes, seconds, GET_YEAR(date)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* Add an hours & minutes UTC offset string to buf. buf has no more than @@ -1141,7 +1143,7 @@ else sprintf(freplacement, "%06d", 0); - return PyString_FromStringAndSize(freplacement, strlen(freplacement)); + return PyBytes_FromStringAndSize(freplacement, strlen(freplacement)); } /* I sure don't want to reproduce the strftime code from the time module, @@ -1152,8 +1154,8 @@ * needed. */ static PyObject * -wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple, - PyObject *tzinfoarg) +wrap_strftime(PyObject *object, const char *format, size_t format_len, + PyObject *timetuple, PyObject *tzinfoarg) { PyObject *result = NULL; /* guilty until proved innocent */ @@ -1161,20 +1163,19 @@ PyObject *Zreplacement = NULL; /* py string, replacement for %Z */ PyObject *freplacement = NULL; /* py string, replacement for %f */ - char *pin; /* pointer to next char in input format */ - char ch; /* next char in input format */ + const char *pin; /* pointer to next char in input format */ + char ch; /* next char in input format */ PyObject *newfmt = NULL; /* py string, the output format */ char *pnew; /* pointer to available byte in output format */ - int totalnew; /* number bytes total in output format buffer, - exclusive of trailing \0 */ - int usednew; /* number bytes used so far in output format buffer */ + size_t totalnew; /* number bytes total in output format buffer, + exclusive of trailing \0 */ + size_t usednew; /* number bytes used so far in output format buffer */ - char *ptoappend; /* pointer to string to append to output buffer */ - int ntoappend; /* # of bytes to append to output buffer */ + const char *ptoappend; /* ptr to string to append to output buffer */ + size_t ntoappend; /* # of bytes to append to output buffer */ assert(object && format && timetuple); - assert(PyString_Check(format)); /* Give up if the year is before 1900. * Python strftime() plays games with the year, and different @@ -1205,13 +1206,13 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ - totalnew = PyString_Size(format) + 1; /* realistic if no %z/%Z/%f */ - newfmt = PyString_FromStringAndSize(NULL, totalnew); + totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ + newfmt = PyBytes_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; - pnew = PyString_AsString(newfmt); + pnew = PyBytes_AsString(newfmt); usednew = 0; - pin = PyString_AsString(format); + pin = format; while ((ch = *pin++) != '\0') { if (ch != '%') { ptoappend = pin - 1; @@ -1229,7 +1230,7 @@ /* format utcoffset */ char buf[100]; PyObject *tzinfo = get_tzinfo_member(object); - zreplacement = PyString_FromString(""); + zreplacement = PyBytes_FromString(""); if (zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { assert(tzinfoarg != NULL); @@ -1240,19 +1241,19 @@ tzinfoarg) < 0) goto Done; Py_DECREF(zreplacement); - zreplacement = PyString_FromString(buf); + zreplacement = PyBytes_FromString(buf); if (zreplacement == NULL) goto Done; } } assert(zreplacement != NULL); - ptoappend = PyString_AS_STRING(zreplacement); - ntoappend = PyString_GET_SIZE(zreplacement); + ptoappend = PyBytes_AS_STRING(zreplacement); + ntoappend = PyBytes_GET_SIZE(zreplacement); } else if (ch == 'Z') { /* format tzname */ if (Zreplacement == NULL) { PyObject *tzinfo = get_tzinfo_member(object); - Zreplacement = PyString_FromString(""); + Zreplacement = PyBytes_FromString(""); if (Zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { PyObject *temp; @@ -1260,7 +1261,7 @@ temp = call_tzname(tzinfo, tzinfoarg); if (temp == NULL) goto Done; if (temp != Py_None) { - assert(PyString_Check(temp)); + assert(PyBytes_Check(temp)); /* Since the tzname is getting * stuffed into the format, we * have to double any % signs @@ -1274,7 +1275,7 @@ Py_DECREF(temp); if (Zreplacement == NULL) goto Done; - if (!PyString_Check(Zreplacement)) { + if (!PyBytes_Check(Zreplacement)) { PyErr_SetString(PyExc_TypeError, "tzname.replace() did not return a string"); goto Done; } @@ -1284,8 +1285,8 @@ } } assert(Zreplacement != NULL); - ptoappend = PyString_AS_STRING(Zreplacement); - ntoappend = PyString_GET_SIZE(Zreplacement); + ptoappend = PyBytes_AS_STRING(Zreplacement); + ntoappend = PyBytes_GET_SIZE(Zreplacement); } else if (ch == 'f') { /* format microseconds */ @@ -1295,9 +1296,9 @@ goto Done; } assert(freplacement != NULL); - assert(PyString_Check(freplacement)); - ptoappend = PyString_AS_STRING(freplacement); - ntoappend = PyString_GET_SIZE(freplacement); + assert(PyBytes_Check(freplacement)); + ptoappend = PyBytes_AS_STRING(freplacement); + ntoappend = PyBytes_GET_SIZE(freplacement); } else { /* percent followed by neither z nor Z */ @@ -1313,15 +1314,15 @@ if (ntoappend == 0) continue; while (usednew + ntoappend > totalnew) { - int bigger = totalnew << 1; + size_t bigger = totalnew << 1; if ((bigger >> 1) != totalnew) { /* overflow */ PyErr_NoMemory(); goto Done; } - if (_PyString_Resize(&newfmt, bigger) < 0) + if (_PyBytes_Resize(&newfmt, bigger) < 0) goto Done; totalnew = bigger; - pnew = PyString_AsString(newfmt) + usednew; + pnew = PyBytes_AsString(newfmt) + usednew; } memcpy(pnew, ptoappend, ntoappend); pnew += ntoappend; @@ -1329,7 +1330,7 @@ assert(usednew <= totalnew); } /* end while() */ - if (_PyString_Resize(&newfmt, usednew) < 0) + if (_PyBytes_Resize(&newfmt, usednew) < 0) goto Done; { PyObject *time = PyImport_ImportModuleNoBlock("time"); @@ -2007,18 +2008,18 @@ delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d, %d)", + return PyBytes_FromFormat("%s(%d, %d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d)", + return PyBytes_FromFormat("%s(%d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); - return PyString_FromFormat("%s(%d)", + return PyBytes_FromFormat("%s(%d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self)); } @@ -2062,7 +2063,7 @@ pbuf += n; } - return PyString_FromStringAndSize(buf, pbuf - buf); + return PyBytes_FromStringAndSize(buf, pbuf - buf); Fail: PyErr_SetString(PyExc_SystemError, "goofy result from PyOS_snprintf"); @@ -2241,15 +2242,15 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) == 1 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && + MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) { PyDateTime_Date *me; me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); me->hashcode = -1; } @@ -2447,7 +2448,7 @@ type_name, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } static PyObject * @@ -2456,7 +2457,7 @@ char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* str() calls the appropriate isoformat() method. */ @@ -2480,18 +2481,19 @@ * timetuple() method appropriate to self's class. */ PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyString_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; tuple = PyObject_CallMethod((PyObject *)self, "timetuple", "()"); if (tuple == NULL) return NULL; - result = wrap_strftime((PyObject *)self, format, tuple, + result = wrap_strftime((PyObject *)self, format, format_len, tuple, (PyObject *)self); Py_DECREF(tuple); return result; @@ -2506,9 +2508,9 @@ return NULL; /* Check for str or unicode */ - if (PyString_Check(format)) { + if (PyBytes_Check(format)) { /* If format is zero length, return str(self) */ - if (PyString_GET_SIZE(format) == 0) + if (PyBytes_GET_SIZE(format) == 0) return PyObject_Str((PyObject *)self); } else if (PyUnicode_Check(format)) { /* If format is zero length, return str(self) */ @@ -2651,7 +2653,7 @@ { return Py_BuildValue( "(N)", - PyString_FromStringAndSize((char *)self->data, + PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_DATE_DATASIZE)); } @@ -3107,9 +3109,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && + ((unsigned char) (PyBytes_AS_STRING(state)[0])) < 24) { PyDateTime_Time *me; char aware; @@ -3125,7 +3127,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); me->hashcode = -1; @@ -3211,7 +3213,7 @@ else PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d)", type_name, h, m); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); if (result != NULL && HASTZINFO(self)) result = append_keyword_tzinfo(result, self->tzinfo); return result; @@ -3238,7 +3240,7 @@ _PyDateTime_TIME_DATASIZE); isoformat_time(pdatetime, buf, sizeof(buf)); - result = PyString_FromString(buf); + result = PyBytes_FromString(buf); if (result == NULL || ! HASTZINFO(self) || self->tzinfo == Py_None) return result; @@ -3248,7 +3250,7 @@ Py_DECREF(result); return NULL; } - PyString_ConcatAndDel(&result, PyString_FromString(buf)); + PyBytes_ConcatAndDel(&result, PyBytes_FromString(buf)); return result; } @@ -3256,12 +3258,13 @@ time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw) { PyObject *result; - PyObject *format; PyObject *tuple; + const char *format; + Py_ssize_t format_len; static char *keywords[] = {"format", NULL}; - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:strftime", keywords, - &PyString_Type, &format)) + if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, + &format, &format_len)) return NULL; /* Python's strftime does insane things with the year part of the @@ -3277,7 +3280,8 @@ if (tuple == NULL) return NULL; assert(PyTuple_Size(tuple) == 9); - result = wrap_strftime((PyObject *)self, format, tuple, Py_None); + result = wrap_strftime((PyObject *)self, format, format_len, tuple, + Py_None); Py_DECREF(tuple); return result; } @@ -3360,7 +3364,7 @@ /* Reduce this to a hash of another object. */ if (offset == 0) - temp = PyString_FromStringAndSize((char *)self->data, + temp = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); else { int hour; @@ -3448,7 +3452,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyString_FromStringAndSize((char *)self->data, + basestate = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) @@ -3635,9 +3639,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) + PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyBytes_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && + MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) { PyDateTime_DateTime *me; char aware; @@ -3653,7 +3657,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { - char *pdata = PyString_AS_STRING(state); + char *pdata = PyBytes_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); me->hashcode = -1; @@ -4162,7 +4166,7 @@ GET_YEAR(self), GET_MONTH(self), GET_DAY(self), DATE_GET_HOUR(self), DATE_GET_MINUTE(self)); } - baserepr = PyString_FromString(buffer); + baserepr = PyBytes_FromString(buffer); if (baserepr == NULL || ! HASTZINFO(self)) return baserepr; return append_keyword_tzinfo(baserepr, self->tzinfo); @@ -4190,7 +4194,7 @@ assert(cp != NULL); *cp++ = sep; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); if (result == NULL || ! HASTZINFO(self)) return result; @@ -4200,7 +4204,7 @@ Py_DECREF(result); return NULL; } - PyString_ConcatAndDel(&result, PyString_FromString(buffer)); + PyBytes_ConcatAndDel(&result, PyBytes_FromString(buffer)); return result; } @@ -4306,7 +4310,7 @@ /* Reduce this to a hash of another object. */ if (n == OFFSET_NAIVE) - temp = PyString_FromStringAndSize( + temp = PyBytes_FromStringAndSize( (char *)self->data, _PyDateTime_DATETIME_DATASIZE); else { @@ -4529,7 +4533,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyString_FromStringAndSize((char *)self->data, + basestate = PyBytes_FromStringAndSize((char *)self->data, _PyDateTime_DATETIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) Modified: python/branches/okkoto-sizeof/Modules/dbmmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/dbmmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/dbmmodule.c Wed Jun 4 11:24:23 2008 @@ -104,7 +104,7 @@ drec = dbm_fetch(dp->di_dbm, krec); if ( drec.dptr == 0 ) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)key)); + PyBytes_AS_STRING((PyBytesObject *)key)); return NULL; } if ( dbm_error(dp->di_dbm) ) { @@ -112,7 +112,7 @@ PyErr_SetString(DbmError, ""); return NULL; } - return PyString_FromStringAndSize(drec.dptr, drec.dsize); + return PyBytes_FromStringAndSize(drec.dptr, drec.dsize); } static int @@ -136,7 +136,7 @@ if ( dbm_delete(dp->di_dbm, krec) < 0 ) { dbm_clearerr(dp->di_dbm); PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)v)); + PyBytes_AS_STRING((PyBytesObject *)v)); return -1; } } else { @@ -166,7 +166,7 @@ { datum key, val; - if (PyString_AsStringAndSize(v, (char **)&key.dptr, + if (PyBytes_AsStringAndSize(v, (char **)&key.dptr, (Py_ssize_t *)&key.dsize)) { return -1; } @@ -222,7 +222,7 @@ return NULL; for (key = dbm_firstkey(dp->di_dbm); key.dptr; key = dbm_nextkey(dp->di_dbm)) { - item = PyString_FromStringAndSize(key.dptr, key.dsize); + item = PyBytes_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { Py_DECREF(v); return NULL; @@ -269,7 +269,7 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyString_FromStringAndSize(val.dptr, val.dsize); + return PyBytes_FromStringAndSize(val.dptr, val.dsize); else { Py_INCREF(defvalue); return defvalue; @@ -292,16 +292,16 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyString_FromStringAndSize(val.dptr, val.dsize); + return PyBytes_FromStringAndSize(val.dptr, val.dsize); if (defvalue == NULL) { - defvalue = PyString_FromStringAndSize(NULL, 0); + defvalue = PyBytes_FromStringAndSize(NULL, 0); if (defvalue == NULL) return NULL; } else Py_INCREF(defvalue); - val.dptr = PyString_AS_STRING(defvalue); - val.dsize = PyString_GET_SIZE(defvalue); + val.dptr = PyBytes_AS_STRING(defvalue); + val.dsize = PyBytes_GET_SIZE(defvalue); if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) { dbm_clearerr(dp->di_dbm); PyErr_SetString(DbmError, "cannot add item to database"); @@ -404,7 +404,7 @@ d = PyModule_GetDict(m); if (DbmError == NULL) DbmError = PyErr_NewException("dbm.error", NULL, NULL); - s = PyString_FromString(which_dbm); + s = PyBytes_FromString(which_dbm); if (s != NULL) { PyDict_SetItemString(d, "library", s); Py_DECREF(s); Modified: python/branches/okkoto-sizeof/Modules/dlmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/dlmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/dlmodule.c Wed Jun 4 11:24:23 2008 @@ -58,8 +58,8 @@ { char *name; PyUnivPtr *func; - if (PyString_Check(args)) { - name = PyString_AS_STRING(args); + if (PyBytes_Check(args)) { + name = PyBytes_AS_STRING(args); } else { PyErr_Format(PyExc_TypeError, "expected string, found %.200s", Py_TYPE(args)->tp_name); @@ -88,14 +88,14 @@ return NULL; } name = PyTuple_GetItem(args, 0); - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "function name must be a string"); return NULL; } func = (long (*)(long, long, long, long, long, long, long, long, long, long)) - dlsym(xp->dl_handle, PyString_AsString(name)); + dlsym(xp->dl_handle, PyBytes_AsString(name)); if (func == NULL) { PyErr_SetString(PyExc_ValueError, dlerror()); return NULL; @@ -109,8 +109,8 @@ PyObject *v = PyTuple_GetItem(args, i); if (PyInt_Check(v)) alist[i-1] = PyInt_AsLong(v); - else if (PyString_Check(v)) - alist[i-1] = (long)PyString_AsString(v); + else if (PyBytes_Check(v)) + alist[i-1] = (long)PyBytes_AsString(v); else if (v == Py_None) alist[i-1] = (long) ((char *)NULL); else { Modified: python/branches/okkoto-sizeof/Modules/errnomodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/errnomodule.c (original) +++ python/branches/okkoto-sizeof/Modules/errnomodule.c Wed Jun 4 11:24:23 2008 @@ -21,7 +21,7 @@ static void _inscode(PyObject *d, PyObject *de, char *name, int code) { - PyObject *u = PyString_FromString(name); + PyObject *u = PyBytes_FromString(name); PyObject *v = PyInt_FromLong((long) code); /* Don't bother checking for errors; they'll be caught at the end Modified: python/branches/okkoto-sizeof/Modules/fcntlmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/fcntlmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/fcntlmodule.c Wed Jun 4 11:24:23 2008 @@ -55,7 +55,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } PyErr_Clear(); @@ -164,7 +164,7 @@ return PyInt_FromLong(ret); } else { - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } } @@ -185,7 +185,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyString_FromStringAndSize(buf, len); + return PyBytes_FromStringAndSize(buf, len); } PyErr_Clear(); @@ -510,6 +510,9 @@ if (ins(d, "F_SETLKW64", (long)F_SETLKW64)) return -1; #endif /* GNU extensions, as of glibc 2.2.4. */ +#ifdef FASYNC + if (ins(d, "FASYNC", (long)FASYNC)) return -1; +#endif #ifdef F_SETLEASE if (ins(d, "F_SETLEASE", (long)F_SETLEASE)) return -1; #endif Modified: python/branches/okkoto-sizeof/Modules/flmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/flmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/flmodule.c Wed Jun 4 11:24:23 2008 @@ -324,7 +324,7 @@ /* "label" is an exception, getmember only works for char pointers, not for char arrays */ if (strcmp(name, "label") == 0) - return PyString_FromString(g->ob_generic->label); + return PyBytes_FromString(g->ob_generic->label); return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); } @@ -343,12 +343,12 @@ /* "label" is an exception: setmember doesn't set strings; and FORMS wants you to call a function to set the label */ if (strcmp(name, "label") == 0) { - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_SetString(PyExc_TypeError, "label attr must be string"); return -1; } - fl_set_object_label(g->ob_generic, PyString_AsString(v)); + fl_set_object_label(g->ob_generic, PyBytes_AsString(v)); return 0; } @@ -369,7 +369,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", g, g->ob_generic->objclass); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyTypeObject GenericObjecttype = { @@ -530,7 +530,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString (str); + return PyBytes_FromString (str); } /* int func (object) */ @@ -628,7 +628,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString (str); + return PyBytes_FromString (str); } static PyObject * @@ -1594,7 +1594,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", f, f->ob_form->window); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyTypeObject Formtype = { @@ -2027,7 +2027,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * @@ -2046,7 +2046,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } @@ -2061,7 +2061,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * Modified: python/branches/okkoto-sizeof/Modules/fmmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/fmmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/fmmodule.c Wed Jun 4 11:24:23 2008 @@ -66,7 +66,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); return NULL; } - return PyString_FromStringAndSize(fontname, len); + return PyBytes_FromStringAndSize(fontname, len); } static PyObject * @@ -79,7 +79,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); return NULL; } - return PyString_FromStringAndSize(comment, len); + return PyBytes_FromStringAndSize(comment, len); } static PyObject * @@ -200,7 +200,7 @@ PyObject *v; if (fontlist == NULL) return; - v = PyString_FromString(fontname); + v = PyBytes_FromString(fontname); if (v == NULL) err = -1; else { @@ -240,7 +240,7 @@ static PyObject * fm_fontpath(PyObject *self) { - return PyString_FromString(fmfontpath()); + return PyBytes_FromString(fmfontpath()); } static PyMethodDef fm_methods[] = { Modified: python/branches/okkoto-sizeof/Modules/gcmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/gcmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/gcmodule.c Wed Jun 4 11:24:23 2008 @@ -639,8 +639,8 @@ char *cname; /* simple version of instance_repr */ PyObject *classname = inst->in_class->cl_name; - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); + if (classname != NULL && PyBytes_Check(classname)) + cname = PyBytes_AsString(classname); else cname = "?"; PySys_WriteStderr("gc: %.100s <%.100s instance at %p>\n", @@ -754,7 +754,7 @@ double t1 = 0.0; if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); + delstr = PyBytes_InternFromString("__del__"); if (delstr == NULL) Py_FatalError("gc couldn't allocate \"__del__\""); } @@ -898,7 +898,7 @@ if (PyErr_Occurred()) { if (gc_str == NULL) - gc_str = PyString_FromString("garbage collection"); + gc_str = PyBytes_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); } Modified: python/branches/okkoto-sizeof/Modules/gdbmmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/gdbmmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/gdbmmodule.c Wed Jun 4 11:24:23 2008 @@ -128,10 +128,10 @@ drec = gdbm_fetch(dp->di_dbm, krec); if (drec.dptr == 0) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)key)); + PyBytes_AS_STRING((PyBytesObject *)key)); return NULL; } - v = PyString_FromStringAndSize(drec.dptr, drec.dsize); + v = PyBytes_FromStringAndSize(drec.dptr, drec.dsize); free(drec.dptr); return v; } @@ -155,7 +155,7 @@ if (w == NULL) { if (gdbm_delete(dp->di_dbm, krec) < 0) { PyErr_SetString(PyExc_KeyError, - PyString_AS_STRING((PyStringObject *)v)); + PyBytes_AS_STRING((PyBytesObject *)v)); return -1; } } @@ -188,14 +188,14 @@ "GDBM object has already been closed"); return -1; } - if (!PyString_Check(arg)) { + if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, "gdbm key must be string, not %.100s", arg->ob_type->tp_name); return -1; } - key.dptr = PyString_AS_STRING(arg); - key.dsize = PyString_GET_SIZE(arg); + key.dptr = PyBytes_AS_STRING(arg); + key.dsize = PyBytes_GET_SIZE(arg); return gdbm_exists(dp->di_dbm, key); } @@ -255,7 +255,7 @@ key = gdbm_firstkey(dp->di_dbm); while (key.dptr) { - item = PyString_FromStringAndSize(key.dptr, key.dsize); + item = PyBytes_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { free(key.dptr); Py_DECREF(v); @@ -306,7 +306,7 @@ check_dbmobject_open(dp); key = gdbm_firstkey(dp->di_dbm); if (key.dptr) { - v = PyString_FromStringAndSize(key.dptr, key.dsize); + v = PyBytes_FromStringAndSize(key.dptr, key.dsize); free(key.dptr); return v; } @@ -338,7 +338,7 @@ check_dbmobject_open(dp); nextkey = gdbm_nextkey(dp->di_dbm, key); if (nextkey.dptr) { - v = PyString_FromStringAndSize(nextkey.dptr, nextkey.dsize); + v = PyBytes_FromStringAndSize(nextkey.dptr, nextkey.dsize); free(nextkey.dptr); return v; } @@ -541,7 +541,7 @@ DbmError = PyErr_NewException("gdbm.error", NULL, NULL); if (DbmError != NULL) { PyDict_SetItemString(d, "error", DbmError); - s = PyString_FromString(dbmmodule_open_flags); + s = PyBytes_FromString(dbmmodule_open_flags); PyDict_SetItemString(d, "open_flags", s); Py_DECREF(s); } Modified: python/branches/okkoto-sizeof/Modules/glmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/glmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/glmodule.c Wed Jun 4 11:24:23 2008 @@ -593,7 +593,7 @@ #if 0 /* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { + if (!PyBytes_Check(s) || PyBytes_Size(s) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to lrectwrite has wrong size"); return NULL; @@ -623,10 +623,10 @@ if (!PyArg_GetShort(args, 4, 3, &y2)) return NULL; pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + parray = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (parray == NULL) return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); + lrectread(x1, y1, x2, y2, (unsigned long *) PyBytes_AsString(parray)); return parray; } @@ -642,10 +642,10 @@ if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) return 0; size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); + rv = PyBytes_FromStringAndSize((char *)NULL, size*sizeof(long)); if ( rv == NULL ) return NULL; - parray = (unsigned long *)PyString_AsString(rv); + parray = (unsigned long *)PyBytes_AsString(rv); size_ret = readdisplay(x1, y1, x2, y2, parray, hints); if ( size_ret != size ) { printf("gl_readdisplay: got %ld pixels, expected %ld\n", @@ -700,16 +700,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyString_Size(unpacked) != pixcount*sizeof(long)) { + if (PyBytes_Size(unpacked) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to packrect has wrong size"); return NULL; } - packed = PyString_FromStringAndSize((char *)NULL, packedcount); + packed = PyBytes_FromStringAndSize((char *)NULL, packedcount); if (packed == NULL) return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); + parray = (unsigned long *) PyBytes_AsString(unpacked); + p = (unsigned char *) PyBytes_AsString(packed); for (y = 0; y < height; y += packfactor, parray += packfactor*width) { for (x = 0; x < width; x += packfactor) { pixel = parray[x]; @@ -758,16 +758,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyString_Size(packed) != packedcount) { + if (PyBytes_Size(packed) != packedcount) { PyErr_SetString(PyExc_RuntimeError, "string arg to unpackrect has wrong size"); return NULL; } - unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + unpacked = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (unpacked == NULL) return NULL; - parray = (unsigned long *) PyString_AsString(unpacked); - p = (unsigned char *) PyString_AsString(packed); + parray = (unsigned long *) PyBytes_AsString(unpacked); + p = (unsigned char *) PyBytes_AsString(packed); if (packfactor == 1 && width*height > 0) { /* Just expand bytes to longs */ register int x = width * height; @@ -799,7 +799,7 @@ { char buf[20]; gversion(buf); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } Modified: python/branches/okkoto-sizeof/Modules/grpmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/grpmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/grpmodule.c Wed Jun 4 11:24:23 2008 @@ -47,7 +47,7 @@ return NULL; } for (member = p->gr_mem; *member != NULL; member++) { - PyObject *x = PyString_FromString(*member); + PyObject *x = PyBytes_FromString(*member); if (x == NULL || PyList_Append(w, x) != 0) { Py_XDECREF(x); Py_DECREF(w); @@ -58,13 +58,13 @@ } #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) - SET(setIndex++, PyString_FromString(p->gr_name)); + SET(setIndex++, PyBytes_FromString(p->gr_name)); #ifdef __VMS SET(setIndex++, Py_None); Py_INCREF(Py_None); #else if (p->gr_passwd) - SET(setIndex++, PyString_FromString(p->gr_passwd)); + SET(setIndex++, PyBytes_FromString(p->gr_passwd)); else { SET(setIndex++, Py_None); Py_INCREF(Py_None); @@ -113,7 +113,7 @@ py_str_name = PyObject_Str(pyo_name); if (!py_str_name) return NULL; - name = PyString_AS_STRING(py_str_name); + name = PyBytes_AS_STRING(py_str_name); if ((p = getgrnam(name)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name); Modified: python/branches/okkoto-sizeof/Modules/imageop.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/imageop.c (original) +++ python/branches/okkoto-sizeof/Modules/imageop.c Wed Jun 4 11:24:23 2008 @@ -54,7 +54,7 @@ return 1; if (bcos == NULL) { /* cache string object for future use */ - bcos = PyString_FromString("backward_compatible"); + bcos = PyBytes_FromString("backward_compatible"); if (bcos == NULL) return 1; } @@ -97,11 +97,11 @@ xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; - rv = PyString_FromStringAndSize(NULL, + rv = PyBytes_FromStringAndSize(NULL, (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); if ( rv == 0 ) return 0; - ncp = (char *)PyString_AsString(rv); + ncp = (char *)PyBytes_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; newy2 += ystep; @@ -150,10 +150,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, newx*newy*size); + rv = PyBytes_FromStringAndSize(NULL, newx*newy*size); if ( rv == 0 ) return 0; - ncp = (char *)PyString_AsString(rv); + ncp = (char *)PyBytes_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; for( iy = 0; iy < newy; iy++ ) { @@ -195,10 +195,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len); + rv = PyBytes_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); if ( width == 1 ) { memcpy(ncp, cp, maxx); /* Copy first line */ @@ -245,10 +245,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+7)/8); + rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; ovalue = 0; @@ -286,10 +286,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+1)/2); + rv = PyBytes_FromStringAndSize(NULL, (len+1)/2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -325,10 +325,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+3)/4); + rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -363,10 +363,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+7)/8); + rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; ovalue = 0; @@ -409,10 +409,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len+3)/4); + rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 1; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -449,10 +449,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); bit = 0x80; for ( i=0; i < nlen; i++ ) { @@ -486,10 +486,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -522,10 +522,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -559,10 +559,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */ @@ -603,10 +603,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen*4); + rv = PyBytes_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: RRRBBGGG @@ -653,10 +653,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen); + rv = PyBytes_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { if (backward_compatible) { @@ -698,10 +698,10 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, nlen*4); + rv = PyBytes_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyString_AsString(rv); + ncp = (unsigned char *)PyBytes_AsString(rv); for ( i=0; i < nlen; i++ ) { value = *cp++; Modified: python/branches/okkoto-sizeof/Modules/imgfile.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/imgfile.c (original) +++ python/branches/okkoto-sizeof/Modules/imgfile.c Wed Jun 4 11:24:23 2008 @@ -130,12 +130,12 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); + rv = PyBytes_FromStringAndSize((char *)NULL, xsize*ysize*zsize); if ( rv == NULL ) { iclose(image); return NULL; } - cdatap = PyString_AsString(rv); + cdatap = PyBytes_AsString(rv); idatap = (long *)cdatap; if (top_to_bottom) { @@ -319,7 +319,7 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); + rv = PyBytes_FromStringAndSize(NULL, xwtd*ywtd*zsize); if ( rv == NULL ) { iclose(image); return NULL; @@ -328,7 +328,7 @@ xfac = (float)xsize/(float)xwtd; yfac = (float)ysize/(float)ywtd; PyFPE_END_PROTECT(yfac) - cdatap = PyString_AsString(rv); + cdatap = PyBytes_AsString(rv); idatap = (long *)cdatap; if ( extended ) { Modified: python/branches/okkoto-sizeof/Modules/itertoolsmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/itertoolsmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/itertoolsmodule.c Wed Jun 4 11:24:23 2008 @@ -2904,12 +2904,12 @@ PyObject *result; if (lz->cnt != PY_SSIZE_T_MAX) - return PyString_FromFormat("count(%zd)", lz->cnt); + return PyBytes_FromFormat("count(%zd)", lz->cnt); cnt_repr = PyObject_Repr(lz->long_cnt); if (cnt_repr == NULL) return NULL; - result = PyString_FromFormat("count(%s)", PyString_AS_STRING(cnt_repr)); + result = PyBytes_FromFormat("count(%s)", PyBytes_AS_STRING(cnt_repr)); Py_DECREF(cnt_repr); return result; } @@ -3221,11 +3221,11 @@ return NULL; if (ro->cnt == -1) - result = PyString_FromFormat("repeat(%s)", - PyString_AS_STRING(objrepr)); + result = PyBytes_FromFormat("repeat(%s)", + PyBytes_AS_STRING(objrepr)); else - result = PyString_FromFormat("repeat(%s, %zd)", - PyString_AS_STRING(objrepr), ro->cnt); + result = PyBytes_FromFormat("repeat(%s, %zd)", + PyBytes_AS_STRING(objrepr), ro->cnt); Py_DECREF(objrepr); return result; } Modified: python/branches/okkoto-sizeof/Modules/linuxaudiodev.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/linuxaudiodev.c (original) +++ python/branches/okkoto-sizeof/Modules/linuxaudiodev.c Wed Jun 4 11:24:23 2008 @@ -162,17 +162,17 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyString_AS_STRING(rv); + cp = PyBytes_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; } self->x_icount += count; - _PyString_Resize(&rv, count); + _PyBytes_Resize(&rv, count); return rv; } Modified: python/branches/okkoto-sizeof/Modules/main.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/main.c (original) +++ python/branches/okkoto-sizeof/Modules/main.c Wed Jun 4 11:24:23 2008 @@ -99,6 +99,7 @@ PYTHONHOME : alternate directory (or %c).\n\ The default module search path uses %s.\n\ PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\ +PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ "; @@ -195,7 +196,7 @@ { PyObject *argv0 = NULL, *importer = NULL; - if ((argv0 = PyString_FromString(filename)) && + if ((argv0 = PyBytes_FromString(filename)) && (importer = PyImport_GetImporter(argv0)) && (importer->ob_type != &PyNullImporter_Type)) { Modified: python/branches/okkoto-sizeof/Modules/mathmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/mathmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/mathmodule.c Wed Jun 4 11:24:23 2008 @@ -307,6 +307,211 @@ FUNC1(tanh, tanh, 0, "tanh(x)\n\nReturn the hyperbolic tangent of x.") +/* Precision summation function as msum() by Raymond Hettinger in + , + enhanced with the exact partials sum and roundoff from Mark + Dickinson's post at . + See those links for more details, proofs and other references. + + Note 1: IEEE 754R floating point semantics are assumed, + but the current implementation does not re-establish special + value semantics across iterations (i.e. handling -Inf + Inf). + + Note 2: No provision is made for intermediate overflow handling; + therefore, sum([1e+308, 1e-308, 1e+308]) returns 1e+308 while + sum([1e+308, 1e+308, 1e-308]) raises an OverflowError due to the + overflow of the first partial sum. + + Note 3: The itermediate values lo, yr, and hi are declared volatile so + aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. + Also, the volatile declaration forces the values to be stored in memory as + regular doubles instead of extended long precision (80-bit) values. This + prevents double rounding because any addition or substraction of two doubles + can be resolved exactly into double-sized hi and lo values. As long as the + hi value gets forced into a double before yr and lo are computed, the extra + bits in downstream extended precision operations (x87 for example) will be + exactly zero and therefore can be losslessly stored back into a double, + thereby preventing double rounding. + + Note 4: A similar implementation is in Modules/cmathmodule.c. + Be sure to update both when making changes. + + Note 5: The signature of math.sum() differs from __builtin__.sum() + because the start argument doesn't make sense in the context of + accurate summation. Since the partials table is collapsed before + returning a result, sum(seq2, start=sum(seq1)) may not equal the + accurate result returned by sum(itertools.chain(seq1, seq2)). +*/ + +#define NUM_PARTIALS 32 /* initial partials array size, on stack */ + +/* Extend the partials array p[] by doubling its size. */ +static int /* non-zero on error */ +_sum_realloc(double **p_ptr, Py_ssize_t n, + double *ps, Py_ssize_t *m_ptr) +{ + void *v = NULL; + Py_ssize_t m = *m_ptr; + + m += m; /* double */ + if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { + double *p = *p_ptr; + if (p == ps) { + v = PyMem_Malloc(sizeof(double) * m); + if (v != NULL) + memcpy(v, ps, sizeof(double) * n); + } + else + v = PyMem_Realloc(p, sizeof(double) * m); + } + if (v == NULL) { /* size overflow or no memory */ + PyErr_SetString(PyExc_MemoryError, "math sum partials"); + return 1; + } + *p_ptr = (double*) v; + *m_ptr = m; + return 0; +} + +/* Full precision summation of a sequence of floats. + + def msum(iterable): + partials = [] # sorted, non-overlapping partial sums + for x in iterable: + i = 0 + for y in partials: + if abs(x) < abs(y): + x, y = y, x + hi = x + y + lo = y - (hi - x) + if lo: + partials[i] = lo + i += 1 + x = hi + partials[i:] = [x] + return sum_exact(partials) + + Rounded x+y stored in hi with the roundoff stored in lo. Together hi+lo + are exactly equal to x+y. The inner loop applies hi/lo summation to each + partial so that the list of partial sums remains exact. + + Sum_exact() adds the partial sums exactly and correctly rounds the final + result (using the round-half-to-even rule). The items in partials remain + non-zero, non-special, non-overlapping and strictly increasing in + magnitude, but possibly not all having the same sign. + + Depends on IEEE 754 arithmetic guarantees and half-even rounding. +*/ + +static PyObject* +math_sum(PyObject *self, PyObject *seq) +{ + PyObject *item, *iter, *sum = NULL; + Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; + double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile double hi, yr, lo; + + iter = PyObject_GetIter(seq); + if (iter == NULL) + return NULL; + + PyFPE_START_PROTECT("sum", Py_DECREF(iter); return NULL) + + for(;;) { /* for x in iterable */ + assert(0 <= n && n <= m); + assert((m == NUM_PARTIALS && p == ps) || + (m > NUM_PARTIALS && p != NULL)); + + item = PyIter_Next(iter); + if (item == NULL) { + if (PyErr_Occurred()) + goto _sum_error; + break; + } + x = PyFloat_AsDouble(item); + Py_DECREF(item); + if (PyErr_Occurred()) + goto _sum_error; + + for (i = j = 0; j < n; j++) { /* for y in partials */ + y = p[j]; + if (fabs(x) < fabs(y)) { + t = x; x = y; y = t; + } + hi = x + y; + yr = hi - x; + lo = y - yr; + if (lo != 0.0) + p[i++] = lo; + x = hi; + } + + n = i; /* ps[i:] = [x] */ + if (x != 0.0) { + /* If non-finite, reset partials, effectively + adding subsequent items without roundoff + and yielding correct non-finite results, + provided IEEE 754 rules are observed */ + if (! Py_IS_FINITE(x)) + n = 0; + else if (n >= m && _sum_realloc(&p, n, ps, &m)) + goto _sum_error; + p[n++] = x; + } + } + + hi = 0.0; + if (n > 0) { + hi = p[--n]; + if (Py_IS_FINITE(hi)) { + /* sum_exact(ps, hi) from the top, stop when the sum becomes inexact. */ + while (n > 0) { + x = hi; + y = p[--n]; + assert(fabs(y) < fabs(x)); + hi = x + y; + yr = hi - x; + lo = y - yr; + if (lo != 0.0) + break; + } + /* Make half-even rounding work across multiple partials. Needed + so that sum([1e-16, 1, 1e16]) will round-up the last digit to + two instead of down to zero (the 1e-16 makes the 1 slightly + closer to two). With a potential 1 ULP rounding error fixed-up, + math.sum() can guarantee commutativity. */ + if (n > 0 && ((lo < 0.0 && p[n-1] < 0.0) || + (lo > 0.0 && p[n-1] > 0.0))) { + y = lo * 2.0; + x = hi + y; + yr = x - hi; + if (y == yr) + hi = x; + } + } + else { /* raise exception corresponding to a special value */ + errno = Py_IS_NAN(hi) ? EDOM : ERANGE; + if (is_error(hi)) + goto _sum_error; + } + } + sum = PyFloat_FromDouble(hi); + +_sum_error: + PyFPE_END_PROTECT(hi) + Py_DECREF(iter); + if (p != ps) + PyMem_Free(p); + return sum; +} + +#undef NUM_PARTIALS + +PyDoc_STRVAR(math_sum_doc, +"sum(iterable)\n\n\ +Return an accurate floating point sum of values in the iterable.\n\ +Assumes IEEE-754 floating point arithmetic."); + static PyObject * math_trunc(PyObject *self, PyObject *number) { @@ -760,6 +965,7 @@ {"sin", math_sin, METH_O, math_sin_doc}, {"sinh", math_sinh, METH_O, math_sinh_doc}, {"sqrt", math_sqrt, METH_O, math_sqrt_doc}, + {"sum", math_sum, METH_O, math_sum_doc}, {"tan", math_tan, METH_O, math_tan_doc}, {"tanh", math_tanh, METH_O, math_tanh_doc}, {"trunc", math_trunc, METH_O, math_trunc_doc}, Modified: python/branches/okkoto-sizeof/Modules/md5module.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/md5module.c (original) +++ python/branches/okkoto-sizeof/Modules/md5module.c Wed Jun 4 11:24:23 2008 @@ -80,7 +80,7 @@ mdContext = self->md5; md5_finish(&mdContext, aDigest); - return PyString_FromStringAndSize((char *)aDigest, 16); + return PyBytes_FromStringAndSize((char *)aDigest, 16); } PyDoc_STRVAR(digest_doc, @@ -113,7 +113,7 @@ c = (c>9) ? c+'a'-10 : c + '0'; hexdigest[j++] = c; } - return PyString_FromStringAndSize((char*)hexdigest, 32); + return PyBytes_FromStringAndSize((char*)hexdigest, 32); } @@ -165,7 +165,7 @@ static PyObject * md5_get_name(PyObject *self, void *closure) { - return PyString_FromStringAndSize("MD5", 3); + return PyBytes_FromStringAndSize("MD5", 3); } static PyGetSetDef md5_getseters[] = { Modified: python/branches/okkoto-sizeof/Modules/mmapmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/mmapmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/mmapmodule.c Wed Jun 4 11:24:23 2008 @@ -222,7 +222,7 @@ else ++eol; /* we're interested in the position after the newline. */ - result = PyString_FromStringAndSize(start, (eol - start)); + result = PyBytes_FromStringAndSize(start, (eol - start)); self->pos += (eol - start); return result; } @@ -700,7 +700,7 @@ PyErr_SetString(PyExc_IndexError, "mmap index out of range"); return NULL; } - return PyString_FromStringAndSize(self->data + i, 1); + return PyBytes_FromStringAndSize(self->data + i, 1); } static PyObject * @@ -718,7 +718,7 @@ else if ((size_t)ihigh > self->size) ihigh = self->size; - return PyString_FromStringAndSize(self->data + ilow, ihigh-ilow); + return PyBytes_FromStringAndSize(self->data + ilow, ihigh-ilow); } static PyObject * @@ -736,7 +736,7 @@ "mmap index out of range"); return NULL; } - return PyString_FromStringAndSize(self->data + i, 1); + return PyBytes_FromStringAndSize(self->data + i, 1); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; @@ -747,9 +747,9 @@ } if (slicelen <= 0) - return PyString_FromStringAndSize("", 0); + return PyBytes_FromStringAndSize("", 0); else if (step == 1) - return PyString_FromStringAndSize(self->data + start, + return PyBytes_FromStringAndSize(self->data + start, slicelen); else { char *result_buf = (char *)PyMem_Malloc(slicelen); @@ -762,7 +762,7 @@ cur += step, i++) { result_buf[i] = self->data[cur]; } - result = PyString_FromStringAndSize(result_buf, + result = PyBytes_FromStringAndSize(result_buf, slicelen); PyMem_Free(result_buf); return result; @@ -815,19 +815,19 @@ "mmap object doesn't support slice deletion"); return -1; } - if (! (PyString_Check(v)) ) { + if (! (PyBytes_Check(v)) ) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyString_Size(v) != (ihigh - ilow)) { + if (PyBytes_Size(v) != (ihigh - ilow)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(v); + buf = PyBytes_AsString(v); memcpy(self->data + ilow, buf, ihigh-ilow); return 0; } @@ -847,14 +847,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (! (PyString_Check(v) && PyString_Size(v)==1) ) { + if (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(v); + buf = PyBytes_AsString(v); self->data[i] = buf[0]; return 0; } @@ -882,14 +882,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (!PyString_Check(value) || PyString_Size(value) != 1) { + if (!PyBytes_Check(value) || PyBytes_Size(value) != 1) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyString_AsString(value); + buf = PyBytes_AsString(value); self->data[i] = buf[0]; return 0; } @@ -906,12 +906,12 @@ "mmap object doesn't support slice deletion"); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyString_Size(value) != slicelen) { + if (PyBytes_Size(value) != slicelen) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; @@ -922,7 +922,7 @@ if (slicelen == 0) return 0; else if (step == 1) { - const char *buf = PyString_AsString(value); + const char *buf = PyBytes_AsString(value); if (buf == NULL) return -1; @@ -931,7 +931,7 @@ } else { Py_ssize_t cur, i; - const char *buf = PyString_AsString(value); + const char *buf = PyBytes_AsString(value); if (buf == NULL) return -1; Modified: python/branches/okkoto-sizeof/Modules/nismodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/nismodule.c (original) +++ python/branches/okkoto-sizeof/Modules/nismodule.c Wed Jun 4 11:24:23 2008 @@ -115,8 +115,8 @@ if (invallen > 0 && inval[invallen-1] == '\0') invallen--; } - key = PyString_FromStringAndSize(inkey, inkeylen); - val = PyString_FromStringAndSize(inval, invallen); + key = PyBytes_FromStringAndSize(inkey, inkeylen); + val = PyBytes_FromStringAndSize(inval, invallen); if (key == NULL || val == NULL) { /* XXX error -- don't know how to handle */ PyErr_Clear(); @@ -146,7 +146,7 @@ if ((err = yp_get_default_domain(&domain)) != 0) return nis_error(err); - res = PyString_FromStringAndSize (domain, strlen(domain)); + res = PyBytes_FromStringAndSize (domain, strlen(domain)); return res; } @@ -178,7 +178,7 @@ len--; if (err != 0) return nis_error(err); - res = PyString_FromStringAndSize (match, len); + res = PyBytes_FromStringAndSize (match, len); free (match); return res; } @@ -398,7 +398,7 @@ if ((list = PyList_New(0)) == NULL) return NULL; for (maps = maps; maps; maps = maps->next) { - PyObject *str = PyString_FromString(maps->map); + PyObject *str = PyBytes_FromString(maps->map); if (!str || PyList_Append(list, str) < 0) { Py_DECREF(list); Modified: python/branches/okkoto-sizeof/Modules/operator.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/operator.c (original) +++ python/branches/okkoto-sizeof/Modules/operator.c Wed Jun 4 11:24:23 2008 @@ -508,19 +508,19 @@ } #endif - if (!PyString_Check(attr)) { + if (!PyBytes_Check(attr)) { PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); return NULL; } - s = PyString_AS_STRING(attr); + s = PyBytes_AS_STRING(attr); Py_INCREF(obj); for (;;) { PyObject *newobj, *str; p = strchr(s, '.'); - str = p ? PyString_FromStringAndSize(s, (p-s)) : - PyString_FromString(s); + str = p ? PyBytes_FromStringAndSize(s, (p-s)) : + PyBytes_FromString(s); if (str == NULL) { Py_DECREF(obj); return NULL; Modified: python/branches/okkoto-sizeof/Modules/ossaudiodev.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/ossaudiodev.c (original) +++ python/branches/okkoto-sizeof/Modules/ossaudiodev.c Wed Jun 4 11:24:23 2008 @@ -366,10 +366,10 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyString_AS_STRING(rv); + cp = PyBytes_AS_STRING(rv); Py_BEGIN_ALLOW_THREADS count = read(self->fd, cp, size); @@ -381,7 +381,7 @@ return NULL; } self->icount += count; - _PyString_Resize(&rv, count); + _PyBytes_Resize(&rv, count); return rv; } @@ -811,20 +811,20 @@ Py_INCREF(rval); } else if (strcmp(name, "name") == 0) { - rval = PyString_FromString(self->devicename); + rval = PyBytes_FromString(self->devicename); } else if (strcmp(name, "mode") == 0) { /* No need for a "default" in this switch: from newossobject(), self->mode can only be one of these three values. */ switch(self->mode) { case O_RDONLY: - rval = PyString_FromString("r"); + rval = PyBytes_FromString("r"); break; case O_RDWR: - rval = PyString_FromString("rw"); + rval = PyBytes_FromString("rw"); break; case O_WRONLY: - rval = PyString_FromString("w"); + rval = PyBytes_FromString("w"); break; } } @@ -913,12 +913,12 @@ if (labels == NULL || names == NULL) goto error2; for (i = 0; i < num_controls; i++) { - s = PyString_FromString(control_labels[i]); + s = PyBytes_FromString(control_labels[i]); if (s == NULL) goto error2; PyList_SET_ITEM(labels, i, s); - s = PyString_FromString(control_names[i]); + s = PyBytes_FromString(control_names[i]); if (s == NULL) goto error2; PyList_SET_ITEM(names, i, s); Modified: python/branches/okkoto-sizeof/Modules/parsermodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/parsermodule.c (original) +++ python/branches/okkoto-sizeof/Modules/parsermodule.c Wed Jun 4 11:24:23 2008 @@ -105,14 +105,14 @@ } if (TYPE(n) == encoding_decl) - (void) addelem(v, i+1, PyString_FromString(STR(n))); + (void) addelem(v, i+1, PyBytes_FromString(STR(n))); return (v); } else if (ISTERMINAL(TYPE(n))) { PyObject *result = mkseq(2 + lineno + col_offset); if (result != NULL) { (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); - (void) addelem(result, 1, PyString_FromString(STR(n))); + (void) addelem(result, 1, PyBytes_FromString(STR(n))); if (lineno == 1) (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); if (col_offset == 1) @@ -689,7 +689,7 @@ temp = PySequence_GetItem(elem, 1); if (temp == NULL) return 0; - if (!PyString_Check(temp)) { + if (!PyBytes_Check(temp)) { PyErr_Format(parser_error, "second item in terminal node must be a string," " found %s", @@ -714,10 +714,10 @@ Py_DECREF(o); } } - len = PyString_GET_SIZE(temp) + 1; + len = PyBytes_GET_SIZE(temp) + 1; strn = (char *)PyObject_MALLOC(len); if (strn != NULL) - (void) memcpy(strn, PyString_AS_STRING(temp), len); + (void) memcpy(strn, PyBytes_AS_STRING(temp), len); Py_DECREF(temp); } else if (!ISNONTERMINAL(type)) { @@ -800,10 +800,10 @@ } if (res && encoding) { Py_ssize_t len; - len = PyString_GET_SIZE(encoding) + 1; + len = PyBytes_GET_SIZE(encoding) + 1; res->n_str = (char *)PyObject_MALLOC(len); if (res->n_str != NULL) - (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len); + (void) memcpy(res->n_str, PyBytes_AS_STRING(encoding), len); Py_DECREF(encoding); Py_DECREF(tuple); } @@ -3284,7 +3284,7 @@ * If this fails, the import of this module will fail because an * exception will be raised here; should we clear the exception? */ - copyreg = PyImport_ImportModuleNoBlock("copyreg"); + copyreg = PyImport_ImportModuleNoBlock("copy_reg"); if (copyreg != NULL) { PyObject *func, *pickler; Modified: python/branches/okkoto-sizeof/Modules/posixmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/posixmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/posixmodule.c Wed Jun 4 11:24:23 2008 @@ -375,12 +375,12 @@ char *p = strchr(*e, '='); if (p == NULL) continue; - k = PyString_FromStringAndSize(*e, (int)(p-*e)); + k = PyBytes_FromStringAndSize(*e, (int)(p-*e)); if (k == NULL) { PyErr_Clear(); continue; } - v = PyString_FromString(p+1); + v = PyBytes_FromString(p+1); if (v == NULL) { PyErr_Clear(); Py_DECREF(k); @@ -400,13 +400,13 @@ rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ - PyObject *v = PyString_FromString(buffer); + PyObject *v = PyBytes_FromString(buffer); PyDict_SetItemString(d, "BEGINLIBPATH", v); Py_DECREF(v); } rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ - PyObject *v = PyString_FromString(buffer); + PyObject *v = PyBytes_FromString(buffer); PyDict_SetItemString(d, "ENDLIBPATH", v); Py_DECREF(v); } @@ -1598,7 +1598,7 @@ #endif if (ret == NULL) return posix_error(); - return PyString_FromString(ret); + return PyBytes_FromString(ret); } #endif @@ -1620,7 +1620,7 @@ #endif if (ret == NULL) return posix_error(); - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } #endif @@ -1968,7 +1968,7 @@ Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #ifdef Py_USING_UNICODE @@ -2174,7 +2174,7 @@ /* Skip over . and .. */ if (strcmp(FileData.cFileName, ".") != 0 && strcmp(FileData.cFileName, "..") != 0) { - v = PyString_FromString(FileData.cFileName); + v = PyBytes_FromString(FileData.cFileName); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2262,7 +2262,7 @@ /* Leave Case of Name Alone -- In Native Form */ /* (Removed Forced Lowercasing Code) */ - v = PyString_FromString(namebuf); + v = PyBytes_FromString(namebuf); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2312,7 +2312,7 @@ (NAMLEN(ep) == 1 || (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) continue; - v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); + v = PyBytes_FromStringAndSize(ep->d_name, NAMLEN(ep)); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2397,7 +2397,7 @@ return PyUnicode_Decode(outbuf, strlen(outbuf), Py_FileSystemDefaultEncoding, NULL); } - return PyString_FromString(outbuf); + return PyBytes_FromString(outbuf); } /* end of posix__getfullpathname */ #endif /* MS_WINDOWS */ @@ -3062,7 +3062,7 @@ /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { #endif - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3292,7 +3292,7 @@ { goto fail_2; } - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3525,7 +3525,7 @@ { goto fail_2; } - len = PyString_Size(key) + PyString_Size(val) + 2; + len = PyBytes_Size(key) + PyBytes_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3895,7 +3895,7 @@ "unable to determine login name"); } else - result = PyString_FromString(name); + result = PyBytes_FromString(name); errno = old_errno; return result; @@ -5884,7 +5884,7 @@ return posix_error_with_allocated_filename(path); PyMem_Free(path); - v = PyString_FromStringAndSize(buf, n); + v = PyBytes_FromStringAndSize(buf, n); #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -6289,18 +6289,18 @@ errno = EINVAL; return posix_error(); } - buffer = PyString_FromStringAndSize((char *)NULL, size); + buffer = PyBytes_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - n = read(fd, PyString_AsString(buffer), size); + n = read(fd, PyBytes_AsString(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) - _PyString_Resize(&buffer, n); + _PyBytes_Resize(&buffer, n); return buffer; } @@ -6647,11 +6647,11 @@ /* XXX This can leak memory -- not easy to fix :-( */ len = strlen(s1) + strlen(s2) + 2; /* len includes space for a trailing \0; the size arg to - PyString_FromStringAndSize does not count that */ - newstr = PyString_FromStringAndSize(NULL, (int)len - 1); + PyBytes_FromStringAndSize does not count that */ + newstr = PyBytes_FromStringAndSize(NULL, (int)len - 1); if (newstr == NULL) return PyErr_NoMemory(); - newenv = PyString_AS_STRING(newstr); + newenv = PyBytes_AS_STRING(newstr); PyOS_snprintf(newenv, len, "%s=%s", s1, s2); if (putenv(newenv)) { Py_DECREF(newstr); @@ -6727,7 +6727,7 @@ "strerror() argument out of range"); return NULL; } - return PyString_FromString(message); + return PyBytes_FromString(message); } @@ -7009,7 +7009,7 @@ #endif if (name == NULL) return PyErr_NoMemory(); - result = PyString_FromString(name); + result = PyBytes_FromString(name); free(name); return result; } @@ -7066,7 +7066,7 @@ Py_XDECREF(err); return NULL; } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } #endif @@ -7095,13 +7095,13 @@ *valuep = PyInt_AS_LONG(arg); return 1; } - if (PyString_Check(arg)) { + if (PyBytes_Check(arg)) { /* look up the value in the table using a binary search */ size_t lo = 0; size_t mid; size_t hi = tablesize; int cmp; - char *confname = PyString_AS_STRING(arg); + char *confname = PyBytes_AS_STRING(arg); while (lo < hi) { mid = (lo + hi) / 2; cmp = strcmp(confname, table[mid].name); @@ -7431,12 +7431,12 @@ } else { if ((unsigned int)len >= sizeof(buffer)) { - result = PyString_FromStringAndSize(NULL, len-1); + result = PyBytes_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyString_AS_STRING(result), len); + confstr(name, PyBytes_AS_STRING(result), len); } else - result = PyString_FromStringAndSize(buffer, len-1); + result = PyBytes_FromStringAndSize(buffer, len-1); } } return result; @@ -8225,11 +8225,11 @@ } /* Allocate bytes */ - result = PyString_FromStringAndSize(NULL, howMany); + result = PyBytes_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) - PyString_AS_STRING(result))) { + PyBytes_AS_STRING(result))) { Py_DECREF(result); return win32_error("CryptGenRandom", NULL); } @@ -8259,11 +8259,11 @@ "negative argument not allowed"); /* Allocate bytes */ - result = PyString_FromStringAndSize(NULL, howMany); + result = PyBytes_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (RAND_pseudo_bytes((unsigned char*) - PyString_AS_STRING(result), + PyBytes_AS_STRING(result), howMany) < 0) { Py_DECREF(result); return PyErr_Format(PyExc_ValueError, @@ -8756,6 +8756,11 @@ #endif /* GNU extensions. */ +#ifdef O_ASYNC + /* Send a SIGIO signal whenever input or output + becomes available on file descriptor */ + if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1; +#endif #ifdef O_DIRECT /* Direct disk access. */ if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; Modified: python/branches/okkoto-sizeof/Modules/pwdmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/pwdmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/pwdmodule.c Wed Jun 4 11:24:23 2008 @@ -49,7 +49,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/okkoto-sizeof/Modules/pyexpat.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/pyexpat.c (original) +++ python/branches/okkoto-sizeof/Modules/pyexpat.c Wed Jun 4 11:24:23 2008 @@ -153,7 +153,7 @@ { PyObject *name = hinfo->nameobj; if (name == NULL) { - name = PyString_FromString(hinfo->name); + name = PyBytes_FromString(hinfo->name); hinfo->nameobj = name; } Py_XINCREF(name); @@ -205,7 +205,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(str); + return PyBytes_FromString(str); } static PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromStringAndSize((const char *)str, len); + return PyBytes_FromStringAndSize((const char *)str, len); } /* Callback routines */ @@ -267,16 +267,16 @@ PyObject *filename = NULL; if (handler_info[slot].tb_code == NULL) { - code = PyString_FromString(""); + code = PyBytes_FromString(""); if (code == NULL) goto failed; - name = PyString_FromString(func_name); + name = PyBytes_FromString(func_name); if (name == NULL) goto failed; nulltuple = PyTuple_New(0); if (nulltuple == NULL) goto failed; - filename = PyString_FromString(__FILE__); + filename = PyBytes_FromString(__FILE__); handler_info[slot].tb_code = PyCode_New(0, /* argcount */ 0, /* nlocals */ @@ -971,13 +971,13 @@ goto finally; /* XXX what to do if it returns a Unicode string? */ - if (!PyString_Check(str)) { + if (!PyBytes_Check(str)) { PyErr_Format(PyExc_TypeError, "read() did not return a string object (type=%.400s)", Py_TYPE(str)->tp_name); goto finally; } - len = PyString_GET_SIZE(str); + len = PyBytes_GET_SIZE(str); if (len > buf_size) { PyErr_Format(PyExc_ValueError, "read() returned too much data: " @@ -985,7 +985,7 @@ buf_size, len); goto finally; } - memcpy(buf, PyString_AsString(str), len); + memcpy(buf, PyBytes_AsString(str), len); finally: Py_XDECREF(arg); Py_XDECREF(str); @@ -1094,7 +1094,7 @@ = XML_GetInputContext(self->itself, &offset, &size); if (buffer != NULL) - return PyString_FromStringAndSize(buffer + offset, + return PyBytes_FromStringAndSize(buffer + offset, size - offset); else Py_RETURN_NONE; @@ -1511,7 +1511,7 @@ #define APPEND(list, str) \ do { \ - PyObject *o = PyString_FromString(str); \ + PyObject *o = PyBytes_FromString(str); \ if (o != NULL) \ PyList_Append(list, o); \ Py_XDECREF(o); \ @@ -1862,7 +1862,7 @@ while (rev[i] != ' ' && rev[i] != '\0') ++i; - return PyString_FromStringAndSize(rev, i); + return PyBytes_FromStringAndSize(rev, i); } /* Initialization function for the module */ @@ -1889,7 +1889,7 @@ MODULE_INITFUNC(void) { PyObject *m, *d; - PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); + PyObject *errmod_name = PyBytes_FromString(MODULE_NAME ".errors"); PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; @@ -1899,7 +1899,7 @@ if (errmod_name == NULL) return; - modelmod_name = PyString_FromString(MODULE_NAME ".model"); + modelmod_name = PyBytes_FromString(MODULE_NAME ".model"); if (modelmod_name == NULL) return; Modified: python/branches/okkoto-sizeof/Modules/readline.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/readline.c (original) +++ python/branches/okkoto-sizeof/Modules/readline.c Wed Jun 4 11:24:23 2008 @@ -421,7 +421,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyString_FromString(rl_completer_word_break_characters); + return PyBytes_FromString(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -471,7 +471,7 @@ if (!PyArg_ParseTuple(args, "i:index", &idx)) return NULL; if ((hist_ent = history_get(idx))) - return PyString_FromString(hist_ent->line); + return PyBytes_FromString(hist_ent->line); else { Py_RETURN_NONE; } @@ -503,7 +503,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyString_FromString(rl_line_buffer); + return PyBytes_FromString(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -676,7 +676,7 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyString_FromString(matches[i+1]); + s = PyBytes_FromString(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) @@ -725,7 +725,7 @@ result = NULL; } else { - char *s = PyString_AsString(r); + char *s = PyBytes_AsString(r); if (s == NULL) goto error; result = strdup(s); Modified: python/branches/okkoto-sizeof/Modules/selectmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/selectmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/selectmodule.c Wed Jun 4 11:24:23 2008 @@ -1219,7 +1219,7 @@ "data=0x%lx udata=%p>", (unsigned long)(s->e.ident), s->e.filter, s->e.flags, s->e.fflags, (long)(s->e.data), s->e.udata); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int Modified: python/branches/okkoto-sizeof/Modules/sha256module.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/sha256module.c (original) +++ python/branches/okkoto-sizeof/Modules/sha256module.c Wed Jun 4 11:24:23 2008 @@ -432,7 +432,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); + return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA256_hexdigest__doc__, @@ -452,10 +452,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -510,9 +510,9 @@ SHA256_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 32) - return PyString_FromStringAndSize("SHA256", 6); + return PyBytes_FromStringAndSize("SHA256", 6); else - return PyString_FromStringAndSize("SHA224", 6); + return PyBytes_FromStringAndSize("SHA224", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/okkoto-sizeof/Modules/sha512module.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/sha512module.c (original) +++ python/branches/okkoto-sizeof/Modules/sha512module.c Wed Jun 4 11:24:23 2008 @@ -498,7 +498,7 @@ SHAcopy(self, &temp); sha512_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); + return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA512_hexdigest__doc__, @@ -518,10 +518,10 @@ sha512_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -576,9 +576,9 @@ SHA512_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 64) - return PyString_FromStringAndSize("SHA512", 6); + return PyBytes_FromStringAndSize("SHA512", 6); else - return PyString_FromStringAndSize("SHA384", 6); + return PyBytes_FromStringAndSize("SHA384", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/okkoto-sizeof/Modules/shamodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/shamodule.c (original) +++ python/branches/okkoto-sizeof/Modules/shamodule.c Wed Jun 4 11:24:23 2008 @@ -380,7 +380,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); + return PyBytes_FromStringAndSize((const char *)digest, sizeof(digest)); } PyDoc_STRVAR(SHA_hexdigest__doc__, @@ -400,10 +400,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, sizeof(digest) * 2); + retval = PyBytes_FromStringAndSize(NULL, sizeof(digest) * 2); if (!retval) return NULL; - hex_digest = PyString_AsString(retval); + hex_digest = PyBytes_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -463,7 +463,7 @@ static PyObject * SHA_get_name(PyObject *self, void *closure) { - return PyString_FromStringAndSize("SHA1", 4); + return PyBytes_FromStringAndSize("SHA1", 4); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/okkoto-sizeof/Modules/socketmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/socketmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/socketmodule.c Wed Jun 4 11:24:23 2008 @@ -911,7 +911,7 @@ set_gaierror(error); return NULL; } - return PyString_FromString(buf); + return PyBytes_FromString(buf); } @@ -955,7 +955,7 @@ sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } #endif @@ -1002,14 +1002,14 @@ #ifdef linux if (a->sun_path[0] == 0) { /* Linux abstract namespace */ addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyString_FromStringAndSize(a->sun_path, + return PyBytes_FromStringAndSize(a->sun_path, addrlen); } else #endif /* linux */ { /* regular NULL-terminated string */ - return PyString_FromString(a->sun_path); + return PyBytes_FromString(a->sun_path); } } #endif /* AF_UNIX */ @@ -1362,7 +1362,7 @@ addr = (struct sockaddr_sco *)addr_ret; _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; - straddr = PyString_AsString(args); + straddr = PyBytes_AsString(args); if (straddr == NULL) { PyErr_SetString(socket_error, "getsockaddrarg: " "wrong format"); @@ -1854,16 +1854,16 @@ "getsockopt buflen out of range"); return NULL; } - buf = PyString_FromStringAndSize((char *)NULL, buflen); + buf = PyBytes_FromStringAndSize((char *)NULL, buflen); if (buf == NULL) return NULL; res = getsockopt(s->sock_fd, level, optname, - (void *)PyString_AS_STRING(buf), &buflen); + (void *)PyBytes_AS_STRING(buf), &buflen); if (res < 0) { Py_DECREF(buf); return s->errorhandler(); } - _PyString_Resize(&buf, buflen); + _PyBytes_Resize(&buf, buflen); return buf; #endif /* __BEOS__ */ } @@ -2386,12 +2386,12 @@ } /* Allocate a new string. */ - buf = PyString_FromStringAndSize((char *) 0, recvlen); + buf = PyBytes_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; /* Call the guts */ - outlen = sock_recv_guts(s, PyString_AS_STRING(buf), recvlen, flags); + outlen = sock_recv_guts(s, PyBytes_AS_STRING(buf), recvlen, flags); if (outlen < 0) { /* An error occurred, release the string and return an error. */ @@ -2401,7 +2401,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyString_Resize(&buf, outlen) < 0) + if (_PyBytes_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ return NULL; } @@ -2560,11 +2560,11 @@ return NULL; } - buf = PyString_FromStringAndSize((char *) 0, recvlen); + buf = PyBytes_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; - outlen = sock_recvfrom_guts(s, PyString_AS_STRING(buf), + outlen = sock_recvfrom_guts(s, PyBytes_AS_STRING(buf), recvlen, flags, &addr); if (outlen < 0) { goto finally; @@ -2573,7 +2573,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyString_Resize(&buf, outlen) < 0) + if (_PyBytes_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ goto finally; } @@ -2941,7 +2941,7 @@ (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } @@ -3057,7 +3057,7 @@ if (res < 0) return set_error(); buf[sizeof buf - 1] = '\0'; - return PyString_FromString(buf); + return PyBytes_FromString(buf); } PyDoc_STRVAR(gethostname_doc, @@ -3143,7 +3143,7 @@ if (h->h_aliases) { for (pch = h->h_aliases; *pch != NULL; pch++) { int status; - tmp = PyString_FromString(*pch); + tmp = PyBytes_FromString(*pch); if (tmp == NULL) goto err; @@ -3432,7 +3432,7 @@ PyErr_SetString(socket_error, "port/proto not found"); return NULL; } - return PyString_FromString(sp->s_name); + return PyBytes_FromString(sp->s_name); } PyDoc_STRVAR(getservbyport_doc, @@ -3734,7 +3734,7 @@ if (inet_aton != NULL) { #endif if (inet_aton(ip_addr, &buf)) - return PyString_FromStringAndSize((char *)(&buf), + return PyBytes_FromStringAndSize((char *)(&buf), sizeof(buf)); PyErr_SetString(socket_error, @@ -3763,7 +3763,7 @@ return NULL; } } - return PyString_FromStringAndSize((char *) &packed_addr, + return PyBytes_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); #ifdef USE_INET_ATON_WEAKLINK @@ -3797,7 +3797,7 @@ memcpy(&packed_addr, packed_str, addr_len); - return PyString_FromString(inet_ntoa(packed_addr)); + return PyBytes_FromString(inet_ntoa(packed_addr)); } #ifdef HAVE_INET_PTON @@ -3840,11 +3840,11 @@ "illegal IP address string passed to inet_pton"); return NULL; } else if (af == AF_INET) { - return PyString_FromStringAndSize(packed, + return PyBytes_FromStringAndSize(packed, sizeof(struct in_addr)); #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { - return PyString_FromStringAndSize(packed, + return PyBytes_FromStringAndSize(packed, sizeof(struct in6_addr)); #endif } else { @@ -3871,7 +3871,7 @@ char ip[INET_ADDRSTRLEN + 1]; #endif - /* Guarantee NUL-termination for PyString_FromString() below */ + /* Guarantee NUL-termination for PyBytes_FromString() below */ memset((void *) &ip[0], '\0', sizeof(ip)); if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { @@ -3903,7 +3903,7 @@ PyErr_SetFromErrno(socket_error); return NULL; } else { - return PyString_FromString(retval); + return PyBytes_FromString(retval); } /* NOTREACHED */ @@ -3944,9 +3944,9 @@ idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); if (!idna) return NULL; - hptr = PyString_AsString(idna); - } else if (PyString_Check(hobj)) { - hptr = PyString_AsString(hobj); + hptr = PyBytes_AsString(idna); + } else if (PyBytes_Check(hobj)) { + hptr = PyBytes_AsString(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); @@ -3955,8 +3955,8 @@ if (PyInt_Check(pobj)) { PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); pptr = pbuf; - } else if (PyString_Check(pobj)) { - pptr = PyString_AsString(pobj); + } else if (PyBytes_Check(pobj)) { + pptr = PyBytes_AsString(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { Modified: python/branches/okkoto-sizeof/Modules/spwdmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/spwdmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/spwdmodule.c Wed Jun 4 11:24:23 2008 @@ -60,7 +60,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/okkoto-sizeof/Modules/stropmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/stropmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/stropmodule.c Wed Jun 4 11:24:23 2008 @@ -47,7 +47,7 @@ i = i+1; } if (j < i) { - item = PyString_FromStringAndSize(s+j, i-j); + item = PyBytes_FromStringAndSize(s+j, i-j); if (item == NULL) goto finally; @@ -61,7 +61,7 @@ i = i+1; } if (maxsplit && (countsplit >= maxsplit) && i < len) { - item = PyString_FromStringAndSize( + item = PyBytes_FromStringAndSize( s+i, len - i); if (item == NULL) goto finally; @@ -122,7 +122,7 @@ i = j = 0; while (i+n <= len) { if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) { - item = PyString_FromStringAndSize(s+j, i-j); + item = PyBytes_FromStringAndSize(s+j, i-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -137,7 +137,7 @@ else i++; } - item = PyString_FromStringAndSize(s+j, len-j); + item = PyBytes_FromStringAndSize(s+j, len-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -189,7 +189,7 @@ if (seqlen == 1) { /* Optimization if there's only one item */ PyObject *item = PySequence_GetItem(seq, 0); - if (item && !PyString_Check(item)) { + if (item && !PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(item); @@ -198,9 +198,9 @@ return item; } - if (!(res = PyString_FromStringAndSize((char*)NULL, sz))) + if (!(res = PyBytes_FromStringAndSize((char*)NULL, sz))) return NULL; - p = PyString_AsString(res); + p = PyBytes_AsString(res); /* optimize for lists, since it's the most common case. all others * (tuples and arbitrary sequences) just use the sequence abstract @@ -209,29 +209,29 @@ if (PyList_Check(seq)) { for (i = 0; i < seqlen; i++) { PyObject *item = PyList_GET_ITEM(seq, i); - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); return NULL; } - slen = PyString_GET_SIZE(item); + slen = PyBytes_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) + if (_PyBytes_Resize(&res, sz * 2) < 0) return NULL; sz *= 2; - p = PyString_AsString(res) + reslen; + p = PyBytes_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyString_AS_STRING(item), slen); + memcpy(p, PyBytes_AS_STRING(item), slen); p += slen; reslen += slen; } - _PyString_Resize(&res, reslen); + _PyBytes_Resize(&res, reslen); return res; } @@ -245,33 +245,33 @@ /* This is now type safe */ for (i = 0; i < seqlen; i++) { PyObject *item = getitemfunc(seq, i); - if (!item || !PyString_Check(item)) { + if (!item || !PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); Py_XDECREF(item); return NULL; } - slen = PyString_GET_SIZE(item); + slen = PyBytes_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) { + if (_PyBytes_Resize(&res, sz * 2) < 0) { Py_DECREF(item); return NULL; } sz *= 2; - p = PyString_AsString(res) + reslen; + p = PyBytes_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyString_AS_STRING(item), slen); + memcpy(p, PyBytes_AS_STRING(item), slen); p += slen; reslen += slen; Py_DECREF(item); } - _PyString_Resize(&res, reslen); + _PyBytes_Resize(&res, reslen); return res; } @@ -369,7 +369,7 @@ Py_ssize_t len, i, j; - if (PyString_AsStringAndSize(args, &s, &len)) + if (PyBytes_AsStringAndSize(args, &s, &len)) return NULL; i = 0; @@ -392,7 +392,7 @@ return args; } else - return PyString_FromStringAndSize(s+i, j-i); + return PyBytes_FromStringAndSize(s+i, j-i); } @@ -450,12 +450,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -489,12 +489,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -529,12 +529,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; if (0 < n) { int c = Py_CHARMASK(*s++); @@ -610,12 +610,12 @@ } /* Second pass: create output string and fill it */ - out = PyString_FromStringAndSize(NULL, i+j); + out = PyBytes_FromStringAndSize(NULL, i+j); if (out == NULL) return NULL; i = 0; - q = PyString_AS_STRING(out); + q = PyBytes_AS_STRING(out); for (p = string; p < e; p++) { if (*p == '\t') { @@ -695,12 +695,12 @@ int changed; WARN; - if (PyString_AsStringAndSize(args, &s, &n)) + if (PyBytes_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyString_FromStringAndSize(NULL, n); + newstr = PyBytes_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyString_AsString(newstr); + s_new = PyBytes_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -898,10 +898,10 @@ return NULL; } - result = PyString_FromStringAndSize((char *)NULL, 256); + result = PyBytes_FromStringAndSize((char *)NULL, 256); if (result == NULL) return NULL; - c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result); + c = (unsigned char *) PyBytes_AS_STRING((PyBytesObject *)result); for (i = 0; i < 256; i++) c[i]=(unsigned char)i; for (i = 0; i < fromlen; i++) @@ -942,12 +942,12 @@ } table = table1; - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); + inlen = PyBytes_GET_SIZE(input_obj); + result = PyBytes_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AsString(input_obj); + output_start = output = PyBytes_AsString(result); + input = PyBytes_AsString(input_obj); if (dellen == 0) { /* If no deletions are required, use faster code */ @@ -983,7 +983,7 @@ } /* Fix the size of the resulting string */ if (inlen > 0) - _PyString_Resize(&result, output - output_start); + _PyBytes_Resize(&result, output - output_start); return result; } @@ -1169,7 +1169,7 @@ Py_XINCREF(newstr); } else { - newstr = PyString_FromStringAndSize(new_s, out_len); + newstr = PyBytes_FromStringAndSize(new_s, out_len); PyMem_FREE(new_s); } return newstr; @@ -1222,7 +1222,7 @@ if (isspace(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "whitespace", s); @@ -1232,7 +1232,7 @@ if (islower(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "lowercase", s); @@ -1242,7 +1242,7 @@ if (isupper(c)) buf[n++] = c; } - s = PyString_FromStringAndSize(buf, n); + s = PyBytes_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "uppercase", s); } Modified: python/branches/okkoto-sizeof/Modules/sunaudiodev.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/sunaudiodev.c (original) +++ python/branches/okkoto-sizeof/Modules/sunaudiodev.c Wed Jun 4 11:24:23 2008 @@ -135,11 +135,11 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyString_FromStringAndSize(NULL, size); + rv = PyBytes_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - if (!(cp = PyString_AsString(rv))) + if (!(cp = PyBytes_AsString(rv))) goto finally; count = read(self->x_fd, cp, size); Modified: python/branches/okkoto-sizeof/Modules/svmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/svmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/svmodule.c Wed Jun 4 11:24:23 2008 @@ -47,13 +47,13 @@ if (!PyArg_Parse(args, "i", &invert)) return NULL; - if (!(output = PyString_FromStringAndSize( + if (!(output = PyBytes_FromStringAndSize( NULL, (int)(self->ob_info.width * self->ob_info.height * factor)))) { return NULL; } - if (!(outstr = PyString_AsString(output))) { + if (!(outstr = PyBytes_AsString(output))) { Py_DECREF(output); return NULL; } @@ -152,9 +152,9 @@ fieldsize = self->ob_info.width * self->ob_info.height / 2; obcapture = (char*)self->ob_capture; - if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) + if (!(f1 = PyBytes_FromStringAndSize(obcapture, fieldsize))) goto finally; - if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, + if (!(f2 = PyBytes_FromStringAndSize(obcapture + fieldsize, fieldsize))) goto finally; ret = PyTuple_Pack(2, f1, f2); @@ -535,12 +535,12 @@ goto finally; } - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) goto finally; /* XXX -- need to do something about the bitvector */ { - char* str = PyString_AsString(videodata); + char* str = PyBytes_AsString(videodata); if (!str) goto finally; @@ -615,10 +615,10 @@ if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) return sv_error(); - if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) return NULL; - str = PyString_AsString(videodata); + str = PyBytes_AsString(videodata); if (!str) goto finally; @@ -849,11 +849,11 @@ return NULL; } - if (!(output = PyString_FromStringAndSize(NULL, + if (!(output = PyBytes_FromStringAndSize(NULL, (int)(width * height * factor)))) return NULL; - str = PyString_AsString(output); + str = PyBytes_AsString(output); if (!str) { Py_DECREF(output); return NULL; Modified: python/branches/okkoto-sizeof/Modules/syslogmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/syslogmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/syslogmodule.c Wed Jun 4 11:24:23 2008 @@ -71,7 +71,7 @@ S_ident_o = new_S_ident_o; Py_INCREF(S_ident_o); - openlog(PyString_AsString(S_ident_o), logopt, facility); + openlog(PyBytes_AsString(S_ident_o), logopt, facility); Py_INCREF(Py_None); return Py_None; Modified: python/branches/okkoto-sizeof/Modules/termios.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/termios.c (original) +++ python/branches/okkoto-sizeof/Modules/termios.c Wed Jun 4 11:24:23 2008 @@ -91,7 +91,7 @@ return NULL; for (i = 0; i < NCCS; i++) { ch = (char)mode.c_cc[i]; - v = PyString_FromStringAndSize(&ch, 1); + v = PyBytes_FromStringAndSize(&ch, 1); if (v == NULL) goto err; PyList_SetItem(cc, i, v); @@ -183,8 +183,8 @@ for (i = 0; i < NCCS; i++) { v = PyList_GetItem(cc, i); - if (PyString_Check(v) && PyString_Size(v) == 1) - mode.c_cc[i] = (cc_t) * PyString_AsString(v); + if (PyBytes_Check(v) && PyBytes_Size(v) == 1) + mode.c_cc[i] = (cc_t) * PyBytes_AsString(v); else if (PyInt_Check(v)) mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { Modified: python/branches/okkoto-sizeof/Modules/threadmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/threadmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/threadmodule.c Wed Jun 4 11:24:23 2008 @@ -190,7 +190,7 @@ Py_XINCREF(kw); self->kw = kw; self->dict = NULL; /* making sure */ - self->key = PyString_FromFormat("thread.local.%p", self); + self->key = PyBytes_FromFormat("thread.local.%p", self); if (self->key == NULL) goto err; Modified: python/branches/okkoto-sizeof/Modules/timemodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/timemodule.c (original) +++ python/branches/okkoto-sizeof/Modules/timemodule.c Wed Jun 4 11:24:23 2008 @@ -488,7 +488,7 @@ e.g. an empty format, or %Z when the timezone is unknown. */ PyObject *ret; - ret = PyString_FromStringAndSize(outbuf, buflen); + ret = PyBytes_FromStringAndSize(outbuf, buflen); free(outbuf); return ret; } @@ -548,7 +548,7 @@ p = asctime(&buf); if (p[24] == '\n') p[24] = '\0'; - return PyString_FromString(p); + return PyBytes_FromString(p); } PyDoc_STRVAR(asctime_doc, @@ -584,7 +584,7 @@ } if (p[24] == '\n') p[24] = '\0'; - return PyString_FromString(p); + return PyBytes_FromString(p); } PyDoc_STRVAR(ctime_doc, Modified: python/branches/okkoto-sizeof/Modules/unicodedata.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/unicodedata.c (original) +++ python/branches/okkoto-sizeof/Modules/unicodedata.c Wed Jun 4 11:24:23 2008 @@ -54,12 +54,6 @@ return &_PyUnicode_Database_Records[index]; } -static const _PyUnicode_DatabaseRecord* -_getrecord(PyUnicodeObject* v) -{ - return _getrecord_ex(*PyUnicode_AS_UNICODE(v)); -} - /* ------------- Previous-version API ------------------------------------- */ typedef struct previous_version { PyObject_HEAD @@ -92,6 +86,24 @@ return (PyObject*)self; } + +static Py_UCS4 getuchar(PyUnicodeObject *obj) +{ + Py_UNICODE *v = PyUnicode_AS_UNICODE(obj); + + if (PyUnicode_GET_SIZE(obj) == 1) + return *v; +#ifndef Py_UNICODE_WIDE + else if ((PyUnicode_GET_SIZE(obj) == 2) && + (0xD800 <= v[0] && v[0] <= 0xDBFF) && + (0xDC00 <= v[1] && v[1] <= 0xDFFF)) + return (((v[0] & 0x3FF)<<10) | (v[1] & 0x3FF)) + 0x10000; +#endif + PyErr_SetString(PyExc_TypeError, + "need a single Unicode character as parameter"); + return (Py_UCS4)-1; +} + /* --- Module API --------------------------------------------------------- */ PyDoc_STRVAR(unicodedata_decimal__doc__, @@ -108,17 +120,16 @@ PyObject *defobj = NULL; int have_old = 0; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:decimal", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -131,7 +142,7 @@ } if (!have_old) - rc = Py_UNICODE_TODECIMAL(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODECIMAL(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, @@ -159,15 +170,14 @@ PyUnicodeObject *v; PyObject *defobj = NULL; long rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:digit", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); + c = getuchar(v); + if (c == (Py_UCS4)-1) return NULL; - } - rc = Py_UNICODE_TODIGIT(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TODIGIT(c); if (rc < 0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a digit"); @@ -195,17 +205,16 @@ PyObject *defobj = NULL; int have_old = 0; double rc; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!|O:numeric", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) { /* unassigned */ have_old = 1; @@ -218,7 +227,7 @@ } if (!have_old) - rc = Py_UNICODE_TONUMERIC(*PyUnicode_AS_UNICODE(v)); + rc = Py_UNICODE_TONUMERIC(c); if (rc == -1.0) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "not a numeric character"); @@ -243,22 +252,21 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:category", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->category; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->category; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed != 0xFF) index = old->category_changed; } - return PyString_FromString(_PyUnicode_CategoryNames[index]); + return PyBytes_FromString(_PyUnicode_CategoryNames[index]); } PyDoc_STRVAR(unicodedata_bidirectional__doc__, @@ -273,24 +281,23 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:bidirectional", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->bidirectional; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->bidirectional; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ else if (old->bidir_changed != 0xFF) index = old->bidir_changed; } - return PyString_FromString(_PyUnicode_BidirectionalNames[index]); + return PyBytes_FromString(_PyUnicode_BidirectionalNames[index]); } PyDoc_STRVAR(unicodedata_combining__doc__, @@ -305,18 +312,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:combining", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->combining; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->combining; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -335,18 +341,17 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:mirrored", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->mirrored; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->mirrored; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } @@ -364,22 +369,21 @@ { PyUnicodeObject *v; int index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:east_asian_width", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } - index = (int) _getrecord(v)->east_asian_width; + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; + index = (int) _getrecord_ex(c)->east_asian_width; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyString_FromString(_PyUnicode_EastAsianWidthNames[index]); + return PyBytes_FromString(_PyUnicode_EastAsianWidthNames[index]); } PyDoc_STRVAR(unicodedata_decomposition__doc__, @@ -396,22 +400,21 @@ char decomp[256]; int code, index, count, i; unsigned int prefix_index; + Py_UCS4 c; if (!PyArg_ParseTuple(args, "O!:decomposition", &PyUnicode_Type, &v)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - code = (int) *PyUnicode_AS_UNICODE(v); + code = (int)c; if (self) { - const change_record *old = get_old_record(self, *PyUnicode_AS_UNICODE(v)); + const change_record *old = get_old_record(self, c); if (old->category_changed == 0) - return PyString_FromString(""); /* unassigned */ + return PyBytes_FromString(""); /* unassigned */ } if (code < 0 || code >= 0x110000) @@ -450,7 +453,7 @@ decomp[i] = '\0'; - return PyString_FromString(decomp); + return PyBytes_FromString(decomp); } static void @@ -515,7 +518,7 @@ /* Hangul Decomposition adds three characters in a single step, so we need atleast that much room. */ if (space < 3) { - Py_ssize_t newsize = PyString_GET_SIZE(result) + 10; + Py_ssize_t newsize = PyBytes_GET_SIZE(result) + 10; space += 10; if (PyUnicode_Resize(&result, newsize) == -1) return NULL; @@ -1039,20 +1042,18 @@ unicodedata_name(PyObject* self, PyObject* args) { char name[NAME_MAXLEN]; + Py_UCS4 c; PyUnicodeObject* v; PyObject* defobj = NULL; if (!PyArg_ParseTuple(args, "O!|O:name", &PyUnicode_Type, &v, &defobj)) return NULL; - if (PyUnicode_GET_SIZE(v) != 1) { - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return NULL; - } + c = getuchar(v); + if (c == (Py_UCS4)-1) + return NULL; - if (!_getucname(self, (Py_UCS4) *PyUnicode_AS_UNICODE(v), - name, sizeof(name))) { + if (!_getucname(self, c, name, sizeof(name))) { if (defobj == NULL) { PyErr_SetString(PyExc_ValueError, "no such name"); return NULL; Modified: python/branches/okkoto-sizeof/Modules/zipimport.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/zipimport.c (original) +++ python/branches/okkoto-sizeof/Modules/zipimport.c Wed Jun 4 11:24:23 2008 @@ -154,11 +154,11 @@ } } - self->archive = PyString_FromString(buf); + self->archive = PyBytes_FromString(buf); if (self->archive == NULL) return -1; - self->prefix = PyString_FromString(prefix); + self->prefix = PyBytes_FromString(prefix); if (self->prefix == NULL) return -1; @@ -191,10 +191,10 @@ char *archive = "???"; char *prefix = ""; - if (self->archive != NULL && PyString_Check(self->archive)) - archive = PyString_AsString(self->archive); - if (self->prefix != NULL && PyString_Check(self->prefix)) - prefix = PyString_AsString(self->prefix); + if (self->archive != NULL && PyBytes_Check(self->archive)) + archive = PyBytes_AsString(self->archive); + if (self->prefix != NULL && PyBytes_Check(self->prefix)) + prefix = PyBytes_AsString(self->prefix); if (prefix != NULL && *prefix) PyOS_snprintf(buf, sizeof(buf), "", @@ -203,7 +203,7 @@ PyOS_snprintf(buf, sizeof(buf), "", archive); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } /* return fullname.split(".")[-1] */ @@ -263,7 +263,7 @@ subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return MI_ERROR; @@ -336,12 +336,12 @@ /* add __path__ to the module *before* the code gets executed */ PyObject *pkgpath, *fullpath; - char *prefix = PyString_AsString(self->prefix); + char *prefix = PyBytes_AsString(self->prefix); char *subname = get_subname(fullname); int err; - fullpath = PyString_FromFormat("%s%c%s%s", - PyString_AsString(self->archive), + fullpath = PyBytes_FromFormat("%s%c%s%s", + PyBytes_AsString(self->archive), SEP, *prefix ? prefix : "", subname); @@ -418,9 +418,9 @@ } path = buf; #endif - len = PyString_Size(self->archive); + len = PyBytes_Size(self->archive); if ((size_t)len < strlen(path) && - strncmp(path, PyString_AsString(self->archive), len) == 0 && + strncmp(path, PyBytes_AsString(self->archive), len) == 0 && path[len] == SEP) { path = path + len + 1; } @@ -430,7 +430,7 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); return NULL; } - return get_data(PyString_AsString(self->archive), toc_entry); + return get_data(PyBytes_AsString(self->archive), toc_entry); } static PyObject * @@ -467,7 +467,7 @@ } subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -480,7 +480,7 @@ toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) - return get_data(PyString_AsString(self->archive), toc_entry); + return get_data(PyBytes_AsString(self->archive), toc_entry); /* we have the module, but no source */ Py_INCREF(Py_None); @@ -843,13 +843,13 @@ PyMarshal_ReadShortFromFile(fp); /* local header size */ file_offset += l; /* Start of file data */ - raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ? + raw_data = PyBytes_FromStringAndSize((char *)NULL, compress == 0 ? data_size : data_size + 1); if (raw_data == NULL) { fclose(fp); return NULL; } - buf = PyString_AsString(raw_data); + buf = PyBytes_AsString(raw_data); err = fseek(fp, file_offset, 0); if (err == 0) @@ -907,8 +907,8 @@ unmarshal_code(char *pathname, PyObject *data, time_t mtime) { PyObject *code; - char *buf = PyString_AsString(data); - Py_ssize_t size = PyString_Size(data); + char *buf = PyBytes_AsString(data); + Py_ssize_t size = PyBytes_Size(data); if (size <= 9) { PyErr_SetString(ZipImportError, @@ -953,14 +953,14 @@ static PyObject * normalize_line_endings(PyObject *source) { - char *buf, *q, *p = PyString_AsString(source); + char *buf, *q, *p = PyBytes_AsString(source); PyObject *fixed_source; if (!p) return NULL; /* one char extra for trailing \n and one for terminating \0 */ - buf = (char *)PyMem_Malloc(PyString_Size(source) + 2); + buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2); if (buf == NULL) { PyErr_SetString(PyExc_MemoryError, "zipimport: no memory to allocate " @@ -979,7 +979,7 @@ } *q++ = '\n'; /* add trailing \n */ *q = '\0'; - fixed_source = PyString_FromString(buf); + fixed_source = PyBytes_FromString(buf); PyMem_Free(buf); return fixed_source; } @@ -995,7 +995,7 @@ if (fixed_source == NULL) return NULL; - code = Py_CompileString(PyString_AsString(fixed_source), pathname, + code = Py_CompileString(PyBytes_AsString(fixed_source), pathname, Py_file_input); Py_DECREF(fixed_source); return code; @@ -1054,7 +1054,7 @@ { PyObject *data, *code; char *modpath; - char *archive = PyString_AsString(self->archive); + char *archive = PyBytes_AsString(self->archive); if (archive == NULL) return NULL; @@ -1063,7 +1063,7 @@ if (data == NULL) return NULL; - modpath = PyString_AsString(PyTuple_GetItem(toc_entry, 0)); + modpath = PyBytes_AsString(PyTuple_GetItem(toc_entry, 0)); if (isbytecode) { code = unmarshal_code(modpath, data, mtime); @@ -1088,7 +1088,7 @@ subname = get_subname(fullname); - len = make_filename(PyString_AsString(self->prefix), subname, path); + len = make_filename(PyBytes_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -1098,7 +1098,7 @@ strcpy(path + len, zso->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s%c%s\n", - PyString_AsString(self->archive), + PyBytes_AsString(self->archive), SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { @@ -1120,7 +1120,7 @@ continue; } if (code != NULL && p_modpath != NULL) - *p_modpath = PyString_AsString( + *p_modpath = PyBytes_AsString( PyTuple_GetItem(toc_entry, 0)); return code; } Modified: python/branches/okkoto-sizeof/Modules/zlibmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Modules/zlibmodule.c (original) +++ python/branches/okkoto-sizeof/Modules/zlibmodule.c Wed Jun 4 11:24:23 2008 @@ -96,12 +96,12 @@ if (self == NULL) return NULL; self->is_initialised = 0; - self->unused_data = PyString_FromString(""); + self->unused_data = PyBytes_FromString(""); if (self->unused_data == NULL) { Py_DECREF(self); return NULL; } - self->unconsumed_tail = PyString_FromString(""); + self->unconsumed_tail = PyBytes_FromString(""); if (self->unconsumed_tail == NULL) { Py_DECREF(self); return NULL; @@ -174,7 +174,7 @@ err=deflateEnd(&zst); if (err == Z_OK) - ReturnVal = PyString_FromStringAndSize((char *)output, + ReturnVal = PyBytes_FromStringAndSize((char *)output, zst.total_out); else zlib_error(zst, err, "while finishing compression"); @@ -211,12 +211,12 @@ zst.avail_in = length; zst.avail_out = r_strlen; - if (!(result_str = PyString_FromStringAndSize(NULL, r_strlen))) + if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen))) return NULL; zst.zalloc = (alloc_func)NULL; zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)PyString_AS_STRING(result_str); + zst.next_out = (Byte *)PyBytes_AS_STRING(result_str); zst.next_in = (Byte *)input; err = inflateInit2(&zst, wsize); @@ -256,11 +256,11 @@ /* fall through */ case(Z_OK): /* need more memory */ - if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { + if (_PyBytes_Resize(&result_str, r_strlen << 1) < 0) { inflateEnd(&zst); goto error; } - zst.next_out = (unsigned char *)PyString_AS_STRING(result_str) \ + zst.next_out = (unsigned char *)PyBytes_AS_STRING(result_str) \ + r_strlen; zst.avail_out = r_strlen; r_strlen = r_strlen << 1; @@ -278,7 +278,7 @@ goto error; } - _PyString_Resize(&result_str, zst.total_out); + _PyBytes_Resize(&result_str, zst.total_out); return result_str; error: @@ -400,7 +400,7 @@ if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) return NULL; - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -409,7 +409,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), Z_NO_FLUSH); @@ -418,9 +418,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) + if (_PyBytes_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -440,7 +440,7 @@ RetVal = NULL; goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -479,7 +479,7 @@ /* limit amount of data allocated to max_length */ if (max_length && length > max_length) length = max_length; - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -488,7 +488,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); @@ -510,9 +510,9 @@ if (max_length && length > max_length) length = max_length; - if (_PyString_Resize(&RetVal, length) < 0) + if (_PyBytes_Resize(&RetVal, length) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + old_length; self->zst.avail_out = length - old_length; @@ -525,7 +525,7 @@ of specified size. Return the unconsumed tail in an attribute.*/ if(max_length) { Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, + self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); if(!self->unconsumed_tail) { Py_DECREF(RetVal); @@ -542,7 +542,7 @@ */ if (err == Z_STREAM_END) { Py_XDECREF(self->unused_data); /* Free original empty string */ - self->unused_data = PyString_FromStringAndSize( + self->unused_data = PyBytes_FromStringAndSize( (char *)self->zst.next_in, self->zst.avail_in); if (self->unused_data == NULL) { Py_DECREF(RetVal); @@ -559,7 +559,7 @@ goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -589,10 +589,10 @@ /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in doing any work at all; just return an empty string. */ if (flushmode == Z_NO_FLUSH) { - return PyString_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); } - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) + if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -600,7 +600,7 @@ start_total_out = self->zst.total_out; self->zst.avail_in = 0; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), flushmode); @@ -609,9 +609,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) + if (_PyBytes_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -646,7 +646,7 @@ goto error; } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -778,7 +778,7 @@ PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); return NULL; } - if (!(retval = PyString_FromStringAndSize(NULL, length))) + if (!(retval = PyBytes_FromStringAndSize(NULL, length))) return NULL; @@ -786,7 +786,7 @@ start_total_out = self->zst.total_out; self->zst.avail_out = length; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval); + self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_FINISH); @@ -795,9 +795,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) { - if (_PyString_Resize(&retval, length << 1) < 0) + if (_PyBytes_Resize(&retval, length << 1) < 0) goto error; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval) + length; + self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval) + length; self->zst.avail_out = length; length = length << 1; @@ -819,7 +819,7 @@ goto error; } } - _PyString_Resize(&retval, self->zst.total_out - start_total_out); + _PyBytes_Resize(&retval, self->zst.total_out - start_total_out); error: @@ -1027,7 +1027,7 @@ PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); - ver = PyString_FromString(ZLIB_VERSION); + ver = PyBytes_FromString(ZLIB_VERSION); if (ver != NULL) PyModule_AddObject(m, "ZLIB_VERSION", ver); Modified: python/branches/okkoto-sizeof/Objects/abstract.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/abstract.c (original) +++ python/branches/okkoto-sizeof/Objects/abstract.c Wed Jun 4 11:24:23 2008 @@ -105,7 +105,7 @@ /* cache a hashed version of the attribute string */ if (hintstrobj == NULL) { - hintstrobj = PyString_InternFromString("__length_hint__"); + hintstrobj = PyBytes_InternFromString("__length_hint__"); if (hintstrobj == NULL) goto defaultcase; } @@ -227,7 +227,7 @@ null_error(); return -1; } - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return -1; ret = PyObject_DelItem(o, okey); @@ -729,21 +729,21 @@ /* Initialize cached value */ if (str__format__ == NULL) { /* Initialize static variable needed by _PyType_Lookup */ - str__format__ = PyString_InternFromString("__format__"); + str__format__ = PyBytes_InternFromString("__format__"); if (str__format__ == NULL) goto done; } /* If no format_spec is provided, use an empty string */ if (format_spec == NULL) { - empty = PyString_FromStringAndSize(NULL, 0); + empty = PyBytes_FromStringAndSize(NULL, 0); format_spec = empty; } /* Check the format_spec type, and make sure it's str or unicode */ if (PyUnicode_Check(format_spec)) spec_is_unicode = 1; - else if (PyString_Check(format_spec)) + else if (PyBytes_Check(format_spec)) spec_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -823,7 +823,7 @@ /* Check the result type, and make sure it's str or unicode */ if (PyUnicode_Check(result)) result_is_unicode = 1; - else if (PyString_Check(result)) + else if (PyBytes_Check(result)) result_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -1541,7 +1541,7 @@ const char *type_name; static PyObject *int_name = NULL; if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); + int_name = PyBytes_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1567,7 +1567,7 @@ non_integral_error: if (PyInstance_Check(integral)) { - type_name = PyString_AS_STRING(((PyInstanceObject *)integral) + type_name = PyBytes_AS_STRING(((PyInstanceObject *)integral) ->in_class->cl_name); } else { @@ -1589,7 +1589,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); + trunc_name = PyBytes_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1629,9 +1629,9 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyString_Check(o)) - return int_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); + if (PyBytes_Check(o)) + return int_from_string(PyBytes_AS_STRING(o), + PyBytes_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), @@ -1674,7 +1674,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); + trunc_name = PyBytes_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1716,13 +1716,13 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyString_Check(o)) + if (PyBytes_Check(o)) /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. */ - return long_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); + return long_from_string(PyBytes_AS_STRING(o), + PyBytes_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ @@ -2413,7 +2413,7 @@ if (key == NULL) return null_error(); - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return NULL; r = PyObject_GetItem(o, okey); @@ -2432,7 +2432,7 @@ return -1; } - okey = PyString_FromString(key); + okey = PyBytes_FromString(key); if (okey == NULL) return -1; r = PyObject_SetItem(o, okey, value); @@ -2760,7 +2760,7 @@ PyObject *bases; if (__bases__ == NULL) { - __bases__ = PyString_InternFromString("__bases__"); + __bases__ = PyBytes_InternFromString("__bases__"); if (__bases__ == NULL) return NULL; } @@ -2838,7 +2838,7 @@ int retval = 0; if (__class__ == NULL) { - __class__ = PyString_InternFromString("__class__"); + __class__ = PyBytes_InternFromString("__class__"); if (__class__ == NULL) return -1; } @@ -2914,7 +2914,7 @@ return 1; if (name == NULL) { - name = PyString_InternFromString("__instancecheck__"); + name = PyBytes_InternFromString("__instancecheck__"); if (name == NULL) return -1; } @@ -2998,7 +2998,7 @@ PyErr_Fetch(&t, &v, &tb); if (name == NULL) { - name = PyString_InternFromString("__subclasscheck__"); + name = PyBytes_InternFromString("__subclasscheck__"); if (name == NULL) return -1; } Modified: python/branches/okkoto-sizeof/Objects/boolobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/boolobject.c (original) +++ python/branches/okkoto-sizeof/Objects/boolobject.c Wed Jun 4 11:24:23 2008 @@ -25,10 +25,10 @@ if (self->ob_ival) s = true_str ? true_str : - (true_str = PyString_InternFromString("True")); + (true_str = PyBytes_InternFromString("True")); else s = false_str ? false_str : - (false_str = PyString_InternFromString("False")); + (false_str = PyBytes_InternFromString("False")); Py_XINCREF(s); return s; } Modified: python/branches/okkoto-sizeof/Objects/bufferobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/bufferobject.c (original) +++ python/branches/okkoto-sizeof/Objects/bufferobject.c Wed Jun 4 11:24:23 2008 @@ -287,13 +287,13 @@ const char *status = self->b_readonly ? "read-only" : "read-write"; if ( self->b_base == NULL ) - return PyString_FromFormat("<%s buffer ptr %p, size %zd at %p>", + return PyBytes_FromFormat("<%s buffer ptr %p, size %zd at %p>", status, self->b_ptr, self->b_size, self); else - return PyString_FromFormat( + return PyBytes_FromFormat( "<%s buffer for %p, size %zd, offset %zd at %p>", status, self->b_base, @@ -318,7 +318,7 @@ * underlying memory is immutable. b_readonly is a necessary but not * sufficient condition for a buffer to be hashable. Perhaps it would * be better to only allow hashing if the underlying object is known to - * be immutable (e.g. PyString_Check() is true). Another idea would + * be immutable (e.g. PyBytes_Check() is true). Another idea would * be to call tp_hash on the underlying object and see if it raises * an error. */ if ( !self->b_readonly ) @@ -349,7 +349,7 @@ Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - return PyString_FromStringAndSize((const char *)ptr, size); + return PyBytes_FromStringAndSize((const char *)ptr, size); } /* Sequence methods */ @@ -401,10 +401,10 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; - ob = PyString_FromStringAndSize(NULL, size + count); + ob = PyBytes_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; - p = PyString_AS_STRING(ob); + p = PyBytes_AS_STRING(ob); memcpy(p, ptr1, size); memcpy(p + size, ptr2, count); @@ -426,11 +426,11 @@ count = 0; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - ob = PyString_FromStringAndSize(NULL, size * count); + ob = PyBytes_FromStringAndSize(NULL, size * count); if ( ob == NULL ) return NULL; - p = PyString_AS_STRING(ob); + p = PyBytes_AS_STRING(ob); while ( count-- ) { memcpy(p, ptr, size); @@ -454,7 +454,7 @@ PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } - return PyString_FromStringAndSize((char *)ptr + idx, 1); + return PyBytes_FromStringAndSize((char *)ptr + idx, 1); } static PyObject * @@ -472,7 +472,7 @@ right = size; if ( right < left ) right = left; - return PyString_FromStringAndSize((char *)ptr + left, + return PyBytes_FromStringAndSize((char *)ptr + left, right - left); } @@ -501,9 +501,9 @@ } if (slicelength <= 0) - return PyString_FromStringAndSize("", 0); + return PyBytes_FromStringAndSize("", 0); else if (step == 1) - return PyString_FromStringAndSize((char *)p + start, + return PyBytes_FromStringAndSize((char *)p + start, stop - start); else { PyObject *result; @@ -518,7 +518,7 @@ result_buf[i] = source_buf[cur]; } - result = PyString_FromStringAndSize(result_buf, + result = PyBytes_FromStringAndSize(result_buf, slicelength); PyMem_Free(result_buf); return result; Modified: python/branches/okkoto-sizeof/Objects/bytes_methods.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/bytes_methods.c (original) +++ python/branches/okkoto-sizeof/Objects/bytes_methods.c Wed Jun 4 11:24:23 2008 @@ -462,11 +462,11 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyString_AS_STRING(newobj); + s = PyBytes_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -490,11 +490,11 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyString_AS_STRING(newobj); + s = PyBytes_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -520,10 +520,10 @@ int previous_is_cased = 0; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); @@ -553,10 +553,10 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); @@ -589,10 +589,10 @@ Py_ssize_t i; /* - newobj = PyString_FromStringAndSize(NULL, len); + newobj = PyBytes_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyString_AsString(newobj); + s_new = PyBytes_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); Modified: python/branches/okkoto-sizeof/Objects/cellobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/cellobject.c (original) +++ python/branches/okkoto-sizeof/Objects/cellobject.c Wed Jun 4 11:24:23 2008 @@ -73,9 +73,9 @@ cell_repr(PyCellObject *op) { if (op->ob_ref == NULL) - return PyString_FromFormat("", op); + return PyBytes_FromFormat("", op); - return PyString_FromFormat("", + return PyBytes_FromFormat("", op, op->ob_ref->ob_type->tp_name, op->ob_ref); } Modified: python/branches/okkoto-sizeof/Objects/classobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/classobject.c (original) +++ python/branches/okkoto-sizeof/Objects/classobject.c Wed Jun 4 11:24:23 2008 @@ -32,21 +32,21 @@ PyClassObject *op, *dummy; static PyObject *docstr, *modstr, *namestr; if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); + docstr= PyBytes_InternFromString("__doc__"); if (docstr == NULL) return NULL; } if (modstr == NULL) { - modstr= PyString_InternFromString("__module__"); + modstr= PyBytes_InternFromString("__module__"); if (modstr == NULL) return NULL; } if (namestr == NULL) { - namestr= PyString_InternFromString("__name__"); + namestr= PyBytes_InternFromString("__name__"); if (namestr == NULL) return NULL; } - if (name == NULL || !PyString_Check(name)) { + if (name == NULL || !PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "PyClass_New: name must be a string"); return NULL; @@ -101,13 +101,13 @@ } if (getattrstr == NULL) { - getattrstr = PyString_InternFromString("__getattr__"); + getattrstr = PyBytes_InternFromString("__getattr__"); if (getattrstr == NULL) goto alloc_error; - setattrstr = PyString_InternFromString("__setattr__"); + setattrstr = PyBytes_InternFromString("__setattr__"); if (setattrstr == NULL) goto alloc_error; - delattrstr = PyString_InternFromString("__delattr__"); + delattrstr = PyBytes_InternFromString("__delattr__"); if (delattrstr == NULL) goto alloc_error; } @@ -222,7 +222,7 @@ class_getattr(register PyClassObject *op, PyObject *name) { register PyObject *v; - register char *sname = PyString_AsString(name); + register char *sname = PyBytes_AsString(name); PyClassObject *klass; descrgetfunc f; @@ -253,7 +253,7 @@ if (v == NULL) { PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); + PyBytes_AS_STRING(op->cl_name), sname); return NULL; } f = TP_DESCR_GET(v->ob_type); @@ -316,9 +316,9 @@ static char * set_name(PyClassObject *c, PyObject *v) { - if (v == NULL || !PyString_Check(v)) + if (v == NULL || !PyBytes_Check(v)) return "__name__ must be a string object"; - if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v)) + if (strlen(PyBytes_AS_STRING(v)) != (size_t)PyBytes_GET_SIZE(v)) return "__name__ must not contain null bytes"; set_slot(&c->cl_name, v); return ""; @@ -333,9 +333,9 @@ "classes are read-only in restricted mode"); return -1; } - sname = PyString_AsString(name); + sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); + Py_ssize_t n = PyBytes_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { char *err = NULL; if (strcmp(sname, "__dict__") == 0) @@ -365,7 +365,7 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); + PyBytes_AS_STRING(op->cl_name), sname); return rv; } else @@ -377,15 +377,15 @@ { PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); char *name; - if (op->cl_name == NULL || !PyString_Check(op->cl_name)) + if (op->cl_name == NULL || !PyBytes_Check(op->cl_name)) name = "?"; else - name = PyString_AsString(op->cl_name); - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", name, op); + name = PyBytes_AsString(op->cl_name); + if (mod == NULL || !PyBytes_Check(mod)) + return PyBytes_FromFormat("", name, op); else - return PyString_FromFormat("", - PyString_AsString(mod), + return PyBytes_FromFormat("", + PyBytes_AsString(mod), name, op); } @@ -397,21 +397,21 @@ PyObject *res; Py_ssize_t m, n; - if (name == NULL || !PyString_Check(name)) + if (name == NULL || !PyBytes_Check(name)) return class_repr(op); - if (mod == NULL || !PyString_Check(mod)) { + if (mod == NULL || !PyBytes_Check(mod)) { Py_INCREF(name); return name; } - m = PyString_GET_SIZE(mod); - n = PyString_GET_SIZE(name); - res = PyString_FromStringAndSize((char *)NULL, m+1+n); + m = PyBytes_GET_SIZE(mod); + n = PyBytes_GET_SIZE(name); + res = PyBytes_FromStringAndSize((char *)NULL, m+1+n); if (res != NULL) { - char *s = PyString_AS_STRING(res); - memcpy(s, PyString_AS_STRING(mod), m); + char *s = PyBytes_AS_STRING(res); + memcpy(s, PyBytes_AS_STRING(mod), m); s += m; *s++ = '.'; - memcpy(s, PyString_AS_STRING(name), n); + memcpy(s, PyBytes_AS_STRING(name), n); } return res; } @@ -541,7 +541,7 @@ static PyObject *initstr; if (initstr == NULL) { - initstr = PyString_InternFromString("__init__"); + initstr = PyBytes_InternFromString("__init__"); if (initstr == NULL) return NULL; } @@ -634,7 +634,7 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); + delstr = PyBytes_InternFromString("__del__"); if (delstr == NULL) PyErr_WriteUnraisable((PyObject*)inst); } @@ -696,7 +696,7 @@ instance_getattr1(register PyInstanceObject *inst, PyObject *name) { register PyObject *v; - register char *sname = PyString_AsString(name); + register char *sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -716,7 +716,7 @@ if (v == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), sname); + PyBytes_AS_STRING(inst->in_class->cl_name), sname); } return v; } @@ -779,7 +779,7 @@ assert(PyInstance_Check(pinst)); inst = (PyInstanceObject *)pinst; - assert(PyString_Check(name)); + assert(PyBytes_Check(name)); v = PyDict_GetItem(inst->in_dict, name); if (v == NULL) @@ -795,8 +795,8 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), - PyString_AS_STRING(name)); + PyBytes_AS_STRING(inst->in_class->cl_name), + PyBytes_AS_STRING(name)); return rv; } else @@ -807,9 +807,9 @@ instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v) { PyObject *func, *args, *res, *tmp; - char *sname = PyString_AsString(name); + char *sname = PyBytes_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); + Py_ssize_t n = PyBytes_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -875,7 +875,7 @@ static PyObject *reprstr; if (reprstr == NULL) { - reprstr = PyString_InternFromString("__repr__"); + reprstr = PyBytes_InternFromString("__repr__"); if (reprstr == NULL) return NULL; } @@ -889,16 +889,16 @@ classname = inst->in_class->cl_name; mod = PyDict_GetItemString(inst->in_class->cl_dict, "__module__"); - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); + if (classname != NULL && PyBytes_Check(classname)) + cname = PyBytes_AsString(classname); else cname = "?"; - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", + if (mod == NULL || !PyBytes_Check(mod)) + return PyBytes_FromFormat("", cname, inst); else - return PyString_FromFormat("<%s.%s instance at %p>", - PyString_AsString(mod), + return PyBytes_FromFormat("<%s.%s instance at %p>", + PyBytes_AsString(mod), cname, inst); } res = PyEval_CallObject(func, (PyObject *)NULL); @@ -914,7 +914,7 @@ static PyObject *strstr; if (strstr == NULL) { - strstr = PyString_InternFromString("__str__"); + strstr = PyBytes_InternFromString("__str__"); if (strstr == NULL) return NULL; } @@ -939,7 +939,7 @@ static PyObject *hashstr, *eqstr, *cmpstr; if (hashstr == NULL) { - hashstr = PyString_InternFromString("__hash__"); + hashstr = PyBytes_InternFromString("__hash__"); if (hashstr == NULL) return -1; } @@ -952,7 +952,7 @@ address. If an __eq__ or __cmp__ method exists, there must be a __hash__. */ if (eqstr == NULL) { - eqstr = PyString_InternFromString("__eq__"); + eqstr = PyBytes_InternFromString("__eq__"); if (eqstr == NULL) return -1; } @@ -962,7 +962,7 @@ return -1; PyErr_Clear(); if (cmpstr == NULL) { - cmpstr = PyString_InternFromString("__cmp__"); + cmpstr = PyBytes_InternFromString("__cmp__"); if (cmpstr == NULL) return -1; } @@ -1014,7 +1014,7 @@ Py_ssize_t outcome; if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); + lenstr = PyBytes_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1063,7 +1063,7 @@ PyObject *res; if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1090,7 +1090,7 @@ if (value == NULL) { if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); + delitemstr = PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1098,7 +1098,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); + setitemstr = PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1135,7 +1135,7 @@ PyObject *func, *res; if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1154,7 +1154,7 @@ static PyObject *getslicestr; if (getslicestr == NULL) { - getslicestr = PyString_InternFromString("__getslice__"); + getslicestr = PyBytes_InternFromString("__getslice__"); if (getslicestr == NULL) return NULL; } @@ -1166,7 +1166,7 @@ PyErr_Clear(); if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1194,7 +1194,7 @@ if (item == NULL) { if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); + delitemstr = PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1202,7 +1202,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); + setitemstr = PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1236,7 +1236,7 @@ if (value == NULL) { if (delslicestr == NULL) { delslicestr = - PyString_InternFromString("__delslice__"); + PyBytes_InternFromString("__delslice__"); if (delslicestr == NULL) return -1; } @@ -1247,7 +1247,7 @@ PyErr_Clear(); if (delitemstr == NULL) { delitemstr = - PyString_InternFromString("__delitem__"); + PyBytes_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1263,7 +1263,7 @@ else { if (setslicestr == NULL) { setslicestr = - PyString_InternFromString("__setslice__"); + PyBytes_InternFromString("__setslice__"); if (setslicestr == NULL) return -1; } @@ -1274,7 +1274,7 @@ PyErr_Clear(); if (setitemstr == NULL) { setitemstr = - PyString_InternFromString("__setitem__"); + PyBytes_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1311,7 +1311,7 @@ */ if(__contains__ == NULL) { - __contains__ = PyString_InternFromString("__contains__"); + __contains__ = PyBytes_InternFromString("__contains__"); if(__contains__ == NULL) return -1; } @@ -1417,7 +1417,7 @@ } if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); + coerce_obj = PyBytes_InternFromString("__coerce__"); if (coerce_obj == NULL) return NULL; } @@ -1504,7 +1504,7 @@ PyObject *coerced; if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); + coerce_obj = PyBytes_InternFromString("__coerce__"); if (coerce_obj == NULL) return -1; } @@ -1552,7 +1552,7 @@ #define UNARY(funcname, methodname) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) { o = PyBytes_InternFromString(methodname); \ if (o == NULL) return NULL; } \ return generic_unary_op(self, o); \ } @@ -1561,7 +1561,7 @@ #define UNARY_FB(funcname, methodname, funcname_fb) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ + if (o == NULL) { o = PyBytes_InternFromString(methodname); \ if (o == NULL) return NULL; } \ if (PyObject_HasAttr((PyObject*)self, o)) \ return generic_unary_op(self, o); \ @@ -1630,7 +1630,7 @@ assert(PyInstance_Check(v)); if (cmp_obj == NULL) { - cmp_obj = PyString_InternFromString("__cmp__"); + cmp_obj = PyBytes_InternFromString("__cmp__"); if (cmp_obj == NULL) return -2; } @@ -1738,7 +1738,7 @@ static PyObject *nonzerostr; if (nonzerostr == NULL) { - nonzerostr = PyString_InternFromString("__nonzero__"); + nonzerostr = PyBytes_InternFromString("__nonzero__"); if (nonzerostr == NULL) return -1; } @@ -1747,7 +1747,7 @@ return -1; PyErr_Clear(); if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); + lenstr = PyBytes_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1787,7 +1787,7 @@ static PyObject *indexstr = NULL; if (indexstr == NULL) { - indexstr = PyString_InternFromString("__index__"); + indexstr = PyBytes_InternFromString("__index__"); if (indexstr == NULL) return NULL; } @@ -1814,7 +1814,7 @@ PyObject *truncated; static PyObject *int_name; if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); + int_name = PyBytes_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1929,7 +1929,7 @@ if (name_op == NULL) return -1; for (i = 0; i < NAME_OPS; ++i) { - name_op[i] = PyString_InternFromString(_name_op[i]); + name_op[i] = PyBytes_InternFromString(_name_op[i]); if (name_op[i] == NULL) return -1; } @@ -2012,12 +2012,12 @@ PyObject *func; if (iterstr == NULL) { - iterstr = PyString_InternFromString("__iter__"); + iterstr = PyBytes_InternFromString("__iter__"); if (iterstr == NULL) return NULL; } if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); + getitemstr = PyBytes_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -2055,7 +2055,7 @@ PyObject *func; if (nextstr == NULL) { - nextstr = PyString_InternFromString("next"); + nextstr = PyBytes_InternFromString("next"); if (nextstr == NULL) return NULL; } @@ -2087,7 +2087,7 @@ PyErr_Clear(); PyErr_Format(PyExc_AttributeError, "%.200s instance has no __call__ method", - PyString_AsString(inst->in_class->cl_name)); + PyBytes_AsString(inst->in_class->cl_name)); return NULL; } /* We must check and increment the recursion depth here. Scenario: @@ -2261,7 +2261,7 @@ { static PyObject *docstr; if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); + docstr= PyBytes_InternFromString("__doc__"); if (docstr == NULL) return NULL; } @@ -2384,12 +2384,12 @@ return NULL; PyErr_Clear(); } - else if (!PyString_Check(funcname)) { + else if (!PyBytes_Check(funcname)) { Py_DECREF(funcname); funcname = NULL; } else - sfuncname = PyString_AS_STRING(funcname); + sfuncname = PyBytes_AS_STRING(funcname); if (klass == NULL) klassname = NULL; else { @@ -2399,28 +2399,28 @@ return NULL; PyErr_Clear(); } - else if (!PyString_Check(klassname)) { + else if (!PyBytes_Check(klassname)) { Py_DECREF(klassname); klassname = NULL; } else - sklassname = PyString_AS_STRING(klassname); + sklassname = PyBytes_AS_STRING(klassname); } if (self == NULL) - result = PyString_FromFormat("", + result = PyBytes_FromFormat("", sklassname, sfuncname); else { /* XXX Shouldn't use repr() here! */ PyObject *selfrepr = PyObject_Repr(self); if (selfrepr == NULL) goto fail; - if (!PyString_Check(selfrepr)) { + if (!PyBytes_Check(selfrepr)) { Py_DECREF(selfrepr); goto fail; } - result = PyString_FromFormat("", + result = PyBytes_FromFormat("", sklassname, sfuncname, - PyString_AS_STRING(selfrepr)); + PyBytes_AS_STRING(selfrepr)); Py_DECREF(selfrepr); } fail: @@ -2472,8 +2472,8 @@ PyErr_Clear(); return; } - if (PyString_Check(name)) { - strncpy(buf, PyString_AS_STRING(name), bufsize); + if (PyBytes_Check(name)) { + strncpy(buf, PyBytes_AS_STRING(name), bufsize); buf[bufsize-1] = '\0'; } Py_DECREF(name); Modified: python/branches/okkoto-sizeof/Objects/codeobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/codeobject.c (original) +++ python/branches/okkoto-sizeof/Objects/codeobject.c Wed Jun 4 11:24:23 2008 @@ -32,10 +32,10 @@ for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); - if (v == NULL || !PyString_CheckExact(v)) { + if (v == NULL || !PyBytes_CheckExact(v)) { Py_FatalError("non-string found in code slot"); } - PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); + PyBytes_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); } } @@ -57,9 +57,9 @@ varnames == NULL || !PyTuple_Check(varnames) || freevars == NULL || !PyTuple_Check(freevars) || cellvars == NULL || !PyTuple_Check(cellvars) || - name == NULL || !PyString_Check(name) || - filename == NULL || !PyString_Check(filename) || - lnotab == NULL || !PyString_Check(lnotab) || + name == NULL || !PyBytes_Check(name) || + filename == NULL || !PyBytes_Check(filename) || + lnotab == NULL || !PyBytes_Check(lnotab) || !PyObject_CheckReadBuffer(code)) { PyErr_BadInternalCall(); return NULL; @@ -71,11 +71,11 @@ /* Intern selected string constants */ for (i = PyTuple_Size(consts); --i >= 0; ) { PyObject *v = PyTuple_GetItem(consts, i); - if (!PyString_Check(v)) + if (!PyBytes_Check(v)) continue; - if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) + if (!all_name_chars((unsigned char *)PyBytes_AS_STRING(v))) continue; - PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); + PyBytes_InternInPlace(&PyTuple_GET_ITEM(consts, i)); } co = PyObject_NEW(PyCodeObject, &PyCode_Type); if (co != NULL) { @@ -145,10 +145,10 @@ for (i = 0; i < len; i++) { item = PyTuple_GET_ITEM(tup, i); - if (PyString_CheckExact(item)) { + if (PyBytes_CheckExact(item)) { Py_INCREF(item); } - else if (!PyString_Check(item)) { + else if (!PyBytes_Check(item)) { PyErr_Format( PyExc_TypeError, "name tuples must contain only " @@ -158,9 +158,9 @@ return NULL; } else { - item = PyString_FromStringAndSize( - PyString_AS_STRING(item), - PyString_GET_SIZE(item)); + item = PyBytes_FromStringAndSize( + PyBytes_AS_STRING(item), + PyBytes_GET_SIZE(item)); if (item == NULL) { Py_DECREF(newtuple); return NULL; @@ -281,14 +281,14 @@ if (co->co_firstlineno != 0) lineno = co->co_firstlineno; - if (co->co_filename && PyString_Check(co->co_filename)) - filename = PyString_AS_STRING(co->co_filename); - if (co->co_name && PyString_Check(co->co_name)) - name = PyString_AS_STRING(co->co_name); + if (co->co_filename && PyBytes_Check(co->co_filename)) + filename = PyBytes_AS_STRING(co->co_filename); + if (co->co_name && PyBytes_Check(co->co_name)) + name = PyBytes_AS_STRING(co->co_name); PyOS_snprintf(buf, sizeof(buf), "", name, co, filename, lineno); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static int @@ -508,8 +508,8 @@ int PyCode_Addr2Line(PyCodeObject *co, int addrq) { - int size = PyString_Size(co->co_lnotab) / 2; - unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); + int size = PyBytes_Size(co->co_lnotab) / 2; + unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab); int line = co->co_firstlineno; int addr = 0; while (--size >= 0) { @@ -604,8 +604,8 @@ int size, addr, line; unsigned char* p; - p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); - size = PyString_GET_SIZE(co->co_lnotab) / 2; + p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab); + size = PyBytes_GET_SIZE(co->co_lnotab) / 2; addr = 0; line = co->co_firstlineno; Modified: python/branches/okkoto-sizeof/Objects/complexobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/complexobject.c (original) +++ python/branches/okkoto-sizeof/Objects/complexobject.c Wed Jun 4 11:24:23 2008 @@ -303,7 +303,7 @@ cv.imag = 0.; if (complex_str == NULL) { - if (!(complex_str = PyString_InternFromString("__complex__"))) + if (!(complex_str = PyBytes_InternFromString("__complex__"))) return cv; } @@ -421,7 +421,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_REPR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -429,7 +429,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_STR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static long @@ -876,9 +876,9 @@ #endif Py_ssize_t len; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + s = PyBytes_AS_STRING(v); + len = PyBytes_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -1064,7 +1064,7 @@ Py_INCREF(r); return r; } - if (PyString_Check(r) || PyUnicode_Check(r)) { + if (PyBytes_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -1073,7 +1073,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL; @@ -1081,7 +1081,7 @@ /* XXX Hack to support classes with __complex__ method */ if (complexstr == NULL) { - complexstr = PyString_InternFromString("__complex__"); + complexstr = PyBytes_InternFromString("__complex__"); if (complexstr == NULL) return NULL; } Modified: python/branches/okkoto-sizeof/Objects/descrobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/descrobject.c (original) +++ python/branches/okkoto-sizeof/Objects/descrobject.c Wed Jun 4 11:24:23 2008 @@ -15,8 +15,8 @@ static char * descr_name(PyDescrObject *descr) { - if (descr->d_name != NULL && PyString_Check(descr->d_name)) - return PyString_AS_STRING(descr->d_name); + if (descr->d_name != NULL && PyBytes_Check(descr->d_name)) + return PyBytes_AS_STRING(descr->d_name); else return "?"; } @@ -24,7 +24,7 @@ static PyObject * descr_repr(PyDescrObject *descr, char *format) { - return PyString_FromFormat(format, descr_name(descr), + return PyBytes_FromFormat(format, descr_name(descr), descr->d_type->tp_name); } @@ -314,7 +314,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_method->ml_doc); + return PyBytes_FromString(descr->d_method->ml_doc); } static PyMemberDef descr_members[] = { @@ -335,7 +335,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_member->doc); + return PyBytes_FromString(descr->d_member->doc); } static PyGetSetDef member_getset[] = { @@ -350,7 +350,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_getset->doc); + return PyBytes_FromString(descr->d_getset->doc); } static PyGetSetDef getset_getset[] = { @@ -365,7 +365,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromString(descr->d_base->doc); + return PyBytes_FromString(descr->d_base->doc); } static PyGetSetDef wrapperdescr_getset[] = { @@ -576,7 +576,7 @@ if (descr != NULL) { Py_XINCREF(type); descr->d_type = type; - descr->d_name = PyString_InternFromString(name); + descr->d_name = PyBytes_InternFromString(name); if (descr->d_name == NULL) { Py_DECREF(descr); descr = NULL; @@ -922,7 +922,7 @@ static PyObject * wrapper_repr(wrapperobject *wp) { - return PyString_FromFormat("", + return PyBytes_FromFormat("", wp->descr->d_base->name, wp->self->ob_type->tp_name, wp->self); @@ -947,7 +947,7 @@ { char *s = wp->descr->d_base->name; - return PyString_FromString(s); + return PyBytes_FromString(s); } static PyObject * @@ -960,7 +960,7 @@ return Py_None; } else { - return PyString_FromString(s); + return PyBytes_FromString(s); } } Modified: python/branches/okkoto-sizeof/Objects/dictobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/dictobject.c (original) +++ python/branches/okkoto-sizeof/Objects/dictobject.c Wed Jun 4 11:24:23 2008 @@ -224,7 +224,7 @@ { register PyDictObject *mp; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyString_FromString(""); + dummy = PyBytes_FromString(""); if (dummy == NULL) return NULL; #ifdef SHOW_CONVERSION_COUNTS @@ -373,7 +373,7 @@ * this assumption allows testing for errors during PyObject_RichCompareBool() * to be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_RichCompareBool(); we can always - * use _PyString_Eq() directly. + * use _PyBytes_Eq() directly. * * This is valuable because dicts with only string keys are very common. */ @@ -391,7 +391,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyString_CheckExact(key)) { + if (!PyBytes_CheckExact(key)) { #ifdef SHOW_CONVERSION_COUNTS ++converted; #endif @@ -405,7 +405,7 @@ if (ep->me_key == dummy) freeslot = ep; else { - if (ep->me_hash == hash && _PyString_Eq(ep->me_key, key)) + if (ep->me_hash == hash && _PyBytes_Eq(ep->me_key, key)) return ep; freeslot = NULL; } @@ -420,7 +420,7 @@ if (ep->me_key == key || (ep->me_hash == hash && ep->me_key != dummy - && _PyString_Eq(ep->me_key, key))) + && _PyBytes_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; @@ -626,8 +626,8 @@ PyThreadState *tstate; if (!PyDict_Check(op)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) { @@ -680,8 +680,8 @@ assert(key); assert(value); mp = (PyDictObject *)op; - if (PyString_CheckExact(key)) { - hash = ((PyStringObject *)key)->ob_shash; + if (PyBytes_CheckExact(key)) { + hash = ((PyBytesObject *)key)->ob_shash; if (hash == -1) hash = PyObject_Hash(key); } @@ -728,8 +728,8 @@ return -1; } assert(key); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -982,11 +982,11 @@ i = Py_ReprEnter((PyObject *)mp); if (i != 0) { - return i > 0 ? PyString_FromString("{...}") : NULL; + return i > 0 ? PyBytes_FromString("{...}") : NULL; } if (mp->ma_used == 0) { - result = PyString_FromString("{}"); + result = PyBytes_FromString("{}"); goto Done; } @@ -994,7 +994,7 @@ if (pieces == NULL) goto Done; - colon = PyString_FromString(": "); + colon = PyBytes_FromString(": "); if (colon == NULL) goto Done; @@ -1006,8 +1006,8 @@ /* Prevent repr from deleting value during key format. */ Py_INCREF(value); s = PyObject_Repr(key); - PyString_Concat(&s, colon); - PyString_ConcatAndDel(&s, PyObject_Repr(value)); + PyBytes_Concat(&s, colon); + PyBytes_ConcatAndDel(&s, PyObject_Repr(value)); Py_DECREF(value); if (s == NULL) goto Done; @@ -1019,29 +1019,29 @@ /* Add "{}" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("{"); + s = PyBytes_FromString("{"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString("}"); + s = PyBytes_FromString("}"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: @@ -1064,8 +1064,8 @@ long hash; PyDictEntry *ep; assert(mp->ma_table != NULL); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1081,7 +1081,7 @@ static PyObject *missing_str = NULL; if (missing_str == NULL) missing_str = - PyString_InternFromString("__missing__"); + PyBytes_InternFromString("__missing__"); missing = _PyType_Lookup(Py_TYPE(mp), missing_str); if (missing != NULL) return PyObject_CallFunctionObjArgs(missing, @@ -1794,8 +1794,8 @@ long hash; PyDictEntry *ep; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1827,8 +1827,8 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1856,8 +1856,8 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1902,8 +1902,8 @@ "pop(): dictionary is empty"); return NULL; } - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -2052,7 +2052,7 @@ PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); PyDoc_STRVAR(sizeof__doc__, -"D.__sizeof__() -> size of D in bytes"); +"D.__sizeof__() -> size of D in memory, in bytes"); PyDoc_STRVAR(get__doc__, "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); @@ -2148,8 +2148,8 @@ PyDictObject *mp = (PyDictObject *)op; PyDictEntry *ep; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -2275,7 +2275,7 @@ PyDict_GetItemString(PyObject *v, const char *key) { PyObject *kv, *rv; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return NULL; rv = PyDict_GetItem(v, kv); @@ -2288,10 +2288,10 @@ { PyObject *kv; int err; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return -1; - PyString_InternInPlace(&kv); /* XXX Should we really? */ + PyBytes_InternInPlace(&kv); /* XXX Should we really? */ err = PyDict_SetItem(v, kv, item); Py_DECREF(kv); return err; @@ -2302,7 +2302,7 @@ { PyObject *kv; int err; - kv = PyString_FromString(key); + kv = PyBytes_FromString(key); if (kv == NULL) return -1; err = PyDict_DelItem(v, kv); Modified: python/branches/okkoto-sizeof/Objects/enumobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/enumobject.c (original) +++ python/branches/okkoto-sizeof/Objects/enumobject.c Wed Jun 4 11:24:23 2008 @@ -224,7 +224,10 @@ PyObject *seq; reversedobject *ro; - if (!PyArg_UnpackTuple(args, "reversed", 1, 1, &seq)) + if (type == &PyReversed_Type && !_PyArg_NoKeywords("reversed()", kwds)) + return NULL; + + if (!PyArg_UnpackTuple(args, "reversed", 1, 1, &seq) ) return NULL; if (PyObject_HasAttrString(seq, "__reversed__")) Modified: python/branches/okkoto-sizeof/Objects/exceptions.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/exceptions.c (original) +++ python/branches/okkoto-sizeof/Objects/exceptions.c Wed Jun 4 11:24:23 2008 @@ -44,7 +44,7 @@ return NULL; } - self->message = PyString_FromString(""); + self->message = PyBytes_FromString(""); if (!self->message) { Py_DECREF(self); return NULL; @@ -104,7 +104,7 @@ switch (PyTuple_GET_SIZE(self->args)) { case 0: - out = PyString_FromString(""); + out = PyBytes_FromString(""); break; case 1: out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0)); @@ -133,13 +133,13 @@ dot = strrchr(name, '.'); if (dot != NULL) name = dot+1; - repr = PyString_FromString(name); + repr = PyBytes_FromString(name); if (!repr) { Py_DECREF(repr_suffix); return NULL; } - PyString_ConcatAndDel(&repr, repr_suffix); + PyBytes_ConcatAndDel(&repr, repr_suffix); return repr; } @@ -610,7 +610,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyString_FromString("[Errno %s] %s: %s"); + fmt = PyBytes_FromString("[Errno %s] %s: %s"); if (!fmt) return NULL; @@ -645,7 +645,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -654,7 +654,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyString_FromString("[Errno %s] %s"); + fmt = PyBytes_FromString("[Errno %s] %s"); if (!fmt) return NULL; @@ -681,7 +681,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -841,7 +841,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyString_FromString("[Error %s] %s: %s"); + fmt = PyBytes_FromString("[Error %s] %s: %s"); if (!fmt) return NULL; @@ -876,7 +876,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -885,7 +885,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyString_FromString("[Error %s] %s"); + fmt = PyBytes_FromString("[Error %s] %s"); if (!fmt) return NULL; @@ -912,7 +912,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyString_Format(fmt, tuple); + rtnval = PyBytes_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -1109,21 +1109,21 @@ str = PyObject_Str(Py_None); if (!str) return NULL; /* Don't fiddle with non-string return (shouldn't happen anyway) */ - if (!PyString_Check(str)) return str; + if (!PyBytes_Check(str)) return str; /* XXX -- do all the additional formatting with filename and lineno here */ have_filename = (self->filename != NULL) && - PyString_Check(self->filename); + PyBytes_Check(self->filename); have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); if (!have_filename && !have_lineno) return str; - bufsize = PyString_GET_SIZE(str) + 64; + bufsize = PyBytes_GET_SIZE(str) + 64; if (have_filename) - bufsize += PyString_GET_SIZE(self->filename); + bufsize += PyBytes_GET_SIZE(self->filename); buffer = PyMem_MALLOC(bufsize); if (buffer == NULL) @@ -1131,19 +1131,19 @@ if (have_filename && have_lineno) PyOS_snprintf(buffer, bufsize, "%s (%s, line %ld)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename)), + PyBytes_AS_STRING(str), + my_basename(PyBytes_AS_STRING(self->filename)), PyInt_AsLong(self->lineno)); else if (have_filename) PyOS_snprintf(buffer, bufsize, "%s (%s)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename))); + PyBytes_AS_STRING(str), + my_basename(PyBytes_AS_STRING(self->filename))); else /* only have_lineno */ PyOS_snprintf(buffer, bufsize, "%s (line %ld)", - PyString_AS_STRING(str), + PyBytes_AS_STRING(str), PyInt_AsLong(self->lineno)); - result = PyString_FromString(buffer); + result = PyBytes_FromString(buffer); PyMem_FREE(buffer); if (result == NULL) @@ -1250,7 +1250,7 @@ return NULL; } - if (!PyString_Check(attr)) { + if (!PyBytes_Check(attr)) { PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); return NULL; } @@ -1262,7 +1262,7 @@ static int set_string(PyObject **attr, const char *value) { - PyObject *obj = PyString_FromString(value); + PyObject *obj = PyBytes_FromString(value); if (!obj) return -1; Py_CLEAR(*attr); @@ -1345,7 +1345,7 @@ "object"); if (!obj) return -1; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); *start = ((PyUnicodeErrorObject *)exc)->start; if (*start<0) *start = 0; @@ -1415,7 +1415,7 @@ if (!obj) return -1; *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyString_GET_SIZE(obj); + size = PyBytes_GET_SIZE(obj); if (*end<1) *end = 1; if (*end>size) @@ -1506,11 +1506,11 @@ Py_CLEAR(self->reason); if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyString_Type, &self->encoding, + &PyBytes_Type, &self->encoding, objecttype, &self->object, &self->start, &self->end, - &PyString_Type, &self->reason)) { + &PyBytes_Type, &self->reason)) { self->encoding = self->object = self->reason = NULL; return -1; } @@ -1590,20 +1590,20 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't encode character u'\\%s' in position %zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), badchar_str, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't encode characters in position %zd-%zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -1642,7 +1642,7 @@ if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) return -1; return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyString_Type); + kwds, &PyBytes_Type); } static PyObject * @@ -1654,21 +1654,21 @@ /* FromFormat does not support %02x, so format that separately */ char byte[4]; PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyString_AS_STRING(uself->object)[uself->start])&0xff); - return PyString_FromFormat( + ((int)PyBytes_AS_STRING(uself->object)[uself->start])&0xff); + return PyBytes_FromFormat( "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), byte, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "'%.400s' codec can't decode bytes in position %zd-%zd: %.400s", - PyString_AS_STRING(uself->encoding), + PyBytes_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -1718,7 +1718,7 @@ &PyUnicode_Type, &self->object, &self->start, &self->end, - &PyString_Type, &self->reason)) { + &PyBytes_Type, &self->reason)) { self->object = self->reason = NULL; return -1; } @@ -1744,18 +1744,18 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyString_FromFormat( + return PyBytes_FromFormat( "can't translate character u'\\%s' in position %zd: %.400s", badchar_str, uself->start, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } - return PyString_FromFormat( + return PyBytes_FromFormat( "can't translate characters in position %zd-%zd: %.400s", uself->start, uself->end-1, - PyString_AS_STRING(uself->reason) + PyBytes_AS_STRING(uself->reason) ); } @@ -2111,7 +2111,7 @@ (PyBaseExceptionObject *)PyExc_RecursionErrorInst; PyObject *args_tuple; PyObject *exc_message; - exc_message = PyString_FromString("maximum recursion depth exceeded"); + exc_message = PyBytes_FromString("maximum recursion depth exceeded"); if (!exc_message) Py_FatalError("cannot allocate argument for RuntimeError " "pre-allocation"); Modified: python/branches/okkoto-sizeof/Objects/fileobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/fileobject.c (original) +++ python/branches/okkoto-sizeof/Objects/fileobject.c Wed Jun 4 11:24:23 2008 @@ -26,7 +26,7 @@ #include #endif -#define BUF(v) PyString_AS_STRING((PyStringObject *)v) +#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) #ifndef DONT_HAVE_ERRNO_H #include @@ -155,11 +155,12 @@ Py_DECREF(f->f_name); Py_DECREF(f->f_mode); Py_DECREF(f->f_encoding); + Py_DECREF(f->f_errors); Py_INCREF(name); f->f_name = name; - f->f_mode = PyString_FromString(mode); + f->f_mode = PyBytes_FromString(mode); f->f_close = close; f->f_softspace = 0; @@ -170,6 +171,8 @@ f->f_skipnextlf = 0; Py_INCREF(Py_None); f->f_encoding = Py_None; + Py_INCREF(Py_None); + f->f_errors = Py_None; if (f->f_mode == NULL) return NULL; @@ -367,7 +370,7 @@ PyFileObject *f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); if (f != NULL) { - PyObject *o_name = PyString_FromString(name); + PyObject *o_name = PyBytes_FromString(name); if (o_name == NULL) return NULL; if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { @@ -435,19 +438,38 @@ } /* Set the encoding used to output Unicode strings. - Returh 1 on success, 0 on failure. */ + Return 1 on success, 0 on failure. */ int PyFile_SetEncoding(PyObject *f, const char *enc) { + return PyFile_SetEncodingAndErrors(f, enc, NULL); +} + +int +PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors) +{ PyFileObject *file = (PyFileObject*)f; - PyObject *str = PyString_FromString(enc); + PyObject *str, *oerrors; assert(PyFile_Check(f)); + str = PyBytes_FromString(enc); if (!str) return 0; + if (errors) { + oerrors = PyString_FromString(errors); + if (!oerrors) { + Py_DECREF(str); + return 0; + } + } else { + oerrors = Py_None; + Py_INCREF(Py_None); + } Py_DECREF(file->f_encoding); file->f_encoding = str; + Py_DECREF(file->f_errors); + file->f_errors = oerrors; return 1; } @@ -491,6 +513,7 @@ Py_XDECREF(f->f_name); Py_XDECREF(f->f_mode); Py_XDECREF(f->f_encoding); + Py_XDECREF(f->f_errors); drop_readahead(f); Py_TYPE(f)->tp_free((PyObject *)f); } @@ -502,20 +525,20 @@ #ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); - const char *name_str = name ? PyString_AsString(name) : "?"; - ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", + const char *name_str = name ? PyBytes_AsString(name) : "?"; + ret = PyBytes_FromFormat("<%s file u'%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", name_str, - PyString_AsString(f->f_mode), + PyBytes_AsString(f->f_mode), f); Py_XDECREF(name); return ret; #endif } else { - return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", + return PyBytes_FromFormat("<%s file '%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", - PyString_AsString(f->f_name), - PyString_AsString(f->f_mode), + PyBytes_AsString(f->f_name), + PyBytes_AsString(f->f_mode), f); } } @@ -935,7 +958,7 @@ "requested number of bytes is more than a Python string can hold"); return NULL; } - v = PyString_FromStringAndSize((char *)NULL, buffersize); + v = PyBytes_FromStringAndSize((char *)NULL, buffersize); if (v == NULL) return NULL; bytesread = 0; @@ -966,7 +989,7 @@ } if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); - if (_PyString_Resize(&v, buffersize) < 0) + if (_PyBytes_Resize(&v, buffersize) < 0) return NULL; } else { /* Got what was requested. */ @@ -974,7 +997,7 @@ } } if (bytesread != buffersize) - _PyString_Resize(&v, bytesread); + _PyBytes_Resize(&v, bytesread); return v; } @@ -1092,7 +1115,7 @@ size_t increment; /* amount to increment the buffer */ size_t prev_v_size; - /* Optimize for normal case: avoid _PyString_Resize if at all + /* Optimize for normal case: avoid _PyBytes_Resize if at all * possible via first reading into stack buffer "buf". */ total_v_size = INITBUFSIZE; /* start small and pray */ @@ -1110,7 +1133,7 @@ clearerr(fp); if (PyErr_CheckSignals()) return NULL; - v = PyString_FromStringAndSize(buf, pvfree - buf); + v = PyBytes_FromStringAndSize(buf, pvfree - buf); return v; } /* fgets read *something* */ @@ -1139,7 +1162,7 @@ assert(p > pvfree && *(p-1) == '\0'); --p; /* don't include \0 from fgets */ } - v = PyString_FromStringAndSize(buf, p - buf); + v = PyBytes_FromStringAndSize(buf, p - buf); return v; } /* yuck: fgets overwrote all the newlines, i.e. the entire @@ -1160,7 +1183,7 @@ * into its buffer. */ total_v_size = MAXBUFSIZE << 1; - v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size); + v = PyBytes_FromStringAndSize((char*)NULL, (int)total_v_size); if (v == NULL) return v; /* copy over everything except the last null byte */ @@ -1215,13 +1238,13 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, (int)total_v_size) < 0) + if (_PyBytes_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) - _PyString_Resize(&v, p - BUF(v)); + _PyBytes_Resize(&v, p - BUF(v)); return v; #undef INITBUFSIZE #undef MAXBUFSIZE @@ -1253,7 +1276,7 @@ return getline_via_fgets(f, fp); #endif total_v_size = n > 0 ? n : 100; - v = PyString_FromStringAndSize((char *)NULL, total_v_size); + v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; buf = BUF(v); @@ -1326,7 +1349,7 @@ Py_DECREF(v); return NULL; } - if (_PyString_Resize(&v, total_v_size) < 0) + if (_PyBytes_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -1334,7 +1357,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyString_Resize(&v, used_v_size); + _PyBytes_Resize(&v, used_v_size); return v; } @@ -1379,7 +1402,7 @@ result = PyEval_CallObject(reader, args); Py_DECREF(reader); Py_DECREF(args); - if (result != NULL && !PyString_Check(result) && + if (result != NULL && !PyBytes_Check(result) && !PyUnicode_Check(result)) { Py_DECREF(result); result = NULL; @@ -1388,9 +1411,9 @@ } } - if (n < 0 && result != NULL && PyString_Check(result)) { - char *s = PyString_AS_STRING(result); - Py_ssize_t len = PyString_GET_SIZE(result); + if (n < 0 && result != NULL && PyBytes_Check(result)) { + char *s = PyBytes_AS_STRING(result); + Py_ssize_t len = PyBytes_GET_SIZE(result); if (len == 0) { Py_DECREF(result); result = NULL; @@ -1399,10 +1422,10 @@ } else if (s[len-1] == '\n') { if (result->ob_refcnt == 1) - _PyString_Resize(&result, len-1); + _PyBytes_Resize(&result, len-1); else { PyObject *v; - v = PyString_FromStringAndSize(s, len-1); + v = PyBytes_FromStringAndSize(s, len-1); Py_DECREF(result); result = v; } @@ -1450,7 +1473,7 @@ if (!PyArg_ParseTuple(args, "|i:readline", &n)) return NULL; if (n == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); if (n < 0) n = 0; return get_line(f, n); @@ -1516,18 +1539,18 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyString_FromStringAndSize( + big_buffer = PyBytes_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) + if ( _PyBytes_Resize(&big_buffer, buffersize) < 0 ) goto error; - buffer = PyString_AS_STRING(big_buffer); + buffer = PyBytes_AS_STRING(big_buffer); } continue; } @@ -1536,7 +1559,7 @@ do { /* Process complete lines */ p++; - line = PyString_FromStringAndSize(q, p-q); + line = PyBytes_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -1555,7 +1578,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyString_FromStringAndSize(buffer, nfilled); + line = PyBytes_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -1565,7 +1588,7 @@ Py_DECREF(line); goto error; } - PyString_Concat(&line, rest); + PyBytes_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -1672,7 +1695,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { const char *buffer; if (((f->f_binary && PyObject_AsReadBuffer(v, @@ -1685,7 +1708,7 @@ "writelines() argument must be a sequence of strings"); goto error; } - line = PyString_FromStringAndSize(buffer, + line = PyBytes_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -1701,8 +1724,8 @@ errno = 0; for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyString_GET_SIZE(line); - nwritten = fwrite(PyString_AS_STRING(line), + len = PyBytes_GET_SIZE(line); + nwritten = fwrite(PyBytes_AS_STRING(line), 1, len, f->f_fp); if (nwritten != len) { FILE_ABORT_ALLOW_THREADS(f) @@ -1736,6 +1759,15 @@ } static PyObject * +file_xreadlines(PyFileObject *f) +{ + if (PyErr_WarnPy3k("f.xreadlines() not supported in 3.x, " + "try 'for line in f' instead", 1) < 0) + return NULL; + return file_self(f); +} + +static PyObject * file_exit(PyObject *f, PyObject *args) { PyObject *ret = PyObject_CallMethod(f, "close", NULL); @@ -1850,9 +1882,9 @@ #endif {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, - {"readlines", (PyCFunction)file_readlines,METH_VARARGS, readlines_doc}, - {"xreadlines",(PyCFunction)file_self, METH_NOARGS, xreadlines_doc}, - {"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc}, + {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, + {"xreadlines",(PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc}, + {"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc}, {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, {"close", (PyCFunction)file_close, METH_NOARGS, close_doc}, {"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc}, @@ -1870,6 +1902,8 @@ "file name"}, {"encoding", T_OBJECT, OFF(f_encoding), RO, "file encoding"}, + {"errors", T_OBJECT, OFF(f_errors), RO, + "Unicode error handler"}, /* getattr(f, "closed") is implemented without this table */ {NULL} /* Sentinel */ }; @@ -1887,13 +1921,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyString_FromString("\r"); + return PyBytes_FromString("\r"); case NEWLINE_LF: - return PyString_FromString("\n"); + return PyBytes_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyString_FromString("\r\n"); + return PyBytes_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -1995,10 +2029,10 @@ horrified by the recursive call: maximum recursion depth is limited by logarithmic buffer growth to about 50 even when reading a 1gb line. */ -static PyStringObject * +static PyBytesObject * readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { - PyStringObject* s; + PyBytesObject* s; char *bufptr; char *buf; Py_ssize_t len; @@ -2009,17 +2043,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyStringObject *) - PyString_FromStringAndSize(NULL, skip); + return (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip); bufptr = (char *)memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyStringObject *) - PyString_FromStringAndSize(NULL, skip+len); + s = (PyBytesObject *) + PyBytes_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) drop_readahead(f); @@ -2034,7 +2068,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyString_AS_STRING(s)+skip, bufptr, len); + memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -2046,13 +2080,13 @@ static PyObject * file_iternext(PyFileObject *f) { - PyStringObject* l; + PyBytesObject* l; if (f->f_fp == NULL) return err_closed(); l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); - if (l == NULL || PyString_GET_SIZE(l) == 0) { + if (l == NULL || PyBytes_GET_SIZE(l) == 0) { Py_XDECREF(l); return NULL; } @@ -2069,7 +2103,7 @@ assert(type != NULL && type->tp_alloc != NULL); if (not_yet_string == NULL) { - not_yet_string = PyString_InternFromString(""); + not_yet_string = PyBytes_InternFromString(""); if (not_yet_string == NULL) return NULL; } @@ -2084,6 +2118,8 @@ ((PyFileObject *)self)->f_mode = not_yet_string; Py_INCREF(Py_None); ((PyFileObject *)self)->f_encoding = Py_None; + Py_INCREF(Py_None); + ((PyFileObject *)self)->f_errors = Py_None; ((PyFileObject *)self)->weakreflist = NULL; ((PyFileObject *)self)->unlocked_count = 0; } @@ -2285,8 +2321,10 @@ #ifdef Py_USING_UNICODE if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { - char *cenc = PyString_AS_STRING(enc); - value = PyUnicode_AsEncodedString(v, cenc, "strict"); + char *cenc = PyBytes_AS_STRING(enc); + char *errors = fobj->f_errors == Py_None ? + "strict" : PyBytes_AS_STRING(fobj->f_errors); + value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) return -1; } else { @@ -2356,7 +2394,7 @@ return 0; } else if (!PyErr_Occurred()) { - PyObject *v = PyString_FromString(s); + PyObject *v = PyBytes_FromString(s); int err; if (v == NULL) return -1; Modified: python/branches/okkoto-sizeof/Objects/floatobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/floatobject.c (original) +++ python/branches/okkoto-sizeof/Objects/floatobject.c Wed Jun 4 11:24:23 2008 @@ -14,9 +14,6 @@ #include #endif -#include "formatter_string.h" - - #ifdef _OSF_SOURCE /* OSF1 5.1 doesn't make this available with XOPEN_SOURCE_EXTENDED defined */ extern int finite(double); @@ -185,9 +182,9 @@ if (pend) *pend = NULL; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + s = PyBytes_AS_STRING(v); + len = PyBytes_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -488,7 +485,7 @@ char buf[100]; format_float(buf, sizeof(buf), v, PREC_REPR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -496,7 +493,7 @@ { char buf[100]; format_float(buf, sizeof(buf), v, PREC_STR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } /* Comparison is pretty much a nightmare. When comparing float to float, @@ -1221,7 +1218,7 @@ return float_subtype_new(type, args, kwds); /* Wimp out */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x)) return NULL; - if (PyString_Check(x)) + if (PyBytes_Check(x)) return PyFloat_FromString(x, NULL); return PyNumber_Float(x); } @@ -1272,13 +1269,13 @@ char* s; float_format_type r; - if (!PyString_Check(arg)) { + if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", Py_TYPE(arg)->tp_name); return NULL; } - s = PyString_AS_STRING(arg); + s = PyBytes_AS_STRING(arg); if (strcmp(s, "double") == 0) { r = double_format; } @@ -1294,11 +1291,11 @@ switch (r) { case unknown_format: - return PyString_FromString("unknown"); + return PyBytes_FromString("unknown"); case ieee_little_endian_format: - return PyString_FromString("IEEE, little-endian"); + return PyBytes_FromString("IEEE, little-endian"); case ieee_big_endian_format: - return PyString_FromString("IEEE, big-endian"); + return PyBytes_FromString("IEEE, big-endian"); default: Py_FatalError("insane float_format or double_format"); return NULL; @@ -1397,27 +1394,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_float__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyFloat_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_float__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyFloat_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); Modified: python/branches/okkoto-sizeof/Objects/frameobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/frameobject.c (original) +++ python/branches/okkoto-sizeof/Objects/frameobject.c Wed Jun 4 11:24:23 2008 @@ -114,7 +114,7 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; @@ -137,7 +137,7 @@ } /* We're now ready to look at the bytecode. */ - PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); + PyBytes_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); min_addr = MIN(new_lasti, f->f_lasti); max_addr = MAX(new_lasti, f->f_lasti); @@ -548,7 +548,7 @@ int _PyFrame_Init() { - builtin_object = PyString_InternFromString("__builtins__"); + builtin_object = PyBytes_InternFromString("__builtins__"); return (builtin_object != NULL); } @@ -728,7 +728,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; - assert(PyString_Check(key)); + assert(PyBytes_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); @@ -776,7 +776,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = PyObject_GetItem(dict, key); - assert(PyString_Check(key)); + assert(PyBytes_Check(key)); /* We only care about NULLs if clear is true. */ if (value == NULL) { PyErr_Clear(); Modified: python/branches/okkoto-sizeof/Objects/funcobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/funcobject.c (original) +++ python/branches/okkoto-sizeof/Objects/funcobject.c Wed Jun 4 11:24:23 2008 @@ -28,7 +28,7 @@ consts = ((PyCodeObject *)code)->co_consts; if (PyTuple_Size(consts) >= 1) { doc = PyTuple_GetItem(consts, 0); - if (!PyString_Check(doc) && !PyUnicode_Check(doc)) + if (!PyBytes_Check(doc) && !PyUnicode_Check(doc)) doc = Py_None; } else @@ -42,7 +42,7 @@ Otherwise, use None. */ if (!__name__) { - __name__ = PyString_InternFromString("__name__"); + __name__ = PyBytes_InternFromString("__name__"); if (!__name__) { Py_DECREF(op); return NULL; @@ -254,7 +254,7 @@ PyErr_Format(PyExc_ValueError, "%s() requires a code object with %zd free vars," " not %zd", - PyString_AsString(op->func_name), + PyBytes_AsString(op->func_name), nclosure, nfree); return -1; } @@ -281,7 +281,7 @@ return -1; /* Not legal to del f.func_name or to set it to anything * other than a string object. */ - if (value == NULL || !PyString_Check(value)) { + if (value == NULL || !PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -380,7 +380,7 @@ &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; - if (name != Py_None && !PyString_Check(name)) { + if (name != Py_None && !PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); return NULL; @@ -409,7 +409,7 @@ if (nfree != nclosure) return PyErr_Format(PyExc_ValueError, "%s requires closure of length %zd, not %zd", - PyString_AS_STRING(code->co_name), + PyBytes_AS_STRING(code->co_name), nfree, nclosure); if (nclosure) { Py_ssize_t i; @@ -465,8 +465,8 @@ static PyObject* func_repr(PyFunctionObject *op) { - return PyString_FromFormat("", - PyString_AsString(op->func_name), + return PyBytes_FromFormat("", + PyBytes_AsString(op->func_name), op); } Modified: python/branches/okkoto-sizeof/Objects/genobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/genobject.c (original) +++ python/branches/okkoto-sizeof/Objects/genobject.c Wed Jun 4 11:24:23 2008 @@ -285,10 +285,10 @@ gen_repr(PyGenObject *gen) { char *code_name; - code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name); + code_name = PyBytes_AsString(((PyCodeObject *)gen->gi_code)->co_name); if (code_name == NULL) return NULL; - return PyString_FromFormat("<%.200s generator object at %p>", + return PyBytes_FromFormat("", code_name, gen); } Modified: python/branches/okkoto-sizeof/Objects/intobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/intobject.c (original) +++ python/branches/okkoto-sizeof/Objects/intobject.c Wed Jun 4 11:24:23 2008 @@ -3,7 +3,6 @@ #include "Python.h" #include -#include "formatter_string.h" static PyObject *int_int(PyIntObject *v); @@ -368,7 +367,7 @@ if (*end != '\0') { bad: slen = strlen(s) < 200 ? strlen(s) : 200; - sobj = PyString_FromStringAndSize(s, slen); + sobj = PyBytes_FromStringAndSize(s, slen); if (sobj == NULL) return NULL; srepr = PyObject_Repr(sobj); @@ -377,7 +376,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -965,11 +964,11 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyString_Check(x)) { + if (PyBytes_Check(x)) { /* Since PyInt_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != PyString_Size(x)) { + char *string = PyBytes_AS_STRING(x); + if (strlen(string) != PyBytes_Size(x)) { /* create a repr() of the input string, * just like PyInt_FromString does */ PyObject *srepr; @@ -978,7 +977,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -1106,7 +1105,7 @@ if (negative) *--p = '-'; - return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p); + return PyBytes_FromStringAndSize(p, &buf[sizeof(buf)] - p); } static PyObject * @@ -1116,27 +1115,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_int__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyInt_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_int__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyInt_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); Modified: python/branches/okkoto-sizeof/Objects/listobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/listobject.c (original) +++ python/branches/okkoto-sizeof/Objects/listobject.c Wed Jun 4 11:24:23 2008 @@ -174,7 +174,7 @@ } if (i < 0 || i >= Py_SIZE(op)) { if (indexerr == NULL) - indexerr = PyString_FromString( + indexerr = PyBytes_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; @@ -349,11 +349,11 @@ i = Py_ReprEnter((PyObject*)v); if (i != 0) { - return i > 0 ? PyString_FromString("[...]") : NULL; + return i > 0 ? PyBytes_FromString("[...]") : NULL; } if (Py_SIZE(v) == 0) { - result = PyString_FromString("[]"); + result = PyBytes_FromString("[]"); goto Done; } @@ -379,29 +379,29 @@ /* Add "[]" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("["); + s = PyBytes_FromString("["); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString("]"); + s = PyBytes_FromString("]"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: @@ -433,7 +433,7 @@ { if (i < 0 || i >= Py_SIZE(a)) { if (indexerr == NULL) - indexerr = PyString_FromString( + indexerr = PyBytes_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; @@ -2437,7 +2437,7 @@ PyDoc_STRVAR(reversed_doc, "L.__reversed__() -- return a reverse iterator over the list"); PyDoc_STRVAR(sizeof_doc, -"L.__sizeof__() -- size of L in bytes"); +"L.__sizeof__() -- size of L in memory, in bytes"); PyDoc_STRVAR(append_doc, "L.append(object) -- append object to end"); PyDoc_STRVAR(extend_doc, Modified: python/branches/okkoto-sizeof/Objects/longobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/longobject.c (original) +++ python/branches/okkoto-sizeof/Objects/longobject.c Wed Jun 4 11:24:23 2008 @@ -6,7 +6,6 @@ #include "Python.h" #include "longintrepr.h" -#include "formatter_string.h" #include @@ -1200,7 +1199,7 @@ _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) { register PyLongObject *a = (PyLongObject *)aa; - PyStringObject *str; + PyBytesObject *str; Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; @@ -1229,10 +1228,10 @@ "long is too large to format"); return NULL; } - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); + str = (PyBytesObject *) PyBytes_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyString_AS_STRING(str) + sz; + p = PyBytes_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1258,7 +1257,7 @@ do { char cdigit = (char)(accum & (base - 1)); cdigit += (cdigit < 10) ? '0' : 'a'-10; - assert(p > PyString_AS_STRING(str)); + assert(p > PyBytes_AS_STRING(str)); *--p = cdigit; accumbits -= basebits; accum >>= basebits; @@ -1310,7 +1309,7 @@ do { digit nextrem = (digit)(rem / base); char c = (char)(rem - nextrem * base); - assert(p > PyString_AS_STRING(str)); + assert(p > PyBytes_AS_STRING(str)); c += (c < 10) ? '0' : 'a'-10; *--p = c; rem = nextrem; @@ -1348,14 +1347,14 @@ } if (sign) *--p = sign; - if (p != PyString_AS_STRING(str)) { - char *q = PyString_AS_STRING(str); + if (p != PyBytes_AS_STRING(str)) { + char *q = PyBytes_AS_STRING(str); assert(p > q); do { } while ((*q++ = *p++) != '\0'); q--; - _PyString_Resize((PyObject **)&str, - (Py_ssize_t) (q - PyString_AS_STRING(str))); + _PyBytes_Resize((PyObject **)&str, + (Py_ssize_t) (q - PyBytes_AS_STRING(str))); } return (PyObject *)str; } @@ -1719,7 +1718,7 @@ onError: Py_XDECREF(z); slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; - strobj = PyString_FromStringAndSize(orig_str, slen); + strobj = PyBytes_FromStringAndSize(orig_str, slen); if (strobj == NULL) return NULL; strrepr = PyObject_Repr(strobj); @@ -1728,7 +1727,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(strrepr)); + base, PyBytes_AS_STRING(strrepr)); Py_DECREF(strrepr); return NULL; } @@ -3332,11 +3331,11 @@ return PyLong_FromLong(0L); if (base == -909) return PyNumber_Long(x); - else if (PyString_Check(x)) { + else if (PyBytes_Check(x)) { /* Since PyLong_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != PyString_Size(x)) { + char *string = PyBytes_AS_STRING(x); + if (strlen(string) != PyBytes_Size(x)) { /* create a repr() of the input string, * just like PyLong_FromString does. */ PyObject *srepr; @@ -3345,11 +3344,11 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(srepr)); + base, PyBytes_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } - return PyLong_FromString(PyString_AS_STRING(x), NULL, base); + return PyLong_FromString(PyBytes_AS_STRING(x), NULL, base); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) @@ -3414,27 +3413,23 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) - return string_long__format__(self, args); + if (PyBytes_Check(format_spec)) + return _PyLong_FormatAdvanced(self, + PyBytes_AS_STRING(format_spec), + PyBytes_GET_SIZE(format_spec)); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */ - PyObject *result = NULL; - PyObject *newargs = NULL; - PyObject *string_format_spec = NULL; - - string_format_spec = PyObject_Str(format_spec); - if (string_format_spec == NULL) - goto done; - - newargs = Py_BuildValue("(O)", string_format_spec); - if (newargs == NULL) - goto done; - - result = string_long__format__(self, newargs); - - done: - Py_XDECREF(string_format_spec); - Py_XDECREF(newargs); + PyObject *result; + PyObject *str_spec = PyObject_Str(format_spec); + + if (str_spec == NULL) + return NULL; + + result = _PyLong_FormatAdvanced(self, + PyBytes_AS_STRING(str_spec), + PyBytes_GET_SIZE(str_spec)); + + Py_DECREF(str_spec); return result; } PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); @@ -3472,7 +3467,7 @@ {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, {"__format__", (PyCFunction)long__format__, METH_VARARGS}, {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, - "Returns size in bytes"}, + "Returns size in memory, in bytes"}, {NULL, NULL} /* sentinel */ }; Modified: python/branches/okkoto-sizeof/Objects/methodobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/methodobject.c (original) +++ python/branches/okkoto-sizeof/Objects/methodobject.c Wed Jun 4 11:24:23 2008 @@ -149,7 +149,7 @@ const char *doc = m->m_ml->ml_doc; if (doc != NULL) - return PyString_FromString(doc); + return PyBytes_FromString(doc); Py_INCREF(Py_None); return Py_None; } @@ -157,7 +157,7 @@ static PyObject * meth_get__name__(PyCFunctionObject *m, void *closure) { - return PyString_FromString(m->m_ml->ml_name); + return PyBytes_FromString(m->m_ml->ml_name); } static int @@ -202,9 +202,9 @@ meth_repr(PyCFunctionObject *m) { if (m->m_self == NULL) - return PyString_FromFormat("", + return PyBytes_FromFormat("", m->m_ml->ml_name); - return PyString_FromFormat("", + return PyBytes_FromFormat("", m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_self); @@ -333,7 +333,7 @@ i = 0; for (c = chain; c != NULL; c = c->link) { for (ml = c->methods; ml->ml_name != NULL; ml++) { - PyList_SetItem(v, i, PyString_FromString(ml->ml_name)); + PyList_SetItem(v, i, PyBytes_FromString(ml->ml_name)); i++; } } @@ -360,7 +360,7 @@ if (strcmp(name, "__doc__") == 0) { const char *doc = self->ob_type->tp_doc; if (doc != NULL) - return PyString_FromString(doc); + return PyBytes_FromString(doc); } } while (chain != NULL) { Modified: python/branches/okkoto-sizeof/Objects/moduleobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/moduleobject.c (original) +++ python/branches/okkoto-sizeof/Objects/moduleobject.c Wed Jun 4 11:24:23 2008 @@ -22,7 +22,7 @@ m = PyObject_GC_New(PyModuleObject, &PyModule_Type); if (m == NULL) return NULL; - nameobj = PyString_FromString(name); + nameobj = PyBytes_FromString(name); m->md_dict = PyDict_New(); if (m->md_dict == NULL || nameobj == NULL) goto fail; @@ -68,12 +68,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (nameobj = PyDict_GetItemString(d, "__name__")) == NULL || - !PyString_Check(nameobj)) + !PyBytes_Check(nameobj)) { PyErr_SetString(PyExc_SystemError, "nameless module"); return NULL; } - return PyString_AsString(nameobj); + return PyBytes_AsString(nameobj); } char * @@ -88,12 +88,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || - !PyString_Check(fileobj)) + !PyBytes_Check(fileobj)) { PyErr_SetString(PyExc_SystemError, "module filename missing"); return NULL; } - return PyString_AsString(fileobj); + return PyBytes_AsString(fileobj); } void @@ -117,8 +117,8 @@ /* First, clear only names starting with a single underscore */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyBytes_Check(key)) { + char *s = PyBytes_AsString(key); if (s[0] == '_' && s[1] != '_') { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[1] %s\n", s); @@ -130,8 +130,8 @@ /* Next, clear all names except for __builtins__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); + if (value != Py_None && PyBytes_Check(key)) { + char *s = PyBytes_AsString(key); if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); @@ -195,9 +195,9 @@ filename = PyModule_GetFilename((PyObject *)m); if (filename == NULL) { PyErr_Clear(); - return PyString_FromFormat("", name); + return PyBytes_FromFormat("", name); } - return PyString_FromFormat("", name, filename); + return PyBytes_FromFormat("", name, filename); } /* We only need a traverse function, no clear function: If the module Modified: python/branches/okkoto-sizeof/Objects/object.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/object.c (original) +++ python/branches/okkoto-sizeof/Objects/object.c Wed Jun 4 11:24:23 2008 @@ -357,9 +357,9 @@ } #endif if (v == NULL) - return PyString_FromString(""); + return PyBytes_FromString(""); else if (Py_TYPE(v)->tp_repr == NULL) - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(v)->tp_name, v); else { PyObject *res; @@ -377,7 +377,7 @@ return NULL; } #endif - if (!PyString_Check(res)) { + if (!PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", Py_TYPE(res)->tp_name); @@ -394,8 +394,8 @@ PyObject *res; int type_ok; if (v == NULL) - return PyString_FromString(""); - if (PyString_CheckExact(v)) { + return PyBytes_FromString(""); + if (PyBytes_CheckExact(v)) { Py_INCREF(v); return v; } @@ -416,7 +416,7 @@ Py_LeaveRecursiveCall(); if (res == NULL) return NULL; - type_ok = PyString_Check(res); + type_ok = PyBytes_Check(res); #ifdef Py_USING_UNICODE type_ok = type_ok || PyUnicode_Check(res); #endif @@ -447,7 +447,7 @@ return NULL; } #endif - assert(PyString_Check(res)); + assert(PyBytes_Check(res)); return res; } @@ -461,7 +461,7 @@ static PyObject *unicodestr; if (v == NULL) { - res = PyString_FromString(""); + res = PyBytes_FromString(""); if (res == NULL) return NULL; str = PyUnicode_FromEncodedObject(res, NULL, "strict"); @@ -475,7 +475,7 @@ check this before trying the __unicode__ method. */ if (unicodestr == NULL) { - unicodestr= PyString_InternFromString("__unicode__"); + unicodestr= PyBytes_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } @@ -492,7 +492,7 @@ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), PyUnicode_GET_SIZE(v)); } - if (PyString_CheckExact(v)) { + if (PyBytes_CheckExact(v)) { Py_INCREF(v); res = v; } @@ -1084,7 +1084,7 @@ if (Py_TYPE(v)->tp_getattr != NULL) return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); - w = PyString_InternFromString(name); + w = PyBytes_InternFromString(name); if (w == NULL) return NULL; res = PyObject_GetAttr(v, w); @@ -1112,7 +1112,7 @@ if (Py_TYPE(v)->tp_setattr != NULL) return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); - s = PyString_InternFromString(name); + s = PyBytes_InternFromString(name); if (s == NULL) return -1; res = PyObject_SetAttr(v, s, w); @@ -1125,7 +1125,7 @@ { PyTypeObject *tp = Py_TYPE(v); - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name @@ -1147,10 +1147,10 @@ if (tp->tp_getattro != NULL) return (*tp->tp_getattro)(v, name); if (tp->tp_getattr != NULL) - return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); + return (*tp->tp_getattr)(v, PyBytes_AS_STRING(name)); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); return NULL; } @@ -1172,7 +1172,7 @@ PyTypeObject *tp = Py_TYPE(v); int err; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1194,14 +1194,14 @@ else Py_INCREF(name); - PyString_InternInPlace(&name); + PyBytes_InternInPlace(&name); if (tp->tp_setattro != NULL) { err = (*tp->tp_setattro)(v, name, value); Py_DECREF(name); return err; } if (tp->tp_setattr != NULL) { - err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); + err = (*tp->tp_setattr)(v, PyBytes_AS_STRING(name), value); Py_DECREF(name); return err; } @@ -1212,14 +1212,14 @@ "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); else PyErr_Format(PyExc_TypeError, "'%.100s' object has only read-only attributes " "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); return -1; } @@ -1271,7 +1271,7 @@ Py_ssize_t dictoffset; PyObject **dictptr; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1386,7 +1386,7 @@ PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1401,7 +1401,7 @@ PyObject **dictptr; int res = -1; - if (!PyString_Check(name)){ + if (!PyBytes_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1469,13 +1469,13 @@ if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); goto done; } PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", - tp->tp_name, PyString_AS_STRING(name)); + tp->tp_name, PyBytes_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1682,7 +1682,7 @@ int i; for (i = 0; i < PyList_GET_SIZE(list); ++i) { PyObject *item = PyList_GET_ITEM(list, i); - if (PyString_Check(item)) { + if (PyBytes_Check(item)) { result = PyDict_SetItem(dict, item, Py_None); if (result < 0) break; @@ -1904,7 +1904,7 @@ static PyObject * none_repr(PyObject *op) { - return PyString_FromString("None"); + return PyBytes_FromString("None"); } /* ARGUSED */ @@ -1946,7 +1946,7 @@ static PyObject * NotImplemented_repr(PyObject *op) { - return PyString_FromString("NotImplemented"); + return PyBytes_FromString("NotImplemented"); } static PyTypeObject PyNotImplemented_Type = { @@ -1983,10 +1983,10 @@ if (PyType_Ready(&PyBool_Type) < 0) Py_FatalError("Can't initialize 'bool'"); - if (PyType_Ready(&PyString_Type) < 0) + if (PyType_Ready(&PyBytes_Type) < 0) Py_FatalError("Can't initialize 'str'"); - if (PyType_Ready(&PyBytes_Type) < 0) + if (PyType_Ready(&PyByteArray_Type) < 0) Py_FatalError("Can't initialize 'bytes'"); if (PyType_Ready(&PyList_Type) < 0) Modified: python/branches/okkoto-sizeof/Objects/rangeobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/rangeobject.c (original) +++ python/branches/okkoto-sizeof/Objects/rangeobject.c Wed Jun 4 11:24:23 2008 @@ -113,16 +113,16 @@ PyObject *rtn; if (r->start == 0 && r->step == 1) - rtn = PyString_FromFormat("xrange(%ld)", + rtn = PyBytes_FromFormat("xrange(%ld)", r->start + r->len * r->step); else if (r->step == 1) - rtn = PyString_FromFormat("xrange(%ld, %ld)", + rtn = PyBytes_FromFormat("xrange(%ld, %ld)", r->start, r->start + r->len * r->step); else - rtn = PyString_FromFormat("xrange(%ld, %ld, %ld)", + rtn = PyBytes_FromFormat("xrange(%ld, %ld, %ld)", r->start, r->start + r->len * r->step, r->step); Modified: python/branches/okkoto-sizeof/Objects/setobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/setobject.c (original) +++ python/branches/okkoto-sizeof/Objects/setobject.c Wed Jun 4 11:24:23 2008 @@ -94,7 +94,9 @@ else { if (entry->hash == hash) { startkey = entry->key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (table == so->table && entry->key == startkey) { @@ -125,7 +127,9 @@ break; if (entry->hash == hash && entry->key != dummy) { startkey = entry->key; + Py_INCREF(startkey); cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); + Py_DECREF(startkey); if (cmp < 0) return NULL; if (table == so->table && entry->key == startkey) { @@ -147,7 +151,7 @@ /* * Hacked up version of set_lookkey which can assume keys are always strings; - * This means we can always use _PyString_Eq directly and not have to check to + * This means we can always use _PyBytes_Eq directly and not have to check to * see if the comparison altered the table. */ static setentry * @@ -164,7 +168,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyString_CheckExact(key)) { + if (!PyBytes_CheckExact(key)) { so->lookup = set_lookkey; return set_lookkey(so, key, hash); } @@ -175,7 +179,7 @@ if (entry->key == dummy) freeslot = entry; else { - if (entry->hash == hash && _PyString_Eq(entry->key, key)) + if (entry->hash == hash && _PyBytes_Eq(entry->key, key)) return entry; freeslot = NULL; } @@ -190,7 +194,7 @@ if (entry->key == key || (entry->hash == hash && entry->key != dummy - && _PyString_Eq(entry->key, key))) + && _PyBytes_Eq(entry->key, key))) return entry; if (entry->key == dummy && freeslot == NULL) freeslot = entry; @@ -377,8 +381,8 @@ register long hash; register Py_ssize_t n_used; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -424,8 +428,8 @@ PyObject *old_key; assert (PyAnySet_Check(so)); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -614,7 +618,7 @@ if (status != 0) { if (status < 0) return NULL; - return PyString_FromFormat("%s(...)", so->ob_type->tp_name); + return PyBytes_FromFormat("%s(...)", so->ob_type->tp_name); } keys = PySequence_List((PyObject *)so); @@ -625,8 +629,8 @@ if (listrepr == NULL) goto done; - result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, - PyString_AS_STRING(listrepr)); + result = PyBytes_FromFormat("%s(%s)", so->ob_type->tp_name, + PyBytes_AS_STRING(listrepr)); Py_DECREF(listrepr); done: Py_ReprLeave((PyObject*)so); @@ -681,8 +685,8 @@ long hash; setentry *entry; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { + if (!PyBytes_CheckExact(key) || + (hash = ((PyBytesObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -979,7 +983,7 @@ register PySetObject *so = NULL; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyString_FromString(""); + dummy = PyBytes_FromString(""); if (dummy == NULL) return NULL; } @@ -2318,7 +2322,7 @@ /* Exercise direct iteration */ i = 0, count = 0; while (_PySet_Next((PyObject *)dup, &i, &x)) { - s = PyString_AsString(x); + s = PyBytes_AsString(x); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); count++; } Modified: python/branches/okkoto-sizeof/Objects/sliceobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/sliceobject.c (original) +++ python/branches/okkoto-sizeof/Objects/sliceobject.c Wed Jun 4 11:24:23 2008 @@ -19,7 +19,7 @@ static PyObject * ellipsis_repr(PyObject *op) { - return PyString_FromString("Ellipsis"); + return PyBytes_FromString("Ellipsis"); } static PyTypeObject PyEllipsis_Type = { @@ -228,14 +228,14 @@ { PyObject *s, *comma; - s = PyString_FromString("slice("); - comma = PyString_FromString(", "); - PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); - PyString_ConcatAndDel(&s, PyString_FromString(")")); + s = PyBytes_FromString("slice("); + comma = PyBytes_FromString(", "); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->start)); + PyBytes_Concat(&s, comma); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->stop)); + PyBytes_Concat(&s, comma); + PyBytes_ConcatAndDel(&s, PyObject_Repr(r->step)); + PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); Py_DECREF(comma); return s; } Modified: python/branches/okkoto-sizeof/Objects/stringlib/formatter.h ============================================================================== --- python/branches/okkoto-sizeof/Objects/stringlib/formatter.h (original) +++ python/branches/okkoto-sizeof/Objects/stringlib/formatter.h Wed Jun 4 11:24:23 2008 @@ -102,12 +102,13 @@ if failure, sets the exception */ static int -parse_internal_render_format_spec(PyObject *format_spec, +parse_internal_render_format_spec(STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len, InternalFormatSpec *format, char default_type) { - STRINGLIB_CHAR *ptr = STRINGLIB_STR(format_spec); - STRINGLIB_CHAR *end = ptr + STRINGLIB_LEN(format_spec); + STRINGLIB_CHAR *ptr = format_spec; + STRINGLIB_CHAR *end = format_spec + format_spec_len; /* end-ptr is used throughout this code to specify the length of the input string */ @@ -756,56 +757,31 @@ /************************************************************************/ /*********** built in formatters ****************************************/ /************************************************************************/ -#ifdef FORMAT_STRING PyObject * -FORMAT_STRING(PyObject* value, PyObject* args) +FORMAT_STRING(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - PyObject *format_spec; - PyObject *result = NULL; -#if PY_VERSION_HEX < 0x03000000 - PyObject *tmp = NULL; -#endif InternalFormatSpec format; - - /* If 2.x, we accept either str or unicode, and try to convert it - to the right type. In 3.x, we insist on only unicode */ -#if PY_VERSION_HEX >= 0x03000000 - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", - &format_spec)) - goto done; -#else - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyString_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = STRINGLIB_TOSTR(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; -#endif + PyObject *result = NULL; /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, 's')) + if (!parse_internal_render_format_spec(format_spec, format_spec_len, + &format, 's')) goto done; /* type conversion? */ switch (format.type) { case 's': /* no type conversion needed, already a string. do the formatting */ - result = format_string_internal(value, &format); + result = format_string_internal(obj, &format); break; default: /* unknown */ @@ -826,35 +802,31 @@ } done: -#if PY_VERSION_HEX < 0x03000000 - Py_XDECREF(tmp); -#endif return result; } -#endif /* FORMAT_STRING */ #if defined FORMAT_LONG || defined FORMAT_INT static PyObject* -format_int_or_long(PyObject* value, PyObject* args, IntOrLongToString tostring) +format_int_or_long(PyObject* obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len, + IntOrLongToString tostring) { - PyObject *format_spec; PyObject *result = NULL; PyObject *tmp = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", - &format_spec)) - goto done; - /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, 'd')) + if (!parse_internal_render_format_spec(format_spec, + format_spec_len, + &format, 'd')) goto done; /* type conversion? */ @@ -868,7 +840,7 @@ case 'n': /* no type conversion needed, already an int (or long). do the formatting */ - result = format_int_or_long_internal(value, &format, tostring); + result = format_int_or_long_internal(obj, &format, tostring); break; case 'e': @@ -879,10 +851,10 @@ case 'G': case '%': /* convert to float */ - tmp = PyNumber_Float(value); + tmp = PyNumber_Float(obj); if (tmp == NULL) goto done; - result = format_float_internal(value, &format); + result = format_float_internal(obj, &format); break; default: @@ -917,9 +889,12 @@ #endif PyObject * -FORMAT_LONG(PyObject* value, PyObject* args) +FORMAT_LONG(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - return format_int_or_long(value, args, long_format); + return format_int_or_long(obj, format_spec, format_spec_len, + long_format); } #endif /* FORMAT_LONG */ @@ -935,32 +910,35 @@ } PyObject * -FORMAT_INT(PyObject* value, PyObject* args) +FORMAT_INT(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - return format_int_or_long(value, args, int_format); + return format_int_or_long(obj, format_spec, format_spec_len, + int_format); } #endif /* FORMAT_INT */ #ifdef FORMAT_FLOAT PyObject * -FORMAT_FLOAT(PyObject *value, PyObject *args) +FORMAT_FLOAT(PyObject *obj, + STRINGLIB_CHAR *format_spec, + Py_ssize_t format_spec_len) { - PyObject *format_spec; PyObject *result = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", &format_spec)) - goto done; - /* check for the special case of zero length format spec, make - it equivalent to str(value) */ - if (STRINGLIB_LEN(format_spec) == 0) { - result = STRINGLIB_TOSTR(value); + it equivalent to str(obj) */ + if (format_spec_len == 0) { + result = STRINGLIB_TOSTR(obj); goto done; } /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, &format, '\0')) + if (!parse_internal_render_format_spec(format_spec, + format_spec_len, + &format, '\0')) goto done; /* type conversion? */ @@ -979,7 +957,7 @@ case 'n': case '%': /* no conversion, already a float. do the formatting */ - result = format_float_internal(value, &format); + result = format_float_internal(obj, &format); break; default: Modified: python/branches/okkoto-sizeof/Objects/stringlib/string_format.h ============================================================================== --- python/branches/okkoto-sizeof/Objects/stringlib/string_format.h (original) +++ python/branches/okkoto-sizeof/Objects/stringlib/string_format.h Wed Jun 4 11:24:23 2008 @@ -496,7 +496,7 @@ #if PY_VERSION_HEX >= 0x03000000 assert(PyUnicode_Check(result)); #else - assert(PyString_Check(result) || PyUnicode_Check(result)); + assert(PyBytes_Check(result) || PyUnicode_Check(result)); /* Convert result to our type. We could be str, and result could be unicode */ Modified: python/branches/okkoto-sizeof/Objects/stringlib/stringdefs.h ============================================================================== --- python/branches/okkoto-sizeof/Objects/stringlib/stringdefs.h (original) +++ python/branches/okkoto-sizeof/Objects/stringlib/stringdefs.h Wed Jun 4 11:24:23 2008 @@ -6,7 +6,7 @@ compiled as unicode. */ #define STRINGLIB_IS_UNICODE 0 -#define STRINGLIB_OBJECT PyStringObject +#define STRINGLIB_OBJECT PyBytesObject #define STRINGLIB_CHAR char #define STRINGLIB_TYPE_NAME "string" #define STRINGLIB_PARSE_CODE "S" @@ -16,13 +16,13 @@ #define STRINGLIB_TOUPPER toupper #define STRINGLIB_TOLOWER tolower #define STRINGLIB_FILL memset -#define STRINGLIB_STR PyString_AS_STRING -#define STRINGLIB_LEN PyString_GET_SIZE -#define STRINGLIB_NEW PyString_FromStringAndSize -#define STRINGLIB_RESIZE _PyString_Resize -#define STRINGLIB_CHECK PyString_Check +#define STRINGLIB_STR PyBytes_AS_STRING +#define STRINGLIB_LEN PyBytes_GET_SIZE +#define STRINGLIB_NEW PyBytes_FromStringAndSize +#define STRINGLIB_RESIZE _PyBytes_Resize +#define STRINGLIB_CHECK PyBytes_Check #define STRINGLIB_CMP memcmp #define STRINGLIB_TOSTR PyObject_Str -#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping +#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping #endif /* !STRINGLIB_STRINGDEFS_H */ Deleted: python/branches/okkoto-sizeof/Objects/stringobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/stringobject.c Wed Jun 4 11:24:23 2008 +++ (empty file) @@ -1,5189 +0,0 @@ -/* String object implementation */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" - -#include "formatter_string.h" - -#include - -#ifdef COUNT_ALLOCS -int null_strings, one_strings; -#endif - -static PyStringObject *characters[UCHAR_MAX + 1]; -static PyStringObject *nullstring; - -/* This dictionary holds all interned strings. Note that references to - strings in this dictionary are *not* counted in the string's ob_refcnt. - When the interned string reaches a refcnt of 0 the string deallocation - function will delete the reference from this dictionary. - - Another way to look at this is that to say that the actual reference - count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) -*/ -static PyObject *interned; - -/* - For both PyString_FromString() and PyString_FromStringAndSize(), the - parameter `size' denotes number of characters to allocate, not counting any - null terminating character. - - For PyString_FromString(), the parameter `str' points to a null-terminated - string containing exactly `size' bytes. - - For PyString_FromStringAndSize(), the parameter the parameter `str' is - either NULL or else points to a string containing at least `size' bytes. - For PyString_FromStringAndSize(), the string in the `str' parameter does - not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyString_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyString_FromStringAndSize() will allocate `size+1' - bytes (setting the last byte to the null terminating character) and you can - fill in the data yourself. If `str' is non-NULL then the resulting - PyString object must be treated as immutable and you must not fill in nor - alter the data yourself, since the strings may be shared. - - The PyObject member `op->ob_size', which denotes the number of "extra - items" in a variable-size object, will contain the number of bytes - allocated for string data, not counting the null terminating character. It - is therefore equal to the equal to the `size' parameter (for - PyString_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyString_FromString()). -*/ -PyObject * -PyString_FromStringAndSize(const char *str, Py_ssize_t size) -{ - register PyStringObject *op; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyString_FromStringAndSize"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && str != NULL && - (op = characters[*str & UCHAR_MAX]) != NULL) - { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - if (str != NULL) - Py_MEMCPY(op->ob_sval, str, size); - op->ob_sval[size] = '\0'; - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1 && str != NULL) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromString(const char *str) -{ - register size_t size; - register PyStringObject *op; - - assert(str != NULL); - size = strlen(str); - if (size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string is too long for a Python string"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, str, size+1); - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t n = 0; - const char* f; - char *s; - PyObject* string; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f; - while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*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. */ - n += 20; - break; - case 's': - s = va_arg(count, char*); - n += strlen(s); - 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: - /* step 2: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyString_FromStringAndSize(NULL, n); - if (!string) - return NULL; - - s = PyString_AsString(string); - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - Py_ssize_t i; - int longflag = 0; - int size_tflag = 0; - /* parse the width.precision part (we're only - interested in the precision value, if any) */ - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - if (*f == '.') { - f++; - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - } - while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - f++; - /* 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': - if (longflag) - sprintf(s, "%ld", va_arg(vargs, long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "d", - va_arg(vargs, Py_ssize_t)); - else - sprintf(s, "%d", va_arg(vargs, int)); - s += strlen(s); - break; - case 'u': - if (longflag) - sprintf(s, "%lu", - va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "u", - va_arg(vargs, size_t)); - else - sprintf(s, "%u", - va_arg(vargs, unsigned int)); - s += strlen(s); - break; - case 'i': - sprintf(s, "%i", va_arg(vargs, int)); - s += strlen(s); - break; - case 'x': - sprintf(s, "%x", va_arg(vargs, int)); - s += strlen(s); - break; - case 's': - p = va_arg(vargs, char*); - i = strlen(p); - if (n > 0 && i > n) - i = n; - Py_MEMCPY(s, p, i); - s += i; - break; - case 'p': - sprintf(s, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (s[1] == 'X') - s[1] = 'x'; - else if (s[1] != 'x') { - memmove(s+2, s, strlen(s)+1); - s[0] = '0'; - s[1] = 'x'; - } - s += strlen(s); - break; - case '%': - *s++ = '%'; - break; - default: - strcpy(s, p); - s += strlen(s); - goto end; - } - } else - *s++ = *f; - } - - end: - _PyString_Resize(&string, s - PyString_AS_STRING(string)); - return string; -} - -PyObject * -PyString_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyString_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - - -PyObject *PyString_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsDecodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsDecodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Decode via the codec registry */ - v = PyCodec_Decode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsDecodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsDecodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -PyObject *PyString_Encode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsEncodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsEncodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsEncodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsEncodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -static void -string_dealloc(PyObject *op) -{ - switch (PyString_CHECK_INTERNED(op)) { - case SSTATE_NOT_INTERNED: - break; - - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(op) = 3; - if (PyDict_DelItem(interned, op) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; - - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); - - default: - Py_FatalError("Inconsistent interned string state."); - } - Py_TYPE(op)->tp_free(op); -} - -/* Unescape a backslash-escaped string. If unicode is non-zero, - the string is a u-literal. If recode_encoding is non-zero, - the string is UTF-8 encoded and should be re-encoded in the - specified encoding. */ - -PyObject *PyString_DecodeEscape(const char *s, - Py_ssize_t len, - const char *errors, - Py_ssize_t unicode, - const char *recode_encoding) -{ - int c; - char *p, *buf; - const char *end; - PyObject *v; - Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyString_FromStringAndSize((char *)NULL, newlen); - if (v == NULL) - return NULL; - p = buf = PyString_AsString(v); - end = s + len; - while (s < end) { - if (*s != '\\') { - non_esc: -#ifdef Py_USING_UNICODE - if (recode_encoding && (*s & 0x80)) { - PyObject *u, *w; - char *r; - const char* t; - Py_ssize_t rn; - t = s; - /* Decode non-ASCII bytes as UTF-8. */ - while (t < end && (*t & 0x80)) t++; - u = PyUnicode_DecodeUTF8(s, t - s, errors); - if(!u) goto failed; - - /* Recode them in target encoding. */ - w = PyUnicode_AsEncodedString( - u, recode_encoding, errors); - Py_DECREF(u); - if (!w) goto failed; - - /* Append bytes to output buffer. */ - assert(PyString_Check(w)); - r = PyString_AS_STRING(w); - rn = PyString_GET_SIZE(w); - Py_MEMCPY(p, r, rn); - p += rn; - Py_DECREF(w); - s = t; - } else { - *p++ = *s++; - } -#else - *p++ = *s++; -#endif - continue; - } - s++; - if (s==end) { - PyErr_SetString(PyExc_ValueError, - "Trailing \\ in string"); - goto failed; - } - switch (*s++) { - /* XXX This assumes ASCII! */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - c = (c<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - c = (c<<3) + *s++ - '0'; - } - *p++ = c; - break; - case 'x': - if (s+1 < end && - isxdigit(Py_CHARMASK(s[0])) && - isxdigit(Py_CHARMASK(s[1]))) - { - unsigned int x = 0; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x = c - '0'; - else if (islower(c)) - x = 10 + c - 'a'; - else - x = 10 + c - 'A'; - x = x << 4; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x += c - '0'; - else if (islower(c)) - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - *p++ = x; - break; - } - if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); - goto failed; - } - if (strcmp(errors, "replace") == 0) { - *p++ = '?'; - } else if (strcmp(errors, "ignore") == 0) - /* do nothing */; - else { - PyErr_Format(PyExc_ValueError, - "decoding error; " - "unknown error handling code: %.400s", - errors); - goto failed; - } -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif - default: - *p++ = '\\'; - s--; - goto non_esc; /* an arbitry number of unescaped - UTF-8 bytes may follow. */ - } - } - if (p-buf < newlen) - _PyString_Resize(&v, p - buf); - return v; - failed: - Py_DECREF(v); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* object api */ - -static Py_ssize_t -string_getsize(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return -1; - return len; -} - -static /*const*/ char * -string_getbuffer(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return NULL; - return s; -} - -Py_ssize_t -PyString_Size(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getsize(op); - return Py_SIZE(op); -} - -/*const*/ char * -PyString_AsString(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getbuffer(op); - return ((PyStringObject *)op) -> ob_sval; -} - -int -PyString_AsStringAndSize(register PyObject *obj, - register char **s, - register Py_ssize_t *len) -{ - if (s == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (!PyString_Check(obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(obj)) { - obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); - if (obj == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " - "%.200s found", Py_TYPE(obj)->tp_name); - return -1; - } - } - - *s = PyString_AS_STRING(obj); - if (len != NULL) - *len = PyString_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) { - PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); - return -1; - } - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#include "stringlib/stringdefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" - -#define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping -#include "stringlib/localeutil.h" - - - -static int -string_print(PyStringObject *op, FILE *fp, int flags) -{ - Py_ssize_t i, str_len; - char c; - int quote; - - /* XXX Ought to check for interrupts when writing long strings */ - if (! PyString_CheckExact(op)) { - int ret; - /* A str subclass may have its own __str__ method. */ - op = (PyStringObject *) PyObject_Str((PyObject *)op); - if (op == NULL) - return -1; - ret = string_print(op, fp, flags); - Py_DECREF(op); - return ret; - } - if (flags & Py_PRINT_RAW) { - char *data = op->ob_sval; - Py_ssize_t size = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - while (size > INT_MAX) { - /* Very long strings cannot be written atomically. - * But don't write exactly INT_MAX bytes at a time - * to avoid memory aligment issues. - */ - const int chunk_size = INT_MAX & ~0x3FFF; - fwrite(data, 1, chunk_size, fp); - data += chunk_size; - size -= chunk_size; - } -#ifdef __VMS - if (size) fwrite(data, (int)size, 1, fp); -#else - fwrite(data, 1, (int)size, fp); -#endif - Py_END_ALLOW_THREADS - return 0; - } - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - str_len = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - fputc(quote, fp); - for (i = 0; i < str_len; i++) { - /* Since strings are immutable and the caller should have a - reference, accessing the interal buffer should not be an issue - with the GIL released. */ - c = op->ob_sval[i]; - if (c == quote || c == '\\') - fprintf(fp, "\\%c", c); - else if (c == '\t') - fprintf(fp, "\\t"); - else if (c == '\n') - fprintf(fp, "\\n"); - else if (c == '\r') - fprintf(fp, "\\r"); - else if (c < ' ' || c >= 0x7f) - fprintf(fp, "\\x%02x", c & 0xff); - else - fputc(c, fp); - } - fputc(quote, fp); - Py_END_ALLOW_THREADS - return 0; -} - -PyObject * -PyString_Repr(PyObject *obj, int smartquotes) -{ - register PyStringObject* op = (PyStringObject*) obj; - size_t newsize = 2 + 4 * Py_SIZE(op); - PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_SIZE(op)) { - PyErr_SetString(PyExc_OverflowError, - "string is too large to make repr"); - return NULL; - } - v = PyString_FromStringAndSize((char *)NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (smartquotes && - memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - p = PyString_AS_STRING(v); - *p++ = quote; - for (i = 0; i < Py_SIZE(op); i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyString_AS_STRING(v)) >= 5); - c = op->ob_sval[i]; - if (c == quote || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c < ' ' || c >= 0x7f) { - /* For performance, we don't want to call - PyOS_snprintf here (extra layers of - function call). */ - sprintf(p, "\\x%02x", c & 0xff); - p += 4; - } - else - *p++ = c; - } - assert(newsize - (p - PyString_AS_STRING(v)) >= 1); - *p++ = quote; - *p = '\0'; - _PyString_Resize( - &v, (p - PyString_AS_STRING(v))); - return v; - } -} - -static PyObject * -string_repr(PyObject *op) -{ - return PyString_Repr(op, 1); -} - -static PyObject * -string_str(PyObject *s) -{ - assert(PyString_Check(s)); - if (PyString_CheckExact(s)) { - Py_INCREF(s); - return s; - } - else { - /* Subtype -- return genuine string with the same value. */ - PyStringObject *t = (PyStringObject *) s; - return PyString_FromStringAndSize(t->ob_sval, Py_SIZE(t)); - } -} - -static Py_ssize_t -string_length(PyStringObject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -string_concat(register PyStringObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register PyStringObject *op; - if (!PyString_Check(bb)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(bb)) - return PyUnicode_Concat((PyObject *)a, bb); -#endif - if (PyBytes_Check(bb)) - return PyBytes_Concat((PyObject *)a, bb); - PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str' and '%.200s' objects", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyStringObject *)bb) - /* Optimize cases with empty left or right operand */ - if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyString_CheckExact(a) && PyString_CheckExact(b)) { - if (Py_SIZE(a) == 0) { - Py_INCREF(bb); - return bb; - } - Py_INCREF(a); - return (PyObject *)a; - } - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - Py_MEMCPY(op->ob_sval + Py_SIZE(a), b->ob_sval, Py_SIZE(b)); - op->ob_sval[size] = '\0'; - return (PyObject *) op; -#undef b -} - -static PyObject * -string_repeat(register PyStringObject *a, register Py_ssize_t n) -{ - register Py_ssize_t i; - register Py_ssize_t j; - register Py_ssize_t size; - register PyStringObject *op; - size_t nbytes; - if (n < 0) - n = 0; - /* watch out for overflows: the size can overflow int, - * and the # of bytes needed can overflow size_t - */ - size = Py_SIZE(a) * n; - if (n && size / n != Py_SIZE(a)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - if (size == Py_SIZE(a) && PyString_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - nbytes = (size_t)size; - if (nbytes + sizeof(PyStringObject) <= nbytes) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + nbytes); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - op->ob_sval[size] = '\0'; - if (Py_SIZE(a) == 1 && n > 0) { - memset(op->ob_sval, a->ob_sval[0] , n); - return (PyObject *) op; - } - i = 0; - if (i < size) { - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - i = Py_SIZE(a); - } - while (i < size) { - j = (i <= size-i) ? i : size-i; - Py_MEMCPY(op->ob_sval+i, op->ob_sval, j); - i += j; - } - return (PyObject *) op; -} - -/* String slice a[i:j] consists of characters a[i] ... a[j-1] */ - -static PyObject * -string_slice(register PyStringObject *a, register Py_ssize_t i, - register Py_ssize_t j) - /* j -- may be negative! */ -{ - if (i < 0) - i = 0; - if (j < 0) - j = 0; /* Avoid signed/unsigned bug in next line */ - if (j > Py_SIZE(a)) - j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) { - /* It's the same as a */ - Py_INCREF(a); - return (PyObject *)a; - } - if (j < i) - j = i; - return PyString_FromStringAndSize(a->ob_sval + i, j-i); -} - -static int -string_contains(PyObject *str_obj, PyObject *sub_obj) -{ - if (!PyString_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(sub_obj)) - return PyUnicode_Contains(str_obj, sub_obj); -#endif - if (!PyString_Check(sub_obj)) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, " - "not %.200s", Py_TYPE(sub_obj)->tp_name); - return -1; - } - } - - return stringlib_contains_obj(str_obj, sub_obj); -} - -static PyObject * -string_item(PyStringObject *a, register Py_ssize_t i) -{ - char pchar; - PyObject *v; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - pchar = a->ob_sval[i]; - v = (PyObject *)characters[pchar & UCHAR_MAX]; - if (v == NULL) - v = PyString_FromStringAndSize(&pchar, 1); - else { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(v); - } - return v; -} - -static PyObject* -string_richcompare(PyStringObject *a, PyStringObject *b, int op) -{ - int c; - Py_ssize_t len_a, len_b; - Py_ssize_t min_len; - PyObject *result; - - /* Make sure both arguments are strings. */ - if (!(PyString_Check(a) && PyString_Check(b))) { - result = Py_NotImplemented; - goto out; - } - if (a == b) { - switch (op) { - case Py_EQ:case Py_LE:case Py_GE: - result = Py_True; - goto out; - case Py_NE:case Py_LT:case Py_GT: - result = Py_False; - goto out; - } - } - if (op == Py_EQ) { - /* Supporting Py_NE here as well does not save - much time, since Py_NE is rarely used. */ - if (Py_SIZE(a) == Py_SIZE(b) - && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0)) { - result = Py_True; - } else { - result = Py_False; - } - goto out; - } - len_a = Py_SIZE(a); len_b = Py_SIZE(b); - min_len = (len_a < len_b) ? len_a : len_b; - if (min_len > 0) { - c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); - if (c==0) - c = memcmp(a->ob_sval, b->ob_sval, min_len); - } else - c = 0; - if (c == 0) - c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: assert(0); break; /* unreachable */ - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - out: - Py_INCREF(result); - return result; -} - -int -_PyString_Eq(PyObject *o1, PyObject *o2) -{ - PyStringObject *a = (PyStringObject*) o1; - PyStringObject *b = (PyStringObject*) o2; - return Py_SIZE(a) == Py_SIZE(b) - && *a->ob_sval == *b->ob_sval - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; -} - -static long -string_hash(PyStringObject *a) -{ - register Py_ssize_t len; - register unsigned char *p; - register long x; - - if (a->ob_shash != -1) - return a->ob_shash; - len = Py_SIZE(a); - p = (unsigned char *) a->ob_sval; - x = *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= Py_SIZE(a); - if (x == -1) - x = -2; - a->ob_shash = x; - return x; -} - -static PyObject* -string_subscript(PyStringObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyString_GET_SIZE(self); - return string_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - char* source_buf; - char* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyString_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyString_FromStringAndSize("", 0); - } - else if (start == 0 && step == 1 && - slicelength == PyString_GET_SIZE(self) && - PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else if (step == 1) { - return PyString_FromStringAndSize( - PyString_AS_STRING(self) + start, - slicelength); - } - else { - source_buf = PyString_AsString((PyObject*)self); - result_buf = (char *)PyMem_Malloc(slicelength); - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyString_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "string indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static Py_ssize_t -string_buffer_getreadbuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = (void *)self->ob_sval; - return Py_SIZE(self); -} - -static Py_ssize_t -string_buffer_getwritebuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "Cannot use string as modifiable buffer"); - return -1; -} - -static Py_ssize_t -string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = self->ob_sval; - return Py_SIZE(self); -} - -static int -string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags) -{ - return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self), - 0, flags); -} - -static PySequenceMethods string_as_sequence = { - (lenfunc)string_length, /*sq_length*/ - (binaryfunc)string_concat, /*sq_concat*/ - (ssizeargfunc)string_repeat, /*sq_repeat*/ - (ssizeargfunc)string_item, /*sq_item*/ - (ssizessizeargfunc)string_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - (objobjproc)string_contains /*sq_contains*/ -}; - -static PyMappingMethods string_as_mapping = { - (lenfunc)string_length, - (binaryfunc)string_subscript, - 0, -}; - -static PyBufferProcs string_as_buffer = { - (readbufferproc)string_buffer_getreadbuf, - (writebufferproc)string_buffer_getwritebuf, - (segcountproc)string_buffer_getsegcount, - (charbufferproc)string_buffer_getcharbuf, - (getbufferproc)string_buffer_getbuffer, - 0, /* XXX */ -}; - - - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - - -/* Don't call if length < 2 */ -#define Py_STRING_MATCH(target, offset, pattern, length) \ - (target[offset] == pattern[0] && \ - target[offset+length-1] == pattern[length-1] && \ - !memcmp(target+offset+1, pattern+1, length-2) ) - - -/* Overallocate the initial list to reduce the number of reallocs for small - split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three - resizes, to sizes 4, 8, then 16. Most observed string splits are for human - text (roughly 11 words per line) and field delimited data (usually 1-10 - fields). For large strings the split algorithms are bandwidth limited - so increasing the preallocation likely will not improve things.*/ - -#define MAX_PREALLOC 12 - -/* 5 splits gives 6 elements */ -#define PREALLOC_SIZE(maxsplit) \ - (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) - -#define SPLIT_APPEND(data, left, right) \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); - -#define SPLIT_ADD(data, left, right) { \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (count < MAX_PREALLOC) { \ - PyList_SET_ITEM(list, count, str); \ - } else { \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); \ - } \ - count++; } - -/* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SIZE(list) = count - -#define SKIP_SPACE(s, i, len) { while (i=0 && isspace(Py_CHARMASK(s[i]))) i--; } -#define RSKIP_NONSPACE(s, i) { while (i>=0 && !isspace(Py_CHARMASK(s[i]))) i--; } - -Py_LOCAL_INLINE(PyObject *) -split_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = 0; - - while (maxsplit-- > 0) { - SKIP_SPACE(s, i, len); - if (i==len) break; - j = i; i++; - SKIP_NONSPACE(s, i, len); - if (j == 0 && i == len && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, j, i); - } - - if (i < len) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to end of string */ - SKIP_SPACE(s, i, len); - if (i != len) - SPLIT_ADD(s, i, len); - } - FIX_PREALLOC_SIZE(list); - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -split_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = 0; - while ((j < len) && (maxcount-- > 0)) { - for(; j list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are removed\n\ -from the result."); - -static PyObject * -string_split(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s = PyString_AS_STRING(self), *sub; - PyObject *list, *str, *subobj = Py_None; -#ifdef USE_FAST - Py_ssize_t pos; -#endif - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return split_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return split_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - -#ifdef USE_FAST - i = j = 0; - while (maxsplit-- > 0) { - pos = fastsearch(s+i, len-i, sub, n, FAST_SEARCH); - if (pos < 0) - break; - j = i+pos; - SPLIT_ADD(s, i, j); - i = j + n; - } -#else - i = j = 0; - while ((j+n <= len) && (maxsplit-- > 0)) { - for (; j+n <= len; j++) { - if (Py_STRING_MATCH(s, j, sub, n)) { - SPLIT_ADD(s, i, j); - i = j = j + n; - break; - } - } - } -#endif - SPLIT_ADD(s, i, len); - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in S, and returns the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, returns S and two empty strings."); - -static PyObject * -string_partition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_partition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (tail, sep, head)\n\ -\n\ -Searches for the separator sep in S, starting at the end of S, and returns\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, returns two empty strings and S."); - -static PyObject * -string_rpartition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_rpartition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = len-1; - - while (maxsplit-- > 0) { - RSKIP_SPACE(s, i); - if (i<0) break; - j = i; i--; - RSKIP_NONSPACE(s, i); - if (j == len-1 && i < 0 && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, i + 1, j + 1); - } - if (i >= 0) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to beginning of string */ - RSKIP_SPACE(s, i); - if (i >= 0) - SPLIT_ADD(s, 0, i + 1); - - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = len - 1; - while ((i >= 0) && (maxcount-- > 0)) { - for (; i >= 0; i--) { - if (s[i] == ch) { - SPLIT_ADD(s, i + 1, j + 1); - j = i = i - 1; - break; - } - } - } - if (i < 0 && count == 0 && PyString_CheckExact(self)) { - /* ch not in self, so just use self as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - } - else if (j >= -1) { - SPLIT_ADD(s, 0, j + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string, starting at the end of the string and working\n\ -to the front. If maxsplit is given, at most maxsplit splits are\n\ -done. If sep is not specified or is None, any whitespace string\n\ -is a separator."); - -static PyObject * -string_rsplit(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s, *sub; - PyObject *list, *str, *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return rsplit_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return rsplit_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - - j = len; - i = j - n; - - s = PyString_AS_STRING(self); - while ( (i >= 0) && (maxsplit-- > 0) ) { - for (; i>=0; i--) { - if (Py_STRING_MATCH(s, i, sub, n)) { - SPLIT_ADD(s, i + n, j); - j = i; - i -= n; - break; - } - } - } - SPLIT_ADD(s, 0, j); - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - -onError: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(join__doc__, -"S.join(sequence) -> string\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."); - -static PyObject * -string_join(PyStringObject *self, PyObject *orig) -{ - char *sep = PyString_AS_STRING(self); - const Py_ssize_t seplen = PyString_GET_SIZE(self); - PyObject *res = NULL; - char *p; - Py_ssize_t seqlen = 0; - size_t sz = 0; - Py_ssize_t i; - PyObject *seq, *item; - - seq = PySequence_Fast(orig, ""); - if (seq == NULL) { - return NULL; - } - - seqlen = PySequence_Size(seq); - if (seqlen == 0) { - Py_DECREF(seq); - return PyString_FromString(""); - } - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyString_CheckExact(item) || PyUnicode_CheckExact(item)) { - Py_INCREF(item); - Py_DECREF(seq); - return item; - } - } - - /* There are at least two things to join, or else we have a subclass - * of the builtin types in the sequence. - * Do a pre-pass to figure out the total amount of space we'll - * need (sz), see whether any argument is absurd, and defer to - * the Unicode join if appropriate. - */ - for (i = 0; i < seqlen; i++) { - const size_t old_sz = sz; - item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyString_Check(item)){ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(item)) { - /* Defer to Unicode join. - * CAUTION: There's no gurantee that the - * original sequence can be iterated over - * again, so we must pass seq here. - */ - PyObject *result; - result = PyUnicode_Join((PyObject *)self, seq); - Py_DECREF(seq); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string," - " %.80s found", - i, Py_TYPE(item)->tp_name); - Py_DECREF(seq); - return NULL; - } - sz += PyString_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"); - Py_DECREF(seq); - return NULL; - } - } - - /* Allocate result space. */ - res = PyString_FromStringAndSize((char*)NULL, sz); - if (res == NULL) { - Py_DECREF(seq); - return NULL; - } - - /* Catenate everything. */ - p = PyString_AS_STRING(res); - for (i = 0; i < seqlen; ++i) { - size_t n; - item = PySequence_Fast_GET_ITEM(seq, i); - n = PyString_GET_SIZE(item); - Py_MEMCPY(p, PyString_AS_STRING(item), n); - p += n; - if (i < seqlen - 1) { - Py_MEMCPY(p, sep, seplen); - p += seplen; - } - } - - Py_DECREF(seq); - return res; -} - -PyObject * -_PyString_Join(PyObject *sep, PyObject *x) -{ - assert(sep != NULL && PyString_Check(sep)); - assert(x != NULL); - return string_join((PyStringObject *)sep, x); -} - -Py_LOCAL_INLINE(void) -string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len) -{ - if (*end > len) - *end = len; - else if (*end < 0) - *end += len; - if (*end < 0) - *end = 0; - if (*start < 0) - *start += len; - if (*start < 0) - *start = 0; -} - -Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyStringObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - const char *sub; - Py_ssize_t sub_len; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - PyObject *obj_start=Py_None, *obj_end=Py_None; - - if (!PyArg_ParseTuple(args, "O|OO:find/rfind/index/rindex", &subobj, - &obj_start, &obj_end)) - return -2; - /* To support None in "start" and "end" arguments, meaning - the same as if they were not passed. - */ - if (obj_start != Py_None) - if (!_PyEval_SliceIndex(obj_start, &start)) - return -2; - if (obj_end != Py_None) - if (!_PyEval_SliceIndex(obj_end, &end)) - return -2; - - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - sub_len = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Find( - (PyObject *)self, subobj, start, end, dir); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) - /* XXX - the "expected a character buffer object" is pretty - confusing for a non-expert. remap to something else ? */ - return -2; - - if (dir > 0) - return stringlib_find_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); - else - return stringlib_rfind_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); -} - - -PyDoc_STRVAR(find__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_find(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(index__doc__, -"S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -string_index(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_rfind(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -string_rindex(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self); - char *sep = PyString_AS_STRING(sepobj); - Py_ssize_t seplen = PyString_GET_SIZE(sepobj); - Py_ssize_t i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_strip(PyStringObject *self, int striptype) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyStringObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyString_Check(sep)) - return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep)) { - PyObject *uniself = PyUnicode_FromObject((PyObject *)self); - PyObject *res; - if (uniself==NULL) - return NULL; - res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, - striptype, sep); - Py_DECREF(uniself); - return res; - } -#endif - PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else - "%s arg must be None or str", -#endif - STRIPNAME(striptype)); - return NULL; - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_strip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_lstrip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_rstrip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -PyDoc_STRVAR(lower__doc__, -"S.lower() -> string\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */ -#ifndef _tolower -#define _tolower tolower -#endif - -static PyObject * -string_lower(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (isupper(c)) - s[i] = _tolower(c); - } - - return newobj; -} - -PyDoc_STRVAR(upper__doc__, -"S.upper() -> string\n\ -\n\ -Return a copy of the string S converted to uppercase."); - -#ifndef _toupper -#define _toupper toupper -#endif - -static PyObject * -string_upper(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (islower(c)) - s[i] = _toupper(c); - } - - return newobj; -} - -PyDoc_STRVAR(title__doc__, -"S.title() -> string\n\ -\n\ -Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -static PyObject* -string_title(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - int previous_is_cased = 0; - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - if (!previous_is_cased) - c = toupper(c); - previous_is_cased = 1; - } else if (isupper(c)) { - if (previous_is_cased) - c = tolower(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *s_new++ = c; - } - return newobj; -} - -PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> string\n\ -\n\ -Return a copy of the string S with only its first character\n\ -capitalized."); - -static PyObject * -string_capitalize(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) - *s_new = toupper(c); - else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) - *s_new = tolower(c); - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(count__doc__, -"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 interpreted\n\ -as in slice notation."); - -static PyObject * -string_count(PyStringObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyString_AS_STRING(self), *sub; - Py_ssize_t sub_len; - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - - if (!PyArg_ParseTuple(args, "O|O&O&:count", &sub_obj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; - - if (PyString_Check(sub_obj)) { - sub = PyString_AS_STRING(sub_obj); - sub_len = PyString_GET_SIZE(sub_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sub_obj)) { - Py_ssize_t count; - count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); - if (count == -1) - return NULL; - else - return PyInt_FromSsize_t(count); - } -#endif - else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) - return NULL; - - string_adjust_indices(&start, &end, PyString_GET_SIZE(self)); - - return PyInt_FromSsize_t( - stringlib_count(str + start, end - start, sub, sub_len) - ); -} - -PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> string\n\ -\n\ -Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."); - -static PyObject * -string_swapcase(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - *s_new = toupper(c); - } - else if (isupper(c)) { - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(translate__doc__, -"S.translate(table [,deletechars]) -> string\n\ -\n\ -Return a copy of the string S, where all characters occurring\n\ -in the optional argument deletechars are removed, and the\n\ -remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256."); - -static PyObject * -string_translate(PyStringObject *self, PyObject *args) -{ - register char *input, *output; - const char *table; - register Py_ssize_t i, c, changed = 0; - PyObject *input_obj = (PyObject*)self; - const char *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - PyObject *tableobj, *delobj = NULL; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (PyString_Check(tableobj)) { - table = PyString_AS_STRING(tableobj); - tablen = PyString_GET_SIZE(tableobj); - } - else if (tableobj == Py_None) { - table = NULL; - tablen = 256; - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(tableobj)) { - /* Unicode .translate() does not support the deletechars - parameter; instead a mapping to None will cause characters - to be deleted. */ - if (delobj != NULL) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } - return PyUnicode_Translate((PyObject *)self, tableobj, NULL); - } -#endif - else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) - return NULL; - - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - if (delobj != NULL) { - if (PyString_Check(delobj)) { - del_table = PyString_AS_STRING(delobj); - dellen = PyString_GET_SIZE(delobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(delobj)) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } -#endif - else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) - return NULL; - } - else { - del_table = NULL; - dellen = 0; - } - - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AS_STRING(input_obj); - - if (dellen == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed || !PyString_CheckExact(input_obj)) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed && PyString_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - _PyString_Resize(&result, output - output_start); - return result; -} - - -#define FORWARD 1 -#define REVERSE -1 - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - -/* String ops must return a string. */ -/* If the object is subclass of string, create a copy */ -Py_LOCAL(PyStringObject *) -return_self(PyStringObject *self) -{ - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return self; - } - return (PyStringObject *)PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, int target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - -Py_LOCAL(Py_ssize_t) -findstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings always match at the first attempt */ - if (pattern_len == 0) - return (direction > 0) ? start : end; - - end -= pattern_len; - - if (direction < 0) { - for (; end >= start; end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) - return end; - } else { - for (; start <= end; start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) - return start; - } - return -1; -} - -Py_LOCAL_INLINE(Py_ssize_t) -countstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings match everywhere */ - if (pattern_len == 0 || maxcount == 0) { - if (target_len+1 < maxcount) - return target_len+1; - return maxcount; - } - - end -= pattern_len; - if (direction < 0) { - for (; (end >= start); end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) break; - end -= pattern_len-1; - } - } else { - for (; (start <= end); start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) - break; - start += pattern_len-1; - } - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_interleave(PyStringObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyString_AS_STRING(self); - result_s = PyString_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_delete_single_character(PyStringObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyStringObject *) -replace_delete_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, 1, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character_in_place(PyStringObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyStringObject *result; - - /* The result string will be the same size */ - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring_in_place(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyStringObject *result; - - /* The result string will be the same size */ - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - offset = findstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD); - if (offset == -1) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character(PyStringObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyStringObject *) -replace(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyString_GET_SIZE(self) == 0) { - /* nothing to do; return the original string */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original string */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' string everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self string to generate a non-empty string */ - /* Special case so the remaining code always gets a non-empty string */ - if (PyString_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' string */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both strings have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - -PyDoc_STRVAR(replace__doc__, -"S.replace (old, new[, count]) -> string\n\ -\n\ -Return a copy of string S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -string_replace(PyStringObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to; - const char *from_s, *to_s; - Py_ssize_t from_len, to_len; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (PyString_Check(from)) { - from_s = PyString_AS_STRING(from); - from_len = PyString_GET_SIZE(from); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(from)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) - return NULL; - - if (PyString_Check(to)) { - to_s = PyString_AS_STRING(to); - to_len = PyString_GET_SIZE(to); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(to)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) - return NULL; - - return (PyObject *)replace((PyStringObject *) self, - from_s, from_len, - to_s, to_len, count); -} - -/** End DALKE **/ - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyString_GET_SIZE(self); - Py_ssize_t slen; - const char* sub; - const char* str; - - if (PyString_Check(substr)) { - sub = PyString_AS_STRING(substr); - slen = PyString_GET_SIZE(substr); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(substr)) - return PyUnicode_Tailmatch((PyObject *)self, - substr, start, end, direction); -#endif - else if (PyObject_AsCharBuffer(substr, &sub, &slen)) - return -1; - str = PyString_AS_STRING(self); - - string_adjust_indices(&start, &end, len); - - if (direction < 0) { - /* startswith */ - if (start+slen > len) - return 0; - } else { - /* endswith */ - if (end-start < slen || start > len) - return 0; - - if (end-slen > start) - start = end - slen; - } - if (end-start >= slen) - return ! memcmp(str+start, sub, slen); - return 0; -} - - -PyDoc_STRVAR(startswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -string_startswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, -1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -string_endswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, +1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[,errors]]) -> object\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeEncodeErrors."); - -static PyObject * -string_encode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) - return NULL; - v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(decode__doc__, -"S.decode([encoding[,errors]]) -> object\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registerd with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -string_decode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) - return NULL; - v = PyString_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> string\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."); - -static PyObject* -string_expandtabs(PyStringObject *self, PyObject *args) -{ - const char *e, *p, *qe; - char *q; - Py_ssize_t i, j, incr; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */ - for (p = PyString_AS_STRING(self); p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = PyString_FromStringAndSize(NULL, i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = PyString_AS_STRING(u); /* next output char */ - qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */ - - for (p = PyString_AS_STRING(self); 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; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - - return u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - - u = PyString_FromStringAndSize(NULL, - left + PyString_GET_SIZE(self) + right); - if (u) { - if (left) - memset(PyString_AS_STRING(u), fill, left); - Py_MEMCPY(PyString_AS_STRING(u) + left, - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); - if (right) - memset(PyString_AS_STRING(u) + left + PyString_GET_SIZE(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> string\n" -"\n" -"Return S left justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -string_ljust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, 0, width - PyString_GET_SIZE(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> string\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)"); - -static PyObject * -string_rjust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, width - PyString_GET_SIZE(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> string\n" -"\n" -"Return S centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_center(PyStringObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - PyString_GET_SIZE(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> string\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."); - -static PyObject * -string_zfill(PyStringObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (PyString_GET_SIZE(self) >= width) { - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self) - ); - } - - fill = width - PyString_GET_SIZE(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = PyString_AS_STRING(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} - -PyDoc_STRVAR(isspace__doc__, -"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."); - -static PyObject* -string_isspace(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isspace(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isspace(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalpha__doc__, -"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."); - -static PyObject* -string_isalpha(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalpha(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalpha(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalnum__doc__, -"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."); - -static PyObject* -string_isalnum(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalnum(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalnum(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isdigit__doc__, -"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."); - -static PyObject* -string_isdigit(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isdigit(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isdigit(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(islower__doc__, -"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."); - -static PyObject* -string_islower(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(islower(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (isupper(*p)) - return PyBool_FromLong(0); - else if (!cased && islower(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(isupper__doc__, -"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."); - -static PyObject* -string_isupper(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (islower(*p)) - return PyBool_FromLong(0); - else if (!cased && isupper(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(istitle__doc__, -"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. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -static PyObject* -string_istitle(PyStringObject *self, PyObject *uncased) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (isupper(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (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(splitlines__doc__, -"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\ -is given and true."); - -static PyObject* -string_splitlines(PyStringObject *self, PyObject *args) -{ - register Py_ssize_t i; - register Py_ssize_t j; - Py_ssize_t len; - int keepends = 0; - PyObject *list; - PyObject *str; - char *data; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - data = PyString_AS_STRING(self); - len = PyString_GET_SIZE(self); - - /* This does not use the preallocated list because splitlines is - usually run with hundreds of newlines. The overhead of - switching between PyList_SET_ITEM and append causes about a - 2-3% slowdown for that common case. A smarter implementation - could move the if check out, so the SET_ITEMs are done first - and the appends only done when the prealloc buffer is full. - That's too much work for little gain.*/ - - list = PyList_New(0); - if (!list) - goto onError; - - for (i = j = 0; i < len; ) { - Py_ssize_t eol; - - /* Find a line and append it */ - while (i < len && data[i] != '\n' && data[i] != '\r') - 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); - } - - return list; - - onError: - Py_XDECREF(list); - return NULL; -} - -PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in bytes"); - -static PyObject * -string_sizeof(PyStringObject *v) -{ - Py_ssize_t res; - res = sizeof(PyStringObject) + v->ob_size * v->ob_type->tp_itemsize; - return PyInt_FromSsize_t(res); -} - -#undef SPLIT_APPEND -#undef SPLIT_ADD -#undef MAX_PREALLOC -#undef PREALLOC_SIZE - -static PyObject * -string_getnewargs(PyStringObject *v) -{ - return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); -} - - -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> unicode\n\ -\n\ -"); - -PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> unicode\n\ -\n\ -"); - - -static PyMethodDef -string_methods[] = { - /* Counterparts of the obsolete stropmodule functions; except - string.maketrans(). */ - {"join", (PyCFunction)string_join, METH_O, join__doc__}, - {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, - {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, - {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, - {"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__}, - {"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__}, - {"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__}, - {"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__}, - {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, - {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, - capitalize__doc__}, - {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, - {"endswith", (PyCFunction)string_endswith, METH_VARARGS, - endswith__doc__}, - {"partition", (PyCFunction)string_partition, METH_O, partition__doc__}, - {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, - {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, - {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, - {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, - {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, - {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction)string_rpartition, METH_O, - rpartition__doc__}, - {"startswith", (PyCFunction)string_startswith, METH_VARARGS, - startswith__doc__}, - {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, - swapcase__doc__}, - {"translate", (PyCFunction)string_translate, METH_VARARGS, - translate__doc__}, - {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, - {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, - {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, - {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, - {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) string__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, - {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, - {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, - splitlines__doc__}, - {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, - sizeof__doc__}, - {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"object", 0}; - - if (type != &PyString_Type) - return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) - return NULL; - if (x == NULL) - return PyString_FromString(""); - return PyObject_Str(x); -} - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyString_Type)); - tmp = string_new(&PyString_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyString_CheckExact(tmp)); - n = PyString_GET_SIZE(tmp); - pnew = type->tp_alloc(type, n); - if (pnew != NULL) { - Py_MEMCPY(PyString_AS_STRING(pnew), PyString_AS_STRING(tmp), n+1); - ((PyStringObject *)pnew)->ob_shash = - ((PyStringObject *)tmp)->ob_shash; - ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; - } - Py_DECREF(tmp); - return pnew; -} - -static PyObject * -basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, - "The basestring type cannot be instantiated"); - return NULL; -} - -static PyObject * -string_mod(PyObject *v, PyObject *w) -{ - if (!PyString_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyString_Format(v, w); -} - -PyDoc_STRVAR(basestring_doc, -"Type basestring cannot be instantiated; it is the base for str and unicode."); - -static PyNumberMethods string_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - string_mod, /*nb_remainder*/ -}; - - -PyTypeObject PyBaseString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "basestring", - 0, - 0, - 0, /* 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 | Py_TPFLAGS_BASETYPE, /* tp_flags */ - basestring_doc, /* 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 */ - 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 */ - basestring_new, /* tp_new */ - 0, /* tp_free */ -}; - -PyDoc_STRVAR(string_doc, -"str(object) -> string\n\ -\n\ -Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."); - -PyTypeObject PyString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", - sizeof(PyStringObject), - sizeof(char), - string_dealloc, /* tp_dealloc */ - (printfunc)string_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - string_repr, /* tp_repr */ - &string_as_number, /* tp_as_number */ - &string_as_sequence, /* tp_as_sequence */ - &string_as_mapping, /* tp_as_mapping */ - (hashfunc)string_hash, /* tp_hash */ - 0, /* tp_call */ - string_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - string_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)string_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - string_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - string_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -void -PyString_Concat(register PyObject **pv, register PyObject *w) -{ - register PyObject *v; - if (*pv == NULL) - return; - if (w == NULL || !PyString_Check(*pv)) { - Py_DECREF(*pv); - *pv = NULL; - return; - } - v = string_concat((PyStringObject *) *pv, w); - Py_DECREF(*pv); - *pv = v; -} - -void -PyString_ConcatAndDel(register PyObject **pv, register PyObject *w) -{ - PyString_Concat(pv, w); - Py_XDECREF(w); -} - - -/* The following function breaks the notion that strings are immutable: - it changes the size of a string. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new string object and destroying the old one, only - more efficiently. In any case, don't use this if the string may - already be known to some other part of the code... - Note that if there's not enough memory to resize the string, the original - string object at *pv is deallocated, *pv is set to NULL, an "out of - memory" exception is set, and -1 is returned. Else (on success) 0 is - returned, and the value in *pv may or may not be the same as on input. - As always, an extra byte is allocated for a trailing \0 byte (newsize - does *not* include that), and a trailing \0 byte is stored. -*/ - -int -_PyString_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyObject *v; - register PyStringObject *sv; - v = *pv; - if (!PyString_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyString_CHECK_INTERNED(v)) { - *pv = 0; - Py_DECREF(v); - PyErr_BadInternalCall(); - return -1; - } - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference(v); - *pv = (PyObject *) - PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize); - if (*pv == NULL) { - PyObject_Del(v); - PyErr_NoMemory(); - return -1; - } - _Py_NewReference(*pv); - sv = (PyStringObject *) *pv; - Py_SIZE(sv) = newsize; - sv->ob_sval[newsize] = '\0'; - sv->ob_shash = -1; /* invalidate cached hash value */ - return 0; -} - -/* Helpers for formatstring */ - -Py_LOCAL_INLINE(PyObject *) -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -Py_LOCAL_INLINE(int) -formatfloat(char *buf, 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)*/ - char fmt[20]; - double x; - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "float argument required, " - "not %.200s", Py_TYPE(v)->tp_name); - return -1; - } - if (prec < 0) - prec = 6; - if (type == 'f' && fabs(x)/1e25 >= 1e25) - 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 - - 'f' formats: - 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; - } - PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); - PyOS_ascii_formatd(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -/* _PyString_FormatLong emulates the format codes d, u, o, x and X, and - * the F_ALT flag, for Python's long (unbounded) ints. It's not used for - * Python's regular ints. - * Return value: a new PyString*, or NULL if error. - * . *pbuf is set to point into it, - * *plen set to the # of chars following that. - * Caller must decref it when done using pbuf. - * The string starting at *pbuf is of the form - * "-"? ("0x" | "0X")? digit+ - * "0x"/"0X" are present only for x and X conversions, with F_ALT - * set in flags. The case of hex digits will be correct, - * There will be at least prec digits, zero-filled on the left if - * necessary to get that many. - * val object to be converted - * flags bitmask of format flags; only F_ALT is looked at - * prec minimum number of digits; 0-fill on left if needed - * type a character in [duoxX]; u acts the same as d - * - * CAUTION: o, x and X conversions on regular ints can never - * produce a '-' sign, but can for Python's unbounded ints. - */ -PyObject* -_PyString_FormatLong(PyObject *val, int flags, int prec, int type, - char **pbuf, int *plen) -{ - PyObject *result = NULL; - char *buf; - Py_ssize_t i; - int sign; /* 1 if '-', else 0 */ - int len; /* number of characters */ - Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; - - switch (type) { - case 'd': - case 'u': - result = Py_TYPE(val)->tp_str(val); - break; - case 'o': - result = Py_TYPE(val)->tp_as_number->nb_oct(val); - break; - case 'x': - case 'X': - numnondigits = 2; - result = Py_TYPE(val)->tp_as_number->nb_hex(val); - break; - default: - assert(!"'type' not in [duoxX]"); - } - if (!result) - return NULL; - - buf = PyString_AsString(result); - if (!buf) { - Py_DECREF(result); - return NULL; - } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyString_Size(result); - if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); - return NULL; - } - len = (int)llen; - if (buf[len-1] == 'L') { - --len; - buf[len] = '\0'; - } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); - skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); - } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyString_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); - return NULL; - } - b1 = PyString_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; - for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyString_AS_STRING(result); - len = numnondigits + prec; - } - - /* Fix up case for hex conversions. */ - if (type == 'X') { - /* Need to convert all lower case letters to upper case. - and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') - buf[i] -= 'a'-'A'; - } - *pbuf = buf; - *plen = len; - return result; -} - -Py_LOCAL_INLINE(int) -formatint(char *buf, 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) - + 1 + 1 = 24 */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", - Py_TYPE(v)->tp_name); - return -1; - } - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - 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 - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in unicodeobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - if (sign[0]) - PyOS_snprintf(buf, buflen, fmt, -x); - else - PyOS_snprintf(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -Py_LOCAL_INLINE(int) -formatchar(char *buf, size_t buflen, PyObject *v) -{ - /* presume that the buffer is at least 2 characters long */ - if (PyString_Check(v)) { - if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) - return -1; - } - else { - if (!PyArg_Parse(v, "b;%c requires int or char", &buf[0])) - return -1; - } - buf[1] = '\0'; - return 1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the floats, ints, & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject * -PyString_Format(PyObject *format, PyObject *args) -{ - char *fmt, *res; - Py_ssize_t arglen, argidx; - Py_ssize_t reslen, rescnt, fmtcnt; - int args_owned = 0; - PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE - PyObject *v, *w; -#endif - PyObject *dict = NULL; - if (format == NULL || !PyString_Check(format) || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - orig_args = args; - fmt = PyString_AS_STRING(format); - fmtcnt = PyString_GET_SIZE(format); - reslen = rescnt = fmtcnt + 100; - result = PyString_FromStringAndSize((char *)NULL, reslen); - if (result == NULL) - return NULL; - res = PyString_AsString(result); - if (PyTuple_Check(args)) { - arglen = PyTuple_GET_SIZE(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyString_Resize(&result, reslen) < 0) - return NULL; - res = PyString_AS_STRING(result) - + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - int c = '\0'; - int fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; - int sign; - Py_ssize_t len; - char formatbuf[FORMATBUFLEN]; - /* For format{float,int,char}() */ -#ifdef Py_USING_UNICODE - char *fmt_start = fmt; - Py_ssize_t argidx_start = argidx; -#endif - - fmt++; - if (*fmt == '(') { - char *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto error; - } - ++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 error; - } - key = PyString_FromStringAndSize(keystart, - keylen); - if (key == NULL) - goto error; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto error; - } - width = PyInt_AsLong(v); - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - width = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((width*10) / 10 != width) { - PyErr_SetString( - PyExc_ValueError, - "width too big"); - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString( - PyExc_TypeError, - "* wants int"); - goto error; - } - prec = PyInt_AsLong(v); - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((prec*10) / 10 != prec) { - PyErr_SetString( - PyExc_ValueError, - "prec too big"); - goto error; - } - 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 error; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - } - sign = 0; - fill = ' '; - switch (c) { - case '%': - pbuf = "%"; - len = 1; - break; - case 's': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE - if (temp != NULL && PyUnicode_Check(temp)) { - Py_DECREF(temp); - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - /* Fall through */ - case 'r': - if (c == 'r') - temp = PyObject_Repr(v); - if (temp == NULL) - goto error; - if (!PyString_Check(temp)) { - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - Py_DECREF(temp); - goto error; - } - pbuf = PyString_AS_STRING(temp); - len = PyString_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 (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, - sizeof(formatbuf), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto error; - sign = 1; - } - else if (PyLong_Check(iobj)) { - int ilen; - - isnumok = 1; - temp = _PyString_FormatLong(iobj, flags, - prec, c, &pbuf, &ilen); - Py_DECREF(iobj); - len = ilen; - if (!temp) - goto error; - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", c, Py_TYPE(v)->tp_name); - goto error; - } - 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), - flags, prec, c, v); - if (len < 0) - goto error; - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - case 'c': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf), v); - if (len < 0) - goto error; - break; - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - c, c, - (Py_ssize_t)(fmt - 1 - - PyString_AsString(format))); - goto error; - } - 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_DECREF(result); - Py_XDECREF(temp); - return PyErr_NoMemory(); - } - if (_PyString_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - return NULL; - } - res = PyString_AS_STRING(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - 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')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_MEMCPY(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 error; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto error; - } - if (args_owned) { - Py_DECREF(args); - } - _PyString_Resize(&result, reslen - rescnt); - return result; - -#ifdef Py_USING_UNICODE - unicode: - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - /* Fiddle args right (remove the first argidx arguments) */ - if (PyTuple_Check(orig_args) && argidx > 0) { - PyObject *v; - Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx; - v = PyTuple_New(n); - if (v == NULL) - goto error; - while (--n >= 0) { - PyObject *w = PyTuple_GET_ITEM(orig_args, n + argidx); - Py_INCREF(w); - PyTuple_SET_ITEM(v, n, w); - } - args = v; - } else { - Py_INCREF(orig_args); - args = orig_args; - } - args_owned = 1; - /* Take what we have of the result and let the Unicode formatting - function format the rest of the input. */ - rescnt = res - PyString_AS_STRING(result); - if (_PyString_Resize(&result, rescnt)) - goto error; - fmtcnt = PyString_GET_SIZE(format) - \ - (fmt - PyString_AS_STRING(format)); - format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); - if (format == NULL) - goto error; - v = PyUnicode_Format(format, args); - Py_DECREF(format); - if (v == NULL) - goto error; - /* Paste what we have (result) to what the Unicode formatting - function returned (v) and return the result (or error) */ - w = PyUnicode_Concat(result, v); - Py_DECREF(result); - Py_DECREF(v); - Py_DECREF(args); - return w; -#endif /* Py_USING_UNICODE */ - - error: - Py_DECREF(result); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -void -PyString_InternInPlace(PyObject **p) -{ - register PyStringObject *s = (PyStringObject *)(*p); - PyObject *t; - if (s == NULL || !PyString_Check(s)) - Py_FatalError("PyString_InternInPlace: strings only please!"); - /* If it's a string subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyString_CheckExact(s)) - return; - if (PyString_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - t = PyDict_GetItem(interned, (PyObject *)s); - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - return; - } - /* The two references in interned are not counted by refcnt. - The string deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; -} - -void -PyString_InternImmortal(PyObject **p) -{ - PyString_InternInPlace(p); - if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } -} - - -PyObject * -PyString_InternFromString(const char *cp) -{ - PyObject *s = PyString_FromString(cp); - if (s == NULL) - return NULL; - PyString_InternInPlace(&s); - return s; -} - -void -PyString_Fini(void) -{ - int i; - for (i = 0; i < UCHAR_MAX + 1; i++) { - Py_XDECREF(characters[i]); - characters[i] = NULL; - } - Py_XDECREF(nullstring); - nullstring = NULL; -} - -void _Py_ReleaseInternedStrings(void) -{ - PyObject *keys; - PyStringObject *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_ReleaseInternedStrings() is intended to help a leak - detector, interned 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 = (PyStringObject *) PyList_GET_ITEM(keys, i); - switch (s->ob_sstate) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += Py_SIZE(s); - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += Py_SIZE(s); - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->ob_sstate = 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; -} Modified: python/branches/okkoto-sizeof/Objects/structseq.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/structseq.c (original) +++ python/branches/okkoto-sizeof/Objects/structseq.c Wed Jun 4 11:24:23 2008 @@ -270,7 +270,7 @@ Py_DECREF(tup); return NULL; } - crepr = PyString_AsString(repr); + crepr = PyBytes_AsString(repr); if (crepr == NULL) { Py_DECREF(tup); Py_DECREF(repr); @@ -306,7 +306,7 @@ *pbuf++ = ')'; *pbuf = '\0'; - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * Modified: python/branches/okkoto-sizeof/Objects/tupleobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/tupleobject.c (original) +++ python/branches/okkoto-sizeof/Objects/tupleobject.c Wed Jun 4 11:24:23 2008 @@ -218,7 +218,7 @@ n = Py_SIZE(v); if (n == 0) - return PyString_FromString("()"); + return PyBytes_FromString("()"); /* While not mutable, it is still possible to end up with a cycle in a tuple through an object that stores itself within a tuple (and thus @@ -226,7 +226,7 @@ possible within a type. */ i = Py_ReprEnter((PyObject *)v); if (i != 0) { - return i > 0 ? PyString_FromString("(...)") : NULL; + return i > 0 ? PyBytes_FromString("(...)") : NULL; } pieces = PyTuple_New(n); @@ -246,29 +246,29 @@ /* Add "()" decorations to the first and last items. */ assert(n > 0); - s = PyString_FromString("("); + s = PyBytes_FromString("("); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); + PyBytes_ConcatAndDel(&s, temp); PyTuple_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyString_FromString(n == 1 ? ",)" : ")"); + s = PyBytes_FromString(n == 1 ? ",)" : ")"); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, n-1); - PyString_ConcatAndDel(&temp, s); + PyBytes_ConcatAndDel(&temp, s); PyTuple_SET_ITEM(pieces, n-1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); + s = PyBytes_FromString(", "); if (s == NULL) goto Done; - result = _PyString_Join(s, pieces); + result = _PyBytes_Join(s, pieces); Py_DECREF(s); Done: Modified: python/branches/okkoto-sizeof/Objects/typeobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/typeobject.c (original) +++ python/branches/okkoto-sizeof/Objects/typeobject.c Wed Jun 4 11:24:23 2008 @@ -19,10 +19,10 @@ >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ - ((PyStringObject *)(name))->ob_shash) + ((PyBytesObject *)(name))->ob_shash) #define MCACHE_CACHEABLE_NAME(name) \ - PyString_CheckExact(name) && \ - PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE + PyBytes_CheckExact(name) && \ + PyBytes_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { unsigned int version; @@ -32,7 +32,6 @@ static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]; static unsigned int next_version_tag = 0; -static void type_modified(PyTypeObject *); unsigned int PyType_ClearCache(void) @@ -47,12 +46,12 @@ } next_version_tag = 0; /* mark all version tags as invalid */ - type_modified(&PyBaseObject_Type); + PyType_Modified(&PyBaseObject_Type); return cur_version_tag; } -static void -type_modified(PyTypeObject *type) +void +PyType_Modified(PyTypeObject *type) { /* Invalidate any cached data for the specified type and all subclasses. This function is called after the base @@ -86,7 +85,7 @@ ref = PyList_GET_ITEM(raw, i); ref = PyWeakref_GET_OBJECT(ref); if (ref != Py_None) { - type_modified((PyTypeObject *)ref); + PyType_Modified((PyTypeObject *)ref); } } } @@ -172,7 +171,7 @@ Py_INCREF(Py_None); } /* mark all version tags as invalid */ - type_modified(&PyBaseObject_Type); + PyType_Modified(&PyBaseObject_Type); return 1; } bases = type->tp_bases; @@ -218,7 +217,7 @@ s = type->tp_name; else s++; - return PyString_FromString(s); + return PyBytes_FromString(s); } } @@ -237,14 +236,14 @@ "can't delete %s.__name__", type->tp_name); return -1; } - if (!PyString_Check(value)) { + if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "can only assign string to %s.__name__, not '%s'", type->tp_name, Py_TYPE(value)->tp_name); return -1; } - if (strlen(PyString_AS_STRING(value)) - != (size_t)PyString_GET_SIZE(value)) { + if (strlen(PyBytes_AS_STRING(value)) + != (size_t)PyBytes_GET_SIZE(value)) { PyErr_Format(PyExc_ValueError, "__name__ must not contain null bytes"); return -1; @@ -257,7 +256,7 @@ Py_DECREF(et->ht_name); et->ht_name = value; - type->tp_name = PyString_AS_STRING(value); + type->tp_name = PyBytes_AS_STRING(value); return 0; } @@ -280,9 +279,9 @@ else { s = strrchr(type->tp_name, '.'); if (s != NULL) - return PyString_FromStringAndSize( + return PyBytes_FromStringAndSize( type->tp_name, (Py_ssize_t)(s - type->tp_name)); - return PyString_FromString("__builtin__"); + return PyBytes_FromString("__builtin__"); } } @@ -300,7 +299,7 @@ return -1; } - type_modified(type); + PyType_Modified(type); return PyDict_SetItemString(type->tp_dict, "__module__", value); } @@ -328,7 +327,7 @@ int res = PyDict_SetItemString(type->tp_dict, "__abstractmethods__", value); if (res == 0) { - type_modified(type); + PyType_Modified(type); if (value && PyObject_IsTrue(value)) { type->tp_flags |= Py_TPFLAGS_IS_ABSTRACT; } @@ -556,7 +555,7 @@ { PyObject *result; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) - return PyString_FromString(type->tp_doc); + return PyBytes_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); if (result == NULL) { result = Py_None; @@ -645,7 +644,7 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyString_Check(mod)) { + else if (!PyBytes_Check(mod)) { Py_DECREF(mod); mod = NULL; } @@ -658,14 +657,14 @@ else kind = "type"; - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) { - rtn = PyString_FromFormat("<%s '%s.%s'>", + if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) { + rtn = PyBytes_FromFormat("<%s '%s.%s'>", kind, - PyString_AS_STRING(mod), - PyString_AS_STRING(name)); + PyBytes_AS_STRING(mod), + PyBytes_AS_STRING(name)); } else - rtn = PyString_FromFormat("<%s '%s'>", kind, type->tp_name); + rtn = PyBytes_FromFormat("<%s '%s'>", kind, type->tp_name); Py_XDECREF(mod); Py_DECREF(name); @@ -1137,7 +1136,7 @@ PyObject *res; if (*attrobj == NULL) { - *attrobj = PyString_InternFromString(attrstr); + *attrobj = PyBytes_InternFromString(attrstr); if (*attrobj == NULL) return NULL; } @@ -1329,7 +1328,7 @@ } if (name == NULL) return NULL; - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { Py_DECREF(name); return NULL; } @@ -1351,7 +1350,7 @@ o = class_name(o); PyErr_Format(PyExc_TypeError, "duplicate base class %s", - o ? PyString_AS_STRING(o) : "?"); + o ? PyBytes_AS_STRING(o) : "?"); Py_XDECREF(o); return -1; } @@ -1397,7 +1396,7 @@ while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { PyObject *name = class_name(k); off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", - name ? PyString_AS_STRING(name) : "?"); + name ? PyBytes_AS_STRING(name) : "?"); Py_XDECREF(name); if (--n && (size_t)(off+1) < sizeof(buf)) { buf[off++] = ','; @@ -1621,7 +1620,7 @@ from the custom MRO */ type_mro_modified(type, type->tp_bases); - type_modified(type); + PyType_Modified(type); return 0; } @@ -1750,7 +1749,7 @@ PyObject *descr; if (dict_str == NULL) { - dict_str = PyString_InternFromString("__dict__"); + dict_str = PyBytes_InternFromString("__dict__"); if (dict_str == NULL) return NULL; } @@ -1899,14 +1898,14 @@ unsigned char *p; Py_ssize_t i, n; - if (!PyString_Check(s)) { + if (!PyBytes_Check(s)) { PyErr_Format(PyExc_TypeError, "__slots__ items must be strings, not '%.200s'", Py_TYPE(s)->tp_name); return 0; } - p = (unsigned char *) PyString_AS_STRING(s); - n = PyString_GET_SIZE(s); + p = (unsigned char *) PyBytes_AS_STRING(s); + n = PyBytes_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the length to 1 so that the loop will balk on the trailing \0. */ if (n == 0) @@ -2108,7 +2107,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyString_Check(slots) || PyUnicode_Check(slots)) + if (PyBytes_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); @@ -2146,8 +2145,8 @@ char *s; if (!valid_identifier(tmp)) goto bad_slots; - assert(PyString_Check(tmp)); - s = PyString_AS_STRING(tmp); + assert(PyBytes_Check(tmp)); + s = PyBytes_AS_STRING(tmp); if (strcmp(s, "__dict__") == 0) { if (!may_add_dict || add_dict) { PyErr_SetString(PyExc_TypeError, @@ -2179,7 +2178,7 @@ for (i = j = 0; i < nslots; i++) { char *s; tmp = PyTuple_GET_ITEM(slots, i); - s = PyString_AS_STRING(tmp); + s = PyBytes_AS_STRING(tmp); if ((add_dict && strcmp(s, "__dict__") == 0) || (add_weak && strcmp(s, "__weakref__") == 0)) continue; @@ -2272,7 +2271,7 @@ type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; - type->tp_name = PyString_AS_STRING(name); + type->tp_name = PyBytes_AS_STRING(name); /* Set tp_base and tp_bases */ type->tp_bases = bases; @@ -2305,14 +2304,14 @@ */ { PyObject *doc = PyDict_GetItemString(dict, "__doc__"); - if (doc != NULL && PyString_Check(doc)) { - const size_t n = (size_t)PyString_GET_SIZE(doc); + if (doc != NULL && PyBytes_Check(doc)) { + const size_t n = (size_t)PyBytes_GET_SIZE(doc); char *tp_doc = (char *)PyObject_MALLOC(n+1); if (tp_doc == NULL) { Py_DECREF(type); return NULL; } - memcpy(tp_doc, PyString_AS_STRING(doc), n+1); + memcpy(tp_doc, PyBytes_AS_STRING(doc), n+1); type->tp_doc = tp_doc; } } @@ -2335,7 +2334,7 @@ slotoffset = base->tp_basicsize; if (slots != NULL) { for (i = 0; i < nslots; i++, mp++) { - mp->name = PyString_AS_STRING( + mp->name = PyBytes_AS_STRING( PyTuple_GET_ITEM(slots, i)); mp->type = T_OBJECT_EX; mp->offset = slotoffset; @@ -2536,7 +2535,7 @@ /* Give up */ PyErr_Format(PyExc_AttributeError, "type object '%.50s' has no attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); + type->tp_name, PyBytes_AS_STRING(name)); return NULL; } @@ -2855,7 +2854,7 @@ if (sorted_methods == NULL) goto error; if (comma == NULL) { - comma = PyString_InternFromString(", "); + comma = PyBytes_InternFromString(", "); if (comma == NULL) goto error; } @@ -2863,7 +2862,7 @@ "O", sorted_methods); if (joined == NULL) goto error; - joined_str = PyString_AsString(joined); + joined_str = PyBytes_AsString(joined); if (joined_str == NULL) goto error; @@ -2897,20 +2896,20 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyString_Check(mod)) { + else if (!PyBytes_Check(mod)) { Py_DECREF(mod); mod = NULL; } name = type_name(type, NULL); if (name == NULL) return NULL; - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) - rtn = PyString_FromFormat("<%s.%s object at %p>", - PyString_AS_STRING(mod), - PyString_AS_STRING(name), + if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) + rtn = PyBytes_FromFormat("<%s.%s object at %p>", + PyBytes_AS_STRING(mod), + PyBytes_AS_STRING(name), self); else - rtn = PyString_FromFormat("<%s object at %p>", + rtn = PyBytes_FromFormat("<%s object at %p>", type->tp_name, self); Py_XDECREF(mod); Py_DECREF(name); @@ -3058,7 +3057,7 @@ /* Stuff to implement __reduce_ex__ for pickle protocols >= 2. - We fall back to helpers in copyreg for: + We fall back to helpers in copy_reg for: - pickle protocols < 2 - calculating the list of slot names (done only once per class) - the __newobj__ function (which is used as a token but never called) @@ -3070,7 +3069,7 @@ static PyObject *copyreg_str; if (!copyreg_str) { - copyreg_str = PyString_InternFromString("copyreg"); + copyreg_str = PyBytes_InternFromString("copy_reg"); if (copyreg_str == NULL) return NULL; } @@ -3376,7 +3375,7 @@ return NULL; if (PyUnicode_Check(format_spec)) { self_as_str = PyObject_Unicode(self); - } else if (PyString_Check(format_spec)) { + } else if (PyBytes_Check(format_spec)) { self_as_str = PyObject_Str(self); } else { PyErr_SetString(PyExc_TypeError, "argument to __format__ must be unicode or str"); @@ -3422,7 +3421,7 @@ {"__format__", object_format, METH_VARARGS, PyDoc_STR("default object formatter")}, {"__sizeof__", object_sizeof, METH_NOARGS, - PyDoc_STR("__sizeof__() -> size of object in bytes")}, + PyDoc_STR("__sizeof__() -> size of object in memory, in bytes")}, {0} }; @@ -3635,7 +3634,7 @@ type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; else if (PyType_IsSubtype(base, &PyLong_Type)) type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; - else if (PyType_IsSubtype(base, &PyString_Type)) + else if (PyType_IsSubtype(base, &PyBytes_Type)) type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; #ifdef Py_USING_UNICODE else if (PyType_IsSubtype(base, &PyUnicode_Type)) @@ -3974,7 +3973,7 @@ */ if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { if (type->tp_doc != NULL) { - PyObject *doc = PyString_FromString(type->tp_doc); + PyObject *doc = PyBytes_FromString(type->tp_doc); if (doc == NULL) goto error; PyDict_SetItemString(type->tp_dict, "__doc__", doc); @@ -4862,7 +4861,7 @@ descrgetfunc f; if (getitem_str == NULL) { - getitem_str = PyString_InternFromString("__getitem__"); + getitem_str = PyBytes_InternFromString("__getitem__"); if (getitem_str == NULL) return NULL; } @@ -5230,7 +5229,7 @@ return res; } PyErr_Clear(); - return PyString_FromFormat("<%s object at %p>", + return PyBytes_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -5338,13 +5337,13 @@ static PyObject *getattr_str = NULL; if (getattr_str == NULL) { - getattr_str = PyString_InternFromString("__getattr__"); + getattr_str = PyBytes_InternFromString("__getattr__"); if (getattr_str == NULL) return NULL; } if (getattribute_str == NULL) { getattribute_str = - PyString_InternFromString("__getattribute__"); + PyBytes_InternFromString("__getattribute__"); if (getattribute_str == NULL) return NULL; } @@ -5485,7 +5484,7 @@ static PyObject *get_str = NULL; if (get_str == NULL) { - get_str = PyString_InternFromString("__get__"); + get_str = PyBytes_InternFromString("__get__"); if (get_str == NULL) return NULL; } @@ -5555,7 +5554,7 @@ Py_ssize_t i, n; if (new_str == NULL) { - new_str = PyString_InternFromString("__new__"); + new_str = PyBytes_InternFromString("__new__"); if (new_str == NULL) return NULL; } @@ -6085,7 +6084,7 @@ if (initialized) return; for (p = slotdefs; p->name; p++) { - p->name_strobj = PyString_InternFromString(p->name); + p->name_strobj = PyBytes_InternFromString(p->name); if (!p->name_strobj) Py_FatalError("Out of memory interning slotdef names"); } @@ -6108,7 +6107,7 @@ update_subclasses() recursion below, but carefully: they each have their own conditions on which to stop recursing into subclasses. */ - type_modified(type); + PyType_Modified(type); init_slotdefs(); pp = ptrs; @@ -6300,12 +6299,12 @@ superobject *su = (superobject *)self; if (su->obj_type) - return PyString_FromFormat( + return PyBytes_FromFormat( ", <%s object>>", su->type ? su->type->tp_name : "NULL", su->obj_type->tp_name); else - return PyString_FromFormat( + return PyBytes_FromFormat( ", NULL>", su->type ? su->type->tp_name : "NULL"); } @@ -6319,9 +6318,9 @@ if (!skip) { /* We want __class__ to return the class of the super object (i.e. super, or a subclass), not the class of su->obj. */ - skip = (PyString_Check(name) && - PyString_GET_SIZE(name) == 9 && - strcmp(PyString_AS_STRING(name), "__class__") == 0); + skip = (PyBytes_Check(name) && + PyBytes_GET_SIZE(name) == 9 && + strcmp(PyBytes_AS_STRING(name), "__class__") == 0); } if (!skip) { @@ -6413,7 +6412,7 @@ PyObject *class_attr; if (class_str == NULL) { - class_str = PyString_FromString("__class__"); + class_str = PyBytes_FromString("__class__"); if (class_str == NULL) return NULL; } Modified: python/branches/okkoto-sizeof/Objects/unicodeobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/unicodeobject.c (original) +++ python/branches/okkoto-sizeof/Objects/unicodeobject.c Wed Jun 4 11:24:23 2008 @@ -42,8 +42,6 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "formatter_unicode.h" - #include "unicodeobject.h" #include "ucnhash.h" @@ -1080,11 +1078,11 @@ #endif /* Coerce object */ - if (PyString_Check(obj)) { - s = PyString_AS_STRING(obj); - len = PyString_GET_SIZE(obj); + if (PyBytes_Check(obj)) { + s = PyBytes_AS_STRING(obj); + len = PyBytes_GET_SIZE(obj); } - else if (PyBytes_Check(obj)) { + else if (PyByteArray_Check(obj)) { /* Python 2.x specific */ PyErr_Format(PyExc_TypeError, "decoding bytearray is not supported"); @@ -1254,7 +1252,7 @@ v = PyCodec_Encode(unicode, encoding, errors); if (v == NULL) goto onError; - if (!PyString_Check(v)) { + if (!PyBytes_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -1654,13 +1652,13 @@ char * start; if (size == 0) - return PyString_FromStringAndSize(NULL, 0); + return PyBytes_FromStringAndSize(NULL, 0); - v = PyString_FromStringAndSize(NULL, cbAllocated); + v = PyBytes_FromStringAndSize(NULL, cbAllocated); if (v == NULL) return NULL; - start = out = PyString_AS_STRING(v); + start = out = PyBytes_AS_STRING(v); for (;i < size; ++i) { Py_UNICODE ch = s[i]; @@ -1726,7 +1724,7 @@ *out++ = '-'; } - _PyString_Resize(&v, out - start); + _PyBytes_Resize(&v, out - start); return v; } @@ -1991,10 +1989,10 @@ nallocated = size * 4; if (nallocated / 4 != size) /* overflow! */ return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, nallocated); + v = PyBytes_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; - p = PyString_AS_STRING(v); + p = PyBytes_AS_STRING(v); } for (i = 0; i < size;) { @@ -2042,13 +2040,13 @@ /* This was stack allocated. */ nneeded = p - stackbuf; assert(nneeded <= nallocated); - v = PyString_FromStringAndSize(stackbuf, nneeded); + v = PyBytes_FromStringAndSize(stackbuf, nneeded); } else { /* Cut back to size actually needed. */ - nneeded = p - PyString_AS_STRING(v); + nneeded = p - PyBytes_AS_STRING(v); assert(nneeded <= nallocated); - _PyString_Resize(&v, nneeded); + _PyBytes_Resize(&v, nneeded); } return v; @@ -2276,12 +2274,12 @@ 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) pairs++; #endif - v = PyString_FromStringAndSize(NULL, + v = PyBytes_FromStringAndSize(NULL, 4 * (size - pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyString_AS_STRING(v); + p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2541,12 +2539,12 @@ if (s[i] >= 0x10000) pairs++; #endif - v = PyString_FromStringAndSize(NULL, + v = PyBytes_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyString_AS_STRING(v); + p = (unsigned char *)PyBytes_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2889,7 +2887,7 @@ escape. */ - repr = PyString_FromStringAndSize(NULL, + repr = PyBytes_FromStringAndSize(NULL, 2 #ifdef Py_UNICODE_WIDE + 10*size @@ -2900,7 +2898,7 @@ if (repr == NULL) return NULL; - p = PyString_AS_STRING(repr); + p = PyBytes_AS_STRING(repr); if (quotes) { *p++ = 'u'; @@ -2912,7 +2910,7 @@ /* Escape quotes and backslashes */ if ((quotes && - ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { + ch == (Py_UNICODE) PyBytes_AS_STRING(repr)[1]) || ch == '\\') { *p++ = '\\'; *p++ = (char) ch; continue; @@ -2998,10 +2996,10 @@ *p++ = (char) ch; } if (quotes) - *p++ = PyString_AS_STRING(repr)[1]; + *p++ = PyBytes_AS_STRING(repr)[1]; *p = '\0'; - _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); + _PyBytes_Resize(&repr, p - PyBytes_AS_STRING(repr)); return repr; } @@ -3150,16 +3148,16 @@ static const char *hexdigit = "0123456789abcdef"; #ifdef Py_UNICODE_WIDE - repr = PyString_FromStringAndSize(NULL, 10 * size); + repr = PyBytes_FromStringAndSize(NULL, 10 * size); #else - repr = PyString_FromStringAndSize(NULL, 6 * size); + repr = PyBytes_FromStringAndSize(NULL, 6 * size); #endif if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyString_AS_STRING(repr); + p = q = PyBytes_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; #ifdef Py_UNICODE_WIDE @@ -3218,7 +3216,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyString_Resize(&repr, p - q); + _PyBytes_Resize(&repr, p - q); return repr; } @@ -3458,12 +3456,12 @@ /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ - res = PyString_FromStringAndSize(NULL, size); + res = PyBytes_FromStringAndSize(NULL, size); if (res == NULL) goto onError; if (size == 0) return res; - str = PyString_AS_STRING(res); + str = PyBytes_AS_STRING(res); ressize = size; while (p ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) + if (_PyBytes_Resize(&res, requiredsize)) goto onError; - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* generate replacement (temporarily (mis)uses p) */ @@ -3560,17 +3558,17 @@ /* 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-PyString_AS_STRING(res); + 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 (_PyString_Resize(&res, requiredsize)) { + if (_PyBytes_Resize(&res, requiredsize)) { Py_DECREF(repunicode); goto onError; } - str = PyString_AS_STRING(res) + respos; + str = PyBytes_AS_STRING(res) + respos; ressize = requiredsize; } /* check if there is anything unencodable in the replacement @@ -3591,10 +3589,10 @@ } } /* Resize if we allocated to much */ - respos = str-PyString_AS_STRING(res); + respos = str-PyBytes_AS_STRING(res); if (respos 0) { - char *s = PyString_AS_STRING(*repr) + n; + 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; @@ -4329,7 +4327,7 @@ } return x; } - else if (PyString_Check(x)) + else if (PyBytes_Check(x)) return x; else { /* wrong return value */ @@ -4343,11 +4341,11 @@ static int charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) { - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); + Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); /* exponentially overallocate to minimize reallocations */ if (requiredsize < 2*outsize) requiredsize = 2*outsize; - if (_PyString_Resize(outobj, requiredsize)) { + if (_PyBytes_Resize(outobj, requiredsize)) { return 0; } return 1; @@ -4368,7 +4366,7 @@ { PyObject *rep; char *outstart; - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); + Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); if (Py_TYPE(mapping) == &EncodingMapType) { int res = encoding_map_lookup(c, mapping); @@ -4378,7 +4376,7 @@ if (outsize unicode\n\ +"S.replace (old, new[, count]) -> unicode\n\ \n\ Return a copy of S with all occurrences of substring\n\ -old replaced by new. If the optional argument maxsplit is\n\ -given, only the first maxsplit occurrences are replaced."); +old replaced by new. If the optional argument count is\n\ +given, only the first count occurrences are replaced."); static PyObject* unicode_replace(PyUnicodeObject *self, PyObject *args) @@ -7863,6 +7861,35 @@ \n\ "); +static PyObject * +unicode__format__(PyObject *self, PyObject *args) +{ + PyObject *format_spec; + PyObject *result = NULL; + PyObject *tmp = NULL; + + /* If 2.x, convert format_spec to the same type as value */ + /* This is to allow things like u''.format('') */ + if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) + goto done; + if (!(PyBytes_Check(format_spec) || PyUnicode_Check(format_spec))) { + PyErr_Format(PyExc_TypeError, "__format__ arg must be str " + "or unicode, not %s", Py_TYPE(format_spec)->tp_name); + goto done; + } + tmp = PyObject_Unicode(format_spec); + if (tmp == NULL) + goto done; + format_spec = tmp; + + result = _PyUnicode_FormatAdvanced(self, + PyUnicode_AS_UNICODE(format_spec), + PyUnicode_GET_SIZE(format_spec)); +done: + Py_XDECREF(tmp); + return result; +} + PyDoc_STRVAR(p_format__doc__, "S.__format__(format_spec) -> unicode\n\ \n\ @@ -8071,8 +8098,8 @@ str = _PyUnicode_AsDefaultEncodedString((PyObject *)self, NULL); if (str == NULL) return -1; - *ptr = (void *) PyString_AS_STRING(str); - return PyString_GET_SIZE(str); + *ptr = (void *) PyBytes_AS_STRING(str); + return PyBytes_GET_SIZE(str); } /* Helpers for PyUnicode_Format() */ @@ -8191,7 +8218,7 @@ PyObject *str; /* temporary string object. */ PyUnicodeObject *result; - str = _PyString_FormatLong(val, flags, prec, type, &buf, &len); + str = _PyBytes_FormatLong(val, flags, prec, type, &buf, &len); if (!str) return NULL; result = _PyUnicode_New(len); @@ -8293,10 +8320,10 @@ buf[0] = PyUnicode_AS_UNICODE(v)[0]; } - else if (PyString_Check(v)) { - if (PyString_GET_SIZE(v) != 1) + else if (PyBytes_Check(v)) { + if (PyBytes_GET_SIZE(v) != 1) goto onError; - buf[0] = (Py_UNICODE)PyString_AS_STRING(v)[0]; + buf[0] = (Py_UNICODE)PyBytes_AS_STRING(v)[0]; } else { @@ -8579,10 +8606,10 @@ goto onError; if (PyUnicode_Check(temp)) /* nothing to do */; - else if (PyString_Check(temp)) { + else if (PyBytes_Check(temp)) { /* convert to string to Unicode */ - unicode = PyUnicode_Decode(PyString_AS_STRING(temp), - PyString_GET_SIZE(temp), + unicode = PyUnicode_Decode(PyBytes_AS_STRING(temp), + PyBytes_GET_SIZE(temp), NULL, "strict"); Py_DECREF(temp); Modified: python/branches/okkoto-sizeof/Objects/weakrefobject.c ============================================================================== --- python/branches/okkoto-sizeof/Objects/weakrefobject.c (original) +++ python/branches/okkoto-sizeof/Objects/weakrefobject.c Wed Jun 4 11:24:23 2008 @@ -166,8 +166,8 @@ "__name__"); if (nameobj == NULL) PyErr_Clear(); - else if (PyString_Check(nameobj)) - name = PyString_AS_STRING(nameobj); + else if (PyBytes_Check(nameobj)) + name = PyBytes_AS_STRING(nameobj); PyOS_snprintf(buffer, sizeof(buffer), name ? "" : "", @@ -177,7 +177,7 @@ name); Py_XDECREF(nameobj); } - return PyString_FromString(buffer); + return PyBytes_FromString(buffer); } /* Weak references only support equality, not ordering. Two weak references @@ -448,7 +448,7 @@ "", proxy, Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name, PyWeakref_GET_OBJECT(proxy)); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } @@ -473,6 +473,8 @@ WRAP_BINARY(proxy_sub, PyNumber_Subtract) WRAP_BINARY(proxy_mul, PyNumber_Multiply) WRAP_BINARY(proxy_div, PyNumber_Divide) +WRAP_BINARY(proxy_floor_div, PyNumber_FloorDivide) +WRAP_BINARY(proxy_true_div, PyNumber_TrueDivide) WRAP_BINARY(proxy_mod, PyNumber_Remainder) WRAP_BINARY(proxy_divmod, PyNumber_Divmod) WRAP_TERNARY(proxy_pow, PyNumber_Power) @@ -492,6 +494,8 @@ WRAP_BINARY(proxy_isub, PyNumber_InPlaceSubtract) WRAP_BINARY(proxy_imul, PyNumber_InPlaceMultiply) WRAP_BINARY(proxy_idiv, PyNumber_InPlaceDivide) +WRAP_BINARY(proxy_ifloor_div, PyNumber_InPlaceFloorDivide) +WRAP_BINARY(proxy_itrue_div, PyNumber_InPlaceTrueDivide) WRAP_BINARY(proxy_imod, PyNumber_InPlaceRemainder) WRAP_TERNARY(proxy_ipow, PyNumber_InPlacePower) WRAP_BINARY(proxy_ilshift, PyNumber_InPlaceLshift) @@ -499,6 +503,7 @@ WRAP_BINARY(proxy_iand, PyNumber_InPlaceAnd) WRAP_BINARY(proxy_ixor, PyNumber_InPlaceXor) WRAP_BINARY(proxy_ior, PyNumber_InPlaceOr) +WRAP_UNARY(proxy_index, PyNumber_Index) static int proxy_nonzero(PyWeakReference *proxy) @@ -623,6 +628,11 @@ proxy_iand, /*nb_inplace_and*/ proxy_ixor, /*nb_inplace_xor*/ proxy_ior, /*nb_inplace_or*/ + proxy_floor_div, /*nb_floor_divide*/ + proxy_true_div, /*nb_true_divide*/ + proxy_ifloor_div, /*nb_inplace_floor_divide*/ + proxy_itrue_div, /*nb_inplace_true_divide*/ + proxy_index, /*nb_index*/ }; static PySequenceMethods proxy_as_sequence = { Modified: python/branches/okkoto-sizeof/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/okkoto-sizeof/PC/VC6/pythoncore.dsp (original) +++ python/branches/okkoto-sizeof/PC/VC6/pythoncore.dsp Wed Jun 4 11:24:23 2008 @@ -237,6 +237,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Objects\bytearrayobject.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytesobject.c # End Source File # Begin Source File @@ -643,10 +647,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Objects\stringobject.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\stropmodule.c # End Source File # Begin Source File Modified: python/branches/okkoto-sizeof/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS7.1/pythoncore.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS7.1/pythoncore.vcproj Wed Jun 4 11:24:23 2008 @@ -443,6 +443,9 @@ RelativePath="..\..\Objects\bufferobject.c"> + + - - @@ -423,7 +418,7 @@ /> Modified: python/branches/okkoto-sizeof/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/_elementtree.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/_elementtree.vcproj Wed Jun 4 11:24:23 2008 @@ -56,6 +56,7 @@ /> @@ -431,6 +437,7 @@ /> Modified: python/branches/okkoto-sizeof/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/_sqlite3.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/_sqlite3.vcproj Wed Jun 4 11:24:23 2008 @@ -53,12 +53,9 @@ /> @@ -446,12 +428,9 @@ /> Modified: python/branches/okkoto-sizeof/PC/VS8.0/_ssl.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/_ssl.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/_ssl.vcproj Wed Jun 4 11:24:23 2008 @@ -27,7 +27,7 @@ > - - Modified: python/branches/okkoto-sizeof/PC/VS8.0/_tkinter.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/_tkinter.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/_tkinter.vcproj Wed Jun 4 11:24:23 2008 @@ -56,7 +56,7 @@ /> + @@ -104,6 +107,96 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + Modified: python/branches/okkoto-sizeof/PC/VS8.0/debug.vsprops ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/debug.vsprops (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/debug.vsprops Wed Jun 4 11:24:23 2008 @@ -8,4 +8,8 @@ Name="VCCLCompilerTool" PreprocessorDefinitions="_DEBUG" /> - \ No newline at end of file + + Modified: python/branches/okkoto-sizeof/PC/VS8.0/make_versioninfo.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/make_versioninfo.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/make_versioninfo.vcproj Wed Jun 4 11:24:23 2008 @@ -67,6 +67,7 @@ /> + + + + + + + + Modified: python/branches/okkoto-sizeof/PC/VS8.0/python.vcproj ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/python.vcproj (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/python.vcproj Wed Jun 4 11:24:23 2008 @@ -62,6 +62,7 @@ /> + + + + @@ -1363,11 +1371,15 @@ > + + - - Modified: python/branches/okkoto-sizeof/PC/VS8.0/release.vsprops ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/release.vsprops (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/release.vsprops Wed Jun 4 11:24:23 2008 @@ -8,4 +8,8 @@ Name="VCCLCompilerTool" PreprocessorDefinitions="NDEBUG" /> + Modified: python/branches/okkoto-sizeof/PC/VS8.0/x64.vsprops ============================================================================== --- python/branches/okkoto-sizeof/PC/VS8.0/x64.vsprops (original) +++ python/branches/okkoto-sizeof/PC/VS8.0/x64.vsprops Wed Jun 4 11:24:23 2008 @@ -15,4 +15,8 @@ Name="VCLinkerTool" TargetMachine="17" /> + Modified: python/branches/okkoto-sizeof/PC/_msi.c ============================================================================== --- python/branches/okkoto-sizeof/PC/_msi.c (original) +++ python/branches/okkoto-sizeof/PC/_msi.c Wed Jun 4 11:24:23 2008 @@ -35,7 +35,7 @@ return NULL; } - oresult = PyString_FromString(cresult); + oresult = PyBytes_FromString(cresult); RpcStringFree(&cresult); return oresult; @@ -136,14 +136,14 @@ PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab); if (result == NULL) return -1; - if (!PyString_Check(result)) { + if (!PyBytes_Check(result)) { PyErr_Format(PyExc_TypeError, "Incorrect return type %s from getnextcabinet", result->ob_type->tp_name); Py_DECREF(result); return FALSE; } - strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab)); + strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab)); return TRUE; } return FALSE; @@ -339,6 +339,49 @@ } static PyObject* +record_getinteger(msiobj* record, PyObject* args) +{ + unsigned int field; + int status; + + if (!PyArg_ParseTuple(args, "I:GetInteger", &field)) + return NULL; + status = MsiRecordGetInteger(record->h, field); + if (status == MSI_NULL_INTEGER){ + PyErr_SetString(MSIError, "could not convert record field to integer"); + return NULL; + } + return PyInt_FromLong((long) status); +} + +static PyObject* +record_getstring(msiobj* record, PyObject* args) +{ + unsigned int field; + unsigned int status; + char buf[2000]; + char *res = buf; + DWORD size = sizeof(buf); + PyObject* string; + + if (!PyArg_ParseTuple(args, "I:GetString", &field)) + return NULL; + status = MsiRecordGetString(record->h, field, res, &size); + if (status == ERROR_MORE_DATA) { + res = (char*) malloc(size + 1); + if (res == NULL) + return PyErr_NoMemory(); + status = MsiRecordGetString(record->h, field, res, &size); + } + if (status != ERROR_SUCCESS) + return msierror((int) status); + string = PyString_FromString(res); + if (buf != res) + free(res); + return string; +} + +static PyObject* record_cleardata(msiobj* record, PyObject *args) { int status = MsiRecordClearData(record->h); @@ -405,6 +448,10 @@ static PyMethodDef record_methods[] = { { "GetFieldCount", (PyCFunction)record_getfieldcount, METH_NOARGS, PyDoc_STR("GetFieldCount() -> int\nWraps MsiRecordGetFieldCount")}, + { "GetInteger", (PyCFunction)record_getinteger, METH_VARARGS, + PyDoc_STR("GetInteger(field) -> int\nWraps MsiRecordGetInteger")}, + { "GetString", (PyCFunction)record_getstring, METH_VARARGS, + PyDoc_STR("GetString(field) -> string\nWraps MsiRecordGetString")}, { "SetString", (PyCFunction)record_setstring, METH_VARARGS, PyDoc_STR("SetString(field,str) -> None\nWraps MsiRecordSetString")}, { "SetStream", (PyCFunction)record_setstream, METH_VARARGS, @@ -507,7 +554,7 @@ PyErr_SetString(PyExc_NotImplementedError, "FILETIME result"); return NULL; case VT_LPSTR: - result = PyString_FromStringAndSize(sval, ssize); + result = PyBytes_FromStringAndSize(sval, ssize); if (sval != sbuf) free(sval); return result; @@ -539,9 +586,9 @@ if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data)) return NULL; - if (PyString_Check(data)) { + if (PyBytes_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR, - 0, NULL, PyString_AsString(data)); + 0, NULL, PyBytes_AsString(data)); } else if (PyInt_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, PyInt_AsLong(data), NULL, NULL); Modified: python/branches/okkoto-sizeof/PC/_subprocess.c ============================================================================== --- python/branches/okkoto-sizeof/PC/_subprocess.c (original) +++ python/branches/okkoto-sizeof/PC/_subprocess.c Wed Jun 4 11:24:23 2008 @@ -304,42 +304,42 @@ if (!keys || !values) goto error; - out = PyString_FromStringAndSize(NULL, 2048); + out = PyBytes_FromStringAndSize(NULL, 2048); if (! out) goto error; - p = PyString_AS_STRING(out); + p = PyBytes_AS_STRING(out); for (i = 0; i < envsize; i++) { int ksize, vsize, totalsize; PyObject* key = PyList_GET_ITEM(keys, i); PyObject* value = PyList_GET_ITEM(values, i); - if (! PyString_Check(key) || ! PyString_Check(value)) { + if (! PyBytes_Check(key) || ! PyBytes_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } - ksize = PyString_GET_SIZE(key); - vsize = PyString_GET_SIZE(value); - totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 + + ksize = PyBytes_GET_SIZE(key); + vsize = PyBytes_GET_SIZE(value); + totalsize = (p - PyBytes_AS_STRING(out)) + ksize + 1 + vsize + 1 + 1; - if (totalsize > PyString_GET_SIZE(out)) { - int offset = p - PyString_AS_STRING(out); - _PyString_Resize(&out, totalsize + 1024); - p = PyString_AS_STRING(out) + offset; + if (totalsize > PyBytes_GET_SIZE(out)) { + int offset = p - PyBytes_AS_STRING(out); + _PyBytes_Resize(&out, totalsize + 1024); + p = PyBytes_AS_STRING(out) + offset; } - memcpy(p, PyString_AS_STRING(key), ksize); + memcpy(p, PyBytes_AS_STRING(key), ksize); p += ksize; *p++ = '='; - memcpy(p, PyString_AS_STRING(value), vsize); + memcpy(p, PyBytes_AS_STRING(value), vsize); p += vsize; *p++ = '\0'; } /* add trailing null byte */ *p++ = '\0'; - _PyString_Resize(&out, p - PyString_AS_STRING(out)); + _PyBytes_Resize(&out, p - PyBytes_AS_STRING(out)); /* PyObject_Print(out, stdout, 0); */ @@ -413,7 +413,7 @@ NULL, inherit_handles, creation_flags, - environment ? PyString_AS_STRING(environment) : NULL, + environment ? PyBytes_AS_STRING(environment) : NULL, current_directory, &si, &pi); @@ -516,7 +516,7 @@ if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyString_FromString(filename); + return PyBytes_FromString(filename); } static PyMethodDef sp_functions[] = { Modified: python/branches/okkoto-sizeof/PC/_winreg.c ============================================================================== --- python/branches/okkoto-sizeof/PC/_winreg.c (original) +++ python/branches/okkoto-sizeof/PC/_winreg.c Wed Jun 4 11:24:23 2008 @@ -424,7 +424,7 @@ PyHKEYObject *pyhkey = (PyHKEYObject *)ob; char resBuf[160]; wsprintf(resBuf, "", pyhkey->hkey); - return PyString_FromString(resBuf); + return PyBytes_FromString(resBuf); } static int @@ -767,11 +767,11 @@ return FALSE; need_decref = 1; } - if (!PyString_Check(value)) + if (!PyBytes_Check(value)) return FALSE; *retDataSize = 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)value)); + PyBytes_AS_STRING( + (PyBytesObject *)value)); } *retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize); if (*retDataBuf==NULL){ @@ -782,8 +782,8 @@ strcpy((char *)*retDataBuf, ""); else strcpy((char *)*retDataBuf, - PyString_AS_STRING( - (PyStringObject *)value)); + PyBytes_AS_STRING( + (PyBytesObject *)value)); if (need_decref) Py_DECREF(value); break; @@ -808,7 +808,7 @@ PyObject *t; t = PyList_GET_ITEM( (PyListObject *)value,j); - if (PyString_Check(t)) { + if (PyBytes_Check(t)) { obs[j] = t; Py_INCREF(t); } else if (PyUnicode_Check(t)) { @@ -821,8 +821,8 @@ } else goto reg_multi_fail; size += 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)obs[j])); + PyBytes_AS_STRING( + (PyBytesObject *)obs[j])); } *retDataSize = size + 1; @@ -839,11 +839,11 @@ PyObject *t; t = obs[j]; strcpy(P, - PyString_AS_STRING( - (PyStringObject *)t)); + PyBytes_AS_STRING( + (PyBytesObject *)t)); P += 1 + strlen( - PyString_AS_STRING( - (PyStringObject *)t)); + PyBytes_AS_STRING( + (PyBytesObject *)t)); Py_DECREF(obs[j]); } /* And doubly-terminate the list... */ @@ -1085,7 +1085,7 @@ if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx"); - retStr = PyString_FromStringAndSize(tmpbuf, len); + retStr = PyBytes_FromStringAndSize(tmpbuf, len); return retStr; /* can be NULL */ } @@ -1303,17 +1303,17 @@ != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); - retStr = PyString_FromStringAndSize(NULL, bufSize); + retStr = PyBytes_FromStringAndSize(NULL, bufSize); if (retStr == NULL) return NULL; - retBuf = PyString_AS_STRING(retStr); + retBuf = PyBytes_AS_STRING(retStr); if ((rc = RegQueryValue(hKey, subKey, retBuf, &bufSize)) != ERROR_SUCCESS) { Py_DECREF(retStr); return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); } - _PyString_Resize(&retStr, strlen(retBuf)); + _PyBytes_Resize(&retStr, strlen(retBuf)); return retStr; } @@ -1414,14 +1414,14 @@ return NULL; } /* XXX - need Unicode support */ - str = PyString_AsString(obStrVal); + str = PyBytes_AsString(obStrVal); if (str == NULL) return NULL; - len = PyString_Size(obStrVal); + len = PyBytes_Size(obStrVal); if (obSubKey == Py_None) subKey = NULL; else { - subKey = PyString_AsString(obSubKey); + subKey = PyBytes_AsString(obSubKey); if (subKey == NULL) return NULL; } Modified: python/branches/okkoto-sizeof/PC/bdist_wininst/install.c ============================================================================== --- python/branches/okkoto-sizeof/PC/bdist_wininst/install.c (original) +++ python/branches/okkoto-sizeof/PC/bdist_wininst/install.c Wed Jun 4 11:24:23 2008 @@ -2115,11 +2115,6 @@ { HKEY hk; char key_name[80]; - OSVERSIONINFO winverinfo; - winverinfo.dwOSVersionInfoSize = sizeof(winverinfo); - // If less than XP, then we can't do it (and its not necessary). - if (!GetVersionEx(&winverinfo) || winverinfo.dwMajorVersion < 5) - return FALSE; // no Python version info == we can't know yet. if (target_version[0] == '\0') return FALSE; @@ -2135,6 +2130,23 @@ return TRUE; } +// Returns TRUE if the platform supports UAC. +BOOL PlatformSupportsUAC() +{ + // Note that win2k does seem to support ShellExecute with 'runas', + // but does *not* support IsUserAnAdmin - so we just pretend things + // only work on XP and later. + BOOL bIsWindowsXPorLater; + OSVERSIONINFO winverinfo; + winverinfo.dwOSVersionInfoSize = sizeof(winverinfo); + if (!GetVersionEx(&winverinfo)) + return FALSE; // something bad has gone wrong + bIsWindowsXPorLater = + ( (winverinfo.dwMajorVersion > 5) || + ( (winverinfo.dwMajorVersion == 5) && (winverinfo.dwMinorVersion >= 1) )); + return bIsWindowsXPorLater; +} + // Spawn ourself as an elevated application. On failure, a message is // displayed to the user - but this app will always terminate, even // on error. @@ -2190,7 +2202,7 @@ // See if we need to do the Vista UAC magic. if (strcmp(user_access_control, "force")==0) { - if (!MyIsUserAnAdmin()) { + if (PlatformSupportsUAC() && !MyIsUserAnAdmin()) { SpawnUAC(); return 0; } @@ -2198,7 +2210,7 @@ } else if (strcmp(user_access_control, "auto")==0) { // Check if it looks like we need UAC control, based // on how Python itself was installed. - if (!MyIsUserAnAdmin() && NeedAutoUAC()) { + if (PlatformSupportsUAC() && !MyIsUserAnAdmin() && NeedAutoUAC()) { SpawnUAC(); return 0; } Modified: python/branches/okkoto-sizeof/PC/msvcrtmodule.c ============================================================================== --- python/branches/okkoto-sizeof/PC/msvcrtmodule.c (original) +++ python/branches/okkoto-sizeof/PC/msvcrtmodule.c Wed Jun 4 11:24:23 2008 @@ -140,7 +140,7 @@ ch = _getch(); Py_END_ALLOW_THREADS s[0] = ch; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } static PyObject * @@ -172,7 +172,7 @@ ch = _getche(); Py_END_ALLOW_THREADS s[0] = ch; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } static PyObject * Modified: python/branches/okkoto-sizeof/PC/winsound.c ============================================================================== --- python/branches/okkoto-sizeof/PC/winsound.c (original) +++ python/branches/okkoto-sizeof/PC/winsound.c Wed Jun 4 11:24:23 2008 @@ -151,7 +151,7 @@ static void add_define(PyObject *dict, const char *key, long value) { - PyObject *k=PyString_FromString(key); + PyObject *k=PyBytes_FromString(key); PyObject *v=PyLong_FromLong(value); if(v&&k) { Modified: python/branches/okkoto-sizeof/PCbuild/pyproject.vsprops ============================================================================== --- python/branches/okkoto-sizeof/PCbuild/pyproject.vsprops (original) +++ python/branches/okkoto-sizeof/PCbuild/pyproject.vsprops Wed Jun 4 11:24:23 2008 @@ -45,6 +45,10 @@ Value="$(SolutionDir)\python.exe" /> + @@ -54,7 +58,7 @@ /> + + @@ -1371,6 +1375,10 @@ > + + @@ -1491,10 +1499,6 @@ > - - Modified: python/branches/okkoto-sizeof/Parser/asdl_c.py ============================================================================== --- python/branches/okkoto-sizeof/Parser/asdl_c.py (original) +++ python/branches/okkoto-sizeof/Parser/asdl_c.py Wed Jun 4 11:24:23 2008 @@ -375,7 +375,7 @@ # there's really nothing more we can do if this fails ... self.emit("if (tmp == NULL) goto failed;", 1) error = "expected some sort of %s, but got %%.400s" % name - format = "PyErr_Format(PyExc_TypeError, \"%s\", PyString_AS_STRING(tmp));" + format = "PyErr_Format(PyExc_TypeError, \"%s\", PyBytes_AS_STRING(tmp));" self.emit(format % error, 1, reflow=False) self.emit("failed:", 0) self.emit("Py_XDECREF(tmp);", 1) @@ -704,7 +704,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyString_FromString(fields[i]); + PyObject *field = PyBytes_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -723,7 +723,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyString_FromString(attrs[i]); + s = PyBytes_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -797,7 +797,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -815,7 +815,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } Modified: python/branches/okkoto-sizeof/Parser/tokenizer.c ============================================================================== --- python/branches/okkoto-sizeof/Parser/tokenizer.c (original) +++ python/branches/okkoto-sizeof/Parser/tokenizer.c Wed Jun 4 11:24:23 2008 @@ -12,7 +12,7 @@ #ifndef PGEN #include "unicodeobject.h" -#include "stringobject.h" +#include "bytesobject.h" #include "fileobject.h" #include "codecs.h" #include "abstract.h" @@ -344,7 +344,7 @@ 1) NULL: need to call tok->decoding_readline to get a new line 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and stored the result in tok->decoding_buffer - 3) PyStringObject *: previous call to fp_readl did not have enough room + 3) PyBytesObject *: previous call to fp_readl did not have enough room (in the s buffer) to copy entire contents of the line read by tok->decoding_readline. tok->decoding_buffer has the overflow. In this case, fp_readl is called in a loop (with an expanded buffer) @@ -375,7 +375,7 @@ return error_ret(tok); } else { tok->decoding_buffer = NULL; - if (PyString_CheckExact(buf)) + if (PyBytes_CheckExact(buf)) utf8 = buf; } if (utf8 == NULL) { @@ -384,10 +384,10 @@ if (utf8 == NULL) return error_ret(tok); } - str = PyString_AsString(utf8); - utf8len = PyString_GET_SIZE(utf8); + str = PyBytes_AsString(utf8); + utf8len = PyBytes_GET_SIZE(utf8); if (utf8len > size) { - tok->decoding_buffer = PyString_FromStringAndSize(str+size, utf8len-size); + tok->decoding_buffer = PyBytes_FromStringAndSize(str+size, utf8len-size); if (tok->decoding_buffer == NULL) { Py_DECREF(utf8); return error_ret(tok); @@ -591,7 +591,7 @@ utf8 = translate_into_utf8(str, tok->enc); if (utf8 == NULL) return error_ret(tok); - str = PyString_AsString(utf8); + str = PyBytes_AsString(utf8); } #endif for (s = str;; s++) { @@ -624,7 +624,7 @@ "unknown encoding: %s", tok->enc); return error_ret(tok); } - str = PyString_AsString(utf8); + str = PyBytes_AsString(utf8); } #endif assert(tok->decoding_buffer == NULL); @@ -706,11 +706,11 @@ return 0; enc = ((PyFileObject *)sysstdin)->f_encoding; - if (enc == NULL || !PyString_Check(enc)) + if (enc == NULL || !PyBytes_Check(enc)) return 0; Py_INCREF(enc); - encoding = PyString_AsString(enc); + encoding = PyBytes_AsString(enc); decoded = PyUnicode_Decode(*inp, strlen(*inp), encoding, NULL); if (decoded == NULL) goto error_clear; @@ -720,9 +720,9 @@ if (utf8 == NULL) goto error_clear; - assert(PyString_Check(utf8)); - converted = new_string(PyString_AS_STRING(utf8), - PyString_GET_SIZE(utf8)); + assert(PyBytes_Check(utf8)); + converted = new_string(PyBytes_AS_STRING(utf8), + PyBytes_GET_SIZE(utf8)); Py_DECREF(utf8); if (converted == NULL) goto error_nomem; @@ -1609,8 +1609,8 @@ /* convert source to original encondig */ PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len); if (lineobj != NULL) { - int linelen = PyString_Size(lineobj); - const char *line = PyString_AsString(lineobj); + int linelen = PyBytes_Size(lineobj); + const char *line = PyBytes_AsString(lineobj); text = PyObject_MALLOC(linelen + 1); if (text != NULL && line != NULL) { if (linelen) @@ -1624,7 +1624,7 @@ PyObject *offsetobj = dec_utf8(tok->encoding, tok->buf, *offset-1); if (offsetobj) { - *offset = PyString_Size(offsetobj) + 1; + *offset = PyBytes_Size(offsetobj) + 1; Py_DECREF(offsetobj); } } Modified: python/branches/okkoto-sizeof/Python/Python-ast.c ============================================================================== --- python/branches/okkoto-sizeof/Python/Python-ast.c (original) +++ python/branches/okkoto-sizeof/Python/Python-ast.c Wed Jun 4 11:24:23 2008 @@ -495,7 +495,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyString_FromString(fields[i]); + PyObject *field = PyBytes_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -514,7 +514,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyString_FromString(attrs[i]); + s = PyBytes_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -588,7 +588,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -606,7 +606,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyString_AS_STRING(s)); + PyBytes_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -3286,7 +3286,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -4414,7 +4414,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5261,7 +5261,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5299,7 +5299,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5417,7 +5417,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5439,7 +5439,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5501,7 +5501,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5531,7 +5531,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5585,7 +5585,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5751,7 +5751,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyBytes_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; Modified: python/branches/okkoto-sizeof/Python/_warnings.c ============================================================================== --- python/branches/okkoto-sizeof/Python/_warnings.c (original) +++ python/branches/okkoto-sizeof/Python/_warnings.c Wed Jun 4 11:24:23 2008 @@ -44,7 +44,7 @@ int result; if (warnings_str == NULL) { - warnings_str = PyString_InternFromString("warnings"); + warnings_str = PyBytes_InternFromString("warnings"); if (warnings_str == NULL) return NULL; } @@ -132,7 +132,7 @@ return NULL; if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyString_AsString(action); + return PyBytes_AsString(action); } m = PyImport_ImportModule(MODULE_NAME); @@ -144,7 +144,7 @@ return NULL; action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME); if (action != NULL) - return PyString_AsString(action); + return PyBytes_AsString(action); PyErr_SetString(PyExc_ValueError, MODULE_NAME "." DEFAULT_ACTION_NAME " not found"); @@ -184,17 +184,17 @@ if (rc == -1) return NULL; else if (rc == 0) - return PyString_FromString(""); + return PyBytes_FromString(""); - mod_str = PyString_AsString(filename); + mod_str = PyBytes_AsString(filename); if (mod_str == NULL) return NULL; - len = PyString_Size(filename); + len = PyBytes_Size(filename); if (len < 0) return NULL; if (len >= 3 && strncmp(mod_str + (len - 3), ".py", 3) == 0) { - module = PyString_FromStringAndSize(mod_str, len-3); + module = PyBytes_FromStringAndSize(mod_str, len-3); } else { module = filename; @@ -258,7 +258,7 @@ /* Print " source_line\n" */ PyFile_WriteString(" ", f_stderr); if (sourceline) { - char *source_line_str = PyString_AS_STRING(sourceline); + char *source_line_str = PyBytes_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || *source_line_str == '\014') source_line_str++; @@ -267,7 +267,7 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); + Py_DisplaySourceLine(f_stderr, PyBytes_AS_STRING(filename), lineno); PyErr_Clear(); } @@ -359,7 +359,7 @@ const char *err_str = "???"; if (to_str != NULL) - err_str = PyString_AS_STRING(to_str); + err_str = PyBytes_AS_STRING(to_str); PyErr_Format(PyExc_RuntimeError, "Unrecognized action (%s) in warnings.filters:\n %s", action, err_str); @@ -380,7 +380,7 @@ else { const char *msg = "functions overriding warnings.showwarning() " "must support the 'line' argument"; - const char *text_char = PyString_AS_STRING(text); + const char *text_char = PyBytes_AS_STRING(text); if (strcmp(msg, text_char) == 0) { /* Prevent infinite recursion by using built-in implementation @@ -484,7 +484,7 @@ /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); if (*module == NULL) { - *module = PyString_FromString(""); + *module = PyBytes_FromString(""); if (*module == NULL) goto handle_error; } @@ -494,8 +494,8 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); if (*filename != NULL) { - Py_ssize_t len = PyString_Size(*filename); - const char *file_str = PyString_AsString(*filename); + Py_ssize_t len = PyBytes_Size(*filename); + const char *file_str = PyBytes_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) goto handle_error; @@ -507,7 +507,7 @@ (tolower(file_str[len-1]) == 'c' || tolower(file_str[len-1]) == 'o')) { - *filename = PyString_FromStringAndSize(file_str, len-1); + *filename = PyBytes_FromStringAndSize(file_str, len-1); if (*filename == NULL) goto handle_error; } @@ -515,7 +515,7 @@ Py_INCREF(*filename); } else { - const char *module_str = PyString_AsString(*module); + const char *module_str = PyBytes_AsString(*module); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { @@ -530,14 +530,14 @@ } else if (!is_true) { Py_DECREF(*filename); - *filename = PyString_FromString("__main__"); + *filename = PyBytes_FromString("__main__"); if (*filename == NULL) goto handle_error; } } else { /* embedded interpreters don't have sys.argv, see bug #839151 */ - *filename = PyString_FromString("__main__"); + *filename = PyBytes_FromString("__main__"); if (*filename == NULL) goto handle_error; } @@ -649,12 +649,12 @@ PyObject *returned; if (get_source_name == NULL) { - get_source_name = PyString_InternFromString("get_source"); + get_source_name = PyBytes_InternFromString("get_source"); if (!get_source_name) return NULL; } if (splitlines_name == NULL) { - splitlines_name = PyString_InternFromString("splitlines"); + splitlines_name = PyBytes_InternFromString("splitlines"); if (!splitlines_name) return NULL; } @@ -711,7 +711,7 @@ PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) { PyObject *res; - PyObject *message = PyString_FromString(text); + PyObject *message = PyBytes_FromString(text); if (message == NULL) return -1; @@ -745,15 +745,15 @@ const char *module_str, PyObject *registry) { PyObject *res; - PyObject *message = PyString_FromString(text); - PyObject *filename = PyString_FromString(filename_str); + PyObject *message = PyBytes_FromString(text); + PyObject *filename = PyBytes_FromString(filename_str); PyObject *module = NULL; int ret = -1; if (message == NULL || filename == NULL) goto exit; if (module_str != NULL) { - module = PyString_FromString(module_str); + module = PyBytes_FromString(module_str); if (module == NULL) goto exit; } @@ -775,15 +775,6 @@ } -int -PyErr_WarnPy3k(const char *text, Py_ssize_t stacklevel) -{ - if (Py_Py3kWarningFlag) - return PyErr_WarnEx(PyExc_DeprecationWarning, text, stacklevel); - return 0; -} - - PyDoc_STRVAR(warn_doc, "Issue a warning, or maybe ignore it or raise an exception."); @@ -812,7 +803,7 @@ if (!strcmp(action, "ignore")) { if (ignore_str == NULL) { - ignore_str = PyString_InternFromString("ignore"); + ignore_str = PyBytes_InternFromString("ignore"); if (ignore_str == NULL) return NULL; } @@ -820,7 +811,7 @@ } else if (!strcmp(action, "error")) { if (error_str == NULL) { - error_str = PyString_InternFromString("error"); + error_str = PyBytes_InternFromString("error"); if (error_str == NULL) return NULL; } @@ -828,7 +819,7 @@ } else if (!strcmp(action, "default")) { if (default_str == NULL) { - default_str = PyString_InternFromString("default"); + default_str = PyBytes_InternFromString("default"); if (default_str == NULL) return NULL; } @@ -901,7 +892,7 @@ if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) return; - default_action = PyString_InternFromString("default"); + default_action = PyBytes_InternFromString("default"); if (default_action == NULL) return; if (PyModule_AddObject(m, DEFAULT_ACTION_NAME, default_action) < 0) Modified: python/branches/okkoto-sizeof/Python/ast.c ============================================================================== --- python/branches/okkoto-sizeof/Python/ast.c (original) +++ python/branches/okkoto-sizeof/Python/ast.c Wed Jun 4 11:24:23 2008 @@ -46,7 +46,7 @@ static identifier new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyString_InternFromString(n); + PyObject* id = PyBytes_InternFromString(n); PyArena_AddPyObject(arena, id); return id; } @@ -352,7 +352,7 @@ switch (e->kind) { case Attribute_kind: if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Attribute.attr), "None")) { + !strcmp(PyBytes_AS_STRING(e->v.Attribute.attr), "None")) { return ast_error(n, "assignment to None"); } e->v.Attribute.ctx = ctx; @@ -362,7 +362,7 @@ break; case Name_kind: if (ctx == Store && - !strcmp(PyString_AS_STRING(e->v.Name.id), "None")) { + !strcmp(PyBytes_AS_STRING(e->v.Name.id), "None")) { return ast_error(n, "assignment to None"); } e->v.Name.ctx = ctx; @@ -1276,7 +1276,7 @@ if (errstr) { char *s = ""; char buf[128]; - s = PyString_AsString(errstr); + s = PyBytes_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { @@ -1921,7 +1921,7 @@ return NULL; } key = e->v.Name.id; - if (!strcmp(PyString_AS_STRING(key), "None")) { + if (!strcmp(PyBytes_AS_STRING(key), "None")) { ast_error(CHILD(ch, 0), "assignment to None"); return NULL; } @@ -2050,7 +2050,7 @@ "expression not possible"); return NULL; case Name_kind: { - const char *var_name = PyString_AS_STRING(expr1->v.Name.id); + const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); if (var_name[0] == 'N' && !strcmp(var_name, "None")) { ast_error(ch, "assignment to None"); return NULL; @@ -2326,10 +2326,10 @@ /* length of string plus one for the dot */ len += strlen(STR(CHILD(n, i))) + 1; len--; /* the last name doesn't have a dot */ - str = PyString_FromStringAndSize(NULL, len); + str = PyBytes_FromStringAndSize(NULL, len); if (!str) return NULL; - s = PyString_AS_STRING(str); + s = PyBytes_AS_STRING(str); if (!s) return NULL; for (i = 0; i < NCH(n); i += 2) { @@ -2340,13 +2340,13 @@ } --s; *s = '\0'; - PyString_InternInPlace(&str); + PyBytes_InternInPlace(&str); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); } break; case STAR: - str = PyString_InternFromString("*"); + str = PyBytes_InternFromString("*"); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); default: @@ -3196,10 +3196,10 @@ u = NULL; } else { /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ - u = PyString_FromStringAndSize((char *)NULL, len * 4); + u = PyBytes_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) return NULL; - p = buf = PyString_AsString(u); + p = buf = PyBytes_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { @@ -3218,8 +3218,8 @@ Py_DECREF(u); return NULL; } - r = PyString_AsString(w); - rn = PyString_Size(w); + r = PyBytes_AsString(w); + rn = PyBytes_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", @@ -3318,11 +3318,11 @@ return v; #endif } else { - return PyString_FromStringAndSize(s, len); + return PyBytes_FromStringAndSize(s, len); } } - return PyString_DecodeEscape(s, len, NULL, unicode, + return PyBytes_DecodeEscape(s, len, NULL, unicode, need_encoding ? c->c_encoding : NULL); } @@ -3343,8 +3343,8 @@ s = parsestr(c, STR(CHILD(n, i))); if (s == NULL) goto onError; - if (PyString_Check(v) && PyString_Check(s)) { - PyString_ConcatAndDel(&v, s); + if (PyBytes_Check(v) && PyBytes_Check(s)) { + PyBytes_ConcatAndDel(&v, s); if (v == NULL) goto onError; } Modified: python/branches/okkoto-sizeof/Python/bltinmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Python/bltinmodule.c (original) +++ python/branches/okkoto-sizeof/Python/bltinmodule.c Wed Jun 4 11:24:23 2008 @@ -247,7 +247,7 @@ return NULL; /* Strings and tuples return a result of the same type. */ - if (PyString_Check(seq)) + if (PyBytes_Check(seq)) return filterstring(func, seq); #ifdef Py_USING_UNICODE if (PyUnicode_Check(seq)) @@ -381,7 +381,7 @@ return NULL; } s[0] = (char)x; - return PyString_FromStringAndSize(s, 1); + return PyBytes_FromStringAndSize(s, 1); } PyDoc_STRVAR(chr_doc, @@ -652,7 +652,7 @@ return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } - if (!PyString_Check(cmd) && + if (!PyBytes_Check(cmd) && !PyUnicode_Check(cmd)) { PyErr_SetString(PyExc_TypeError, "eval() arg 1 must be a string or code object"); @@ -669,7 +669,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyString_AsStringAndSize(cmd, &str, NULL)) { + if (PyBytes_AsStringAndSize(cmd, &str, NULL)) { Py_XDECREF(tmp); return NULL; } @@ -814,7 +814,7 @@ } #endif - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "getattr(): attribute name must be string"); return NULL; @@ -870,7 +870,7 @@ } #endif - if (!PyString_Check(name)) { + if (!PyBytes_Check(name)) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return NULL; @@ -1189,7 +1189,7 @@ return NULL; } res = (*nb->nb_hex)(v); - if (res && !PyString_Check(res)) { + if (res && !PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__hex__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1249,13 +1249,13 @@ PyObject *s; if (!PyArg_ParseTuple(args, "S:intern", &s)) return NULL; - if (!PyString_CheckExact(s)) { + if (!PyBytes_CheckExact(s)) { PyErr_SetString(PyExc_TypeError, "can't intern subclass of string"); return NULL; } Py_INCREF(s); - PyString_InternInPlace(&s); + PyBytes_InternInPlace(&s); return s; } @@ -1457,7 +1457,7 @@ return NULL; } res = (*nb->nb_oct)(v); - if (res && !PyString_Check(res)) { + if (res && !PyBytes_Check(res)) { PyErr_Format(PyExc_TypeError, "__oct__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1492,16 +1492,16 @@ long ord; Py_ssize_t size; - if (PyString_Check(obj)) { - size = PyString_GET_SIZE(obj); + if (PyBytes_Check(obj)) { + size = PyBytes_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyString_AS_STRING(obj)); + ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); return PyInt_FromLong(ord); } - } else if (PyBytes_Check(obj)) { - size = PyBytes_GET_SIZE(obj); + } else if (PyByteArray_Check(obj)) { + size = PyByteArray_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); + ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj)); return PyInt_FromLong(ord); } @@ -1572,14 +1572,14 @@ Py_RETURN_NONE; } - if (sep && sep != Py_None && !PyString_Check(sep) && + if (sep && sep != Py_None && !PyBytes_Check(sep) && !PyUnicode_Check(sep)) { PyErr_Format(PyExc_TypeError, "sep must be None, str or unicode, not %.200s", sep->ob_type->tp_name); return NULL; } - if (end && end != Py_None && !PyString_Check(end) && + if (end && end != Py_None && !PyBytes_Check(end) && !PyUnicode_Check(end)) { PyErr_Format(PyExc_TypeError, "end must be None, str or unicode, not %.200s", @@ -1948,7 +1948,7 @@ po = PyObject_Str(v); if (po == NULL) return NULL; - prompt = PyString_AsString(po); + prompt = PyBytes_AsString(po); if (prompt == NULL) return NULL; } @@ -1976,7 +1976,7 @@ result = NULL; } else { - result = PyString_FromStringAndSize(s, len-1); + result = PyBytes_FromStringAndSize(s, len-1); } } PyMem_FREE(s); @@ -2305,14 +2305,14 @@ return PyFloat_FromDouble(f_result); } if (PyFloat_CheckExact(item)) { - PyFPE_START_PROTECT("add", return 0) + PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) f_result += PyFloat_AS_DOUBLE(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); continue; } if (PyInt_CheckExact(item)) { - PyFPE_START_PROTECT("add", return 0) + PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) f_result += (double)PyInt_AS_LONG(item); PyFPE_END_PROTECT(f_result) Py_DECREF(item); @@ -2618,8 +2618,8 @@ SETBUILTIN("basestring", &PyBaseString_Type); SETBUILTIN("bool", &PyBool_Type); /* SETBUILTIN("memoryview", &PyMemoryView_Type); */ - SETBUILTIN("bytearray", &PyBytes_Type); - SETBUILTIN("bytes", &PyString_Type); + SETBUILTIN("bytearray", &PyByteArray_Type); + SETBUILTIN("bytes", &PyBytes_Type); SETBUILTIN("buffer", &PyBuffer_Type); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX @@ -2639,7 +2639,7 @@ SETBUILTIN("set", &PySet_Type); SETBUILTIN("slice", &PySlice_Type); SETBUILTIN("staticmethod", &PyStaticMethod_Type); - SETBUILTIN("str", &PyString_Type); + SETBUILTIN("str", &PyBytes_Type); SETBUILTIN("super", &PySuper_Type); SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); @@ -2737,7 +2737,7 @@ { PyObject *result; Py_ssize_t i, j; - Py_ssize_t len = PyString_Size(strobj); + Py_ssize_t len = PyBytes_Size(strobj); Py_ssize_t outlen = len; if (func == Py_None) { @@ -2745,12 +2745,12 @@ * as no character is ever false and __getitem__ * does return this character. If it's a subclass * we must go through the __getitem__ loop */ - if (PyString_CheckExact(strobj)) { + if (PyBytes_CheckExact(strobj)) { Py_INCREF(strobj); return strobj; } } - if ((result = PyString_FromStringAndSize(NULL, len)) == NULL) + if ((result = PyBytes_FromStringAndSize(NULL, len)) == NULL) return NULL; for (i = j = 0; i < len; ++i) { @@ -2780,16 +2780,16 @@ } if (ok) { Py_ssize_t reslen; - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "can't filter str to str:" " __getitem__ returned different type"); Py_DECREF(item); goto Fail_1; } - reslen = PyString_GET_SIZE(item); + reslen = PyBytes_GET_SIZE(item); if (reslen == 1) { - PyString_AS_STRING(result)[j++] = - PyString_AS_STRING(item)[0]; + PyBytes_AS_STRING(result)[j++] = + PyBytes_AS_STRING(item)[0]; } else { /* do we need more space? */ Py_ssize_t need = j + reslen + len-i-1; @@ -2797,15 +2797,15 @@ /* overallocate, to avoid reallocations */ if (need<2*outlen) need = 2*outlen; - if (_PyString_Resize(&result, need)) { + if (_PyBytes_Resize(&result, need)) { Py_DECREF(item); return NULL; } outlen = need; } memcpy( - PyString_AS_STRING(result) + j, - PyString_AS_STRING(item), + PyBytes_AS_STRING(result) + j, + PyBytes_AS_STRING(item), reslen ); j += reslen; @@ -2815,7 +2815,7 @@ } if (j < outlen) - _PyString_Resize(&result, j); + _PyBytes_Resize(&result, j); return result; Modified: python/branches/okkoto-sizeof/Python/ceval.c ============================================================================== --- python/branches/okkoto-sizeof/Python/ceval.c (original) +++ python/branches/okkoto-sizeof/Python/ceval.c Wed Jun 4 11:24:23 2008 @@ -739,7 +739,7 @@ consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + co->co_nlocals; - first_instr = (unsigned char*) PyString_AS_STRING(co->co_code); + first_instr = (unsigned char*) PyBytes_AS_STRING(co->co_code); /* An explanation is in order for the next line. f->f_lasti now refers to the index of the last instruction @@ -766,7 +766,7 @@ lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co->co_filename); + filename = PyBytes_AsString(co->co_filename); #endif why = WHY_NOT; @@ -1147,8 +1147,8 @@ goto slow_add; x = PyInt_FromLong(i); } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { + else if (PyBytes_CheckExact(v) && + PyBytes_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_vx; @@ -1349,8 +1349,8 @@ goto slow_iadd; x = PyInt_FromLong(i); } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { + else if (PyBytes_CheckExact(v) && + PyBytes_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_v; @@ -1576,9 +1576,9 @@ err = PyFile_WriteObject(v, w, Py_PRINT_RAW); if (err == 0) { /* XXX move into writeobject() ? */ - if (PyString_Check(v)) { - char *s = PyString_AS_STRING(v); - Py_ssize_t len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + char *s = PyBytes_AS_STRING(v); + Py_ssize_t len = PyBytes_GET_SIZE(v); if (len == 0 || !isspace(Py_CHARMASK(s[len-1])) || s[len-1] == ' ') @@ -1705,7 +1705,7 @@ retval = POP(); } else if (PyExceptionClass_Check(v) || - PyString_Check(v)) { + PyBytes_Check(v)) { w = POP(); u = POP(); PyErr_Restore(v, w, u); @@ -1869,11 +1869,11 @@ case LOAD_GLOBAL: w = GETITEM(names, oparg); - if (PyString_CheckExact(w)) { + if (PyBytes_CheckExact(w)) { /* Inline the PyDict_GetItem() calls. WARNING: this is an extreme speed hack. Do not try this at home. */ - long hash = ((PyStringObject *)w)->ob_shash; + long hash = ((PyBytesObject *)w)->ob_shash; if (hash != -1) { PyDictObject *d; PyDictEntry *e; @@ -2726,7 +2726,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), defcount ? "at most" : "exactly", co->co_argcount, kwcount ? "non-keyword " : "", @@ -2756,10 +2756,10 @@ PyObject *keyword = kws[2*i]; PyObject *value = kws[2*i + 1]; int j; - if (keyword == NULL || !PyString_Check(keyword)) { + if (keyword == NULL || !PyBytes_Check(keyword)) { PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", - PyString_AsString(co->co_name)); + PyBytes_AsString(co->co_name)); goto fail; } /* XXX slow -- speed up using dictionary? */ @@ -2781,8 +2781,8 @@ PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected " "keyword argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(keyword)); + PyBytes_AsString(co->co_name), + PyBytes_AsString(keyword)); goto fail; } PyDict_SetItem(kwdict, keyword, value); @@ -2793,8 +2793,8 @@ "%.200s() got multiple " "values for keyword " "argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(keyword)); + PyBytes_AsString(co->co_name), + PyBytes_AsString(keyword)); goto fail; } Py_INCREF(value); @@ -2808,7 +2808,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), ((co->co_flags & CO_VARARGS) || defcount) ? "at least" : "exactly", @@ -2834,7 +2834,7 @@ if (argcount > 0 || kwcount > 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%d given)", - PyString_AsString(co->co_name), + PyBytes_AsString(co->co_name), argcount + kwcount); goto fail; } @@ -2860,11 +2860,11 @@ list so that we can march over it more efficiently? */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { - cellname = PyString_AS_STRING( + cellname = PyBytes_AS_STRING( PyTuple_GET_ITEM(co->co_cellvars, i)); found = 0; for (j = 0; j < nargs; j++) { - argname = PyString_AS_STRING( + argname = PyBytes_AS_STRING( PyTuple_GET_ITEM(co->co_varnames, j)); if (strcmp(cellname, argname) == 0) { c = PyCell_New(GETLOCAL(j)); @@ -3522,13 +3522,13 @@ if (PyMethod_Check(func)) return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) - return PyString_AsString(((PyFunctionObject*)func)->func_name); + return PyBytes_AsString(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else if (PyClass_Check(func)) - return PyString_AsString(((PyClassObject*)func)->cl_name); + return PyBytes_AsString(((PyClassObject*)func)->cl_name); else if (PyInstance_Check(func)) { - return PyString_AsString( + return PyBytes_AsString( ((PyInstanceObject*)func)->in_class->cl_name); } else { return func->ob_type->tp_name; @@ -3767,7 +3767,7 @@ "for keyword argument '%.200s'", PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), - PyString_AsString(key)); + PyBytes_AsString(key)); Py_DECREF(key); Py_DECREF(value); Py_DECREF(kwdict); @@ -4086,7 +4086,7 @@ length = PyTuple_Size(w); for (i = 0; i < length; i += 1) { PyObject *exc = PyTuple_GET_ITEM(w, i); - if (PyString_Check(exc)) { + if (PyBytes_Check(exc)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4109,7 +4109,7 @@ } } else { - if (PyString_Check(w)) { + if (PyBytes_Check(w)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4149,7 +4149,7 @@ if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, "cannot import name %.230s", - PyString_AsString(name)); + PyBytes_AsString(name)); } return x; } @@ -4191,8 +4191,8 @@ break; } if (skip_leading_underscores && - PyString_Check(name) && - PyString_AS_STRING(name)[0] == '_') + PyBytes_Check(name) && + PyBytes_AS_STRING(name)[0] == '_') { Py_DECREF(name); continue; @@ -4251,12 +4251,12 @@ PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); - if (PyString_Check(pvalue)) { + if (PyBytes_Check(pvalue)) { PyObject *newmsg; - newmsg = PyString_FromFormat( + newmsg = PyBytes_FromFormat( "Error when calling the metaclass bases\n" " %s", - PyString_AS_STRING(pvalue)); + PyBytes_AS_STRING(pvalue)); if (newmsg != NULL) { Py_DECREF(pvalue); pvalue = newmsg; @@ -4297,7 +4297,7 @@ } else if (locals == Py_None) locals = globals; - if (!PyString_Check(prog) && + if (!PyBytes_Check(prog) && !PyUnicode_Check(prog) && !PyCode_Check(prog) && !PyFile_Check(prog)) { @@ -4327,7 +4327,7 @@ } else if (PyFile_Check(prog)) { FILE *fp = PyFile_AsFile(prog); - char *name = PyString_AsString(PyFile_Name(prog)); + char *name = PyBytes_AsString(PyFile_Name(prog)); PyCompilerFlags cf; if (name == NULL) return -1; @@ -4353,7 +4353,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyString_AsStringAndSize(prog, &str, NULL)) + if (PyBytes_AsStringAndSize(prog, &str, NULL)) return -1; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, @@ -4378,7 +4378,7 @@ if (!obj) return; - obj_str = PyString_AsString(obj); + obj_str = PyBytes_AsString(obj); if (!obj_str) return; @@ -4391,8 +4391,8 @@ { /* This function implements 'variable += expr' when both arguments are strings. */ - Py_ssize_t v_len = PyString_GET_SIZE(v); - Py_ssize_t w_len = PyString_GET_SIZE(w); + Py_ssize_t v_len = PyBytes_GET_SIZE(v); + Py_ssize_t w_len = PyBytes_GET_SIZE(w); Py_ssize_t new_len = v_len + w_len; if (new_len < 0) { PyErr_SetString(PyExc_OverflowError, @@ -4441,12 +4441,12 @@ } } - if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) { + if (v->ob_refcnt == 1 && !PyBytes_CHECK_INTERNED(v)) { /* Now we own the last reference to 'v', so we can resize it * in-place. */ - if (_PyString_Resize(&v, new_len) != 0) { - /* XXX if _PyString_Resize() fails, 'v' has been + if (_PyBytes_Resize(&v, new_len) != 0) { + /* XXX if _PyBytes_Resize() fails, 'v' has been * deallocated so it cannot be put back into * 'variable'. The MemoryError is raised when there * is no value in 'variable', which might (very @@ -4455,13 +4455,13 @@ return NULL; } /* copy 'w' into the newly allocated area of 'v' */ - memcpy(PyString_AS_STRING(v) + v_len, - PyString_AS_STRING(w), w_len); + memcpy(PyBytes_AS_STRING(v) + v_len, + PyBytes_AS_STRING(w), w_len); return v; } else { /* When in-place resizing is not an option. */ - PyString_Concat(&v, w); + PyBytes_Concat(&v, w); return v; } } Modified: python/branches/okkoto-sizeof/Python/codecs.c ============================================================================== --- python/branches/okkoto-sizeof/Python/codecs.c (original) +++ python/branches/okkoto-sizeof/Python/codecs.c Wed Jun 4 11:24:23 2008 @@ -61,10 +61,10 @@ return NULL; } - v = PyString_FromStringAndSize(NULL, len); + v = PyBytes_FromStringAndSize(NULL, len); if (v == NULL) return NULL; - p = PyString_AS_STRING(v); + p = PyBytes_AS_STRING(v); for (i = 0; i < len; i++) { register char ch = string[i]; if (ch == ' ') @@ -112,7 +112,7 @@ v = normalizestring(encoding); if (v == NULL) goto onError; - PyString_InternInPlace(&v); + PyBytes_InternInPlace(&v); /* First, try to lookup the name in the registry dictionary */ result = PyDict_GetItem(interp->codec_search_cache, v); @@ -190,7 +190,7 @@ if (errors) { PyObject *v; - v = PyString_FromString(errors); + v = PyBytes_FromString(errors); if (v == NULL) { Py_DECREF(args); return NULL; @@ -451,7 +451,7 @@ if (string != NULL) { PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", - PyString_AS_STRING(string)); + PyBytes_AS_STRING(string)); Py_DECREF(string); } } Modified: python/branches/okkoto-sizeof/Python/compile.c ============================================================================== --- python/branches/okkoto-sizeof/Python/compile.c (original) +++ python/branches/okkoto-sizeof/Python/compile.c Wed Jun 4 11:24:23 2008 @@ -184,15 +184,15 @@ { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ - const char *p, *name = PyString_AsString(ident); + const char *p, *name = PyBytes_AsString(ident); char *buffer; size_t nlen, plen; - if (privateobj == NULL || !PyString_Check(privateobj) || + if (privateobj == NULL || !PyBytes_Check(privateobj) || name == NULL || name[0] != '_' || name[1] != '_') { Py_INCREF(ident); return ident; } - p = PyString_AsString(privateobj); + p = PyBytes_AsString(privateobj); nlen = strlen(name); /* Don't mangle __id__ or names with dots. @@ -216,11 +216,11 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); - ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); + ident = PyBytes_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ - buffer = PyString_AS_STRING(ident); + buffer = PyBytes_AS_STRING(ident); buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); @@ -249,7 +249,7 @@ int merged; if (!__doc__) { - __doc__ = PyString_InternFromString("__doc__"); + __doc__ = PyBytes_InternFromString("__doc__"); if (!__doc__) return NULL; } @@ -540,7 +540,7 @@ { char tmpname[256]; PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyString_FromString(tmpname); + return PyBytes_FromString(tmpname); } /* Allocate a new block and return a pointer to it. @@ -1193,7 +1193,7 @@ int addNone = 1; static PyObject *module; if (!module) { - module = PyString_InternFromString(""); + module = PyBytes_InternFromString(""); if (!module) return NULL; } @@ -1245,8 +1245,8 @@ PyOS_snprintf(buf, sizeof(buf), "unknown scope for %.100s in %.100s(%s) in %s\n" "symbols: %s\nlocals: %s\nglobals: %s\n", - PyString_AS_STRING(name), - PyString_AS_STRING(c->u->u_name), + PyBytes_AS_STRING(name), + PyBytes_AS_STRING(c->u->u_name), PyObject_REPR(c->u->u_ste->ste_id), c->c_filename, PyObject_REPR(c->u->u_ste->ste_symbols), @@ -1304,9 +1304,9 @@ printf("lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), - PyString_AS_STRING(c->u->u_name), + PyBytes_AS_STRING(c->u->u_name), reftype, arg, - PyString_AS_STRING(co->co_name), + PyBytes_AS_STRING(co->co_name), PyObject_REPR(co->co_freevars)); Py_FatalError("compiler_make_closure()"); } @@ -1341,7 +1341,7 @@ for (i = 0; i < n; i++) { expr_ty arg = (expr_ty)asdl_seq_GET(args->args, i); if (arg->kind == Tuple_kind) { - PyObject *id = PyString_FromFormat(".%d", i); + PyObject *id = PyBytes_FromFormat(".%d", i); if (id == NULL) { return 0; } @@ -1434,7 +1434,7 @@ Py_XDECREF(c->u->u_private); c->u->u_private = s->v.ClassDef.name; Py_INCREF(c->u->u_private); - str = PyString_InternFromString("__name__"); + str = PyBytes_InternFromString("__name__"); if (!str || !compiler_nameop(c, str, Load)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1442,7 +1442,7 @@ } Py_DECREF(str); - str = PyString_InternFromString("__module__"); + str = PyBytes_InternFromString("__module__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1509,7 +1509,7 @@ assert(e->kind == Lambda_kind); if (!name) { - name = PyString_InternFromString(""); + name = PyBytes_InternFromString(""); if (!name) return 0; } @@ -1899,7 +1899,7 @@ If there is a dot in name, we need to split it and emit a LOAD_ATTR for each name. */ - const char *src = PyString_AS_STRING(name); + const char *src = PyBytes_AS_STRING(name); const char *dot = strchr(src, '.'); if (dot) { /* Consume the base module name to get the first attribute */ @@ -1908,7 +1908,7 @@ /* NB src is only defined when dot != NULL */ PyObject *attr; dot = strchr(src, '.'); - attr = PyString_FromStringAndSize(src, + attr = PyBytes_FromStringAndSize(src, dot ? dot - src : strlen(src)); if (!attr) return -1; @@ -1957,10 +1957,10 @@ } else { identifier tmp = alias->name; - const char *base = PyString_AS_STRING(alias->name); + const char *base = PyBytes_AS_STRING(alias->name); char *dot = strchr(base, '.'); if (dot) - tmp = PyString_FromStringAndSize(base, + tmp = PyBytes_FromStringAndSize(base, dot - base); r = compiler_nameop(c, tmp, Store); if (dot) { @@ -2003,7 +2003,7 @@ } if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), + if (!strcmp(PyBytes_AS_STRING(s->v.ImportFrom.module), "__future__")) { Py_DECREF(level); Py_DECREF(names); @@ -2023,7 +2023,7 @@ alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; - if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { + if (i == 0 && *PyBytes_AS_STRING(alias->name) == '*') { assert(n == 1); ADDOP(c, IMPORT_STAR); return 1; @@ -2053,7 +2053,7 @@ if (Py_OptimizeFlag) return 1; if (assertion_error == NULL) { - assertion_error = PyString_InternFromString("AssertionError"); + assertion_error = PyBytes_InternFromString("AssertionError"); if (assertion_error == NULL) return 0; } @@ -2336,7 +2336,7 @@ /* First check for assignment to __debug__. Param? */ if ((ctx == Store || ctx == AugStore || ctx == Del) - && !strcmp(PyString_AS_STRING(name), "__debug__")) { + && !strcmp(PyBytes_AS_STRING(name), "__debug__")) { return compiler_error(c, "can not assign to __debug__"); } @@ -2374,7 +2374,7 @@ } /* XXX Leave assert here, but handle __doc__ and the like better */ - assert(scope || PyString_AS_STRING(name)[0] == '_'); + assert(scope || PyBytes_AS_STRING(name)[0] == '_'); switch (optype) { case OP_DEREF: @@ -2388,7 +2388,7 @@ PyErr_Format(PyExc_SyntaxError, "can not delete variable '%s' referenced " "in nested scope", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); Py_DECREF(mangled); return 0; case Param: @@ -2773,7 +2773,7 @@ 0)))->iter; if (!name) { - name = PyString_FromString(""); + name = PyBytes_FromString(""); if (!name) return 0; } @@ -2822,7 +2822,7 @@ case Name_kind: /* __debug__ is not assignable, so we can optimize * it away in if and while statements */ - if (strcmp(PyString_AS_STRING(e->v.Name.id), + if (strcmp(PyBytes_AS_STRING(e->v.Name.id), "__debug__") == 0) return ! Py_OptimizeFlag; /* fall through */ @@ -2864,12 +2864,12 @@ assert(s->kind == With_kind); if (!enter_attr) { - enter_attr = PyString_InternFromString("__enter__"); + enter_attr = PyBytes_InternFromString("__enter__"); if (!enter_attr) return 0; } if (!exit_attr) { - exit_attr = PyString_InternFromString("__exit__"); + exit_attr = PyBytes_InternFromString("__exit__"); if (!exit_attr) return 0; } @@ -3472,10 +3472,10 @@ { memset(a, 0, sizeof(struct assembler)); a->a_lineno = firstlineno; - a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); + a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); if (!a->a_bytecode) return 0; - a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); + a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; a->a_postorder = (basicblock **)PyObject_Malloc( @@ -3584,17 +3584,17 @@ if (d_bytecode > 255) { int j, nbytes, ncodes = d_bytecode / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyString_Resize(&a->a_lnotab, len) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; for (j = 0; j < ncodes; j++) { *lnotab++ = 255; *lnotab++ = 0; @@ -3606,17 +3606,17 @@ if (d_lineno > 255) { int j, nbytes, ncodes = d_lineno / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyString_Resize(&a->a_lnotab, len) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; *lnotab++ = d_bytecode; *lnotab++ = 255; d_bytecode = 0; @@ -3628,13 +3628,13 @@ a->a_lnotab_off += ncodes * 2; } - len = PyString_GET_SIZE(a->a_lnotab); + len = PyBytes_GET_SIZE(a->a_lnotab); if (a->a_lnotab_off + 2 >= len) { - if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) + if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) return 0; } lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; a->a_lnotab_off += 2; if (d_bytecode) { @@ -3659,7 +3659,7 @@ assemble_emit(struct assembler *a, struct instr *i) { int size, arg = 0, ext = 0; - Py_ssize_t len = PyString_GET_SIZE(a->a_bytecode); + Py_ssize_t len = PyBytes_GET_SIZE(a->a_bytecode); char *code; size = instrsize(i); @@ -3670,10 +3670,10 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { - if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) + if (_PyBytes_Resize(&a->a_bytecode, len * 2) < 0) return 0; } - code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; + code = PyBytes_AS_STRING(a->a_bytecode) + a->a_offset; a->a_offset += size; if (size == 6) { assert(i->i_hasarg); @@ -3846,7 +3846,7 @@ freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); if (!freevars) goto error; - filename = PyString_FromString(c->c_filename); + filename = PyBytes_FromString(c->c_filename); if (!filename) goto error; @@ -3966,9 +3966,9 @@ goto error; } - if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) + if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) goto error; - if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0) + if (_PyBytes_Resize(&a.a_bytecode, a.a_offset) < 0) goto error; co = makecode(c, &a); Modified: python/branches/okkoto-sizeof/Python/errors.c ============================================================================== --- python/branches/okkoto-sizeof/Python/errors.c (original) +++ python/branches/okkoto-sizeof/Python/errors.c Wed Jun 4 11:24:23 2008 @@ -66,7 +66,7 @@ void PyErr_SetString(PyObject *exception, const char *string) { - PyObject *value = PyString_FromString(string); + PyObject *value = PyBytes_FromString(string); PyErr_SetObject(exception, value); Py_XDECREF(value); } @@ -351,7 +351,7 @@ PyObject * PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); Py_XDECREF(name); return result; @@ -430,7 +430,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, ierr, name); @@ -469,7 +469,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyString_FromString(filename) : NULL; + PyObject *name = filename ? PyBytes_FromString(filename) : NULL; PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( PyExc_WindowsError, ierr, name); @@ -527,7 +527,7 @@ va_start(vargs); #endif - string = PyString_FromFormatV(format, vargs); + string = PyBytes_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); va_end(vargs); @@ -559,7 +559,7 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, + modulename = PyBytes_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; @@ -611,7 +611,7 @@ if (moduleName == NULL) PyFile_WriteString("", f); else { - char* modstr = PyString_AsString(moduleName); + char* modstr = PyBytes_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions") != 0) { @@ -665,7 +665,7 @@ Py_DECREF(tmp); } if (filename != NULL) { - tmp = PyString_FromString(filename); + tmp = PyBytes_FromString(filename); if (tmp == NULL) PyErr_Clear(); else { @@ -742,7 +742,7 @@ char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - return PyString_FromString(p); + return PyBytes_FromString(p); } return NULL; } Modified: python/branches/okkoto-sizeof/Python/formatter_string.c ============================================================================== --- python/branches/okkoto-sizeof/Python/formatter_string.c (original) +++ python/branches/okkoto-sizeof/Python/formatter_string.c Wed Jun 4 11:24:23 2008 @@ -4,12 +4,11 @@ of int.__float__, etc., that take and return string objects */ #include "Python.h" -#include "formatter_string.h" - #include "../Objects/stringlib/stringdefs.h" -#define FORMAT_STRING string__format__ -#define FORMAT_LONG string_long__format__ -#define FORMAT_INT string_int__format__ -#define FORMAT_FLOAT string_float__format__ +#define FORMAT_STRING _PyBytes_FormatAdvanced +#define FORMAT_LONG _PyLong_FormatAdvanced +#define FORMAT_INT _PyInt_FormatAdvanced +#define FORMAT_FLOAT _PyFloat_FormatAdvanced + #include "../Objects/stringlib/formatter.h" Modified: python/branches/okkoto-sizeof/Python/formatter_unicode.c ============================================================================== --- python/branches/okkoto-sizeof/Python/formatter_unicode.c (original) +++ python/branches/okkoto-sizeof/Python/formatter_unicode.c Wed Jun 4 11:24:23 2008 @@ -2,12 +2,12 @@ built-in formatter for unicode. That is, unicode.__format__(). */ #include "Python.h" -#include "formatter_unicode.h" - #include "../Objects/stringlib/unicodedefs.h" -#define FORMAT_STRING unicode__format__ +#define FORMAT_STRING _PyUnicode_FormatAdvanced + /* don't define FORMAT_LONG and FORMAT_FLOAT, since we can live with only the string versions of those. The builtin format() will convert them to unicode. */ + #include "../Objects/stringlib/formatter.h" Modified: python/branches/okkoto-sizeof/Python/future.c ============================================================================== --- python/branches/okkoto-sizeof/Python/future.c (original) +++ python/branches/okkoto-sizeof/Python/future.c Wed Jun 4 11:24:23 2008 @@ -20,7 +20,7 @@ names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyString_AsString(name->name); + const char *feature = PyBytes_AsString(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { @@ -59,7 +59,7 @@ static PyObject *future; if (!future) { - future = PyString_InternFromString("__future__"); + future = PyBytes_InternFromString("__future__"); if (!future) return 0; } Modified: python/branches/okkoto-sizeof/Python/getargs.c ============================================================================== --- python/branches/okkoto-sizeof/Python/getargs.c (original) +++ python/branches/okkoto-sizeof/Python/getargs.c Wed Jun 4 11:24:23 2008 @@ -418,7 +418,7 @@ n++; } - if (!PySequence_Check(arg) || PyString_Check(arg)) { + if (!PySequence_Check(arg) || PyBytes_Check(arg)) { levels[0] = 0; PyOS_snprintf(msgbuf, bufsize, toplevel ? "expected %d arguments, not %.50s" : @@ -765,8 +765,8 @@ case 'c': {/* char */ char *p = va_arg(*p_va, char *); - if (PyString_Check(arg) && PyString_Size(arg) == 1) - *p = PyString_AS_STRING(arg)[0]; + if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1) + *p = PyBytes_AS_STRING(arg)[0]; else return converterr("char", arg, msgbuf, bufsize); break; @@ -777,9 +777,9 @@ void **p = (void **)va_arg(*p_va, char **); FETCH_SIZE; - if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); + if (PyBytes_Check(arg)) { + *p = PyBytes_AS_STRING(arg); + STORE_SIZE(PyBytes_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -787,8 +787,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); + *p = PyBytes_AS_STRING(uarg); + STORE_SIZE(PyBytes_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -802,20 +802,20 @@ } else { char **p = va_arg(*p_va, char **); - if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); + if (PyBytes_Check(arg)) + *p = PyBytes_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); + *p = PyBytes_AS_STRING(uarg); } #endif else return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -831,9 +831,9 @@ *p = 0; STORE_SIZE(0); } - else if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); + else if (PyBytes_Check(arg)) { + *p = PyBytes_AS_STRING(arg); + STORE_SIZE(PyBytes_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -841,8 +841,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); + *p = PyBytes_AS_STRING(uarg); + STORE_SIZE(PyBytes_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -858,15 +858,15 @@ if (arg == Py_None) *p = 0; - else if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); + else if (PyBytes_Check(arg)) + *p = PyBytes_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); + *p = PyBytes_AS_STRING(uarg); } #endif else @@ -878,11 +878,11 @@ if (arg == Py_None) *q = 0; else - *q = PyString_Size(arg); + *q = PyBytes_Size(arg); format++; } else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyString_Size(arg)) + (Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -923,7 +923,7 @@ arg, msgbuf, bufsize); /* Encode object */ - if (!recode_strings && PyString_Check(arg)) { + if (!recode_strings && PyBytes_Check(arg)) { s = arg; Py_INCREF(s); } @@ -946,7 +946,7 @@ if (s == NULL) return converterr("(encoding failed)", arg, msgbuf, bufsize); - if (!PyString_Check(s)) { + if (!PyBytes_Check(s)) { Py_DECREF(s); return converterr( "(encoder failed to return a string)", @@ -956,7 +956,7 @@ return converterr("string", arg, msgbuf, bufsize); #endif } - size = PyString_GET_SIZE(s); + size = PyBytes_GET_SIZE(s); /* Write output; output is guaranteed to be 0-terminated */ if (*format == '#') { @@ -1013,7 +1013,7 @@ } } memcpy(*buffer, - PyString_AS_STRING(s), + PyBytes_AS_STRING(s), size + 1); STORE_SIZE(size); } else { @@ -1030,7 +1030,7 @@ PyMem_Free()ing it after usage */ - if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) + if ((Py_ssize_t)strlen(PyBytes_AS_STRING(s)) != size) { Py_DECREF(s); return converterr( @@ -1049,7 +1049,7 @@ arg, msgbuf, bufsize); } memcpy(*buffer, - PyString_AS_STRING(s), + PyBytes_AS_STRING(s), size + 1); } Py_DECREF(s); @@ -1083,7 +1083,7 @@ case 'S': { /* string object */ PyObject **p = va_arg(*p_va, PyObject **); - if (PyString_Check(arg)) + if (PyBytes_Check(arg)) *p = arg; else return converterr("string", arg, msgbuf, bufsize); @@ -1473,12 +1473,12 @@ while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; char *ks; - if (!PyString_Check(key)) { + if (!PyBytes_Check(key)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return cleanreturn(0, freelist); } - ks = PyString_AsString(key); + ks = PyBytes_AsString(key); for (i = 0; i < len; i++) { if (!strcmp(ks, kwlist[i])) { match = 1; Modified: python/branches/okkoto-sizeof/Python/import.c ============================================================================== --- python/branches/okkoto-sizeof/Python/import.c (original) +++ python/branches/okkoto-sizeof/Python/import.c Wed Jun 4 11:24:23 2008 @@ -467,8 +467,8 @@ while (PyDict_Next(modules, &pos, &key, &value)) { if (value->ob_refcnt != 1) continue; - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); + if (PyBytes_Check(key) && PyModule_Check(value)) { + name = PyBytes_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -486,8 +486,8 @@ /* Next, delete all modules (still skipping __builtin__ and sys) */ pos = 0; while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); + if (PyBytes_Check(key) && PyModule_Check(value)) { + name = PyBytes_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -665,7 +665,7 @@ /* Remember the filename as the __file__ attribute */ v = NULL; if (pathname != NULL) { - v = PyString_FromString(pathname); + v = PyBytes_FromString(pathname); if (v == NULL) PyErr_Clear(); } @@ -1002,7 +1002,7 @@ PySys_WriteStderr("import %s # directory %s\n", name, pathname); d = PyModule_GetDict(m); - file = PyString_FromString(pathname); + file = PyBytes_FromString(pathname); if (file == NULL) goto error; path = Py_BuildValue("[O]", file); @@ -1214,15 +1214,15 @@ Py_DECREF(meta_path); } - if (path != NULL && PyString_Check(path)) { + if (path != NULL && PyBytes_Check(path)) { /* The only type of submodule allowed inside a "frozen" package are other frozen modules or packages. */ - if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) { + if (PyBytes_Size(path) + 1 + strlen(name) >= (size_t)buflen) { PyErr_SetString(PyExc_ImportError, "full frozen module name too long"); return NULL; } - strcpy(buf, PyString_AsString(path)); + strcpy(buf, PyBytes_AsString(path)); strcat(buf, "."); strcat(buf, name); strcpy(name, buf); @@ -1291,14 +1291,14 @@ } else #endif - if (!PyString_Check(v)) + if (!PyBytes_Check(v)) continue; - len = PyString_GET_SIZE(v); + len = PyBytes_GET_SIZE(v); if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyString_AS_STRING(v)); + strcpy(buf, PyBytes_AS_STRING(v)); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */ @@ -1963,7 +1963,7 @@ if (m == NULL) goto err_return; d = PyModule_GetDict(m); - s = PyString_InternFromString(name); + s = PyBytes_InternFromString(name); if (s == NULL) goto err_return; err = PyDict_SetItemString(d, "__path__", s); @@ -1992,7 +1992,7 @@ PyObject *pname; PyObject *result; - pname = PyString_FromString(name); + pname = PyBytes_FromString(name); if (pname == NULL) return NULL; result = PyImport_Import(pname); @@ -2165,17 +2165,17 @@ return Py_None; if (namestr == NULL) { - namestr = PyString_InternFromString("__name__"); + namestr = PyBytes_InternFromString("__name__"); if (namestr == NULL) return NULL; } if (pathstr == NULL) { - pathstr = PyString_InternFromString("__path__"); + pathstr = PyBytes_InternFromString("__path__"); if (pathstr == NULL) return NULL; } if (pkgstr == NULL) { - pkgstr = PyString_InternFromString("__package__"); + pkgstr = PyBytes_InternFromString("__package__"); if (pkgstr == NULL) return NULL; } @@ -2187,12 +2187,12 @@ if ((pkgname != NULL) && (pkgname != Py_None)) { /* __package__ is set, so use it */ Py_ssize_t len; - if (!PyString_Check(pkgname)) { + if (!PyBytes_Check(pkgname)) { PyErr_SetString(PyExc_ValueError, "__package__ set to non-string"); return NULL; } - len = PyString_GET_SIZE(pkgname); + len = PyBytes_GET_SIZE(pkgname); if (len == 0) { if (level > 0) { PyErr_SetString(PyExc_ValueError, @@ -2206,24 +2206,24 @@ "Package name too long"); return NULL; } - strcpy(buf, PyString_AS_STRING(pkgname)); + strcpy(buf, PyBytes_AS_STRING(pkgname)); } else { /* __package__ not set, so figure it out and set it */ modname = PyDict_GetItem(globals, namestr); - if (modname == NULL || !PyString_Check(modname)) + if (modname == NULL || !PyBytes_Check(modname)) return Py_None; modpath = PyDict_GetItem(globals, pathstr); if (modpath != NULL) { /* __path__ is set, so modname is already the package name */ - Py_ssize_t len = PyString_GET_SIZE(modname); + Py_ssize_t len = PyBytes_GET_SIZE(modname); int error; if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long"); return NULL; } - strcpy(buf, PyString_AS_STRING(modname)); + strcpy(buf, PyBytes_AS_STRING(modname)); error = PyDict_SetItem(globals, pkgstr, modname); if (error) { PyErr_SetString(PyExc_ValueError, @@ -2232,7 +2232,7 @@ } } else { /* Normal module, so work out the package name if any */ - char *start = PyString_AS_STRING(modname); + char *start = PyBytes_AS_STRING(modname); char *lastdot = strrchr(start, '.'); size_t len; int error; @@ -2258,7 +2258,7 @@ } strncpy(buf, start, len); buf[len] = '\0'; - pkgname = PyString_FromString(buf); + pkgname = PyBytes_FromString(buf); if (pkgname == NULL) { return NULL; } @@ -2394,13 +2394,13 @@ } return 0; } - if (!PyString_Check(item)) { + if (!PyBytes_Check(item)) { PyErr_SetString(PyExc_TypeError, "Item in ``from list'' not a string"); Py_DECREF(item); return 0; } - if (PyString_AS_STRING(item)[0] == '*') { + if (PyBytes_AS_STRING(item)[0] == '*') { PyObject *all; Py_DECREF(item); /* See if the package defines __all__ */ @@ -2419,7 +2419,7 @@ } hasit = PyObject_HasAttr(mod, item); if (!hasit) { - char *subname = PyString_AS_STRING(item); + char *subname = PyBytes_AS_STRING(item); PyObject *submod; char *p; if (buflen + strlen(subname) >= MAXPATHLEN) { @@ -2585,7 +2585,7 @@ subname = name; else { PyObject *parentname, *parent; - parentname = PyString_FromStringAndSize(name, (subname-name)); + parentname = PyBytes_FromStringAndSize(name, (subname-name)); if (parentname == NULL) { imp_modules_reloading_clear(); return NULL; @@ -2594,7 +2594,7 @@ if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - PyString_AS_STRING(parentname)); + PyBytes_AS_STRING(parentname)); Py_DECREF(parentname); imp_modules_reloading_clear(); return NULL; @@ -2639,7 +2639,7 @@ done using whatever import hooks are installed in the current environment, e.g. by "rexec". A dummy list ["__doc__"] is passed as the 4th argument so that - e.g. PyImport_Import(PyString_FromString("win32com.client.gencache")) + e.g. PyImport_Import(PyBytes_FromString("win32com.client.gencache")) will return instead of . */ PyObject * @@ -2655,10 +2655,10 @@ /* Initialize constant string objects */ if (silly_list == NULL) { - import_str = PyString_InternFromString("__import__"); + import_str = PyBytes_InternFromString("__import__"); if (import_str == NULL) return NULL; - builtins_str = PyString_InternFromString("__builtins__"); + builtins_str = PyBytes_InternFromString("__builtins__"); if (builtins_str == NULL) return NULL; silly_list = Py_BuildValue("[s]", "__doc__"); @@ -2726,7 +2726,7 @@ buf[2] = (char) ((pyc_magic >> 16) & 0xff); buf[3] = (char) ((pyc_magic >> 24) & 0xff); - return PyString_FromStringAndSize(buf, 4); + return PyBytes_FromStringAndSize(buf, 4); } static PyObject * Modified: python/branches/okkoto-sizeof/Python/mactoolboxglue.c ============================================================================== --- python/branches/okkoto-sizeof/Python/mactoolboxglue.c (original) +++ python/branches/okkoto-sizeof/Python/mactoolboxglue.c Wed Jun 4 11:24:23 2008 @@ -52,7 +52,7 @@ buf[0] = '\0'; } else { - char *input = PyString_AsString(rv); + char *input = PyBytes_AsString(rv); if (!input) { PyErr_Clear(); buf[0] = '\0'; @@ -124,7 +124,7 @@ if (!rv) goto error; - input = PyString_AsString(rv); + input = PyBytes_AsString(rv); if (!input) goto error; @@ -159,12 +159,12 @@ PyMac_GetOSType(PyObject *v, OSType *pr) { uint32_t tmp; - if (!PyString_Check(v) || PyString_Size(v) != 4) { + if (!PyBytes_Check(v) || PyBytes_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)&tmp, PyString_AsString(v), 4); + memcpy((char *)&tmp, PyBytes_AsString(v), 4); *pr = (OSType)ntohl(tmp); return 1; } @@ -174,7 +174,7 @@ PyMac_BuildOSType(OSType t) { uint32_t tmp = htonl((uint32_t)t); - return PyString_FromStringAndSize((char *)&tmp, 4); + return PyBytes_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -190,13 +190,13 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf) { int len; - if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { + if (!PyBytes_Check(v) || (len = PyBytes_Size(v)) > 255) { PyErr_SetString(PyExc_TypeError, "Str255 arg must be string of at most 255 chars"); return 0; } pbuf[0] = len; - memcpy((char *)(pbuf+1), PyString_AsString(v), len); + memcpy((char *)(pbuf+1), PyBytes_AsString(v), len); return 1; } @@ -208,7 +208,7 @@ PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); return NULL; } - return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); } PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); } Modified: python/branches/okkoto-sizeof/Python/marshal.c ============================================================================== --- python/branches/okkoto-sizeof/Python/marshal.c (original) +++ python/branches/okkoto-sizeof/Python/marshal.c Wed Jun 4 11:24:23 2008 @@ -64,18 +64,18 @@ Py_ssize_t size, newsize; if (p->str == NULL) return; /* An error already occurred */ - size = PyString_Size(p->str); + size = PyBytes_Size(p->str); newsize = size + size + 1024; if (newsize > 32*1024*1024) { newsize = size + 1024*1024; } - if (_PyString_Resize(&p->str, newsize) != 0) { + if (_PyBytes_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; } else { - p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size; + p->ptr = PyBytes_AS_STRING((PyBytesObject *)p->str) + size; p->end = - PyString_AS_STRING((PyStringObject *)p->str) + newsize; + PyBytes_AS_STRING((PyBytesObject *)p->str) + newsize; *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char); } } @@ -239,8 +239,8 @@ } } #endif - else if (PyString_CheckExact(v)) { - if (p->strings && PyString_CHECK_INTERNED(v)) { + else if (PyBytes_CheckExact(v)) { + if (p->strings && PyBytes_CHECK_INTERNED(v)) { PyObject *o = PyDict_GetItem(p->strings, v); if (o) { long w = PyInt_AsLong(o); @@ -265,7 +265,7 @@ else { w_byte(TYPE_STRING, p); } - n = PyString_GET_SIZE(v); + n = PyBytes_GET_SIZE(v); if (n > INT_MAX) { /* huge strings are not supported */ p->depth--; @@ -273,7 +273,7 @@ return; } w_long((long)n, p); - w_string(PyString_AS_STRING(v), (int)n, p); + w_string(PyBytes_AS_STRING(v), (int)n, p); } #ifdef Py_USING_UNICODE else if (PyUnicode_CheckExact(v)) { @@ -285,14 +285,14 @@ return; } w_byte(TYPE_UNICODE, p); - n = PyString_GET_SIZE(utf8); + n = PyBytes_GET_SIZE(utf8); if (n > INT_MAX) { p->depth--; p->error = 1; return; } w_long((long)n, p); - w_string(PyString_AS_STRING(utf8), (int)n, p); + w_string(PyBytes_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } #endif @@ -713,12 +713,12 @@ retval = NULL; break; } - v = PyString_FromStringAndSize((char *)NULL, n); + v = PyBytes_FromStringAndSize((char *)NULL, n); if (v == NULL) { retval = NULL; break; } - if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { + if (r_string(PyBytes_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); @@ -726,7 +726,7 @@ break; } if (type == TYPE_INTERNED) { - PyString_InternInPlace(&v); + PyBytes_InternInPlace(&v); if (PyList_Append(p->strings, v) < 0) { retval = NULL; break; @@ -1113,11 +1113,11 @@ { WFILE wf; wf.fp = NULL; - wf.str = PyString_FromStringAndSize((char *)NULL, 50); + wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; - wf.ptr = PyString_AS_STRING((PyStringObject *)wf.str); - wf.end = wf.ptr + PyString_Size(wf.str); + wf.ptr = PyBytes_AS_STRING((PyBytesObject *)wf.str); + wf.end = wf.ptr + PyBytes_Size(wf.str); wf.error = 0; wf.depth = 0; wf.version = version; @@ -1125,14 +1125,14 @@ w_object(x, &wf); Py_XDECREF(wf.strings); if (wf.str != NULL) { - char *base = PyString_AS_STRING((PyStringObject *)wf.str); + char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, "too much marshall data for a string"); return NULL; } - _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + _PyBytes_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); } if (wf.error) { Py_XDECREF(wf.str); Modified: python/branches/okkoto-sizeof/Python/modsupport.c ============================================================================== --- python/branches/okkoto-sizeof/Python/modsupport.c (original) +++ python/branches/okkoto-sizeof/Python/modsupport.c Wed Jun 4 11:24:23 2008 @@ -65,7 +65,7 @@ return NULL; d = PyModule_GetDict(m); if (methods != NULL) { - n = PyString_FromString(name); + n = PyBytes_FromString(name); if (n == NULL) return NULL; for (ml = methods; ml->ml_name != NULL; ml++) { @@ -92,7 +92,7 @@ Py_DECREF(n); } if (doc != NULL) { - v = PyString_FromString(doc); + v = PyBytes_FromString(doc); if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { Py_XDECREF(v); return NULL; @@ -391,7 +391,7 @@ { char p[1]; p[0] = (char)va_arg(*p_va, int); - return PyString_FromStringAndSize(p, 1); + return PyBytes_FromStringAndSize(p, 1); } case 's': @@ -423,7 +423,7 @@ } n = (Py_ssize_t)m; } - v = PyString_FromStringAndSize(str, n); + v = PyBytes_FromStringAndSize(str, n); } return v; } @@ -633,7 +633,7 @@ int PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) { - PyObject *o = PyString_FromString(value); + PyObject *o = PyBytes_FromString(value); if (!o) return -1; if (PyModule_AddObject(m, name, o) == 0) Modified: python/branches/okkoto-sizeof/Python/mysnprintf.c ============================================================================== --- python/branches/okkoto-sizeof/Python/mysnprintf.c (original) +++ python/branches/okkoto-sizeof/Python/mysnprintf.c Wed Jun 4 11:24:23 2008 @@ -54,18 +54,28 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) { int len; /* # bytes written, excluding \0 */ -#ifndef HAVE_SNPRINTF +#ifdef HAVE_SNPRINTF +#define _PyOS_vsnprintf_EXTRA_SPACE 1 +#else +#define _PyOS_vsnprintf_EXTRA_SPACE 512 char *buffer; #endif assert(str != NULL); assert(size > 0); assert(format != NULL); + /* We take a size_t as input but return an int. Sanity check + * our input so that it won't cause an overflow in the + * vsnprintf return value or the buffer malloc size. */ + if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) { + len = -666; + goto Done; + } #ifdef HAVE_SNPRINTF len = vsnprintf(str, size, format, va); #else /* Emulate it. */ - buffer = PyMem_MALLOC(size + 512); + buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE); if (buffer == NULL) { len = -666; goto Done; @@ -75,7 +85,7 @@ if (len < 0) /* ignore the error */; - else if ((size_t)len >= size + 512) + else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); else { @@ -86,8 +96,10 @@ str[to_copy] = '\0'; } PyMem_FREE(buffer); -Done: #endif - str[size-1] = '\0'; +Done: + if (size > 0) + str[size-1] = '\0'; return len; +#undef _PyOS_vsnprintf_EXTRA_SPACE } Modified: python/branches/okkoto-sizeof/Python/peephole.c ============================================================================== --- python/branches/okkoto-sizeof/Python/peephole.c (original) +++ python/branches/okkoto-sizeof/Python/peephole.c Wed Jun 4 11:24:23 2008 @@ -300,15 +300,15 @@ goto exitUnchanged; /* Bypass optimization when the lineno table is too complex */ - assert(PyString_Check(lineno_obj)); - lineno = (unsigned char*)PyString_AS_STRING(lineno_obj); - tabsiz = PyString_GET_SIZE(lineno_obj); + assert(PyBytes_Check(lineno_obj)); + lineno = (unsigned char*)PyBytes_AS_STRING(lineno_obj); + tabsiz = PyBytes_GET_SIZE(lineno_obj); if (memchr(lineno, 255, tabsiz) != NULL) goto exitUnchanged; /* Avoid situations where jump retargeting could overflow */ - assert(PyString_Check(code)); - codelen = PyString_GET_SIZE(code); + assert(PyBytes_Check(code)); + codelen = PyBytes_GET_SIZE(code); if (codelen > 32700) goto exitUnchanged; @@ -317,7 +317,7 @@ if (codestr == NULL) goto exitUnchanged; codestr = (unsigned char *)memcpy(codestr, - PyString_AS_STRING(code), codelen); + PyBytes_AS_STRING(code), codelen); /* Verify that RETURN_VALUE terminates the codestring. This allows the various transformation patterns to look ahead several @@ -382,7 +382,7 @@ case LOAD_NAME: case LOAD_GLOBAL: j = GETARG(codestr, i); - name = PyString_AsString(PyTuple_GET_ITEM(names, j)); + name = PyBytes_AsString(PyTuple_GET_ITEM(names, j)); if (name == NULL || strcmp(name, "None") != 0) continue; for (j=0 ; j < PyList_GET_SIZE(consts) ; j++) { @@ -612,7 +612,7 @@ } assert(h + nops == codelen); - code = PyString_FromStringAndSize((char *)codestr, h); + code = PyBytes_FromStringAndSize((char *)codestr, h); PyMem_Free(addrmap); PyMem_Free(codestr); PyMem_Free(blocks); Modified: python/branches/okkoto-sizeof/Python/pystrtod.c ============================================================================== --- python/branches/okkoto-sizeof/Python/pystrtod.c (original) +++ python/branches/okkoto-sizeof/Python/pystrtod.c Wed Jun 4 11:24:23 2008 @@ -364,7 +364,7 @@ /* At this point, p points just past the right-most character we want to format. We need to add the grouping string for the characters between buffer and p. */ - return _PyString_InsertThousandsGrouping(buffer, len, p, + return _PyBytes_InsertThousandsGrouping(buffer, len, p, buf_size, NULL, 1); } Modified: python/branches/okkoto-sizeof/Python/pythonrun.c ============================================================================== --- python/branches/okkoto-sizeof/Python/pythonrun.c (original) +++ python/branches/okkoto-sizeof/Python/pythonrun.c Wed Jun 4 11:24:23 2008 @@ -132,10 +132,19 @@ PyThreadState *tstate; PyObject *bimod, *sysmod; char *p; -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) - char *codeset; - char *saved_locale; + char *icodeset; /* On Windows, input codeset may theoretically + differ from output codeset. */ + char *codeset = NULL; + char *errors = NULL; + int free_codeset = 0; + int overridden = 0; PyObject *sys_stream, *sys_isatty; +#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) + char *saved_locale, *loc_codeset; +#endif +#ifdef MS_WINDOWS + char ibuf[128]; + char buf[128]; #endif extern void _Py_ReadyTypes(void); @@ -169,7 +178,7 @@ if (!_PyInt_Init()) Py_FatalError("Py_Initialize: can't init ints"); - if (!PyBytes_Init()) + if (!PyByteArray_Init()) Py_FatalError("Py_Initialize: can't init bytearray"); _PyFloat_Init(); @@ -238,38 +247,75 @@ _PyGILState_Init(interp, tstate); #endif /* WITH_THREAD */ + if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { + p = icodeset = codeset = strdup(p); + free_codeset = 1; + errors = strchr(p, ':'); + if (errors) { + *errors = '\0'; + errors++; + } + overridden = 1; + } + #if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) /* On Unix, set the file system encoding according to the user's preference, if the CODESET names a well-known Python codec, and Py_FileSystemDefaultEncoding isn't initialized by other means. Also set the encoding of - stdin and stdout if these are terminals. */ + stdin and stdout if these are terminals, unless overridden. */ - saved_locale = strdup(setlocale(LC_CTYPE, NULL)); - setlocale(LC_CTYPE, ""); - codeset = nl_langinfo(CODESET); - if (codeset && *codeset) { - PyObject *enc = PyCodec_Encoder(codeset); - if (enc) { - codeset = strdup(codeset); - Py_DECREF(enc); - } else { - codeset = NULL; - PyErr_Clear(); + if (!overridden || !Py_FileSystemDefaultEncoding) { + saved_locale = strdup(setlocale(LC_CTYPE, NULL)); + setlocale(LC_CTYPE, ""); + loc_codeset = nl_langinfo(CODESET); + if (loc_codeset && *loc_codeset) { + PyObject *enc = PyCodec_Encoder(loc_codeset); + if (enc) { + loc_codeset = strdup(loc_codeset); + Py_DECREF(enc); + } else { + loc_codeset = NULL; + PyErr_Clear(); + } + } else + loc_codeset = NULL; + setlocale(LC_CTYPE, saved_locale); + free(saved_locale); + + if (!overridden) { + codeset = icodeset = loc_codeset; + free_codeset = 1; + } + + /* Initialize Py_FileSystemDefaultEncoding from + locale even if PYTHONIOENCODING is set. */ + if (!Py_FileSystemDefaultEncoding) { + Py_FileSystemDefaultEncoding = loc_codeset; + if (!overridden) + free_codeset = 0; } - } else - codeset = NULL; - setlocale(LC_CTYPE, saved_locale); - free(saved_locale); + } +#endif + +#ifdef MS_WINDOWS + if (!overridden) { + icodeset = ibuf; + codeset = buf; + sprintf(ibuf, "cp%d", GetConsoleCP()); + sprintf(buf, "cp%d", GetConsoleOutputCP()); + } +#endif if (codeset) { sys_stream = PySys_GetObject("stdin"); sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, icodeset, errors)) Py_FatalError("Cannot set codeset of stdin"); } Py_XDECREF(sys_isatty); @@ -278,9 +324,10 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if ((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stdout"); } Py_XDECREF(sys_isatty); @@ -289,19 +336,17 @@ sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); if (!sys_isatty) PyErr_Clear(); - if(sys_isatty && PyObject_IsTrue(sys_isatty) && + if((overridden || + (sys_isatty && PyObject_IsTrue(sys_isatty))) && PyFile_Check(sys_stream)) { - if (!PyFile_SetEncoding(sys_stream, codeset)) + if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) Py_FatalError("Cannot set codeset of stderr"); } Py_XDECREF(sys_isatty); - if (!Py_FileSystemDefaultEncoding) - Py_FileSystemDefaultEncoding = codeset; - else + if (free_codeset) free(codeset); } -#endif } void @@ -450,8 +495,8 @@ PyTuple_Fini(); PyList_Fini(); PySet_Fini(); - PyString_Fini(); PyBytes_Fini(); + PyByteArray_Fini(); PyInt_Fini(); PyFloat_Fini(); PyDict_Fini(); @@ -699,12 +744,12 @@ } v = PySys_GetObject("ps1"); if (v == NULL) { - PySys_SetObject("ps1", v = PyString_FromString(">>> ")); + PySys_SetObject("ps1", v = PyBytes_FromString(">>> ")); Py_XDECREF(v); } v = PySys_GetObject("ps2"); if (v == NULL) { - PySys_SetObject("ps2", v = PyString_FromString("... ")); + PySys_SetObject("ps2", v = PyBytes_FromString("... ")); Py_XDECREF(v); } for (;;) { @@ -751,16 +796,16 @@ v = PyObject_Str(v); if (v == NULL) PyErr_Clear(); - else if (PyString_Check(v)) - ps1 = PyString_AsString(v); + else if (PyBytes_Check(v)) + ps1 = PyBytes_AsString(v); } w = PySys_GetObject("ps2"); if (w != NULL) { w = PyObject_Str(w); if (w == NULL) PyErr_Clear(); - else if (PyString_Check(w)) - ps2 = PyString_AsString(w); + else if (PyBytes_Check(w)) + ps2 = PyBytes_AsString(w); } arena = PyArena_New(); if (arena == NULL) { @@ -853,7 +898,7 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, "__file__") == NULL) { - PyObject *f = PyString_FromString(filename); + PyObject *f = PyBytes_FromString(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, "__file__", f) < 0) { @@ -937,7 +982,7 @@ goto finally; if (v == Py_None) *filename = NULL; - else if (! (*filename = PyString_AsString(v))) + else if (! (*filename = PyBytes_AsString(v))) goto finally; Py_DECREF(v); @@ -969,7 +1014,7 @@ goto finally; if (v == Py_None) *text = NULL; - else if (! (*text = PyString_AsString(v))) + else if (! (*text = PyBytes_AsString(v))) goto finally; Py_DECREF(v); return 1; @@ -1192,7 +1237,7 @@ if (moduleName == NULL) err = PyFile_WriteString("", f); else { - char* modstr = PyString_AsString(moduleName); + char* modstr = PyBytes_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); @@ -1216,8 +1261,8 @@ */ if (s == NULL) err = -1; - else if (!PyString_Check(s) || - PyString_GET_SIZE(s) != 0) + else if (!PyBytes_Check(s) || + PyBytes_GET_SIZE(s) != 0) err = PyFile_WriteString(": ", f); if (err == 0) err = PyFile_WriteObject(s, f, Py_PRINT_RAW); @@ -1536,7 +1581,7 @@ if (value != NULL) { u = PyObject_Str(value); if (u != NULL) { - msg = PyString_AsString(u); + msg = PyBytes_AsString(u); } } if (msg == NULL) Modified: python/branches/okkoto-sizeof/Python/structmember.c ============================================================================== --- python/branches/okkoto-sizeof/Python/structmember.c (original) +++ python/branches/okkoto-sizeof/Python/structmember.c Wed Jun 4 11:24:23 2008 @@ -16,7 +16,7 @@ if (v != NULL) { for (i = 0; i < n; i++) PyList_SetItem(v, i, - PyString_FromString(mlist[i].name)); + PyBytes_FromString(mlist[i].name)); if (PyErr_Occurred()) { Py_DECREF(v); v = NULL; @@ -103,13 +103,13 @@ v = Py_None; } else - v = PyString_FromString(*(char**)addr); + v = PyBytes_FromString(*(char**)addr); break; case T_STRING_INPLACE: - v = PyString_FromString((char*)addr); + v = PyBytes_FromString((char*)addr); break; case T_CHAR: - v = PyString_FromStringAndSize((char*)addr, 1); + v = PyBytes_FromStringAndSize((char*)addr, 1); break; case T_OBJECT: v = *(PyObject **)addr; @@ -310,8 +310,8 @@ Py_XDECREF(oldv); break; case T_CHAR: - if (PyString_Check(v) && PyString_Size(v) == 1) { - *(char*)addr = PyString_AsString(v)[0]; + if (PyBytes_Check(v) && PyBytes_Size(v) == 1) { + *(char*)addr = PyBytes_AsString(v)[0]; } else { PyErr_BadArgument(); Modified: python/branches/okkoto-sizeof/Python/symtable.c ============================================================================== --- python/branches/okkoto-sizeof/Python/symtable.c (original) +++ python/branches/okkoto-sizeof/Python/symtable.c Wed Jun 4 11:24:23 2008 @@ -87,9 +87,9 @@ PyOS_snprintf(buf, sizeof(buf), "", - PyString_AS_STRING(ste->ste_name), + PyBytes_AS_STRING(ste->ste_name), PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static void @@ -180,7 +180,7 @@ static identifier top = NULL, lambda = NULL, genexpr = NULL; #define GET_IDENTIFIER(VAR) \ - ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) + ((VAR) ? (VAR) : ((VAR) = PyBytes_InternFromString(# VAR))) #define DUPLICATE_ARGUMENT \ "duplicate argument '%s' in function definition" @@ -372,7 +372,7 @@ if (flags & DEF_PARAM) { PyErr_Format(PyExc_SyntaxError, "name '%s' is local and global", - PyString_AS_STRING(name)); + PyBytes_AS_STRING(name)); return 0; } SET_SCOPE(dict, name, GLOBAL_EXPLICIT); @@ -487,19 +487,19 @@ PyOS_snprintf(buf, sizeof(buf), "import * is not allowed in function '%.100s' " "because it is %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; case OPT_BARE_EXEC: PyOS_snprintf(buf, sizeof(buf), "unqualified exec is not allowed in function " "'%.100s' it %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; default: PyOS_snprintf(buf, sizeof(buf), "function '%.100s' uses import * and bare exec, " "which are illegal because it %s", - PyString_AS_STRING(ste->ste_name), trailer); + PyBytes_AS_STRING(ste->ste_name), trailer); break; } @@ -800,7 +800,7 @@ if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, - PyString_AsString(name)); + PyBytes_AsString(name)); PyErr_SyntaxLocation(st->st_filename, st->st_cur->ste_lineno); goto error; @@ -914,7 +914,7 @@ PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++st->st_cur->ste_tmpname); - tmp = PyString_InternFromString(tmpname); + tmp = PyBytes_InternFromString(tmpname); if (!tmp) return 0; if (!symtable_add_def(st, tmp, DEF_LOCAL)) @@ -1065,7 +1065,7 @@ asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyString_AS_STRING(name); + char *c_name = PyBytes_AS_STRING(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; @@ -1218,7 +1218,7 @@ static int symtable_implicit_arg(struct symtable *st, int pos) { - PyObject *id = PyString_FromFormat(".%d", pos); + PyObject *id = PyBytes_FromFormat(".%d", pos); if (id == NULL) return 0; if (!symtable_add_def(st, id, DEF_PARAM)) { @@ -1326,10 +1326,10 @@ */ PyObject *store_name; PyObject *name = (a->asname == NULL) ? a->name : a->asname; - const char *base = PyString_AS_STRING(name); + const char *base = PyBytes_AS_STRING(name); char *dot = strchr(base, '.'); if (dot) { - store_name = PyString_FromStringAndSize(base, dot - base); + store_name = PyBytes_FromStringAndSize(base, dot - base); if (!store_name) return 0; } @@ -1337,7 +1337,7 @@ store_name = name; Py_INCREF(store_name); } - if (strcmp(PyString_AS_STRING(name), "*")) { + if (strcmp(PyBytes_AS_STRING(name), "*")) { int r = symtable_add_def(st, store_name, DEF_IMPORT); Py_DECREF(store_name); return r; Modified: python/branches/okkoto-sizeof/Python/sysmodule.c ============================================================================== --- python/branches/okkoto-sizeof/Python/sysmodule.c (original) +++ python/branches/okkoto-sizeof/Python/sysmodule.c Wed Jun 4 11:24:23 2008 @@ -229,7 +229,7 @@ static PyObject * sys_getdefaultencoding(PyObject *self) { - return PyString_FromString(PyUnicode_GetDefaultEncoding()); + return PyBytes_FromString(PyUnicode_GetDefaultEncoding()); } PyDoc_STRVAR(getdefaultencoding_doc, @@ -261,7 +261,7 @@ sys_getfilesystemencoding(PyObject *self) { if (Py_FileSystemDefaultEncoding) - return PyString_FromString(Py_FileSystemDefaultEncoding); + return PyBytes_FromString(Py_FileSystemDefaultEncoding); Py_INCREF(Py_None); return Py_None; } @@ -290,7 +290,7 @@ int i; for (i = 0; i < 7; ++i) { if (whatstrings[i] == NULL) { - name = PyString_InternFromString(whatnames[i]); + name = PyBytes_InternFromString(whatnames[i]); if (name == NULL) return -1; whatstrings[i] = name; @@ -661,13 +661,12 @@ Py_TYPE(args)->tp_name); return NULL; } - /* And call it, binding it to the value */ return PyObject_CallFunctionObjArgs(method, args, NULL); } /* Instance of old-style classes */ - else if(PyInstance_Check(args)) + else if (PyInstance_Check(args)) return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); - /* Old-style class */ + /* Old-style classes */ else if (PyClass_Check(args)) return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); else @@ -932,7 +931,7 @@ if (list == NULL) return NULL; for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - PyObject *name = PyString_FromString( + PyObject *name = PyBytes_FromString( PyImport_Inittab[i].name); if (name == NULL) break; @@ -972,7 +971,7 @@ if (warnoptions == NULL) return; } - str = PyString_FromString(s); + str = PyBytes_FromString(s); if (str != NULL) { PyList_Append(warnoptions, str); Py_DECREF(str); @@ -1033,6 +1032,7 @@ Static objects:\n\ \n\ maxint -- the largest supported integer (the smallest is -maxint-1)\n\ +maxsize -- the largest supported length of containers.\n\ maxunicode -- the largest supported character\n\ builtin_module_names -- tuple of module names built into this interpreter\n\ version -- the version of this interpreter as a string\n\ @@ -1273,9 +1273,6 @@ PyObject *m, *v, *sysdict; PyObject *sysin, *sysout, *syserr; char *s; -#ifdef MS_WINDOWS - char buf[128]; -#endif m = Py_InitModule3("sys", sys_methods, sys_doc); if (m == NULL) @@ -1313,23 +1310,6 @@ syserr = PyFile_FromFile(stderr, "", "w", _check_and_flush); if (PyErr_Occurred()) return NULL; -#ifdef MS_WINDOWS - if(isatty(_fileno(stdin)) && PyFile_Check(sysin)) { - sprintf(buf, "cp%d", GetConsoleCP()); - if (!PyFile_SetEncoding(sysin, buf)) - return NULL; - } - if(isatty(_fileno(stdout)) && PyFile_Check(sysout)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(sysout, buf)) - return NULL; - } - if(isatty(_fileno(stderr)) && PyFile_Check(syserr)) { - sprintf(buf, "cp%d", GetConsoleOutputCP()); - if (!PyFile_SetEncoding(syserr, buf)) - return NULL; - } -#endif PyDict_SetItemString(sysdict, "stdin", sysin); PyDict_SetItemString(sysdict, "stdout", sysout); @@ -1347,7 +1327,7 @@ Py_XDECREF(syserr); SET_SYS_FROM_STRING("version", - PyString_FromString(Py_GetVersion())); + PyBytes_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyInt_FromLong(PY_VERSION_HEX)); svnversion_init(); @@ -1378,15 +1358,17 @@ SET_SYS_FROM_STRING("api_version", PyInt_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", - PyString_FromString(Py_GetCopyright())); + PyBytes_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", - PyString_FromString(Py_GetPlatform())); + PyBytes_FromString(Py_GetPlatform())); SET_SYS_FROM_STRING("executable", - PyString_FromString(Py_GetProgramFullPath())); + PyBytes_FromString(Py_GetProgramFullPath())); SET_SYS_FROM_STRING("prefix", - PyString_FromString(Py_GetPrefix())); + PyBytes_FromString(Py_GetPrefix())); SET_SYS_FROM_STRING("exec_prefix", - PyString_FromString(Py_GetExecPrefix())); + PyBytes_FromString(Py_GetExecPrefix())); + SET_SYS_FROM_STRING("maxsize", + PyInt_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("maxint", PyInt_FromLong(PyInt_GetMax())); SET_SYS_FROM_STRING("py3kwarning", @@ -1411,13 +1393,13 @@ else value = "little"; SET_SYS_FROM_STRING("byteorder", - PyString_FromString(value)); + PyBytes_FromString(value)); } #ifdef MS_COREDLL SET_SYS_FROM_STRING("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); SET_SYS_FROM_STRING("winver", - PyString_FromString(PyWin_DLLVersionString)); + PyBytes_FromString(PyWin_DLLVersionString)); #endif if (warnoptions == NULL) { warnoptions = PyList_New(0); @@ -1462,7 +1444,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); + w = PyBytes_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; @@ -1507,14 +1489,14 @@ if (i == 0) { char* fn = decc$translate_vms(argv[0]); if ((fn == (char *)0) || fn == (char *)-1) - v = PyString_FromString(argv[0]); + v = PyBytes_FromString(argv[0]); else - v = PyString_FromString( + v = PyBytes_FromString( decc$translate_vms(argv[0])); } else - v = PyString_FromString(argv[i]); + v = PyBytes_FromString(argv[i]); #else - PyObject *v = PyString_FromString(argv[i]); + PyObject *v = PyBytes_FromString(argv[i]); #endif if (v == NULL) { Py_DECREF(av); @@ -1618,7 +1600,7 @@ #endif /* Unix */ } #endif /* All others */ - a = PyString_FromStringAndSize(argv0, n); + a = PyBytes_FromStringAndSize(argv0, n); if (a == NULL) Py_FatalError("no mem for sys.path insertion"); if (PyList_Insert(path, 0, a) < 0) Modified: python/branches/okkoto-sizeof/Python/traceback.c ============================================================================== --- python/branches/okkoto-sizeof/Python/traceback.c (original) +++ python/branches/okkoto-sizeof/Python/traceback.c Wed Jun 4 11:24:23 2008 @@ -155,12 +155,12 @@ PyErr_Clear(); break; } - if (PyString_Check(v)) { + if (PyBytes_Check(v)) { size_t len; - len = PyString_GET_SIZE(v); + len = PyBytes_GET_SIZE(v); if (len + 1 + taillen >= MAXPATHLEN) continue; /* Too long */ - strcpy(namebuf, PyString_AsString(v)); + strcpy(namebuf, PyBytes_AsString(v)); if (strlen(namebuf) != len) continue; /* v contains '\0' */ if (len > 0 && namebuf[len-1] != SEP) @@ -238,10 +238,10 @@ while (tb != NULL && err == 0) { if (depth <= limit) { err = tb_displayline(f, - PyString_AsString( + PyBytes_AsString( tb->tb_frame->f_code->co_filename), tb->tb_lineno, - PyString_AsString(tb->tb_frame->f_code->co_name)); + PyBytes_AsString(tb->tb_frame->f_code->co_name)); } depth--; tb = tb->tb_next; Modified: python/branches/okkoto-sizeof/README ============================================================================== --- python/branches/okkoto-sizeof/README (original) +++ python/branches/okkoto-sizeof/README Wed Jun 4 11:24:23 2008 @@ -917,6 +917,26 @@ link most extension modules statically. +Coverage checking +----------------- + +For C coverage checking using gcov, run "make coverage". This will +build a Python binary with profiling activated, and a ".gcno" and +".gcda" file for every source file compiled with that option. With +the built binary, now run the code whose coverage you want to check. +Then, you can see coverage statistics for each individual source file +by running gcov, e.g. + + gcov -o Modules zlibmodule + +This will create a "zlibmodule.c.gcov" file in the current directory +containing coverage info for that source file. + +This works only for source files statically compiled into the +executable; use the Makefile/Setup mechanism to compile and link +extension modules you want to coverage-check statically. + + Testing ------- Modified: python/branches/okkoto-sizeof/RISCOS/Modules/drawfmodule.c ============================================================================== --- python/branches/okkoto-sizeof/RISCOS/Modules/drawfmodule.c (original) +++ python/branches/okkoto-sizeof/RISCOS/Modules/drawfmodule.c Wed Jun 4 11:24:23 2008 @@ -333,7 +333,7 @@ char *dtable; if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); + { int m=PyBytes_Size(value); if(m<0||!PyInt_Check(key)) return NULL; size+=m+2; } @@ -350,9 +350,9 @@ memset(dtable,0,size-8); n=0; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); + { int m=PyBytes_Size(value); *dtable=(char)PyInt_AsLong(key); - strcpy(dtable+1,PyString_AsString(value)); + strcpy(dtable+1,PyBytes_AsString(value)); dtable+=m+2; } Py_INCREF(Py_None);return Py_None; @@ -609,8 +609,8 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(2); if (list) - { PyList_SetItem(list, 0, PyString_FromString("size")); - PyList_SetItem(list, 1, PyString_FromString("start")); + { PyList_SetItem(list, 0, PyBytes_FromString("size")); + PyList_SetItem(list, 1, PyBytes_FromString("start")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -659,6 +659,6 @@ { PyObject *m, *d; m = Py_InitModule("drawf", DrawFMethods); d = PyModule_GetDict(m); - DrawFError=PyString_FromString("drawf.error"); + DrawFError=PyBytes_FromString("drawf.error"); PyDict_SetItemString(d,"error",DrawFError); } Modified: python/branches/okkoto-sizeof/RISCOS/Modules/riscosmodule.c ============================================================================== --- python/branches/okkoto-sizeof/RISCOS/Modules/riscosmodule.c (original) +++ python/branches/okkoto-sizeof/RISCOS/Modules/riscosmodule.c Wed Jun 4 11:24:23 2008 @@ -79,9 +79,9 @@ char *buf; e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); if(e) return riscos_oserror(); - obj=PyString_FromStringAndSize(NULL,-len); + obj=PyBytes_FromStringAndSize(NULL,-len); if(obj==NULL) return NULL; - buf=PyString_AsString(obj); + buf=PyBytes_AsString(obj); e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); if(len!=1) return riscos_error("Error expanding path"); if(!e) return obj; @@ -131,7 +131,7 @@ { Py_DECREF(d);return riscos_oserror(); } if(count) - { v=PyString_FromString(buf); + { v=PyBytes_FromString(buf); if(!v) { Py_DECREF(d);return 0;} if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} } @@ -320,7 +320,7 @@ char *name,*value; if(!PyArg_ParseTuple(args,"s:getenv",&name)) return NULL; value=getenv(name); - if(value) return PyString_FromString(value); + if(value) return PyBytes_FromString(value); Py_INCREF(Py_None); return Py_None; } @@ -371,7 +371,7 @@ os_VARTYPE_EXPANDED,&size,(int *)&context,0)) { PyObject *v; value[size]='\0'; - v = PyString_FromString(value); + v = PyBytes_FromString(value); if (v == NULL) continue; PyDict_SetItemString(dict, context, v); Py_DECREF(v); Modified: python/branches/okkoto-sizeof/RISCOS/Modules/swimodule.c ============================================================================== --- python/branches/okkoto-sizeof/RISCOS/Modules/swimodule.c (original) +++ python/branches/okkoto-sizeof/RISCOS/Modules/swimodule.c Wed Jun 4 11:24:23 2008 @@ -66,10 +66,10 @@ b->length=4*size; b->heap=1; if(init) - { if(PyString_Check(init)) - { int n=PyString_Size(init); + { if(PyBytes_Check(init)) + { int n=PyBytes_Size(init); if (n>4*size) n=4*size; - memcpy(b->block,PyString_AsString(init),n); + memcpy(b->block,PyBytes_AsString(init),n); memset((char*)b->block+n,0,4*size-n); } else @@ -113,7 +113,7 @@ { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } - return PyString_FromStringAndSize((char*)self->block+s,e-s); + return PyBytes_FromStringAndSize((char*)self->block+s,e-s); } static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) @@ -125,7 +125,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyBytes_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) @@ -137,7 +137,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyBytes_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) @@ -296,9 +296,9 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(3); if (list) - { PyList_SetItem(list, 0, PyString_FromString("length")); - PyList_SetItem(list, 1, PyString_FromString("start")); - PyList_SetItem(list, 2, PyString_FromString("end")); + { PyList_SetItem(list, 0, PyBytes_FromString("length")); + PyList_SetItem(list, 1, PyBytes_FromString("start")); + PyList_SetItem(list, 2, PyBytes_FromString("end")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -402,7 +402,7 @@ for(;*fmt;fmt++) { switch(*fmt) { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; - case 's':v=PyString_FromString((char*)(r.r[rno++])); break; + case 's':v=PyBytes_FromString((char*)(r.r[rno++])); break; case '.':rno++; continue; case '*':v=PyInt_FromLong((long)carry); break; } @@ -421,7 +421,7 @@ if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL; if (l==-1) l = strlen(s); - return PyString_FromStringAndSize((char*)s, l); + return PyBytes_FromStringAndSize((char*)s, l); } static char swi_string__doc__[] = Modified: python/branches/okkoto-sizeof/Tools/README ============================================================================== --- python/branches/okkoto-sizeof/Tools/README (original) +++ python/branches/okkoto-sizeof/Tools/README Wed Jun 4 11:24:23 2008 @@ -9,6 +9,7 @@ bgen Generate complete extension modules from a description. Still under development! + WARNING: bgen has been removed in 3.0. compiler Tools used to maintain the compiler package in the standard library. Modified: python/branches/okkoto-sizeof/Tools/bgen/README ============================================================================== --- python/branches/okkoto-sizeof/Tools/bgen/README (original) +++ python/branches/okkoto-sizeof/Tools/bgen/README Wed Jun 4 11:24:23 2008 @@ -5,3 +5,5 @@ complete source code for Python extension module. For examples of its use, see the Mac Python source distribution (available separately from the Python ftp archives). Note that BGEN is not Mac specific! + +WARNING: bgen has been removed in 3.0. Modified: python/branches/okkoto-sizeof/Tools/msi/msi.py ============================================================================== --- python/branches/okkoto-sizeof/Tools/msi/msi.py (original) +++ python/branches/okkoto-sizeof/Tools/msi/msi.py Wed Jun 4 11:24:23 2008 @@ -382,6 +382,7 @@ ]) compileargs = r'-Wi "[TARGETDIR]Lib\compileall.py" -f -x bad_coding|badsyntax|site-packages|py3_ "[TARGETDIR]Lib"' + lib2to3args = r'-c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"' # See "CustomAction Table" add_data(db, "CustomAction", [ # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty @@ -395,6 +396,7 @@ # See "Custom Action Type 18" ("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs), + ("CompileGrammar", 18, "python.exe", lib2to3args), ]) # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" @@ -424,12 +426,14 @@ ("UpdateEditIDLE", None, 1050), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), + ("CompileGrammar", "COMPILEALL", 6802), ]) add_data(db, "AdminExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), + ("CompileGrammar", "COMPILEALL", 6802), ]) ##################################################################### @@ -840,6 +844,26 @@ result.append((f, kw)) return result +def generate_license(): + import shutil, glob + out = open("LICENSE.txt", "w") + shutil.copyfileobj(open(os.path.join(srcdir, "LICENSE")), out) + for dir, file in (("bzip2","LICENSE"), + ("db", "LICENSE"), + ("openssl", "LICENSE"), + ("tcl", "license.terms"), + ("tk", "license.terms")): + out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % dir) + dirs = glob.glob(srcdir+"/../"+dir+"-*") + if not dirs: + raise ValueError, "Could not find "+srcdir+"/../"+dir+"-*" + if len(dirs) > 2: + raise ValueError, "Multiple copies of "+dir + dir = dirs[0] + shutil.copyfileobj(open(os.path.join(dir, file)), out) + out.close() + + class PyDirectory(Directory): """By default, all components in the Python installer can run from source.""" @@ -860,7 +884,8 @@ root.add_file("%s/w9xpopen.exe" % PCBUILD) root.add_file("README.txt", src="README") root.add_file("NEWS.txt", src="Misc/NEWS") - root.add_file("LICENSE.txt", src="LICENSE") + generate_license() + root.add_file("LICENSE.txt", src=os.path.abspath("LICENSE.txt")) root.start_component("python.exe", keyfile="python.exe") root.add_file("%s/python.exe" % PCBUILD) root.start_component("pythonw.exe", keyfile="pythonw.exe") @@ -978,6 +1003,8 @@ if dir=="setuptools": lib.add_file("cli.exe") lib.add_file("gui.exe") + if dir=="lib2to3": + lib.removefile("pickle", "*.pickle") if dir=="data" and parent.physical=="test" and parent.basedir.physical=="email": # This should contain all non-.svn files listed in subversion for f in os.listdir(lib.absolute): Modified: python/branches/okkoto-sizeof/Tools/msi/msilib.py ============================================================================== --- python/branches/okkoto-sizeof/Tools/msi/msilib.py (original) +++ python/branches/okkoto-sizeof/Tools/msi/msilib.py Wed Jun 4 11:24:23 2008 @@ -571,6 +571,11 @@ [(self.component+"c", self.component, "*.pyc", self.logical, 2), (self.component+"o", self.component, "*.pyo", self.logical, 2)]) + def removefile(self, key, pattern): + "Add a RemoveFile entry" + add_data(self.db, "RemoveFile", [(self.component+key, self.component, pattern, self.logical, 2)]) + + class Feature: def __init__(self, db, id, title, desc, display, level = 1, parent=None, directory = None, attributes=0): Modified: python/branches/okkoto-sizeof/Tools/webchecker/wsgui.py ============================================================================== --- python/branches/okkoto-sizeof/Tools/webchecker/wsgui.py (original) +++ python/branches/okkoto-sizeof/Tools/webchecker/wsgui.py Wed Jun 4 11:24:23 2008 @@ -10,7 +10,7 @@ import websucker import os import threading -import queue +import Queue import time VERBOSE = 2 @@ -139,7 +139,7 @@ def go(self, event=None): if not self.msgq: - self.msgq = queue.Queue(0) + self.msgq = Queue.Queue(0) self.check_msgq() if not self.sucker: self.sucker = SuckerThread(self.msgq) Modified: python/branches/okkoto-sizeof/configure ============================================================================== --- python/branches/okkoto-sizeof/configure (original) +++ python/branches/okkoto-sizeof/configure Wed Jun 4 11:24:23 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 62499 . +# From configure.in Revision: 63545 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -2078,6 +2078,11 @@ Darwin/[789].*) define_xopen_source=no ;; + # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from + # defining NI_NUMERICHOST. + QNX/6.3.2) + define_xopen_source=no + ;; esac @@ -3920,6 +3925,10 @@ LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";; Monterey64*) LINKCC="$LINKCC -L/usr/lib/ia64l64";; + QNX*) + # qcc must be used because the other compilers do not + # support -N. + LINKCC=qcc;; esac fi { echo "$as_me:$LINENO: result: $LINKCC" >&5 @@ -5461,6 +5470,7 @@ + for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ @@ -5469,7 +5479,7 @@ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ -sys/time.h \ +sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h @@ -12520,7 +12530,7 @@ fi fi ;; - Linux*|GNU*) LDSHARED='$(CC) -shared';; + Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';; BSD/OS*/4*) LDSHARED="gcc -shared";; FreeBSD*) if [ "`$CC -dM -E - &5 Modified: python/branches/okkoto-sizeof/configure.in ============================================================================== --- python/branches/okkoto-sizeof/configure.in (original) +++ python/branches/okkoto-sizeof/configure.in Wed Jun 4 11:24:23 2008 @@ -1,4 +1,7 @@ -dnl Process this file with autoconf 2.0 or later to make a configure script. +dnl *********************************************** +dnl * Please run autoreconf to test your changes! * +dnl *********************************************** +dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.63). # Set VERSION so we only need to edit in one place (i.e., here) m4_define(PYTHON_VERSION, 2.6) @@ -262,6 +265,11 @@ Darwin/@<:@789@:>@.*) define_xopen_source=no ;; + # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from + # defining NI_NUMERICHOST. + QNX/6.3.2) + define_xopen_source=no + ;; esac @@ -586,6 +594,10 @@ LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";; Monterey64*) LINKCC="$LINKCC -L/usr/lib/ia64l64";; + QNX*) + # qcc must be used because the other compilers do not + # support -N. + LINKCC=qcc;; esac fi AC_MSG_RESULT($LINKCC) @@ -1132,7 +1144,7 @@ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ -sys/time.h \ +sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h) @@ -1576,7 +1588,7 @@ fi fi ;; - Linux*|GNU*) LDSHARED='$(CC) -shared';; + Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';; BSD/OS*/4*) LDSHARED="gcc -shared";; FreeBSD*) if [[ "`$CC -dM -E - header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TERMIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H Modified: python/branches/okkoto-sizeof/setup.py ============================================================================== --- python/branches/okkoto-sizeof/setup.py (original) +++ python/branches/okkoto-sizeof/setup.py Wed Jun 4 11:24:23 2008 @@ -5,6 +5,7 @@ import sys, os, imp, re, optparse from glob import glob +from platform import machine as platform_machine from distutils import log from distutils import sysconfig @@ -687,13 +688,39 @@ # a release. Most open source OSes come with one or more # versions of BerkeleyDB already installed. - max_db_ver = (4, 5) # XXX(gregory.p.smith): 4.6 "works" but seems to - # have issues on many platforms. I've temporarily - # disabled 4.6 to see what the odd platform - # buildbots say. + max_db_ver = (4, 7) min_db_ver = (3, 3) db_setup_debug = False # verbose debug prints from this script? + def allow_db_ver(db_ver): + """Returns a boolean if the given BerkeleyDB version is acceptable. + + Args: + db_ver: A tuple of the version to verify. + """ + if not (min_db_ver <= db_ver <= max_db_ver): + return False + # Use this function to filter out known bad configurations. + if (4, 6) == db_ver[:2]: + # BerkeleyDB 4.6.x is not stable on many architectures. + arch = platform_machine() + if arch not in ('i386', 'i486', 'i586', 'i686', + 'x86_64', 'ia64'): + return False + return True + + def gen_db_minor_ver_nums(major): + if major == 4: + for x in range(max_db_ver[1]+1): + if allow_db_ver((4, x)): + yield x + elif major == 3: + for x in (3,): + if allow_db_ver((3, x)): + yield x + else: + raise ValueError("unknown major BerkeleyDB version", major) + # construct a list of paths to look for the header file in on # top of the normal inc_dirs. db_inc_paths = [ @@ -708,7 +735,7 @@ '/sw/include/db3', ] # 4.x minor number specific paths - for x in range(max_db_ver[1]+1): + for x in gen_db_minor_ver_nums(4): db_inc_paths.append('/usr/include/db4%d' % x) db_inc_paths.append('/usr/include/db4.%d' % x) db_inc_paths.append('/usr/local/BerkeleyDB.4.%d/include' % x) @@ -718,7 +745,7 @@ # MacPorts default (http://www.macports.org/) db_inc_paths.append('/opt/local/include/db4%d' % x) # 3.x minor number specific paths - for x in (3,): + for x in gen_db_minor_ver_nums(3): db_inc_paths.append('/usr/include/db3%d' % x) db_inc_paths.append('/usr/local/BerkeleyDB.3.%d/include' % x) db_inc_paths.append('/usr/local/include/db3%d' % x) @@ -733,10 +760,10 @@ for dn in inc_dirs: std_variants.append(os.path.join(dn, 'db3')) std_variants.append(os.path.join(dn, 'db4')) - for x in range(max_db_ver[1]+1): + for x in gen_db_minor_ver_nums(4): std_variants.append(os.path.join(dn, "db4%d"%x)) std_variants.append(os.path.join(dn, "db4.%d"%x)) - for x in (3,): + for x in gen_db_minor_ver_nums(3): std_variants.append(os.path.join(dn, "db3%d"%x)) std_variants.append(os.path.join(dn, "db3.%d"%x)) @@ -771,7 +798,7 @@ continue if ( (not db_ver_inc_map.has_key(db_ver)) and - (db_ver <= max_db_ver and db_ver >= min_db_ver) ): + allow_db_ver(db_ver) ): # save the include directory with the db.h version # (first occurrence only) db_ver_inc_map[db_ver] = d @@ -816,8 +843,8 @@ except db_found: if db_setup_debug: - print "db lib: using", db_ver, dblib - print "db: lib dir", dblib_dir, "inc dir", db_incdir + print "bsddb using BerkeleyDB lib:", db_ver, dblib + print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir db_incs = [db_incdir] dblibs = [dblib] # We add the runtime_library_dirs argument because the @@ -1009,7 +1036,7 @@ missing.append('resource') # Sun yellow pages. Some systems have the functions in libc. - if platform not in ['cygwin', 'atheos']: + if platform not in ['cygwin', 'atheos', 'qnx6']: if (self.compiler.find_library_file(lib_dirs, 'nsl')): libs = ['nsl'] else: @@ -1580,6 +1607,9 @@ # finding some -z option for the Sun compiler. extra_link_args.append('-mimpure-text') + elif sys.platform.startswith('hp-ux'): + extra_link_args.append('-fPIC') + ext = Extension('_ctypes', include_dirs=include_dirs, extra_compile_args=extra_compile_args, From python-checkins at python.org Wed Jun 4 11:38:51 2008 From: python-checkins at python.org (robert.schuppenies) Date: Wed, 4 Jun 2008 11:38:51 +0200 (CEST) Subject: [Python-checkins] r63931 - python/branches/okkoto-sizeof/Lib/test/test_sys.py Message-ID: <20080604093851.609D61E4002@bag.python.org> Author: robert.schuppenies Date: Wed Jun 4 11:38:51 2008 New Revision: 63931 Log: more generic sizeof testing via helper class. comments are welcome. Modified: python/branches/okkoto-sizeof/Lib/test/test_sys.py Modified: python/branches/okkoto-sizeof/Lib/test/test_sys.py ============================================================================== --- python/branches/okkoto-sizeof/Lib/test/test_sys.py (original) +++ python/branches/okkoto-sizeof/Lib/test/test_sys.py Wed Jun 4 11:38:51 2008 @@ -405,16 +405,149 @@ self.assertEqual(out, '?') +class SizeOfHelper(object): + "Helper class for sizeof tests" + + def __init__(self, default_n=None): + """default_n can be used to set the default alignment offset. + If it is not set, n must be provided on every call of sizeof().""" + self.default_n = default_n + + def align(self, value, n): + """ Align value to multiple of n.""" + mod = value % n + if mod != 0: + return value - mod + n + else: + return value + + def sizeof(self, members, n=None): + """ Calculate size of a struct in bytes, i.e. simulate sizeof(). + members is the ordered list of members of the struct. n is the + offset used for the alignment. If n is not set in the constructor + it must be set here. + This function is recursive.""" + res = 0 + if n == None: + n = self.default_n + if n <=0: + raise ValueError("n has to be larger than 0") + if len(members) == 1: + res = self.align(members[0], n) + return res + else: + if (members[0] % n) == 0: + # perfect match: add first member and continue with the rest + res = members[0] + self.sizeof(members[1:len(members)], n) + return res + else: + # space left, check if next member would still fit + index = 0 + sum = members[index] + index += 1 + while (index < len(members)) and ((sum + members[index] <= n)): + sum += members[index] + index += 1 + res = self.align(sum, n) + if index != len(members): + res += self.sizeof(members[index:len(members)], n) + return res + +class SizeOfHelperTest(unittest.TestCase): + + def setUp(self): + self.sim = SizeOfHelper() + + def test_align(self): + n = 8 + self.assertEqual(self.sim.align(0, n) % n, 0) + self.assertEqual(self.sim.align(1, n) % n, 0) + self.assertEqual(self.sim.align(3, n) % n, 0) + self.assertEqual(self.sim.align(4, n) % n, 0) + self.assertEqual(self.sim.align(7, n) % n, 0) + self.assertEqual(self.sim.align(8, n) % n, 0) + self.assertEqual(self.sim.align(9, n) % n, 0) + + def test_zero(self): + members = [0] + self.assertRaises(ValueError, self.sim.sizeof, members, max(members)) + + def test_char(self): + members = [1] + self.assertEqual(self.sim.sizeof(members, 1), 1) + + def test_xchar(self): + import random + rand = random.randint(2,300) + members = [1] * rand + self.assertEqual(self.sim.sizeof(members, 1), rand*1) + + def test_membermerge(self): + # test the merge of equal size members into one, eg [4, 4, 2]=[2*4, 2] + members = [2*4, 4] + self.assertEqual(self.sim.sizeof(members, 4), 12) + + def init_types(self, i, l, p): + """Initialize types for testing, whereas i=int, l=long, and p=pointer. + The dict consists of a descriptive name as key and two list items. The + first is the ordered list of the type members, the second the expected + value for sizeof. The expected value has to be set in the caller + afterwards.""" + types = {"3ip": [[i, i, i, p ], -1],\ + "ip": [[i, p], -1],\ + "pplpl": [[2*p, l, p, l], -1]} + return types + + def test_ILP32(self): + i = l = p = 4 + types = self.init_types(i, l, p) + types["3ip"][1] = 16 + types["ip"][1] = 8 + types["pplpl"][1] = 20 + for v in types.values(): + self.assertEqual(self.sim.sizeof(v[0], p), v[1]) + + def test_LP64(self): + i = 4 + l = p = 8 + types = self.init_types(i, l, p) + types["3ip"][1] = 24 + types["ip"][1] = 16 + types["pplpl"][1] = 40 + for v in types.values(): + self.assertEqual(self.sim.sizeof(v[0], p), v[1]) + + def test_LLP64(self): + i = l = 4 + p = 8 + types = self.init_types(i, l, p) + types["3ip"][1] = 24 + types["ip"][1] = 16 + types["pplpl"][1] = 40 + for v in types.values(): + self.assertEqual(self.sim.sizeof(v[0], p), v[1]) + + def test_ILP64(self): + i = l = p = 8 + types = self.init_types(i, l, p) + types["3ip"][1] = 32 + types["ip"][1] = 16 + types["pplpl"][1] = 40 + for v in types.values(): + self.assertEqual(self.sim.sizeof(v[0], p), v[1]) + class SizeofTest(unittest.TestCase): def setUp(self): import struct + # determine size of basic types self.i = len(struct.pack('i', 0)) self.l = len(struct.pack('l', 0)) self.p = len(struct.pack('P', 0)) - self.headersize = self.l + self.p + self.header = [self.l, self.p] if hasattr(sys, "gettotalrefcount"): - self.headersize += 2 * self.p + self.header.extend([2*self.p]) + self.helper = SizeOfHelper(default_n=self.p) self.file = open(test.test_support.TESTFN, 'wb') def tearDown(self): @@ -427,64 +560,50 @@ % (type(o), result, size) self.assertEqual(result, size, msg) - def align(self, value): - mod = value % self.p - if mod != 0: - return value - mod + self.p - else: - return value - - def test_align(self): - self.assertEqual(self.align(0) % self.p, 0) - self.assertEqual(self.align(1) % self.p, 0) - self.assertEqual(self.align(3) % self.p, 0) - self.assertEqual(self.align(4) % self.p, 0) - self.assertEqual(self.align(7) % self.p, 0) - self.assertEqual(self.align(8) % self.p, 0) - self.assertEqual(self.align(9) % self.p, 0) - def test_standardtypes(self): i = self.i l = self.l p = self.p - h = self.headersize + h = self.header + size = self.helper.sizeof + # bool - self.check_sizeof(True, h + l) + self.check_sizeof(True, size(h + [l])) # buffer - self.check_sizeof(buffer(''), h + 2*p + 2*l + self.align(i) +l) + self.check_sizeof(buffer(''), size(h + [2*p, 2*l, i, l])) # cell def get_cell(): x = 42 def inner(): return x return inner - self.check_sizeof(get_cell().func_closure[0], h + p) + self.check_sizeof(get_cell().func_closure[0], size(h + [p])) # old-style class class class_oldstyle(): def method(): pass - self.check_sizeof(class_oldstyle, h + 6*p) + self.check_sizeof(class_oldstyle, size(h + [6*p])) # instance - self.check_sizeof(class_oldstyle(), h + 3*p) + self.check_sizeof(class_oldstyle(), size(h + [3*p])) # method - self.check_sizeof(class_oldstyle().method, h + 4*p) + self.check_sizeof(class_oldstyle().method, size(h + [4*p])) # code - self.check_sizeof(get_cell().func_code, h + self.align(4*i) + 8*p +\ - self.align(i) + 2*p) + self.check_sizeof(get_cell().func_code, size(h +\ + [4*i, 8*p, i, 2*p])) # complex - self.check_sizeof(complex(0,1), h + 2*8) + self.check_sizeof(complex(0,1), size(h + [2*8])) # enumerate - self.check_sizeof(enumerate([]), h + l + 3*p) + self.check_sizeof(enumerate([]), size(h + [l, 3*p])) # reverse - self.check_sizeof(reversed(''), h + l + p ) + self.check_sizeof(reversed(''), size(h + [l, p])) # file - self.check_sizeof(self.file, h + 4*p + self.align(2*i) + 4*p +\ - self.align(3*i) + 3*p + self.align(i)) + self.check_sizeof(self.file, size(h + [4*p, 2*i, 4*p,\ + 3*i, 3*p, i])) # float - self.check_sizeof(float(0), h + 8) + self.check_sizeof(float(0), size(h + [8])) # function def func(): pass - self.check_sizeof(func, h + 9 * l) + self.check_sizeof(func, size(h + [9*l])) class c(): @staticmethod def foo(): @@ -493,63 +612,65 @@ def bar(cls): pass # staticmethod - self.check_sizeof(foo, h + l) + self.check_sizeof(foo, size(h + [l])) # classmethod - self.check_sizeof(bar, h + l) + self.check_sizeof(bar, size(h + [l])) # generator def get_gen(): yield 1 - self.check_sizeof(get_gen(), h + p + self.align(i) + 2*p) + self.check_sizeof(get_gen(), size(h + [p, i, 2*p])) # integer - self.check_sizeof(1, h + l) + self.check_sizeof(1, size(h + [l])) # builtin_function_or_method - self.check_sizeof(abs, h + 3*p) + self.check_sizeof(abs, size(h + [3*p])) # module - self.check_sizeof(unittest, h + p) + self.check_sizeof(unittest, size(h + [p])) # xrange - self.check_sizeof(xrange(1), h + 3*p) + self.check_sizeof(xrange(1), size(h + [3*p])) # slice - self.check_sizeof(slice(0), h + 3*p) + self.check_sizeof(slice(0), size(h + [3*p])) - h += l + h.append(l) # new-style class class class_newstyle(object): def method(): pass # type (PyTypeObject + PyNumberMethods + PyMappingMethods + # PySequenceMethods + PyBufferProcs) - len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p - self.check_sizeof(class_newstyle, - h + len_typeobject + 42*p + 10*p + 3*p + 6*p) - + typeobject_members = [p, 2*l, 15*p, l, 4*p, l, 9*p, l, 11*p] + self.check_sizeof(class_newstyle, size(h + typeobject_members +\ + [42*p, 10*p, 3*p, 6*p])) def test_specialtypes(self): i = self.i l = self.l p = self.p - h = self.headersize + h = self.header + size = self.helper.sizeof + # dict - self.check_sizeof({}, h + 3*l + 3*p + 8*(l + 2*p)) + self.check_sizeof({}, size(h + [3*l, 3*p, 8*size([l, 2*p])])) longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} - self.check_sizeof(longdict, h + 3*l + 3*p + 8*(l + 2*p) + 16*(l + 2*p)) + self.check_sizeof(longdict, size(h + [3*l, 3*p, \ + 8*size([l, 2*p]), 16*size([l, 2*p])])) # list - self.check_sizeof([], h + l + p + l) - self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) + self.check_sizeof([], size(h + [l, p, l])) + self.check_sizeof([1, 2, 3], size(h + [l, p, l, 3*l])) - h += l + h.append(l) # long - self.check_sizeof(0L, h + self.align(2)) - self.check_sizeof(1L, h + self.align(2)) - self.check_sizeof(-1L, h + self.align(2)) - self.check_sizeof(32768L, h + self.align(2) + 2) - self.check_sizeof(32768L*32768L-1, h + self.align(2) + 2) - self.check_sizeof(32768L*32768L, h + self.align(2) + 4) + self.check_sizeof(0L, size(h + [2])) + self.check_sizeof(1L, size(h + [2])) + self.check_sizeof(-1L, size(h + [2])) + self.check_sizeof(32768L, size(h + [2]) + 2) + self.check_sizeof(32768L*32768L-1, size(h + [2]) +2) + self.check_sizeof(32768L*32768L, size(h + [2]) + 4) # string - self.check_sizeof('', h + l + self.align(i + 1)) - self.check_sizeof('abc', h + l + self.align(i + 1) + 3) + self.check_sizeof('', size(h + [l, i + 1])) + self.check_sizeof('abc', size(h + [l, i + 1]) + 3) def test_main(): - test_classes = (SysModuleTest, SizeofTest) + test_classes = (SysModuleTest, SizeOfHelperTest, SizeofTest) test.test_support.run_unittest(*test_classes) From python-checkins at python.org Wed Jun 4 13:17:27 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 4 Jun 2008 13:17:27 +0200 (CEST) Subject: [Python-checkins] r63932 - python/trunk/Doc/library/turtle.rst Message-ID: <20080604111727.BFCD11E4021@bag.python.org> Author: georg.brandl Date: Wed Jun 4 13:17:26 2008 New Revision: 63932 Log: Complete revision of new turtle module's docs. Modified: python/trunk/Doc/library/turtle.rst Modified: python/trunk/Doc/library/turtle.rst ============================================================================== --- python/trunk/Doc/library/turtle.rst (original) +++ python/trunk/Doc/library/turtle.rst Wed Jun 4 13:17:26 2008 @@ -2,2001 +2,1887 @@ :mod:`turtle` --- Turtle graphics for Tk ======================================== ------------- Introduction ------------- +============ -Turtle graphics is a popular way for introducing programming to -kids. It was part of the original Logo programming language developed -by Wally Feurzig and Seymour Papert in 1966. - -Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it -the command turtle.forward(15), and it moves (on-screen!) 15 pixels in -the direction it is facing, drawing a line as it moves. Give it the -command turtle.left(25), and it rotates in-place 25 degrees clockwise. - -By combining together these and similar commands, intricate shapes and -pictures can easily be drawn. - -The module turtle.py is an extended reimplementation of turtle.py from -the Python standard distribution up to version Python 2.5. - -It tries to keep the merits of turtle.py and to be (nearly) 100% -compatible with it. This means in the first place to enable the -learning programmer to use all the commands, classes and methods -interactively when using the module from within IDLE run with -the -n switch. - -The turtle module provides turtle graphics primitives, in both -object-oriented and procedure-oriented ways. Because it uses Tkinter -for the underlying graphics, it needs a version of python installed -with Tk support. - -The objectoriented interface uses essentially two+two classes: - -1. The TurtleScreen class defines graphics windows as a playground for the - drawing turtles. It's constructor needs a Tk-Canvas or a ScrolledCanvas - as argument. It should be used when turtle.py is used as part of some - application. - - Derived from TurtleScreen is the subclass Screen. Screen is implemented - as sort of singleton, so there can exist only one instance of Screen at a - time. It should be used when turtle.py is used as a standalone tool for - doing graphics. - - All methods of TurtleScreen/Screen also exist as functions, i. e. - as part of the procedure-oriented interface. - -2. RawTurtle (alias: RawPen) defines Turtle-objects which draw on a - TurtleScreen. It's constructor needs a Canvas/ScrolledCanvas/Turtlescreen - as argument, so the RawTurtle objects know where to draw. - - Derived from RawTurtle is the subclass Turtle (alias: Pen), which - draws on "the" Screen - instance which is automatically created, - if not already present. - - All methods of RawTurtle/Turtle also exist as functions, i. e. - part of the procedure-oriented interface. +Turtle graphics is a popular way for introducing programming to kids. It was +part of the original Logo programming language developed by Wally Feurzig and +Seymour Papert in 1966. -The procedural interface uses functions which are derived from the methods -of the classes Screen and Turtle. They have the same names as the -corresponding methods. A screen-object is automativally created -whenever a function derived form a Screen-method is called. An (unnamed) -turtle object is automatically created whenever any of the functions -derived from a Turtle method is called. +Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it the +command ``turtle.forward(15)``, and it moves (on-screen!) 15 pixels in the +direction it is facing, drawing a line as it moves. Give it the command +``turtle.left(25)``, and it rotates in-place 25 degrees clockwise. -To use multiple turtles an a screen one has to use the objectoriented -interface. +By combining together these and similar commands, intricate shapes and pictures +can easily be drawn. +The :mod:`turtle` module is an extended reimplementation of the same-named +module from the Python standard distribution up to version Python 2.5. -IMPORTANT NOTE! +It tries to keep the merits of the old turtle module and to be (nearly) 100% +compatible with it. This means in the first place to enable the learning +programmer to use all the commands, classes and methods interactively when using +the module from within IDLE run with the ``-n`` switch. -In the following documentation the argumentlist for functions is given. ---->> Methods, of course, have the additional first argument self <<--- ---->> which is omitted here. <<--- +The turtle module provides turtle graphics primitives, in both object-oriented +and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying +graphics, it needs a version of python installed with Tk support. +The object-oriented interface uses essentially two+two classes: --------------------------------------------------- -OVERVIEW over available Turtle and Screen methods: --------------------------------------------------- +1. The :class:`TurtleScreen` class defines graphics windows as a playground for + the drawing turtles. Its constructor needs a :class:`Tkinter.Canvas` or a + :class:`ScrolledCanvas` as argument. It should be used when :mod:`turtle` is + used as part of some application. -(A) TURTLE METHODS: -=================== + Derived from :class:`TurtleScreen` is the subclass :class:`Screen`. Screen + is implemented as sort of singleton, so there can exist only one instance of + Screen at a time. It should be used when :mod:`turtle` is used as a + standalone tool for doing graphics. -I. TURTLE MOTION ------------------ + All methods of TurtleScreen/Screen also exist as functions, i.e. as part of + the procedure-oriented interface. -MOVE AND DRAW - forward | fd - back | bk | back - right | rt - left | lt - goto | setpos | setposition - setx - sety - setheading | seth - home - circle - dot - stamp - clearstamp - clearstamps - undo - speed - -TELL TURTLE'S STATE - position | pos - towards - xcor - ycor - heading - distance - -SETTING AND MEASUREMENT - degrees - radians +2. :class:`RawTurtle` (alias: :class:`RawPen`) defines Turtle objects which draw + on a :class:`TurtleScreen`. Its constructor needs a Canvas, ScrolledCanvas + or TurtleScreen as argument, so the RawTurtle objects know where to draw. -II. PEN CONTROL ---------------- + Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), + which draws on "the" :class:`Screen` - instance which is automatically + created, if not already present. -DRAWING STATE - pendown | pd | down - penup | pu | up - pensize | width - pen - isdown - -COLOR CONTROL - color - pencolor - fillcolor - -FILLING - fill - begin_fill - end_fill - -MORE DRAWING CONTROL - reset - clear - write - -III. TURTLE STATE ------------------ + All methods of RawTurtle/Turtle also exist as functions, i.e. part of the + procedure-oriented interface. -VISIBILITY - showturtle | st - hideturtle | ht - isvisible - -APPEARANCE - shape - resizemode - shapesize | turtlesize - settiltangle - tiltangle - tilt - -IV. USING EVENTS ----------------- - onclick - onrelease - ondrag - -V. SPECIAL TURTLE METHODS -------------------------- - begin_poly - end_poly - get_poly - clone - getturtle | getpen - getscreen - setundobuffer - undobufferentries - tracer - window_width - window_height - -..EXCURSUS ABOUT THE USE OF COMPOUND SHAPES -..----------------------------------------- +The procedural interface provides functions which are derived from the methods +of the classes :class:`Screen` and :class:`Turtle`. They have the same names as +the corresponding methods. A screen object is automativally created whenever a +function derived from a Screen method is called. An (unnamed) turtle object is +automatically created whenever any of the functions derived from a Turtle method +is called. -(B) METHODS OF TurtleScreen/Screen -================================== +To use multiple turtles an a screen one has to use the object-oriented interface. -I. WINDOW CONTROL ------------------ - bgcolor - bgpic - clear | clearscreen - reset | resetscreen - screensize - setworldcoordinates - -II. ANIMATION CONTROL ---------------------- - delay - tracer - update - -III. USING SCREEN EVENTS ------------------------- - listen - onkey - onclick | onscreenclick - ontimer - -IV. SETTINGS AND SPECIAL METHODS --------------------------------- - mode - colormode - getcanvas - getshapes - register_shape | addshape - turtles - window_height - window_width - -V. METHODS SPECIFIC TO Screen -============================= - bye() - exitonclick() - setup() - title() - ----------------end of OVERVIEW --------------------------- - - - -2. METHODS OF RawTurtle/Turtle AND CORRESPONDING FUNCTIONS -========================================================== - -(I) TURTLE MOTION: ------------------- - -(a) --- MOVE (AND DRAW) - - - .. method:: forward(distance) - .. method:: fd(distance) - distance -- a number (integer or float) - - Move the turtle forward by the specified distance, in the direction - the turtle is headed. - - Example (for a Turtle instance named turtle):: - >>> turtle.position() - (0.00, 0.00) - >>> turtle.forward(25) - >>> turtle.position() - (25.00,0.00) - >>> turtle.forward(-75) - >>> turtle.position() - (-50.00,0.00) - - - .. method:: back(distance) - .. method:: bk(distance) - .. method:: backward(distance) - distance -- a number - - call: back(distance) - --or: bk(distance) - --or: backward(distance) - - Move the turtle backward by distance ,opposite to the direction the - turtle is headed. Do not change the turtle's heading. - - Example (for a Turtle instance named turtle):: - - >>> turtle.position() - (0.00, 0.00) - >>> turtle.backward(30) - >>> turtle.position() - (-30.00, 0.00) - +.. note:: + In the following documentation the argument list for functions is given. + Methods, of course, have the additional first argument *self* which is + omitted here. - .. method:: right(angle) - .. method:: rt(angle) - angle -- a number (integer or float) - - Turn turtle right by angle units. (Units are by default degrees, - but can be set via the degrees() and radians() functions.) - Angle orientation depends on mode. (See this.) - - Example (for a Turtle instance named turtle):: - >>> turtle.heading() - 22.0 - >>> turtle.right(45) - >>> turtle.heading() - 337.0 - - - .. method:: left(angle) - .. method:: lt(angle) - angle -- a number (integer or float) - - Turn turtle left by angle units. (Units are by default degrees, - but can be set via the degrees() and radians() functions.) - Angle orientation depends on mode. (See this.) - - Example (for a Turtle instance named turtle):: - >>> turtle.heading() - 22.0 - >>> turtle.left(45) - >>> turtle.heading() - 67.0 - - .. method:: goto(x, y=None) - .. method:: setpos(x, y=None) - .. method:: setposition(x, y=None) - x -- a number or a pair/vector of numbers - y -- a number None - - call: goto(x, y) # two coordinates - --or: goto((x, y)) # a pair (tuple) of coordinates - --or: goto(vec) # e.g. as returned by pos() - - Move turtle to an absolute position. If the pen is down, - draw line. Do not change the turtle's orientation. - - Example (for a Turtle instance named turtle):: - >>> tp = turtle.pos() - >>> tp - (0.00, 0.00) - >>> turtle.setpos(60,30) - >>> turtle.pos() - (60.00,30.00) - >>> turtle.setpos((20,80)) - >>> turtle.pos() - (20.00,80.00) - >>> turtle.setpos(tp) - >>> turtle.pos() - (0.00,0.00) - - - .. method:: setx(x) - x -- a number (integer or float) - - Set the turtle's first coordinate to x, leave second coordinate - unchanged. - - Example (for a Turtle instance named turtle):: - >>> turtle.position() - (0.00, 240.00) - >>> turtle.setx(10) - >>> turtle.position() - (10.00, 240.00) - - - .. method:: sety(y) - y -- a number (integer or float) - Set the turtle's first coordinate to x, leave second coordinate - unchanged. +Overview over available Turtle and Screen methods +================================================= - Example (for a Turtle instance named turtle):: - >>> turtle.position() - (0.00, 40.00) - >>> turtle.sety(-10) - >>> turtle.position() - (0.00, -10.00) +Turtle methods +-------------- - - .. method:: setheading(to_angle) - .. method:: seth(to_angle) - to_angle -- a number (integer or float) - - Set the orientation of the turtle to to_angle. - Here are some common directions in degrees: - - =================== ==================== - standard - mode logo-mode - =================== ==================== - 0 - east 0 - north - 90 - north 90 - east - 180 - west 180 - south - 270 - south 270 - west - =================== ==================== - - Example (for a Turtle instance named turtle):: - >>> turtle.setheading(90) - >>> turtle.heading() - 90 - - - .. method:: home(): - Move turtle to the origin - coordinates (0,0) and set it's - heading to it's start-orientation (which depends on mode). - - Example (for a Turtle instance named turtle):: - >>> turtle.home() +Turtle motion + Move and draw + | :func:`forward` | :func:`fd` + | :func:`backward` | :func:`bk` | :func:`back` + | :func:`right` | :func:`rt` + | :func:`left` | :func:`lt` + | :func:`goto` | :func:`setpos` | :func:`setposition` + | :func:`setx` + | :func:`sety` + | :func:`setheading` | :func:`seth` + | :func:`home` + | :func:`circle` + | :func:`dot` + | :func:`stamp` + | :func:`clearstamp` + | :func:`clearstamps` + | :func:`undo` + | :func:`speed` + + Tell Turtle's state + | :func:`position` | :func:`pos` + | :func:`towards` + | :func:`xcor` + | :func:`ycor` + | :func:`heading` + | :func:`distance` + + Setting and measurement + | :func:`degrees` + | :func:`radians` + +Pen control + Drawing state + | :func:`pendown` | :func:`pd` | :func:`down` + | :func:`penup` | :func:`pu` | :func:`up` + | :func:`pensize` | :func:`width` + | :func:`pen` + | :func:`isdown` + + Color control + | :func:`color` + | :func:`pencolor` + | :func:`fillcolor` + + Filling + | :func:`fill` + | :func:`begin_fill` + | :func:`end_fill` + + More drawing control + | :func:`reset` + | :func:`clear` + | :func:`write` + +Turtle state + Visibility + | :func:`showturtle` | :func:`st` + | :func:`hideturtle` | :func:`ht` + | :func:`isvisible` + + Appearance + | :func:`shape` + | :func:`resizemode` + | :func:`shapesize` | :func:`turtlesize` + | :func:`settiltangle` + | :func:`tiltangle` + | :func:`tilt` + +Using events + | :func:`onclick` + | :func:`onrelease` + | :func:`ondrag` + +Special Turtle methods + | :func:`begin_poly` + | :func:`end_poly` + | :func:`get_poly` + | :func:`clone` + | :func:`getturtle` | :func:`getpen` + | :func:`getscreen` + | :func:`setundobuffer` + | :func:`undobufferentries` + | :func:`tracer` + | :func:`window_width` + | :func:`window_height` + + +Methods of TurtleScreen/Screen +------------------------------ + +Window control + | :func:`bgcolor` + | :func:`bgpic` + | :func:`clear` | :func:`clearscreen` + | :func:`reset` | :func:`resetscreen` + | :func:`screensize` + | :func:`setworldcoordinates` + +Animation control + | :func:`delay` + | :func:`tracer` + | :func:`update` + +Using screen events + | :func:`listen` + | :func:`onkey` + | :func:`onclick` | :func:`onscreenclick` + | :func:`ontimer` + +Settings and special methods + | :func:`mode` + | :func:`colormode` + | :func:`getcanvas` + | :func:`getshapes` + | :func:`register_shape` | :func:`addshape` + | :func:`turtles` + | :func:`window_height` + | :func:`window_width` + +Methods specific to Screen + | :func:`bye` + | :func:`exitonclick` + | :func:`setup` + | :func:`title` - - .. method:: circle(radius, extent=None, steps=None) - radius -- a number - extent (optional) -- a number - steps (optional) -- an integer - - Draw a circle with given radius. The center is radius units left - of the turtle; extent - an angle - determines which part of the - circle is drawn. If extent is not given, draw the entire circle. - If extent is not a full circle, one endpoint of the arc is the - current pen position. Draw the arc in counterclockwise direction - if radius is positive, otherwise in clockwise direction. Finally - the direction of the turtle is changed by the amount of extent. - - As the circle is approximated by an inscribed regular polygon, - steps determines the number of steps to use. If not given, - it will be calculated automatically. Maybe used to draw regular - polygons. - - call: circle(radius) # full circle - --or: circle(radius, extent) # arc - --or: circle(radius, extent, steps) - --or: circle(radius, steps=6) # 6-sided polygon - - Example (for a Turtle instance named turtle):: - >>> turtle.circle(50) - >>> turtle.circle(120, 180) # semicircle - - .. method:: dot(size=None, *color) - size -- an integer >= 1 (if given) - color -- a colorstring or a numeric color tuple - - Draw a circular dot with diameter size, using color. If size - is not given, the maximum of pensize+4 and 2*pensize is used. - - Example (for a Turtle instance named turtle):: - >>> turtle.dot() - >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) - - - .. method:: stamp(): - Stamp a copy of the turtle shape onto the canvas at the current - turtle position. Return a stamp_id for that stamp, which can be - used to delete it by calling clearstamp(stamp_id). - - Example (for a Turtle instance named turtle):: - >>> turtle.color("blue") - >>> turtle.stamp() - 13 - >>> turtle.fd(50) +Methods of RawTurtle/Turtle and corresponding functions +======================================================= - - .. method:: clearstamp(stampid): - stampid - an integer, must be return value of previous stamp() call. - - Delete stamp with given stampid - - Example (for a Turtle instance named turtle):: - >>> turtle.color("blue") - >>> astamp = turtle.stamp() - >>> turtle.fd(50) - >>> turtle.clearstamp(astamp) +Most of the examples in this section refer to a Turtle instance called +``turtle``. - - .. method:: clearstamps(n=None): - n -- an integer +Turtle motion +------------- - Delete all or first/last n of turtle's stamps. - If n is None, delete all of pen's stamps, - else if n > 0 delete first n stamps - else if n < 0 delete last n stamps. - - Example (for a Turtle instance named turtle):: - >>> for i in range(8): - ... turtle.stamp(); turtle.fd(30) - >>> turtle.clearstamps(2) - >>> turtle.clearstamps(-2) - >>> turtle.clearstamps() +.. function:: forward(distance) + fd(distance) - - .. method:: undo(): - undo (repeatedly) the last turtle action(s). Number of available - undo actions is determined by the size of the undobuffer. - - Example (for a Turtle instance named turtle):: - >>> for i in range(4): - turtle.fd(50); turtle.lt(80) - - >>> for i in range(8): - turtle.undo() + :param distance: a number (integer or float) - - .. method:: speed(speed=None): - speed -- an integer in the range 0..10 or a speedstring (see below) - - Set the turtle's speed to an integer value in the range 0 .. 10. - If no argument is given: return current speed. - - If input is a number greater than 10 or smaller than 0.5, - speed is set to 0. - Speedstrings are mapped to speedvalues as follows: - - * 'fastest' : 0 - * 'fast' : 10 - * 'normal' : 6 - * 'slow' : 3 - * 'slowest' : 1 - - speeds from 1 to 10 enforce increasingly faster animation of - line drawing and turtle turning. - - Attention: - speed = 0 : *no* animation takes place. forward/back makes turtle jump - and likewise left/right make the turtle turn instantly. + Move the turtle forward by the specified *distance*, in the direction the + turtle is headed. - Example (for a Turtle instance named turtle):: - >>> turtle.speed(3) - - -TELL TURTLE'S STATE + >>> turtle.position() + (0.00, 0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) + + +.. function:: back(distance) + bk(distance) + backward(distance) + + :param distance: a number + + Move the turtle backward by *distance*, opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + >>> turtle.position() + (0.00, 0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00, 0.00) + + +.. function:: right(angle) + rt(angle) + + :param angle: a number (integer or float) + + Turn turtle right by *angle* units. (Units are by default degrees, but + can be set via the :func:`degrees` and :func:`radians` functions.) Angle + orientation depends on the turtle mode, see :func:`mode`. + + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 + + +.. function:: left(angle) + lt(angle) + + :param angle: a number (integer or float) + + Turn turtle left by *angle* units. (Units are by default degrees, but + can be set via the :func:`degrees` and :func:`radians` functions.) Angle + orientation depends on the turtle mode, see :func:`mode`. + + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + +.. function:: goto(x, y=None) + setpos(x, y=None) + setposition(x, y=None) + + :param x: a number or a pair/vector of numbers + :param y: a number or ``None`` + + If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` + (e.g. as returned by :func:`pos`). + + Move turtle to an absolute position. If the pen is down, draw line. Do + not change the turtle's orientation. + + >>> tp = turtle.pos() + >>> tp + (0.00, 0.00) + >>> turtle.setpos(60,30) + >>> turtle.pos() + (60.00,30.00) + >>> turtle.setpos((20,80)) + >>> turtle.pos() + (20.00,80.00) + >>> turtle.setpos(tp) + >>> turtle.pos() + (0.00,0.00) + + +.. function:: setx(x) + + :param x: a number (integer or float) + + Set the turtle's first coordinate to *x*, leave second coordinate + unchanged. + + >>> turtle.position() + (0.00, 240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00, 240.00) + + +.. function:: sety(y) + + :param y: a number (integer or float) + + Set the turtle's first coordinate to *y*, leave second coordinate + unchanged. + + >>> turtle.position() + (0.00, 40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00, -10.00) + + +.. function:: setheading(to_angle) + seth(to_angle) + + :param to_angle: a number (integer or float) + + Set the orientation of the turtle to *to_angle*. Here are some common + directions in degrees: + + =================== ==================== + standard mode logo mode + =================== ==================== + 0 - east 0 - north + 90 - north 90 - east + 180 - west 180 - south + 270 - south 270 - west + =================== ==================== + + >>> turtle.setheading(90) + >>> turtle.heading() + 90 + + +.. function:: home() + + Move turtle to the origin -- coordinates (0,0) -- and set its heading to + its start-orientation (which depends on the mode, see :func:`mode`). + + +.. function:: circle(radius, extent=None, steps=None) + + :param radius: a number + :param extent: a number (or ``None``) + :param steps: an integer (or ``None``) + + Draw a circle with given *radius*. The center is *radius* units left of + the turtle; *extent* -- an angle -- determines which part of the circle + is drawn. If *extent* is not given, draw the entire circle. If *extent* + is not a full circle, one endpoint of the arc is the current pen + position. Draw the arc in counterclockwise direction if *radius* is + positive, otherwise in clockwise direction. Finally the direction of the + turtle is changed by the amount of *extent*. + + As the circle is approximated by an inscribed regular polygon, *steps* + determines the number of steps to use. If not given, it will be + calculated automatically. May be used to draw regular polygons. + + >>> turtle.circle(50) + >>> turtle.circle(120, 180) # draw a semicircle + + +.. function:: dot(size=None, *color) + + :param size: an integer >= 1 (if given) + :param color: a colorstring or a numeric color tuple + + Draw a circular dot with diameter *size*, using *color*. If *size* is + not given, the maximum of pensize+4 and 2*pensize is used. + + >>> turtle.dot() + >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) + + +.. function:: stamp() + + Stamp a copy of the turtle shape onto the canvas at the current turtle + position. Return a stamp_id for that stamp, which can be used to delete + it by calling ``clearstamp(stamp_id)``. + + >>> turtle.color("blue") + >>> turtle.stamp() + 13 + >>> turtle.fd(50) + + +.. function:: clearstamp(stampid) + + :param stampid: an integer, must be return value of previous + :func:`stamp` call + + Delete stamp with given *stampid*. + + >>> turtle.color("blue") + >>> astamp = turtle.stamp() + >>> turtle.fd(50) + >>> turtle.clearstamp(astamp) + + +.. function:: clearstamps(n=None) + + :param n: an integer (or ``None``) + + Delete all or first/last *n* of turtle's stamps. If *n* is None, delete + all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete + last *n* stamps. + + >>> for i in range(8): + ... turtle.stamp(); turtle.fd(30) + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + + +.. function:: undo() + + Undo (repeatedly) the last turtle action(s). Number of available + undo actions is determined by the size of the undobuffer. + + >>> for i in range(4): + ... turtle.fd(50); turtle.lt(80) + ... + >>> for i in range(8): + ... turtle.undo() + + +.. function:: speed(speed=None) + + :param speed: an integer in the range 0..10 or a speedstring (see below) + + Set the turtle's speed to an integer value in the range 0..10. If no + argument is given, return current speed. + + If input is a number greater than 10 or smaller than 0.5, speed is set + to 0. Speedstrings are mapped to speedvalues as follows: + + * "fastest": 0 + * "fast": 10 + * "normal": 6 + * "slow": 3 + * "slowest": 1 + + Speeds from 1 to 10 enforce increasingly faster animation of line drawing + and turtle turning. + + Attention: *speed* = 0 means that *no* animation takes + place. forward/back makes turtle jump and likewise left/right make the + turtle turn instantly. + + >>> turtle.speed(3) + + +Tell Turtle's state ------------------- +.. function:: position() + pos() - .. method:: position() - .. method:: pos() - Return the turtle's current location (x,y) (as a Vec2D-vector) - - Example (for a Turtle instance named turtle):: - >>> turtle.pos() - (0.00, 240.00) - + Return the turtle's current location (x,y) (as a :class:`Vec2D` vector). - .. method:: towards(x, y=None) - x -- a number or a pair/vector of numbers or a turtle instance - y -- a number None None - - call: distance(x, y) # two coordinates - --or: distance((x, y)) # a pair (tuple) of coordinates - --or: distance(vec) # e.g. as returned by pos() - --or: distance(mypen) # where mypen is another turtle - - Return the angle, between the line from turtle-position to position - specified by x, y and the turtle's start orientation. (Depends on - modes - "standard"/"world" or "logo") - - Example (for a Turtle instance named turtle):: - >>> turtle.pos() - (10.00, 10.00) - >>> turtle.towards(0,0) - 225.0 - - - .. method:: xcor() - Return the turtle's x coordinate - - Example (for a Turtle instance named turtle):: - >>> reset() - >>> turtle.left(60) - >>> turtle.forward(100) - >>> print turtle.xcor() - 50.0 - - - .. method:: ycor() - Return the turtle's y coordinate - - Example (for a Turtle instance named turtle):: - >>> reset() - >>> turtle.left(60) - >>> turtle.forward(100) - >>> print turtle.ycor() - 86.6025403784 - - - .. method:: heading() - Return the turtle's current heading (value depends on mode). - - Example (for a Turtle instance named turtle):: - >>> turtle.left(67) - >>> turtle.heading() - 67.0 - - - .. method:: distance(x, y=None) - x -- a number or a pair/vector of numbers or a turtle instance - y -- a number None None - - call: distance(x, y) # two coordinates - --or: distance((x, y)) # a pair (tuple) of coordinates - --or: distance(vec) # e.g. as returned by pos() - --or: distance(mypen) # where mypen is another turtle - - Return the distance from the turtle to (x,y) in turtle step units. - - Example (for a Turtle instance named turtle):: - >>> turtle.pos() - (0.00, 0.00) - >>> turtle.distance(30,40) - 50.0 - >>> joe = Turtle() - >>> joe.forward(77) - >>> turtle.distance(joe) - 77.0 - - -SETTINGS FOR MEASUREMENT + >>> turtle.pos() + (0.00, 240.00) - .. method:: degrees(fullcircle=360.0) - fullcircle - a number +.. function:: towards(x, y=None) - Set angle measurement units, i. e. set number - of 'degrees' for a full circle. Dafault value is - 360 degrees. - - Example (for a Turtle instance named turtle):: - >>> turtle.left(90) - >>> turtle.heading() - 90 - >>> turtle.degrees(400.0) # angle measurement in gon - >>> turtle.heading() - 100 - - - .. method:: radians() - Set the angle measurement units to radians. - - Example (for a Turtle instance named turtle):: - >>> turtle.heading() - 90 - >>> turtle.radians() - >>> turtle.heading() - 1.5707963267948966 - + :param x: a number or a pair/vector of numbers or a turtle instance + :param y: a number if *x* is a number, else ``None`` -(II) PEN CONTROL: ------------------ + Return the angle between the line from turtle position to position specified + by (x,y), the vector or the other turtle. This depends on the turtle's start + orientation which depends on the mode - "standard"/"world" or "logo"). -DRAWING STATE + >>> turtle.pos() + (10.00, 10.00) + >>> turtle.towards(0,0) + 225.0 - .. method:: pendown() - .. method:: pd() - .. method:: down() - Pull the pen down -- drawing when moving. - - Example (for a Turtle instance named turtle):: - >>> turtle.pendown() - - - .. method:: penup() - .. method:: pu() - .. method:: up() - Pull the pen up -- no drawing when moving. - - Example (for a Turtle instance named turtle):: - >>> turtle.penup() - - - .. method:: pensize(width=None) - .. method:: width(width=None) - width -- positive number - - Set the line thickness to width or return it. If resizemode is set - to "auto" and turtleshape is a polygon, that polygon is drawn with - the same line thickness. If no argument is given, the current pensize - is returned. - - Example (for a Turtle instance named turtle):: - >>> turtle.pensize() - 1 - turtle.pensize(10) # from here on lines of width 10 are drawn - - - .. method:: pen(pen=None, **pendict) - pen -- a dictionary with some or all of the below listed keys. - **pendict -- one or more keyword-arguments with the below - listed keys as keywords. - - Return or set the pen's attributes in a 'pen-dictionary' - with the following key/value pairs: - - * "shown" : True/False - * "pendown" : True/False - * "pencolor" : color-string or color-tuple - * "fillcolor" : color-string or color-tuple - * "pensize" : positive number - * "speed" : number in range 0..10 - * "resizemode" : "auto" or "user" or "noresize" - * "stretchfactor": (positive number, positive number) - * "outline" : positive number - * "tilt" : number - - This dicionary can be used as argument for a subsequent - pen()-call to restore the former pen-state. Moreover one - or more of these attributes can be provided as keyword-arguments. - This can be used to set several pen attributes in one statement. - - Examples (for a Turtle instance named turtle):: - >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) - >>> turtle.pen() - {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, - 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', - 'stretchfactor': (1,1), 'speed': 3} - >>> penstate=turtle.pen() - >>> turtle.color("yellow","") - >>> turtle.penup() - >>> turtle.pen() - {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, - 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', - 'stretchfactor': (1,1), 'speed': 3} - >>> p.pen(penstate, fillcolor="green") - >>> p.pen() - {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, - 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', - 'stretchfactor': (1,1), 'speed': 3} - - - .. method:: isdown(self): - Return True if pen is down, False if it's up. - - Example (for a Turtle instance named turtle):: - >>> turtle.penup() - >>> turtle.isdown() - False - >>> turtle.pendown() - >>> turtle.isdown() - True - - -COLOR CONTROL - - - .. method:: color(*args) - Return or set pencolor and fillcolor. - - Several input formats are allowed. They use 0, 1, 2, or 3 arguments - as follows: - - - color() - Return the current pencolor and the current fillcolor - as a pair of color specification strings as are returned - by pencolor and fillcolor. - - color(colorstring), color((r,g,b)), color(r,g,b) - inputs as in pencolor, set both, fillcolor and pencolor, - to the given value. - - color(colorstring1, colorstring2), - - color((r1,g1,b1), (r2,g2,b2)) - equivalent to pencolor(colorstring1) and fillcolor(colorstring2) - and analogously, if the other input format is used. - - If turtleshape is a polygon, outline and interior of that polygon - is drawn with the newly set colors. - For more info see: pencolor, fillcolor - - Example (for a Turtle instance named turtle):: - >>> turtle.color('red', 'green') - >>> turtle.color() - ('red', 'green') - >>> colormode(255) - >>> color((40, 80, 120), (160, 200, 240)) - >>> color() - ('#285078', '#a0c8f0') - - - .. method:: pencolor(*args) - Return or set the pencolor. - - Four input formats are allowed: - - - pencolor() - Return the current pencolor as color specification string, - possibly in hex-number format (see example). - May be used as input to another color/pencolor/fillcolor call. - - pencolor(colorstring) - s is a Tk color specification string, such as "red" or "yellow" - - pencolor((r, g, b)) - *a tuple* of r, g, and b, which represent, an RGB color, - and each of r, g, and b are in the range 0..colormode, - where colormode is either 1.0 or 255 - - pencolor(r, g, b) - r, g, and b represent an RGB color, and each of r, g, and b - are in the range 0..colormode - - If turtleshape is a polygon, the outline of that polygon is drawn - with the newly set pencolor. - - Example (for a Turtle instance named turtle):: - >>> turtle.pencolor('brown') - >>> tup = (0.2, 0.8, 0.55) - >>> turtle.pencolor(tup) - >>> turtle.pencolor() - '#33cc8c' - - - .. method:: fillcolor(*args) - """ Return or set the fillcolor. - - Four input formats are allowed: - - - fillcolor() - Return the current fillcolor as color specification string, - possibly in hex-number format (see example). - May be used as input to another color/pencolor/fillcolor call. - - fillcolor(colorstring) - s is a Tk color specification string, such as "red" or "yellow" - - fillcolor((r, g, b)) - *a tuple* of r, g, and b, which represent, an RGB color, - and each of r, g, and b are in the range 0..colormode, - where colormode is either 1.0 or 255 - - fillcolor(r, g, b) - r, g, and b represent an RGB color, and each of r, g, and b - are in the range 0..colormode - - If turtleshape is a polygon, the interior of that polygon is drawn - with the newly set fillcolor. - - Example (for a Turtle instance named turtle):: - >>> turtle.fillcolor('violet') - >>> col = turtle.pencolor() - >>> turtle.fillcolor(col) - >>> turtle.fillcolor(0, .5, 0) - - - See also: Screen method colormode() - - -FILLING - - - .. method:: fill(flag) - flag -- True/False (or 1/0 respectively) - - Call fill(True) before drawing the shape you want to fill, - and fill(False) when done. When used without argument: return - fillstate (True if filling, False else). - - Example (for a Turtle instance named turtle):: - >>> turtle.fill(True) - >>> for _ in range(3): - ... turtle.forward(100) - ... turtle.left(120) - ... - >>> turtle.fill(False) - - - .. method:: begin_fill() - Called just before drawing a shape to be filled. - - Example (for a Turtle instance named turtle):: - >>> turtle.color("black", "red") - >>> turtle.begin_fill() - >>> turtle.circle(60) - >>> turtle.end_fill() - - - .. method:: end_fill() - Fill the shape drawn after the call begin_fill(). - - Example: See begin_fill() - - -MORE DRAWING CONTROL - - - .. method:: reset() - Delete the turtle's drawings from the screen, re-center the turtle - and set variables to the default values. - - Example (for a Turtle instance named turtle):: - >>> turtle.position() - (0.00,-22.00) - >>> turtle.heading() - 100.0 - >>> turtle.reset() - >>> turtle.position() - (0.00,0.00) - >>> turtle.heading() - 0.0 - - - .. method:: clear() - Delete the turtle's drawings from the screen. Do not move turtle. - State and position of the turtle as well as drawings of other - turtles are not affected. +.. function:: xcor() - Examples (for a Turtle instance named turtle): - >>> turtle.clear() - - - .. method:: write(arg, move=False, align='left', font=('Arial', 8, 'normal')) - arg -- info, which is to be written to the TurtleScreen - move (optional) -- True/False - align (optional) -- one of the strings "left", "center" or right" - font (optional) -- a triple (fontname, fontsize, fonttype) - - Write text - the string representation of arg - at the current - turtle position according to align ("left", "center" or right") - and with the given font. - If move is True, the pen is moved to the bottom-right corner - of the text. By default, move is False. - - Example (for a Turtle instance named turtle):: - >>> turtle.write('Home = ', True, align="center") - >>> turtle.write((0,0), True) - + Return the turtle's x coordinate. -TURTLE STATE: -------------- + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.xcor() + 50.0 -VISIBILITY +.. function:: ycor() - .. method:: showturtle() - .. method:: st() - Makes the turtle visible. - - Example (for a Turtle instance named turtle):: - >>> turtle.hideturtle() - >>> turtle.showturtle() - - - .. method:: hideturtle() - .. method:: ht() - Makes the turtle invisible. - It's a good idea to do this while you're in the middle of - doing some complex drawing, because hiding the turtle speeds - up the drawing observably. - - Example (for a Turtle instance named turtle):: - >>> turtle.hideturtle() - - - .. method:: isvisible(self): - Return True if the Turtle is shown, False if it's hidden. - - Example (for a Turtle instance named turtle):: - >>> turtle.hideturtle() - >>> print turtle.isvisible(): - False - - -APPEARANCE - - - .. method:: shape(name=None) - name -- a string, which is a valid shapename - - Set turtle shape to shape with given name or, if name is not given, - return name of current shape. - Shape with name must exist in the TurtleScreen's shape dictionary. - Initially there are the following polygon shapes: - 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'. - To learn about how to deal with shapes see Screen-method register_shape. - - Example (for a Turtle instance named turtle):: - >>> turtle.shape() - 'arrow' - >>> turtle.shape("turtle") - >>> turtle.shape() - 'turtle' - - - .. method:: resizemode(rmode=None) - rmode -- one of the strings "auto", "user", "noresize" - - Set resizemode to one of the values: "auto", "user", "noresize". - If rmode is not given, return current resizemode. - Different resizemodes have the following effects: - - - "auto" adapts the appearance of the turtle - corresponding to the value of pensize. - - "user" adapts the appearance of the turtle according to the - values of stretchfactor and outlinewidth (outline), - which are set by shapesize() - - "noresize" no adaption of the turtle's appearance takes place. - - resizemode("user") is called by a shapesize when used with arguments. - - Examples (for a Turtle instance named turtle):: - >>> turtle.resizemode("noresize") - >>> turtle.resizemode() - 'noresize' - - - .. method:: shapesize(stretch_wid=None, stretch_len=None, outline=None): - stretch_wid -- positive number - stretch_len -- positive number - outline -- positive number - - Return or set the pen's attributes x/y-stretchfactors and/or outline. - Set resizemode to "user". - If and only if resizemode is set to "user", the turtle will be - displayed stretched according to its stretchfactors: - stretch_wid is stretchfactor perpendicular to it's orientation, - stretch_len is stretchfactor in direction of it's orientation, - outline determines the width of the shapes's outline. - - Examples (for a Turtle instance named turtle):: - >>> turtle.resizemode("user") - >>> turtle.shapesize(5, 5, 12) - >>> turtle.shapesize(outline=8) - - - .. method:: tilt(angle) - angle - a number + Return the turtle's y coordinate. - Rotate the turtleshape by angle from its current tilt-angle, - but do NOT change the turtle's heading (direction of movement). - - Examples (for a Turtle instance named turtle):: - >>> turtle.shape("circle") - >>> turtle.shapesize(5,2) - >>> turtle.tilt(30) - >>> turtle.fd(50) - >>> turtle.tilt(30) - >>> turtle.fd(50) - - - .. method:: settiltangle(angle) - angle -- number - - Rotate the turtleshape to point in the direction specified by angle, - regardless of its current tilt-angle. DO NOT change the turtle's - heading (direction of movement). - - Examples (for a Turtle instance named turtle):: - >>> turtle.shape("circle") - >>> turtle.shapesize(5,2) - >>> turtle.settiltangle(45) - >>> stamp() - >>> turtle.fd(50) - >>> turtle.settiltangle(-45) - >>> stamp() - >>> turtle.fd(50) - - - .. method:: tiltangle() - Return the current tilt-angle, i. e. the angle between the - orientation of the turtleshape and the heading of the turtle - (it's direction of movement). - - Examples (for a Turtle instance named turtle):: - >>> turtle.shape("circle") - >>> turtle.shapesize(5,2) - >>> turtle.tilt(45) - >>> turtle.tiltangle() - 45 - - -IV. USING EVENTS ----------------- - - - .. method:: onclick(fun, btn=1, add=None) - fun -- a function with two arguments, to which will be assigned - the coordinates of the clicked point on the canvas. - num -- number of the mouse-button defaults to 1 (left mouse button). - add -- True or False. If True, new binding will be added, otherwise - it will replace a former binding. - - Bind fun to mouse-click event on this turtle on canvas. - If fun is None, existing bindings are removed. - Example for the anonymous turtle, i. e. the procedural way:: + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.ycor() + 86.6025403784 - >>> def turn(x, y): - left(360) - - >>> onclick(turn) # Now clicking into the turtle will turn it. - >>> onclick(None) # event-binding will be removed - - - .. method:: onrelease(fun, btn=1, add=None): - """ - Arguments: - fun -- a function with two arguments, to which will be assigned - the coordinates of the clicked point on the canvas. - num -- number of the mouse-button defaults to 1 (left mouse button). - add -- True or False. If True, new binding will be added, otherwise - it will replace a former binding. - - Bind fun to mouse-button-release event on this turtle on canvas. - If fun is None, existing bindings are removed. - - Example (for a MyTurtle instance named turtle): - >>> class MyTurtle(Turtle): - ... def glow(self,x,y): - ... self.fillcolor("red") - ... def unglow(self,x,y): - ... self.fillcolor("") - ... - >>> turtle = MyTurtle() - >>> turtle.onclick(turtle.glow) - >>> turtle.onrelease(turtle.unglow) - ### clicking on turtle turns fillcolor red, - ### unclicking turns it to transparent. - - - .. method:: ondrag(fun, btn=1, add=None): - fun -- a function with two arguments, to which will be assigned - the coordinates of the clicked point on the canvas. - num -- number of the mouse-button defaults to 1 (left mouse button). - add -- True or False. If True, new binding will be added, otherwise - it will replace a former binding. - - Bind fun to mouse-move event on this turtle on canvas. - If fun is None, existing bindings are removed. - - Remark: Every sequence of mouse-move-events on a turtle is preceded - by a mouse-click event on that turtle. - If fun is None, existing bindings are removed. - - Example (for a Turtle instance named turtle): - >>> turtle.ondrag(turtle.goto) - ### Subsequently clicking and dragging a Turtle will move it across - ### the screen thereby producing handdrawings (if pen is down). - - -V. SPECIAL TURTLE METHODS --------------------------- +.. function:: heading() + + Return the turtle's current heading (value depends on the turtle mode, see + :func:`mode`). + + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + + +.. function:: distance(x, y=None) + + :param x: a number or a pair/vector of numbers or a turtle instance + :param y: a number if *x* is a number, else ``None`` + + Return the distance from the turtle to (x,y), the given vector, or the given + other turtle, in turtle step units. + + >>> turtle.pos() + (0.00, 0.00) + >>> turtle.distance(30,40) + 50.0 + >>> joe = Turtle() + >>> joe.forward(77) + >>> turtle.distance(joe) + 77.0 + + +Settings for measurement +------------------------ + +.. function:: degrees(fullcircle=360.0) + + :param fullcircle: a number + + Set angle measurement units, i.e. set number of "degrees" for a full circle. + Default value is 360 degrees. + + >>> turtle.left(90) + >>> turtle.heading() + 90 + >>> turtle.degrees(400.0) # angle measurement in gon + >>> turtle.heading() + 100 + + +.. function:: radians() + + Set the angle measurement units to radians. Equivalent to + ``degrees(2*math.pi)``. + + >>> turtle.heading() + 90 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + + +Pen control +----------- + +Drawing state +~~~~~~~~~~~~~ + +.. function:: pendown() + pd() + down() + + Pull the pen down -- drawing when moving. + + +.. function:: penup() + pu() + up() + + Pull the pen up -- no drawing when moving. + + +.. function:: pensize(width=None) + width(width=None) + + :param width: a positive number + + Set the line thickness to *width* or return it. If resizemode is set to + "auto" and turtleshape is a polygon, that polygon is drawn with the same line + thickness. If no argument is given, the current pensize is returned. + + >>> turtle.pensize() + 1 + >>> turtle.pensize(10) # from here on lines of width 10 are drawn + + +.. function:: pen(pen=None, **pendict) + + :param pen: a dictionary with some or all of the below listed keys + :param pendict: one or more keyword-arguments with the below listed keys as keywords + + Return or set the pen's attributes in a "pen-dictionary" with the following + key/value pairs: + + * "shown": True/False + * "pendown": True/False + * "pencolor": color-string or color-tuple + * "fillcolor": color-string or color-tuple + * "pensize": positive number + * "speed": number in range 0..10 + * "resizemode": "auto" or "user" or "noresize" + * "stretchfactor": (positive number, positive number) + * "outline": positive number + * "tilt": number + + This dicionary can be used as argument for a subsequent call to :func:`pen` + to restore the former pen-state. Moreover one or more of these attributes + can be provided as keyword-arguments. This can be used to set several pen + attributes in one statement. + + >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', + 'stretchfactor': (1,1), 'speed': 3} + >>> penstate=turtle.pen() + >>> turtle.color("yellow","") + >>> turtle.penup() + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', + 'stretchfactor': (1,1), 'speed': 3} + >>> p.pen(penstate, fillcolor="green") + >>> p.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', + 'stretchfactor': (1,1), 'speed': 3} + + +.. function:: isdown() + + Return ``True`` if pen is down, ``False`` if it's up. + + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + + +Color control +~~~~~~~~~~~~~ + +.. function:: pencolor(*args) + + Return or set the pencolor. + + Four input formats are allowed: + + ``pencolor()`` + Return the current pencolor as color specification string, possibly in + hex-number format (see example). May be used as input to another + color/pencolor/fillcolor call. + + ``pencolor(colorstring)`` + Set pencolor to *colorstring*, which is a Tk color specification string, + such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. + + ``pencolor((r, g, b))`` + Set pencolor to the RGB color represented by the tuple of *r*, *g*, and + *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where + colormode is either 1.0 or 255 (see :func:`colormode`). + + ``pencolor(r, g, b)`` + Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of + *r*, *g*, and *b* must be in the range 0..colormode. + + If turtleshape is a polygon, the outline of that polygon is drawn with the + newly set pencolor. + + >>> turtle.pencolor("brown") + >>> tup = (0.2, 0.8, 0.55) + >>> turtle.pencolor(tup) + >>> turtle.pencolor() + "#33cc8c" + + +.. function:: fillcolor(*args) + + Return or set the fillcolor. + + Four input formats are allowed: + + ``fillcolor()`` + Return the current fillcolor as color specification string, possibly in + hex-number format (see example). May be used as input to another + color/pencolor/fillcolor call. + + ``fillcolor(colorstring)`` + Set fillcolor to *colorstring*, which is a Tk color specification string, + such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. + + ``fillcolor((r, g, b))`` + Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and + *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where + colormode is either 1.0 or 255 (see :func:`colormode`). + + ``fillcolor(r, g, b)`` + Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of + *r*, *g*, and *b* must be in the range 0..colormode. + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + >>> turtle.fillcolor("violet") + >>> col = turtle.pencolor() + >>> turtle.fillcolor(col) + >>> turtle.fillcolor(0, .5, 0) + + +.. function:: color(*args) + + Return or set pencolor and fillcolor. + + Several input formats are allowed. They use 0 to 3 arguments as + follows: + + ``color()`` + Return the current pencolor and the current fillcolor as a pair of color + specification strings as returned by :func:`pencolor` and + :func:`fillcolor`. + + ``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)`` + Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the + given value. + + ``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))`` + Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` + and analogously if the other input format is used. + + If turtleshape is a polygon, outline and interior of that polygon is drawn + with the newly set colors. + + >>> turtle.color("red", "green") + >>> turtle.color() + ("red", "green") + >>> colormode(255) + >>> color((40, 80, 120), (160, 200, 240)) + >>> color() + ("#285078", "#a0c8f0") + + +See also: Screen method :func:`colormode`. + + +Filling +~~~~~~~ + +.. function:: fill(flag) + + :param flag: True/False (or 1/0 respectively) + + Call ``fill(True)`` before drawing the shape you want to fill, and + ``fill(False)`` when done. When used without argument: return fillstate + (``True`` if filling, ``False`` else). + + >>> turtle.fill(True) + >>> for _ in range(3): + ... turtle.forward(100) + ... turtle.left(120) + ... + >>> turtle.fill(False) + + +.. function:: begin_fill() + + Call just before drawing a shape to be filled. Equivalent to ``fill(True)``. + + >>> turtle.color("black", "red") + >>> turtle.begin_fill() + >>> turtle.circle(60) + >>> turtle.end_fill() + + +.. function:: end_fill() + + Fill the shape drawn after the last call to :func:`begin_fill`. Equivalent + to ``fill(False)``. + + +More drawing control +~~~~~~~~~~~~~~~~~~~~ + +.. function:: reset() + + Delete the turtle's drawings from the screen, re-center the turtle and set + variables to the default values. + + >>> turtle.position() + (0.00,-22.00) + >>> turtle.heading() + 100.0 + >>> turtle.reset() + >>> turtle.position() + (0.00,0.00) + >>> turtle.heading() + 0.0 + + +.. function:: clear() + + Delete the turtle's drawings from the screen. Do not move turtle. State and + position of the turtle as well as drawings of other turtles are not affected. + + +.. function:: write(arg, move=False, align="left", font=("Arial", 8, "normal")) + + :param arg: object to be written to the TurtleScreen + :param move: True/False + :param align: one of the strings "left", "center" or right" + :param font: a triple (fontname, fontsize, fonttype) + + Write text - the string representation of *arg* - at the current turtle + position according to *align* ("left", "center" or right") and with the given + font. If *move* is True, the pen is moved to the bottom-right corner of the + text. By default, *move* is False. + + >>> turtle.write("Home = ", True, align="center") + >>> turtle.write((0,0), True) + + +Turtle state +------------ - .. method:: begin_poly(): - Start recording the vertices of a polygon. Current turtle position - is first vertex of polygon. +Visibility +~~~~~~~~~~ - Example (for a Turtle instance named turtle): - >>> turtle.begin_poly() +.. function:: showturtle() + st() + Make the turtle visible. - .. method:: end_poly(): - Stop recording the vertices of a polygon. Current turtle position is - last vertex of polygon. This will be connected with the first vertex. + >>> turtle.hideturtle() + >>> turtle.showturtle() - Example (for a Turtle instance named turtle): - >>> turtle.end_poly() +.. function:: hideturtle() + ht() - .. method:: get_poly(): - Return the lastly recorded polygon. + Make the turtle invisible. It's a good idea to do this while you're in the + middle of doing some complex drawing, because hiding the turtle speeds up the + drawing observably. - Example (for a Turtle instance named turtle): - >>> p = turtle.get_poly() - >>> turtle.register_shape("myFavouriteShape", p) + >>> turtle.hideturtle() - .. method:: clone(): - Create and return a clone of the turtle with same position, heading - and turtle properties. +.. function:: isvisible() - Example (for a Turtle instance named mick): - mick = Turtle() - joe = mick.clone() + Return True if the Turtle is shown, False if it's hidden. + >>> turtle.hideturtle() + >>> print turtle.isvisible(): + False - .. method:: getturtle(): - Return the Turtleobject itself. - Only reasonable use: as a function to return the 'anonymous turtle': - - Example: - >>> pet = getturtle() - >>> pet.fd(50) - >>> pet - - >>> turtles() - [] +Appearance +~~~~~~~~~~ - .. method:: getscreen(): - Return the TurtleScreen object, the turtle is drawing on. - So TurtleScreen-methods can be called for that object. +.. function:: shape(name=None) - Example (for a Turtle instance named turtle): - >>> ts = turtle.getscreen() - >>> ts - - >>> ts.bgcolor("pink") + :param name: a string which is a valid shapename + Set turtle shape to shape with given *name* or, if name is not given, return + name of current shape. Shape with *name* must exist in the TurtleScreen's + shape dictionary. Initially there are the following polygon shapes: "arrow", + "turtle", "circle", "square", "triangle", "classic". To learn about how to + deal with shapes see Screen method :func:`register_shape`. - .. method:: def setundobuffer(size): - size -- an integer or None + >>> turtle.shape() + "arrow" + >>> turtle.shape("turtle") + >>> turtle.shape() + "turtle" - Set or disable undobuffer. - If size is an integer an empty undobuffer of given size is installed. - Size gives the maximum number of turtle-actions that can be undone - by the undo() method/function. - If size is None, no undobuffer is present. - Example (for a Turtle instance named turtle): - >>> turtle.setundobuffer(42) +.. function:: resizemode(rmode=None) + :param rmode: one of the strings "auto", "user", "noresize" - .. method:: undobufferentries(): - """Return count of entries in the undobuffer. + Set resizemode to one of the values: "auto", "user", "noresize". If *rmode* + is not given, return current resizemode. Different resizemodes have the + following effects: - Example (for a Turtle instance named turtle): - >>> while undobufferentries(): - ... undo() + - "auto": adapts the appearance of the turtle corresponding to the value of pensize. + - "user": adapts the appearance of the turtle according to the values of + stretchfactor and outlinewidth (outline), which are set by + :func:`shapesize`. + - "noresize": no adaption of the turtle's appearance takes place. + resizemode("user") is called by :func:`shapesize` when used with arguments. - .. method:: tracer(flag=None, delay=None) - A replica of the corresponding TurtleScreen-method - *Deprecated since Python 2.6* (as RawTurtle method) + >>> turtle.resizemode("noresize") + >>> turtle.resizemode() + "noresize" - .. method:: window_width() - .. method:: window_height() - Both are replicas of the corresponding TurtleScreen-methods - *Deprecated since Python 2.6* (as RawTurtle methods) - +.. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) -EXCURSUS ABOUT THE USE OF COMPOUND SHAPES + :param stretch_wid: positive number + :param stretch_len: positive number + :param outline: positive number + + Return or set the pen's attributes x/y-stretchfactors and/or outline. Set + resizemode to "user". If and only if resizemode is set to "user", the turtle + will be displayed stretched according to its stretchfactors: *stretch_wid* is + stretchfactor perpendicular to its orientation, *stretch_len* is + stretchfactor in direction of its orientation, *outline* determines the width + of the shapes's outline. + + >>> turtle.resizemode("user") + >>> turtle.shapesize(5, 5, 12) + >>> turtle.shapesize(outline=8) + + +.. function:: tilt(angle) + + :param angle: a number + + Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* + change the turtle's heading (direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + + +.. function:: settiltangle(angle) + + :param angle: a number + + Rotate the turtleshape to point in the direction specified by *angle*, + regardless of its current tilt-angle. *Do not* change the turtle's heading + (direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.settiltangle(45) + >>> stamp() + >>> turtle.fd(50) + >>> turtle.settiltangle(-45) + >>> stamp() + >>> turtle.fd(50) + + +.. function:: tiltangle() + + Return the current tilt-angle, i.e. the angle between the orientation of the + turtleshape and the heading of the turtle (its direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(45) + >>> turtle.tiltangle() + 45 + + +Using events +------------ + +.. function:: onclick(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, + existing bindings are removed. Example for the anonymous turtle, i.e. the + procedural way: + + >>> def turn(x, y): + ... left(180) + ... + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed + + +.. function:: onrelease(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-button-release events on this turtle. If *fun* is + ``None``, existing bindings are removed. + + >>> class MyTurtle(Turtle): + ... def glow(self,x,y): + ... self.fillcolor("red") + ... def unglow(self,x,y): + ... self.fillcolor("") + ... + >>> turtle = MyTurtle() + >>> turtle.onclick(turtle.glow) # clicking on turtle turns fillcolor red, + >>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent. + + +.. function:: ondrag(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, + existing bindings are removed. + + Remark: Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. + + >>> turtle.ondrag(turtle.goto) + # Subsequently, clicking and dragging the Turtle will move it across + # the screen thereby producing handdrawings (if pen is down). + + +Special Turtle methods +---------------------- + +.. function:: begin_poly() + + Start recording the vertices of a polygon. Current turtle position is first + vertex of polygon. + + +.. function:: end_poly() + + Stop recording the vertices of a polygon. Current turtle position is last + vertex of polygon. This will be connected with the first vertex. + + +.. function:: get_poly() + + Return the last recorded polygon. + + >>> p = turtle.get_poly() + >>> turtle.register_shape("myFavouriteShape", p) + + +.. function:: clone() + + Create and return a clone of the turtle with same position, heading and + turtle properties. + + >>> mick = Turtle() + >>> joe = mick.clone() + + +.. function:: getturtle() + + Return the Turtle object itself. Only reasonable use: as a function to + return the "anonymous turtle": + + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + >>> turtles() + [] + + +.. function:: getscreen() + + Return the :class:`TurtleScreen` object the turtle is drawing on. + TurtleScreen methods can then be called for that object. + + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + + +.. function:: setundobuffer(size) + + :param size: an integer or ``None`` + + Set or disable undobuffer. If *size* is an integer an empty undobuffer of + given size is installed. *size* gives the maximum number of turtle actions + that can be undone by the :func:`undo` method/function. If *size* is + ``None``, the undobuffer is disabled. + + >>> turtle.setundobuffer(42) + + +.. function:: undobufferentries() + + Return number of entries in the undobuffer. + + >>> while undobufferentries(): + ... undo() + + +.. function:: tracer(flag=None, delay=None) + + A replica of the corresponding TurtleScreen method. + + .. deprecated:: 2.6 + + +.. function:: window_width() + window_height() + + Both are replicas of the corresponding TurtleScreen methods. + + .. deprecated:: 2.6 + + +.. _compoundshapes: + +Excursus about the use of compound shapes ----------------------------------------- -To use compound turtle shapes, which consist of several polygons -of different color, you must use the helper class Shape -explicitely as described below: - - 1. Create an empty Shape object of type compound - 2. Add as many components to this object as desired, - using the addcomponent() method: - - .. method:: addcomponent(self, poly, fill, outline=None) - poly -- a polygon - fill -- a color, the poly will be filled with - outline -- a color for the poly's outline (if given) - -So it goes like this:: +To use compound turtle shapes, which consist of several polygons of different +color, you must use the helper class :class:`Shape` explicitly as described +below: - >>> s = Shape("compound") - >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5)) - >>> s.addcomponent(poly1, "red", "blue") - >>> poly2 = ((0,0),(10,-5),(-10,-5)) - >>> s.addcomponent(poly2, "blue", "red") +1. Create an empty Shape object of type "compound". +2. Add as many components to this object as desired, using the + :meth:`addcomponent` method. -Now add Shape s to the Screen's shapelist ... -.. and use it:: + For example: - >>> register_shape("myshape", s) - >>> shape("myshape") - + >>> s = Shape("compound") + >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s.addcomponent(poly1, "red", "blue") + >>> poly2 = ((0,0),(10,-5),(-10,-5)) + >>> s.addcomponent(poly2, "blue", "red") -NOTE 1: addcomponent() is a method of class Shape (not of -Turtle nor Screen) and thus there is NO FUNCTION of the same name. +3. Now add the Shape to the Screen's shapelist and use it: -NOTE 2: class Shape is used internally by the register_shape method -in different ways. + >>> register_shape("myshape", s) + >>> shape("myshape") -The application programmer has to deal with the Shape class -ONLY when using compound shapes like shown above! -NOTE 3: A short description of the class Shape is in section 4. +.. note:: - - -3. METHODS OF TurtleScreen/Screen AND CORRESPONDING FUNCTIONS -============================================================= + The :class:`Shape` class is used internally by the :func:`register_shape` + method in different ways. The application programmer has to deal with the + Shape class *only* when using compound shapes like shown above! + + +Methods of TurtleScreen/Screen and corresponding functions +========================================================== +Most of the examples in this section refer to a TurtleScreen instance called +``screen``. -WINDOW CONTROL + +Window control -------------- +.. function:: bgcolor(*args) + + :param args: a color string or three numbers in the range 0..colormode or a + 3-tuple of such numbers + + Set or return background color of the TurtleScreen. + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + "orange" + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + "#800080" + + +.. function:: bgpic(picname=None) + + :param picname: a string, name of a gif-file or ``"nopic"``, or ``None`` + + Set background image or return name of current backgroundimage. If *picname* + is a filename, set the corresponding image as background. If *picname* is + ``"nopic"``, delete background image, if present. If *picname* is ``None``, + return the filename of the current backgroundimage. + + >>> screen.bgpic() + "nopic" + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + "landscape.gif" + + +.. function:: clear() + clearscreen() - .. method:: bgcolor(*args) - args -- a color string or three numbers in the range 0..colormode - or a 3-tuple of such numbers. - - Set or return backgroundcolor of the TurtleScreen. - - Example (for a TurtleScreen instance named screen): - >>> screen.bgcolor("orange") - >>> screen.bgcolor() - 'orange' - >>> screen.bgcolor(0.5,0,0.5) - >>> screen.bgcolor() - '#800080' - - - .. method:: bgpic(picname=None) - picname -- a string, name of a gif-file or "nopic". - - Set background image or return name of current backgroundimage. - If picname is a filename, set the corresponing image as background. - If picname is "nopic", delete backgroundimage, if present. - If picname is None, return the filename of the current backgroundimage. - - Example (for a TurtleScreen instance named screen): - >>> screen.bgpic() - 'nopic' - >>> screen.bgpic("landscape.gif") - >>> screen.bgpic() - 'landscape.gif' - - - .. method:: clear() - .. method:: clearscreen() - Delete all drawings and all turtles from the TurtleScreen. - Reset empty TurtleScreen to it's initial state: white background, - no backgroundimage, no eventbindings and tracing on. - - Example (for a TurtleScreen instance named screen): - screen.clear() - - *Note*: this method is only available as the function named - clearscreen(). (The function clear() is another one derived from - the Turtle-method clear()!). - - - .. method:: reset() - .. method:: resetscreen() - Reset all Turtles on the Screen to their initial state. - - Example (for a TurtleScreen instance named screen): - >>> screen.reset() - - *Note*: this method is pnly available as the function named - resetscreen(). (The function reset() is another one derived from - the Turtle-method reset()!). - - - .. method:: screensize(canvwidth=None, canvheight=None, bg=None): - canvwidth -- positive integer, new width of canvas in pixels - canvheight -- positive integer, new height of canvas in pixels - bg -- colorstring or color-tupel, new backgroundcolor - - If no arguments are given, return current (canvaswidth, canvasheight) - Resize the canvas, the turtles are drawing on. - Do not alter the drawing window. To observe hidden parts of - the canvas use the scrollbars. (So one can make visible those - parts of a drawing, which were outside the canvas before!) - - Example (for a Turtle instance named turtle): - >>> turtle.screensize(2000,1500) - ### e. g. to search for an erroneously escaped turtle ;-) - - - .. method:: setworldcoordinates(llx, lly, urx, ury): - llx -- a number, x-coordinate of lower left corner of canvas - lly -- a number, y-coordinate of lower left corner of canvas - urx -- a number, x-coordinate of upper right corner of canvas - ury -- a number, y-coordinate of upper right corner of canvas - - Set up user coodinate-system and switch to mode 'world' if necessary. - This performs a screen.reset. If mode 'world' is already active, - all drawings are redrawn according to the new coordinates. - - But *ATTENTION*: in user-defined coordinatesystems angles may appear - distorted. (see Screen.mode()) - - Example (for a TurtleScreen instance named screen): - >>> screen.reset() - >>> screen.setworldcoordinates(-50,-7.5,50,7.5) - >>> for _ in range(72): - ... left(10) - ... - >>> for _ in range(8): - ... left(45); fd(2) # a regular octogon - - -ANIMATION CONTROL + Delete all drawings and all turtles from the TurtleScreen. Reset the now + empty TurtleScreen to its initial state: white background, no background + image, no event bindings and tracing on. + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``clearscreen``. The global function ``clear`` is another one + derived from the Turtle method ``clear``. + + +.. function:: reset() + resetscreen() + + Reset all Turtles on the Screen to their initial state. + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``resetscreen``. The global function ``reset`` is another one + derived from the Turtle method ``reset``. + + +.. function:: screensize(canvwidth=None, canvheight=None, bg=None) + + :param canvwidth: positive integer, new width of canvas in pixels + :param canvheight: positive integer, new height of canvas in pixels + :param bg: colorstring or color-tupel, new background color + + If no arguments are given, return current (canvaswidth, canvasheight). Else + resize the canvas the turtles are drawing on. Do not alter the drawing + window. To observe hidden parts of the canvas, use the scrollbars. With this + method, one can make visible those parts of a drawing which were outside the + canvas before. + + >>> turtle.screensize(2000,1500) + # e.g. to search for an erroneously escaped turtle ;-) + + +.. function:: setworldcoordinates(llx, lly, urx, ury) + + :param llx: a number, x-coordinate of lower left corner of canvas + :param lly: a number, y-coordinate of lower left corner of canvas + :param urx: a number, x-coordinate of upper right corner of canvas + :param ury: a number, y-coordinate of upper right corner of canvas + + Set up user-defined coordinate system and switch to mode "world" if + necessary. This performs a ``screen.reset()``. If mode "world" is already + active, all drawings are redrawn according to the new coordinates. + + **ATTENTION**: in user-defined coordinate systems angles may appear + distorted. + + >>> screen.reset() + >>> screen.setworldcoordinates(-50,-7.5,50,7.5) + >>> for _ in range(72): + ... left(10) + ... + >>> for _ in range(8): + ... left(45); fd(2) # a regular octogon + + +Animation control ----------------- +.. function:: delay(delay=None) - .. method:: delay(delay=None): - delay -- positive integer - - Set or return the drawing delay in milliseconds. (This is sort of - time interval between two consecutived canvas updates.) The longer - the drawing delay, the slower the animation. - - Optional argument: - Example (for a TurtleScreen instance named screen):: - - >>> screen.delay(15) - >>> screen.delay() - 15 - - - .. method:: tracer(n=None, delay=None): - n -- nonnegative integer - delay -- nonnegative integer - - Turn turtle animation on/off and set delay for update drawings. - If n is given, only each n-th regular screen update is really performed. - (Can be used to accelerate the drawing of complex graphics.) - Second argument sets delay value (see delay()) - - Example (for a TurtleScreen instance named screen): - >>> screen.tracer(8, 25) - >>> dist = 2 - >>> for i in range(200): - ... fd(dist) - ... rt(90) - ... dist += 2 - - - .. method:: update(): - Perform a TurtleScreen update. To be used, when tracer is turned - off. - - See also RawTurtle/Turtle - method speed() - + :param delay: positive integer + + Set or return the drawing *delay* in milliseconds. (This is approximately + the time interval between two consecutived canvas updates.) The longer the + drawing delay, the slower the animation. + + Optional argument: + + >>> screen.delay(15) + >>> screen.delay() + 15 + + +.. function:: tracer(n=None, delay=None) + + :param n: nonnegative integer + :param delay: nonnegative integer + + Turn turtle animation on/off and set delay for update drawings. If *n* is + given, only each n-th regular screen update is really performed. (Can be + used to accelerate the drawing of complex graphics.) Second argument sets + delay value (see :func:`delay`). + + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + ... fd(dist) + ... rt(90) + ... dist += 2 + + +.. function:: update() -USING SCREEN EVENTS + Perform a TurtleScreen update. To be used when tracer is turned off. + +See also the RawTurtle/Turtle method :func:`speed`. + + +Using screen events ------------------- +.. function:: listen(xdummy=None, ydummy=None) + + Set focus on TurtleScreen (in order to collect key-events). Dummy arguments + are provided in order to be able to pass :func:`listen` to the onclick method. + + +.. function:: onkey(fun, key) + + :param fun: a function with no arguments or ``None`` + :param key: a string: key (e.g. "a") or key-symbol (e.g. "space") + + Bind *fun* to key-release event of key. If *fun* is ``None``, event bindings + are removed. Remark: in order to be able to register key-events, TurtleScreen + must have the focus. (See method :func:`listen`.) + + >>> def f(): + ... fd(50) + ... lt(60) + ... + >>> screen.onkey(f, "Up") + >>> screen.listen() + + +.. function:: onclick(fun, btn=1, add=None) + onscreenclick(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, + existing bindings are removed. + + Example for a TurtleScreen instance named ``screen`` and a Turtle instance + named turtle: + + >>> screen.onclick(turtle.goto) + # Subsequently clicking into the TurtleScreen will + # make the turtle move to the clicked point. + >>> screen.onclick(None) # remove event binding again + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``onscreenclick``. The global function ``onclick`` is another one + derived from the Turtle method ``onclick``. + + +.. function:: ontimer(fun, t=0) + + :param fun: a function with no arguments + :param t: a number >= 0 + + Install a timer that calls *fun* after *t* milliseconds. + + >>> running = True + >>> def f(): + if running: + fd(50) + lt(60) + screen.ontimer(f, 250) + >>> f() ### makes the turtle marching around + >>> running = False + + +Settings and special methods +---------------------------- + +.. function:: mode(mode=None) + + :param mode: one of the strings "standard", "logo" or "world" + + Set turtle mode ("standard", "logo" or "world") and perform reset. If mode + is not given, current mode is returned. + + Mode "standard" is compatible with old :mod:`turtle`. Mode "logo" is + compatible with most Logo turtle graphics. Mode "world" uses user-defined + "world coordinates". **Attention**: in this mode angles appear distorted if + ``x/y`` unit-ratio doesn't equal 1. + + ============ ========================= =================== + Mode Initial turtle heading positive angles + ============ ========================= =================== + "standard" to the right (east) counterclockwise + "logo" upward (north) clockwise + ============ ========================= =================== + + >>> mode("logo") # resets turtle heading to north + >>> mode() + "logo" + + +.. function:: colormode(cmode=None) + + :param cmode: one of the values 1.0 or 255 + + Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* + values of color triples have to be in the range 0..\ *cmode*. + + >>> screen.colormode() + 1.0 + >>> screen.colormode(255) + >>> turtle.pencolor(240,160,80) + + +.. function:: getcanvas() + + Return the Canvas of this TurtleScreen. Useful for insiders who know what to + do with a Tkinter Canvas. + + >>> cv = screen.getcanvas() + >>> cv + + + +.. function:: getshapes() + + Return a list of names of all currently available turtle shapes. + + >>> screen.getshapes() + ["arrow", "blank", "circle", ..., "turtle"] + + +.. function:: register_shape(name, shape=None) + addshape(name, shape=None) + + There are three different ways to call this function: + + (1) *name* is the name of a gif-file and *shape* is ``None``: Install the + corresponding image shape. + + .. note:: + Image shapes *do not* rotate when turning the turtle, so they do not + display the heading of the turtle! + + (2) *name* is an arbitrary string and *shape* is a tuple of pairs of + coordinates: Install the corresponding polygon shape. + + (3) *name* is an arbitrary string and shape is a (compound) :class:`Shape` + object: Install the corresponding compound shape. + + Add a turtle shape to TurtleScreen's shapelist. Only thusly registered + shapes can be used by issuing the command ``shape(shapename)``. + + >>> screen.register_shape("turtle.gif") + >>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3))) + + +.. function:: turtles() + + Return the list of turtles on the screen. + + >>> for turtle in screen.turtles() + ... turtle.color("red") + + +.. function:: window_height() + + Return the height of the turtle window. + + >>> screen.window_height() + 480 + + +.. function:: window_width() + + Return the width of the turtle window. - .. method:: listen(xdummy=None, ydummy=None): - """Set focus on TurtleScreen (in order to collect key-events) - Dummy arguments are provided in order to be able to pass listen - to the onclick method. - - Example (for a TurtleScreen instance named screen): - >>> screen.listen() - - - .. method:: onkey(fun, key): - fun -- a function with no arguments or None - key -- a string: key (e.g. "a") or key-symbol (e.g. "space") - - Bind fun to key-release event of key. If fun is None, event-bindings - are removed. - Remark: in order to be able to register key-events, TurtleScreen - must have focus. (See method listen.) - - Example (for a TurtleScreen instance named screen - and a Turtle instance named turtle):: - - >>> def f(): - ... fd(50) - ... lt(60) - ... - >>> screen.onkey(f, "Up") - >>> screen.listen() - - - .. method:: onclick(fun, btn=1, add=None): - .. method:: onscreenclick(fun, btn=1, add=None): - fun -- a function with two arguments, to which will be assigned - the coordinates of the clicked point on the canvas - or None. - num -- number of the mouse-button defaults to 1 (left mouse button). - add -- True or False. If True, new binding will be added, otherwise - it will replace a former binding. - - Example (for a TurtleScreen instance named screen and a Turtle instance - named turtle):: - - >>> screen.onclick(turtle.goto) - ### Subsequently clicking into the TurtleScreen will - ### make the turtle move to the clicked point. - >>> screen.onclick(None) - - ### event-binding will be removed - - *Note*: this method is only available as the function named - onscreenclick(). (The function onclick() is a different one derived - from the Turtle-method onclick()!). - - - .. method:: ontimer(fun, t=0): - fun -- a function with no arguments. - t -- a number >= 0 - - Install a timer, which calls fun after t milliseconds. - - Example (for a TurtleScreen instance named screen): - - >>> running = True - >>> def f(): - if running: - fd(50) - lt(60) - screen.ontimer(f, 250) - >>> f() ### makes the turtle marching around - >>> running = False - - -SETTINGS AND SPECIAL METHODS - - - .. method:: mode(mode=None): - mode -- on of the strings 'standard', 'logo' or 'world' - - Set turtle-mode ('standard', 'logo' or 'world') and perform reset. - If mode is not given, current mode is returned. - - Mode 'standard' is compatible with old turtle.py. - Mode 'logo' is compatible with most Logo-Turtle-Graphics. - Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in - this mode angles appear distorted if x/y unit-ratio doesn't equal 1. - - ============ ========================= =================== - Mode Initial turtle heading positive angles - ============ ========================= =================== - 'standard' to the right (east) counterclockwise - 'logo' upward (north) clockwise - ============ ========================= =================== - - Examples:: - >>> mode('logo') # resets turtle heading to north - >>> mode() - 'logo' - - - .. method:: colormode(cmode=None): - cmode -- one of the values 1.0 or 255 - - """Return the colormode or set it to 1.0 or 255. - Subsequently r, g, b values of colortriples have to be in - range 0..cmode. - - Example (for a TurtleScreen instance named screen): - >>> screen.colormode() - 1.0 - >>> screen.colormode(255) - >>> turtle.pencolor(240,160,80) - - - .. method:: getcanvas(): - Return the Canvas of this TurtleScreen. Useful for insiders, who - know what to do with a Tkinter-Canvas ;-) - - Example (for a Screen instance named screen): - >>> cv = screen.getcanvas() - >>> cv - - - - .. method:: getshapes(): - """Return a list of names of all currently available turtle shapes. - - Example (for a TurtleScreen instance named screen): - >>> screen.getshapes() - ['arrow', 'blank', 'circle', ... , 'turtle'] - - - .. method:: register_shape(name, shape=None) - .. method:: addshape(name, shape=None) - Arguments: - (1) name is the name of a gif-file and shape is None. - Installs the corresponding image shape. - !! Image-shapes DO NOT rotate when turning the turtle, - !! so they do not display the heading of the turtle! - (2) name is an arbitrary string and shape is a tuple - of pairs of coordinates. Installs the corresponding - polygon shape - (3) name is an arbitrary string and shape is a - (compound) Shape object. Installs the corresponding - compound shape. (See class Shape.) - - Adds a turtle shape to TurtleScreen's shapelist. Only thusly - registered shapes can be used by issueing the command shape(shapename). - - call: register_shape("turtle.gif") - --or: register_shape("tri", ((0,0), (10,10), (-10,10))) - - Example (for a TurtleScreen instance named screen): - >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3))) - - - .. method:: turtles(): - Return the list of turtles on the screen. - - Example (for a TurtleScreen instance named screen): - >>> for turtle in screen.turtles() - ... turtle.color("red") - - - .. method:: window_height(): - Return the height of the turtle window. - - Example (for a TurtleScreen instance named screen): - >>> screen.window_height() - 480 - - - .. method:: window_width(): - Return the width of the turtle window. - - Example (for a TurtleScreen instance named screen): - >>> screen.window_width() - 640 - + >>> screen.window_width() + 640 -METHODS SPECIFIC TO Screen, not inherited from TurtleScreen + +.. _screenspecific: + +Methods specific to Screen, not inherited from TurtleScreen ----------------------------------------------------------- +.. function:: bye() - .. method:: bye(): - """Shut the turtlegraphics window. + Shut the turtlegraphics window. - This is a method of the Screen-class and not available for - TurtleScreen instances. - Example (for a TurtleScreen instance named screen): - >>> screen.bye() +.. function:: exitonclick() + Bind bye() method to mouse clicks on the Screen. - .. method:: exitonclick(): - Bind bye() method to mouseclick on TurtleScreen. - If "using_IDLE" - value in configuration dictionary is False - (default value), enter mainloop. - Remark: If IDLE with -n switch (no subprocess) is used, this value - should be set to True in turtle.cfg. In this case IDLE's own mainloop - is active also for the client script. - This is a method of the Screen-class and not available for - TurtleScreen instances. + If the value "using_IDLE" in the configuration dictionary is ``False`` + (default value), also enter mainloop. Remark: If IDLE with the ``-n`` switch + (no subprocess) is used, this value should be set to ``True`` in + :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the + client script. - Example (for a Screen instance named screen): - >>> screen.exitonclick() +.. function:: setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]) - .. method:: setup(width=_CFG["width"], height=_CFG["height"], - startx=_CFG["leftright"], starty=_CFG["topbottom"]): - Set the size and position of the main window. - Default values of arguments are stored in the configuration dicionary - and can be changed via a turtle.cfg file. - - width -- as integer a size in pixels, as float a fraction of the screen. - Default is 50% of screen. - height -- as integer the height in pixels, as float a fraction of the - screen. Default is 75% of screen. - startx -- if positive, starting position in pixels from the left - edge of the screen, if negative from the right edge - Default, startx=None is to center window horizontally. - starty -- if positive, starting position in pixels from the top - edge of the screen, if negative from the bottom edge - Default, starty=None is to center window vertically. + Set the size and position of the main window. Default values of arguments + are stored in the configuration dicionary and can be changed via a + :file:`turtle.cfg` file. - Examples (for a Screen instance named screen):: - >>> screen.setup (width=200, height=200, startx=0, starty=0) - # sets window to 200x200 pixels, in upper left of screen + :param width: if an integer, a size in pixels, if a float, a fraction of the + screen; default is 50% of screen + :param height: if an integer, the height in pixels, if a float, a fraction of + the screen; default is 75% of screen + :param startx: if positive, starting position in pixels from the left + edge of the screen, if negative from the right edge, if None, + center window horizontally + :param startx: if positive, starting position in pixels from the top + edge of the screen, if negative from the bottom edge, if None, + center window vertically - >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) - # sets window to 75% of screen by 50% of screen and centers + >>> screen.setup (width=200, height=200, startx=0, starty=0) + # sets window to 200x200 pixels, in upper left of screen + >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) + # sets window to 75% of screen by 50% of screen and centers - - .. method:: title(titlestring): - titlestring -- a string, to appear in the titlebar of the - turtle graphics window. - Set title of turtle-window to titlestring +.. function:: title(titlestring) - This is a method of the Screen-class and not available for - TurtleScreen instances. + :param titlestring: a string that is shown in the titlebar of the turtle + graphics window - Example (for a Screen instance named screen): - >>> screen.title("Welcome to the turtle-zoo!") + Set title of turtle window to *titlestring*. + >>> screen.title("Welcome to the turtle zoo!") -4. THE PUBLIC CLASSES of the module turtle.py -============================================= +The public classes of the module :mod:`turtle` +============================================== -class RawTurtle(canvas): - canvas -- a Tkinter-Canvas, a ScrolledCanvas or a TurtleScreen - - Alias: RawPen - - Define a turtle. - A description of the methods follows below. All methods are also - available as functions (to control some anonymous turtle) thus - providing a procedural interface to turtlegraphics - -class Turtle() - Subclass of RawTurtle, has the same interface with the additional - property, that Turtle instances draw on a default Screen object, - which is created automatically, when needed for the first time. - -class TurtleScreen(cv) - cv -- a Tkinter-Canvas - Provides screen oriented methods like setbg etc. - A description of the methods follows below. - -class Screen() - Subclass of TurtleScreen, with four methods added. - All methods are also available as functions to conrtol a unique - Screen instance thus belonging to the procedural interface - to turtlegraphics. This Screen instance is automatically created - when needed for the first time. - -class ScrolledCavas(master) - master -- some Tkinter widget to contain the ScrolledCanvas, i.e. - a Tkinter-canvas with scrollbars added. - Used by class Screen, which thus provides automatically a - ScrolledCanvas as playground for the turtles. +.. class:: RawTurtle(canvas) + RawPen(canvas) -class Shape(type\_, data) - type --- one of the strings "polygon", "image", "compound" + :param canvas: a :class:`Tkinter.Canvas`, a :class:`ScrolledCanvas` or a + :class:`TurtleScreen` - Data structure modeling shapes. - The pair type\_, data must be as follows: - - type\_ data + Create a turtle. The turtle has all methods described above as "methods of + Turtle/RawTurtle". - "polygon" a polygon-tuple, i. e. - a tuple of pairs of coordinates - - "image" an image (in this form only used internally!) - - "compound" None - A compund shape has to be constructed using - the addcomponent method - - addcomponent(self, poly, fill, outline=None) - poly -- polygon, i. e. a tuple of pairs of numbers. - fill -- the fillcolor of the component, - outline -- the outline color of the component. - - Example: - >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) - >>> s = Shape("compound") - >>> s.addcomponent(poly, "red", "blue") - ### .. add more components and then use register_shape() - - See EXCURSUS ABOUT THE USE OF COMPOUND SHAPES - - -class Vec2D(x, y): - A two-dimensional vector class, used as a helper class - for implementing turtle graphics. - May be useful for turtle graphics programs also. - Derived from tuple, so a vector is a tuple! - - Provides (for a, b vectors, k number): - - * a+b vector addition - * a-b vector subtraction - * a*b inner product - * k*a and a*k multiplication with scalar - * \|a\| absolute value of a - * a.rotate(angle) rotation +.. class:: Turtle() - -V. HELP AND CONFIGURATION -========================= + Subclass of RawTurtle, has the same interface but draws on a default + :class:`Screen` object created automatically when needed for the first time. + + +.. class:: TurtleScreen(cv) + + :param cv: a :class:`Tkinter.Canvas` -This section contains subsections on: + Provides screen oriented methods like :func:`setbg` etc. that are described + above. + +.. class:: Screen() + + Subclass of TurtleScreen, with :ref:`four methods added `. + + +.. class:: ScrolledCavas(master) -- how to use help -- how to prepare and use translations of the online-help - into other languages -- how to configure the appearance of the graphics window and - the turtles at startup + :param master: some Tkinter widget to contain the ScrolledCanvas, i.e. + a Tkinter-canvas with scrollbars added + Used by class Screen, which thus automatically provides a ScrolledCanvas as + playground for the turtles. -HOW TO USE HELP: ----------------- +.. class:: Shape(type_, data) -The public methods of the Screen and Turtle classes are documented -extensively via docstrings. So these can be used as online-help -via the Python help facilities: + :param type\_: one of the strings "polygon", "image", "compound" -- When using IDLE, tooltips show the signatures and first lines of - the docstrings of typed in function-/method calls. + Data structure modeling shapes. The pair ``(type_, data)`` must follow this + specification: -- calling help on methods or functions display the docstrings. - Examples:: - - >>> help(Screen.bgcolor) - Help on method bgcolor in module turtle: + + =========== =========== + *type_* *data* + =========== =========== + "polygon" a polygon-tuple, i.e. a tuple of pairs of coordinates + "image" an image (in this form only used internally!) + "compound" ``None`` (a compund shape has to be constructed using the + :meth:`addcomponent` method) + =========== =========== + + .. method:: addcomponent(poly, fill, outline=None) + + :param poly: a polygon, i.e. a tuple of pairs of numbers + :param fill: a color the *poly* will be filled with + :param outline: a color for the poly's outline (if given) + + Example: + + >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s = Shape("compound") + >>> s.addcomponent(poly, "red", "blue") + # .. add more components and then use register_shape() + + See :ref:`compoundshapes`. + + +.. class:: Vec2D(x, y) + + A two-dimensional vector class, used as a helper class for implementing + turtle graphics. May be useful for turtle graphics programs too. Derived + from tuple, so a vector is a tuple! + + Provides (for *a*, *b* vectors, *k* number): + + * ``a + b`` vector addition + * ``a - b`` vector subtraction + * ``a * b`` inner product + * ``k * a`` and ``a * k`` multiplication with scalar + * ``abs(a)`` absolute value of a + * ``a.rotate(angle)`` rotation + + +Help and configuration +====================== + +How to use help +--------------- + +The public methods of the Screen and Turtle classes are documented extensively +via docstrings. So these can be used as online-help via the Python help +facilities: + +- When using IDLE, tooltips show the signatures and first lines of the + docstrings of typed in function-/method calls. + +- Calling :func:`help` on methods or functions displays the docstrings:: + + >>> help(Screen.bgcolor) + Help on method bgcolor in module turtle: + + bgcolor(self, *args) unbound turtle.Screen method + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + "orange" + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + "#800080" - bgcolor(self, *args) unbound turtle.Screen method - Set or return backgroundcolor of the TurtleScreen. - - Arguments (if given): a color string or three numbers - in the range 0..colormode or a 3-tuple of such numbers. - - Example (for a TurtleScreen instance named screen):: + >>> help(Turtle.penup) + Help on method penup in module turtle: - >>> screen.bgcolor("orange") - >>> screen.bgcolor() - 'orange' - >>> screen.bgcolor(0.5,0,0.5) - >>> screen.bgcolor() - '#800080' + penup(self) unbound turtle.Turtle method + Pull the pen up -- no drawing when moving. - >>> help(Turtle.penup) - Help on method penup in module turtle: + Aliases: penup | pu | up - penup(self) unbound turtle.Turtle method - Pull the pen up -- no drawing when moving. - - Aliases: penup | pu | up - - No argument - - Example (for a Turtle instance named turtle): - >>> turtle.penup() + No argument + + >>> turtle.penup() -The docstrings of the functions which are derived from methods have -a modified form:: +- The docstrings of the functions which are derived from methods have a modified + form:: - >>> help(bgcolor) - Help on function bgcolor in module turtle: + >>> help(bgcolor) + Help on function bgcolor in module turtle: + + bgcolor(*args) + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example:: - bgcolor(*args) - Set or return backgroundcolor of the TurtleScreen. - - Arguments (if given): a color string or three numbers - in the range 0..colormode or a 3-tuple of such numbers. - - Example:: + >>> bgcolor("orange") + >>> bgcolor() + "orange" + >>> bgcolor(0.5,0,0.5) + >>> bgcolor() + "#800080" - >>> bgcolor("orange") - >>> bgcolor() - 'orange' - >>> bgcolor(0.5,0,0.5) - >>> bgcolor() - '#800080' + >>> help(penup) + Help on function penup in module turtle: - >>> help(penup) - Help on function penup in module turtle: + penup() + Pull the pen up -- no drawing when moving. - penup() - Pull the pen up -- no drawing when moving. - - Aliases: penup | pu | up - - No argument - - Example: - >>> penup() + Aliases: penup | pu | up + + No argument + + Example: + >>> penup() -These modified docstrings are created automatically together with the -function definitions that are derived from the methods at import time. +These modified docstrings are created automatically together with the function +definitions that are derived from the methods at import time. -TRANSLATION OF DOCSTRINGS INTO DIFFERENT LANGUAGES +Translation of docstrings into different languages -------------------------------------------------- -There is a utility to create a dictionary the keys of which are the -method names and the values of which are the docstrings of the public -methods of the classes Screen and Turtle. - -write_docstringdict(filename="turtle_docstringdict"): - filename -- a string, used as filename - - Create and write docstring-dictionary to a Python script - with the given filename. - This function has to be called explicitely, (it is not used by the - turtle-graphics classes). The docstring dictionary will be written - to the Python script .py It is intended to serve as a - template for translation of the docstrings into different languages. - -If you (or your students) want to use turtle.py with online help in -your native language. You have to translate the docstrings and save -the resulting file as e.g. turtle_docstringdict_german.py - -If you have an appropriate entry in your turtle.cfg file this dictionary -will be read in at import time and will replace the original English -docstrings. - -At the time of this writing there exist docstring_dicts in German -and in Italian. (Requests please to glingl at aon.at) - - - -HOW TO CONFIGURE SCREEN AND TURTLES +There is a utility to create a dictionary the keys of which are the method names +and the values of which are the docstrings of the public methods of the classes +Screen and Turtle. + +.. function:: write_docstringdict(filename="turtle_docstringdict") + + :param filename: a string, used as filename + + Create and write docstring-dictionary to a Python script with the given + filename. This function has to be called explicitly (it is not used by the + turtle graphics classes). The docstring dictionary will be written to the + Python script :file:`{filename}.py`. It is intended to serve as a template + for translation of the docstrings into different languages. + +If you (or your students) want to use :mod:`turtle` with online help in your +native language, you have to translate the docstrings and save the resulting +file as e.g. :file:`turtle_docstringdict_german.py`. + +If you have an appropriate entry in your :file:`turtle.cfg` file this dictionary +will be read in at import time and will replace the original English docstrings. + +At the time of this writing there are docstring dictionaries in German and in +Italian. (Requests please to glingl at aon.at.) + + + +How to configure Screen and Turtles ----------------------------------- -The built-in default configuration mimics the appearance and -behaviour of the old turtle module in order to retain best possible -compatibility with it. - -If you want to use a different configuration which reflects -better the features of this module or which fits better to -your needs, e. g. for use in a classroom, you can prepare -a configuration file turtle.cfg which will be read at import -time and modify the configuration according to it's settings. - -The built in configuration would correspond to the following -turtle.cfg: - -width = 0.5 -height = 0.75 -leftright = None -topbottom = None -canvwidth = 400 -canvheight = 300 -mode = standard -colormode = 1.0 -delay = 10 -undobuffersize = 1000 -shape = classic -pencolor = black -fillcolor = black -resizemode = noresize -visible = True -language = english -exampleturtle = turtle -examplescreen = screen -title = Python Turtle Graphics -using_IDLE = False +The built-in default configuration mimics the appearance and behaviour of the +old turtle module in order to retain best possible compatibility with it. + +If you want to use a different configuration which better reflects the features +of this module or which better fits to your needs, e.g. for use in a classroom, +you can prepare a configuration file ``turtle.cfg`` which will be read at import +time and modify the configuration according to its settings. + +The built in configuration would correspond to the following turtle.cfg:: + + width = 0.5 + height = 0.75 + leftright = None + topbottom = None + canvwidth = 400 + canvheight = 300 + mode = standard + colormode = 1.0 + delay = 10 + undobuffersize = 1000 + shape = classic + pencolor = black + fillcolor = black + resizemode = noresize + visible = True + language = english + exampleturtle = turtle + examplescreen = screen + title = Python Turtle Graphics + using_IDLE = False Short explanation of selected entries: -- The first four lines correspond to the arguments of the - Screen.setup method -- Line 5 and 6 correspond to the arguments of the Method - Screen.screensize -- shape can be any of the built-in shapes, e.g: arrow, turtle, - etc. For more info try help(shape) -- if you want to use no fillcolor (i. e. turtle transparent), - you have to write: - fillcolor = "" - (All not empty strings must not have quotes in the cfg-file!) -- if you want to reflect the turtle its state, you have to use - resizemode = auto -- if you set, e. g.: language = italian - the docstringdict turtle_docstringdict_italian.py will be - loaded at import time (if present on the import path, e.g. in - the same directory as turtle.py -- the entries exampleturtle and examplescreen define the names - of these objects as they occur in the docstrings. The - transformation of method-docstrings to function-docstrings - will delete these names from the docstrings. (See examples in - section on HELP) -- using_IDLE Set this to True if you regularly work with IDLE - and it's -n - switch. ("No subprocess") This will prevent - exitonclick to enter the mainloop. - -There can be a turtle.cfg file in the directory where turtle.py -is stored and an additional one in the currentworkingdirectory. -The latter will override the settings of the first one. - -The turtledemo directory contains a turtle.cfg file. If you -study it as an example and see its effects when running the -demos (preferably not from within the demo-viewer). - - -VI. Demo scripts -================ - -There is a set of demo scripts in the turtledemo directory -located here ... +- The first four lines correspond to the arguments of the :meth:`Screen.setup` + method. +- Line 5 and 6 correspond to the arguments of the method + :meth:`Screen.screensize`. +- *shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For more + info try ``help(shape)``. +- If you want to use no fillcolor (i.e. make the turtle transparent), you have + to write ``fillcolor = ""`` (but all nonempty strings must not have quotes in + the cfg-file). +- If you want to reflect the turtle its state, you have to use ``resizemode = + auto``. +- If you set e.g. ``language = italian`` the docstringdict + :file:`turtle_docstringdict_italian.py` will be loaded at import time (if + present on the import path, e.g. in the same directory as :mod:`turtle`. +- The entries *exampleturtle* and *examplescreen* define the names of these + objects as they occur in the docstrings. The transformation of + method-docstrings to function-docstrings will delete these names from the + docstrings. +- *using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its -n + switch ("no subprocess"). This will prevent :func:`exitonclick` to enter the + mainloop. + +There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` is +stored and an additional one in the current working directory. The latter will +override the settings of the first one. + +The :file:`Demo/turtle` directory contains a :file:`turtle.cfg` file. You can +study it as an example and see its effects when running the demos (preferably +not from within the demo-viewer). + + +Demo scripts +============ + +There is a set of demo scripts in the turtledemo directory located in the +:file:`Demo/turtle` directory in the source distribution. - ##### please complete info about path ######################## - It contains: -- a set of 15 demo scripts demonstrating differet features - of the new module turtle.py -- a Demo-Viewer turtleDemo.py which can be used to view - the sourcecode of the scripts and run them at the same time - 14 of the examples can be accessed via the Examples Menu. - All of them can also be run standalone. -- The example turtledemo_two_canvases.py demonstrates the - simultaneous use of two canvases with the turtle module. - Therefor it only can be run standalone. -- There is a turtle.cfg file in this directory, which also - serves as an example for how to write and use such files. - +- a set of 15 demo scripts demonstrating differet features of the new module + :mod:`turtle` +- a demo viewer :file:`turtleDemo.py` which can be used to view the sourcecode + of the scripts and run them at the same time. 14 of the examples can be + accessed via the Examples menu; all of them can also be run standalone. +- The example :file:`turtledemo_two_canvases.py` demonstrates the simultaneous + use of two canvases with the turtle module. Therefore it only can be run + standalone. +- There is a :file:`turtle.cfg` file in this directory, which also serves as an + example for how to write and use such files. + The demoscripts are: +----------------+------------------------------+-----------------------+ -|Name | description | features | +| Name | Description | Features | +----------------+------------------------------+-----------------------+ -|bytedesign | complex classical | tracer, delay | -| | turtlegraphics pattern | update | +| bytedesign | complex classical | :func:`tracer`, delay,| +| | turtlegraphics pattern | :func:`update` | +----------------+------------------------------+-----------------------+ -|chaos | graphs verhust dynamics, | worldcoordinates | -| | proofs that you must not | | -| | trust computers computations| | +| chaos | graphs verhust dynamics, | world coordinates | +| | proves that you must not | | +| | trust computers' computations| | +----------------+------------------------------+-----------------------+ -|clock | analog clock showing time | turtles as clock's | -| | of your computer | hands, ontimer | +| clock | analog clock showing time | turtles as clock's | +| | of your computer | hands, ontimer | +----------------+------------------------------+-----------------------+ -|colormixer | experiment with r, g, b | ondrag | +| colormixer | experiment with r, g, b | :func:`ondrag` | +----------------+------------------------------+-----------------------+ -|fractalcurves | Hilbert & Koch | recursion | +| fractalcurves | Hilbert & Koch curves | recursion | +----------------+------------------------------+-----------------------+ -|lindenmayer | ethnomathematics | L-System | -| | (indian kolams) | | +| lindenmayer | ethnomathematics | L-System | +| | (indian kolams) | | +----------------+------------------------------+-----------------------+ -|minimal_hanoi | Towers of Hanoi | Rectangular Turtles | -| | | as Hanoi-Discs | -| | | (shape, shapesize) | +| minimal_hanoi | Towers of Hanoi | Rectangular Turtles | +| | | as Hanoi discs | +| | | (shape, shapesize) | +----------------+------------------------------+-----------------------+ -|paint | super minimalistic | onclick | -| | drawing program | | +| paint | super minimalistic | :func:`onclick` | +| | drawing program | | +----------------+------------------------------+-----------------------+ -|peace | elementary | turtle: appearance | -| | | and animation | +| peace | elementary | turtle: appearance | +| | | and animation | +----------------+------------------------------+-----------------------+ -|penrose | aperiodic tiling with | stamp | -| | kites and darts | | +| penrose | aperiodic tiling with | :func:`stamp` | +| | kites and darts | | +----------------+------------------------------+-----------------------+ -|planet_and_moon | simulation of | compound shape | -| | gravitational system | Vec2D | +| planet_and_moon| simulation of | compound shapes, | +| | gravitational system | :class:`Vec2D` | +----------------+------------------------------+-----------------------+ -|tree | a (graphical) breadth | clone | +| tree | a (graphical) breadth | :func:`clone` | | | first tree (using generators)| | +----------------+------------------------------+-----------------------+ -|wikipedia | a pattern from the wikipedia | clone, undo | -| | article on turtle-graphics | | +| wikipedia | a pattern from the wikipedia | :func:`clone`, | +| | article on turtle graphics | :func:`undo` | +----------------+------------------------------+-----------------------+ -|yingyang | another elementary example | circle | +| yingyang | another elementary example | :func:`circle` | +----------------+------------------------------+-----------------------+ -turtledemo_two-canvases: two distinct Tkinter-Canvases -are populated with turtles. Uses class RawTurtle. - - -Have fun! \ No newline at end of file +Have fun! From buildbot at python.org Wed Jun 4 13:55:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 11:55:51 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080604115551.7E4981E400F@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/582 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 13:57:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 11:57:49 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080604115750.1BB081E4011@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/79 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_compile test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 14:12:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 12:12:03 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20080604121203.DF8BD1E4012@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%203.0/builds/30 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 14:20:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 12:20:48 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080604122048.995FA1E4002@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/295 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_calendar test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 14:29:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 12:29:15 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080604122915.BB58E1E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1021 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 14:47:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 12:47:57 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080604124757.E8D6F1E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1063 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 15:13:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 13:13:42 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080604131343.118C01E4011@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/935 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 15:19:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 13:19:21 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080604131922.204111E4002@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/442 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 15:27:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 13:27:56 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080604132756.A34CC1E4002@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/81 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 15:43:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 13:43:52 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080604134412.3C2201E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/585 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 16:00:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 14:00:52 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080604140121.62CD01E401F@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1023 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 4 16:08:46 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 4 Jun 2008 16:08:46 +0200 (CEST) Subject: [Python-checkins] r63938 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py idlelib_ttk.diff Message-ID: <20080604140846.219831E4002@bag.python.org> Author: guilherme.polo Date: Wed Jun 4 16:08:45 2008 New Revision: 63938 Log: _dict_from_tcltuple converts 'integers' to integers now, when possible; Correction of paramaters' passage done at Lib/idlelib/dynOptionMenuWidget.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Wed Jun 4 16:08:45 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1" +__version__ = "0.1.1" __author__ = "Guilherme Polo " @@ -249,16 +249,19 @@ opt_start = 1 if cut_minus else 0 for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - - try: - if ' ' in val: # val could be the padding option - val = map(int, val.split()) - except (AttributeError, TypeError, ValueError): - # it is not a bool, neither a string and not even a tuple or list - pass - else: # but could be a statespec val - if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): - val = _list_from_statespec(val) + if isinstance(val, basestring): + try: + if ' ' in val: # could be the padding option + val = map(int, val.split()) + elif val.isdigit(): + val = int(val) + except (AttributeError, TypeError, ValueError): + # leave val untouched for now + pass + + elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): + # could be a statespec + val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) @@ -1357,11 +1360,11 @@ def set_menu(self, default=None, *values): """Build a new menu of radiobuttons with *values and optionally a default value.""" - menu = self._menu + menu = self['menu'] menu.delete(0, 'end') - for v in values: - menu.add_radiobutton(label=v, - command=Tkinter._setit(self._variable, v, self._callback)) + for val in values: + menu.add_radiobutton(label=val, + command=Tkinter._setit(self._variable, val, self._callback)) if default: self._variable.set(default) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Wed Jun 4 16:08:45 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1" +__version__ = "0.1.1" __author__ = "Guilherme Polo " @@ -249,16 +249,19 @@ opt_start = 1 if cut_minus else 0 for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - - try: - if ' ' in val: # val could be the padding option - val = list(map(int, val.split())) - except (AttributeError, TypeError, ValueError): - # it is not a bool, neither a string and not even a tuple or list - pass - else: # but could be a statespec val - if val and hasattr(val, "__len__") and hasattr(val[0], "typename"): - val = _list_from_statespec(val) + if isinstance(val, str): + try: + if ' ' in val: # could be the padding option + val = list(map(int, val.split())) + elif val.isdigit(): + val = int(val) + except (AttributeError, TypeError, ValueError): + # leave val untouched for now + pass + + elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): + # could be a statespec + val = _list_from_statespec(val) opts.append((str(opt)[opt_start:], val)) @@ -1359,9 +1362,9 @@ a default value.""" menu = self['menu'] menu.delete(0, 'end') - for v in values: - menu.add_radiobutton(label=v, - command=tkinter._setit(self._variable, v, self._callback)) + for val in values: + menu.add_radiobutton(label=val, + command=tkinter._setit(self._variable, val, self._callback)) if default: self._variable.set(default) Modified: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Wed Jun 4 16:08:45 2008 @@ -145,7 +145,7 @@ import macosxSupport +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import Scrollbar ++ from ttk import Scrollbar, Button, Radiobutton class Idb(bdb.Bdb): @@ -1662,7 +1662,7 @@ - for item in valueList: - self['menu'].add_command(label=item, + if TTK: -+ self.set_menu(valueList[0], *valueList[1:]) ++ self.set_menu(value, *valueList) + else: + menu = self['menu'] + menu.delete(0,'end') From python-checkins at python.org Wed Jun 4 16:15:03 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 4 Jun 2008 16:15:03 +0200 (CEST) Subject: [Python-checkins] r63939 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080604141503.223861E4003@bag.python.org> Author: guilherme.polo Date: Wed Jun 4 16:15:02 2008 New Revision: 63939 Log: AttributeError and TypeError aren't needed to be caught anymore at _dict_from_tcltuple, since it explicitely checks for string earlier. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Wed Jun 4 16:15:02 2008 @@ -255,8 +255,7 @@ val = map(int, val.split()) elif val.isdigit(): val = int(val) - except (AttributeError, TypeError, ValueError): - # leave val untouched for now + except ValueError: # leave val untouched for now pass elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Wed Jun 4 16:15:02 2008 @@ -255,8 +255,7 @@ val = list(map(int, val.split())) elif val.isdigit(): val = int(val) - except (AttributeError, TypeError, ValueError): - # leave val untouched for now + except ValueError: # leave val untouched for now pass elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): From buildbot at python.org Wed Jun 4 16:39:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 14:39:31 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080604143931.F01B81E404D@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/375 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys ====================================================================== FAIL: test_sys_flags (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_sys.py", line 330, in test_sys_flags self.assert_(hasattr(sys.flags, attr), attr) AssertionError: tabcheck make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 17:01:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 15:01:15 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080604150115.7BA961E4035@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1025 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_builtin make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 4 18:27:05 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 4 Jun 2008 18:27:05 +0200 (CEST) Subject: [Python-checkins] r63941 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080604162705.1D68D1E4010@bag.python.org> Author: guilherme.polo Date: Wed Jun 4 18:27:04 2008 New Revision: 63941 Log: Added support for Ttk Scale widget, which wasn't documented in Tk's site. Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Wed Jun 4 18:27:04 2008 @@ -41,10 +41,10 @@ from Tkinter import * from ttk import * -And then several :mod:`ttk` widgets (:class:`Button`, :class:`Entry`, -:class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, -:class:`PanedWindow`, :class:`Radiobutton` and :class:`Scrollbar`) will -automatically substitute the Tk widgets. +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. This has the direct benefit of using the new widgets which gives better look & feel across platforms, but you should be aware that they are not @@ -57,13 +57,13 @@ Ttk Widgets ----------- -Ttk comes with 16 widgets, where 10 of these already existed in Tkinter: +Ttk comes with 17 widgets, where 11 of these already existed in Tkinter: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, -:class:`Radiobutton` 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 subclass of -:class:`Widget`. +: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 +subclasses of :class:`Widget`. Like it was told before, you will notice changes in look & feel as well in the styling code. To demonstrate the latter, a very simple example is shown below. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Wed Jun 4 18:27:04 2008 @@ -16,10 +16,10 @@ __author__ = "Guilherme Polo " -__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", - "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", - "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", - "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", +__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label", + "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow", + "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", + "Separator", "Sizegrip", "Style", "Treeview", # Extensions "OptionMenu"] @@ -991,6 +991,24 @@ return self.tk.call(self._w, "invoke") +class Scale(Widget, Tkinter.Scale): + """Ttk Scale widget is typically used to control the numeric value of + a linked variable that varies uniformly over some range.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Scale with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + command, from, length, orient, to, value, variable + """ + Widget.__init__(self, master, "ttk::scale", kw) + + class Scrollbar(Widget, Tkinter.Scrollbar): """Ttk Scrollbar controls the viewport of a scrollable widget.""" Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Wed Jun 4 18:27:04 2008 @@ -16,10 +16,10 @@ __author__ = "Guilherme Polo " -__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", - "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", - "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", - "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", +__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label", + "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow", + "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", + "Separator", "Sizegrip", "Style", "Treeview", # Extensions "OptionMenu"] @@ -991,6 +991,24 @@ return self.tk.call(self._w, "invoke") +class Scale(Widget, tkinter.Scale): + """Ttk Scale widget is typically used to control the numeric value of + a linked variable that varies uniformly over some range.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Scale with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + command, from, length, orient, to, value, variable + """ + Widget.__init__(self, master, "ttk::scale", kw) + + class Scrollbar(Widget, tkinter.Scrollbar): """Ttk Scrollbar controls the viewport of a scrollable widget.""" From python-checkins at python.org Wed Jun 4 20:59:04 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 4 Jun 2008 20:59:04 +0200 (CEST) Subject: [Python-checkins] r63942 - in python/trunk: Lib/ctypes/__init__.py Lib/ctypes/test/test_errno.py Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Message-ID: <20080604185904.4008D1E4002@bag.python.org> Author: thomas.heller Date: Wed Jun 4 20:59:03 2008 New Revision: 63942 Log: Issue #1798: Add ctypes calling convention that allows safe access to errno (and LastError, on Windows). ctypes maintains a module-global, but thread-local, variable that contains an error number; called 'ctypes_errno' for this discussion. This variable is a private copy of the systems 'errno' value; the copy is swapped with the 'errno' variable on several occasions. Foreign functions created with CDLL(..., use_errno=True), when called, swap the values just before the actual function call, and swapped again immediately afterwards. The 'use_errno' parameter defaults to False, in this case 'ctypes_errno' is not touched. The values are also swapped immeditately before and after ctypes callback functions are called, if the callbacks are constructed using the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True). Two new ctypes functions are provided to access the 'ctypes_errno' value from Python: - ctypes.set_errno(value) sets ctypes_errno to 'value', the previous ctypes_errno value is returned. - ctypes.get_errno() returns the current ctypes_errno value. --- On Windows, the same scheme is implemented for the error value which is managed by the GetLastError() and SetLastError() windows api calls. The ctypes functions are 'ctypes.set_last_error(value)' and 'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is named 'use_last_error', defaults to False. --- On Windows, TlsSetValue and TlsGetValue calls are used to provide thread local storage for the variables; ctypes compiled with __GNUC__ uses __thread variables. Added: python/trunk/Lib/ctypes/test/test_errno.py (contents, props changed) Modified: python/trunk/Lib/ctypes/__init__.py python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callbacks.c python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/ctypes.h Modified: python/trunk/Lib/ctypes/__init__.py ============================================================================== --- python/trunk/Lib/ctypes/__init__.py (original) +++ python/trunk/Lib/ctypes/__init__.py Wed Jun 4 20:59:03 2008 @@ -33,7 +33,9 @@ DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ - FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI + FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \ + FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \ + FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR """ WINOLEAPI -> HRESULT @@ -73,8 +75,9 @@ return create_string_buffer(init, size) _c_functype_cache = {} -def CFUNCTYPE(restype, *argtypes): - """CFUNCTYPE(restype, *argtypes) -> function prototype. +def CFUNCTYPE(restype, *argtypes, **kw): + """CFUNCTYPE(restype, *argtypes, + use_errno=False, use_last_error=False) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types @@ -88,14 +91,21 @@ prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ + flags = _FUNCFLAG_CDECL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _c_functype_cache[(restype, argtypes)] + return _c_functype_cache[(restype, argtypes, flags)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_CDECL - _c_functype_cache[(restype, argtypes)] = CFunctionType + _flags_ = flags + _c_functype_cache[(restype, argtypes, flags)] = CFunctionType return CFunctionType if _os.name in ("nt", "ce"): @@ -106,16 +116,23 @@ _FUNCFLAG_STDCALL = _FUNCFLAG_CDECL _win_functype_cache = {} - def WINFUNCTYPE(restype, *argtypes): + def WINFUNCTYPE(restype, *argtypes, **kw): # docstring set later (very similar to CFUNCTYPE.__doc__) + flags = _FUNCFLAG_STDCALL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _win_functype_cache[(restype, argtypes)] + return _win_functype_cache[(restype, argtypes, flags)] except KeyError: class WinFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_STDCALL - _win_functype_cache[(restype, argtypes)] = WinFunctionType + _flags_ = flags + _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType return WinFunctionType if WINFUNCTYPE.__doc__: WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE") @@ -124,6 +141,7 @@ from _ctypes import dlopen as _dlopen from _ctypes import sizeof, byref, addressof, alignment, resize +from _ctypes import get_errno, set_errno from _ctypes import _SimpleCData def _check_size(typ, typecode=None): @@ -313,12 +331,24 @@ Calling the functions releases the Python GIL during the call and reacquires it afterwards. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL + _func_restype_ = c_int - def __init__(self, name, mode=DEFAULT_MODE, handle=None): + def __init__(self, name, mode=DEFAULT_MODE, handle=None, + use_errno=False, + use_last_error=False): self._name = name + flags = self._func_flags_ + if use_errno: + flags |= _FUNCFLAG_USE_ERRNO + if use_last_error: + flags |= _FUNCFLAG_USE_LASTERROR + + class _FuncPtr(_CFuncPtr): + _flags_ = flags + _restype_ = self._func_restype_ + self._FuncPtr = _FuncPtr + if handle is None: self._handle = _dlopen(self._name, mode) else: @@ -348,9 +378,7 @@ access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI if _os.name in ("nt", "ce"): @@ -358,9 +386,7 @@ """This class represents a dll exporting functions using the Windows stdcall calling convention. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_STDCALL # XXX Hm, what about HRESULT as normal parameter? # Mustn't it derive from c_long then? @@ -384,9 +410,8 @@ HRESULT error values are automatically raised as WindowsError exceptions. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = HRESULT + _func_flags_ = _FUNCFLAG_STDCALL + _func_restype_ = HRESULT class LibraryLoader(object): def __init__(self, dlltype): @@ -424,6 +449,7 @@ GetLastError = windll.kernel32.GetLastError else: GetLastError = windll.coredll.GetLastError + from _ctypes import get_last_error, set_last_error def WinError(code=None, descr=None): if code is None: Added: python/trunk/Lib/ctypes/test/test_errno.py ============================================================================== --- (empty file) +++ python/trunk/Lib/ctypes/test/test_errno.py Wed Jun 4 20:59:03 2008 @@ -0,0 +1,76 @@ +import unittest, os, errno +from ctypes import * +from ctypes.util import find_library +import threading + +class Test(unittest.TestCase): + def test_open(self): + libc_name = find_library("c") + if libc_name is not None: + libc = CDLL(libc_name, use_errno=True) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + + libc_open.argtypes = c_char_p, c_int + + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), errno.ENOENT) + + self.failUnlessEqual(set_errno(32), errno.ENOENT) + self.failUnlessEqual(get_errno(), 32) + + + def _worker(): + set_errno(0) + + libc = CDLL(libc_name, use_errno=False) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + libc_open.argtypes = c_char_p, c_int + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_errno(), 32) + set_errno(0) + + if os.name == "nt": + + def test_GetLastError(self): + dll = WinDLL("kernel32", use_last_error=True) + GetModuleHandle = dll.GetModuleHandleA + GetModuleHandle.argtypes = [c_wchar_p] + + self.failUnlessEqual(0, GetModuleHandle("foo")) + self.failUnlessEqual(get_last_error(), 126) + + self.failUnlessEqual(set_last_error(32), 126) + self.failUnlessEqual(get_last_error(), 32) + + def _worker(): + set_last_error(0) + + dll = WinDLL("kernel32", use_last_error=False) + GetModuleHandle = dll.GetModuleHandleW + GetModuleHandle.argtypes = [c_wchar_p] + GetModuleHandle("bar") + + self.failUnlessEqual(get_last_error(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_last_error(), 32) + + set_last_error(0) + +if __name__ == "__main__": + unittest.main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 4 20:59:03 2008 @@ -72,6 +72,9 @@ Library ------- +- Issue #1798: Add ctypes calling convention that allows safe access + to errno. + - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. Modified: python/trunk/Modules/_ctypes/_ctypes.c ============================================================================== --- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Wed Jun 4 20:59:03 2008 @@ -3271,7 +3271,7 @@ thunk = AllocFunctionCallback(callable, dict->argtypes, dict->restype, - dict->flags & FUNCFLAG_CDECL); + dict->flags); if (!thunk) return NULL; @@ -5273,6 +5273,17 @@ if (!m) return; +#ifdef MS_WIN32 + dwTlsIndex_LastError = TlsAlloc(); + dwTlsIndex_errno = TlsAlloc(); + if (dwTlsIndex_LastError == TLS_OUT_OF_INDEXES + || dwTlsIndex_errno == TLS_OUT_OF_INDEXES) { + PyErr_SetString(PyExc_MemoryError, + "Could not allocate TLSIndex for LastError value"); + return; + } +#endif + _pointer_type_cache = PyDict_New(); if (_pointer_type_cache == NULL) return; @@ -5394,6 +5405,8 @@ PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); #endif PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); + PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyInt_FromLong(FUNCFLAG_USE_ERRNO)); + PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyInt_FromLong(FUNCFLAG_USE_LASTERROR)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddStringConstant(m, "__version__", "1.1.0"); Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Wed Jun 4 20:59:03 2008 @@ -189,6 +189,7 @@ SETFUNC setfunc, PyObject *callable, PyObject *converters, + int flags, void **pArgs) { Py_ssize_t i; @@ -271,8 +272,22 @@ #define CHECK(what, x) \ if (x == NULL) _AddTraceback(what, "_ctypes/callbacks.c", __LINE__ - 1), PyErr_Print() + if (flags & FUNCFLAG_USE_ERRNO) + _swap_errno(); +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) + _swap_last_error(); +#endif + result = PyObject_CallObject(callable, arglist); CHECK("'calling callback function'", result); + +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) + _swap_last_error(); +#endif + if (flags & FUNCFLAG_USE_ERRNO) + _swap_errno(); if ((restype != &ffi_type_void) && result) { PyObject *keep; assert(setfunc); @@ -322,6 +337,7 @@ p->setfunc, p->callable, p->converters, + p->flags, args); } @@ -351,7 +367,7 @@ CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int is_cdecl) + int flags) { int result; CThunkObject *p; @@ -371,6 +387,7 @@ goto error; } + p->flags = flags; for (i = 0; i < nArgs; ++i) { PyObject *cnv = PySequence_GetItem(converters, i); if (cnv == NULL) @@ -398,7 +415,7 @@ cc = FFI_DEFAULT_ABI; #if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64) - if (is_cdecl == 0) + if ((flags & FUNCFLAG_CDECL) == 0) cc = FFI_STDCALL; #endif result = ffi_prep_cif(&p->cif, cc, Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Wed Jun 4 20:59:03 2008 @@ -83,6 +83,131 @@ #define DONT_USE_SEH #endif +/* + ctypes maintains a module-global, but thread-local, variable that contains + an error number; called 'ctypes_errno' for this discussion. This variable + is a private copy of the systems 'errno' value; the copy is swapped with the + 'errno' variable on several occasions. + + Foreign functions created with CDLL(..., use_errno=True), when called, swap + the values just before the actual function call, and swapped again + immediately afterwards. The 'use_errno' parameter defaults to False, in + this case 'ctypes_errno' is not touched. + + The values are also swapped immeditately before and after ctypes callback + functions are called, if the callbacks are constructed using the new + optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or + WINFUNCTYPE(..., use_errno=True). + + Two new ctypes functions are provided to access the 'ctypes_errno' value + from Python: + + - ctypes.set_errno(value) sets ctypes_errno to 'value', the previous + ctypes_errno value is returned. + + - ctypes.get_errno() returns the current ctypes_errno value. + + --- + + On Windows, the same scheme is implemented for the error value which is + managed by the GetLastError() and SetLastError() windows api calls. + + The ctypes functions are 'ctypes.set_last_error(value)' and + 'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is named + 'use_last_error', defaults to False. + + --- + + On Windows, TlsSetValue and TlsGetValue calls are used to provide thread + local storage for the variables; ctypes compiled with __GNUC__ uses __thread + variables. +*/ + +#if defined(MS_WIN32) +DWORD dwTlsIndex_LastError; +DWORD dwTlsIndex_errno; + +void +_swap_last_error(void) +{ + DWORD temp = GetLastError(); + SetLastError((DWORD)TlsGetValue(dwTlsIndex_LastError)); + TlsSetValue(dwTlsIndex_LastError, (void *)temp); +} + +static PyObject * +get_last_error(PyObject *self, PyObject *args) +{ + return PyInt_FromLong((DWORD)TlsGetValue(dwTlsIndex_LastError)); +} + +static PyObject * +set_last_error(PyObject *self, PyObject *args) +{ + DWORD new_value, prev_value; + if (!PyArg_ParseTuple(args, "i", &new_value)) + return NULL; + prev_value = (DWORD)TlsGetValue(dwTlsIndex_LastError); + TlsSetValue(dwTlsIndex_LastError, (void *)new_value); + return PyInt_FromLong(prev_value); +} + +void +_swap_errno(void) +{ + int temp = errno; + errno = (int)TlsGetValue(dwTlsIndex_errno); + TlsSetValue(dwTlsIndex_errno, (void *)temp); +} + +static PyObject * +get_errno(PyObject *self, PyObject *args) +{ + return PyInt_FromLong((int)TlsGetValue(dwTlsIndex_errno)); +} + +static PyObject * +set_errno(PyObject *self, PyObject *args) +{ + int new_value, prev_value; + if (!PyArg_ParseTuple(args, "i", &new_value)) + return NULL; + prev_value = (int)TlsGetValue(dwTlsIndex_errno); + TlsSetValue(dwTlsIndex_errno, (void *)new_value); + return PyInt_FromLong(prev_value); +} + +#elif defined(__GNUC__) +static __thread int ctypes_errno; + +void +_swap_errno(void) +{ + int temp = errno; + errno = ctypes_errno; + ctypes_errno = temp; +} + +static PyObject * +get_errno(PyObject *self, PyObject *args) +{ + return PyInt_FromLong(ctypes_errno); +} + +static PyObject * +set_errno(PyObject *self, PyObject *args) +{ + int new_errno; + if (!PyArg_ParseTuple(args, "i", &new_errno)) + return NULL; + return PyInt_FromLong(_save_errno(new_errno)); +} +#else + +#error "TLS not implemented in this configuration" + +#endif + #ifdef MS_WIN32 PyObject *ComError; @@ -660,7 +785,11 @@ if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_UNBLOCK_THREADS #endif + if (flags & FUNCFLAG_USE_ERRNO) + _swap_errno(); #ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) + _swap_last_error(); #ifndef DONT_USE_SEH __try { #endif @@ -675,7 +804,11 @@ ; } #endif + if (flags & FUNCFLAG_USE_LASTERROR) + _swap_last_error(); #endif + if (flags & FUNCFLAG_USE_ERRNO) + _swap_errno(); #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_BLOCK_THREADS @@ -1667,6 +1800,8 @@ } PyMethodDef module_methods[] = { + {"get_errno", get_errno, METH_NOARGS}, + {"set_errno", set_errno, METH_VARARGS}, {"POINTER", POINTER, METH_O }, {"pointer", pointer, METH_O }, {"_unpickle", unpickle, METH_VARARGS }, @@ -1675,6 +1810,8 @@ {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif #ifdef MS_WIN32 + {"get_last_error", get_last_error, METH_NOARGS}, + {"set_last_error", set_last_error, METH_VARARGS}, {"CopyComPointer", copy_com_pointer, METH_VARARGS, copy_com_pointer_doc}, {"FormatError", format_error, METH_VARARGS, format_error_doc}, {"LoadLibrary", load_library, METH_VARARGS, load_library_doc}, Modified: python/trunk/Modules/_ctypes/ctypes.h ============================================================================== --- python/trunk/Modules/_ctypes/ctypes.h (original) +++ python/trunk/Modules/_ctypes/ctypes.h Wed Jun 4 20:59:03 2008 @@ -87,6 +87,7 @@ PyObject_VAR_HEAD ffi_closure *pcl; /* the C callable */ ffi_cif cif; + int flags; PyObject *converters; PyObject *callable; PyObject *restype; @@ -185,7 +186,7 @@ extern CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int stdcall); + int flags); /* a table entry describing a predefined ctypes type */ struct fielddesc { char code; @@ -303,6 +304,8 @@ #define FUNCFLAG_CDECL 0x1 #define FUNCFLAG_HRESULT 0x2 #define FUNCFLAG_PYTHONAPI 0x4 +#define FUNCFLAG_USE_ERRNO 0x8 +#define FUNCFLAG_USE_LASTERROR 0x10 #define TYPEFLAG_ISPOINTER 0x100 #define TYPEFLAG_HASPOINTER 0x200 @@ -421,8 +424,16 @@ extern PyObject *_pointer_type_cache; +extern void _swap_errno(void); + #ifdef MS_WIN32 + +extern void _swap_last_error(void); + extern PyObject *ComError; + +extern DWORD dwTlsIndex_LastError; +extern DWORD dwTlsIndex_errno; #endif /* From python-checkins at python.org Wed Jun 4 21:19:00 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 4 Jun 2008 21:19:00 +0200 (CEST) Subject: [Python-checkins] r63943 - python/trunk/Modules/_ctypes/callproc.c Message-ID: <20080604191900.827921E4002@bag.python.org> Author: thomas.heller Date: Wed Jun 4 21:19:00 2008 New Revision: 63943 Log: Fix ctypes.set_errno for gcc. Modified: python/trunk/Modules/_ctypes/callproc.c Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Wed Jun 4 21:19:00 2008 @@ -197,10 +197,12 @@ static PyObject * set_errno(PyObject *self, PyObject *args) { - int new_errno; + int new_errno, prev_errno; if (!PyArg_ParseTuple(args, "i", &new_errno)) return NULL; - return PyInt_FromLong(_save_errno(new_errno)); + prev_errno = ctypes_errno; + ctypes_errno = new_errno; + return PyInt_FromLong(prev_errno); } #else From buildbot at python.org Wed Jun 4 21:29:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 19:29:28 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080604192929.241FF1E4003@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/391 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: georg.brandl,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 7 tests failed: test_socket_ssl test_ssl test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet ====================================================================== ERROR: testBasic (test.test_socket_ssl.ConnectedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socket_ssl.py", line 51, in testBasic f = self.urlopen('https://sf.net') File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socket_ssl.py", line 32, in urlopen return urllib.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 815, in testAsyncore f = urllib.urlopen(url) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: testAsyncore (test.test_ssl.ConnectedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 828, in testAsyncore raise test_support.TestFailed(msg) TestFailed: Traceback (most recent call last): ====================================================================== ERROR: test_close (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_fileno (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_getcode (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_interface (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_iter (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readline (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readlines (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_empty_socket (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 148, in test_empty_socket self.assertRaises(IOError, urllib.urlopen, 'http://something') File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 122, in test_read fp = urllib.urlopen("http://python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read_bogus (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 139, in test_read_bogus self.assertRaises(IOError, urllib.urlopen, "http://python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 207, in test_basic result = urllib.urlretrieve("file:%s" % test_support.TESTFN) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_copy (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 218, in test_copy test_support.TESTFN), second_temp) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 242, in test_reporthook second_temp, hooktester) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_0_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 251, in test_reporthook_0_bytes test_support.TESTFN, hooktester) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_5_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 265, in test_reporthook_5_bytes test_support.TESTFN, hooktester) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_8193_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib.py", line 279, in test_reporthook_8193_bytes test_support.TESTFN, hooktester) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_trivial (test.test_urllib2.TrivialTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2.py", line 20, in test_trivial self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_build_opener (test.test_urllib2.MiscTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2.py", line 1046, in test_build_opener o = build_opener(FooHandler, BarHandler) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_200 (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 391, in test_200 f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_200_with_parameters (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 405, in test_200_with_parameters f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port, 'get=with_feeling') File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_404 (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 371, in test_404 urllib2.urlopen('http://localhost:%s/weeble' % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_bad_address (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 477, in test_bad_address urllib2.urlopen, "http://www.python.invalid./") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 430, in test_basic open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 459, in test_geturl open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 445, in test_info open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_redirection (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 355, in test_redirection f = urllib2.urlopen('http://localhost:%s/' % handler.port) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_sending_headers (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2_localnet.py", line 421, in test_sending_headers urllib2.urlopen(req) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 118, in test_file self._test_urls(urls, self._extra_handlers(), urllib2.urlopen) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 106, in test_ftp self._test_urls(urls, self._extra_handlers()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_close (test.test_urllib2net.CloseSocketTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 76, in test_close response = _urlopen_with_retry("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 222, in test_ftp_basic u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 229, in test_ftp_default_timeout u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 238, in test_ftp_no_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=None) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 244, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 193, in test_http_basic u = _urlopen_with_retry("http://www.python.org") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 200, in test_http_default_timeout u = _urlopen_with_retry("http://www.python.org") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 209, in test_http_no_timeout u = _urlopen_with_retry("http://www.python.org", timeout=None) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 215, in test_http_timeout u = _urlopen_with_retry("http://www.python.org", timeout=120) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: testURLread (test.test_urllibnet.URLTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 37, in testURLread f = _open_with_retry(urllib.urlopen, "http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_bad_address (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 140, in test_bad_address urllib.urlopen, "http://www.python.invalid./") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 60, in test_basic open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_fileno (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 120, in test_fileno open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_getcode (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 106, in test_getcode open_url = urllib.FancyURLopener().open(URL) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 96, in test_geturl open_url = self.urlopen(URL) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 83, in test_info open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readlines (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 72, in test_readlines open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 150, in test_basic file_location,info = self.urlretrieve("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_header (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 176, in test_header file_location, header = self.urlretrieve("http://www.python.org/") File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_specified_path (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 164, in test_specified_path test_support.TESTFN) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 21:59:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 19:59:46 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080604195946.48CF21E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3488 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 7 tests failed: test_socket_ssl test_ssl test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet ====================================================================== ERROR: testBasic (test.test_socket_ssl.ConnectedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_socket_ssl.py", line 51, in testBasic f = self.urlopen('https://sf.net') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_socket_ssl.py", line 32, in urlopen return urllib.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_ssl.py", line 815, in testAsyncore f = urllib.urlopen(url) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: testAsyncore (test.test_ssl.ConnectedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_ssl.py", line 828, in testAsyncore raise test_support.TestFailed(msg) TestFailed: Traceback (most recent call last): ====================================================================== ERROR: test_close (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_fileno (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_getcode (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_interface (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_iter (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readline (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readlines (test.test_urllib.urlopen_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 36, in setUp self.returned_obj = urllib.urlopen("file:%s" % self.pathname) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_empty_socket (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 148, in test_empty_socket self.assertRaises(IOError, urllib.urlopen, 'http://something') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 122, in test_read fp = urllib.urlopen("http://python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_read_bogus (test.test_urllib.urlopen_HttpTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 139, in test_read_bogus ====================================================================== ERROR: test_basic (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 207, in test_basic result = urllib.urlretrieve("file:%s" % test_support.TESTFN) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_copy (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 218, in test_copy test_support.TESTFN), second_temp) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 242, in test_reporthook second_temp, hooktester) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_0_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 251, in test_reporthook_0_bytes test_support.TESTFN, hooktester) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_5_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 265, in test_reporthook_5_bytes test_support.TESTFN, hooktester) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_reporthook_8193_bytes (test.test_urllib.urlretrieve_FileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib.py", line 279, in test_reporthook_8193_bytes test_support.TESTFN, hooktester) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_trivial (test.test_urllib2.TrivialTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 20, in test_trivial self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_build_opener (test.test_urllib2.MiscTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 1046, in test_build_opener o = build_opener(FooHandler, BarHandler) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_200 (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 391, in test_200 f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_200_with_parameters (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 405, in test_200_with_parameters f = urllib2.urlopen('http://localhost:%s/bizarre' % handler.port, 'get=with_feeling') File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_404 (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 371, in test_404 urllib2.urlopen('http://localhost:%s/weeble' % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_bad_address (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 477, in test_bad_address urllib2.urlopen, "http://www.python.invalid./") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 430, in test_basic open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 459, in test_geturl open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 445, in test_info open_url = urllib2.urlopen("http://localhost:%s" % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_redirection (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 355, in test_redirection f = urllib2.urlopen('http://localhost:%s/' % handler.port) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_sending_headers (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2_localnet.py", line 421, in test_sending_headers urllib2.urlopen(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 118, in test_file self._test_urls(urls, self._extra_handlers(), urllib2.urlopen) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 106, in test_ftp self._test_urls(urls, self._extra_handlers()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 156, in _test_urls urllib2.install_opener(urllib2.build_opener(*handlers)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_close (test.test_urllib2net.CloseSocketTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 76, in test_close response = _urlopen_with_retry("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 222, in test_ftp_basic u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 229, in test_ftp_default_timeout u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 238, in test_ftp_no_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 244, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 193, in test_http_basic u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 200, in test_http_default_timeout u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 209, in test_http_no_timeout u = _urlopen_with_retry("http://www.python.org", timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 215, in test_http_timeout u = _urlopen_with_retry("http://www.python.org", timeout=120) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 19, in _urlopen_with_retry return urllib2.urlopen(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 123, in urlopen _opener = build_opener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: testURLread (test.test_urllibnet.URLTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 37, in testURLread f = _open_with_retry(urllib.urlopen, "http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_bad_address (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 140, in test_bad_address urllib.urlopen, "http://www.python.invalid./") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 60, in test_basic open_url = self.urlopen("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_fileno (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 120, in test_fileno open_url = self.urlopen("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_getcode (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 106, in test_getcode open_url = urllib.FancyURLopener().open(URL) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_geturl (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 96, in test_geturl open_url = self.urlopen(URL) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_info (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 83, in test_info open_url = self.urlopen("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_readlines (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 72, in test_readlines open_url = self.urlopen("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 56, in urlopen return _open_with_retry(urllib.urlopen, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 77, in urlopen opener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_basic (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 150, in test_basic file_location,info = self.urlretrieve("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_header (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 176, in test_header file_location, header = self.urlretrieve("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes ====================================================================== ERROR: test_specified_path (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 164, in test_specified_path test_support.TESTFN) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 146, in urlretrieve return _open_with_retry(urllib.urlretrieve, *args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllibnet.py", line 18, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 88, in urlretrieve _urlopener = FancyURLopener() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 606, in __init__ URLopener.__init__(self, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 124, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1443, in getproxies_macosx_sysconf from ctypes import cdll File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/ctypes/__init__.py", line 10, in from _ctypes import Union, Structure, Array ImportError: No module named _ctypes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 4 22:21:39 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 4 Jun 2008 22:21:39 +0200 (CEST) Subject: [Python-checkins] r63944 - doctools/trunk/sphinx/textwriter.py Message-ID: <20080604202139.6174F1E4003@bag.python.org> Author: georg.brandl Date: Wed Jun 4 22:21:39 2008 New Revision: 63944 Log: Fix 2.5ism in textwriter. Modified: doctools/trunk/sphinx/textwriter.py Modified: doctools/trunk/sphinx/textwriter.py ============================================================================== --- doctools/trunk/sphinx/textwriter.py (original) +++ doctools/trunk/sphinx/textwriter.py Wed Jun 4 22:21:39 2008 @@ -305,7 +305,10 @@ cells = [] for i, cell in enumerate(line): par = textwrap.wrap(cell, width=colwidths[i]) - maxwidth = max(map(len, par)) if par else 0 + if par: + maxwidth = max(map(len, par)) + else: + maxwidth = 0 realwidths[i] = max(realwidths[i], maxwidth) cells.append(par) fmted_rows.append(cells) From python-checkins at python.org Wed Jun 4 22:22:06 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 4 Jun 2008 22:22:06 +0200 (CEST) Subject: [Python-checkins] r63945 - in python/trunk: Lib/ctypes/__init__.py Lib/ctypes/test/test_errno.py Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Message-ID: <20080604202206.2649A1E4003@bag.python.org> Author: thomas.heller Date: Wed Jun 4 22:22:05 2008 New Revision: 63945 Log: Revert revisions 63943 and 63942 (Issue #1798: Add ctypes calling convention that allows safe access to errno) This code does not yet work on OS X (__thread storage specifier not available), so i needs a configure check plus a more portable solution. Removed: python/trunk/Lib/ctypes/test/test_errno.py Modified: python/trunk/Lib/ctypes/__init__.py python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callbacks.c python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/ctypes.h Modified: python/trunk/Lib/ctypes/__init__.py ============================================================================== --- python/trunk/Lib/ctypes/__init__.py (original) +++ python/trunk/Lib/ctypes/__init__.py Wed Jun 4 22:22:05 2008 @@ -33,9 +33,7 @@ DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ - FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \ - FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \ - FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR + FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI """ WINOLEAPI -> HRESULT @@ -75,9 +73,8 @@ return create_string_buffer(init, size) _c_functype_cache = {} -def CFUNCTYPE(restype, *argtypes, **kw): - """CFUNCTYPE(restype, *argtypes, - use_errno=False, use_last_error=False) -> function prototype. +def CFUNCTYPE(restype, *argtypes): + """CFUNCTYPE(restype, *argtypes) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types @@ -91,21 +88,14 @@ prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ - flags = _FUNCFLAG_CDECL - if kw.pop("use_errno", False): - flags |= _FUNCFLAG_USE_ERRNO - if kw.pop("use_last_error", False): - flags |= _FUNCFLAG_USE_LASTERROR - if kw: - raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _c_functype_cache[(restype, argtypes, flags)] + return _c_functype_cache[(restype, argtypes)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = flags - _c_functype_cache[(restype, argtypes, flags)] = CFunctionType + _flags_ = _FUNCFLAG_CDECL + _c_functype_cache[(restype, argtypes)] = CFunctionType return CFunctionType if _os.name in ("nt", "ce"): @@ -116,23 +106,16 @@ _FUNCFLAG_STDCALL = _FUNCFLAG_CDECL _win_functype_cache = {} - def WINFUNCTYPE(restype, *argtypes, **kw): + def WINFUNCTYPE(restype, *argtypes): # docstring set later (very similar to CFUNCTYPE.__doc__) - flags = _FUNCFLAG_STDCALL - if kw.pop("use_errno", False): - flags |= _FUNCFLAG_USE_ERRNO - if kw.pop("use_last_error", False): - flags |= _FUNCFLAG_USE_LASTERROR - if kw: - raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _win_functype_cache[(restype, argtypes, flags)] + return _win_functype_cache[(restype, argtypes)] except KeyError: class WinFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = flags - _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType + _flags_ = _FUNCFLAG_STDCALL + _win_functype_cache[(restype, argtypes)] = WinFunctionType return WinFunctionType if WINFUNCTYPE.__doc__: WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE") @@ -141,7 +124,6 @@ from _ctypes import dlopen as _dlopen from _ctypes import sizeof, byref, addressof, alignment, resize -from _ctypes import get_errno, set_errno from _ctypes import _SimpleCData def _check_size(typ, typecode=None): @@ -331,24 +313,12 @@ Calling the functions releases the Python GIL during the call and reacquires it afterwards. """ - _func_flags_ = _FUNCFLAG_CDECL - _func_restype_ = c_int + class _FuncPtr(_CFuncPtr): + _flags_ = _FUNCFLAG_CDECL + _restype_ = c_int # default, can be overridden in instances - def __init__(self, name, mode=DEFAULT_MODE, handle=None, - use_errno=False, - use_last_error=False): + def __init__(self, name, mode=DEFAULT_MODE, handle=None): self._name = name - flags = self._func_flags_ - if use_errno: - flags |= _FUNCFLAG_USE_ERRNO - if use_last_error: - flags |= _FUNCFLAG_USE_LASTERROR - - class _FuncPtr(_CFuncPtr): - _flags_ = flags - _restype_ = self._func_restype_ - self._FuncPtr = _FuncPtr - if handle is None: self._handle = _dlopen(self._name, mode) else: @@ -378,7 +348,9 @@ access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ - _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI + class _FuncPtr(_CFuncPtr): + _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI + _restype_ = c_int # default, can be overridden in instances if _os.name in ("nt", "ce"): @@ -386,7 +358,9 @@ """This class represents a dll exporting functions using the Windows stdcall calling convention. """ - _func_flags_ = _FUNCFLAG_STDCALL + class _FuncPtr(_CFuncPtr): + _flags_ = _FUNCFLAG_STDCALL + _restype_ = c_int # default, can be overridden in instances # XXX Hm, what about HRESULT as normal parameter? # Mustn't it derive from c_long then? @@ -410,8 +384,9 @@ HRESULT error values are automatically raised as WindowsError exceptions. """ - _func_flags_ = _FUNCFLAG_STDCALL - _func_restype_ = HRESULT + class _FuncPtr(_CFuncPtr): + _flags_ = _FUNCFLAG_STDCALL + _restype_ = HRESULT class LibraryLoader(object): def __init__(self, dlltype): @@ -449,7 +424,6 @@ GetLastError = windll.kernel32.GetLastError else: GetLastError = windll.coredll.GetLastError - from _ctypes import get_last_error, set_last_error def WinError(code=None, descr=None): if code is None: Deleted: python/trunk/Lib/ctypes/test/test_errno.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_errno.py Wed Jun 4 22:22:05 2008 +++ (empty file) @@ -1,76 +0,0 @@ -import unittest, os, errno -from ctypes import * -from ctypes.util import find_library -import threading - -class Test(unittest.TestCase): - def test_open(self): - libc_name = find_library("c") - if libc_name is not None: - libc = CDLL(libc_name, use_errno=True) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - - libc_open.argtypes = c_char_p, c_int - - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), errno.ENOENT) - - self.failUnlessEqual(set_errno(32), errno.ENOENT) - self.failUnlessEqual(get_errno(), 32) - - - def _worker(): - set_errno(0) - - libc = CDLL(libc_name, use_errno=False) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - libc_open.argtypes = c_char_p, c_int - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_errno(), 32) - set_errno(0) - - if os.name == "nt": - - def test_GetLastError(self): - dll = WinDLL("kernel32", use_last_error=True) - GetModuleHandle = dll.GetModuleHandleA - GetModuleHandle.argtypes = [c_wchar_p] - - self.failUnlessEqual(0, GetModuleHandle("foo")) - self.failUnlessEqual(get_last_error(), 126) - - self.failUnlessEqual(set_last_error(32), 126) - self.failUnlessEqual(get_last_error(), 32) - - def _worker(): - set_last_error(0) - - dll = WinDLL("kernel32", use_last_error=False) - GetModuleHandle = dll.GetModuleHandleW - GetModuleHandle.argtypes = [c_wchar_p] - GetModuleHandle("bar") - - self.failUnlessEqual(get_last_error(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_last_error(), 32) - - set_last_error(0) - -if __name__ == "__main__": - unittest.main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 4 22:22:05 2008 @@ -72,9 +72,6 @@ Library ------- -- Issue #1798: Add ctypes calling convention that allows safe access - to errno. - - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. Modified: python/trunk/Modules/_ctypes/_ctypes.c ============================================================================== --- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Wed Jun 4 22:22:05 2008 @@ -3271,7 +3271,7 @@ thunk = AllocFunctionCallback(callable, dict->argtypes, dict->restype, - dict->flags); + dict->flags & FUNCFLAG_CDECL); if (!thunk) return NULL; @@ -5273,17 +5273,6 @@ if (!m) return; -#ifdef MS_WIN32 - dwTlsIndex_LastError = TlsAlloc(); - dwTlsIndex_errno = TlsAlloc(); - if (dwTlsIndex_LastError == TLS_OUT_OF_INDEXES - || dwTlsIndex_errno == TLS_OUT_OF_INDEXES) { - PyErr_SetString(PyExc_MemoryError, - "Could not allocate TLSIndex for LastError value"); - return; - } -#endif - _pointer_type_cache = PyDict_New(); if (_pointer_type_cache == NULL) return; @@ -5405,8 +5394,6 @@ PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); #endif PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); - PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyInt_FromLong(FUNCFLAG_USE_ERRNO)); - PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyInt_FromLong(FUNCFLAG_USE_LASTERROR)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddStringConstant(m, "__version__", "1.1.0"); Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Wed Jun 4 22:22:05 2008 @@ -189,7 +189,6 @@ SETFUNC setfunc, PyObject *callable, PyObject *converters, - int flags, void **pArgs) { Py_ssize_t i; @@ -272,22 +271,8 @@ #define CHECK(what, x) \ if (x == NULL) _AddTraceback(what, "_ctypes/callbacks.c", __LINE__ - 1), PyErr_Print() - if (flags & FUNCFLAG_USE_ERRNO) - _swap_errno(); -#ifdef MS_WIN32 - if (flags & FUNCFLAG_USE_LASTERROR) - _swap_last_error(); -#endif - result = PyObject_CallObject(callable, arglist); CHECK("'calling callback function'", result); - -#ifdef MS_WIN32 - if (flags & FUNCFLAG_USE_LASTERROR) - _swap_last_error(); -#endif - if (flags & FUNCFLAG_USE_ERRNO) - _swap_errno(); if ((restype != &ffi_type_void) && result) { PyObject *keep; assert(setfunc); @@ -337,7 +322,6 @@ p->setfunc, p->callable, p->converters, - p->flags, args); } @@ -367,7 +351,7 @@ CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int flags) + int is_cdecl) { int result; CThunkObject *p; @@ -387,7 +371,6 @@ goto error; } - p->flags = flags; for (i = 0; i < nArgs; ++i) { PyObject *cnv = PySequence_GetItem(converters, i); if (cnv == NULL) @@ -415,7 +398,7 @@ cc = FFI_DEFAULT_ABI; #if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64) - if ((flags & FUNCFLAG_CDECL) == 0) + if (is_cdecl == 0) cc = FFI_STDCALL; #endif result = ffi_prep_cif(&p->cif, cc, Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Wed Jun 4 22:22:05 2008 @@ -83,133 +83,6 @@ #define DONT_USE_SEH #endif -/* - ctypes maintains a module-global, but thread-local, variable that contains - an error number; called 'ctypes_errno' for this discussion. This variable - is a private copy of the systems 'errno' value; the copy is swapped with the - 'errno' variable on several occasions. - - Foreign functions created with CDLL(..., use_errno=True), when called, swap - the values just before the actual function call, and swapped again - immediately afterwards. The 'use_errno' parameter defaults to False, in - this case 'ctypes_errno' is not touched. - - The values are also swapped immeditately before and after ctypes callback - functions are called, if the callbacks are constructed using the new - optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or - WINFUNCTYPE(..., use_errno=True). - - Two new ctypes functions are provided to access the 'ctypes_errno' value - from Python: - - - ctypes.set_errno(value) sets ctypes_errno to 'value', the previous - ctypes_errno value is returned. - - - ctypes.get_errno() returns the current ctypes_errno value. - - --- - - On Windows, the same scheme is implemented for the error value which is - managed by the GetLastError() and SetLastError() windows api calls. - - The ctypes functions are 'ctypes.set_last_error(value)' and - 'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is named - 'use_last_error', defaults to False. - - --- - - On Windows, TlsSetValue and TlsGetValue calls are used to provide thread - local storage for the variables; ctypes compiled with __GNUC__ uses __thread - variables. -*/ - -#if defined(MS_WIN32) -DWORD dwTlsIndex_LastError; -DWORD dwTlsIndex_errno; - -void -_swap_last_error(void) -{ - DWORD temp = GetLastError(); - SetLastError((DWORD)TlsGetValue(dwTlsIndex_LastError)); - TlsSetValue(dwTlsIndex_LastError, (void *)temp); -} - -static PyObject * -get_last_error(PyObject *self, PyObject *args) -{ - return PyInt_FromLong((DWORD)TlsGetValue(dwTlsIndex_LastError)); -} - -static PyObject * -set_last_error(PyObject *self, PyObject *args) -{ - DWORD new_value, prev_value; - if (!PyArg_ParseTuple(args, "i", &new_value)) - return NULL; - prev_value = (DWORD)TlsGetValue(dwTlsIndex_LastError); - TlsSetValue(dwTlsIndex_LastError, (void *)new_value); - return PyInt_FromLong(prev_value); -} - -void -_swap_errno(void) -{ - int temp = errno; - errno = (int)TlsGetValue(dwTlsIndex_errno); - TlsSetValue(dwTlsIndex_errno, (void *)temp); -} - -static PyObject * -get_errno(PyObject *self, PyObject *args) -{ - return PyInt_FromLong((int)TlsGetValue(dwTlsIndex_errno)); -} - -static PyObject * -set_errno(PyObject *self, PyObject *args) -{ - int new_value, prev_value; - if (!PyArg_ParseTuple(args, "i", &new_value)) - return NULL; - prev_value = (int)TlsGetValue(dwTlsIndex_errno); - TlsSetValue(dwTlsIndex_errno, (void *)new_value); - return PyInt_FromLong(prev_value); -} - -#elif defined(__GNUC__) -static __thread int ctypes_errno; - -void -_swap_errno(void) -{ - int temp = errno; - errno = ctypes_errno; - ctypes_errno = temp; -} - -static PyObject * -get_errno(PyObject *self, PyObject *args) -{ - return PyInt_FromLong(ctypes_errno); -} - -static PyObject * -set_errno(PyObject *self, PyObject *args) -{ - int new_errno, prev_errno; - if (!PyArg_ParseTuple(args, "i", &new_errno)) - return NULL; - prev_errno = ctypes_errno; - ctypes_errno = new_errno; - return PyInt_FromLong(prev_errno); -} -#else - -#error "TLS not implemented in this configuration" - -#endif - #ifdef MS_WIN32 PyObject *ComError; @@ -787,11 +660,7 @@ if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_UNBLOCK_THREADS #endif - if (flags & FUNCFLAG_USE_ERRNO) - _swap_errno(); #ifdef MS_WIN32 - if (flags & FUNCFLAG_USE_LASTERROR) - _swap_last_error(); #ifndef DONT_USE_SEH __try { #endif @@ -806,11 +675,7 @@ ; } #endif - if (flags & FUNCFLAG_USE_LASTERROR) - _swap_last_error(); #endif - if (flags & FUNCFLAG_USE_ERRNO) - _swap_errno(); #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_BLOCK_THREADS @@ -1802,8 +1667,6 @@ } PyMethodDef module_methods[] = { - {"get_errno", get_errno, METH_NOARGS}, - {"set_errno", set_errno, METH_VARARGS}, {"POINTER", POINTER, METH_O }, {"pointer", pointer, METH_O }, {"_unpickle", unpickle, METH_VARARGS }, @@ -1812,8 +1675,6 @@ {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif #ifdef MS_WIN32 - {"get_last_error", get_last_error, METH_NOARGS}, - {"set_last_error", set_last_error, METH_VARARGS}, {"CopyComPointer", copy_com_pointer, METH_VARARGS, copy_com_pointer_doc}, {"FormatError", format_error, METH_VARARGS, format_error_doc}, {"LoadLibrary", load_library, METH_VARARGS, load_library_doc}, Modified: python/trunk/Modules/_ctypes/ctypes.h ============================================================================== --- python/trunk/Modules/_ctypes/ctypes.h (original) +++ python/trunk/Modules/_ctypes/ctypes.h Wed Jun 4 22:22:05 2008 @@ -87,7 +87,6 @@ PyObject_VAR_HEAD ffi_closure *pcl; /* the C callable */ ffi_cif cif; - int flags; PyObject *converters; PyObject *callable; PyObject *restype; @@ -186,7 +185,7 @@ extern CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int flags); + int stdcall); /* a table entry describing a predefined ctypes type */ struct fielddesc { char code; @@ -304,8 +303,6 @@ #define FUNCFLAG_CDECL 0x1 #define FUNCFLAG_HRESULT 0x2 #define FUNCFLAG_PYTHONAPI 0x4 -#define FUNCFLAG_USE_ERRNO 0x8 -#define FUNCFLAG_USE_LASTERROR 0x10 #define TYPEFLAG_ISPOINTER 0x100 #define TYPEFLAG_HASPOINTER 0x200 @@ -424,16 +421,8 @@ extern PyObject *_pointer_type_cache; -extern void _swap_errno(void); - #ifdef MS_WIN32 - -extern void _swap_last_error(void); - extern PyObject *ComError; - -extern DWORD dwTlsIndex_LastError; -extern DWORD dwTlsIndex_errno; #endif /* From python-checkins at python.org Wed Jun 4 22:25:27 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 4 Jun 2008 22:25:27 +0200 (CEST) Subject: [Python-checkins] r63946 - in doctools/trunk/sphinx: application.py config.py environment.py Message-ID: <20080604202527.8A7631E4012@bag.python.org> Author: georg.brandl Date: Wed Jun 4 22:25:27 2008 New Revision: 63946 Log: Fix the handling of extensions' config values. Modified: doctools/trunk/sphinx/application.py doctools/trunk/sphinx/config.py doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/application.py ============================================================================== --- doctools/trunk/sphinx/application.py (original) +++ doctools/trunk/sphinx/application.py Wed Jun 4 22:25:27 2008 @@ -74,10 +74,7 @@ self._events = events.copy() # read config - self.config = Config(confdir, 'conf.py') - if confoverrides: - for key, val in confoverrides.items(): - setattr(self.config, key, val) + self.config = Config(confdir, 'conf.py', confoverrides) # load all extension modules for extension in self.config.extensions: @@ -86,6 +83,9 @@ if self.config.setup: self.config.setup(self) + # now that we know all config values, collect them from conf.py + self.config.init_values() + if buildername is None: print >>status, 'No builder selected, using default: html' buildername = 'html' @@ -176,10 +176,9 @@ self.builderclasses[builder.name] = builder def add_config_value(self, name, default, rebuild_env): - if name in self.config.valuenames: + if name in self.config.config_values: raise ExtensionError('Config value %r already present' % name) - self.config.valuenames.add(name) - self.config.__class__.config_values[name] = (default, rebuild_env) + self.config.config_values[name] = (default, rebuild_env) def add_event(self, name): if name in self._events: Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Wed Jun 4 22:25:27 2008 @@ -30,11 +30,7 @@ today = ('', True), today_fmt = ('%B %d, %Y', True), - # extensibility - templates_path = ([], False), - extensions = ([], True), - - # general reading options + # general options master_doc = ('contents', True), source_suffix = ('.rst', True), unused_docs = ([], True), @@ -44,6 +40,7 @@ add_module_names = (True, True), show_authors = (False, True), pygments_style = ('sphinx', False), + templates_path = ([], False), template_bridge = (None, False), # HTML options @@ -80,8 +77,8 @@ latex_use_modindex = (True, False), ) - def __init__(self, dirname, filename): - self.valuenames = set(self.config_values.keys()) + def __init__(self, dirname, filename, overrides): + self.overrides = overrides config = {'__file__': path.join(dirname, filename)} olddir = os.getcwd() try: @@ -89,15 +86,24 @@ execfile(config['__file__'], config) finally: os.chdir(olddir) - for name in config: - if name in self.valuenames: - self.__dict__[name] = config[name] + self._raw_config = config + # these two must be preinitialized because extensions can add their + # own config values self.setup = config.get('setup', None) + self.extensions = config.get('extensions', []) + + def init_values(self): + config = self._raw_config + config.update(self.overrides) + for name in self._raw_config: + if name in self.config_values: + self.__dict__[name] = config[name] + del self._raw_config def __getattr__(self, name): if name.startswith('_'): raise AttributeError(name) - if name not in self.valuenames: + if name not in self.config_values: raise AttributeError('No such config value: %s' % name) default = self.config_values[name][0] if callable(default): @@ -114,4 +120,4 @@ delattr(self, name) def __contains__(self, name): - return name in self.valuenames + return name in self.config_values Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Wed Jun 4 22:25:27 2008 @@ -397,9 +397,7 @@ for key, descr in config.config_values.iteritems(): if not descr[1]: continue - if not hasattr(self.config, key) or \ - self.config[key] != config[key]: - + if self.config[key] != config[key]: msg = '[config changed] ' config_changed = True break From python-checkins at python.org Wed Jun 4 22:41:44 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Wed, 4 Jun 2008 22:41:44 +0200 (CEST) Subject: [Python-checkins] r63948 - in python/trunk: Lib/test/test_complex.py Objects/complexobject.c Message-ID: <20080604204144.B125D1E4003@bag.python.org> Author: alexandre.vassalotti Date: Wed Jun 4 22:41:44 2008 New Revision: 63948 Log: Fixed complex.__getnewargs__() to not emit another complex object. Modified: python/trunk/Lib/test/test_complex.py python/trunk/Objects/complexobject.c Modified: python/trunk/Lib/test/test_complex.py ============================================================================== --- python/trunk/Lib/test/test_complex.py (original) +++ python/trunk/Lib/test/test_complex.py Wed Jun 4 22:41:44 2008 @@ -373,6 +373,14 @@ except (OSError, IOError): pass + def test_getnewargs(self): + self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0)) + self.assertEqual((1-2j).__getnewargs__(), (1.0, -2.0)) + self.assertEqual((2j).__getnewargs__(), (0.0, 2.0)) + self.assertEqual((-0j).__getnewargs__(), (0.0, -0.0)) + self.assertEqual(complex(0, INF).__getnewargs__(), (0.0, INF)) + self.assertEqual(complex(INF, 0).__getnewargs__(), (INF, 0.0)) + if float.__getformat__("double").startswith("IEEE"): def test_plus_minus_0j(self): # test that -0j and 0j literals are not identified Modified: python/trunk/Objects/complexobject.c ============================================================================== --- python/trunk/Objects/complexobject.c (original) +++ python/trunk/Objects/complexobject.c Wed Jun 4 22:41:44 2008 @@ -822,7 +822,8 @@ static PyObject * complex_getnewargs(PyComplexObject *v) { - return Py_BuildValue("(D)", &v->cval); + Py_complex c = v->cval; + return Py_BuildValue("(dd)", c.real, c.imag); } #if 0 From python-checkins at python.org Wed Jun 4 22:47:51 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 4 Jun 2008 22:47:51 +0200 (CEST) Subject: [Python-checkins] r63949 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080604204751.DAD051E4003@bag.python.org> Author: guilherme.polo Date: Wed Jun 4 22:47:51 2008 New Revision: 63949 Log: Implemented method get for the new Scale widget since Ttk Scale supports optional x and y params and the type conversion done at Tkinter is not needed for Ttk Scale. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Wed Jun 4 22:47:51 2008 @@ -1009,6 +1009,15 @@ Widget.__init__(self, master, "ttk::scale", kw) + def get(self, x=None, y=None): + """Get the current value of the value option, or the value + corresponding to the coordinates x, y if they are specified. + + x and y are pixel coordinates relative to the scale widget + origin.""" + return self.tk.call(self._w, 'get', x, y) + + class Scrollbar(Widget, Tkinter.Scrollbar): """Ttk Scrollbar controls the viewport of a scrollable widget.""" Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Wed Jun 4 22:47:51 2008 @@ -1009,6 +1009,15 @@ Widget.__init__(self, master, "ttk::scale", kw) + def get(self, x=None, y=None): + """Get the current value of the value option, or the value + corresponding to the coordinates x, y if they are specified. + + x and y are pixel coordinates relative to the scale widget + origin.""" + return self.tk.call(self._w, 'get', x, y) + + class Scrollbar(Widget, tkinter.Scrollbar): """Ttk Scrollbar controls the viewport of a scrollable widget.""" From buildbot at python.org Wed Jun 4 23:08:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 21:08:03 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080604210803.A7CCB1E4016@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/588 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: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_codecs test_io ====================================================================== ERROR: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_codecs.py", line 1344, in test_basics encodedresult += encoder.encode(c) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_codecs.py", line 1429, in test_decoder_state self.check_state_handling_decode(encoding, u, u.encode(encoding)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_codecs.py", line 30, in check_state_handling_decode part1 = d.decode(s[:i]) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 823, in testBasicIO self.assertEquals(f.write("abc"), 3) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1428, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 661, in testEncodingErrorsReading self.assertRaises(UnicodeError, t.read) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1661, in read decoder.decode(self.buffer.read(), final=True)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 679, in testEncodingErrorsWriting self.assertRaises(UnicodeError, t.write, "\xff") File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1428, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 784, in testNewlinesInput self.assertEquals(txt.readlines(), expected) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 536, in readlines return list(self) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1676, in __next__ line = self.readline() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1750, in readline while self._read_chunk(): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 809, in testNewlinesOutput txt.write(data) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1428, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 1045, in test_issue1395_1 c = txt.read(1) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1670, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 1057, in test_issue1395_2 c = txt.read(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1670, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 1067, in test_issue1395_3 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1670, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 1078, in test_issue1395_4 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1670, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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 "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_io.py", line 1086, in test_issue1395_5 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1670, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1499, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/io.py", line 1236, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/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' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 4 23:13:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 21:13:40 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080604211341.11F2F1E4003@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/300 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_email make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 5 01:00:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 04 Jun 2008 23:00:30 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080604230030.872421E4004@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3157 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: alexandre.vassalotti,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpyYRePJ/cgi-bin/file2.py", line 2, in import cgi Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/trunk.norwitz-tru64/build/Lib/test/test_socket.py", line 123, in clientRun Fatal Python error: UNREF invalid object sincerely, -The Buildbot From python-checkins at python.org Thu Jun 5 02:00:56 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 5 Jun 2008 02:00:56 +0200 (CEST) Subject: [Python-checkins] r63951 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst samples/treeview_multicolumn.py src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080605000056.60C9E1E4003@bag.python.org> Author: guilherme.polo Date: Thu Jun 5 02:00:55 2008 New Revision: 63951 Log: Methods heading and tag_bind of Treeview supports Python objects as callback now, before the person would need to use Misc.register before passing it. Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Thu Jun 5 02:00:55 2008 @@ -904,9 +904,8 @@ * anchor: anchor Specifies how the heading text should be aligned. One of the standard Tk anchor values. - * command: script - A script to evaluate when the heading label is pressed. - This could be passed using Misc.register(callback). + * command: callback + A callback to be invoked when the heading label is pressed. To configure the tree column heading, call this with column = "#0" @@ -1038,12 +1037,10 @@ *column* in *given* item to the specified *value*. - .. method:: tag_bind(tagname[, sequence=None[, script=None]]) + .. method:: tag_bind(tagname[, sequence=None[, callback=None]]) - Bind a script for the event *sequence* to the tag *tagname*. *script* is - possibly passed using Misc.register(callback) combined with substitutions. - - When an X event is delivered to an item, the script for each of the + Bind a callback for the given event *sequence* to the tag *tagname*. + When an event is delivered to an item, the callbacks for each of the item's tags option are called. Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py (original) +++ sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py Thu Jun 5 02:00:55 2008 @@ -38,8 +38,8 @@ tree.move(item[1], '', indx) # switch the heading so that it will sort in the opposite direction - tree.heading(col, command=tree.register( - lambda col=col: sortby(tree, col, int(not descending)))) + tree.heading(col, + command=lambda col=col: sortby(tree, col, int(not descending))) class App(object): def __init__(self): @@ -81,8 +81,7 @@ def _build_tree(self): for col in tree_columns: self.tree.heading(col, text=col.title(), - command=self.tree.register( - lambda c=col: sortby(self.tree, c, 0))) + command=lambda c=col: sortby(self.tree, c, 0)) # XXX tkFont.Font().measure expected args are incorrect according # to the Tk docs self.tree.column(col, width=tkFont.Font().measure(col.title())) Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Thu Jun 5 02:00:55 2008 @@ -1170,11 +1170,16 @@ anchor: anchor Specifies how the heading text should be aligned. One of the standard Tk anchor values - command: script - A script to evaluate when the heading label is pressed. - This could be passed using Misc.register(callback). + command: callback + A callback to be invoked when the heading label is + pressed. To configure the tree column heading, call this with column = "#0" """ + cmd = kw.get('command') + if cmd and not isinstance(cmd, basestring): + # callback not registered yet, do it now + kw['command'] = self.master.register(cmd, self._substitute) + return self.tk.call(self._w, "heading", column, *(_format_optdict(kw))) @@ -1317,14 +1322,11 @@ return res - def tag_bind(self, tagname, sequence=None, script=None): - """Bind a script for the event sequence to the tag tagname. - script is possibly passed using Misc.register(callback) combined - with substitutions. - - When an X event is delivered to an item, the script for each + def tag_bind(self, tagname, sequence=None, callback=None): + """Bind a callback for the given event sequence to the tag tagname. + When an event is delivered to an item, the callbacks for each of the item's tags option are called.""" - self.tk.call(self._w, "tag", "bind", tagname, sequence, script) + self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0) def tag_configure(self, tagname, **kw): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Thu Jun 5 02:00:55 2008 @@ -1170,11 +1170,16 @@ anchor: anchor Specifies how the heading text should be aligned. One of the standard Tk anchor values - command: script - A script to evaluate when the heading label is pressed. - This could be passed using Misc.register(callback). + command: callback + A callback to be invoked when the heading label is + pressed. To configure the tree column heading, call this with column = "#0" """ + cmd = kw.get('command') + if cmd and not isinstance(cmd, str): + # callback not registered yet, do it now + kw['command'] = self.master.register(cmd, self._substitute) + return self.tk.call(self._w, "heading", column, *(_format_optdict(kw))) @@ -1317,14 +1322,11 @@ return res - def tag_bind(self, tagname, sequence=None, script=None): - """Bind a script for the event sequence to the tag tagname. - script is possibly passed using Misc.register(callback) combined - with substitutions. - - When an X event is delivered to an item, the script for each + def tag_bind(self, tagname, sequence=None, callback=None): + """Bind a callback for the given event sequence to the tag tagname. + When an event is delivered to an item, the callbacks for each of the item's tags option are called.""" - self.tk.call(self._w, "tag", "bind", tagname, sequence, script) + self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0) def tag_configure(self, tagname, **kw): From python-checkins at python.org Thu Jun 5 03:13:59 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 5 Jun 2008 03:13:59 +0200 (CEST) Subject: [Python-checkins] r63952 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080605011359.19F671E4003@bag.python.org> Author: guilherme.polo Date: Thu Jun 5 03:13:58 2008 New Revision: 63952 Log: Somehow I missed the "invoke" command for Ttk Button, added now. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Thu Jun 5 03:13:58 2008 @@ -553,6 +553,11 @@ Widget.__init__(self, master, "ttk::button", kw) + def invoke(self): + """Invokes the command associated with the button.""" + return self.tk.call(self._w, "invoke") + + class Checkbutton(Widget): """Ttk Checkbutton widget which is either in on- or off-state.""" Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Thu Jun 5 03:13:58 2008 @@ -553,6 +553,11 @@ Widget.__init__(self, master, "ttk::button", kw) + def invoke(self): + """Invokes the command associated with the button.""" + return self.tk.call(self._w, "invoke") + + class Checkbutton(Widget): """Ttk Checkbutton widget which is either in on- or off-state.""" From buildbot at python.org Thu Jun 5 08:22:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 06:22:32 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20080605062232.97B3B1E4003@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%20trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: The web-page 'force build' button was pressed by 'cortesi': test Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Thu Jun 5 08:31:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 06:31:21 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20080605063122.1E7671E4003@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: The web-page 'force build' button was pressed by 'cortesi': testing Build Source Stamp: [branch 2.5] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Thu Jun 5 09:41:23 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 5 Jun 2008 09:41:23 +0200 (CEST) Subject: [Python-checkins] r63953 - doctools/trunk/sphinx/web Message-ID: <20080605074123.6A1FE1E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 5 09:41:22 2008 New Revision: 63953 Log: Remove the old web package. Removed: doctools/trunk/sphinx/web/ From python-checkins at python.org Thu Jun 5 10:58:44 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 5 Jun 2008 10:58:44 +0200 (CEST) Subject: [Python-checkins] r63954 - in doctools/trunk: Makefile sphinx/application.py sphinx/builder.py sphinx/config.py sphinx/environment.py tests tests/path.py tests/root tests/root/Makefile tests/root/_static tests/root/_templates tests/root/conf.py tests/root/contents.txt tests/root/ext.py tests/run.py tests/test_config.py tests/util.py Message-ID: <20080605085844.635E51E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 5 10:58:43 2008 New Revision: 63954 Log: Add a test suite skeleton, a first test for sphinx.config, and fix a bug in config. Added: doctools/trunk/tests/ doctools/trunk/tests/path.py (contents, props changed) doctools/trunk/tests/root/ doctools/trunk/tests/root/Makefile (contents, props changed) doctools/trunk/tests/root/_static/ doctools/trunk/tests/root/_templates/ doctools/trunk/tests/root/conf.py (contents, props changed) doctools/trunk/tests/root/contents.txt (contents, props changed) doctools/trunk/tests/root/ext.py (contents, props changed) doctools/trunk/tests/run.py (contents, props changed) doctools/trunk/tests/test_config.py (contents, props changed) doctools/trunk/tests/util.py (contents, props changed) Modified: doctools/trunk/Makefile doctools/trunk/sphinx/application.py doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/config.py doctools/trunk/sphinx/environment.py Modified: doctools/trunk/Makefile ============================================================================== --- doctools/trunk/Makefile (original) +++ doctools/trunk/Makefile Thu Jun 5 10:58:43 2008 @@ -25,3 +25,6 @@ reindent: @$(PYTHON) utils/reindent.py -r -B . + +test: + @cd tests; $(PYTHON) run.py Modified: doctools/trunk/sphinx/application.py ============================================================================== --- doctools/trunk/sphinx/application.py (original) +++ doctools/trunk/sphinx/application.py Thu Jun 5 10:58:43 2008 @@ -53,6 +53,8 @@ 'html-page-context': 'pagename, context, doctree or None', } +CONFIG_FILENAME = 'conf.py' + class Sphinx(object): def __init__(self, srcdir, confdir, outdir, doctreedir, buildername, @@ -74,7 +76,7 @@ self._events = events.copy() # read config - self.config = Config(confdir, 'conf.py', confoverrides) + self.config = Config(confdir, CONFIG_FILENAME, confoverrides) # load all extension modules for extension in self.config.extensions: @@ -176,9 +178,9 @@ self.builderclasses[builder.name] = builder def add_config_value(self, name, default, rebuild_env): - if name in self.config.config_values: + if name in self.config.values: raise ExtensionError('Config value %r already present' % name) - self.config.config_values[name] = (default, rebuild_env) + self.config.values[name] = (default, rebuild_env) def add_event(self, name): if name in self._events: Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Thu Jun 5 10:58:43 2008 @@ -127,7 +127,7 @@ if not self.freshenv: try: self.info(bold('trying to load pickled env... '), nonl=True) - self.env = BuildEnvironment.frompickle( + self.env = BuildEnvironment.frompickle(self.config, path.join(self.doctreedir, ENV_PICKLE_FILENAME)) self.info('done') except Exception, err: Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Thu Jun 5 10:58:43 2008 @@ -79,6 +79,7 @@ def __init__(self, dirname, filename, overrides): self.overrides = overrides + self.values = Config.config_values.copy() config = {'__file__': path.join(dirname, filename)} olddir = os.getcwd() try: @@ -95,17 +96,17 @@ def init_values(self): config = self._raw_config config.update(self.overrides) - for name in self._raw_config: - if name in self.config_values: + for name in config: + if name in self.values: self.__dict__[name] = config[name] del self._raw_config def __getattr__(self, name): if name.startswith('_'): raise AttributeError(name) - if name not in self.config_values: + if name not in self.values: raise AttributeError('No such config value: %s' % name) - default = self.config_values[name][0] + default = self.values[name][0] if callable(default): return default(self) return default @@ -120,4 +121,4 @@ delattr(self, name) def __contains__(self, name): - return name in self.config_values + return name in self.values Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Thu Jun 5 10:58:43 2008 @@ -163,12 +163,13 @@ # --------- ENVIRONMENT PERSISTENCE ---------------------------------------- @staticmethod - def frompickle(filename): + def frompickle(config, filename): picklefile = open(filename, 'rb') try: env = pickle.load(picklefile) finally: picklefile.close() + env.config.values = config.values if env.version != ENV_VERSION: raise IOError('env version not current') return env @@ -177,6 +178,8 @@ # remove unpicklable attributes warnfunc = self._warnfunc self.set_warnfunc(None) + values = self.config.values + del self.config.values picklefile = open(filename, 'wb') # remove potentially pickling-problematic values from config for key, val in vars(self.config).items(): @@ -189,7 +192,8 @@ pickle.dump(self, picklefile, pickle.HIGHEST_PROTOCOL) finally: picklefile.close() - # reset stream + # reset attributes + self.config.values = values self.set_warnfunc(warnfunc) # --------- ENVIRONMENT INITIALIZATION ------------------------------------- Added: doctools/trunk/tests/path.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/path.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,970 @@ +""" path.py - An object representing a path to a file or directory. + +Example: + +from path import path +d = path('/home/guido/bin') +for f in d.files('*.py'): + f.chmod(0755) + +This module requires Python 2.2 or later. + + +URL: http://www.jorendorff.com/articles/python/path +Author: Jason Orendorff (and others - see the url!) +Date: 9 Mar 2007 +""" + + +# TODO +# - Tree-walking functions don't avoid symlink loops. Matt Harrison +# sent me a patch for this. +# - Bug in write_text(). It doesn't support Universal newline mode. +# - Better error message in listdir() when self isn't a +# directory. (On Windows, the error message really sucks.) +# - Make sure everything has a good docstring. +# - Add methods for regex find and replace. +# - guess_content_type() method? +# - Perhaps support arguments to touch(). + +from __future__ import generators + +import sys, warnings, os, fnmatch, glob, shutil, codecs, md5 + +__version__ = '2.2' +__all__ = ['path'] + +# Platform-specific support for path.owner +if os.name == 'nt': + try: + import win32security + except ImportError: + win32security = None +else: + try: + import pwd + except ImportError: + pwd = None + +# Pre-2.3 support. Are unicode filenames supported? +_base = str +_getcwd = os.getcwd +try: + if os.path.supports_unicode_filenames: + _base = unicode + _getcwd = os.getcwdu +except AttributeError: + pass + +# Pre-2.3 workaround for booleans +try: + True, False +except NameError: + True, False = 1, 0 + +# Pre-2.3 workaround for basestring. +try: + basestring +except NameError: + basestring = (str, unicode) + +# Universal newline support +_textmode = 'r' +if hasattr(file, 'newlines'): + _textmode = 'U' + + +class TreeWalkWarning(Warning): + pass + +class path(_base): + """ Represents a filesystem path. + + For documentation on individual methods, consult their + counterparts in os.path. + """ + + # --- Special Python methods. + + def __repr__(self): + return 'path(%s)' % _base.__repr__(self) + + # Adding a path and a string yields a path. + def __add__(self, more): + try: + resultStr = _base.__add__(self, more) + except TypeError: #Python bug + resultStr = NotImplemented + if resultStr is NotImplemented: + return resultStr + return self.__class__(resultStr) + + def __radd__(self, other): + if isinstance(other, basestring): + return self.__class__(other.__add__(self)) + else: + return NotImplemented + + # The / operator joins paths. + def __div__(self, rel): + """ fp.__div__(rel) == fp / rel == fp.joinpath(rel) + + Join two path components, adding a separator character if + needed. + """ + return self.__class__(os.path.join(self, rel)) + + # Make the / operator work even when true division is enabled. + __truediv__ = __div__ + + def getcwd(cls): + """ Return the current working directory as a path object. """ + return cls(_getcwd()) + getcwd = classmethod(getcwd) + + + # --- Operations on path strings. + + isabs = os.path.isabs + def abspath(self): return self.__class__(os.path.abspath(self)) + def normcase(self): return self.__class__(os.path.normcase(self)) + def normpath(self): return self.__class__(os.path.normpath(self)) + def realpath(self): return self.__class__(os.path.realpath(self)) + def expanduser(self): return self.__class__(os.path.expanduser(self)) + def expandvars(self): return self.__class__(os.path.expandvars(self)) + def dirname(self): return self.__class__(os.path.dirname(self)) + basename = os.path.basename + + def expand(self): + """ Clean up a filename by calling expandvars(), + expanduser(), and normpath() on it. + + This is commonly everything needed to clean up a filename + read from a configuration file, for example. + """ + return self.expandvars().expanduser().normpath() + + def _get_namebase(self): + base, ext = os.path.splitext(self.name) + return base + + def _get_ext(self): + f, ext = os.path.splitext(_base(self)) + return ext + + def _get_drive(self): + drive, r = os.path.splitdrive(self) + return self.__class__(drive) + + parent = property( + dirname, None, None, + """ This path's parent directory, as a new path object. + + For example, path('/usr/local/lib/libpython.so').parent == path('/usr/local/lib') + """) + + name = property( + basename, None, None, + """ The name of this file or directory without the full path. + + For example, path('/usr/local/lib/libpython.so').name == 'libpython.so' + """) + + namebase = property( + _get_namebase, None, None, + """ The same as path.name, but with one file extension stripped off. + + For example, path('/home/guido/python.tar.gz').name == 'python.tar.gz', + but path('/home/guido/python.tar.gz').namebase == 'python.tar' + """) + + ext = property( + _get_ext, None, None, + """ The file extension, for example '.py'. """) + + drive = property( + _get_drive, None, None, + """ The drive specifier, for example 'C:'. + This is always empty on systems that don't use drive specifiers. + """) + + def splitpath(self): + """ p.splitpath() -> Return (p.parent, p.name). """ + parent, child = os.path.split(self) + return self.__class__(parent), child + + def splitdrive(self): + """ p.splitdrive() -> Return (p.drive, ). + + Split the drive specifier from this path. If there is + no drive specifier, p.drive is empty, so the return value + is simply (path(''), p). This is always the case on Unix. + """ + drive, rel = os.path.splitdrive(self) + return self.__class__(drive), rel + + def splitext(self): + """ p.splitext() -> Return (p.stripext(), p.ext). + + Split the filename extension from this path and return + the two parts. Either part may be empty. + + The extension is everything from '.' to the end of the + last path segment. This has the property that if + (a, b) == p.splitext(), then a + b == p. + """ + filename, ext = os.path.splitext(self) + return self.__class__(filename), ext + + def stripext(self): + """ p.stripext() -> Remove one file extension from the path. + + For example, path('/home/guido/python.tar.gz').stripext() + returns path('/home/guido/python.tar'). + """ + return self.splitext()[0] + + if hasattr(os.path, 'splitunc'): + def splitunc(self): + unc, rest = os.path.splitunc(self) + return self.__class__(unc), rest + + def _get_uncshare(self): + unc, r = os.path.splitunc(self) + return self.__class__(unc) + + uncshare = property( + _get_uncshare, None, None, + """ The UNC mount point for this path. + This is empty for paths on local drives. """) + + def joinpath(self, *args): + """ Join two or more path components, adding a separator + character (os.sep) if needed. Returns a new path + object. + """ + return self.__class__(os.path.join(self, *args)) + + def splitall(self): + r""" Return a list of the path components in this path. + + The first item in the list will be a path. Its value will be + either os.curdir, os.pardir, empty, or the root directory of + this path (for example, '/' or 'C:\\'). The other items in + the list will be strings. + + path.path.joinpath(*result) will yield the original path. + """ + parts = [] + loc = self + while loc != os.curdir and loc != os.pardir: + prev = loc + loc, child = prev.splitpath() + if loc == prev: + break + parts.append(child) + parts.append(loc) + parts.reverse() + return parts + + def relpath(self): + """ Return this path as a relative path, + based from the current working directory. + """ + cwd = self.__class__(os.getcwd()) + return cwd.relpathto(self) + + def relpathto(self, dest): + """ Return a relative path from self to dest. + + If there is no relative path from self to dest, for example if + they reside on different drives in Windows, then this returns + dest.abspath(). + """ + origin = self.abspath() + dest = self.__class__(dest).abspath() + + orig_list = origin.normcase().splitall() + # Don't normcase dest! We want to preserve the case. + dest_list = dest.splitall() + + if orig_list[0] != os.path.normcase(dest_list[0]): + # Can't get here from there. + return dest + + # Find the location where the two paths start to differ. + i = 0 + for start_seg, dest_seg in zip(orig_list, dest_list): + if start_seg != os.path.normcase(dest_seg): + break + i += 1 + + # Now i is the point where the two paths diverge. + # Need a certain number of "os.pardir"s to work up + # from the origin to the point of divergence. + segments = [os.pardir] * (len(orig_list) - i) + # Need to add the diverging part of dest_list. + segments += dest_list[i:] + if len(segments) == 0: + # If they happen to be identical, use os.curdir. + relpath = os.curdir + else: + relpath = os.path.join(*segments) + return self.__class__(relpath) + + # --- Listing, searching, walking, and matching + + def listdir(self, pattern=None): + """ D.listdir() -> List of items in this directory. + + Use D.files() or D.dirs() instead if you want a listing + of just files or just subdirectories. + + The elements of the list are path objects. + + With the optional 'pattern' argument, this only lists + items whose names match the given pattern. + """ + names = os.listdir(self) + if pattern is not None: + names = fnmatch.filter(names, pattern) + return [self / child for child in names] + + def dirs(self, pattern=None): + """ D.dirs() -> List of this directory's subdirectories. + + The elements of the list are path objects. + This does not walk recursively into subdirectories + (but see path.walkdirs). + + With the optional 'pattern' argument, this only lists + directories whose names match the given pattern. For + example, d.dirs('build-*'). + """ + return [p for p in self.listdir(pattern) if p.isdir()] + + def files(self, pattern=None): + """ D.files() -> List of the files in this directory. + + The elements of the list are path objects. + This does not walk into subdirectories (see path.walkfiles). + + With the optional 'pattern' argument, this only lists files + whose names match the given pattern. For example, + d.files('*.pyc'). + """ + + return [p for p in self.listdir(pattern) if p.isfile()] + + def walk(self, pattern=None, errors='strict'): + """ D.walk() -> iterator over files and subdirs, recursively. + + The iterator yields path objects naming each child item of + this directory and its descendants. This requires that + D.isdir(). + + This performs a depth-first traversal of the directory tree. + Each directory is returned just before all its children. + + The errors= keyword argument controls behavior when an + error occurs. The default is 'strict', which causes an + exception. The other allowed values are 'warn', which + reports the error via warnings.warn(), and 'ignore'. + """ + if errors not in ('strict', 'warn', 'ignore'): + raise ValueError("invalid errors parameter") + + try: + childList = self.listdir() + except Exception: + if errors == 'ignore': + return + elif errors == 'warn': + warnings.warn( + "Unable to list directory '%s': %s" + % (self, sys.exc_info()[1]), + TreeWalkWarning) + return + else: + raise + + for child in childList: + if pattern is None or child.fnmatch(pattern): + yield child + try: + isdir = child.isdir() + except Exception: + if errors == 'ignore': + isdir = False + elif errors == 'warn': + warnings.warn( + "Unable to access '%s': %s" + % (child, sys.exc_info()[1]), + TreeWalkWarning) + isdir = False + else: + raise + + if isdir: + for item in child.walk(pattern, errors): + yield item + + def walkdirs(self, pattern=None, errors='strict'): + """ D.walkdirs() -> iterator over subdirs, recursively. + + With the optional 'pattern' argument, this yields only + directories whose names match the given pattern. For + example, mydir.walkdirs('*test') yields only directories + with names ending in 'test'. + + The errors= keyword argument controls behavior when an + error occurs. The default is 'strict', which causes an + exception. The other allowed values are 'warn', which + reports the error via warnings.warn(), and 'ignore'. + """ + if errors not in ('strict', 'warn', 'ignore'): + raise ValueError("invalid errors parameter") + + try: + dirs = self.dirs() + except Exception: + if errors == 'ignore': + return + elif errors == 'warn': + warnings.warn( + "Unable to list directory '%s': %s" + % (self, sys.exc_info()[1]), + TreeWalkWarning) + return + else: + raise + + for child in dirs: + if pattern is None or child.fnmatch(pattern): + yield child + for subsubdir in child.walkdirs(pattern, errors): + yield subsubdir + + def walkfiles(self, pattern=None, errors='strict'): + """ D.walkfiles() -> iterator over files in D, recursively. + + The optional argument, pattern, limits the results to files + with names that match the pattern. For example, + mydir.walkfiles('*.tmp') yields only files with the .tmp + extension. + """ + if errors not in ('strict', 'warn', 'ignore'): + raise ValueError("invalid errors parameter") + + try: + childList = self.listdir() + except Exception: + if errors == 'ignore': + return + elif errors == 'warn': + warnings.warn( + "Unable to list directory '%s': %s" + % (self, sys.exc_info()[1]), + TreeWalkWarning) + return + else: + raise + + for child in childList: + try: + isfile = child.isfile() + isdir = not isfile and child.isdir() + except: + if errors == 'ignore': + continue + elif errors == 'warn': + warnings.warn( + "Unable to access '%s': %s" + % (self, sys.exc_info()[1]), + TreeWalkWarning) + continue + else: + raise + + if isfile: + if pattern is None or child.fnmatch(pattern): + yield child + elif isdir: + for f in child.walkfiles(pattern, errors): + yield f + + def fnmatch(self, pattern): + """ Return True if self.name matches the given pattern. + + pattern - A filename pattern with wildcards, + for example '*.py'. + """ + return fnmatch.fnmatch(self.name, pattern) + + def glob(self, pattern): + """ Return a list of path objects that match the pattern. + + pattern - a path relative to this directory, with wildcards. + + For example, path('/users').glob('*/bin/*') returns a list + of all the files users have in their bin directories. + """ + cls = self.__class__ + return [cls(s) for s in glob.glob(_base(self / pattern))] + + + # --- Reading or writing an entire file at once. + + def open(self, mode='r'): + """ Open this file. Return a file object. """ + return file(self, mode) + + def bytes(self): + """ Open this file, read all bytes, return them as a string. """ + f = self.open('rb') + try: + return f.read() + finally: + f.close() + + def write_bytes(self, bytes, append=False): + """ Open this file and write the given bytes to it. + + Default behavior is to overwrite any existing file. + Call p.write_bytes(bytes, append=True) to append instead. + """ + if append: + mode = 'ab' + else: + mode = 'wb' + f = self.open(mode) + try: + f.write(bytes) + finally: + f.close() + + def text(self, encoding=None, errors='strict'): + r""" Open this file, read it in, return the content as a string. + + This uses 'U' mode in Python 2.3 and later, so '\r\n' and '\r' + are automatically translated to '\n'. + + Optional arguments: + + encoding - The Unicode encoding (or character set) of + the file. If present, the content of the file is + decoded and returned as a unicode object; otherwise + it is returned as an 8-bit str. + errors - How to handle Unicode errors; see help(str.decode) + for the options. Default is 'strict'. + """ + if encoding is None: + # 8-bit + f = self.open(_textmode) + try: + return f.read() + finally: + f.close() + else: + # Unicode + f = codecs.open(self, 'r', encoding, errors) + # (Note - Can't use 'U' mode here, since codecs.open + # doesn't support 'U' mode, even in Python 2.3.) + try: + t = f.read() + finally: + f.close() + return (t.replace(u'\r\n', u'\n') + .replace(u'\r\x85', u'\n') + .replace(u'\r', u'\n') + .replace(u'\x85', u'\n') + .replace(u'\u2028', u'\n')) + + def write_text(self, text, encoding=None, errors='strict', linesep=os.linesep, append=False): + r""" Write the given text to this file. + + The default behavior is to overwrite any existing file; + to append instead, use the 'append=True' keyword argument. + + There are two differences between path.write_text() and + path.write_bytes(): newline handling and Unicode handling. + See below. + + Parameters: + + - text - str/unicode - The text to be written. + + - encoding - str - The Unicode encoding that will be used. + This is ignored if 'text' isn't a Unicode string. + + - errors - str - How to handle Unicode encoding errors. + Default is 'strict'. See help(unicode.encode) for the + options. This is ignored if 'text' isn't a Unicode + string. + + - linesep - keyword argument - str/unicode - The sequence of + characters to be used to mark end-of-line. The default is + os.linesep. You can also specify None; this means to + leave all newlines as they are in 'text'. + + - append - keyword argument - bool - Specifies what to do if + the file already exists (True: append to the end of it; + False: overwrite it.) The default is False. + + + --- Newline handling. + + write_text() converts all standard end-of-line sequences + ('\n', '\r', and '\r\n') to your platform's default end-of-line + sequence (see os.linesep; on Windows, for example, the + end-of-line marker is '\r\n'). + + If you don't like your platform's default, you can override it + using the 'linesep=' keyword argument. If you specifically want + write_text() to preserve the newlines as-is, use 'linesep=None'. + + This applies to Unicode text the same as to 8-bit text, except + there are three additional standard Unicode end-of-line sequences: + u'\x85', u'\r\x85', and u'\u2028'. + + (This is slightly different from when you open a file for + writing with fopen(filename, "w") in C or file(filename, 'w') + in Python.) + + + --- Unicode + + If 'text' isn't Unicode, then apart from newline handling, the + bytes are written verbatim to the file. The 'encoding' and + 'errors' arguments are not used and must be omitted. + + If 'text' is Unicode, it is first converted to bytes using the + specified 'encoding' (or the default encoding if 'encoding' + isn't specified). The 'errors' argument applies only to this + conversion. + + """ + if isinstance(text, unicode): + if linesep is not None: + # Convert all standard end-of-line sequences to + # ordinary newline characters. + text = (text.replace(u'\r\n', u'\n') + .replace(u'\r\x85', u'\n') + .replace(u'\r', u'\n') + .replace(u'\x85', u'\n') + .replace(u'\u2028', u'\n')) + text = text.replace(u'\n', linesep) + if encoding is None: + encoding = sys.getdefaultencoding() + bytes = text.encode(encoding, errors) + else: + # It is an error to specify an encoding if 'text' is + # an 8-bit string. + assert encoding is None + + if linesep is not None: + text = (text.replace('\r\n', '\n') + .replace('\r', '\n')) + bytes = text.replace('\n', linesep) + + self.write_bytes(bytes, append) + + def lines(self, encoding=None, errors='strict', retain=True): + r""" Open this file, read all lines, return them in a list. + + Optional arguments: + encoding - The Unicode encoding (or character set) of + the file. The default is None, meaning the content + of the file is read as 8-bit characters and returned + as a list of (non-Unicode) str objects. + errors - How to handle Unicode errors; see help(str.decode) + for the options. Default is 'strict' + retain - If true, retain newline characters; but all newline + character combinations ('\r', '\n', '\r\n') are + translated to '\n'. If false, newline characters are + stripped off. Default is True. + + This uses 'U' mode in Python 2.3 and later. + """ + if encoding is None and retain: + f = self.open(_textmode) + try: + return f.readlines() + finally: + f.close() + else: + return self.text(encoding, errors).splitlines(retain) + + def write_lines(self, lines, encoding=None, errors='strict', + linesep=os.linesep, append=False): + r""" Write the given lines of text to this file. + + By default this overwrites any existing file at this path. + + This puts a platform-specific newline sequence on every line. + See 'linesep' below. + + lines - A list of strings. + + encoding - A Unicode encoding to use. This applies only if + 'lines' contains any Unicode strings. + + errors - How to handle errors in Unicode encoding. This + also applies only to Unicode strings. + + linesep - The desired line-ending. This line-ending is + applied to every line. If a line already has any + standard line ending ('\r', '\n', '\r\n', u'\x85', + u'\r\x85', u'\u2028'), that will be stripped off and + this will be used instead. The default is os.linesep, + which is platform-dependent ('\r\n' on Windows, '\n' on + Unix, etc.) Specify None to write the lines as-is, + like file.writelines(). + + Use the keyword argument append=True to append lines to the + file. The default is to overwrite the file. Warning: + When you use this with Unicode data, if the encoding of the + existing data in the file is different from the encoding + you specify with the encoding= parameter, the result is + mixed-encoding data, which can really confuse someone trying + to read the file later. + """ + if append: + mode = 'ab' + else: + mode = 'wb' + f = self.open(mode) + try: + for line in lines: + isUnicode = isinstance(line, unicode) + if linesep is not None: + # Strip off any existing line-end and add the + # specified linesep string. + if isUnicode: + if line[-2:] in (u'\r\n', u'\x0d\x85'): + line = line[:-2] + elif line[-1:] in (u'\r', u'\n', + u'\x85', u'\u2028'): + line = line[:-1] + else: + if line[-2:] == '\r\n': + line = line[:-2] + elif line[-1:] in ('\r', '\n'): + line = line[:-1] + line += linesep + if isUnicode: + if encoding is None: + encoding = sys.getdefaultencoding() + line = line.encode(encoding, errors) + f.write(line) + finally: + f.close() + + def read_md5(self): + """ Calculate the md5 hash for this file. + + This reads through the entire file. + """ + f = self.open('rb') + try: + m = md5.new() + while True: + d = f.read(8192) + if not d: + break + m.update(d) + finally: + f.close() + return m.digest() + + # --- Methods for querying the filesystem. + + exists = os.path.exists + isdir = os.path.isdir + isfile = os.path.isfile + islink = os.path.islink + ismount = os.path.ismount + + if hasattr(os.path, 'samefile'): + samefile = os.path.samefile + + getatime = os.path.getatime + atime = property( + getatime, None, None, + """ Last access time of the file. """) + + getmtime = os.path.getmtime + mtime = property( + getmtime, None, None, + """ Last-modified time of the file. """) + + if hasattr(os.path, 'getctime'): + getctime = os.path.getctime + ctime = property( + getctime, None, None, + """ Creation time of the file. """) + + getsize = os.path.getsize + size = property( + getsize, None, None, + """ Size of the file, in bytes. """) + + if hasattr(os, 'access'): + def access(self, mode): + """ Return true if current user has access to this path. + + mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK + """ + return os.access(self, mode) + + def stat(self): + """ Perform a stat() system call on this path. """ + return os.stat(self) + + def lstat(self): + """ Like path.stat(), but do not follow symbolic links. """ + return os.lstat(self) + + def get_owner(self): + r""" Return the name of the owner of this file or directory. + + This follows symbolic links. + + On Windows, this returns a name of the form ur'DOMAIN\User Name'. + On Windows, a group can own a file or directory. + """ + if os.name == 'nt': + if win32security is None: + raise Exception("path.owner requires win32all to be installed") + desc = win32security.GetFileSecurity( + self, win32security.OWNER_SECURITY_INFORMATION) + sid = desc.GetSecurityDescriptorOwner() + account, domain, typecode = win32security.LookupAccountSid(None, sid) + return domain + u'\\' + account + else: + if pwd is None: + raise NotImplementedError("path.owner is not implemented on this platform.") + st = self.stat() + return pwd.getpwuid(st.st_uid).pw_name + + owner = property( + get_owner, None, None, + """ Name of the owner of this file or directory. """) + + if hasattr(os, 'statvfs'): + def statvfs(self): + """ Perform a statvfs() system call on this path. """ + return os.statvfs(self) + + if hasattr(os, 'pathconf'): + def pathconf(self, name): + return os.pathconf(self, name) + + + # --- Modifying operations on files and directories + + def utime(self, times): + """ Set the access and modified times of this file. """ + os.utime(self, times) + + def chmod(self, mode): + os.chmod(self, mode) + + if hasattr(os, 'chown'): + def chown(self, uid, gid): + os.chown(self, uid, gid) + + def rename(self, new): + os.rename(self, new) + + def renames(self, new): + os.renames(self, new) + + + # --- Create/delete operations on directories + + def mkdir(self, mode=0777): + os.mkdir(self, mode) + + def makedirs(self, mode=0777): + os.makedirs(self, mode) + + def rmdir(self): + os.rmdir(self) + + def removedirs(self): + os.removedirs(self) + + + # --- Modifying operations on files + + def touch(self): + """ Set the access/modified times of this file to the current time. + Create the file if it does not exist. + """ + fd = os.open(self, os.O_WRONLY | os.O_CREAT, 0666) + os.close(fd) + os.utime(self, None) + + def remove(self): + os.remove(self) + + def unlink(self): + os.unlink(self) + + + # --- Links + + if hasattr(os, 'link'): + def link(self, newpath): + """ Create a hard link at 'newpath', pointing to this file. """ + os.link(self, newpath) + + if hasattr(os, 'symlink'): + def symlink(self, newlink): + """ Create a symbolic link at 'newlink', pointing here. """ + os.symlink(self, newlink) + + if hasattr(os, 'readlink'): + def readlink(self): + """ Return the path to which this symbolic link points. + + The result may be an absolute or a relative path. + """ + return self.__class__(os.readlink(self)) + + def readlinkabs(self): + """ Return the path to which this symbolic link points. + + The result is always an absolute path. + """ + p = self.readlink() + if p.isabs(): + return p + else: + return (self.parent / p).abspath() + + + # --- High-level functions from shutil + + copyfile = shutil.copyfile + copymode = shutil.copymode + copystat = shutil.copystat + copy = shutil.copy + copy2 = shutil.copy2 + copytree = shutil.copytree + if hasattr(shutil, 'move'): + move = shutil.move + rmtree = shutil.rmtree + + + # --- Special stuff from os + + if hasattr(os, 'chroot'): + def chroot(self): + os.chroot(self) + + if hasattr(os, 'startfile'): + def startfile(self): + os.startfile(self) + Added: doctools/trunk/tests/root/Makefile ============================================================================== --- (empty file) +++ doctools/trunk/tests/root/Makefile Thu Jun 5 10:58:43 2008 @@ -0,0 +1,70 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + -rm -rf _build/* + +html: + mkdir -p _build/html _build/doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html + @echo + @echo "Build finished. The HTML pages are in _build/html." + +pickle: + mkdir -p _build/pickle _build/doctrees + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle + @echo + @echo "Build finished; now you can process the pickle files or run" + @echo " sphinx-web _build/pickle" + @echo "to start the sphinx-web server." + +web: pickle + +htmlhelp: + mkdir -p _build/htmlhelp _build/doctrees + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in _build/htmlhelp." + +latex: + mkdir -p _build/latex _build/doctrees + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex + @echo + @echo "Build finished; the LaTeX files are in _build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + mkdir -p _build/changes _build/doctrees + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes + @echo + @echo "The overview file is in _build/changes." + +linkcheck: + mkdir -p _build/linkcheck _build/doctrees + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in _build/linkcheck/output.txt." Added: doctools/trunk/tests/root/conf.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/root/conf.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,173 @@ +# -*- coding: utf-8 -*- +# +# Sphinx Tests documentation build configuration file, created by +# sphinx-quickstart on Wed Jun 4 23:49:58 2008. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# All configuration values have a default value; values that are commented out +# serve to show the default value. + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +sys.path.append(os.path.abspath('.')) + +# General configuration +# --------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['ext'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.txt' + +# The master toctree document. +master_doc = 'index' + +# General substitutions. +project = 'Sphinx Tests' +copyright = '2008, Georg Brandl' + +# The default replacements for |version| and |release|, also used in various +# other places throughout the built documents. +# +# The short X.Y version. +version = '0.4' +# The full version, including alpha/beta/rc tags. +release = '0.4alpha1' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directories, that shouldn't be searched +# for source files. +#exclude_dirs = [] + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# Options for HTML output +# ----------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +html_style = 'default.css' + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (within the static path) to place at the top of +# the sidebar. +#html_logo = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the reST sources are included in the HTML build as _sources/. +#html_copy_source = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'SphinxTestsdoc' + + +# Options for LaTeX output +# ------------------------ + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). +latex_documents = [ + ('contents', 'SphinxTests.tex', 'Sphinx Tests Documentation', 'Georg Brandl', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True + +value_from_conf_py = 84 + + +def setup(app): + app.add_config_value('value_from_conf_py', 42, False) Added: doctools/trunk/tests/root/contents.txt ============================================================================== --- (empty file) +++ doctools/trunk/tests/root/contents.txt Thu Jun 5 10:58:43 2008 @@ -0,0 +1,19 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + Added: doctools/trunk/tests/root/ext.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/root/ext.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,4 @@ +# Test extension module + +def setup(app): + app.add_config_value('value_from_ext', [], False) Added: doctools/trunk/tests/run.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/run.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Sphinx unit test driver + ~~~~~~~~~~~~~~~~~~~~~~~ + + This script runs the Sphinx unit test suite. + + :copyright: 2008 by Georg Brandl. + :license: BSD. +""" + +import sys +from os import path + +# always test the sphinx package from this directory +sys.path.insert(0, path.join(path.dirname(__file__), path.pardir)) + +try: + import nose +except ImportError: + print "The nose package is needed to run the Sphinx test suite." + sys.exit(1) + +print "Running Sphinx test suite..." +nose.main() Added: doctools/trunk/tests/test_config.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/test_config.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +""" + test_config + ~~~~~~~~~~~ + + Test the sphinx.config.Config class and its handling in the + Application class. + + :copyright: 2008 by Georg Brandl. + :license: BSD. +""" + +from util import * + +from sphinx.application import ExtensionError + + +def test_core_config(): + overrides = {'master_doc': 'master', 'nonexisting_value': 'True'} + cfg = TestApp(confoverrides=overrides).config + + # simple values + assert 'project' in cfg.__dict__ + assert cfg.project == 'Sphinx Tests' + assert cfg.templates_path == ['_templates'] + + # overrides + assert cfg.master_doc == 'master' + + # simple default values + assert 'exclude_dirs' not in cfg.__dict__ + assert cfg.exclude_dirs == [] + assert cfg.show_authors == False + + # complex default values + assert 'html_title' not in cfg.__dict__ + assert cfg.html_title == 'Sphinx Tests v0.4alpha1 documentation' + + # complex default values mustn't raise + for valuename in cfg.config_values: + getattr(cfg, valuename) + + # "contains" gives True both for set and unset values + assert 'project' in cfg + assert 'html_title' in cfg + + # invalid values + raises(AttributeError, getattr, cfg, '_value') + raises(AttributeError, getattr, cfg, 'nonexisting_value') + + # non-value attributes are deleted from the namespace + raises(AttributeError, getattr, cfg, 'sys') + + # setting attributes + cfg.project = 'Foo' + assert cfg.project == 'Foo' + + # alternative access via item interface + cfg['project'] = 'Sphinx Tests' + assert cfg['project'] == cfg.project == 'Sphinx Tests' + + +def test_extension_values(): + app = TestApp() + cfg = app.config + + # default value + assert cfg.value_from_ext == [] + # non-default value + assert cfg.value_from_conf_py == 84 + + # no duplicate values allowed + raises_msg(ExtensionError, 'already present', app.add_config_value, + 'html_title', 'x', True) + raises_msg(ExtensionError, 'already present', app.add_config_value, + 'value_from_ext', 'x', True) Added: doctools/trunk/tests/util.py ============================================================================== --- (empty file) +++ doctools/trunk/tests/util.py Thu Jun 5 10:58:43 2008 @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +""" + Sphinx test suite utilities + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: 2008 by Georg Brandl. + :license: BSD. +""" + +import sys +import StringIO +import tempfile + +from sphinx import application, builder + +from path import path + + +__all__ = [ + 'raises', 'raises_msg', + 'ErrorOutput', 'TestApp', + 'with_tempdir', 'write_file', +] + + +def _excstr(exc): + if type(exc) is tuple: + return str(tuple(map(_excstr, exc))) + return exc.__name__ + +def raises(exc, func, *args, **kwds): + """ + Raise :exc:`AssertionError` if ``func(*args, **kwds)`` does not + raise *exc*. + """ + try: + func(*args, **kwds) + except exc: + pass + else: + raise AssertionError('%s did not raise %s' % + (func.__name__, _excstr(exc))) + +def raises_msg(exc, msg, func, *args, **kwds): + """ + Raise :exc:`AssertionError` if ``func(*args, **kwds)`` does not + raise *exc*, and check if the message contains *msg*. + """ + try: + func(*args, **kwds) + except exc, err: + assert msg in str(err) + else: + raise AssertionError('%s did not raise %s' % + (func.__name__, _excstr(exc))) + + +class ErrorOutput(object): + """ + File-like object that raises :exc:`AssertionError` on ``write()``. + """ + def __init__(self, name): + self.name = name + + def write(self, text): + assert False, 'tried to write %r to %s' % (text, self.name) + + +class TestApp(application.Sphinx): + """ + A subclass of :class:`Sphinx` that runs on the test root, with some + better default values for the initialization parameters. + """ + + def __init__(self, srcdir=None, confdir=None, outdir=None, doctreedir=None, + buildername='html', confoverrides=None, status=None, warning=None, + freshenv=None, confname='conf.py'): + + application.CONFIG_FILENAME = confname + + if srcdir is None: + srcdir = path(__file__).parent.joinpath('root').abspath() + else: + srcdir = path(srcdir) + if confdir is None: + confdir = srcdir + if outdir is None: + outdir = srcdir.joinpath('_build', buildername) + if doctreedir is None: + doctreedir = srcdir.joinpath(srcdir, '_build', 'doctrees') + if confoverrides is None: + confoverrides = {} + if status is None: + status = StringIO.StringIO() + if warning is None: + warning = ErrorOutput('stderr') + if freshenv is None: + freshenv = True + + application.Sphinx.__init__(self, srcdir, confdir, outdir, doctreedir, + buildername, confoverrides, status, warning, + freshenv) + + +def with_tempdir(func): + def new_func(): + tempdir = path(tempfile.mkdtemp()) + func(tempdir) + tempdir.rmtree() + new_func.__name__ = func.__name__ + return new_func + + +def write_file(name, contents): + f = open(str(name), 'wb') + f.write(contents) + f.close() From python-checkins at python.org Thu Jun 5 14:58:27 2008 From: python-checkins at python.org (ronald.oussoren) Date: Thu, 5 Jun 2008 14:58:27 +0200 (CEST) Subject: [Python-checkins] r63955 - in python/trunk: Doc/library/macos.rst Include/Python.h Include/pymacconfig.h Include/pymactoolbox.h Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/distutils/util.py Lib/test/test_macos.py Mac/IDLE/Makefile.in Mac/IDLE/idlemain.py Mac/Makefile.in Mac/Modules/ColorPickermodule.c Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/OSATerminology.c Mac/Modules/ae/_AEmodule.c Mac/Modules/app/_Appmodule.c Mac/Modules/carbonevt/_CarbonEvtmodule.c Mac/Modules/cg/_CGmodule.c Mac/Modules/cm/_Cmmodule.c Mac/Modules/ctl/_Ctlmodule.c Mac/Modules/dlg/_Dlgmodule.c Mac/Modules/drag/_Dragmodule.c Mac/Modules/evt/_Evtmodule.c Mac/Modules/file/_Filemodule.c Mac/Modules/file/filesupport.py Mac/Modules/fm/_Fmmodule.c Mac/Modules/folder/_Foldermodule.c Mac/Modules/help/_Helpmodule.c Mac/Modules/ibcarbon/_IBCarbon.c Mac/Modules/icn/_Icnmodule.c Mac/Modules/launch/_Launchmodule.c Mac/Modules/list/_Listmodule.c Mac/Modules/menu/_Menumodule.c Mac/Modules/mlte/_Mltemodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/qt/_Qtmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndmodule.c Mac/Modules/te/_TEmodule.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Misc/NEWS Modules/_ctypes/cfield.c Modules/_ctypes/libffi_osx/x86/x86-darwin.S Python/mactoolboxglue.c configure configure.in pyconfig.h.in setup.py Message-ID: <20080605125827.CB0EB1E4022@bag.python.org> Author: ronald.oussoren Date: Thu Jun 5 14:58:24 2008 New Revision: 63955 Log: MacOS X: Enable 4-way universal builds This patch adds a new configure argument on OSX: --with-universal-archs=[32-bit|64-bit|all] When used with the --enable-universalsdk option this controls which CPU architectures are includes in the framework. The default is 32-bit, meaning i386 and ppc. The most useful alternative is 'all', which includes all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64). This includes limited support for the Carbon bindings in 64-bit mode as well, limited because (a) I haven't done extensive testing and (b) a large portion of the Carbon API's aren't available in 64-bit mode anyway. I've also duplicated a feature of Apple's build of python: setting the environment variable 'ARCHFLAGS' controls the '-arch' flags used for building extensions using distutils. Added: python/trunk/Include/pymacconfig.h (contents, props changed) python/trunk/Lib/test/test_macos.py (contents, props changed) Modified: python/trunk/Doc/library/macos.rst python/trunk/Include/Python.h python/trunk/Include/pymactoolbox.h python/trunk/Lib/distutils/sysconfig.py python/trunk/Lib/distutils/unixccompiler.py python/trunk/Lib/distutils/util.py python/trunk/Mac/IDLE/Makefile.in python/trunk/Mac/IDLE/idlemain.py python/trunk/Mac/Makefile.in python/trunk/Mac/Modules/ColorPickermodule.c python/trunk/Mac/Modules/MacOS.c python/trunk/Mac/Modules/Nav.c python/trunk/Mac/Modules/OSATerminology.c python/trunk/Mac/Modules/ae/_AEmodule.c python/trunk/Mac/Modules/app/_Appmodule.c python/trunk/Mac/Modules/carbonevt/_CarbonEvtmodule.c python/trunk/Mac/Modules/cg/_CGmodule.c python/trunk/Mac/Modules/cm/_Cmmodule.c python/trunk/Mac/Modules/ctl/_Ctlmodule.c python/trunk/Mac/Modules/dlg/_Dlgmodule.c python/trunk/Mac/Modules/drag/_Dragmodule.c python/trunk/Mac/Modules/evt/_Evtmodule.c python/trunk/Mac/Modules/file/_Filemodule.c python/trunk/Mac/Modules/file/filesupport.py python/trunk/Mac/Modules/fm/_Fmmodule.c python/trunk/Mac/Modules/folder/_Foldermodule.c python/trunk/Mac/Modules/help/_Helpmodule.c python/trunk/Mac/Modules/ibcarbon/_IBCarbon.c python/trunk/Mac/Modules/icn/_Icnmodule.c python/trunk/Mac/Modules/launch/_Launchmodule.c python/trunk/Mac/Modules/list/_Listmodule.c python/trunk/Mac/Modules/menu/_Menumodule.c python/trunk/Mac/Modules/mlte/_Mltemodule.c python/trunk/Mac/Modules/qd/_Qdmodule.c python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c python/trunk/Mac/Modules/qt/_Qtmodule.c python/trunk/Mac/Modules/res/_Resmodule.c python/trunk/Mac/Modules/scrap/_Scrapmodule.c python/trunk/Mac/Modules/snd/_Sndmodule.c python/trunk/Mac/Modules/te/_TEmodule.c python/trunk/Mac/Modules/win/_Winmodule.c python/trunk/Makefile.pre.in python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/cfield.c python/trunk/Modules/_ctypes/libffi_osx/x86/x86-darwin.S python/trunk/Python/mactoolboxglue.c python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in python/trunk/setup.py Modified: python/trunk/Doc/library/macos.rst ============================================================================== --- python/trunk/Doc/library/macos.rst (original) +++ python/trunk/Doc/library/macos.rst Thu Jun 5 14:58:24 2008 @@ -58,11 +58,19 @@ elaborate functionality was available), but it provides a convenient location to attach a breakpoint in a low-level debugger like :program:`gdb`. + .. note:: + + Not available in 64-bit mode. + .. function:: SysBeep() Ring the bell. + .. note:: + + Not available in 64-bit mode. + .. function:: GetTicks() @@ -74,6 +82,10 @@ Return the file creator and file type as two four-character strings. The *file* parameter can be a pathname or an ``FSSpec`` or ``FSRef`` object. + .. note:: + + It is not possible to use an ``FSSpec`` in 64-bit mode. + .. function:: SetCreatorAndType(file, creator, type) @@ -81,6 +93,9 @@ ``FSSpec`` or ``FSRef`` object. *creator* and *type* must be four character strings. + .. note:: + + It is not possible to use an ``FSSpec`` in 64-bit mode. .. function:: openrf(name [, mode]) @@ -98,3 +113,12 @@ from an application bundle either when it has been started with :program:`pythonw` instead of :program:`python` or when running as an applet. +.. function:: splash([resourceid]) + + Opens a splash screen by resource id. Use resourceid ``0`` to close + the splash screen. + + .. note:: + + Not available in 64-bit mode. + Modified: python/trunk/Include/Python.h ============================================================================== --- python/trunk/Include/Python.h (original) +++ python/trunk/Include/Python.h Thu Jun 5 14:58:24 2008 @@ -1,11 +1,11 @@ -#ifndef Py_PYTHON_H -#define Py_PYTHON_H +#ifndef Py_PYTHON_H #define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ #include "patchlevel.h" #include "pyconfig.h" +#include "pymacconfig.h" /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the * old symbol for the benefit of extension modules written before then Added: python/trunk/Include/pymacconfig.h ============================================================================== --- (empty file) +++ python/trunk/Include/pymacconfig.h Thu Jun 5 14:58:24 2008 @@ -0,0 +1,59 @@ +#ifndef PYMACCONFIG_H +#define PYMACCONFIG_H + /* + * This file moves some of the autoconf magic to compile-time + * when building on MacOSX. This is needed for building 4-way + * universal binaries and for 64-bit universal binaries because + * the values redefined below aren't configure-time constant but + * only compile-time constant in these scenarios. + */ + +#if defined(__APPLE__) + +# undef SIZEOF_LONG +# undef SIZEOF_PTHREAD_T +# undef SIZEOF_SIZE_T +# undef SIZEOF_TIME_T +# undef SIZEOF_VOID_P + +# undef VA_LIST_IS_ARRAY +# if defined(__LP64__) && defined(__x86_64__) +# define VA_LIST_IS_ARRAY 1 +# endif + +# undef HAVE_LARGEFILE_SUPPORT +# ifndef __LP64__ +# define HAVE_LARGEFILE_SUPPORT 1 +# endif + +# undef SIZEOF_LONG +# ifdef __LP64__ +# define SIZEOF_LONG 8 +# define SIZEOF_PTHREAD_T 8 +# define SIZEOF_SIZE_T 8 +# define SIZEOF_TIME_T 8 +# define SIZEOF_VOID_P 8 +# else +# define SIZEOF_LONG 4 +# define SIZEOF_PTHREAD_T 4 +# define SIZEOF_SIZE_T 4 +# define SIZEOF_TIME_T 4 +# define SIZEOF_VOID_P 4 +# endif + +# if defined(__LP64__) + /* MacOSX 10.4 (the first release to suppport 64-bit code + * at all) only supports 64-bit in the UNIX layer. + * Therefore surpress the toolbox-glue in 64-bit mode. + */ + + /* In 64-bit mode setpgrp always has no argments, in 32-bit + * mode that depends on the compilation environment + */ +# undef SETPGRP_HAVE_ARG + +# endif + +#endif /* defined(_APPLE__) */ + +#endif /* PYMACCONFIG_H */ Modified: python/trunk/Include/pymactoolbox.h ============================================================================== --- python/trunk/Include/pymactoolbox.h (original) +++ python/trunk/Include/pymactoolbox.h Thu Jun 5 14:58:24 2008 @@ -8,7 +8,10 @@ #endif #include + +#ifndef __LP64__ #include +#endif /* !__LP64__ */ /* ** Helper routines for error codes and such. @@ -18,8 +21,11 @@ PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ +#ifndef __LP64__ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert fsspec->path */ +#endif /* __LP64__ */ + /* ** These conversion routines are defined in mactoolboxglue.c itself. */ @@ -83,8 +89,10 @@ #endif /* USE_TOOLBOX_OBJECT_GLUE */ /* macfs exports */ +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ +#endif /* !__LP64__ */ int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ @@ -101,39 +109,54 @@ extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); /* Ctl exports */ +#ifndef __LP64__ extern PyObject *CtlObj_New(ControlHandle); extern int CtlObj_Convert(PyObject *, ControlHandle *); +#endif /* !__LP64__ */ /* Dlg exports */ +#ifndef __LP64__ extern PyObject *DlgObj_New(DialogPtr); extern int DlgObj_Convert(PyObject *, DialogPtr *); extern PyObject *DlgObj_WhichDialog(DialogPtr); +#endif /* !__LP64__ */ /* Drag exports */ +#ifndef __LP64__ extern PyObject *DragObj_New(DragReference); extern int DragObj_Convert(PyObject *, DragReference *); +#endif /* !__LP64__ */ /* List exports */ +#ifndef __LP64__ extern PyObject *ListObj_New(ListHandle); extern int ListObj_Convert(PyObject *, ListHandle *); +#endif /* !__LP64__ */ /* Menu exports */ +#ifndef __LP64__ extern PyObject *MenuObj_New(MenuHandle); extern int MenuObj_Convert(PyObject *, MenuHandle *); +#endif /* !__LP64__ */ /* Qd exports */ +#ifndef __LP64__ extern PyObject *GrafObj_New(GrafPtr); extern int GrafObj_Convert(PyObject *, GrafPtr *); extern PyObject *BMObj_New(BitMapPtr); extern int BMObj_Convert(PyObject *, BitMapPtr *); extern PyObject *QdRGB_New(RGBColor *); extern int QdRGB_Convert(PyObject *, RGBColor *); +#endif /* !__LP64__ */ /* Qdoffs exports */ +#ifndef __LP64__ extern PyObject *GWorldObj_New(GWorldPtr); extern int GWorldObj_Convert(PyObject *, GWorldPtr *); +#endif /* !__LP64__ */ /* Qt exports */ +#ifndef __LP64__ extern PyObject *TrackObj_New(Track); extern int TrackObj_Convert(PyObject *, Track *); extern PyObject *MovieObj_New(Movie); @@ -146,6 +169,7 @@ extern int UserDataObj_Convert(PyObject *, UserData *); extern PyObject *MediaObj_New(Media); extern int MediaObj_Convert(PyObject *, Media *); +#endif /* !__LP64__ */ /* Res exports */ extern PyObject *ResObj_New(Handle); @@ -154,13 +178,17 @@ extern int OptResObj_Convert(PyObject *, Handle *); /* TE exports */ +#ifndef __LP64__ extern PyObject *TEObj_New(TEHandle); extern int TEObj_Convert(PyObject *, TEHandle *); +#endif /* !__LP64__ */ /* Win exports */ +#ifndef __LP64__ extern PyObject *WinObj_New(WindowPtr); extern int WinObj_Convert(PyObject *, WindowPtr *); extern PyObject *WinObj_WhichWindow(WindowPtr); +#endif /* !__LP64__ */ /* CF exports */ extern PyObject *CFObj_New(CFTypeRef); Modified: python/trunk/Lib/distutils/sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/sysconfig.py (original) +++ python/trunk/Lib/distutils/sysconfig.py Thu Jun 5 14:58:24 2008 @@ -539,6 +539,26 @@ flags = re.sub('-isysroot [^ \t]*', ' ', flags) _config_vars[key] = flags + else: + + # Allow the user to override the architecture flags using + # an environment variable. + # NOTE: This name was introduced by Apple in OSX 10.5 and + # is used by several scripting languages distributed with + # that OS release. + + if 'ARCHFLAGS' in os.environ: + arch = os.environ['ARCHFLAGS'] + for key in ('LDFLAGS', 'BASECFLAGS', + # a number of derived variables. These need to be + # patched up as well. + 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = flags + ' ' + arch + _config_vars[key] = flags + if args: vals = [] for name in args: Modified: python/trunk/Lib/distutils/unixccompiler.py ============================================================================== --- python/trunk/Lib/distutils/unixccompiler.py (original) +++ python/trunk/Lib/distutils/unixccompiler.py Thu Jun 5 14:58:24 2008 @@ -64,7 +64,7 @@ stripArch = '-arch' in cc_args stripSysroot = '-isysroot' in cc_args - if stripArch: + if stripArch or 'ARCHFLAGS' in os.environ: while 1: try: index = compiler_so.index('-arch') @@ -73,6 +73,12 @@ except ValueError: break + if 'ARCHFLAGS' in os.environ and not stripArch: + # User specified different -arch flags in the environ, + # see also distutils.sysconfig + compiler_so = compiler_so + ' ' + os.environ['ARCHFLAGS'] + + if stripSysroot: try: index = compiler_so.index('-isysroot') Modified: python/trunk/Lib/distutils/util.py ============================================================================== --- python/trunk/Lib/distutils/util.py (original) +++ python/trunk/Lib/distutils/util.py Thu Jun 5 14:58:24 2008 @@ -125,12 +125,19 @@ osname = "macosx" - if (release + '.') < '10.4.' and \ - get_config_vars().get('UNIVERSALSDK', '').strip(): + if (release + '.') >= '10.4.' and \ + '-arch' in get_config_vars().get('CFLAGS', '').strip(): # The universal build will build fat binaries, but not on # systems before 10.4 + # + # Try to detect 4-way universal builds, those have machine-type + # 'universal' instead of 'fat'. + machine = 'fat' + if '-arch x86_64' in get_config_vars().get('CFLAGS'): + machine = 'universal' + elif machine in ('PowerPC', 'Power_Macintosh'): # Pick a sane name for the PPC architecture. machine = 'ppc' Added: python/trunk/Lib/test/test_macos.py ============================================================================== --- (empty file) +++ python/trunk/Lib/test/test_macos.py Thu Jun 5 14:58:24 2008 @@ -0,0 +1,43 @@ +import unittest +import MacOS +import Carbon.File +from test import test_support +import os + +TESTFN2 = test_support.TESTFN + '2' + +class TestMacOS(unittest.TestCase): + + def testOpenRF(self): + try: + fp = open(test_support.TESTFN, 'w') + fp.write('hello world\n') + fp.close() + + rfp = MacOS.openrf(test_support.TESTFN, '*wb') + rfp.write('goodbye world\n') + rfp.close() + + + fp = open(test_support.TESTFN, 'r') + data = fp.read() + fp.close() + self.assertEquals(data, 'hello world\n') + + rfp = MacOS.openrf(test_support.TESTFN, '*rb') + data = rfp.read(100) + data2 = rfp.read(100) + rfp.close() + self.assertEquals(data, 'goodbye world\n') + self.assertEquals(data2, '') + + + finally: + os.unlink(test_support.TESTFN) + +def test_main(): + test_support.run_unittest(TestMacOS) + + +if __name__ == '__main__': + test_main() Modified: python/trunk/Mac/IDLE/Makefile.in ============================================================================== --- python/trunk/Mac/IDLE/Makefile.in (original) +++ python/trunk/Mac/IDLE/Makefile.in Thu Jun 5 14:58:24 2008 @@ -42,7 +42,7 @@ $(srcdir)/../Icons/PythonSource.icns \ $(srcdir)/../Icons/PythonCompiled.icns Info.plist rm -fr IDLE.app - $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(BUNDLEBULDER) \ --builddir=. \ --name=IDLE \ --link-exec \ @@ -51,7 +51,7 @@ --iconfile=$(srcdir)/../Icons/IDLE.icns \ --resource=$(srcdir)/../Icons/PythonSource.icns \ --resource=$(srcdir)/../Icons/PythonCompiled.icns \ - --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \ build Modified: python/trunk/Mac/IDLE/idlemain.py ============================================================================== --- python/trunk/Mac/IDLE/idlemain.py (original) +++ python/trunk/Mac/IDLE/idlemain.py Thu Jun 5 14:58:24 2008 @@ -13,7 +13,10 @@ # Make sure sys.executable points to the python interpreter inside the # framework, instead of at the helper executable inside the application # bundle (the latter works, but doesn't allow access to the window server) -sys.executable = os.path.join(sys.prefix, 'bin', 'python') +if sys.executable.endswith('-32'): + sys.executable = os.path.join(sys.prefix, 'bin', 'python-32') +else: + sys.executable = os.path.join(sys.prefix, 'bin', 'python') # Look for the -psn argument that the launcher adds and remove it, it will # only confuse the IDLE startup code. Modified: python/trunk/Mac/Makefile.in ============================================================================== --- python/trunk/Mac/Makefile.in (original) +++ python/trunk/Mac/Makefile.in Thu Jun 5 14:58:24 2008 @@ -49,12 +49,42 @@ installapps: install_Python install_BuildApplet install_PythonLauncher \ install_IDLE checkapplepython install_pythonw install_versionedtools +installapps4way: install_Python4way install_BuildApplet install_PythonLauncher install_IDLE install_pythonw4way install_versionedtools + + install_pythonw: pythonw $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python" ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw" + +# Install 3 variants of python/pythonw: +# - 32-bit (i386 and ppc) +# - 64-bit (x86_64 and ppc64) +# - all (all four architectures) +# - Make 'python' and 'pythonw' aliases for the 32-bit variant +install_pythonw4way: pythonw-32 pythonw-64 pythonw + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64" + ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64" + ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64" + + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32" + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32" + + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all" + ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all" + ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all" + + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)" + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python" + # # Install unix tools in /usr/local/bin. These are just aliases for the # actual installation inside the framework. @@ -65,11 +95,16 @@ fi for fn in python pythonw idle pydoc python-config smtpd.py \ python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ - pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ + pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\ do \ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ done + +# TODO: install symlinks for -32, -64 and -all as well +installunixtools4way: installunixtools + + # # Like installunixtools, but only install links to the versioned binaries. # @@ -78,18 +113,20 @@ $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ fi for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ - pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ + pydoc$(VERSION) python$(VERSION)-config) smtpd$(VERSION).py ;\ do \ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ done +# TODO: -32, -64 and -all variants +altinstallunixtools4way: altinstallunixtools # By default most tools are installed without a version in their basename, to # make it easier to install (and use) several python versions side-by-side move # the tools to a version-specific name and add the non-versioned name as an # alias. install_versionedtools: - for fn in idle pydoc python-config ;\ + for fn in idle pydoc ;\ do \ if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \ continue ;\ @@ -97,6 +134,10 @@ mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\ ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\ done + if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \ + mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\ + ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \ + fi if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \ mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\ ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\ @@ -107,6 +148,13 @@ $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \ -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"' +pythonw-32: $(srcdir)/Tools/pythonw.c Makefile + $(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"' + +pythonw-64: $(srcdir)/Tools/pythonw.c Makefile + $(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"' install_PythonLauncher: cd PythonLauncher && make install DESTDIR=$(DESTDIR) @@ -159,13 +207,19 @@ done $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" +install_Python4way: install_Python + lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" + lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" + + + install_IDLE: cd IDLE && make install install_BuildApplet: - $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \ + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONAPP) \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \ --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \ $(srcdir)/scripts/BuildApplet.py @@ -225,7 +279,7 @@ done - $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) Modified: python/trunk/Mac/Modules/ColorPickermodule.c ============================================================================== --- python/trunk/Mac/Modules/ColorPickermodule.c (original) +++ python/trunk/Mac/Modules/ColorPickermodule.c Thu Jun 5 14:58:24 2008 @@ -27,6 +27,9 @@ /* ----------------------------------------------------- */ + +#ifndef __LP64__ + static char cp_GetColor__doc__[] = "GetColor(prompt, (r, g, b)) -> (r, g, b), ok" ; @@ -46,11 +49,14 @@ return Py_BuildValue("O&h", QdRGB_New, &outColor, ok); } +#endif /* __LP64__ */ /* List of methods defined in the module */ static struct PyMethodDef cp_methods[] = { +#ifndef __LP64__ {"GetColor", (PyCFunction)cp_GetColor, METH_VARARGS, cp_GetColor__doc__}, +#endif /* __LP64__ */ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ }; Modified: python/trunk/Mac/Modules/MacOS.c ============================================================================== --- python/trunk/Mac/Modules/MacOS.c (original) +++ python/trunk/Mac/Modules/MacOS.c Thu Jun 5 14:58:24 2008 @@ -30,6 +30,7 @@ #include #include + static PyObject *MacOS_Error; /* Exception MacOS.Error */ #define PATHNAMELEN 1024 @@ -40,7 +41,7 @@ typedef struct { PyObject_HEAD - short fRefNum; + FSIORefNum fRefNum; int isclosed; } rfobject; @@ -54,7 +55,7 @@ do_close(rfobject *self) { if (self->isclosed ) return; - (void)FSClose(self->fRefNum); + (void)FSCloseFork(self->fRefNum); self->isclosed = 1; } @@ -68,6 +69,7 @@ long n; PyObject *v; OSErr err; + ByteCount n2; if (self->isclosed) { PyErr_SetString(PyExc_ValueError, "Operation on closed file"); @@ -81,13 +83,13 @@ if (v == NULL) return NULL; - err = FSRead(self->fRefNum, &n, PyBytes_AsString(v)); + err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2); if (err && err != eofErr) { PyMac_Error(err); Py_DECREF(v); return NULL; } - _PyBytes_Resize(&v, n); + _PyString_Resize(&v, n2); return v; } @@ -109,7 +111,7 @@ } if (!PyArg_ParseTuple(args, "s#", &buffer, &size)) return NULL; - err = FSWrite(self->fRefNum, &size, buffer); + err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL); if (err) { PyMac_Error(err); return NULL; @@ -126,47 +128,36 @@ static PyObject * rf_seek(rfobject *self, PyObject *args) { - long amount, pos; + long amount; int whence = SEEK_SET; - long eof; + int mode; OSErr err; if (self->isclosed) { PyErr_SetString(PyExc_ValueError, "Operation on closed file"); return NULL; } - if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) + if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) { return NULL; - - if ((err = GetEOF(self->fRefNum, &eof))) - goto ioerr; + } switch (whence) { case SEEK_CUR: - if ((err = GetFPos(self->fRefNum, &pos))) - goto ioerr; + mode = fsFromMark; break; case SEEK_END: - pos = eof; + mode = fsFromLEOF; break; case SEEK_SET: - pos = 0; + mode = fsFromStart; break; default: PyErr_BadArgument(); return NULL; } - - pos += amount; - - /* Don't bother implementing seek past EOF */ - if (pos > eof || pos < 0) { - PyErr_BadArgument(); - return NULL; - } - - if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) { -ioerr: + + err = FSSetForkPosition(self->fRefNum, mode, amount); + if (err != noErr) { PyMac_Error(err); return NULL; } @@ -182,7 +173,7 @@ static PyObject * rf_tell(rfobject *self, PyObject *args) { - long where; + long long where; OSErr err; if (self->isclosed) { @@ -191,11 +182,13 @@ } if (!PyArg_ParseTuple(args, "")) return NULL; - if ((err = GetFPos(self->fRefNum, &where)) ) { + + err = FSGetForkPosition(self->fRefNum, &where); + if (err != noErr) { PyMac_Error(err); return NULL; } - return PyInt_FromLong(where); + return PyLong_FromLongLong(where); } static char rf_close__doc__[] = @@ -281,6 +274,7 @@ Rftype__doc__ /* Documentation string */ }; + /* End of code for Resource fork objects */ /* -------------------------------------------------------- */ @@ -292,17 +286,61 @@ static PyObject * MacOS_GetCreatorAndType(PyObject *self, PyObject *args) { - FSSpec fss; - FInfo info; PyObject *creator, *type, *res; OSErr err; - - if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss)) + FSRef ref; + FSCatalogInfo cataloginfo; + FileInfo* finfo; + + if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) { +#ifndef __LP64__ + /* This function is documented to take an FSSpec as well, + * which only works in 32-bit mode. + */ + PyErr_Clear(); + FSSpec fss; + FInfo info; + + if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss)) + return NULL; + + if ((err = FSpGetFInfo(&fss, &info)) != noErr) { + return PyErr_Mac(MacOS_Error, err); + } + creator = PyString_FromStringAndSize( + (char *)&info.fdCreator, 4); + type = PyString_FromStringAndSize((char *)&info.fdType, 4); + res = Py_BuildValue("OO", creator, type); + Py_DECREF(creator); + Py_DECREF(type); + return res; +#else /* __LP64__ */ + return NULL; +#endif /* __LP64__ */ + } + + err = FSGetCatalogInfo(&ref, + kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, + NULL, NULL, NULL); + if (err != noErr) { + PyErr_Mac(MacOS_Error, err); return NULL; - if ((err = FSpGetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); - creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4); - type = PyBytes_FromStringAndSize((char *)&info.fdType, 4); + } + + if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) { + /* Directory: doesn't have type/creator info. + * + * The specific error code is for backward compatibility with + * earlier versions. + */ + PyErr_Mac(MacOS_Error, fnfErr); + return NULL; + + } + finfo = (FileInfo*)&(cataloginfo.finderInfo); + creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4); + type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4); + res = Py_BuildValue("OO", creator, type); Py_DECREF(creator); Py_DECREF(type); @@ -314,20 +352,66 @@ static PyObject * MacOS_SetCreatorAndType(PyObject *self, PyObject *args) { - FSSpec fss; ResType creator, type; - FInfo info; + FSRef ref; + FileInfo* finfo; OSErr err; - + FSCatalogInfo cataloginfo; + if (!PyArg_ParseTuple(args, "O&O&O&", + PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) { +#ifndef __LP64__ + /* Try to handle FSSpec arguments, for backward compatibility */ + FSSpec fss; + FInfo info; + + if (!PyArg_ParseTuple(args, "O&O&O&", PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) + return NULL; + + if ((err = FSpGetFInfo(&fss, &info)) != noErr) + return PyErr_Mac(MacOS_Error, err); + + info.fdCreator = creator; + info.fdType = type; + + if ((err = FSpSetFInfo(&fss, &info)) != noErr) + return PyErr_Mac(MacOS_Error, err); + Py_INCREF(Py_None); + return Py_None; +#else /* __LP64__ */ + return NULL; +#endif /* __LP64__ */ + } + + err = FSGetCatalogInfo(&ref, + kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, + NULL, NULL, NULL); + if (err != noErr) { + PyErr_Mac(MacOS_Error, err); + return NULL; + } + + if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) { + /* Directory: doesn't have type/creator info. + * + * The specific error code is for backward compatibility with + * earlier versions. + */ + PyErr_Mac(MacOS_Error, fnfErr); + return NULL; + + } + finfo = (FileInfo*)&(cataloginfo.finderInfo); + finfo->fileCreator = creator; + finfo->fileType = type; + + err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo); + if (err != noErr) { + PyErr_Mac(MacOS_Error, fnfErr); return NULL; - if ((err = FSpGetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); - info.fdCreator = creator; - info.fdType = type; - if ((err = FSpSetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); + } + Py_INCREF(Py_None); return Py_None; } @@ -399,6 +483,9 @@ return Py_BuildValue("s", buf); } + +#ifndef __LP64__ + static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)"; static PyObject * @@ -417,7 +504,7 @@ return NULL; olddialog = curdialog; curdialog = NULL; - + if ( resid != -1 ) { curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1); if ( curdialog ) { @@ -452,11 +539,13 @@ if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object)) return NULL; + DebugStr(message); Py_INCREF(Py_None); return Py_None; } + static char SysBeep_doc[] = "BEEEEEP!!!"; static PyObject * @@ -471,6 +560,8 @@ return Py_None; } +#endif /* __LP64__ */ + static char WMAvailable_doc[] = "True if this process can interact with the display." "Will foreground the application on the first call as a side-effect." @@ -530,51 +621,37 @@ { OSErr err; char *mode = "r"; - FSSpec fss; - SignedByte permission = 1; + FSRef ref; + SInt8 permission = fsRdPerm; rfobject *fp; + HFSUniStr255 name; - if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode)) + if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode)) return NULL; while (*mode) { switch (*mode++) { case '*': break; - case 'r': permission = 1; break; - case 'w': permission = 2; break; + case 'r': permission = fsRdPerm; break; + case 'w': permission = fsWrPerm; break; case 'b': break; default: PyErr_BadArgument(); return NULL; } } + + err = FSGetResourceForkName(&name); + if (err != noErr) { + PyMac_Error(err); + return NULL; + } if ( (fp = newrfobject()) == NULL ) return NULL; - - err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum); + - if ( err == fnfErr ) { - /* In stead of doing complicated things here to get creator/type - ** correct we let the standard i/o library handle it - */ - FILE *tfp; - char pathname[PATHNAMELEN]; - - if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) { - PyMac_Error(err); - Py_DECREF(fp); - return NULL; - } - - if ( (tfp = fopen(pathname, "w")) == NULL ) { - PyMac_Error(fnfErr); /* What else... */ - Py_DECREF(fp); - return NULL; - } - fclose(tfp); - err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum); - } - if ( err ) { + err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum); + if (err != noErr) { Py_DECREF(fp); PyMac_Error(err); return NULL; @@ -584,15 +661,18 @@ } + static PyMethodDef MacOS_Methods[] = { {"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc}, {"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc}, {"GetErrorString", MacOS_GetErrorString, 1, geterr_doc}, {"openrf", MacOS_openrf, 1, openrf_doc}, +#ifndef __LP64__ {"splash", MacOS_splash, 1, splash_doc}, {"DebugStr", MacOS_DebugStr, 1, DebugStr_doc}, - {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc}, {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc}, +#endif /* __LP64__ */ + {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc}, {"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc}, {NULL, NULL} /* Sentinel */ }; Modified: python/trunk/Mac/Modules/Nav.c ============================================================================== --- python/trunk/Mac/Modules/Nav.c (original) +++ python/trunk/Mac/Modules/Nav.c Thu Jun 5 14:58:24 2008 @@ -184,18 +184,22 @@ } else if( strcmp(keystr, "preferenceKey") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) ) return 0; +#ifndef __LP64__ } else if( strcmp(keystr, "popupExtension") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) ) return 0; +#endif /* !__LP64__ */ } else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) { *eventProcP = my_eventProcUPP; } else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) { *previewProcP = my_previewProcUPP; } else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) { *filterProcP = my_filterProcUPP; +#ifndef __LP64__ } else if( typeListP && strcmp(keystr, "typeList") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) ) return 0; +#endif /* !__LP64__ */ } else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) ) return 0; @@ -301,13 +305,26 @@ static PyObject * navrr_getattr(navrrobject *self, char *name) { - FSSpec fss; FSRef fsr; +#ifndef __LP64__ + FSSpec fss; +#endif /* !__LP64__ */ if( strcmp(name, "__members__") == 0 ) - return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing", - "isStationery", "translationNeeded", "selection", "selection_fsr", + return Py_BuildValue( +#ifndef __LP64__ + "ssssssssss", +#else /* __LP64__ */ + "ssssssssss", +#endif /* __LP64__ */ + "version", "validRecord", "replacing", + "isStationery", "translationNeeded", +#ifndef __LP64__ + "selection", +#endif /* !__LP64__ */ + "selection_fsr", "fileTranslation", "keyScript", "saveFileName"); + if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); if( strcmp(name, "validRecord") == 0 ) @@ -318,8 +335,10 @@ return Py_BuildValue("l", (long)self->itself.isStationery); if( strcmp(name, "translationNeeded") == 0 ) return Py_BuildValue("l", (long)self->itself.translationNeeded); +#ifndef __LP64__ if( strcmp(name, "selection") == 0 ) { - SInt32 i, count; + SInt32 i; + long count; OSErr err; PyObject *rv, *rvitem; AEDesc desc; @@ -348,8 +367,10 @@ } return rv; } +#endif /* !__LP64__ */ if( strcmp(name, "selection_fsr") == 0 ) { - SInt32 i, count; + SInt32 i; + long count; OSErr err; PyObject *rv, *rvitem; AEDesc desc; @@ -378,8 +399,10 @@ } return rv; } +#ifndef __LP64__ if( strcmp(name, "fileTranslation") == 0 ) return ResObj_New((Handle)self->itself.fileTranslation); +#endif if( strcmp(name, "keyScript") == 0 ) return Py_BuildValue("h", (short)self->itself.keyScript); if( strcmp(name, "saveFileName") == 0 ) @@ -861,7 +884,12 @@ PyErr_Mac(ErrorObject, err); return NULL; } - return Py_BuildValue("{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", + return Py_BuildValue( +#ifndef __LP64__ + "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", +#else /* __LP64__ */ + "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", +#endif /* __LP64__ */ "version", dialogOptions.version, "dialogOptionFlags", dialogOptions.dialogOptionFlags, "location", PyMac_BuildPoint, dialogOptions.location, @@ -871,8 +899,11 @@ "cancelButtonLabel", PyMac_BuildStr255, &dialogOptions.cancelButtonLabel, "savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName, "message", PyMac_BuildStr255, &dialogOptions.message, - "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey, - "popupExtension", OptResObj_New, dialogOptions.popupExtension); + "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey +#ifndef __LP64__ + ,"popupExtension", OptResObj_New, dialogOptions.popupExtension +#endif /* __LP64__ */ + ); } /* List of methods defined in the module */ Modified: python/trunk/Mac/Modules/OSATerminology.c ============================================================================== --- python/trunk/Mac/Modules/OSATerminology.c (original) +++ python/trunk/Mac/Modules/OSATerminology.c Thu Jun 5 14:58:24 2008 @@ -11,6 +11,7 @@ #include +#ifndef __LP64__ static PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { @@ -68,12 +69,14 @@ if (err) return PyMac_Error(err); return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); } +#endif /* !__LP64__ */ /* * List of methods defined in the module */ static struct PyMethodDef OSATerminology_methods[] = { +#ifndef __LP64__ {"GetAppTerminology", (PyCFunction) PyOSA_GetAppTerminology, METH_VARARGS, @@ -82,14 +85,14 @@ (PyCFunction) PyOSA_GetSysTerminology, METH_VARARGS, "Get an applications system terminology, as an AEDesc object."}, +#endif /* !__LP64__ */ {NULL, (PyCFunction) NULL, 0, NULL} }; - void initOSATerminology(void) { if (PyErr_WarnPy3k("In 3.x, OSATerminology is removed.", 1) < 0) return; Py_InitModule("OSATerminology", OSATerminology_methods); -} \ No newline at end of file +} Modified: python/trunk/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/trunk/Mac/Modules/ae/_AEmodule.c (original) +++ python/trunk/Mac/Modules/ae/_AEmodule.c Thu Jun 5 14:58:24 2008 @@ -683,7 +683,8 @@ return NULL; _err = AEResumeTheCurrentEvent(&_self->ob_itself, &reply, - dispatcher__proc__, (long)dispatcher); + dispatcher__proc__, + (SRefCon)dispatcher); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; @@ -1154,7 +1155,7 @@ return NULL; _err = AEInstallEventHandler(theAEEventClass, theAEEventID, - handler__proc__, (long)handler, + handler__proc__, (SRefCon)handler, 0); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); @@ -1203,7 +1204,7 @@ return NULL; _err = AEGetEventHandler(theAEEventClass, theAEEventID, - &handler__proc__, (long *)&handler, + &handler__proc__, (SRefCon *)&handler, 0); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O", Modified: python/trunk/Mac/Modules/app/_Appmodule.c ============================================================================== --- python/trunk/Mac/Modules/app/_Appmodule.c (original) +++ python/trunk/Mac/Modules/app/_Appmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,8 @@ #include "Python.h" +#ifndef __LP64__ + /* Carbon GUI stuff, not available in 64-bit mode */ #include "pymactoolbox.h" @@ -18,7 +20,7 @@ #include -int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself) +static int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself) { return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment); } @@ -1792,17 +1794,25 @@ }; +#else /* __LP64__ */ + +static PyMethodDef App_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_App(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; - - +#endif /* !__LP64__ */ m = Py_InitModule("_App", App_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); App_Error = PyMac_GetOSErrException(); if (App_Error == NULL || @@ -1815,6 +1825,7 @@ /* Backward-compatible name */ Py_INCREF(&ThemeDrawingState_Type); PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type); +#endif /* __LP64__ */ } /* ======================== End module _App ========================= */ Modified: python/trunk/Mac/Modules/carbonevt/_CarbonEvtmodule.c ============================================================================== --- python/trunk/Mac/Modules/carbonevt/_CarbonEvtmodule.c (original) +++ python/trunk/Mac/Modules/carbonevt/_CarbonEvtmodule.c Thu Jun 5 14:58:24 2008 @@ -3,7 +3,7 @@ #include "Python.h" - +#ifndef __LP64__ #include "pymactoolbox.h" @@ -2141,20 +2141,28 @@ {NULL, NULL, 0} }; +#else /* __LP64__ */ + +static PyMethodDef CarbonEvents_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_CarbonEvt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* !__LP64__ */ + m = Py_InitModule("_CarbonEvt", CarbonEvents_methods); +#ifndef __LP64__ myEventHandlerUPP = NewEventHandlerUPP(myEventHandler); - - - m = Py_InitModule("_CarbonEvt", CarbonEvents_methods); d = PyModule_GetDict(m); CarbonEvents_Error = PyMac_GetOSErrException(); if (CarbonEvents_Error == NULL || @@ -2216,6 +2224,7 @@ /* Backward-compatible name */ Py_INCREF(&EventHotKeyRef_Type); PyModule_AddObject(m, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type); +#endif /* !__LP64__ */ } /* ===================== End module _CarbonEvt ====================== */ Modified: python/trunk/Mac/Modules/cg/_CGmodule.c ============================================================================== --- python/trunk/Mac/Modules/cg/_CGmodule.c (original) +++ python/trunk/Mac/Modules/cg/_CGmodule.c Thu Jun 5 14:58:24 2008 @@ -1025,6 +1025,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1055,6 +1056,7 @@ _res = Py_None; return _res; } +#endif static PyMethodDef CGContextRefObj_methods[] = { {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1, @@ -1173,10 +1175,12 @@ PyDoc_STR("() -> None")}, {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1, PyDoc_STR("(int shouldAntialias) -> None")}, +#ifndef __LP64__ {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1, PyDoc_STR("(CGrafPtr port) -> None")}, {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1, PyDoc_STR("(Rect portRect, RgnHandle region) -> None")}, +#endif {NULL, NULL, 0} }; @@ -1254,6 +1258,7 @@ /* ------------------ End object type CGContextRef ------------------ */ +#ifndef __LP64__ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1271,10 +1276,13 @@ return _res; } +#endif static PyMethodDef CG_methods[] = { +#ifndef __LP64__ {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1, PyDoc_STR("(CGrafPtr) -> CGContextRef")}, +#endif {NULL, NULL, 0} }; Modified: python/trunk/Mac/Modules/cm/_Cmmodule.c ============================================================================== --- python/trunk/Mac/Modules/cm/_Cmmodule.c (original) +++ python/trunk/Mac/Modules/cm/_Cmmodule.c Thu Jun 5 14:58:24 2008 @@ -178,6 +178,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -228,6 +229,7 @@ _rv); return _res; } +#endif /* !__LP64__*/ static PyMethodDef CmpInstObj_methods[] = { {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1, @@ -240,12 +242,14 @@ PyDoc_STR("() -> (Handle _rv)")}, {"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1, PyDoc_STR("(Handle theStorage) -> None")}, +#ifndef __LP64__ {"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1, PyDoc_STR("(short ftnNumber) -> (long _rv)")}, {"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1, PyDoc_STR("() -> (long _rv)")}, {"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1, PyDoc_STR("(ComponentInstance target) -> (long _rv)")}, +#endif /* !__LP64__ */ {NULL, NULL, 0} }; @@ -631,6 +635,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -648,6 +653,7 @@ ResObj_New, iconSuite); return _res; } +#endif /* !__LP64__ */ static PyMethodDef CmpObj_methods[] = { {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1, @@ -678,8 +684,10 @@ PyDoc_STR("(Component capturingComponent) -> (Component _rv)")}, {"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1, PyDoc_STR("() -> None")}, +#ifndef __LP64__ {"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1, PyDoc_STR("() -> (Handle iconSuite)")}, +#endif /* !__LP64__ */ {NULL, NULL, 0} }; Modified: python/trunk/Mac/Modules/ctl/_Ctlmodule.c ============================================================================== --- python/trunk/Mac/Modules/ctl/_Ctlmodule.c (original) +++ python/trunk/Mac/Modules/ctl/_Ctlmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -5765,13 +5766,20 @@ return (ControlPartCode)c_rv; } +#else /* __LP64__ */ + +static PyMethodDef Ctl_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_Ctl(void) { PyObject *m; - PyObject *d; - +#ifndef __LP64__ + PyObject *d; mytracker_upp = NewControlActionUPP(mytracker); myactionproc_upp = NewControlActionUPP(myactionproc); @@ -5783,9 +5791,11 @@ mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); - +#endif /* !__LP64__ */ m = Py_InitModule("_Ctl", Ctl_methods); + +#ifndef __LP64__ d = PyModule_GetDict(m); Ctl_Error = PyMac_GetOSErrException(); if (Ctl_Error == NULL || @@ -5798,6 +5808,7 @@ /* Backward-compatible name */ Py_INCREF(&Control_Type); PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type); +#endif /* !__LP64__ */ } /* ======================== End module _Ctl ========================= */ Modified: python/trunk/Mac/Modules/dlg/_Dlgmodule.c ============================================================================== --- python/trunk/Mac/Modules/dlg/_Dlgmodule.c (original) +++ python/trunk/Mac/Modules/dlg/_Dlgmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1564,10 +1565,19 @@ return it; } +#else /* __LP64__ */ + +static PyMethodDef Dlg_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ + void init_Dlg(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1575,9 +1585,11 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New); PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert); - +#endif /* !__LP64__ */ m = Py_InitModule("_Dlg", Dlg_methods); + +#ifndef __LP64__ d = PyModule_GetDict(m); Dlg_Error = PyMac_GetOSErrException(); if (Dlg_Error == NULL || @@ -1590,6 +1602,7 @@ /* Backward-compatible name */ Py_INCREF(&Dialog_Type); PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type); +#endif /* !__LP64__ */ } /* ======================== End module _Dlg ========================= */ Modified: python/trunk/Mac/Modules/drag/_Dragmodule.c ============================================================================== --- python/trunk/Mac/Modules/drag/_Dragmodule.c (original) +++ python/trunk/Mac/Modules/drag/_Dragmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1106,21 +1107,28 @@ return 0; } #endif - +#else /* __LP64__ */ +static PyMethodDef Drag_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Drag(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert); +#endif /* !__LP64__ */ m = Py_InitModule("_Drag", Drag_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Drag_Error = PyMac_GetOSErrException(); if (Drag_Error == NULL || @@ -1142,6 +1150,7 @@ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing); #endif +#endif /* !__LP64__ */ } Modified: python/trunk/Mac/Modules/evt/_Evtmodule.c ============================================================================== --- python/trunk/Mac/Modules/evt/_Evtmodule.c (original) +++ python/trunk/Mac/Modules/evt/_Evtmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -526,22 +527,32 @@ }; +#else /* __LP64__ */ + +static PyMethodDef Evt_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Evt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Evt", Evt_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Evt_Error = PyMac_GetOSErrException(); if (Evt_Error == NULL || PyDict_SetItemString(d, "Error", Evt_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Evt ========================= */ Modified: python/trunk/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/trunk/Mac/Modules/file/_Filemodule.c (original) +++ python/trunk/Mac/Modules/file/_Filemodule.c Thu Jun 5 14:58:24 2008 @@ -18,30 +18,45 @@ #include #ifdef USE_TOOLBOX_OBJECT_GLUE + +#ifndef __LP64__ extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec); -extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec); -extern PyObject *_PyMac_BuildFSRef(FSRef *spec); +#define PyMac_BuildFSSpec _PyMac_BuildFSSpec +#endif /* __LP64__*/ +extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr); +extern PyObject *_PyMac_BuildFSRef(FSRef *spec); +#define PyMac_BuildFSRef _PyMac_BuildFSRef #define PyMac_GetFSSpec _PyMac_GetFSSpec #define PyMac_GetFSRef _PyMac_GetFSRef -#define PyMac_BuildFSSpec _PyMac_BuildFSSpec -#define PyMac_BuildFSRef _PyMac_BuildFSRef -#else + +#else /* !USE_TOOLBOX_OBJECT_GLUE */ + +#ifndef __LP64__ extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec); -extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *PyMac_BuildFSSpec(FSSpec *spec); +#endif /* !__LP64__*/ + +extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *PyMac_BuildFSRef(FSRef *spec); -#endif + +#endif /* !USE_TOOLBOX_OBJECT_GLUE */ /* Forward declarations */ -static PyObject *FInfo_New(FInfo *itself); static PyObject *FSRef_New(FSRef *itself); +#ifndef __LP64__ +static PyObject *FInfo_New(FInfo *itself); + static PyObject *FSSpec_New(FSSpec *itself); +#define FSSpec_Convert PyMac_GetFSSpec +#endif /* !__LP64__ */ + static PyObject *Alias_New(AliasHandle itself); +#ifndef __LP64__ static int FInfo_Convert(PyObject *v, FInfo *p_itself); +#endif /* !__LP64__ */ #define FSRef_Convert PyMac_GetFSRef -#define FSSpec_Convert PyMac_GetFSSpec static int Alias_Convert(PyObject *v, AliasHandle *p_itself); /* @@ -62,6 +77,7 @@ /* ** Optional fsspec and fsref pointers. None will pass NULL */ +#ifndef __LP64__ static int myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec) { @@ -71,6 +87,7 @@ } return PyMac_GetFSSpec(v, *spec); } +#endif /* !__LP64__ */ static int myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref) @@ -92,6 +109,7 @@ return Py_BuildValue("u#", itself->unicode, itself->length); } +#ifndef __LP64__ static OSErr _PyMac_GetFullPathname(FSSpec *fss, char *path, int len) { @@ -135,6 +153,7 @@ } return 0; } +#endif /* !__LP64__ */ static PyObject *File_Error; @@ -174,6 +193,10 @@ static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self) { /* Cleanup of self->ob_itself goes here */ + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + if (info->fileSec != NULL) { + CFRelease(info->fileSec); + } self->ob_type->tp_free((PyObject *)self); } @@ -282,12 +305,28 @@ static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure) { - return Py_BuildValue("(llll)", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]); + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + return Py_BuildValue("(llll)", info->userID, info->groupID, info->userAccess, info->mode); } static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure) { - return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1; + long userID; + long groupID; + long userAccess; + long mode; + int r; + + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + + r = PyArg_Parse(v, "(llll)", &userID, &groupID, &userAccess, &mode); + if (!r) { + return -1; + } + info->userID = userID; + info->groupID = groupID; + info->userAccess = userAccess; + info->mode = mode; return 0; } @@ -501,6 +540,8 @@ /* ----------------------- Object type FInfo ------------------------ */ +#ifndef __LP64__ + static PyTypeObject FInfo_Type; #define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) @@ -682,6 +723,7 @@ FInfo_tp_free, /* tp_free */ }; +#endif /* !__LP64__ */ /* --------------------- End object type FInfo ---------------------- */ @@ -729,6 +771,7 @@ self->ob_type->tp_free((PyObject *)self); } +#ifndef __LP64__ static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -818,6 +861,7 @@ wasChanged); return _res; } +#endif /* !__LP64__ */ static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args) { @@ -891,6 +935,7 @@ } static PyMethodDef Alias_methods[] = { +#ifndef __LP64__ {"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1, PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")}, {"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1, @@ -899,6 +944,7 @@ PyDoc_STR("(FSSpec fromFile, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")}, {"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1, PyDoc_STR("(FSSpec fromFile, Boolean logon) -> (FSSpec target, Boolean wasChanged)")}, +#endif /* !__LP64__ */ {"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1, PyDoc_STR("(FSRef fromFile, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")}, {"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1, @@ -1033,6 +1079,7 @@ /* ----------------------- Object type FSSpec ----------------------- */ +#ifndef __LP64__ static PyTypeObject FSSpec_Type; @@ -1488,6 +1535,7 @@ FSSpec_tp_free, /* tp_free */ }; +#endif /* !__LP64__ */ /* --------------------- End object type FSSpec --------------------- */ @@ -1568,7 +1616,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; FSRef newRef; +#ifndef __LP64__ FSSpec newSpec; +#endif if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, @@ -1580,11 +1630,22 @@ whichInfo, &catalogInfo, &newRef, - &newSpec); +#ifndef __LP64__ + &newSpec +#else /* __LP64__ */ + NULL +#endif /* __LP64__*/ + ); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&", FSRef_New, &newRef, FSSpec_New, &newSpec); +#else /* __LP64__ */ + _res = Py_BuildValue("O&O", FSRef_New, &newRef, Py_None); +#endif /* __LP64__ */ + return _res; } @@ -1598,7 +1659,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; FSRef newRef; +#ifndef __LP64__ FSSpec newSpec; +#endif /* !__LP64__ */ UInt32 newDirID; if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, @@ -1611,13 +1674,25 @@ whichInfo, &catalogInfo, &newRef, +#ifndef __LP64__ &newSpec, +#else /* !__LP64__ */ + NULL, +#endif /* !__LP64__ */ &newDirID); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&l", FSRef_New, &newRef, FSSpec_New, &newSpec, newDirID); +#else /* __LP64__ */ + _res = Py_BuildValue("O&Ol", + FSRef_New, &newRef, + Py_None, + newDirID); +#endif /* __LP64__ */ return _res; } @@ -1699,7 +1774,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; HFSUniStr255 outName; +#ifndef __LP64__ FSSpec fsSpec; +#endif /* !__LP64__ */ FSRef parentRef; if (!PyArg_ParseTuple(_args, "l", &whichInfo)) @@ -1708,14 +1785,27 @@ whichInfo, &catalogInfo, &outName, +#ifndef __LP64__ &fsSpec, +#else /* __LP64__ */ + NULL, +#endif /* __LP64__ */ &parentRef); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&O&O&", FSCatalogInfo_New, &catalogInfo, PyMac_BuildHFSUniStr255, &outName, FSSpec_New, &fsSpec, FSRef_New, &parentRef); +#else /* __LP64__ */ + _res = Py_BuildValue("O&O&OO&", + FSCatalogInfo_New, &catalogInfo, + PyMac_BuildHFSUniStr255, &outName, + Py_None, + FSRef_New, &parentRef); +#endif /* __LP64__ */ return _res; } @@ -1784,7 +1874,7 @@ UniCharCount forkNameLength__len__; int forkNameLength__in_len__; SInt8 permissions; - SInt16 forkRefNum; + FSIORefNum forkRefNum; if (!PyArg_ParseTuple(_args, "u#b", &forkNameLength__in__, &forkNameLength__in_len__, &permissions)) @@ -2034,7 +2124,7 @@ /* --------------------- End object type FSRef ---------------------- */ - +#ifndef __LP64__ static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2562,6 +2652,7 @@ FSSpec_New, &spec); return _res; } +#endif /* !__LP64__ */ static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args) { @@ -2785,6 +2876,7 @@ return _res; } +#ifndef __LP64__ static PyObject *File_NewAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2933,6 +3025,7 @@ wasAliased); return _res; } +#endif /* !__LP64__ */ static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args) { @@ -3050,6 +3143,7 @@ } static PyMethodDef File_methods[] = { +#ifndef __LP64__ {"UnmountVol", (PyCFunction)File_UnmountVol, 1, PyDoc_STR("(Str63 volName, short vRefNum) -> None")}, {"FlushVol", (PyCFunction)File_FlushVol, 1, @@ -3100,6 +3194,7 @@ PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, long newDirID, Str255 newName) -> None")}, {"FSMakeFSSpec", (PyCFunction)File_FSMakeFSSpec, 1, PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FSSpec spec)")}, +#endif /* !__LP64__*/ {"FSGetForkPosition", (PyCFunction)File_FSGetForkPosition, 1, PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 position)")}, {"FSSetForkPosition", (PyCFunction)File_FSSetForkPosition, 1, @@ -3124,6 +3219,7 @@ PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")}, {"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1, PyDoc_STR("(FNMessage message, OptionBits flags) -> None")}, +#ifndef __LP64__ {"NewAlias", (PyCFunction)File_NewAlias, 1, PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")}, {"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1, @@ -3136,6 +3232,7 @@ PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")}, {"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)File_ResolveAliasFileWithMountFlagsNoUI, 1, PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")}, +#endif /* !__LP64__ */ {"FSNewAlias", (PyCFunction)File_FSNewAlias, 1, PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")}, {"FSResolveAliasFileWithMountFlags", (PyCFunction)File_FSResolveAliasFileWithMountFlags, 1, @@ -3150,7 +3247,7 @@ }; - +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *v, FSSpec *spec) { @@ -3188,12 +3285,15 @@ } return 0; } +#endif /* !__LP64__ */ int PyMac_GetFSRef(PyObject *v, FSRef *fsr) { OSStatus err; +#ifndef __LP64__ FSSpec fss; +#endif /* !__LP64__ */ if (FSRef_Check(v)) { *fsr = ((FSRefObject *)v)->ob_itself; @@ -3205,12 +3305,14 @@ char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; - if ( (err=FSPathMakeRef(path, fsr, NULL)) ) + if ( (err=FSPathMakeRef((unsigned char*)path, fsr, NULL)) ) PyMac_Error(err); PyMem_Free(path); return !err; } /* XXXX Should try unicode here too */ + +#ifndef __LP64__ /* Otherwise we try to go via an FSSpec */ if (FSSpec_Check(v)) { fss = ((FSSpecObject *)v)->ob_itself; @@ -3219,15 +3321,19 @@ PyMac_Error(err); return 0; } +#endif /* !__LP64__ */ + PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required"); return 0; } +#ifndef __LP64__ extern PyObject * PyMac_BuildFSSpec(FSSpec *spec) { return FSSpec_New(spec); } +#endif /* !__LP64__ */ extern PyObject * PyMac_BuildFSRef(FSRef *spec) @@ -3242,10 +3348,12 @@ PyObject *d; - +#ifndef __LP64__ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec); - PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec); +#endif /* !__LP64__ */ + + PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef); @@ -3262,6 +3370,8 @@ /* Backward-compatible name */ Py_INCREF(&FSCatalogInfo_Type); PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type); + +#ifndef __LP64__ FInfo_Type.ob_type = &PyType_Type; if (PyType_Ready(&FInfo_Type) < 0) return; Py_INCREF(&FInfo_Type); @@ -3269,6 +3379,7 @@ /* Backward-compatible name */ Py_INCREF(&FInfo_Type); PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type); +#endif /* !__LP64__ */ Alias_Type.ob_type = &PyType_Type; if (PyType_Ready(&Alias_Type) < 0) return; Py_INCREF(&Alias_Type); @@ -3276,6 +3387,8 @@ /* Backward-compatible name */ Py_INCREF(&Alias_Type); PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type); + +#ifndef __LP64__ FSSpec_Type.ob_type = &PyType_Type; if (PyType_Ready(&FSSpec_Type) < 0) return; Py_INCREF(&FSSpec_Type); @@ -3283,6 +3396,7 @@ /* Backward-compatible name */ Py_INCREF(&FSSpec_Type); PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type); +#endif /* !__LP64__ */ FSRef_Type.ob_type = &PyType_Type; if (PyType_Ready(&FSRef_Type) < 0) return; Py_INCREF(&FSRef_Type); Modified: python/trunk/Mac/Modules/file/filesupport.py ============================================================================== --- python/trunk/Mac/Modules/file/filesupport.py (original) +++ python/trunk/Mac/Modules/file/filesupport.py Thu Jun 5 14:58:24 2008 @@ -6,6 +6,13 @@ # XXXX TO DO: # - Implement correct missing FSSpec handling for Alias methods # - Implement FInfo +# +# WARNING WARNING WARNING +# The file _Filemodule.c was modified manually, don't run this script +# unless you really know what you're doing. + +import sys +sys.exit(42) import string @@ -199,6 +206,7 @@ return Py_BuildValue("u#", itself->unicode, itself->length); } +#ifndef __LP64__ /* ** Get pathname for a given FSSpec */ @@ -244,10 +252,13 @@ } return 0; } +#endif /* !__LP64__ */ """ finalstuff = finalstuff + """ + +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *v, FSSpec *spec) { @@ -286,6 +297,8 @@ return 0; } +#endif /* !__LP64__ */ + int PyMac_GetFSRef(PyObject *v, FSRef *fsr) { @@ -309,6 +322,7 @@ } /* XXXX Should try unicode here too */ /* Otherwise we try to go via an FSSpec */ +#ifndef __LP64__ if (FSSpec_Check(v)) { fss = ((FSSpecObject *)v)->ob_itself; if ((err=FSpMakeFSRef(&fss, fsr)) == 0) @@ -317,14 +331,19 @@ return 0; } PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required"); +#else /* __LP64__ */ + PyErr_SetString(PyExc_TypeError, "FSRef or pathname required"); +#endif /* __LP64__ */ return 0; } +#ifndef __LP64__ extern PyObject * PyMac_BuildFSSpec(FSSpec *spec) { return FSSpec_New(spec); } +#endif /* __LP64__ */ extern PyObject * PyMac_BuildFSRef(FSRef *spec) @@ -334,9 +353,11 @@ """ initstuff = initstuff + """ +#ifndef __LP64__ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec); -PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec); +#endif /* !__LP64__*/ +PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef); """ Modified: python/trunk/Mac/Modules/fm/_Fmmodule.c ============================================================================== --- python/trunk/Mac/Modules/fm/_Fmmodule.c (original) +++ python/trunk/Mac/Modules/fm/_Fmmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -335,23 +336,32 @@ {NULL, NULL, 0} }; +#else /* __LP64__ */ +static PyMethodDef Fm_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Fm(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Fm", Fm_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Fm_Error = PyMac_GetOSErrException(); if (Fm_Error == NULL || PyDict_SetItemString(d, "Error", Fm_Error) != 0) return; +#endif /* __LP64__ */ } /* ========================= End module _Fm ========================= */ Modified: python/trunk/Mac/Modules/folder/_Foldermodule.c ============================================================================== --- python/trunk/Mac/Modules/folder/_Foldermodule.c (original) +++ python/trunk/Mac/Modules/folder/_Foldermodule.c Thu Jun 5 14:58:24 2008 @@ -27,8 +27,8 @@ short vRefNum; OSType folderType; Boolean createFolder; - short foundVRefNum; - long foundDirID; + FSVolumeRefNum foundVRefNum; + SInt32 foundDirID; if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, @@ -158,6 +158,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -248,6 +249,7 @@ flags); return _res; } +#endif /* !__LP64__ */ static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args) { @@ -300,6 +302,7 @@ PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")}, {"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1, PyDoc_STR("(FolderType foldType) -> None")}, +#ifndef __LP64__ {"GetFolderName", (PyCFunction)Folder_GetFolderName, 1, PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")}, {"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1, @@ -308,6 +311,7 @@ PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")}, {"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1, PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")}, +#endif /* !__LP64__ */ {"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1, PyDoc_STR("(short vRefNum, long dirID) -> None")}, {"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1, Modified: python/trunk/Mac/Modules/help/_Helpmodule.c ============================================================================== --- python/trunk/Mac/Modules/help/_Helpmodule.c (original) +++ python/trunk/Mac/Modules/help/_Helpmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -144,7 +145,10 @@ return _res; } +#endif /* __LP64__ */ + static PyMethodDef Help_methods[] = { +#ifndef __LP64__ {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1, PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")}, {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1, @@ -161,6 +165,7 @@ PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")}, {"HMHideTag", (PyCFunction)Help_HMHideTag, 1, PyDoc_STR("() -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -170,17 +175,21 @@ void init_Help(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Help", Help_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Help_Error = PyMac_GetOSErrException(); if (Help_Error == NULL || PyDict_SetItemString(d, "Error", Help_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Help ======================== */ Modified: python/trunk/Mac/Modules/ibcarbon/_IBCarbon.c ============================================================================== --- python/trunk/Mac/Modules/ibcarbon/_IBCarbon.c (original) +++ python/trunk/Mac/Modules/ibcarbon/_IBCarbon.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include #include "pymactoolbox.h" @@ -224,10 +225,13 @@ IBNibRefObj_New, outNibRef); return _res; } +#endif /* __LP64__ */ static PyMethodDef IBCarbon_methods[] = { +#ifndef __LP64__ {"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1, PyDoc_STR("(CFStringRef inNibName) -> (IBNibRef outNibRef)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -237,13 +241,16 @@ void init_IBCarbon(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_IBCarbon", IBCarbon_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); IBCarbon_Error = PyMac_GetOSErrException(); if (IBCarbon_Error == NULL || @@ -256,6 +263,7 @@ /* Backward-compatible name */ Py_INCREF(&IBNibRef_Type); PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type); +#endif /* __LP64__ */ } /* ====================== End module _IBCarbon ====================== */ Modified: python/trunk/Mac/Modules/icn/_Icnmodule.c ============================================================================== --- python/trunk/Mac/Modules/icn/_Icnmodule.c (original) +++ python/trunk/Mac/Modules/icn/_Icnmodule.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1447,8 +1448,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Icn_methods[] = { +#ifndef __LP64__ {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, PyDoc_STR("(SInt16 iconID) -> (CIconHandle _rv)")}, {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1, @@ -1573,6 +1576,7 @@ PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")}, {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1582,17 +1586,21 @@ void init_Icn(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Icn", Icn_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Icn_Error = PyMac_GetOSErrException(); if (Icn_Error == NULL || PyDict_SetItemString(d, "Error", Icn_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Icn ========================= */ Modified: python/trunk/Mac/Modules/launch/_Launchmodule.c ============================================================================== --- python/trunk/Mac/Modules/launch/_Launchmodule.c (original) +++ python/trunk/Mac/Modules/launch/_Launchmodule.c Thu Jun 5 14:58:24 2008 @@ -50,6 +50,7 @@ PyObject * LSItemInfoRecord_New(LSItemInfoRecord *it) { +#ifndef __LP64__ return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}", "flags", it->flags, "filetype", PyMac_BuildOSType, it->filetype, @@ -57,6 +58,13 @@ "extension", OptCFStringRefObj_New, it->extension, "iconFileName", OptCFStringRefObj_New, it->iconFileName, "kindID", it->kindID); +#else + return Py_BuildValue("{s:is:O&s:O&s:O&}", + "flags", it->flags, + "filetype", PyMac_BuildOSType, it->filetype, + "creator", PyMac_BuildOSType, it->creator, + "extension", OptCFStringRefObj_New, it->extension); +#endif } static PyObject *Launch_Error; Modified: python/trunk/Mac/Modules/list/_Listmodule.c ============================================================================== --- python/trunk/Mac/Modules/list/_Listmodule.c (original) +++ python/trunk/Mac/Modules/list/_Listmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1032,8 +1033,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef List_methods[] = { +#ifndef __LP64__ {"CreateCustomList", (PyCFunction)List_CreateCustomList, 1, PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")}, {"LNew", (PyCFunction)List_LNew, 1, @@ -1056,9 +1059,11 @@ PyDoc_STR("(ListHandle list, OptionBits selectionFlags) -> None")}, {"as_List", (PyCFunction)List_as_List, 1, PyDoc_STR("(Resource)->List.\nReturns List object (which is not auto-freed!)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ static void myListDefFunction(SInt16 message, @@ -1096,11 +1101,13 @@ Py_DECREF(rv); } } +#endif /* __LP64__ */ void init_List(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1109,9 +1116,11 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_List", List_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); List_Error = PyMac_GetOSErrException(); if (List_Error == NULL || @@ -1124,6 +1133,7 @@ /* Backward-compatible name */ Py_INCREF(&List_Type); PyModule_AddObject(m, "ListType", (PyObject *)&List_Type); +#endif /* __LP64__ */ } /* ======================== End module _List ======================== */ Modified: python/trunk/Mac/Modules/menu/_Menumodule.c ============================================================================== --- python/trunk/Mac/Modules/menu/_Menumodule.c (original) +++ python/trunk/Mac/Modules/menu/_Menumodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -3347,8 +3348,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Menu_methods[] = { +#ifndef __LP64__ {"NewMenu", (PyCFunction)Menu_NewMenu, 1, PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")}, {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1, @@ -3433,6 +3436,7 @@ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")}, {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1, PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -3442,15 +3446,18 @@ void init_Menu(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Menu", Menu_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Menu_Error = PyMac_GetOSErrException(); if (Menu_Error == NULL || @@ -3463,6 +3470,7 @@ /* Backward-compatible name */ Py_INCREF(&Menu_Type); PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type); +#endif /* __LP64__ */ } /* ======================== End module _Menu ======================== */ Modified: python/trunk/Mac/Modules/mlte/_Mltemodule.c ============================================================================== --- python/trunk/Mac/Modules/mlte/_Mltemodule.c (original) +++ python/trunk/Mac/Modules/mlte/_Mltemodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1622,7 +1623,10 @@ } +#endif /* __LP64__ */ + static PyMethodDef Mlte_methods[] = { +#ifndef __LP64__ {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, @@ -1639,6 +1643,7 @@ PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")}, {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1, PyDoc_STR("(TXNInitOptions) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1648,14 +1653,17 @@ void init_Mlte(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; // PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx); +#endif /* __LP64__ */ m = Py_InitModule("_Mlte", Mlte_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Mlte_Error = PyMac_GetOSErrException(); if (Mlte_Error == NULL || @@ -1675,6 +1683,7 @@ /* Backward-compatible name */ Py_INCREF(&TXNFontMenuObject_Type); PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type); +#endif /* __LP64__ */ } /* ======================== End module _Mlte ======================== */ Modified: python/trunk/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/trunk/Mac/Modules/qd/_Qdmodule.c (original) +++ python/trunk/Mac/Modules/qd/_Qdmodule.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -6544,8 +6545,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef Qd_methods[] = { +#ifndef __LP64__ {"GetPort", (PyCFunction)Qd_GetPort, 1, PyDoc_STR("() -> (GrafPtr port)")}, {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1, @@ -7080,10 +7083,12 @@ PyDoc_STR("Take (string, int, Rect) argument and create BitMap")}, {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1, PyDoc_STR("Take string BitMap and turn into BitMap object")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ /* Like BMObj_New, but the original bitmap data structure is copied (and ** released when the object is released) @@ -7101,11 +7106,13 @@ return (PyObject *)it; } +#endif /* __LP64__ */ void init_Qd(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -7117,8 +7124,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qd", Qd_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qd_Error = PyMac_GetOSErrException(); if (Qd_Error == NULL || @@ -7138,6 +7147,7 @@ /* Backward-compatible name */ Py_INCREF(&BitMap_Type); PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type); +#endif /* __LP64__ */ } /* ========================= End module _Qd ========================= */ Modified: python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -630,8 +631,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef Qdoffs_methods[] = { +#ifndef __LP64__ {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")}, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, @@ -678,6 +681,7 @@ PyDoc_STR("(pixmap, int start, int size) -> string. Return bytes from the pixmap")}, {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1, PyDoc_STR("(pixmap, int start, string data). Store bytes into the pixmap")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -687,6 +691,7 @@ void init_Qdoffs(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -694,8 +699,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qdoffs", Qdoffs_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qdoffs_Error = PyMac_GetOSErrException(); if (Qdoffs_Error == NULL || @@ -708,6 +715,7 @@ /* Backward-compatible name */ Py_INCREF(&GWorld_Type); PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type); +#endif /* __LP64__ */ } /* ======================= End module _Qdoffs ======================= */ Modified: python/trunk/Mac/Modules/qt/_Qtmodule.c ============================================================================== --- python/trunk/Mac/Modules/qt/_Qtmodule.c (original) +++ python/trunk/Mac/Modules/qt/_Qtmodule.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -26294,8 +26295,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Qt_methods[] = { +#ifndef __LP64__ {"EnterMovies", (PyCFunction)Qt_EnterMovies, 1, PyDoc_STR("() -> None")}, {"ExitMovies", (PyCFunction)Qt_ExitMovies, 1, @@ -27988,6 +27991,7 @@ PyDoc_STR("(WindowPtr wp, Point startPt, Rect boundsRect) -> None")}, {"MoviesTask", (PyCFunction)Qt_MoviesTask, 1, PyDoc_STR("(long maxMilliSecToUse) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -27997,6 +28001,7 @@ void init_Qt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -28013,9 +28018,11 @@ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qt", Qt_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qt_Error = PyMac_GetOSErrException(); if (Qt_Error == NULL || @@ -28077,6 +28084,7 @@ /* Backward-compatible name */ Py_INCREF(&SGOutput_Type); PyModule_AddObject(m, "SGOutputType", (PyObject *)&SGOutput_Type); +#endif /* __LP64__ */ } /* ========================= End module _Qt ========================= */ Modified: python/trunk/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/trunk/Mac/Modules/res/_Resmodule.c (original) +++ python/trunk/Mac/Modules/res/_Resmodule.c Thu Jun 5 14:58:24 2008 @@ -4,7 +4,6 @@ #include "Python.h" - #include "pymactoolbox.h" /* Macro to test whether a weak-loaded CFM function exists */ @@ -414,6 +413,7 @@ return _res; } +#ifndef __LP64__ static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -431,6 +431,7 @@ return _res; } +#endif /* !__LP64__ */ static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args) { @@ -501,10 +502,12 @@ PyDoc_STR("(long newSize) -> None")}, {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1, PyDoc_STR("() -> (Handle _rv)")}, +#ifndef __LP64__ {"as_Control", (PyCFunction)ResObj_as_Control, 1, PyDoc_STR("Return this resource/handle as a Control")}, {"as_Menu", (PyCFunction)ResObj_as_Menu, 1, PyDoc_STR("Return this resource/handle as a Menu")}, +#endif /* !__LP64__ */ {"LoadResource", (PyCFunction)ResObj_LoadResource, 1, PyDoc_STR("() -> None")}, {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1, @@ -1152,6 +1155,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1287,6 +1291,7 @@ _res = Py_None; return _res; } +#endif /* !__LP64__ */ static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args) { @@ -1327,6 +1332,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1394,6 +1400,7 @@ return _res; } + static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1413,6 +1420,7 @@ nextRefNum); return _res; } +#endif /* !__LP64__ */ static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args) { @@ -1438,6 +1446,8 @@ return _res; } + +#ifndef __LP64__ static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1534,6 +1544,7 @@ PyMac_BuildFSSpec, &newSpec); return _res; } +#endif /* __LP64__ */ static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args) { @@ -1544,7 +1555,7 @@ UniCharCount forkNameLength__len__; int forkNameLength__in_len__; SignedByte permissions; - SInt16 refNum; + ResFileRefNum refNum; #ifndef FSOpenResourceFile PyMac_PRECHECK(FSOpenResourceFile); #endif @@ -1637,6 +1648,7 @@ PyDoc_STR("(short refNum) -> (short _rv)")}, {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1, PyDoc_STR("(short refNum, short attrs) -> None")}, +#ifndef __LP64__ {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")}, {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, @@ -1647,10 +1659,12 @@ PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")}, +#endif /* !__LP64__ */ {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1, PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")}, {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1, PyDoc_STR("(SInt16 refNum) -> None")}, +#ifndef __LP64__ {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1, PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1, @@ -1659,14 +1673,17 @@ PyDoc_STR("() -> (SInt16 refNum)")}, {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")}, +#endif /* __LP64__ */ {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")}, +#ifndef __LP64__ {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1, PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")}, {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1, PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")}, +#endif /* __LP64__ */ {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1, PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")}, {"Handle", (PyCFunction)Res_Handle, 1, @@ -1676,7 +1693,6 @@ - /* Alternative version of ResObj_New, which returns None for null argument */ PyObject *OptResObj_New(Handle itself) { Modified: python/trunk/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/trunk/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/trunk/Mac/Modules/scrap/_Scrapmodule.c Thu Jun 5 14:58:24 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -315,8 +316,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Scrap_methods[] = { +#ifndef __LP64__ {"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1, PyDoc_STR("() -> None")}, {"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1, @@ -327,6 +330,7 @@ PyDoc_STR("() -> None")}, {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1, PyDoc_STR("() -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -336,12 +340,15 @@ void init_Scrap(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Scrap", Scrap_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Scrap_Error = PyMac_GetOSErrException(); if (Scrap_Error == NULL || @@ -351,6 +358,7 @@ Py_INCREF(&Scrap_Type); if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0) Py_FatalError("can't initialize ScrapType"); +#endif /* __LP64__ */ } /* ======================= End module _Scrap ======================== */ Modified: python/trunk/Mac/Modules/snd/_Sndmodule.c ============================================================================== --- python/trunk/Mac/Modules/snd/_Sndmodule.c (original) +++ python/trunk/Mac/Modules/snd/_Sndmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -981,8 +982,10 @@ byteCount); return _res; } +#endif /* __LP64__ */ static PyMethodDef Snd_methods[] = { +#ifndef __LP64__ {"SPB", (PyCFunction)Snd_SPB, 1, PyDoc_STR(NULL)}, {"SysBeep", (PyCFunction)Snd_SysBeep, 1, @@ -1047,10 +1050,12 @@ PyDoc_STR("(long inRefNum) -> (long milliseconds)")}, {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1, PyDoc_STR("(long inRefNum) -> (long byteCount)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int @@ -1113,19 +1118,23 @@ SetA5(A5); } } +#endif /* __LP64__ */ void init_Snd(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Snd", Snd_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Snd_Error = PyMac_GetOSErrException(); if (Snd_Error == NULL || @@ -1145,6 +1154,7 @@ /* Backward-compatible name */ Py_INCREF(&SPB_Type); PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type); +#endif /* __LP64__ */ } /* ======================== End module _Snd ========================= */ Modified: python/trunk/Mac/Modules/te/_TEmodule.c ============================================================================== --- python/trunk/Mac/Modules/te/_TEmodule.c (original) +++ python/trunk/Mac/Modules/te/_TEmodule.c Thu Jun 5 14:58:24 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1267,8 +1268,10 @@ TEObj_New, _rv); return _res; } +#endif /* __LP64__ */ static PyMethodDef TE_methods[] = { +#ifndef __LP64__ {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, PyDoc_STR("() -> (Handle _rv)")}, {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, @@ -1295,6 +1298,7 @@ PyDoc_STR("(UInt8 value) -> None")}, {"as_TE", (PyCFunction)TE_as_TE, 1, PyDoc_STR("(Handle h) -> (TEHandle _rv)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1304,6 +1308,7 @@ void init_TE(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1311,8 +1316,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_TE", TE_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); TE_Error = PyMac_GetOSErrException(); if (TE_Error == NULL || @@ -1325,6 +1332,7 @@ /* Backward-compatible name */ Py_INCREF(&TE_Type); PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type); +#endif /* __LP64__ */ } /* ========================= End module _TE ========================= */ Modified: python/trunk/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/trunk/Mac/Modules/win/_Winmodule.c (original) +++ python/trunk/Mac/Modules/win/_Winmodule.c Thu Jun 5 14:58:24 2008 @@ -3,7 +3,7 @@ #include "Python.h" - +#ifndef __LP64__ #include "pymactoolbox.h" @@ -3147,8 +3147,10 @@ WinObj_WhichWindow, theWindow); return _res; } +#endif /* __LP64__ */ static PyMethodDef Win_methods[] = { +#ifndef __LP64__ {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")}, {"NewWindow", (PyCFunction)Win_NewWindow, 1, @@ -3200,10 +3202,12 @@ {"FindWindow", (PyCFunction)Win_FindWindow, 1, PyDoc_STR("(Point thePoint) -> (short _rv, WindowPtr theWindow)")}, {NULL, NULL, 0} +#endif /* __LP64__ */ }; +#ifndef __LP64__ /* Return the object corresponding to the window, or NULL */ PyObject * @@ -3226,20 +3230,22 @@ return it; } +#endif /* __LP64__ */ void init_Win(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; + PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); - - PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); - PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); - +#endif /* __LP64__ */ m = Py_InitModule("_Win", Win_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Win_Error = PyMac_GetOSErrException(); if (Win_Error == NULL || @@ -3252,6 +3258,7 @@ /* Backward-compatible name */ Py_INCREF(&Window_Type); PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type); +#endif /* __LP64__ */ } /* ======================== End module _Win ========================= */ Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Thu Jun 5 14:58:24 2008 @@ -430,7 +430,7 @@ $(RESSRCDIR)/Info.plist $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) if test "${UNIVERSALSDK}"; then \ - $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \ + $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \ -isysroot "${UNIVERSALSDK}" \ -all_load $(LIBRARY) -Wl,-single_module \ -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \ @@ -1051,13 +1051,22 @@ frameworkinstallapps: cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)" +frameworkinstallapps4way: + cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)" + # This install the unix python and pythonw tools in /usr/local/bin frameworkinstallunixtools: cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)" +frameworkinstallunixtools4way: + cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)" + frameworkaltinstallunixtools: cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)" +frameworkaltinstallunixtools4way: + cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)" + # This installs the Demos and Tools into the applications directory. # It is not part of a normal frameworkinstall frameworkinstallextras: @@ -1184,7 +1193,7 @@ # Perform some verification checks on any modified files. check: - ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py # Dependencies Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 5 14:58:24 2008 @@ -259,6 +259,14 @@ - The Mac Modules (including Carbon) have been deprecated for removal in Python 3.0. +- Library: on MacOS X you can now set ``ARCHFLAGS`` in the shell + environment to control the '-arch' flags that are used to build + an extension. This was added for compatibility with Apple's build + of Python. + +- The bundled OSX-specific copy of libbffi is now in sync with the version + shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. + Build ----- @@ -266,6 +274,23 @@ - ``Lib/lib-old`` is now added to sys.path. +- On MacOS X it is now possible to install the framework in 64-bit + mode or even as a 4-way universal binary (that is, PPC, i386, + PPC64 and x86_64 support in one binary) + + This is controlled by the configure argument ``--with-universal-archs``: + + - ``--with-universal-archs=all``: install 4-way universal + + - ``--with-universal-archs=32-bit``: install 2-way universal, 32-bit (the default) + + - ``--with-universal-archs=64-bit``: install 2-way universal, 64-bit + + This option should be used in combination with ``--enable-universalsdk=``. + + NOTE: 64-bit and 4-way builds are only suppported on Mac OS X 10.5 (or later). + + C API ----- Modified: python/trunk/Modules/_ctypes/cfield.c ============================================================================== --- python/trunk/Modules/_ctypes/cfield.c (original) +++ python/trunk/Modules/_ctypes/cfield.c Thu Jun 5 14:58:24 2008 @@ -1758,6 +1758,7 @@ #ifdef ffi_type_longdouble #undef ffi_type_longdouble #endif + /* This is already defined on OSX */ ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, FFI_TYPE_LONGDOUBLE }; Modified: python/trunk/Modules/_ctypes/libffi_osx/x86/x86-darwin.S ============================================================================== --- python/trunk/Modules/_ctypes/libffi_osx/x86/x86-darwin.S (original) +++ python/trunk/Modules/_ctypes/libffi_osx/x86/x86-darwin.S Thu Jun 5 14:58:24 2008 @@ -179,7 +179,6 @@ movl %ebp,%esp popl %ebp ret -.LFE1: .ffi_call_SYSV_end: #if 0 .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV @@ -220,7 +219,7 @@ #else .long .LFB1 /* FDE initial location */ #endif - .long .LFE1-.LFB1 /* FDE address range */ + .long .ffi_call_SYSV_end-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif Modified: python/trunk/Python/mactoolboxglue.c ============================================================================== --- python/trunk/Python/mactoolboxglue.c (original) +++ python/trunk/Python/mactoolboxglue.c Thu Jun 5 14:58:24 2008 @@ -106,6 +106,7 @@ } +#ifndef __LP64__ OSErr PyMac_GetFullPathname(FSSpec *fss, char *path, int len) { @@ -153,6 +154,7 @@ Py_XDECREF(fs); return err; } +#endif /* !__LP64__ */ /* Convert a 4-char string object argument to an OSType value */ int @@ -417,6 +419,7 @@ GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs") GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs") +#ifndef __LP64__ GLUE_NEW(Track, TrackObj_New, "Carbon.Qt") GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt") GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt") @@ -429,6 +432,7 @@ GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt") GLUE_NEW(Media, MediaObj_New, "Carbon.Qt") GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt") +#endif /* !__LP64__ */ GLUE_NEW(Handle, ResObj_New, "Carbon.Res") GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res") Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Thu Jun 5 14:58:24 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 63545 . +# From configure.in Revision: 63690 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -703,6 +703,7 @@ LN OPT BASECFLAGS +UNIVERSAL_ARCH_FLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO @@ -1328,6 +1329,9 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-universal-archs=ARCH + select architectures for universal build ("32-bit", + "64-bit" or "all") --with-framework-name=FRAMEWORK specify an alternate name of the framework built with --enable-framework @@ -1850,6 +1854,16 @@ _ACEOF +# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable +# them. + +cat >>confdefs.h <<\_ACEOF +#define _DARWIN_C_SOURCE 1 +_ACEOF + + + define_xopen_source=yes # Arguments passed to configure. @@ -1883,6 +1897,27 @@ +UNIVERSAL_ARCHS="32-bit" +{ echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 +echo $ECHO_N "checking for --with-universal-archs... $ECHO_C" >&6; } + +# Check whether --with-universal-archs was given. +if test "${with_universal_archs+set}" = set; then + withval=$with_universal_archs; + { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } + UNIVERSAL_ARCHS="$withval" + +else + + { echo "$as_me:$LINENO: result: 32-bit" >&5 +echo "${ECHO_T}32-bit" >&6; } + +fi + + + + # Check whether --with-framework-name was given. if test "${with_framework_name+set}" = set; then @@ -1927,9 +1962,14 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" - FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" - FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" + else + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + fi + if test "x${prefix}" = "xNONE" ; then FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" else @@ -1968,6 +2008,12 @@ fi enable_framework= + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST=update4wayuniversal + FRAMEWORKALTINSTALLLAST=update4wayuniversal + fi + fi @@ -4509,6 +4555,11 @@ fi + +# The -arch flags for universal builds on OSX +UNIVERSAL_ARCH_FLAGS= + + # tweak BASECFLAGS based on compiler and platform case $GCC in yes) @@ -4589,7 +4640,25 @@ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd # used to be here, but non-Apple gcc doesn't accept them. if test "${enable_universalsdk}"; then - BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + UNIVERSAL_ARCH_FLAGS="" + if test "$UNIVERSAL_ARCHS" = "32-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" + + elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" + + elif test "$UNIVERSAL_ARCHS" = "all" ; then + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" + + else + { { echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 +echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} + { (exit 1); exit 1; }; } + + fi + + + BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" fi ;; @@ -12500,6 +12569,12 @@ if test ${cur_target} '>' 10.2; then cur_target=10.3 fi + if test "${UNIVERSAL_ARCHS}" = "all"; then + # Ensure that the default platform for a 4-way + # universal build is OSX 10.5, that's the first + # OS release where 4-way builds make sense. + cur_target='10.5' + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the @@ -12510,10 +12585,10 @@ export MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET='' - if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 + if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 then if test "${enable_universalsdk}"; then - LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" @@ -22212,8 +22287,6 @@ esac - - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). { echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 @@ -24771,6 +24844,7 @@ LN!$LN$ac_delim OPT!$OPT$ac_delim BASECFLAGS!$BASECFLAGS$ac_delim +UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim SO!$SO$ac_delim @@ -24780,7 +24854,6 @@ LINKFORSHARED!$LINKFORSHARED$ac_delim CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim SHLIBS!$SHLIBS$ac_delim -USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -24822,6 +24895,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim LDLAST!$LDLAST$ac_delim @@ -24844,7 +24918,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Thu Jun 5 14:58:24 2008 @@ -57,6 +57,12 @@ # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) +# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable +# them. +AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) + + define_xopen_source=yes # Arguments passed to configure. @@ -86,6 +92,20 @@ ]) AC_SUBST(UNIVERSALSDK) +UNIVERSAL_ARCHS="32-bit" +AC_MSG_CHECKING(for --with-universal-archs) +AC_ARG_WITH(universal-archs, + AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit" or "all")), +[ + AC_MSG_RESULT($withval) + UNIVERSAL_ARCHS="$withval" +], +[ + AC_MSG_RESULT(32-bit) +]) + + + AC_ARG_WITH(framework-name, AC_HELP_STRING(--with-framework-name=FRAMEWORK, specify an alternate name of the framework built with --enable-framework), @@ -127,9 +147,14 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" - FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" - FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" + else + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + fi + if test "x${prefix}" = "xNONE" ; then FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" else @@ -160,6 +185,12 @@ FRAMEWORKUNIXTOOLSPREFIX="${prefix}" fi enable_framework= + + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST=update4wayuniversal + FRAMEWORKALTINSTALLLAST=update4wayuniversal + fi ]) AC_SUBST(PYTHONFRAMEWORK) AC_SUBST(PYTHONFRAMEWORKIDENTIFIER) @@ -827,6 +858,11 @@ fi AC_SUBST(BASECFLAGS) + +# The -arch flags for universal builds on OSX +UNIVERSAL_ARCH_FLAGS= +AC_SUBST(UNIVERSAL_ARCH_FLAGS) + # tweak BASECFLAGS based on compiler and platform case $GCC in yes) @@ -865,7 +901,23 @@ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd # used to be here, but non-Apple gcc doesn't accept them. if test "${enable_universalsdk}"; then - BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + UNIVERSAL_ARCH_FLAGS="" + if test "$UNIVERSAL_ARCHS" = "32-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" + + elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" + + elif test "$UNIVERSAL_ARCHS" = "all" ; then + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" + + else + AC_MSG_ERROR([proper usage is --with-universalarch=32-bit|64-bit|all]) + + fi + + + BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" fi ;; @@ -1558,6 +1610,12 @@ if test ${cur_target} '>' 10.2; then cur_target=10.3 fi + if test "${UNIVERSAL_ARCHS}" = "all"; then + # Ensure that the default platform for a 4-way + # universal build is OSX 10.5, that's the first + # OS release where 4-way builds make sense. + cur_target='10.5' + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the @@ -1568,10 +1626,10 @@ export MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET='' - if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 + if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 then if test "${enable_universalsdk}"; then - LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" @@ -3191,23 +3249,6 @@ # check for endianness AC_C_BIGENDIAN -AH_VERBATIM([WORDS_BIGENDIAN], -[ - /* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). - - The block below does compile-time checking for endianness on platforms - that use GCC and therefore allows compiling fat binaries on OSX by using - '-arch ppc -arch i386' as the compile flags. The phrasing was choosen - such that the configure-result is used on systems that don't use GCC. - */ -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN 1 -#else -#ifndef __LITTLE_ENDIAN__ -#undef WORDS_BIGENDIAN -#endif -#endif]) # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Thu Jun 5 14:58:24 2008 @@ -489,6 +489,9 @@ /* Define if you have readline 4.2 */ #undef HAVE_RL_COMPLETION_MATCHES +/* Define when using libedit's readline emulation */ +#undef HAVE_RL_DISPM_VFUNC + /* Define if you have readline 4.0 */ #undef HAVE_RL_PRE_INPUT_HOOK @@ -973,22 +976,9 @@ /* Define to profile with the Pentium timestamp counter */ #undef WITH_TSC - - /* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). - - The block below does compile-time checking for endianness on platforms - that use GCC and therefore allows compiling fat binaries on OSX by using - '-arch ppc -arch i386' as the compile flags. The phrasing was choosen - such that the configure-result is used on systems that don't use GCC. - */ -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN 1 -#else -#ifndef __LITTLE_ENDIAN__ +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN -#endif -#endif /* Define to 1 if on AIX 3. System headers sometimes define this. @@ -1003,6 +993,9 @@ /* Define on Irix to enable u_int */ #undef _BSD_TYPES +/* Define on Darwin to activate all library features */ +#undef _DARWIN_C_SOURCE + /* This must be set to 64 on some systems to enable large file support. */ #undef _FILE_OFFSET_BITS Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Thu Jun 5 14:58:24 2008 @@ -248,6 +248,19 @@ 'WARNING: skipping import check for Carbon-based "%s"' % ext.name) return + + if self.get_platform() == 'darwin' and ( + sys.maxint > 2**32 and '-arch' in ext.extra_link_args): + # Don't bother doing an import check when an extension was + # build with an explicit '-arch' flag on OSX. That's currently + # only used to build 32-bit only extensions in a 4-way + # universal build and loading 32-bit code into a 64-bit + # process will fail. + self.announce( + 'WARNING: skipping import check for "%s"' % + ext.name) + return + # Workaround for Cygwin: Cygwin currently has fork issues when many # modules have been imported if self.get_platform() == 'cygwin': @@ -541,10 +554,12 @@ # readline do_readline = self.compiler.find_library_file(lib_dirs, 'readline') - if platform == 'darwin': + if platform == 'darwin': # and os.uname()[2] < '9.': # MacOSX 10.4 has a broken readline. Don't try to build # the readline module unless the user has installed a fixed # readline package + # FIXME: The readline emulation on 10.5 is better, but the + # readline module doesn't compile out of the box. if find_file('readline/rlconf.h', inc_dirs, []) is None: do_readline = False if do_readline: @@ -1304,11 +1319,24 @@ '_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm', '_Help', '_Icn', '_IBCarbon', '_List', '_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs', - '_Scrap', '_Snd', '_TE', '_Win', + '_Scrap', '_Snd', '_TE', ] for name in CARBON_EXTS: addMacExtension(name, carbon_kwds) + # Workaround for a bug in the version of gcc shipped with Xcode 3. + # The _Win extension should build just like the other Carbon extensions, but + # this actually results in a hard crash of the linker. + # + if '-arch ppc64' in cflags and '-arch ppc' in cflags: + win_kwds = {'extra_compile_args': carbon_extra_compile_args + ['-arch', 'i386', '-arch', 'ppc'], + 'extra_link_args': ['-framework', 'Carbon', '-arch', 'i386', '-arch', 'ppc'], + } + addMacExtension('_Win', win_kwds) + else: + addMacExtension('_Win', carbon_kwds) + + # Application Services & QuickTime app_kwds = {'extra_compile_args': carbon_extra_compile_args, 'extra_link_args': ['-framework','ApplicationServices'], @@ -1375,11 +1403,29 @@ include_dirs.append('/usr/X11R6/include') frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] + # All existing framework builds of Tcl/Tk don't support 64-bit + # architectures. + cflags = sysconfig.get_config_vars('CFLAGS')[0] + archs = re.findall('-arch\s+(\w+)', cflags) + if 'x86_64' in archs or 'ppc64' in archs: + try: + archs.remove('x86_64') + except ValueError: + pass + try: + archs.remove('ppc64') + except ValueError: + pass + + for a in archs: + frameworks.append('-arch') + frameworks.append(a) + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], define_macros=[('WITH_APPINIT', 1)], include_dirs = include_dirs, libraries = [], - extra_compile_args = frameworks, + extra_compile_args = frameworks[2:], extra_link_args = frameworks, ) self.extensions.append(ext) @@ -1510,6 +1556,7 @@ '_ctypes', 'libffi_osx')) sources = [os.path.join(ffi_srcdir, p) for p in ['ffi.c', + 'x86/darwin64.S', 'x86/x86-darwin.S', 'x86/x86-ffi_darwin.c', 'x86/x86-ffi64.c', From buildbot at python.org Thu Jun 5 15:11:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 13:11:15 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080605131115.511751E4006@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/395 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: ronald.oussoren BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Bus error sincerely, -The Buildbot From buildbot at python.org Thu Jun 5 15:17:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 13:17:38 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080605131738.51B141E4003@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/97 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 5 16:00:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 14:00:25 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080605140025.5E1201E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3491 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_platform ====================================================================== FAIL: test_mac_ver (test.test_platform.PlatformTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_platform.py", line 86, in test_mac_ver self.assertEquals(res[0], real_ver) AssertionError: '' != '10.4.4' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From musiccomposition at gmail.com Thu Jun 5 16:26:26 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Thu, 5 Jun 2008 09:26:26 -0500 Subject: [Python-checkins] r63955 - in python/trunk: Doc/library/macos.rst Include/Python.h Include/pymacconfig.h Include/pymactoolbox.h Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/distutils/util.py Lib/test/test_macos.py Mac/IDLE/Makefi Message-ID: <1afaf6160806050726q730889a7q50cd2e496f92566@mail.gmail.com> Can you personally oversee the merge into Py3k? (making sure the changes get into Modules/_gestalt.c) From python-checkins at python.org Thu Jun 5 17:34:33 2008 From: python-checkins at python.org (thomas.lee) Date: Thu, 5 Jun 2008 17:34:33 +0200 (CEST) Subject: [Python-checkins] r63956 - in python/branches/tlee-ast-optimize: Include/optimize.h Python/bltinmodule.c Python/compile.c Python/import.c Python/optimize.c Python/pythonrun.c Message-ID: <20080605153433.127101E4004@bag.python.org> Author: thomas.lee Date: Thu Jun 5 17:34:32 2008 New Revision: 63956 Log: Separate symtable generation and compilation. The AST optimizer will run between the two phases. AST optimizer yet to be updated to make use of symtable information. Modified: python/branches/tlee-ast-optimize/Include/optimize.h python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Python/import.c python/branches/tlee-ast-optimize/Python/optimize.c python/branches/tlee-ast-optimize/Python/pythonrun.c Modified: python/branches/tlee-ast-optimize/Include/optimize.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/optimize.h (original) +++ python/branches/tlee-ast-optimize/Include/optimize.h Thu Jun 5 17:34:32 2008 @@ -5,7 +5,8 @@ extern "C" { #endif -PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena); +PyAPI_FUNC(int) PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, + PyArena* arena); #ifdef __cplusplus }; Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Thu Jun 5 17:34:32 2008 @@ -6,6 +6,7 @@ #include "node.h" #include "code.h" #include "eval.h" +#include "symtable.h" #include "optimize.h" #include @@ -448,6 +449,53 @@ return res; } +static PyObject* +_ast_compile(PyObject *cmd, const char *filename, int mode, int optimize, + PyCompilerFlags *cf) +{ + PyArena *arena = NULL; + struct symtable *st = NULL; + PyFutureFeatures *ff = NULL; + PyCodeObject* co = NULL; + mod_ty mod; + PyCompilerInfo ci; + + arena = PyArena_New(); + mod = PyAST_obj2mod(cmd, arena, mode); + if (mod == NULL) + goto cleanup; + ff = PyFuture_FromAST(mod, filename); + if (ff == NULL) + goto cleanup; + st = PySymtable_Build(mod, filename, ff); + if (st == NULL) + goto cleanup; + if (optimize) { + if (!PyAST_Optimize(&mod, st, arena)) + goto cleanup; + } + + ci.ci_filename = filename; + ci.ci_future = ff; + ci.ci_symtable = st; + ci.ci_flags = cf; + + if (!cf || !(cf->cf_flags & PyCF_NO_OPTIMIZE)) + if (!PyAST_Optimize(&mod, ci.ci_symtable, arena)) + goto cleanup; + + co = PyAST_CompileEx(mod, &ci, arena); + +cleanup: + if (ff != NULL) + PyObject_Free(ff); + if (st != NULL) + PySymtable_Free(st); + if (arena != NULL) + PyArena_Free(arena); + return (PyObject*)co; +} + PyDoc_STRVAR(coerce_doc, "coerce(x, y) -> (x1, y1)\n\ \n\ @@ -513,25 +561,12 @@ result = cmd; } else { - PyArena *arena; - mod_ty mod; - - arena = PyArena_New(); - mod = PyAST_obj2mod(cmd, arena, mode); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } - if (!(supplied_flags & PyCF_NO_OPTIMIZE)) { - if (!PyAST_Optimize(&mod, arena)) { - PyArena_Free(arena); - return NULL; - } - } - result = (PyObject*)PyAST_Compile(mod, filename, &cf, arena); - PyArena_Free(arena); + result = _ast_compile(cmd, filename, mode, + !(supplied_flags & PyCF_NO_OPTIMIZE), &cf); } return result; + + /* XXX: this is awful */ } #ifdef Py_USING_UNICODE Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Thu Jun 5 17:34:32 2008 @@ -272,7 +272,7 @@ c.c_flags = flags; c.c_nestlevel = 0; - c.c_st = PySymtable_Build(mod, info->ci_filename, c.c_future); + c.c_st = info->ci_symtable; if (c.c_st == NULL) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, "no symtable"); @@ -292,28 +292,30 @@ PyCodeObject * PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags, - PyArena *arena) + PyArena *arena) { - PyCompilerInfo info; - PyCodeObject* result; + PyCompilerInfo ci; + PyCodeObject* co = NULL; - info.ci_filename = filename; - info.ci_flags = flags; - info.ci_future = PyFuture_FromAST(mod, filename); - if (info.ci_future == NULL) - return NULL; - info.ci_symtable = PySymtable_Build(mod, filename, info.ci_future); - if (info.ci_symtable == NULL) { - PyObject_Free(info.ci_future); - return NULL; - } - - result = PyAST_CompileEx(mod, &info, arena); - - PyObject_Free(info.ci_future); - PySymtable_Free(info.ci_symtable); - - return result; + ci.ci_filename = filename; + ci.ci_flags = flags; + ci.ci_future = NULL; + ci.ci_symtable = NULL; + + ci.ci_future = PyFuture_FromAST(mod, filename); + if (ci.ci_future == NULL) + goto cleanup; + ci.ci_symtable = PySymtable_Build(mod, filename, ci.ci_future); + if (ci.ci_symtable == NULL) + goto cleanup; + co = PyAST_CompileEx(mod, &ci, arena); + +cleanup: + if (ci.ci_future != NULL) + PyObject_Free(ci.ci_future); + if (ci.ci_symtable != NULL) + PySymtable_Free(ci.ci_symtable); + return co; } PyCodeObject * @@ -321,15 +323,33 @@ { PyCodeObject *co = NULL; mod_ty mod; + PyCompilerInfo ci; PyArena *arena = PyArena_New(); if (!arena) return NULL; + + ci.ci_filename = filename; + ci.ci_future = NULL; + ci.ci_symtable = NULL; + ci.ci_flags = NULL; + mod = PyAST_FromNode(n, NULL, filename, arena); if (mod != NULL) { - if (PyAST_Optimize(&mod, arena)) { - co = PyAST_Compile(mod, filename, NULL, arena); - } - } + ci.ci_future = PyFuture_FromAST(mod, filename); + if (ci.ci_future == NULL) + goto cleanup; + ci.ci_symtable = PySymtable_Build(mod, filename, ci.ci_future); + if (ci.ci_symtable == NULL) + goto cleanup; + if (!PyAST_Optimize(&mod, ci.ci_symtable, arena)) + goto cleanup; + co = PyAST_CompileEx(mod, &ci, arena); + } +cleanup: + if (ci.ci_symtable != NULL) + PySymtable_Free(ci.ci_symtable); + if (ci.ci_future != NULL) + PyObject_Free(ci.ci_future); PyArena_Free(arena); return co; } Modified: python/branches/tlee-ast-optimize/Python/import.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/import.c (original) +++ python/branches/tlee-ast-optimize/Python/import.c Thu Jun 5 17:34:32 2008 @@ -14,6 +14,8 @@ #include "eval.h" #include "osdefs.h" #include "importdl.h" +#include "optimize.h" +#include "symtable.h" #ifdef HAVE_FCNTL_H #include @@ -818,18 +820,36 @@ { PyCodeObject *co = NULL; mod_ty mod; - PyCompilerFlags flags; + PyCompilerInfo ci; + PyCompilerFlags cf; PyArena *arena = PyArena_New(); if (arena == NULL) return NULL; - flags.cf_flags = 0; + ci.ci_filename = pathname; + ci.ci_future = NULL; + ci.ci_symtable = NULL; + ci.ci_flags = &cf; + cf.cf_flags = 0; - mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, &flags, - NULL, arena); + mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, + &cf, NULL, arena); if (mod) { - co = PyAST_Compile(mod, pathname, NULL, arena); - } + ci.ci_future = PyFuture_FromAST(mod, pathname); + if (ci.ci_future == NULL) + goto cleanup; + ci.ci_symtable = PySymtable_Build(mod, pathname, ci.ci_future); + if (ci.ci_symtable == NULL) + goto cleanup; + if (!PyAST_Optimize(&mod, ci.ci_symtable, arena)) + goto cleanup; + co = PyAST_CompileEx(mod, &ci, arena); + } +cleanup: + if (ci.ci_symtable != NULL) + PySymtable_Free(ci.ci_symtable); + if (ci.ci_future != NULL) + PyObject_Free(ci.ci_future); PyArena_Free(arena); return co; } Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Thu Jun 5 17:34:32 2008 @@ -1211,8 +1211,9 @@ * Optimize an AST. */ int -PyAST_Optimize(mod_ty* mod_ptr, PyArena* arena) +PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, PyArena* arena) { + /* TODO: update optimize_* functions to accept an ste */ return optimize_mod(mod_ptr, arena); } Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Thu Jun 5 17:34:32 2008 @@ -1325,12 +1325,34 @@ PyCompilerFlags *flags, PyArena *arena) { PyCodeObject *co; - PyObject *v; - co = PyAST_Compile(mod, filename, flags, arena); - if (co == NULL) - return NULL; - v = PyEval_EvalCode(co, globals, locals); - Py_DECREF(co); + PyObject *v = NULL; + PyCompilerInfo ci; + + ci.ci_filename = filename; + ci.ci_future = NULL; + ci.ci_symtable = NULL; + ci.ci_flags = flags; + + ci.ci_future = PyFuture_FromAST(mod, filename); + if (ci.ci_future == NULL) + goto cleanup; + ci.ci_symtable = PySymtable_Build(mod, filename, ci.ci_future); + if (ci.ci_symtable == NULL) + goto cleanup; + if (!flags || !(flags->cf_flags & PyCF_NO_OPTIMIZE)) + if (!PyAST_Optimize(&mod, ci.ci_symtable, arena)) + goto cleanup; + + co = PyAST_CompileEx(mod, &ci, arena); +cleanup: + if (ci.ci_symtable != NULL) + PySymtable_Free(ci.ci_symtable); + if (ci.ci_future != NULL) + PyObject_Free(ci.ci_future); + if (co != NULL) { + v = PyEval_EvalCode(co, globals, locals); + Py_DECREF(co); + } return v; } @@ -1372,21 +1394,39 @@ { PyCodeObject *co; mod_ty mod; + PyCompilerInfo ci; PyArena *arena = PyArena_New(); if (arena == NULL) return NULL; + ci.ci_filename = filename; + ci.ci_future = NULL; + ci.ci_symtable = NULL; + ci.ci_flags = flags; + mod = PyParser_ASTFromString(str, filename, start, flags, arena); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } + if (mod == NULL) + goto cleanup; + ci.ci_future = PyFuture_FromAST(mod, filename); + if (ci.ci_future == NULL) + goto cleanup; + ci.ci_symtable = PySymtable_Build(mod, filename, ci.ci_future); + if (ci.ci_symtable == NULL) + goto cleanup; + if (!flags || !(flags->cf_flags & PyCF_NO_OPTIMIZE)) + if (!PyAST_Optimize(&mod, ci.ci_symtable, arena)) + goto cleanup; if (flags && (flags->cf_flags & PyCF_ONLY_AST)) { PyObject *result = PyAST_mod2obj(mod); PyArena_Free(arena); return result; } - co = PyAST_Compile(mod, filename, flags, arena); + co = PyAST_CompileEx(mod, &ci, arena); +cleanup: + if (ci.ci_future != NULL) + PyObject_Free(ci.ci_future); + if (ci.ci_symtable != NULL) + PySymtable_Free(ci.ci_symtable); PyArena_Free(arena); return (PyObject *)co; } @@ -1431,9 +1471,6 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) - if (!PyAST_Optimize(&mod, arena)) - return NULL; return mod; } else { @@ -1459,9 +1496,6 @@ } mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); - if (mod != NULL && flags && !(flags->cf_flags & PyCF_NO_OPTIMIZE)) - if (!PyAST_Optimize(&mod, arena)) - return NULL; return mod; } else { From python-checkins at python.org Thu Jun 5 17:42:14 2008 From: python-checkins at python.org (thomas.lee) Date: Thu, 5 Jun 2008 17:42:14 +0200 (CEST) Subject: [Python-checkins] r63957 - in python/branches/tlee-ast-optimize: Demo/turtle Doc/library/macos.rst Doc/library/turtle.rst Include/Python.h Include/pymacconfig.h Include/pymactoolbox.h Lib/distutils/sysconfig.py Lib/distutils/unixccompiler.py Lib/distutils/util.py Lib/lib-tk/Tkinter.py Lib/lib-tk/turtle.py Lib/test/test_complex.py Lib/test/test_macos.py Mac/IDLE/Makefile.in Mac/IDLE/idlemain.py Mac/Makefile.in Mac/Modules/ColorPickermodule.c Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/OSATerminology.c Mac/Modules/ae/_AEmodule.c Mac/Modules/app/_Appmodule.c Mac/Modules/carbonevt/_CarbonEvtmodule.c Mac/Modules/cg/_CGmodule.c Mac/Modules/cm/_Cmmodule.c Mac/Modules/ctl/_Ctlmodule.c Mac/Modules/dlg/_Dlgmodule.c Mac/Modules/drag/_Dragmodule.c Mac/Modules/evt/_Evtmodule.c Mac/Modules/file/_Filemodule.c Mac/Modules/file/filesupport.py Mac/Modules/fm/_Fmmodule.c Mac/Modules/folder/_Foldermodule.c Mac/Modules/help/_Helpmodule.c Mac/Modules/ibcarbon/_IBCarbon.c Mac/Modules/icn/_Icnmodule.c Mac/Modules/launch/_Launchmodule.c Mac/Modules/list/_Listmodule.c Mac/Modules/menu/_Menumodule.c Mac/Modules/mlte/_Mltemodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/qt/_Qtmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndmodule.c Mac/Modules/te/_TEmodule.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Misc/ACKS Misc/NEWS Modules/_ctypes/cfield.c Modules/_ctypes/libffi_osx/x86/x86-darwin.S Objects/complexobject.c Python/bltinmodule.c Python/mactoolboxglue.c configure configure.in pyconfig.h.in setup.py Message-ID: <20080605154214.2B9FD1E4004@bag.python.org> Author: thomas.lee Date: Thu Jun 5 17:42:10 2008 New Revision: 63957 Log: Merged revisions 63912-63956 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r63914 | georg.brandl | 2008-06-03 20:23:15 +1000 (Tue, 03 Jun 2008) | 2 lines Fix Tkinter sequence passing. #2906. ........ r63929 | martin.v.loewis | 2008-06-04 16:29:55 +1000 (Wed, 04 Jun 2008) | 2 lines Patch #1513695: New turtle module, with demos. ........ r63932 | georg.brandl | 2008-06-04 21:17:26 +1000 (Wed, 04 Jun 2008) | 2 lines Complete revision of new turtle module's docs. ........ r63942 | thomas.heller | 2008-06-05 04:59:03 +1000 (Thu, 05 Jun 2008) | 42 lines Issue #1798: Add ctypes calling convention that allows safe access to errno (and LastError, on Windows). ctypes maintains a module-global, but thread-local, variable that contains an error number; called 'ctypes_errno' for this discussion. This variable is a private copy of the systems 'errno' value; the copy is swapped with the 'errno' variable on several occasions. Foreign functions created with CDLL(..., use_errno=True), when called, swap the values just before the actual function call, and swapped again immediately afterwards. The 'use_errno' parameter defaults to False, in this case 'ctypes_errno' is not touched. The values are also swapped immeditately before and after ctypes callback functions are called, if the callbacks are constructed using the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True). Two new ctypes functions are provided to access the 'ctypes_errno' value from Python: - ctypes.set_errno(value) sets ctypes_errno to 'value', the previous ctypes_errno value is returned. - ctypes.get_errno() returns the current ctypes_errno value. --- On Windows, the same scheme is implemented for the error value which is managed by the GetLastError() and SetLastError() windows api calls. The ctypes functions are 'ctypes.set_last_error(value)' and 'ctypes.get_last_error()', the CDLL and WinDLL optional parameter is named 'use_last_error', defaults to False. --- On Windows, TlsSetValue and TlsGetValue calls are used to provide thread local storage for the variables; ctypes compiled with __GNUC__ uses __thread variables. ........ r63943 | thomas.heller | 2008-06-05 05:19:00 +1000 (Thu, 05 Jun 2008) | 1 line Fix ctypes.set_errno for gcc. ........ r63945 | thomas.heller | 2008-06-05 06:22:05 +1000 (Thu, 05 Jun 2008) | 7 lines Revert revisions 63943 and 63942 (Issue #1798: Add ctypes calling convention that allows safe access to errno) This code does not yet work on OS X (__thread storage specifier not available), so i needs a configure check plus a more portable solution. ........ r63948 | alexandre.vassalotti | 2008-06-05 06:41:44 +1000 (Thu, 05 Jun 2008) | 2 lines Fixed complex.__getnewargs__() to not emit another complex object. ........ r63955 | ronald.oussoren | 2008-06-05 22:58:24 +1000 (Thu, 05 Jun 2008) | 20 lines MacOS X: Enable 4-way universal builds This patch adds a new configure argument on OSX: --with-universal-archs=[32-bit|64-bit|all] When used with the --enable-universalsdk option this controls which CPU architectures are includes in the framework. The default is 32-bit, meaning i386 and ppc. The most useful alternative is 'all', which includes all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64). This includes limited support for the Carbon bindings in 64-bit mode as well, limited because (a) I haven't done extensive testing and (b) a large portion of the Carbon API's aren't available in 64-bit mode anyway. I've also duplicated a feature of Apple's build of python: setting the environment variable 'ARCHFLAGS' controls the '-arch' flags used for building extensions using distutils. ........ Added: python/branches/tlee-ast-optimize/Demo/turtle/ - copied from r63955, /python/trunk/Demo/turtle/ python/branches/tlee-ast-optimize/Include/pymacconfig.h - copied unchanged from r63955, /python/trunk/Include/pymacconfig.h python/branches/tlee-ast-optimize/Lib/test/test_macos.py - copied unchanged from r63955, /python/trunk/Lib/test/test_macos.py Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/library/macos.rst python/branches/tlee-ast-optimize/Doc/library/turtle.rst python/branches/tlee-ast-optimize/Include/Python.h python/branches/tlee-ast-optimize/Include/pymactoolbox.h python/branches/tlee-ast-optimize/Lib/distutils/sysconfig.py python/branches/tlee-ast-optimize/Lib/distutils/unixccompiler.py python/branches/tlee-ast-optimize/Lib/distutils/util.py python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py python/branches/tlee-ast-optimize/Lib/lib-tk/turtle.py python/branches/tlee-ast-optimize/Lib/test/test_complex.py python/branches/tlee-ast-optimize/Mac/IDLE/Makefile.in python/branches/tlee-ast-optimize/Mac/IDLE/idlemain.py python/branches/tlee-ast-optimize/Mac/Makefile.in python/branches/tlee-ast-optimize/Mac/Modules/ColorPickermodule.c python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c python/branches/tlee-ast-optimize/Mac/Modules/Nav.c python/branches/tlee-ast-optimize/Mac/Modules/OSATerminology.c python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c python/branches/tlee-ast-optimize/Mac/Modules/app/_Appmodule.c python/branches/tlee-ast-optimize/Mac/Modules/carbonevt/_CarbonEvtmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cg/_CGmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cm/_Cmmodule.c python/branches/tlee-ast-optimize/Mac/Modules/ctl/_Ctlmodule.c python/branches/tlee-ast-optimize/Mac/Modules/dlg/_Dlgmodule.c python/branches/tlee-ast-optimize/Mac/Modules/drag/_Dragmodule.c python/branches/tlee-ast-optimize/Mac/Modules/evt/_Evtmodule.c python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c python/branches/tlee-ast-optimize/Mac/Modules/file/filesupport.py python/branches/tlee-ast-optimize/Mac/Modules/fm/_Fmmodule.c python/branches/tlee-ast-optimize/Mac/Modules/folder/_Foldermodule.c python/branches/tlee-ast-optimize/Mac/Modules/help/_Helpmodule.c python/branches/tlee-ast-optimize/Mac/Modules/ibcarbon/_IBCarbon.c python/branches/tlee-ast-optimize/Mac/Modules/icn/_Icnmodule.c python/branches/tlee-ast-optimize/Mac/Modules/launch/_Launchmodule.c python/branches/tlee-ast-optimize/Mac/Modules/list/_Listmodule.c python/branches/tlee-ast-optimize/Mac/Modules/menu/_Menumodule.c python/branches/tlee-ast-optimize/Mac/Modules/mlte/_Mltemodule.c python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c python/branches/tlee-ast-optimize/Mac/Modules/qt/_Qtmodule.c python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndmodule.c python/branches/tlee-ast-optimize/Mac/Modules/te/_TEmodule.c python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c python/branches/tlee-ast-optimize/Makefile.pre.in python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-darwin.S python/branches/tlee-ast-optimize/Objects/complexobject.c python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/mactoolboxglue.c python/branches/tlee-ast-optimize/configure python/branches/tlee-ast-optimize/configure.in python/branches/tlee-ast-optimize/pyconfig.h.in python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Doc/library/macos.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/macos.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/macos.rst Thu Jun 5 17:42:10 2008 @@ -58,11 +58,19 @@ elaborate functionality was available), but it provides a convenient location to attach a breakpoint in a low-level debugger like :program:`gdb`. + .. note:: + + Not available in 64-bit mode. + .. function:: SysBeep() Ring the bell. + .. note:: + + Not available in 64-bit mode. + .. function:: GetTicks() @@ -74,6 +82,10 @@ Return the file creator and file type as two four-character strings. The *file* parameter can be a pathname or an ``FSSpec`` or ``FSRef`` object. + .. note:: + + It is not possible to use an ``FSSpec`` in 64-bit mode. + .. function:: SetCreatorAndType(file, creator, type) @@ -81,6 +93,9 @@ ``FSSpec`` or ``FSRef`` object. *creator* and *type* must be four character strings. + .. note:: + + It is not possible to use an ``FSSpec`` in 64-bit mode. .. function:: openrf(name [, mode]) @@ -98,3 +113,12 @@ from an application bundle either when it has been started with :program:`pythonw` instead of :program:`python` or when running as an applet. +.. function:: splash([resourceid]) + + Opens a splash screen by resource id. Use resourceid ``0`` to close + the splash screen. + + .. note:: + + Not available in 64-bit mode. + Modified: python/branches/tlee-ast-optimize/Doc/library/turtle.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/turtle.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/turtle.rst Thu Jun 5 17:42:10 2008 @@ -1,312 +1,1888 @@ - +======================================== :mod:`turtle` --- Turtle graphics for Tk ======================================== -.. module:: turtle - :platform: Tk - :synopsis: An environment for turtle graphics. -.. moduleauthor:: Guido van Rossum +Introduction +============ +Turtle graphics is a popular way for introducing programming to kids. It was +part of the original Logo programming language developed by Wally Feurzig and +Seymour Papert in 1966. + +Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it the +command ``turtle.forward(15)``, and it moves (on-screen!) 15 pixels in the +direction it is facing, drawing a line as it moves. Give it the command +``turtle.left(25)``, and it rotates in-place 25 degrees clockwise. + +By combining together these and similar commands, intricate shapes and pictures +can easily be drawn. + +The :mod:`turtle` module is an extended reimplementation of the same-named +module from the Python standard distribution up to version Python 2.5. + +It tries to keep the merits of the old turtle module and to be (nearly) 100% +compatible with it. This means in the first place to enable the learning +programmer to use all the commands, classes and methods interactively when using +the module from within IDLE run with the ``-n`` switch. + +The turtle module provides turtle graphics primitives, in both object-oriented +and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying +graphics, it needs a version of python installed with Tk support. + +The object-oriented interface uses essentially two+two classes: + +1. The :class:`TurtleScreen` class defines graphics windows as a playground for + the drawing turtles. Its constructor needs a :class:`Tkinter.Canvas` or a + :class:`ScrolledCanvas` as argument. It should be used when :mod:`turtle` is + used as part of some application. + + Derived from :class:`TurtleScreen` is the subclass :class:`Screen`. Screen + is implemented as sort of singleton, so there can exist only one instance of + Screen at a time. It should be used when :mod:`turtle` is used as a + standalone tool for doing graphics. + + All methods of TurtleScreen/Screen also exist as functions, i.e. as part of + the procedure-oriented interface. + +2. :class:`RawTurtle` (alias: :class:`RawPen`) defines Turtle objects which draw + on a :class:`TurtleScreen`. Its constructor needs a Canvas, ScrolledCanvas + or TurtleScreen as argument, so the RawTurtle objects know where to draw. + + Derived from RawTurtle is the subclass :class:`Turtle` (alias: :class:`Pen`), + which draws on "the" :class:`Screen` - instance which is automatically + created, if not already present. + + All methods of RawTurtle/Turtle also exist as functions, i.e. part of the + procedure-oriented interface. + +The procedural interface provides functions which are derived from the methods +of the classes :class:`Screen` and :class:`Turtle`. They have the same names as +the corresponding methods. A screen object is automativally created whenever a +function derived from a Screen method is called. An (unnamed) turtle object is +automatically created whenever any of the functions derived from a Turtle method +is called. + +To use multiple turtles an a screen one has to use the object-oriented interface. + +.. note:: + In the following documentation the argument list for functions is given. + Methods, of course, have the additional first argument *self* which is + omitted here. + + +Overview over available Turtle and Screen methods +================================================= + +Turtle methods +-------------- + +Turtle motion + Move and draw + | :func:`forward` | :func:`fd` + | :func:`backward` | :func:`bk` | :func:`back` + | :func:`right` | :func:`rt` + | :func:`left` | :func:`lt` + | :func:`goto` | :func:`setpos` | :func:`setposition` + | :func:`setx` + | :func:`sety` + | :func:`setheading` | :func:`seth` + | :func:`home` + | :func:`circle` + | :func:`dot` + | :func:`stamp` + | :func:`clearstamp` + | :func:`clearstamps` + | :func:`undo` + | :func:`speed` + + Tell Turtle's state + | :func:`position` | :func:`pos` + | :func:`towards` + | :func:`xcor` + | :func:`ycor` + | :func:`heading` + | :func:`distance` + + Setting and measurement + | :func:`degrees` + | :func:`radians` + +Pen control + Drawing state + | :func:`pendown` | :func:`pd` | :func:`down` + | :func:`penup` | :func:`pu` | :func:`up` + | :func:`pensize` | :func:`width` + | :func:`pen` + | :func:`isdown` + + Color control + | :func:`color` + | :func:`pencolor` + | :func:`fillcolor` + + Filling + | :func:`fill` + | :func:`begin_fill` + | :func:`end_fill` + + More drawing control + | :func:`reset` + | :func:`clear` + | :func:`write` + +Turtle state + Visibility + | :func:`showturtle` | :func:`st` + | :func:`hideturtle` | :func:`ht` + | :func:`isvisible` + + Appearance + | :func:`shape` + | :func:`resizemode` + | :func:`shapesize` | :func:`turtlesize` + | :func:`settiltangle` + | :func:`tiltangle` + | :func:`tilt` + +Using events + | :func:`onclick` + | :func:`onrelease` + | :func:`ondrag` + +Special Turtle methods + | :func:`begin_poly` + | :func:`end_poly` + | :func:`get_poly` + | :func:`clone` + | :func:`getturtle` | :func:`getpen` + | :func:`getscreen` + | :func:`setundobuffer` + | :func:`undobufferentries` + | :func:`tracer` + | :func:`window_width` + | :func:`window_height` -.. sectionauthor:: Moshe Zadka +Methods of TurtleScreen/Screen +------------------------------ -The :mod:`turtle` module provides turtle graphics primitives, in both an -object-oriented and procedure-oriented ways. Because it uses :mod:`Tkinter` for -the underlying graphics, it needs a version of python installed with Tk support. +Window control + | :func:`bgcolor` + | :func:`bgpic` + | :func:`clear` | :func:`clearscreen` + | :func:`reset` | :func:`resetscreen` + | :func:`screensize` + | :func:`setworldcoordinates` + +Animation control + | :func:`delay` + | :func:`tracer` + | :func:`update` + +Using screen events + | :func:`listen` + | :func:`onkey` + | :func:`onclick` | :func:`onscreenclick` + | :func:`ontimer` + +Settings and special methods + | :func:`mode` + | :func:`colormode` + | :func:`getcanvas` + | :func:`getshapes` + | :func:`register_shape` | :func:`addshape` + | :func:`turtles` + | :func:`window_height` + | :func:`window_width` + +Methods specific to Screen + | :func:`bye` + | :func:`exitonclick` + | :func:`setup` + | :func:`title` -The procedural interface uses a pen and a canvas which are automagically created -when any of the functions are called. -The :mod:`turtle` module defines the following functions: +Methods of RawTurtle/Turtle and corresponding functions +======================================================= +Most of the examples in this section refer to a Turtle instance called +``turtle``. -.. function:: degrees() +Turtle motion +------------- - Set angle measurement units to degrees. +.. function:: forward(distance) + fd(distance) + :param distance: a number (integer or float) -.. function:: radians() + Move the turtle forward by the specified *distance*, in the direction the + turtle is headed. - Set angle measurement units to radians. + >>> turtle.position() + (0.00, 0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) -.. function:: setup(**kwargs) +.. function:: back(distance) + bk(distance) + backward(distance) - Sets the size and position of the main window. Keywords are: + :param distance: a number - * ``width``: either a size in pixels or a fraction of the screen. The default is - 50% of the screen. + Move the turtle backward by *distance*, opposite to the direction the + turtle is headed. Do not change the turtle's heading. - * ``height``: either a size in pixels or a fraction of the screen. The default - is 50% of the screen. + >>> turtle.position() + (0.00, 0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00, 0.00) - * ``startx``: starting position in pixels from the left edge of the screen. - ``None`` is the default value and centers the window horizontally on screen. - * ``starty``: starting position in pixels from the top edge of the screen. - ``None`` is the default value and centers the window vertically on screen. +.. function:: right(angle) + rt(angle) - Examples:: + :param angle: a number (integer or float) - # Uses default geometry: 50% x 50% of screen, centered. - setup() + Turn turtle right by *angle* units. (Units are by default degrees, but + can be set via the :func:`degrees` and :func:`radians` functions.) Angle + orientation depends on the turtle mode, see :func:`mode`. + + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 - # Sets window to 200x200 pixels, in upper left of screen - setup (width=200, height=200, startx=0, starty=0) - # Sets window to 75% of screen by 50% of screen, and centers it. - setup(width=.75, height=0.5, startx=None, starty=None) +.. function:: left(angle) + lt(angle) + :param angle: a number (integer or float) -.. function:: title(title_str) + Turn turtle left by *angle* units. (Units are by default degrees, but + can be set via the :func:`degrees` and :func:`radians` functions.) Angle + orientation depends on the turtle mode, see :func:`mode`. + + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + +.. function:: goto(x, y=None) + setpos(x, y=None) + setposition(x, y=None) + + :param x: a number or a pair/vector of numbers + :param y: a number or ``None`` + + If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` + (e.g. as returned by :func:`pos`). + + Move turtle to an absolute position. If the pen is down, draw line. Do + not change the turtle's orientation. + + >>> tp = turtle.pos() + >>> tp + (0.00, 0.00) + >>> turtle.setpos(60,30) + >>> turtle.pos() + (60.00,30.00) + >>> turtle.setpos((20,80)) + >>> turtle.pos() + (20.00,80.00) + >>> turtle.setpos(tp) + >>> turtle.pos() + (0.00,0.00) - Set the window's title to *title*. +.. function:: setx(x) -.. function:: done() + :param x: a number (integer or float) - Enters the Tk main loop. The window will continue to be displayed until the - user closes it or the process is killed. + Set the turtle's first coordinate to *x*, leave second coordinate + unchanged. + >>> turtle.position() + (0.00, 240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00, 240.00) -.. function:: reset() - Clear the screen, re-center the pen, and set variables to the default values. +.. function:: sety(y) + :param y: a number (integer or float) -.. function:: clear() + Set the turtle's first coordinate to *y*, leave second coordinate + unchanged. - Clear the screen. + >>> turtle.position() + (0.00, 40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00, -10.00) -.. function:: tracer(flag) +.. function:: setheading(to_angle) + seth(to_angle) - Set tracing on/off (according to whether flag is true or not). Tracing means - line are drawn more slowly, with an animation of an arrow along the line. + :param to_angle: a number (integer or float) + Set the orientation of the turtle to *to_angle*. Here are some common + directions in degrees: -.. function:: speed(speed) + =================== ==================== + standard mode logo mode + =================== ==================== + 0 - east 0 - north + 90 - north 90 - east + 180 - west 180 - south + 270 - south 270 - west + =================== ==================== - Set the speed of the turtle. Valid values for the parameter *speed* are - ``'fastest'`` (no delay), ``'fast'``, (delay 5ms), ``'normal'`` (delay 10ms), - ``'slow'`` (delay 15ms), and ``'slowest'`` (delay 20ms). + >>> turtle.setheading(90) + >>> turtle.heading() + 90 - .. versionadded:: 2.5 +.. function:: home() -.. function:: delay(delay) + Move turtle to the origin -- coordinates (0,0) -- and set its heading to + its start-orientation (which depends on the mode, see :func:`mode`). - Set the speed of the turtle to *delay*, which is given in ms. - .. versionadded:: 2.5 +.. function:: circle(radius, extent=None, steps=None) + :param radius: a number + :param extent: a number (or ``None``) + :param steps: an integer (or ``None``) -.. function:: forward(distance) + Draw a circle with given *radius*. The center is *radius* units left of + the turtle; *extent* -- an angle -- determines which part of the circle + is drawn. If *extent* is not given, draw the entire circle. If *extent* + is not a full circle, one endpoint of the arc is the current pen + position. Draw the arc in counterclockwise direction if *radius* is + positive, otherwise in clockwise direction. Finally the direction of the + turtle is changed by the amount of *extent*. - Go forward *distance* steps. + As the circle is approximated by an inscribed regular polygon, *steps* + determines the number of steps to use. If not given, it will be + calculated automatically. May be used to draw regular polygons. + >>> turtle.circle(50) + >>> turtle.circle(120, 180) # draw a semicircle -.. function:: backward(distance) - Go backward *distance* steps. +.. function:: dot(size=None, *color) + :param size: an integer >= 1 (if given) + :param color: a colorstring or a numeric color tuple -.. function:: left(angle) + Draw a circular dot with diameter *size*, using *color*. If *size* is + not given, the maximum of pensize+4 and 2*pensize is used. - Turn left *angle* units. Units are by default degrees, but can be set via the - :func:`degrees` and :func:`radians` functions. + >>> turtle.dot() + >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) -.. function:: right(angle) +.. function:: stamp() + + Stamp a copy of the turtle shape onto the canvas at the current turtle + position. Return a stamp_id for that stamp, which can be used to delete + it by calling ``clearstamp(stamp_id)``. + + >>> turtle.color("blue") + >>> turtle.stamp() + 13 + >>> turtle.fd(50) + + +.. function:: clearstamp(stampid) + + :param stampid: an integer, must be return value of previous + :func:`stamp` call + + Delete stamp with given *stampid*. + + >>> turtle.color("blue") + >>> astamp = turtle.stamp() + >>> turtle.fd(50) + >>> turtle.clearstamp(astamp) + + +.. function:: clearstamps(n=None) + + :param n: an integer (or ``None``) + + Delete all or first/last *n* of turtle's stamps. If *n* is None, delete + all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete + last *n* stamps. + + >>> for i in range(8): + ... turtle.stamp(); turtle.fd(30) + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + + +.. function:: undo() + + Undo (repeatedly) the last turtle action(s). Number of available + undo actions is determined by the size of the undobuffer. + + >>> for i in range(4): + ... turtle.fd(50); turtle.lt(80) + ... + >>> for i in range(8): + ... turtle.undo() + + +.. function:: speed(speed=None) + + :param speed: an integer in the range 0..10 or a speedstring (see below) + + Set the turtle's speed to an integer value in the range 0..10. If no + argument is given, return current speed. + + If input is a number greater than 10 or smaller than 0.5, speed is set + to 0. Speedstrings are mapped to speedvalues as follows: + + * "fastest": 0 + * "fast": 10 + * "normal": 6 + * "slow": 3 + * "slowest": 1 + + Speeds from 1 to 10 enforce increasingly faster animation of line drawing + and turtle turning. + + Attention: *speed* = 0 means that *no* animation takes + place. forward/back makes turtle jump and likewise left/right make the + turtle turn instantly. + + >>> turtle.speed(3) + + +Tell Turtle's state +------------------- + +.. function:: position() + pos() + + Return the turtle's current location (x,y) (as a :class:`Vec2D` vector). + + >>> turtle.pos() + (0.00, 240.00) + + +.. function:: towards(x, y=None) + + :param x: a number or a pair/vector of numbers or a turtle instance + :param y: a number if *x* is a number, else ``None`` + + Return the angle between the line from turtle position to position specified + by (x,y), the vector or the other turtle. This depends on the turtle's start + orientation which depends on the mode - "standard"/"world" or "logo"). + + >>> turtle.pos() + (10.00, 10.00) + >>> turtle.towards(0,0) + 225.0 + + +.. function:: xcor() + + Return the turtle's x coordinate. + + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.xcor() + 50.0 + + +.. function:: ycor() + + Return the turtle's y coordinate. + + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.ycor() + 86.6025403784 + + +.. function:: heading() + + Return the turtle's current heading (value depends on the turtle mode, see + :func:`mode`). + + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + + +.. function:: distance(x, y=None) + + :param x: a number or a pair/vector of numbers or a turtle instance + :param y: a number if *x* is a number, else ``None`` + + Return the distance from the turtle to (x,y), the given vector, or the given + other turtle, in turtle step units. + + >>> turtle.pos() + (0.00, 0.00) + >>> turtle.distance(30,40) + 50.0 + >>> joe = Turtle() + >>> joe.forward(77) + >>> turtle.distance(joe) + 77.0 + + +Settings for measurement +------------------------ + +.. function:: degrees(fullcircle=360.0) + + :param fullcircle: a number + + Set angle measurement units, i.e. set number of "degrees" for a full circle. + Default value is 360 degrees. + + >>> turtle.left(90) + >>> turtle.heading() + 90 + >>> turtle.degrees(400.0) # angle measurement in gon + >>> turtle.heading() + 100 + + +.. function:: radians() + + Set the angle measurement units to radians. Equivalent to + ``degrees(2*math.pi)``. + + >>> turtle.heading() + 90 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + + +Pen control +----------- + +Drawing state +~~~~~~~~~~~~~ + +.. function:: pendown() + pd() + down() + + Pull the pen down -- drawing when moving. + - Turn right *angle* units. Units are by default degrees, but can be set via the - :func:`degrees` and :func:`radians` functions. +.. function:: penup() + pu() + up() + Pull the pen up -- no drawing when moving. -.. function:: up() - Move the pen up --- stop drawing. +.. function:: pensize(width=None) + width(width=None) + :param width: a positive number -.. function:: down() + Set the line thickness to *width* or return it. If resizemode is set to + "auto" and turtleshape is a polygon, that polygon is drawn with the same line + thickness. If no argument is given, the current pensize is returned. - Move the pen down --- draw when moving. + >>> turtle.pensize() + 1 + >>> turtle.pensize(10) # from here on lines of width 10 are drawn -.. function:: width(width) +.. function:: pen(pen=None, **pendict) - Set the line width to *width*. + :param pen: a dictionary with some or all of the below listed keys + :param pendict: one or more keyword-arguments with the below listed keys as keywords + Return or set the pen's attributes in a "pen-dictionary" with the following + key/value pairs: -.. function:: color(s) - color((r, g, b)) - color(r, g, b) + * "shown": True/False + * "pendown": True/False + * "pencolor": color-string or color-tuple + * "fillcolor": color-string or color-tuple + * "pensize": positive number + * "speed": number in range 0..10 + * "resizemode": "auto" or "user" or "noresize" + * "stretchfactor": (positive number, positive number) + * "outline": positive number + * "tilt": number - Set the pen color. In the first form, the color is specified as a Tk color - specification as a string. The second form specifies the color as a tuple of - the RGB values, each in the range [0..1]. For the third form, the color is - specified giving the RGB values as three separate parameters (each in the range - [0..1]). + This dicionary can be used as argument for a subsequent call to :func:`pen` + to restore the former pen-state. Moreover one or more of these attributes + can be provided as keyword-arguments. This can be used to set several pen + attributes in one statement. + >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', + 'stretchfactor': (1,1), 'speed': 3} + >>> penstate=turtle.pen() + >>> turtle.color("yellow","") + >>> turtle.penup() + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', + 'stretchfactor': (1,1), 'speed': 3} + >>> p.pen(penstate, fillcolor="green") + >>> p.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', + 'stretchfactor': (1,1), 'speed': 3} -.. function:: write(text[, move]) - Write *text* at the current pen position. If *move* is true, the pen is moved to - the bottom-right corner of the text. By default, *move* is false. +.. function:: isdown() + Return ``True`` if pen is down, ``False`` if it's up. + + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + + +Color control +~~~~~~~~~~~~~ + +.. function:: pencolor(*args) + + Return or set the pencolor. + + Four input formats are allowed: + + ``pencolor()`` + Return the current pencolor as color specification string, possibly in + hex-number format (see example). May be used as input to another + color/pencolor/fillcolor call. + + ``pencolor(colorstring)`` + Set pencolor to *colorstring*, which is a Tk color specification string, + such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. + + ``pencolor((r, g, b))`` + Set pencolor to the RGB color represented by the tuple of *r*, *g*, and + *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where + colormode is either 1.0 or 255 (see :func:`colormode`). + + ``pencolor(r, g, b)`` + Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of + *r*, *g*, and *b* must be in the range 0..colormode. + + If turtleshape is a polygon, the outline of that polygon is drawn with the + newly set pencolor. + + >>> turtle.pencolor("brown") + >>> tup = (0.2, 0.8, 0.55) + >>> turtle.pencolor(tup) + >>> turtle.pencolor() + "#33cc8c" + + +.. function:: fillcolor(*args) + + Return or set the fillcolor. + + Four input formats are allowed: + + ``fillcolor()`` + Return the current fillcolor as color specification string, possibly in + hex-number format (see example). May be used as input to another + color/pencolor/fillcolor call. + + ``fillcolor(colorstring)`` + Set fillcolor to *colorstring*, which is a Tk color specification string, + such as ``"red"``, ``"yellow"``, or ``"#33cc8c"``. + + ``fillcolor((r, g, b))`` + Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and + *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where + colormode is either 1.0 or 255 (see :func:`colormode`). + + ``fillcolor(r, g, b)`` + Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of + *r*, *g*, and *b* must be in the range 0..colormode. + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + >>> turtle.fillcolor("violet") + >>> col = turtle.pencolor() + >>> turtle.fillcolor(col) + >>> turtle.fillcolor(0, .5, 0) + + +.. function:: color(*args) + + Return or set pencolor and fillcolor. + + Several input formats are allowed. They use 0 to 3 arguments as + follows: + + ``color()`` + Return the current pencolor and the current fillcolor as a pair of color + specification strings as returned by :func:`pencolor` and + :func:`fillcolor`. + + ``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)`` + Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the + given value. + + ``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))`` + Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` + and analogously if the other input format is used. + + If turtleshape is a polygon, outline and interior of that polygon is drawn + with the newly set colors. + + >>> turtle.color("red", "green") + >>> turtle.color() + ("red", "green") + >>> colormode(255) + >>> color((40, 80, 120), (160, 200, 240)) + >>> color() + ("#285078", "#a0c8f0") + + +See also: Screen method :func:`colormode`. + + +Filling +~~~~~~~ .. function:: fill(flag) - The complete specifications are rather complex, but the recommended usage is: - call ``fill(1)`` before drawing a path you want to fill, and call ``fill(0)`` - when you finish to draw the path. + :param flag: True/False (or 1/0 respectively) + + Call ``fill(True)`` before drawing the shape you want to fill, and + ``fill(False)`` when done. When used without argument: return fillstate + (``True`` if filling, ``False`` else). + + >>> turtle.fill(True) + >>> for _ in range(3): + ... turtle.forward(100) + ... turtle.left(120) + ... + >>> turtle.fill(False) .. function:: begin_fill() - Switch turtle into filling mode; Must eventually be followed by a corresponding - end_fill() call. Otherwise it will be ignored. + Call just before drawing a shape to be filled. Equivalent to ``fill(True)``. - .. versionadded:: 2.5 + >>> turtle.color("black", "red") + >>> turtle.begin_fill() + >>> turtle.circle(60) + >>> turtle.end_fill() .. function:: end_fill() - End filling mode, and fill the shape; equivalent to ``fill(0)``. + Fill the shape drawn after the last call to :func:`begin_fill`. Equivalent + to ``fill(False)``. - .. versionadded:: 2.5 +More drawing control +~~~~~~~~~~~~~~~~~~~~ + +.. function:: reset() -.. function:: circle(radius[, extent]) + Delete the turtle's drawings from the screen, re-center the turtle and set + variables to the default values. - Draw a circle with radius *radius* whose center-point is *radius* units left of - the turtle. *extent* determines which part of a circle is drawn: if not given it - defaults to a full circle. + >>> turtle.position() + (0.00,-22.00) + >>> turtle.heading() + 100.0 + >>> turtle.reset() + >>> turtle.position() + (0.00,0.00) + >>> turtle.heading() + 0.0 - If *extent* is not a full circle, one endpoint of the arc is the current pen - position. The arc is drawn in a counter clockwise direction if *radius* is - positive, otherwise in a clockwise direction. In the process, the direction of - the turtle is changed by the amount of the *extent*. +.. function:: clear() -.. function:: goto(x, y) - goto((x, y)) + Delete the turtle's drawings from the screen. Do not move turtle. State and + position of the turtle as well as drawings of other turtles are not affected. - Go to co-ordinates *x*, *y*. The co-ordinates may be specified either as two - separate arguments or as a 2-tuple. +.. function:: write(arg, move=False, align="left", font=("Arial", 8, "normal")) -.. function:: towards(x, y) + :param arg: object to be written to the TurtleScreen + :param move: True/False + :param align: one of the strings "left", "center" or right" + :param font: a triple (fontname, fontsize, fonttype) - Return the angle of the line from the turtle's position to the point *x*, *y*. - The co-ordinates may be specified either as two separate arguments, as a - 2-tuple, or as another pen object. + Write text - the string representation of *arg* - at the current turtle + position according to *align* ("left", "center" or right") and with the given + font. If *move* is True, the pen is moved to the bottom-right corner of the + text. By default, *move* is False. - .. versionadded:: 2.5 + >>> turtle.write("Home = ", True, align="center") + >>> turtle.write((0,0), True) -.. function:: heading() +Turtle state +------------ - Return the current orientation of the turtle. +Visibility +~~~~~~~~~~ - .. versionadded:: 2.3 +.. function:: showturtle() + st() + Make the turtle visible. -.. function:: setheading(angle) + >>> turtle.hideturtle() + >>> turtle.showturtle() - Set the orientation of the turtle to *angle*. - .. versionadded:: 2.3 +.. function:: hideturtle() + ht() + Make the turtle invisible. It's a good idea to do this while you're in the + middle of doing some complex drawing, because hiding the turtle speeds up the + drawing observably. -.. function:: position() + >>> turtle.hideturtle() - Return the current location of the turtle as an ``(x,y)`` pair. - .. versionadded:: 2.3 +.. function:: isvisible() + Return True if the Turtle is shown, False if it's hidden. -.. function:: setx(x) + >>> turtle.hideturtle() + >>> print turtle.isvisible(): + False - Set the x coordinate of the turtle to *x*. - .. versionadded:: 2.3 +Appearance +~~~~~~~~~~ +.. function:: shape(name=None) -.. function:: sety(y) + :param name: a string which is a valid shapename + + Set turtle shape to shape with given *name* or, if name is not given, return + name of current shape. Shape with *name* must exist in the TurtleScreen's + shape dictionary. Initially there are the following polygon shapes: "arrow", + "turtle", "circle", "square", "triangle", "classic". To learn about how to + deal with shapes see Screen method :func:`register_shape`. + + >>> turtle.shape() + "arrow" + >>> turtle.shape("turtle") + >>> turtle.shape() + "turtle" + + +.. function:: resizemode(rmode=None) + + :param rmode: one of the strings "auto", "user", "noresize" + + Set resizemode to one of the values: "auto", "user", "noresize". If *rmode* + is not given, return current resizemode. Different resizemodes have the + following effects: + + - "auto": adapts the appearance of the turtle corresponding to the value of pensize. + - "user": adapts the appearance of the turtle according to the values of + stretchfactor and outlinewidth (outline), which are set by + :func:`shapesize`. + - "noresize": no adaption of the turtle's appearance takes place. + + resizemode("user") is called by :func:`shapesize` when used with arguments. + + >>> turtle.resizemode("noresize") + >>> turtle.resizemode() + "noresize" + + +.. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) + + :param stretch_wid: positive number + :param stretch_len: positive number + :param outline: positive number + + Return or set the pen's attributes x/y-stretchfactors and/or outline. Set + resizemode to "user". If and only if resizemode is set to "user", the turtle + will be displayed stretched according to its stretchfactors: *stretch_wid* is + stretchfactor perpendicular to its orientation, *stretch_len* is + stretchfactor in direction of its orientation, *outline* determines the width + of the shapes's outline. + + >>> turtle.resizemode("user") + >>> turtle.shapesize(5, 5, 12) + >>> turtle.shapesize(outline=8) + + +.. function:: tilt(angle) + + :param angle: a number + + Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* + change the turtle's heading (direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + + +.. function:: settiltangle(angle) + + :param angle: a number + + Rotate the turtleshape to point in the direction specified by *angle*, + regardless of its current tilt-angle. *Do not* change the turtle's heading + (direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.settiltangle(45) + >>> stamp() + >>> turtle.fd(50) + >>> turtle.settiltangle(-45) + >>> stamp() + >>> turtle.fd(50) + + +.. function:: tiltangle() + + Return the current tilt-angle, i.e. the angle between the orientation of the + turtleshape and the heading of the turtle (its direction of movement). + + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(45) + >>> turtle.tiltangle() + 45 + + +Using events +------------ + +.. function:: onclick(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, + existing bindings are removed. Example for the anonymous turtle, i.e. the + procedural way: + + >>> def turn(x, y): + ... left(180) + ... + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed + + +.. function:: onrelease(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-button-release events on this turtle. If *fun* is + ``None``, existing bindings are removed. + + >>> class MyTurtle(Turtle): + ... def glow(self,x,y): + ... self.fillcolor("red") + ... def unglow(self,x,y): + ... self.fillcolor("") + ... + >>> turtle = MyTurtle() + >>> turtle.onclick(turtle.glow) # clicking on turtle turns fillcolor red, + >>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent. + + +.. function:: ondrag(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding - Set the y coordinate of the turtle to *y*. + Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, + existing bindings are removed. - .. versionadded:: 2.3 + Remark: Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. + + >>> turtle.ondrag(turtle.goto) + # Subsequently, clicking and dragging the Turtle will move it across + # the screen thereby producing handdrawings (if pen is down). + + +Special Turtle methods +---------------------- + +.. function:: begin_poly() + + Start recording the vertices of a polygon. Current turtle position is first + vertex of polygon. + + +.. function:: end_poly() + + Stop recording the vertices of a polygon. Current turtle position is last + vertex of polygon. This will be connected with the first vertex. + + +.. function:: get_poly() + + Return the last recorded polygon. + + >>> p = turtle.get_poly() + >>> turtle.register_shape("myFavouriteShape", p) + + +.. function:: clone() + + Create and return a clone of the turtle with same position, heading and + turtle properties. + + >>> mick = Turtle() + >>> joe = mick.clone() + + +.. function:: getturtle() + + Return the Turtle object itself. Only reasonable use: as a function to + return the "anonymous turtle": + + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + >>> turtles() + [] + + +.. function:: getscreen() + + Return the :class:`TurtleScreen` object the turtle is drawing on. + TurtleScreen methods can then be called for that object. + + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + + +.. function:: setundobuffer(size) + + :param size: an integer or ``None`` + + Set or disable undobuffer. If *size* is an integer an empty undobuffer of + given size is installed. *size* gives the maximum number of turtle actions + that can be undone by the :func:`undo` method/function. If *size* is + ``None``, the undobuffer is disabled. + + >>> turtle.setundobuffer(42) + + +.. function:: undobufferentries() + + Return number of entries in the undobuffer. + + >>> while undobufferentries(): + ... undo() + + +.. function:: tracer(flag=None, delay=None) + + A replica of the corresponding TurtleScreen method. + + .. deprecated:: 2.6 .. function:: window_width() + window_height() + + Both are replicas of the corresponding TurtleScreen methods. + + .. deprecated:: 2.6 + + +.. _compoundshapes: + +Excursus about the use of compound shapes +----------------------------------------- + +To use compound turtle shapes, which consist of several polygons of different +color, you must use the helper class :class:`Shape` explicitly as described +below: + +1. Create an empty Shape object of type "compound". +2. Add as many components to this object as desired, using the + :meth:`addcomponent` method. + + For example: + + >>> s = Shape("compound") + >>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s.addcomponent(poly1, "red", "blue") + >>> poly2 = ((0,0),(10,-5),(-10,-5)) + >>> s.addcomponent(poly2, "blue", "red") + +3. Now add the Shape to the Screen's shapelist and use it: + + >>> register_shape("myshape", s) + >>> shape("myshape") + + +.. note:: + + The :class:`Shape` class is used internally by the :func:`register_shape` + method in different ways. The application programmer has to deal with the + Shape class *only* when using compound shapes like shown above! + + +Methods of TurtleScreen/Screen and corresponding functions +========================================================== + +Most of the examples in this section refer to a TurtleScreen instance called +``screen``. + + +Window control +-------------- + +.. function:: bgcolor(*args) + + :param args: a color string or three numbers in the range 0..colormode or a + 3-tuple of such numbers + + Set or return background color of the TurtleScreen. + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + "orange" + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + "#800080" + + +.. function:: bgpic(picname=None) + + :param picname: a string, name of a gif-file or ``"nopic"``, or ``None`` + + Set background image or return name of current backgroundimage. If *picname* + is a filename, set the corresponding image as background. If *picname* is + ``"nopic"``, delete background image, if present. If *picname* is ``None``, + return the filename of the current backgroundimage. + + >>> screen.bgpic() + "nopic" + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + "landscape.gif" + + +.. function:: clear() + clearscreen() + + Delete all drawings and all turtles from the TurtleScreen. Reset the now + empty TurtleScreen to its initial state: white background, no background + image, no event bindings and tracing on. + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``clearscreen``. The global function ``clear`` is another one + derived from the Turtle method ``clear``. + + +.. function:: reset() + resetscreen() + + Reset all Turtles on the Screen to their initial state. + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``resetscreen``. The global function ``reset`` is another one + derived from the Turtle method ``reset``. + + +.. function:: screensize(canvwidth=None, canvheight=None, bg=None) + + :param canvwidth: positive integer, new width of canvas in pixels + :param canvheight: positive integer, new height of canvas in pixels + :param bg: colorstring or color-tupel, new background color + + If no arguments are given, return current (canvaswidth, canvasheight). Else + resize the canvas the turtles are drawing on. Do not alter the drawing + window. To observe hidden parts of the canvas, use the scrollbars. With this + method, one can make visible those parts of a drawing which were outside the + canvas before. + + >>> turtle.screensize(2000,1500) + # e.g. to search for an erroneously escaped turtle ;-) + + +.. function:: setworldcoordinates(llx, lly, urx, ury) + + :param llx: a number, x-coordinate of lower left corner of canvas + :param lly: a number, y-coordinate of lower left corner of canvas + :param urx: a number, x-coordinate of upper right corner of canvas + :param ury: a number, y-coordinate of upper right corner of canvas + + Set up user-defined coordinate system and switch to mode "world" if + necessary. This performs a ``screen.reset()``. If mode "world" is already + active, all drawings are redrawn according to the new coordinates. + + **ATTENTION**: in user-defined coordinate systems angles may appear + distorted. + + >>> screen.reset() + >>> screen.setworldcoordinates(-50,-7.5,50,7.5) + >>> for _ in range(72): + ... left(10) + ... + >>> for _ in range(8): + ... left(45); fd(2) # a regular octogon - Return the width of the canvas window. - .. versionadded:: 2.3 +Animation control +----------------- + +.. function:: delay(delay=None) + + :param delay: positive integer + + Set or return the drawing *delay* in milliseconds. (This is approximately + the time interval between two consecutived canvas updates.) The longer the + drawing delay, the slower the animation. + + Optional argument: + + >>> screen.delay(15) + >>> screen.delay() + 15 + + +.. function:: tracer(n=None, delay=None) + + :param n: nonnegative integer + :param delay: nonnegative integer + + Turn turtle animation on/off and set delay for update drawings. If *n* is + given, only each n-th regular screen update is really performed. (Can be + used to accelerate the drawing of complex graphics.) Second argument sets + delay value (see :func:`delay`). + + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + ... fd(dist) + ... rt(90) + ... dist += 2 + + +.. function:: update() + + Perform a TurtleScreen update. To be used when tracer is turned off. + +See also the RawTurtle/Turtle method :func:`speed`. + + +Using screen events +------------------- + +.. function:: listen(xdummy=None, ydummy=None) + + Set focus on TurtleScreen (in order to collect key-events). Dummy arguments + are provided in order to be able to pass :func:`listen` to the onclick method. + + +.. function:: onkey(fun, key) + + :param fun: a function with no arguments or ``None`` + :param key: a string: key (e.g. "a") or key-symbol (e.g. "space") + + Bind *fun* to key-release event of key. If *fun* is ``None``, event bindings + are removed. Remark: in order to be able to register key-events, TurtleScreen + must have the focus. (See method :func:`listen`.) + + >>> def f(): + ... fd(50) + ... lt(60) + ... + >>> screen.onkey(f, "Up") + >>> screen.listen() + + +.. function:: onclick(fun, btn=1, add=None) + onscreenclick(fun, btn=1, add=None) + + :param fun: a function with two arguments which will be called with the + coordinates of the clicked point on the canvas + :param num: number of the mouse-button, defaults to 1 (left mouse button) + :param add: ``True`` or ``False`` -- if ``True``, a new binding will be + added, otherwise it will replace a former binding + + Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, + existing bindings are removed. + + Example for a TurtleScreen instance named ``screen`` and a Turtle instance + named turtle: + + >>> screen.onclick(turtle.goto) + # Subsequently clicking into the TurtleScreen will + # make the turtle move to the clicked point. + >>> screen.onclick(None) # remove event binding again + + .. note:: + This TurtleScreen method is available as a global function only under the + name ``onscreenclick``. The global function ``onclick`` is another one + derived from the Turtle method ``onclick``. + + +.. function:: ontimer(fun, t=0) + + :param fun: a function with no arguments + :param t: a number >= 0 + + Install a timer that calls *fun* after *t* milliseconds. + + >>> running = True + >>> def f(): + if running: + fd(50) + lt(60) + screen.ontimer(f, 250) + >>> f() ### makes the turtle marching around + >>> running = False + + +Settings and special methods +---------------------------- + +.. function:: mode(mode=None) + + :param mode: one of the strings "standard", "logo" or "world" + + Set turtle mode ("standard", "logo" or "world") and perform reset. If mode + is not given, current mode is returned. + + Mode "standard" is compatible with old :mod:`turtle`. Mode "logo" is + compatible with most Logo turtle graphics. Mode "world" uses user-defined + "world coordinates". **Attention**: in this mode angles appear distorted if + ``x/y`` unit-ratio doesn't equal 1. + + ============ ========================= =================== + Mode Initial turtle heading positive angles + ============ ========================= =================== + "standard" to the right (east) counterclockwise + "logo" upward (north) clockwise + ============ ========================= =================== + + >>> mode("logo") # resets turtle heading to north + >>> mode() + "logo" + + +.. function:: colormode(cmode=None) + + :param cmode: one of the values 1.0 or 255 + + Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* + values of color triples have to be in the range 0..\ *cmode*. + + >>> screen.colormode() + 1.0 + >>> screen.colormode(255) + >>> turtle.pencolor(240,160,80) + + +.. function:: getcanvas() + + Return the Canvas of this TurtleScreen. Useful for insiders who know what to + do with a Tkinter Canvas. + + >>> cv = screen.getcanvas() + >>> cv + + + +.. function:: getshapes() + + Return a list of names of all currently available turtle shapes. + + >>> screen.getshapes() + ["arrow", "blank", "circle", ..., "turtle"] + + +.. function:: register_shape(name, shape=None) + addshape(name, shape=None) + + There are three different ways to call this function: + + (1) *name* is the name of a gif-file and *shape* is ``None``: Install the + corresponding image shape. + + .. note:: + Image shapes *do not* rotate when turning the turtle, so they do not + display the heading of the turtle! + + (2) *name* is an arbitrary string and *shape* is a tuple of pairs of + coordinates: Install the corresponding polygon shape. + + (3) *name* is an arbitrary string and shape is a (compound) :class:`Shape` + object: Install the corresponding compound shape. + + Add a turtle shape to TurtleScreen's shapelist. Only thusly registered + shapes can be used by issuing the command ``shape(shapename)``. + + >>> screen.register_shape("turtle.gif") + >>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3))) + + +.. function:: turtles() + + Return the list of turtles on the screen. + + >>> for turtle in screen.turtles() + ... turtle.color("red") .. function:: window_height() - Return the height of the canvas window. + Return the height of the turtle window. - .. versionadded:: 2.3 + >>> screen.window_height() + 480 -This module also does ``from math import *``, so see the documentation for the -:mod:`math` module for additional constants and functions useful for turtle -graphics. +.. function:: window_width() -.. function:: demo() + Return the width of the turtle window. - Exercise the module a bit. + >>> screen.window_width() + 640 -.. exception:: Error +.. _screenspecific: - Exception raised on any error caught by this module. +Methods specific to Screen, not inherited from TurtleScreen +----------------------------------------------------------- -For examples, see the code of the :func:`demo` function. +.. function:: bye() -This module defines the following classes: + Shut the turtlegraphics window. -.. class:: Pen() +.. function:: exitonclick() - Define a pen. All above functions can be called as a methods on the given pen. - The constructor automatically creates a canvas do be drawn on. + Bind bye() method to mouse clicks on the Screen. -.. class:: Turtle() + If the value "using_IDLE" in the configuration dictionary is ``False`` + (default value), also enter mainloop. Remark: If IDLE with the ``-n`` switch + (no subprocess) is used, this value should be set to ``True`` in + :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the + client script. - Define a pen. This is essentially a synonym for ``Pen()``; :class:`Turtle` is an - empty subclass of :class:`Pen`. +.. function:: setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]) -.. class:: RawPen(canvas) + Set the size and position of the main window. Default values of arguments + are stored in the configuration dicionary and can be changed via a + :file:`turtle.cfg` file. - Define a pen which draws on a canvas *canvas*. This is useful if you want to - use the module to create graphics in a "real" program. + :param width: if an integer, a size in pixels, if a float, a fraction of the + screen; default is 50% of screen + :param height: if an integer, the height in pixels, if a float, a fraction of + the screen; default is 75% of screen + :param startx: if positive, starting position in pixels from the left + edge of the screen, if negative from the right edge, if None, + center window horizontally + :param startx: if positive, starting position in pixels from the top + edge of the screen, if negative from the bottom edge, if None, + center window vertically + >>> screen.setup (width=200, height=200, startx=0, starty=0) + # sets window to 200x200 pixels, in upper left of screen + >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) + # sets window to 75% of screen by 50% of screen and centers -.. _pen-rawpen-objects: -Turtle, Pen and RawPen Objects ------------------------------- +.. function:: title(titlestring) + + :param titlestring: a string that is shown in the titlebar of the turtle + graphics window + + Set title of turtle window to *titlestring*. + + >>> screen.title("Welcome to the turtle zoo!") + + +The public classes of the module :mod:`turtle` +============================================== + + +.. class:: RawTurtle(canvas) + RawPen(canvas) + + :param canvas: a :class:`Tkinter.Canvas`, a :class:`ScrolledCanvas` or a + :class:`TurtleScreen` + + Create a turtle. The turtle has all methods described above as "methods of + Turtle/RawTurtle". + + +.. class:: Turtle() -Most of the global functions available in the module are also available as -methods of the :class:`Turtle`, :class:`Pen` and :class:`RawPen` classes, -affecting only the state of the given pen. + Subclass of RawTurtle, has the same interface but draws on a default + :class:`Screen` object created automatically when needed for the first time. -The only method which is more powerful as a method is :func:`degrees`, which -takes an optional argument letting you specify the number of units -corresponding to a full circle: +.. class:: TurtleScreen(cv) -.. method:: Turtle.degrees([fullcircle]) + :param cv: a :class:`Tkinter.Canvas` - *fullcircle* is by default 360. This can cause the pen to have any angular units - whatever: give *fullcircle* ``2*pi`` for radians, or 400 for gradians. + Provides screen oriented methods like :func:`setbg` etc. that are described + above. + +.. class:: Screen() + + Subclass of TurtleScreen, with :ref:`four methods added `. + + +.. class:: ScrolledCavas(master) + + :param master: some Tkinter widget to contain the ScrolledCanvas, i.e. + a Tkinter-canvas with scrollbars added + + Used by class Screen, which thus automatically provides a ScrolledCanvas as + playground for the turtles. + +.. class:: Shape(type_, data) + + :param type\_: one of the strings "polygon", "image", "compound" + + Data structure modeling shapes. The pair ``(type_, data)`` must follow this + specification: + + + =========== =========== + *type_* *data* + =========== =========== + "polygon" a polygon-tuple, i.e. a tuple of pairs of coordinates + "image" an image (in this form only used internally!) + "compound" ``None`` (a compund shape has to be constructed using the + :meth:`addcomponent` method) + =========== =========== + + .. method:: addcomponent(poly, fill, outline=None) + + :param poly: a polygon, i.e. a tuple of pairs of numbers + :param fill: a color the *poly* will be filled with + :param outline: a color for the poly's outline (if given) + + Example: + + >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s = Shape("compound") + >>> s.addcomponent(poly, "red", "blue") + # .. add more components and then use register_shape() + + See :ref:`compoundshapes`. + + +.. class:: Vec2D(x, y) + + A two-dimensional vector class, used as a helper class for implementing + turtle graphics. May be useful for turtle graphics programs too. Derived + from tuple, so a vector is a tuple! + + Provides (for *a*, *b* vectors, *k* number): + + * ``a + b`` vector addition + * ``a - b`` vector subtraction + * ``a * b`` inner product + * ``k * a`` and ``a * k`` multiplication with scalar + * ``abs(a)`` absolute value of a + * ``a.rotate(angle)`` rotation + + +Help and configuration +====================== + +How to use help +--------------- + +The public methods of the Screen and Turtle classes are documented extensively +via docstrings. So these can be used as online-help via the Python help +facilities: + +- When using IDLE, tooltips show the signatures and first lines of the + docstrings of typed in function-/method calls. + +- Calling :func:`help` on methods or functions displays the docstrings:: + + >>> help(Screen.bgcolor) + Help on method bgcolor in module turtle: + + bgcolor(self, *args) unbound turtle.Screen method + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + "orange" + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + "#800080" + + >>> help(Turtle.penup) + Help on method penup in module turtle: + + penup(self) unbound turtle.Turtle method + Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + >>> turtle.penup() + +- The docstrings of the functions which are derived from methods have a modified + form:: + + >>> help(bgcolor) + Help on function bgcolor in module turtle: + + bgcolor(*args) + Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example:: + + >>> bgcolor("orange") + >>> bgcolor() + "orange" + >>> bgcolor(0.5,0,0.5) + >>> bgcolor() + "#800080" + + >>> help(penup) + Help on function penup in module turtle: + + penup() + Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + Example: + >>> penup() + +These modified docstrings are created automatically together with the function +definitions that are derived from the methods at import time. + + +Translation of docstrings into different languages +-------------------------------------------------- + +There is a utility to create a dictionary the keys of which are the method names +and the values of which are the docstrings of the public methods of the classes +Screen and Turtle. + +.. function:: write_docstringdict(filename="turtle_docstringdict") + + :param filename: a string, used as filename + + Create and write docstring-dictionary to a Python script with the given + filename. This function has to be called explicitly (it is not used by the + turtle graphics classes). The docstring dictionary will be written to the + Python script :file:`{filename}.py`. It is intended to serve as a template + for translation of the docstrings into different languages. + +If you (or your students) want to use :mod:`turtle` with online help in your +native language, you have to translate the docstrings and save the resulting +file as e.g. :file:`turtle_docstringdict_german.py`. + +If you have an appropriate entry in your :file:`turtle.cfg` file this dictionary +will be read in at import time and will replace the original English docstrings. + +At the time of this writing there are docstring dictionaries in German and in +Italian. (Requests please to glingl at aon.at.) + + + +How to configure Screen and Turtles +----------------------------------- + +The built-in default configuration mimics the appearance and behaviour of the +old turtle module in order to retain best possible compatibility with it. + +If you want to use a different configuration which better reflects the features +of this module or which better fits to your needs, e.g. for use in a classroom, +you can prepare a configuration file ``turtle.cfg`` which will be read at import +time and modify the configuration according to its settings. + +The built in configuration would correspond to the following turtle.cfg:: + + width = 0.5 + height = 0.75 + leftright = None + topbottom = None + canvwidth = 400 + canvheight = 300 + mode = standard + colormode = 1.0 + delay = 10 + undobuffersize = 1000 + shape = classic + pencolor = black + fillcolor = black + resizemode = noresize + visible = True + language = english + exampleturtle = turtle + examplescreen = screen + title = Python Turtle Graphics + using_IDLE = False + +Short explanation of selected entries: + +- The first four lines correspond to the arguments of the :meth:`Screen.setup` + method. +- Line 5 and 6 correspond to the arguments of the method + :meth:`Screen.screensize`. +- *shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For more + info try ``help(shape)``. +- If you want to use no fillcolor (i.e. make the turtle transparent), you have + to write ``fillcolor = ""`` (but all nonempty strings must not have quotes in + the cfg-file). +- If you want to reflect the turtle its state, you have to use ``resizemode = + auto``. +- If you set e.g. ``language = italian`` the docstringdict + :file:`turtle_docstringdict_italian.py` will be loaded at import time (if + present on the import path, e.g. in the same directory as :mod:`turtle`. +- The entries *exampleturtle* and *examplescreen* define the names of these + objects as they occur in the docstrings. The transformation of + method-docstrings to function-docstrings will delete these names from the + docstrings. +- *using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its -n + switch ("no subprocess"). This will prevent :func:`exitonclick` to enter the + mainloop. + +There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` is +stored and an additional one in the current working directory. The latter will +override the settings of the first one. + +The :file:`Demo/turtle` directory contains a :file:`turtle.cfg` file. You can +study it as an example and see its effects when running the demos (preferably +not from within the demo-viewer). + + +Demo scripts +============ + +There is a set of demo scripts in the turtledemo directory located in the +:file:`Demo/turtle` directory in the source distribution. + +It contains: + +- a set of 15 demo scripts demonstrating differet features of the new module + :mod:`turtle` +- a demo viewer :file:`turtleDemo.py` which can be used to view the sourcecode + of the scripts and run them at the same time. 14 of the examples can be + accessed via the Examples menu; all of them can also be run standalone. +- The example :file:`turtledemo_two_canvases.py` demonstrates the simultaneous + use of two canvases with the turtle module. Therefore it only can be run + standalone. +- There is a :file:`turtle.cfg` file in this directory, which also serves as an + example for how to write and use such files. + +The demoscripts are: + ++----------------+------------------------------+-----------------------+ +| Name | Description | Features | ++----------------+------------------------------+-----------------------+ +| bytedesign | complex classical | :func:`tracer`, delay,| +| | turtlegraphics pattern | :func:`update` | ++----------------+------------------------------+-----------------------+ +| chaos | graphs verhust dynamics, | world coordinates | +| | proves that you must not | | +| | trust computers' computations| | ++----------------+------------------------------+-----------------------+ +| clock | analog clock showing time | turtles as clock's | +| | of your computer | hands, ontimer | ++----------------+------------------------------+-----------------------+ +| colormixer | experiment with r, g, b | :func:`ondrag` | ++----------------+------------------------------+-----------------------+ +| fractalcurves | Hilbert & Koch curves | recursion | ++----------------+------------------------------+-----------------------+ +| lindenmayer | ethnomathematics | L-System | +| | (indian kolams) | | ++----------------+------------------------------+-----------------------+ +| minimal_hanoi | Towers of Hanoi | Rectangular Turtles | +| | | as Hanoi discs | +| | | (shape, shapesize) | ++----------------+------------------------------+-----------------------+ +| paint | super minimalistic | :func:`onclick` | +| | drawing program | | ++----------------+------------------------------+-----------------------+ +| peace | elementary | turtle: appearance | +| | | and animation | ++----------------+------------------------------+-----------------------+ +| penrose | aperiodic tiling with | :func:`stamp` | +| | kites and darts | | ++----------------+------------------------------+-----------------------+ +| planet_and_moon| simulation of | compound shapes, | +| | gravitational system | :class:`Vec2D` | ++----------------+------------------------------+-----------------------+ +| tree | a (graphical) breadth | :func:`clone` | +| | first tree (using generators)| | ++----------------+------------------------------+-----------------------+ +| wikipedia | a pattern from the wikipedia | :func:`clone`, | +| | article on turtle graphics | :func:`undo` | ++----------------+------------------------------+-----------------------+ +| yingyang | another elementary example | :func:`circle` | ++----------------+------------------------------+-----------------------+ +Have fun! Modified: python/branches/tlee-ast-optimize/Include/Python.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/Python.h (original) +++ python/branches/tlee-ast-optimize/Include/Python.h Thu Jun 5 17:42:10 2008 @@ -1,11 +1,11 @@ -#ifndef Py_PYTHON_H -#define Py_PYTHON_H +#ifndef Py_PYTHON_H #define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ #include "patchlevel.h" #include "pyconfig.h" +#include "pymacconfig.h" /* Cyclic gc is always enabled, starting with release 2.3a1. Supply the * old symbol for the benefit of extension modules written before then Modified: python/branches/tlee-ast-optimize/Include/pymactoolbox.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pymactoolbox.h (original) +++ python/branches/tlee-ast-optimize/Include/pymactoolbox.h Thu Jun 5 17:42:10 2008 @@ -8,7 +8,10 @@ #endif #include + +#ifndef __LP64__ #include +#endif /* !__LP64__ */ /* ** Helper routines for error codes and such. @@ -18,8 +21,11 @@ PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ +#ifndef __LP64__ extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert fsspec->path */ +#endif /* __LP64__ */ + /* ** These conversion routines are defined in mactoolboxglue.c itself. */ @@ -83,8 +89,10 @@ #endif /* USE_TOOLBOX_OBJECT_GLUE */ /* macfs exports */ +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ +#endif /* !__LP64__ */ int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ @@ -101,39 +109,54 @@ extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); /* Ctl exports */ +#ifndef __LP64__ extern PyObject *CtlObj_New(ControlHandle); extern int CtlObj_Convert(PyObject *, ControlHandle *); +#endif /* !__LP64__ */ /* Dlg exports */ +#ifndef __LP64__ extern PyObject *DlgObj_New(DialogPtr); extern int DlgObj_Convert(PyObject *, DialogPtr *); extern PyObject *DlgObj_WhichDialog(DialogPtr); +#endif /* !__LP64__ */ /* Drag exports */ +#ifndef __LP64__ extern PyObject *DragObj_New(DragReference); extern int DragObj_Convert(PyObject *, DragReference *); +#endif /* !__LP64__ */ /* List exports */ +#ifndef __LP64__ extern PyObject *ListObj_New(ListHandle); extern int ListObj_Convert(PyObject *, ListHandle *); +#endif /* !__LP64__ */ /* Menu exports */ +#ifndef __LP64__ extern PyObject *MenuObj_New(MenuHandle); extern int MenuObj_Convert(PyObject *, MenuHandle *); +#endif /* !__LP64__ */ /* Qd exports */ +#ifndef __LP64__ extern PyObject *GrafObj_New(GrafPtr); extern int GrafObj_Convert(PyObject *, GrafPtr *); extern PyObject *BMObj_New(BitMapPtr); extern int BMObj_Convert(PyObject *, BitMapPtr *); extern PyObject *QdRGB_New(RGBColor *); extern int QdRGB_Convert(PyObject *, RGBColor *); +#endif /* !__LP64__ */ /* Qdoffs exports */ +#ifndef __LP64__ extern PyObject *GWorldObj_New(GWorldPtr); extern int GWorldObj_Convert(PyObject *, GWorldPtr *); +#endif /* !__LP64__ */ /* Qt exports */ +#ifndef __LP64__ extern PyObject *TrackObj_New(Track); extern int TrackObj_Convert(PyObject *, Track *); extern PyObject *MovieObj_New(Movie); @@ -146,6 +169,7 @@ extern int UserDataObj_Convert(PyObject *, UserData *); extern PyObject *MediaObj_New(Media); extern int MediaObj_Convert(PyObject *, Media *); +#endif /* !__LP64__ */ /* Res exports */ extern PyObject *ResObj_New(Handle); @@ -154,13 +178,17 @@ extern int OptResObj_Convert(PyObject *, Handle *); /* TE exports */ +#ifndef __LP64__ extern PyObject *TEObj_New(TEHandle); extern int TEObj_Convert(PyObject *, TEHandle *); +#endif /* !__LP64__ */ /* Win exports */ +#ifndef __LP64__ extern PyObject *WinObj_New(WindowPtr); extern int WinObj_Convert(PyObject *, WindowPtr *); extern PyObject *WinObj_WhichWindow(WindowPtr); +#endif /* !__LP64__ */ /* CF exports */ extern PyObject *CFObj_New(CFTypeRef); Modified: python/branches/tlee-ast-optimize/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/sysconfig.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/sysconfig.py Thu Jun 5 17:42:10 2008 @@ -539,6 +539,26 @@ flags = re.sub('-isysroot [^ \t]*', ' ', flags) _config_vars[key] = flags + else: + + # Allow the user to override the architecture flags using + # an environment variable. + # NOTE: This name was introduced by Apple in OSX 10.5 and + # is used by several scripting languages distributed with + # that OS release. + + if 'ARCHFLAGS' in os.environ: + arch = os.environ['ARCHFLAGS'] + for key in ('LDFLAGS', 'BASECFLAGS', + # a number of derived variables. These need to be + # patched up as well. + 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): + + flags = _config_vars[key] + flags = re.sub('-arch\s+\w+\s', ' ', flags) + flags = flags + ' ' + arch + _config_vars[key] = flags + if args: vals = [] for name in args: Modified: python/branches/tlee-ast-optimize/Lib/distutils/unixccompiler.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/unixccompiler.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/unixccompiler.py Thu Jun 5 17:42:10 2008 @@ -64,7 +64,7 @@ stripArch = '-arch' in cc_args stripSysroot = '-isysroot' in cc_args - if stripArch: + if stripArch or 'ARCHFLAGS' in os.environ: while 1: try: index = compiler_so.index('-arch') @@ -73,6 +73,12 @@ except ValueError: break + if 'ARCHFLAGS' in os.environ and not stripArch: + # User specified different -arch flags in the environ, + # see also distutils.sysconfig + compiler_so = compiler_so + ' ' + os.environ['ARCHFLAGS'] + + if stripSysroot: try: index = compiler_so.index('-isysroot') Modified: python/branches/tlee-ast-optimize/Lib/distutils/util.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/util.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/util.py Thu Jun 5 17:42:10 2008 @@ -125,12 +125,19 @@ osname = "macosx" - if (release + '.') < '10.4.' and \ - get_config_vars().get('UNIVERSALSDK', '').strip(): + if (release + '.') >= '10.4.' and \ + '-arch' in get_config_vars().get('CFLAGS', '').strip(): # The universal build will build fat binaries, but not on # systems before 10.4 + # + # Try to detect 4-way universal builds, those have machine-type + # 'universal' instead of 'fat'. + machine = 'fat' + if '-arch x86_64' in get_config_vars().get('CFLAGS'): + machine = 'universal' + elif machine in ('PowerPC', 'Power_Macintosh'): # Pick a sane name for the PPC architecture. machine = 'ppc' Modified: python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py Thu Jun 5 17:42:10 2008 @@ -30,7 +30,7 @@ tk.mainloop() """ -__version__ = "$Revision: 63501 $" +__version__ = "$Revision$" import sys if sys.platform == "win32": @@ -1054,11 +1054,17 @@ if callable(v): v = self._register(v) elif isinstance(v, (tuple, list)): + nv = [] for item in v: if not isinstance(item, (basestring, int)): break + elif isinstance(item, int): + nv.append('%d' % item) + else: + # format it to proper Tcl code if it contains space + nv.append(('{%s}' if ' ' in item else '%s') % item) else: - v = ' '.join(map(str, v)) + v = ' '.join(nv) res = res + ('-'+k, v) return res def nametowidget(self, name): Modified: python/branches/tlee-ast-optimize/Lib/lib-tk/turtle.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib-tk/turtle.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib-tk/turtle.py Thu Jun 5 17:42:10 2008 @@ -1,294 +1,3142 @@ -# LogoMation-like turtle graphics +# +# turtle.py: a Tkinter based turtle graphics module for Python +# Version 1.0b1 - 31. 5. 2008 +# +# Copyright (C) 2006 - 2008 Gregor Lingl +# email: glingl at aon.at +# +# This software is provided 'as-is', without any express or implied +# warranty. In no event will the authors be held liable for any damages +# arising from the use of this software. +# +# Permission is granted to anyone to use this software for any purpose, +# including commercial applications, and to alter it and redistribute it +# freely, subject to the following restrictions: +# +# 1. The origin of this software must not be misrepresented; you must not +# claim that you wrote the original software. If you use this software +# in a product, an acknowledgment in the product documentation would be +# appreciated but is not required. +# 2. Altered source versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# 3. This notice may not be removed or altered from any source distribution. + """ Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed -by Wally Feurzeig and Seymour Papert in 1966. +by Wally Feurzig and Seymour Papert in 1966. Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.left(25), and it rotates in-place 25 degrees clockwise. -By combining together these and similar commands, intricate shapes and -pictures can easily be drawn. -""" +By combining together these and similar commands, intricate shapes and +pictures can easily be drawn. + +----- turtle.py + +This module is an extended reimplementation of turtle.py from the +Python standard distribution up to Python 2.5. (See: http:\\www.python.org) + +It tries to keep the merits of turtle.py and to be (nearly) 100% +compatible with it. This means in the first place to enable the +learning programmer to use all the commands, classes and methods +interactively when using the module from within IDLE run with +the -n switch. + +Roughly it has the following features added: + +- Better animation of the turtle movements, especially of turning the + turtle. So the turtles can more easily be used as a visual feedback + instrument by the (beginning) programmer. + +- Different turtle shapes, gif-images as turtle shapes, user defined + and user controllable turtle shapes, among them compound + (multicolored) shapes. Turtle shapes can be stgretched and tilted, which + makes turtles zu very versatile geometrical objects. + +- Fine control over turtle movement and screen updates via delay(), + and enhanced tracer() and speed() methods. + +- Aliases for the most commonly used commands, like fd for forward etc., + following the early Logo traditions. This reduces the boring work of + typing long sequences of commands, which often occur in a natural way + when kids try to program fancy pictures on their first encounter with + turtle graphcis. + +- Turtles now have an undo()-method with configurable undo-buffer. + +- Some simple commands/methods for creating event driven programs + (mouse-, key-, timer-events). Especially useful for programming games. + +- A scrollable Canvas class. The default scrollable Canvas can be + extended interactively as needed while playing around with the turtle(s). + +- A TurtleScreen class with methods controlling background color or + background image, window and canvas size and other properties of the + TurtleScreen. + +- There is a method, setworldcoordinates(), to install a user defined + coordinate-system for the TurtleScreen. + +- The implementation uses a 2-vector class named Vec2D, derived from tuple. + This class is public, so it can be imported by the application programmer, + which makes certain types of computations very natural and compact. + +- Appearance of the TurtleScreen and the Turtles at startup/import can be + configured by means of a turtle.cfg configuration file. + The default configuration mimics the appearance of the old turtle module. + +- If configured appropriately the module reads in docstrings from a docstring + dictionary in some different language, supplied separately and replaces + the english ones by those read in. There is a utility function + write_docstringdict() to write a dictionary with the original (english) + docstrings to disc, so it can serve as a template for translations. + +Behind the scenes there are some features included with possible +extensionsin in mind. These will be commented and documented elsewhere. + +""" + +_ver = "turtle 1.0b1 - for Python 2.6 - 30. 5. 2008, 18:08" + +#print _ver + +import Tkinter as TK +import types +import math +import time +import os + +from os.path import isfile, split, join +from copy import deepcopy + +from math import * ## for compatibility with old turtle module + +_tg_classes = ['ScrolledCanvas', 'TurtleScreen', 'Screen', + 'RawTurtle', 'Turtle', 'RawPen', 'Pen', 'Shape', 'Vec2D'] +_tg_screen_functions = ['addshape', 'bgcolor', 'bgpic', 'bye', + 'clearscreen', 'colormode', 'delay', 'exitonclick', 'getcanvas', + 'getshapes', 'listen', 'mode', 'onkey', 'onscreenclick', 'ontimer', + 'register_shape', 'resetscreen', 'screensize', 'setup', + 'setworldcoordinates', 'title', 'tracer', 'turtles', 'update', + 'window_height', 'window_width'] +_tg_turtle_functions = ['back', 'backward', 'begin_fill', 'begin_poly', 'bk', + 'circle', 'clear', 'clearstamp', 'clearstamps', 'clone', 'color', + 'degrees', 'distance', 'dot', 'down', 'end_fill', 'end_poly', 'fd', + 'fill', 'fillcolor', 'forward', 'get_poly', 'getpen', 'getscreen', + 'getturtle', 'goto', 'heading', 'hideturtle', 'home', 'ht', 'isdown', + 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd', + 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', + 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', + 'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', + 'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'showturtle', + 'speed', 'st', 'stamp', 'tilt', 'tiltangle', 'towards', 'tracer', + 'turtlesize', 'undo', 'undobufferentries', 'up', 'width', + 'window_height', 'window_width', 'write', 'xcor', 'ycor'] +_tg_utilities = ['write_docstringdict', 'done', 'mainloop'] +_math_functions = ['acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', + 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log', + 'log10', 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh'] + +__all__ = (_tg_classes + _tg_screen_functions + _tg_turtle_functions + + _tg_utilities + _math_functions) + +_alias_list = ['addshape', 'backward', 'bk', 'fd', 'ht', 'lt', 'pd', 'pos', + 'pu', 'rt', 'seth', 'setpos', 'setposition', 'st', + 'turtlesize', 'up', 'width'] + +_CFG = {"width" : 0.5, # Screen + "height" : 0.75, + "canvwidth" : 400, + "canvheight": 300, + "leftright": None, + "topbottom": None, + "mode": "standard", # TurtleScreen + "colormode": 1.0, + "delay": 10, + "undobuffersize": 1000, # RawTurtle + "shape": "classic", + "pencolor" : "black", + "fillcolor" : "black", + "resizemode" : "noresize", + "visible" : True, + "language": "english", # docstrings + "exampleturtle": "turtle", + "examplescreen": "screen", + "title": "Python Turtle Graphics", + "using_IDLE": False + } + +##print "cwd:", os.getcwd() +##print "__file__:", __file__ +## +##def show(dictionary): +## print "==========================" +## for key in sorted(dictionary.keys()): +## print key, ":", dictionary[key] +## print "==========================" +## print + +def config_dict(filename): + """Convert content of config-file into dictionary.""" + f = open(filename, "r") + cfglines = f.readlines() + f.close() + cfgdict = {} + for line in cfglines: + line = line.strip() + if not line or line.startswith("#"): + continue + try: + key, value = line.split("=") + except: + print "Bad line in config-file %s:\n%s" % (filename,line) + continue + key = key.strip() + value = value.strip() + if value in ["True", "False", "None", "''", '""']: + value = eval(value) + else: + try: + if "." in value: + value = float(value) + else: + value = int(value) + except: + pass # value need not be converted + cfgdict[key] = value + return cfgdict + +def readconfig(cfgdict): + """Read config-files, change configuration-dict accordingly. + + If there is a turtle.cfg file in the current working directory, + read it from there. If this contains an importconfig-value, + say 'myway', construct filename turtle_mayway.cfg else use + turtle.cfg and read it from the import-directory, where + turtle.py is located. + Update configuration dictionary first according to config-file, + in the import directory, then according to config-file in the + current working directory. + If no config-file is found, the default configuration is used. + """ + default_cfg = "turtle.cfg" + cfgdict1 = {} + cfgdict2 = {} + if isfile(default_cfg): + cfgdict1 = config_dict(default_cfg) + #print "1. Loading config-file %s from: %s" % (default_cfg, os.getcwd()) + if "importconfig" in cfgdict1: + default_cfg = "turtle_%s.cfg" % cfgdict1["importconfig"] + try: + head, tail = split(__file__) + cfg_file2 = join(head, default_cfg) + except: + cfg_file2 = "" + if isfile(cfg_file2): + #print "2. Loading config-file %s:" % cfg_file2 + cfgdict2 = config_dict(cfg_file2) +## show(_CFG) +## show(cfgdict2) + _CFG.update(cfgdict2) +## show(_CFG) +## show(cfgdict1) + _CFG.update(cfgdict1) +## show(_CFG) + +try: + readconfig(_CFG) +except: + print "No configfile read, reason unknown" + + +class Vec2D(tuple): + """A 2 dimensional vector class, used as a helper class + for implementing turtle graphics. + May be useful for turtle graphics programs also. + Derived from tuple, so a vector is a tuple! + + Provides (for a, b vectors, k number): + a+b vector addition + a-b vector subtraction + a*b inner product + k*a and a*k multiplication with scalar + |a| absolute value of a + a.rotate(angle) rotation + """ + def __new__(cls, x, y): + return tuple.__new__(cls, (x, y)) + def __add__(self, other): + return Vec2D(self[0]+other[0], self[1]+other[1]) + def __mul__(self, other): + if isinstance(other, Vec2D): + return self[0]*other[0]+self[1]*other[1] + return Vec2D(self[0]*other, self[1]*other) + def __rmul__(self, other): + if isinstance(other, int) or isinstance(other, float): + return Vec2D(self[0]*other, self[1]*other) + def __sub__(self, other): + return Vec2D(self[0]-other[0], self[1]-other[1]) + def __neg__(self): + return Vec2D(-self[0], -self[1]) + def __abs__(self): + return (self[0]**2 + self[1]**2)**0.5 + def rotate(self, angle): + """rotate self counterclockwise by angle + """ + perp = Vec2D(-self[1], self[0]) + angle = angle * math.pi / 180.0 + c, s = math.cos(angle), math.sin(angle) + return Vec2D(self[0]*c+perp[0]*s, self[1]*c+perp[1]*s) + def __getnewargs__(self): + return (self[0], self[1]) + def __repr__(self): + return "(%.2f,%.2f)" % self + + +############################################################################## +### From here up to line : Tkinter - Interface for turtle.py ### +### May be replaced by an interface to some different graphcis-toolkit ### +############################################################################## + +## helper functions for Scrolled Canvas, to forward Canvas-methods +## to ScrolledCanvas class + +def __methodDict(cls, _dict): + """helper function for Scrolled Canvas""" + baseList = list(cls.__bases__) + baseList.reverse() + for _super in baseList: + __methodDict(_super, _dict) + for key, value in cls.__dict__.items(): + if type(value) == types.FunctionType: + _dict[key] = value + +def __methods(cls): + """helper function for Scrolled Canvas""" + _dict = {} + __methodDict(cls, _dict) + return _dict.keys() + +__stringBody = ( + 'def %(method)s(self, *args, **kw): return ' + + 'self.%(attribute)s.%(method)s(*args, **kw)') + +def __forwardmethods(fromClass, toClass, toPart, exclude = ()): + """Helper functions for Scrolled Canvas, used to forward + ScrolledCanvas-methods to Tkinter.Canvas class. + """ + _dict = {} + __methodDict(toClass, _dict) + for ex in _dict.keys(): + if ex[:1] == '_' or ex[-1:] == '_': + del _dict[ex] + for ex in exclude: + if _dict.has_key(ex): + del _dict[ex] + for ex in __methods(fromClass): + if _dict.has_key(ex): + del _dict[ex] + + for method, func in _dict.items(): + d = {'method': method, 'func': func} + if type(toPart) == types.StringType: + execString = \ + __stringBody % {'method' : method, 'attribute' : toPart} + exec execString in d + fromClass.__dict__[method] = d[method] + + +class ScrolledCanvas(TK.Frame): + """Modeled after the scrolled canvas class from Grayons's Tkinter book. + + Used as the default canvas, which pops up automatically when + using turtle graphics functions or the Turtle class. + """ + def __init__(self, master, width=500, height=350, + canvwidth=600, canvheight=500): + TK.Frame.__init__(self, master, width=width, height=height) + self._root = self.winfo_toplevel() + self.width, self.height = width, height + self.canvwidth, self.canvheight = canvwidth, canvheight + self.bg = "white" + self._canvas = TK.Canvas(master, width=width, height=height, + bg=self.bg, relief=TK.SUNKEN, borderwidth=2) + self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, + orient=TK.HORIZONTAL) + self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) + self._canvas.configure(xscrollcommand=self.hscroll.set, + yscrollcommand=self.vscroll.set) + self.rowconfigure(0, weight=1, minsize=0) + self.columnconfigure(0, weight=1, minsize=0) + self._canvas.grid(padx=1, in_ = self, pady=1, row=0, + column=0, rowspan=1, columnspan=1, sticky='news') + self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, + column=1, rowspan=1, columnspan=1, sticky='news') + self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, + column=0, rowspan=1, columnspan=1, sticky='news') + self.reset() + self._root.bind('', self.onResize) + + def reset(self, canvwidth=None, canvheight=None, bg = None): + """Ajust canvas and scrollbars according to given canvas size.""" + if canvwidth: + self.canvwidth = canvwidth + if canvheight: + self.canvheight = canvheight + if bg: + self.bg = bg + self._canvas.config(bg=bg, + scrollregion=(-self.canvwidth//2, -self.canvheight//2, + self.canvwidth//2, self.canvheight//2)) + self._canvas.xview_moveto(0.5*(self.canvwidth - self.width + 30) / + self.canvwidth) + self._canvas.yview_moveto(0.5*(self.canvheight- self.height + 30) / + self.canvheight) + self.adjustScrolls() + + + def adjustScrolls(self): + """ Adjust scrollbars according to window- and canvas-size. + """ + cwidth = self._canvas.winfo_width() + cheight = self._canvas.winfo_height() + self._canvas.xview_moveto(0.5*(self.canvwidth-cwidth)/self.canvwidth) + self._canvas.yview_moveto(0.5*(self.canvheight-cheight)/self.canvheight) + if cwidth < self.canvwidth or cheight < self.canvheight: + self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, + column=0, rowspan=1, columnspan=1, sticky='news') + self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, + column=1, rowspan=1, columnspan=1, sticky='news') + else: + self.hscroll.grid_forget() + self.vscroll.grid_forget() + + def onResize(self, event): + """self-explanatory""" + self.adjustScrolls() + + def bbox(self, *args): + """ 'forward' method, which canvas itself has inherited... + """ + return self._canvas.bbox(*args) + + def cget(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + return self._canvas.cget(*args, **kwargs) + + def config(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.config(*args, **kwargs) + + def bind(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.bind(*args, **kwargs) + + def unbind(self, *args, **kwargs): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.unbind(*args, **kwargs) + + def focus_force(self): + """ 'forward' method, which canvas itself has inherited... + """ + self._canvas.focus_force() + +__forwardmethods(ScrolledCanvas, TK.Canvas, '_canvas') + + +class _Root(TK.Tk): + """Root class for Screen based on Tkinter.""" + def __init__(self): + TK.Tk.__init__(self) + + def setupcanvas(self, width, height, cwidth, cheight): + self._canvas = ScrolledCanvas(self, width, height, cwidth, cheight) + self._canvas.pack(expand=1, fill="both") + + def _getcanvas(self): + return self._canvas + + def set_geometry(self, width, height, startx, starty): + self.geometry("%dx%d%+d%+d"%(width, height, startx, starty)) + + def ondestroy(self, destroy): + self.wm_protocol("WM_DELETE_WINDOW", destroy) + + def win_width(self): + return self.winfo_screenwidth() + + def win_height(self): + return self.winfo_screenheight() + +Canvas = TK.Canvas + + +class TurtleScreenBase(object): + """Provide the basic graphics functionality. + Interface between Tkinter and turtle.py. + + To port turtle.py to some different graphics toolkit + a corresponding TurtleScreenBase class has to be implemented. + """ + + @staticmethod + def _blankimage(): + """return a blank image object + """ + img = TK.PhotoImage(width=1, height=1) + img.blank() + return img + + @staticmethod + def _image(filename): + """return an image object containing the + imagedata from a gif-file named filename. + """ + return TK.PhotoImage(file=filename) + + def __init__(self, cv): + self.cv = cv + if isinstance(cv, ScrolledCanvas): + w = self.cv.canvwidth + h = self.cv.canvheight + else: # expected: ordinary TK.Canvas + w = int(self.cv.cget("width")) + h = int(self.cv.cget("height")) + self.cv.config(scrollregion = (-w//2, -h//2, w//2, h//2 )) + self.canvwidth = w + self.canvheight = h + self.xscale = self.yscale = 1.0 + + def _createpoly(self): + """Create an invisible polygon item on canvas self.cv) + """ + return self.cv.create_polygon((0, 0, 0, 0, 0, 0), fill="", outline="") + + def _drawpoly(self, polyitem, coordlist, fill=None, + outline=None, width=None, top=False): + """Configure polygonitem polyitem according to provided + arguments: + coordlist is sequence of coordinates + fill is filling color + outline is outline color + top is a boolean value, which specifies if polyitem + will be put on top of the canvas' displaylist so it + will not be covered by other items. + """ + cl = [] + for x, y in coordlist: + cl.append(x * self.xscale) + cl.append(-y * self.yscale) + self.cv.coords(polyitem, *cl) + if fill is not None: + self.cv.itemconfigure(polyitem, fill=fill) + if outline is not None: + self.cv.itemconfigure(polyitem, outline=outline) + if width is not None: + self.cv.itemconfigure(polyitem, width=width) + if top: + self.cv.tag_raise(polyitem) + + def _createline(self): + """Create an invisible line item on canvas self.cv) + """ + return self.cv.create_line(0, 0, 0, 0, fill="", width=2, + capstyle = TK.ROUND) + + def _drawline(self, lineitem, coordlist=None, + fill=None, width=None, top=False): + """Configure lineitem according to provided arguments: + coordlist is sequence of coordinates + fill is drawing color + width is width of drawn line. + top is a boolean value, which specifies if polyitem + will be put on top of the canvas' displaylist so it + will not be covered by other items. + """ + if coordlist is not None: + cl = [] + for x, y in coordlist: + cl.append(x * self.xscale) + cl.append(-y * self.yscale) + self.cv.coords(lineitem, *cl) + if fill is not None: + self.cv.itemconfigure(lineitem, fill=fill) + if width is not None: + self.cv.itemconfigure(lineitem, width=width) + if top: + self.cv.tag_raise(lineitem) + + def _delete(self, item): + """Delete graphics item from canvas. + If item is"all" delete all graphics items. + """ + self.cv.delete(item) + + def _update(self): + """Redraw graphics items on canvas + """ + self.cv.update() + + def _delay(self, delay): + """Delay subsequent canvas actions for delay ms.""" + self.cv.after(delay) + + def _iscolorstring(self, color): + """Check if the string color is a legal Tkinter color string. + """ + try: + rgb = self.cv.winfo_rgb(color) + ok = True + except TK.TclError: + ok = False + return ok + + def _bgcolor(self, color=None): + """Set canvas' backgroundcolor if color is not None, + else return backgroundcolor.""" + if color is not None: + self.cv.config(bg = color) + self._update() + else: + return self.cv.cget("bg") + + def _write(self, pos, txt, align, font, pencolor): + """Write txt at pos in canvas with specified font + and color. + Return text item and x-coord of right bottom corner + of text's bounding box.""" + x, y = pos + x = x * self.xscale + y = y * self.yscale + anchor = {"left":"sw", "center":"s", "right":"se" } + item = self.cv.create_text(x-1, -y, text = txt, anchor = anchor[align], + fill = pencolor, font = font) + x0, y0, x1, y1 = self.cv.bbox(item) + self.cv.update() + return item, x1-1 + +## def _dot(self, pos, size, color): +## """may be implemented for some other graphics toolkit""" + + def _onclick(self, item, fun, num=1, add=None): + """Bind fun to mouse-click event on turtle. + fun must be a function with two arguments, the coordinates + of the clicked point on the canvas. + num, the number of the mouse-button defaults to 1 + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.tag_bind(item, "" % num, eventfun, add) + + def _onrelease(self, item, fun, num=1, add=None): + """Bind fun to mouse-button-release event on turtle. + fun must be a function with two arguments, the coordinates + of the point on the canvas where mouse button is released. + num, the number of the mouse-button defaults to 1 + + If a turtle is clicked, first _onclick-event will be performed, + then _onscreensclick-event. + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.tag_bind(item, "" % num, + eventfun, add) + + def _ondrag(self, item, fun, num=1, add=None): + """Bind fun to mouse-move-event (with pressed mouse button) on turtle. + fun must be a function with two arguments, the coordinates of the + actual mouse position on the canvas. + num, the number of the mouse-button defaults to 1 + + Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. + """ + if fun is None: + self.cv.tag_unbind(item, "" % num) + else: + def eventfun(event): + try: + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + except: + pass + self.cv.tag_bind(item, "" % num, eventfun, add) + + def _onscreenclick(self, fun, num=1, add=None): + """Bind fun to mouse-click event on canvas. + fun must be a function with two arguments, the coordinates + of the clicked point on the canvas. + num, the number of the mouse-button defaults to 1 + + If a turtle is clicked, first _onclick-event will be performed, + then _onscreensclick-event. + """ + if fun is None: + self.cv.unbind("" % num) + else: + def eventfun(event): + x, y = (self.cv.canvasx(event.x)/self.xscale, + -self.cv.canvasy(event.y)/self.yscale) + fun(x, y) + self.cv.bind("" % num, eventfun, add) + + def _onkey(self, fun, key): + """Bind fun to key-release event of key. + Canvas must have focus. See method listen + """ + if fun is None: + self.cv.unbind("" % key, None) + else: + def eventfun(event): + fun() + self.cv.bind("" % key, eventfun) + + def _listen(self): + """Set focus on canvas (in order to collect key-events) + """ + self.cv.focus_force() + + def _ontimer(self, fun, t): + """Install a timer, which calls fun after t milliseconds. + """ + if t == 0: + self.cv.after_idle(fun) + else: + self.cv.after(t, fun) + + def _createimage(self, image): + """Create and return image item on canvas. + """ + return self.cv.create_image(0, 0, image=image) + + def _drawimage(self, item, (x, y), image): + """Configure image item as to draw image object + at position (x,y) on canvas) + """ + self.cv.coords(item, (x, -y)) + self.cv.itemconfig(item, image=image) + + def _setbgpic(self, item, image): + """Configure image item as to draw image object + at center of canvas. Set item to the first item + in the displaylist, so it will be drawn below + any other item .""" + self.cv.itemconfig(item, image=image) + self.cv.tag_lower(item) + + def _type(self, item): + """Return 'line' or 'polygon' or 'image' depending on + type of item. + """ + return self.cv.type(item) + + def _pointlist(self, item): + """returns list of coordinate-pairs of points of item + Example (for insiders): + >>> from turtle import * + >>> getscreen()._pointlist(getturtle().turtle._item) + [(0.0, 9.9999999999999982), (0.0, -9.9999999999999982), + (9.9999999999999982, 0.0)] + >>> """ + cl = self.cv.coords(item) + pl = [(cl[i], -cl[i+1]) for i in range(0, len(cl), 2)] + return pl + + def _setscrollregion(self, srx1, sry1, srx2, sry2): + self.cv.config(scrollregion=(srx1, sry1, srx2, sry2)) + + def _rescale(self, xscalefactor, yscalefactor): + items = self.cv.find_all() + for item in items: + coordinates = self.cv.coords(item) + newcoordlist = [] + while coordinates: + x, y = coordinates[:2] + newcoordlist.append(x * xscalefactor) + newcoordlist.append(y * yscalefactor) + coordinates = coordinates[2:] + self.cv.coords(item, *newcoordlist) + + def _resize(self, canvwidth=None, canvheight=None, bg=None): + """Resize the canvas, the turtles are drawing on. Does + not alter the drawing window. + """ + # needs amendment + if not isinstance(self.cv, ScrolledCanvas): + return self.canvwidth, self.canvheight + if canvwidth is None and canvheight is None and bg is None: + return self.cv.canvwidth, self.cv.canvheight + if canvwidth is not None: + self.canvwidth = canvwidth + if canvheight is not None: + self.canvheight = canvheight + self.cv.reset(canvwidth, canvheight, bg) + + def _window_size(self): + """ Return the width and height of the turtle window. + """ + width = self.cv.winfo_width() + if width <= 1: # the window isn't managed by a geometry manager + width = self.cv['width'] + height = self.cv.winfo_height() + if height <= 1: # the window isn't managed by a geometry manager + height = self.cv['height'] + return width, height + + +############################################################################## +### End of Tkinter - interface ### +############################################################################## + + +class Terminator (Exception): + """Will be raised in TurtleScreen.update, if _RUNNING becomes False. + + Thus stops execution of turtle graphics script. Main purpose: use in + in the Demo-Viewer turtle.Demo.py. + """ + pass + + +class TurtleGraphicsError(Exception): + """Some TurtleGraphics Error + """ + + +class Shape(object): + """Data structure modeling shapes. + + attribute _type is one of "polygon", "image", "compound" + attribute _data is - depending on _type a poygon-tuple, + an image or a list constructed using the addcomponent method. + """ + def __init__(self, type_, data=None): + self._type = type_ + if type_ == "polygon": + if isinstance(data, list): + data = tuple(data) + elif type_ == "image": + if isinstance(data, str): + if data.lower().endswith(".gif") and isfile(data): + data = TurtleScreen._image(data) + # else data assumed to be Photoimage + elif type_ == "compound": + data = [] + else: + raise TurtleGraphicsError("There is no shape type %s" % type_) + self._data = data + + def addcomponent(self, poly, fill, outline=None): + """Add component to a shape of type compound. + + Arguments: poly is a polygon, i. e. a tuple of number pairs. + fill is the fillcolor of the component, + outline is the outline color of the component. + + call (for a Shapeobject namend s): + -- s.addcomponent(((0,0), (10,10), (-10,10)), "red", "blue") + + Example: + >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) + >>> s = Shape("compound") + >>> s.addcomponent(poly, "red", "blue") + ### .. add more components and then use register_shape() + """ + if self._type != "compound": + raise TurtleGraphicsError("Cannot add component to %s Shape" + % self._type) + if outline is None: + outline = fill + self._data.append([poly, fill, outline]) + + +class Tbuffer(object): + """Ring buffer used as undobuffer for RawTurtle objects.""" + def __init__(self, bufsize=10): + self.bufsize = bufsize + self.buffer = [[None]] * bufsize + self.ptr = -1 + self.cumulate = False + def reset(self, bufsize=None): + if bufsize is None: + for i in range(self.bufsize): + self.buffer[i] = [None] + else: + self.bufsize = bufsize + self.buffer = [[None]] * bufsize + self.ptr = -1 + def push(self, item): + if self.bufsize > 0: + if not self.cumulate: + self.ptr = (self.ptr + 1) % self.bufsize + self.buffer[self.ptr] = item + else: + self.buffer[self.ptr].append(item) + def pop(self): + if self.bufsize > 0: + item = self.buffer[self.ptr] + if item is None: + return None + else: + self.buffer[self.ptr] = [None] + self.ptr = (self.ptr - 1) % self.bufsize + return (item) + def nr_of_items(self): + return self.bufsize - self.buffer.count([None]) + def __repr__(self): + return str(self.buffer) + " " + str(self.ptr) + + + +class TurtleScreen(TurtleScreenBase): + """Provides screen oriented methods like setbg etc. + + Only relies upon the methods of TurtleScreenBase and NOT + upon components of the underlying graphics toolkit - + which is Tkinter in this case. + """ +# _STANDARD_DELAY = 5 + _RUNNING = True + + def __init__(self, cv, mode=_CFG["mode"], + colormode=_CFG["colormode"], delay=_CFG["delay"]): + self._shapes = { + "arrow" : Shape("polygon", ((-10,0), (10,0), (0,10))), + "turtle" : Shape("polygon", ((0,16), (-2,14), (-1,10), (-4,7), + (-7,9), (-9,8), (-6,5), (-7,1), (-5,-3), (-8,-6), + (-6,-8), (-4,-5), (0,-7), (4,-5), (6,-8), (8,-6), + (5,-3), (7,1), (6,5), (9,8), (7,9), (4,7), (1,10), + (2,14))), + "circle" : Shape("polygon", ((10,0), (9.51,3.09), (8.09,5.88), + (5.88,8.09), (3.09,9.51), (0,10), (-3.09,9.51), + (-5.88,8.09), (-8.09,5.88), (-9.51,3.09), (-10,0), + (-9.51,-3.09), (-8.09,-5.88), (-5.88,-8.09), + (-3.09,-9.51), (-0.00,-10.00), (3.09,-9.51), + (5.88,-8.09), (8.09,-5.88), (9.51,-3.09))), + "square" : Shape("polygon", ((10,-10), (10,10), (-10,10), + (-10,-10))), + "triangle" : Shape("polygon", ((10,-5.77), (0,11.55), + (-10,-5.77))), + "classic": Shape("polygon", ((0,0),(-5,-9),(0,-7),(5,-9))), + "blank" : Shape("image", self._blankimage()) + } + + self._bgpics = {"nopic" : ""} + + TurtleScreenBase.__init__(self, cv) + self._mode = mode + self._delayvalue = delay + self._colormode = _CFG["colormode"] + self._keys = [] + self.clear() + + def clear(self): + """Delete all drawings and all turtles from the TurtleScreen. + + Reset empty TurtleScreen to it's initial state: white background, + no backgroundimage, no eventbindings and tracing on. + + No argument. + + Example (for a TurtleScreen instance named screen): + screen.clear() + + Note: this method is not available as function. + """ + self._delayvalue = _CFG["delay"] + self._colormode = _CFG["colormode"] + self._delete("all") + self._bgpic = self._createimage("") + self._bgpicname = "nopic" + self._tracing = 1 + self._updatecounter = 0 + self._turtles = [] + self.bgcolor("white") + for btn in 1, 2, 3: + self.onclick(None, btn) + for key in self._keys[:]: + self.onkey(None, key) + Turtle._pen = None + + def mode(self, mode=None): + """Set turtle-mode ('standard', 'logo' or 'world') and perform reset. + + Optional argument: + mode -- on of the strings 'standard', 'logo' or 'world' + + Mode 'standard' is compatible with turtle.py. + Mode 'logo' is compatible with most Logo-Turtle-Graphics. + Mode 'world' uses userdefined 'worldcoordinates'. *Attention*: in + this mode angles appear distorted if x/y unit-ratio doesn't equal 1. + If mode is not given, return the current mode. + + Mode Initial turtle heading positive angles + ------------|-------------------------|------------------- + 'standard' to the right (east) counterclockwise + 'logo' upward (north) clockwise + + Examples: + >>> mode('logo') # resets turtle heading to north + >>> mode() + 'logo' + """ + if mode == None: + return self._mode + mode = mode.lower() + if mode not in ["standard", "logo", "world"]: + raise TurtleGraphicsError("No turtle-graphics-mode %s" % mode) + self._mode = mode + if mode in ["standard", "logo"]: + self._setscrollregion(-self.canvwidth//2, -self.canvheight//2, + self.canvwidth//2, self.canvheight//2) + self.xscale = self.yscale = 1.0 + self.reset() + + def setworldcoordinates(self, llx, lly, urx, ury): + """Set up a user defined coordinate-system. + + Arguments: + llx -- a number, x-coordinate of lower left corner of canvas + lly -- a number, y-coordinate of lower left corner of canvas + urx -- a number, x-coordinate of upper right corner of canvas + ury -- a number, y-coordinate of upper right corner of canvas + + Set up user coodinat-system and switch to mode 'world' if necessary. + This performs a screen.reset. If mode 'world' is already active, + all drawings are redrawn according to the new coordinates. + + But ATTENTION: in user-defined coordinatesystems angles may appear + distorted. (see Screen.mode()) + + Example (for a TurtleScreen instance named screen): + >>> screen.setworldcoordinates(-10,-0.5,50,1.5) + >>> for _ in range(36): + left(10) + forward(0.5) + """ + if self.mode() != "world": + self.mode("world") + xspan = float(urx - llx) + yspan = float(ury - lly) + wx, wy = self._window_size() + self.screensize(wx-20, wy-20) + oldxscale, oldyscale = self.xscale, self.yscale + self.xscale = self.canvwidth / xspan + self.yscale = self.canvheight / yspan + srx1 = llx * self.xscale + sry1 = -ury * self.yscale + srx2 = self.canvwidth + srx1 + sry2 = self.canvheight + sry1 + self._setscrollregion(srx1, sry1, srx2, sry2) + self._rescale(self.xscale/oldxscale, self.yscale/oldyscale) + self.update() + + def register_shape(self, name, shape=None): + """Adds a turtle shape to TurtleScreen's shapelist. + + Arguments: + (1) name is the name of a gif-file and shape is None. + Installs the corresponding image shape. + !! Image-shapes DO NOT rotate when turning the turtle, + !! so they do not display the heading of the turtle! + (2) name is an arbitrary string and shape is a tuple + of pairs of coordinates. Installs the corresponding + polygon shape + (3) name is an arbitrary string and shape is a + (compound) Shape object. Installs the corresponding + compound shape. + To use a shape, you have to issue the command shape(shapename). + + call: register_shape("turtle.gif") + --or: register_shape("tri", ((0,0), (10,10), (-10,10))) + + Example (for a TurtleScreen instance named screen): + >>> screen.register_shape("triangle", ((5,-3),(0,5),(-5,-3))) + + """ + if shape is None: + # image + if name.lower().endswith(".gif"): + shape = Shape("image", self._image(name)) + else: + raise TurtleGraphicsError("Bad arguments for register_shape.\n" + + "Use help(register_shape)" ) + elif isinstance(shape, tuple): + shape = Shape("polygon", shape) + ## else shape assumed to be Shape-instance + self._shapes[name] = shape + # print "shape added:" , self._shapes + + def _colorstr(self, color): + """Return color string corresponding to args. + + Argument may be a string or a tuple of three + numbers corresponding to actual colormode, + i.e. in the range 0<=n<=colormode. + + If the argument doesn't represent a color, + an error is raised. + """ + if len(color) == 1: + color = color[0] + if isinstance(color, str): + if self._iscolorstring(color) or color == "": + return color + else: + raise TurtleGraphicsError("bad color string: %s" % str(color)) + try: + r, g, b = color + except: + raise TurtleGraphicsError("bad color arguments: %s" % str(color)) + if self._colormode == 1.0: + r, g, b = [round(255.0*x) for x in (r, g, b)] + if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)): + raise TurtleGraphicsError("bad color sequence: %s" % str(color)) + return "#%02x%02x%02x" % (r, g, b) + + def _color(self, cstr): + if not cstr.startswith("#"): + return cstr + if len(cstr) == 7: + cl = [int(cstr[i:i+2], 16) for i in (1, 3, 5)] + elif len(cstr) == 4: + cl = [16*int(cstr[h], 16) for h in cstr[1:]] + else: + raise TurtleGraphicsError("bad colorstring: %s" % cstr) + return tuple([c * self._colormode/255 for c in cl]) + + def colormode(self, cmode=None): + """Return the colormode or set it to 1.0 or 255. + + Optional argument: + cmode -- one of the values 1.0 or 255 + + r, g, b values of colortriples have to be in range 0..cmode. + + Example (for a TurtleScreen instance named screen): + >>> screen.colormode() + 1.0 + >>> screen.colormode(255) + >>> turtle.pencolor(240,160,80) + """ + if cmode is None: + return self._colormode + if cmode == 1.0: + self._colormode = float(cmode) + elif cmode == 255: + self._colormode = int(cmode) + + def reset(self): + """Reset all Turtles on the Screen to their initial state. + + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.reset() + """ + for turtle in self._turtles: + turtle._setmode(self._mode) + turtle.reset() + + def turtles(self): + """Return the list of turtles on the screen. + + Example (for a TurtleScreen instance named screen): + >>> screen.turtles() + [] + """ + return self._turtles + + def bgcolor(self, *args): + """Set or return backgroundcolor of the TurtleScreen. + + Arguments (if given): a color string or three numbers + in the range 0..colormode or a 3-tuple of such numbers. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + 'orange' + >>> screen.bgcolor(0.5,0,0.5) + >>> screen.bgcolor() + '#800080' + """ + if args: + color = self._colorstr(args) + else: + color = None + color = self._bgcolor(color) + if color is not None: + color = self._color(color) + return color + + def tracer(self, n=None, delay=None): + """Turns turtle animation on/off and set delay for update drawings. + + Optional arguments: + n -- nonnegative integer + delay -- nonnegative integer + + If n is given, only each n-th regular screen update is really performed. + (Can be used to accelerate the drawing of complex graphics.) + Second arguments sets delay value (see RawTurtle.delay()) + + Example (for a TurtleScreen instance named screen): + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + fd(dist) + rt(90) + dist += 2 + """ + if n is None: + return self._tracing + self._tracing = int(n) + self._updatecounter = 0 + if delay is not None: + self._delayvalue = int(delay) + if self._tracing: + self.update() + + def delay(self, delay=None): + """ Return or set the drawing delay in milliseconds. + + Optional argument: + delay -- positive integer + + Example (for a TurtleScreen instance named screen): + >>> screen.delay(15) + >>> screen.delay() + 15 + """ + if delay is None: + return self._delayvalue + self._delayvalue = int(delay) + + def _incrementudc(self): + "Increment upadate counter.""" + if not TurtleScreen._RUNNING: + TurtleScreen._RUNNNING = True + raise Terminator + if self._tracing > 0: + self._updatecounter += 1 + self._updatecounter %= self._tracing + + def update(self): + """Perform a TurtleScreen update. + """ + for t in self.turtles(): + t._update_data() + t._drawturtle() + self._update() + + def window_width(self): + """ Return the width of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_width() + 640 + """ + return self._window_size()[0] + + def window_height(self): + """ Return the height of the turtle window. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_height() + 480 + """ + return self._window_size()[1] + + def getcanvas(self): + """Return the Canvas of this TurtleScreen. + + No argument. + + Example (for a Screen instance named screen): + >>> cv = screen.getcanvas() + >>> cv + + """ + return self.cv + + def getshapes(self): + """Return a list of names of all currently available turtle shapes. + + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.getshapes() + ['arrow', 'blank', 'circle', ... , 'turtle'] + """ + return sorted(self._shapes.keys()) + + def onclick(self, fun, btn=1, add=None): + """Bind fun to mouse-click event on canvas. + + Arguments: + fun -- a function with two arguments, the coordinates of the + clicked point on the canvas. + num -- the number of the mouse-button, defaults to 1 + + Example (for a TurtleScreen instance named screen + and a Turtle instance named turtle): + + >>> screen.onclick(turtle.goto) + + ### Subsequently clicking into the TurtleScreen will + ### make the turtle move to the clicked point. + >>> screen.onclick(None) + + ### event-binding will be removed + """ + self._onscreenclick(fun, btn, add) + + def onkey(self, fun, key): + """Bind fun to key-release event of key. + + Arguments: + fun -- a function with no arguments + key -- a string: key (e.g. "a") or key-symbol (e.g. "space") + + In order ro be able to register key-events, TurtleScreen + must have focus. (See method listen.) + + Example (for a TurtleScreen instance named screen + and a Turtle instance named turtle): + + >>> def f(): + fd(50) + lt(60) + + + >>> screen.onkey(f, "Up") + >>> screen.listen() + + ### Subsequently the turtle can be moved by + ### repeatedly pressing the up-arrow key, + ### consequently drawing a hexagon + """ + if fun == None: + self._keys.remove(key) + elif key not in self._keys: + self._keys.append(key) + self._onkey(fun, key) + + def listen(self, xdummy=None, ydummy=None): + """Set focus on TurtleScreen (in order to collect key-events) + + No arguments. + Dummy arguments are provided in order + to be able to pass listen to the onclick method. + + Example (for a TurtleScreen instance named screen): + >>> screen.listen() + """ + self._listen() + + def ontimer(self, fun, t=0): + """Install a timer, which calls fun after t milliseconds. + + Arguments: + fun -- a function with no arguments. + t -- a number >= 0 + + Example (for a TurtleScreen instance named screen): + + >>> running = True + >>> def f(): + if running: + fd(50) + lt(60) + screen.ontimer(f, 250) + + >>> f() ### makes the turtle marching around + >>> running = False + """ + self._ontimer(fun, t) + + def bgpic(self, picname=None): + """Set background image or return name of current backgroundimage. + + Optional argument: + picname -- a string, name of a gif-file or "nopic". + + If picname is a filename, set the corresponing image as background. + If picname is "nopic", delete backgroundimage, if present. + If picname is None, return the filename of the current backgroundimage. + + Example (for a TurtleScreen instance named screen): + >>> screen.bgpic() + 'nopic' + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + 'landscape.gif' + """ + if picname is None: + return self._bgpicname + if picname not in self._bgpics: + self._bgpics[picname] = self._image(picname) + self._setbgpic(self._bgpic, self._bgpics[picname]) + self._bgpicname = picname + + def screensize(self, canvwidth=None, canvheight=None, bg=None): + """Resize the canvas, the turtles are drawing on. + + Optional arguments: + canvwidth -- positive integer, new width of canvas in pixels + canvheight -- positive integer, new height of canvas in pixels + bg -- colorstring or color-tupel, new backgroundcolor + If no arguments are given, return current (canvaswidth, canvasheight) + + Do not alter the drawing window. To observe hidden parts of + the canvas use the scrollbars. (Can make visible those parts + of a drawing, which were outside the canvas before!) + + Example (for a Turtle instance named turtle): + >>> turtle.screensize(2000,1500) + ### e. g. to search for an erroneously escaped turtle ;-) + """ + return self._resize(canvwidth, canvheight, bg) + + onscreenclick = onclick + resetscreen = reset + clearscreen = clear + addshape = register_shape + +class TNavigator(object): + """Navigation part of the RawTurtle. + Implements methods for turtle movement. + """ + START_ORIENTATION = { + "standard": Vec2D(1.0, 0.0), + "world" : Vec2D(1.0, 0.0), + "logo" : Vec2D(0.0, 1.0) } + DEFAULT_MODE = "standard" + DEFAULT_ANGLEOFFSET = 0 + DEFAULT_ANGLEORIENT = 1 + + def __init__(self, mode=DEFAULT_MODE): + self._angleOffset = self.DEFAULT_ANGLEOFFSET + self._angleOrient = self.DEFAULT_ANGLEORIENT + self._mode = mode + self.undobuffer = None + self.degrees() + self._mode = None + self._setmode(mode) + TNavigator.reset(self) + + def reset(self): + """reset turtle to its initial values + + Will be overwritten by parent class + """ + self._position = Vec2D(0.0, 0.0) + self._orient = TNavigator.START_ORIENTATION[self._mode] + + def _setmode(self, mode=None): + """Set turtle-mode to 'standard', 'world' or 'logo'. + """ + if mode == None: + return self._mode + if mode not in ["standard", "logo", "world"]: + return + self._mode = mode + if mode in ["standard", "world"]: + self._angleOffset = 0 + self._angleOrient = 1 + else: # mode == "logo": + self._angleOffset = self._fullcircle/4. + self._angleOrient = -1 + + def _setDegreesPerAU(self, fullcircle): + """Helper function for degrees() and radians()""" + self._fullcircle = fullcircle + self._degreesPerAU = 360/fullcircle + if self._mode == "standard": + self._angleOffset = 0 + else: + self._angleOffset = fullcircle/4. + + def degrees(self, fullcircle=360.0): + """ Set angle measurement units to degrees. + + Optional argument: + fullcircle - a number + + Set angle measurement units, i. e. set number + of 'degrees' for a full circle. Dafault value is + 360 degrees. + + Example (for a Turtle instance named turtle): + >>> turtle.left(90) + >>> turtle.heading() + 90 + >>> turtle.degrees(400.0) # angle measurement in gon + >>> turtle.heading() + 100 + + """ + self._setDegreesPerAU(fullcircle) + + def radians(self): + """ Set the angle measurement units to radians. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 90 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + """ + self._setDegreesPerAU(2*math.pi) + + def _go(self, distance): + """move turtle forward by specified distance""" + ende = self._position + self._orient * distance + self._goto(ende) + + def _rotate(self, angle): + """Turn turtle counterclockwise by specified angle if angle > 0.""" + angle *= self._degreesPerAU + self._orient = self._orient.rotate(angle) + + def _goto(self, end): + """move turtle to position end.""" + self._position = end + + def forward(self, distance): + """Move the turtle forward by the specified distance. + + Aliases: forward | fd + + Argument: + distance -- a number (integer or float) + + Move the turtle forward by the specified distance, in the direction + the turtle is headed. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) + """ + self._go(distance) + + def back(self, distance): + """Move the turtle backward by distance. + + Aliases: back | backward | bk + + Argument: + distance -- a number + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00, 0.00) + """ + self._go(-distance) + + def right(self, angle): + """Turn turtle right by angle units. + + Aliases: right | rt + + Argument: + angle -- a number (integer or float) + + Turn turtle right by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 + """ + self._rotate(-angle) + + def left(self, angle): + """Turn turtle left by angle units. + + Aliases: left | lt + + Argument: + angle -- a number (integer or float) + + Turn turtle left by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + """ + self._rotate(angle) + + def pos(self): + """Return the turtle's current location (x,y), as a Vec2D-vector. + + Aliases: pos | position + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (0.00, 240.00) + """ + return self._position + + def xcor(self): + """ Return the turtle's x coordinate. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.xcor() + 50.0 + """ + return self._position[0] + + def ycor(self): + """ Return the turtle's y coordinate + --- + No arguments. + + Example (for a Turtle instance named turtle): + >>> reset() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print turtle.ycor() + 86.6025403784 + """ + return self._position[1] + + + def goto(self, x, y=None): + """Move turtle to an absolute position. + + Aliases: setpos | setposition | goto: + + Arguments: + x -- a number or a pair/vector of numbers + y -- a number None + + call: goto(x, y) # two coordinates + --or: goto((x, y)) # a pair (tuple) of coordinates + --or: goto(vec) # e.g. as returned by pos() + + Move turtle to an absolute position. If the pen is down, + a line will be drawn. The turtle's orientation does not change. + + Example (for a Turtle instance named turtle): + >>> tp = turtle.pos() + >>> tp + (0.00, 0.00) + >>> turtle.setpos(60,30) + >>> turtle.pos() + (60.00,30.00) + >>> turtle.setpos((20,80)) + >>> turtle.pos() + (20.00,80.00) + >>> turtle.setpos(tp) + >>> turtle.pos() + (0.00,0.00) + """ + if y is None: + self._goto(Vec2D(*x)) + else: + self._goto(Vec2D(x, y)) + + def home(self): + """Move turtle to the origin - coordinates (0,0). + + No arguments. + + Move turtle to the origin - coordinates (0,0) and set it's + heading to it's start-orientation (which depends on mode). + + Example (for a Turtle instance named turtle): + >>> turtle.home() + """ + self.goto(0, 0) + self.setheading(0) + + def setx(self, x): + """Set the turtle's first coordinate to x + + Argument: + x -- a number (integer or float) + + Set the turtle's first coordinate to x, leave second coordinate + unchanged. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00, 240.00) + """ + self._goto(Vec2D(x, self._position[1])) + + def sety(self, y): + """Set the turtle's second coordinate to y + + Argument: + y -- a number (integer or float) + + Set the turtle's first coordinate to x, second coordinate remains + unchanged. + + Example (for a Turtle instance named turtle): + >>> turtle.position() + (0.00, 40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00, -10.00) + """ + self._goto(Vec2D(self._position[0], y)) + + def distance(self, x, y=None): + """Return the distance from the turtle to (x,y) in turtle step units. + + Arguments: + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (0.00, 0.00) + >>> turtle.distance(30,40) + 50.0 + >>> pen = Turtle() + >>> pen.forward(77) + >>> turtle.distance(pen) + 77.0 + """ + if y is not None: + pos = Vec2D(x, y) + if isinstance(x, Vec2D): + pos = x + elif isinstance(x, tuple): + pos = Vec2D(*x) + elif isinstance(x, TNavigator): + pos = x._position + return abs(pos - self._position) + + def towards(self, x, y=None): + """Return the angle of the line from the turtle's position to (x, y). + + Arguments: + x -- a number or a pair/vector of numbers or a turtle instance + y -- a number None None + + call: distance(x, y) # two coordinates + --or: distance((x, y)) # a pair (tuple) of coordinates + --or: distance(vec) # e.g. as returned by pos() + --or: distance(mypen) # where mypen is another turtle + + Return the angle, between the line from turtle-position to position + specified by x, y and the turtle's start orientation. (Depends on + modes - "standard" or "logo") + + Example (for a Turtle instance named turtle): + >>> turtle.pos() + (10.00, 10.00) + >>> turtle.towards(0,0) + 225.0 + """ + if y is not None: + pos = Vec2D(x, y) + if isinstance(x, Vec2D): + pos = x + elif isinstance(x, tuple): + pos = Vec2D(*x) + elif isinstance(x, TNavigator): + pos = x._position + x, y = pos - self._position + result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0 + result /= self._degreesPerAU + return (self._angleOffset + self._angleOrient*result) % self._fullcircle + + def heading(self): + """ Return the turtle's current heading. + + No arguments. + + Example (for a Turtle instance named turtle): + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + """ + x, y = self._orient + result = round(math.atan2(y, x)*180.0/math.pi, 10) % 360.0 + result /= self._degreesPerAU + return (self._angleOffset + self._angleOrient*result) % self._fullcircle + + def setheading(self, to_angle): + """Set the orientation of the turtle to to_angle. + + Aliases: setheading | seth + + Argument: + to_angle -- a number (integer or float) + + Set the orientation of the turtle to to_angle. + Here are some common directions in degrees: + + standard - mode: logo-mode: + -------------------|-------------------- + 0 - east 0 - north + 90 - north 90 - east + 180 - west 180 - south + 270 - south 270 - west + + Example (for a Turtle instance named turtle): + >>> turtle.setheading(90) + >>> turtle.heading() + 90 + """ + angle = (to_angle - self.heading())*self._angleOrient + full = self._fullcircle + angle = (angle+full/2.)%full - full/2. + self._rotate(angle) + + def circle(self, radius, extent = None, steps = None): + """ Draw a circle with given radius. + + Arguments: + radius -- a number + extent (optional) -- a number + steps (optional) -- an integer + + Draw a circle with given radius. The center is radius units left + of the turtle; extent - an angle - determines which part of the + circle is drawn. If extent is not given, draw the entire circle. + If extent is not a full circle, one endpoint of the arc is the + current pen position. Draw the arc in counterclockwise direction + if radius is positive, otherwise in clockwise direction. Finally + the direction of the turtle is changed by the amount of extent. + + As the circle is approximated by an inscribed regular polygon, + steps determines the number of steps to use. If not given, + it will be calculated automatically. Maybe used to draw regular + polygons. + + call: circle(radius) # full circle + --or: circle(radius, extent) # arc + --or: circle(radius, extent, steps) + --or: circle(radius, steps=6) # 6-sided polygon + + Example (for a Turtle instance named turtle): + >>> turtle.circle(50) + >>> turtle.circle(120, 180) # semicircle + """ + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + speed = self.speed() + if extent is None: + extent = self._fullcircle + if steps is None: + frac = abs(extent)/self._fullcircle + steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) + w = 1.0 * extent / steps + w2 = 0.5 * w + l = 2.0 * radius * math.sin(w2*math.pi/180.0*self._degreesPerAU) + if radius < 0: + l, w, w2 = -l, -w, -w2 + tr = self.tracer() + dl = self._delay() + if speed == 0: + self.tracer(0, 0) + else: + self.speed(0) + self._rotate(w2) + for i in range(steps): + self.speed(speed) + self._go(l) + self.speed(0) + self._rotate(w) + self._rotate(-w2) + if speed == 0: + self.tracer(tr, dl) + self.speed(speed) + if self.undobuffer: + self.undobuffer.cumulate = False + +## three dummy methods to be implemented by child class: + + def speed(self, s=0): + """dummy method - to be overwritten by child class""" + def tracer(self, a=None, b=None): + """dummy method - to be overwritten by child class""" + def _delay(self, n=None): + """dummy method - to be overwritten by child class""" + + fd = forward + bk = back + backward = back + rt = right + lt = left + position = pos + setpos = goto + setposition = goto + seth = setheading + + +class TPen(object): + """Drawing part of the RawTurtle. + Implements drawing properties. + """ + def __init__(self, resizemode=_CFG["resizemode"]): + self._resizemode = resizemode # or "user" or "noresize" + self.undobuffer = None + TPen._reset(self) + + def _reset(self, pencolor=_CFG["pencolor"], + fillcolor=_CFG["fillcolor"]): + self._pensize = 1 + self._shown = True + self._pencolor = pencolor + self._fillcolor = fillcolor + self._drawing = True + self._speed = 3 + self._stretchfactor = (1, 1) + self._tilt = 0 + self._outlinewidth = 1 + ### self.screen = None # to override by child class + + def resizemode(self, rmode=None): + """Set resizemode to one of the values: "auto", "user", "noresize". + + (Optional) Argument: + rmode -- one of the strings "auto", "user", "noresize" + + Different resizemodes have the following effects: + - "auto" adapts the appearance of the turtle + corresponding to the value of pensize. + - "user" adapts the appearance of the turtle according to the + values of stretchfactor and outlinewidth (outline), + which are set by shapesize() + - "noresize" no adaption of the turtle's appearance takes place. + If no argument is given, return current resizemode. + resizemode("user") is called by a call of shapesize with arguments. + + + Examples (for a Turtle instance named turtle): + >>> turtle.resizemode("noresize") + >>> turtle.resizemode() + 'noresize' + """ + if rmode is None: + return self._resizemode + rmode = rmode.lower() + if rmode in ["auto", "user", "noresize"]: + self.pen(resizemode=rmode) + + def pensize(self, width=None): + """Set or return the line thickness. + + Aliases: pensize | width + + Argument: + width -- positive number + + Set the line thickness to width or return it. If resizemode is set + to "auto" and turtleshape is a polygon, that polygon is drawn with + the same line thickness. If no argument is given, current pensize + is returned. + + Example (for a Turtle instance named turtle): + >>> turtle.pensize() + 1 + turtle.pensize(10) # from here on lines of width 10 are drawn + """ + if width is None: + return self._pensize + self.pen(pensize=width) + + + def penup(self): + """Pull the pen up -- no drawing when moving. + + Aliases: penup | pu | up + + No argument + + Example (for a Turtle instance named turtle): + >>> turtle.penup() + """ + if not self._drawing: + return + self.pen(pendown=False) + + def pendown(self): + """Pull the pen down -- drawing when moving. + + Aliases: pendown | pd | down + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.pendown() + """ + if self._drawing: + return + self.pen(pendown=True) + + def isdown(self): + """Return True if pen is down, False if it's up. + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + """ + return self._drawing + + def speed(self, speed=None): + """ Return or set the turtle's speed. + + Optional argument: + speed -- an integer in the range 0..10 or a speedstring (see below) + + Set the turtle's speed to an integer value in the range 0 .. 10. + If no argument is given: return current speed. + + If input is a number greater than 10 or smaller than 0.5, + speed is set to 0. + Speedstrings are mapped to speedvalues in the following way: + 'fastest' : 0 + 'fast' : 10 + 'normal' : 6 + 'slow' : 3 + 'slowest' : 1 + speeds from 1 to 10 enforce increasingly faster animation of + line drawing and turtle turning. + + Attention: + speed = 0 : *no* animation takes place. forward/back makes turtle jump + and likewise left/right make the turtle turn instantly. + + Example (for a Turtle instance named turtle): + >>> turtle.speed(3) + """ + speeds = {'fastest':0, 'fast':10, 'normal':6, 'slow':3, 'slowest':1 } + if speed is None: + return self._speed + if speed in speeds: + speed = speeds[speed] + elif 0.5 < speed < 10.5: + speed = int(round(speed)) + else: + speed = 0 + self.pen(speed=speed) + + def color(self, *args): + """Return or set the pencolor and fillcolor. + + Arguments: + Several input formats are allowed. + They use 0, 1, 2, or 3 arguments as follows: + + color() + Return the current pencolor and the current fillcolor + as a pair of color specification strings as are returned + by pencolor and fillcolor. + color(colorstring), color((r,g,b)), color(r,g,b) + inputs as in pencolor, set both, fillcolor and pencolor, + to the given value. + color(colorstring1, colorstring2), + color((r1,g1,b1), (r2,g2,b2)) + equivalent to pencolor(colorstring1) and fillcolor(colorstring2) + and analogously, if the other input format is used. + + If turtleshape is a polygon, outline and interior of that polygon + is drawn with the newly set colors. + For mor info see: pencolor, fillcolor + + Example (for a Turtle instance named turtle): + >>> turtle.color('red', 'green') + >>> turtle.color() + ('red', 'green') + >>> colormode(255) + >>> color((40, 80, 120), (160, 200, 240)) + >>> color() + ('#285078', '#a0c8f0') + """ + if args: + l = len(args) + if l == 1: + pcolor = fcolor = args[0] + elif l == 2: + pcolor, fcolor = args + elif l == 3: + pcolor = fcolor = args + pcolor = self._colorstr(pcolor) + fcolor = self._colorstr(fcolor) + self.pen(pencolor=pcolor, fillcolor=fcolor) + else: + return self._color(self._pencolor), self._color(self._fillcolor) + + def pencolor(self, *args): + """ Return or set the pencolor. + + Arguments: + Four input formats are allowed: + - pencolor() + Return the current pencolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - pencolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - pencolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - pencolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the outline of that polygon is drawn + with the newly set pencolor. + + Example (for a Turtle instance named turtle): + >>> turtle.pencolor('brown') + >>> tup = (0.2, 0.8, 0.55) + >>> turtle.pencolor(tup) + >>> turtle.pencolor() + '#33cc8c' + """ + if args: + color = self._colorstr(args) + if color == self._pencolor: + return + self.pen(pencolor=color) + else: + return self._color(self._pencolor) + + def fillcolor(self, *args): + """ Return or set the fillcolor. + + Arguments: + Four input formats are allowed: + - fillcolor() + Return the current fillcolor as color specification string, + possibly in hex-number format (see example). + May be used as input to another color/pencolor/fillcolor call. + - fillcolor(colorstring) + s is a Tk color specification string, such as "red" or "yellow" + - fillcolor((r, g, b)) + *a tuple* of r, g, and b, which represent, an RGB color, + and each of r, g, and b are in the range 0..colormode, + where colormode is either 1.0 or 255 + - fillcolor(r, g, b) + r, g, and b represent an RGB color, and each of r, g, and b + are in the range 0..colormode + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + Example (for a Turtle instance named turtle): + >>> turtle.fillcolor('violet') + >>> col = turtle.pencolor() + >>> turtle.fillcolor(col) + >>> turtle.fillcolor(0, .5, 0) + """ + if args: + color = self._colorstr(args) + if color == self._fillcolor: + return + self.pen(fillcolor=color) + else: + return self._color(self._fillcolor) + + def showturtle(self): + """Makes the turtle visible. + + Aliases: showturtle | st -from math import * # Also for export -from time import sleep -import Tkinter + No argument. -speeds = ['fastest', 'fast', 'normal', 'slow', 'slowest'] + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + >>> turtle.showturtle() + """ + self.pen(shown=True) + + def hideturtle(self): + """Makes the turtle invisible. + + Aliases: hideturtle | ht + + No argument. + + It's a good idea to do this while you're in the + middle of a complicated drawing, because hiding + the turtle speeds up the drawing observably. + + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + """ + self.pen(shown=False) + + def isvisible(self): + """Return True if the Turtle is shown, False if it's hidden. + + No argument. + + Example (for a Turtle instance named turtle): + >>> turtle.hideturtle() + >>> print turtle.isvisible(): + False + """ + return self._shown + + def pen(self, pen=None, **pendict): + """Return or set the pen's attributes. + + Arguments: + pen -- a dictionary with some or all of the below listed keys. + **pendict -- one or more keyword-arguments with the below + listed keys as keywords. + + Return or set the pen's attributes in a 'pen-dictionary' + with the following key/value pairs: + "shown" : True/False + "pendown" : True/False + "pencolor" : color-string or color-tuple + "fillcolor" : color-string or color-tuple + "pensize" : positive number + "speed" : number in range 0..10 + "resizemode" : "auto" or "user" or "noresize" + "stretchfactor": (positive number, positive number) + "outline" : positive number + "tilt" : number + + This dicionary can be used as argument for a subsequent + pen()-call to restore the former pen-state. Moreover one + or more of these attributes can be provided as keyword-arguments. + This can be used to set several pen attributes in one statement. + + + Examples (for a Turtle instance named turtle): + >>> turtle.pen(fillcolor="black", pencolor="red", pensize=10) + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'black', + 'stretchfactor': (1,1), 'speed': 3} + >>> penstate=turtle.pen() + >>> turtle.color("yellow","") + >>> turtle.penup() + >>> turtle.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'yellow', 'pendown': False, 'fillcolor': '', + 'stretchfactor': (1,1), 'speed': 3} + >>> p.pen(penstate, fillcolor="green") + >>> p.pen() + {'pensize': 10, 'shown': True, 'resizemode': 'auto', 'outline': 1, + 'pencolor': 'red', 'pendown': True, 'fillcolor': 'green', + 'stretchfactor': (1,1), 'speed': 3} + """ + _pd = {"shown" : self._shown, + "pendown" : self._drawing, + "pencolor" : self._pencolor, + "fillcolor" : self._fillcolor, + "pensize" : self._pensize, + "speed" : self._speed, + "resizemode" : self._resizemode, + "stretchfactor" : self._stretchfactor, + "outline" : self._outlinewidth, + "tilt" : self._tilt + } -class Error(Exception): - pass + if not (pen or pendict): + return _pd -class RawPen: + if isinstance(pen, dict): + p = pen + else: + p = {} + p.update(pendict) - def __init__(self, canvas): - self._canvas = canvas - self._items = [] - self._tracing = 1 - self._arrow = 0 - self._delay = 10 # default delay for drawing - self._angle = 0.0 - self.degrees() - self.reset() + _p_buf = {} + for key in p: + _p_buf[key] = _pd[key] + + if self.undobuffer: + self.undobuffer.push(("pen", _p_buf)) + + newLine = False + if "pendown" in p: + if self._drawing != p["pendown"]: + newLine = True + if "pencolor" in p: + if isinstance(p["pencolor"], tuple): + p["pencolor"] = self._colorstr((p["pencolor"],)) + if self._pencolor != p["pencolor"]: + newLine = True + if "pensize" in p: + if self._pensize != p["pensize"]: + newLine = True + if newLine: + self._newLine() + if "pendown" in p: + self._drawing = p["pendown"] + if "pencolor" in p: + self._pencolor = p["pencolor"] + if "pensize" in p: + self._pensize = p["pensize"] + if "fillcolor" in p: + if isinstance(p["fillcolor"], tuple): + p["fillcolor"] = self._colorstr((p["fillcolor"],)) + self._fillcolor = p["fillcolor"] + if "speed" in p: + self._speed = p["speed"] + if "resizemode" in p: + self._resizemode = p["resizemode"] + if "stretchfactor" in p: + sf = p["stretchfactor"] + if isinstance(sf, (int, float)): + sf = (sf, sf) + self._stretchfactor = sf + if "outline" in p: + self._outlinewidth = p["outline"] + if "shown" in p: + self._shown = p["shown"] + if "tilt" in p: + self._tilt = p["tilt"] + self._update() + +## three dummy methods to be implemented by child class: + + def _newLine(self, usePos = True): + """dummy method - to be overwritten by child class""" + def _update(self, count=True, forced=False): + """dummy method - to be overwritten by child class""" + def _color(self, args): + """dummy method - to be overwritten by child class""" + def _colorstr(self, args): + """dummy method - to be overwritten by child class""" + + width = pensize + up = penup + pu = penup + pd = pendown + down = pendown + st = showturtle + ht = hideturtle - def degrees(self, fullcircle=360.0): - """ Set angle measurement units to degrees. - Example: - >>> turtle.degrees() - """ - # Don't try to change _angle if it is 0, because - # _fullcircle might not be set, yet - if self._angle: - self._angle = (self._angle / self._fullcircle) * fullcircle - self._fullcircle = fullcircle - self._invradian = pi / (fullcircle * 0.5) +class _TurtleImage(object): + """Helper class: Datatype to store Turtle attributes + """ - def radians(self): - """ Set the angle measurement units to radians. + def __init__(self, screen, shapeIndex): + self.screen = screen + self._type = None + self._setshape(shapeIndex) + + def _setshape(self, shapeIndex): + screen = self.screen # RawTurtle.screens[self.screenIndex] + self.shapeIndex = shapeIndex + if self._type == "polygon" == screen._shapes[shapeIndex]._type: + return + if self._type == "image" == screen._shapes[shapeIndex]._type: + return + if self._type in ["image", "polygon"]: + screen._delete(self._item) + elif self._type == "compound": + for item in self._item: + screen._delete(item) + self._type = screen._shapes[shapeIndex]._type + if self._type == "polygon": + self._item = screen._createpoly() + elif self._type == "image": + self._item = screen._createimage(screen._shapes["blank"]._data) + elif self._type == "compound": + self._item = [screen._createpoly() for item in + screen._shapes[shapeIndex]._data] + + +class RawTurtle(TPen, TNavigator): + """Animation part of the RawTurtle. + Puts RawTurtle upon a TurtleScreen and provides tools for + it's animation. + """ + screens = [] - Example: - >>> turtle.radians() - """ - self.degrees(2.0*pi) + def __init__(self, canvas=None, + shape=_CFG["shape"], + undobuffersize=_CFG["undobuffersize"], + visible=_CFG["visible"]): + if isinstance(canvas, Screen): + self.screen = canvas + elif isinstance(canvas, TurtleScreen): + if canvas not in RawTurtle.screens: + RawTurtle.screens.append(canvas) + self.screen = canvas + elif isinstance(canvas, (ScrolledCanvas, Canvas)): + for screen in RawTurtle.screens: + if screen.cv == canvas: + self.screen = screen + break + else: + self.screen = TurtleScreen(canvas) + RawTurtle.screens.append(self.screen) + else: + raise TurtleGraphicsError("bad cavas argument %s" % canvas) + + screen = self.screen + TNavigator.__init__(self, screen.mode()) + TPen.__init__(self) + screen._turtles.append(self) + self.drawingLineItem = screen._createline() + self.turtle = _TurtleImage(screen, shape) + self._poly = None + self._creatingPoly = False + self._fillitem = self._fillpath = None + self._shown = visible + self._hidden_from_screen = False + self.currentLineItem = screen._createline() + self.currentLine = [self._position] + self.items = [self.currentLineItem] + self.stampItems = [] + self._undobuffersize = undobuffersize + self.undobuffer = Tbuffer(undobuffersize) + self._update() def reset(self): - """ Clear the screen, re-center the pen, and set variables to - the default values. + """Delete the turtle's drawings and restore it's default values. - Example: + No argument. +, + Delete the turtle's drawings from the screen, re-center the turtle + and set variables to the default values. + + Example (for a Turtle instance named turtle): >>> turtle.position() - [0.0, -22.0] + (0.00,-22.00) >>> turtle.heading() 100.0 >>> turtle.reset() >>> turtle.position() - [0.0, 0.0] + (0.00,0.00) >>> turtle.heading() 0.0 """ - canvas = self._canvas - self._canvas.update() - width = canvas.winfo_width() - height = canvas.winfo_height() - if width <= 1: - width = canvas['width'] - if height <= 1: - height = canvas['height'] - self._origin = float(width)/2.0, float(height)/2.0 - self._position = self._origin - self._angle = 0.0 - self._drawing = 1 - self._width = 1 - self._color = "black" - self._filling = 0 - self._path = [] - self.clear() - canvas._root().tkraise() - - def clear(self): - """ Clear the screen. The turtle does not move. - - Example: - >>> turtle.clear() - """ - self.fill(0) - canvas = self._canvas - items = self._items - self._items = [] - for item in items: - canvas.delete(item) - self._delete_turtle() - self._draw_turtle() - - def tracer(self, flag): - """ Set tracing on if flag is True, and off if it is False. - Tracing means line are drawn more slowly, with an - animation of an arrow along the line. - - Example: - >>> turtle.tracer(False) # turns off Tracer - """ - self._tracing = flag - if not self._tracing: - self._delete_turtle() - self._draw_turtle() - - def forward(self, distance): - """ Go forward distance steps. - - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.forward(25) - >>> turtle.position() - [25.0, 0.0] - >>> turtle.forward(-75) - >>> turtle.position() - [-50.0, 0.0] - """ - x0, y0 = start = self._position - x1 = x0 + distance * cos(self._angle*self._invradian) - y1 = y0 - distance * sin(self._angle*self._invradian) - self._goto(x1, y1) + TNavigator.reset(self) + TPen._reset(self) + self._clear() + self._drawturtle() + self._update() + + def setundobuffer(self, size): + """Set or disable undobuffer. + + Argument: + size -- an integer or None + + If size is an integer an empty undobuffer of given size is installed. + Size gives the maximum number of turtle-actions that can be undone + by the undo() function. + If size is None, no undobuffer is present. - def backward(self, distance): - """ Go backwards distance steps. - - The turtle's heading does not change. - - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.backward(30) - >>> turtle.position() - [-30.0, 0.0] + Example (for a Turtle instance named turtle): + >>> turtle.setundobuffer(42) """ - self.forward(-distance) - - def left(self, angle): - """ Turn left angle units (units are by default degrees, - but can be set via the degrees() and radians() functions.) - - When viewed from above, the turning happens in-place around - its front tip. + if size is None: + self.undobuffer = None + else: + self.undobuffer = Tbuffer(size) - Example: - >>> turtle.heading() - 22 - >>> turtle.left(45) - >>> turtle.heading() - 67.0 - """ - self._angle = (self._angle + angle) % self._fullcircle - self._draw_turtle() + def undobufferentries(self): + """Return count of entries in the undobuffer. - def right(self, angle): - """ Turn right angle units (units are by default degrees, - but can be set via the degrees() and radians() functions.) + No argument. - When viewed from above, the turning happens in-place around - its front tip. + Example (for a Turtle instance named turtle): + >>> while undobufferentries(): + undo() + """ + if self.undobuffer is None: + return 0 + return self.undobuffer.nr_of_items() + + def _clear(self): + """Delete all of pen's drawings""" + self._fillitem = self._fillpath = None + for item in self.items: + self.screen._delete(item) + self.currentLineItem = self.screen._createline() + self.currentLine = [] + if self._drawing: + self.currentLine.append(self._position) + self.items = [self.currentLineItem] + self.clearstamps() + self.setundobuffer(self._undobuffersize) - Example: - >>> turtle.heading() - 22 - >>> turtle.right(45) - >>> turtle.heading() - 337.0 - """ - self.left(-angle) - def up(self): - """ Pull the pen up -- no drawing when moving. + def clear(self): + """Delete the turtle's drawings from the screen. Do not move turtle. - Example: - >>> turtle.up() - """ - self._drawing = 0 + No arguments. - def down(self): - """ Put the pen down -- draw when moving. + Delete the turtle's drawings from the screen. Do not move turtle. + State and position of the turtle as well as drawings of other + turtles are not affected. - Example: - >>> turtle.down() + Examples (for a Turtle instance named turtle): + >>> turtle.clear() """ - self._drawing = 1 + self._clear() + self._update() - def width(self, width): - """ Set the line to thickness to width. + def _update_data(self): + self.screen._incrementudc() + if self.screen._updatecounter != 0: + return + if len(self.currentLine)>1: + self.screen._drawline(self.currentLineItem, self.currentLine, + self._pencolor, self._pensize) - Example: - >>> turtle.width(10) + def _update(self): + """Perform a Turtle-data update. """ - self._width = float(width) - - def color(self, *args): - """ Set the pen color. - - Three input formats are allowed: - - color(s) - s is a Tk specification string, such as "red" or "yellow" - - color((r, g, b)) - *a tuple* of r, g, and b, which represent, an RGB color, - and each of r, g, and b are in the range [0..1] - - color(r, g, b) - r, g, and b represent an RGB color, and each of r, g, and b - are in the range [0..1] + screen = self.screen + if screen._tracing == 0: + return + elif screen._tracing == 1: + self._update_data() + self._drawturtle() + screen._update() # TurtleScreenBase + screen._delay(screen._delayvalue) # TurtleScreenBase + else: + self._update_data() + if screen._updatecounter == 0: + for t in screen.turtles(): + t._drawturtle() + screen._update() + + def tracer(self, flag=None, delay=None): + """Turns turtle animation on/off and set delay for update drawings. + + Optional arguments: + n -- nonnegative integer + delay -- nonnegative integer + + If n is given, only each n-th regular screen update is really performed. + (Can be used to accelerate the drawing of complex graphics.) + Second arguments sets delay value (see RawTurtle.delay()) + + Example (for a Turtle instance named turtle): + >>> turtle.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + turtle.fd(dist) + turtle.rt(90) + dist += 2 + """ + return self.screen.tracer(flag, delay) + + def _color(self, args): + return self.screen._color(args) - Example: + def _colorstr(self, args): + return self.screen._colorstr(args) - >>> turtle.color('brown') - >>> tup = (0.2, 0.8, 0.55) - >>> turtle.color(tup) - >>> turtle.color(0, .5, 0) + def _cc(self, args): + """Convert colortriples to hexstrings. """ - if not args: - raise Error, "no color arguments" - if len(args) == 1: - color = args[0] - if type(color) == type(""): - # Test the color first - try: - id = self._canvas.create_line(0, 0, 0, 0, fill=color) - except Tkinter.TclError: - raise Error, "bad color string: %r" % (color,) - self._set_color(color) + if isinstance(args, str): + return args + try: + r, g, b = args + except: + raise TurtleGraphicsError("bad color arguments: %s" % str(args)) + if self.screen._colormode == 1.0: + r, g, b = [round(255.0*x) for x in (r, g, b)] + if not ((0 <= r <= 255) and (0 <= g <= 255) and (0 <= b <= 255)): + raise TurtleGraphicsError("bad color sequence: %s" % str(args)) + return "#%02x%02x%02x" % (r, g, b) + + def clone(self): + """Create and return a clone of the turtle. + + No argument. + + Create and return a clone of the turtle with same position, heading + and turtle properties. + + Example (for a Turtle instance named mick): + mick = Turtle() + joe = mick.clone() + """ + screen = self.screen + self._newLine(self._drawing) + + turtle = self.turtle + self.screen = None + self.turtle = None # too make self deepcopy-able + + q = deepcopy(self) + + self.screen = screen + self.turtle = turtle + + q.screen = screen + q.turtle = _TurtleImage(screen, self.turtle.shapeIndex) + + screen._turtles.append(q) + ttype = screen._shapes[self.turtle.shapeIndex]._type + if ttype == "polygon": + q.turtle._item = screen._createpoly() + elif ttype == "image": + q.turtle._item = screen._createimage(screen._shapes["blank"]._data) + elif ttype == "compound": + q.turtle._item = [screen._createpoly() for item in + screen._shapes[self.turtle.shapeIndex]._data] + q.currentLineItem = screen._createline() + q._update() + return q + + def shape(self, name=None): + """Set turtle shape to shape with given name / return current shapename. + + Optional argument: + name -- a string, which is a valid shapename + + Set turtle shape to shape with given name or, if name is not given, + return name of current shape. + Shape with name must exist in the TurtleScreen's shape dictionary. + Initially there are the following polygon shapes: + 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'. + To learn about how to deal with shapes see Screen-method register_shape. + + Example (for a Turtle instance named turtle): + >>> turtle.shape() + 'arrow' + >>> turtle.shape("turtle") + >>> turtle.shape() + 'turtle' + """ + if name is None: + return self.turtle.shapeIndex + if not name in self.screen.getshapes(): + raise TurtleGraphicsError("There is no shape named %s" % name) + self.turtle._setshape(name) + self._update() + + def shapesize(self, stretch_wid=None, stretch_len=None, outline=None): + """Set/return turtle's stretchfactors/outline. Set resizemode to "user". + + Optinonal arguments: + stretch_wid : positive number + stretch_len : positive number + outline : positive number + + Return or set the pen's attributes x/y-stretchfactors and/or outline. + Set resizemode to "user". + If and only if resizemode is set to "user", the turtle will be displayed + stretched according to its stretchfactors: + stretch_wid is stretchfactor perpendicular to orientation + stretch_len is stretchfactor in direction of turtles orientation. + outline determines the width of the shapes's outline. + + Examples (for a Turtle instance named turtle): + >>> turtle.resizemode("user") + >>> turtle.shapesize(5, 5, 12) + >>> turtle.shapesize(outline=8) + """ + if stretch_wid is None and stretch_len is None and outline == None: + stretch_wid, stretch_len = self._stretchfactor + return stretch_wid, stretch_len, self._outlinewidth + if stretch_wid is not None: + if stretch_len is None: + stretchfactor = stretch_wid, stretch_wid + else: + stretchfactor = stretch_wid, stretch_len + elif stretch_len is not None: + stretchfactor = self._stretchfactor[0], stretch_len + else: + stretchfactor = self._stretchfactor + if outline is None: + outline = self._outlinewidth + self.pen(resizemode="user", + stretchfactor=stretchfactor, outline=outline) + + def settiltangle(self, angle): + """Rotate the turtleshape to point in the specified direction + + Optional argument: + angle -- number + + Rotate the turtleshape to point in the direction specified by angle, + regardless of its current tilt-angle. DO NOT change the turtle's + heading (direction of movement). + + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.settiltangle(45) + >>> stamp() + >>> turtle.fd(50) + >>> turtle.settiltangle(-45) + >>> stamp() + >>> turtle.fd(50) + """ + tilt = -angle * self._degreesPerAU * self._angleOrient + tilt = (tilt * math.pi / 180.0) % (2*math.pi) + self.pen(resizemode="user", tilt=tilt) + + def tiltangle(self): + """Return the current tilt-angle. + + No argument. + + Return the current tilt-angle, i. e. the angle between the + orientation of the turtleshape and the heading of the turtle + (it's direction of movement). + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(45) + >>> turtle.tiltangle() + >>> + """ + tilt = -self._tilt * (180.0/math.pi) * self._angleOrient + return (tilt / self._degreesPerAU) % self._fullcircle + + def tilt(self, angle): + """Rotate the turtleshape by angle. + + Argument: + angle - a number + + Rotate the turtleshape by angle from its current tilt-angle, + but do NOT change the turtle's heading (direction of movement). + + Examples (for a Turtle instance named turtle): + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + """ + self.settiltangle(angle + self.tiltangle()) + + def _polytrafo(self, poly): + """Computes transformed polygon shapes from a shape + according to current position and heading. + """ + screen = self.screen + p0, p1 = self._position + e0, e1 = self._orient + e = Vec2D(e0, e1 * screen.yscale / screen.xscale) + e0, e1 = (1.0 / abs(e)) * e + return [(p0+(e1*x+e0*y)/screen.xscale, p1+(-e0*x+e1*y)/screen.yscale) + for (x, y) in poly] + + def _drawturtle(self): + """Manages the correct rendering of the turtle with respect to + it's shape, resizemode, strech and tilt etc.""" + screen = self.screen + shape = screen._shapes[self.turtle.shapeIndex] + ttype = shape._type + titem = self.turtle._item + if self._shown and screen._updatecounter == 0 and screen._tracing > 0: + self._hidden_from_screen = False + tshape = shape._data + if ttype == "polygon": + if self._resizemode == "noresize": + w = 1 + shape = tshape + else: + if self._resizemode == "auto": + lx = ly = max(1, self._pensize/5.0) + w = self._pensize + tiltangle = 0 + elif self._resizemode == "user": + lx, ly = self._stretchfactor + w = self._outlinewidth + tiltangle = self._tilt + shape = [(lx*x, ly*y) for (x, y) in tshape] + t0, t1 = math.sin(tiltangle), math.cos(tiltangle) + shape = [(t1*x+t0*y, -t0*x+t1*y) for (x, y) in shape] + shape = self._polytrafo(shape) + fc, oc = self._fillcolor, self._pencolor + screen._drawpoly(titem, shape, fill=fc, outline=oc, + width=w, top=True) + elif ttype == "image": + screen._drawimage(titem, self._position, tshape) + elif ttype == "compound": + lx, ly = self._stretchfactor + w = self._outlinewidth + for item, (poly, fc, oc) in zip(titem, tshape): + poly = [(lx*x, ly*y) for (x, y) in poly] + poly = self._polytrafo(poly) + screen._drawpoly(item, poly, fill=self._cc(fc), + outline=self._cc(oc), width=w, top=True) + else: + if self._hidden_from_screen: return - try: - r, g, b = color - except: - raise Error, "bad color sequence: %r" % (color,) + if ttype == "polygon": + screen._drawpoly(titem, ((0, 0), (0, 0), (0, 0)), "", "") + elif ttype == "image": + screen._drawimage(titem, self._position, + screen._shapes["blank"]._data) + elif ttype == "compound": + for item in titem: + screen._drawpoly(item, ((0, 0), (0, 0), (0, 0)), "", "") + self._hidden_from_screen = True + +############################## stamp stuff ############################### + + def stamp(self): + """Stamp a copy of the turtleshape onto the canvas and return it's id. + + No argument. + + Stamp a copy of the turtle shape onto the canvas at the current + turtle position. Return a stamp_id for that stamp, which can be + used to delete it by calling clearstamp(stamp_id). + + Example (for a Turtle instance named turtle): + >>> turtle.color("blue") + >>> turtle.stamp() + 13 + >>> turtle.fd(50) + """ + screen = self.screen + shape = screen._shapes[self.turtle.shapeIndex] + ttype = shape._type + tshape = shape._data + if ttype == "polygon": + stitem = screen._createpoly() + if self._resizemode == "noresize": + w = 1 + shape = tshape + else: + if self._resizemode == "auto": + lx = ly = max(1, self._pensize/5.0) + w = self._pensize + tiltangle = 0 + elif self._resizemode == "user": + lx, ly = self._stretchfactor + w = self._outlinewidth + tiltangle = self._tilt + shape = [(lx*x, ly*y) for (x, y) in tshape] + t0, t1 = math.sin(tiltangle), math.cos(tiltangle) + shape = [(t1*x+t0*y, -t0*x+t1*y) for (x, y) in shape] + shape = self._polytrafo(shape) + fc, oc = self._fillcolor, self._pencolor + screen._drawpoly(stitem, shape, fill=fc, outline=oc, + width=w, top=True) + elif ttype == "image": + stitem = screen._createimage("") + screen._drawimage(stitem, self._position, tshape) + elif ttype == "compound": + stitem = [] + for element in tshape: + item = screen._createpoly() + stitem.append(item) + stitem = tuple(stitem) + lx, ly = self._stretchfactor + w = self._outlinewidth + for item, (poly, fc, oc) in zip(stitem, tshape): + poly = [(lx*x, ly*y) for (x, y) in poly] + poly = self._polytrafo(poly) + screen._drawpoly(item, poly, fill=self._cc(fc), + outline=self._cc(oc), width=w, top=True) + self.stampItems.append(stitem) + self.undobuffer.push(("stamp", stitem)) + return stitem + + def _clearstamp(self, stampid): + """does the work for clearstamp() and clearstamps() + """ + if stampid in self.stampItems: + if isinstance(stampid, tuple): + for subitem in stampid: + self.screen._delete(subitem) + else: + self.screen._delete(stampid) + self.stampItems.remove(stampid) + # Delete stampitem from undobuffer if necessary + # if clearstamp is called directly. + item = ("stamp", stampid) + buf = self.undobuffer + if item not in buf.buffer: + return + index = buf.buffer.index(item) + buf.buffer.remove(item) + if index <= buf.ptr: + buf.ptr = (buf.ptr - 1) % buf.bufsize + buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None]) + + def clearstamp(self, stampid): + """Delete stamp with given stampid + + Argument: + stampid - an integer, must be return value of previous stamp() call. + + Example (for a Turtle instance named turtle): + >>> turtle.color("blue") + >>> astamp = turtle.stamp() + >>> turtle.fd(50) + >>> turtle.clearstamp(astamp) + """ + self._clearstamp(stampid) + self._update() + + def clearstamps(self, n=None): + """Delete all or first/last n of turtle's stamps. + + Optional argument: + n -- an integer + + If n is None, delete all of pen's stamps, + else if n > 0 delete first n stamps + else if n < 0 delete last n stamps. + + Example (for a Turtle instance named turtle): + >>> for i in range(8): + turtle.stamp(); turtle.fd(30) + ... + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + """ + if n is None: + toDelete = self.stampItems[:] + elif n >= 0: + toDelete = self.stampItems[:n] else: - try: - r, g, b = args - except: - raise Error, "bad color arguments: %r" % (args,) - assert 0 <= r <= 1 - assert 0 <= g <= 1 - assert 0 <= b <= 1 - x = 255.0 - y = 0.5 - self._set_color("#%02x%02x%02x" % (int(r*x+y), int(g*x+y), int(b*x+y))) - - def _set_color(self,color): - self._color = color - self._draw_turtle() + toDelete = self.stampItems[n:] + for item in toDelete: + self._clearstamp(item) + self._update() + + def _goto(self, end): + """Move the pen to the point end, thereby drawing a line + if pen is down. All other methodes for turtle movement depend + on this one. + """ + ## Version mit undo-stuff + go_modes = ( self._drawing, + self._pencolor, + self._pensize, + isinstance(self._fillpath, list)) + screen = self.screen + undo_entry = ("go", self._position, end, go_modes, + (self.currentLineItem, + self.currentLine[:], + screen._pointlist(self.currentLineItem), + self.items[:]) + ) + if self.undobuffer: + self.undobuffer.push(undo_entry) + start = self._position + if self._speed and screen._tracing == 1: + diff = (end-start) + diffsq = (diff[0]*screen.xscale)**2 + (diff[1]*screen.yscale)**2 + nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) + delta = diff * (1.0/nhops) + for n in range(1, nhops): + if n == 1: + top = True + else: + top = False + self._position = start + delta * n + if self._drawing: + screen._drawline(self.drawingLineItem, + (start, self._position), + self._pencolor, self._pensize, top) + self._update() + if self._drawing: + screen._drawline(self.drawingLineItem, ((0, 0), (0, 0)), + fill="", width=self._pensize) + # Turtle now at end, + if self._drawing: # now update currentLine + self.currentLine.append(end) + if isinstance(self._fillpath, list): + self._fillpath.append(end) + ###### vererbung!!!!!!!!!!!!!!!!!!!!!! + self._position = end + if self._creatingPoly: + self._poly.append(end) + if len(self.currentLine) > 42: # 42! answer to the ultimate question + # of life, the universe and everything + self._newLine() + self._update() #count=True) + + def _undogoto(self, entry): + """Reverse a _goto. Used for undo() + """ + old, new, go_modes, coodata = entry + drawing, pc, ps, filling = go_modes + cLI, cL, pl, items = coodata + screen = self.screen + if abs(self._position - new) > 0.5: + print "undogoto: HALLO-DA-STIMMT-WAS-NICHT!" + # restore former situation + self.currentLineItem = cLI + self.currentLine = cL - def write(self, text, move=False): - """ Write text at the current pen position. - - If move is true, the pen is moved to the bottom-right corner - of the text. By default, move is False. + if pl == [(0, 0), (0, 0)]: + usepc = "" + else: + usepc = pc + screen._drawline(cLI, pl, fill=usepc, width=ps) - Example: - >>> turtle.write('The race is on!') - >>> turtle.write('Home = (0, 0)', True) - """ - x, y = self._position - x = x-1 # correction -- calibrated for Windows - item = self._canvas.create_text(x, y, - text=str(text), anchor="sw", - fill=self._color) - self._items.append(item) - if move: - x0, y0, x1, y1 = self._canvas.bbox(item) - self._goto(x1, y1) - self._draw_turtle() - - def fill(self, flag): - """ Call fill(1) before drawing the shape you - want to fill, and fill(0) when done. + todelete = [i for i in self.items if (i not in items) and + (screen._type(i) == "line")] + for i in todelete: + screen._delete(i) + self.items.remove(i) + + start = old + if self._speed and screen._tracing == 1: + diff = old - new + diffsq = (diff[0]*screen.xscale)**2 + (diff[1]*screen.yscale)**2 + nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed)) + delta = diff * (1.0/nhops) + for n in range(1, nhops): + if n == 1: + top = True + else: + top = False + self._position = new + delta * n + if drawing: + screen._drawline(self.drawingLineItem, + (start, self._position), + pc, ps, top) + self._update() + if drawing: + screen._drawline(self.drawingLineItem, ((0, 0), (0, 0)), + fill="", width=ps) + # Turtle now at position old, + self._position = old + ## if undo is done during crating a polygon, the last vertex + ## will be deleted. if the polygon is entirel deleted, + ## creatigPoly will be set to False. + ## Polygons created before the last one will not be affected by undo() + if self._creatingPoly: + if len(self._poly) > 0: + self._poly.pop() + if self._poly == []: + self._creatingPoly = False + self._poly = None + if filling: + if self._fillpath == []: + self._fillpath = None + print "Unwahrscheinlich in _undogoto!" + elif self._fillpath is not None: + self._fillpath.pop() + self._update() #count=True) + + def _rotate(self, angle): + """Turns pen clockwise by angle. + """ + if self.undobuffer: + self.undobuffer.push(("rot", angle, self._degreesPerAU)) + angle *= self._degreesPerAU + neworient = self._orient.rotate(angle) + tracing = self.screen._tracing + if tracing == 1 and self._speed > 0: + anglevel = 3.0 * self._speed + steps = 1 + int(abs(angle)/anglevel) + delta = 1.0*angle/steps + for _ in range(steps): + self._orient = self._orient.rotate(delta) + self._update() + self._orient = neworient + self._update() + + def _newLine(self, usePos=True): + """Closes current line item and starts a new one. + Remark: if current line became too long, animation + performance (via _drawline) slowed down considerably. + """ + if len(self.currentLine) > 1: + self.screen._drawline(self.currentLineItem, self.currentLine, + self._pencolor, self._pensize) + self.currentLineItem = self.screen._createline() + self.items.append(self.currentLineItem) + else: + self.screen._drawline(self.currentLineItem, top=True) + self.currentLine = [] + if usePos: + self.currentLine = [self._position] + + def fill(self, flag=None): + """Call fill(True) before drawing a shape to fill, fill(False) when done. + + Optional argument: + flag -- True/False (or 1/0 respectively) + + Call fill(True) before drawing the shape you want to fill, + and fill(False) when done. + When used without argument: return fillstate (True if filling, + False else) - Example: - >>> turtle.fill(1) + Example (for a Turtle instance named turtle): + >>> turtle.fill(True) >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) @@ -296,27 +3144,43 @@ >>> turtle.forward(100) >>> turtle.left(90) >>> turtle.forward(100) - >>> turtle.fill(0) + >>> turtle.fill(False) """ - if self._filling: - path = tuple(self._path) - smooth = self._filling < 0 - if len(path) > 2: - item = self._canvas._create('polygon', path, - {'fill': self._color, - 'smooth': smooth}) - self._items.append(item) - self._path = [] - self._filling = flag + filling = isinstance(self._fillpath, list) + if flag is None: + return filling + screen = self.screen + entry1 = entry2 = () + if filling: + if len(self._fillpath) > 2: + self.screen._drawpoly(self._fillitem, self._fillpath, + fill=self._fillcolor) + entry1 = ("dofill", self._fillitem) if flag: - self._path.append(self._position) + self._fillitem = self.screen._createpoly() + self.items.append(self._fillitem) + self._fillpath = [self._position] + entry2 = ("beginfill", self._fillitem) # , self._fillpath) + self._newLine() + else: + self._fillitem = self._fillpath = None + if self.undobuffer: + if entry1 == (): + if entry2 != (): + self.undobuffer.push(entry2) + else: + if entry2 == (): + self.undobuffer.push(entry1) + else: + self.undobuffer.push(["seq", entry1, entry2]) + self._update() def begin_fill(self): - """ Called just before drawing a shape to be filled. - Must eventually be followed by a corresponding end_fill() call. - Otherwise it will be ignored. + """Called just before drawing a shape to be filled. - Example: + No argument. + + Example (for a Turtle instance named turtle): >>> turtle.begin_fill() >>> turtle.forward(100) >>> turtle.left(90) @@ -327,13 +3191,14 @@ >>> turtle.forward(100) >>> turtle.end_fill() """ - self._path = [self._position] - self._filling = 1 + self.fill(True) def end_fill(self): - """ Called after drawing a shape to be filled. + """Fill the shape drawn after the call begin_fill(). - Example: + No argument. + + Example (for a Turtle instance named turtle): >>> turtle.begin_fill() >>> turtle.forward(100) >>> turtle.left(90) @@ -344,613 +3209,820 @@ >>> turtle.forward(100) >>> turtle.end_fill() """ - self.fill(0) + self.fill(False) - def circle(self, radius, extent = None): - """ Draw a circle with given radius. - The center is radius units left of the turtle; extent - determines which part of the circle is drawn. If not given, - the entire circle is drawn. + def dot(self, size=None, *color): + """Draw a dot with diameter size, using color. - If extent is not a full circle, one endpoint of the arc is the - current pen position. The arc is drawn in a counter clockwise - direction if radius is positive, otherwise in a clockwise - direction. In the process, the direction of the turtle is - changed by the amount of the extent. + Optional argumentS: + size -- an integer >= 1 (if given) + color -- a colorstring or a numeric color tuple + + Draw a circular dot with diameter size, using color. + If size is not given, the maximum of pensize+4 and 2*pensize is used. + + Example (for a Turtle instance named turtle): + >>> turtle.dot() + >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) + """ + #print "dot-1:", size, color + if not color: + if isinstance(size, (str, tuple)): + color = self._colorstr(size) + size = self._pensize + max(self._pensize, 4) + else: + color = self._pencolor + if not size: + size = self._pensize + max(self._pensize, 4) + else: + if size is None: + size = self._pensize + max(self._pensize, 4) + color = self._colorstr(color) + #print "dot-2:", size, color + if hasattr(self.screen, "_dot"): + item = self.screen._dot(self._position, size, color) + #print "dot:", size, color, "item:", item + self.items.append(item) + if self.undobuffer: + self.undobuffer.push(("dot", item)) + else: + pen = self.pen() + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + try: + if self.resizemode() == 'auto': + self.ht() + self.pendown() + self.pensize(size) + self.pencolor(color) + self.forward(0) + finally: + self.pen(pen) + if self.undobuffer: + self.undobuffer.cumulate = False + + def _write(self, txt, align, font): + """Performs the writing for write() + """ + item, end = self.screen._write(self._position, txt, align, font, + self._pencolor) + self.items.append(item) + if self.undobuffer: + self.undobuffer.push(("wri", item)) + return end + + def write(self, arg, move=False, align="left", font=("Arial", 8, "normal")): + """Write text at the current turtle position. + + Arguments: + arg -- info, which is to be written to the TurtleScreen + move (optional) -- True/False + align (optional) -- one of the strings "left", "center" or right" + font (optional) -- a triple (fontname, fontsize, fonttype) + + Write text - the string representation of arg - at the current + turtle position according to align ("left", "center" or right") + and with the given font. + If move is True, the pen is moved to the bottom-right corner + of the text. By default, move is False. - >>> turtle.circle(50) - >>> turtle.circle(120, 180) # half a circle + Example (for a Turtle instance named turtle): + >>> turtle.write('Home = ', True, align="center") + >>> turtle.write((0,0), True) + """ + if self.undobuffer: + self.undobuffer.push(["seq"]) + self.undobuffer.cumulate = True + end = self._write(str(arg), align.lower(), font) + if move: + x, y = self.pos() + self.setpos(end, y) + if self.undobuffer: + self.undobuffer.cumulate = False + + def begin_poly(self): + """Start recording the vertices of a polygon. + + No argument. + + Start recording the vertices of a polygon. Current turtle position + is first point of polygon. + + Example (for a Turtle instance named turtle): + >>> turtle.begin_poly() """ - if extent is None: - extent = self._fullcircle - frac = abs(extent)/self._fullcircle - steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) - w = 1.0 * extent / steps - w2 = 0.5 * w - l = 2.0 * radius * sin(w2*self._invradian) - if radius < 0: - l, w, w2 = -l, -w, -w2 - self.left(w2) - for i in range(steps): - self.forward(l) - self.left(w) - self.right(w2) + self._poly = [self._position] + self._creatingPoly = True - def heading(self): - """ Return the turtle's current heading. + def end_poly(self): + """Stop recording the vertices of a polygon. - Example: - >>> turtle.heading() - 67.0 + No argument. + + Stop recording the vertices of a polygon. Current turtle position is + last point of polygon. This will be connected with the first point. + + Example (for a Turtle instance named turtle): + >>> turtle.end_poly() """ - return self._angle + self._creatingPoly = False - def setheading(self, angle): - """ Set the turtle facing the given angle. + def get_poly(self): + """Return the lastly recorded polygon. - Here are some common directions in degrees: + No argument. + + Example (for a Turtle instance named turtle): + >>> p = turtle.get_poly() + >>> turtle.register_shape("myFavouriteShape", p) + """ + ## check if there is any poly? -- 1st solution: + if self._poly is not None: + return tuple(self._poly) + + def getscreen(self): + """Return the TurtleScreen object, the turtle is drawing on. + + No argument. - 0 - east - 90 - north - 180 - west - 270 - south + Return the TurtleScreen object, the turtle is drawing on. + So TurtleScreen-methods can be called for that object. + + Example (for a Turtle instance named turtle): + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + """ + return self.screen + + def getturtle(self): + """Return the Turtleobject itself. + + No argument. + + Only reasonable use: as a function to return the 'anonymous turtle': Example: - >>> turtle.setheading(90) - >>> turtle.heading() - 90 - >>> turtle.setheading(128) - >>> turtle.heading() - 128 + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + >>> turtles() + [] """ - self._angle = angle - self._draw_turtle() + return self + + getpen = getturtle + + + ################################################################ + ### screen oriented methods recurring to methods of TurtleScreen + ################################################################ def window_width(self): """ Returns the width of the turtle window. - Example: - >>> turtle.window_width() + No argument. + + Example (for a TurtleScreen instance named screen): + >>> screen.window_width() 640 """ - width = self._canvas.winfo_width() - if width <= 1: # the window isn't managed by a geometry manager - width = self._canvas['width'] - return width + return self.screen._window_size()[0] def window_height(self): """ Return the height of the turtle window. - Example: - >>> turtle.window_height() - 768 - """ - height = self._canvas.winfo_height() - if height <= 1: # the window isn't managed by a geometry manager - height = self._canvas['height'] - return height + No argument. - def position(self): - """ Return the current (x, y) location of the turtle. + Example (for a TurtleScreen instance named screen): + >>> screen.window_height() + 480 + """ + return self.screen._window_size()[1] - Example: - >>> turtle.position() - [0.0, 240.0] + def _delay(self, delay=None): + """Set delay value which determines speed of turtle animation. """ - x0, y0 = self._origin - x1, y1 = self._position - return [x1-x0, -y1+y0] + return self.screen.delay(delay) - def setx(self, xpos): - """ Set the turtle's x coordinate to be xpos. + ##### event binding methods ##### - Example: - >>> turtle.position() - [10.0, 240.0] - >>> turtle.setx(10) - >>> turtle.position() - [10.0, 240.0] - """ - x0, y0 = self._origin - x1, y1 = self._position - self._goto(x0+xpos, y1) + def onclick(self, fun, btn=1, add=None): + """Bind fun to mouse-click event on this turtle on canvas. - def sety(self, ypos): - """ Set the turtle's y coordinate to be ypos. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). + add -- True or False. If True, new binding will be added, otherwise + it will replace a former binding. - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.sety(-22) - >>> turtle.position() - [0.0, -22.0] + Example for the anonymous turtle, i. e. the procedural way: + + >>> def turn(x, y): + left(360) + + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed """ - x0, y0 = self._origin - x1, y1 = self._position - self._goto(x1, y0-ypos) + self.screen._onclick(self.turtle._item, fun, btn, add) + self._update() - def towards(self, *args): - """Returs the angle, which corresponds to the line - from turtle-position to point (x,y). + def onrelease(self, fun, btn=1, add=None): + """Bind fun to mouse-button-release event on this turtle on canvas. - Argument can be two coordinates or one pair of coordinates - or a RawPen/Pen instance. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). - Example: - >>> turtle.position() - [10.0, 10.0] - >>> turtle.towards(0,0) - 225.0 + Example (for a MyTurtle instance named joe): + >>> class MyTurtle(Turtle): + def glow(self,x,y): + self.fillcolor("red") + def unglow(self,x,y): + self.fillcolor("") + + >>> joe = MyTurtle() + >>> joe.onclick(joe.glow) + >>> joe.onrelease(joe.unglow) + ### clicking on joe turns fillcolor red, + ### unclicking turns it to transparent. """ - if len(args) == 2: - x, y = args - else: - arg = args[0] - if isinstance(arg, RawPen): - x, y = arg.position() - else: - x, y = arg - x0, y0 = self.position() - dx = x - x0 - dy = y - y0 - return (atan2(dy,dx) / self._invradian) % self._fullcircle + self.screen._onrelease(self.turtle._item, fun, btn, add) + self._update() - def goto(self, *args): - """ Go to the given point. + def ondrag(self, fun, btn=1, add=None): + """Bind fun to mouse-move event on this turtle on canvas. - If the pen is down, then a line will be drawn. The turtle's - orientation does not change. + Arguments: + fun -- a function with two arguments, to which will be assigned + the coordinates of the clicked point on the canvas. + num -- number of the mouse-button defaults to 1 (left mouse button). - Two input formats are accepted: + Every sequence of mouse-move-events on a turtle is preceded by a + mouse-click event on that turtle. - goto(x, y) - go to point (x, y) + Example (for a Turtle instance named turtle): + >>> turtle.ondrag(turtle.goto) - goto((x, y)) - go to point (x, y) + ### Subsequently clicking and dragging a Turtle will + ### move it across the screen thereby producing handdrawings + ### (if pen is down). + """ + self.screen._ondrag(self.turtle._item, fun, btn, add) - Example: - >>> turtle.position() - [0.0, 0.0] - >>> turtle.goto(50, -45) - >>> turtle.position() - [50.0, -45.0] + + def _undo(self, action, data): + """Does the main part of the work for undo() """ - if len(args) == 1: - try: - x, y = args[0] - except: - raise Error, "bad point argument: %r" % (args[0],) - else: - try: - x, y = args - except: - raise Error, "bad coordinates: %r" % (args[0],) - x0, y0 = self._origin - self._goto(x0+x, y0-y) - - def _goto(self, x1, y1): - x0, y0 = self._position - self._position = map(float, (x1, y1)) - if self._filling: - self._path.append(self._position) - if self._drawing: - if self._tracing: - dx = float(x1 - x0) - dy = float(y1 - y0) - distance = hypot(dx, dy) - nhops = int(distance) - item = self._canvas.create_line(x0, y0, x0, y0, - width=self._width, - capstyle="round", - fill=self._color) - try: - for i in range(1, 1+nhops): - x, y = x0 + dx*i/nhops, y0 + dy*i/nhops - self._canvas.coords(item, x0, y0, x, y) - self._draw_turtle((x,y)) - self._canvas.update() - self._canvas.after(self._delay) - # in case nhops==0 - self._canvas.coords(item, x0, y0, x1, y1) - self._canvas.itemconfigure(item, arrow="none") - except Tkinter.TclError: - # Probably the window was closed! - return - else: - item = self._canvas.create_line(x0, y0, x1, y1, - width=self._width, - capstyle="round", - fill=self._color) - self._items.append(item) - self._draw_turtle() - - def speed(self, speed): - """ Set the turtle's speed. - - speed must one of these five strings: - - 'fastest' is a 0 ms delay - 'fast' is a 5 ms delay - 'normal' is a 10 ms delay - 'slow' is a 15 ms delay - 'slowest' is a 20 ms delay + if self.undobuffer is None: + return + if action == "rot": + angle, degPAU = data + self._rotate(-angle*degPAU/self._degreesPerAU) + dummy = self.undobuffer.pop() + elif action == "stamp": + stitem = data[0] + self.clearstamp(stitem) + elif action == "go": + self._undogoto(data) + elif action in ["wri", "dot"]: + item = data[0] + self.screen._delete(item) + self.items.remove(item) + elif action == "dofill": + item = data[0] + self.screen._drawpoly(item, ((0, 0),(0, 0),(0, 0)), + fill="", outline="") + elif action == "beginfill": + item = data[0] + self._fillitem = self._fillpath = None + self.screen._delete(item) + self.items.remove(item) + elif action == "pen": + TPen.pen(self, data[0]) + self.undobuffer.pop() + + def undo(self): + """undo (repeatedly) the last turtle action. + + No argument. + + undo (repeatedly) the last turtle action. + Number of available undo actions is determined by the size of + the undobuffer. + + Example (for a Turtle instance named turtle): + >>> for i in range(4): + turtle.fd(50); turtle.lt(80) - Example: - >>> turtle.speed('slow') + >>> for i in range(8): + turtle.undo() """ - try: - speed = speed.strip().lower() - self._delay = speeds.index(speed) * 5 - except: - raise ValueError("%r is not a valid speed. speed must be " - "one of %s" % (speed, speeds)) + if self.undobuffer is None: + return + item = self.undobuffer.pop() + action = item[0] + data = item[1:] + if action == "seq": + while data: + item = data.pop() + self._undo(item[0], item[1:]) + else: + self._undo(action, data) + turtlesize = shapesize - def delay(self, delay): - """ Set the drawing delay in milliseconds. +RawPen = RawTurtle - This is intended to allow finer control of the drawing speed - than the speed() method +### Screen - Klasse ######################## - Example: - >>> turtle.delay(15) - """ - if int(delay) < 0: - raise ValueError("delay must be greater than or equal to 0") - self._delay = int(delay) - - def _draw_turtle(self, position=[]): - if not self._tracing: - self._canvas.update() - return - if position == []: - position = self._position - x,y = position - distance = 8 - dx = distance * cos(self._angle*self._invradian) - dy = distance * sin(self._angle*self._invradian) - self._delete_turtle() - self._arrow = self._canvas.create_line(x-dx,y+dy,x,y, - width=self._width, - arrow="last", - capstyle="round", - fill=self._color) - self._canvas.update() - - def _delete_turtle(self): - if self._arrow != 0: - self._canvas.delete(self._arrow) - self._arrow = 0 - - -_root = None -_canvas = None -_pen = None -_width = 0.50 # 50% of window width -_height = 0.75 # 75% of window height -_startx = None -_starty = None -_title = "Turtle Graphics" # default title +class Screen(TurtleScreen): + + _root = None + _canvas = None + _title = _CFG["title"] + + # Borg-Idiom -class Pen(RawPen): + _shared_state = {} + + def __new__(cls, *args, **kwargs): + obj = object.__new__(cls, *args, **kwargs) + obj.__dict__ = cls._shared_state + return obj def __init__(self): - global _root, _canvas - if _root is None: - _root = Tkinter.Tk() - _root.wm_protocol("WM_DELETE_WINDOW", self._destroy) - _root.title(_title) - - if _canvas is None: - # XXX Should have scroll bars - _canvas = Tkinter.Canvas(_root, background="white") - _canvas.pack(expand=1, fill="both") + if Screen._root is None: + Screen._root = self._root = _Root() + self._root.title(Screen._title) + self._root.ondestroy(self._destroy) + if Screen._canvas is None: + width = _CFG["width"] + height = _CFG["height"] + canvwidth = _CFG["canvwidth"] + canvheight = _CFG["canvheight"] + leftright = _CFG["leftright"] + topbottom = _CFG["topbottom"] + self._root.setupcanvas(width, height, canvwidth, canvheight) + Screen._canvas = self._root._getcanvas() + self.setup(width, height, leftright, topbottom) + TurtleScreen.__init__(self, Screen._canvas) + Turtle._screen = self + + def setup(self, width=_CFG["width"], height=_CFG["height"], + startx=_CFG["leftright"], starty=_CFG["topbottom"]): + """ Set the size and position of the main window. + + Arguments: + width: as integer a size in pixels, as float a fraction of the screen. + Default is 50% of screen. + height: as integer the height in pixels, as float a fraction of the + screen. Default is 75% of screen. + startx: if positive, starting position in pixels from the left + edge of the screen, if negative from the right edge + Default, startx=None is to center window horizontally. + starty: if positive, starting position in pixels from the top + edge of the screen, if negative from the bottom edge + Default, starty=None is to center window vertically. + + Examples (for a Screen instance named screen): + >>> screen.setup (width=200, height=200, startx=0, starty=0) + + sets window to 200x200 pixels, in upper left of screen - setup(width=_width, height= _height, startx=_startx, starty=_starty) + >>> screen.setup(width=.75, height=0.5, startx=None, starty=None) - RawPen.__init__(self, _canvas) + sets window to 75% of screen by 50% of screen and centers + """ + if not hasattr(self._root, "set_geometry"): + return + sw = self._root.win_width() + sh = self._root.win_height() + if isinstance(width, float) and 0 <= width <= 1: + width = sw*width + if startx is None: + startx = (sw - width) / 2 + if isinstance(height, float) and 0 <= height <= 1: + height = sh*height + if starty is None: + starty = (sh - height) / 2 + self._root.set_geometry(width, height, startx, starty) + + def title(self, titlestring): + """Set title of turtle-window + + Argument: + titlestring -- a string, to appear in the titlebar of the + turtle graphics window. + + This is a method of Screen-class. Not available for TurtleScreen- + objects. + + Example (for a Screen instance named screen): + >>> screen.title("Welcome to the turtle-zoo!") + """ + if Screen._root is not None: + Screen._root.title(titlestring) + Screen._title = titlestring def _destroy(self): - global _root, _canvas, _pen - root = self._canvas._root() - if root is _root: - _pen = None - _root = None - _canvas = None + root = self._root + if root is Screen._root: + Turtle._pen = None + Turtle._screen = None + Screen._root = None + Screen._canvas = None + TurtleScreen._RUNNING = True root.destroy() -def _getpen(): - global _pen - if not _pen: - _pen = Pen() - return _pen + def bye(self): + """Shut the turtlegraphics window. -class Turtle(Pen): - pass + Example (for a TurtleScreen instance named screen): + >>> screen.bye() + """ + self._destroy() -"""For documentation of the following functions see - the RawPen methods with the same names -""" + def exitonclick(self): + """Go into mainloop until the mouse is clicked. -def degrees(): _getpen().degrees() -def radians(): _getpen().radians() -def reset(): _getpen().reset() -def clear(): _getpen().clear() -def tracer(flag): _getpen().tracer(flag) -def forward(distance): _getpen().forward(distance) -def backward(distance): _getpen().backward(distance) -def left(angle): _getpen().left(angle) -def right(angle): _getpen().right(angle) -def up(): _getpen().up() -def down(): _getpen().down() -def width(width): _getpen().width(width) -def color(*args): _getpen().color(*args) -def write(arg, move=0): _getpen().write(arg, move) -def fill(flag): _getpen().fill(flag) -def begin_fill(): _getpen().begin_fill() -def end_fill(): _getpen().end_fill() -def circle(radius, extent=None): _getpen().circle(radius, extent) -def goto(*args): _getpen().goto(*args) -def heading(): return _getpen().heading() -def setheading(angle): _getpen().setheading(angle) -def position(): return _getpen().position() -def window_width(): return _getpen().window_width() -def window_height(): return _getpen().window_height() -def setx(xpos): _getpen().setx(xpos) -def sety(ypos): _getpen().sety(ypos) -def towards(*args): return _getpen().towards(*args) - -def done(): _root.mainloop() -def delay(delay): return _getpen().delay(delay) -def speed(speed): return _getpen().speed(speed) - -for methodname in dir(RawPen): - """ copies RawPen docstrings to module functions of same name """ - if not methodname.startswith("_"): - eval(methodname).__doc__ = RawPen.__dict__[methodname].__doc__ - - -def setup(**geometry): - """ Sets the size and position of the main window. - - Keywords are width, height, startx and starty: - - width: either a size in pixels or a fraction of the screen. - Default is 50% of screen. - height: either the height in pixels or a fraction of the screen. - Default is 75% of screen. - - Setting either width or height to None before drawing will force - use of default geometry as in older versions of turtle.py - - startx: starting position in pixels from the left edge of the screen. - Default is to center window. Setting startx to None is the default - and centers window horizontally on screen. - - starty: starting position in pixels from the top edge of the screen. - Default is to center window. Setting starty to None is the default - and centers window vertically on screen. - - Examples: - >>> setup (width=200, height=200, startx=0, starty=0) - - sets window to 200x200 pixels, in upper left of screen - - >>> setup(width=.75, height=0.5, startx=None, starty=None) - - sets window to 75% of screen by 50% of screen and centers - - >>> setup(width=None) - - forces use of default geometry as in older versions of turtle.py - """ - - global _width, _height, _startx, _starty - - width = geometry.get('width',_width) - if width >= 0 or width is None: - _width = width - else: - raise ValueError, "width can not be less than 0" + No arguments. - height = geometry.get('height',_height) - if height >= 0 or height is None: - _height = height - else: - raise ValueError, "height can not be less than 0" + Bind bye() method to mouseclick on TurtleScreen. + If "using_IDLE" - value in configuration dictionary is False + (default value), enter mainloop. + If IDLE with -n switch (no subprocess) is used, this value should be + set to True in turtle.cfg. In this case IDLE's mainloop + is active also for the client script. - startx = geometry.get('startx', _startx) - if startx >= 0 or startx is None: - _startx = _startx - else: - raise ValueError, "startx can not be less than 0" + This is a method of the Screen-class and not available for + TurtleScreen instances. - starty = geometry.get('starty', _starty) - if starty >= 0 or starty is None: - _starty = starty - else: - raise ValueError, "startx can not be less than 0" + Example (for a Screen instance named screen): + >>> screen.exitonclick() + """ + def exitGracefully(x, y): + """Screen.bye() with two dummy-parameters""" + self.bye() + self.onclick(exitGracefully) + if _CFG["using_IDLE"]: + return + try: + mainloop() + except AttributeError: + exit(0) - if _root and _width and _height: - if 0 < _width <= 1: - _width = _root.winfo_screenwidth() * +width - if 0 < _height <= 1: - _height = _root.winfo_screenheight() * _height - # center window on screen - if _startx is None: - _startx = (_root.winfo_screenwidth() - _width) / 2 +class Turtle(RawTurtle): + """RawTurtle auto-crating (scrolled) canvas. - if _starty is None: - _starty = (_root.winfo_screenheight() - _height) / 2 + When a Turtle object is created or a function derived from some + Turtle method is called a TurtleScreen object is automatically created. + """ + _pen = None + _screen = None - _root.geometry("%dx%d+%d+%d" % (_width, _height, _startx, _starty)) + def __init__(self, + shape=_CFG["shape"], + undobuffersize=_CFG["undobuffersize"], + visible=_CFG["visible"]): + if Turtle._screen is None: + Turtle._screen = Screen() + RawTurtle.__init__(self, Turtle._screen, + shape=shape, + undobuffersize=undobuffersize, + visible=visible) -def title(title): - """Set the window title. +Pen = Turtle - By default this is set to 'Turtle Graphics' +def _getpen(): + """Create the 'anonymous' turtle if not already present.""" + if Turtle._pen is None: + Turtle._pen = Turtle() + return Turtle._pen + +def _getscreen(): + """Create a TurtleScreen if not already present.""" + if Turtle._screen is None: + Turtle._screen = Screen() + return Turtle._screen + +def write_docstringdict(filename="turtle_docstringdict"): + """Create and write docstring-dictionary to file. + + Optional argument: + filename -- a string, used as filename + default value is turtle_docstringdict + + Has to be called explicitely, (not used by the turtle-graphics classes) + The docstring dictionary will be written to the Python script .py + It is intended to serve as a template for translation of the docstrings + into different languages. + """ + docsdict = {} - Example: - >>> title("My Window") + for methodname in _tg_screen_functions: + key = "Screen."+methodname + docsdict[key] = eval(key).__doc__ + for methodname in _tg_turtle_functions: + key = "Turtle."+methodname + docsdict[key] = eval(key).__doc__ + + f = open("%s.py" % filename,"w") + keys = sorted([x for x in docsdict.keys() + if x.split('.')[1] not in _alias_list]) + f.write('docsdict = {\n\n') + for key in keys[:-1]: + f.write('%s :\n' % repr(key)) + f.write(' """%s\n""",\n\n' % docsdict[key]) + key = keys[-1] + f.write('%s :\n' % repr(key)) + f.write(' """%s\n"""\n\n' % docsdict[key]) + f.write("}\n") + f.close() + +def read_docstrings(lang): + """Read in docstrings from lang-specific docstring dictionary. + + Transfer docstrings, translated to lang, from a dictionary-file + to the methods of classes Screen and Turtle and - in revised form - + to the corresponding functions. """ + modname = "turtle_docstringdict_%(language)s" % {'language':lang.lower()} + module = __import__(modname) + docsdict = module.docsdict + for key in docsdict: + #print key + try: + eval(key).im_func.__doc__ = docsdict[key] + except: + print "Bad docstring-entry: %s" % key - global _title - _title = title +_LANGUAGE = _CFG["language"] -def demo(): - reset() - tracer(1) - up() - backward(100) - down() - # draw 3 squares; the last filled - width(3) - for i in range(3): - if i == 2: - fill(1) - for j in range(4): - forward(20) - left(90) - if i == 2: - color("maroon") - fill(0) +try: + if _LANGUAGE != "english": + read_docstrings(_LANGUAGE) +except ImportError: + print "Cannot find docsdict for", _LANGUAGE +except: + print ("Unknown Error when trying to import %s-docstring-dictionary" % + _LANGUAGE) + + +def getmethparlist(ob): + "Get strings describing the arguments for the given object" + argText1 = argText2 = "" + # bit of a hack for methods - turn it into a function + # but we drop the "self" param. + if type(ob)==types.MethodType: + fob = ob.im_func + argOffset = 1 + else: + fob = ob + argOffset = 0 + # Try and build one for Python defined functions + if type(fob) in [types.FunctionType, types.LambdaType]: + try: + counter = fob.func_code.co_argcount + items2 = list(fob.func_code.co_varnames[argOffset:counter]) + realArgs = fob.func_code.co_varnames[argOffset:counter] + defaults = fob.func_defaults or [] + defaults = list(map(lambda name: "=%s" % repr(name), defaults)) + defaults = [""] * (len(realArgs)-len(defaults)) + defaults + items1 = map(lambda arg, dflt: arg+dflt, realArgs, defaults) + if fob.func_code.co_flags & 0x4: + items1.append("*"+fob.func_code.co_varnames[counter]) + items2.append("*"+fob.func_code.co_varnames[counter]) + counter += 1 + if fob.func_code.co_flags & 0x8: + items1.append("**"+fob.func_code.co_varnames[counter]) + items2.append("**"+fob.func_code.co_varnames[counter]) + argText1 = ", ".join(items1) + argText1 = "(%s)" % argText1 + argText2 = ", ".join(items2) + argText2 = "(%s)" % argText2 + except: + pass + return argText1, argText2 + +def _turtle_docrevise(docstr): + """To reduce docstrings from RawTurtle class for functions + """ + import re + if docstr is None: + return None + turtlename = _CFG["exampleturtle"] + newdocstr = docstr.replace("%s." % turtlename,"") + parexp = re.compile(r' \(.+ %s\):' % turtlename) + newdocstr = parexp.sub(":", newdocstr) + return newdocstr + +def _screen_docrevise(docstr): + """To reduce docstrings from TurtleScreen class for functions + """ + import re + if docstr is None: + return None + screenname = _CFG["examplescreen"] + newdocstr = docstr.replace("%s." % screenname,"") + parexp = re.compile(r' \(.+ %s\):' % screenname) + newdocstr = parexp.sub(":", newdocstr) + return newdocstr + +## The following mechanism makes all methods of RawTurtle and Turtle available +## as functions. So we can enhance, change, add, delete methods to these +## classes and do not need to change anything here. + + +for methodname in _tg_screen_functions: + pl1, pl2 = getmethparlist(eval('Screen.' + methodname)) + if pl1 == "": + print ">>>>>>", pl1, pl2 + continue + defstr = ("def %(key)s%(pl1)s: return _getscreen().%(key)s%(pl2)s" % + {'key':methodname, 'pl1':pl1, 'pl2':pl2}) + exec defstr + eval(methodname).__doc__ = _screen_docrevise(eval('Screen.'+methodname).__doc__) + +for methodname in _tg_turtle_functions: + pl1, pl2 = getmethparlist(eval('Turtle.' + methodname)) + if pl1 == "": + print ">>>>>>", pl1, pl2 + continue + defstr = ("def %(key)s%(pl1)s: return _getpen().%(key)s%(pl2)s" % + {'key':methodname, 'pl1':pl1, 'pl2':pl2}) + exec defstr + eval(methodname).__doc__ = _turtle_docrevise(eval('Turtle.'+methodname).__doc__) + + +done = mainloop = TK.mainloop +del pl1, pl2, defstr + +if __name__ == "__main__": + def switchpen(): + if isdown(): + pu() + else: + pd() + + def demo1(): + """Demo of old turtle.py - module""" + reset() + tracer(True) up() - forward(30) + backward(100) down() - width(1) - color("black") - # move out of the way - tracer(0) - up() - right(90) - forward(100) - right(90) - forward(100) - right(180) - down() - # some text - write("startstart", 1) - write("start", 1) - color("red") - # staircase - for i in range(5): - forward(20) - left(90) - forward(20) - right(90) - # filled staircase - fill(1) - for i in range(5): - forward(20) - left(90) - forward(20) - right(90) - fill(0) - tracer(1) - # more text - write("end") - -def demo2(): - # exercises some new and improved features - speed('fast') - width(3) - - # draw a segmented half-circle - setheading(towards(0,0)) - x,y = position() - r = (x**2+y**2)**.5/2.0 - right(90) - pendown = True - for i in range(18): - if pendown: + # draw 3 squares; the last filled + width(3) + for i in range(3): + if i == 2: + fill(1) + for _ in range(4): + forward(20) + left(90) + if i == 2: + color("maroon") + fill(0) up() - pendown = False - else: + forward(30) down() - pendown = True - circle(r,10) - sleep(2) - - reset() - left(90) - - # draw a series of triangles - l = 10 - color("green") - width(3) - left(180) - sp = 5 - for i in range(-2,16): - if i > 0: - color(1.0-0.05*i,0,0.05*i) - fill(1) - color("green") - for j in range(3): - forward(l) - left(120) - l += 10 - left(15) - if sp > 0: - sp = sp-1 - speed(speeds[sp]) - color(0.25,0,0.75) - fill(0) - - # draw and fill a concave shape - left(120) - up() - forward(70) - right(30) - down() - color("red") - speed("fastest") - fill(1) - for i in range(4): - circle(50,90) + width(1) + color("black") + # move out of the way + tracer(False) + up() right(90) - forward(30) + forward(100) right(90) - color("yellow") - fill(0) - left(90) - up() - forward(30) - down(); - - color("red") - - # create a second turtle and make the original pursue and catch it - turtle=Turtle() - turtle.reset() - turtle.left(90) - turtle.speed('normal') - turtle.up() - turtle.goto(280,40) - turtle.left(24) - turtle.down() - turtle.speed('fast') - turtle.color("blue") - turtle.width(2) - speed('fastest') - - # turn default turtle towards new turtle object - setheading(towards(turtle)) - while ( abs(position()[0]-turtle.position()[0])>4 or - abs(position()[1]-turtle.position()[1])>4): - turtle.forward(3.5) - turtle.left(0.6) - # turn default turtle towards new turtle object + forward(100) + right(180) + down() + # some text + write("startstart", 1) + write("start", 1) + color("red") + # staircase + for i in range(5): + forward(20) + left(90) + forward(20) + right(90) + # filled staircase + tracer(True) + fill(1) + for i in range(5): + forward(20) + left(90) + forward(20) + right(90) + fill(0) + # more text + + def demo2(): + """Demo of some new features.""" + speed(1) + st() + pensize(3) + setheading(towards(0, 0)) + radius = distance(0, 0)/2.0 + rt(90) + for _ in range(18): + switchpen() + circle(radius, 10) + write("wait a moment...") + while undobufferentries(): + undo() + reset() + lt(90) + colormode(255) + laenge = 10 + pencolor("green") + pensize(3) + lt(180) + for i in range(-2, 16): + if i > 0: + begin_fill() + fillcolor(255-15*i, 0, 15*i) + for _ in range(3): + fd(laenge) + lt(120) + laenge += 10 + lt(15) + speed((speed()+1)%12) + end_fill() + + lt(120) + pu() + fd(70) + rt(30) + pd() + color("red","yellow") + speed(0) + fill(1) + for _ in range(4): + circle(50, 90) + rt(90) + fd(30) + rt(90) + fill(0) + lt(90) + pu() + fd(30) + pd() + shape("turtle") + + tri = getturtle() + tri.resizemode("auto") + turtle = Turtle() + turtle.resizemode("auto") + turtle.shape("turtle") + turtle.reset() + turtle.left(90) + turtle.speed(0) + turtle.up() + turtle.goto(280, 40) + turtle.lt(30) + turtle.down() + turtle.speed(6) + turtle.color("blue","orange") + turtle.pensize(2) + tri.speed(6) setheading(towards(turtle)) - forward(4) - write("CAUGHT! ", move=True) - - + count = 1 + while tri.distance(turtle) > 4: + turtle.fd(3.5) + turtle.lt(0.6) + tri.setheading(tri.towards(turtle)) + tri.fd(4) + if count % 20 == 0: + turtle.stamp() + tri.stamp() + switchpen() + count += 1 + tri.write("CAUGHT! ", font=("Arial", 16, "bold"), align="right") + tri.pencolor("black") + tri.pencolor("red") + + def baba(xdummy, ydummy): + clearscreen() + bye() + + time.sleep(2) + + while undobufferentries(): + tri.undo() + turtle.undo() + tri.fd(50) + tri.write(" Click me!", font = ("Courier", 12, "bold") ) + tri.onclick(baba, 1) -if __name__ == '__main__': - demo() - sleep(3) + demo1() demo2() - done() + exitonclick() Modified: python/branches/tlee-ast-optimize/Lib/test/test_complex.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_complex.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_complex.py Thu Jun 5 17:42:10 2008 @@ -373,6 +373,14 @@ except (OSError, IOError): pass + def test_getnewargs(self): + self.assertEqual((1+2j).__getnewargs__(), (1.0, 2.0)) + self.assertEqual((1-2j).__getnewargs__(), (1.0, -2.0)) + self.assertEqual((2j).__getnewargs__(), (0.0, 2.0)) + self.assertEqual((-0j).__getnewargs__(), (0.0, -0.0)) + self.assertEqual(complex(0, INF).__getnewargs__(), (0.0, INF)) + self.assertEqual(complex(INF, 0).__getnewargs__(), (INF, 0.0)) + if float.__getformat__("double").startswith("IEEE"): def test_plus_minus_0j(self): # test that -0j and 0j literals are not identified Modified: python/branches/tlee-ast-optimize/Mac/IDLE/Makefile.in ============================================================================== --- python/branches/tlee-ast-optimize/Mac/IDLE/Makefile.in (original) +++ python/branches/tlee-ast-optimize/Mac/IDLE/Makefile.in Thu Jun 5 17:42:10 2008 @@ -42,7 +42,7 @@ $(srcdir)/../Icons/PythonSource.icns \ $(srcdir)/../Icons/PythonCompiled.icns Info.plist rm -fr IDLE.app - $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(BUNDLEBULDER) \ --builddir=. \ --name=IDLE \ --link-exec \ @@ -51,7 +51,7 @@ --iconfile=$(srcdir)/../Icons/IDLE.icns \ --resource=$(srcdir)/../Icons/PythonSource.icns \ --resource=$(srcdir)/../Icons/PythonCompiled.icns \ - --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \ build Modified: python/branches/tlee-ast-optimize/Mac/IDLE/idlemain.py ============================================================================== --- python/branches/tlee-ast-optimize/Mac/IDLE/idlemain.py (original) +++ python/branches/tlee-ast-optimize/Mac/IDLE/idlemain.py Thu Jun 5 17:42:10 2008 @@ -13,7 +13,10 @@ # Make sure sys.executable points to the python interpreter inside the # framework, instead of at the helper executable inside the application # bundle (the latter works, but doesn't allow access to the window server) -sys.executable = os.path.join(sys.prefix, 'bin', 'python') +if sys.executable.endswith('-32'): + sys.executable = os.path.join(sys.prefix, 'bin', 'python-32') +else: + sys.executable = os.path.join(sys.prefix, 'bin', 'python') # Look for the -psn argument that the launcher adds and remove it, it will # only confuse the IDLE startup code. Modified: python/branches/tlee-ast-optimize/Mac/Makefile.in ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Makefile.in (original) +++ python/branches/tlee-ast-optimize/Mac/Makefile.in Thu Jun 5 17:42:10 2008 @@ -49,12 +49,42 @@ installapps: install_Python install_BuildApplet install_PythonLauncher \ install_IDLE checkapplepython install_pythonw install_versionedtools +installapps4way: install_Python4way install_BuildApplet install_PythonLauncher install_IDLE install_pythonw4way install_versionedtools + + install_pythonw: pythonw $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python" ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw" + +# Install 3 variants of python/pythonw: +# - 32-bit (i386 and ppc) +# - 64-bit (x86_64 and ppc64) +# - all (all four architectures) +# - Make 'python' and 'pythonw' aliases for the 32-bit variant +install_pythonw4way: pythonw-32 pythonw-64 pythonw + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64" + ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64" + ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64" + + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32" + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32" + + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all" + ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all" + ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all" + + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)" + ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw" + ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python" + # # Install unix tools in /usr/local/bin. These are just aliases for the # actual installation inside the framework. @@ -65,11 +95,16 @@ fi for fn in python pythonw idle pydoc python-config smtpd.py \ python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ - pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ + pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\ do \ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ done + +# TODO: install symlinks for -32, -64 and -all as well +installunixtools4way: installunixtools + + # # Like installunixtools, but only install links to the versioned binaries. # @@ -78,18 +113,20 @@ $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ fi for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ - pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\ + pydoc$(VERSION) python$(VERSION)-config) smtpd$(VERSION).py ;\ do \ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ done +# TODO: -32, -64 and -all variants +altinstallunixtools4way: altinstallunixtools # By default most tools are installed without a version in their basename, to # make it easier to install (and use) several python versions side-by-side move # the tools to a version-specific name and add the non-versioned name as an # alias. install_versionedtools: - for fn in idle pydoc python-config ;\ + for fn in idle pydoc ;\ do \ if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \ continue ;\ @@ -97,6 +134,10 @@ mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\ ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\ done + if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \ + mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\ + ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \ + fi if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \ mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\ ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\ @@ -107,6 +148,13 @@ $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \ -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"' +pythonw-32: $(srcdir)/Tools/pythonw.c Makefile + $(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"' + +pythonw-64: $(srcdir)/Tools/pythonw.c Makefile + $(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"' install_PythonLauncher: cd PythonLauncher && make install DESTDIR=$(DESTDIR) @@ -159,13 +207,19 @@ done $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" +install_Python4way: install_Python + lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" + lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" + + + install_IDLE: cd IDLE && make install install_BuildApplet: - $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \ + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \ --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONAPP) \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \ --output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \ $(srcdir)/scripts/BuildApplet.py @@ -225,7 +279,7 @@ done - $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) Modified: python/branches/tlee-ast-optimize/Mac/Modules/ColorPickermodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ColorPickermodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ColorPickermodule.c Thu Jun 5 17:42:10 2008 @@ -27,6 +27,9 @@ /* ----------------------------------------------------- */ + +#ifndef __LP64__ + static char cp_GetColor__doc__[] = "GetColor(prompt, (r, g, b)) -> (r, g, b), ok" ; @@ -46,11 +49,14 @@ return Py_BuildValue("O&h", QdRGB_New, &outColor, ok); } +#endif /* __LP64__ */ /* List of methods defined in the module */ static struct PyMethodDef cp_methods[] = { +#ifndef __LP64__ {"GetColor", (PyCFunction)cp_GetColor, METH_VARARGS, cp_GetColor__doc__}, +#endif /* __LP64__ */ {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ }; Modified: python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c Thu Jun 5 17:42:10 2008 @@ -30,6 +30,7 @@ #include #include + static PyObject *MacOS_Error; /* Exception MacOS.Error */ #define PATHNAMELEN 1024 @@ -40,7 +41,7 @@ typedef struct { PyObject_HEAD - short fRefNum; + FSIORefNum fRefNum; int isclosed; } rfobject; @@ -54,7 +55,7 @@ do_close(rfobject *self) { if (self->isclosed ) return; - (void)FSClose(self->fRefNum); + (void)FSCloseFork(self->fRefNum); self->isclosed = 1; } @@ -68,6 +69,7 @@ long n; PyObject *v; OSErr err; + ByteCount n2; if (self->isclosed) { PyErr_SetString(PyExc_ValueError, "Operation on closed file"); @@ -81,13 +83,13 @@ if (v == NULL) return NULL; - err = FSRead(self->fRefNum, &n, PyBytes_AsString(v)); + err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2); if (err && err != eofErr) { PyMac_Error(err); Py_DECREF(v); return NULL; } - _PyBytes_Resize(&v, n); + _PyString_Resize(&v, n2); return v; } @@ -109,7 +111,7 @@ } if (!PyArg_ParseTuple(args, "s#", &buffer, &size)) return NULL; - err = FSWrite(self->fRefNum, &size, buffer); + err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL); if (err) { PyMac_Error(err); return NULL; @@ -126,47 +128,36 @@ static PyObject * rf_seek(rfobject *self, PyObject *args) { - long amount, pos; + long amount; int whence = SEEK_SET; - long eof; + int mode; OSErr err; if (self->isclosed) { PyErr_SetString(PyExc_ValueError, "Operation on closed file"); return NULL; } - if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) + if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) { return NULL; - - if ((err = GetEOF(self->fRefNum, &eof))) - goto ioerr; + } switch (whence) { case SEEK_CUR: - if ((err = GetFPos(self->fRefNum, &pos))) - goto ioerr; + mode = fsFromMark; break; case SEEK_END: - pos = eof; + mode = fsFromLEOF; break; case SEEK_SET: - pos = 0; + mode = fsFromStart; break; default: PyErr_BadArgument(); return NULL; } - - pos += amount; - - /* Don't bother implementing seek past EOF */ - if (pos > eof || pos < 0) { - PyErr_BadArgument(); - return NULL; - } - - if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) { -ioerr: + + err = FSSetForkPosition(self->fRefNum, mode, amount); + if (err != noErr) { PyMac_Error(err); return NULL; } @@ -182,7 +173,7 @@ static PyObject * rf_tell(rfobject *self, PyObject *args) { - long where; + long long where; OSErr err; if (self->isclosed) { @@ -191,11 +182,13 @@ } if (!PyArg_ParseTuple(args, "")) return NULL; - if ((err = GetFPos(self->fRefNum, &where)) ) { + + err = FSGetForkPosition(self->fRefNum, &where); + if (err != noErr) { PyMac_Error(err); return NULL; } - return PyInt_FromLong(where); + return PyLong_FromLongLong(where); } static char rf_close__doc__[] = @@ -281,6 +274,7 @@ Rftype__doc__ /* Documentation string */ }; + /* End of code for Resource fork objects */ /* -------------------------------------------------------- */ @@ -292,17 +286,61 @@ static PyObject * MacOS_GetCreatorAndType(PyObject *self, PyObject *args) { - FSSpec fss; - FInfo info; PyObject *creator, *type, *res; OSErr err; - - if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss)) + FSRef ref; + FSCatalogInfo cataloginfo; + FileInfo* finfo; + + if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) { +#ifndef __LP64__ + /* This function is documented to take an FSSpec as well, + * which only works in 32-bit mode. + */ + PyErr_Clear(); + FSSpec fss; + FInfo info; + + if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss)) + return NULL; + + if ((err = FSpGetFInfo(&fss, &info)) != noErr) { + return PyErr_Mac(MacOS_Error, err); + } + creator = PyString_FromStringAndSize( + (char *)&info.fdCreator, 4); + type = PyString_FromStringAndSize((char *)&info.fdType, 4); + res = Py_BuildValue("OO", creator, type); + Py_DECREF(creator); + Py_DECREF(type); + return res; +#else /* __LP64__ */ + return NULL; +#endif /* __LP64__ */ + } + + err = FSGetCatalogInfo(&ref, + kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, + NULL, NULL, NULL); + if (err != noErr) { + PyErr_Mac(MacOS_Error, err); return NULL; - if ((err = FSpGetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); - creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4); - type = PyBytes_FromStringAndSize((char *)&info.fdType, 4); + } + + if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) { + /* Directory: doesn't have type/creator info. + * + * The specific error code is for backward compatibility with + * earlier versions. + */ + PyErr_Mac(MacOS_Error, fnfErr); + return NULL; + + } + finfo = (FileInfo*)&(cataloginfo.finderInfo); + creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4); + type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4); + res = Py_BuildValue("OO", creator, type); Py_DECREF(creator); Py_DECREF(type); @@ -314,20 +352,66 @@ static PyObject * MacOS_SetCreatorAndType(PyObject *self, PyObject *args) { - FSSpec fss; ResType creator, type; - FInfo info; + FSRef ref; + FileInfo* finfo; OSErr err; - + FSCatalogInfo cataloginfo; + if (!PyArg_ParseTuple(args, "O&O&O&", + PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) { +#ifndef __LP64__ + /* Try to handle FSSpec arguments, for backward compatibility */ + FSSpec fss; + FInfo info; + + if (!PyArg_ParseTuple(args, "O&O&O&", PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) + return NULL; + + if ((err = FSpGetFInfo(&fss, &info)) != noErr) + return PyErr_Mac(MacOS_Error, err); + + info.fdCreator = creator; + info.fdType = type; + + if ((err = FSpSetFInfo(&fss, &info)) != noErr) + return PyErr_Mac(MacOS_Error, err); + Py_INCREF(Py_None); + return Py_None; +#else /* __LP64__ */ + return NULL; +#endif /* __LP64__ */ + } + + err = FSGetCatalogInfo(&ref, + kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo, + NULL, NULL, NULL); + if (err != noErr) { + PyErr_Mac(MacOS_Error, err); + return NULL; + } + + if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) { + /* Directory: doesn't have type/creator info. + * + * The specific error code is for backward compatibility with + * earlier versions. + */ + PyErr_Mac(MacOS_Error, fnfErr); + return NULL; + + } + finfo = (FileInfo*)&(cataloginfo.finderInfo); + finfo->fileCreator = creator; + finfo->fileType = type; + + err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo); + if (err != noErr) { + PyErr_Mac(MacOS_Error, fnfErr); return NULL; - if ((err = FSpGetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); - info.fdCreator = creator; - info.fdType = type; - if ((err = FSpSetFInfo(&fss, &info)) != noErr) - return PyErr_Mac(MacOS_Error, err); + } + Py_INCREF(Py_None); return Py_None; } @@ -399,6 +483,9 @@ return Py_BuildValue("s", buf); } + +#ifndef __LP64__ + static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)"; static PyObject * @@ -417,7 +504,7 @@ return NULL; olddialog = curdialog; curdialog = NULL; - + if ( resid != -1 ) { curdialog = GetNewDialog(resid, NULL, (WindowPtr)-1); if ( curdialog ) { @@ -452,11 +539,13 @@ if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object)) return NULL; + DebugStr(message); Py_INCREF(Py_None); return Py_None; } + static char SysBeep_doc[] = "BEEEEEP!!!"; static PyObject * @@ -471,6 +560,8 @@ return Py_None; } +#endif /* __LP64__ */ + static char WMAvailable_doc[] = "True if this process can interact with the display." "Will foreground the application on the first call as a side-effect." @@ -530,51 +621,37 @@ { OSErr err; char *mode = "r"; - FSSpec fss; - SignedByte permission = 1; + FSRef ref; + SInt8 permission = fsRdPerm; rfobject *fp; + HFSUniStr255 name; - if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode)) + if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode)) return NULL; while (*mode) { switch (*mode++) { case '*': break; - case 'r': permission = 1; break; - case 'w': permission = 2; break; + case 'r': permission = fsRdPerm; break; + case 'w': permission = fsWrPerm; break; case 'b': break; default: PyErr_BadArgument(); return NULL; } } + + err = FSGetResourceForkName(&name); + if (err != noErr) { + PyMac_Error(err); + return NULL; + } if ( (fp = newrfobject()) == NULL ) return NULL; - - err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum); + - if ( err == fnfErr ) { - /* In stead of doing complicated things here to get creator/type - ** correct we let the standard i/o library handle it - */ - FILE *tfp; - char pathname[PATHNAMELEN]; - - if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) { - PyMac_Error(err); - Py_DECREF(fp); - return NULL; - } - - if ( (tfp = fopen(pathname, "w")) == NULL ) { - PyMac_Error(fnfErr); /* What else... */ - Py_DECREF(fp); - return NULL; - } - fclose(tfp); - err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum); - } - if ( err ) { + err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum); + if (err != noErr) { Py_DECREF(fp); PyMac_Error(err); return NULL; @@ -584,15 +661,18 @@ } + static PyMethodDef MacOS_Methods[] = { {"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc}, {"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc}, {"GetErrorString", MacOS_GetErrorString, 1, geterr_doc}, {"openrf", MacOS_openrf, 1, openrf_doc}, +#ifndef __LP64__ {"splash", MacOS_splash, 1, splash_doc}, {"DebugStr", MacOS_DebugStr, 1, DebugStr_doc}, - {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc}, {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc}, +#endif /* __LP64__ */ + {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc}, {"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc}, {NULL, NULL} /* Sentinel */ }; Modified: python/branches/tlee-ast-optimize/Mac/Modules/Nav.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/Nav.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/Nav.c Thu Jun 5 17:42:10 2008 @@ -184,18 +184,22 @@ } else if( strcmp(keystr, "preferenceKey") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) ) return 0; +#ifndef __LP64__ } else if( strcmp(keystr, "popupExtension") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) ) return 0; +#endif /* !__LP64__ */ } else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) { *eventProcP = my_eventProcUPP; } else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) { *previewProcP = my_previewProcUPP; } else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) { *filterProcP = my_filterProcUPP; +#ifndef __LP64__ } else if( typeListP && strcmp(keystr, "typeList") == 0 ) { if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) ) return 0; +#endif /* !__LP64__ */ } else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) { if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) ) return 0; @@ -301,13 +305,26 @@ static PyObject * navrr_getattr(navrrobject *self, char *name) { - FSSpec fss; FSRef fsr; +#ifndef __LP64__ + FSSpec fss; +#endif /* !__LP64__ */ if( strcmp(name, "__members__") == 0 ) - return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing", - "isStationery", "translationNeeded", "selection", "selection_fsr", + return Py_BuildValue( +#ifndef __LP64__ + "ssssssssss", +#else /* __LP64__ */ + "ssssssssss", +#endif /* __LP64__ */ + "version", "validRecord", "replacing", + "isStationery", "translationNeeded", +#ifndef __LP64__ + "selection", +#endif /* !__LP64__ */ + "selection_fsr", "fileTranslation", "keyScript", "saveFileName"); + if( strcmp(name, "version") == 0 ) return Py_BuildValue("h", self->itself.version); if( strcmp(name, "validRecord") == 0 ) @@ -318,8 +335,10 @@ return Py_BuildValue("l", (long)self->itself.isStationery); if( strcmp(name, "translationNeeded") == 0 ) return Py_BuildValue("l", (long)self->itself.translationNeeded); +#ifndef __LP64__ if( strcmp(name, "selection") == 0 ) { - SInt32 i, count; + SInt32 i; + long count; OSErr err; PyObject *rv, *rvitem; AEDesc desc; @@ -348,8 +367,10 @@ } return rv; } +#endif /* !__LP64__ */ if( strcmp(name, "selection_fsr") == 0 ) { - SInt32 i, count; + SInt32 i; + long count; OSErr err; PyObject *rv, *rvitem; AEDesc desc; @@ -378,8 +399,10 @@ } return rv; } +#ifndef __LP64__ if( strcmp(name, "fileTranslation") == 0 ) return ResObj_New((Handle)self->itself.fileTranslation); +#endif if( strcmp(name, "keyScript") == 0 ) return Py_BuildValue("h", (short)self->itself.keyScript); if( strcmp(name, "saveFileName") == 0 ) @@ -861,7 +884,12 @@ PyErr_Mac(ErrorObject, err); return NULL; } - return Py_BuildValue("{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", + return Py_BuildValue( +#ifndef __LP64__ + "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", +#else /* __LP64__ */ + "{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}", +#endif /* __LP64__ */ "version", dialogOptions.version, "dialogOptionFlags", dialogOptions.dialogOptionFlags, "location", PyMac_BuildPoint, dialogOptions.location, @@ -871,8 +899,11 @@ "cancelButtonLabel", PyMac_BuildStr255, &dialogOptions.cancelButtonLabel, "savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName, "message", PyMac_BuildStr255, &dialogOptions.message, - "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey, - "popupExtension", OptResObj_New, dialogOptions.popupExtension); + "preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey +#ifndef __LP64__ + ,"popupExtension", OptResObj_New, dialogOptions.popupExtension +#endif /* __LP64__ */ + ); } /* List of methods defined in the module */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/OSATerminology.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/OSATerminology.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/OSATerminology.c Thu Jun 5 17:42:10 2008 @@ -11,6 +11,7 @@ #include +#ifndef __LP64__ static PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { @@ -68,12 +69,14 @@ if (err) return PyMac_Error(err); return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch); } +#endif /* !__LP64__ */ /* * List of methods defined in the module */ static struct PyMethodDef OSATerminology_methods[] = { +#ifndef __LP64__ {"GetAppTerminology", (PyCFunction) PyOSA_GetAppTerminology, METH_VARARGS, @@ -82,14 +85,14 @@ (PyCFunction) PyOSA_GetSysTerminology, METH_VARARGS, "Get an applications system terminology, as an AEDesc object."}, +#endif /* !__LP64__ */ {NULL, (PyCFunction) NULL, 0, NULL} }; - void initOSATerminology(void) { if (PyErr_WarnPy3k("In 3.x, OSATerminology is removed.", 1) < 0) return; Py_InitModule("OSATerminology", OSATerminology_methods); -} \ No newline at end of file +} Modified: python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c Thu Jun 5 17:42:10 2008 @@ -683,7 +683,8 @@ return NULL; _err = AEResumeTheCurrentEvent(&_self->ob_itself, &reply, - dispatcher__proc__, (long)dispatcher); + dispatcher__proc__, + (SRefCon)dispatcher); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; @@ -1154,7 +1155,7 @@ return NULL; _err = AEInstallEventHandler(theAEEventClass, theAEEventID, - handler__proc__, (long)handler, + handler__proc__, (SRefCon)handler, 0); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); @@ -1203,7 +1204,7 @@ return NULL; _err = AEGetEventHandler(theAEEventClass, theAEEventID, - &handler__proc__, (long *)&handler, + &handler__proc__, (SRefCon *)&handler, 0); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O", Modified: python/branches/tlee-ast-optimize/Mac/Modules/app/_Appmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/app/_Appmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/app/_Appmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,8 @@ #include "Python.h" +#ifndef __LP64__ + /* Carbon GUI stuff, not available in 64-bit mode */ #include "pymactoolbox.h" @@ -18,7 +20,7 @@ #include -int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself) +static int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself) { return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment); } @@ -1792,17 +1794,25 @@ }; +#else /* __LP64__ */ + +static PyMethodDef App_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_App(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; - - +#endif /* !__LP64__ */ m = Py_InitModule("_App", App_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); App_Error = PyMac_GetOSErrException(); if (App_Error == NULL || @@ -1815,6 +1825,7 @@ /* Backward-compatible name */ Py_INCREF(&ThemeDrawingState_Type); PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type); +#endif /* __LP64__ */ } /* ======================== End module _App ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/carbonevt/_CarbonEvtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/carbonevt/_CarbonEvtmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/carbonevt/_CarbonEvtmodule.c Thu Jun 5 17:42:10 2008 @@ -3,7 +3,7 @@ #include "Python.h" - +#ifndef __LP64__ #include "pymactoolbox.h" @@ -2141,20 +2141,28 @@ {NULL, NULL, 0} }; +#else /* __LP64__ */ + +static PyMethodDef CarbonEvents_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_CarbonEvt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* !__LP64__ */ + m = Py_InitModule("_CarbonEvt", CarbonEvents_methods); +#ifndef __LP64__ myEventHandlerUPP = NewEventHandlerUPP(myEventHandler); - - - m = Py_InitModule("_CarbonEvt", CarbonEvents_methods); d = PyModule_GetDict(m); CarbonEvents_Error = PyMac_GetOSErrException(); if (CarbonEvents_Error == NULL || @@ -2216,6 +2224,7 @@ /* Backward-compatible name */ Py_INCREF(&EventHotKeyRef_Type); PyModule_AddObject(m, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type); +#endif /* !__LP64__ */ } /* ===================== End module _CarbonEvt ====================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/cg/_CGmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cg/_CGmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cg/_CGmodule.c Thu Jun 5 17:42:10 2008 @@ -1025,6 +1025,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1055,6 +1056,7 @@ _res = Py_None; return _res; } +#endif static PyMethodDef CGContextRefObj_methods[] = { {"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1, @@ -1173,10 +1175,12 @@ PyDoc_STR("() -> None")}, {"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1, PyDoc_STR("(int shouldAntialias) -> None")}, +#ifndef __LP64__ {"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1, PyDoc_STR("(CGrafPtr port) -> None")}, {"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1, PyDoc_STR("(Rect portRect, RgnHandle region) -> None")}, +#endif {NULL, NULL, 0} }; @@ -1254,6 +1258,7 @@ /* ------------------ End object type CGContextRef ------------------ */ +#ifndef __LP64__ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1271,10 +1276,13 @@ return _res; } +#endif static PyMethodDef CG_methods[] = { +#ifndef __LP64__ {"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1, PyDoc_STR("(CGrafPtr) -> CGContextRef")}, +#endif {NULL, NULL, 0} }; Modified: python/branches/tlee-ast-optimize/Mac/Modules/cm/_Cmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cm/_Cmmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cm/_Cmmodule.c Thu Jun 5 17:42:10 2008 @@ -178,6 +178,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -228,6 +229,7 @@ _rv); return _res; } +#endif /* !__LP64__*/ static PyMethodDef CmpInstObj_methods[] = { {"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1, @@ -240,12 +242,14 @@ PyDoc_STR("() -> (Handle _rv)")}, {"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1, PyDoc_STR("(Handle theStorage) -> None")}, +#ifndef __LP64__ {"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1, PyDoc_STR("(short ftnNumber) -> (long _rv)")}, {"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1, PyDoc_STR("() -> (long _rv)")}, {"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1, PyDoc_STR("(ComponentInstance target) -> (long _rv)")}, +#endif /* !__LP64__ */ {NULL, NULL, 0} }; @@ -631,6 +635,7 @@ return _res; } +#ifndef __LP64__ static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -648,6 +653,7 @@ ResObj_New, iconSuite); return _res; } +#endif /* !__LP64__ */ static PyMethodDef CmpObj_methods[] = { {"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1, @@ -678,8 +684,10 @@ PyDoc_STR("(Component capturingComponent) -> (Component _rv)")}, {"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1, PyDoc_STR("() -> None")}, +#ifndef __LP64__ {"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1, PyDoc_STR("() -> (Handle iconSuite)")}, +#endif /* !__LP64__ */ {NULL, NULL, 0} }; Modified: python/branches/tlee-ast-optimize/Mac/Modules/ctl/_Ctlmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ctl/_Ctlmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ctl/_Ctlmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -5765,13 +5766,20 @@ return (ControlPartCode)c_rv; } +#else /* __LP64__ */ + +static PyMethodDef Ctl_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ void init_Ctl(void) { PyObject *m; - PyObject *d; - +#ifndef __LP64__ + PyObject *d; mytracker_upp = NewControlActionUPP(mytracker); myactionproc_upp = NewControlActionUPP(myactionproc); @@ -5783,9 +5791,11 @@ mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); - +#endif /* !__LP64__ */ m = Py_InitModule("_Ctl", Ctl_methods); + +#ifndef __LP64__ d = PyModule_GetDict(m); Ctl_Error = PyMac_GetOSErrException(); if (Ctl_Error == NULL || @@ -5798,6 +5808,7 @@ /* Backward-compatible name */ Py_INCREF(&Control_Type); PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type); +#endif /* !__LP64__ */ } /* ======================== End module _Ctl ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/dlg/_Dlgmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/dlg/_Dlgmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/dlg/_Dlgmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1564,10 +1565,19 @@ return it; } +#else /* __LP64__ */ + +static PyMethodDef Dlg_methods[] = { + {NULL, NULL, 0} +}; + +#endif /* __LP64__ */ + void init_Dlg(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1575,9 +1585,11 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New); PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert); - +#endif /* !__LP64__ */ m = Py_InitModule("_Dlg", Dlg_methods); + +#ifndef __LP64__ d = PyModule_GetDict(m); Dlg_Error = PyMac_GetOSErrException(); if (Dlg_Error == NULL || @@ -1590,6 +1602,7 @@ /* Backward-compatible name */ Py_INCREF(&Dialog_Type); PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type); +#endif /* !__LP64__ */ } /* ======================== End module _Dlg ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/drag/_Dragmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/drag/_Dragmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/drag/_Dragmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1106,21 +1107,28 @@ return 0; } #endif - +#else /* __LP64__ */ +static PyMethodDef Drag_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Drag(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert); +#endif /* !__LP64__ */ m = Py_InitModule("_Drag", Drag_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Drag_Error = PyMac_GetOSErrException(); if (Drag_Error == NULL || @@ -1142,6 +1150,7 @@ dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing); #endif +#endif /* !__LP64__ */ } Modified: python/branches/tlee-ast-optimize/Mac/Modules/evt/_Evtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/evt/_Evtmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/evt/_Evtmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -526,22 +527,32 @@ }; +#else /* __LP64__ */ + +static PyMethodDef Evt_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Evt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Evt", Evt_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Evt_Error = PyMac_GetOSErrException(); if (Evt_Error == NULL || PyDict_SetItemString(d, "Error", Evt_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Evt ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c Thu Jun 5 17:42:10 2008 @@ -18,30 +18,45 @@ #include #ifdef USE_TOOLBOX_OBJECT_GLUE + +#ifndef __LP64__ extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec); -extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec); -extern PyObject *_PyMac_BuildFSRef(FSRef *spec); +#define PyMac_BuildFSSpec _PyMac_BuildFSSpec +#endif /* __LP64__*/ +extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr); +extern PyObject *_PyMac_BuildFSRef(FSRef *spec); +#define PyMac_BuildFSRef _PyMac_BuildFSRef #define PyMac_GetFSSpec _PyMac_GetFSSpec #define PyMac_GetFSRef _PyMac_GetFSRef -#define PyMac_BuildFSSpec _PyMac_BuildFSSpec -#define PyMac_BuildFSRef _PyMac_BuildFSRef -#else + +#else /* !USE_TOOLBOX_OBJECT_GLUE */ + +#ifndef __LP64__ extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec); -extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *PyMac_BuildFSSpec(FSSpec *spec); +#endif /* !__LP64__*/ + +extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr); extern PyObject *PyMac_BuildFSRef(FSRef *spec); -#endif + +#endif /* !USE_TOOLBOX_OBJECT_GLUE */ /* Forward declarations */ -static PyObject *FInfo_New(FInfo *itself); static PyObject *FSRef_New(FSRef *itself); +#ifndef __LP64__ +static PyObject *FInfo_New(FInfo *itself); + static PyObject *FSSpec_New(FSSpec *itself); +#define FSSpec_Convert PyMac_GetFSSpec +#endif /* !__LP64__ */ + static PyObject *Alias_New(AliasHandle itself); +#ifndef __LP64__ static int FInfo_Convert(PyObject *v, FInfo *p_itself); +#endif /* !__LP64__ */ #define FSRef_Convert PyMac_GetFSRef -#define FSSpec_Convert PyMac_GetFSSpec static int Alias_Convert(PyObject *v, AliasHandle *p_itself); /* @@ -62,6 +77,7 @@ /* ** Optional fsspec and fsref pointers. None will pass NULL */ +#ifndef __LP64__ static int myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec) { @@ -71,6 +87,7 @@ } return PyMac_GetFSSpec(v, *spec); } +#endif /* !__LP64__ */ static int myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref) @@ -92,6 +109,7 @@ return Py_BuildValue("u#", itself->unicode, itself->length); } +#ifndef __LP64__ static OSErr _PyMac_GetFullPathname(FSSpec *fss, char *path, int len) { @@ -135,6 +153,7 @@ } return 0; } +#endif /* !__LP64__ */ static PyObject *File_Error; @@ -174,6 +193,10 @@ static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self) { /* Cleanup of self->ob_itself goes here */ + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + if (info->fileSec != NULL) { + CFRelease(info->fileSec); + } self->ob_type->tp_free((PyObject *)self); } @@ -282,12 +305,28 @@ static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure) { - return Py_BuildValue("(llll)", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]); + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + return Py_BuildValue("(llll)", info->userID, info->groupID, info->userAccess, info->mode); } static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure) { - return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1; + long userID; + long groupID; + long userAccess; + long mode; + int r; + + FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); + + r = PyArg_Parse(v, "(llll)", &userID, &groupID, &userAccess, &mode); + if (!r) { + return -1; + } + info->userID = userID; + info->groupID = groupID; + info->userAccess = userAccess; + info->mode = mode; return 0; } @@ -501,6 +540,8 @@ /* ----------------------- Object type FInfo ------------------------ */ +#ifndef __LP64__ + static PyTypeObject FInfo_Type; #define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type)) @@ -682,6 +723,7 @@ FInfo_tp_free, /* tp_free */ }; +#endif /* !__LP64__ */ /* --------------------- End object type FInfo ---------------------- */ @@ -729,6 +771,7 @@ self->ob_type->tp_free((PyObject *)self); } +#ifndef __LP64__ static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -818,6 +861,7 @@ wasChanged); return _res; } +#endif /* !__LP64__ */ static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args) { @@ -891,6 +935,7 @@ } static PyMethodDef Alias_methods[] = { +#ifndef __LP64__ {"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1, PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")}, {"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1, @@ -899,6 +944,7 @@ PyDoc_STR("(FSSpec fromFile, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")}, {"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1, PyDoc_STR("(FSSpec fromFile, Boolean logon) -> (FSSpec target, Boolean wasChanged)")}, +#endif /* !__LP64__ */ {"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1, PyDoc_STR("(FSRef fromFile, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")}, {"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1, @@ -1033,6 +1079,7 @@ /* ----------------------- Object type FSSpec ----------------------- */ +#ifndef __LP64__ static PyTypeObject FSSpec_Type; @@ -1488,6 +1535,7 @@ FSSpec_tp_free, /* tp_free */ }; +#endif /* !__LP64__ */ /* --------------------- End object type FSSpec --------------------- */ @@ -1568,7 +1616,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; FSRef newRef; +#ifndef __LP64__ FSSpec newSpec; +#endif if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, &whichInfo, @@ -1580,11 +1630,22 @@ whichInfo, &catalogInfo, &newRef, - &newSpec); +#ifndef __LP64__ + &newSpec +#else /* __LP64__ */ + NULL +#endif /* __LP64__*/ + ); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&", FSRef_New, &newRef, FSSpec_New, &newSpec); +#else /* __LP64__ */ + _res = Py_BuildValue("O&O", FSRef_New, &newRef, Py_None); +#endif /* __LP64__ */ + return _res; } @@ -1598,7 +1659,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; FSRef newRef; +#ifndef __LP64__ FSSpec newSpec; +#endif /* !__LP64__ */ UInt32 newDirID; if (!PyArg_ParseTuple(_args, "u#lO&", &nameLength__in__, &nameLength__in_len__, @@ -1611,13 +1674,25 @@ whichInfo, &catalogInfo, &newRef, +#ifndef __LP64__ &newSpec, +#else /* !__LP64__ */ + NULL, +#endif /* !__LP64__ */ &newDirID); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&l", FSRef_New, &newRef, FSSpec_New, &newSpec, newDirID); +#else /* __LP64__ */ + _res = Py_BuildValue("O&Ol", + FSRef_New, &newRef, + Py_None, + newDirID); +#endif /* __LP64__ */ return _res; } @@ -1699,7 +1774,9 @@ FSCatalogInfoBitmap whichInfo; FSCatalogInfo catalogInfo; HFSUniStr255 outName; +#ifndef __LP64__ FSSpec fsSpec; +#endif /* !__LP64__ */ FSRef parentRef; if (!PyArg_ParseTuple(_args, "l", &whichInfo)) @@ -1708,14 +1785,27 @@ whichInfo, &catalogInfo, &outName, +#ifndef __LP64__ &fsSpec, +#else /* __LP64__ */ + NULL, +#endif /* __LP64__ */ &parentRef); if (_err != noErr) return PyMac_Error(_err); + +#ifndef __LP64__ _res = Py_BuildValue("O&O&O&O&", FSCatalogInfo_New, &catalogInfo, PyMac_BuildHFSUniStr255, &outName, FSSpec_New, &fsSpec, FSRef_New, &parentRef); +#else /* __LP64__ */ + _res = Py_BuildValue("O&O&OO&", + FSCatalogInfo_New, &catalogInfo, + PyMac_BuildHFSUniStr255, &outName, + Py_None, + FSRef_New, &parentRef); +#endif /* __LP64__ */ return _res; } @@ -1784,7 +1874,7 @@ UniCharCount forkNameLength__len__; int forkNameLength__in_len__; SInt8 permissions; - SInt16 forkRefNum; + FSIORefNum forkRefNum; if (!PyArg_ParseTuple(_args, "u#b", &forkNameLength__in__, &forkNameLength__in_len__, &permissions)) @@ -2034,7 +2124,7 @@ /* --------------------- End object type FSRef ---------------------- */ - +#ifndef __LP64__ static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2562,6 +2652,7 @@ FSSpec_New, &spec); return _res; } +#endif /* !__LP64__ */ static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args) { @@ -2785,6 +2876,7 @@ return _res; } +#ifndef __LP64__ static PyObject *File_NewAlias(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2933,6 +3025,7 @@ wasAliased); return _res; } +#endif /* !__LP64__ */ static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args) { @@ -3050,6 +3143,7 @@ } static PyMethodDef File_methods[] = { +#ifndef __LP64__ {"UnmountVol", (PyCFunction)File_UnmountVol, 1, PyDoc_STR("(Str63 volName, short vRefNum) -> None")}, {"FlushVol", (PyCFunction)File_FlushVol, 1, @@ -3100,6 +3194,7 @@ PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, long newDirID, Str255 newName) -> None")}, {"FSMakeFSSpec", (PyCFunction)File_FSMakeFSSpec, 1, PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FSSpec spec)")}, +#endif /* !__LP64__*/ {"FSGetForkPosition", (PyCFunction)File_FSGetForkPosition, 1, PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 position)")}, {"FSSetForkPosition", (PyCFunction)File_FSSetForkPosition, 1, @@ -3124,6 +3219,7 @@ PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")}, {"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1, PyDoc_STR("(FNMessage message, OptionBits flags) -> None")}, +#ifndef __LP64__ {"NewAlias", (PyCFunction)File_NewAlias, 1, PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")}, {"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1, @@ -3136,6 +3232,7 @@ PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")}, {"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)File_ResolveAliasFileWithMountFlagsNoUI, 1, PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")}, +#endif /* !__LP64__ */ {"FSNewAlias", (PyCFunction)File_FSNewAlias, 1, PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")}, {"FSResolveAliasFileWithMountFlags", (PyCFunction)File_FSResolveAliasFileWithMountFlags, 1, @@ -3150,7 +3247,7 @@ }; - +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *v, FSSpec *spec) { @@ -3188,12 +3285,15 @@ } return 0; } +#endif /* !__LP64__ */ int PyMac_GetFSRef(PyObject *v, FSRef *fsr) { OSStatus err; +#ifndef __LP64__ FSSpec fss; +#endif /* !__LP64__ */ if (FSRef_Check(v)) { *fsr = ((FSRefObject *)v)->ob_itself; @@ -3205,12 +3305,14 @@ char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; - if ( (err=FSPathMakeRef(path, fsr, NULL)) ) + if ( (err=FSPathMakeRef((unsigned char*)path, fsr, NULL)) ) PyMac_Error(err); PyMem_Free(path); return !err; } /* XXXX Should try unicode here too */ + +#ifndef __LP64__ /* Otherwise we try to go via an FSSpec */ if (FSSpec_Check(v)) { fss = ((FSSpecObject *)v)->ob_itself; @@ -3219,15 +3321,19 @@ PyMac_Error(err); return 0; } +#endif /* !__LP64__ */ + PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required"); return 0; } +#ifndef __LP64__ extern PyObject * PyMac_BuildFSSpec(FSSpec *spec) { return FSSpec_New(spec); } +#endif /* !__LP64__ */ extern PyObject * PyMac_BuildFSRef(FSRef *spec) @@ -3242,10 +3348,12 @@ PyObject *d; - +#ifndef __LP64__ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec); - PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec); +#endif /* !__LP64__ */ + + PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef); @@ -3262,6 +3370,8 @@ /* Backward-compatible name */ Py_INCREF(&FSCatalogInfo_Type); PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type); + +#ifndef __LP64__ FInfo_Type.ob_type = &PyType_Type; if (PyType_Ready(&FInfo_Type) < 0) return; Py_INCREF(&FInfo_Type); @@ -3269,6 +3379,7 @@ /* Backward-compatible name */ Py_INCREF(&FInfo_Type); PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type); +#endif /* !__LP64__ */ Alias_Type.ob_type = &PyType_Type; if (PyType_Ready(&Alias_Type) < 0) return; Py_INCREF(&Alias_Type); @@ -3276,6 +3387,8 @@ /* Backward-compatible name */ Py_INCREF(&Alias_Type); PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type); + +#ifndef __LP64__ FSSpec_Type.ob_type = &PyType_Type; if (PyType_Ready(&FSSpec_Type) < 0) return; Py_INCREF(&FSSpec_Type); @@ -3283,6 +3396,7 @@ /* Backward-compatible name */ Py_INCREF(&FSSpec_Type); PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type); +#endif /* !__LP64__ */ FSRef_Type.ob_type = &PyType_Type; if (PyType_Ready(&FSRef_Type) < 0) return; Py_INCREF(&FSRef_Type); Modified: python/branches/tlee-ast-optimize/Mac/Modules/file/filesupport.py ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/file/filesupport.py (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/file/filesupport.py Thu Jun 5 17:42:10 2008 @@ -6,6 +6,13 @@ # XXXX TO DO: # - Implement correct missing FSSpec handling for Alias methods # - Implement FInfo +# +# WARNING WARNING WARNING +# The file _Filemodule.c was modified manually, don't run this script +# unless you really know what you're doing. + +import sys +sys.exit(42) import string @@ -199,6 +206,7 @@ return Py_BuildValue("u#", itself->unicode, itself->length); } +#ifndef __LP64__ /* ** Get pathname for a given FSSpec */ @@ -244,10 +252,13 @@ } return 0; } +#endif /* !__LP64__ */ """ finalstuff = finalstuff + """ + +#ifndef __LP64__ int PyMac_GetFSSpec(PyObject *v, FSSpec *spec) { @@ -286,6 +297,8 @@ return 0; } +#endif /* !__LP64__ */ + int PyMac_GetFSRef(PyObject *v, FSRef *fsr) { @@ -309,6 +322,7 @@ } /* XXXX Should try unicode here too */ /* Otherwise we try to go via an FSSpec */ +#ifndef __LP64__ if (FSSpec_Check(v)) { fss = ((FSSpecObject *)v)->ob_itself; if ((err=FSpMakeFSRef(&fss, fsr)) == 0) @@ -317,14 +331,19 @@ return 0; } PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required"); +#else /* __LP64__ */ + PyErr_SetString(PyExc_TypeError, "FSRef or pathname required"); +#endif /* __LP64__ */ return 0; } +#ifndef __LP64__ extern PyObject * PyMac_BuildFSSpec(FSSpec *spec) { return FSSpec_New(spec); } +#endif /* __LP64__ */ extern PyObject * PyMac_BuildFSRef(FSRef *spec) @@ -334,9 +353,11 @@ """ initstuff = initstuff + """ +#ifndef __LP64__ PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec); -PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec); +#endif /* !__LP64__*/ +PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef); """ Modified: python/branches/tlee-ast-optimize/Mac/Modules/fm/_Fmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/fm/_Fmmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/fm/_Fmmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -335,23 +336,32 @@ {NULL, NULL, 0} }; +#else /* __LP64__ */ +static PyMethodDef Fm_methods[] = { + {NULL, NULL, 0} +}; +#endif /* __LP64__ */ void init_Fm(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Fm", Fm_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Fm_Error = PyMac_GetOSErrException(); if (Fm_Error == NULL || PyDict_SetItemString(d, "Error", Fm_Error) != 0) return; +#endif /* __LP64__ */ } /* ========================= End module _Fm ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/folder/_Foldermodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/folder/_Foldermodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/folder/_Foldermodule.c Thu Jun 5 17:42:10 2008 @@ -27,8 +27,8 @@ short vRefNum; OSType folderType; Boolean createFolder; - short foundVRefNum; - long foundDirID; + FSVolumeRefNum foundVRefNum; + SInt32 foundDirID; if (!PyArg_ParseTuple(_args, "hO&b", &vRefNum, PyMac_GetOSType, &folderType, @@ -158,6 +158,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -248,6 +249,7 @@ flags); return _res; } +#endif /* !__LP64__ */ static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args) { @@ -300,6 +302,7 @@ PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")}, {"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1, PyDoc_STR("(FolderType foldType) -> None")}, +#ifndef __LP64__ {"GetFolderName", (PyCFunction)Folder_GetFolderName, 1, PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")}, {"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1, @@ -308,6 +311,7 @@ PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")}, {"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1, PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")}, +#endif /* !__LP64__ */ {"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1, PyDoc_STR("(short vRefNum, long dirID) -> None")}, {"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1, Modified: python/branches/tlee-ast-optimize/Mac/Modules/help/_Helpmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/help/_Helpmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/help/_Helpmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -144,7 +145,10 @@ return _res; } +#endif /* __LP64__ */ + static PyMethodDef Help_methods[] = { +#ifndef __LP64__ {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1, PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")}, {"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1, @@ -161,6 +165,7 @@ PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")}, {"HMHideTag", (PyCFunction)Help_HMHideTag, 1, PyDoc_STR("() -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -170,17 +175,21 @@ void init_Help(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Help", Help_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Help_Error = PyMac_GetOSErrException(); if (Help_Error == NULL || PyDict_SetItemString(d, "Error", Help_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Help ======================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/ibcarbon/_IBCarbon.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ibcarbon/_IBCarbon.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ibcarbon/_IBCarbon.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include #include "pymactoolbox.h" @@ -224,10 +225,13 @@ IBNibRefObj_New, outNibRef); return _res; } +#endif /* __LP64__ */ static PyMethodDef IBCarbon_methods[] = { +#ifndef __LP64__ {"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1, PyDoc_STR("(CFStringRef inNibName) -> (IBNibRef outNibRef)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -237,13 +241,16 @@ void init_IBCarbon(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_IBCarbon", IBCarbon_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); IBCarbon_Error = PyMac_GetOSErrException(); if (IBCarbon_Error == NULL || @@ -256,6 +263,7 @@ /* Backward-compatible name */ Py_INCREF(&IBNibRef_Type); PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type); +#endif /* __LP64__ */ } /* ====================== End module _IBCarbon ====================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/icn/_Icnmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/icn/_Icnmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/icn/_Icnmodule.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1447,8 +1448,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Icn_methods[] = { +#ifndef __LP64__ {"GetCIcon", (PyCFunction)Icn_GetCIcon, 1, PyDoc_STR("(SInt16 iconID) -> (CIconHandle _rv)")}, {"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1, @@ -1573,6 +1576,7 @@ PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")}, {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1582,17 +1586,21 @@ void init_Icn(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Icn", Icn_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Icn_Error = PyMac_GetOSErrException(); if (Icn_Error == NULL || PyDict_SetItemString(d, "Error", Icn_Error) != 0) return; +#endif /* __LP64__ */ } /* ======================== End module _Icn ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/launch/_Launchmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/launch/_Launchmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/launch/_Launchmodule.c Thu Jun 5 17:42:10 2008 @@ -50,6 +50,7 @@ PyObject * LSItemInfoRecord_New(LSItemInfoRecord *it) { +#ifndef __LP64__ return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}", "flags", it->flags, "filetype", PyMac_BuildOSType, it->filetype, @@ -57,6 +58,13 @@ "extension", OptCFStringRefObj_New, it->extension, "iconFileName", OptCFStringRefObj_New, it->iconFileName, "kindID", it->kindID); +#else + return Py_BuildValue("{s:is:O&s:O&s:O&}", + "flags", it->flags, + "filetype", PyMac_BuildOSType, it->filetype, + "creator", PyMac_BuildOSType, it->creator, + "extension", OptCFStringRefObj_New, it->extension); +#endif } static PyObject *Launch_Error; Modified: python/branches/tlee-ast-optimize/Mac/Modules/list/_Listmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/list/_Listmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/list/_Listmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1032,8 +1033,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef List_methods[] = { +#ifndef __LP64__ {"CreateCustomList", (PyCFunction)List_CreateCustomList, 1, PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")}, {"LNew", (PyCFunction)List_LNew, 1, @@ -1056,9 +1059,11 @@ PyDoc_STR("(ListHandle list, OptionBits selectionFlags) -> None")}, {"as_List", (PyCFunction)List_as_List, 1, PyDoc_STR("(Resource)->List.\nReturns List object (which is not auto-freed!)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ static void myListDefFunction(SInt16 message, @@ -1096,11 +1101,13 @@ Py_DECREF(rv); } } +#endif /* __LP64__ */ void init_List(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1109,9 +1116,11 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_List", List_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); List_Error = PyMac_GetOSErrException(); if (List_Error == NULL || @@ -1124,6 +1133,7 @@ /* Backward-compatible name */ Py_INCREF(&List_Type); PyModule_AddObject(m, "ListType", (PyObject *)&List_Type); +#endif /* __LP64__ */ } /* ======================== End module _List ======================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/menu/_Menumodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/menu/_Menumodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/menu/_Menumodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -3347,8 +3348,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Menu_methods[] = { +#ifndef __LP64__ {"NewMenu", (PyCFunction)Menu_NewMenu, 1, PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")}, {"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1, @@ -3433,6 +3436,7 @@ PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")}, {"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1, PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -3442,15 +3446,18 @@ void init_Menu(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Menu", Menu_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Menu_Error = PyMac_GetOSErrException(); if (Menu_Error == NULL || @@ -3463,6 +3470,7 @@ /* Backward-compatible name */ Py_INCREF(&Menu_Type); PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type); +#endif /* __LP64__ */ } /* ======================== End module _Menu ======================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/mlte/_Mltemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/mlte/_Mltemodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/mlte/_Mltemodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1622,7 +1623,10 @@ } +#endif /* __LP64__ */ + static PyMethodDef Mlte_methods[] = { +#ifndef __LP64__ {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, @@ -1639,6 +1643,7 @@ PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")}, {"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1, PyDoc_STR("(TXNInitOptions) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1648,14 +1653,17 @@ void init_Mlte(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; // PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx); +#endif /* __LP64__ */ m = Py_InitModule("_Mlte", Mlte_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Mlte_Error = PyMac_GetOSErrException(); if (Mlte_Error == NULL || @@ -1675,6 +1683,7 @@ /* Backward-compatible name */ Py_INCREF(&TXNFontMenuObject_Type); PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type); +#endif /* __LP64__ */ } /* ======================== End module _Mlte ======================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -6544,8 +6545,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef Qd_methods[] = { +#ifndef __LP64__ {"GetPort", (PyCFunction)Qd_GetPort, 1, PyDoc_STR("() -> (GrafPtr port)")}, {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1, @@ -7080,10 +7083,12 @@ PyDoc_STR("Take (string, int, Rect) argument and create BitMap")}, {"RawBitMap", (PyCFunction)Qd_RawBitMap, 1, PyDoc_STR("Take string BitMap and turn into BitMap object")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ /* Like BMObj_New, but the original bitmap data structure is copied (and ** released when the object is released) @@ -7101,11 +7106,13 @@ return (PyObject *)it; } +#endif /* __LP64__ */ void init_Qd(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -7117,8 +7124,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qd", Qd_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qd_Error = PyMac_GetOSErrException(); if (Qd_Error == NULL || @@ -7138,6 +7147,7 @@ /* Backward-compatible name */ Py_INCREF(&BitMap_Type); PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type); +#endif /* __LP64__ */ } /* ========================= End module _Qd ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -630,8 +631,10 @@ return _res; } +#endif /* __LP64__ */ static PyMethodDef Qdoffs_methods[] = { +#ifndef __LP64__ {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")}, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, @@ -678,6 +681,7 @@ PyDoc_STR("(pixmap, int start, int size) -> string. Return bytes from the pixmap")}, {"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1, PyDoc_STR("(pixmap, int start, string data). Store bytes into the pixmap")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -687,6 +691,7 @@ void init_Qdoffs(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -694,8 +699,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qdoffs", Qdoffs_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qdoffs_Error = PyMac_GetOSErrException(); if (Qdoffs_Error == NULL || @@ -708,6 +715,7 @@ /* Backward-compatible name */ Py_INCREF(&GWorld_Type); PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type); +#endif /* __LP64__ */ } /* ======================= End module _Qdoffs ======================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/qt/_Qtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qt/_Qtmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qt/_Qtmodule.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -26294,8 +26295,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Qt_methods[] = { +#ifndef __LP64__ {"EnterMovies", (PyCFunction)Qt_EnterMovies, 1, PyDoc_STR("() -> None")}, {"ExitMovies", (PyCFunction)Qt_ExitMovies, 1, @@ -27988,6 +27991,7 @@ PyDoc_STR("(WindowPtr wp, Point startPt, Rect boundsRect) -> None")}, {"MoviesTask", (PyCFunction)Qt_MoviesTask, 1, PyDoc_STR("(long maxMilliSecToUse) -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -27997,6 +28001,7 @@ void init_Qt(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -28013,9 +28018,11 @@ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_Qt", Qt_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Qt_Error = PyMac_GetOSErrException(); if (Qt_Error == NULL || @@ -28077,6 +28084,7 @@ /* Backward-compatible name */ Py_INCREF(&SGOutput_Type); PyModule_AddObject(m, "SGOutputType", (PyObject *)&SGOutput_Type); +#endif /* __LP64__ */ } /* ========================= End module _Qt ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c Thu Jun 5 17:42:10 2008 @@ -4,7 +4,6 @@ #include "Python.h" - #include "pymactoolbox.h" /* Macro to test whether a weak-loaded CFM function exists */ @@ -414,6 +413,7 @@ return _res; } +#ifndef __LP64__ static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -431,6 +431,7 @@ return _res; } +#endif /* !__LP64__ */ static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args) { @@ -501,10 +502,12 @@ PyDoc_STR("(long newSize) -> None")}, {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1, PyDoc_STR("() -> (Handle _rv)")}, +#ifndef __LP64__ {"as_Control", (PyCFunction)ResObj_as_Control, 1, PyDoc_STR("Return this resource/handle as a Control")}, {"as_Menu", (PyCFunction)ResObj_as_Menu, 1, PyDoc_STR("Return this resource/handle as a Menu")}, +#endif /* !__LP64__ */ {"LoadResource", (PyCFunction)ResObj_LoadResource, 1, PyDoc_STR("() -> None")}, {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1, @@ -1152,6 +1155,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1287,6 +1291,7 @@ _res = Py_None; return _res; } +#endif /* !__LP64__ */ static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args) { @@ -1327,6 +1332,7 @@ return _res; } +#ifndef __LP64__ static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1394,6 +1400,7 @@ return _res; } + static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1413,6 +1420,7 @@ nextRefNum); return _res; } +#endif /* !__LP64__ */ static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args) { @@ -1438,6 +1446,8 @@ return _res; } + +#ifndef __LP64__ static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1534,6 +1544,7 @@ PyMac_BuildFSSpec, &newSpec); return _res; } +#endif /* __LP64__ */ static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args) { @@ -1544,7 +1555,7 @@ UniCharCount forkNameLength__len__; int forkNameLength__in_len__; SignedByte permissions; - SInt16 refNum; + ResFileRefNum refNum; #ifndef FSOpenResourceFile PyMac_PRECHECK(FSOpenResourceFile); #endif @@ -1637,6 +1648,7 @@ PyDoc_STR("(short refNum) -> (short _rv)")}, {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1, PyDoc_STR("(short refNum, short attrs) -> None")}, +#ifndef __LP64__ {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1, PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")}, {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1, @@ -1647,10 +1659,12 @@ PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")}, {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1, PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")}, +#endif /* !__LP64__ */ {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1, PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")}, {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1, PyDoc_STR("(SInt16 refNum) -> None")}, +#ifndef __LP64__ {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1, PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1, @@ -1659,14 +1673,17 @@ PyDoc_STR("() -> (SInt16 refNum)")}, {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1, PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")}, +#endif /* __LP64__ */ {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1, PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")}, +#ifndef __LP64__ {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1, PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")}, {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1, PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")}, {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1, PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")}, +#endif /* __LP64__ */ {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1, PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")}, {"Handle", (PyCFunction)Res_Handle, 1, @@ -1676,7 +1693,6 @@ - /* Alternative version of ResObj_New, which returns None for null argument */ PyObject *OptResObj_New(Handle itself) { Modified: python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c Thu Jun 5 17:42:10 2008 @@ -4,6 +4,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -315,8 +316,10 @@ _res = Py_None; return _res; } +#endif /* __LP64__ */ static PyMethodDef Scrap_methods[] = { +#ifndef __LP64__ {"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1, PyDoc_STR("() -> None")}, {"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1, @@ -327,6 +330,7 @@ PyDoc_STR("() -> None")}, {"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1, PyDoc_STR("() -> None")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -336,12 +340,15 @@ void init_Scrap(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Scrap", Scrap_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Scrap_Error = PyMac_GetOSErrException(); if (Scrap_Error == NULL || @@ -351,6 +358,7 @@ Py_INCREF(&Scrap_Type); if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0) Py_FatalError("can't initialize ScrapType"); +#endif /* __LP64__ */ } /* ======================= End module _Scrap ======================== */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -981,8 +982,10 @@ byteCount); return _res; } +#endif /* __LP64__ */ static PyMethodDef Snd_methods[] = { +#ifndef __LP64__ {"SPB", (PyCFunction)Snd_SPB, 1, PyDoc_STR(NULL)}, {"SysBeep", (PyCFunction)Snd_SysBeep, 1, @@ -1047,10 +1050,12 @@ PyDoc_STR("(long inRefNum) -> (long milliseconds)")}, {"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1, PyDoc_STR("(long inRefNum) -> (long byteCount)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; +#ifndef __LP64__ /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int @@ -1113,19 +1118,23 @@ SetA5(A5); } } +#endif /* __LP64__ */ void init_Snd(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; +#endif /* __LP64__ */ m = Py_InitModule("_Snd", Snd_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Snd_Error = PyMac_GetOSErrException(); if (Snd_Error == NULL || @@ -1145,6 +1154,7 @@ /* Backward-compatible name */ Py_INCREF(&SPB_Type); PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type); +#endif /* __LP64__ */ } /* ======================== End module _Snd ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/te/_TEmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/te/_TEmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/te/_TEmodule.c Thu Jun 5 17:42:10 2008 @@ -3,6 +3,7 @@ #include "Python.h" +#ifndef __LP64__ #include "pymactoolbox.h" @@ -1267,8 +1268,10 @@ TEObj_New, _rv); return _res; } +#endif /* __LP64__ */ static PyMethodDef TE_methods[] = { +#ifndef __LP64__ {"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1, PyDoc_STR("() -> (Handle _rv)")}, {"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1, @@ -1295,6 +1298,7 @@ PyDoc_STR("(UInt8 value) -> None")}, {"as_TE", (PyCFunction)TE_as_TE, 1, PyDoc_STR("(Handle h) -> (TEHandle _rv)")}, +#endif /* __LP64__ */ {NULL, NULL, 0} }; @@ -1304,6 +1308,7 @@ void init_TE(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; @@ -1311,8 +1316,10 @@ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert); +#endif /* __LP64__ */ m = Py_InitModule("_TE", TE_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); TE_Error = PyMac_GetOSErrException(); if (TE_Error == NULL || @@ -1325,6 +1332,7 @@ /* Backward-compatible name */ Py_INCREF(&TE_Type); PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type); +#endif /* __LP64__ */ } /* ========================= End module _TE ========================= */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c Thu Jun 5 17:42:10 2008 @@ -3,7 +3,7 @@ #include "Python.h" - +#ifndef __LP64__ #include "pymactoolbox.h" @@ -3147,8 +3147,10 @@ WinObj_WhichWindow, theWindow); return _res; } +#endif /* __LP64__ */ static PyMethodDef Win_methods[] = { +#ifndef __LP64__ {"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1, PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")}, {"NewWindow", (PyCFunction)Win_NewWindow, 1, @@ -3200,10 +3202,12 @@ {"FindWindow", (PyCFunction)Win_FindWindow, 1, PyDoc_STR("(Point thePoint) -> (short _rv, WindowPtr theWindow)")}, {NULL, NULL, 0} +#endif /* __LP64__ */ }; +#ifndef __LP64__ /* Return the object corresponding to the window, or NULL */ PyObject * @@ -3226,20 +3230,22 @@ return it; } +#endif /* __LP64__ */ void init_Win(void) { PyObject *m; +#ifndef __LP64__ PyObject *d; + PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); - - PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); - PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); - +#endif /* __LP64__ */ m = Py_InitModule("_Win", Win_methods); +#ifndef __LP64__ d = PyModule_GetDict(m); Win_Error = PyMac_GetOSErrException(); if (Win_Error == NULL || @@ -3252,6 +3258,7 @@ /* Backward-compatible name */ Py_INCREF(&Window_Type); PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type); +#endif /* __LP64__ */ } /* ======================== End module _Win ========================= */ Modified: python/branches/tlee-ast-optimize/Makefile.pre.in ============================================================================== --- python/branches/tlee-ast-optimize/Makefile.pre.in (original) +++ python/branches/tlee-ast-optimize/Makefile.pre.in Thu Jun 5 17:42:10 2008 @@ -431,7 +431,7 @@ $(RESSRCDIR)/Info.plist $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION) if test "${UNIVERSALSDK}"; then \ - $(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \ + $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \ -isysroot "${UNIVERSALSDK}" \ -all_load $(LIBRARY) -Wl,-single_module \ -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \ @@ -1052,13 +1052,22 @@ frameworkinstallapps: cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)" +frameworkinstallapps4way: + cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)" + # This install the unix python and pythonw tools in /usr/local/bin frameworkinstallunixtools: cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)" +frameworkinstallunixtools4way: + cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)" + frameworkaltinstallunixtools: cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)" +frameworkaltinstallunixtools4way: + cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)" + # This installs the Demos and Tools into the applications directory. # It is not part of a normal frameworkinstall frameworkinstallextras: @@ -1185,7 +1194,7 @@ # Perform some verification checks on any modified files. check: - ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py # Dependencies Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Thu Jun 5 17:42:10 2008 @@ -412,6 +412,7 @@ Bjorn Lindqvist Per Lindqvist Eric Lindvall +Gregor Lingl Nick Lockwood Stephanie Lockwood Anne Lord Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Thu Jun 5 17:42:10 2008 @@ -259,6 +259,14 @@ - The Mac Modules (including Carbon) have been deprecated for removal in Python 3.0. +- Library: on MacOS X you can now set ``ARCHFLAGS`` in the shell + environment to control the '-arch' flags that are used to build + an extension. This was added for compatibility with Apple's build + of Python. + +- The bundled OSX-specific copy of libbffi is now in sync with the version + shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. + Build ----- @@ -266,6 +274,23 @@ - ``Lib/lib-old`` is now added to sys.path. +- On MacOS X it is now possible to install the framework in 64-bit + mode or even as a 4-way universal binary (that is, PPC, i386, + PPC64 and x86_64 support in one binary) + + This is controlled by the configure argument ``--with-universal-archs``: + + - ``--with-universal-archs=all``: install 4-way universal + + - ``--with-universal-archs=32-bit``: install 2-way universal, 32-bit (the default) + + - ``--with-universal-archs=64-bit``: install 2-way universal, 64-bit + + This option should be used in combination with ``--enable-universalsdk=``. + + NOTE: 64-bit and 4-way builds are only suppported on Mac OS X 10.5 (or later). + + C API ----- Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c Thu Jun 5 17:42:10 2008 @@ -1758,6 +1758,7 @@ #ifdef ffi_type_longdouble #undef ffi_type_longdouble #endif + /* This is already defined on OSX */ ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN, FFI_TYPE_LONGDOUBLE }; Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-darwin.S ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-darwin.S (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-darwin.S Thu Jun 5 17:42:10 2008 @@ -179,7 +179,6 @@ movl %ebp,%esp popl %ebp ret -.LFE1: .ffi_call_SYSV_end: #if 0 .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV @@ -220,7 +219,7 @@ #else .long .LFB1 /* FDE initial location */ #endif - .long .LFE1-.LFB1 /* FDE address range */ + .long .ffi_call_SYSV_end-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif Modified: python/branches/tlee-ast-optimize/Objects/complexobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/complexobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/complexobject.c Thu Jun 5 17:42:10 2008 @@ -822,7 +822,8 @@ static PyObject * complex_getnewargs(PyComplexObject *v) { - return Py_BuildValue("(D)", &v->cval); + Py_complex c = v->cval; + return Py_BuildValue("(dd)", c.real, c.imag); } #if 0 Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Thu Jun 5 17:42:10 2008 @@ -565,8 +565,6 @@ !(supplied_flags & PyCF_NO_OPTIMIZE), &cf); } return result; - - /* XXX: this is awful */ } #ifdef Py_USING_UNICODE Modified: python/branches/tlee-ast-optimize/Python/mactoolboxglue.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/mactoolboxglue.c (original) +++ python/branches/tlee-ast-optimize/Python/mactoolboxglue.c Thu Jun 5 17:42:10 2008 @@ -106,6 +106,7 @@ } +#ifndef __LP64__ OSErr PyMac_GetFullPathname(FSSpec *fss, char *path, int len) { @@ -153,6 +154,7 @@ Py_XDECREF(fs); return err; } +#endif /* !__LP64__ */ /* Convert a 4-char string object argument to an OSType value */ int @@ -417,6 +419,7 @@ GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs") GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs") +#ifndef __LP64__ GLUE_NEW(Track, TrackObj_New, "Carbon.Qt") GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt") GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt") @@ -429,6 +432,7 @@ GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt") GLUE_NEW(Media, MediaObj_New, "Carbon.Qt") GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt") +#endif /* !__LP64__ */ GLUE_NEW(Handle, ResObj_New, "Carbon.Res") GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res") Modified: python/branches/tlee-ast-optimize/configure ============================================================================== --- python/branches/tlee-ast-optimize/configure (original) +++ python/branches/tlee-ast-optimize/configure Thu Jun 5 17:42:10 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 63545 . +# From configure.in Revision: 63690 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -703,6 +703,7 @@ LN OPT BASECFLAGS +UNIVERSAL_ARCH_FLAGS OTHER_LIBTOOL_OPT LIBTOOL_CRUFT SO @@ -1328,6 +1329,9 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-universal-archs=ARCH + select architectures for universal build ("32-bit", + "64-bit" or "all") --with-framework-name=FRAMEWORK specify an alternate name of the framework built with --enable-framework @@ -1850,6 +1854,16 @@ _ACEOF +# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable +# them. + +cat >>confdefs.h <<\_ACEOF +#define _DARWIN_C_SOURCE 1 +_ACEOF + + + define_xopen_source=yes # Arguments passed to configure. @@ -1883,6 +1897,27 @@ +UNIVERSAL_ARCHS="32-bit" +{ echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 +echo $ECHO_N "checking for --with-universal-archs... $ECHO_C" >&6; } + +# Check whether --with-universal-archs was given. +if test "${with_universal_archs+set}" = set; then + withval=$with_universal_archs; + { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } + UNIVERSAL_ARCHS="$withval" + +else + + { echo "$as_me:$LINENO: result: 32-bit" >&5 +echo "${ECHO_T}32-bit" >&6; } + +fi + + + + # Check whether --with-framework-name was given. if test "${with_framework_name+set}" = set; then @@ -1927,9 +1962,14 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" - FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" - FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" + else + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + fi + if test "x${prefix}" = "xNONE" ; then FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" else @@ -1968,6 +2008,12 @@ fi enable_framework= + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST=update4wayuniversal + FRAMEWORKALTINSTALLLAST=update4wayuniversal + fi + fi @@ -4509,6 +4555,11 @@ fi + +# The -arch flags for universal builds on OSX +UNIVERSAL_ARCH_FLAGS= + + # tweak BASECFLAGS based on compiler and platform case $GCC in yes) @@ -4589,7 +4640,25 @@ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd # used to be here, but non-Apple gcc doesn't accept them. if test "${enable_universalsdk}"; then - BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + UNIVERSAL_ARCH_FLAGS="" + if test "$UNIVERSAL_ARCHS" = "32-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" + + elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" + + elif test "$UNIVERSAL_ARCHS" = "all" ; then + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" + + else + { { echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 +echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} + { (exit 1); exit 1; }; } + + fi + + + BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" fi ;; @@ -12500,6 +12569,12 @@ if test ${cur_target} '>' 10.2; then cur_target=10.3 fi + if test "${UNIVERSAL_ARCHS}" = "all"; then + # Ensure that the default platform for a 4-way + # universal build is OSX 10.5, that's the first + # OS release where 4-way builds make sense. + cur_target='10.5' + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the @@ -12510,10 +12585,10 @@ export MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET='' - if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 + if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 then if test "${enable_universalsdk}"; then - LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" @@ -22212,8 +22287,6 @@ esac - - # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). { echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 @@ -24771,6 +24844,7 @@ LN!$LN$ac_delim OPT!$OPT$ac_delim BASECFLAGS!$BASECFLAGS$ac_delim +UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim SO!$SO$ac_delim @@ -24780,7 +24854,6 @@ LINKFORSHARED!$LINKFORSHARED$ac_delim CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim SHLIBS!$SHLIBS$ac_delim -USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -24822,6 +24895,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim LDLAST!$LDLAST$ac_delim @@ -24844,7 +24918,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Thu Jun 5 17:42:10 2008 @@ -57,6 +57,12 @@ # u_int on Irix 5.3. Defining _BSD_TYPES brings it back. AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) +# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable +# them. +AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) + + define_xopen_source=yes # Arguments passed to configure. @@ -86,6 +92,20 @@ ]) AC_SUBST(UNIVERSALSDK) +UNIVERSAL_ARCHS="32-bit" +AC_MSG_CHECKING(for --with-universal-archs) +AC_ARG_WITH(universal-archs, + AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit" or "all")), +[ + AC_MSG_RESULT($withval) + UNIVERSAL_ARCHS="$withval" +], +[ + AC_MSG_RESULT(32-bit) +]) + + + AC_ARG_WITH(framework-name, AC_HELP_STRING(--with-framework-name=FRAMEWORK, specify an alternate name of the framework built with --enable-framework), @@ -127,9 +147,14 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools" - FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall" - FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" + else + FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools" + fi + if test "x${prefix}" = "xNONE" ; then FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}" else @@ -160,6 +185,12 @@ FRAMEWORKUNIXTOOLSPREFIX="${prefix}" fi enable_framework= + + if test "$UNIVERSAL_ARCHS" = "all" + then + FRAMEWORKINSTALLLAST=update4wayuniversal + FRAMEWORKALTINSTALLLAST=update4wayuniversal + fi ]) AC_SUBST(PYTHONFRAMEWORK) AC_SUBST(PYTHONFRAMEWORKIDENTIFIER) @@ -827,6 +858,11 @@ fi AC_SUBST(BASECFLAGS) + +# The -arch flags for universal builds on OSX +UNIVERSAL_ARCH_FLAGS= +AC_SUBST(UNIVERSAL_ARCH_FLAGS) + # tweak BASECFLAGS based on compiler and platform case $GCC in yes) @@ -865,7 +901,23 @@ # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd # used to be here, but non-Apple gcc doesn't accept them. if test "${enable_universalsdk}"; then - BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + UNIVERSAL_ARCH_FLAGS="" + if test "$UNIVERSAL_ARCHS" = "32-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" + + elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then + UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" + + elif test "$UNIVERSAL_ARCHS" = "all" ; then + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" + + else + AC_MSG_ERROR([proper usage is --with-universalarch=32-bit|64-bit|all]) + + fi + + + BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" fi ;; @@ -1558,6 +1610,12 @@ if test ${cur_target} '>' 10.2; then cur_target=10.3 fi + if test "${UNIVERSAL_ARCHS}" = "all"; then + # Ensure that the default platform for a 4-way + # universal build is OSX 10.5, that's the first + # OS release where 4-way builds make sense. + cur_target='10.5' + fi CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the @@ -1568,10 +1626,10 @@ export MACOSX_DEPLOYMENT_TARGET EXPORT_MACOSX_DEPLOYMENT_TARGET='' - if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2 + if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 then if test "${enable_universalsdk}"; then - LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" fi LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" @@ -3191,23 +3249,6 @@ # check for endianness AC_C_BIGENDIAN -AH_VERBATIM([WORDS_BIGENDIAN], -[ - /* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). - - The block below does compile-time checking for endianness on platforms - that use GCC and therefore allows compiling fat binaries on OSX by using - '-arch ppc -arch i386' as the compile flags. The phrasing was choosen - such that the configure-result is used on systems that don't use GCC. - */ -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN 1 -#else -#ifndef __LITTLE_ENDIAN__ -#undef WORDS_BIGENDIAN -#endif -#endif]) # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). Modified: python/branches/tlee-ast-optimize/pyconfig.h.in ============================================================================== --- python/branches/tlee-ast-optimize/pyconfig.h.in (original) +++ python/branches/tlee-ast-optimize/pyconfig.h.in Thu Jun 5 17:42:10 2008 @@ -489,6 +489,9 @@ /* Define if you have readline 4.2 */ #undef HAVE_RL_COMPLETION_MATCHES +/* Define when using libedit's readline emulation */ +#undef HAVE_RL_DISPM_VFUNC + /* Define if you have readline 4.0 */ #undef HAVE_RL_PRE_INPUT_HOOK @@ -973,22 +976,9 @@ /* Define to profile with the Pentium timestamp counter */ #undef WITH_TSC - - /* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). - - The block below does compile-time checking for endianness on platforms - that use GCC and therefore allows compiling fat binaries on OSX by using - '-arch ppc -arch i386' as the compile flags. The phrasing was choosen - such that the configure-result is used on systems that don't use GCC. - */ -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN 1 -#else -#ifndef __LITTLE_ENDIAN__ +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN -#endif -#endif /* Define to 1 if on AIX 3. System headers sometimes define this. @@ -1003,6 +993,9 @@ /* Define on Irix to enable u_int */ #undef _BSD_TYPES +/* Define on Darwin to activate all library features */ +#undef _DARWIN_C_SOURCE + /* This must be set to 64 on some systems to enable large file support. */ #undef _FILE_OFFSET_BITS Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Thu Jun 5 17:42:10 2008 @@ -248,6 +248,19 @@ 'WARNING: skipping import check for Carbon-based "%s"' % ext.name) return + + if self.get_platform() == 'darwin' and ( + sys.maxint > 2**32 and '-arch' in ext.extra_link_args): + # Don't bother doing an import check when an extension was + # build with an explicit '-arch' flag on OSX. That's currently + # only used to build 32-bit only extensions in a 4-way + # universal build and loading 32-bit code into a 64-bit + # process will fail. + self.announce( + 'WARNING: skipping import check for "%s"' % + ext.name) + return + # Workaround for Cygwin: Cygwin currently has fork issues when many # modules have been imported if self.get_platform() == 'cygwin': @@ -541,10 +554,12 @@ # readline do_readline = self.compiler.find_library_file(lib_dirs, 'readline') - if platform == 'darwin': + if platform == 'darwin': # and os.uname()[2] < '9.': # MacOSX 10.4 has a broken readline. Don't try to build # the readline module unless the user has installed a fixed # readline package + # FIXME: The readline emulation on 10.5 is better, but the + # readline module doesn't compile out of the box. if find_file('readline/rlconf.h', inc_dirs, []) is None: do_readline = False if do_readline: @@ -1304,11 +1319,24 @@ '_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm', '_Help', '_Icn', '_IBCarbon', '_List', '_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs', - '_Scrap', '_Snd', '_TE', '_Win', + '_Scrap', '_Snd', '_TE', ] for name in CARBON_EXTS: addMacExtension(name, carbon_kwds) + # Workaround for a bug in the version of gcc shipped with Xcode 3. + # The _Win extension should build just like the other Carbon extensions, but + # this actually results in a hard crash of the linker. + # + if '-arch ppc64' in cflags and '-arch ppc' in cflags: + win_kwds = {'extra_compile_args': carbon_extra_compile_args + ['-arch', 'i386', '-arch', 'ppc'], + 'extra_link_args': ['-framework', 'Carbon', '-arch', 'i386', '-arch', 'ppc'], + } + addMacExtension('_Win', win_kwds) + else: + addMacExtension('_Win', carbon_kwds) + + # Application Services & QuickTime app_kwds = {'extra_compile_args': carbon_extra_compile_args, 'extra_link_args': ['-framework','ApplicationServices'], @@ -1375,11 +1403,29 @@ include_dirs.append('/usr/X11R6/include') frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] + # All existing framework builds of Tcl/Tk don't support 64-bit + # architectures. + cflags = sysconfig.get_config_vars('CFLAGS')[0] + archs = re.findall('-arch\s+(\w+)', cflags) + if 'x86_64' in archs or 'ppc64' in archs: + try: + archs.remove('x86_64') + except ValueError: + pass + try: + archs.remove('ppc64') + except ValueError: + pass + + for a in archs: + frameworks.append('-arch') + frameworks.append(a) + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], define_macros=[('WITH_APPINIT', 1)], include_dirs = include_dirs, libraries = [], - extra_compile_args = frameworks, + extra_compile_args = frameworks[2:], extra_link_args = frameworks, ) self.extensions.append(ext) @@ -1510,6 +1556,7 @@ '_ctypes', 'libffi_osx')) sources = [os.path.join(ffi_srcdir, p) for p in ['ffi.c', + 'x86/darwin64.S', 'x86/x86-darwin.S', 'x86/x86-ffi_darwin.c', 'x86/x86-ffi64.c', From python-checkins at python.org Thu Jun 5 19:06:34 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 5 Jun 2008 19:06:34 +0200 (CEST) Subject: [Python-checkins] r63958 - in doctools/trunk: CHANGES sphinx/ext/autodoc.py Message-ID: <20080605170634.87AD41E400F@bag.python.org> Author: georg.brandl Date: Thu Jun 5 19:06:34 2008 New Revision: 63958 Log: #3041: fix handling of unicode docstrings. Modified: doctools/trunk/CHANGES doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Thu Jun 5 19:06:34 2008 @@ -69,6 +69,8 @@ * Fix the handling of explicit module names given to autoclass directives. They now show up with the correct module name in the generated docs. +* Enable autodoc to process Unicode docstrings. + Release 0.3 (May 6, 2008) ========================= Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Thu Jun 5 19:06:34 2008 @@ -218,7 +218,7 @@ module = getattr(todoc, '__module__', None) if module is not None: charset = get_module_charset(module) - docstrings = [docstring.decode(charset) for docstring in docstrings] + docstrings = [isinstance(d, str) and d.decode(charset) or d for d in docstrings] # add docstring content for docstring in docstrings: From python-checkins at python.org Thu Jun 5 19:21:07 2008 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 5 Jun 2008 19:21:07 +0200 (CEST) Subject: [Python-checkins] r63959 - in peps/trunk: pep-0000.txt pep-0371.txt Message-ID: <20080605172107.DF0821E4004@bag.python.org> Author: guido.van.rossum Date: Thu Jun 5 19:21:07 2008 New Revision: 63959 Log: Accept PEP 371, adding the multiprocessing package. Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Thu Jun 5 19:21:07 2008 @@ -76,6 +76,7 @@ SA 358 The "bytes" Object Schemenauer, GvR SA 370 Per user site-packages directory Heimes + SA 371 Addition of the multiprocessing package Noller, Oudkerk SA 3101 Advanced String Formatting Talin SA 3106 Revamping dict.keys(), .values() & .items() GvR SA 3108 Standard Library Reorganization Cannon @@ -97,7 +98,6 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes - S 371 Addition of the multiprocessing package Noller, Oudkerk S 3134 Exception Chaining and Embedded Tracebacks Yee S 3135 New Super Spealman, Delaney @@ -475,7 +475,7 @@ S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes SA 370 Per user site-packages directory Heimes - S 371 Addition of the multiprocessing package Noller, Oudkerk + SA 371 Addition of the multiprocessing package Noller, Oudkerk SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Thu Jun 5 19:21:07 2008 @@ -4,7 +4,7 @@ Last-Modified: $Date$ Author: Jesse Noller , Richard Oudkerk -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/plain Created: 06-May-2008 From python-checkins at python.org Thu Jun 5 19:28:44 2008 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 5 Jun 2008 19:28:44 +0200 (CEST) Subject: [Python-checkins] r63960 - peps/trunk/pep-3138.txt Message-ID: <20080605172844.CE93E1E400D@bag.python.org> Author: guido.van.rossum Date: Thu Jun 5 19:28:44 2008 New Revision: 63960 Log: New cleaned-up version from Atsuo. Modified: peps/trunk/pep-3138.txt Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Thu Jun 5 19:28:44 2008 @@ -7,7 +7,7 @@ Type: Standards Track Content-Type: text/x-rst Created: 05-May-2008 -Post-History: +Post-History: 05-May-2008, 05-Jun-2008 Abstract @@ -60,8 +60,8 @@ directory: '\u65e5\u672c\u8a9e'``, which isn't helpful. Python 3000 has a lot of nice features for non-Latin users such as -non-ASCII identifiers, so it would be helpful if Python could also -progress in a similar way for printable output. +non-ASCII identifiers, so it would be helpful if Python could also progress +in a similar way for printable output. Some users might be concerned that such output will mess up their console if they print binary data like images. But this is unlikely to @@ -79,48 +79,57 @@ Unicode character ``ch``; otherwise it returns 1. Characters that should be escaped are defined in the Unicode character database as: - * Cc (Other, Control) - * Cf (Other, Format) - * Cs (Other, Surrogate) - * Co (Other, Private Use) - * Cn (Other, Not Assigned) - * Zl (Separator, Line), refers to LINE SEPARATOR ('\\u2028'). - * Zp (Separator, Paragraph), refers to PARAGRAPH SEPARATOR ('\\u2029'). - * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in - this category should be escaped to avoid ambiguity. + * Cc (Other, Control) + * Cf (Other, Format) + * Cs (Other, Surrogate) + * Co (Other, Private Use) + * Cn (Other, Not Assigned) + * Zl (Separator, Line), refers to LINE SEPARATOR ('\\u2028'). + * Zp (Separator, Paragraph), refers to PARAGRAPH SEPARATOR ('\\u2029'). + * Zs (Separator, Space) other than ASCII space('\\x20'). Characters in + this category should be escaped to avoid ambiguity. - The algorithm to build repr() strings should be changed to: - * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. + * Convert CR, LF, TAB and '\\' to '\\r', '\\n', '\\t', '\\\\'. - * Convert non-printable ASCII characters(0x00-0x1f, 0x7f) to '\\xXX'. + * Convert non-printable ASCII characters(0x00-0x1f, 0x7f) to '\\xXX'. - * Convert leading surrogate pair characters without trailing character - (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. + * Convert leading surrogate pair characters without trailing character + (0xd800-0xdbff, but not followed by 0xdc00-0xdfff) to '\\uXXXX'. - * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) - to '\\xXX', '\\uXXXX' or '\\U00xxxxxx'. + * Convert non-printable characters(Py_UNICODE_ISPRINTABLE() returns 0) + to 'xXX', '\\uXXXX' or '\\U00xxxxxx'. - * Backslash-escape quote characters (apostrophe, 0x27) and add quote - character at the beginning and the end. + * Backslash-escape quote characters (apostrophe, 0x27) and add quote + character at the beginning and the end. - Set the Unicode error-handler for sys.stderr to 'backslashreplace' by default. +- Add a new function to the Python C API ``PyObject *PyObject_ASCII + (PyObject *o)``. This function converts any python object to a string + using PyObject_Repr() and then hex-escapes all non-ASCII characters. + ``PyObject_ASCII()`` generates the same string as ``PyObject_Repr()`` + in Python 2. + +- Add a new built-in function, ``ascii()``. This function converts any + python object to a string using repr() and then hex-escapes all non-ASCII + characters. ``ascii()`` generates the same string as ``repr()`` in + Python 2. + - Add ``'%a'`` string format operator. ``'%a'`` converts any python object to a string using repr() and then hex-escapes all non-ASCII characters. The ``'%a'`` format operator generates the same string as - ``'%r'`` in Python 2. - -- Add a new built-in function, ``ascii()``. This function converts any - python object to a string using repr() and then hex-escapes all non- - ASCII characters. ``ascii()`` generates the same string as ``repr()`` - in Python 2. + ``'%r'`` in Python 2. Also, add ``'!a'`` conversion flags to the + ``string.format()`` method and add ``'%A'`` operator to the + PyUnicode_FromFormat(). They converts any object to an ASCII string + as ``'%a'`` string format operator. - Add an ``isprintable()`` method to the string type. ``str.isprintable()`` returns False if repr() should escape any character in the string; otherwise returns True. The ``isprintable()`` method calls the - `` Py_UNICODE_ISPRINTABLE()`` function internally. + ``Py_UNICODE_ISPRINTABLE()`` function internally. Rationale @@ -136,18 +145,21 @@ Characters not supported by the user's console could be hex-escaped on printing, by the Unicode encoder's error-handler. If the error-handler -of the output file is 'backslashreplace', such characters are hex- -escaped without raising UnicodeEncodeError. For example, if your default -encoding is ASCII, ``print('Hello ?')`` will prints 'Hello \\xa2'. If +of the output file is 'backslashreplace', such characters are +hex-escaped without raising UnicodeEncodeError. For example, if your default +encoding is ASCII, ``print('Hello ?')`` will print 'Hello \\xa2'. If your encoding is ISO-8859-1, 'Hello ?' will be printed. -Default error-handler of sys.stdout is 'strict'. Other applications +The default error-handler for sys.stdout is 'strict'. Other applications reading the output might not understand hex-escaped characters, so unsupported characters should be trapped when writing. If you need to -escape unsupported characters, you should change error-handler -explicitly. For sys.stderr, default error-handler is set to -'backslashreplace' and printing exceptions or error messages won't -be failed. +escape unsupported characters, you should explicitly change the +error-handler. Unlike sys.stdout, sys.stderr doesn't raise +UnicodeEncodingError by default, because the default error-handler is +'backslashreplace'. So printing error messeges containing non-ASCII +characters to sys.stderr will not raise an exception. Also, information +about uncaught exceptions (exception object, traceback) are printed by +the interpreter without raising exceptions. Alternate Solutions ------------------- @@ -169,15 +181,15 @@ For interactive sessions, we can write hooks to restore hex escaped characters to the original characters. But these hooks are called only when printing the result of evaluating an expression entered in an - interactive Python session, and doesn't work for the print() function, - for non-interactive sessions or for logging.debug("%r", ...), etc. + interactive Python session, and doesn't work for the ``print()`` function, + for non-interactive sessions or for ``logging.debug("%r", ...)``, etc. - Subclass sys.stdout and sys.stderr. It is difficult to implement a subclass to restore hex-escaped characters since there isn't enough information left by the time it's - a string to undo the escaping correctly in all cases. For example, `` - print("\\"+"u0041")`` should be printed as '\\u0041', not 'A'. But + a string to undo the escaping correctly in all cases. For example, + ``print("\\"+"u0041")`` should be printed as '\\u0041', not 'A'. But there is no chance to tell file objects apart. - Make the encoding used by unicode_repr() adjustable, and make the @@ -199,45 +211,37 @@ need repr() strings without non-ASCII character as Python 2, you can use the following function. :: - def repr_ascii(obj): - return str(repr(obj).encode("ASCII", "backslashreplace"), "ASCII") + def repr_ascii(obj): + return str(repr(obj).encode("ASCII", "backslashreplace"), "ASCII") For logging or for debugging, the following code can raise UnicodeEncodeError. :: - log = open("logfile", "w") - log.write(repr(data)) # UnicodeEncodeError will be raised - # if data contains unsupported characters. + log = open("logfile", "w") + log.write(repr(data)) # UnicodeEncodeError will be raised + # if data contains unsupported characters. To avoid exceptions being raised, you can explicitly specify the error- handler. :: - log = open("logfile", "w", errors="backslashreplace") - log.write(repr(data)) # Unsupported characters will be escaped. + log = open("logfile", "w", errors="backslashreplace") + log.write(repr(data)) # Unsupported characters will be escaped. For a console that uses a Unicode-based encoding, for example, en_US. utf8 or de_DE.utf8, the backslashescape trick doesn't work and all printable characters are not escaped. This will cause a problem of similarly drawing characters in Western, Greek and Cyrillic languages. -These languages use similar (but different) alphabets (descended from -the common ancestor) and contain letters that look similar but have +These languages use similar (but different) alphabets (descended from a +common ancestor) and contain letters that look similar but have different character codes. For example, it is hard to distinguish Latin -'a', 'e' and 'o' from Cyrillic '\u0430', '\u0435' and '\u043e'. (The visual +'a', 'e' and 'o' from Cyrillic '?', '?' and '?'. (The visual representation, of course, very much depends on the fonts used but usually these letters are almost indistinguishable.) To avoid the problem, the user can adjust the terminal encoding to get a result suitable for their environment. -Open Issues -=========== - -- Is the ``ascii()`` function necessary, or is it sufficient to document - how to do it? If necessary, should ``ascii()`` belong to the builtin - namespace? - - Rejected Proposals ================== @@ -248,10 +252,10 @@ idea. [2]_ - Use character names to escape characters, instead of hex character - codes. For example, ``repr('\u03b1')`` can be converted to - ``"\N{GREEK SMALL LETTER ALPHA}"``. + codes. For example, ``repr('\u03b1')`` can be converted to ``"\N{GREEK + SMALL LETTER ALPHA}"``. - Using character names can be very verbose compared to hex-escape. + Using character names can be very verbose compared to hex-escape. e.g., ``repr("\ufbf9")`` is converted to ``"\N{ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM}"``. @@ -273,7 +277,7 @@ References ========== -.. [1] Multibyte string on string::string_print +.. [1] Multibyte string on string\::string_print (http://bugs.python.org/issue479898) .. [2] [Python-3000] Displaying strings containing unicode escapes From python-checkins at python.org Thu Jun 5 19:29:38 2008 From: python-checkins at python.org (thomas.heller) Date: Thu, 5 Jun 2008 19:29:38 +0200 (CEST) Subject: [Python-checkins] r63961 - python/trunk/Include/Python.h Message-ID: <20080605172938.7A4211E400C@bag.python.org> Author: thomas.heller Date: Thu Jun 5 19:29:38 2008 New Revision: 63961 Log: Fix preprocessor statement. Modified: python/trunk/Include/Python.h Modified: python/trunk/Include/Python.h ============================================================================== --- python/trunk/Include/Python.h (original) +++ python/trunk/Include/Python.h Thu Jun 5 19:29:38 2008 @@ -1,4 +1,5 @@ -#ifndef Py_PYTHON_H #define Py_PYTHON_H +#ifndef Py_PYTHON_H +#define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ From python-checkins at python.org Thu Jun 5 19:51:16 2008 From: python-checkins at python.org (thomas.heller) Date: Thu, 5 Jun 2008 19:51:16 +0200 (CEST) Subject: [Python-checkins] r63962 - in python/trunk: Lib/ctypes/test/test_pep3118.py Modules/_ctypes/_ctypes.c Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Modules/_ctypes/stgdict.c Message-ID: <20080605175116.472AE1E4004@bag.python.org> Author: thomas.heller Date: Thu Jun 5 19:51:15 2008 New Revision: 63962 Log: Backport from py3k: Implement the new buffer interface from pep3118 for ctypes instances. Closes issue #2404. Added: python/trunk/Lib/ctypes/test/test_pep3118.py (contents, props changed) Modified: python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/ctypes.h python/trunk/Modules/_ctypes/stgdict.c Added: python/trunk/Lib/ctypes/test/test_pep3118.py ============================================================================== --- (empty file) +++ python/trunk/Lib/ctypes/test/test_pep3118.py Thu Jun 5 19:51:15 2008 @@ -0,0 +1,191 @@ +import unittest +from ctypes import * +import re, struct, sys + +if sys.byteorder == "little": + THIS_ENDIAN = "<" + OTHER_ENDIAN = ">" +else: + THIS_ENDIAN = ">" + OTHER_ENDIAN = "<" + +class memoryview(object): + # This class creates a memoryview - like object from data returned + # by the private _ctypes._buffer_info() function, just enough for + # these tests. + # + # It can be removed when the py3k memoryview object is backported. + def __init__(self, ob): + from _ctypes import _buffer_info + self.format, self.ndim, self.shape = _buffer_info(ob) + if self.shape == (): + self.shape = None + self.itemsize = sizeof(ob) + else: + size = sizeof(ob) + for dim in self.shape: + size /= dim + self.itemsize = size + self.strides = None + self.readonly = False + self.size = sizeof(ob) + +def normalize(format): + # Remove current endian specifier and white space from a format + # string + format = format.replace(OTHER_ENDIAN, THIS_ENDIAN) + return re.sub(r"\s", "", format) + +class Test(unittest.TestCase): + + def test_native_types(self): + for tp, fmt, shape, itemtp in native_types: + ob = tp() + v = memoryview(ob) + try: + self.failUnlessEqual(normalize(v.format), normalize(fmt)) + self.failUnlessEqual(v.size, sizeof(ob)) + self.failUnlessEqual(v.itemsize, sizeof(itemtp)) + self.failUnlessEqual(v.shape, shape) + # ctypes object always have a non-strided memory block + self.failUnlessEqual(v.strides, None) + # they are always read/write + self.failIf(v.readonly) + + if v.shape: + n = 1 + for dim in v.shape: + n = n * dim + self.failUnlessEqual(v.itemsize * n, v.size) + except: + # so that we can see the failing type + print(tp) + raise + + def test_endian_types(self): + for tp, fmt, shape, itemtp in endian_types: + ob = tp() + v = memoryview(ob) + try: + self.failUnlessEqual(v.format, fmt) + self.failUnlessEqual(v.size, sizeof(ob)) + self.failUnlessEqual(v.itemsize, sizeof(itemtp)) + self.failUnlessEqual(v.shape, shape) + # ctypes object always have a non-strided memory block + self.failUnlessEqual(v.strides, None) + # they are always read/write + self.failIf(v.readonly) + + if v.shape: + n = 1 + for dim in v.shape: + n = n * dim + self.failUnlessEqual(v.itemsize * n, v.size) + except: + # so that we can see the failing type + print(tp) + raise + +# define some structure classes + +class Point(Structure): + _fields_ = [("x", c_long), ("y", c_long)] + +class PackedPoint(Structure): + _pack_ = 2 + _fields_ = [("x", c_long), ("y", c_long)] + +class Point2(Structure): + pass +Point2._fields_ = [("x", c_long), ("y", c_long)] + +class EmptyStruct(Structure): + _fields_ = [] + +class aUnion(Union): + _fields_ = [("a", c_int)] + +################################################################ +# +# This table contains format strings as they look on little endian +# machines. The test replaces '<' with '>' on big endian machines. +# +native_types = [ + # type format shape calc itemsize + + ## simple types + + (c_char, "l:x:>l:y:}", None, BEPoint), + (LEPoint, "T{l:x:>l:y:}", None, POINTER(BEPoint)), + (POINTER(LEPoint), "&T{format = alloc_format_string("&", itemdict->format); + if (stgdict->format == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + } + /* create the new instance (which is a class, since we are a metatype!) */ result = (PyTypeObject *)PyType_Type.tp_new(type, args, kwds); @@ -1244,9 +1284,10 @@ StgDictObject *itemdict; PyObject *proto; PyObject *typedict; - int length; + long length; Py_ssize_t itemsize, itemalign; + char buf[32]; typedict = PyTuple_GetItem(args, 2); if (!typedict) @@ -1281,6 +1322,28 @@ return NULL; } + assert(itemdict->format); + if (itemdict->format[0] == '(') { + sprintf(buf, "(%ld,", length); + stgdict->format = alloc_format_string(buf, itemdict->format+1); + } else { + sprintf(buf, "(%ld)", length); + stgdict->format = alloc_format_string(buf, itemdict->format); + } + if (stgdict->format == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + stgdict->ndim = itemdict->ndim + 1; + stgdict->shape = PyMem_Malloc(sizeof(Py_ssize_t *) * stgdict->ndim); + if (stgdict->shape == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + stgdict->shape[0] = length; + memmove(&stgdict->shape[1], itemdict->shape, + sizeof(Py_ssize_t) * (stgdict->ndim - 1)); + itemsize = itemdict->size; if (length * itemsize < 0) { PyErr_SetString(PyExc_OverflowError, @@ -1768,6 +1831,8 @@ PyTypeObject *result; StgDictObject *stgdict; PyObject *proto; + const char *proto_str; + Py_ssize_t proto_len; PyMethodDef *ml; struct fielddesc *fmt; @@ -1778,17 +1843,34 @@ return NULL; proto = PyObject_GetAttrString((PyObject *)result, "_type_"); /* new ref */ - if (!proto - || !PyBytes_Check(proto) - || 1 != strlen(PyBytes_AS_STRING(proto)) - || !strchr(SIMPLE_TYPE_CHARS, PyBytes_AS_STRING(proto)[0])) { + if (!proto) { + PyErr_SetString(PyExc_AttributeError, + "class must define a '_type_' attribute"); + error: + Py_XDECREF(proto); + Py_XDECREF(result); + return NULL; + } + if (PyString_Check(proto)) { + proto_str = PyBytes_AS_STRING(proto); + proto_len = PyBytes_GET_SIZE(proto); + } else { + PyErr_SetString(PyExc_TypeError, + "class must define a '_type_' string attribute"); + goto error; + } + if (proto_len != 1) { + PyErr_SetString(PyExc_ValueError, + "class must define a '_type_' attribute " + "which must be a string of length 1"); + goto error; + } + if (!strchr(SIMPLE_TYPE_CHARS, *proto_str)) { PyErr_Format(PyExc_AttributeError, "class must define a '_type_' attribute which must be\n" "a single character string containing one of '%s'.", SIMPLE_TYPE_CHARS); - Py_XDECREF(proto); - Py_DECREF(result); - return NULL; + goto error; } fmt = getentry(PyBytes_AS_STRING(proto)); if (fmt == NULL) { @@ -1810,6 +1892,16 @@ stgdict->size = fmt->pffi_type->size; stgdict->setfunc = fmt->setfunc; stgdict->getfunc = fmt->getfunc; +#ifdef WORDS_BIGENDIAN + stgdict->format = alloc_format_string(">", proto_str); +#else + stgdict->format = alloc_format_string("<", proto_str); +#endif + if (stgdict->format == NULL) { + Py_DECREF(result); + Py_DECREF((PyObject *)stgdict); + return NULL; + } stgdict->paramfunc = SimpleType_paramfunc; /* @@ -1895,22 +1987,32 @@ if (type == &SimpleType_Type && fmt->setfunc_swapped && fmt->getfunc_swapped) { PyObject *swapped = CreateSwappedType(type, args, kwds, proto, fmt); + StgDictObject *sw_dict; if (swapped == NULL) { Py_DECREF(result); return NULL; } + sw_dict = PyType_stgdict(swapped); #ifdef WORDS_BIGENDIAN PyObject_SetAttrString((PyObject *)result, "__ctype_le__", swapped); PyObject_SetAttrString((PyObject *)result, "__ctype_be__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_be__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_le__", swapped); + /* We are creating the type for the OTHER endian */ + sw_dict->format = alloc_format_string("<", stgdict->format+1); #else PyObject_SetAttrString((PyObject *)result, "__ctype_be__", swapped); PyObject_SetAttrString((PyObject *)result, "__ctype_le__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_le__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_be__", swapped); + /* We are creating the type for the OTHER endian */ + sw_dict->format = alloc_format_string(">", stgdict->format+1); #endif Py_DECREF(swapped); + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } }; return (PyObject *)result; @@ -2166,6 +2268,13 @@ return NULL; stgdict->paramfunc = CFuncPtrType_paramfunc; + /* We do NOT expose the function signature in the format string. It + is impossible, generally, because the only requirement for the + argtypes items is that they have a .from_param method - we do not + know the types of the arguments (although, in practice, most + argtypes would be a ctypes type). + */ + stgdict->format = alloc_format_string(NULL, "X{}"); stgdict->flags |= TYPEFLAG_ISPOINTER; /* create the new instance (which is a class, @@ -2386,15 +2495,34 @@ { NULL }, }; -static Py_ssize_t CData_GetBuffer(PyObject *_self, Py_ssize_t seg, void **pptr) +static int CData_NewGetBuffer(PyObject *_self, Py_buffer *view, int flags) { CDataObject *self = (CDataObject *)_self; - if (seg != 0) { - /* Hm. Must this set an exception? */ + StgDictObject *dict = PyObject_stgdict(_self); + Py_ssize_t i; + + if (view == NULL) return 0; + if (((flags & PyBUF_LOCK) == PyBUF_LOCK)) { + PyErr_SetString(PyExc_BufferError, + "Cannot lock this object."); return -1; } - *pptr = self->b_ptr; - return self->b_size; + + view->buf = self->b_ptr; + view->len = self->b_size; + view->readonly = 0; + /* use default format character if not set */ + view->format = dict->format ? dict->format : "B"; + view->ndim = dict->ndim; + view->shape = dict->shape; + view->itemsize = self->b_size; + for (i = 0; i < view->ndim; ++i) { + view->itemsize /= dict->shape[i]; + } + view->strides = NULL; + view->suboffsets = NULL; + view->internal = NULL; + return 0; } static Py_ssize_t CData_GetSegcount(PyObject *_self, Py_ssize_t *lenp) @@ -2404,11 +2532,24 @@ return 1; } +static Py_ssize_t CData_GetBuffer(PyObject *_self, Py_ssize_t seg, void **pptr) +{ + CDataObject *self = (CDataObject *)_self; + if (seg != 0) { + /* Hm. Must this set an exception? */ + return -1; + } + *pptr = self->b_ptr; + return self->b_size; +} + static PyBufferProcs CData_as_buffer = { - CData_GetBuffer, - CData_GetBuffer, - CData_GetSegcount, - NULL, + (readbufferproc)CData_GetBuffer, + (writebufferproc)CData_GetBuffer, + (segcountproc)CData_GetSegcount, + (charbufferproc)NULL, + (getbufferproc)CData_NewGetBuffer, + (releasebufferproc)NULL, }; /* @@ -2497,7 +2638,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -3824,7 +3965,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Function Pointer", /* tp_doc */ (traverseproc)CFuncPtr_traverse, /* tp_traverse */ (inquiry)CFuncPtr_clear, /* tp_clear */ @@ -3967,7 +4108,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Structure base class", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4009,7 +4150,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Union base class", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4406,7 +4547,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4643,7 +4784,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -5043,7 +5184,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Thu Jun 5 19:51:15 2008 @@ -1666,10 +1666,37 @@ return result; } +static PyObject * +buffer_info(PyObject *self, PyObject *arg) +{ + StgDictObject *dict = PyType_stgdict(arg); + PyObject *shape; + Py_ssize_t i; + + if (dict == NULL) + dict = PyObject_stgdict(arg); + if (dict == NULL) { + PyErr_SetString(PyExc_TypeError, + "not a ctypes type or object"); + return NULL; + } + shape = PyTuple_New(dict->ndim); + for (i = 0; i < (int)dict->ndim; ++i) + PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i])); + + if (PyErr_Occurred()) { + Py_DECREF(shape); + return NULL; + } + return Py_BuildValue("siN", dict->format, dict->ndim, shape); +} + PyMethodDef module_methods[] = { {"POINTER", POINTER, METH_O }, {"pointer", pointer, METH_O }, {"_unpickle", unpickle, METH_VARARGS }, + {"_buffer_info", buffer_info, METH_O, + "Return buffer interface information (for testing only)"}, {"resize", resize, METH_VARARGS, "Resize the memory buffer of a ctypes instance"}, #ifdef CTYPES_UNICODE {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, Modified: python/trunk/Modules/_ctypes/ctypes.h ============================================================================== --- python/trunk/Modules/_ctypes/ctypes.h (original) +++ python/trunk/Modules/_ctypes/ctypes.h Thu Jun 5 19:51:15 2008 @@ -235,6 +235,14 @@ PyObject *restype; /* CDataObject or NULL */ PyObject *checker; int flags; /* calling convention and such */ + + /* pep3118 fields, pointers neeed PyMem_Free */ + char *format; + int ndim; + Py_ssize_t *shape; +/* Py_ssize_t *strides; */ /* unused in ctypes */ +/* Py_ssize_t *suboffsets; */ /* unused in ctypes */ + } StgDictObject; /**************************************************************** @@ -415,6 +423,7 @@ extern void _AddTraceback(char *, char *, int); extern PyObject *CData_FromBaseObj(PyObject *type, PyObject *base, Py_ssize_t index, char *adr); +extern char *alloc_format_string(const char *prefix, const char *suffix); /* XXX better name needed! */ extern int IsSimpleSubType(PyObject *obj); Modified: python/trunk/Modules/_ctypes/stgdict.c ============================================================================== --- python/trunk/Modules/_ctypes/stgdict.c (original) +++ python/trunk/Modules/_ctypes/stgdict.c Thu Jun 5 19:51:15 2008 @@ -6,6 +6,7 @@ #include #ifdef MS_WIN32 #include +#include #endif #include "ctypes.h" @@ -24,6 +25,9 @@ { if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0) return -1; + self->format = NULL; + self->ndim = 0; + self->shape = NULL; return 0; } @@ -42,6 +46,8 @@ StgDict_dealloc(StgDictObject *self) { StgDict_clear(self); + PyMem_Free(self->format); + PyMem_Free(self->shape); PyMem_Free(self->ffi_type_pointer.elements); PyDict_Type.tp_dealloc((PyObject *)self); } @@ -54,6 +60,10 @@ StgDict_clear(dst); PyMem_Free(dst->ffi_type_pointer.elements); + PyMem_Free(dst->format); + dst->format = NULL; + PyMem_Free(dst->shape); + dst->shape = NULL; dst->ffi_type_pointer.elements = NULL; d = (char *)dst; @@ -68,6 +78,20 @@ Py_XINCREF(dst->restype); Py_XINCREF(dst->checker); + if (src->format) { + dst->format = PyMem_Malloc(strlen(src->format) + 1); + if (dst->format == NULL) + return -1; + strcpy(dst->format, src->format); + } + if (src->shape) { + dst->shape = PyMem_Malloc(sizeof(Py_ssize_t) * src->ndim); + if (dst->shape == NULL) + return -1; + memcpy(dst->shape, src->shape, + sizeof(Py_ssize_t) * src->ndim); + } + if (src->ffi_type_pointer.elements == NULL) return 0; size = sizeof(ffi_type *) * (src->length + 1); @@ -349,6 +373,11 @@ return -1; } + if (stgdict->format) { + PyMem_Free(stgdict->format); + stgdict->format = NULL; + } + if (stgdict->ffi_type_pointer.elements) PyMem_Free(stgdict->ffi_type_pointer.elements); @@ -387,6 +416,15 @@ ffi_ofs = 0; } + if (isStruct && !isPacked) { + stgdict->format = alloc_format_string(NULL, "T{"); + } else { + /* PEP3118 doesn't support union, or packed structures (well, + only standard packing, but we dont support the pep for + that). Use 'B' for bytes. */ + stgdict->format = alloc_format_string(NULL, "B"); + } + #define realdict ((PyObject *)&stgdict->dict) for (i = 0; i < len; ++i) { PyObject *name = NULL, *desc = NULL; @@ -451,6 +489,24 @@ } } else bitsize = 0; + if (isStruct && !isPacked) { + char *fieldfmt = dict->format ? dict->format : "B"; + char *fieldname = PyString_AsString(name); + char *ptr; + Py_ssize_t len = strlen(fieldname) + strlen(fieldfmt); + char *buf = alloca(len + 2 + 1); + + sprintf(buf, "%s:%s:", fieldfmt, fieldname); + + ptr = stgdict->format; + stgdict->format = alloc_format_string(stgdict->format, buf); + PyMem_Free(ptr); + + if (stgdict->format == NULL) { + Py_DECREF(pair); + return -1; + } + } if (isStruct) { prop = CField_FromDesc(desc, i, &field_size, bitsize, &bitofs, @@ -481,6 +537,13 @@ Py_DECREF(prop); } #undef realdict + + if (isStruct && !isPacked) { + stgdict->format = alloc_format_string(stgdict->format, "}"); + if (stgdict->format == NULL) + return -1; + } + if (!isStruct) size = union_size; From python-checkins at python.org Thu Jun 5 19:53:00 2008 From: python-checkins at python.org (thomas.heller) Date: Thu, 5 Jun 2008 19:53:00 +0200 (CEST) Subject: [Python-checkins] r63963 - python/trunk/Misc/NEWS Message-ID: <20080605175300.3CB351E4004@bag.python.org> Author: thomas.heller Date: Thu Jun 5 19:52:59 2008 New Revision: 63963 Log: Backport from py3k: Implement the new buffer interface from pep3118 for ctypes instances. Closes issue #2404. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 5 19:52:59 2008 @@ -72,6 +72,8 @@ Library ------- +- Issue #2404: ctypes objects support the new pep3118 buffer interface + - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. From python-checkins at python.org Fri Jun 6 00:39:34 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 6 Jun 2008 00:39:34 +0200 (CEST) Subject: [Python-checkins] r63965 - python/trunk/Lib/tokenize.py Message-ID: <20080605223934.EC04E1E4004@bag.python.org> Author: benjamin.peterson Date: Fri Jun 6 00:39:34 2008 New Revision: 63965 Log: use the more idomatic while True Modified: python/trunk/Lib/tokenize.py Modified: python/trunk/Lib/tokenize.py ============================================================================== --- python/trunk/Lib/tokenize.py (original) +++ python/trunk/Lib/tokenize.py Fri Jun 6 00:39:34 2008 @@ -281,7 +281,7 @@ contline = None indents = [0] - while 1: # loop over lines in stream + while True: # loop over lines in stream try: line = readline() except StopIteration: From python at rcn.com Fri Jun 6 00:52:05 2008 From: python at rcn.com (Raymond Hettinger) Date: Thu, 5 Jun 2008 15:52:05 -0700 Subject: [Python-checkins] r63965 - python/trunk/Lib/tokenize.py References: <20080605223934.EC04E1E4004@bag.python.org> Message-ID: <3AB916E21C864CA39F033302C6FE4B7C@RaymondLaptop1> These were intentionly left as "while 1" in Py2.6 because it compiles differently than "while True" and is much slower. In Py3.0, the True can be optimized away. Raymond > Log: > use the more idomatic while True > > > Modified: > python/trunk/Lib/tokenize.py > > Modified: python/trunk/Lib/tokenize.py > ============================================================================== > --- python/trunk/Lib/tokenize.py (original) > +++ python/trunk/Lib/tokenize.py Fri Jun 6 00:39:34 2008 > @@ -281,7 +281,7 @@ > contline = None > indents = [0] > > - while 1: # loop over lines in stream > + while True: # loop over lines in stream > try: > line = readline() > except StopIteration: > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins From musiccomposition at gmail.com Fri Jun 6 00:54:20 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Thu, 5 Jun 2008 17:54:20 -0500 Subject: [Python-checkins] r63965 - python/trunk/Lib/tokenize.py In-Reply-To: <3AB916E21C864CA39F033302C6FE4B7C@RaymondLaptop1> References: <20080605223934.EC04E1E4004@bag.python.org> <3AB916E21C864CA39F033302C6FE4B7C@RaymondLaptop1> Message-ID: <1afaf6160806051554o1c6254c4h4fd3c0501aab2a91@mail.gmail.com> On Thu, Jun 5, 2008 at 5:52 PM, Raymond Hettinger wrote: > These were intentionly left as "while 1" in Py2.6 because it compiles > differently than "while True" and is much slower. > In Py3.0, the True can be optimized away. Thanks for letting me know. It's still using while 1 in 3.0. Shall I revert the 2.6 revision, and change it in 3.0? -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." From buildbot at python.org Fri Jun 6 00:55:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 22:55:22 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080605225522.9979E1E4005@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1438 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 01:02:33 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 6 Jun 2008 01:02:33 +0200 (CEST) Subject: [Python-checkins] r63967 - python/trunk/Lib/tokenize.py Message-ID: <20080605230233.9AFCD1E4004@bag.python.org> Author: benjamin.peterson Date: Fri Jun 6 01:02:33 2008 New Revision: 63967 Log: revert 63965 for preformance reasons Modified: python/trunk/Lib/tokenize.py Modified: python/trunk/Lib/tokenize.py ============================================================================== --- python/trunk/Lib/tokenize.py (original) +++ python/trunk/Lib/tokenize.py Fri Jun 6 01:02:33 2008 @@ -281,7 +281,7 @@ contline = None indents = [0] - while True: # loop over lines in stream + while 1: # loop over lines in stream try: line = readline() except StopIteration: From python-checkins at python.org Fri Jun 6 01:12:33 2008 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 6 Jun 2008 01:12:33 +0200 (CEST) Subject: [Python-checkins] r63969 - peps/trunk/pep-3141.txt Message-ID: <20080605231233.7BF0B1E4004@bag.python.org> Author: raymond.hettinger Date: Fri Jun 6 01:12:33 2008 New Revision: 63969 Log: Update the PEP to reflect that Exact and Inexact were dropped shortly after Pycon. Modified: peps/trunk/pep-3141.txt Modified: peps/trunk/pep-3141.txt ============================================================================== --- peps/trunk/pep-3141.txt (original) +++ peps/trunk/pep-3141.txt Fri Jun 6 01:12:33 2008 @@ -16,10 +16,8 @@ This proposal defines a hierarchy of Abstract Base Classes (ABCs) (PEP 3119) to represent number-like classes. It proposes a hierarchy of ``Number :> Complex :> Real :> Rational :> Integral`` where ``A :> B`` -means "A is a supertype of B", and a pair of ``Exact``/``Inexact`` -classes to capture the difference between ``floats`` and -``ints``. These types are significantly inspired by Scheme's numeric -tower [#schemetower]_. +means "A is a supertype of B". The hierarchy is inspired by Scheme's +numeric tower [#schemetower]_. Rationale ========= @@ -394,25 +392,6 @@ return 1 -Exact vs. Inexact Classes -------------------------- - -Floating point values may not exactly obey several of the properties -you would expect. For example, it is possible for ``(X + -X) + 3 == -3``, but ``X + (-X + 3) == 0``. On the range of values that most -functions deal with this isn't a problem, but it is something to be -aware of. - -Therefore, we define ``Exact`` and ``Inexact`` ABCs to mark whether -types have this problem. Every instance of ``Integral`` and -``Rational`` should be Exact, but ``Reals`` and ``Complexes`` may or -may not be. (Do we really only need one of these, and the other is -defined as ``not`` the first?) :: - - class Exact(Number): pass - class Inexact(Number): pass - - Changes to operations and __magic__ methods ------------------------------------------- From buildbot at python.org Fri Jun 6 01:25:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 23:25:40 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian trunk Message-ID: <20080605232540.8CC3B1E4004@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%20trunk/builds/1016 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 01:33:55 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Jun 2008 01:33:55 +0200 (CEST) Subject: [Python-checkins] r63970 - python/trunk/Doc/library/logging.rst Message-ID: <20080605233355.AA6321E4008@bag.python.org> Author: andrew.kuchling Date: Fri Jun 6 01:33:54 2008 New Revision: 63970 Log: Document 'utc' parameter Modified: python/trunk/Doc/library/logging.rst Modified: python/trunk/Doc/library/logging.rst ============================================================================== --- python/trunk/Doc/library/logging.rst (original) +++ python/trunk/Doc/library/logging.rst Fri Jun 6 01:33:54 2008 @@ -1645,7 +1645,7 @@ timed intervals. -.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay]]]]]) +.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay[, utc]]]]]]) Returns a new instance of the :class:`TimedRotatingFileHandler` class. The specified file is opened and used as the stream for logging. On rotating it also @@ -1653,7 +1653,7 @@ *interval*. You can use the *when* to specify the type of *interval*. The list of possible - values is, note that they are not case sensitive: + values is below. Note that they are not case sensitive. : +----------------+-----------------------+ | Value | Type of interval | @@ -1674,7 +1674,11 @@ The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the - rollover interval. If *backupCount* is nonzero, at most *backupCount* files + rollover interval. + If the 'utc' argument was true, times in UTC will be used; otherwise + local time is used. + + If *backupCount* is nonzero, at most *backupCount* files will be kept, and if more would be created when rollover occurs, the oldest one is deleted. The deletion logic uses the interval to determine which files to delete, so changing the interval may leave old files lying around. From buildbot at python.org Fri Jun 6 01:34:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 05 Jun 2008 23:34:22 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080605233422.CD2E01E4004@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/303 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 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_email test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 01:35:31 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Jun 2008 01:35:31 +0200 (CEST) Subject: [Python-checkins] r63971 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080605233531.EBE731E4004@bag.python.org> Author: andrew.kuchling Date: Fri Jun 6 01:35:31 2008 New Revision: 63971 Log: Add various items Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Fri Jun 6 01:35:31 2008 @@ -647,6 +647,7 @@ >>> format(75.6564, '.2f') '75.66' + .. seealso:: :ref:`formatstrings` @@ -1251,6 +1252,11 @@ (Contributed by Alexander Belopolsky; :issue:`1686487`.) +* A new built-in, ``next(*iterator*, [*default*])`` returns the next item + from the specified iterator. If the *default* argument is supplied, + it will be returned if *iterator* has been exhausted; otherwise, + the :exc:`StopIteration` exception will be raised. (:issue:`2719`) + * Tuples now have an :meth:`index` method matching the list type's :meth:`index` method:: @@ -1554,6 +1560,7 @@ :mod:`terminalcommand`. A number of old IRIX-specific modules were deprecated: + :mod:`al` and :mod:`AL`, :mod:`cd`, :mod:`cddb`, :mod:`cdplayer`, @@ -1734,6 +1741,13 @@ to drop the built-in in the 2.x series. (Patched by Christian Heimes; :issue:`1739906`.) +* When possible, the :mod:`getpass` module will now use + :file:`/dev/tty` (when available) to print + a prompting message and read the password, falling back to using + standard error and standard input. If the password may be echoed to + the terminal, a warning is printed before the prompt is displayed. + (Contributed by Gregory P. Smith.) + * The :func:`glob.glob` function can now return Unicode filenames if a Unicode path was used and Unicode filenames are matched within the directory. (:issue:`1001604`) @@ -1753,6 +1767,10 @@ This is more efficient than making a call to :func:`heappush` and then :func:`heappop`. + :mod:`heapq` is now implemented to only use less-than comparison, + instead of the less-than-or-equal comparison it previously used. + This makes :mod:`heapq`'s usage of a type match that of the + :meth:`list.sort` method. (Contributed by Raymond Hettinger.) * An optional ``timeout`` parameter was added to the @@ -1847,6 +1865,11 @@ is true, opening of the log file is deferred until the first :meth:`emit` call is made. (Contributed by Vinay Sajip.) + :class:`TimedRotatingFileHandler` also has a *utc* constructor + parameter. If the argument is true, UTC time will be used + in determining when midnight occurs and in generating filenames; + otherwise local time will be used. + * The :mod:`macfs` module has been removed. This in turn required the :func:`macostools.touched` function to be removed because it depended on the :mod:`macfs` module. (:issue:`1490190`) @@ -2114,12 +2137,20 @@ (Contributed by Neal Norwitz and Georg Brandl.) Information about the command-line arguments supplied to the Python - interpreter are available as attributes of a ``sys.flags`` named - tuple. For example, the :attr:`verbose` attribute is true if Python + interpreter is available by reading attributes of a named + tuple available as ``sys.flags``. For example, the :attr:`verbose` + attribute is true if Python was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. These attributes are all read-only. (Contributed by Christian Heimes.) + A new function, :func:`getsizeof`, takes a Python object and returns + the amount of memory used by the object, measured in bytes. Built-in + objects return correct results; third-party extensions may not, + but can define a :meth:`__sizeof__` method to return the + object's size. + (Contributed by Robert Schuppenies; :issue:`2898`.) + It's now possible to determine the current profiler and tracer functions by calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by Georg Brandl; :issue:`1648`.) @@ -2205,6 +2236,10 @@ (Contributed by Dwayne Bailey; :issue:`1581073`.) +* The :mod:`threading` module's :class:`Thread` objects + gained a :meth:`getIdent` method that returns the thread's + identifier, a nonzero integer. (Contributed by XXX; :issue:`2871`.) + * The :mod:`timeit` module now accepts callables as well as strings for the statement being timed and for the setup code. Two convenience functions were added for creating @@ -2214,6 +2249,24 @@ the corresponding method. (Contributed by Erik Demaine; :issue:`1533909`.) +* The :mod:`turtle` module for turtle graphics was greatly enhanced by + Gregor Lingl. New features in the module include: + + * Better animation of turtle movement and rotation. + * Control over turtle movement using the new delay(), + tracer(), and speed() methods. + * The ability to set new shapes for the turtle, and to + define a new coordinate system. + * Turtles now have an undo() method that can roll back actions. + * Simple support for reacting to input events such as mouse and keyboard + activity, making it possible to write simple games. + * A :file:`turtle.cfg` file can be used to customize the starting appearance + of the turtle's screen. + * The module's docstrings can be replaced by new docstrings that have been + translated into another language. + + (:issue:`1513695`) + * An optional ``timeout`` parameter was added to the :func:`urllib.urlopen` function and the :class:`urllib.ftpwrapper` class constructor, as well as the @@ -2256,8 +2309,10 @@ not necessarily correct for all applications. Code using :mod:`xmlrpclib` should convert :class:`date` and :class:`time` instances. (:issue:`1330538`) The code can also handle - dates before 1900. (Contributed by Ralf Schmitt; :issue:`2014`.) - + dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) + and 64-bit integers represented by using ```` in XML-RPC responses + (contributed by XXX; :issue:`2985`). + * The :mod:`zipfile` module's :class:`ZipFile` class now has :meth:`extract` and :meth:`extractall` methods that will unpack a single file or all the files in the archive to the current directory, or @@ -2273,9 +2328,14 @@ (Contributed by Alan McIntyre; :issue:`467924`.) - Also, :mod:`zipfile` now supports using Unicode filenames - for archived files. (Contributed by Alexey Borzenkov; :issue:`1734346`.) + The :meth:`open`, :meth:`read` and :meth:`extract` methods can now + take either a filename or a :class:`ZipInfo` object. This is useful when an + archive accidentally contains a duplicated filename. + (Contributed by Graham Horler; :issue:`1775025`.) + Finally, :mod:`zipfile` now supports using Unicode filenames + for archived files. (Contributed by Alexey Borzenkov; :issue:`1734346`.) + .. ====================================================================== .. whole new modules get described in subsections here @@ -2470,10 +2530,8 @@ results, and then compiles using these results for optimization. (Contributed by Gregory P. Smith.) - .. ====================================================================== - Port-Specific Changes: Windows ----------------------------------- @@ -2518,6 +2576,16 @@ .. ====================================================================== +Port-Specific Changes: MacOS X +----------------------------------- + +* When compiling a framework build of Python, you can now specify the + framework name to be used by providing the + :option:`--with-framework-name=` option to the + :program:`configure` script. + +.. ====================================================================== + .. _section-other: From python-checkins at python.org Fri Jun 6 01:35:48 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 6 Jun 2008 01:35:48 +0200 (CEST) Subject: [Python-checkins] r63972 - python/trunk/Doc/whatsnew/2.5.rst Message-ID: <20080605233548.EF6D91E4004@bag.python.org> Author: andrew.kuchling Date: Fri Jun 6 01:35:48 2008 New Revision: 63972 Log: Grammar fix Modified: python/trunk/Doc/whatsnew/2.5.rst Modified: python/trunk/Doc/whatsnew/2.5.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.5.rst (original) +++ python/trunk/Doc/whatsnew/2.5.rst Fri Jun 6 01:35:48 2008 @@ -2205,10 +2205,10 @@ * MacOS X (10.3 and higher): dynamic loading of modules now uses the :cfunc:`dlopen` function instead of MacOS-specific functions. -* MacOS X: a :option:`--enable-universalsdk` switch was added to the +* MacOS X: an :option:`--enable-universalsdk` switch was added to the :program:`configure` script that compiles the interpreter as a universal binary able to run on both PowerPC and Intel processors. (Contributed by Ronald - Oussoren.) + Oussoren; :issue:`2573`.) * Windows: :file:`.dll` is no longer supported as a filename extension for extension modules. :file:`.pyd` is now the only filename extension that will be From buildbot at python.org Fri Jun 6 02:10:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 00:10:42 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080606001042.E0F5F1E4013@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/999 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jun 6 02:49:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 00:49:56 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080606004957.19CDE1E4004@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1030 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_builtin make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 04:20:48 2008 From: python-checkins at python.org (david.goodger) Date: Fri, 6 Jun 2008 04:20:48 +0200 (CEST) Subject: [Python-checkins] r63974 - peps/trunk/pep-0371.txt Message-ID: <20080606022048.DC4A91E400E@bag.python.org> Author: david.goodger Date: Fri Jun 6 04:20:47 2008 New Revision: 63974 Log: update from PEP authors Modified: peps/trunk/pep-0371.txt Modified: peps/trunk/pep-0371.txt ============================================================================== --- peps/trunk/pep-0371.txt (original) +++ peps/trunk/pep-0371.txt Fri Jun 6 04:20:47 2008 @@ -18,9 +18,9 @@ into the Python standard library, renamed to "multiprocessing". The processing package mimics the standard library threading - module and API to provide a process-based approach to "threaded - programming" allowing end-users to dispatch multiple tasks that - effectively side-step the global interpreter lock. + module functionality to provide a process-based approach to + threaded programming allowing end-users to dispatch multiple + tasks that effectively side-step the global interpreter lock. The package also provides server and client functionality (processing.Manager) to provide remote sharing and management of @@ -45,23 +45,23 @@ The GIL itself prevents more than a single thread from running within the interpreter at any given point in time, effectively removing Python's ability to take advantage of multi-processor - systems. While I/O bound applications do not suffer the same - slow-down when using threading, they do suffer some performance - cost due to the GIL. + systems. - The pyProcessing package offers a method to side-step the GIL + The pyprocessing package offers a method to side-step the GIL allowing applications within CPython to take advantage of multi-core architectures without asking users to completely change their programming paradigm (i.e.: dropping threaded programming - for another "concurrent" approach - Twisted, etc). + for another "concurrent" approach - Twisted, Actors, etc). + + The Processing package offers CPython a "known API" which mirrors + albeit in a PEP 8 compliant manner, that of the threading API, + with known semantics and easy scalability. - The Processing package offers CPython users a known API (that of - the threading module), with known semantics and easy-scalability. In the future, the package might not be as relevant should the CPython interpreter enable "true" threading, however for some applications, forking an OS process may sometimes be more desirable than using lightweight threads, especially on those - platforms where process creation is fast/optimized. + platforms where process creation is fast and optimized. For example, a simple threaded application: @@ -74,13 +74,17 @@ t.start() t.join() - The pyprocessing package mirrors the API so well, that with a + The pyprocessing package mirrored the API so well, that with a simple change of the import to: - from processing import Process as worker + from processing import process as worker + + The code would now execute through the processing.process class. + Obviously, with the renaming of the API to PEP 8 compliance there + would be additional renaming which would need to occur within + user applications, however minor. - The code now executes through the processing.Process class. This - type of compatibility means that, with a minor (in most cases) + This type of compatibility means that, with a minor (in most cases) change in code, users' applications will be able to leverage all cores and processors on a given machine for parallel execution. In many cases the pyprocessing package is even faster than the @@ -318,15 +322,25 @@ API Naming - While the aim of the package's API is designed to closely mimic that of - the threading and Queue modules, those modules are not PEP 8 compliant. - It has been decided that instead of adding the package as-is and - therefore perpetuating the non-PEP 8 compliant naming, we will rename - all APIs, classes, etc to be fully PEP 8 compliant. + While the aim of the package's API is designed to closely mimic that of + the threading and Queue modules as of python 2.x, those modules are not + PEP 8 compliant. It has been decided that instead of adding the package + "as is" and therefore perpetuating the non-PEP 8 compliant naming, we + will rename all APIs, classes, etc to be fully PEP 8 compliant. This change does affect the ease-of-drop in replacement for those using the threading module, but that is an acceptable side-effect in the view - of the authors. + of the authors, especially given that the threading module's own API + will change. + + Issue 3042 in the tracker proposes that for Python 2.6 there will be + two APIs for the threading module - the current one, and the PEP 8 + compliant one. Warnings about the upcoming removal of the original + java-style API will be issues when -3 is invoked. + + In Python 3000, the threading API will become PEP 8 compliant, which + means that the multiprocessing module and the threading module will + again have matching APIs. Timing/Schedule @@ -345,28 +359,24 @@ * All existing tests for the package should be converted to UnitTest format. + * Existing documentation has to be moved to ReST formatting. + * Verify code coverage percentage of existing test suite. - * Identify any requirements to achieve a 1.0 milestone if - required. + * Verify current source tree conforms to standard library practices. - * Rename top-level package from "pyprocessing" to - "multiprocessing". + * Confirm no "default" remote connection capabilities, if needed enable the remote security mechanisms by default for those classes which offer remote capabilities. + * Some of the API (Queue methods qsize(), task_done() and join()) either need to be added, or the reason for their exclusion needs to be identified and documented clearly. - * Add in "multiprocessing.setExecutable()" method to override the - default behavior of the package to spawn processes using the - current executable name rather than the Python interpreter. Note - that Mark Hammond has suggested a factory-style interface for - this[7]. - * Also note that the default behavior of process spawning does - not make it compatible with use within IDLE as-is, this will - be examined as a bug-fix or "setExecutable" enhancement. + + * The PyGILState bug patch submitted in issue 1683 by roudkerk + must be applied for the package unit tests to work. Closed Issues @@ -375,6 +385,19 @@ ctypes is not supported. This is not a restriction of this package, but rather of ctypes. + * DONE: Rename top-level package from "pyprocessing" to + "multiprocessing". + + * DONE: Also note that the default behavior of process spawning + does not make it compatible with use within IDLE as-is, this + will be examined as a bug-fix or "setExecutable" enhancement. + + * DONE: Add in "multiprocessing.setExecutable()" method to override the + default behavior of the package to spawn processes using the + current executable name rather than the Python interpreter. Note + that Mark Hammond has suggested a factory-style interface for + this[7]. + References [1] PyProcessing home page @@ -398,6 +421,9 @@ [7] http://groups.google.com/group/python-dev2/msg/54cf06d15cbcbc34 + [8] Addition Python-Dev discussion + http://mail.python.org/pipermail/python-dev/2008-June/080011.html + Copyright This document has been placed in the public domain. From python-checkins at python.org Fri Jun 6 06:47:03 2008 From: python-checkins at python.org (neal.norwitz) Date: Fri, 6 Jun 2008 06:47:03 +0200 (CEST) Subject: [Python-checkins] r63975 - in python/trunk: configure configure.in Message-ID: <20080606044703.2984C1E4004@bag.python.org> Author: neal.norwitz Date: Fri Jun 6 06:47:01 2008 New Revision: 63975 Log: Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3. (I didn't regen configure, since I don't have a working autoconf.) Modified: python/trunk/configure python/trunk/configure.in Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Fri Jun 6 06:47:01 2008 @@ -2072,7 +2072,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0]) + OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Fri Jun 6 06:47:01 2008 @@ -248,7 +248,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0@:>@) + OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE From buildbot at python.org Fri Jun 6 06:56:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 04:56:00 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080606045600.46CE91E4004@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/3765 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,neal.norwitz BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Killed sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 09:34:50 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 6 Jun 2008 09:34:50 +0200 (CEST) Subject: [Python-checkins] r63976 - python/trunk/Doc/library/logging.rst Message-ID: <20080606073450.9312B1E4004@bag.python.org> Author: georg.brandl Date: Fri Jun 6 09:34:50 2008 New Revision: 63976 Log: Markup fix. Modified: python/trunk/Doc/library/logging.rst Modified: python/trunk/Doc/library/logging.rst ============================================================================== --- python/trunk/Doc/library/logging.rst (original) +++ python/trunk/Doc/library/logging.rst Fri Jun 6 09:34:50 2008 @@ -1653,7 +1653,7 @@ *interval*. You can use the *when* to specify the type of *interval*. The list of possible - values is below. Note that they are not case sensitive. : + values is below. Note that they are not case sensitive. +----------------+-----------------------+ | Value | Type of interval | @@ -1675,7 +1675,7 @@ The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the rollover interval. - If the 'utc' argument was true, times in UTC will be used; otherwise + If the *utc* argument is true, times in UTC will be used; otherwise local time is used. If *backupCount* is nonzero, at most *backupCount* files From python-checkins at python.org Fri Jun 6 10:33:47 2008 From: python-checkins at python.org (thomas.heller) Date: Fri, 6 Jun 2008 10:33:47 +0200 (CEST) Subject: [Python-checkins] r63977 - in python/trunk: Lib/ctypes/__init__.py Lib/ctypes/test/test_errno.py Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Message-ID: <20080606083347.4BB961E4004@bag.python.org> Author: thomas.heller Date: Fri Jun 6 10:33:46 2008 New Revision: 63977 Log: Issue #1798: Add ctypes calling convention that allows safe access of errno. ctypes maintains thread-local storage that has space for two error numbers: private copies of the system 'errno' value and, on Windows, the system error code accessed by the GetLastError() and SetLastError() api functions. Foreign functions created with CDLL(..., use_errno=True), when called, swap the system 'errno' value with the private copy just before the actual function call, and swapped again immediately afterwards. The 'use_errno' parameter defaults to False, in this case 'ctypes_errno' is not touched. On Windows, foreign functions created with CDLL(..., use_last_error=True) or WinDLL(..., use_last_error=True) swap the system LastError value with the ctypes private copy. The values are also swapped immeditately before and after ctypes callback functions are called, if the callbacks are constructed using the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True). New ctypes functions are provided to access the ctypes private copies from Python: - ctypes.set_errno(value) and ctypes.set_last_error(value) store 'value' in the private copy and returns the previous value. - ctypes.get_errno() and ctypes.get_last_error() returns the current ctypes private copies value. Added: python/trunk/Lib/ctypes/test/test_errno.py Modified: python/trunk/Lib/ctypes/__init__.py python/trunk/Misc/NEWS python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callbacks.c python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/ctypes.h Modified: python/trunk/Lib/ctypes/__init__.py ============================================================================== --- python/trunk/Lib/ctypes/__init__.py (original) +++ python/trunk/Lib/ctypes/__init__.py Fri Jun 6 10:33:46 2008 @@ -33,7 +33,9 @@ DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ - FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI + FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \ + FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \ + FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR """ WINOLEAPI -> HRESULT @@ -73,8 +75,9 @@ return create_string_buffer(init, size) _c_functype_cache = {} -def CFUNCTYPE(restype, *argtypes): - """CFUNCTYPE(restype, *argtypes) -> function prototype. +def CFUNCTYPE(restype, *argtypes, **kw): + """CFUNCTYPE(restype, *argtypes, + use_errno=False, use_last_error=False) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types @@ -88,14 +91,21 @@ prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ + flags = _FUNCFLAG_CDECL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _c_functype_cache[(restype, argtypes)] + return _c_functype_cache[(restype, argtypes, flags)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_CDECL - _c_functype_cache[(restype, argtypes)] = CFunctionType + _flags_ = flags + _c_functype_cache[(restype, argtypes, flags)] = CFunctionType return CFunctionType if _os.name in ("nt", "ce"): @@ -106,16 +116,23 @@ _FUNCFLAG_STDCALL = _FUNCFLAG_CDECL _win_functype_cache = {} - def WINFUNCTYPE(restype, *argtypes): + def WINFUNCTYPE(restype, *argtypes, **kw): # docstring set later (very similar to CFUNCTYPE.__doc__) + flags = _FUNCFLAG_STDCALL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _win_functype_cache[(restype, argtypes)] + return _win_functype_cache[(restype, argtypes, flags)] except KeyError: class WinFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_STDCALL - _win_functype_cache[(restype, argtypes)] = WinFunctionType + _flags_ = flags + _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType return WinFunctionType if WINFUNCTYPE.__doc__: WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE") @@ -124,6 +141,7 @@ from _ctypes import dlopen as _dlopen from _ctypes import sizeof, byref, addressof, alignment, resize +from _ctypes import get_errno, set_errno from _ctypes import _SimpleCData def _check_size(typ, typecode=None): @@ -313,12 +331,24 @@ Calling the functions releases the Python GIL during the call and reacquires it afterwards. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL + _func_restype_ = c_int - def __init__(self, name, mode=DEFAULT_MODE, handle=None): + def __init__(self, name, mode=DEFAULT_MODE, handle=None, + use_errno=False, + use_last_error=False): self._name = name + flags = self._func_flags_ + if use_errno: + flags |= _FUNCFLAG_USE_ERRNO + if use_last_error: + flags |= _FUNCFLAG_USE_LASTERROR + + class _FuncPtr(_CFuncPtr): + _flags_ = flags + _restype_ = self._func_restype_ + self._FuncPtr = _FuncPtr + if handle is None: self._handle = _dlopen(self._name, mode) else: @@ -348,9 +378,7 @@ access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI if _os.name in ("nt", "ce"): @@ -358,9 +386,7 @@ """This class represents a dll exporting functions using the Windows stdcall calling convention. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_STDCALL # XXX Hm, what about HRESULT as normal parameter? # Mustn't it derive from c_long then? @@ -384,9 +410,8 @@ HRESULT error values are automatically raised as WindowsError exceptions. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = HRESULT + _func_flags_ = _FUNCFLAG_STDCALL + _func_restype_ = HRESULT class LibraryLoader(object): def __init__(self, dlltype): @@ -424,6 +449,7 @@ GetLastError = windll.kernel32.GetLastError else: GetLastError = windll.coredll.GetLastError + from _ctypes import get_last_error, set_last_error def WinError(code=None, descr=None): if code is None: Added: python/trunk/Lib/ctypes/test/test_errno.py ============================================================================== --- (empty file) +++ python/trunk/Lib/ctypes/test/test_errno.py Fri Jun 6 10:33:46 2008 @@ -0,0 +1,76 @@ +import unittest, os, errno +from ctypes import * +from ctypes.util import find_library +import threading + +class Test(unittest.TestCase): + def test_open(self): + libc_name = find_library("c") + if libc_name is not None: + libc = CDLL(libc_name, use_errno=True) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + + libc_open.argtypes = c_char_p, c_int + + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), errno.ENOENT) + + self.failUnlessEqual(set_errno(32), errno.ENOENT) + self.failUnlessEqual(get_errno(), 32) + + + def _worker(): + set_errno(0) + + libc = CDLL(libc_name, use_errno=False) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + libc_open.argtypes = c_char_p, c_int + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_errno(), 32) + set_errno(0) + + if os.name == "nt": + + def test_GetLastError(self): + dll = WinDLL("kernel32", use_last_error=True) + GetModuleHandle = dll.GetModuleHandleA + GetModuleHandle.argtypes = [c_wchar_p] + + self.failUnlessEqual(0, GetModuleHandle("foo")) + self.failUnlessEqual(get_last_error(), 126) + + self.failUnlessEqual(set_last_error(32), 126) + self.failUnlessEqual(get_last_error(), 32) + + def _worker(): + set_last_error(0) + + dll = WinDLL("kernel32", use_last_error=False) + GetModuleHandle = dll.GetModuleHandleW + GetModuleHandle.argtypes = [c_wchar_p] + GetModuleHandle("bar") + + self.failUnlessEqual(get_last_error(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_last_error(), 32) + + set_last_error(0) + +if __name__ == "__main__": + unittest.main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 6 10:33:46 2008 @@ -72,6 +72,9 @@ Library ------- +- Issue #1798: Add ctypes calling convention that allows safe access + to errno. + - Issue #2404: ctypes objects support the new pep3118 buffer interface - Patch #2125: Add GetInteger and GetString methods for Modified: python/trunk/Modules/_ctypes/_ctypes.c ============================================================================== --- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Fri Jun 6 10:33:46 2008 @@ -3412,7 +3412,7 @@ thunk = AllocFunctionCallback(callable, dict->argtypes, dict->restype, - dict->flags & FUNCFLAG_CDECL); + dict->flags); if (!thunk) return NULL; @@ -5535,6 +5535,8 @@ PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); #endif PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); + PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyInt_FromLong(FUNCFLAG_USE_ERRNO)); + PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyInt_FromLong(FUNCFLAG_USE_LASTERROR)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddStringConstant(m, "__version__", "1.1.0"); Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Fri Jun 6 10:33:46 2008 @@ -189,12 +189,15 @@ SETFUNC setfunc, PyObject *callable, PyObject *converters, + int flags, void **pArgs) { Py_ssize_t i; PyObject *result; PyObject *arglist = NULL; Py_ssize_t nArgs; + PyObject *error_object = NULL; + int *space; #ifdef WITH_THREAD PyGILState_STATE state = PyGILState_Ensure(); #endif @@ -271,8 +274,41 @@ #define CHECK(what, x) \ if (x == NULL) _AddTraceback(what, "_ctypes/callbacks.c", __LINE__ - 1), PyErr_Print() + if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) { + error_object = get_error_object(&space); + if (error_object == NULL) + goto Done; + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } +#endif + } + result = PyObject_CallObject(callable, arglist); CHECK("'calling callback function'", result); + +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } +#endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } + Py_XDECREF(error_object); + if ((restype != &ffi_type_void) && result) { PyObject *keep; assert(setfunc); @@ -322,6 +358,7 @@ p->setfunc, p->callable, p->converters, + p->flags, args); } @@ -351,7 +388,7 @@ CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int is_cdecl) + int flags) { int result; CThunkObject *p; @@ -371,6 +408,7 @@ goto error; } + p->flags = flags; for (i = 0; i < nArgs; ++i) { PyObject *cnv = PySequence_GetItem(converters, i); if (cnv == NULL) @@ -398,7 +436,7 @@ cc = FFI_DEFAULT_ABI; #if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64) - if (is_cdecl == 0) + if ((flags & FUNCFLAG_CDECL) == 0) cc = FFI_STDCALL; #endif result = ffi_prep_cif(&p->cif, cc, Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Fri Jun 6 10:33:46 2008 @@ -83,7 +83,129 @@ #define DONT_USE_SEH #endif +/* + ctypes maintains thread-local storage that has space for two error numbers: + private copies of the system 'errno' value and, on Windows, the system error code + accessed by the GetLastError() and SetLastError() api functions. + + Foreign functions created with CDLL(..., use_errno=True), when called, swap + the system 'errno' value with the private copy just before the actual + function call, and swapped again immediately afterwards. The 'use_errno' + parameter defaults to False, in this case 'ctypes_errno' is not touched. + + On Windows, foreign functions created with CDLL(..., use_last_error=True) or + WinDLL(..., use_last_error=True) swap the system LastError value with the + ctypes private copy. + + The values are also swapped immeditately before and after ctypes callback + functions are called, if the callbacks are constructed using the new + optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or + WINFUNCTYPE(..., use_errno=True). + + New ctypes functions are provided to access the ctypes private copies from + Python: + + - ctypes.set_errno(value) and ctypes.set_last_error(value) store 'value' in + the private copy and returns the previous value. + + - ctypes.get_errno() and ctypes.get_last_error() returns the current ctypes + private copies value. +*/ + +/* + This function creates and returns a thread-local Python object that has + space to store two integer error numbers; once created the Python object is + kept alive in the thread state dictionary as long as the thread itself. +*/ +PyObject * +get_error_object(int **pspace) +{ + PyObject *dict = PyThreadState_GetDict(); + PyObject *errobj; + if (dict == 0) { + PyErr_SetString(PyExc_RuntimeError, + "cannot get thread state"); + return NULL; + } + errobj = PyDict_GetItemString(dict, "ctypes.error_object"); + if (errobj) + Py_INCREF(errobj); + else { + void *space = PyMem_Malloc(sizeof(int) * 2); + if (space == NULL) + return NULL; + memset(space, 0, sizeof(int) * 2); + errobj = PyCObject_FromVoidPtr(space, PyMem_Free); + if (errobj == NULL) + return NULL; + if (-1 == PyDict_SetItemString(dict, "ctypes.error_object", + errobj)) { + Py_DECREF(errobj); + return NULL; + } + } + *pspace = (int *)PyCObject_AsVoidPtr(errobj); + return errobj; +} + +static PyObject * +get_error_internal(PyObject *self, PyObject *args, int index) +{ + int *space; + PyObject *errobj = get_error_object(&space); + PyObject *result; + + if (errobj == NULL) + return NULL; + result = PyInt_FromLong(space[index]); + Py_DECREF(errobj); + return result; +} + +static PyObject * +set_error_internal(PyObject *self, PyObject *args, int index) +{ + int new_errno, old_errno; + PyObject *errobj; + int *space; + + if (!PyArg_ParseTuple(args, "i", &new_errno)) + return NULL; + errobj = get_error_object(&space); + if (errobj == NULL) + return NULL; + old_errno = space[index]; + space[index] = new_errno; + Py_DECREF(errobj); + return PyInt_FromLong(old_errno); +} + +static PyObject * +get_errno(PyObject *self, PyObject *args) +{ + return get_error_internal(self, args, 0); +} + +static PyObject * +set_errno(PyObject *self, PyObject *args) +{ + return set_error_internal(self, args, 0); +} + #ifdef MS_WIN32 + +static PyObject * +get_last_error(PyObject *self, PyObject *args) +{ + return get_error_internal(self, args, 1); +} + +static PyObject * +set_last_error(PyObject *self, PyObject *args) +{ + return set_error_internal(self, args, 1); +} + PyObject *ComError; static TCHAR *FormatError(DWORD code) @@ -625,6 +747,8 @@ #ifdef WITH_THREAD PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */ #endif + PyObject *error_object = NULL; + int *space; ffi_cif cif; int cc; #ifdef MS_WIN32 @@ -656,11 +780,26 @@ return -1; } + if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) { + error_object = get_error_object(&space); + if (error_object == NULL) + return -1; + } #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_UNBLOCK_THREADS #endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } #ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } #ifndef DONT_USE_SEH __try { #endif @@ -675,7 +814,18 @@ ; } #endif + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } #endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } + Py_XDECREF(error_object); #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_BLOCK_THREADS @@ -1692,6 +1842,8 @@ } PyMethodDef module_methods[] = { + {"get_errno", get_errno, METH_NOARGS}, + {"set_errno", set_errno, METH_VARARGS}, {"POINTER", POINTER, METH_O }, {"pointer", pointer, METH_O }, {"_unpickle", unpickle, METH_VARARGS }, @@ -1702,6 +1854,8 @@ {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif #ifdef MS_WIN32 + {"get_last_error", get_last_error, METH_NOARGS}, + {"set_last_error", set_last_error, METH_VARARGS}, {"CopyComPointer", copy_com_pointer, METH_VARARGS, copy_com_pointer_doc}, {"FormatError", format_error, METH_VARARGS, format_error_doc}, {"LoadLibrary", load_library, METH_VARARGS, load_library_doc}, Modified: python/trunk/Modules/_ctypes/ctypes.h ============================================================================== --- python/trunk/Modules/_ctypes/ctypes.h (original) +++ python/trunk/Modules/_ctypes/ctypes.h Fri Jun 6 10:33:46 2008 @@ -87,6 +87,7 @@ PyObject_VAR_HEAD ffi_closure *pcl; /* the C callable */ ffi_cif cif; + int flags; PyObject *converters; PyObject *callable; PyObject *restype; @@ -185,7 +186,7 @@ extern CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int stdcall); + int flags); /* a table entry describing a predefined ctypes type */ struct fielddesc { char code; @@ -311,6 +312,8 @@ #define FUNCFLAG_CDECL 0x1 #define FUNCFLAG_HRESULT 0x2 #define FUNCFLAG_PYTHONAPI 0x4 +#define FUNCFLAG_USE_ERRNO 0x8 +#define FUNCFLAG_USE_LASTERROR 0x10 #define TYPEFLAG_ISPOINTER 0x100 #define TYPEFLAG_HASPOINTER 0x200 @@ -429,6 +432,7 @@ extern int IsSimpleSubType(PyObject *obj); extern PyObject *_pointer_type_cache; +PyObject *get_error_object(int **pspace); #ifdef MS_WIN32 extern PyObject *ComError; From buildbot at python.org Fri Jun 6 11:29:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 09:29:37 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080606092937.799151E4004@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/305 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 6 11:50:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 09:50:05 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080606095005.7BDBB1E4005@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1073 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 12:43:44 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 6 Jun 2008 12:43:44 +0200 (CEST) Subject: [Python-checkins] r63982 - python/trunk/Doc/reference/simple_stmts.rst Message-ID: <20080606104344.267D61E4004@bag.python.org> Author: georg.brandl Date: Fri Jun 6 12:43:43 2008 New Revision: 63982 Log: Fix brackets. Modified: python/trunk/Doc/reference/simple_stmts.rst Modified: python/trunk/Doc/reference/simple_stmts.rst ============================================================================== --- python/trunk/Doc/reference/simple_stmts.rst (original) +++ python/trunk/Doc/reference/simple_stmts.rst Fri Jun 6 12:43:43 2008 @@ -375,8 +375,8 @@ .. index:: statement: print .. productionlist:: - print_stmt: "print" ([`expression` ("," `expression`)* [","] - : | ">>" `expression` [("," `expression`)+ [","]) + print_stmt: "print" ([`expression` ("," `expression`)* [","]] + : | ">>" `expression` [("," `expression`)+ [","]]) :keyword:`print` evaluates each expression in turn and writes the resulting object to standard output (see below). If an object is not a string, it is From buildbot at python.org Fri Jun 6 13:16:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 11:16:24 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080606111624.5A2061E4004@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1033 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_builtin make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 6 13:41:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 11:41:49 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080606114149.EDF8F1E4005@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/382 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 13:45:08 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 6 Jun 2008 13:45:08 +0200 (CEST) Subject: [Python-checkins] r63984 - sandbox/trunk/ttk-gsoc/samples/combo_themes.py Message-ID: <20080606114508.DCCB11E4004@bag.python.org> Author: guilherme.polo Date: Fri Jun 6 13:45:08 2008 New Revision: 63984 Log: Removed XXX comment, the bug has been fixed in py3k, python-trunk and release25-maint repos now. Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/combo_themes.py (original) +++ sandbox/trunk/ttk-gsoc/samples/combo_themes.py Fri Jun 6 13:45:08 2008 @@ -19,16 +19,13 @@ self.style.theme_use(newtheme) def _setup_widgets(self): - # XXX Not how we have to convert from tuple to list (to add a new - # element) and then convert to tuple again so Combobox displays - # it correctly. This shouldn't be needed, and I will see what - # can be done towards this. themes = list(self.style.theme_names()) themes.insert(0, "Pick a theme") # Create a readonly Combobox which will display 4 values at max, # which will cause it to create a scrollbar if there are more # than 4 values in total. - themes_combo = ttk.Combobox(self, values=themes, state="readonly", height=4) + themes_combo = ttk.Combobox(self, values=themes, state="readonly", + height=4) themes_combo.set(themes[0]) # sets the combobox value to "Pick a theme" # Combobox widget generates a <> virtual event # when the user selects an element. This event is generated after From buildbot at python.org Fri Jun 6 14:18:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 12:18:48 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080606121848.B5C581E4004@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/307 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 18:33:51 2008 From: python-checkins at python.org (travis.oliphant) Date: Fri, 6 Jun 2008 18:33:51 +0200 (CEST) Subject: [Python-checkins] r63987 - peps/trunk/pep-3118.txt Message-ID: <20080606163351.47BE71E4004@bag.python.org> Author: travis.oliphant Date: Fri Jun 6 18:33:50 2008 New Revision: 63987 Log: Remove locking scheme from PEP 3118 buffer protocol. See issue 3046 in python bug tracker. Modified: peps/trunk/pep-3118.txt Modified: peps/trunk/pep-3118.txt ============================================================================== --- peps/trunk/pep-3118.txt (original) +++ peps/trunk/pep-3118.txt Fri Jun 6 18:33:50 2008 @@ -147,16 +147,16 @@ releasebufferproc bf_releasebuffer; } PyBufferProcs; +Both of these routines are optional for a type object + :: typedef int (*getbufferproc)(PyObject *obj, PyBuffer *view, int flags) This function returns ``0`` on success and ``-1`` on failure (and raises an error). The first variable is the "exporting" object. The second -argument is the address to a bufferinfo structure. If view is ``NULL``, -then no information is returned but a lock on the memory is still -obtained. In this case, the corresponding releasebuffer should also -be called with ``NULL``. +argument is the address to a bufferinfo structure. Both arguments must +never be NULL. The third argument indicates what kind of buffer the consumer is prepared to deal with and therefore what kind of buffer the exporter @@ -178,13 +178,16 @@ structure (with defaults or NULLs if nothing else is requested). The PyBuffer_FillInfo function can be used for simple cases. + +Access flags +------------ + Some flags are useful for requesting a specific kind of memory segment, while others indicate to the exporter what kind of information the consumer can deal with. If certain information is not asked for by the consumer, but the exporter cannot share its memory without that information, then a ``PyErr_BufferError`` should be raised. - ``PyBUF_SIMPLE`` This is the default flag state (0). The returned buffer may or may @@ -198,29 +201,6 @@ The returned buffer must be writable. If it is not writable, then raise an error. -``PyBUF_LOCK`` - - This flag is used to request a lock (either a read-lock or an - exclusive write lock) on the data-area of the object before the - buffer is returned. If the lock cannot be obtained, then an error - should be raised. In conjunction with the PyBUF_WRITABLE flag, the - PyBUF_LOCK flag creates four different access modes on the - data-area of the buffer memory: read, read-with-write-lock, write, - and exclusive write. The access modes are - - ================ ================= ========================== - flags Description Other Requests Can - ================ ================= ========================== - neither read read and write - WRITABLE write read and write - LOCK locked read read but not write - WRITABLE | LOCK exclusive write neither read nor write - ================ ================= ========================== - - Care should be taken not to LOCK the buffer unless it is really - necessary (especially the exclusive write lock) as it makes the - object unable to share its memory until the lock is released. - ``PyBUF_FORMAT`` The returned buffer must have true format information if this flag @@ -256,7 +236,6 @@ All of these flags imply PyBUF_STRIDES and guarantee that the strides buffer info structure will be filled in correctly. - ``PyBUF_INDIRECT`` (implies ``PyBUF_STRIDES``) The returned buffer must have suboffsets information (which can be @@ -271,29 +250,21 @@ | ``PyBUF_CONTIG`` (``PyBUF_ND | PyBUF_WRITABLE``) | ``PyBUF_CONTIG_RO`` (``PyBUF_ND``) - | ``PyBUF_CONTIG_LCK`` (``PyBUF_ND | PyBUF_LOCK``) - | ``PyBUF_CONTIG_XLCK`` (``PyBUF_ND | PyBUF_WRITABLE | PyBUF_LOCK``) Multi-dimensional using strides but aligned | ``PyBUF_STRIDED`` (``PyBUF_STRIDES | PyBUF_WRITABLE``) | ``PyBUF_STRIDED_RO`` (``PyBUF_STRIDES``) - | ``PyBUF_STRIDED_LCK`` (``PyBUF_STRIDES | PyBUF_LOCK``) - | ``PyBUF_STRIDED_XLCK`` (``PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE``) Multi-dimensional using strides and not necessarily aligned | ``PyBUF_RECORDS`` (``PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT``) | ``PyBUF_RECORDS_RO`` (``PyBUF_STRIDES | PyBUF_FORMAT``) - | ``PyBUF_RECORDS_LCK`` (``PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT``) - | ``PyBUF_RECORDS_XLCK`` (``PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT | PyBUF_WRITABLE``) Multi-dimensional using sub-offsets | ``PyBUF_FULL`` (``PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT``) | ``PyBUF_FULL_RO`` (``PyBUF_INDIRECT | PyBUF_FORMAT``) - | ``PyBUF_FULL_LCK`` (``PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT``) - | ``PyBUF_FULL_XLCK`` (``PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT | PyBUF_WRITABLE``) Thus, the consumer simply wanting a contiguous chunk of bytes from the object would use ``PyBUF_SIMPLE``, while a consumer that understands @@ -307,6 +278,10 @@ buffer info structure correctly according to the provided flags if a contiguous chunk of "unsigned bytes" is all that can be exported. + +The Py_buffer struct +-------------------- + The bufferinfo structure is:: struct bufferinfo { @@ -322,14 +297,15 @@ void *internal; } Py_buffer; -Before calling the bf_getbuffer function, the bufferinfo structure can be -filled with whatever. Upon return from bf_getbuffer, the bufferinfo -structure is filled in with relevant information about the buffer. -This same bufferinfo structure must be passed to bf_releasebuffer (if -available) when the consumer is done with the memory. The caller is -responsible for keeping a reference to obj until releasebuffer is -called (i.e. the call to bf_getbuffer does not alter the reference -count of obj). +Before calling the bf_getbuffer function, the bufferinfo structure can +be filled with whatever, but the ``buf`` field must be NULL when +requesting a new buffer. Upon return from bf_getbuffer, the +bufferinfo structure is filled in with relevant information about the +buffer. This same bufferinfo structure must be passed to +bf_releasebuffer (if available) when the consumer is done with the +memory. The caller is responsible for keeping a reference to obj until +releasebuffer is called (i.e. the call to bf_getbuffer does not alter +the reference count of obj). The members of the bufferinfo structure are: @@ -343,14 +319,7 @@ ``readonly`` an integer variable to hold whether or not the memory is readonly. - 1 means the memory is readonly, zero means the memory is writable, - -1 means the memory was read "locked" when this Py_buffer - structure was filled-in therefore should be unlocked when this - Py_buffer structure is "released." A -2 means this Py_buffer - structure has an exclusive-write lock on the memory. This should - be unlocked when the Py_buffer structure is released. The concept - of locking is not supported by all objects that expose the buffer - protocol. + 1 means the memory is readonly, zero means the memory is writable. ``format`` a NULL-terminated format-string (following the struct-style syntax @@ -359,7 +328,7 @@ is the number of bytes implied by the format. This can be NULL which implies standard unsigned bytes ("B"). -``ndims`` +``ndim`` a variable storing the number of dimensions the memory represents. Must be >=0. A value of 0 means that shape and strides and suboffsets must be ``NULL`` (i.e. the memory represents a scalar). @@ -440,21 +409,25 @@ when releasebuffer is called. +Releasing the buffer +-------------------- + The same bufferinfo struct should be used in the release-buffer -interface call. The caller is responsible for the memory of the -Py_buffer structure itself. +interface call. The caller is responsible for the memory of the +Py_buffer structure itself. + +:: -``typedef void (*releasebufferproc)(PyObject *obj, Py_buffer *view)`` - Callers of getbufferproc must make sure that this function is - called when memory previously acquired from the object is no - longer needed. The exporter of the interface must make sure that - any memory pointed to in the bufferinfo structure remains valid - until releasebuffer is called. + typedef void (*releasebufferproc)(PyObject *obj, Py_buffer *view) - Both of these routines are optional for a type object +Callers of getbufferproc must make sure that this function is called +when memory previously acquired from the object is no longer needed. +The exporter of the interface must make sure that any memory pointed +to in the bufferinfo structure remains valid until releasebuffer is +called. - If the bf_releasebuffer function is not provided (i.e. it is NULL), - then it does not ever need to be called. +If the bf_releasebuffer function is not provided (i.e. it is NULL), +then it does not ever need to be called. Exporters will need to define a bf_releasebuffer function if they can re-allocate their memory, strides, shape, suboffsets, or format @@ -520,10 +493,6 @@ Thus, this memory view object holds on to the memory of base until it is deleted. -The bf_getbuffer and bf_releasebuffer for this object increments and -decrements the lock on base, but passes on the contents of view to the -caller. - This memory-view object will support multi-dimensional slicing and be the first object provided with Python to do so. Slices of the memory-view object are other memory-view objects with the same base @@ -571,7 +540,7 @@ :: PyObject * PyMemoryView_GetContiguous(PyObject *obj, int buffertype, - char fort) + char fortran) Return a memoryview object to a contiguous chunk of memory represented by obj. If a copy must be made (because the memory pointed to by obj @@ -586,9 +555,8 @@ can use PyBUF_UPDATEIFCOPY to ensure that a a writable temporary contiguous buffer is returned. The contents of this contiguous buffer will be copied back into the original object after the memoryview -object is deleted as long as the original object is writable and -allows applying a read-write lock. If this is not allowed by -the original object, then a BufferError is raised. +object is deleted as long as the original object is writable. If this +is not allowed by the original object, then a BufferError is raised. If the object is multi-dimensional, then if fortran is 'F', the first dimension of the underlying array will vary the fastest in the buffer. @@ -597,9 +565,7 @@ you will get whatever the object decides is more efficient. If a copy is made, then the memory must be freed by calling ``PyMem_Free``. -You receive a new reference to the memoryview object which will also -hold a lock on the objects data area (this lock will be released when -the memoryview object is deleted). +You receive a new reference to the memoryview object. :: @@ -816,12 +782,15 @@ adding the C-API and the two functions to the existing buffer protocol. -The proposed locking mechanism relies entirely on the exporter object -to not invalidate any of the memory pointed to by the buffer structure -until a corresponding releasebuffer is called. If it wants to be able -to change its own shape and/or strides arrays, then it needs to create -memory for these in the bufferinfo structure and copy information -over. +Previous versions of this PEP proposed a read/write locking scheme, +but it was later perceived as a) too complicated for common simple use +cases that do not require any locking and b) too simple for use cases +that required concurrent read/write access to a buffer with changing, +short-living locks. It is therefore left to users to implement their +own specific locking scheme around buffer objects if they require +consistent views across concurrent read/write access. A future PEP +may be proposed which includes a separate locking API after some +experience with these user-schemes is obtained The sharing of strided memory and suboffsets is new and can be seen as a modification of the multiple-segment interface. It is motivated by @@ -860,8 +829,6 @@ this proposal but will welcome any help. - - Examples ======== @@ -943,7 +910,7 @@ } /* No releasebuffer is necessary because the memory will never - be re-allocated so the locking mechanism is not needed + be re-allocated */ Ex. 3 From python-checkins at python.org Fri Jun 6 20:37:55 2008 From: python-checkins at python.org (thomas.heller) Date: Fri, 6 Jun 2008 20:37:55 +0200 (CEST) Subject: [Python-checkins] r63988 - python/trunk/Modules/_ctypes/callproc.c Message-ID: <20080606183755.B5EBC1E400E@bag.python.org> Author: thomas.heller Date: Fri Jun 6 20:37:55 2008 New Revision: 63988 Log: Performance improvement: Use PyDict_Get/SetItem instead of PyDict_Get/SetItemString. Modified: python/trunk/Modules/_ctypes/callproc.c Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Fri Jun 6 20:37:55 2008 @@ -122,12 +122,18 @@ { PyObject *dict = PyThreadState_GetDict(); PyObject *errobj; + static PyObject *error_object_name; if (dict == 0) { PyErr_SetString(PyExc_RuntimeError, "cannot get thread state"); return NULL; } - errobj = PyDict_GetItemString(dict, "ctypes.error_object"); + if (error_object_name == NULL) { + error_object_name = PyString_InternFromString("ctypes.error_object"); + if (error_object_name == NULL) + return NULL; + } + errobj = PyDict_GetItem(dict, error_object_name); if (errobj) Py_INCREF(errobj); else { @@ -138,8 +144,8 @@ errobj = PyCObject_FromVoidPtr(space, PyMem_Free); if (errobj == NULL) return NULL; - if (-1 == PyDict_SetItemString(dict, "ctypes.error_object", - errobj)) { + if (-1 == PyDict_SetItem(dict, error_object_name, + errobj)) { Py_DECREF(errobj); return NULL; } From python-checkins at python.org Fri Jun 6 20:42:11 2008 From: python-checkins at python.org (thomas.heller) Date: Fri, 6 Jun 2008 20:42:11 +0200 (CEST) Subject: [Python-checkins] r63989 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080606184211.E927D1E4004@bag.python.org> Author: thomas.heller Date: Fri Jun 6 20:42:11 2008 New Revision: 63989 Log: Add a reminder for the maintainer of whatsnew. Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Fri Jun 6 20:42:11 2008 @@ -1672,6 +1672,10 @@ (Contributed by Raymond Hettinger.) +* XXX Describe the new ctypes calling convention that allows safe + access to errno. + (Implemented by Thomas Heller; :issue:`1798`.) + * The :mod:`ctypes` module now supports a :class:`c_bool` datatype that represents the C99 ``bool`` type. (Contributed by David Remahl; :issue:`1649190`.) From python-checkins at python.org Fri Jun 6 20:48:49 2008 From: python-checkins at python.org (guido.van.rossum) Date: Fri, 6 Jun 2008 20:48:49 +0200 (CEST) Subject: [Python-checkins] r63990 - peps/trunk/pep-0008.txt Message-ID: <20080606184849.BDD221E4008@bag.python.org> Author: guido.van.rossum Date: Fri Jun 6 20:48:49 2008 New Revision: 63990 Log: Clarify preferred way to break at a binary operator. Modified: peps/trunk/pep-0008.txt Modified: peps/trunk/pep-0008.txt ============================================================================== --- peps/trunk/pep-0008.txt (original) +++ peps/trunk/pep-0008.txt Fri Jun 6 20:48:49 2008 @@ -87,7 +87,8 @@ continuation inside parentheses, brackets and braces. If necessary, you can add an extra pair of parentheses around an expression, but sometimes using a backslash looks better. Make sure to indent the continued line - appropriately. Some examples: + appropriately. The preferred place to break around a binary operator is + *after* the operator, not before it. Some examples: class Rectangle(Blob): @@ -99,7 +100,8 @@ raise ValueError("sorry, you lose") if width == 0 and height == 0 and (color == 'red' or emphasis is None): - raise ValueError("I don't think so") + raise ValueError("I don't think so -- values are %s, %s" % + (width, height)) Blob.__init__(self, width, height, color, emphasis, highlight) From python-checkins at python.org Fri Jun 6 22:05:15 2008 From: python-checkins at python.org (thomas.heller) Date: Fri, 6 Jun 2008 22:05:15 +0200 (CEST) Subject: [Python-checkins] r63991 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080606200515.6EB2A1E4004@bag.python.org> Author: thomas.heller Date: Fri Jun 6 22:05:15 2008 New Revision: 63991 Log: Document the new ctypes features. It would be great if someone could review both sematics, markup, and spelling, and correct the versionadded and versionchanges markers. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Fri Jun 6 22:05:15 2008 @@ -1337,14 +1337,14 @@ way is to instantiate one of the following classes: -.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Instances of this class represent loaded shared libraries. Functions in these libraries use the standard C calling convention, and are assumed to return ``int``. -.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` calling convention, and are @@ -1354,7 +1354,7 @@ failure, an :class:`WindowsError` is automatically raised. -.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` calling convention, and are @@ -1387,6 +1387,29 @@ The *mode* parameter can be used to specify how the library is loaded. For details, consult the ``dlopen(3)`` manpage, on Windows, *mode* is ignored. +The *use_errno* parameter, when set to True, enables a ctypes +mechanism that allows to access the system `errno` error number in a +safe way. `ctypes` maintains a thread-local copy of the systems +`errno` variable; if you call foreign functions created with +`use_errno=True` then the `errno` value before the function call is +swapped with the ctypes private copy, the same happens immediately +after the function call. + +The function `ctypes.get_errno()` returns the value of the ctypes +private copy, and the function `ctypes.set_errno(value)` changes the +ctypes private copy to `value` and returns the former value. + +The *use_last_error* parameter, when set to True, enables the same +mechanism for the Windows error code which is managed by the +GetLastError() and SetLastError() Windows api functions; +`ctypes.get_last_error()` and `ctypes.set_last_error(value)` are used +to request and change the ctypes private copy of the windows error +code. + +.. versionchanged:: 2.6 + +The `use_errno` and `use_last_error` parameters were added in Python +2.6. .. data:: RTLD_GLOBAL :noindex: @@ -1585,18 +1608,26 @@ type and the argument types of the function. -.. function:: CFUNCTYPE(restype, *argtypes) +.. function:: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) The returned function prototype creates functions that use the standard C calling convention. The function will release the GIL during the call. + If `use_errno` is set to True, the ctypes private copy of the system `errno` + variable is exchanged with the real `errno` value bafore and after the call; + `use_last_error` does the same for the Windows error code. + + .. versionchanged:: 2.6 + + The optional `use_errno` and `use_last_error` parameters were added + in Python 2.6. -.. function:: WINFUNCTYPE(restype, *argtypes) +.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) Windows only: The returned function prototype creates functions that use the ``stdcall`` calling convention, except on Windows CE where :func:`WINFUNCTYPE` is the same as :func:`CFUNCTYPE`. The function will release the GIL during the - call. + call. `use_errno` and `use_last_error` have the same meaning as above. .. function:: PYFUNCTYPE(restype, *argtypes) @@ -1848,7 +1879,22 @@ .. function:: GetLastError() Windows only: Returns the last error code set by Windows in the calling thread. + This function calls the Windows `GetLastError()` function directly, + it does not return the ctypes-private copy of the error code. + +.. function:: get_errno() + + Returns the current value of the ctypes-private copy of the system + `errno` variable in the calling thread. + + .. versionadded:: 2.6 + +.. function:: get_last_error() + Windows only: returns the current value of the ctypes-private copy of the system + `LastError` variable in the calling thread. + + .. versionadded:: 2.6 .. function:: memmove(dst, src, count) @@ -1901,6 +1947,22 @@ other systems ``('ascii', 'strict')``. +.. function:: set_errno(value) + + Set the current value of the ctypes-private copy of the system + `errno` variable in the calling thread to `value` and return the + previous value. + + .. versionadded:: 2.6 + +.. function:: set_last_error(value) + + Windows only: set the current value of the ctypes-private copy of + the system `LastError` variable in the calling thread to `value` + and return the previous value. + + .. versionadded:: 2.6 + .. function:: sizeof(obj_or_type) Returns the size in bytes of a ctypes type or instance memory buffer. Does the From python-checkins at python.org Fri Jun 6 22:41:40 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 6 Jun 2008 22:41:40 +0200 (CEST) Subject: [Python-checkins] r63992 - tracker/instances/python-dev/html/home.html Message-ID: <20080606204140.3E80F1E4005@bag.python.org> Author: martin.v.loewis Date: Fri Jun 6 22:41:39 2008 New Revision: 63992 Log: Issue 209: Stop grouping by priority. Modified: tracker/instances/python-dev/html/home.html Modified: tracker/instances/python-dev/html/home.html ============================================================================== --- tracker/instances/python-dev/html/home.html (original) +++ tracker/instances/python-dev/html/home.html Fri Jun 6 22:41:39 2008 @@ -5,6 +5,6 @@ whatever. It's a good idea to have the issues on the front page though --> From python-checkins at python.org Fri Jun 6 22:43:24 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 6 Jun 2008 22:43:24 +0200 (CEST) Subject: [Python-checkins] r63993 - tracker/instances/jython/html/home.html Message-ID: <20080606204324.CDB661E4004@bag.python.org> Author: martin.v.loewis Date: Fri Jun 6 22:43:24 2008 New Revision: 63993 Log: Issue 209: Stop grouping by priority. Modified: tracker/instances/jython/html/home.html Modified: tracker/instances/jython/html/home.html ============================================================================== --- tracker/instances/jython/html/home.html (original) +++ tracker/instances/jython/html/home.html Fri Jun 6 22:43:24 2008 @@ -5,6 +5,6 @@ whatever. It's a good idea to have the issues on the front page though --> From buildbot at python.org Fri Jun 6 23:01:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 21:01:49 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080606210149.844691E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/599 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: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Aborted (core dumped) sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 23:05:14 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 6 Jun 2008 23:05:14 +0200 (CEST) Subject: [Python-checkins] r63995 - sandbox/trunk/ttk-gsoc/src/idlelib Message-ID: <20080606210514.9DBC41E4009@bag.python.org> Author: guilherme.polo Date: Fri Jun 6 23:05:14 2008 New Revision: 63995 Log: Created a idlelib branch for me so it is easier to keep track of changes Added: sandbox/trunk/ttk-gsoc/src/idlelib/ - copied from r63994, /python/trunk/Lib/idlelib/ From buildbot at python.org Fri Jun 6 23:09:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 21:09:48 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080606210948.C0B651E4004@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/310 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/bsddb/test/test_associate.py", line 308, in getGenre genre = priData.split('|')[2] make: *** [buildbottest] Segmentation fault sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 23:10:47 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 6 Jun 2008 23:10:47 +0200 (CEST) Subject: [Python-checkins] r63996 - sandbox/trunk/ttk-gsoc/src/idlelib Message-ID: <20080606211047.251BD1E400B@bag.python.org> Author: guilherme.polo Date: Fri Jun 6 23:10:46 2008 New Revision: 63996 Log: Initialized merge tracking via "svnmerge" with revisions "1-63994" from svn+ssh://pythondev/python/trunk/Lib/idlelib Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ (props changed) From python-checkins at python.org Fri Jun 6 23:31:34 2008 From: python-checkins at python.org (ronald.oussoren) Date: Fri, 6 Jun 2008 23:31:34 +0200 (CEST) Subject: [Python-checkins] r63997 - in python/trunk: Mac/Modules/MacOS.c Mac/Modules/ae/_AEmodule.c Mac/Modules/file/_Filemodule.c configure configure.in pyconfig.h.in Message-ID: <20080606213134.0B18D1E4004@bag.python.org> Author: ronald.oussoren Date: Fri Jun 6 23:31:33 2008 New Revision: 63997 Log: Fix build issue on OSX 10.4 Modified: python/trunk/Mac/Modules/MacOS.c python/trunk/Mac/Modules/ae/_AEmodule.c python/trunk/Mac/Modules/file/_Filemodule.c python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Modified: python/trunk/Mac/Modules/MacOS.c ============================================================================== --- python/trunk/Mac/Modules/MacOS.c (original) +++ python/trunk/Mac/Modules/MacOS.c Fri Jun 6 23:31:33 2008 @@ -30,6 +30,9 @@ #include #include +#ifndef HAVE_MACOS105_SDK +typedef SInt16 FSIORefNum; +#endif static PyObject *MacOS_Error; /* Exception MacOS.Error */ Modified: python/trunk/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/trunk/Mac/Modules/ae/_AEmodule.c (original) +++ python/trunk/Mac/Modules/ae/_AEmodule.c Fri Jun 6 23:31:33 2008 @@ -7,6 +7,10 @@ #include "pymactoolbox.h" +#ifndef HAVE_OSX105_SDK +typedef SInt32 SRefCon; +#endif + /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ Modified: python/trunk/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/trunk/Mac/Modules/file/_Filemodule.c (original) +++ python/trunk/Mac/Modules/file/_Filemodule.c Fri Jun 6 23:31:33 2008 @@ -7,6 +7,10 @@ #include "pymactoolbox.h" +#ifndef HAVE_MACOS105_SDK +typedef SInt16 FSIORefNum; +#endif + /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ @@ -193,10 +197,6 @@ static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self) { /* Cleanup of self->ob_itself goes here */ - FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); - if (info->fileSec != NULL) { - CFRelease(info->fileSec); - } self->ob_type->tp_free((PyObject *)self); } Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Fri Jun 6 23:31:33 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 63690 . +# From configure.in Revision: 63955 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -4659,6 +4659,7 @@ BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" fi ;; @@ -12400,6 +12401,7 @@ echo "${ECHO_T}$enable_toolbox_glue" >&6; } + case $ac_sys_system/$ac_sys_release in Darwin/[01567]\..*) OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000" @@ -12746,6 +12748,7 @@ echo "${ECHO_T}$LINKFORSHARED" >&6; } + { echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 echo $ECHO_N "checking CFLAGSFORSHARED... $ECHO_C" >&6; } if test ! "$LIBRARY" = "$LDLIBRARY" @@ -15309,6 +15312,58 @@ fi fi +{ echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 +echo $ECHO_N "checking for OSX 10.5 SDK or later... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +FSIORefNum fRef = 0 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OSX105_SDK 1 +_ACEOF + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Check for --with-doc-strings { echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 echo $ECHO_N "checking for --with-doc-strings... $ECHO_C" >&6; } Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Fri Jun 6 23:31:33 2008 @@ -918,6 +918,7 @@ BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" fi ;; @@ -1456,6 +1457,7 @@ esac AC_MSG_RESULT($enable_toolbox_glue) + AC_SUBST(OTHER_LIBTOOL_OPT) case $ac_sys_system/$ac_sys_release in Darwin/@<:@01567@:>@\..*) @@ -1781,6 +1783,7 @@ fi AC_MSG_RESULT($LINKFORSHARED) + AC_SUBST(CFLAGSFORSHARED) AC_MSG_CHECKING(CFLAGSFORSHARED) if test ! "$LIBRARY" = "$LDLIBRARY" @@ -2297,6 +2300,13 @@ fi fi +AC_MSG_CHECKING(for OSX 10.5 SDK or later) +AC_TRY_COMPILE([#include ], FSIORefNum fRef = 0, + AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) +) + # Check for --with-doc-strings AC_MSG_CHECKING(for --with-doc-strings) AC_ARG_WITH(doc-strings, Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Fri Jun 6 23:31:33 2008 @@ -426,6 +426,9 @@ /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY +/* Define if compiling using MacOS X 10.5 SDK or later. */ +#undef HAVE_OSX105_SDK + /* Define to 1 if you have the `pathconf' function. */ #undef HAVE_PATHCONF @@ -489,9 +492,6 @@ /* Define if you have readline 4.2 */ #undef HAVE_RL_COMPLETION_MATCHES -/* Define when using libedit's readline emulation */ -#undef HAVE_RL_DISPM_VFUNC - /* Define if you have readline 4.0 */ #undef HAVE_RL_PRE_INPUT_HOOK From buildbot at python.org Fri Jun 6 23:32:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 21:32:47 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080606213247.AC07C1E400A@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/456 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/bsddb/test/test_associate.py", line 308, in getGenre genre = priData.split('|')[2] make: *** [buildbottest] Bus error sincerely, -The Buildbot From buildbot at python.org Fri Jun 6 23:41:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 21:41:43 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080606214143.DD4A21E400A@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/949 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Segmentation fault sincerely, -The Buildbot From python-checkins at python.org Fri Jun 6 23:47:51 2008 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 6 Jun 2008 23:47:51 +0200 (CEST) Subject: [Python-checkins] r63998 - python/trunk/Modules/_heapqmodule.c Message-ID: <20080606214751.8822E1E4009@bag.python.org> Author: raymond.hettinger Date: Fri Jun 6 23:47:51 2008 New Revision: 63998 Log: Issue 3501: Make heapq support both __le__ and __lt__. Modified: python/trunk/Modules/_heapqmodule.c Modified: python/trunk/Modules/_heapqmodule.c ============================================================================== --- python/trunk/Modules/_heapqmodule.c (original) +++ python/trunk/Modules/_heapqmodule.c Fri Jun 6 23:47:51 2008 @@ -8,6 +8,25 @@ #include "Python.h" +/* Older implementations of heapq used Py_LE for comparisons. Now, it uses + Py_LT so it will match min(), sorted(), and bisect(). Unfortunately, some + client code (Twisted for example) relied on Py_LE, so this little function + restores compatability by trying both. +*/ +static int +cmp_lt(PyObject *x, PyObject *y) +{ + int cmp; + cmp = PyObject_RichCompareBool(x, y, Py_LT); + if (cmp == -1 && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + cmp = PyObject_RichCompareBool(y, x, Py_LE); + if (cmp != -1) + cmp = 1 - cmp; + } + return cmp; +} + static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { @@ -28,7 +47,7 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(newitem, parent, Py_LT); + cmp = cmp_lt(newitem, parent); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -68,10 +87,9 @@ /* Set childpos to index of smaller child. */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = PyObject_RichCompareBool( + cmp = cmp_lt( PyList_GET_ITEM(heap, childpos), - PyList_GET_ITEM(heap, rightpos), - Py_LT); + PyList_GET_ITEM(heap, rightpos)); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -214,7 +232,7 @@ return item; } - cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT); + cmp = cmp_lt(PyList_GET_ITEM(heap, 0), item); if (cmp == -1) return NULL; if (cmp == 0) { @@ -313,7 +331,7 @@ else goto sortit; } - cmp = PyObject_RichCompareBool(sol, elem, Py_LT); + cmp = cmp_lt(sol, elem); if (cmp == -1) { Py_DECREF(elem); goto fail; @@ -368,7 +386,7 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(parent, newitem, Py_LT); + cmp = cmp_lt(parent, newitem); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -408,10 +426,9 @@ /* Set childpos to index of smaller child. */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = PyObject_RichCompareBool( + cmp = cmp_lt( PyList_GET_ITEM(heap, rightpos), - PyList_GET_ITEM(heap, childpos), - Py_LT); + PyList_GET_ITEM(heap, childpos)); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -484,7 +501,7 @@ else goto sortit; } - cmp = PyObject_RichCompareBool(elem, los, Py_LT); + cmp = cmp_lt(elem, los); if (cmp == -1) { Py_DECREF(elem); goto fail; From python-checkins at python.org Sat Jun 7 00:14:52 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 00:14:52 +0200 (CEST) Subject: [Python-checkins] r63999 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080606221452.B250A1E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 00:14:52 2008 New Revision: 63999 Log: New support class: LabeledScale Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 00:14:52 2008 @@ -21,7 +21,7 @@ "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", # Extensions - "OptionMenu"] + "LabeledScale", "OptionMenu"] import Tkinter @@ -1359,6 +1359,42 @@ # Extensions +class LabeledScale(Frame): + """A Ttk Scale widget with a Ttk Label widget over it indicating its + current value. + + The Ttk Scale can be accessed through instance.scale, and Ttk Label + can be accessed through instance.label""" + + def __init__(self, master, variable, from_=0, to=10, **kw): + """Construct a LabeledScale with parent master, a variable to be + associated with the Ttk Scale widget and its range.""" + Frame.__init__(self, master, **kw) + self.label = Label(self) + self.scale = Scale(self, variable=variable, from_=from_, to=to) + + tmp = Label(self).pack() # place holder + self.label.place(anchor='n') + self.scale.pack(side='bottom', fill='x') + + self._variable = variable + self._variable.trace_variable('w', self._adjust) + + self.scale.bind('', self._adjust) + self.scale.bind('', self._adjust) + + + def _adjust(self, *args): + """Adjust the label position according to the scale.""" + self.update() + self.label['text'] = self._variable.get() + x, y = self.scale.coords() + + y = self.scale.winfo_y() - self.label.winfo_reqheight() + x = x + self.scale.winfo_x() + self.label.place_configure(x=x, y=y) + + class OptionMenu(Menubutton): """Themed OptionMenu which allows the user to select a value from a menu.""" Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 00:14:52 2008 @@ -21,7 +21,7 @@ "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", # Extensions - "OptionMenu"] + "LabeledScale", "OptionMenu"] import tkinter @@ -1359,6 +1359,42 @@ # Extensions +class LabeledScale(Frame): + """A Ttk Scale widget with a Ttk Label widget over it indicating its + current value. + + The Ttk Scale can be accessed through instance.scale, and Ttk Label + can be accessed through instance.label""" + + def __init__(self, master, variable, from_=0, to=10, **kw): + """Construct a LabeledScale with parent master, a variable to be + associated with the Ttk Scale widget and its range.""" + Frame.__init__(self, master, **kw) + self.label = Label(self) + self.scale = Scale(self, variable=variable, from_=from_, to=to) + + tmp = Label(self).pack() # place holder + self.label.place(anchor='n') + self.scale.pack(side='bottom', fill='x') + + self._variable = variable + self._variable.trace_variable('w', self._adjust) + + self.scale.bind('', self._adjust) + self.scale.bind('', self._adjust) + + + def _adjust(self, *args): + """Adjust the label position according to the scale.""" + self.update() + self.label['text'] = self._variable.get() + x, y = self.scale.coords() + + y = self.scale.winfo_y() - self.label.winfo_reqheight() + x = x + self.scale.winfo_x() + self.label.place_configure(x=x, y=y) + + class OptionMenu(Menubutton): """Themed OptionMenu which allows the user to select a value from a menu.""" From python-checkins at python.org Sat Jun 7 00:16:58 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 00:16:58 +0200 (CEST) Subject: [Python-checkins] r64000 - in sandbox/trunk/ttk-gsoc/src: idlelib/AutoCompleteWindow.py idlelib/CallTipWindow.py idlelib/Debugger.py idlelib/EditorWindow.py idlelib/GrepDialog.py idlelib/IOBinding.py idlelib/MultiStatusBar.py idlelib/PyShell.py idlelib/ReplaceDialog.py idlelib/ScrolledList.py idlelib/SearchDialog.py idlelib/SearchDialogBase.py idlelib/ToolTip.py idlelib/TreeWidget.py idlelib/aboutDialog.py idlelib/config-main.def idlelib/configDialog.py idlelib/configHelpSourceEdit.py idlelib/configSectionNameDialog.py idlelib/dynOptionMenuWidget.py idlelib/keybindingDialog.py idlelib/stylist.py idlelib/tabbedpages.py idlelib/tabbedpages_new.py idlelib/tabbedpages_old.py idlelib/textView.py idlelib_ttk.diff Message-ID: <20080606221658.A017D1E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 00:16:57 2008 New Revision: 64000 Log: Merged the large idlelib diff into my idlelib branch and removed the old idlelib_ttk.diff Added: sandbox/trunk/ttk-gsoc/src/idlelib/stylist.py sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py Removed: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Modified: sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/dynOptionMenuWidget.py sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py sandbox/trunk/ttk-gsoc/src/idlelib/textView.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py Sat Jun 7 00:16:57 2008 @@ -4,6 +4,10 @@ from Tkinter import * from MultiCall import MC_SHIFT import AutoComplete +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * HIDE_VIRTUAL_EVENT_NAME = "<>" HIDE_SEQUENCES = ("", "") Modified: sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py Sat Jun 7 00:16:57 2008 @@ -5,6 +5,10 @@ """ from Tkinter import * +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * HIDE_VIRTUAL_EVENT_NAME = "<>" HIDE_SEQUENCES = ("", "") @@ -163,6 +167,8 @@ def calltip_hide(self, event): self.calltip.hidetip() +# XXX Bugged test + def main(): # Test code c=container() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py Sat Jun 7 00:16:57 2008 @@ -4,8 +4,11 @@ from Tkinter import * from WindowList import ListedToplevel from ScrolledList import ScrolledList +from configHandler import idleConf import macosxSupport +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import Scrollbar, Button, Radiobutton class Idb(bdb.Bdb): @@ -155,6 +158,7 @@ self.show_locals() if self.vglobals.get(): self.show_globals() + # def interaction(self, message, frame, info=None): self.frame = frame @@ -413,6 +417,7 @@ height = 20*len(dict) # XXX 20 == observed height of Entry widget self.master = master self.title = title + import repr self.repr = repr.Repr() self.repr.maxstring = 60 Modified: sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py Sat Jun 7 00:16:57 2008 @@ -19,6 +19,10 @@ import aboutDialog, textView, configDialog import macosxSupport +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import Scrollbar + + # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 @@ -365,7 +369,7 @@ self.menudict = menudict = {} for name, label in self.menu_specs: underline, label = prepstr(label) - menudict[name] = menu = Menu(mbar, name=name) + menudict[name] = menu = Menu(mbar, name=name, tearoff=0) mbar.add_cascade(label=label, menu=menu, underline=underline) if sys.platform == 'darwin' and '.framework' in sys.executable: Modified: sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py Sat Jun 7 00:16:57 2008 @@ -4,6 +4,10 @@ from Tkinter import * import SearchEngine from SearchDialogBase import SearchDialogBase +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * def grep(text, io=None, flist=None): root = text._root() @@ -15,10 +19,10 @@ dialog.open(text, searchphrase, io) class GrepDialog(SearchDialogBase): - title = "Find in Files Dialog" icon = "Grep" needwrapbutton = 0 + bottom_btns = [("Search Files", 'default_command', 1)] def __init__(self, root, engine, flist): SearchDialogBase.__init__(self, root, engine) @@ -40,20 +44,18 @@ def create_entries(self): SearchDialogBase.create_entries(self) - self.globent = self.make_entry("In files:", self.globvar) + self.globent = self.make_entry("In files", self.globvar) def create_other_buttons(self): f = self.make_frame() - btn = Checkbutton(f, anchor="w", - variable=self.recvar, + btn = Checkbutton(f, variable=self.recvar, text="Recurse down subdirectories") btn.pack(side="top", fill="both") - btn.select() + btn.invoke() def create_command_buttons(self): SearchDialogBase.create_command_buttons(self) - self.make_button("Search Files", self.default_command, 1) def default_command(self, event=None): prog = self.engine.getprog() @@ -126,8 +128,3 @@ for subdir in subdirs: list.extend(self.findfiles(subdir, base, rec)) return list - - def close(self, event=None): - if self.top: - self.top.grab_release() - self.top.withdraw() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py Sat Jun 7 00:16:57 2008 @@ -18,6 +18,9 @@ from configHandler import idleConf +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * + try: from codecs import BOM_UTF8 except ImportError: Modified: sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py Sat Jun 7 00:16:57 2008 @@ -1,4 +1,8 @@ from Tkinter import * +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import Frame, Label class MultiStatusBar(Frame): @@ -10,7 +14,7 @@ def set_label(self, name, text='', side=LEFT): if not self.labels.has_key(name): - label = Label(self, bd=1, relief=SUNKEN, anchor=W) + label = Label(self, relief=SUNKEN, anchor=W) label.pack(side=side) self.labels[name] = label else: Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Sat Jun 7 00:16:57 2008 @@ -22,14 +22,26 @@ print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ "Your Python may not be configured for Tk. **" sys.exit(1) +try: + from ttk import * + TTK = 1 +except ImportError: + print >> sys.stderr, "** IDLE can't import ttk." + TTK = 0 + import tkMessageBox +from configHandler import idleConf + +# store ttk availability +idleConf.SetOption('main', 'General', 'use-ttk', str(TTK)) +idleConf.SaveUserCfgFiles() + from EditorWindow import EditorWindow, fixwordbreaks from FileList import FileList from ColorDelegator import ColorDelegator from UndoDelegator import UndoDelegator from OutputWindow import OutputWindow -from configHandler import idleConf import idlever import rpc @@ -1381,6 +1393,19 @@ # start editor and/or shell windows: root = Tk(className="Idle") + if TTK: + # create base styles used along idle files + style = Style() + + x = style.map('.') + r = {'background': []} + for sspec in x['background']: + if 'active' in sspec[:-1]: + r['background'].append(('!disabled', sspec[-1])) + break + style.map('RootColor.TFrame', **r) + # end styles + fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py Sat Jun 7 00:16:57 2008 @@ -11,9 +11,12 @@ dialog.open(text) class ReplaceDialog(SearchDialogBase): - title = "Replace Dialog" icon = "Replace" + bottom_btns = [("Find", 'find_it'), + ("Replace", 'replace_it'), + ("Replace+Find", 'default_command', 1), + ("Replace All", 'replace_all')] def __init__(self, root, engine): SearchDialogBase.__init__(self, root, engine) @@ -36,14 +39,10 @@ def create_entries(self): SearchDialogBase.create_entries(self) - self.replent = self.make_entry("Replace with:", self.replvar) + self.replent = self.make_entry("Replace with", self.replvar) def create_command_buttons(self): SearchDialogBase.create_command_buttons(self) - self.make_button("Find", self.find_it) - self.make_button("Replace", self.replace_it) - self.make_button("Replace+Find", self.default_command, 1) - self.make_button("Replace All", self.replace_all) def find_it(self, event=None): self.do_find(0) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py Sat Jun 7 00:16:57 2008 @@ -1,4 +1,8 @@ from Tkinter import * +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * class ScrolledList: Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py Sat Jun 7 00:16:57 2008 @@ -21,10 +21,10 @@ return _setup(text).find_selection(text) class SearchDialog(SearchDialogBase): + bottom_btns = [("Find", 'default_command', 1)] def create_widgets(self): - f = SearchDialogBase.create_widgets(self) - self.make_button("Find", self.default_command, 1) + SearchDialogBase.create_widgets(self) def default_command(self, event=None): if not self.engine.getprog(): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py Sat Jun 7 00:16:57 2008 @@ -1,35 +1,40 @@ from Tkinter import * +from idlelib.configHandler import idleConf + +if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): + from ttk import * class SearchDialogBase: title = "Search Dialog" icon = "Search" needwrapbutton = 1 + bottom_btns = None def __init__(self, root, engine): self.root = root self.engine = engine - self.top = None + self.ttop = None def open(self, text, searchphrase=None): self.text = text - if not self.top: + if not self.ttop: self.create_widgets() else: - self.top.deiconify() - self.top.tkraise() + self.ttop.deiconify() + self.ttop.tkraise() if searchphrase: - self.ent.delete(0,"end") - self.ent.insert("end",searchphrase) + self.ent.delete(0, "end") + self.ent.insert("end", searchphrase) self.ent.focus_set() self.ent.selection_range(0, "end") self.ent.icursor(0) - self.top.grab_set() + self.ttop.grab_set() def close(self, event=None): - if self.top: - self.top.grab_release() - self.top.withdraw() + if self.ttop: + self.ttop.grab_release() + self.ttop.withdraw() def create_widgets(self): top = Toplevel(self.root) @@ -38,103 +43,96 @@ top.protocol("WM_DELETE_WINDOW", self.close) top.wm_title(self.title) top.wm_iconname(self.icon) - self.top = top + top.resizable(height=FALSE,width=FALSE) + self.ttop = top + self.top = Frame(top) self.row = 0 - self.top.grid_columnconfigure(0, pad=2, weight=0) - self.top.grid_columnconfigure(1, pad=2, minsize=100, weight=100) + self.top.grid(sticky='news') self.create_entries() self.create_option_buttons() self.create_other_buttons() - return self.create_command_buttons() + self.create_command_buttons() + def make_entry(self, label, var): l = Label(self.top, text=label) - l.grid(row=self.row, column=0, sticky="nw") + l.grid(row=self.row, column=0, sticky="ne", padx=6, pady=6) e = Entry(self.top, textvariable=var, exportselection=0) - e.grid(row=self.row, column=1, sticky="nwe") + e.grid(row=self.row, column=1, sticky="nwe", padx=6, pady=6) self.row = self.row + 1 return e def make_frame(self,labeltext=None): if labeltext: l = Label(self.top, text=labeltext) - l.grid(row=self.row, column=0, sticky="nw") + l.grid(row=self.row, column=0, sticky="ne", padx=6, pady=6) f = Frame(self.top) - f.grid(row=self.row, column=1, columnspan=1, sticky="nwe") + f.grid(row=self.row, column=1, columnspan=1, sticky="nwe", + padx=6, pady=6 if labeltext else 0) self.row = self.row + 1 return f - def make_button(self, label, command, isdef=0): - b = Button(self.buttonframe, - text=label, command=command, - default=isdef and "active" or "normal") - cols,rows=self.buttonframe.grid_size() - b.grid(pady=1,row=rows,column=0,sticky="ew") - self.buttonframe.grid(rowspan=rows+1) - return b - def create_entries(self): - self.ent = self.make_entry("Find:", self.engine.patvar) + self.ent = self.make_entry("Find", self.engine.patvar) def create_option_buttons(self): f = self.make_frame("Options") - btn = Checkbutton(f, anchor="w", - variable=self.engine.revar, - text="Regular expression") + btn = Checkbutton(f, variable=self.engine.revar, + text="Regular expression") btn.pack(side="left", fill="both") if self.engine.isre(): - btn.select() + btn.invoke() - btn = Checkbutton(f, anchor="w", - variable=self.engine.casevar, - text="Match case") + btn = Checkbutton(f, variable=self.engine.casevar, text="Match case") btn.pack(side="left", fill="both") if self.engine.iscase(): - btn.select() + btn.invoke() - btn = Checkbutton(f, anchor="w", - variable=self.engine.wordvar, - text="Whole word") + btn = Checkbutton(f, variable=self.engine.wordvar, text="Whole word") btn.pack(side="left", fill="both") if self.engine.isword(): - btn.select() + btn.invoke() if self.needwrapbutton: - btn = Checkbutton(f, anchor="w", - variable=self.engine.wrapvar, - text="Wrap around") + btn = Checkbutton(f, variable=self.engine.wrapvar, + text="Wrap around") btn.pack(side="left", fill="both") if self.engine.iswrap(): - btn.select() + btn.invoke() def create_other_buttons(self): f = self.make_frame("Direction") - #lbl = Label(f, text="Direction: ") - #lbl.pack(side="left") - - btn = Radiobutton(f, anchor="w", - variable=self.engine.backvar, value=1, - text="Up") - btn.pack(side="left", fill="both") + btn = Radiobutton(f, variable=self.engine.backvar, value=1, text="Up") + btn.pack(side="left") if self.engine.isback(): - btn.select() + btn.invoke() - btn = Radiobutton(f, anchor="w", - variable=self.engine.backvar, value=0, - text="Down") - btn.pack(side="left", fill="both") + btn = Radiobutton(f, variable=self.engine.backvar, value=0, text="Down") + btn.pack(side="left") if not self.engine.isback(): - btn.select() + btn.invoke() def create_command_buttons(self): - # - # place button frame on the right - f = self.buttonframe = Frame(self.top) - f.grid(row=0,column=2,padx=2,pady=2,ipadx=2,ipady=2) + self.bottom_btns = self.bottom_btns or [] + f = Frame(self.top) + f.grid(row=self.row, column=0, columnspan=len(self.bottom_btns) + 1, + pady=6) - b = self.make_button("close", self.close) - b.lower() + column = 0 + b = Button(f, text="Close", command=self.close) + b.grid(row=self.row, column=column, padx=6, pady=6) + column += 1 + + btns = {} + for tbtn in self.bottom_btns: + opts = {'text': tbtn[0], 'command': getattr(self, tbtn[1])} + if len(tbtn) == 3: + opts['default'] = tbtn[2] and 'active' or 'normal' + + btns[opts['text']] = Button(f, **opts).grid(row=self.row, padx=6, + pady=6, column=column) + column += 1 Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py Sat Jun 7 00:16:57 2008 @@ -3,7 +3,8 @@ # may be useful for some purposes in (or almost in ;) the current project scope # Ideas gleaned from PySol -from Tkinter import * +from Tkinter import END, Listbox, Tk, Toplevel +from ttk import Button, Label class ToolTipBase: Modified: sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py Sat Jun 7 00:16:57 2008 @@ -21,6 +21,12 @@ import ZoomHeight from configHandler import idleConf +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + ICONDIR = "Icons" # Look for Icons subdirectory in the same directory as this module @@ -248,7 +254,9 @@ label = self.label except AttributeError: # padding carefully selected (on Windows) to match Entry widget: - self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2) + self.label = Label(self.canvas, text=text) + if not TTK: + self.label.configure(bd=0, padx=2, pady=2) theme = idleConf.GetOption('main','Theme','name') if self.selected: self.label.configure(idleConf.GetHighlight(theme, 'hilite')) @@ -451,6 +459,8 @@ # Testing functions +# XXX Can't run these tests + def test(): import PyShell root = Toplevel(PyShell.root) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py Sat Jun 7 00:16:57 2008 @@ -1,13 +1,17 @@ -"""About Dialog for IDLE - -""" - +"""About Dialog for IDLE""" from Tkinter import * import os import os.path import textView import idlever +from idlelib.stylist import PoorManStyle +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + class AboutDialog(Toplevel): """Modal about dialog for idle @@ -15,10 +19,13 @@ def __init__(self,parent,title): Toplevel.__init__(self, parent) self.configure(borderwidth=5) + self.geometry("+%d+%d" % (parent.winfo_rootx()+30, parent.winfo_rooty()+30)) self.bg = "#707070" self.fg = "#ffffff" + + self.SetupStyles() self.CreateWidgets() self.resizable(height=FALSE, width=FALSE) self.title(title) @@ -31,40 +38,44 @@ self.bind('',self.Ok) #dismiss dialog self.wait_window() + def SetupStyles(self): + if TTK: + style = Style(self.master) + style.configure('Color.TLabel', foreground=self.fg, + background=self.bg) + style.configure('Color.TFrame', background=self.bg) + self.ttkstyle = style + self.style = lambda w, style: w.configure(style=style) + else: + self.style = PoorManStyle(self, + styles={'Color.TLabel': {'fg': self.fg, 'bg': self.bg}, + 'Color.TFrame': {'bg': self.bg}}).style_it + def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) - frameButtons.pack(side=BOTTOM, fill=X) + frameButtons.pack(side=BOTTOM, pady=3) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) - self.buttonOk = Button(frameButtons, text='Close', - command=self.Ok) - self.buttonOk.pack(padx=5, pady=5) - #self.picture = Image('photo', data=self.pictureData) - frameBg = Frame(frameMain, bg=self.bg) + self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) + self.buttonOk.pack() + frameBg = Frame(frameMain) frameBg.pack(expand=TRUE, fill=BOTH) - labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, - font=('courier', 24, 'bold')) + labelTitle = Label(frameBg, text='IDLE', font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) - #labelPicture = Label(frameBg, text='[picture]') - #image=self.picture, bg=self.bg) - #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, - # padx=0, pady=3) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' - labelDesc = Label(frameBg, text=byline, justify=LEFT, - fg=self.fg, bg=self.bg) + labelDesc = Label(frameBg, text=byline, justify=LEFT) labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) labelEmail = Label(frameBg, text='email: idle-dev at python.org', - justify=LEFT, fg=self.fg, bg=self.bg) + justify=LEFT) labelEmail.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', - justify=LEFT, fg=self.fg, bg=self.bg) + justify=LEFT) labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) - Frame(frameBg, borderwidth=1, relief=SUNKEN, - height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, - columnspan=3, padx=5, pady=5) + fbg = Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2) + fbg.grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) labelPythonVer = Label(frameBg, text='Python version: ' + \ - sys.version.split()[0], fg=self.fg, bg=self.bg) + sys.version.split()[0]) labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = repr(TkVersion).split('.') @@ -72,44 +83,50 @@ if tkVer[len(tkVer)-1] == '': tkVer[len(tkVer)-1] = '0' tkVer = '.'.join(tkVer) - labelTkVer = Label(frameBg, text='Tk version: '+ - tkVer, fg=self.fg, bg=self.bg) + labelTkVer = Label(frameBg, text='Tk version: '+ tkVer) labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) - py_button_f = Frame(frameBg, bg=self.bg) + py_button_f = Frame(frameBg) py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) buttonLicense = Button(py_button_f, text='License', width=8, - highlightbackground=self.bg, command=self.ShowLicense) buttonLicense.pack(side=LEFT, padx=10, pady=10) buttonCopyright = Button(py_button_f, text='Copyright', width=8, - highlightbackground=self.bg, command=self.ShowCopyright) buttonCopyright.pack(side=LEFT, padx=10, pady=10) buttonCredits = Button(py_button_f, text='Credits', width=8, - highlightbackground=self.bg, command=self.ShowPythonCredits) buttonCredits.pack(side=LEFT, padx=10, pady=10) - Frame(frameBg, borderwidth=1, relief=SUNKEN, - height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, - columnspan=3, padx=5, pady=5) - idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION, - fg=self.fg, bg=self.bg) + fbg2 = Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2) + fbg2.grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) + idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) - idle_button_f = Frame(frameBg, bg=self.bg) + idle_button_f = Frame(frameBg) idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) idle_about_b = Button(idle_button_f, text='README', width=8, - highlightbackground=self.bg, command=self.ShowIDLEAbout) idle_about_b.pack(side=LEFT, padx=10, pady=10) idle_news_b = Button(idle_button_f, text='NEWS', width=8, - highlightbackground=self.bg, command=self.ShowIDLENEWS) idle_news_b.pack(side=LEFT, padx=10, pady=10) idle_credits_b = Button(idle_button_f, text='Credits', width=8, - highlightbackground=self.bg, command=self.ShowIDLECredits) idle_credits_b.pack(side=LEFT, padx=10, pady=10) + s = self.style + s(frameButtons, 'RootColor.TFrame') + s(frameBg, 'Color.TFrame') + s(labelTitle, 'Color.TLabel') + s(labelDesc, 'Color.TLabel') + s(labelEmail, 'Color.TLabel') + s(labelWWW, 'Color.TLabel') + s(fbg, 'Color.TFrame') + s(labelPythonVer, 'Color.TLabel') + s(labelTkVer, 'Color.TLabel') + s(py_button_f, 'Color.TFrame') + s(fbg2, 'Color.TFrame') + s(idle_v, 'Color.TLabel') + s(idle_button_f, 'Color.TFrame') + def ShowLicense(self): self.display_printer_text('About - License', license) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def Sat Jun 7 00:16:57 2008 @@ -49,6 +49,7 @@ print-command-posix=lpr %s print-command-win=start /min notepad /p %s delete-exitfunc= 1 +use-ttk=0 [EditorWindow] width= 80 Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py Sat Jun 7 00:16:57 2008 @@ -7,7 +7,6 @@ Note that tab width in IDLE is currently fixed at eight due to Tk issues. Refer to comments in EditorWindow autoindent code for details. - """ from Tkinter import * import tkMessageBox, tkColorChooser, tkFont @@ -19,6 +18,11 @@ from keybindingDialog import GetKeysDialog from configSectionNameDialog import GetCfgSectionNameDialog from configHelpSourceEdit import GetHelpSourceDialog +from stylist import PoorManStyle + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * class ConfigDialog(Toplevel): @@ -47,6 +51,7 @@ 'Shell Stderr Text':('stderr','12'), } self.ResetChangedItems() #load initial values in changed items dict + self.SetupStyles() self.CreateWidgets() self.resizable(height=FALSE,width=FALSE) self.transient(parent) @@ -64,32 +69,52 @@ self.wm_deiconify() self.wait_window() + def SetupStyles(self): + if TTK: + style = Style(self.master) + style.configure('S.TButton', padding=[6, 3]) + style.configure('S2.TFrame', padding=2) + style.configure('Color.TFrame', background='blue') + self.ttkstyle = style + self.style = lambda w, style: w.configure(style=style) + else: + self.ttkstyle = PoorManStyle(self, styles={ + 'S.TButton': {'pady': 6, 'padx': 3}, + 'S2.TFrame': {'padx': 2, 'pady': 2} + }, cfgstyles={'Color.TFrame': 'frameColourSet'}) + self.style = self.ttkstyle.style_it + def CreateWidgets(self): self.tabPages = TabbedPageSet(self, page_names=['Fonts/Tabs','Highlighting','Keys','General']) - frameActionButtons = Frame(self,pady=2) + frameActionButtons = Frame(self) #action buttons self.buttonHelp = Button(frameActionButtons,text='Help', - command=self.Help,takefocus=FALSE, - padx=6,pady=3) - self.buttonOk = Button(frameActionButtons,text='Ok', - command=self.Ok,takefocus=FALSE, - padx=6,pady=3) - self.buttonApply = Button(frameActionButtons,text='Apply', - command=self.Apply,takefocus=FALSE, - padx=6,pady=3) - self.buttonCancel = Button(frameActionButtons,text='Cancel', - command=self.Cancel,takefocus=FALSE, - padx=6,pady=3) + command=self.Help, takefocus=FALSE) + self.buttonOk = Button(frameActionButtons, text='Ok', + command=self.Ok, takefocus=FALSE) + self.buttonApply = Button(frameActionButtons, text='Apply', + command=self.Apply, takefocus=FALSE) + self.buttonCancel = Button(frameActionButtons, text='Cancel', + command=self.Cancel, takefocus=FALSE) + + # Apply styles + s = self.style + s(frameActionButtons, 'RootColor.TFrame') + s(self.buttonHelp, 'S.TButton') + s(self.buttonOk, 'S.TButton') + s(self.buttonApply, 'S.TButton') + s(self.buttonCancel, 'S.TButton') + self.CreatePageFontTab() self.CreatePageHighlight() self.CreatePageKeys() self.CreatePageGeneral() - self.buttonHelp.pack(side=RIGHT,padx=5) - self.buttonOk.pack(side=LEFT,padx=5) - self.buttonApply.pack(side=LEFT,padx=5) - self.buttonCancel.pack(side=LEFT,padx=5) - frameActionButtons.pack(side=BOTTOM) + self.buttonHelp.pack(side=LEFT, pady=6) + self.buttonApply.pack(side=RIGHT, pady=6) + self.buttonOk.pack(side=RIGHT, padx=6, pady=6) + self.buttonCancel.pack(side=RIGHT, pady=6) + frameActionButtons.pack(side=BOTTOM, fill=X, expand=TRUE) Frame(self, height=2, borderwidth=0).pack(side=BOTTOM) self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH) @@ -127,14 +152,11 @@ frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', - justify=LEFT,font=self.editFont) + justify=LEFT, font=self.editFont) #frameIndent frameIndentSize=Frame(frameIndent) labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT, text='Python Standard: 4 Spaces!') - self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum, - orient='horizontal', - tickinterval=2, from_=2, to=16) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) @@ -149,11 +171,20 @@ self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) - self.labelFontSample.pack(expand=TRUE,fill=BOTH) + self.labelFontSample.pack(expand=1, fill=Y) #frameIndent frameIndentSize.pack(side=TOP,fill=X) - labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) - self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) + labelSpaceNumTitle.pack(side=TOP, anchor=W, padx=5, pady=6) + + if TTK: + self.scaleSpaceNum = LabeledScale(frameIndentSize, self.spaceNum, + from_=2, to=16, padding=2) + else: + self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum, + orient='horizontal', from_=2, to=16, tickinterval=2) + + self.scaleSpaceNum.pack(side=TOP, padx=5, fill=X) + return frame def CreatePageHighlight(self): @@ -174,7 +205,7 @@ text=' Highlighting Theme ') #frameCustom self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1, - font=('courier',12,''),cursor='hand2',width=21,height=10, + font=('courier',12,''), cursor='hand2', width=21, height=11, takefocus=FALSE,highlightthickness=0,wrap=NONE) text=self.textHighlightSample text.bind('',lambda e: 'break') @@ -197,12 +228,15 @@ lambda event,elem=element: event.widget.winfo_toplevel() .highlightTarget.set(elem)) text.config(state=DISABLED) - self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1) + + self.frameColourSet=Frame(frameCustom, relief=SOLID, borderwidth=1) + self.style(self.frameColourSet, 'Color.TFrame') + frameFgBg=Frame(frameCustom) buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :', - command=self.GetColour,highlightthickness=0) + command=self.GetColour) # XXX self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet, - self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding + self.highlightTarget, None) # XXX self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite, value=1,text='Foreground',command=self.SetColourSampleBinding) self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite, @@ -275,8 +309,11 @@ self.buttonNewKeys=Button(frameCustom,text='Get New Keys for Selection', command=self.GetNewKeys,state=DISABLED) #frameKeySets - frames = [Frame(frameKeySets, padx=2, pady=2, borderwidth=0) - for i in range(2)] + frames = [] + for i in range(2): + f = Frame(frameKeySets, borderwidth=0) + self.style(f, 'S2.TFrame') + frames.append(f) self.radioKeysBuiltin=Radiobutton(frames[0],variable=self.keysAreBuiltin, value=1,command=self.SetKeysType,text='Use a Built-in Key Set') self.radioKeysCustom=Radiobutton(frames[0],variable=self.keysAreBuiltin, @@ -748,14 +785,14 @@ def GetColour(self): target=self.highlightTarget.get() - prevColour=self.frameColourSet.cget('bg') + prevColour = self.ttkstyle.configure('Color.TFrame', 'background') rgbTuplet, colourString = tkColorChooser.askcolor(parent=self, title='Pick new colour for : '+target,initialcolor=prevColour) if colourString and (colourString!=prevColour): #user didn't cancel, and they chose a new colour if self.themeIsBuiltin.get(): #current theme is a built-in - message=('Your changes will be saved as a new Custom Theme. '+ - 'Enter a name for your new Custom Theme below.') + message=("Your changes will be saved as a new Custom Theme. " + "Enter a name for your new Custom Theme below.") newTheme=self.GetNewThemeName(message) if not newTheme: #user cancelled custom theme creation return @@ -767,7 +804,7 @@ def OnNewColourSet(self): newColour=self.colour.get() - self.frameColourSet.config(bg=newColour)#set sample + self.ttkstyle.configure('Color.TFrame', background=newColour) if self.fgHilite.get(): plane='foreground' else: plane='background' sampleElement=self.themeElements[self.highlightTarget.get()][0] @@ -777,6 +814,7 @@ self.AddChangedItem('highlight',theme,themeElement,newColour) def GetNewThemeName(self,message): + # XXX idle bug here usedNames=(idleConf.GetSectionList('user','highlight')+ idleConf.GetSectionList('default','highlight')) newTheme=GetCfgSectionNameDialog(self,'New Custom Theme', @@ -846,7 +884,7 @@ if self.fgHilite.get(): plane='foreground' else: plane='background' colour=self.textHighlightSample.tag_cget(tag,plane) - self.frameColourSet.config(bg=colour) + self.ttkstyle.configure('Color.TFrame', background=colour) def PaintThemeSample(self): if self.themeIsBuiltin.get(): #a default theme Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py Sat Jun 7 00:16:57 2008 @@ -1,12 +1,16 @@ "Dialog to specify or edit the parameters for a user configured help source." - import os import sys - from Tkinter import * import tkMessageBox import tkFileDialog +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + class GetHelpSourceDialog(Toplevel): def __init__(self, parent, title, menuItem='', filePath=''): """Get menu entry and url/ local file location for Additional Help @@ -25,6 +29,7 @@ self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.result = None + self.CreateWidgets() self.menu.set(menuItem) self.path.set(filePath) @@ -46,32 +51,35 @@ self.path = StringVar(self) self.fontSize = StringVar(self) self.frameMain = Frame(self, borderwidth=2, relief=GROOVE) - self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) labelMenu = Label(self.frameMain, anchor=W, justify=LEFT, - text='Menu Item:') - self.entryMenu = Entry(self.frameMain, textvariable=self.menu, - width=30) - self.entryMenu.focus_set() + text='Menu Item:') + self.entryMenu = Entry(self.frameMain, textvariable=self.menu) labelPath = Label(self.frameMain, anchor=W, justify=LEFT, - text='Help File Path: Enter URL or browse for file') + text='Help File Path: Enter URL or browse for file') self.entryPath = Entry(self.frameMain, textvariable=self.path, - width=40) + width=30) + browseButton = Button(self.frameMain, text='Browse', width=8, + command=self.browseFile) + frameButtons = Frame(self) + self.buttonOk = Button(frameButtons, text='OK', width=8, + default=ACTIVE, command=self.Ok) + self.buttonCancel = Button(frameButtons, text='Cancel', width=8, + command=self.Cancel) + self.entryMenu.focus_set() + + self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) labelMenu.pack(anchor=W, padx=5, pady=3) - self.entryMenu.pack(anchor=W, padx=5, pady=3) + self.entryMenu.pack(anchor=W, padx=5, pady=3, fill=X) labelPath.pack(anchor=W, padx=5, pady=3) - self.entryPath.pack(anchor=W, padx=5, pady=3) - browseButton = Button(self.frameMain, text='Browse', width=8, - command=self.browseFile) - browseButton.pack(pady=3) - frameButtons = Frame(self) + self.entryPath.pack(anchor=W, padx=5, pady=3, side=LEFT, fill=X) + browseButton.pack(pady=3, padx=5, side=RIGHT) frameButtons.pack(side=BOTTOM, fill=X) - self.buttonOk = Button(frameButtons, text='OK', - width=8, default=ACTIVE, command=self.Ok) - self.buttonOk.grid(row=0, column=0, padx=5,pady=5) - self.buttonCancel = Button(frameButtons, text='Cancel', - width=8, command=self.Cancel) - self.buttonCancel.grid(row=0, column=1, padx=5, pady=5) + self.buttonOk.pack(pady=5, side=RIGHT) + self.buttonCancel.pack(padx=5, pady=5, side=RIGHT) + + if TTK: + frameButtons['style'] = 'RootColor.TFrame' def browseFile(self): filetypes = [ Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py Sat Jun 7 00:16:57 2008 @@ -5,93 +5,106 @@ from Tkinter import * import tkMessageBox +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + class GetCfgSectionNameDialog(Toplevel): - def __init__(self,parent,title,message,usedNames): + def __init__(self, parent, title, message, usedNames): """ message - string, informational message to display usedNames - list, list of names already in use for validity check """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) - self.resizable(height=FALSE,width=FALSE) + self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent - self.message=message - self.usedNames=usedNames - self.result='' + self.message = message + self.usedNames = usedNames + self.result = '' self.CreateWidgets() self.withdraw() #hide while setting geometry self.update_idletasks() - #needs to be done here so that the winfo_reqwidth is valid - self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) self.geometry("+%d+%d" % - ((parent.winfo_rootx()+((parent.winfo_width()/2) - -(self.winfo_reqwidth()/2)), - parent.winfo_rooty()+((parent.winfo_height()/2) - -(self.winfo_reqheight()/2)) )) ) #centre dialog over parent + ((parent.winfo_rootx() + ((parent.winfo_width() / 2) + - (self.winfo_reqwidth() / 2)), + parent.winfo_rooty() + ((parent.winfo_height() / 2) + - (self.winfo_reqheight() / 2)) )) ) #centre dialog over parent self.deiconify() #geometry set, unhide self.wait_window() def CreateWidgets(self): - self.name=StringVar(self) - self.fontSize=StringVar(self) - self.frameMain = Frame(self,borderwidth=2,relief=SUNKEN) - self.frameMain.pack(side=TOP,expand=TRUE,fill=BOTH) - self.messageInfo=Message(self.frameMain,anchor=W,justify=LEFT,padx=5,pady=5, - text=self.message)#,aspect=200) - entryName=Entry(self.frameMain,textvariable=self.name,width=30) + self.name = StringVar(self) + self.fontSize = StringVar(self) + self.frameMain = Frame(self, borderwidth=2, relief=SUNKEN) + self.messageInfo = Label(self.frameMain, text=self.message) + entryName = Entry(self.frameMain, textvariable=self.name, width=30) + frameButtons = Frame(self) + self.buttonOk = Button(frameButtons, text='Ok', command=self.Ok) + self.buttonCancel = Button(frameButtons, text='Cancel', + command=self.Cancel) + entryName.focus_set() - self.messageInfo.pack(padx=5,pady=5)#,expand=TRUE,fill=BOTH) - entryName.pack(padx=5,pady=5) - frameButtons=Frame(self) - frameButtons.pack(side=BOTTOM,fill=X) - self.buttonOk = Button(frameButtons,text='Ok', - width=8,command=self.Ok) - self.buttonOk.grid(row=0,column=0,padx=5,pady=5) - self.buttonCancel = Button(frameButtons,text='Cancel', - width=8,command=self.Cancel) - self.buttonCancel.grid(row=0,column=1,padx=5,pady=5) + + self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) + self.messageInfo.pack(padx=5, pady=5) + entryName.pack(padx=5, pady=5) + frameButtons.pack(side=BOTTOM, fill=X) + self.buttonOk.pack(padx=1, pady=5, side=RIGHT) + self.buttonCancel.pack(pady=5, padx=5, side=RIGHT) + + if TTK: + self.messageInfo['padding'] = 5 + frameButtons['style'] = 'RootColor.TFrame' + else: + self.messageInfo.configure(padx=5, pady=5) def NameOk(self): #simple validity check for a sensible #ConfigParser file section name - nameOk=1 - name=self.name.get() + nameOk = 1 + name = self.name.get() name.strip() + if not name: #no name specified tkMessageBox.showerror(title='Name Error', - message='No name specified.', parent=self) - nameOk=0 - elif len(name)>30: #name too long + message='No name specified.', parent=self) + nameOk = 0 + elif len(name) > 30: #name too long tkMessageBox.showerror(title='Name Error', - message='Name too long. It should be no more than '+ - '30 characters.', parent=self) + message=('Name too long. It should be no more than ' + '30 characters.'), parent=self) nameOk=0 elif name in self.usedNames: tkMessageBox.showerror(title='Name Error', message='This name is already in use.', parent=self) nameOk=0 + return nameOk def Ok(self, event=None): if self.NameOk(): - self.result=self.name.get().strip() + self.result = self.name.get().strip() self.destroy() def Cancel(self, event=None): - self.result='' + self.result = '' self.destroy() if __name__ == '__main__': #test the dialog - root=Tk() def run(): - keySeq='' - dlg=GetCfgSectionNameDialog(root,'Get Name', - 'The information here should need to be word wrapped. Test.') + keySeq = '' + dlg = GetCfgSectionNameDialog(root, 'Get Name', + 'The information here should need to be word wrapped. Test.') print dlg.result - Button(root,text='Dialog',command=run).pack() + + root=Tk() + Button(root, text='Dialog', command=run).pack() root.mainloop() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/dynOptionMenuWidget.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/dynOptionMenuWidget.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/dynOptionMenuWidget.py Sat Jun 7 00:16:57 2008 @@ -2,34 +2,41 @@ OptionMenu widget modified to allow dynamic menu reconfiguration and setting of highlightthickness """ -from Tkinter import OptionMenu +from Tkinter import OptionMenu, Menu from Tkinter import _setit import copy +from configHandler import idleConf +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + class DynOptionMenu(OptionMenu): - """ - unlike OptionMenu, our kwargs can include highlightthickness - """ + """Unlike OptionMenu, our kwargs can include highlightthickness""" def __init__(self, master, variable, value, *values, **kwargs): #get a copy of kwargs before OptionMenu.__init__ munges them kwargsCopy=copy.copy(kwargs) if 'highlightthickness' in kwargs.keys(): del(kwargs['highlightthickness']) + self.command=kwargs.get('command') + self.variable=variable + OptionMenu.__init__(self, master, variable, value, *values, **kwargs) self.config(highlightthickness=kwargsCopy.get('highlightthickness')) - #self.menu=self['menu'] - self.variable=variable - self.command=kwargs.get('command') - def SetMenu(self,valueList,value=None): + def SetMenu(self, valueList, value=None): """ clear and reload the menu with a new set of options. valueList - list of new options value - initial value to set the optionmenu's menubutton to """ - self['menu'].delete(0,'end') - for item in valueList: - self['menu'].add_command(label=item, + if TTK: + self.set_menu(value, *valueList) + else: + menu = self['menu'] + menu.delete(0,'end') + for item in valueList: + menu.add_command(label=item, command=_setit(self.variable,item,self.command)) - if value: - self.variable.set(value) + if value: + self.variable.set(value) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py Sat Jun 7 00:16:57 2008 @@ -5,6 +5,12 @@ import tkMessageBox import string +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * + class GetKeysDialog(Toplevel): def __init__(self,parent,title,action,currentKeySequences): """ @@ -124,6 +130,9 @@ "separated by a space, eg., ." ) labelHelpAdvanced.grid(row=0,column=0,sticky=NSEW) + if TTK: + frameButtons['style'] = 'RootColor.TFrame' + def SetModifiersForPlatform(self): """Determine list of names of key modifiers for this platform. Added: sandbox/trunk/ttk-gsoc/src/idlelib/stylist.py ============================================================================== --- (empty file) +++ sandbox/trunk/ttk-gsoc/src/idlelib/stylist.py Sat Jun 7 00:16:57 2008 @@ -0,0 +1,29 @@ +from configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') + +class PoorManStyle(object): + def __init__(self, parent, styles=None, cfgstyles=None): + self.parent = parent + self.cfgstyles = cfgstyles + self.styles = styles + + def configure(self, style, lookup=None, background=None): + if style not in self.cfgstyles: # passed wrong style probably + return + + widget = getattr(self.parent, self.cfgstyles[style]) + if lookup: + return widget.cget('bg') + + widget.configure(bg=background) + + def style_it(self, w, style): + if TTK: + w['style'] = style + return + + if not style in self.styles: # may not need to be styled + return + + w.configure(**self.styles[style]) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages.py Sat Jun 7 00:16:57 2008 @@ -1,490 +1,4 @@ -"""An implementation of tabbed pages using only standard Tkinter. - -Originally developed for use in IDLE. Based on tabpage.py. - -Classes exported: -TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. -TabSet -- A widget containing tabs (buttons) in one or more rows. - -""" -from Tkinter import * - -class InvalidNameError(Exception): pass -class AlreadyExistsError(Exception): pass - - -class TabSet(Frame): - """A widget containing tabs (buttons) in one or more rows. - - Only one tab may be selected at a time. - - """ - def __init__(self, page_set, select_command, - tabs=None, n_rows=1, max_tabs_per_row=5, - expand_tabs=False, **kw): - """Constructor arguments: - - select_command -- A callable which will be called when a tab is - selected. It is called with the name of the selected tab as an - argument. - - tabs -- A list of strings, the names of the tabs. Should be specified in - the desired tab order. The first tab will be the default and first - active tab. If tabs is None or empty, the TabSet will be initialized - empty. - - n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is - None, then the number of rows will be decided by TabSet. See - _arrange_tabs() for details. - - max_tabs_per_row -- Used for deciding how many rows of tabs are needed, - when the number of rows is not constant. See _arrange_tabs() for - details. - - """ - Frame.__init__(self, page_set, **kw) - self.select_command = select_command - self.n_rows = n_rows - self.max_tabs_per_row = max_tabs_per_row - self.expand_tabs = expand_tabs - self.page_set = page_set - - self._tabs = {} - self._tab2row = {} - if tabs: - self._tab_names = list(tabs) - else: - self._tab_names = [] - self._selected_tab = None - self._tab_rows = [] - - self.padding_frame = Frame(self, height=2, - borderwidth=0, relief=FLAT, - background=self.cget('background')) - self.padding_frame.pack(side=TOP, fill=X, expand=False) - - self._arrange_tabs() - - def add_tab(self, tab_name): - """Add a new tab with the name given in tab_name.""" - if not tab_name: - raise InvalidNameError("Invalid Tab name: '%s'" % tab_name) - if tab_name in self._tab_names: - raise AlreadyExistsError("Tab named '%s' already exists" %tab_name) - - self._tab_names.append(tab_name) - self._arrange_tabs() - - def remove_tab(self, tab_name): - """Remove the tab named """ - if not tab_name in self._tab_names: - raise KeyError("No such Tab: '%s" % page_name) - - self._tab_names.remove(tab_name) - self._arrange_tabs() - - def set_selected_tab(self, tab_name): - """Show the tab named as the selected one""" - if tab_name == self._selected_tab: - return - if tab_name is not None and tab_name not in self._tabs: - raise KeyError("No such Tab: '%s" % page_name) - - # deselect the current selected tab - if self._selected_tab is not None: - self._tabs[self._selected_tab].set_normal() - self._selected_tab = None - - if tab_name is not None: - # activate the tab named tab_name - self._selected_tab = tab_name - tab = self._tabs[tab_name] - tab.set_selected() - # move the tab row with the selected tab to the bottom - tab_row = self._tab2row[tab] - tab_row.pack_forget() - tab_row.pack(side=TOP, fill=X, expand=0) - - def _add_tab_row(self, tab_names, expand_tabs): - if not tab_names: - return - - tab_row = Frame(self) - tab_row.pack(side=TOP, fill=X, expand=0) - self._tab_rows.append(tab_row) - - for tab_name in tab_names: - tab = TabSet.TabButton(tab_name, self.select_command, - tab_row, self) - if expand_tabs: - tab.pack(side=LEFT, fill=X, expand=True) - else: - tab.pack(side=LEFT) - self._tabs[tab_name] = tab - self._tab2row[tab] = tab_row - - # tab is the last one created in the above loop - tab.is_last_in_row = True - - def _reset_tab_rows(self): - while self._tab_rows: - tab_row = self._tab_rows.pop() - tab_row.destroy() - self._tab2row = {} - - def _arrange_tabs(self): - """ - Arrange the tabs in rows, in the order in which they were added. - - If n_rows >= 1, this will be the number of rows used. Otherwise the - number of rows will be calculated according to the number of tabs and - max_tabs_per_row. In this case, the number of rows may change when - adding/removing tabs. - - """ - # remove all tabs and rows - for tab_name in self._tabs.keys(): - self._tabs.pop(tab_name).destroy() - self._reset_tab_rows() - - if not self._tab_names: - return - - if self.n_rows is not None and self.n_rows > 0: - n_rows = self.n_rows - else: - # calculate the required number of rows - n_rows = (len(self._tab_names) - 1) // self.max_tabs_per_row + 1 - - # not expanding the tabs with more than one row is very ugly - expand_tabs = self.expand_tabs or n_rows > 1 - i = 0 # index in self._tab_names - for row_index in xrange(n_rows): - # calculate required number of tabs in this row - n_tabs = (len(self._tab_names) - i - 1) // (n_rows - row_index) + 1 - tab_names = self._tab_names[i:i + n_tabs] - i += n_tabs - self._add_tab_row(tab_names, expand_tabs) - - # re-select selected tab so it is properly displayed - selected = self._selected_tab - self.set_selected_tab(None) - if selected in self._tab_names: - self.set_selected_tab(selected) - - class TabButton(Frame): - """A simple tab-like widget.""" - - bw = 2 # borderwidth - - def __init__(self, name, select_command, tab_row, tab_set): - """Constructor arguments: - - name -- The tab's name, which will appear in its button. - - select_command -- The command to be called upon selection of the - tab. It is called with the tab's name as an argument. - - """ - Frame.__init__(self, tab_row, borderwidth=self.bw, relief=RAISED) - - self.name = name - self.select_command = select_command - self.tab_set = tab_set - self.is_last_in_row = False - - self.button = Radiobutton( - self, text=name, command=self._select_event, - padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, - highlightthickness=0, selectcolor='', borderwidth=0) - self.button.pack(side=LEFT, fill=X, expand=True) - - self._init_masks() - self.set_normal() - - def _select_event(self, *args): - """Event handler for tab selection. - - With TabbedPageSet, this calls TabbedPageSet.change_page, so that - selecting a tab changes the page. - - Note that this does -not- call set_selected -- it will be called by - TabSet.set_selected_tab, which should be called when whatever the - tabs are related to changes. - - """ - self.select_command(self.name) - return - - def set_selected(self): - """Assume selected look""" - self._place_masks(selected=True) - - def set_normal(self): - """Assume normal look""" - self._place_masks(selected=False) - - def _init_masks(self): - page_set = self.tab_set.page_set - background = page_set.pages_frame.cget('background') - # mask replaces the middle of the border with the background color - self.mask = Frame(page_set, borderwidth=0, relief=FLAT, - background=background) - # mskl replaces the bottom-left corner of the border with a normal - # left border - self.mskl = Frame(page_set, borderwidth=0, relief=FLAT, - background=background) - self.mskl.ml = Frame(self.mskl, borderwidth=self.bw, - relief=RAISED) - self.mskl.ml.place(x=0, y=-self.bw, - width=2*self.bw, height=self.bw*4) - # mskr replaces the bottom-right corner of the border with a normal - # right border - self.mskr = Frame(page_set, borderwidth=0, relief=FLAT, - background=background) - self.mskr.mr = Frame(self.mskr, borderwidth=self.bw, - relief=RAISED) - - def _place_masks(self, selected=False): - height = self.bw - if selected: - height += self.bw - - self.mask.place(in_=self, - relx=0.0, x=0, - rely=1.0, y=0, - relwidth=1.0, width=0, - relheight=0.0, height=height) - - self.mskl.place(in_=self, - relx=0.0, x=-self.bw, - rely=1.0, y=0, - relwidth=0.0, width=self.bw, - relheight=0.0, height=height) - - page_set = self.tab_set.page_set - if selected and ((not self.is_last_in_row) or - (self.winfo_rootx() + self.winfo_width() < - page_set.winfo_rootx() + page_set.winfo_width()) - ): - # for a selected tab, if its rightmost edge isn't on the - # rightmost edge of the page set, the right mask should be one - # borderwidth shorter (vertically) - height -= self.bw - - self.mskr.place(in_=self, - relx=1.0, x=0, - rely=1.0, y=0, - relwidth=0.0, width=self.bw, - relheight=0.0, height=height) - - self.mskr.mr.place(x=-self.bw, y=-self.bw, - width=2*self.bw, height=height + self.bw*2) - - # finally, lower the tab set so that all of the frames we just - # placed hide it - self.tab_set.lower() - -class TabbedPageSet(Frame): - """A Tkinter tabbed-pane widget. - - Constains set of 'pages' (or 'panes') with tabs above for selecting which - page is displayed. Only one page will be displayed at a time. - - Pages may be accessed through the 'pages' attribute, which is a dictionary - of pages, using the name given as the key. A page is an instance of a - subclass of Tk's Frame widget. - - The page widgets will be created (and destroyed when required) by the - TabbedPageSet. Do not call the page's pack/place/grid/destroy methods. - - Pages may be added or removed at any time using the add_page() and - remove_page() methods. - - """ - class Page(object): - """Abstract base class for TabbedPageSet's pages. - - Subclasses must override the _show() and _hide() methods. - - """ - uses_grid = False - - def __init__(self, page_set): - self.frame = Frame(page_set, borderwidth=2, relief=RAISED) - - def _show(self): - raise NotImplementedError - - def _hide(self): - raise NotImplementedError - - class PageRemove(Page): - """Page class using the grid placement manager's "remove" mechanism.""" - uses_grid = True - - def _show(self): - self.frame.grid(row=0, column=0, sticky=NSEW) - - def _hide(self): - self.frame.grid_remove() - - class PageLift(Page): - """Page class using the grid placement manager's "lift" mechanism.""" - uses_grid = True - - def __init__(self, page_set): - super(TabbedPageSet.PageLift, self).__init__(page_set) - self.frame.grid(row=0, column=0, sticky=NSEW) - self.frame.lower() - - def _show(self): - self.frame.lift() - - def _hide(self): - self.frame.lower() - - class PagePackForget(Page): - """Page class using the pack placement manager's "forget" mechanism.""" - def _show(self): - self.frame.pack(fill=BOTH, expand=True) - - def _hide(self): - self.frame.pack_forget() - - def __init__(self, parent, page_names=None, page_class=PageLift, - n_rows=1, max_tabs_per_row=5, expand_tabs=False, - **kw): - """Constructor arguments: - - page_names -- A list of strings, each will be the dictionary key to a - page's widget, and the name displayed on the page's tab. Should be - specified in the desired page order. The first page will be the default - and first active page. If page_names is None or empty, the - TabbedPageSet will be initialized empty. - - n_rows, max_tabs_per_row -- Parameters for the TabSet which will - manage the tabs. See TabSet's docs for details. - - page_class -- Pages can be shown/hidden using three mechanisms: - - * PageLift - All pages will be rendered one on top of the other. When - a page is selected, it will be brought to the top, thus hiding all - other pages. Using this method, the TabbedPageSet will not be resized - when pages are switched. (It may still be resized when pages are - added/removed.) - - * PageRemove - When a page is selected, the currently showing page is - hidden, and the new page shown in its place. Using this method, the - TabbedPageSet may resize when pages are changed. - - * PagePackForget - This mechanism uses the pack placement manager. - When a page is shown it is packed, and when it is hidden it is - unpacked (i.e. pack_forget). This mechanism may also cause the - TabbedPageSet to resize when the page is changed. - - """ - Frame.__init__(self, parent, **kw) - - self.page_class = page_class - self.pages = {} - self._pages_order = [] - self._current_page = None - self._default_page = None - - self.columnconfigure(0, weight=1) - self.rowconfigure(1, weight=1) - - self.pages_frame = Frame(self) - self.pages_frame.grid(row=1, column=0, sticky=NSEW) - if self.page_class.uses_grid: - self.pages_frame.columnconfigure(0, weight=1) - self.pages_frame.rowconfigure(0, weight=1) - - # the order of the following commands is important - self._tab_set = TabSet(self, self.change_page, n_rows=n_rows, - max_tabs_per_row=max_tabs_per_row, - expand_tabs=expand_tabs) - if page_names: - for name in page_names: - self.add_page(name) - self._tab_set.grid(row=0, column=0, sticky=NSEW) - - self.change_page(self._default_page) - - def add_page(self, page_name): - """Add a new page with the name given in page_name.""" - if not page_name: - raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) - if page_name in self.pages: - raise AlreadyExistsError( - "TabPage named '%s' already exists" % page_name) - - self.pages[page_name] = self.page_class(self.pages_frame) - self._pages_order.append(page_name) - self._tab_set.add_tab(page_name) - - if len(self.pages) == 1: # adding first page - self._default_page = page_name - self.change_page(page_name) - - def remove_page(self, page_name): - """Destroy the page whose name is given in page_name.""" - if not page_name in self.pages: - raise KeyError("No such TabPage: '%s" % page_name) - - self._pages_order.remove(page_name) - - # handle removing last remaining, default, or currently shown page - if len(self._pages_order) > 0: - if page_name == self._default_page: - # set a new default page - self._default_page = self._pages_order[0] - else: - self._default_page = None - - if page_name == self._current_page: - self.change_page(self._default_page) - - self._tab_set.remove_tab(page_name) - page = self.pages.pop(page_name) - page.frame.destroy() - - def change_page(self, page_name): - """Show the page whose name is given in page_name.""" - if self._current_page == page_name: - return - if page_name is not None and page_name not in self.pages: - raise KeyError("No such TabPage: '%s'" % page_name) - - if self._current_page is not None: - self.pages[self._current_page]._hide() - self._current_page = None - - if page_name is not None: - self._current_page = page_name - self.pages[page_name]._show() - - self._tab_set.set_selected_tab(page_name) - -if __name__ == '__main__': - # test dialog - root=Tk() - tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, - expand_tabs=False, - ) - tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) - Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() - Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() - Label(tabPage.pages['Baz'].frame, text='Baz').pack() - entryPgName=Entry(root) - buttonAdd=Button(root, text='Add Page', - command=lambda:tabPage.add_page(entryPgName.get())) - buttonRemove=Button(root, text='Remove Page', - command=lambda:tabPage.remove_page(entryPgName.get())) - labelPgName=Label(root, text='name of page to add/remove:') - buttonAdd.pack(padx=5, pady=5) - buttonRemove.pack(padx=5, pady=5) - labelPgName.pack(padx=5) - entryPgName.pack(padx=5) - root.mainloop() +try: + from idlelib.tabbedpages_new import TabbedPageSet +except ImportError: + from idlelib.tabbedpages_old import TabbedPageSet Added: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py ============================================================================== --- (empty file) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Sat Jun 7 00:16:57 2008 @@ -0,0 +1,85 @@ +"""Classes exported: + +TabbedPageSet -- A custom ttk.Notebook used by IDLE. +""" +from Tkinter import * +from ttk import * + +class InvalidNameError(Exception): pass +class AlreadyExistsError(Exception): pass + +class FramePage(object): + def __init__(self, notebook): + self.frame = Frame(notebook) + +class TabbedPageSet(Notebook): + """ + Pages may be accessed through the 'pages' attribute, which is a dictionary + of pages, using the name given as the key. A page is an instance of a + subclass of ttk's Frame widget. + + Pages may be added or removed at any time using the add_page() and + remove_page() methods. + """ + + def __init__(self, master, page_names=None, **kw): + """Constructor arguments: + + page_names -- A list of strings, each will be the dictionary key to a + page's widget, and the name displayed on the page's tab. Should be + specified in the desired page order. The first page will be the default + and first active page. If page_names is None or empty, the + TabbedPageSet will be initialized empty. + """ + Notebook.__init__(self, master, **kw) + + self.pages = {} + for name in page_names: + self.add_page(name) + + def add_page(self, page_name): + """Add a new page with the name given in page_name.""" + if not page_name: + raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) + if page_name in self.pages: + raise AlreadyExistsError( + "TabPage named '%s' already exists" % page_name) + + fpage = FramePage(self) + self.pages[page_name] = fpage + self.add(fpage.frame, text=page_name, padding=6) + + # workaround for bug #1878298 at tktoolkit sf bug tracker + self.event_generate('') + + def remove_page(self, page_name): + if not page_name in self.pages: + raise KeyError("No such TabPage: '%s" % page_name) + + self.forget(self.index(self.pages[page_name].frame)) + del self.pages[page_name] + + # workaround for bug #1878298 at tktoolkit sf bug tracker + self.event_generate('') + +if __name__ == '__main__': + # test dialog + root=Tk() + style = Style() + style.configure('C.TLabel', padding=20) + tabPage=TabbedPageSet(root, page_names=['Foobar','Baz']) + tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) + Label(tabPage.pages['Foobar'].frame, text='Foo', style='C.TLabel').pack() + Label(tabPage.pages['Foobar'].frame, text='Bar', style='C.TLabel').pack() + Label(tabPage.pages['Baz'].frame, text='Baz').pack() + entryPgName=Entry(root) + buttonAdd=Button(root, text='Add Page', + command=lambda:tabPage.add_page(entryPgName.get())) + buttonRemove=Button(root, text='Remove Page', + command=lambda:tabPage.remove_page(entryPgName.get())) + labelPgName=Label(root, text='name of page to add/remove:') + buttonAdd.pack(padx=5, pady=5) + buttonRemove.pack(padx=5, pady=5) + labelPgName.pack(padx=5) + entryPgName.pack(padx=5) + root.mainloop() Added: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py ============================================================================== --- (empty file) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py Sat Jun 7 00:16:57 2008 @@ -0,0 +1,490 @@ +"""An implementation of tabbed pages using only standard Tkinter. + +Originally developed for use in IDLE. Based on tabpage.py. + +Classes exported: +TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. +TabSet -- A widget containing tabs (buttons) in one or more rows. + +""" +from Tkinter import * + +class InvalidNameError(Exception): pass +class AlreadyExistsError(Exception): pass + + +class TabSet(Frame): + """A widget containing tabs (buttons) in one or more rows. + + Only one tab may be selected at a time. + + """ + def __init__(self, page_set, select_command, + tabs=None, n_rows=1, max_tabs_per_row=5, + expand_tabs=False, **kw): + """Constructor arguments: + + select_command -- A callable which will be called when a tab is + selected. It is called with the name of the selected tab as an + argument. + + tabs -- A list of strings, the names of the tabs. Should be specified in + the desired tab order. The first tab will be the default and first + active tab. If tabs is None or empty, the TabSet will be initialized + empty. + + n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is + None, then the number of rows will be decided by TabSet. See + _arrange_tabs() for details. + + max_tabs_per_row -- Used for deciding how many rows of tabs are needed, + when the number of rows is not constant. See _arrange_tabs() for + details. + + """ + Frame.__init__(self, page_set, **kw) + self.select_command = select_command + self.n_rows = n_rows + self.max_tabs_per_row = max_tabs_per_row + self.expand_tabs = expand_tabs + self.page_set = page_set + + self._tabs = {} + self._tab2row = {} + if tabs: + self._tab_names = list(tabs) + else: + self._tab_names = [] + self._selected_tab = None + self._tab_rows = [] + + self.padding_frame = Frame(self, height=2, + borderwidth=0, relief=FLAT, + background=self.cget('background')) + self.padding_frame.pack(side=TOP, fill=X, expand=False) + + self._arrange_tabs() + + def add_tab(self, tab_name): + """Add a new tab with the name given in tab_name.""" + if not tab_name: + raise InvalidNameError("Invalid Tab name: '%s'" % tab_name) + if tab_name in self._tab_names: + raise AlreadyExistsError("Tab named '%s' already exists" %tab_name) + + self._tab_names.append(tab_name) + self._arrange_tabs() + + def remove_tab(self, tab_name): + """Remove the tab named """ + if not tab_name in self._tab_names: + raise KeyError("No such Tab: '%s" % page_name) + + self._tab_names.remove(tab_name) + self._arrange_tabs() + + def set_selected_tab(self, tab_name): + """Show the tab named as the selected one""" + if tab_name == self._selected_tab: + return + if tab_name is not None and tab_name not in self._tabs: + raise KeyError("No such Tab: '%s" % page_name) + + # deselect the current selected tab + if self._selected_tab is not None: + self._tabs[self._selected_tab].set_normal() + self._selected_tab = None + + if tab_name is not None: + # activate the tab named tab_name + self._selected_tab = tab_name + tab = self._tabs[tab_name] + tab.set_selected() + # move the tab row with the selected tab to the bottom + tab_row = self._tab2row[tab] + tab_row.pack_forget() + tab_row.pack(side=TOP, fill=X, expand=0) + + def _add_tab_row(self, tab_names, expand_tabs): + if not tab_names: + return + + tab_row = Frame(self) + tab_row.pack(side=TOP, fill=X, expand=0) + self._tab_rows.append(tab_row) + + for tab_name in tab_names: + tab = TabSet.TabButton(tab_name, self.select_command, + tab_row, self) + if expand_tabs: + tab.pack(side=LEFT, fill=X, expand=True) + else: + tab.pack(side=LEFT) + self._tabs[tab_name] = tab + self._tab2row[tab] = tab_row + + # tab is the last one created in the above loop + tab.is_last_in_row = True + + def _reset_tab_rows(self): + while self._tab_rows: + tab_row = self._tab_rows.pop() + tab_row.destroy() + self._tab2row = {} + + def _arrange_tabs(self): + """ + Arrange the tabs in rows, in the order in which they were added. + + If n_rows >= 1, this will be the number of rows used. Otherwise the + number of rows will be calculated according to the number of tabs and + max_tabs_per_row. In this case, the number of rows may change when + adding/removing tabs. + + """ + # remove all tabs and rows + while self._tabs: + self._tabs.popitem()[1].destroy() + self._reset_tab_rows() + + if not self._tab_names: + return + + if self.n_rows is not None and self.n_rows > 0: + n_rows = self.n_rows + else: + # calculate the required number of rows + n_rows = (len(self._tab_names) - 1) // self.max_tabs_per_row + 1 + + # not expanding the tabs with more than one row is very ugly + expand_tabs = self.expand_tabs or n_rows > 1 + i = 0 # index in self._tab_names + for row_index in range(n_rows): + # calculate required number of tabs in this row + n_tabs = (len(self._tab_names) - i - 1) // (n_rows - row_index) + 1 + tab_names = self._tab_names[i:i + n_tabs] + i += n_tabs + self._add_tab_row(tab_names, expand_tabs) + + # re-select selected tab so it is properly displayed + selected = self._selected_tab + self.set_selected_tab(None) + if selected in self._tab_names: + self.set_selected_tab(selected) + + class TabButton(Frame): + """A simple tab-like widget.""" + + bw = 2 # borderwidth + + def __init__(self, name, select_command, tab_row, tab_set): + """Constructor arguments: + + name -- The tab's name, which will appear in its button. + + select_command -- The command to be called upon selection of the + tab. It is called with the tab's name as an argument. + + """ + Frame.__init__(self, tab_row, borderwidth=self.bw, relief=RAISED) + + self.name = name + self.select_command = select_command + self.tab_set = tab_set + self.is_last_in_row = False + + self.button = Radiobutton( + self, text=name, command=self._select_event, + padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, + highlightthickness=0, selectcolor='', borderwidth=0) + self.button.pack(side=LEFT, fill=X, expand=True) + + self._init_masks() + self.set_normal() + + def _select_event(self, *args): + """Event handler for tab selection. + + With TabbedPageSet, this calls TabbedPageSet.change_page, so that + selecting a tab changes the page. + + Note that this does -not- call set_selected -- it will be called by + TabSet.set_selected_tab, which should be called when whatever the + tabs are related to changes. + + """ + self.select_command(self.name) + return + + def set_selected(self): + """Assume selected look""" + self._place_masks(selected=True) + + def set_normal(self): + """Assume normal look""" + self._place_masks(selected=False) + + def _init_masks(self): + page_set = self.tab_set.page_set + background = page_set.pages_frame.cget('background') + # mask replaces the middle of the border with the background color + self.mask = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + # mskl replaces the bottom-left corner of the border with a normal + # left border + self.mskl = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + self.mskl.ml = Frame(self.mskl, borderwidth=self.bw, + relief=RAISED) + self.mskl.ml.place(x=0, y=-self.bw, + width=2*self.bw, height=self.bw*4) + # mskr replaces the bottom-right corner of the border with a normal + # right border + self.mskr = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + self.mskr.mr = Frame(self.mskr, borderwidth=self.bw, + relief=RAISED) + + def _place_masks(self, selected=False): + height = self.bw + if selected: + height += self.bw + + self.mask.place(in_=self, + relx=0.0, x=0, + rely=1.0, y=0, + relwidth=1.0, width=0, + relheight=0.0, height=height) + + self.mskl.place(in_=self, + relx=0.0, x=-self.bw, + rely=1.0, y=0, + relwidth=0.0, width=self.bw, + relheight=0.0, height=height) + + page_set = self.tab_set.page_set + if selected and ((not self.is_last_in_row) or + (self.winfo_rootx() + self.winfo_width() < + page_set.winfo_rootx() + page_set.winfo_width()) + ): + # for a selected tab, if its rightmost edge isn't on the + # rightmost edge of the page set, the right mask should be one + # borderwidth shorter (vertically) + height -= self.bw + + self.mskr.place(in_=self, + relx=1.0, x=0, + rely=1.0, y=0, + relwidth=0.0, width=self.bw, + relheight=0.0, height=height) + + self.mskr.mr.place(x=-self.bw, y=-self.bw, + width=2*self.bw, height=height + self.bw*2) + + # finally, lower the tab set so that all of the frames we just + # placed hide it + self.tab_set.lower() + +class TabbedPageSet(Frame): + """A Tkinter tabbed-pane widget. + + Constains set of 'pages' (or 'panes') with tabs above for selecting which + page is displayed. Only one page will be displayed at a time. + + Pages may be accessed through the 'pages' attribute, which is a dictionary + of pages, using the name given as the key. A page is an instance of a + subclass of Tk's Frame widget. + + The page widgets will be created (and destroyed when required) by the + TabbedPageSet. Do not call the page's pack/place/grid/destroy methods. + + Pages may be added or removed at any time using the add_page() and + remove_page() methods. + + """ + class Page(object): + """Abstract base class for TabbedPageSet's pages. + + Subclasses must override the _show() and _hide() methods. + + """ + uses_grid = False + + def __init__(self, page_set): + self.frame = Frame(page_set, borderwidth=2, relief=RAISED) + + def _show(self): + raise NotImplementedError + + def _hide(self): + raise NotImplementedError + + class PageRemove(Page): + """Page class using the grid placement manager's "remove" mechanism.""" + uses_grid = True + + def _show(self): + self.frame.grid(row=0, column=0, sticky=NSEW) + + def _hide(self): + self.frame.grid_remove() + + class PageLift(Page): + """Page class using the grid placement manager's "lift" mechanism.""" + uses_grid = True + + def __init__(self, page_set): + super(TabbedPageSet.PageLift, self).__init__(page_set) + self.frame.grid(row=0, column=0, sticky=NSEW) + self.frame.lower() + + def _show(self): + self.frame.lift() + + def _hide(self): + self.frame.lower() + + class PagePackForget(Page): + """Page class using the pack placement manager's "forget" mechanism.""" + def _show(self): + self.frame.pack(fill=BOTH, expand=True) + + def _hide(self): + self.frame.pack_forget() + + def __init__(self, parent, page_names=None, page_class=PageLift, + n_rows=1, max_tabs_per_row=5, expand_tabs=False, + **kw): + """Constructor arguments: + + page_names -- A list of strings, each will be the dictionary key to a + page's widget, and the name displayed on the page's tab. Should be + specified in the desired page order. The first page will be the default + and first active page. If page_names is None or empty, the + TabbedPageSet will be initialized empty. + + n_rows, max_tabs_per_row -- Parameters for the TabSet which will + manage the tabs. See TabSet's docs for details. + + page_class -- Pages can be shown/hidden using three mechanisms: + + * PageLift - All pages will be rendered one on top of the other. When + a page is selected, it will be brought to the top, thus hiding all + other pages. Using this method, the TabbedPageSet will not be resized + when pages are switched. (It may still be resized when pages are + added/removed.) + + * PageRemove - When a page is selected, the currently showing page is + hidden, and the new page shown in its place. Using this method, the + TabbedPageSet may resize when pages are changed. + + * PagePackForget - This mechanism uses the pack placement manager. + When a page is shown it is packed, and when it is hidden it is + unpacked (i.e. pack_forget). This mechanism may also cause the + TabbedPageSet to resize when the page is changed. + + """ + Frame.__init__(self, parent, **kw) + + self.page_class = page_class + self.pages = {} + self._pages_order = [] + self._current_page = None + self._default_page = None + + self.columnconfigure(0, weight=1) + self.rowconfigure(1, weight=1) + + self.pages_frame = Frame(self) + self.pages_frame.grid(row=1, column=0, sticky=NSEW) + if self.page_class.uses_grid: + self.pages_frame.columnconfigure(0, weight=1) + self.pages_frame.rowconfigure(0, weight=1) + + # the order of the following commands is important + self._tab_set = TabSet(self, self.change_page, n_rows=n_rows, + max_tabs_per_row=max_tabs_per_row, + expand_tabs=expand_tabs) + if page_names: + for name in page_names: + self.add_page(name) + self._tab_set.grid(row=0, column=0, sticky=NSEW) + + self.change_page(self._default_page) + + def add_page(self, page_name): + """Add a new page with the name given in page_name.""" + if not page_name: + raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) + if page_name in self.pages: + raise AlreadyExistsError( + "TabPage named '%s' already exists" % page_name) + + self.pages[page_name] = self.page_class(self.pages_frame) + self._pages_order.append(page_name) + self._tab_set.add_tab(page_name) + + if len(self.pages) == 1: # adding first page + self._default_page = page_name + self.change_page(page_name) + + def remove_page(self, page_name): + """Destroy the page whose name is given in page_name.""" + if not page_name in self.pages: + raise KeyError("No such TabPage: '%s" % page_name) + + self._pages_order.remove(page_name) + + # handle removing last remaining, default, or currently shown page + if len(self._pages_order) > 0: + if page_name == self._default_page: + # set a new default page + self._default_page = self._pages_order[0] + else: + self._default_page = None + + if page_name == self._current_page: + self.change_page(self._default_page) + + self._tab_set.remove_tab(page_name) + page = self.pages.pop(page_name) + page.frame.destroy() + + def change_page(self, page_name): + """Show the page whose name is given in page_name.""" + if self._current_page == page_name: + return + if page_name is not None and page_name not in self.pages: + raise KeyError("No such TabPage: '%s'" % page_name) + + if self._current_page is not None: + self.pages[self._current_page]._hide() + self._current_page = None + + if page_name is not None: + self._current_page = page_name + self.pages[page_name]._show() + + self._tab_set.set_selected_tab(page_name) + +if __name__ == '__main__': + # test dialog + root=Tk() + tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, + expand_tabs=False, + ) + tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) + Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() + Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() + Label(tabPage.pages['Baz'].frame, text='Baz').pack() + entryPgName=Entry(root) + buttonAdd=Button(root, text='Add Page', + command=lambda:tabPage.add_page(entryPgName.get())) + buttonRemove=Button(root, text='Remove Page', + command=lambda:tabPage.remove_page(entryPgName.get())) + labelPgName=Label(root, text='name of page to add/remove:') + buttonAdd.pack(padx=5, pady=5) + buttonRemove.pack(padx=5, pady=5) + labelPgName.pack(padx=5) + entryPgName.pack(padx=5) + root.mainloop() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/textView.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/textView.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/textView.py Sat Jun 7 00:16:57 2008 @@ -1,9 +1,12 @@ -"""Simple text browser for IDLE +"""Simple text browser for IDLE""" -""" - -from Tkinter import * import tkMessageBox +from Tkinter import * +from idlelib.configHandler import idleConf + +TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') +if TTK: + from ttk import * class TextViewer(Toplevel): """A simple text viewer dialog for IDLE @@ -42,17 +45,20 @@ self.buttonOk = Button(frameButtons, text='Close', command=self.Ok, takefocus=FALSE) self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, - takefocus=FALSE, highlightthickness=0) - self.textView = Text(frameText, wrap=WORD, highlightthickness=0, - fg=self.fg, bg=self.bg) + takefocus=FALSE) + self.textView = Text(frameText, wrap=WORD, fg=self.fg, bg=self.bg, + highlightthickness=0) self.scrollbarView.config(command=self.textView.yview) self.textView.config(yscrollcommand=self.scrollbarView.set) self.buttonOk.pack() self.scrollbarView.pack(side=RIGHT,fill=Y) self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH) - frameButtons.pack(side=BOTTOM,fill=X) + frameButtons.pack(side=BOTTOM) frameText.pack(side=TOP,expand=TRUE,fill=BOTH) + if TTK: + frameButtons['style'] = 'RootColor.TFrame' + def Ok(self, event=None): self.destroy() Deleted: sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib_ttk.diff Sat Jun 7 00:16:57 2008 +++ (empty file) @@ -1,1698 +0,0 @@ -Index: Lib/idlelib/AutoCompleteWindow.py -=================================================================== ---- Lib/idlelib/AutoCompleteWindow.py (revision 63916) -+++ Lib/idlelib/AutoCompleteWindow.py (working copy) -@@ -4,7 +4,11 @@ - from Tkinter import * - from MultiCall import MC_SHIFT - import AutoComplete -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - HIDE_VIRTUAL_EVENT_NAME = "<>" - HIDE_SEQUENCES = ("", "") - KEYPRESS_VIRTUAL_EVENT_NAME = "<>" -Index: Lib/idlelib/ToolTip.py -=================================================================== ---- Lib/idlelib/ToolTip.py (revision 63916) -+++ Lib/idlelib/ToolTip.py (working copy) -@@ -3,7 +3,8 @@ - # may be useful for some purposes in (or almost in ;) the current project scope - # Ideas gleaned from PySol - --from Tkinter import * -+from Tkinter import END, Listbox, Tk, Toplevel -+from ttk import Button, Label - - class ToolTipBase: - -Index: Lib/idlelib/configSectionNameDialog.py -=================================================================== ---- Lib/idlelib/configSectionNameDialog.py (revision 63916) -+++ Lib/idlelib/configSectionNameDialog.py (working copy) -@@ -4,7 +4,12 @@ - """ - from Tkinter import * - import tkMessageBox -+from idlelib.configHandler import idleConf - -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class GetCfgSectionNameDialog(Toplevel): - def __init__(self,parent,title,message,usedNames): - """ -@@ -25,8 +30,6 @@ - self.CreateWidgets() - self.withdraw() #hide while setting geometry - self.update_idletasks() -- #needs to be done here so that the winfo_reqwidth is valid -- self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) - self.geometry("+%d+%d" % - ((parent.winfo_rootx()+((parent.winfo_width()/2) - -(self.winfo_reqwidth()/2)), -@@ -40,11 +43,10 @@ - self.fontSize=StringVar(self) - self.frameMain = Frame(self,borderwidth=2,relief=SUNKEN) - self.frameMain.pack(side=TOP,expand=TRUE,fill=BOTH) -- self.messageInfo=Message(self.frameMain,anchor=W,justify=LEFT,padx=5,pady=5, -- text=self.message)#,aspect=200) -+ self.messageInfo= Label(self.frameMain, text=self.message) - entryName=Entry(self.frameMain,textvariable=self.name,width=30) - entryName.focus_set() -- self.messageInfo.pack(padx=5,pady=5)#,expand=TRUE,fill=BOTH) -+ self.messageInfo.pack(padx=5,pady=5) - entryName.pack(padx=5,pady=5) - frameButtons=Frame(self) - frameButtons.pack(side=BOTTOM,fill=X) -@@ -55,6 +57,12 @@ - width=8,command=self.Cancel) - self.buttonCancel.grid(row=0,column=1,padx=5,pady=5) - -+ if TTK: -+ self.messageInfo['padding'] = 5 -+ frameButtons['style'] = 'RootColor.TFrame' -+ else: -+ self.messageInfo.configure(padx=5, pady=5) -+ - def NameOk(self): - #simple validity check for a sensible - #ConfigParser file section name -Index: Lib/idlelib/PyShell.py -=================================================================== ---- Lib/idlelib/PyShell.py (revision 63916) -+++ Lib/idlelib/PyShell.py (working copy) -@@ -22,14 +22,26 @@ - print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ - "Your Python may not be configured for Tk. **" - sys.exit(1) -+try: -+ from ttk import * -+ TTK = 1 -+except ImportError: -+ print >> sys.stderr, "** IDLE can't import ttk." -+ TTK = 0 -+ - import tkMessageBox - -+from configHandler import idleConf -+ -+# store ttk availability -+idleConf.SetOption('main', 'General', 'use-ttk', str(TTK)) -+idleConf.SaveUserCfgFiles() -+ - from EditorWindow import EditorWindow, fixwordbreaks - from FileList import FileList - from ColorDelegator import ColorDelegator - from UndoDelegator import UndoDelegator - from OutputWindow import OutputWindow --from configHandler import idleConf - import idlever - - import rpc -@@ -1381,6 +1393,19 @@ - # start editor and/or shell windows: - root = Tk(className="Idle") - -+ if TTK: -+ # create base styles used along idle files -+ style = Style() -+ -+ x = style.map('.') -+ r = {'background': []} -+ for sspec in x['background']: -+ if 'active' in sspec[:-1]: -+ r['background'].append(('!disabled', sspec[-1])) -+ break -+ style.map('RootColor.TFrame', **r) -+ # end styles -+ - fixwordbreaks(root) - root.withdraw() - flist = PyShellFileList(root) -Index: Lib/idlelib/Debugger.py -=================================================================== ---- Lib/idlelib/Debugger.py (revision 63916) -+++ Lib/idlelib/Debugger.py (working copy) -@@ -4,8 +4,11 @@ - from Tkinter import * - from WindowList import ListedToplevel - from ScrolledList import ScrolledList -+from configHandler import idleConf - import macosxSupport - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import Scrollbar, Button, Radiobutton - - class Idb(bdb.Bdb): - -@@ -155,6 +158,7 @@ - self.show_locals() - if self.vglobals.get(): - self.show_globals() -+ # - - def interaction(self, message, frame, info=None): - self.frame = frame -@@ -413,6 +417,7 @@ - height = 20*len(dict) # XXX 20 == observed height of Entry widget - self.master = master - self.title = title -+ - import repr - self.repr = repr.Repr() - self.repr.maxstring = 60 -Index: Lib/idlelib/configDialog.py -=================================================================== ---- Lib/idlelib/configDialog.py (revision 63916) -+++ Lib/idlelib/configDialog.py (working copy) -@@ -7,7 +7,6 @@ - - Note that tab width in IDLE is currently fixed at eight due to Tk issues. - Refer to comments in EditorWindow autoindent code for details. -- - """ - from Tkinter import * - import tkMessageBox, tkColorChooser, tkFont -@@ -19,7 +18,12 @@ - from keybindingDialog import GetKeysDialog - from configSectionNameDialog import GetCfgSectionNameDialog - from configHelpSourceEdit import GetHelpSourceDialog -+from stylist import PoorManStyle - -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class ConfigDialog(Toplevel): - - def __init__(self,parent,title): -@@ -47,6 +51,7 @@ - 'Shell Stderr Text':('stderr','12'), - } - self.ResetChangedItems() #load initial values in changed items dict -+ self.SetupStyles() - self.CreateWidgets() - self.resizable(height=FALSE,width=FALSE) - self.transient(parent) -@@ -64,32 +69,52 @@ - self.wm_deiconify() - self.wait_window() - -+ def SetupStyles(self): -+ if TTK: -+ style = Style(self.master) -+ style.configure('S.TButton', padding=[6, 3]) -+ style.configure('S2.TFrame', padding=2) -+ style.configure('Color.TFrame', background='blue') -+ self.ttkstyle = style -+ self.style = lambda w, style: w.configure(style=style) -+ else: -+ self.ttkstyle = PoorManStyle(self, styles={ -+ 'S.TButton': {'pady': 6, 'padx': 3}, -+ 'S2.TFrame': {'padx': 2, 'pady': 2} -+ }, cfgstyles={'Color.TFrame': 'frameColourSet'}) -+ self.style = self.ttkstyle.style_it -+ - def CreateWidgets(self): - self.tabPages = TabbedPageSet(self, - page_names=['Fonts/Tabs','Highlighting','Keys','General']) -- frameActionButtons = Frame(self,pady=2) -+ frameActionButtons = Frame(self) - #action buttons - self.buttonHelp = Button(frameActionButtons,text='Help', -- command=self.Help,takefocus=FALSE, -- padx=6,pady=3) -- self.buttonOk = Button(frameActionButtons,text='Ok', -- command=self.Ok,takefocus=FALSE, -- padx=6,pady=3) -- self.buttonApply = Button(frameActionButtons,text='Apply', -- command=self.Apply,takefocus=FALSE, -- padx=6,pady=3) -- self.buttonCancel = Button(frameActionButtons,text='Cancel', -- command=self.Cancel,takefocus=FALSE, -- padx=6,pady=3) -+ command=self.Help, takefocus=FALSE) -+ self.buttonOk = Button(frameActionButtons, text='Ok', -+ command=self.Ok, takefocus=FALSE) -+ self.buttonApply = Button(frameActionButtons, text='Apply', -+ command=self.Apply, takefocus=FALSE) -+ self.buttonCancel = Button(frameActionButtons, text='Cancel', -+ command=self.Cancel, takefocus=FALSE) -+ -+ # Apply styles -+ s = self.style -+ s(frameActionButtons, 'RootColor.TFrame') -+ s(self.buttonHelp, 'S.TButton') -+ s(self.buttonOk, 'S.TButton') -+ s(self.buttonApply, 'S.TButton') -+ s(self.buttonCancel, 'S.TButton') -+ - self.CreatePageFontTab() - self.CreatePageHighlight() - self.CreatePageKeys() - self.CreatePageGeneral() -- self.buttonHelp.pack(side=RIGHT,padx=5) -- self.buttonOk.pack(side=LEFT,padx=5) -- self.buttonApply.pack(side=LEFT,padx=5) -- self.buttonCancel.pack(side=LEFT,padx=5) -- frameActionButtons.pack(side=BOTTOM) -+ self.buttonHelp.pack(side=LEFT, pady=6) -+ self.buttonApply.pack(side=RIGHT, pady=6) -+ self.buttonOk.pack(side=RIGHT, padx=6, pady=6) -+ self.buttonCancel.pack(side=RIGHT, pady=6) -+ frameActionButtons.pack(side=BOTTOM, fill=X, expand=TRUE) - Frame(self, height=2, borderwidth=0).pack(side=BOTTOM) - self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH) - -@@ -127,14 +152,19 @@ - frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) - self.labelFontSample=Label(frameFontSample, - text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', -- justify=LEFT,font=self.editFont) -+ justify=LEFT, font=self.editFont) - #frameIndent - frameIndentSize=Frame(frameIndent) - labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT, - text='Python Standard: 4 Spaces!') - self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum, -- orient='horizontal', -- tickinterval=2, from_=2, to=16) -+ orient='horizontal', tickinterval=2, -+ from_=2, to=16) -+ if TTK: -+ self.scaleSpaceNum.configure( -+ bg=self.ttkstyle.configure('.', 'background'), -+ highlightthickness=0) -+ - #widget packing - #body - frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) -@@ -149,7 +179,7 @@ - self.optMenuFontSize.pack(side=LEFT,anchor=W) - checkFontBold.pack(side=LEFT,anchor=W,padx=20) - frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) -- self.labelFontSample.pack(expand=TRUE,fill=BOTH) -+ self.labelFontSample.pack(expand=1, fill=Y) - #frameIndent - frameIndentSize.pack(side=TOP,fill=X) - labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) -@@ -174,7 +204,7 @@ - text=' Highlighting Theme ') - #frameCustom - self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1, -- font=('courier',12,''),cursor='hand2',width=21,height=10, -+ font=('courier',12,''), cursor='hand2', width=21, height=11, - takefocus=FALSE,highlightthickness=0,wrap=NONE) - text=self.textHighlightSample - text.bind('',lambda e: 'break') -@@ -197,12 +227,15 @@ - lambda event,elem=element: event.widget.winfo_toplevel() - .highlightTarget.set(elem)) - text.config(state=DISABLED) -- self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1) -+ -+ self.frameColourSet=Frame(frameCustom, relief=SOLID, borderwidth=1) -+ self.style(self.frameColourSet, 'Color.TFrame') -+ - frameFgBg=Frame(frameCustom) - buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :', -- command=self.GetColour,highlightthickness=0) -+ command=self.GetColour) # XXX - self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet, -- self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding -+ self.highlightTarget, None) # XXX - self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite, - value=1,text='Foreground',command=self.SetColourSampleBinding) - self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite, -@@ -275,8 +308,11 @@ - self.buttonNewKeys=Button(frameCustom,text='Get New Keys for Selection', - command=self.GetNewKeys,state=DISABLED) - #frameKeySets -- frames = [Frame(frameKeySets, padx=2, pady=2, borderwidth=0) -- for i in range(2)] -+ frames = [] -+ for i in range(2): -+ f = Frame(frameKeySets, borderwidth=0) -+ self.style(f, 'S2.TFrame') -+ frames.append(f) - self.radioKeysBuiltin=Radiobutton(frames[0],variable=self.keysAreBuiltin, - value=1,command=self.SetKeysType,text='Use a Built-in Key Set') - self.radioKeysCustom=Radiobutton(frames[0],variable=self.keysAreBuiltin, -@@ -748,14 +784,14 @@ - - def GetColour(self): - target=self.highlightTarget.get() -- prevColour=self.frameColourSet.cget('bg') -+ prevColour = self.ttkstyle.configure('Color.TFrame', 'background') - rgbTuplet, colourString = tkColorChooser.askcolor(parent=self, - title='Pick new colour for : '+target,initialcolor=prevColour) - if colourString and (colourString!=prevColour): - #user didn't cancel, and they chose a new colour - if self.themeIsBuiltin.get(): #current theme is a built-in -- message=('Your changes will be saved as a new Custom Theme. '+ -- 'Enter a name for your new Custom Theme below.') -+ message=("Your changes will be saved as a new Custom Theme. " -+ "Enter a name for your new Custom Theme below.") - newTheme=self.GetNewThemeName(message) - if not newTheme: #user cancelled custom theme creation - return -@@ -767,7 +803,7 @@ - - def OnNewColourSet(self): - newColour=self.colour.get() -- self.frameColourSet.config(bg=newColour)#set sample -+ self.ttkstyle.configure('Color.TFrame', background=newColour) - if self.fgHilite.get(): plane='foreground' - else: plane='background' - sampleElement=self.themeElements[self.highlightTarget.get()][0] -@@ -777,6 +813,7 @@ - self.AddChangedItem('highlight',theme,themeElement,newColour) - - def GetNewThemeName(self,message): -+ # XXX idle bug here - usedNames=(idleConf.GetSectionList('user','highlight')+ - idleConf.GetSectionList('default','highlight')) - newTheme=GetCfgSectionNameDialog(self,'New Custom Theme', -@@ -846,7 +883,7 @@ - if self.fgHilite.get(): plane='foreground' - else: plane='background' - colour=self.textHighlightSample.tag_cget(tag,plane) -- self.frameColourSet.config(bg=colour) -+ self.ttkstyle.configure('Color.TFrame', background=colour) - - def PaintThemeSample(self): - if self.themeIsBuiltin.get(): #a default theme -Index: Lib/idlelib/ReplaceDialog.py -=================================================================== ---- Lib/idlelib/ReplaceDialog.py (revision 63916) -+++ Lib/idlelib/ReplaceDialog.py (working copy) -@@ -11,9 +11,12 @@ - dialog.open(text) - - class ReplaceDialog(SearchDialogBase): -- - title = "Replace Dialog" - icon = "Replace" -+ bottom_btns = [("Find", 'find_it'), -+ ("Replace", 'replace_it'), -+ ("Replace+Find", 'default_command', 1), -+ ("Replace All", 'replace_all')] - - def __init__(self, root, engine): - SearchDialogBase.__init__(self, root, engine) -@@ -36,14 +39,10 @@ - - def create_entries(self): - SearchDialogBase.create_entries(self) -- self.replent = self.make_entry("Replace with:", self.replvar) -+ self.replent = self.make_entry("Replace with", self.replvar) - - def create_command_buttons(self): - SearchDialogBase.create_command_buttons(self) -- self.make_button("Find", self.find_it) -- self.make_button("Replace", self.replace_it) -- self.make_button("Replace+Find", self.default_command, 1) -- self.make_button("Replace All", self.replace_all) - - def find_it(self, event=None): - self.do_find(0) -Index: Lib/idlelib/tabbedpages.py -=================================================================== ---- Lib/idlelib/tabbedpages.py (revision 63916) -+++ Lib/idlelib/tabbedpages.py (working copy) -@@ -1,490 +1,4 @@ --"""An implementation of tabbed pages using only standard Tkinter. -- --Originally developed for use in IDLE. Based on tabpage.py. -- --Classes exported: --TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. --TabSet -- A widget containing tabs (buttons) in one or more rows. -- --""" --from Tkinter import * -- --class InvalidNameError(Exception): pass --class AlreadyExistsError(Exception): pass -- -- --class TabSet(Frame): -- """A widget containing tabs (buttons) in one or more rows. -- -- Only one tab may be selected at a time. -- -- """ -- def __init__(self, page_set, select_command, -- tabs=None, n_rows=1, max_tabs_per_row=5, -- expand_tabs=False, **kw): -- """Constructor arguments: -- -- select_command -- A callable which will be called when a tab is -- selected. It is called with the name of the selected tab as an -- argument. -- -- tabs -- A list of strings, the names of the tabs. Should be specified in -- the desired tab order. The first tab will be the default and first -- active tab. If tabs is None or empty, the TabSet will be initialized -- empty. -- -- n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is -- None, then the number of rows will be decided by TabSet. See -- _arrange_tabs() for details. -- -- max_tabs_per_row -- Used for deciding how many rows of tabs are needed, -- when the number of rows is not constant. See _arrange_tabs() for -- details. -- -- """ -- Frame.__init__(self, page_set, **kw) -- self.select_command = select_command -- self.n_rows = n_rows -- self.max_tabs_per_row = max_tabs_per_row -- self.expand_tabs = expand_tabs -- self.page_set = page_set -- -- self._tabs = {} -- self._tab2row = {} -- if tabs: -- self._tab_names = list(tabs) -- else: -- self._tab_names = [] -- self._selected_tab = None -- self._tab_rows = [] -- -- self.padding_frame = Frame(self, height=2, -- borderwidth=0, relief=FLAT, -- background=self.cget('background')) -- self.padding_frame.pack(side=TOP, fill=X, expand=False) -- -- self._arrange_tabs() -- -- def add_tab(self, tab_name): -- """Add a new tab with the name given in tab_name.""" -- if not tab_name: -- raise InvalidNameError("Invalid Tab name: '%s'" % tab_name) -- if tab_name in self._tab_names: -- raise AlreadyExistsError("Tab named '%s' already exists" %tab_name) -- -- self._tab_names.append(tab_name) -- self._arrange_tabs() -- -- def remove_tab(self, tab_name): -- """Remove the tab named """ -- if not tab_name in self._tab_names: -- raise KeyError("No such Tab: '%s" % page_name) -- -- self._tab_names.remove(tab_name) -- self._arrange_tabs() -- -- def set_selected_tab(self, tab_name): -- """Show the tab named as the selected one""" -- if tab_name == self._selected_tab: -- return -- if tab_name is not None and tab_name not in self._tabs: -- raise KeyError("No such Tab: '%s" % page_name) -- -- # deselect the current selected tab -- if self._selected_tab is not None: -- self._tabs[self._selected_tab].set_normal() -- self._selected_tab = None -- -- if tab_name is not None: -- # activate the tab named tab_name -- self._selected_tab = tab_name -- tab = self._tabs[tab_name] -- tab.set_selected() -- # move the tab row with the selected tab to the bottom -- tab_row = self._tab2row[tab] -- tab_row.pack_forget() -- tab_row.pack(side=TOP, fill=X, expand=0) -- -- def _add_tab_row(self, tab_names, expand_tabs): -- if not tab_names: -- return -- -- tab_row = Frame(self) -- tab_row.pack(side=TOP, fill=X, expand=0) -- self._tab_rows.append(tab_row) -- -- for tab_name in tab_names: -- tab = TabSet.TabButton(tab_name, self.select_command, -- tab_row, self) -- if expand_tabs: -- tab.pack(side=LEFT, fill=X, expand=True) -- else: -- tab.pack(side=LEFT) -- self._tabs[tab_name] = tab -- self._tab2row[tab] = tab_row -- -- # tab is the last one created in the above loop -- tab.is_last_in_row = True -- -- def _reset_tab_rows(self): -- while self._tab_rows: -- tab_row = self._tab_rows.pop() -- tab_row.destroy() -- self._tab2row = {} -- -- def _arrange_tabs(self): -- """ -- Arrange the tabs in rows, in the order in which they were added. -- -- If n_rows >= 1, this will be the number of rows used. Otherwise the -- number of rows will be calculated according to the number of tabs and -- max_tabs_per_row. In this case, the number of rows may change when -- adding/removing tabs. -- -- """ -- # remove all tabs and rows -- for tab_name in self._tabs.keys(): -- self._tabs.pop(tab_name).destroy() -- self._reset_tab_rows() -- -- if not self._tab_names: -- return -- -- if self.n_rows is not None and self.n_rows > 0: -- n_rows = self.n_rows -- else: -- # calculate the required number of rows -- n_rows = (len(self._tab_names) - 1) // self.max_tabs_per_row + 1 -- -- # not expanding the tabs with more than one row is very ugly -- expand_tabs = self.expand_tabs or n_rows > 1 -- i = 0 # index in self._tab_names -- for row_index in xrange(n_rows): -- # calculate required number of tabs in this row -- n_tabs = (len(self._tab_names) - i - 1) // (n_rows - row_index) + 1 -- tab_names = self._tab_names[i:i + n_tabs] -- i += n_tabs -- self._add_tab_row(tab_names, expand_tabs) -- -- # re-select selected tab so it is properly displayed -- selected = self._selected_tab -- self.set_selected_tab(None) -- if selected in self._tab_names: -- self.set_selected_tab(selected) -- -- class TabButton(Frame): -- """A simple tab-like widget.""" -- -- bw = 2 # borderwidth -- -- def __init__(self, name, select_command, tab_row, tab_set): -- """Constructor arguments: -- -- name -- The tab's name, which will appear in its button. -- -- select_command -- The command to be called upon selection of the -- tab. It is called with the tab's name as an argument. -- -- """ -- Frame.__init__(self, tab_row, borderwidth=self.bw, relief=RAISED) -- -- self.name = name -- self.select_command = select_command -- self.tab_set = tab_set -- self.is_last_in_row = False -- -- self.button = Radiobutton( -- self, text=name, command=self._select_event, -- padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, -- highlightthickness=0, selectcolor='', borderwidth=0) -- self.button.pack(side=LEFT, fill=X, expand=True) -- -- self._init_masks() -- self.set_normal() -- -- def _select_event(self, *args): -- """Event handler for tab selection. -- -- With TabbedPageSet, this calls TabbedPageSet.change_page, so that -- selecting a tab changes the page. -- -- Note that this does -not- call set_selected -- it will be called by -- TabSet.set_selected_tab, which should be called when whatever the -- tabs are related to changes. -- -- """ -- self.select_command(self.name) -- return -- -- def set_selected(self): -- """Assume selected look""" -- self._place_masks(selected=True) -- -- def set_normal(self): -- """Assume normal look""" -- self._place_masks(selected=False) -- -- def _init_masks(self): -- page_set = self.tab_set.page_set -- background = page_set.pages_frame.cget('background') -- # mask replaces the middle of the border with the background color -- self.mask = Frame(page_set, borderwidth=0, relief=FLAT, -- background=background) -- # mskl replaces the bottom-left corner of the border with a normal -- # left border -- self.mskl = Frame(page_set, borderwidth=0, relief=FLAT, -- background=background) -- self.mskl.ml = Frame(self.mskl, borderwidth=self.bw, -- relief=RAISED) -- self.mskl.ml.place(x=0, y=-self.bw, -- width=2*self.bw, height=self.bw*4) -- # mskr replaces the bottom-right corner of the border with a normal -- # right border -- self.mskr = Frame(page_set, borderwidth=0, relief=FLAT, -- background=background) -- self.mskr.mr = Frame(self.mskr, borderwidth=self.bw, -- relief=RAISED) -- -- def _place_masks(self, selected=False): -- height = self.bw -- if selected: -- height += self.bw -- -- self.mask.place(in_=self, -- relx=0.0, x=0, -- rely=1.0, y=0, -- relwidth=1.0, width=0, -- relheight=0.0, height=height) -- -- self.mskl.place(in_=self, -- relx=0.0, x=-self.bw, -- rely=1.0, y=0, -- relwidth=0.0, width=self.bw, -- relheight=0.0, height=height) -- -- page_set = self.tab_set.page_set -- if selected and ((not self.is_last_in_row) or -- (self.winfo_rootx() + self.winfo_width() < -- page_set.winfo_rootx() + page_set.winfo_width()) -- ): -- # for a selected tab, if its rightmost edge isn't on the -- # rightmost edge of the page set, the right mask should be one -- # borderwidth shorter (vertically) -- height -= self.bw -- -- self.mskr.place(in_=self, -- relx=1.0, x=0, -- rely=1.0, y=0, -- relwidth=0.0, width=self.bw, -- relheight=0.0, height=height) -- -- self.mskr.mr.place(x=-self.bw, y=-self.bw, -- width=2*self.bw, height=height + self.bw*2) -- -- # finally, lower the tab set so that all of the frames we just -- # placed hide it -- self.tab_set.lower() -- --class TabbedPageSet(Frame): -- """A Tkinter tabbed-pane widget. -- -- Constains set of 'pages' (or 'panes') with tabs above for selecting which -- page is displayed. Only one page will be displayed at a time. -- -- Pages may be accessed through the 'pages' attribute, which is a dictionary -- of pages, using the name given as the key. A page is an instance of a -- subclass of Tk's Frame widget. -- -- The page widgets will be created (and destroyed when required) by the -- TabbedPageSet. Do not call the page's pack/place/grid/destroy methods. -- -- Pages may be added or removed at any time using the add_page() and -- remove_page() methods. -- -- """ -- class Page(object): -- """Abstract base class for TabbedPageSet's pages. -- -- Subclasses must override the _show() and _hide() methods. -- -- """ -- uses_grid = False -- -- def __init__(self, page_set): -- self.frame = Frame(page_set, borderwidth=2, relief=RAISED) -- -- def _show(self): -- raise NotImplementedError -- -- def _hide(self): -- raise NotImplementedError -- -- class PageRemove(Page): -- """Page class using the grid placement manager's "remove" mechanism.""" -- uses_grid = True -- -- def _show(self): -- self.frame.grid(row=0, column=0, sticky=NSEW) -- -- def _hide(self): -- self.frame.grid_remove() -- -- class PageLift(Page): -- """Page class using the grid placement manager's "lift" mechanism.""" -- uses_grid = True -- -- def __init__(self, page_set): -- super(TabbedPageSet.PageLift, self).__init__(page_set) -- self.frame.grid(row=0, column=0, sticky=NSEW) -- self.frame.lower() -- -- def _show(self): -- self.frame.lift() -- -- def _hide(self): -- self.frame.lower() -- -- class PagePackForget(Page): -- """Page class using the pack placement manager's "forget" mechanism.""" -- def _show(self): -- self.frame.pack(fill=BOTH, expand=True) -- -- def _hide(self): -- self.frame.pack_forget() -- -- def __init__(self, parent, page_names=None, page_class=PageLift, -- n_rows=1, max_tabs_per_row=5, expand_tabs=False, -- **kw): -- """Constructor arguments: -- -- page_names -- A list of strings, each will be the dictionary key to a -- page's widget, and the name displayed on the page's tab. Should be -- specified in the desired page order. The first page will be the default -- and first active page. If page_names is None or empty, the -- TabbedPageSet will be initialized empty. -- -- n_rows, max_tabs_per_row -- Parameters for the TabSet which will -- manage the tabs. See TabSet's docs for details. -- -- page_class -- Pages can be shown/hidden using three mechanisms: -- -- * PageLift - All pages will be rendered one on top of the other. When -- a page is selected, it will be brought to the top, thus hiding all -- other pages. Using this method, the TabbedPageSet will not be resized -- when pages are switched. (It may still be resized when pages are -- added/removed.) -- -- * PageRemove - When a page is selected, the currently showing page is -- hidden, and the new page shown in its place. Using this method, the -- TabbedPageSet may resize when pages are changed. -- -- * PagePackForget - This mechanism uses the pack placement manager. -- When a page is shown it is packed, and when it is hidden it is -- unpacked (i.e. pack_forget). This mechanism may also cause the -- TabbedPageSet to resize when the page is changed. -- -- """ -- Frame.__init__(self, parent, **kw) -- -- self.page_class = page_class -- self.pages = {} -- self._pages_order = [] -- self._current_page = None -- self._default_page = None -- -- self.columnconfigure(0, weight=1) -- self.rowconfigure(1, weight=1) -- -- self.pages_frame = Frame(self) -- self.pages_frame.grid(row=1, column=0, sticky=NSEW) -- if self.page_class.uses_grid: -- self.pages_frame.columnconfigure(0, weight=1) -- self.pages_frame.rowconfigure(0, weight=1) -- -- # the order of the following commands is important -- self._tab_set = TabSet(self, self.change_page, n_rows=n_rows, -- max_tabs_per_row=max_tabs_per_row, -- expand_tabs=expand_tabs) -- if page_names: -- for name in page_names: -- self.add_page(name) -- self._tab_set.grid(row=0, column=0, sticky=NSEW) -- -- self.change_page(self._default_page) -- -- def add_page(self, page_name): -- """Add a new page with the name given in page_name.""" -- if not page_name: -- raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) -- if page_name in self.pages: -- raise AlreadyExistsError( -- "TabPage named '%s' already exists" % page_name) -- -- self.pages[page_name] = self.page_class(self.pages_frame) -- self._pages_order.append(page_name) -- self._tab_set.add_tab(page_name) -- -- if len(self.pages) == 1: # adding first page -- self._default_page = page_name -- self.change_page(page_name) -- -- def remove_page(self, page_name): -- """Destroy the page whose name is given in page_name.""" -- if not page_name in self.pages: -- raise KeyError("No such TabPage: '%s" % page_name) -- -- self._pages_order.remove(page_name) -- -- # handle removing last remaining, default, or currently shown page -- if len(self._pages_order) > 0: -- if page_name == self._default_page: -- # set a new default page -- self._default_page = self._pages_order[0] -- else: -- self._default_page = None -- -- if page_name == self._current_page: -- self.change_page(self._default_page) -- -- self._tab_set.remove_tab(page_name) -- page = self.pages.pop(page_name) -- page.frame.destroy() -- -- def change_page(self, page_name): -- """Show the page whose name is given in page_name.""" -- if self._current_page == page_name: -- return -- if page_name is not None and page_name not in self.pages: -- raise KeyError("No such TabPage: '%s'" % page_name) -- -- if self._current_page is not None: -- self.pages[self._current_page]._hide() -- self._current_page = None -- -- if page_name is not None: -- self._current_page = page_name -- self.pages[page_name]._show() -- -- self._tab_set.set_selected_tab(page_name) -- --if __name__ == '__main__': -- # test dialog -- root=Tk() -- tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, -- expand_tabs=False, -- ) -- tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) -- Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() -- Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() -- Label(tabPage.pages['Baz'].frame, text='Baz').pack() -- entryPgName=Entry(root) -- buttonAdd=Button(root, text='Add Page', -- command=lambda:tabPage.add_page(entryPgName.get())) -- buttonRemove=Button(root, text='Remove Page', -- command=lambda:tabPage.remove_page(entryPgName.get())) -- labelPgName=Label(root, text='name of page to add/remove:') -- buttonAdd.pack(padx=5, pady=5) -- buttonRemove.pack(padx=5, pady=5) -- labelPgName.pack(padx=5) -- entryPgName.pack(padx=5) -- root.mainloop() -+try: -+ from idlelib.tabbedpages_new import TabbedPageSet -+except ImportError: -+ from idlelib.tabbedpages_old import TabbedPageSet -Index: Lib/idlelib/keybindingDialog.py -=================================================================== ---- Lib/idlelib/keybindingDialog.py (revision 63916) -+++ Lib/idlelib/keybindingDialog.py (working copy) -@@ -5,6 +5,12 @@ - import tkMessageBox - import string - -+from idlelib.configHandler import idleConf -+ -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class GetKeysDialog(Toplevel): - def __init__(self,parent,title,action,currentKeySequences): - """ -@@ -124,6 +130,9 @@ - "separated by a space, eg., ." ) - labelHelpAdvanced.grid(row=0,column=0,sticky=NSEW) - -+ if TTK: -+ frameButtons['style'] = 'RootColor.TFrame' -+ - def SetModifiersForPlatform(self): - """Determine list of names of key modifiers for this platform. - -Index: Lib/idlelib/configHelpSourceEdit.py -=================================================================== ---- Lib/idlelib/configHelpSourceEdit.py (revision 63916) -+++ Lib/idlelib/configHelpSourceEdit.py (working copy) -@@ -6,7 +6,12 @@ - from Tkinter import * - import tkMessageBox - import tkFileDialog -+from idlelib.configHandler import idleConf - -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class GetHelpSourceDialog(Toplevel): - def __init__(self, parent, title, menuItem='', filePath=''): - """Get menu entry and url/ local file location for Additional Help -@@ -25,6 +30,7 @@ - self.protocol("WM_DELETE_WINDOW", self.Cancel) - self.parent = parent - self.result = None -+ - self.CreateWidgets() - self.menu.set(menuItem) - self.path.set(filePath) -@@ -68,11 +74,14 @@ - frameButtons.pack(side=BOTTOM, fill=X) - self.buttonOk = Button(frameButtons, text='OK', - width=8, default=ACTIVE, command=self.Ok) -- self.buttonOk.grid(row=0, column=0, padx=5,pady=5) -+ self.buttonOk.grid(row=0, column=0, pady=5) - self.buttonCancel = Button(frameButtons, text='Cancel', - width=8, command=self.Cancel) - self.buttonCancel.grid(row=0, column=1, padx=5, pady=5) - -+ if TTK: -+ frameButtons['style'] = 'RootColor.TFrame' -+ - def browseFile(self): - filetypes = [ - ("HTML Files", "*.htm *.html", "TEXT"), -Index: Lib/idlelib/GrepDialog.py -=================================================================== ---- Lib/idlelib/GrepDialog.py (revision 63916) -+++ Lib/idlelib/GrepDialog.py (working copy) -@@ -4,7 +4,11 @@ - from Tkinter import * - import SearchEngine - from SearchDialogBase import SearchDialogBase -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - def grep(text, io=None, flist=None): - root = text._root() - engine = SearchEngine.get(root) -@@ -15,10 +19,10 @@ - dialog.open(text, searchphrase, io) - - class GrepDialog(SearchDialogBase): -- - title = "Find in Files Dialog" - icon = "Grep" - needwrapbutton = 0 -+ bottom_btns = [("Search Files", 'default_command', 1)] - - def __init__(self, root, engine, flist): - SearchDialogBase.__init__(self, root, engine) -@@ -40,20 +44,18 @@ - - def create_entries(self): - SearchDialogBase.create_entries(self) -- self.globent = self.make_entry("In files:", self.globvar) -+ self.globent = self.make_entry("In files", self.globvar) - - def create_other_buttons(self): - f = self.make_frame() - -- btn = Checkbutton(f, anchor="w", -- variable=self.recvar, -+ btn = Checkbutton(f, variable=self.recvar, - text="Recurse down subdirectories") - btn.pack(side="top", fill="both") -- btn.select() -+ btn.invoke() - - def create_command_buttons(self): - SearchDialogBase.create_command_buttons(self) -- self.make_button("Search Files", self.default_command, 1) - - def default_command(self, event=None): - prog = self.engine.getprog() -@@ -126,8 +128,3 @@ - for subdir in subdirs: - list.extend(self.findfiles(subdir, base, rec)) - return list -- -- def close(self, event=None): -- if self.top: -- self.top.grab_release() -- self.top.withdraw() -Index: Lib/idlelib/EditorWindow.py -=================================================================== ---- Lib/idlelib/EditorWindow.py (revision 63916) -+++ Lib/idlelib/EditorWindow.py (working copy) -@@ -19,6 +19,10 @@ - import aboutDialog, textView, configDialog - import macosxSupport - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import Scrollbar -+ -+ - # The default tab setting for a Text widget, in average-width characters. - TK_TABWIDTH_DEFAULT = 8 - -@@ -365,7 +369,7 @@ - self.menudict = menudict = {} - for name, label in self.menu_specs: - underline, label = prepstr(label) -- menudict[name] = menu = Menu(mbar, name=name) -+ menudict[name] = menu = Menu(mbar, name=name, tearoff=0) - mbar.add_cascade(label=label, menu=menu, underline=underline) - - if sys.platform == 'darwin' and '.framework' in sys.executable: -Index: Lib/idlelib/aboutDialog.py -=================================================================== ---- Lib/idlelib/aboutDialog.py (revision 63916) -+++ Lib/idlelib/aboutDialog.py (working copy) -@@ -1,13 +1,17 @@ --"""About Dialog for IDLE -- --""" -- -+"""About Dialog for IDLE""" - from Tkinter import * - import os - import os.path - import textView - import idlever - -+from idlelib.stylist import PoorManStyle -+from idlelib.configHandler import idleConf -+ -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class AboutDialog(Toplevel): - """Modal about dialog for idle - -@@ -15,10 +19,13 @@ - def __init__(self,parent,title): - Toplevel.__init__(self, parent) - self.configure(borderwidth=5) -+ - self.geometry("+%d+%d" % (parent.winfo_rootx()+30, - parent.winfo_rooty()+30)) - self.bg = "#707070" - self.fg = "#ffffff" -+ -+ self.SetupStyles() - self.CreateWidgets() - self.resizable(height=FALSE, width=FALSE) - self.title(title) -@@ -31,40 +38,44 @@ - self.bind('',self.Ok) #dismiss dialog - self.wait_window() - -+ def SetupStyles(self): -+ if TTK: -+ style = Style(self.master) -+ style.configure('Color.TLabel', foreground=self.fg, -+ background=self.bg) -+ style.configure('Color.TFrame', background=self.bg) -+ self.ttkstyle = style -+ self.style = lambda w, style: w.configure(style=style) -+ else: -+ self.style = PoorManStyle(self, -+ styles={'Color.TLabel': {'fg': self.fg, 'bg': self.bg}, -+ 'Color.TFrame': {'bg': self.bg}}).style_it -+ - def CreateWidgets(self): - frameMain = Frame(self, borderwidth=2, relief=SUNKEN) - frameButtons = Frame(self) -- frameButtons.pack(side=BOTTOM, fill=X) -+ frameButtons.pack(side=BOTTOM, pady=3) - frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) -- self.buttonOk = Button(frameButtons, text='Close', -- command=self.Ok) -- self.buttonOk.pack(padx=5, pady=5) -- #self.picture = Image('photo', data=self.pictureData) -- frameBg = Frame(frameMain, bg=self.bg) -+ self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) -+ self.buttonOk.pack() -+ frameBg = Frame(frameMain) - frameBg.pack(expand=TRUE, fill=BOTH) -- labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, -- font=('courier', 24, 'bold')) -+ labelTitle = Label(frameBg, text='IDLE', font=('courier', 24, 'bold')) - labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) -- #labelPicture = Label(frameBg, text='[picture]') -- #image=self.picture, bg=self.bg) -- #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, -- # padx=0, pady=3) - byline = "Python's Integrated DeveLopment Environment" + 5*'\n' -- labelDesc = Label(frameBg, text=byline, justify=LEFT, -- fg=self.fg, bg=self.bg) -+ labelDesc = Label(frameBg, text=byline, justify=LEFT) - labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) - labelEmail = Label(frameBg, text='email: idle-dev at python.org', -- justify=LEFT, fg=self.fg, bg=self.bg) -+ justify=LEFT) - labelEmail.grid(row=6, column=0, columnspan=2, - sticky=W, padx=10, pady=0) - labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', -- justify=LEFT, fg=self.fg, bg=self.bg) -+ justify=LEFT) - labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) -- Frame(frameBg, borderwidth=1, relief=SUNKEN, -- height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, -- columnspan=3, padx=5, pady=5) -+ fbg = Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2) -+ fbg.grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) - labelPythonVer = Label(frameBg, text='Python version: ' + \ -- sys.version.split()[0], fg=self.fg, bg=self.bg) -+ sys.version.split()[0]) - labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) - # handle weird tk version num in windoze python >= 1.6 (?!?) - tkVer = repr(TkVersion).split('.') -@@ -72,44 +83,50 @@ - if tkVer[len(tkVer)-1] == '': - tkVer[len(tkVer)-1] = '0' - tkVer = '.'.join(tkVer) -- labelTkVer = Label(frameBg, text='Tk version: '+ -- tkVer, fg=self.fg, bg=self.bg) -+ labelTkVer = Label(frameBg, text='Tk version: '+ tkVer) - labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) -- py_button_f = Frame(frameBg, bg=self.bg) -+ py_button_f = Frame(frameBg) - py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) - buttonLicense = Button(py_button_f, text='License', width=8, -- highlightbackground=self.bg, - command=self.ShowLicense) - buttonLicense.pack(side=LEFT, padx=10, pady=10) - buttonCopyright = Button(py_button_f, text='Copyright', width=8, -- highlightbackground=self.bg, - command=self.ShowCopyright) - buttonCopyright.pack(side=LEFT, padx=10, pady=10) - buttonCredits = Button(py_button_f, text='Credits', width=8, -- highlightbackground=self.bg, - command=self.ShowPythonCredits) - buttonCredits.pack(side=LEFT, padx=10, pady=10) -- Frame(frameBg, borderwidth=1, relief=SUNKEN, -- height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, -- columnspan=3, padx=5, pady=5) -- idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION, -- fg=self.fg, bg=self.bg) -+ fbg2 = Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2) -+ fbg2.grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) -+ idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION) - idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) -- idle_button_f = Frame(frameBg, bg=self.bg) -+ idle_button_f = Frame(frameBg) - idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) - idle_about_b = Button(idle_button_f, text='README', width=8, -- highlightbackground=self.bg, - command=self.ShowIDLEAbout) - idle_about_b.pack(side=LEFT, padx=10, pady=10) - idle_news_b = Button(idle_button_f, text='NEWS', width=8, -- highlightbackground=self.bg, - command=self.ShowIDLENEWS) - idle_news_b.pack(side=LEFT, padx=10, pady=10) - idle_credits_b = Button(idle_button_f, text='Credits', width=8, -- highlightbackground=self.bg, - command=self.ShowIDLECredits) - idle_credits_b.pack(side=LEFT, padx=10, pady=10) - -+ s = self.style -+ s(frameButtons, 'RootColor.TFrame') -+ s(frameBg, 'Color.TFrame') -+ s(labelTitle, 'Color.TLabel') -+ s(labelDesc, 'Color.TLabel') -+ s(labelEmail, 'Color.TLabel') -+ s(labelWWW, 'Color.TLabel') -+ s(fbg, 'Color.TFrame') -+ s(labelPythonVer, 'Color.TLabel') -+ s(labelTkVer, 'Color.TLabel') -+ s(py_button_f, 'Color.TFrame') -+ s(fbg2, 'Color.TFrame') -+ s(idle_v, 'Color.TLabel') -+ s(idle_button_f, 'Color.TFrame') -+ - def ShowLicense(self): - self.display_printer_text('About - License', license) - -Index: Lib/idlelib/config-main.def -=================================================================== ---- Lib/idlelib/config-main.def (revision 63916) -+++ Lib/idlelib/config-main.def (working copy) -@@ -49,6 +49,7 @@ - print-command-posix=lpr %s - print-command-win=start /min notepad /p %s - delete-exitfunc= 1 -+use-ttk=0 - - [EditorWindow] - width= 80 -Index: Lib/idlelib/IOBinding.py -=================================================================== ---- Lib/idlelib/IOBinding.py (revision 63916) -+++ Lib/idlelib/IOBinding.py (working copy) -@@ -18,6 +18,9 @@ - - from configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - try: - from codecs import BOM_UTF8 - except ImportError: -Index: Lib/idlelib/ScrolledList.py -=================================================================== ---- Lib/idlelib/ScrolledList.py (revision 63916) -+++ Lib/idlelib/ScrolledList.py (working copy) -@@ -1,5 +1,9 @@ - from Tkinter import * -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - class ScrolledList: - - default = "(None)" -Index: Lib/idlelib/textView.py -=================================================================== ---- Lib/idlelib/textView.py (revision 63916) -+++ Lib/idlelib/textView.py (working copy) -@@ -1,10 +1,13 @@ --"""Simple text browser for IDLE -+"""Simple text browser for IDLE""" - --""" -- -+import tkMessageBox - from Tkinter import * --import tkMessageBox -+from idlelib.configHandler import idleConf - -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class TextViewer(Toplevel): - """A simple text viewer dialog for IDLE - -@@ -42,17 +45,20 @@ - self.buttonOk = Button(frameButtons, text='Close', - command=self.Ok, takefocus=FALSE) - self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, -- takefocus=FALSE, highlightthickness=0) -- self.textView = Text(frameText, wrap=WORD, highlightthickness=0, -- fg=self.fg, bg=self.bg) -+ takefocus=FALSE) -+ self.textView = Text(frameText, wrap=WORD, fg=self.fg, bg=self.bg, -+ highlightthickness=0) - self.scrollbarView.config(command=self.textView.yview) - self.textView.config(yscrollcommand=self.scrollbarView.set) - self.buttonOk.pack() - self.scrollbarView.pack(side=RIGHT,fill=Y) - self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH) -- frameButtons.pack(side=BOTTOM,fill=X) -+ frameButtons.pack(side=BOTTOM) - frameText.pack(side=TOP,expand=TRUE,fill=BOTH) - -+ if TTK: -+ frameButtons['style'] = 'RootColor.TFrame' -+ - def Ok(self, event=None): - self.destroy() - -Index: Lib/idlelib/CallTipWindow.py -=================================================================== ---- Lib/idlelib/CallTipWindow.py (revision 63916) -+++ Lib/idlelib/CallTipWindow.py (working copy) -@@ -5,7 +5,11 @@ - - """ - from Tkinter import * -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - HIDE_VIRTUAL_EVENT_NAME = "<>" - HIDE_SEQUENCES = ("", "") - CHECKHIDE_VIRTUAL_EVENT_NAME = "<>" -@@ -163,6 +167,8 @@ - def calltip_hide(self, event): - self.calltip.hidetip() - -+# XXX Bugged test -+ - def main(): - # Test code - c=container() -Index: Lib/idlelib/SearchDialogBase.py -=================================================================== ---- Lib/idlelib/SearchDialogBase.py (revision 63916) -+++ Lib/idlelib/SearchDialogBase.py (working copy) -@@ -1,35 +1,40 @@ - from Tkinter import * -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import * -+ - class SearchDialogBase: - - title = "Search Dialog" - icon = "Search" - needwrapbutton = 1 -+ bottom_btns = None - - def __init__(self, root, engine): - self.root = root - self.engine = engine -- self.top = None -+ self.ttop = None - - def open(self, text, searchphrase=None): - self.text = text -- if not self.top: -+ if not self.ttop: - self.create_widgets() - else: -- self.top.deiconify() -- self.top.tkraise() -+ self.ttop.deiconify() -+ self.ttop.tkraise() - if searchphrase: -- self.ent.delete(0,"end") -- self.ent.insert("end",searchphrase) -+ self.ent.delete(0, "end") -+ self.ent.insert("end", searchphrase) - self.ent.focus_set() - self.ent.selection_range(0, "end") - self.ent.icursor(0) -- self.top.grab_set() -+ self.ttop.grab_set() - - def close(self, event=None): -- if self.top: -- self.top.grab_release() -- self.top.withdraw() -+ if self.ttop: -+ self.ttop.grab_release() -+ self.ttop.withdraw() - - def create_widgets(self): - top = Toplevel(self.root) -@@ -38,103 +43,96 @@ - top.protocol("WM_DELETE_WINDOW", self.close) - top.wm_title(self.title) - top.wm_iconname(self.icon) -- self.top = top -+ top.resizable(height=FALSE,width=FALSE) -+ self.ttop = top -+ self.top = Frame(top) - - self.row = 0 -- self.top.grid_columnconfigure(0, pad=2, weight=0) -- self.top.grid_columnconfigure(1, pad=2, minsize=100, weight=100) -+ self.top.grid(sticky='news') - - self.create_entries() - self.create_option_buttons() - self.create_other_buttons() -- return self.create_command_buttons() -+ self.create_command_buttons() - -+ - def make_entry(self, label, var): - l = Label(self.top, text=label) -- l.grid(row=self.row, column=0, sticky="nw") -+ l.grid(row=self.row, column=0, sticky="ne", padx=6, pady=6) - e = Entry(self.top, textvariable=var, exportselection=0) -- e.grid(row=self.row, column=1, sticky="nwe") -+ e.grid(row=self.row, column=1, sticky="nwe", padx=6, pady=6) - self.row = self.row + 1 - return e - - def make_frame(self,labeltext=None): - if labeltext: - l = Label(self.top, text=labeltext) -- l.grid(row=self.row, column=0, sticky="nw") -+ l.grid(row=self.row, column=0, sticky="ne", padx=6, pady=6) - f = Frame(self.top) -- f.grid(row=self.row, column=1, columnspan=1, sticky="nwe") -+ f.grid(row=self.row, column=1, columnspan=1, sticky="nwe", -+ padx=6, pady=6 if labeltext else 0) - self.row = self.row + 1 - return f - -- def make_button(self, label, command, isdef=0): -- b = Button(self.buttonframe, -- text=label, command=command, -- default=isdef and "active" or "normal") -- cols,rows=self.buttonframe.grid_size() -- b.grid(pady=1,row=rows,column=0,sticky="ew") -- self.buttonframe.grid(rowspan=rows+1) -- return b -- - def create_entries(self): -- self.ent = self.make_entry("Find:", self.engine.patvar) -+ self.ent = self.make_entry("Find", self.engine.patvar) - - def create_option_buttons(self): - f = self.make_frame("Options") - -- btn = Checkbutton(f, anchor="w", -- variable=self.engine.revar, -- text="Regular expression") -+ btn = Checkbutton(f, variable=self.engine.revar, -+ text="Regular expression") - btn.pack(side="left", fill="both") - if self.engine.isre(): -- btn.select() -+ btn.invoke() - -- btn = Checkbutton(f, anchor="w", -- variable=self.engine.casevar, -- text="Match case") -+ btn = Checkbutton(f, variable=self.engine.casevar, text="Match case") - btn.pack(side="left", fill="both") - if self.engine.iscase(): -- btn.select() -+ btn.invoke() - -- btn = Checkbutton(f, anchor="w", -- variable=self.engine.wordvar, -- text="Whole word") -+ btn = Checkbutton(f, variable=self.engine.wordvar, text="Whole word") - btn.pack(side="left", fill="both") - if self.engine.isword(): -- btn.select() -+ btn.invoke() - - if self.needwrapbutton: -- btn = Checkbutton(f, anchor="w", -- variable=self.engine.wrapvar, -- text="Wrap around") -+ btn = Checkbutton(f, variable=self.engine.wrapvar, -+ text="Wrap around") - btn.pack(side="left", fill="both") - if self.engine.iswrap(): -- btn.select() -+ btn.invoke() - - def create_other_buttons(self): - f = self.make_frame("Direction") - -- #lbl = Label(f, text="Direction: ") -- #lbl.pack(side="left") -- -- btn = Radiobutton(f, anchor="w", -- variable=self.engine.backvar, value=1, -- text="Up") -- btn.pack(side="left", fill="both") -+ btn = Radiobutton(f, variable=self.engine.backvar, value=1, text="Up") -+ btn.pack(side="left") - if self.engine.isback(): -- btn.select() -+ btn.invoke() - -- btn = Radiobutton(f, anchor="w", -- variable=self.engine.backvar, value=0, -- text="Down") -- btn.pack(side="left", fill="both") -+ btn = Radiobutton(f, variable=self.engine.backvar, value=0, text="Down") -+ btn.pack(side="left") - if not self.engine.isback(): -- btn.select() -+ btn.invoke() - - def create_command_buttons(self): -- # -- # place button frame on the right -- f = self.buttonframe = Frame(self.top) -- f.grid(row=0,column=2,padx=2,pady=2,ipadx=2,ipady=2) -+ self.bottom_btns = self.bottom_btns or [] -+ f = Frame(self.top) -+ f.grid(row=self.row, column=0, columnspan=len(self.bottom_btns) + 1, -+ pady=6) - -- b = self.make_button("close", self.close) -- b.lower() -+ column = 0 -+ b = Button(f, text="Close", command=self.close) -+ b.grid(row=self.row, column=column, padx=6, pady=6) -+ column += 1 -+ -+ btns = {} -+ for tbtn in self.bottom_btns: -+ opts = {'text': tbtn[0], 'command': getattr(self, tbtn[1])} -+ if len(tbtn) == 3: -+ opts['default'] = tbtn[2] and 'active' or 'normal' -+ -+ btns[opts['text']] = Button(f, **opts).grid(row=self.row, padx=6, -+ pady=6, column=column) -+ column += 1 -Index: Lib/idlelib/SearchDialog.py -=================================================================== ---- Lib/idlelib/SearchDialog.py (revision 63916) -+++ Lib/idlelib/SearchDialog.py (working copy) -@@ -21,10 +21,10 @@ - return _setup(text).find_selection(text) - - class SearchDialog(SearchDialogBase): -+ bottom_btns = [("Find", 'default_command', 1)] - - def create_widgets(self): -- f = SearchDialogBase.create_widgets(self) -- self.make_button("Find", self.default_command, 1) -+ SearchDialogBase.create_widgets(self) - - def default_command(self, event=None): - if not self.engine.getprog(): -Index: Lib/idlelib/TreeWidget.py -=================================================================== ---- Lib/idlelib/TreeWidget.py (revision 63916) -+++ Lib/idlelib/TreeWidget.py (working copy) -@@ -21,6 +21,12 @@ - import ZoomHeight - from configHandler import idleConf - -+from idlelib.configHandler import idleConf -+ -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - ICONDIR = "Icons" - - # Look for Icons subdirectory in the same directory as this module -@@ -248,7 +254,9 @@ - label = self.label - except AttributeError: - # padding carefully selected (on Windows) to match Entry widget: -- self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2) -+ self.label = Label(self.canvas, text=text) -+ if not TTK: -+ self.label.configure(bd=0, padx=2, pady=2) - theme = idleConf.GetOption('main','Theme','name') - if self.selected: - self.label.configure(idleConf.GetHighlight(theme, 'hilite')) -@@ -451,6 +459,8 @@ - - # Testing functions - -+# XXX Can't run these tests -+ - def test(): - import PyShell - root = Toplevel(PyShell.root) -Index: Lib/idlelib/dynOptionMenuWidget.py -=================================================================== ---- Lib/idlelib/dynOptionMenuWidget.py (revision 63916) -+++ Lib/idlelib/dynOptionMenuWidget.py (working copy) -@@ -2,34 +2,41 @@ - OptionMenu widget modified to allow dynamic menu reconfiguration - and setting of highlightthickness - """ --from Tkinter import OptionMenu -+from Tkinter import OptionMenu, Menu - from Tkinter import _setit - import copy - -+from configHandler import idleConf -+TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') -+if TTK: -+ from ttk import * -+ - class DynOptionMenu(OptionMenu): -- """ -- unlike OptionMenu, our kwargs can include highlightthickness -- """ -+ """Unlike OptionMenu, our kwargs can include highlightthickness""" - def __init__(self, master, variable, value, *values, **kwargs): - #get a copy of kwargs before OptionMenu.__init__ munges them - kwargsCopy=copy.copy(kwargs) - if 'highlightthickness' in kwargs.keys(): - del(kwargs['highlightthickness']) -+ self.command=kwargs.get('command') -+ self.variable=variable -+ - OptionMenu.__init__(self, master, variable, value, *values, **kwargs) - self.config(highlightthickness=kwargsCopy.get('highlightthickness')) -- #self.menu=self['menu'] -- self.variable=variable -- self.command=kwargs.get('command') - -- def SetMenu(self,valueList,value=None): -+ def SetMenu(self, valueList, value=None): - """ - clear and reload the menu with a new set of options. - valueList - list of new options - value - initial value to set the optionmenu's menubutton to - """ -- self['menu'].delete(0,'end') -- for item in valueList: -- self['menu'].add_command(label=item, -+ if TTK: -+ self.set_menu(value, *valueList) -+ else: -+ menu = self['menu'] -+ menu.delete(0,'end') -+ for item in valueList: -+ menu.add_command(label=item, - command=_setit(self.variable,item,self.command)) -- if value: -- self.variable.set(value) -+ if value: -+ self.variable.set(value) -Index: Lib/idlelib/MultiStatusBar.py -=================================================================== ---- Lib/idlelib/MultiStatusBar.py (revision 63916) -+++ Lib/idlelib/MultiStatusBar.py (working copy) -@@ -1,5 +1,9 @@ - from Tkinter import * -+from idlelib.configHandler import idleConf - -+if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): -+ from ttk import Frame, Label -+ - class MultiStatusBar(Frame): - - def __init__(self, master=None, **kw): -@@ -10,7 +14,7 @@ - - def set_label(self, name, text='', side=LEFT): - if not self.labels.has_key(name): -- label = Label(self, bd=1, relief=SUNKEN, anchor=W) -+ label = Label(self, relief=SUNKEN, anchor=W) - label.pack(side=side) - self.labels[name] = label - else: From buildbot at python.org Sat Jun 7 00:23:04 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 06 Jun 2008 22:23:04 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080606222304.245A31E4004@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/404 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: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jun 7 00:25:41 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 00:25:41 +0200 (CEST) Subject: [Python-checkins] r64001 - sandbox/trunk/ttk-gsoc/README Message-ID: <20080606222541.3AC301E4007@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 00:25:40 2008 New Revision: 64001 Log: Updated README to reflect the current usage of a idlelib branch. Modified: sandbox/trunk/ttk-gsoc/README Modified: sandbox/trunk/ttk-gsoc/README ============================================================================== --- sandbox/trunk/ttk-gsoc/README (original) +++ sandbox/trunk/ttk-gsoc/README Sat Jun 7 00:25:40 2008 @@ -57,7 +57,7 @@ Tk source code http://tktoolkit.cvs.sourceforge.net/tktoolkit/ -Experimental Tile +Experimental IDLE ================= Another part of the project is moving the idlelib to use the new ttk @@ -69,9 +69,9 @@ Testing it ---------- -You will find a idlelib_ttk.diff inside the src/ directory. In order to -apply it you will need to checkout the python-trunk repo, the same you did -at `Reading the Documentation`_. -After applying it, start idle (adapt as needed): +You will find a idlelib directory at src/idlelib, which should be added to +your PYTHONPATH if you want to run IDLE using this experimental branch. +To use both the ttk module and the new idlelib, you could start idle as +this: -$ PYTHONPATH=~/ttk-gsoc/src/2.x ./python Tools/scripts/idle +$ PYTHONPATH=~/ttk-gsoc/src/2.x:~/ttk-gsoc/src/ idle From python-checkins at python.org Sat Jun 7 00:33:21 2008 From: python-checkins at python.org (travis.oliphant) Date: Sat, 7 Jun 2008 00:33:21 +0200 (CEST) Subject: [Python-checkins] r64002 - python/trunk/configure.in Message-ID: <20080606223321.D252C1E4004@bag.python.org> Author: travis.oliphant Date: Sat Jun 7 00:33:21 2008 New Revision: 64002 Log: Add long double check support to configure test. Modified: python/trunk/configure.in Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Sat Jun 7 00:33:21 2008 @@ -1321,6 +1321,17 @@ AC_CHECK_SIZEOF(long long, 8) fi +AC_MSG_CHECKING(for long double support) +have_long_double=no +AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [ + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.]) + have_long_double=yes +]) +AC_MSG_RESULT($have_long_double) +if test "$have_long_long" = yes ; then +AC_CHECK_SIZEOF(long double, 12) +fi + AC_MSG_CHECKING(for _Bool support) have_c99_bool=no AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [ From python-checkins at python.org Sat Jun 7 00:39:48 2008 From: python-checkins at python.org (travis.oliphant) Date: Sat, 7 Jun 2008 00:39:48 +0200 (CEST) Subject: [Python-checkins] r64003 - in python/trunk: Include/object.h Modules/_ctypes/_ctypes.c Objects/abstract.c Message-ID: <20080606223948.2AE381E4004@bag.python.org> Author: travis.oliphant Date: Sat Jun 7 00:39:47 2008 New Revision: 64003 Log: Remove locking part of new buffer protocol. Modified: python/trunk/Include/object.h python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Objects/abstract.c Modified: python/trunk/Include/object.h ============================================================================== --- python/trunk/Include/object.h (original) +++ python/trunk/Include/object.h Sat Jun 7 00:39:47 2008 @@ -183,7 +183,6 @@ #define PyBUF_WRITABLE 0x0001 /* we used to include an E, backwards compatible alias */ #define PyBUF_WRITEABLE PyBUF_WRITABLE -#define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -194,25 +193,15 @@ #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) #define PyBUF_CONTIG_RO (PyBUF_ND) -#define PyBUF_CONTIG_LCK (PyBUF_ND | PyBUF_LOCK) -#define PyBUF_CONTIG_XLCK (PyBUF_ND | PyBUF_LOCK | PyBUF_WRITABLE) #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) #define PyBUF_STRIDED_RO (PyBUF_STRIDES) -#define PyBUF_STRIDED_LCK (PyBUF_STRIDES | PyBUF_LOCK) -#define PyBUF_STRIDED_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) -#define PyBUF_RECORDS_LCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT) -#define PyBUF_RECORDS_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE \ - | PyBUF_FORMAT) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) -#define PyBUF_FULL_LCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT) -#define PyBUF_FULL_XLCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_WRITABLE \ - | PyBUF_FORMAT) #define PyBUF_READ 0x100 Modified: python/trunk/Modules/_ctypes/_ctypes.c ============================================================================== --- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Sat Jun 7 00:39:47 2008 @@ -2502,11 +2502,6 @@ Py_ssize_t i; if (view == NULL) return 0; - if (((flags & PyBUF_LOCK) == PyBUF_LOCK)) { - PyErr_SetString(PyExc_BufferError, - "Cannot lock this object."); - return -1; - } view->buf = self->b_ptr; view->len = self->b_size; Modified: python/trunk/Objects/abstract.c ============================================================================== --- python/trunk/Objects/abstract.c (original) +++ python/trunk/Objects/abstract.c Sat Jun 7 00:39:47 2008 @@ -685,12 +685,6 @@ int readonly, int flags) { if (view == NULL) return 0; - if (((flags & PyBUF_LOCK) == PyBUF_LOCK) && - readonly != 0) { - PyErr_SetString(PyExc_BufferError, - "Cannot lock this object."); - return -1; - } if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && (readonly == 1)) { PyErr_SetString(PyExc_BufferError, From python-checkins at python.org Sat Jun 7 01:06:21 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 01:06:21 +0200 (CEST) Subject: [Python-checkins] r64004 - in sandbox/trunk/ttk-gsoc/src/idlelib: PyShell.py config-main.def configDialog.py Message-ID: <20080606230621.365DD1E400D@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 01:06:20 2008 New Revision: 64004 Log: Added the possibility to change the display theme when running with Ttk. Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Sat Jun 7 01:06:20 2008 @@ -862,6 +862,9 @@ # self.pollinterval = 50 # millisec + if TTK: + self.set_theme(Style(self.root)) + def get_standard_extension_names(self): return idleConf.GetExtensions(shell_only=True) @@ -878,6 +881,10 @@ def get_warning_stream(self): return warning_stream + def set_theme(self, ttkstyle): + ttkstyle.theme_use(idleConf.GetOption('main', 'Theme', + 'displaytheme')) + def toggle_debugger(self, event=None): if self.executing: tkMessageBox.showerror("Don't debug now", Modified: sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/config-main.def Sat Jun 7 01:06:20 2008 @@ -49,7 +49,7 @@ print-command-posix=lpr %s print-command-win=start /min notepad /p %s delete-exitfunc= 1 -use-ttk=0 +use-ttk = 0 [EditorWindow] width= 80 @@ -69,6 +69,7 @@ [Theme] default= 1 name= IDLE Classic +displaytheme = default [Keys] default= 1 Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py Sat Jun 7 01:06:20 2008 @@ -359,6 +359,7 @@ self.startupEdit=IntVar(self) self.autoSave=IntVar(self) self.encoding=StringVar(self) + self.themename = StringVar(self) self.userHelpBrowser=BooleanVar(self) self.helpBrowser=StringVar(self) #widget creation @@ -372,6 +373,8 @@ frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE) frameParaSize=Frame(frame,borderwidth=2,relief=GROOVE) frameEncoding=Frame(frame,borderwidth=2,relief=GROOVE) + if TTK: + frameTheme = Frame(frame, borderwidth=2, relief=GROOVE) frameHelp=LabelFrame(frame,borderwidth=2,relief=GROOVE, text=' Additional Help Sources ') #frameRun @@ -408,6 +411,11 @@ value="utf-8",text="UTF-8") radioEncNone=Radiobutton(frameEncoding,variable=self.encoding, value="none",text="None") + #frameTheme + if TTK: + labelTheme = Label(frameTheme, text="Display Theme") + comboTheme = Combobox(frameTheme, textvariable=self.themename, + values=self.ttkstyle.theme_names(), state='readonly') #frameHelp frameHelpList=Frame(frameHelp) frameHelpListButtons=Frame(frameHelpList) @@ -430,6 +438,8 @@ frameWinSize.pack(side=TOP,padx=5,pady=5,fill=X) frameParaSize.pack(side=TOP,padx=5,pady=5,fill=X) frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X) + if TTK: + frameTheme.pack(side=TOP, padx=5, pady=5, fill=X) frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) #frameRun labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) @@ -453,6 +463,10 @@ radioEncNone.pack(side=RIGHT,anchor=E,pady=5) radioEncUTF8.pack(side=RIGHT,anchor=E,pady=5) radioEncLocale.pack(side=RIGHT,anchor=E,pady=5) + #franeTheme + if TTK: + labelTheme.pack(side=LEFT, anchor=W, padx=5, pady=5) + comboTheme.pack(side=RIGHT, anchor=E, padx=5, pady=5) #frameHelp frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y) frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) @@ -483,6 +497,7 @@ self.startupEdit.trace_variable('w',self.VarChanged_startupEdit) self.autoSave.trace_variable('w',self.VarChanged_autoSave) self.encoding.trace_variable('w',self.VarChanged_encoding) + self.themename.trace_variable('w', self.VarChanged_themename) def VarChanged_fontSize(self,*params): value=self.fontSize.get() @@ -580,6 +595,10 @@ value=self.encoding.get() self.AddChangedItem('main','EditorWindow','encoding',value) + def VarChanged_themename(self, *params): + value = self.themename.get() + self.AddChangedItem('main', 'Theme', 'displaytheme', value) + def ResetChangedItems(self): #When any config item is changed in this dialog, an entry #should be made in the relevant section (config type) of this @@ -1023,6 +1042,10 @@ self.PaintThemeSample() self.SetHighlightTarget() + if TTK: + displaytheme = idleConf.GetOption('main', 'Theme', 'displaytheme') + self.themename.set(displaytheme) + def __ThemeNameIndexCompare(self,a,b): if self.themeElements[a][1] 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/406 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: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jun 7 01:34:33 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 01:34:33 +0200 (CEST) Subject: [Python-checkins] r64005 - sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Message-ID: <20080606233434.000E01E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 01:34:33 2008 New Revision: 64005 Log: root style may not have the background set, noticed this under Windows. Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Sat Jun 7 01:34:33 2008 @@ -1406,7 +1406,7 @@ x = style.map('.') r = {'background': []} - for sspec in x['background']: + for sspec in x.get('background', []): if 'active' in sspec[:-1]: r['background'].append(('!disabled', sspec[-1])) break From buildbot at python.org Sat Jun 7 02:00:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 07 Jun 2008 00:00:45 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080607000046.4540D1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1444 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 5 tests failed: test_pydoc test_site test_subprocess test_sys test_winsound ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_pydoc.py", line 220, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_text_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_pydoc.py", line 228, in test_text_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== FAIL: test_specialtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 531, in test_specialtypes self.check_sizeof({}, h + 3*l + 3*p + 8*(l + 2*p)) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 272, expected 224 ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 452, in test_standardtypes self.check_sizeof(True, h + l) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 40, expected 32 ====================================================================== ERROR: test_alias_asterisk (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 86, in test_alias_asterisk winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exclamation (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 96, in test_alias_exclamation winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exit (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 106, in test_alias_exit winsound.PlaySound('SystemExit', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_hand (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 116, in test_alias_hand winsound.PlaySound('SystemHand', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_question (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 126, in test_alias_question winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) RuntimeError: Failed to play sound sincerely, -The Buildbot From buildbot at python.org Sat Jun 7 02:29:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 07 Jun 2008 00:29:07 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080607002907.41BB21E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3501 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: travis.oliphant BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 7 02:54:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 07 Jun 2008 00:54:42 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080607005442.7499E1E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1536 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 19 tests failed: test_bsddb test_bufio test_cookielib test_deque test_file test_filecmp test_gzip test_io test_iter test_mailbox test_multibytecodec test_pkgutil test_pydoc test_set test_site test_subprocess test_urllib2 test_zipfile test_zipimport ====================================================================== ERROR: test_nullpat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 59, in test_nullpat self.drive_one("\0" * 1000) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 51, in drive_one self.try_one(teststring[:-1]) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_primepat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 56, in test_primepat self.drive_one("1234567890\00\01\02\03\04\05\06") File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 49, in drive_one self.try_one(teststring) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_magic (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 268, in test_bad_magic f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_lwp_valueless_cookie (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 243, in test_lwp_valueless_cookie c.save(filename, ignore_discard=True) File "C:\buildbot\work\trunk.heller-windows\build\lib\_LWPCookieJar.py", line 83, in save f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_maxlen (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 79, in test_maxlen fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 286, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_matching (test.test_filecmp.FileCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_filecmp.py", line 13, in setUp output = open(name, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_1647484 (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 158, in test_1647484 f = gzip.GzipFile(self.filename, mode) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_append (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 54, in test_append self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_many_append (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 65, in test_many_append f = gzip.open(self.filename, 'wb', 9) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 33, in open return GzipFile(filename, mode, compresslevel) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_mode (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 151, in test_mode self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 48, in test_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 85, in test_readline self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 98, in test_readlines self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 112, in test_seek_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_whence (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 132, in test_seek_whence self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 144, in test_seek_write f = gzip.GzipFile(self.filename, 'w') File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: Test seek/tell using the StatefulIncrementalDecoder. ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 946, in testSeekAndTell testSeekAndTellWithData(input) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 926, in testSeekAndTellWithData decoded = f.read() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1668, in read decoder = self._decoder or self._get_decoder() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1457, in _get_decoder decoder = make_decoder(self._errors) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 523, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_open_close_open (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_relock (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_update (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_values (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_and_close (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_from_string (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_mbox_or_mmdf_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_close (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_items (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_open_close_open (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_relock (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_update (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_values (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_and_remove_folders (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_close (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_folder (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_items (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_bug1728403 (test.test_multibytecodec.Test_StreamReader) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_multibytecodec.py", line 148, in test_bug1728403 os.unlink(TESTFN) WindowsError: [Error 5] Access is denied: '@test' ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pydoc.py", line 220, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_text_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pydoc.py", line 228, in test_text_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== ERROR: test_print (test.test_set.TestBasicOpsSingleton) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_set.py", line 629, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_set.TestBasicOpsTuple) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_set.py", line 629, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_set.TestBasicOpsTriple) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_set.py", line 629, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_urllib2.py", line 614, in test_file f = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testAbsoluteArcnames (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testAppendToNonZipFile (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testIterlinesDeflated (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testIterlinesStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testLowCompression (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testOpenDeflated (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testOpenStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testOpenViaZipInfo (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testGoodPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 746, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testNoPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 746, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testGetCompiledSource (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 311, in testGetCompiledSource self.doTest(pyc_ext, files, TESTMOD, call=self.assertModuleSource) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testGetData (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 268, in testGetData z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testGetSource (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 305, in testGetSource self.doTest(".py", files, TESTMOD, call=self.assertModuleSource) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testImport_WithStuff (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 298, in testImport_WithStuff stuff="Some Stuff"*31) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testImporterAttr (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 291, in testImporterAttr self.doTest(pyc_ext, files, TESTMOD) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testPackage (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 189, in testPackage self.doTest(pyc_ext, files, TESTPACK, TESTMOD) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testPy (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 139, in testPy self.doTest(".py", files, TESTMOD) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testPyc (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 143, in testPyc self.doTest(pyc_ext, files, TESTMOD) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testTraceback (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 365, in testTraceback self.doTest(None, files, TESTMOD, call=self.doTraceback) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 68, in doTest z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testZipImporterMethods (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 206, in testZipImporterMethods z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' ====================================================================== ERROR: testZipImporterMethodsInSubDirectory (test.test_zipimport.CompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipimport.py", line 242, in testZipImporterMethodsInSubDirectory z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\trunk.heller-windows\build\lib\zipfile.py", line 618, in __init__ self.fp = open(file, modeDict[mode]) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\junk95142.zip' sincerely, -The Buildbot From python-checkins at python.org Sat Jun 7 03:04:21 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 03:04:21 +0200 (CEST) Subject: [Python-checkins] r64006 - sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Message-ID: <20080607010421.E823F1E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 03:04:21 2008 New Revision: 64006 Log: Removed the use of the "next" builtin so it works with python prior 2.6 Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 03:04:21 2008 @@ -1413,7 +1413,7 @@ self._variable = variable if kwargs: raise Tkinter.TclError('unknown option -%s' % ( - next(kwargs.iterkeys()))) + kwargs.iterkeys().next())) self['menu'] = self._menu self.set_menu(value, *((value, ) + values)) From python-checkins at python.org Sat Jun 7 12:42:03 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 12:42:03 +0200 (CEST) Subject: [Python-checkins] r64007 - sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py Message-ID: <20080607104203.CAFA01E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 12:42:03 2008 New Revision: 64007 Log: Removed a XXX comment, the problem is fixed on the release25-maint, trunk and py3k repos now Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py (original) +++ sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py Sat Jun 7 12:42:03 2008 @@ -49,8 +49,6 @@ def _setup_widgets(self): msg = ttk.Label(wraplength="4i", justify="left", anchor="n", - # XXX Change the following to a list, run it using tk 8.4 and - # watch it segfault. padding=(10, 2, 10, 6), text=("Ttk is the new Tk themed widget set. One of the widgets it " "includes is a tree widget, which can be configured to " From python-checkins at python.org Sat Jun 7 13:39:29 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 13:39:29 +0200 (CEST) Subject: [Python-checkins] r64008 - in sandbox/trunk/ttk-gsoc/Doc/library: tk.rst.diff ttk.rst Message-ID: <20080607113929.D86941E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 13:39:29 2008 New Revision: 64008 Log: Added a new reference; Updated tk.rst.diff to match current tk.rst at python-trunk. Modified: sandbox/trunk/ttk-gsoc/Doc/library/tk.rst.diff sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Modified: sandbox/trunk/ttk-gsoc/Doc/library/tk.rst.diff ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/tk.rst.diff (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/tk.rst.diff Sat Jun 7 13:39:29 2008 @@ -1,23 +1,22 @@ Index: Doc/library/tk.rst =================================================================== ---- Doc/library/tk.rst (revision 63398) +--- Doc/library/tk.rst (revision 64007) +++ Doc/library/tk.rst (working copy) -@@ -12,8 +12,8 @@ +@@ -12,7 +12,8 @@ Tk/Tcl has long been an integral part of Python. It provides a robust and platform independent windowing toolkit, that is available to Python programmers --using the :mod:`tkinter` package, and its extension, the :mod:`tkinter.tix` --module. +-using the :mod:`Tkinter` module, and its extension, the :mod:`Tix` module. +using the :mod:`tkinter` package, its extension, the :mod:`tkinter.tix` module +and the :mod:`ttk` module for using themed widgets. - The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. To - use :mod:`tkinter`, you don't need to write Tcl code, but you will need to -@@ -36,6 +36,7 @@ - tkinter.tix.rst - tkinter.scrolledtext.rst - tkinter.turtle.rst + The :mod:`Tkinter` module is a thin object-oriented layer on top of Tcl/Tk. To + use :mod:`Tkinter`, you don't need to write Tcl code, but you will need to +@@ -32,6 +33,7 @@ + .. toctree:: + + tkinter.rst + ttk.rst - idle.rst - othergui.rst - + tix.rst + scrolledtext.rst + turtle.rst Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Sat Jun 7 13:39:29 2008 @@ -53,6 +53,11 @@ longer present in Ttk widgets, instead you will have to use :class:`ttk.Style` to achieve the same (or better) styling. +.. seealso:: + `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. + Ttk Widgets ----------- From python-checkins at python.org Sat Jun 7 14:18:12 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 14:18:12 +0200 (CEST) Subject: [Python-checkins] r64009 - sandbox/trunk/ttk-gsoc/samples/widget_state.py Message-ID: <20080607121812.0FA771E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 14:18:11 2008 New Revision: 64009 Log: Removed unecessary py3k check. Modified: sandbox/trunk/ttk-gsoc/samples/widget_state.py Modified: sandbox/trunk/ttk-gsoc/samples/widget_state.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/widget_state.py (original) +++ sandbox/trunk/ttk-gsoc/samples/widget_state.py Sat Jun 7 14:18:11 2008 @@ -11,10 +11,7 @@ states.append("!" + state) def reset_state(widget): - if PY3K: - nostate = states[len(states) // 2:] - else: - nostate = states[len(states) / 2:] + nostate = states[len(states) // 2:] widget.state(nostate) class App(ttk.Frame): From python-checkins at python.org Sat Jun 7 14:55:52 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 14:55:52 +0200 (CEST) Subject: [Python-checkins] r64010 - peps/trunk/pep-3119.txt Message-ID: <20080607125552.8C30F1E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 14:55:52 2008 New Revision: 64010 Log: bytes aren't mutable anymore. Modified: peps/trunk/pep-3119.txt Modified: peps/trunk/pep-3119.txt ============================================================================== --- peps/trunk/pep-3119.txt (original) +++ peps/trunk/pep-3119.txt Sat Jun 7 14:55:52 2008 @@ -182,7 +182,7 @@ isinstance((), Sequence) not issubclass(tuple, MutableSequence) isinstance("", Sequence) - issubclass(bytes, MutableSequence) + issubclass(bytearray, MutableSequence) The primary mechanism proposed here is to allow overloading the built-in functions ``isinstance()`` and ``issubclass()``. The From python-checkins at python.org Sat Jun 7 14:56:39 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 14:56:39 +0200 (CEST) Subject: [Python-checkins] r64011 - peps/trunk/pep-0361.txt Message-ID: <20080607125639.71B6A1E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 14:56:39 2008 New Revision: 64011 Log: Status update in PEP 361. Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Sat Jun 7 14:56:39 2008 @@ -82,7 +82,8 @@ New modules in the standard library: - - json + - json + - new enhanced turtle module Deprecated modules and functions in the standard library: @@ -126,22 +127,20 @@ any C modifications or behavioral changes. New features *must* be implemented prior to beta1 or will require Release Manager approval. - The following PEPs are being worked on for possible inclusion in 2.6: + The following PEPs are being worked on for inclusion in 2.6: - - PEP 297: Support for System Upgrades [#pep297] - - PEP 367: New Super [#pep367] + - PEP 371: Addition of the multiprocessing package [#pep371] Each non-trivial feature listed here that is not a PEP must be discussed on python-dev. Other enhancements include: - distutils replacement (requires a PEP) - - turtle.py replacement or enhancements New modules in the standard library: - winerror http://python.org/sf/1505257 - (Owner: MAL) + (Patch rejected, module should be written in C) - setuptools BDFL pronouncement for inclusion in 2.5: @@ -153,10 +152,6 @@ - ast http://mail.python.org/pipermail/python-dev/2008-April/078950.html - - pyprocessing - http://mail.python.org/pipermail/python-dev/2008-May/079417.html - http://mail.python.org/pipermail/python-dev/2008-May/079677.html - Modules to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): @@ -246,6 +241,9 @@ .. [#pep367] PEP 367 (New Super) http://www.python.org/dev/peps/pep-0367 +.. [#pep371] PEP 371 (Addition of the multiprocessing package) + http://www.python.org/dev/peps/pep-0371 + .. [#pep3000] PEP 3000 (Python 3000) http://www.python.org/dev/peps/pep-3000 From python-checkins at python.org Sat Jun 7 15:36:36 2008 From: python-checkins at python.org (facundo.batista) Date: Sat, 7 Jun 2008 15:36:36 +0200 (CEST) Subject: [Python-checkins] r64012 - python/trunk/Lib/test/test_urllib2net.py Message-ID: <20080607133636.CE3151E4004@bag.python.org> Author: facundo.batista Date: Sat Jun 7 15:36:36 2008 New Revision: 64012 Log: Finished bug #2451. Fixed the retrying part to make it more robust. Modified: python/trunk/Lib/test/test_urllib2net.py Modified: python/trunk/Lib/test/test_urllib2net.py ============================================================================== --- python/trunk/Lib/test/test_urllib2net.py (original) +++ python/trunk/Lib/test/test_urllib2net.py Sat Jun 7 15:36:36 2008 @@ -11,18 +11,24 @@ import mimetools -def _urlopen_with_retry(host, *args, **kwargs): - # Connecting to remote hosts is flaky. Make it more robust - # by retrying the connection several times. +def _retry_thrice(func, exc, *args, **kwargs): for i in range(3): try: - return urllib2.urlopen(host, *args, **kwargs) - except urllib2.URLError, last_exc: + return func(*args, **kwargs) + except exc, last_exc: continue except: raise raise last_exc +def _wrap_with_retry_thrice(func, exc): + def wrapped(*args, **kwargs): + return _retry_thrice(func, exc, *args, **kwargs) + return wrapped + +# Connecting to remote hosts is flaky. Make it more robust by retrying +# the connection several times. +_urlopen_with_retry = _wrap_with_retry_thrice(urllib2.urlopen, urllib2.URLError) class AuthTests(unittest.TestCase): @@ -115,7 +121,7 @@ 'file:'+sanepathname2url(os.path.abspath(TESTFN)), ('file:///nonsensename/etc/passwd', None, urllib2.URLError), ] - self._test_urls(urls, self._extra_handlers(), urllib2.urlopen) + self._test_urls(urls, self._extra_handlers(), retry=True) finally: os.remove(TESTFN) @@ -147,13 +153,15 @@ ## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) - def _test_urls(self, urls, handlers, urlopen=_urlopen_with_retry): + def _test_urls(self, urls, handlers, retry=True): import socket import time import logging debug = logging.getLogger("test_urllib2").debug - urllib2.install_opener(urllib2.build_opener(*handlers)) + urlopen = urllib2.build_opener(*handlers).open + if retry: + urlopen = _wrap_with_retry_thrice(urlopen, urllib2.URLError) for url in urls: if isinstance(url, tuple): From python-checkins at python.org Sat Jun 7 16:00:11 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 16:00:11 +0200 (CEST) Subject: [Python-checkins] r64013 - in sandbox/trunk/ttk-gsoc: samples/widget_state.py src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080607140011.5CE031E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 16:00:10 2008 New Revision: 64013 Log: Updated and reorganized the extension class LabeledScale. Now it auto creates a variable if one isn't passed, and supports label at top or bottom. Modified: sandbox/trunk/ttk-gsoc/samples/widget_state.py sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/samples/widget_state.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/widget_state.py (original) +++ sandbox/trunk/ttk-gsoc/samples/widget_state.py Sat Jun 7 16:00:10 2008 @@ -3,7 +3,6 @@ import ttk -PY3K = True if sys.version_info[0] > 2 else False states = ['active', 'disabled', 'focus', 'pressed', 'selected', 'background', 'readonly', 'alternate', 'invalid'] Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 16:00:10 2008 @@ -1359,50 +1359,84 @@ # Extensions -class LabeledScale(Frame): +class LabeledScale(Frame, object): """A Ttk Scale widget with a Ttk Label widget over it indicating its current value. The Ttk Scale can be accessed through instance.scale, and Ttk Label can be accessed through instance.label""" - def __init__(self, master, variable, from_=0, to=10, **kw): + def __init__(self, master=None, variable=None, from_=0, to=10, **kw): """Construct a LabeledScale with parent master, a variable to be - associated with the Ttk Scale widget and its range.""" + associated with the Ttk Scale widget and its range. If variable is + not specified, a Tkinter.IntVar is created. + + WIDGET-SPECIFIC OPTIONS + + compound: 'top' or 'bottom' + Specifies how to display the label relative to the scale. + Defaults to 'top'. + """ + self._label_top = kw.pop('compound', 'top') == 'top' Frame.__init__(self, master, **kw) + self._variable = variable or Tkinter.IntVar(master, value=from_) + self.label = Label(self) - self.scale = Scale(self, variable=variable, from_=from_, to=to) + self.scale = Scale(self, variable=self._variable, from_=from_, to=to) - tmp = Label(self).pack() # place holder - self.label.place(anchor='n') - self.scale.pack(side='bottom', fill='x') + # position scale and label according to the compound option + scale_side = 'bottom' if self._label_top else 'top' + label_side = 'top' if scale_side == 'bottom' else 'bottom' + self.scale.pack(side=scale_side, fill='x') + tmp = Label(self).pack(side=label_side) # place holder + self.label.place(anchor='n' if label_side == 'top' else 's') - self._variable = variable + # update the label as scale or variable changes self._variable.trace_variable('w', self._adjust) - self.scale.bind('', self._adjust) self.scale.bind('', self._adjust) def _adjust(self, *args): """Adjust the label position according to the scale.""" + newval = self._variable.get() + if not self.scale['from'] <= newval <= self.scale['to']: + return + self.update() - self.label['text'] = self._variable.get() - x, y = self.scale.coords() + self.label['text'] = newval - y = self.scale.winfo_y() - self.label.winfo_reqheight() + x, y = self.scale.coords() + if self._label_top: + y = self.scale.winfo_y() - self.label.winfo_reqheight() + else: + y = self.scale.winfo_reqheight() + self.label.winfo_reqheight() x = x + self.scale.winfo_x() + self.label.place_configure(x=x, y=y) + def _get_value(self): + """Return current scale value.""" + return self._variable.get() + + + def _set_value(self, val): + """Set new scale value.""" + self._variable.set(val) + + + value = property(_get_value, _set_value) + + class OptionMenu(Menubutton): """Themed OptionMenu which allows the user to select a value from a menu.""" - def __init__(self, master, variable, value, *values, **kwargs): + def __init__(self, master, variable, default=None, *values, **kwargs): """Construct a themed OptionMenu widget with the parent master, the resource textvariable set to variable, the initially selected - value specified by the value parameter, the other menu values + value specified by the default parameter, the other menu values given by *values and an additional keyword argument command.""" kw = {'textvariable': variable, 'style': kwargs.pop('style', None), 'direction': kwargs.pop('direction', None)} @@ -1416,7 +1450,7 @@ kwargs.iterkeys().next())) self['menu'] = self._menu - self.set_menu(value, *((value, ) + values)) + self.set_menu(default, *((default, ) + values)) def __getitem__(self, item): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 16:00:10 2008 @@ -1366,43 +1366,77 @@ The Ttk Scale can be accessed through instance.scale, and Ttk Label can be accessed through instance.label""" - def __init__(self, master, variable, from_=0, to=10, **kw): + def __init__(self, master=None, variable=None, from_=0, to=10, **kw): """Construct a LabeledScale with parent master, a variable to be - associated with the Ttk Scale widget and its range.""" + associated with the Ttk Scale widget and its range. If variable is + not specified, a tkinter.IntVar is created. + + WIDGET-SPECIFIC OPTIONS + + compound: 'top' or 'bottom' + Specifies how to display the label relative to the scale. + Defaults to 'top'. + """ + self._label_top = kw.pop('compound', 'top') == 'top' Frame.__init__(self, master, **kw) + self._variable = variable or tkinter.IntVar(master, value=from_) + self.label = Label(self) - self.scale = Scale(self, variable=variable, from_=from_, to=to) + self.scale = Scale(self, variable=self._variable, from_=from_, to=to) - tmp = Label(self).pack() # place holder - self.label.place(anchor='n') - self.scale.pack(side='bottom', fill='x') + # position scale and label according to the compound option + scale_side = 'bottom' if self._label_top else 'top' + label_side = 'top' if scale_side == 'bottom' else 'bottom' + self.scale.pack(side=scale_side, fill='x') + tmp = Label(self).pack(side=label_side) # place holder + self.label.place(anchor='n' if label_side == 'top' else 's') - self._variable = variable + # update the label as scale or variable changes self._variable.trace_variable('w', self._adjust) - self.scale.bind('', self._adjust) self.scale.bind('', self._adjust) def _adjust(self, *args): """Adjust the label position according to the scale.""" + newval = self._variable.get() + if not self.scale['from'] <= newval <= self.scale['to']: + return + self.update() - self.label['text'] = self._variable.get() - x, y = self.scale.coords() + self.label['text'] = newval - y = self.scale.winfo_y() - self.label.winfo_reqheight() + x, y = self.scale.coords() + if self._label_top: + y = self.scale.winfo_y() - self.label.winfo_reqheight() + else: + y = self.scale.winfo_reqheight() + self.label.winfo_reqheight() x = x + self.scale.winfo_x() + self.label.place_configure(x=x, y=y) + def _get_value(self): + """Return current scale value.""" + return self._variable.get() + + + def _set_value(self, val): + """Set new scale value.""" + self._variable.set(val) + + + value = property(_get_value, _set_value) + + class OptionMenu(Menubutton): """Themed OptionMenu which allows the user to select a value from a menu.""" - def __init__(self, master, variable, value, *values, **kwargs): + def __init__(self, master, variable, default=None, *values, **kwargs): """Construct a themed OptionMenu widget with the parent master, the resource textvariable set to variable, the initially selected - value specified by the value parameter, the other menu values + value specified by the default parameter, the other menu values given by *values and an additional keyword argument command.""" kw = {'textvariable': variable, 'style': kwargs.pop('style', None), 'direction': kwargs.pop('direction', None)} @@ -1416,7 +1450,7 @@ next(iter(kwargs.keys())))) self['menu'] = self._menu - self.set_menu(value, *((value, ) + values)) + self.set_menu(default, *((default, ) + values)) def __getitem__(self, item): From buildbot at python.org Sat Jun 7 17:16:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 07 Jun 2008 15:16:45 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080607151645.BFAFA1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1446 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 4 tests failed: test_pydoc test_site test_sys test_winsound ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_pydoc.py", line 220, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_text_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_pydoc.py", line 228, in test_text_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_ioencoding (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 397, in test_ioencoding stdout = subprocess.PIPE, env=env) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== FAIL: test_specialtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 531, in test_specialtypes self.check_sizeof({}, h + 3*l + 3*p + 8*(l + 2*p)) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 272, expected 224 ====================================================================== FAIL: test_standardtypes (test.test_sys.SizeofTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 452, in test_standardtypes self.check_sizeof(True, h + l) File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_sys.py", line 428, in check_sizeof self.assertEqual(result, size, msg) AssertionError: wrong size for : got 40, expected 32 ====================================================================== ERROR: test_alias_asterisk (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 86, in test_alias_asterisk winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exclamation (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 96, in test_alias_exclamation winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_exit (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 106, in test_alias_exit winsound.PlaySound('SystemExit', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_hand (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 116, in test_alias_hand winsound.PlaySound('SystemHand', winsound.SND_ALIAS) RuntimeError: Failed to play sound ====================================================================== ERROR: test_alias_question (test.test_winsound.PlaySoundTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\trunk.heller-windows-amd64\build\lib\test\test_winsound.py", line 126, in test_alias_question winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) RuntimeError: Failed to play sound sincerely, -The Buildbot From python-checkins at python.org Sat Jun 7 17:59:11 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 17:59:11 +0200 (CEST) Subject: [Python-checkins] r64014 - in python/trunk: Doc/library/_ast.rst Doc/library/inspect.rst Doc/library/language.rst Lib/inspect.py Lib/test/test_ast.py Lib/test/test_inspect.py Misc/NEWS Message-ID: <20080607155911.06D301E4005@bag.python.org> Author: georg.brandl Date: Sat Jun 7 17:59:10 2008 New Revision: 64014 Log: Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc() to ease standalone use of the algorithm. Removed: python/trunk/Doc/library/_ast.rst Modified: python/trunk/Doc/library/inspect.rst python/trunk/Doc/library/language.rst python/trunk/Lib/inspect.py python/trunk/Lib/test/test_ast.py python/trunk/Lib/test/test_inspect.py python/trunk/Misc/NEWS Deleted: python/trunk/Doc/library/_ast.rst ============================================================================== --- python/trunk/Doc/library/_ast.rst Sat Jun 7 17:59:10 2008 +++ (empty file) @@ -1,85 +0,0 @@ -.. _ast: - -Abstract Syntax Trees -===================== - -.. module:: _ast - :synopsis: Abstract Syntax Tree classes. - -.. sectionauthor:: Martin v. L?wis - - -.. versionadded:: 2.5 - -The ``_ast`` module helps Python applications to process trees of the Python -abstract syntax grammar. The abstract syntax itself might change with each -Python release; this module helps to find out programmatically what the current -grammar looks like. - -An abstract syntax tree can be generated by passing :data:`_ast.PyCF_ONLY_AST` -as a flag to the :func:`compile` builtin function. The result will be a tree of -objects whose classes all inherit from :class:`_ast.AST`. - -A modified abstract syntax tree can be compiled into a Python code object using -the built-in :func:`compile` function. - -The actual classes are derived from the ``Parser/Python.asdl`` file, which is -reproduced below. There is one class defined for each left-hand side symbol in -the abstract grammar (for example, ``_ast.stmt`` or ``_ast.expr``). In addition, -there is one class defined for each constructor on the right-hand side; these -classes inherit from the classes for the left-hand side trees. For example, -``_ast.BinOp`` inherits from ``_ast.expr``. For production rules with -alternatives (aka "sums"), the left-hand side class is abstract: only instances -of specific constructor nodes are ever created. - -Each concrete class has an attribute ``_fields`` which gives the names of all -child nodes. - -Each instance of a concrete class has one attribute for each child node, of the -type as defined in the grammar. For example, ``_ast.BinOp`` instances have an -attribute ``left`` of type ``_ast.expr``. Instances of ``_ast.expr`` and -``_ast.stmt`` subclasses also have lineno and col_offset attributes. The lineno -is the line number of source text (1 indexed so the first line is line 1) and -the col_offset is the utf8 byte offset of the first token that generated the -node. The utf8 offset is recorded because the parser uses utf8 internally. - -If these attributes are marked as optional in the grammar (using a question -mark), the value might be ``None``. If the attributes can have zero-or-more -values (marked with an asterisk), the values are represented as Python lists. -All possible attributes must be present and have valid values when compiling an -AST with :func:`compile`. - -The constructor of a class ``_ast.T`` parses their arguments as follows: - -* If there are positional arguments, there must be as many as there are items in - ``T._fields``; they will be assigned as attributes of these names. -* If there are keyword arguments, they will set the attributes of the same names - to the given values. - -For example, to create and populate a ``UnaryOp`` node, you could use :: - - node = _ast.UnaryOp() - node.op = _ast.USub() - node.operand = _ast.Num() - node.operand.n = 5 - node.operand.lineno = 0 - node.operand.col_offset = 0 - node.lineno = 0 - node.col_offset = 0 - -or the more compact :: - - node = _ast.UnaryOp(_ast.USub(), _ast.Num(5, lineno=0, col_offset=0), - lineno=0, col_offset=0) - - - -Abstract Grammar ----------------- - -The module defines a string constant ``__version__`` which is the decimal -subversion revision number of the file shown below. - -The abstract grammar is currently defined as follows: - -.. literalinclude:: ../../Parser/Python.asdl Modified: python/trunk/Doc/library/inspect.rst ============================================================================== --- python/trunk/Doc/library/inspect.rst (original) +++ python/trunk/Doc/library/inspect.rst Sat Jun 7 17:59:10 2008 @@ -376,13 +376,9 @@ Retrieving source code ---------------------- - .. function:: getdoc(object) - Get the documentation string for an object. All tabs are expanded to spaces. To - clean up docstrings that are indented to line up with blocks of code, any - whitespace than can be uniformly removed from the second line onwards is - removed. + Get the documentation string for an object, cleaned up with :func:`cleandoc`. .. function:: getcomments(object) @@ -429,6 +425,15 @@ cannot be retrieved. +.. function:: cleandoc(doc) + + Clean up indentation from docstrings that are indented to line up with blocks + of code. Any whitespace that can be uniformly removed from the second line + onwards is removed. Also, all tabs are expanded to spaces. + + .. versionadded:: 2.6 + + .. _inspect-classes-functions: Classes and functions Modified: python/trunk/Doc/library/language.rst ============================================================================== --- python/trunk/Doc/library/language.rst (original) +++ python/trunk/Doc/library/language.rst Sat Jun 7 17:59:10 2008 @@ -15,7 +15,7 @@ .. toctree:: parser.rst - _ast.rst + ast.rst symbol.rst token.rst keyword.rst Modified: python/trunk/Lib/inspect.py ============================================================================== --- python/trunk/Lib/inspect.py (original) +++ python/trunk/Lib/inspect.py Sat Jun 7 17:59:10 2008 @@ -368,6 +368,13 @@ return None if not isinstance(doc, types.StringTypes): return None + return cleandoc(doc) + +def cleandoc(doc): + """Clean up indentation from docstrings. + + Any whitespace that can be uniformly removed from the second line + onwards is removed.""" try: lines = string.split(string.expandtabs(doc), '\n') except UnicodeError: Modified: python/trunk/Lib/test/test_ast.py ============================================================================== --- python/trunk/Lib/test/test_ast.py (original) +++ python/trunk/Lib/test/test_ast.py Sat Jun 7 17:59:10 2008 @@ -1,6 +1,6 @@ import sys, itertools, unittest from test import test_support -import _ast +import ast def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): @@ -123,9 +123,9 @@ class AST_Tests(unittest.TestCase): def _assert_order(self, ast_node, parent_pos): - if not isinstance(ast_node, _ast.AST) or ast_node._fields is None: + if not isinstance(ast_node, ast.AST) or ast_node._fields is None: return - if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): + if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) self.assert_(node_pos >= parent_pos) parent_pos = (ast_node.lineno, ast_node.col_offset) @@ -142,29 +142,29 @@ (single_tests, single_results, "single"), (eval_tests, eval_results, "eval")): for i, o in itertools.izip(input, output): - ast_tree = compile(i, "?", kind, _ast.PyCF_ONLY_AST) + ast_tree = compile(i, "?", kind, ast.PyCF_ONLY_AST) self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) def test_nodeclasses(self): - x = _ast.BinOp(1, 2, 3, lineno=0) + x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # node raises exception when not given enough arguments - self.assertRaises(TypeError, _ast.BinOp, 1, 2) + self.assertRaises(TypeError, ast.BinOp, 1, 2) # can set attributes through kwargs too - x = _ast.BinOp(left=1, op=2, right=3, lineno=0) + x = ast.BinOp(left=1, op=2, right=3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # this used to fail because Sub._fields was None - x = _ast.Sub() + x = ast.Sub() def test_pickling(self): import pickle @@ -181,8 +181,99 @@ ast2 = mod.loads(mod.dumps(ast, protocol)) self.assertEquals(to_tuple(ast2), to_tuple(ast)) + +class ASTHelpers_Test(unittest.TestCase): + + def test_parse(self): + a = ast.parse('foo(1 + 1)') + b = compile('foo(1 + 1)', '', 'exec', ast.PyCF_ONLY_AST) + self.assertEqual(ast.dump(a), ast.dump(b)) + + def test_dump(self): + node = ast.parse('spam(eggs, "and cheese")') + self.assertEqual(ast.dump(node), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), " + "args=[Name(id='eggs', ctx=Load()), Str(s='and cheese')], " + "keywords=[], starargs=None, kwargs=None))])" + ) + self.assertEqual(ast.dump(node, annotate_fields=False), + "Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), " + "Str('and cheese')], [], None, None))])" + ) + self.assertEqual(ast.dump(node, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), " + "lineno=1, col_offset=0), args=[Name(id='eggs', ctx=Load(), " + "lineno=1, col_offset=5), Str(s='and cheese', lineno=1, " + "col_offset=11)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_copy_location(self): + src = ast.parse('1 + 1', mode='eval') + src.body.right = ast.copy_location(ast.Num(2), src.body.right) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=1, col_offset=0), ' + 'op=Add(), right=Num(n=2, lineno=1, col_offset=4), lineno=1, ' + 'col_offset=0))' + ) + + def test_fix_missing_locations(self): + src = ast.parse('write("spam")') + src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()), + [ast.Str('eggs')], [], None, None))) + self.assertEqual(src, ast.fix_missing_locations(src)) + self.assertEqual(ast.dump(src, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), " + "lineno=1, col_offset=0), args=[Str(s='spam', lineno=1, " + "col_offset=6)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0), " + "Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, " + "col_offset=0), args=[Str(s='eggs', lineno=1, col_offset=0)], " + "keywords=[], starargs=None, kwargs=None, lineno=1, " + "col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_increment_lineno(self): + src = ast.parse('1 + 1', mode='eval') + self.assertEqual(ast.increment_lineno(src, n=3), src) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), ' + 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' + 'col_offset=0))' + ) + + def test_iter_fields(self): + node = ast.parse('foo()', mode='eval') + d = dict(ast.iter_fields(node.body)) + self.assertEqual(d.pop('func').id, 'foo') + self.assertEqual(d, {'keywords': [], 'kwargs': None, + 'args': [], 'starargs': None}) + + def test_iter_child_nodes(self): + node = ast.parse("spam(23, 42, eggs='leek')", mode='eval') + self.assertEqual(len(list(ast.iter_child_nodes(node.body))), 4) + iterator = ast.iter_child_nodes(node.body) + self.assertEqual(next(iterator).id, 'spam') + self.assertEqual(next(iterator).n, 23) + self.assertEqual(next(iterator).n, 42) + self.assertEqual(ast.dump(next(iterator)), + "keyword(arg='eggs', value=Str(s='leek'))" + ) + + def test_get_docstring(self): + node = ast.parse('def foo():\n """line one\n line two"""') + self.assertEqual(ast.get_docstring(node.body[0]), + 'line one\n line two') + + def test_literal_eval(self): + self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) + self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) + self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None)) + self.assertRaises(ValueError, ast.literal_eval, 'foo()') + + def test_main(): - test_support.run_unittest(AST_Tests) + test_support.run_unittest(AST_Tests, ASTHelpers_Test) def main(): if __name__ != '__main__': Modified: python/trunk/Lib/test/test_inspect.py ============================================================================== --- python/trunk/Lib/test/test_inspect.py (original) +++ python/trunk/Lib/test/test_inspect.py Sat Jun 7 17:59:10 2008 @@ -185,6 +185,10 @@ self.assertEqual(inspect.getdoc(git.abuse), 'Another\n\ndocstring\n\ncontaining\n\ntabs') + def test_cleandoc(self): + self.assertEqual(inspect.cleandoc('An\n indented\n docstring.'), + 'An\nindented\ndocstring.') + def test_getcomments(self): self.assertEqual(inspect.getcomments(mod), '# line 1\n') self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n') Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jun 7 17:59:10 2008 @@ -72,6 +72,9 @@ Library ------- +- Factored out the indentation cleaning from inspect.getdoc() into + inspect.cleandoc() to ease standalone use. + - Issue #1798: Add ctypes calling convention that allows safe access to errno. From python-checkins at python.org Sat Jun 7 18:04:02 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 18:04:02 +0200 (CEST) Subject: [Python-checkins] r64015 - in python/trunk: Doc/library/_ast.rst Doc/library/language.rst Lib/test/test_ast.py Message-ID: <20080607160402.6CE701E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 18:04:01 2008 New Revision: 64015 Log: Revert unwanted changes. Added: python/trunk/Doc/library/_ast.rst Modified: python/trunk/Doc/library/language.rst python/trunk/Lib/test/test_ast.py Added: python/trunk/Doc/library/_ast.rst ============================================================================== --- (empty file) +++ python/trunk/Doc/library/_ast.rst Sat Jun 7 18:04:01 2008 @@ -0,0 +1,85 @@ +.. _ast: + +Abstract Syntax Trees +===================== + +.. module:: _ast + :synopsis: Abstract Syntax Tree classes. + +.. sectionauthor:: Martin v. L?wis + + +.. versionadded:: 2.5 + +The ``_ast`` module helps Python applications to process trees of the Python +abstract syntax grammar. The abstract syntax itself might change with each +Python release; this module helps to find out programmatically what the current +grammar looks like. + +An abstract syntax tree can be generated by passing :data:`_ast.PyCF_ONLY_AST` +as a flag to the :func:`compile` builtin function. The result will be a tree of +objects whose classes all inherit from :class:`_ast.AST`. + +A modified abstract syntax tree can be compiled into a Python code object using +the built-in :func:`compile` function. + +The actual classes are derived from the ``Parser/Python.asdl`` file, which is +reproduced below. There is one class defined for each left-hand side symbol in +the abstract grammar (for example, ``_ast.stmt`` or ``_ast.expr``). In addition, +there is one class defined for each constructor on the right-hand side; these +classes inherit from the classes for the left-hand side trees. For example, +``_ast.BinOp`` inherits from ``_ast.expr``. For production rules with +alternatives (aka "sums"), the left-hand side class is abstract: only instances +of specific constructor nodes are ever created. + +Each concrete class has an attribute ``_fields`` which gives the names of all +child nodes. + +Each instance of a concrete class has one attribute for each child node, of the +type as defined in the grammar. For example, ``_ast.BinOp`` instances have an +attribute ``left`` of type ``_ast.expr``. Instances of ``_ast.expr`` and +``_ast.stmt`` subclasses also have lineno and col_offset attributes. The lineno +is the line number of source text (1 indexed so the first line is line 1) and +the col_offset is the utf8 byte offset of the first token that generated the +node. The utf8 offset is recorded because the parser uses utf8 internally. + +If these attributes are marked as optional in the grammar (using a question +mark), the value might be ``None``. If the attributes can have zero-or-more +values (marked with an asterisk), the values are represented as Python lists. +All possible attributes must be present and have valid values when compiling an +AST with :func:`compile`. + +The constructor of a class ``_ast.T`` parses their arguments as follows: + +* If there are positional arguments, there must be as many as there are items in + ``T._fields``; they will be assigned as attributes of these names. +* If there are keyword arguments, they will set the attributes of the same names + to the given values. + +For example, to create and populate a ``UnaryOp`` node, you could use :: + + node = _ast.UnaryOp() + node.op = _ast.USub() + node.operand = _ast.Num() + node.operand.n = 5 + node.operand.lineno = 0 + node.operand.col_offset = 0 + node.lineno = 0 + node.col_offset = 0 + +or the more compact :: + + node = _ast.UnaryOp(_ast.USub(), _ast.Num(5, lineno=0, col_offset=0), + lineno=0, col_offset=0) + + + +Abstract Grammar +---------------- + +The module defines a string constant ``__version__`` which is the decimal +subversion revision number of the file shown below. + +The abstract grammar is currently defined as follows: + +.. literalinclude:: ../../Parser/Python.asdl Modified: python/trunk/Doc/library/language.rst ============================================================================== --- python/trunk/Doc/library/language.rst (original) +++ python/trunk/Doc/library/language.rst Sat Jun 7 18:04:01 2008 @@ -15,7 +15,7 @@ .. toctree:: parser.rst - ast.rst + _ast.rst symbol.rst token.rst keyword.rst Modified: python/trunk/Lib/test/test_ast.py ============================================================================== --- python/trunk/Lib/test/test_ast.py (original) +++ python/trunk/Lib/test/test_ast.py Sat Jun 7 18:04:01 2008 @@ -1,6 +1,6 @@ import sys, itertools, unittest from test import test_support -import ast +import _ast def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): @@ -123,9 +123,9 @@ class AST_Tests(unittest.TestCase): def _assert_order(self, ast_node, parent_pos): - if not isinstance(ast_node, ast.AST) or ast_node._fields is None: + if not isinstance(ast_node, _ast.AST) or ast_node._fields is None: return - if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)): + if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) self.assert_(node_pos >= parent_pos) parent_pos = (ast_node.lineno, ast_node.col_offset) @@ -142,29 +142,29 @@ (single_tests, single_results, "single"), (eval_tests, eval_results, "eval")): for i, o in itertools.izip(input, output): - ast_tree = compile(i, "?", kind, ast.PyCF_ONLY_AST) + ast_tree = compile(i, "?", kind, _ast.PyCF_ONLY_AST) self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) def test_nodeclasses(self): - x = ast.BinOp(1, 2, 3, lineno=0) + x = _ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # node raises exception when not given enough arguments - self.assertRaises(TypeError, ast.BinOp, 1, 2) + self.assertRaises(TypeError, _ast.BinOp, 1, 2) # can set attributes through kwargs too - x = ast.BinOp(left=1, op=2, right=3, lineno=0) + x = _ast.BinOp(left=1, op=2, right=3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # this used to fail because Sub._fields was None - x = ast.Sub() + x = _ast.Sub() def test_pickling(self): import pickle @@ -181,99 +181,8 @@ ast2 = mod.loads(mod.dumps(ast, protocol)) self.assertEquals(to_tuple(ast2), to_tuple(ast)) - -class ASTHelpers_Test(unittest.TestCase): - - def test_parse(self): - a = ast.parse('foo(1 + 1)') - b = compile('foo(1 + 1)', '', 'exec', ast.PyCF_ONLY_AST) - self.assertEqual(ast.dump(a), ast.dump(b)) - - def test_dump(self): - node = ast.parse('spam(eggs, "and cheese")') - self.assertEqual(ast.dump(node), - "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), " - "args=[Name(id='eggs', ctx=Load()), Str(s='and cheese')], " - "keywords=[], starargs=None, kwargs=None))])" - ) - self.assertEqual(ast.dump(node, annotate_fields=False), - "Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), " - "Str('and cheese')], [], None, None))])" - ) - self.assertEqual(ast.dump(node, include_attributes=True), - "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), " - "lineno=1, col_offset=0), args=[Name(id='eggs', ctx=Load(), " - "lineno=1, col_offset=5), Str(s='and cheese', lineno=1, " - "col_offset=11)], keywords=[], starargs=None, kwargs=None, " - "lineno=1, col_offset=0), lineno=1, col_offset=0)])" - ) - - def test_copy_location(self): - src = ast.parse('1 + 1', mode='eval') - src.body.right = ast.copy_location(ast.Num(2), src.body.right) - self.assertEqual(ast.dump(src, include_attributes=True), - 'Expression(body=BinOp(left=Num(n=1, lineno=1, col_offset=0), ' - 'op=Add(), right=Num(n=2, lineno=1, col_offset=4), lineno=1, ' - 'col_offset=0))' - ) - - def test_fix_missing_locations(self): - src = ast.parse('write("spam")') - src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()), - [ast.Str('eggs')], [], None, None))) - self.assertEqual(src, ast.fix_missing_locations(src)) - self.assertEqual(ast.dump(src, include_attributes=True), - "Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), " - "lineno=1, col_offset=0), args=[Str(s='spam', lineno=1, " - "col_offset=6)], keywords=[], starargs=None, kwargs=None, " - "lineno=1, col_offset=0), lineno=1, col_offset=0), " - "Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, " - "col_offset=0), args=[Str(s='eggs', lineno=1, col_offset=0)], " - "keywords=[], starargs=None, kwargs=None, lineno=1, " - "col_offset=0), lineno=1, col_offset=0)])" - ) - - def test_increment_lineno(self): - src = ast.parse('1 + 1', mode='eval') - self.assertEqual(ast.increment_lineno(src, n=3), src) - self.assertEqual(ast.dump(src, include_attributes=True), - 'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), ' - 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' - 'col_offset=0))' - ) - - def test_iter_fields(self): - node = ast.parse('foo()', mode='eval') - d = dict(ast.iter_fields(node.body)) - self.assertEqual(d.pop('func').id, 'foo') - self.assertEqual(d, {'keywords': [], 'kwargs': None, - 'args': [], 'starargs': None}) - - def test_iter_child_nodes(self): - node = ast.parse("spam(23, 42, eggs='leek')", mode='eval') - self.assertEqual(len(list(ast.iter_child_nodes(node.body))), 4) - iterator = ast.iter_child_nodes(node.body) - self.assertEqual(next(iterator).id, 'spam') - self.assertEqual(next(iterator).n, 23) - self.assertEqual(next(iterator).n, 42) - self.assertEqual(ast.dump(next(iterator)), - "keyword(arg='eggs', value=Str(s='leek'))" - ) - - def test_get_docstring(self): - node = ast.parse('def foo():\n """line one\n line two"""') - self.assertEqual(ast.get_docstring(node.body[0]), - 'line one\n line two') - - def test_literal_eval(self): - self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) - self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) - self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None)) - self.assertRaises(ValueError, ast.literal_eval, 'foo()') - - def test_main(): - test_support.run_unittest(AST_Tests, ASTHelpers_Test) + test_support.run_unittest(AST_Tests) def main(): if __name__ != '__main__': From python-checkins at python.org Sat Jun 7 18:16:12 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 18:16:12 +0200 (CEST) Subject: [Python-checkins] r64016 - python/trunk/Lib/UserDict.py Message-ID: <20080607161612.DA7981E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 18:16:12 2008 New Revision: 64016 Log: Register IterableUserDict as a MutableMapping. Modified: python/trunk/Lib/UserDict.py Modified: python/trunk/Lib/UserDict.py ============================================================================== --- python/trunk/Lib/UserDict.py (original) +++ python/trunk/Lib/UserDict.py Sat Jun 7 18:16:12 2008 @@ -79,6 +79,10 @@ def __iter__(self): return iter(self.data) +import _abcoll +_abcoll.MutableMapping.register(IterableUserDict) + + class DictMixin: # Mixin defining all dictionary methods for classes that already have # a minimum dictionary interface including getitem, setitem, delitem, From python-checkins at python.org Sat Jun 7 18:32:37 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 18:32:37 +0200 (CEST) Subject: [Python-checkins] r64017 - sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Message-ID: <20080607163237.784AA1E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 18:32:36 2008 New Revision: 64017 Log: Added proper unicode support where it makes sense Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 18:32:36 2008 @@ -65,7 +65,7 @@ continue if isinstance(value, (list, tuple)): - value = format % ' '.join(map(str, value)) + value = format % ' '.join(map(unicode, value)) if script and value == '': value = '{}' # empty string in Python is equivalent to {} in Tcl @@ -1229,7 +1229,7 @@ opts, values = _format_optdict(kw, ignore='values'), kw.get('values') # values may need special formatting if any value contains a space if values: - values = map(str, values) + values = map(unicode, values) opts += ("-values", ' '.join(('{%s}' if ' ' in v else '%s') % v for v in values)) if iid: From python-checkins at python.org Sat Jun 7 19:03:28 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 19:03:28 +0200 (CEST) Subject: [Python-checkins] r64018 - python/trunk/Lib/_abcoll.py Message-ID: <20080607170328.A6F191E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 19:03:28 2008 New Revision: 64018 Log: #3057: Fix the MutableMapping ABC to use the 2.6 dict interface. Modified: python/trunk/Lib/_abcoll.py Modified: python/trunk/Lib/_abcoll.py ============================================================================== --- python/trunk/Lib/_abcoll.py (original) +++ python/trunk/Lib/_abcoll.py Sat Jun 7 19:03:28 2008 @@ -329,14 +329,25 @@ else: return True + def iterkeys(self): + return iter(self) + + def itervalues(self): + for key in self: + yield self[key] + + def iteritems(self): + for key in self: + yield (key, self[key]) + def keys(self): - return KeysView(self) + return list(self) def items(self): - return ItemsView(self) + return [(key, self[key]) for key in self] def values(self): - return ValuesView(self) + return [self[key] for key in self] def __eq__(self, other): return isinstance(other, Mapping) and \ @@ -363,8 +374,6 @@ for key in self._mapping: yield key -KeysView.register(type({}.keys())) - class ItemsView(MappingView, Set): @@ -381,8 +390,6 @@ for key in self._mapping: yield (key, self._mapping[key]) -ItemsView.register(type({}.items())) - class ValuesView(MappingView): @@ -396,8 +403,6 @@ for key in self._mapping: yield self._mapping[key] -ValuesView.register(type({}.values())) - class MutableMapping(Mapping): From python-checkins at python.org Sat Jun 7 19:11:12 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 19:11:12 +0200 (CEST) Subject: [Python-checkins] r64019 - in python/trunk/Doc/library: abc.rst python.rst Message-ID: <20080607171112.7A7A41E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 19:11:00 2008 New Revision: 64019 Log: Backport docs for abc module to 2.6. Added: python/trunk/Doc/library/abc.rst Modified: python/trunk/Doc/library/python.rst Added: python/trunk/Doc/library/abc.rst ============================================================================== --- (empty file) +++ python/trunk/Doc/library/abc.rst Sat Jun 7 19:11:00 2008 @@ -0,0 +1,195 @@ +:mod:`abc` --- Abstract Base Classes +==================================== + +.. module:: abc + :synopsis: Abstract base classes according to PEP 3119. +.. moduleauthor:: Guido van Rossum +.. sectionauthor:: Georg Brandl +.. much of the content adapted from docstrings + +.. versionadded:: 2.6 + +This module provides the infrastructure for defining abstract base classes +(ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +was added to Python. (See also, :pep:`3141` regarding a type hierarchy +for numbers based on ABCs.) + +The :mod:`collections` module has some concrete classes that derive from +ABCs; these can, of course, be further derived. In addition the +:mod:`collections` module has some ABCs that can be used to test whether +a class or instance provides a particular interface, for example, is it +hashable or a mapping. + + +This module provides the following class: + +.. class:: ABCMeta + + Metaclass for defining Abstract Base Classes (ABCs). + + Use this metaclass to create an ABC. An ABC can be subclassed directly, and + then acts as a mix-in class. You can also register unrelated concrete + classes (even built-in classes) and unrelated ABCs as "virtual subclasses" -- + these and their descendants will be considered subclasses of the registering + ABC by the built-in :func:`issubclass` function, but the registering ABC + won't show up in their MRO (Method Resolution Order) nor will method + implementations defined by the registering ABC be callable (not even via + :func:`super`). [#]_ + + Classes created with a metaclass of :class:`ABCMeta` have the following method: + + .. method:: register(subclass) + + Register *subclass* as a "virtual subclass" of this ABC. For + example:: + + from abc import ABCMeta + + class MyABC: + __metaclass__ = ABCMeta + + MyABC.register(tuple) + + assert issubclass(tuple, MyABC) + assert isinstance((), MyABC) + + You can also override this method in an abstract base class: + + .. method:: __subclasshook__(subclass) + + (Must be defined as a class method.) + + Check whether *subclass* is considered a subclass of this ABC. This means + that you can customize the behavior of ``issubclass`` further without the + need to call :meth:`register` on every class you want to consider a + subclass of the ABC. (This class method is called from the + :meth:`__subclasscheck__` method of the ABC.) + + This method should return ``True``, ``False`` or ``NotImplemented``. If + it returns ``True``, the *subclass* is considered a subclass of this ABC. + If it returns ``False``, the *subclass* is not considered a subclass of + this ABC, even if it would normally be one. If it returns + ``NotImplemented``, the subclass check is continued with the usual + mechanism. + + .. XXX explain the "usual mechanism" + + + For a demonstration of these concepts, look at this example ABC definition:: + + class Foo(object): + def __getitem__(self, index): + ... + def __len__(self): + ... + def get_iterator(self): + return iter(self) + + class MyIterable: + __metaclass__ = ABCMeta + + @abstractmethod + def __iter__(self): + while False: + yield None + + def get_iterator(self): + return self.__iter__() + + @classmethod + def __subclasshook__(cls, C): + if cls is MyIterable: + if any("__iter__" in B.__dict__ for B in C.__mro__): + return True + return NotImplemented + + MyIterable.register(Foo) + + The ABC ``MyIterable`` defines the standard iterable method, + :meth:`__iter__`, as an abstract method. The implementation given here can + still be called from subclasses. The :meth:`get_iterator` method is also + part of the ``MyIterable`` abstract base class, but it does not have to be + overridden in non-abstract derived classes. + + The :meth:`__subclasshook__` class method defined here says that any class + that has an :meth:`__iter__` method in its :attr:`__dict__` (or in that of + one of its base classes, accessed via the :attr:`__mro__` list) is + considered a ``MyIterable`` too. + + Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, + even though it does not define an :meth:`__iter__` method (it uses the + old-style iterable protocol, defined in terms of :meth:`__len__` and + :meth:`__getitem__`). Note that this will not make ``get_iterator`` + available as a method of ``Foo``, so it is provided separately. + + +It also provides the following decorators: + +.. function:: abstractmethod(function) + + A decorator indicating abstract methods. + + Using this decorator requires that the class's metaclass is :class:`ABCMeta` or + is derived from it. + A class that has a metaclass derived from :class:`ABCMeta` + cannot be instantiated unless all of its abstract methods and + properties are overridden. + The abstract methods can be called using any of the the normal 'super' call + mechanisms. + + Dynamically adding abstract methods to a class, or attempting to modify the + abstraction status of a method or class once it is created, are not + supported. The :func:`abstractmethod` only affects subclasses derived using + regular inheritance; "virtual subclasses" registered with the ABC's + :meth:`register` method are not affected. + + Usage:: + + class C: + __metaclass__ = ABCMeta + @abstractmethod + def my_abstract_method(self, ...): + ... + + .. note:: + + Unlike C++'s pure virtual functions, or Java abstract methods, these abstract + methods may have an implementation. This implementation can be + called via the :func:`super` mechanism from the class that + overrides it. This could be useful as an end-point for a + super-call in a framework that uses cooperative + multiple-inheritance. + + +.. function:: abstractproperty(fget[, fset[, fdel[, doc]]]) + + A subclass of the built-in :func:`property`, indicating an abstract property. + + Using this function requires that the class's metaclass is :class:`ABCMeta` or + is derived from it. + A class that has a metaclass derived from :class:`ABCMeta` cannot be + instantiated unless all of its abstract methods and properties are overridden. + The abstract properties can be called using any of the normal + 'super' call mechanisms. + + Usage:: + + class C: + __metaclass__ = ABCMeta + @abstractproperty + def my_abstract_property(self): + ... + + This defines a read-only property; you can also define a read-write abstract + property using the 'long' form of property declaration:: + + class C: + __metaclass__ = ABCMeta + def getx(self): ... + def setx(self, value): ... + x = abstractproperty(getx, setx) + +.. rubric:: Footnotes + +.. [#] C++ programmers should note that Python's virtual base class + concept is not the same as C++'s. Modified: python/trunk/Doc/library/python.rst ============================================================================== --- python/trunk/Doc/library/python.rst (original) +++ python/trunk/Doc/library/python.rst Sat Jun 7 19:11:00 2008 @@ -18,6 +18,7 @@ __main__.rst warnings.rst contextlib.rst + abc.rst atexit.rst traceback.rst __future__.rst From buildbot at python.org Sat Jun 7 19:40:27 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 07 Jun 2008 17:40:27 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080607174028.0BD5D1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1448 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sat Jun 7 20:16:44 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 20:16:44 +0200 (CEST) Subject: [Python-checkins] r64021 - python/trunk/Doc/library/abc.rst Message-ID: <20080607181644.CA9A71E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 20:16:12 2008 New Revision: 64021 Log: X-ref to numbers module. Modified: python/trunk/Doc/library/abc.rst Modified: python/trunk/Doc/library/abc.rst ============================================================================== --- python/trunk/Doc/library/abc.rst (original) +++ python/trunk/Doc/library/abc.rst Sat Jun 7 20:16:12 2008 @@ -10,9 +10,9 @@ .. versionadded:: 2.6 This module provides the infrastructure for defining abstract base classes -(ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this -was added to Python. (See also, :pep:`3141` regarding a type hierarchy -for numbers based on ABCs.) +(ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added +to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type +hierarchy for numbers based on ABCs.) The :mod:`collections` module has some concrete classes that derive from ABCs; these can, of course, be further derived. In addition the From python-checkins at python.org Sat Jun 7 20:17:46 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 20:17:46 +0200 (CEST) Subject: [Python-checkins] r64022 - python/trunk/Doc/library/parser.rst Message-ID: <20080607181746.23D1D1E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 20:17:37 2008 New Revision: 64022 Log: Document the "st" API, to avoid confusion with the "new" AST. Add a note about using the new AST module. Modified: python/trunk/Doc/library/parser.rst Modified: python/trunk/Doc/library/parser.rst ============================================================================== --- python/trunk/Doc/library/parser.rst (original) +++ python/trunk/Doc/library/parser.rst Sat Jun 7 20:17:37 2008 @@ -24,6 +24,17 @@ code fragment as a string because parsing is performed in a manner identical to the code forming the application. It is also faster. +.. note:: + + From Python 2.5 onward, it's much more convenient to cut in at the Abstract + Syntax Tree (AST) generation and compilation stage, using the :mod:`ast` + module. + + The :mod:`parser` module exports the names documented here also with "st" + replaced by "ast"; this is a legacy from the time when there was no other + AST and has nothing to do with the AST found in Python 2.5. This is also the + reason for the functions' keyword arguments being called *ast*, not *st*. + There are a few things to note about this module which are important to making use of the data structures created. This is not a tutorial on editing the parse trees for Python code, but some examples of using the :mod:`parser` module are @@ -34,9 +45,9 @@ to :ref:`reference-index`. The parser itself is created from a grammar specification defined in the file :file:`Grammar/Grammar` in the standard Python distribution. The parse trees -stored in the AST objects created by this module are the actual output from the +stored in the ST objects created by this module are the actual output from the internal parser when created by the :func:`expr` or :func:`suite` functions, -described below. The AST objects created by :func:`sequence2ast` faithfully +described below. The ST objects created by :func:`sequence2st` faithfully simulate those structures. Be aware that the values of the sequences which are considered "correct" will vary from one version of Python to another as the formal grammar for the language is revised. However, transporting code from one @@ -46,7 +57,7 @@ language constructs. The parse trees are not typically compatible from one version to another, whereas source code has always been forward-compatible. -Each element of the sequences returned by :func:`ast2list` or :func:`ast2tuple` +Each element of the sequences returned by :func:`st2list` or :func:`st2tuple` has a simple form. Sequences representing non-terminal elements in the grammar always have a length greater than one. The first element is an integer which identifies a production in the grammar. These integers are given symbolic names @@ -69,19 +80,19 @@ terminal symbols are defined in the C header file :file:`Include/token.h` and the Python module :mod:`token`. -The AST objects are not required to support the functionality of this module, +The ST objects are not required to support the functionality of this module, but are provided for three purposes: to allow an application to amortize the cost of processing complex parse trees, to provide a parse tree representation which conserves memory space when compared to the Python list or tuple representation, and to ease the creation of additional modules in C which manipulate parse trees. A simple "wrapper" class may be created in Python to -hide the use of AST objects. +hide the use of ST objects. The :mod:`parser` module defines functions for a few distinct purposes. The -most important purposes are to create AST objects and to convert AST objects to +most important purposes are to create ST objects and to convert ST objects to other representations such as parse trees and compiled code objects, but there are also functions which serve to query the type of parse tree represented by an -AST object. +ST object. .. seealso:: @@ -94,20 +105,20 @@ testing node values. -.. _creating-asts: +.. _creating-sts: -Creating AST Objects --------------------- +Creating ST Objects +------------------- -AST objects may be created from source code or from a parse tree. When creating -an AST object from source, different functions are used to create the ``'eval'`` +ST objects may be created from source code or from a parse tree. When creating +an ST object from source, different functions are used to create the ``'eval'`` and ``'exec'`` forms. .. function:: expr(source) The :func:`expr` function parses the parameter *source* as if it were an input - to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an AST object + to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is thrown. @@ -115,22 +126,22 @@ .. function:: suite(source) The :func:`suite` function parses the parameter *source* as if it were an input - to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an AST object + to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is thrown. -.. function:: sequence2ast(sequence) +.. function:: sequence2st(sequence) This function accepts a parse tree represented as a sequence and builds an internal representation if possible. If it can validate that the tree conforms to the Python grammar and all nodes are valid node types in the host version of - Python, an AST object is created from the internal representation and returned + Python, an ST object is created from the internal representation and returned to the called. If there is a problem creating the internal representation, or if the tree cannot be validated, a :exc:`ParserError` exception is thrown. An - AST object created this way should not be assumed to compile correctly; normal - exceptions thrown by compilation may still be initiated when the AST object is - passed to :func:`compileast`. This may indicate problems not related to syntax + ST object created this way should not be assumed to compile correctly; normal + exceptions thrown by compilation may still be initiated when the ST object is + passed to :func:`compilest`. This may indicate problems not related to syntax (such as a :exc:`MemoryError` exception), but may also be due to constructs such as the result of parsing ``del f(0)``, which escapes the Python parser but is checked by the bytecode compiler. @@ -142,31 +153,31 @@ symbols in the input tree. -.. function:: tuple2ast(sequence) +.. function:: tuple2st(sequence) - This is the same function as :func:`sequence2ast`. This entry point is + This is the same function as :func:`sequence2st`. This entry point is maintained for backward compatibility. -.. _converting-asts: +.. _converting-sts: -Converting AST Objects ----------------------- +Converting ST Objects +--------------------- -AST objects, regardless of the input used to create them, may be converted to +ST objects, regardless of the input used to create them, may be converted to parse trees represented as list- or tuple- trees, or may be compiled into executable code objects. Parse trees may be extracted with or without line numbering information. -.. function:: ast2list(ast[, line_info]) +.. function:: st2list(ast[, line_info]) - This function accepts an AST object from the caller in *ast* and returns a + This function accepts an ST object from the caller in *ast* and returns a Python list representing the equivalent parse tree. The resulting list representation can be used for inspection or the creation of a new parse tree in list form. This function does not fail so long as memory is available to build the list representation. If the parse tree will only be used for inspection, - :func:`ast2tuple` should be used instead to reduce memory consumption and + :func:`st2tuple` should be used instead to reduce memory consumption and fragmentation. When the list representation is required, this function is significantly faster than retrieving a tuple representation and converting that to nested lists. @@ -177,29 +188,29 @@ This information is omitted if the flag is false or omitted. -.. function:: ast2tuple(ast[, line_info]) +.. function:: st2tuple(ast[, line_info]) - This function accepts an AST object from the caller in *ast* and returns a + This function accepts an ST object from the caller in *ast* and returns a Python tuple representing the equivalent parse tree. Other than returning a - tuple instead of a list, this function is identical to :func:`ast2list`. + tuple instead of a list, this function is identical to :func:`st2list`. If *line_info* is true, line number information will be included for all terminal tokens as a third element of the list representing the token. This information is omitted if the flag is false or omitted. -.. function:: compileast(ast[, filename='']) +.. function:: compilest(ast[, filename='']) .. index:: builtin: eval - The Python byte compiler can be invoked on an AST object to produce code objects + The Python byte compiler can be invoked on an ST object to produce code objects which can be used as part of an :keyword:`exec` statement or a call to the built-in :func:`eval` function. This function provides the interface to the compiler, passing the internal parse tree from *ast* to the parser, using the source file name specified by the *filename* parameter. The default value - supplied for *filename* indicates that the source was an AST object. + supplied for *filename* indicates that the source was an ST object. - Compiling an AST object may result in exceptions related to compilation; an + Compiling an ST object may result in exceptions related to compilation; an example would be a :exc:`SyntaxError` caused by the parse tree for ``del f(0)``: this statement is considered legal within the formal grammar for Python but is not a legal language construct. The :exc:`SyntaxError` raised for this @@ -209,15 +220,15 @@ tree. -.. _querying-asts: +.. _querying-sts: -Queries on AST Objects ----------------------- +Queries on ST Objects +--------------------- -Two functions are provided which allow an application to determine if an AST was +Two functions are provided which allow an application to determine if an ST was created as an expression or a suite. Neither of these functions can be used to -determine if an AST was created from source code via :func:`expr` or -:func:`suite` or from a parse tree via :func:`sequence2ast`. +determine if an ST was created from source code via :func:`expr` or +:func:`suite` or from a parse tree via :func:`sequence2st`. .. function:: isexpr(ast) @@ -227,19 +238,19 @@ When *ast* represents an ``'eval'`` form, this function returns true, otherwise it returns false. This is useful, since code objects normally cannot be queried for this information using existing built-in functions. Note that the code - objects created by :func:`compileast` cannot be queried like this either, and + objects created by :func:`compilest` cannot be queried like this either, and are identical to those created by the built-in :func:`compile` function. .. function:: issuite(ast) - This function mirrors :func:`isexpr` in that it reports whether an AST object + This function mirrors :func:`isexpr` in that it reports whether an ST object represents an ``'exec'`` form, commonly known as a "suite." It is not safe to assume that this function is equivalent to ``not isexpr(ast)``, as additional syntactic fragments may be supported in the future. -.. _ast-errors: +.. _st-errors: Exceptions and Error Handling ----------------------------- @@ -255,12 +266,12 @@ generally produced for validation failures rather than the built in :exc:`SyntaxError` thrown during normal parsing. The exception argument is either a string describing the reason of the failure or a tuple containing a - sequence causing the failure from a parse tree passed to :func:`sequence2ast` - and an explanatory string. Calls to :func:`sequence2ast` need to be able to + sequence causing the failure from a parse tree passed to :func:`sequence2st` + and an explanatory string. Calls to :func:`sequence2st` need to be able to handle either type of exception, while calls to other functions in the module will only need to be aware of the simple string values. -Note that the functions :func:`compileast`, :func:`expr`, and :func:`suite` may +Note that the functions :func:`compilest`, :func:`expr`, and :func:`suite` may throw exceptions which are normally thrown by the parsing and compilation process. These include the built in exceptions :exc:`MemoryError`, :exc:`OverflowError`, :exc:`SyntaxError`, and :exc:`SystemError`. In these @@ -268,49 +279,49 @@ Refer to the descriptions of each function for detailed information. -.. _ast-objects: +.. _st-objects: -AST Objects ------------ +ST Objects +---------- -Ordered and equality comparisons are supported between AST objects. Pickling of -AST objects (using the :mod:`pickle` module) is also supported. +Ordered and equality comparisons are supported between ST objects. Pickling of +ST objects (using the :mod:`pickle` module) is also supported. -.. data:: ASTType +.. data:: STType The type of the objects returned by :func:`expr`, :func:`suite` and - :func:`sequence2ast`. + :func:`sequence2st`. -AST objects have the following methods: +ST objects have the following methods: -.. method:: AST.compile([filename]) +.. method:: ST.compile([filename]) - Same as ``compileast(ast, filename)``. + Same as ``compilest(st, filename)``. -.. method:: AST.isexpr() +.. method:: ST.isexpr() - Same as ``isexpr(ast)``. + Same as ``isexpr(st)``. -.. method:: AST.issuite() +.. method:: ST.issuite() - Same as ``issuite(ast)``. + Same as ``issuite(st)``. -.. method:: AST.tolist([line_info]) +.. method:: ST.tolist([line_info]) - Same as ``ast2list(ast, line_info)``. + Same as ``st2list(st, line_info)``. -.. method:: AST.totuple([line_info]) +.. method:: ST.totuple([line_info]) - Same as ``ast2tuple(ast, line_info)``. + Same as ``st2tuple(st, line_info)``. -.. _ast-examples: +.. _st-examples: Examples -------- @@ -338,27 +349,27 @@ 10 The equivalent operation using the :mod:`parser` module is somewhat longer, and -allows the intermediate internal parse tree to be retained as an AST object:: +allows the intermediate internal parse tree to be retained as an ST object:: >>> import parser - >>> ast = parser.expr('a + 5') - >>> code = ast.compile('file.py') + >>> st = parser.expr('a + 5') + >>> code = st.compile('file.py') >>> a = 5 >>> eval(code) 10 -An application which needs both AST and code objects can package this code into +An application which needs both ST and code objects can package this code into readily available functions:: import parser def load_suite(source_string): - ast = parser.suite(source_string) - return ast, ast.compile() + st = parser.suite(source_string) + return st, st.compile() def load_expression(source_string): - ast = parser.expr(source_string) - return ast, ast.compile() + st = parser.expr(source_string) + return st, st.compile() Information Discovery @@ -412,8 +423,8 @@ >>> import parser >>> import pprint - >>> ast = parser.suite(open('docstring.py').read()) - >>> tup = ast.totuple() + >>> st = parser.suite(open('docstring.py').read()) + >>> tup = st.totuple() >>> pprint.pprint(tup) (257, (264, @@ -670,8 +681,8 @@ source = open(fileName).read() basename = os.path.basename(os.path.splitext(fileName)[0]) - ast = parser.suite(source) - return ModuleInfo(ast.totuple(), basename) + st = parser.suite(source) + return ModuleInfo(st.totuple(), basename) This provides an easy-to-use interface to the documentation of a module. If information is required which is not extracted by the code of this example, the From python-checkins at python.org Sat Jun 7 21:03:20 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 7 Jun 2008 21:03:20 +0200 (CEST) Subject: [Python-checkins] r64024 - peps/trunk/pep-3108.txt Message-ID: <20080607190320.DA55D1E4004@bag.python.org> Author: georg.brandl Date: Sat Jun 7 21:03:20 2008 New Revision: 64024 Log: CL usage is removed from aifc. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Sat Jun 7 21:03:20 2008 @@ -69,7 +69,7 @@ + Documented as deprecated since Python 2.4 without an explicit reason. -* cl [done: 3.0] (Need to update ``aifc`` to not use ``cl``) +* cl [done: 3.0] + Documented as obsolete since Python 2.0 or earlier. + Interface to SGI hardware. From python-checkins at python.org Sat Jun 7 21:27:29 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 21:27:29 +0200 (CEST) Subject: [Python-checkins] r64025 - in sandbox/trunk/ttk-gsoc: samples/ttkcalendar.py src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080607192729.C2FD81E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 21:27:29 2008 New Revision: 64025 Log: Empty values may be used at columns in ttk Treeview, now they are correctly accepted by by _format_optdict; Added a new sample, a calendar; Bumped to version 0.1.2 Added: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Added: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py ============================================================================== --- (empty file) +++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Sat Jun 7 21:27:29 2008 @@ -0,0 +1,111 @@ +"""Simple calendar using ttk Treeview together with calendar and datetime +classes. + +wrriten by Guilherme Polo, 2008. +""" +import calendar + +try: + import Tkinter + import tkFont +except ImportError: # py3k + import tkinter as Tkinter + import tkinter.font as tkFont + +import ttk + +class Calendar(ttk.Frame): + datetime = calendar.datetime.datetime + timedelta = calendar.datetime.timedelta + + def __init__(self, master=None, **kw): + """ + WIDGET-SPECIFIC OPTIONS + + locale, firstweekday, year, month + """ + # remove custom options from kw before initializating ttk.Frame + self._fwday = kw.pop('firstweekday', 0) + year = kw.pop('year', self.datetime.now().year) + month = kw.pop('month', self.datetime.now().month) + self._date = self.datetime(year, month, 1) + locale = kw.pop('locale', None) + + ttk.Frame.__init__(self, master, **kw) + + if locale is None: + self._cal = calendar.TextCalendar(self._fwday) + else: + self._cal = calendar.LocaleTextCalendar(self._fwday, locale) + + # custom ttk Buttons + style = ttk.Style(master) + style.layout('L.TButton', [('Button.leftarrow', None)]) + style.layout('R.TButton', [('Button.rightarrow', None)]) + + # header frame and its widgets + hframe = ttk.Frame(self) + lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month) + rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month) + self._header = ttk.Label(hframe, width=15, anchor='center') + + # the calendar + cols = self._cal.formatweekheader(3).split() + self._calendar = ttk.Treeview(show='', columns=cols, selectmode='none', + height=7) + self._calendar.tag_configure('header', background='grey90') + self._calendar.insert('', 'end', values=cols, tag='header') + # adjust columns width + font = tkFont.Font() + maxwidth = max(font.measure(col) for col in cols) + for col in cols: + self._calendar.column(col, width=maxwidth, anchor='e') + # store treeview's tags + self._items = [self._calendar.insert('', 'end', values='') + for _ in range(6)] + + # pack the widgets + hframe.pack(in_=self, side='top', pady=4, anchor='center') + lbtn.grid(in_=hframe) + self._header.grid(in_=hframe, column=1, row=0, padx=12) + rbtn.grid(in_=hframe, column=2, row=0) + self._calendar.pack(in_=self, expand=1, fill='both', side='bottom') + + # finally build the calendar display + self.__build_calendar() + + def __build_calendar(self): + year, month = self._date.year, self._date.month + + header = self._cal.formatmonthname(year, month, 0) + self._header['text'] = header.title() + #cal = self._cal.monthdatescalendar(year, month) + cal = self._cal.monthdayscalendar(year, month) + + for indx, item in enumerate(self._items): + week = cal[indx] if indx < len(cal) else [] + #y = ['%02d' % dtime.day for dtime in week] + y = [('%02d' % day) if day else '' for day in week] + self._calendar.item(self._items[indx], values=y) + + def _prev_month(self): + self._date = self._date - self.timedelta(days=1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self.__build_calendar() + + def _next_month(self): + year, month = self._date.year, self._date.month + self._date = self._date + self.timedelta( + days=calendar.monthrange(year, month)[1] + 1) + self._date = self.datetime(self._date.year, self._date.month, 1) + self.__build_calendar() + + +def test(): + root = Tkinter.Tk() + x = Calendar(firstweekday=6)#, locale=('pt_BR', 'UTF-8')) + x.pack(expand=1, fill='both') + root.mainloop() + +if __name__ == '__main__': + test() Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 21:27:29 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1.1" +__version__ = "0.1.2" __author__ = "Guilherme Polo " @@ -65,7 +65,8 @@ continue if isinstance(value, (list, tuple)): - value = format % ' '.join(map(unicode, value)) + value = (unicode(val) if val else '{}' for val in value) + value = format % ' '.join(value) if script and value == '': value = '{}' # empty string in Python is equivalent to {} in Tcl Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 21:27:29 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1.1" +__version__ = "0.1.2" __author__ = "Guilherme Polo " @@ -65,7 +65,8 @@ continue if isinstance(value, (list, tuple)): - value = format % ' '.join(map(str, value)) + value = (str(val) if val else '{}' for val in value) + value = format % ' '.join(value) if script and value == '': value = '{}' # empty string in Python is equivalent to {} in Tcl From python-checkins at python.org Sat Jun 7 22:18:55 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 22:18:55 +0200 (CEST) Subject: [Python-checkins] r64026 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080607201855.08D0C1E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 22:18:54 2008 New Revision: 64026 Log: Fixed order of precedence in the lookup method Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 22:18:54 2008 @@ -370,7 +370,7 @@ or more states. If the default argument is set, it is used as a fallback value in case no specification for option is found.""" state = ' '.join(state) if state else '' - option = '-' if not option.startswith('-') else '' + option + option = ('-' if not option.startswith('-') else '') + option return self.tk.call(self._name, "lookup", style, option, state, default) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 22:18:54 2008 @@ -370,7 +370,7 @@ or more states. If the default argument is set, it is used as a fallback value in case no specification for option is found.""" state = ' '.join(state) if state else '' - option = '-' if not option.startswith('-') else '' + option + option = ('-' if not option.startswith('-') else '') + option return self.tk.call(self._name, "lookup", style, option, state, default) From python-checkins at python.org Sat Jun 7 22:32:29 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 22:32:29 +0200 (CEST) Subject: [Python-checkins] r64027 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080607203229.60D641E4004@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 22:32:29 2008 New Revision: 64027 Log: Fixed order of precedence in the configure and map methods Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 22:32:29 2008 @@ -339,7 +339,7 @@ Each key in kw is an option and each value is either a string or a sequence identifying the value for that option.""" if query_opt: - query_opt = '' if query_opt.startswith('-') else '-' + query_opt + query_opt = ('' if query_opt.startswith('-') else '-') + query_opt return self.tk.call(self._name, "configure", style, query_opt) return _dict_from_tcltuple(self.tk.call(self._name, "configure", style, @@ -355,7 +355,7 @@ or something else of your preference. A statespec is compound of one or more states and then a value.""" if query_opt: - query_opt = '' if query_opt.startswith('-') else '-' + query_opt + query_opt = ('' if query_opt.startswith('-') else '-') + query_opt return _list_from_statespec(self.tk.call(self._name, "map", style, query_opt)) Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 22:32:29 2008 @@ -339,7 +339,7 @@ Each key in kw is an option and each value is either a string or a sequence identifying the value for that option.""" if query_opt: - query_opt = '' if query_opt.startswith('-') else '-' + query_opt + query_opt = ('' if query_opt.startswith('-') else '-') + query_opt return self.tk.call(self._name, "configure", style, query_opt) return _dict_from_tcltuple(self.tk.call(self._name, "configure", style, @@ -355,7 +355,7 @@ or something else of your preference. A statespec is compound of one or more states and then a value.""" if query_opt: - query_opt = '' if query_opt.startswith('-') else '-' + query_opt + query_opt = ('' if query_opt.startswith('-') else '-') + query_opt return _list_from_statespec(self.tk.call(self._name, "map", style, query_opt)) From python-checkins at python.org Sat Jun 7 22:44:48 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 7 Jun 2008 22:44:48 +0200 (CEST) Subject: [Python-checkins] r64028 - python/trunk/Doc/library/_ast.rst Message-ID: <20080607204448.4A0C71E4005@bag.python.org> Author: benjamin.peterson Date: Sat Jun 7 22:44:48 2008 New Revision: 64028 Log: capitalization nit Modified: python/trunk/Doc/library/_ast.rst Modified: python/trunk/Doc/library/_ast.rst ============================================================================== --- python/trunk/Doc/library/_ast.rst (original) +++ python/trunk/Doc/library/_ast.rst Sat Jun 7 22:44:48 2008 @@ -78,7 +78,7 @@ ---------------- The module defines a string constant ``__version__`` which is the decimal -subversion revision number of the file shown below. +Subversion revision number of the file shown below. The abstract grammar is currently defined as follows: From python-checkins at python.org Sat Jun 7 22:49:42 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 7 Jun 2008 22:49:42 +0200 (CEST) Subject: [Python-checkins] r64029 - in sandbox/trunk/ttk-gsoc: samples/treeview_multicolumn.py samples/ttkcalendar.py src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080607204942.E22D41E400B@bag.python.org> Author: guilherme.polo Date: Sat Jun 7 22:49:42 2008 New Revision: 64029 Log: Only strings inside tuples/lists should have special formatting, fixed at _format_optdict. Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py (original) +++ sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py Sat Jun 7 22:49:42 2008 @@ -97,6 +97,10 @@ root = Tkinter.Tk() root.wm_title("Multi-Column List") root.wm_iconname("mclist") + + import plastik_theme + plastik_theme.install('~/tile-themes/plastik/plastik') + app = App() root.mainloop() Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py (original) +++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Sat Jun 7 22:49:42 2008 @@ -103,8 +103,11 @@ def test(): root = Tkinter.Tk() + root.title('Ttk Calendar') x = Calendar(firstweekday=6)#, locale=('pt_BR', 'UTF-8')) x.pack(expand=1, fill='both') + s = ttk.Style() + s.theme_use('clam') root.mainloop() if __name__ == '__main__': Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sat Jun 7 22:49:42 2008 @@ -65,8 +65,13 @@ continue if isinstance(value, (list, tuple)): - value = (unicode(val) if val else '{}' for val in value) - value = format % ' '.join(value) + v = [] + for val in value: + if isinstance(val, basestring): + v.append(unicode(val) if val else '{}') + else: + v.append(str(val)) + value = format % ' '.join(v) if script and value == '': value = '{}' # empty string in Python is equivalent to {} in Tcl Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sat Jun 7 22:49:42 2008 @@ -65,8 +65,13 @@ continue if isinstance(value, (list, tuple)): - value = (str(val) if val else '{}' for val in value) - value = format % ' '.join(value) + v = [] + for val in value: + if isinstance(val, str): + v.append(str(val) if val else '{}') + else: + v.append(str(val)) + value = format % ' '.join(v) if script and value == '': value = '{}' # empty string in Python is equivalent to {} in Tcl From python-checkins at python.org Sun Jun 8 02:24:22 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 8 Jun 2008 02:24:22 +0200 (CEST) Subject: [Python-checkins] r64030 - peps/trunk/pep-0339.txt Message-ID: <20080608002422.17A1B1E4005@bag.python.org> Author: benjamin.peterson Date: Sun Jun 8 02:24:21 2008 New Revision: 64030 Log: update for new docs Modified: peps/trunk/pep-0339.txt Modified: peps/trunk/pep-0339.txt ============================================================================== --- peps/trunk/pep-0339.txt (original) +++ peps/trunk/pep-0339.txt Sun Jun 8 02:24:21 2008 @@ -383,7 +383,7 @@ Once the name/number pair has been chosen and entered in Include/opcode.h, you must also enter it into -Lib/opcode.py and Doc/lib/libdis.tex . +Lib/opcode.py and Doc/library/dis.rst . With a new bytecode you must also change what is called the magic number for .pyc files. The variable ``MAGIC`` in Python/import.c contains the number. From python-checkins at python.org Sun Jun 8 04:05:34 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 8 Jun 2008 04:05:34 +0200 (CEST) Subject: [Python-checkins] r64031 - in python/trunk: Lib/test/test_py3kwarn.py Python/ast.c Message-ID: <20080608020534.366AF1E4004@bag.python.org> Author: benjamin.peterson Date: Sun Jun 8 04:05:33 2008 New Revision: 64031 Log: change Py3k backquote warning to a SyntaxWarning and add a test Modified: python/trunk/Lib/test/test_py3kwarn.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Sun Jun 8 04:05:33 2008 @@ -10,6 +10,12 @@ class TestPy3KWarnings(unittest.TestCase): + def test_backquote(self): + expected = 'backquote not supported in 3.x; use repr()' + with catch_warning() as w: + exec "`2`" in {} + self.assertWarning(None, w, expected) + def test_type_inequality_comparisons(self): expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sun Jun 8 04:05:33 2008 @@ -1364,7 +1364,7 @@ case BACKQUOTE: { /* repr */ expr_ty expression; if (Py_Py3kWarningFlag) { - if (PyErr_WarnExplicit(PyExc_DeprecationWarning, + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, "backquote not supported in 3.x; use repr()", c->c_filename, LINENO(n), NULL, NULL)) { From buildbot at python.org Sun Jun 8 05:05:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Jun 2008 03:05:12 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080608030512.659431E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3506 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pty make: *** [buildbottest] Error 1 sincerely, -The Buildbot From gki at pldtdsl.net Sun Jun 8 01:10:31 2008 From: gki at pldtdsl.net (Global Knowledge PH) Date: Sat, 7 Jun 2008 16:10:31 -0700 Subject: [Python-checkins] ECSA/LPT Bootcamp Training on June 23-27 2008 Message-ID: <65a1801c8c8f3$ae9a8730$2b01a8c0@gk8bc2ac533c9a> E|CSA EC-Council Certified Security Analyst EC-COUNCIL ECSA / LPT Certification Bootcamp Schedule / Duration June 23-27, 2008 (M-F) / 5 days (9am - 5pm) Course fee Php65,000.00+VAT/person inclusive of ECSA Exam, Kit and food. Discount: Please call 683-0969 / 637-3657 / 0920-709-8298 and look for Sandra. Exam The ECSA certification exam will be conducted on the last day of training. Students need to pass the online Prometric exam 412-79 to receive the ECSA certification. The Student also will be prepared for the LPT certification. Course Description ECSA/LPT is a security class like no other! Providing real world hands on experience, it is the only in-depth Advanced Hacking and Penetration Testing class available that covers testing in all modern infrastructures, operating systems and application environments. EC-Council's Certified Security Analyst/LPT program is a highly interactive 5-day security class designed to teach Security Professionals the advanced uses of the LPT methodologies, tools and techniques required to perform comprehensive information security tests. Students will learn how to design, secure and test networks to protect your organization from the threats hackers and crackers pose. By teaching the tools and ground breaking techniques for security and penetration testing, this class will help you perform the intensive assessments required to effectively identify and mitigate risks to the security of your infrastructure. As students learn to identify security problems, they also learn how to avoid and eliminate them, with the class providing complete coverage of analysis and network security-testing topics. Who Should Attend Network server administrators, Firewall Administrators, Security Testers, System Administrators and Risk Assessment professionals. Course Outline v3 Module 1: The Need for Security Analysis Module 2: Advanced Googling Module 3: TCP/IP Packet Analysis Module 4: Advanced Sniffing Techniques Module 5: Vulnerability Analysis with Nessus Module 6: Advanced Wireless Testing Module 7: Designing a DMZ Module 8: Snort Analysis Module 9: Log Analysis Module 10: Advanced Exploits and Tools Module 11: Penetration Testing Methodologies Module 12: Customers and Legal Agreements Module 13: Penetration Testing Planning and Scheduling Module 14: Pre Penetration Testing Checklist Module 15: Information Gathering Module 16: Vulnerability Analysis Module 17: External Penetration Testing Module 18: Internal Network Penetration Testing Module 19: Router Penetration Testing Module 20: Firewall Penetration Testing Module 21: IDS Penetration Testing Module 22: Wireless Network Penetration Testing Module 23: Denial of Service Penetration Testing Module 24: Password Cracking Penetration Testing Module 25: Social Engineering Penetration Testing Module 26: Stolen Laptop Penetration Testing Module 27: Application Penetration Testing Module 28: Physical Security Penetration Testing Module 29: Database Penetration testing Module 30: VoIP Penetration Testing Module 31: VPN Penetration Testing Module 32: Penetration Testing Report Analysis Module 33: Penetration Testing Report and Documentation Writing Module 34: Penetration Testing Deliverables and Conclusion Module 35: Ethics of a Licensed Penetration Tester To Register Please call 683-0969 / 637-3657 and look for Sandra. GLOBAL KNOWLEDGE ASSOCIATES INC Venue: 25th flr. Unit no. 2502b West Tower Philippine Stock Exchange, Ortigas Center Pasig City, 1605 Philippines Tel. No. (632) 683-0969 / 637-3657 Mobile No.: (+63) 920-709-8298 Email: sandra at globalknowledgeph.com YM: sandra_medalla at yahoo.com URL: www.gkphilippines.com _____ If you want to unsubscribe from this mailing list. Please Click it -------------- next part -------------- An HTML attachment was scrubbed... URL: From buildbot at python.org Sun Jun 8 06:14:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Jun 2008 04:14:22 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080608041422.CFA0E1E4004@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/388 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed configure sincerely, -The Buildbot From buildbot at python.org Sun Jun 8 07:09:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Jun 2008 05:09:02 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080608050903.2011D1E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1541 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 25 tests failed: test_array test_bufio test_cookielib test_deque test_file test_filecmp test_fileinput test_gzip test_hotshot test_io test_iter test_mailbox test_marshal test_mmap test_multibytecodec test_netrc test_pep277 test_pydoc test_set test_site test_univnewlines test_urllib test_urllib2 test_urllib2net test_zipfile ====================================================================== ERROR: test_nullpat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 59, in test_nullpat self.drive_one("\0" * 1000) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 51, in drive_one self.try_one(teststring[:-1]) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_primepat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 56, in test_primepat self.drive_one("1234567890\00\01\02\03\04\05\06") File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 49, in drive_one self.try_one(teststring) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_maxlen (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 79, in test_maxlen fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 286, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testUnicodeOpen (test.test_file.OtherFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 149, in testUnicodeOpen f = open(unicode(TESTFN), "w") IOError: [Errno 13] Permission denied: u'@test' ====================================================================== ERROR: testExit (test.test_file.FileSubclassTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 341, in testExit with C(TESTFN, 'w') as f: File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 336, in __init__ file.__init__(self, *args) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_flush (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_isatty (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_iter (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_print (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_read (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_readinto (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_readline (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_readlines (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_seek (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_tell (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_truncate (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_write (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_open_writelines (test.test_file.FileThreadingTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_file.py", line 354, in setUp with open(self.filename, "w") as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_different (test.test_filecmp.FileCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_filecmp.py", line 13, in setUp output = open(name, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_matching (test.test_filecmp.FileCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_filecmp.py", line 13, in setUp output = open(name, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 48, in test_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 85, in test_readline self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 98, in test_readlines self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 112, in test_seek_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_whence (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 132, in test_seek_whence self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 144, in test_seek_write f = gzip.GzipFile(self.filename, 'w') File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_addinfo (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 74, in test_addinfo profiler = self.new_profiler() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_sys_path (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 118, in test_bad_sys_path self.assertRaises(RuntimeError, coverage, test_support.TESTFN) File "C:\buildbot\work\trunk.heller-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_line_numbers (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 98, in test_line_numbers self.run_test(g, events, self.new_profiler(lineevents=1)) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_start_stop (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 104, in test_start_stop profiler = self.new_profiler() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_buffered_file_io (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 165, in test_buffered_file_io f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_close_flushes (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 251, in test_close_flushes f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_destructor (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 245, in test_destructor f = MyFileIO(test_support.TESTFN, "w") IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_large_file_ops (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 211, in test_large_file_ops f = io.open(test_support.TESTFN, "w+b", 0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_raw_file_io (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 151, in test_raw_file_io f = io.open(test_support.TESTFN, "wb", buffering=0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_readline (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 179, in test_readline f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_with_open (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 221, in test_with_open with open(test_support.TESTFN, "wb", bufsize) as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testBasicIO (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 820, in testBasicIO f = io.open(test_support.TESTFN, "w+", encoding=enc) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: Test seek/tell using the StatefulIncrementalDecoder. ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 946, in testSeekAndTell testSeekAndTellWithData(input) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 926, in testSeekAndTellWithData decoded = f.read() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1668, in read decoder = self._decoder or self._get_decoder() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1457, in _get_decoder decoder = make_decoder(self._errors) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 523, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_add (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 62, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 45, in _delete_recursively os.rmdir(target) WindowsError: [Error 145] The directory is not empty: '@test' ====================================================================== ERROR: test_add_and_remove_folders (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_close (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_folder (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_items (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_len (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_list_folders (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_pack (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_sequences (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_update (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_values (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_add (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_clear (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_close (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_contains (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_discard (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_flush (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_items (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iter (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_keys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_labels (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_len (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_pop (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_remove (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_update (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_values (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_become_message (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\4' ====================================================================== ERROR: test_explain_to (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_initialize_incorrectly (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_initialize_with_eMM (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_initialize_with_file (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 992, in test_initialize_with_file f = open(self._path, 'w+') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_initialize_with_file (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_initialize_with_nothing (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_initialize_with_string (test.test_mailbox.TestMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_become_message (test.test_mailbox.TestMaildirMessage) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 975, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\5' ====================================================================== ERROR: test_floats (test.test_marshal.FloatTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 70, in test_floats marshal.dump(f, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_buffer (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 135, in test_buffer marshal.dump(b, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_string (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 124, in test_string marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_unicode (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 113, in test_unicode marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_dict (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 164, in test_dict marshal.dump(self.d, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_list (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 173, in test_list marshal.dump(lst, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_sets (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 194, in test_sets marshal.dump(t, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_tuple (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 182, in test_tuple marshal.dump(t, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bug1728403 (test.test_multibytecodec.Test_StreamReader) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_multibytecodec.py", line 148, in test_bug1728403 os.unlink(TESTFN) WindowsError: [Error 5] Access is denied: '@test' ====================================================================== ERROR: test_case_1 (test.test_netrc.NetrcTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_netrc.py", line 28, in setUp fp = open(temp_filename, mode) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_directory (test.test_pep277.UnicodeFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pep277.py", line 39, in setUp f = open(name, 'w') IOError: [Errno 13] Permission denied: '@test\\abc' ====================================================================== ERROR: test_failures (test.test_pep277.UnicodeFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pep277.py", line 39, in setUp f = open(name, 'w') IOError: [Errno 13] Permission denied: '@test\\abc' ====================================================================== ERROR: test_listdir (test.test_pep277.UnicodeFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pep277.py", line 39, in setUp f = open(name, 'w') IOError: [Errno 13] Permission denied: '@test\\abc' ====================================================================== ERROR: test_open (test.test_pep277.UnicodeFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pep277.py", line 39, in setUp f = open(name, 'w') IOError: [Errno 13] Permission denied: '@test\\abc' ====================================================================== ERROR: test_rename (test.test_pep277.UnicodeFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pep277.py", line 39, in setUp f = open(name, 'w') IOError: [Errno 13] Permission denied: '@test\\abc' ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pydoc.py", line 220, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== FAIL: test_text_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_pydoc.py", line 228, in test_text_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== ERROR: test_cyclical_print (test.test_set.TestSetSubclass) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_set.py", line 286, in test_cyclical_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_urllib2.py", line 614, in test_file f = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadStored (test.test_zipfile.UniversalNewlineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 933, in setUp open(self.arcfiles[s], "wb").write(self.arcdata[s]) IOError: [Errno 13] Permission denied: '@test-0' ====================================================================== ERROR: testReadlineDeflated (test.test_zipfile.UniversalNewlineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 933, in setUp open(self.arcfiles[s], "wb").write(self.arcdata[s]) IOError: [Errno 13] Permission denied: '@test-0' ====================================================================== ERROR: testReadlineStored (test.test_zipfile.UniversalNewlineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 933, in setUp open(self.arcfiles[s], "wb").write(self.arcdata[s]) IOError: [Errno 13] Permission denied: '@test-0' ====================================================================== ERROR: testReadlinesDeflated (test.test_zipfile.UniversalNewlineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 933, in setUp open(self.arcfiles[s], "wb").write(self.arcdata[s]) IOError: [Errno 13] Permission denied: '@test-0' ====================================================================== ERROR: testReadlinesStored (test.test_zipfile.UniversalNewlineTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 933, in setUp open(self.arcfiles[s], "wb").write(self.arcdata[s]) IOError: [Errno 13] Permission denied: '@test-0' sincerely, -The Buildbot From buildbot at python.org Sun Jun 8 08:20:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Jun 2008 06:20:53 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080608062053.56A1E1E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/979 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jun 8 10:46:48 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 8 Jun 2008 10:46:48 +0200 (CEST) Subject: [Python-checkins] r64034 - in python/branches/tlee-ast-optimize: Lib/test/test_optimizer.py Python/optimize.c Python/peephole.c Message-ID: <20080608084648.E84151E4004@bag.python.org> Author: thomas.lee Date: Sun Jun 8 10:46:48 2008 New Revision: 64034 Log: Finalize symtable-generation-before-compile. STEs are now available to the AST optimizer. Added an optimization for lists used as constants in for loops in the AST optimizer. Removed the corresponding code from the peepholer. Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py python/branches/tlee-ast-optimize/Python/optimize.c python/branches/tlee-ast-optimize/Python/peephole.c Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py Sun Jun 8 10:46:48 2008 @@ -194,6 +194,17 @@ self.assertEqual(_ast.Return, ast.body[0].body[0].__class__) self.assertEqual(None, ast.body[0].body[0].value) + def test_generators_work_even_if_yields_are_optimized_away(self): + code = """ +def mygen(): + return + yield 5 +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Return, ast.body[0].body[0].__class__) + self.assertEqual(_ast.Pass, ast.body[0].body[1].__class__) + def test_tuple_of_constants(self): tests = [ (1, 2, 3), @@ -211,6 +222,15 @@ self.assertEqual(tuple, ast.body[0].value.value.__class__) self.assertEqual(obj, ast.body[0].value.value) + def test_folding_of_constant_list_in_for_loop(self): + code = """ +for i in [1, 2, 3]: + print i +""" + ast = self.compileast(code) + self.assertEqual(_ast.Const, ast.body[0].iter.__class__) + self.assertEqual((1, 2, 3), ast.body[0].iter.value) + def test_named_constants(self): tests = [None, True, False] Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 8 10:46:48 2008 @@ -2,16 +2,24 @@ #include "Python-ast.h" #include "pyarena.h" #include "pyerrors.h" +#include "symtable.h" #include "node.h" #include "ast.h" -static int optimize_expr(expr_ty* expr_ptr, PyArena* arena); -static int optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena); -static int optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena); -static int optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena); -static int optimize_keyword(keyword_ty* kwd_ptr, PyArena* arena); -static int optimize_arguments(arguments_ty* args_ptr, PyArena* arena); -static int optimize_slice(slice_ty* slice_ptr, PyArena* arena); +static int optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_comprehension(comprehension_ty* comp_ptr, + PySTEntryObject* ste, PyArena* arena); +static int optimize_excepthandler(excepthandler_ty* exc_ptr, + PySTEntryObject* ste, PyArena* arena); +static int optimize_keyword(keyword_ty* kwd_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, + PyArena* arena); +static int optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, + PyArena* arena); /** * Determine the constant value of a given expression. It's assumed that @@ -133,12 +141,12 @@ * Optimize a sequence of expressions. */ static int -optimize_expr_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_expr_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } @@ -199,13 +207,13 @@ * Optimize a sequence of statements. */ static int -optimize_stmt_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { stmt_ty stmt = asdl_seq_GET(seq, n); - if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; if (stmt->kind == If_kind) { @@ -243,57 +251,59 @@ } static int -optimize_comprehension_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_comprehension_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, + PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { comprehension_ty* comp; comp = (comprehension_ty*)&asdl_seq_GET(seq, n); - if (!optimize_comprehension(comp, arena)) + if (!optimize_comprehension(comp, ste, arena)) return 0; } return 1; } static int -optimize_excepthandler_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_excepthandler_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, + PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { excepthandler_ty* excepthandler; excepthandler = (excepthandler_ty*)&asdl_seq_GET(seq, n); - if (!optimize_excepthandler(excepthandler, arena)) + if (!optimize_excepthandler(excepthandler, ste, arena)) return 0; } return 1; } static int -optimize_keyword_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_keyword_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } static int -optimize_slice_seq(asdl_seq** seq_ptr, PyArena* arena) +optimize_slice_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), arena)) + if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), ste, arena)) return 0; return 1; } static int -optimize_mod(mod_ty* mod_ptr, PyArena* arena) +optimize_mod(mod_ty* mod_ptr, PySTEntryObject* ste, PyArena* arena) { asdl_seq** body; mod_ty mod = *mod_ptr; @@ -316,7 +326,7 @@ } case Expression_kind: { - return optimize_expr(&mod->v.Expression.body, arena); + return optimize_expr(&mod->v.Expression.body, ste, arena); } default: PyErr_Format(PyExc_ValueError, "unknown mod_ty kind: %d", @@ -324,28 +334,28 @@ return 0; }; - return optimize_stmt_seq(body, arena); + return optimize_stmt_seq(body, ste, arena); } static int -optimize_bool_op(expr_ty* expr_ptr, PyArena* arena) +optimize_bool_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.BoolOp.values, arena)) + if (!optimize_expr_seq(&expr->v.BoolOp.values, ste, arena)) return 0; return 1; } static int -optimize_bin_op(expr_ty* expr_ptr, PyArena* arena) +optimize_bin_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { PyObject* left; PyObject* right; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.BinOp.left, arena)) + if (!optimize_expr(&expr->v.BinOp.left, ste, arena)) return 0; - if (!optimize_expr(&expr->v.BinOp.right, arena)) + if (!optimize_expr(&expr->v.BinOp.right, ste, arena)) return 0; /* @@ -472,11 +482,11 @@ } static int -optimize_unary_op(expr_ty* expr_ptr, PyArena* arena) +optimize_unary_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { PyObject* operand; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.UnaryOp.operand, arena)) + if (!optimize_expr(&expr->v.UnaryOp.operand, ste, arena)) return 0; operand = _expr_constant_value(expr->v.UnaryOp.operand); if (operand != NULL) { @@ -537,76 +547,83 @@ } static int -optimize_lambda(expr_ty* expr_ptr, PyArena* arena) +optimize_lambda(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Lambda.body, arena)) + if (!optimize_expr(&expr->v.Lambda.body, ste, arena)) return 0; return 1; } -static int optimize_if_exp(expr_ty* expr_ptr, PyArena* arena) { +static int +optimize_if_exp(expr_ty* expr_ptr, PySTEntryObject* ste, + PyArena* arena) +{ expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.IfExp.test, arena)) + if (!optimize_expr(&expr->v.IfExp.test, ste, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.body, arena)) + if (!optimize_expr(&expr->v.IfExp.body, ste, arena)) return 0; - if (!optimize_expr(&expr->v.IfExp.orelse, arena)) + if (!optimize_expr(&expr->v.IfExp.orelse, ste, arena)) return 0; return 1; } -static int optimize_dict(expr_ty* expr_ptr, PyArena* arena) { +static int +optimize_dict(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +{ expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Dict.keys, arena)) + if (!optimize_expr_seq(&expr->v.Dict.keys, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Dict.values, arena)) + if (!optimize_expr_seq(&expr->v.Dict.values, ste, arena)) return 0; return 1; } static int -optimize_comprehension(comprehension_ty* comp_ptr, PyArena* arena) +optimize_comprehension(comprehension_ty* comp_ptr, PySTEntryObject* ste, + PyArena* arena) { comprehension_ty comp = *comp_ptr; - if (!optimize_expr(&comp->target, arena)) + if (!optimize_expr(&comp->target, ste, arena)) return 0; - if (!optimize_expr(&comp->iter, arena)) + if (!optimize_expr(&comp->iter, ste, arena)) return 0; - if (!optimize_expr_seq(&comp->ifs, arena)) + if (!optimize_expr_seq(&comp->ifs, ste, arena)) return 0; return 1; } static int -optimize_list_comp(expr_ty* expr_ptr, PyArena* arena) +optimize_list_comp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.ListComp.elt, arena)) + if (!optimize_expr(&expr->v.ListComp.elt, ste, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.ListComp.generators, arena)) + if (!optimize_comprehension_seq(&expr->v.ListComp.generators, ste, arena)) return 0; return 1; } static int -optimize_generator_exp(expr_ty* expr_ptr, PyArena* arena) +optimize_generator_exp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.GeneratorExp.elt, arena)) + if (!optimize_expr(&expr->v.GeneratorExp.elt, ste, arena)) return 0; - if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, arena)) + if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, ste, + arena)) return 0; return 1; } static int -optimize_yield(expr_ty* expr_ptr, PyArena* arena) +optimize_yield(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; if (expr->v.Yield.value != NULL) { expr_ty value; - if (!optimize_expr(&expr->v.Yield.value, arena)) + if (!optimize_expr(&expr->v.Yield.value, ste, arena)) return 0; value = expr->v.Yield.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -616,100 +633,101 @@ } static int -optimize_compare(expr_ty* expr_ptr, PyArena* arena) +optimize_compare(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Compare.left, arena)) + if (!optimize_expr(&expr->v.Compare.left, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Compare.comparators, arena)) + if (!optimize_expr_seq(&expr->v.Compare.comparators, ste, arena)) return 0; return 1; } static int -optimize_keyword(keyword_ty* keyword_ptr, PyArena* arena) +optimize_keyword(keyword_ty* keyword_ptr, PySTEntryObject* ste, PyArena* arena) { keyword_ty keyword = *keyword_ptr; - if (!optimize_expr(&keyword->value, arena)) + if (!optimize_expr(&keyword->value, ste, arena)) return 0; return 1; } static int -optimize_arguments(arguments_ty* args_ptr, PyArena* arena) +optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, + PyArena* arena) { arguments_ty args = *args_ptr; - if (!optimize_expr_seq(&args->args, arena)) + if (!optimize_expr_seq(&args->args, ste, arena)) return 0; - if (!optimize_expr_seq(&args->defaults, arena)) + if (!optimize_expr_seq(&args->defaults, ste, arena)) return 0; return 1; } static int -optimize_call(expr_ty* expr_ptr, PyArena* arena) +optimize_call(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Call.func, arena)) + if (!optimize_expr(&expr->v.Call.func, ste, arena)) return 0; - if (!optimize_expr_seq(&expr->v.Call.args, arena)) + if (!optimize_expr_seq(&expr->v.Call.args, ste, arena)) return 0; - if (!optimize_keyword_seq(&expr->v.Call.keywords, arena)) + if (!optimize_keyword_seq(&expr->v.Call.keywords, ste, arena)) return 0; if (expr->v.Call.starargs != NULL) - if (!optimize_expr(&expr->v.Call.starargs, arena)) + if (!optimize_expr(&expr->v.Call.starargs, ste, arena)) return 0; if (expr->v.Call.kwargs != NULL) - if (!optimize_expr(&expr->v.Call.kwargs, arena)) + if (!optimize_expr(&expr->v.Call.kwargs, ste, arena)) return 0; return 1; } static int -optimize_repr(expr_ty* expr_ptr, PyArena* arena) +optimize_repr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Repr.value, arena)) + if (!optimize_expr(&expr->v.Repr.value, ste, arena)) return 0; return 1; } static int -optimize_attribute(expr_ty* expr_ptr, PyArena* arena) +optimize_attribute(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Attribute.value, arena)) + if (!optimize_expr(&expr->v.Attribute.value, ste, arena)) return 0; return 1; } static int -optimize_slice(slice_ty* slice_ptr, PyArena* arena) +optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, PyArena* arena) { slice_ty slice = *slice_ptr; switch (slice->kind) { case Slice_kind: { if (slice->v.Slice.lower != NULL) - if (!optimize_expr(&slice->v.Slice.lower, arena)) + if (!optimize_expr(&slice->v.Slice.lower, ste, arena)) return 0; if (slice->v.Slice.upper != NULL) - if (!optimize_expr(&slice->v.Slice.upper, arena)) + if (!optimize_expr(&slice->v.Slice.upper, ste, arena)) return 0; if (slice->v.Slice.step != NULL) - if (!optimize_expr(&slice->v.Slice.step, arena)) + if (!optimize_expr(&slice->v.Slice.step, ste, arena)) return 0; break; } case ExtSlice_kind: { - if (!optimize_slice_seq(&slice->v.ExtSlice.dims, arena)) + if (!optimize_slice_seq(&slice->v.ExtSlice.dims, ste, arena)) return 0; break; } case Index_kind: { - if (!optimize_expr(&slice->v.Index.value, arena)) + if (!optimize_expr(&slice->v.Index.value, ste, arena)) return 0; break; } @@ -726,21 +744,21 @@ } static int -optimize_subscript(expr_ty* expr_ptr, PyArena* arena) +optimize_subscript(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Subscript.value, arena)) + if (!optimize_expr(&expr->v.Subscript.value, ste, arena)) return 0; - if (!optimize_slice(&expr->v.Subscript.slice, arena)) + if (!optimize_slice(&expr->v.Subscript.slice, ste, arena)) return 0; return 1; } static int -optimize_tuple(expr_ty* expr_ptr, PyArena* arena) +optimize_tuple(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Tuple.elts, arena)) + if (!optimize_expr_seq(&expr->v.Tuple.elts, ste, arena)) return 0; if (_is_sequence_of_constants(expr->v.Tuple.elts)) { @@ -756,7 +774,7 @@ } static int -optimize_name(expr_ty* expr_ptr, PyArena* arena) +optimize_name(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; const char* id = PyString_AS_STRING(expr->v.Name.id); @@ -783,77 +801,77 @@ } static int -optimize_expr(expr_ty* expr_ptr, PyArena* arena) +optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) { expr_ty expr = *expr_ptr; switch (expr->kind) { case BoolOp_kind: { - return optimize_bool_op(expr_ptr, arena); + return optimize_bool_op(expr_ptr, ste, arena); } case BinOp_kind: { - return optimize_bin_op(expr_ptr, arena); + return optimize_bin_op(expr_ptr, ste, arena); } case UnaryOp_kind: { - return optimize_unary_op(expr_ptr, arena); + return optimize_unary_op(expr_ptr, ste, arena); } case Lambda_kind: { - return optimize_lambda(expr_ptr, arena); + return optimize_lambda(expr_ptr, ste, arena); } case IfExp_kind: { - return optimize_if_exp(expr_ptr, arena); + return optimize_if_exp(expr_ptr, ste, arena); } case Dict_kind: { - return optimize_dict(expr_ptr, arena); + return optimize_dict(expr_ptr, ste, arena); } case ListComp_kind: { - return optimize_list_comp(expr_ptr, arena); + return optimize_list_comp(expr_ptr, ste, arena); } case GeneratorExp_kind: { - return optimize_generator_exp(expr_ptr, arena); + return optimize_generator_exp(expr_ptr, ste, arena); } case Yield_kind: { - return optimize_yield(expr_ptr, arena); + return optimize_yield(expr_ptr, ste, arena); } case Compare_kind: { - return optimize_compare(expr_ptr, arena); + return optimize_compare(expr_ptr, ste, arena); } case Call_kind: { - return optimize_call(expr_ptr, arena); + return optimize_call(expr_ptr, ste, arena); } case Repr_kind: { - return optimize_repr(expr_ptr, arena); + return optimize_repr(expr_ptr, ste, arena); } case Attribute_kind: { - return optimize_attribute(expr_ptr, arena); + return optimize_attribute(expr_ptr, ste, arena); } case Subscript_kind: { - return optimize_subscript(expr_ptr, arena); + return optimize_subscript(expr_ptr, ste, arena); } case List_kind: { - return optimize_expr_seq(&expr->v.List.elts, arena); + return optimize_expr_seq(&expr->v.List.elts, ste, arena); } case Tuple_kind: { - return optimize_tuple(expr_ptr, arena); + return optimize_tuple(expr_ptr, ste, arena); } case Name_kind: { - return optimize_name(expr_ptr, arena); + return optimize_name(expr_ptr, ste, arena); } case Num_kind: case Str_kind: @@ -869,38 +887,38 @@ } static int -optimize_function_def(stmt_ty* stmt_ptr, PyArena* arena) +optimize_function_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_arguments(&stmt->v.FunctionDef.args, arena)) + if (!optimize_arguments(&stmt->v.FunctionDef.args, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, arena)) + if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, arena)) + if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, ste, arena)) return 0; return 1; } static int -optimize_class_def(stmt_ty* stmt_ptr, PyArena* arena) +optimize_class_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.ClassDef.bases, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.bases, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, arena)) + if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.ClassDef.body, arena)) + if (!optimize_stmt_seq(&stmt->v.ClassDef.body, ste, arena)) return 0; return 1; } static int -optimize_return(stmt_ty* stmt_ptr, PyArena* arena) +optimize_return(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Return.value != NULL) { expr_ty value; - if (!optimize_expr(&stmt->v.Return.value, arena)) + if (!optimize_expr(&stmt->v.Return.value, ste, arena)) return 0; value = stmt->v.Return.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -910,87 +928,105 @@ } static int -optimize_delete(stmt_ty* stmt_ptr, PyArena* arena) +optimize_delete(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Delete.targets, arena)) + if (!optimize_expr_seq(&stmt->v.Delete.targets, ste, arena)) return 0; return 1; } static int -optimize_assign(stmt_ty* stmt_ptr, PyArena* arena) +optimize_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Assign.targets, arena)) + if (!optimize_expr_seq(&stmt->v.Assign.targets, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.Assign.value, arena)) + if (!optimize_expr(&stmt->v.Assign.value, ste, arena)) return 0; return 1; } static int -optimize_aug_assign(stmt_ty* stmt_ptr, PyArena* arena) +optimize_aug_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.AugAssign.target, arena)) + if (!optimize_expr(&stmt->v.AugAssign.target, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.AugAssign.value, arena)) + if (!optimize_expr(&stmt->v.AugAssign.value, ste, arena)) return 0; return 1; } static int -optimize_print(stmt_ty* stmt_ptr, PyArena* arena) +optimize_print(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Print.dest != NULL) - if (!optimize_expr(&stmt->v.Print.dest, arena)) + if (!optimize_expr(&stmt->v.Print.dest, ste, arena)) return 0; - if (!optimize_expr_seq(&stmt->v.Print.values, arena)) + if (!optimize_expr_seq(&stmt->v.Print.values, ste, arena)) return 0; return 1; } static int -optimize_for(stmt_ty* stmt_ptr, PyArena* arena) +optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.target, arena)) + if (!optimize_expr(&stmt->v.For.target, ste, arena)) return 0; - if (!optimize_expr(&stmt->v.For.iter, arena)) + if (!optimize_expr(&stmt->v.For.iter, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.body, arena)) + /* if the object we're iterating over is a list of constants, + * build the list at compile time. Note that this will actually + * transform the list into a tuple. This is safe because only + * the `for' loop can actually reference it. + */ + if (stmt->v.For.iter->kind == List_kind) { + expr_ty list = stmt->v.For.iter; + if (_is_sequence_of_constants(list->v.List.elts)) { + PyObject* iter = _build_tuple_of_constants(list->v.List.elts, + arena); + if (iter == NULL) + return 0; + stmt->v.For.iter = Const(iter, stmt->lineno, stmt->col_offset, + arena); + if (stmt->v.For.iter == NULL) + return 0; + } + } + if (!optimize_stmt_seq(&stmt->v.For.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.For.orelse, ste, arena)) return 0; return 1; } static int -optimize_while(stmt_ty* stmt_ptr, PyArena* arena) +optimize_while(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.While.test, arena)) + if (!optimize_expr(&stmt->v.While.test, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.body, arena)) + if (!optimize_stmt_seq(&stmt->v.While.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.While.orelse, ste, arena)) return 0; return 1; } static int -optimize_if(stmt_ty* stmt_ptr, PyArena* arena) +optimize_if(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.If.test, arena)) + if (!optimize_expr(&stmt->v.If.test, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.body, arena)) + if (!optimize_stmt_seq(&stmt->v.If.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.If.orelse, ste, arena)) return 0; if (stmt->v.If.test->kind == UnaryOp_kind && @@ -1020,174 +1056,187 @@ } static int -optimize_with(stmt_ty* stmt_ptr, PyArena* arena) +optimize_with(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.With.context_expr, arena)) + if (!optimize_expr(&stmt->v.With.context_expr, ste, arena)) return 0; if (stmt->v.With.optional_vars != NULL) - if (!optimize_expr(&stmt->v.With.optional_vars, arena)) + if (!optimize_expr(&stmt->v.With.optional_vars, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.With.body, arena)) + if (!optimize_stmt_seq(&stmt->v.With.body, ste, arena)) return 0; return 1; } static int -optimize_raise(stmt_ty* stmt_ptr, PyArena* arena) +optimize_raise(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Raise.type != NULL) - if (!optimize_expr(&stmt->v.Raise.type, arena)) + if (!optimize_expr(&stmt->v.Raise.type, ste, arena)) return 0; if (stmt->v.Raise.inst != NULL) - if (!optimize_expr(&stmt->v.Raise.inst, arena)) + if (!optimize_expr(&stmt->v.Raise.inst, ste, arena)) return 0; if (stmt->v.Raise.tback != NULL) - if (!optimize_expr(&stmt->v.Raise.tback, arena)) + if (!optimize_expr(&stmt->v.Raise.tback, ste, arena)) return 0; return 1; } static int -optimize_excepthandler(excepthandler_ty* exc_ptr, PyArena* arena) +optimize_excepthandler(excepthandler_ty* exc_ptr, PySTEntryObject* ste, + PyArena* arena) { excepthandler_ty exc = *exc_ptr; if (exc->v.ExceptHandler.type != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.type, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.type, ste, arena)) return 0; if (exc->v.ExceptHandler.name != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.name, arena)) + if (!optimize_expr(&exc->v.ExceptHandler.name, ste, arena)) return 0; - if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, arena)) + if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, ste, arena)) return 0; return 1; } static int -optimize_try_except(stmt_ty* stmt_ptr, PyArena* arena) +optimize_try_except(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryExcept.body, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.body, ste, arena)) return 0; - if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, arena)) + if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, arena)) + if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, ste, arena)) return 0; return 1; } static int -optimize_try_finally(stmt_ty* stmt_ptr, PyArena* arena) +optimize_try_finally(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryFinally.body, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.body, ste, arena)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, arena)) + if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, ste, arena)) return 0; return 1; } static int -optimize_assert(stmt_ty* stmt_ptr, PyArena* arena) +optimize_assert(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Assert.test, arena)) + if (!optimize_expr(&stmt->v.Assert.test, ste, arena)) return 0; if (stmt->v.Assert.msg != NULL) - if (!optimize_expr(&stmt->v.Assert.msg, arena)) + if (!optimize_expr(&stmt->v.Assert.msg, ste, arena)) return 0; return 1; } static int -optimize_exec(stmt_ty* stmt_ptr, PyArena* arena) +optimize_exec(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Exec.body, arena)) + if (!optimize_expr(&stmt->v.Exec.body, ste, arena)) return 0; if (stmt->v.Exec.globals != NULL) - if (!optimize_expr(&stmt->v.Exec.globals, arena)) + if (!optimize_expr(&stmt->v.Exec.globals, ste, arena)) return 0; if (stmt->v.Exec.locals != NULL) - if (!optimize_expr(&stmt->v.Exec.locals, arena)) + if (!optimize_expr(&stmt->v.Exec.locals, ste, arena)) return 0; return 1; } static int -optimize_stmt(stmt_ty* stmt_ptr, PyArena* arena) +optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; switch (stmt->kind) { case FunctionDef_kind: { - return optimize_function_def(stmt_ptr, arena); + int result; + ste = PySymtable_Lookup(ste->ste_table, stmt); + if (ste == NULL) + return 0; + result = optimize_function_def(stmt_ptr, ste, arena); + Py_DECREF(ste); + return result; } case ClassDef_kind: { - return optimize_class_def(stmt_ptr, arena); + int result; + ste = PySymtable_Lookup(ste->ste_table, stmt); + if (ste == NULL) + return 0; + result = optimize_class_def(stmt_ptr, ste, arena); + Py_DECREF(ste); + return result; } case Return_kind: { - return optimize_return(stmt_ptr, arena); + return optimize_return(stmt_ptr, ste, arena); } case Delete_kind: { - return optimize_delete(stmt_ptr, arena); + return optimize_delete(stmt_ptr, ste, arena); } case Assign_kind: { - return optimize_assign(stmt_ptr, arena); + return optimize_assign(stmt_ptr, ste, arena); } case AugAssign_kind: { - return optimize_aug_assign(stmt_ptr, arena); + return optimize_aug_assign(stmt_ptr, ste, arena); } case Print_kind: { - return optimize_print(stmt_ptr, arena); + return optimize_print(stmt_ptr, ste, arena); } case For_kind: { - return optimize_for(stmt_ptr, arena); + return optimize_for(stmt_ptr, ste, arena); } case While_kind: { - return optimize_while(stmt_ptr, arena); + return optimize_while(stmt_ptr, ste, arena); } case If_kind: { - return optimize_if(stmt_ptr, arena); + return optimize_if(stmt_ptr, ste, arena); } case With_kind: { - return optimize_with(stmt_ptr, arena); + return optimize_with(stmt_ptr, ste, arena); } case Raise_kind: { - return optimize_raise(stmt_ptr, arena); + return optimize_raise(stmt_ptr, ste, arena); } case TryExcept_kind: { - return optimize_try_except(stmt_ptr, arena); + return optimize_try_except(stmt_ptr, ste, arena); } case TryFinally_kind: { - return optimize_try_finally(stmt_ptr, arena); + return optimize_try_finally(stmt_ptr, ste, arena); } case Assert_kind: { - return optimize_assert(stmt_ptr, arena); + return optimize_assert(stmt_ptr, ste, arena); } case Exec_kind: { - return optimize_exec(stmt_ptr, arena); + return optimize_exec(stmt_ptr, ste, arena); } case Expr_kind: { - return optimize_expr(&stmt->v.Expr.value, arena); + return optimize_expr(&stmt->v.Expr.value, ste, arena); } case Import_kind: case ImportFrom_kind: @@ -1213,7 +1262,14 @@ int PyAST_Optimize(mod_ty* mod_ptr, struct symtable* st, PyArena* arena) { - /* TODO: update optimize_* functions to accept an ste */ - return optimize_mod(mod_ptr, arena); + int result; + PySTEntryObject* ste; + + ste = PySymtable_Lookup(st, *mod_ptr); + if (ste == NULL) + return 0; + result = optimize_mod(mod_ptr, ste, arena); + Py_DECREF(ste); + return 1; } Modified: python/branches/tlee-ast-optimize/Python/peephole.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/peephole.c (original) +++ python/branches/tlee-ast-optimize/Python/peephole.c Sun Jun 8 10:46:48 2008 @@ -20,55 +20,6 @@ #define ISBASICBLOCK(blocks, start, bytes) \ (blocks[start]==blocks[start+bytes-1]) -/* Replace LOAD_CONST c1. LOAD_CONST c2 ... LOAD_CONST cn BUILD_TUPLE n - with LOAD_CONST (c1, c2, ... cn). - The consts table must still be in list form so that the - new constant (c1, c2, ... cn) can be appended. - Called with codestr pointing to the first LOAD_CONST. - Bails out with no change if one or more of the LOAD_CONSTs is missing. - Also works for BUILD_LIST when followed by an "in" or "not in" test. -*/ -static int -tuple_of_constants(unsigned char *codestr, Py_ssize_t n, PyObject *consts) -{ - PyObject *newconst, *constant; - Py_ssize_t i, arg, len_consts; - - /* Pre-conditions */ - assert(PyList_CheckExact(consts)); - assert(codestr[n*3] == BUILD_TUPLE || codestr[n*3] == BUILD_LIST); - assert(GETARG(codestr, (n*3)) == n); - for (i=0 ; i= 0 && - j <= lastlc && - ((opcode == BUILD_TUPLE && - ISBASICBLOCK(blocks, h, 3*(j+1))) || - (opcode == BUILD_LIST && - codestr[i+3]==COMPARE_OP && - ISBASICBLOCK(blocks, h, 3*(j+2)) && - (GETARG(codestr,i+3)==6 || - GETARG(codestr,i+3)==7))) && - tuple_of_constants(&codestr[h], j, consts)) { - assert(codestr[i] == LOAD_CONST); - cumlc = 1; - break; - } - if (codestr[i+3] != UNPACK_SEQUENCE || - !ISBASICBLOCK(blocks,i,6) || - j != GETARG(codestr, i+3)) - continue; - if (j == 1) { - memset(codestr+i, NOP, 6); - } else if (j == 2) { - codestr[i] = ROT_TWO; - memset(codestr+i+1, NOP, 5); - } else if (j == 3) { - codestr[i] = ROT_THREE; - codestr[i+1] = ROT_TWO; - memset(codestr+i+2, NOP, 4); - } - break; - /* Simplify conditional jump to conditional jump where the result of the first test implies the success of a similar test or the failure of the opposite test. From python-checkins at python.org Sun Jun 8 10:47:34 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 8 Jun 2008 10:47:34 +0200 (CEST) Subject: [Python-checkins] r64035 - python/branches/tlee-ast-optimize/Python/pythonrun.c Message-ID: <20080608084734.8151C1E4004@bag.python.org> Author: thomas.lee Date: Sun Jun 8 10:47:34 2008 New Revision: 64035 Log: Fix a potential bug introduced during my changes for symtable-generation-before-compile. Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Sun Jun 8 10:47:34 2008 @@ -1324,7 +1324,7 @@ run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals, PyCompilerFlags *flags, PyArena *arena) { - PyCodeObject *co; + PyCodeObject *co = NULL; PyObject *v = NULL; PyCompilerInfo ci; @@ -1392,7 +1392,7 @@ Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags) { - PyCodeObject *co; + PyCodeObject *co = NULL; mod_ty mod; PyCompilerInfo ci; PyArena *arena = PyArena_New(); From python-checkins at python.org Sun Jun 8 10:54:41 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 8 Jun 2008 10:54:41 +0200 (CEST) Subject: [Python-checkins] r64036 - python/trunk/Doc/library/tokenize.rst Message-ID: <20080608085441.030681E4004@bag.python.org> Author: georg.brandl Date: Sun Jun 8 10:54:40 2008 New Revision: 64036 Log: #3028: tokenize passes the physical line. Modified: python/trunk/Doc/library/tokenize.rst Modified: python/trunk/Doc/library/tokenize.rst ============================================================================== --- python/trunk/Doc/library/tokenize.rst (original) +++ python/trunk/Doc/library/tokenize.rst Sun Jun 8 10:54:40 2008 @@ -15,21 +15,20 @@ The primary entry point is a :term:`generator`: - .. function:: generate_tokens(readline) - The :func:`generate_tokens` generator requires one argument, *readline*, which - must be a callable object which provides the same interface as the + The :func:`generate_tokens` generator requires one argument, *readline*, + which must be a callable object which provides the same interface as the :meth:`readline` method of built-in file objects (see section - :ref:`bltin-file-objects`). Each call to the function should return one line of - input as a string. + :ref:`bltin-file-objects`). Each call to the function should return one line + of input as a string. The generator produces 5-tuples with these members: the token type; the token - string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column where - the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints specifying - the row and column where the token ends in the source; and the line on which the - token was found. The line passed is the *logical* line; continuation lines are - included. + string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column + where the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints + specifying the row and column where the token ends in the source; and the + line on which the token was found. The line passed is the *physical* line, + that is, continuation lines are not handled specially. .. versionadded:: 2.2 From python-checkins at python.org Sun Jun 8 10:59:38 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 8 Jun 2008 10:59:38 +0200 (CEST) Subject: [Python-checkins] r64037 - python/trunk/Doc/library/tokenize.rst Message-ID: <20080608085938.EB6901E4004@bag.python.org> Author: georg.brandl Date: Sun Jun 8 10:59:38 2008 New Revision: 64037 Log: Argh, I read it wrong. Reverted 64036 and added a clarifying remark. Modified: python/trunk/Doc/library/tokenize.rst Modified: python/trunk/Doc/library/tokenize.rst ============================================================================== --- python/trunk/Doc/library/tokenize.rst (original) +++ python/trunk/Doc/library/tokenize.rst Sun Jun 8 10:59:38 2008 @@ -27,8 +27,8 @@ string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column where the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints specifying the row and column where the token ends in the source; and the - line on which the token was found. The line passed is the *physical* line, - that is, continuation lines are not handled specially. + line on which the token was found. The line passed (the last tuple item) is + the *logical* line; continuation lines are included. .. versionadded:: 2.2 From python-checkins at python.org Sun Jun 8 10:59:53 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 8 Jun 2008 10:59:53 +0200 (CEST) Subject: [Python-checkins] r64038 - in python/branches/tlee-ast-optimize: Doc/library/_ast.rst Doc/library/abc.rst Doc/library/ctypes.rst Doc/library/inspect.rst Doc/library/logging.rst Doc/library/parser.rst Doc/library/python.rst Doc/reference/simple_stmts.rst Doc/whatsnew/2.5.rst Doc/whatsnew/2.6.rst Include/Python.h Include/object.h Lib/UserDict.py Lib/_abcoll.py Lib/ctypes/__init__.py Lib/ctypes/test/test_errno.py Lib/ctypes/test/test_pep3118.py Lib/inspect.py Lib/test/test_inspect.py Lib/test/test_py3kwarn.py Lib/test/test_urllib2net.py Mac/Modules/MacOS.c Mac/Modules/ae/_AEmodule.c Mac/Modules/file/_Filemodule.c Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/ctypes.h Modules/_ctypes/stgdict.c Modules/_heapqmodule.c Objects/abstract.c Python/ast.c configure configure.in pyconfig.h.in Message-ID: <20080608085953.B22311E4004@bag.python.org> Author: thomas.lee Date: Sun Jun 8 10:59:51 2008 New Revision: 64038 Log: Merged revisions 63957-64035 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r63961 | thomas.heller | 2008-06-06 03:29:38 +1000 (Fri, 06 Jun 2008) | 1 line Fix preprocessor statement. ........ r63962 | thomas.heller | 2008-06-06 03:51:15 +1000 (Fri, 06 Jun 2008) | 3 lines Backport from py3k: Implement the new buffer interface from pep3118 for ctypes instances. Closes issue #2404. ........ r63963 | thomas.heller | 2008-06-06 03:52:59 +1000 (Fri, 06 Jun 2008) | 3 lines Backport from py3k: Implement the new buffer interface from pep3118 for ctypes instances. Closes issue #2404. ........ r63965 | benjamin.peterson | 2008-06-06 08:39:34 +1000 (Fri, 06 Jun 2008) | 2 lines use the more idomatic while True ........ r63967 | benjamin.peterson | 2008-06-06 09:02:33 +1000 (Fri, 06 Jun 2008) | 2 lines revert 63965 for preformance reasons ........ r63970 | andrew.kuchling | 2008-06-06 09:33:54 +1000 (Fri, 06 Jun 2008) | 1 line Document 'utc' parameter ........ r63971 | andrew.kuchling | 2008-06-06 09:35:31 +1000 (Fri, 06 Jun 2008) | 1 line Add various items ........ r63972 | andrew.kuchling | 2008-06-06 09:35:48 +1000 (Fri, 06 Jun 2008) | 1 line Grammar fix ........ r63975 | neal.norwitz | 2008-06-06 14:47:01 +1000 (Fri, 06 Jun 2008) | 3 lines Aldo Cortesi confirmed this is still needed for OpenBSD 4.2 and 4.3. (I didn't regen configure, since I don't have a working autoconf.) ........ r63976 | georg.brandl | 2008-06-06 17:34:50 +1000 (Fri, 06 Jun 2008) | 2 lines Markup fix. ........ r63977 | thomas.heller | 2008-06-06 18:33:46 +1000 (Fri, 06 Jun 2008) | 31 lines Issue #1798: Add ctypes calling convention that allows safe access of errno. ctypes maintains thread-local storage that has space for two error numbers: private copies of the system 'errno' value and, on Windows, the system error code accessed by the GetLastError() and SetLastError() api functions. Foreign functions created with CDLL(..., use_errno=True), when called, swap the system 'errno' value with the private copy just before the actual function call, and swapped again immediately afterwards. The 'use_errno' parameter defaults to False, in this case 'ctypes_errno' is not touched. On Windows, foreign functions created with CDLL(..., use_last_error=True) or WinDLL(..., use_last_error=True) swap the system LastError value with the ctypes private copy. The values are also swapped immeditately before and after ctypes callback functions are called, if the callbacks are constructed using the new optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or WINFUNCTYPE(..., use_errno=True). New ctypes functions are provided to access the ctypes private copies from Python: - ctypes.set_errno(value) and ctypes.set_last_error(value) store 'value' in the private copy and returns the previous value. - ctypes.get_errno() and ctypes.get_last_error() returns the current ctypes private copies value. ........ r63982 | georg.brandl | 2008-06-06 20:43:43 +1000 (Fri, 06 Jun 2008) | 2 lines Fix brackets. ........ r63988 | thomas.heller | 2008-06-07 04:37:55 +1000 (Sat, 07 Jun 2008) | 3 lines Performance improvement: Use PyDict_Get/SetItem instead of PyDict_Get/SetItemString. ........ r63989 | thomas.heller | 2008-06-07 04:42:11 +1000 (Sat, 07 Jun 2008) | 2 lines Add a reminder for the maintainer of whatsnew. ........ r63991 | thomas.heller | 2008-06-07 06:05:15 +1000 (Sat, 07 Jun 2008) | 5 lines Document the new ctypes features. It would be great if someone could review both sematics, markup, and spelling, and correct the versionadded and versionchanges markers. ........ r63997 | ronald.oussoren | 2008-06-07 07:31:33 +1000 (Sat, 07 Jun 2008) | 2 lines Fix build issue on OSX 10.4 ........ r63998 | raymond.hettinger | 2008-06-07 07:47:51 +1000 (Sat, 07 Jun 2008) | 1 line Issue 3501: Make heapq support both __le__ and __lt__. ........ r64002 | travis.oliphant | 2008-06-07 08:33:21 +1000 (Sat, 07 Jun 2008) | 1 line Add long double check support to configure test. ........ r64003 | travis.oliphant | 2008-06-07 08:39:47 +1000 (Sat, 07 Jun 2008) | 1 line Remove locking part of new buffer protocol. ........ r64012 | facundo.batista | 2008-06-07 23:36:36 +1000 (Sat, 07 Jun 2008) | 4 lines Finished bug #2451. Fixed the retrying part to make it more robust. ........ r64014 | georg.brandl | 2008-06-08 01:59:10 +1000 (Sun, 08 Jun 2008) | 3 lines Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc() to ease standalone use of the algorithm. ........ r64015 | georg.brandl | 2008-06-08 02:04:01 +1000 (Sun, 08 Jun 2008) | 2 lines Revert unwanted changes. ........ r64016 | georg.brandl | 2008-06-08 02:16:12 +1000 (Sun, 08 Jun 2008) | 2 lines Register IterableUserDict as a MutableMapping. ........ r64018 | georg.brandl | 2008-06-08 03:03:28 +1000 (Sun, 08 Jun 2008) | 2 lines #3057: Fix the MutableMapping ABC to use the 2.6 dict interface. ........ r64019 | georg.brandl | 2008-06-08 03:11:00 +1000 (Sun, 08 Jun 2008) | 2 lines Backport docs for abc module to 2.6. ........ r64021 | georg.brandl | 2008-06-08 04:16:12 +1000 (Sun, 08 Jun 2008) | 2 lines X-ref to numbers module. ........ r64022 | georg.brandl | 2008-06-08 04:17:37 +1000 (Sun, 08 Jun 2008) | 3 lines Document the "st" API, to avoid confusion with the "new" AST. Add a note about using the new AST module. ........ r64028 | benjamin.peterson | 2008-06-08 06:44:48 +1000 (Sun, 08 Jun 2008) | 2 lines capitalization nit ........ r64031 | benjamin.peterson | 2008-06-08 12:05:33 +1000 (Sun, 08 Jun 2008) | 2 lines change Py3k backquote warning to a SyntaxWarning and add a test ........ Added: python/branches/tlee-ast-optimize/Doc/library/_ast.rst - copied unchanged from r64031, /python/trunk/Doc/library/_ast.rst python/branches/tlee-ast-optimize/Doc/library/abc.rst - copied unchanged from r64031, /python/trunk/Doc/library/abc.rst python/branches/tlee-ast-optimize/Lib/ctypes/test/test_errno.py - copied unchanged from r64031, /python/trunk/Lib/ctypes/test/test_errno.py python/branches/tlee-ast-optimize/Lib/ctypes/test/test_pep3118.py - copied unchanged from r64031, /python/trunk/Lib/ctypes/test/test_pep3118.py Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/library/ctypes.rst python/branches/tlee-ast-optimize/Doc/library/inspect.rst python/branches/tlee-ast-optimize/Doc/library/logging.rst python/branches/tlee-ast-optimize/Doc/library/parser.rst python/branches/tlee-ast-optimize/Doc/library/python.rst python/branches/tlee-ast-optimize/Doc/reference/simple_stmts.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.5.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Include/Python.h python/branches/tlee-ast-optimize/Include/object.h python/branches/tlee-ast-optimize/Lib/UserDict.py python/branches/tlee-ast-optimize/Lib/_abcoll.py python/branches/tlee-ast-optimize/Lib/ctypes/__init__.py python/branches/tlee-ast-optimize/Lib/inspect.py python/branches/tlee-ast-optimize/Lib/test/test_inspect.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c python/branches/tlee-ast-optimize/Modules/_ctypes/ctypes.h python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c python/branches/tlee-ast-optimize/Modules/_heapqmodule.c python/branches/tlee-ast-optimize/Objects/abstract.c python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/configure python/branches/tlee-ast-optimize/configure.in python/branches/tlee-ast-optimize/pyconfig.h.in Modified: python/branches/tlee-ast-optimize/Doc/library/ctypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ctypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ctypes.rst Sun Jun 8 10:59:51 2008 @@ -1337,14 +1337,14 @@ way is to instantiate one of the following classes: -.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Instances of this class represent loaded shared libraries. Functions in these libraries use the standard C calling convention, and are assumed to return ``int``. -.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` calling convention, and are @@ -1354,7 +1354,7 @@ failure, an :class:`WindowsError` is automatically raised. -.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None) +.. class:: WinDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` calling convention, and are @@ -1387,6 +1387,29 @@ The *mode* parameter can be used to specify how the library is loaded. For details, consult the ``dlopen(3)`` manpage, on Windows, *mode* is ignored. +The *use_errno* parameter, when set to True, enables a ctypes +mechanism that allows to access the system `errno` error number in a +safe way. `ctypes` maintains a thread-local copy of the systems +`errno` variable; if you call foreign functions created with +`use_errno=True` then the `errno` value before the function call is +swapped with the ctypes private copy, the same happens immediately +after the function call. + +The function `ctypes.get_errno()` returns the value of the ctypes +private copy, and the function `ctypes.set_errno(value)` changes the +ctypes private copy to `value` and returns the former value. + +The *use_last_error* parameter, when set to True, enables the same +mechanism for the Windows error code which is managed by the +GetLastError() and SetLastError() Windows api functions; +`ctypes.get_last_error()` and `ctypes.set_last_error(value)` are used +to request and change the ctypes private copy of the windows error +code. + +.. versionchanged:: 2.6 + +The `use_errno` and `use_last_error` parameters were added in Python +2.6. .. data:: RTLD_GLOBAL :noindex: @@ -1585,18 +1608,26 @@ type and the argument types of the function. -.. function:: CFUNCTYPE(restype, *argtypes) +.. function:: CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) The returned function prototype creates functions that use the standard C calling convention. The function will release the GIL during the call. + If `use_errno` is set to True, the ctypes private copy of the system `errno` + variable is exchanged with the real `errno` value bafore and after the call; + `use_last_error` does the same for the Windows error code. + + .. versionchanged:: 2.6 + + The optional `use_errno` and `use_last_error` parameters were added + in Python 2.6. -.. function:: WINFUNCTYPE(restype, *argtypes) +.. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) Windows only: The returned function prototype creates functions that use the ``stdcall`` calling convention, except on Windows CE where :func:`WINFUNCTYPE` is the same as :func:`CFUNCTYPE`. The function will release the GIL during the - call. + call. `use_errno` and `use_last_error` have the same meaning as above. .. function:: PYFUNCTYPE(restype, *argtypes) @@ -1848,7 +1879,22 @@ .. function:: GetLastError() Windows only: Returns the last error code set by Windows in the calling thread. + This function calls the Windows `GetLastError()` function directly, + it does not return the ctypes-private copy of the error code. + +.. function:: get_errno() + + Returns the current value of the ctypes-private copy of the system + `errno` variable in the calling thread. + + .. versionadded:: 2.6 + +.. function:: get_last_error() + Windows only: returns the current value of the ctypes-private copy of the system + `LastError` variable in the calling thread. + + .. versionadded:: 2.6 .. function:: memmove(dst, src, count) @@ -1901,6 +1947,22 @@ other systems ``('ascii', 'strict')``. +.. function:: set_errno(value) + + Set the current value of the ctypes-private copy of the system + `errno` variable in the calling thread to `value` and return the + previous value. + + .. versionadded:: 2.6 + +.. function:: set_last_error(value) + + Windows only: set the current value of the ctypes-private copy of + the system `LastError` variable in the calling thread to `value` + and return the previous value. + + .. versionadded:: 2.6 + .. function:: sizeof(obj_or_type) Returns the size in bytes of a ctypes type or instance memory buffer. Does the Modified: python/branches/tlee-ast-optimize/Doc/library/inspect.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/inspect.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/inspect.rst Sun Jun 8 10:59:51 2008 @@ -376,13 +376,9 @@ Retrieving source code ---------------------- - .. function:: getdoc(object) - Get the documentation string for an object. All tabs are expanded to spaces. To - clean up docstrings that are indented to line up with blocks of code, any - whitespace than can be uniformly removed from the second line onwards is - removed. + Get the documentation string for an object, cleaned up with :func:`cleandoc`. .. function:: getcomments(object) @@ -429,6 +425,15 @@ cannot be retrieved. +.. function:: cleandoc(doc) + + Clean up indentation from docstrings that are indented to line up with blocks + of code. Any whitespace that can be uniformly removed from the second line + onwards is removed. Also, all tabs are expanded to spaces. + + .. versionadded:: 2.6 + + .. _inspect-classes-functions: Classes and functions Modified: python/branches/tlee-ast-optimize/Doc/library/logging.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/logging.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/logging.rst Sun Jun 8 10:59:51 2008 @@ -1645,7 +1645,7 @@ timed intervals. -.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay]]]]]) +.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay[, utc]]]]]]) Returns a new instance of the :class:`TimedRotatingFileHandler` class. The specified file is opened and used as the stream for logging. On rotating it also @@ -1653,7 +1653,7 @@ *interval*. You can use the *when* to specify the type of *interval*. The list of possible - values is, note that they are not case sensitive: + values is below. Note that they are not case sensitive. +----------------+-----------------------+ | Value | Type of interval | @@ -1674,7 +1674,11 @@ The system will save old log files by appending extensions to the filename. The extensions are date-and-time based, using the strftime format ``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the - rollover interval. If *backupCount* is nonzero, at most *backupCount* files + rollover interval. + If the *utc* argument is true, times in UTC will be used; otherwise + local time is used. + + If *backupCount* is nonzero, at most *backupCount* files will be kept, and if more would be created when rollover occurs, the oldest one is deleted. The deletion logic uses the interval to determine which files to delete, so changing the interval may leave old files lying around. Modified: python/branches/tlee-ast-optimize/Doc/library/parser.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/parser.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/parser.rst Sun Jun 8 10:59:51 2008 @@ -24,6 +24,17 @@ code fragment as a string because parsing is performed in a manner identical to the code forming the application. It is also faster. +.. note:: + + From Python 2.5 onward, it's much more convenient to cut in at the Abstract + Syntax Tree (AST) generation and compilation stage, using the :mod:`ast` + module. + + The :mod:`parser` module exports the names documented here also with "st" + replaced by "ast"; this is a legacy from the time when there was no other + AST and has nothing to do with the AST found in Python 2.5. This is also the + reason for the functions' keyword arguments being called *ast*, not *st*. + There are a few things to note about this module which are important to making use of the data structures created. This is not a tutorial on editing the parse trees for Python code, but some examples of using the :mod:`parser` module are @@ -34,9 +45,9 @@ to :ref:`reference-index`. The parser itself is created from a grammar specification defined in the file :file:`Grammar/Grammar` in the standard Python distribution. The parse trees -stored in the AST objects created by this module are the actual output from the +stored in the ST objects created by this module are the actual output from the internal parser when created by the :func:`expr` or :func:`suite` functions, -described below. The AST objects created by :func:`sequence2ast` faithfully +described below. The ST objects created by :func:`sequence2st` faithfully simulate those structures. Be aware that the values of the sequences which are considered "correct" will vary from one version of Python to another as the formal grammar for the language is revised. However, transporting code from one @@ -46,7 +57,7 @@ language constructs. The parse trees are not typically compatible from one version to another, whereas source code has always been forward-compatible. -Each element of the sequences returned by :func:`ast2list` or :func:`ast2tuple` +Each element of the sequences returned by :func:`st2list` or :func:`st2tuple` has a simple form. Sequences representing non-terminal elements in the grammar always have a length greater than one. The first element is an integer which identifies a production in the grammar. These integers are given symbolic names @@ -69,19 +80,19 @@ terminal symbols are defined in the C header file :file:`Include/token.h` and the Python module :mod:`token`. -The AST objects are not required to support the functionality of this module, +The ST objects are not required to support the functionality of this module, but are provided for three purposes: to allow an application to amortize the cost of processing complex parse trees, to provide a parse tree representation which conserves memory space when compared to the Python list or tuple representation, and to ease the creation of additional modules in C which manipulate parse trees. A simple "wrapper" class may be created in Python to -hide the use of AST objects. +hide the use of ST objects. The :mod:`parser` module defines functions for a few distinct purposes. The -most important purposes are to create AST objects and to convert AST objects to +most important purposes are to create ST objects and to convert ST objects to other representations such as parse trees and compiled code objects, but there are also functions which serve to query the type of parse tree represented by an -AST object. +ST object. .. seealso:: @@ -94,20 +105,20 @@ testing node values. -.. _creating-asts: +.. _creating-sts: -Creating AST Objects --------------------- +Creating ST Objects +------------------- -AST objects may be created from source code or from a parse tree. When creating -an AST object from source, different functions are used to create the ``'eval'`` +ST objects may be created from source code or from a parse tree. When creating +an ST object from source, different functions are used to create the ``'eval'`` and ``'exec'`` forms. .. function:: expr(source) The :func:`expr` function parses the parameter *source* as if it were an input - to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an AST object + to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is thrown. @@ -115,22 +126,22 @@ .. function:: suite(source) The :func:`suite` function parses the parameter *source* as if it were an input - to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an AST object + to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an ST object is created to hold the internal parse tree representation, otherwise an appropriate exception is thrown. -.. function:: sequence2ast(sequence) +.. function:: sequence2st(sequence) This function accepts a parse tree represented as a sequence and builds an internal representation if possible. If it can validate that the tree conforms to the Python grammar and all nodes are valid node types in the host version of - Python, an AST object is created from the internal representation and returned + Python, an ST object is created from the internal representation and returned to the called. If there is a problem creating the internal representation, or if the tree cannot be validated, a :exc:`ParserError` exception is thrown. An - AST object created this way should not be assumed to compile correctly; normal - exceptions thrown by compilation may still be initiated when the AST object is - passed to :func:`compileast`. This may indicate problems not related to syntax + ST object created this way should not be assumed to compile correctly; normal + exceptions thrown by compilation may still be initiated when the ST object is + passed to :func:`compilest`. This may indicate problems not related to syntax (such as a :exc:`MemoryError` exception), but may also be due to constructs such as the result of parsing ``del f(0)``, which escapes the Python parser but is checked by the bytecode compiler. @@ -142,31 +153,31 @@ symbols in the input tree. -.. function:: tuple2ast(sequence) +.. function:: tuple2st(sequence) - This is the same function as :func:`sequence2ast`. This entry point is + This is the same function as :func:`sequence2st`. This entry point is maintained for backward compatibility. -.. _converting-asts: +.. _converting-sts: -Converting AST Objects ----------------------- +Converting ST Objects +--------------------- -AST objects, regardless of the input used to create them, may be converted to +ST objects, regardless of the input used to create them, may be converted to parse trees represented as list- or tuple- trees, or may be compiled into executable code objects. Parse trees may be extracted with or without line numbering information. -.. function:: ast2list(ast[, line_info]) +.. function:: st2list(ast[, line_info]) - This function accepts an AST object from the caller in *ast* and returns a + This function accepts an ST object from the caller in *ast* and returns a Python list representing the equivalent parse tree. The resulting list representation can be used for inspection or the creation of a new parse tree in list form. This function does not fail so long as memory is available to build the list representation. If the parse tree will only be used for inspection, - :func:`ast2tuple` should be used instead to reduce memory consumption and + :func:`st2tuple` should be used instead to reduce memory consumption and fragmentation. When the list representation is required, this function is significantly faster than retrieving a tuple representation and converting that to nested lists. @@ -177,29 +188,29 @@ This information is omitted if the flag is false or omitted. -.. function:: ast2tuple(ast[, line_info]) +.. function:: st2tuple(ast[, line_info]) - This function accepts an AST object from the caller in *ast* and returns a + This function accepts an ST object from the caller in *ast* and returns a Python tuple representing the equivalent parse tree. Other than returning a - tuple instead of a list, this function is identical to :func:`ast2list`. + tuple instead of a list, this function is identical to :func:`st2list`. If *line_info* is true, line number information will be included for all terminal tokens as a third element of the list representing the token. This information is omitted if the flag is false or omitted. -.. function:: compileast(ast[, filename='']) +.. function:: compilest(ast[, filename='']) .. index:: builtin: eval - The Python byte compiler can be invoked on an AST object to produce code objects + The Python byte compiler can be invoked on an ST object to produce code objects which can be used as part of an :keyword:`exec` statement or a call to the built-in :func:`eval` function. This function provides the interface to the compiler, passing the internal parse tree from *ast* to the parser, using the source file name specified by the *filename* parameter. The default value - supplied for *filename* indicates that the source was an AST object. + supplied for *filename* indicates that the source was an ST object. - Compiling an AST object may result in exceptions related to compilation; an + Compiling an ST object may result in exceptions related to compilation; an example would be a :exc:`SyntaxError` caused by the parse tree for ``del f(0)``: this statement is considered legal within the formal grammar for Python but is not a legal language construct. The :exc:`SyntaxError` raised for this @@ -209,15 +220,15 @@ tree. -.. _querying-asts: +.. _querying-sts: -Queries on AST Objects ----------------------- +Queries on ST Objects +--------------------- -Two functions are provided which allow an application to determine if an AST was +Two functions are provided which allow an application to determine if an ST was created as an expression or a suite. Neither of these functions can be used to -determine if an AST was created from source code via :func:`expr` or -:func:`suite` or from a parse tree via :func:`sequence2ast`. +determine if an ST was created from source code via :func:`expr` or +:func:`suite` or from a parse tree via :func:`sequence2st`. .. function:: isexpr(ast) @@ -227,19 +238,19 @@ When *ast* represents an ``'eval'`` form, this function returns true, otherwise it returns false. This is useful, since code objects normally cannot be queried for this information using existing built-in functions. Note that the code - objects created by :func:`compileast` cannot be queried like this either, and + objects created by :func:`compilest` cannot be queried like this either, and are identical to those created by the built-in :func:`compile` function. .. function:: issuite(ast) - This function mirrors :func:`isexpr` in that it reports whether an AST object + This function mirrors :func:`isexpr` in that it reports whether an ST object represents an ``'exec'`` form, commonly known as a "suite." It is not safe to assume that this function is equivalent to ``not isexpr(ast)``, as additional syntactic fragments may be supported in the future. -.. _ast-errors: +.. _st-errors: Exceptions and Error Handling ----------------------------- @@ -255,12 +266,12 @@ generally produced for validation failures rather than the built in :exc:`SyntaxError` thrown during normal parsing. The exception argument is either a string describing the reason of the failure or a tuple containing a - sequence causing the failure from a parse tree passed to :func:`sequence2ast` - and an explanatory string. Calls to :func:`sequence2ast` need to be able to + sequence causing the failure from a parse tree passed to :func:`sequence2st` + and an explanatory string. Calls to :func:`sequence2st` need to be able to handle either type of exception, while calls to other functions in the module will only need to be aware of the simple string values. -Note that the functions :func:`compileast`, :func:`expr`, and :func:`suite` may +Note that the functions :func:`compilest`, :func:`expr`, and :func:`suite` may throw exceptions which are normally thrown by the parsing and compilation process. These include the built in exceptions :exc:`MemoryError`, :exc:`OverflowError`, :exc:`SyntaxError`, and :exc:`SystemError`. In these @@ -268,49 +279,49 @@ Refer to the descriptions of each function for detailed information. -.. _ast-objects: +.. _st-objects: -AST Objects ------------ +ST Objects +---------- -Ordered and equality comparisons are supported between AST objects. Pickling of -AST objects (using the :mod:`pickle` module) is also supported. +Ordered and equality comparisons are supported between ST objects. Pickling of +ST objects (using the :mod:`pickle` module) is also supported. -.. data:: ASTType +.. data:: STType The type of the objects returned by :func:`expr`, :func:`suite` and - :func:`sequence2ast`. + :func:`sequence2st`. -AST objects have the following methods: +ST objects have the following methods: -.. method:: AST.compile([filename]) +.. method:: ST.compile([filename]) - Same as ``compileast(ast, filename)``. + Same as ``compilest(st, filename)``. -.. method:: AST.isexpr() +.. method:: ST.isexpr() - Same as ``isexpr(ast)``. + Same as ``isexpr(st)``. -.. method:: AST.issuite() +.. method:: ST.issuite() - Same as ``issuite(ast)``. + Same as ``issuite(st)``. -.. method:: AST.tolist([line_info]) +.. method:: ST.tolist([line_info]) - Same as ``ast2list(ast, line_info)``. + Same as ``st2list(st, line_info)``. -.. method:: AST.totuple([line_info]) +.. method:: ST.totuple([line_info]) - Same as ``ast2tuple(ast, line_info)``. + Same as ``st2tuple(st, line_info)``. -.. _ast-examples: +.. _st-examples: Examples -------- @@ -338,27 +349,27 @@ 10 The equivalent operation using the :mod:`parser` module is somewhat longer, and -allows the intermediate internal parse tree to be retained as an AST object:: +allows the intermediate internal parse tree to be retained as an ST object:: >>> import parser - >>> ast = parser.expr('a + 5') - >>> code = ast.compile('file.py') + >>> st = parser.expr('a + 5') + >>> code = st.compile('file.py') >>> a = 5 >>> eval(code) 10 -An application which needs both AST and code objects can package this code into +An application which needs both ST and code objects can package this code into readily available functions:: import parser def load_suite(source_string): - ast = parser.suite(source_string) - return ast, ast.compile() + st = parser.suite(source_string) + return st, st.compile() def load_expression(source_string): - ast = parser.expr(source_string) - return ast, ast.compile() + st = parser.expr(source_string) + return st, st.compile() Information Discovery @@ -412,8 +423,8 @@ >>> import parser >>> import pprint - >>> ast = parser.suite(open('docstring.py').read()) - >>> tup = ast.totuple() + >>> st = parser.suite(open('docstring.py').read()) + >>> tup = st.totuple() >>> pprint.pprint(tup) (257, (264, @@ -670,8 +681,8 @@ source = open(fileName).read() basename = os.path.basename(os.path.splitext(fileName)[0]) - ast = parser.suite(source) - return ModuleInfo(ast.totuple(), basename) + st = parser.suite(source) + return ModuleInfo(st.totuple(), basename) This provides an easy-to-use interface to the documentation of a module. If information is required which is not extracted by the code of this example, the Modified: python/branches/tlee-ast-optimize/Doc/library/python.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/python.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/python.rst Sun Jun 8 10:59:51 2008 @@ -18,6 +18,7 @@ __main__.rst warnings.rst contextlib.rst + abc.rst atexit.rst traceback.rst __future__.rst Modified: python/branches/tlee-ast-optimize/Doc/reference/simple_stmts.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/simple_stmts.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/simple_stmts.rst Sun Jun 8 10:59:51 2008 @@ -375,8 +375,8 @@ .. index:: statement: print .. productionlist:: - print_stmt: "print" ([`expression` ("," `expression`)* [","] - : | ">>" `expression` [("," `expression`)+ [","]) + print_stmt: "print" ([`expression` ("," `expression`)* [","]] + : | ">>" `expression` [("," `expression`)+ [","]]) :keyword:`print` evaluates each expression in turn and writes the resulting object to standard output (see below). If an object is not a string, it is Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.5.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.5.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.5.rst Sun Jun 8 10:59:51 2008 @@ -2205,10 +2205,10 @@ * MacOS X (10.3 and higher): dynamic loading of modules now uses the :cfunc:`dlopen` function instead of MacOS-specific functions. -* MacOS X: a :option:`--enable-universalsdk` switch was added to the +* MacOS X: an :option:`--enable-universalsdk` switch was added to the :program:`configure` script that compiles the interpreter as a universal binary able to run on both PowerPC and Intel processors. (Contributed by Ronald - Oussoren.) + Oussoren; :issue:`2573`.) * Windows: :file:`.dll` is no longer supported as a filename extension for extension modules. :file:`.pyd` is now the only filename extension that will be Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Sun Jun 8 10:59:51 2008 @@ -647,6 +647,7 @@ >>> format(75.6564, '.2f') '75.66' + .. seealso:: :ref:`formatstrings` @@ -1251,6 +1252,11 @@ (Contributed by Alexander Belopolsky; :issue:`1686487`.) +* A new built-in, ``next(*iterator*, [*default*])`` returns the next item + from the specified iterator. If the *default* argument is supplied, + it will be returned if *iterator* has been exhausted; otherwise, + the :exc:`StopIteration` exception will be raised. (:issue:`2719`) + * Tuples now have an :meth:`index` method matching the list type's :meth:`index` method:: @@ -1554,6 +1560,7 @@ :mod:`terminalcommand`. A number of old IRIX-specific modules were deprecated: + :mod:`al` and :mod:`AL`, :mod:`cd`, :mod:`cddb`, :mod:`cdplayer`, @@ -1665,6 +1672,10 @@ (Contributed by Raymond Hettinger.) +* XXX Describe the new ctypes calling convention that allows safe + access to errno. + (Implemented by Thomas Heller; :issue:`1798`.) + * The :mod:`ctypes` module now supports a :class:`c_bool` datatype that represents the C99 ``bool`` type. (Contributed by David Remahl; :issue:`1649190`.) @@ -1734,6 +1745,13 @@ to drop the built-in in the 2.x series. (Patched by Christian Heimes; :issue:`1739906`.) +* When possible, the :mod:`getpass` module will now use + :file:`/dev/tty` (when available) to print + a prompting message and read the password, falling back to using + standard error and standard input. If the password may be echoed to + the terminal, a warning is printed before the prompt is displayed. + (Contributed by Gregory P. Smith.) + * The :func:`glob.glob` function can now return Unicode filenames if a Unicode path was used and Unicode filenames are matched within the directory. (:issue:`1001604`) @@ -1753,6 +1771,10 @@ This is more efficient than making a call to :func:`heappush` and then :func:`heappop`. + :mod:`heapq` is now implemented to only use less-than comparison, + instead of the less-than-or-equal comparison it previously used. + This makes :mod:`heapq`'s usage of a type match that of the + :meth:`list.sort` method. (Contributed by Raymond Hettinger.) * An optional ``timeout`` parameter was added to the @@ -1847,6 +1869,11 @@ is true, opening of the log file is deferred until the first :meth:`emit` call is made. (Contributed by Vinay Sajip.) + :class:`TimedRotatingFileHandler` also has a *utc* constructor + parameter. If the argument is true, UTC time will be used + in determining when midnight occurs and in generating filenames; + otherwise local time will be used. + * The :mod:`macfs` module has been removed. This in turn required the :func:`macostools.touched` function to be removed because it depended on the :mod:`macfs` module. (:issue:`1490190`) @@ -2114,12 +2141,20 @@ (Contributed by Neal Norwitz and Georg Brandl.) Information about the command-line arguments supplied to the Python - interpreter are available as attributes of a ``sys.flags`` named - tuple. For example, the :attr:`verbose` attribute is true if Python + interpreter is available by reading attributes of a named + tuple available as ``sys.flags``. For example, the :attr:`verbose` + attribute is true if Python was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. These attributes are all read-only. (Contributed by Christian Heimes.) + A new function, :func:`getsizeof`, takes a Python object and returns + the amount of memory used by the object, measured in bytes. Built-in + objects return correct results; third-party extensions may not, + but can define a :meth:`__sizeof__` method to return the + object's size. + (Contributed by Robert Schuppenies; :issue:`2898`.) + It's now possible to determine the current profiler and tracer functions by calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by Georg Brandl; :issue:`1648`.) @@ -2205,6 +2240,10 @@ (Contributed by Dwayne Bailey; :issue:`1581073`.) +* The :mod:`threading` module's :class:`Thread` objects + gained a :meth:`getIdent` method that returns the thread's + identifier, a nonzero integer. (Contributed by XXX; :issue:`2871`.) + * The :mod:`timeit` module now accepts callables as well as strings for the statement being timed and for the setup code. Two convenience functions were added for creating @@ -2214,6 +2253,24 @@ the corresponding method. (Contributed by Erik Demaine; :issue:`1533909`.) +* The :mod:`turtle` module for turtle graphics was greatly enhanced by + Gregor Lingl. New features in the module include: + + * Better animation of turtle movement and rotation. + * Control over turtle movement using the new delay(), + tracer(), and speed() methods. + * The ability to set new shapes for the turtle, and to + define a new coordinate system. + * Turtles now have an undo() method that can roll back actions. + * Simple support for reacting to input events such as mouse and keyboard + activity, making it possible to write simple games. + * A :file:`turtle.cfg` file can be used to customize the starting appearance + of the turtle's screen. + * The module's docstrings can be replaced by new docstrings that have been + translated into another language. + + (:issue:`1513695`) + * An optional ``timeout`` parameter was added to the :func:`urllib.urlopen` function and the :class:`urllib.ftpwrapper` class constructor, as well as the @@ -2256,8 +2313,10 @@ not necessarily correct for all applications. Code using :mod:`xmlrpclib` should convert :class:`date` and :class:`time` instances. (:issue:`1330538`) The code can also handle - dates before 1900. (Contributed by Ralf Schmitt; :issue:`2014`.) - + dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) + and 64-bit integers represented by using ```` in XML-RPC responses + (contributed by XXX; :issue:`2985`). + * The :mod:`zipfile` module's :class:`ZipFile` class now has :meth:`extract` and :meth:`extractall` methods that will unpack a single file or all the files in the archive to the current directory, or @@ -2273,9 +2332,14 @@ (Contributed by Alan McIntyre; :issue:`467924`.) - Also, :mod:`zipfile` now supports using Unicode filenames - for archived files. (Contributed by Alexey Borzenkov; :issue:`1734346`.) + The :meth:`open`, :meth:`read` and :meth:`extract` methods can now + take either a filename or a :class:`ZipInfo` object. This is useful when an + archive accidentally contains a duplicated filename. + (Contributed by Graham Horler; :issue:`1775025`.) + Finally, :mod:`zipfile` now supports using Unicode filenames + for archived files. (Contributed by Alexey Borzenkov; :issue:`1734346`.) + .. ====================================================================== .. whole new modules get described in subsections here @@ -2470,10 +2534,8 @@ results, and then compiles using these results for optimization. (Contributed by Gregory P. Smith.) - .. ====================================================================== - Port-Specific Changes: Windows ----------------------------------- @@ -2518,6 +2580,16 @@ .. ====================================================================== +Port-Specific Changes: MacOS X +----------------------------------- + +* When compiling a framework build of Python, you can now specify the + framework name to be used by providing the + :option:`--with-framework-name=` option to the + :program:`configure` script. + +.. ====================================================================== + .. _section-other: Modified: python/branches/tlee-ast-optimize/Include/Python.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/Python.h (original) +++ python/branches/tlee-ast-optimize/Include/Python.h Sun Jun 8 10:59:51 2008 @@ -1,4 +1,5 @@ -#ifndef Py_PYTHON_H #define Py_PYTHON_H +#ifndef Py_PYTHON_H +#define Py_PYTHON_H /* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ /* Include nearly all Python header files */ Modified: python/branches/tlee-ast-optimize/Include/object.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/object.h (original) +++ python/branches/tlee-ast-optimize/Include/object.h Sun Jun 8 10:59:51 2008 @@ -183,7 +183,6 @@ #define PyBUF_WRITABLE 0x0001 /* we used to include an E, backwards compatible alias */ #define PyBUF_WRITEABLE PyBUF_WRITABLE -#define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -194,25 +193,15 @@ #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) #define PyBUF_CONTIG_RO (PyBUF_ND) -#define PyBUF_CONTIG_LCK (PyBUF_ND | PyBUF_LOCK) -#define PyBUF_CONTIG_XLCK (PyBUF_ND | PyBUF_LOCK | PyBUF_WRITABLE) #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) #define PyBUF_STRIDED_RO (PyBUF_STRIDES) -#define PyBUF_STRIDED_LCK (PyBUF_STRIDES | PyBUF_LOCK) -#define PyBUF_STRIDED_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) -#define PyBUF_RECORDS_LCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT) -#define PyBUF_RECORDS_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE \ - | PyBUF_FORMAT) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) -#define PyBUF_FULL_LCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT) -#define PyBUF_FULL_XLCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_WRITABLE \ - | PyBUF_FORMAT) #define PyBUF_READ 0x100 Modified: python/branches/tlee-ast-optimize/Lib/UserDict.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/UserDict.py (original) +++ python/branches/tlee-ast-optimize/Lib/UserDict.py Sun Jun 8 10:59:51 2008 @@ -79,6 +79,10 @@ def __iter__(self): return iter(self.data) +import _abcoll +_abcoll.MutableMapping.register(IterableUserDict) + + class DictMixin: # Mixin defining all dictionary methods for classes that already have # a minimum dictionary interface including getitem, setitem, delitem, Modified: python/branches/tlee-ast-optimize/Lib/_abcoll.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/_abcoll.py (original) +++ python/branches/tlee-ast-optimize/Lib/_abcoll.py Sun Jun 8 10:59:51 2008 @@ -329,14 +329,25 @@ else: return True + def iterkeys(self): + return iter(self) + + def itervalues(self): + for key in self: + yield self[key] + + def iteritems(self): + for key in self: + yield (key, self[key]) + def keys(self): - return KeysView(self) + return list(self) def items(self): - return ItemsView(self) + return [(key, self[key]) for key in self] def values(self): - return ValuesView(self) + return [self[key] for key in self] def __eq__(self, other): return isinstance(other, Mapping) and \ @@ -363,8 +374,6 @@ for key in self._mapping: yield key -KeysView.register(type({}.keys())) - class ItemsView(MappingView, Set): @@ -381,8 +390,6 @@ for key in self._mapping: yield (key, self._mapping[key]) -ItemsView.register(type({}.items())) - class ValuesView(MappingView): @@ -396,8 +403,6 @@ for key in self._mapping: yield self._mapping[key] -ValuesView.register(type({}.values())) - class MutableMapping(Mapping): Modified: python/branches/tlee-ast-optimize/Lib/ctypes/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ctypes/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/ctypes/__init__.py Sun Jun 8 10:59:51 2008 @@ -33,7 +33,9 @@ DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ - FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI + FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI, \ + FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO, \ + FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR """ WINOLEAPI -> HRESULT @@ -73,8 +75,9 @@ return create_string_buffer(init, size) _c_functype_cache = {} -def CFUNCTYPE(restype, *argtypes): - """CFUNCTYPE(restype, *argtypes) -> function prototype. +def CFUNCTYPE(restype, *argtypes, **kw): + """CFUNCTYPE(restype, *argtypes, + use_errno=False, use_last_error=False) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types @@ -88,14 +91,21 @@ prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ + flags = _FUNCFLAG_CDECL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _c_functype_cache[(restype, argtypes)] + return _c_functype_cache[(restype, argtypes, flags)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_CDECL - _c_functype_cache[(restype, argtypes)] = CFunctionType + _flags_ = flags + _c_functype_cache[(restype, argtypes, flags)] = CFunctionType return CFunctionType if _os.name in ("nt", "ce"): @@ -106,16 +116,23 @@ _FUNCFLAG_STDCALL = _FUNCFLAG_CDECL _win_functype_cache = {} - def WINFUNCTYPE(restype, *argtypes): + def WINFUNCTYPE(restype, *argtypes, **kw): # docstring set later (very similar to CFUNCTYPE.__doc__) + flags = _FUNCFLAG_STDCALL + if kw.pop("use_errno", False): + flags |= _FUNCFLAG_USE_ERRNO + if kw.pop("use_last_error", False): + flags |= _FUNCFLAG_USE_LASTERROR + if kw: + raise ValueError("unexpected keyword argument(s) %s" % kw.keys()) try: - return _win_functype_cache[(restype, argtypes)] + return _win_functype_cache[(restype, argtypes, flags)] except KeyError: class WinFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype - _flags_ = _FUNCFLAG_STDCALL - _win_functype_cache[(restype, argtypes)] = WinFunctionType + _flags_ = flags + _win_functype_cache[(restype, argtypes, flags)] = WinFunctionType return WinFunctionType if WINFUNCTYPE.__doc__: WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE") @@ -124,6 +141,7 @@ from _ctypes import dlopen as _dlopen from _ctypes import sizeof, byref, addressof, alignment, resize +from _ctypes import get_errno, set_errno from _ctypes import _SimpleCData def _check_size(typ, typecode=None): @@ -313,12 +331,24 @@ Calling the functions releases the Python GIL during the call and reacquires it afterwards. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL + _func_restype_ = c_int - def __init__(self, name, mode=DEFAULT_MODE, handle=None): + def __init__(self, name, mode=DEFAULT_MODE, handle=None, + use_errno=False, + use_last_error=False): self._name = name + flags = self._func_flags_ + if use_errno: + flags |= _FUNCFLAG_USE_ERRNO + if use_last_error: + flags |= _FUNCFLAG_USE_LASTERROR + + class _FuncPtr(_CFuncPtr): + _flags_ = flags + _restype_ = self._func_restype_ + self._FuncPtr = _FuncPtr + if handle is None: self._handle = _dlopen(self._name, mode) else: @@ -348,9 +378,7 @@ access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI if _os.name in ("nt", "ce"): @@ -358,9 +386,7 @@ """This class represents a dll exporting functions using the Windows stdcall calling convention. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = c_int # default, can be overridden in instances + _func_flags_ = _FUNCFLAG_STDCALL # XXX Hm, what about HRESULT as normal parameter? # Mustn't it derive from c_long then? @@ -384,9 +410,8 @@ HRESULT error values are automatically raised as WindowsError exceptions. """ - class _FuncPtr(_CFuncPtr): - _flags_ = _FUNCFLAG_STDCALL - _restype_ = HRESULT + _func_flags_ = _FUNCFLAG_STDCALL + _func_restype_ = HRESULT class LibraryLoader(object): def __init__(self, dlltype): @@ -424,6 +449,7 @@ GetLastError = windll.kernel32.GetLastError else: GetLastError = windll.coredll.GetLastError + from _ctypes import get_last_error, set_last_error def WinError(code=None, descr=None): if code is None: Modified: python/branches/tlee-ast-optimize/Lib/inspect.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/inspect.py (original) +++ python/branches/tlee-ast-optimize/Lib/inspect.py Sun Jun 8 10:59:51 2008 @@ -368,6 +368,13 @@ return None if not isinstance(doc, types.StringTypes): return None + return cleandoc(doc) + +def cleandoc(doc): + """Clean up indentation from docstrings. + + Any whitespace that can be uniformly removed from the second line + onwards is removed.""" try: lines = string.split(string.expandtabs(doc), '\n') except UnicodeError: Modified: python/branches/tlee-ast-optimize/Lib/test/test_inspect.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_inspect.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_inspect.py Sun Jun 8 10:59:51 2008 @@ -185,6 +185,10 @@ self.assertEqual(inspect.getdoc(git.abuse), 'Another\n\ndocstring\n\ncontaining\n\ntabs') + def test_cleandoc(self): + self.assertEqual(inspect.cleandoc('An\n indented\n docstring.'), + 'An\nindented\ndocstring.') + def test_getcomments(self): self.assertEqual(inspect.getcomments(mod), '# line 1\n') self.assertEqual(inspect.getcomments(mod.StupidGit), '# line 20\n') Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py Sun Jun 8 10:59:51 2008 @@ -10,6 +10,12 @@ class TestPy3KWarnings(unittest.TestCase): + def test_backquote(self): + expected = 'backquote not supported in 3.x; use repr()' + with catch_warning() as w: + exec "`2`" in {} + self.assertWarning(None, w, expected) + def test_type_inequality_comparisons(self): expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllib2net.py Sun Jun 8 10:59:51 2008 @@ -11,18 +11,24 @@ import mimetools -def _urlopen_with_retry(host, *args, **kwargs): - # Connecting to remote hosts is flaky. Make it more robust - # by retrying the connection several times. +def _retry_thrice(func, exc, *args, **kwargs): for i in range(3): try: - return urllib2.urlopen(host, *args, **kwargs) - except urllib2.URLError, last_exc: + return func(*args, **kwargs) + except exc, last_exc: continue except: raise raise last_exc +def _wrap_with_retry_thrice(func, exc): + def wrapped(*args, **kwargs): + return _retry_thrice(func, exc, *args, **kwargs) + return wrapped + +# Connecting to remote hosts is flaky. Make it more robust by retrying +# the connection several times. +_urlopen_with_retry = _wrap_with_retry_thrice(urllib2.urlopen, urllib2.URLError) class AuthTests(unittest.TestCase): @@ -115,7 +121,7 @@ 'file:'+sanepathname2url(os.path.abspath(TESTFN)), ('file:///nonsensename/etc/passwd', None, urllib2.URLError), ] - self._test_urls(urls, self._extra_handlers(), urllib2.urlopen) + self._test_urls(urls, self._extra_handlers(), retry=True) finally: os.remove(TESTFN) @@ -147,13 +153,15 @@ ## self._test_urls(urls, self._extra_handlers()+[bauth, dauth]) - def _test_urls(self, urls, handlers, urlopen=_urlopen_with_retry): + def _test_urls(self, urls, handlers, retry=True): import socket import time import logging debug = logging.getLogger("test_urllib2").debug - urllib2.install_opener(urllib2.build_opener(*handlers)) + urlopen = urllib2.build_opener(*handlers).open + if retry: + urlopen = _wrap_with_retry_thrice(urlopen, urllib2.URLError) for url in urls: if isinstance(url, tuple): Modified: python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c Sun Jun 8 10:59:51 2008 @@ -30,6 +30,9 @@ #include #include +#ifndef HAVE_MACOS105_SDK +typedef SInt16 FSIORefNum; +#endif static PyObject *MacOS_Error; /* Exception MacOS.Error */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c Sun Jun 8 10:59:51 2008 @@ -7,6 +7,10 @@ #include "pymactoolbox.h" +#ifndef HAVE_OSX105_SDK +typedef SInt32 SRefCon; +#endif + /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ Modified: python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c Sun Jun 8 10:59:51 2008 @@ -7,6 +7,10 @@ #include "pymactoolbox.h" +#ifndef HAVE_MACOS105_SDK +typedef SInt16 FSIORefNum; +#endif + /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ @@ -193,10 +197,6 @@ static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self) { /* Cleanup of self->ob_itself goes here */ - FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions); - if (info->fileSec != NULL) { - CFRelease(info->fileSec); - } self->ob_type->tp_free((PyObject *)self); } Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sun Jun 8 10:59:51 2008 @@ -72,6 +72,14 @@ Library ------- +- Factored out the indentation cleaning from inspect.getdoc() into + inspect.cleandoc() to ease standalone use. + +- Issue #1798: Add ctypes calling convention that allows safe access + to errno. + +- Issue #2404: ctypes objects support the new pep3118 buffer interface + - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c Sun Jun 8 10:59:51 2008 @@ -294,6 +294,36 @@ /******************************************************************/ /* + Allocate a memory block for a pep3118 format string, copy prefix (if + non-null) and suffix into it. Returns NULL on failure, with the error + indicator set. If called with a suffix of NULL the error indicator must + already be set. + */ +char * +alloc_format_string(const char *prefix, const char *suffix) +{ + size_t len; + char *result; + + if (suffix == NULL) { + assert(PyErr_Occurred()); + return NULL; + } + len = strlen(suffix); + if (prefix) + len += strlen(prefix); + result = PyMem_Malloc(len + 1); + if (result == NULL) + return NULL; + if (prefix) + strcpy(result, prefix); + else + result[0] = '\0'; + strcat(result, suffix); + return result; +} + +/* StructType_Type - a meta type/class. Creating a new class using this one as __metaclass__ will call the contructor StructUnionType_new. It replaces the tp_dict member with a new instance of StgDict, and initializes the C @@ -874,6 +904,16 @@ return NULL; } + if (proto) { + StgDictObject *itemdict = PyType_stgdict(proto); + assert(itemdict); + stgdict->format = alloc_format_string("&", itemdict->format); + if (stgdict->format == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + } + /* create the new instance (which is a class, since we are a metatype!) */ result = (PyTypeObject *)PyType_Type.tp_new(type, args, kwds); @@ -1244,9 +1284,10 @@ StgDictObject *itemdict; PyObject *proto; PyObject *typedict; - int length; + long length; Py_ssize_t itemsize, itemalign; + char buf[32]; typedict = PyTuple_GetItem(args, 2); if (!typedict) @@ -1281,6 +1322,28 @@ return NULL; } + assert(itemdict->format); + if (itemdict->format[0] == '(') { + sprintf(buf, "(%ld,", length); + stgdict->format = alloc_format_string(buf, itemdict->format+1); + } else { + sprintf(buf, "(%ld)", length); + stgdict->format = alloc_format_string(buf, itemdict->format); + } + if (stgdict->format == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + stgdict->ndim = itemdict->ndim + 1; + stgdict->shape = PyMem_Malloc(sizeof(Py_ssize_t *) * stgdict->ndim); + if (stgdict->shape == NULL) { + Py_DECREF((PyObject *)stgdict); + return NULL; + } + stgdict->shape[0] = length; + memmove(&stgdict->shape[1], itemdict->shape, + sizeof(Py_ssize_t) * (stgdict->ndim - 1)); + itemsize = itemdict->size; if (length * itemsize < 0) { PyErr_SetString(PyExc_OverflowError, @@ -1768,6 +1831,8 @@ PyTypeObject *result; StgDictObject *stgdict; PyObject *proto; + const char *proto_str; + Py_ssize_t proto_len; PyMethodDef *ml; struct fielddesc *fmt; @@ -1778,17 +1843,34 @@ return NULL; proto = PyObject_GetAttrString((PyObject *)result, "_type_"); /* new ref */ - if (!proto - || !PyBytes_Check(proto) - || 1 != strlen(PyBytes_AS_STRING(proto)) - || !strchr(SIMPLE_TYPE_CHARS, PyBytes_AS_STRING(proto)[0])) { + if (!proto) { + PyErr_SetString(PyExc_AttributeError, + "class must define a '_type_' attribute"); + error: + Py_XDECREF(proto); + Py_XDECREF(result); + return NULL; + } + if (PyString_Check(proto)) { + proto_str = PyBytes_AS_STRING(proto); + proto_len = PyBytes_GET_SIZE(proto); + } else { + PyErr_SetString(PyExc_TypeError, + "class must define a '_type_' string attribute"); + goto error; + } + if (proto_len != 1) { + PyErr_SetString(PyExc_ValueError, + "class must define a '_type_' attribute " + "which must be a string of length 1"); + goto error; + } + if (!strchr(SIMPLE_TYPE_CHARS, *proto_str)) { PyErr_Format(PyExc_AttributeError, "class must define a '_type_' attribute which must be\n" "a single character string containing one of '%s'.", SIMPLE_TYPE_CHARS); - Py_XDECREF(proto); - Py_DECREF(result); - return NULL; + goto error; } fmt = getentry(PyBytes_AS_STRING(proto)); if (fmt == NULL) { @@ -1810,6 +1892,16 @@ stgdict->size = fmt->pffi_type->size; stgdict->setfunc = fmt->setfunc; stgdict->getfunc = fmt->getfunc; +#ifdef WORDS_BIGENDIAN + stgdict->format = alloc_format_string(">", proto_str); +#else + stgdict->format = alloc_format_string("<", proto_str); +#endif + if (stgdict->format == NULL) { + Py_DECREF(result); + Py_DECREF((PyObject *)stgdict); + return NULL; + } stgdict->paramfunc = SimpleType_paramfunc; /* @@ -1895,22 +1987,32 @@ if (type == &SimpleType_Type && fmt->setfunc_swapped && fmt->getfunc_swapped) { PyObject *swapped = CreateSwappedType(type, args, kwds, proto, fmt); + StgDictObject *sw_dict; if (swapped == NULL) { Py_DECREF(result); return NULL; } + sw_dict = PyType_stgdict(swapped); #ifdef WORDS_BIGENDIAN PyObject_SetAttrString((PyObject *)result, "__ctype_le__", swapped); PyObject_SetAttrString((PyObject *)result, "__ctype_be__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_be__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_le__", swapped); + /* We are creating the type for the OTHER endian */ + sw_dict->format = alloc_format_string("<", stgdict->format+1); #else PyObject_SetAttrString((PyObject *)result, "__ctype_be__", swapped); PyObject_SetAttrString((PyObject *)result, "__ctype_le__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_le__", (PyObject *)result); PyObject_SetAttrString(swapped, "__ctype_be__", swapped); + /* We are creating the type for the OTHER endian */ + sw_dict->format = alloc_format_string(">", stgdict->format+1); #endif Py_DECREF(swapped); + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } }; return (PyObject *)result; @@ -2166,6 +2268,13 @@ return NULL; stgdict->paramfunc = CFuncPtrType_paramfunc; + /* We do NOT expose the function signature in the format string. It + is impossible, generally, because the only requirement for the + argtypes items is that they have a .from_param method - we do not + know the types of the arguments (although, in practice, most + argtypes would be a ctypes type). + */ + stgdict->format = alloc_format_string(NULL, "X{}"); stgdict->flags |= TYPEFLAG_ISPOINTER; /* create the new instance (which is a class, @@ -2386,15 +2495,29 @@ { NULL }, }; -static Py_ssize_t CData_GetBuffer(PyObject *_self, Py_ssize_t seg, void **pptr) +static int CData_NewGetBuffer(PyObject *_self, Py_buffer *view, int flags) { CDataObject *self = (CDataObject *)_self; - if (seg != 0) { - /* Hm. Must this set an exception? */ - return -1; - } - *pptr = self->b_ptr; - return self->b_size; + StgDictObject *dict = PyObject_stgdict(_self); + Py_ssize_t i; + + if (view == NULL) return 0; + + view->buf = self->b_ptr; + view->len = self->b_size; + view->readonly = 0; + /* use default format character if not set */ + view->format = dict->format ? dict->format : "B"; + view->ndim = dict->ndim; + view->shape = dict->shape; + view->itemsize = self->b_size; + for (i = 0; i < view->ndim; ++i) { + view->itemsize /= dict->shape[i]; + } + view->strides = NULL; + view->suboffsets = NULL; + view->internal = NULL; + return 0; } static Py_ssize_t CData_GetSegcount(PyObject *_self, Py_ssize_t *lenp) @@ -2404,11 +2527,24 @@ return 1; } +static Py_ssize_t CData_GetBuffer(PyObject *_self, Py_ssize_t seg, void **pptr) +{ + CDataObject *self = (CDataObject *)_self; + if (seg != 0) { + /* Hm. Must this set an exception? */ + return -1; + } + *pptr = self->b_ptr; + return self->b_size; +} + static PyBufferProcs CData_as_buffer = { - CData_GetBuffer, - CData_GetBuffer, - CData_GetSegcount, - NULL, + (readbufferproc)CData_GetBuffer, + (writebufferproc)CData_GetBuffer, + (segcountproc)CData_GetSegcount, + (charbufferproc)NULL, + (getbufferproc)CData_NewGetBuffer, + (releasebufferproc)NULL, }; /* @@ -2497,7 +2633,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -3271,7 +3407,7 @@ thunk = AllocFunctionCallback(callable, dict->argtypes, dict->restype, - dict->flags & FUNCFLAG_CDECL); + dict->flags); if (!thunk) return NULL; @@ -3824,7 +3960,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Function Pointer", /* tp_doc */ (traverseproc)CFuncPtr_traverse, /* tp_traverse */ (inquiry)CFuncPtr_clear, /* tp_clear */ @@ -3967,7 +4103,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Structure base class", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4009,7 +4145,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "Union base class", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4406,7 +4542,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -4643,7 +4779,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -5043,7 +5179,7 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ &CData_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_NEWBUFFER | Py_TPFLAGS_BASETYPE, /* tp_flags */ "XXX to be provided", /* tp_doc */ (traverseproc)CData_traverse, /* tp_traverse */ (inquiry)CData_clear, /* tp_clear */ @@ -5394,6 +5530,8 @@ PyModule_AddObject(m, "FUNCFLAG_STDCALL", PyInt_FromLong(FUNCFLAG_STDCALL)); #endif PyModule_AddObject(m, "FUNCFLAG_CDECL", PyInt_FromLong(FUNCFLAG_CDECL)); + PyModule_AddObject(m, "FUNCFLAG_USE_ERRNO", PyInt_FromLong(FUNCFLAG_USE_ERRNO)); + PyModule_AddObject(m, "FUNCFLAG_USE_LASTERROR", PyInt_FromLong(FUNCFLAG_USE_LASTERROR)); PyModule_AddObject(m, "FUNCFLAG_PYTHONAPI", PyInt_FromLong(FUNCFLAG_PYTHONAPI)); PyModule_AddStringConstant(m, "__version__", "1.1.0"); Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c Sun Jun 8 10:59:51 2008 @@ -189,12 +189,15 @@ SETFUNC setfunc, PyObject *callable, PyObject *converters, + int flags, void **pArgs) { Py_ssize_t i; PyObject *result; PyObject *arglist = NULL; Py_ssize_t nArgs; + PyObject *error_object = NULL; + int *space; #ifdef WITH_THREAD PyGILState_STATE state = PyGILState_Ensure(); #endif @@ -271,8 +274,41 @@ #define CHECK(what, x) \ if (x == NULL) _AddTraceback(what, "_ctypes/callbacks.c", __LINE__ - 1), PyErr_Print() + if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) { + error_object = get_error_object(&space); + if (error_object == NULL) + goto Done; + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } +#endif + } + result = PyObject_CallObject(callable, arglist); CHECK("'calling callback function'", result); + +#ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } +#endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } + Py_XDECREF(error_object); + if ((restype != &ffi_type_void) && result) { PyObject *keep; assert(setfunc); @@ -322,6 +358,7 @@ p->setfunc, p->callable, p->converters, + p->flags, args); } @@ -351,7 +388,7 @@ CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int is_cdecl) + int flags) { int result; CThunkObject *p; @@ -371,6 +408,7 @@ goto error; } + p->flags = flags; for (i = 0; i < nArgs; ++i) { PyObject *cnv = PySequence_GetItem(converters, i); if (cnv == NULL) @@ -398,7 +436,7 @@ cc = FFI_DEFAULT_ABI; #if defined(MS_WIN32) && !defined(_WIN32_WCE) && !defined(MS_WIN64) - if (is_cdecl == 0) + if ((flags & FUNCFLAG_CDECL) == 0) cc = FFI_STDCALL; #endif result = ffi_prep_cif(&p->cif, cc, Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c Sun Jun 8 10:59:51 2008 @@ -83,7 +83,135 @@ #define DONT_USE_SEH #endif +/* + ctypes maintains thread-local storage that has space for two error numbers: + private copies of the system 'errno' value and, on Windows, the system error code + accessed by the GetLastError() and SetLastError() api functions. + + Foreign functions created with CDLL(..., use_errno=True), when called, swap + the system 'errno' value with the private copy just before the actual + function call, and swapped again immediately afterwards. The 'use_errno' + parameter defaults to False, in this case 'ctypes_errno' is not touched. + + On Windows, foreign functions created with CDLL(..., use_last_error=True) or + WinDLL(..., use_last_error=True) swap the system LastError value with the + ctypes private copy. + + The values are also swapped immeditately before and after ctypes callback + functions are called, if the callbacks are constructed using the new + optional use_errno parameter set to True: CFUNCTYPE(..., use_errno=TRUE) or + WINFUNCTYPE(..., use_errno=True). + + New ctypes functions are provided to access the ctypes private copies from + Python: + + - ctypes.set_errno(value) and ctypes.set_last_error(value) store 'value' in + the private copy and returns the previous value. + + - ctypes.get_errno() and ctypes.get_last_error() returns the current ctypes + private copies value. +*/ + +/* + This function creates and returns a thread-local Python object that has + space to store two integer error numbers; once created the Python object is + kept alive in the thread state dictionary as long as the thread itself. +*/ +PyObject * +get_error_object(int **pspace) +{ + PyObject *dict = PyThreadState_GetDict(); + PyObject *errobj; + static PyObject *error_object_name; + if (dict == 0) { + PyErr_SetString(PyExc_RuntimeError, + "cannot get thread state"); + return NULL; + } + if (error_object_name == NULL) { + error_object_name = PyString_InternFromString("ctypes.error_object"); + if (error_object_name == NULL) + return NULL; + } + errobj = PyDict_GetItem(dict, error_object_name); + if (errobj) + Py_INCREF(errobj); + else { + void *space = PyMem_Malloc(sizeof(int) * 2); + if (space == NULL) + return NULL; + memset(space, 0, sizeof(int) * 2); + errobj = PyCObject_FromVoidPtr(space, PyMem_Free); + if (errobj == NULL) + return NULL; + if (-1 == PyDict_SetItem(dict, error_object_name, + errobj)) { + Py_DECREF(errobj); + return NULL; + } + } + *pspace = (int *)PyCObject_AsVoidPtr(errobj); + return errobj; +} + +static PyObject * +get_error_internal(PyObject *self, PyObject *args, int index) +{ + int *space; + PyObject *errobj = get_error_object(&space); + PyObject *result; + + if (errobj == NULL) + return NULL; + result = PyInt_FromLong(space[index]); + Py_DECREF(errobj); + return result; +} + +static PyObject * +set_error_internal(PyObject *self, PyObject *args, int index) +{ + int new_errno, old_errno; + PyObject *errobj; + int *space; + + if (!PyArg_ParseTuple(args, "i", &new_errno)) + return NULL; + errobj = get_error_object(&space); + if (errobj == NULL) + return NULL; + old_errno = space[index]; + space[index] = new_errno; + Py_DECREF(errobj); + return PyInt_FromLong(old_errno); +} + +static PyObject * +get_errno(PyObject *self, PyObject *args) +{ + return get_error_internal(self, args, 0); +} + +static PyObject * +set_errno(PyObject *self, PyObject *args) +{ + return set_error_internal(self, args, 0); +} + #ifdef MS_WIN32 + +static PyObject * +get_last_error(PyObject *self, PyObject *args) +{ + return get_error_internal(self, args, 1); +} + +static PyObject * +set_last_error(PyObject *self, PyObject *args) +{ + return set_error_internal(self, args, 1); +} + PyObject *ComError; static TCHAR *FormatError(DWORD code) @@ -625,6 +753,8 @@ #ifdef WITH_THREAD PyThreadState *_save = NULL; /* For Py_BLOCK_THREADS and Py_UNBLOCK_THREADS */ #endif + PyObject *error_object = NULL; + int *space; ffi_cif cif; int cc; #ifdef MS_WIN32 @@ -656,11 +786,26 @@ return -1; } + if (flags & (FUNCFLAG_USE_ERRNO | FUNCFLAG_USE_LASTERROR)) { + error_object = get_error_object(&space); + if (error_object == NULL) + return -1; + } #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_UNBLOCK_THREADS #endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } #ifdef MS_WIN32 + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } #ifndef DONT_USE_SEH __try { #endif @@ -675,7 +820,18 @@ ; } #endif + if (flags & FUNCFLAG_USE_LASTERROR) { + int temp = space[1]; + space[1] = GetLastError(); + SetLastError(temp); + } #endif + if (flags & FUNCFLAG_USE_ERRNO) { + int temp = space[0]; + space[0] = errno; + errno = temp; + } + Py_XDECREF(error_object); #ifdef WITH_THREAD if ((flags & FUNCFLAG_PYTHONAPI) == 0) Py_BLOCK_THREADS @@ -1666,15 +1822,46 @@ return result; } +static PyObject * +buffer_info(PyObject *self, PyObject *arg) +{ + StgDictObject *dict = PyType_stgdict(arg); + PyObject *shape; + Py_ssize_t i; + + if (dict == NULL) + dict = PyObject_stgdict(arg); + if (dict == NULL) { + PyErr_SetString(PyExc_TypeError, + "not a ctypes type or object"); + return NULL; + } + shape = PyTuple_New(dict->ndim); + for (i = 0; i < (int)dict->ndim; ++i) + PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i])); + + if (PyErr_Occurred()) { + Py_DECREF(shape); + return NULL; + } + return Py_BuildValue("siN", dict->format, dict->ndim, shape); +} + PyMethodDef module_methods[] = { + {"get_errno", get_errno, METH_NOARGS}, + {"set_errno", set_errno, METH_VARARGS}, {"POINTER", POINTER, METH_O }, {"pointer", pointer, METH_O }, {"_unpickle", unpickle, METH_VARARGS }, + {"_buffer_info", buffer_info, METH_O, + "Return buffer interface information (for testing only)"}, {"resize", resize, METH_VARARGS, "Resize the memory buffer of a ctypes instance"}, #ifdef CTYPES_UNICODE {"set_conversion_mode", set_conversion_mode, METH_VARARGS, set_conversion_mode_doc}, #endif #ifdef MS_WIN32 + {"get_last_error", get_last_error, METH_NOARGS}, + {"set_last_error", set_last_error, METH_VARARGS}, {"CopyComPointer", copy_com_pointer, METH_VARARGS, copy_com_pointer_doc}, {"FormatError", format_error, METH_VARARGS, format_error_doc}, {"LoadLibrary", load_library, METH_VARARGS, load_library_doc}, Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/ctypes.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/ctypes.h (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/ctypes.h Sun Jun 8 10:59:51 2008 @@ -87,6 +87,7 @@ PyObject_VAR_HEAD ffi_closure *pcl; /* the C callable */ ffi_cif cif; + int flags; PyObject *converters; PyObject *callable; PyObject *restype; @@ -185,7 +186,7 @@ extern CThunkObject *AllocFunctionCallback(PyObject *callable, PyObject *converters, PyObject *restype, - int stdcall); + int flags); /* a table entry describing a predefined ctypes type */ struct fielddesc { char code; @@ -235,6 +236,14 @@ PyObject *restype; /* CDataObject or NULL */ PyObject *checker; int flags; /* calling convention and such */ + + /* pep3118 fields, pointers neeed PyMem_Free */ + char *format; + int ndim; + Py_ssize_t *shape; +/* Py_ssize_t *strides; */ /* unused in ctypes */ +/* Py_ssize_t *suboffsets; */ /* unused in ctypes */ + } StgDictObject; /**************************************************************** @@ -303,6 +312,8 @@ #define FUNCFLAG_CDECL 0x1 #define FUNCFLAG_HRESULT 0x2 #define FUNCFLAG_PYTHONAPI 0x4 +#define FUNCFLAG_USE_ERRNO 0x8 +#define FUNCFLAG_USE_LASTERROR 0x10 #define TYPEFLAG_ISPOINTER 0x100 #define TYPEFLAG_HASPOINTER 0x200 @@ -415,11 +426,13 @@ extern void _AddTraceback(char *, char *, int); extern PyObject *CData_FromBaseObj(PyObject *type, PyObject *base, Py_ssize_t index, char *adr); +extern char *alloc_format_string(const char *prefix, const char *suffix); /* XXX better name needed! */ extern int IsSimpleSubType(PyObject *obj); extern PyObject *_pointer_type_cache; +PyObject *get_error_object(int **pspace); #ifdef MS_WIN32 extern PyObject *ComError; Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/stgdict.c Sun Jun 8 10:59:51 2008 @@ -6,6 +6,7 @@ #include #ifdef MS_WIN32 #include +#include #endif #include "ctypes.h" @@ -24,6 +25,9 @@ { if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0) return -1; + self->format = NULL; + self->ndim = 0; + self->shape = NULL; return 0; } @@ -42,6 +46,8 @@ StgDict_dealloc(StgDictObject *self) { StgDict_clear(self); + PyMem_Free(self->format); + PyMem_Free(self->shape); PyMem_Free(self->ffi_type_pointer.elements); PyDict_Type.tp_dealloc((PyObject *)self); } @@ -54,6 +60,10 @@ StgDict_clear(dst); PyMem_Free(dst->ffi_type_pointer.elements); + PyMem_Free(dst->format); + dst->format = NULL; + PyMem_Free(dst->shape); + dst->shape = NULL; dst->ffi_type_pointer.elements = NULL; d = (char *)dst; @@ -68,6 +78,20 @@ Py_XINCREF(dst->restype); Py_XINCREF(dst->checker); + if (src->format) { + dst->format = PyMem_Malloc(strlen(src->format) + 1); + if (dst->format == NULL) + return -1; + strcpy(dst->format, src->format); + } + if (src->shape) { + dst->shape = PyMem_Malloc(sizeof(Py_ssize_t) * src->ndim); + if (dst->shape == NULL) + return -1; + memcpy(dst->shape, src->shape, + sizeof(Py_ssize_t) * src->ndim); + } + if (src->ffi_type_pointer.elements == NULL) return 0; size = sizeof(ffi_type *) * (src->length + 1); @@ -349,6 +373,11 @@ return -1; } + if (stgdict->format) { + PyMem_Free(stgdict->format); + stgdict->format = NULL; + } + if (stgdict->ffi_type_pointer.elements) PyMem_Free(stgdict->ffi_type_pointer.elements); @@ -387,6 +416,15 @@ ffi_ofs = 0; } + if (isStruct && !isPacked) { + stgdict->format = alloc_format_string(NULL, "T{"); + } else { + /* PEP3118 doesn't support union, or packed structures (well, + only standard packing, but we dont support the pep for + that). Use 'B' for bytes. */ + stgdict->format = alloc_format_string(NULL, "B"); + } + #define realdict ((PyObject *)&stgdict->dict) for (i = 0; i < len; ++i) { PyObject *name = NULL, *desc = NULL; @@ -451,6 +489,24 @@ } } else bitsize = 0; + if (isStruct && !isPacked) { + char *fieldfmt = dict->format ? dict->format : "B"; + char *fieldname = PyString_AsString(name); + char *ptr; + Py_ssize_t len = strlen(fieldname) + strlen(fieldfmt); + char *buf = alloca(len + 2 + 1); + + sprintf(buf, "%s:%s:", fieldfmt, fieldname); + + ptr = stgdict->format; + stgdict->format = alloc_format_string(stgdict->format, buf); + PyMem_Free(ptr); + + if (stgdict->format == NULL) { + Py_DECREF(pair); + return -1; + } + } if (isStruct) { prop = CField_FromDesc(desc, i, &field_size, bitsize, &bitofs, @@ -481,6 +537,13 @@ Py_DECREF(prop); } #undef realdict + + if (isStruct && !isPacked) { + stgdict->format = alloc_format_string(stgdict->format, "}"); + if (stgdict->format == NULL) + return -1; + } + if (!isStruct) size = union_size; Modified: python/branches/tlee-ast-optimize/Modules/_heapqmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_heapqmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_heapqmodule.c Sun Jun 8 10:59:51 2008 @@ -8,6 +8,25 @@ #include "Python.h" +/* Older implementations of heapq used Py_LE for comparisons. Now, it uses + Py_LT so it will match min(), sorted(), and bisect(). Unfortunately, some + client code (Twisted for example) relied on Py_LE, so this little function + restores compatability by trying both. +*/ +static int +cmp_lt(PyObject *x, PyObject *y) +{ + int cmp; + cmp = PyObject_RichCompareBool(x, y, Py_LT); + if (cmp == -1 && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + cmp = PyObject_RichCompareBool(y, x, Py_LE); + if (cmp != -1) + cmp = 1 - cmp; + } + return cmp; +} + static int _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) { @@ -28,7 +47,7 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(newitem, parent, Py_LT); + cmp = cmp_lt(newitem, parent); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -68,10 +87,9 @@ /* Set childpos to index of smaller child. */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = PyObject_RichCompareBool( + cmp = cmp_lt( PyList_GET_ITEM(heap, childpos), - PyList_GET_ITEM(heap, rightpos), - Py_LT); + PyList_GET_ITEM(heap, rightpos)); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -214,7 +232,7 @@ return item; } - cmp = PyObject_RichCompareBool(PyList_GET_ITEM(heap, 0), item, Py_LT); + cmp = cmp_lt(PyList_GET_ITEM(heap, 0), item); if (cmp == -1) return NULL; if (cmp == 0) { @@ -313,7 +331,7 @@ else goto sortit; } - cmp = PyObject_RichCompareBool(sol, elem, Py_LT); + cmp = cmp_lt(sol, elem); if (cmp == -1) { Py_DECREF(elem); goto fail; @@ -368,7 +386,7 @@ while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); - cmp = PyObject_RichCompareBool(parent, newitem, Py_LT); + cmp = cmp_lt(parent, newitem); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -408,10 +426,9 @@ /* Set childpos to index of smaller child. */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = PyObject_RichCompareBool( + cmp = cmp_lt( PyList_GET_ITEM(heap, rightpos), - PyList_GET_ITEM(heap, childpos), - Py_LT); + PyList_GET_ITEM(heap, childpos)); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -484,7 +501,7 @@ else goto sortit; } - cmp = PyObject_RichCompareBool(elem, los, Py_LT); + cmp = cmp_lt(elem, los); if (cmp == -1) { Py_DECREF(elem); goto fail; Modified: python/branches/tlee-ast-optimize/Objects/abstract.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/abstract.c (original) +++ python/branches/tlee-ast-optimize/Objects/abstract.c Sun Jun 8 10:59:51 2008 @@ -685,12 +685,6 @@ int readonly, int flags) { if (view == NULL) return 0; - if (((flags & PyBUF_LOCK) == PyBUF_LOCK) && - readonly != 0) { - PyErr_SetString(PyExc_BufferError, - "Cannot lock this object."); - return -1; - } if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && (readonly == 1)) { PyErr_SetString(PyExc_BufferError, Modified: python/branches/tlee-ast-optimize/Python/ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ast.c (original) +++ python/branches/tlee-ast-optimize/Python/ast.c Sun Jun 8 10:59:51 2008 @@ -1364,7 +1364,7 @@ case BACKQUOTE: { /* repr */ expr_ty expression; if (Py_Py3kWarningFlag) { - if (PyErr_WarnExplicit(PyExc_DeprecationWarning, + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, "backquote not supported in 3.x; use repr()", c->c_filename, LINENO(n), NULL, NULL)) { Modified: python/branches/tlee-ast-optimize/configure ============================================================================== --- python/branches/tlee-ast-optimize/configure (original) +++ python/branches/tlee-ast-optimize/configure Sun Jun 8 10:59:51 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 63690 . +# From configure.in Revision: 63955 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -2072,7 +2072,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0]) + OpenBSD/2.* | OpenBSD/3.[0123456789] | OpenBSD/4.[0123]) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -4659,6 +4659,7 @@ BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" fi ;; @@ -12400,6 +12401,7 @@ echo "${ECHO_T}$enable_toolbox_glue" >&6; } + case $ac_sys_system/$ac_sys_release in Darwin/[01567]\..*) OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000" @@ -12746,6 +12748,7 @@ echo "${ECHO_T}$LINKFORSHARED" >&6; } + { echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 echo $ECHO_N "checking CFLAGSFORSHARED... $ECHO_C" >&6; } if test ! "$LIBRARY" = "$LDLIBRARY" @@ -15309,6 +15312,58 @@ fi fi +{ echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 +echo $ECHO_N "checking for OSX 10.5 SDK or later... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +FSIORefNum fRef = 0 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OSX105_SDK 1 +_ACEOF + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Check for --with-doc-strings { echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 echo $ECHO_N "checking for --with-doc-strings... $ECHO_C" >&6; } Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Sun Jun 8 10:59:51 2008 @@ -248,7 +248,7 @@ # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0@:>@) + OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@) define_xopen_source=no # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is # also defined. This can be overridden by defining _BSD_SOURCE @@ -918,6 +918,7 @@ BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}" + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" fi ;; @@ -1320,6 +1321,17 @@ AC_CHECK_SIZEOF(long long, 8) fi +AC_MSG_CHECKING(for long double support) +have_long_double=no +AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [ + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.]) + have_long_double=yes +]) +AC_MSG_RESULT($have_long_double) +if test "$have_long_long" = yes ; then +AC_CHECK_SIZEOF(long double, 12) +fi + AC_MSG_CHECKING(for _Bool support) have_c99_bool=no AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [ @@ -1456,6 +1468,7 @@ esac AC_MSG_RESULT($enable_toolbox_glue) + AC_SUBST(OTHER_LIBTOOL_OPT) case $ac_sys_system/$ac_sys_release in Darwin/@<:@01567@:>@\..*) @@ -1781,6 +1794,7 @@ fi AC_MSG_RESULT($LINKFORSHARED) + AC_SUBST(CFLAGSFORSHARED) AC_MSG_CHECKING(CFLAGSFORSHARED) if test ! "$LIBRARY" = "$LDLIBRARY" @@ -2297,6 +2311,13 @@ fi fi +AC_MSG_CHECKING(for OSX 10.5 SDK or later) +AC_TRY_COMPILE([#include ], FSIORefNum fRef = 0, + AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) +) + # Check for --with-doc-strings AC_MSG_CHECKING(for --with-doc-strings) AC_ARG_WITH(doc-strings, Modified: python/branches/tlee-ast-optimize/pyconfig.h.in ============================================================================== --- python/branches/tlee-ast-optimize/pyconfig.h.in (original) +++ python/branches/tlee-ast-optimize/pyconfig.h.in Sun Jun 8 10:59:51 2008 @@ -426,6 +426,9 @@ /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY +/* Define if compiling using MacOS X 10.5 SDK or later. */ +#undef HAVE_OSX105_SDK + /* Define to 1 if you have the `pathconf' function. */ #undef HAVE_PATHCONF @@ -489,9 +492,6 @@ /* Define if you have readline 4.2 */ #undef HAVE_RL_COMPLETION_MATCHES -/* Define when using libedit's readline emulation */ -#undef HAVE_RL_DISPM_VFUNC - /* Define if you have readline 4.0 */ #undef HAVE_RL_PRE_INPUT_HOOK From python-checkins at python.org Sun Jun 8 16:57:53 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 8 Jun 2008 16:57:53 +0200 (CEST) Subject: [Python-checkins] r64039 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080608145753.CB1301E4004@bag.python.org> Author: guilherme.polo Date: Sun Jun 8 16:57:53 2008 New Revision: 64039 Log: _dict_from_tcltuple now converts generic Tcl objects to their string representation; Treeview's heading now, more correctly, uses _val_or_dict instead of a plain tk.call Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sun Jun 8 16:57:53 2008 @@ -268,6 +268,10 @@ # could be a statespec val = _list_from_statespec(val) + elif hasattr(val, 'typename'): + # some other Tcl object + val = str(val) + opts.append((str(opt)[opt_start:], val)) return dict(opts) @@ -1191,7 +1195,7 @@ # callback not registered yet, do it now kw['command'] = self.master.register(cmd, self._substitute) - return self.tk.call(self._w, "heading", column, *(_format_optdict(kw))) + return _val_or_dict(kw, self.tk.call, self._w, 'heading', column) def identify(self, component, x, y): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sun Jun 8 16:57:53 2008 @@ -268,6 +268,10 @@ # could be a statespec val = _list_from_statespec(val) + elif hasattr(val, 'typename'): + # some other Tcl object + val = str(val) + opts.append((str(opt)[opt_start:], val)) return dict(opts) @@ -1191,7 +1195,7 @@ # callback not registered yet, do it now kw['command'] = self.master.register(cmd, self._substitute) - return self.tk.call(self._w, "heading", column, *(_format_optdict(kw))) + return _val_or_dict(kw, self.tk.call, self._w, 'heading', column) def identify(self, component, x, y): From python-checkins at python.org Sun Jun 8 17:45:23 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 8 Jun 2008 17:45:23 +0200 (CEST) Subject: [Python-checkins] r64040 - python/trunk/Python/ast.c Message-ID: <20080608154523.945151E4005@bag.python.org> Author: benjamin.peterson Date: Sun Jun 8 17:45:23 2008 New Revision: 64040 Log: add an ast_warn helper function to make adding those Py3k warnings easier Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sun Jun 8 17:45:23 2008 @@ -113,6 +113,19 @@ PyErr_Restore(type, value, tback); } +static int +ast_warn(struct compiling *c, const node *n, char *msg) +{ + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, LINENO(n), + NULL, NULL) < 0) { + /* if -Werr, change it to a SyntaxError */ + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SyntaxWarning)) + ast_error(n, msg); + return 0; + } + return 1; +} + /* num_stmts() returns number of contained statements. Use this routine to determine how big a sequence is needed for @@ -1363,14 +1376,9 @@ } case BACKQUOTE: { /* repr */ expr_ty expression; - if (Py_Py3kWarningFlag) { - if (PyErr_WarnExplicit(PyExc_SyntaxWarning, - "backquote not supported in 3.x; use repr()", - c->c_filename, LINENO(n), - NULL, NULL)) { + if (Py_Py3kWarningFlag && + !ast_warn(c, n, "backquote not supported in 3.x; use repr()")) return NULL; - } - } expression = ast_for_testlist(c, CHILD(n, 1)); if (!expression) return NULL; From buildbot at python.org Sun Jun 8 18:04:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 08 Jun 2008 16:04:03 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080608160403.C93211E4011@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/114 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 8 20:17:20 2008 From: python-checkins at python.org (armin.ronacher) Date: Sun, 8 Jun 2008 20:17:20 +0200 (CEST) Subject: [Python-checkins] r64042 - doctools/trunk/sphinx/environment.py Message-ID: <20080608181720.67DFB1E4004@bag.python.org> Author: armin.ronacher Date: Sun Jun 8 20:17:20 2008 New Revision: 64042 Log: env is set now to nodes after unpickling. Modified: doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Sun Jun 8 20:17:20 2008 @@ -698,6 +698,7 @@ doctree = pickle.load(f) finally: f.close() + doctree.settings.env = self doctree.reporter = Reporter(self.doc2path(docname), 2, 4, stream=RedirStream(self._warnfunc)) return doctree From python-checkins at python.org Sun Jun 8 22:12:42 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 8 Jun 2008 22:12:42 +0200 (CEST) Subject: [Python-checkins] r64043 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080608201242.756131E4004@bag.python.org> Author: guilherme.polo Date: Sun Jun 8 22:12:42 2008 New Revision: 64043 Log: The "forget" alias is not needed for Panedwindow as it is already done at Tkinter Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sun Jun 8 22:12:42 2008 @@ -901,9 +901,6 @@ Widget.__init__(self, master, "ttk::panedwindow", kw) - forget = Tkinter.PanedWindow.remove - - def insert(self, pos, child, **kw): """Inserts a pane at the specified positions. Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sun Jun 8 22:12:42 2008 @@ -901,9 +901,6 @@ Widget.__init__(self, master, "ttk::panedwindow", kw) - forget = tkinter.PanedWindow.remove - - def insert(self, pos, child, **kw): """Inserts a pane at the specified positions. From python-checkins at python.org Mon Jun 9 00:52:37 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 9 Jun 2008 00:52:37 +0200 (CEST) Subject: [Python-checkins] r64044 - in python/trunk: Lib/test/test_py3kwarn.py Python/ast.c Message-ID: <20080608225237.E82B91E4004@bag.python.org> Author: benjamin.peterson Date: Mon Jun 9 00:52:37 2008 New Revision: 64044 Log: Warn about assigning to Py3k keywords (True and False) Modified: python/trunk/Lib/test/test_py3kwarn.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Mon Jun 9 00:52:37 2008 @@ -16,6 +16,55 @@ exec "`2`" in {} self.assertWarning(None, w, expected) + def test_bool_assign(self): + # So we don't screw up our globals + def safe_exec(expr): + def f(**kwargs): pass + exec expr in {'f' : f} + + expected = "assignment to True or False is forbidden in 3.x" + with catch_warning() as w: + safe_exec("True = False") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("False = True") + self.assertWarning(None, w, expected) + with catch_warning() as w: + try: + safe_exec("obj.False = True") + except NameError: pass + self.assertWarning(None, w, expected) + with catch_warning() as w: + try: + safe_exec("obj.True = False") + except NameError: pass + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def False(): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def True(): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("class False: pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("class True: pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def f(True=43): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def f(False=None): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("f(False=True)") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("f(True=1)") + self.assertWarning(None, w, expected) + + def test_type_inequality_comparisons(self): expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Mon Jun 9 00:52:37 2008 @@ -126,6 +126,17 @@ return 1; } +static int +forbidden_check(struct compiling *c, const node *n, const char *x) +{ + if (!strcmp(x, "None")) + return ast_error(n, "assignment to None"); + if (Py_Py3kWarningFlag && !(strcmp(x, "True") && strcmp(x, "False")) && + !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) + return 0; + return 1; +} + /* num_stmts() returns number of contained statements. Use this routine to determine how big a sequence is needed for @@ -364,20 +375,18 @@ switch (e->kind) { case Attribute_kind: - if (ctx == Store && - !strcmp(PyBytes_AS_STRING(e->v.Attribute.attr), "None")) { - return ast_error(n, "assignment to None"); - } + if (ctx == Store && !forbidden_check(c, n, + PyBytes_AS_STRING(e->v.Attribute.attr))) + return 0; e->v.Attribute.ctx = ctx; break; case Subscript_kind: e->v.Subscript.ctx = ctx; break; case Name_kind: - if (ctx == Store && - !strcmp(PyBytes_AS_STRING(e->v.Name.id), "None")) { - return ast_error(n, "assignment to None"); - } + if (ctx == Store && !forbidden_check(c, n, + PyBytes_AS_STRING(e->v.Name.id))) + return 0; e->v.Name.ctx = ctx; break; case List_kind: @@ -595,10 +604,8 @@ /* fpdef_node is either a NAME or an fplist */ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { - if (!strcmp(STR(child), "None")) { - ast_error(child, "assignment to None"); - return NULL; - } + if (!forbidden_check(c, n, STR(child))) + return NULL; arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), child->n_col_offset, c->c_arena); } @@ -708,10 +715,8 @@ } if (TYPE(CHILD(ch, 0)) == NAME) { expr_ty name; - if (!strcmp(STR(CHILD(ch, 0)), "None")) { - ast_error(CHILD(ch, 0), "assignment to None"); + if (!forbidden_check(c, n, STR(CHILD(ch, 0)))) goto error; - } name = Name(NEW_IDENTIFIER(CHILD(ch, 0)), Param, LINENO(ch), ch->n_col_offset, c->c_arena); @@ -723,18 +728,14 @@ i += 2; /* the name and the comma */ break; case STAR: - if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); + if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; - } vararg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; break; case DOUBLESTAR: - if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); + if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; - } kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; break; @@ -857,10 +858,8 @@ name = NEW_IDENTIFIER(CHILD(n, name_i)); if (!name) return NULL; - else if (!strcmp(STR(CHILD(n, name_i)), "None")) { - ast_error(CHILD(n, name_i), "assignment to None"); + else if (!forbidden_check(c, CHILD(n, name_i), STR(CHILD(n, name_i)))) return NULL; - } args = ast_for_arguments(c, CHILD(n, name_i + 1)); if (!args) return NULL; @@ -1929,10 +1928,8 @@ return NULL; } key = e->v.Name.id; - if (!strcmp(PyBytes_AS_STRING(key), "None")) { - ast_error(CHILD(ch, 0), "assignment to None"); + if (!forbidden_check(c, CHILD(ch, 0), PyBytes_AS_STRING(key))) return NULL; - } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL; @@ -2059,10 +2056,9 @@ return NULL; case Name_kind: { const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); - if (var_name[0] == 'N' && !strcmp(var_name, "None")) { - ast_error(ch, "assignment to None"); + if ((var_name[0] == 'N' || var_name[0] == 'T' || var_name[0] == 'F') && + !forbidden_check(c, ch, var_name)) return NULL; - } break; } case Attribute_kind: @@ -3005,10 +3001,8 @@ REQ(n, classdef); - if (!strcmp(STR(CHILD(n, 1)), "None")) { - ast_error(n, "assignment to None"); + if (!forbidden_check(c, n, STR(CHILD(n, 1)))) return NULL; - } if (NCH(n) == 4) { s = ast_for_suite(c, CHILD(n, 3)); From python-checkins at python.org Mon Jun 9 01:00:11 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 9 Jun 2008 01:00:11 +0200 (CEST) Subject: [Python-checkins] r64045 - in python/trunk: Lib/test/test_py3kwarn.py Python/ast.c Message-ID: <20080608230011.62DB71E4004@bag.python.org> Author: benjamin.peterson Date: Mon Jun 9 01:00:00 2008 New Revision: 64045 Log: warn about parameter tuple unpacking Modified: python/trunk/Lib/test/test_py3kwarn.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Mon Jun 9 01:00:00 2008 @@ -173,6 +173,12 @@ with catch_warning() as w: self.assertWarning(set(), w, expected) + def test_tuple_parameter_unpacking(self): + expected = "tuple parameter unpacking has been removed in 3.x" + with catch_warning() as w: + exec "def f((a, b)): pass" + self.assertWarning(None, w, expected) + def test_buffer(self): expected = 'buffer() not supported in 3.x; use memoryview()' with catch_warning() as w: Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Mon Jun 9 01:00:00 2008 @@ -701,6 +701,9 @@ /* def foo((x)): is not complex, special case. */ if (NCH(ch) != 1) { /* We have complex arguments, setup for unpacking. */ + if (Py_Py3kWarningFlag && !ast_warn(c, ch, + "tuple parameter unpacking has been removed in 3.x")) + goto error; asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); if (!asdl_seq_GET(args, k-1)) goto error; From buildbot at python.org Mon Jun 9 02:01:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 00:01:28 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080609000130.0AEB81E4004@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1452 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 9 03:28:30 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 9 Jun 2008 03:28:30 +0200 (CEST) Subject: [Python-checkins] r64047 - in python/trunk: Doc/library/collections.rst Lib/collections.py Lib/test/test_collections.py Message-ID: <20080609012830.DB53F1E4004@bag.python.org> Author: raymond.hettinger Date: Mon Jun 9 03:28:30 2008 New Revision: 64047 Log: Issue3065: Fixed pickling of named tuples. Added tests. Modified: python/trunk/Doc/library/collections.rst python/trunk/Lib/collections.py python/trunk/Lib/test/test_collections.py Modified: python/trunk/Doc/library/collections.rst ============================================================================== --- python/trunk/Doc/library/collections.rst (original) +++ python/trunk/Doc/library/collections.rst Mon Jun 9 03:28:30 2008 @@ -539,6 +539,9 @@ if kwds: raise ValueError('Got unexpected field names: %r' % kwds.keys()) return result + + def __getnewargs__(self): + return tuple(self) x = property(itemgetter(0)) y = property(itemgetter(1)) Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Mon Jun 9 03:28:30 2008 @@ -82,7 +82,9 @@ result = self._make(map(kwds.pop, %(field_names)r, self)) if kwds: raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) - return result \n\n''' % locals() + return result \n + def __getnewargs__(self): + return tuple(self) \n\n''' % locals() for i, name in enumerate(field_names): template += ' %s = property(itemgetter(%d))\n' % (name, i) if verbose: Modified: python/trunk/Lib/test/test_collections.py ============================================================================== --- python/trunk/Lib/test/test_collections.py (original) +++ python/trunk/Lib/test/test_collections.py Mon Jun 9 03:28:30 2008 @@ -1,12 +1,14 @@ import unittest, doctest from test import test_support from collections import namedtuple +import pickle, cPickle, copy from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable from collections import Set, MutableSet from collections import Mapping, MutableMapping from collections import Sequence, MutableSequence +TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests class TestNamedTuple(unittest.TestCase): @@ -108,7 +110,7 @@ self.assertEqual(Dot(1)._replace(d=999), (999,)) self.assertEqual(Dot(1)._fields, ('d',)) - n = 10000 + n = 5000 import string, random names = list(set(''.join([random.choice(string.ascii_letters) for j in range(10)]) for i in range(n))) @@ -130,6 +132,23 @@ self.assertEqual(b2, tuple(b2_expected)) self.assertEqual(b._fields, tuple(names)) + def test_pickle(self): + p = TestNT(x=10, y=20, z=30) + for module in pickle, cPickle: + loads = getattr(module, 'loads') + dumps = getattr(module, 'dumps') + for protocol in -1, 0, 1, 2: + q = loads(dumps(p, protocol)) + self.assertEqual(p, q) + self.assertEqual(p._fields, q._fields) + + def test_copy(self): + p = TestNT(x=10, y=20, z=30) + for copier in copy.copy, copy.deepcopy: + q = copier(p) + self.assertEqual(p, q) + self.assertEqual(p._fields, q._fields) + class TestOneTrickPonyABCs(unittest.TestCase): def test_Hashable(self): From python-checkins at python.org Mon Jun 9 06:59:02 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 9 Jun 2008 06:59:02 +0200 (CEST) Subject: [Python-checkins] r64048 - in python/trunk: Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Include/bytesobject.h Include/object.h Include/py_curses.h Include/pyerrors.h Include/pyport.h Include/pythonrun.h Include/stringobject.h Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/ae/_AEmodule.c Mac/Modules/cf/_CFmodule.c Mac/Modules/cf/pycfbridge.c Mac/Modules/file/_Filemodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndihooks.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Modules/_bytesio.c Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_csv.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_curses_panel.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_heapqmodule.c Modules/_hotshot.c Modules/_json.c Modules/_localemodule.c Modules/_lsprof.c Modules/_sqlite/cache.c Modules/_sqlite/connection.c Modules/_sqlite/connection.h Modules/_sqlite/cursor.c Modules/_sqlite/module.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_sre.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/almodule.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/bsddbmodule.c Modules/bz2module.c Modules/cPickle.c Modules/cStringIO.c Modules/cdmodule.c Modules/cgensupport.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/clmodule.c Modules/datetimemodule.c Modules/dbmmodule.c Modules/dlmodule.c Modules/errnomodule.c Modules/fcntlmodule.c Modules/flmodule.c Modules/fmmodule.c Modules/gcmodule.c Modules/gdbmmodule.c Modules/glmodule.c Modules/grpmodule.c Modules/imageop.c Modules/imgfile.c Modules/itertoolsmodule.c Modules/linuxaudiodev.c Modules/main.c Modules/md5module.c Modules/mmapmodule.c Modules/nismodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pwdmodule.c Modules/pyexpat.c Modules/readline.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/shamodule.c Modules/socketmodule.c Modules/spwdmodule.c Modules/stropmodule.c Modules/sunaudiodev.c Modules/svmodule.c Modules/syslogmodule.c Modules/termios.c Modules/threadmodule.c Modules/timemodule.c Modules/unicodedata.c Modules/zipimport.c Modules/zlibmodule.c Objects/abstract.c Objects/boolobject.c Objects/bufferobject.c Objects/bytes_methods.c Objects/bytesobject.c Objects/cellobject.c Objects/classobject.c Objects/codeobject.c Objects/complexobject.c Objects/descrobject.c Objects/dictobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/methodobject.c Objects/moduleobject.c Objects/object.c Objects/rangeobject.c Objects/setobject.c Objects/sliceobject.c Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/structseq.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c PC/_msi.c PC/_subprocess.c PC/_winreg.c PC/msvcrtmodule.c PC/winsound.c Parser/asdl_c.py Parser/tokenizer.c Python/Python-ast.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/codecs.c Python/compile.c Python/errors.c Python/future.c Python/getargs.c Python/import.c Python/mactoolboxglue.c Python/marshal.c Python/modsupport.c Python/peephole.c Python/pystrtod.c Python/pythonrun.c Python/structmember.c Python/symtable.c Python/sysmodule.c Python/traceback.c RISCOS/Modules/drawfmodule.c RISCOS/Modules/riscosmodule.c RISCOS/Modules/swimodule.c Message-ID: <20080609045902.A675E1E4004@bag.python.org> Author: gregory.p.smith Date: Mon Jun 9 06:58:54 2008 New Revision: 64048 Log: This reverts r63675 based on the discussion in this thread: http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread. Modified: python/trunk/Doc/includes/noddy2.c python/trunk/Doc/includes/noddy3.c python/trunk/Doc/includes/noddy4.c python/trunk/Doc/includes/run-func.c python/trunk/Include/bytesobject.h python/trunk/Include/object.h python/trunk/Include/py_curses.h python/trunk/Include/pyerrors.h python/trunk/Include/pyport.h python/trunk/Include/pythonrun.h python/trunk/Include/stringobject.h python/trunk/Mac/Modules/MacOS.c python/trunk/Mac/Modules/Nav.c python/trunk/Mac/Modules/ae/_AEmodule.c python/trunk/Mac/Modules/cf/_CFmodule.c python/trunk/Mac/Modules/cf/pycfbridge.c python/trunk/Mac/Modules/file/_Filemodule.c python/trunk/Mac/Modules/qd/_Qdmodule.c python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c python/trunk/Mac/Modules/res/_Resmodule.c python/trunk/Mac/Modules/scrap/_Scrapmodule.c python/trunk/Mac/Modules/snd/_Sndihooks.c python/trunk/Mac/Modules/win/_Winmodule.c python/trunk/Makefile.pre.in python/trunk/Modules/_bytesio.c python/trunk/Modules/_codecsmodule.c python/trunk/Modules/_collectionsmodule.c python/trunk/Modules/_csv.c python/trunk/Modules/_ctypes/_ctypes.c python/trunk/Modules/_ctypes/callbacks.c python/trunk/Modules/_ctypes/callproc.c python/trunk/Modules/_ctypes/cfield.c python/trunk/Modules/_curses_panel.c python/trunk/Modules/_cursesmodule.c python/trunk/Modules/_elementtree.c python/trunk/Modules/_fileio.c python/trunk/Modules/_hashopenssl.c python/trunk/Modules/_heapqmodule.c python/trunk/Modules/_hotshot.c python/trunk/Modules/_json.c python/trunk/Modules/_localemodule.c python/trunk/Modules/_lsprof.c python/trunk/Modules/_sqlite/cache.c python/trunk/Modules/_sqlite/connection.c python/trunk/Modules/_sqlite/connection.h python/trunk/Modules/_sqlite/cursor.c python/trunk/Modules/_sqlite/module.c python/trunk/Modules/_sqlite/row.c python/trunk/Modules/_sqlite/statement.c python/trunk/Modules/_sre.c python/trunk/Modules/_ssl.c python/trunk/Modules/_struct.c python/trunk/Modules/_testcapimodule.c python/trunk/Modules/_tkinter.c python/trunk/Modules/almodule.c python/trunk/Modules/arraymodule.c python/trunk/Modules/audioop.c python/trunk/Modules/binascii.c python/trunk/Modules/bsddbmodule.c python/trunk/Modules/bz2module.c python/trunk/Modules/cPickle.c python/trunk/Modules/cStringIO.c python/trunk/Modules/cdmodule.c python/trunk/Modules/cgensupport.c python/trunk/Modules/cjkcodecs/cjkcodecs.h python/trunk/Modules/cjkcodecs/multibytecodec.c python/trunk/Modules/clmodule.c python/trunk/Modules/datetimemodule.c python/trunk/Modules/dbmmodule.c python/trunk/Modules/dlmodule.c python/trunk/Modules/errnomodule.c python/trunk/Modules/fcntlmodule.c python/trunk/Modules/flmodule.c python/trunk/Modules/fmmodule.c python/trunk/Modules/gcmodule.c python/trunk/Modules/gdbmmodule.c python/trunk/Modules/glmodule.c python/trunk/Modules/grpmodule.c python/trunk/Modules/imageop.c python/trunk/Modules/imgfile.c python/trunk/Modules/itertoolsmodule.c python/trunk/Modules/linuxaudiodev.c python/trunk/Modules/main.c python/trunk/Modules/md5module.c python/trunk/Modules/mmapmodule.c python/trunk/Modules/nismodule.c python/trunk/Modules/operator.c python/trunk/Modules/ossaudiodev.c python/trunk/Modules/parsermodule.c python/trunk/Modules/posixmodule.c python/trunk/Modules/pwdmodule.c python/trunk/Modules/pyexpat.c python/trunk/Modules/readline.c python/trunk/Modules/selectmodule.c python/trunk/Modules/sha256module.c python/trunk/Modules/sha512module.c python/trunk/Modules/shamodule.c python/trunk/Modules/socketmodule.c python/trunk/Modules/spwdmodule.c python/trunk/Modules/stropmodule.c python/trunk/Modules/sunaudiodev.c python/trunk/Modules/svmodule.c python/trunk/Modules/syslogmodule.c python/trunk/Modules/termios.c python/trunk/Modules/threadmodule.c python/trunk/Modules/timemodule.c python/trunk/Modules/unicodedata.c python/trunk/Modules/zipimport.c python/trunk/Modules/zlibmodule.c python/trunk/Objects/abstract.c python/trunk/Objects/boolobject.c python/trunk/Objects/bufferobject.c python/trunk/Objects/bytes_methods.c python/trunk/Objects/bytesobject.c python/trunk/Objects/cellobject.c python/trunk/Objects/classobject.c python/trunk/Objects/codeobject.c python/trunk/Objects/complexobject.c python/trunk/Objects/descrobject.c python/trunk/Objects/dictobject.c python/trunk/Objects/exceptions.c python/trunk/Objects/fileobject.c python/trunk/Objects/floatobject.c python/trunk/Objects/frameobject.c python/trunk/Objects/funcobject.c python/trunk/Objects/genobject.c python/trunk/Objects/intobject.c python/trunk/Objects/listobject.c python/trunk/Objects/longobject.c python/trunk/Objects/methodobject.c python/trunk/Objects/moduleobject.c python/trunk/Objects/object.c python/trunk/Objects/rangeobject.c python/trunk/Objects/setobject.c python/trunk/Objects/sliceobject.c python/trunk/Objects/stringlib/string_format.h python/trunk/Objects/stringlib/stringdefs.h python/trunk/Objects/structseq.c python/trunk/Objects/tupleobject.c python/trunk/Objects/typeobject.c python/trunk/Objects/unicodeobject.c python/trunk/Objects/weakrefobject.c python/trunk/PC/_msi.c python/trunk/PC/_subprocess.c python/trunk/PC/_winreg.c python/trunk/PC/msvcrtmodule.c python/trunk/PC/winsound.c python/trunk/Parser/asdl_c.py python/trunk/Parser/tokenizer.c python/trunk/Python/Python-ast.c python/trunk/Python/_warnings.c python/trunk/Python/ast.c python/trunk/Python/bltinmodule.c python/trunk/Python/ceval.c python/trunk/Python/codecs.c python/trunk/Python/compile.c python/trunk/Python/errors.c python/trunk/Python/future.c python/trunk/Python/getargs.c python/trunk/Python/import.c python/trunk/Python/mactoolboxglue.c python/trunk/Python/marshal.c python/trunk/Python/modsupport.c python/trunk/Python/peephole.c python/trunk/Python/pystrtod.c python/trunk/Python/pythonrun.c python/trunk/Python/structmember.c python/trunk/Python/symtable.c python/trunk/Python/sysmodule.c python/trunk/Python/traceback.c python/trunk/RISCOS/Modules/drawfmodule.c python/trunk/RISCOS/Modules/riscosmodule.c python/trunk/RISCOS/Modules/swimodule.c Modified: python/trunk/Doc/includes/noddy2.c ============================================================================== --- python/trunk/Doc/includes/noddy2.c (original) +++ python/trunk/Doc/includes/noddy2.c Mon Jun 9 06:58:54 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -90,7 +90,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -109,7 +109,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/trunk/Doc/includes/noddy3.c ============================================================================== --- python/trunk/Doc/includes/noddy3.c (original) +++ python/trunk/Doc/includes/noddy3.c Mon Jun 9 06:58:54 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -93,7 +93,7 @@ return -1; } - if (! PyBytes_Check(value)) { + if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The first attribute value must be a string"); return -1; @@ -121,7 +121,7 @@ return -1; } - if (! PyBytes_Check(value)) { + if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The last attribute value must be a string"); return -1; @@ -153,7 +153,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -162,7 +162,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/trunk/Doc/includes/noddy4.c ============================================================================== --- python/trunk/Doc/includes/noddy4.c (original) +++ python/trunk/Doc/includes/noddy4.c Mon Jun 9 06:58:54 2008 @@ -57,14 +57,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -124,7 +124,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -143,7 +143,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/trunk/Doc/includes/run-func.c ============================================================================== --- python/trunk/Doc/includes/run-func.c (original) +++ python/trunk/Doc/includes/run-func.c Mon Jun 9 06:58:54 2008 @@ -13,7 +13,7 @@ } Py_Initialize(); - pName = PyBytes_FromString(argv[1]); + pName = PyString_FromString(argv[1]); /* Error checking of pName left out */ pModule = PyImport_Import(pName); Modified: python/trunk/Include/bytesobject.h ============================================================================== --- python/trunk/Include/bytesobject.h (original) +++ python/trunk/Include/bytesobject.h Mon Jun 9 06:58:54 2008 @@ -1,5 +1,5 @@ -/* Bytes (String) object interface */ +/* String (Bytes) object interface */ #ifndef Py_BYTESOBJECT_H #define Py_BYTESOBJECT_H @@ -10,7 +10,7 @@ #include /* -Type PyBytesObject represents a character string. An extra zero byte is +Type PyStringObject represents a character string. An extra zero byte is reserved at the end to ensure it is zero-terminated, but a size is present so strings with null bytes in them can be represented. This is an immutable object type. @@ -46,61 +46,61 @@ * 'interned' dictionary; in this case the two references * from 'interned' to this object are *not counted* in ob_refcnt. */ -} PyBytesObject; +} PyStringObject; #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 #define SSTATE_INTERNED_IMMORTAL 2 PyAPI_DATA(PyTypeObject) PyBaseString_Type; -PyAPI_DATA(PyTypeObject) PyBytes_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; -#define PyBytes_Check(op) \ +#define PyString_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) -PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); -PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) Py_GCC_ATTRIBUTE((format(printf, 1, 0))); -PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); -PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); -PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); -PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); -PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); -PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(int) _PyBytes_Eq(PyObject *, PyObject*); -PyAPI_FUNC(PyObject *) PyBytes_Format(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyBytes_FormatLong(PyObject*, int, int, +PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); -PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, +PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); -PyAPI_FUNC(void) PyBytes_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyBytes_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyBytes_InternFromString(const char *); +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Use only if you know it's a string */ -#define PyBytes_CHECK_INTERNED(op) (((PyBytesObject *)(op))->ob_sstate) +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) /* Macro, trading safety for speed */ -#define PyBytes_AS_STRING(op) (((PyBytesObject *)(op))->ob_sval) -#define PyBytes_GET_SIZE(op) Py_SIZE(op) +#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) +#define PyString_GET_SIZE(op) Py_SIZE(op) -/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, +/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ -PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ /* Create an object by decoding the encoded string s of the given size. */ -PyAPI_FUNC(PyObject*) PyBytes_Decode( +PyAPI_FUNC(PyObject*) PyString_Decode( const char *s, /* encoded string */ Py_ssize_t size, /* size of buffer */ const char *encoding, /* encoding */ @@ -110,7 +110,7 @@ /* Encodes a char buffer of the given size and returns a Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_Encode( +PyAPI_FUNC(PyObject*) PyString_Encode( const char *s, /* string char buffer */ Py_ssize_t size, /* number of chars to encode */ const char *encoding, /* encoding */ @@ -120,7 +120,7 @@ /* Encodes a string object and returns the result as Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_AsEncodedObject( +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -132,9 +132,9 @@ If the codec returns an Unicode object, the object is converted back to a string using the default encoding. - DEPRECATED - use PyBytes_AsEncodedObject() instead. */ + DEPRECATED - use PyString_AsEncodedObject() instead. */ -PyAPI_FUNC(PyObject*) PyBytes_AsEncodedString( +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -143,7 +143,7 @@ /* Decodes a string object and returns the result as Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_AsDecodedObject( +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -155,9 +155,9 @@ If the codec returns an Unicode object, the object is converted back to a string using the default encoding. - DEPRECATED - use PyBytes_AsDecodedObject() instead. */ + DEPRECATED - use PyString_AsDecodedObject() instead. */ -PyAPI_FUNC(PyObject*) PyBytes_AsDecodedString( +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -169,7 +169,7 @@ 0-terminated (passing a string with embedded NULL characters will cause an exception). */ -PyAPI_FUNC(int) PyBytes_AsStringAndSize( +PyAPI_FUNC(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ register Py_ssize_t *len /* pointer to length variable or NULL @@ -181,7 +181,7 @@ into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ -PyAPI_FUNC(int) _PyBytes_InsertThousandsGrouping(char *buffer, +PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, Py_ssize_t len, char *plast, Py_ssize_t buf_size, Modified: python/trunk/Include/object.h ============================================================================== --- python/trunk/Include/object.h (original) +++ python/trunk/Include/object.h Mon Jun 9 06:58:54 2008 @@ -504,7 +504,7 @@ PyAPI_FUNC(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) PyBytes_AS_STRING(PyObject_Repr(obj)) +#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ @@ -598,7 +598,7 @@ #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) -#define Py_TPFLAGS_BYTES_SUBCLASS (1L<<27) +#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) Modified: python/trunk/Include/py_curses.h ============================================================================== --- python/trunk/Include/py_curses.h (original) +++ python/trunk/Include/py_curses.h Mon Jun 9 06:58:54 2008 @@ -146,7 +146,7 @@ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ - return PyBytes_FromString(X()); } + return PyString_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ Modified: python/trunk/Include/pyerrors.h ============================================================================== --- python/trunk/Include/pyerrors.h (original) +++ python/trunk/Include/pyerrors.h Mon Jun 9 06:58:54 2008 @@ -104,7 +104,7 @@ #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ - ? PyBytes_AS_STRING(((PyClassObject*)(x))->cl_name) \ + ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ : (char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) \ Modified: python/trunk/Include/pyport.h ============================================================================== --- python/trunk/Include/pyport.h (original) +++ python/trunk/Include/pyport.h Mon Jun 9 06:58:54 2008 @@ -135,9 +135,9 @@ * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * - * PyBytes_FromFormat + * PyString_FromFormat * PyErr_Format - * PyBytes_FromFormatV + * PyString_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for Modified: python/trunk/Include/pythonrun.h ============================================================================== --- python/trunk/Include/pythonrun.h (original) +++ python/trunk/Include/pythonrun.h Mon Jun 9 06:58:54 2008 @@ -136,7 +136,7 @@ PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); -PyAPI_FUNC(void) PyBytes_Fini(void); +PyAPI_FUNC(void) PyString_Fini(void); PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); Modified: python/trunk/Include/stringobject.h ============================================================================== --- python/trunk/Include/stringobject.h (original) +++ python/trunk/Include/stringobject.h Mon Jun 9 06:58:54 2008 @@ -1,13 +1,12 @@ #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type -#define PyString_Check PyBytes_Check -#define PyString_CheckExact PyBytes_CheckExact -#define PyString_CHECK_INTERNED PyBytes_CHECK_INTERNED -#define PyString_AS_STRING PyBytes_AS_STRING -#define PyString_GET_SIZE PyBytes_GET_SIZE - -#define Py_TPFLAGS_STRING_SUBCLASS Py_TPFLAGS_BYTES_SUBCLASS +#define PyBytes_Check PyString_Check +#define PyBytes_CheckExact PyString_CheckExact +#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromString PyString_FromString @@ -23,9 +22,6 @@ #define PyBytes_Format PyString_Format #define _PyBytes_FormatLong _PyString_FormatLong #define PyBytes_DecodeEscape PyString_DecodeEscape -#define PyBytes_InternInPlace PyString_InternInPlace -#define PyBytes_InternImmortal PyString_InternImmortal -#define PyBytes_InternFromString PyString_InternFromString #define _PyBytes_Join _PyString_Join #define PyBytes_Decode PyString_Decode #define PyBytes_Encode PyString_Encode Modified: python/trunk/Mac/Modules/MacOS.c ============================================================================== --- python/trunk/Mac/Modules/MacOS.c (original) +++ python/trunk/Mac/Modules/MacOS.c Mon Jun 9 06:58:54 2008 @@ -706,7 +706,7 @@ ** some of the image and sound processing interfaces on the mac:-( */ { - PyBytesObject *p = 0; + PyStringObject *p = 0; long off = (long)&(p->ob_sval[0]); if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0) Modified: python/trunk/Mac/Modules/Nav.c ============================================================================== --- python/trunk/Mac/Modules/Nav.c (original) +++ python/trunk/Mac/Modules/Nav.c Mon Jun 9 06:58:54 2008 @@ -139,11 +139,11 @@ NavGetDefaultDialogOptions(opt); while ( PyDict_Next(d, &pos, &key, &value) ) { - if ( !key || !value || !PyBytes_Check(key) ) { + if ( !key || !value || !PyString_Check(key) ) { PyErr_SetString(ErrorObject, "DialogOption has non-string key"); return 0; } - keystr = PyBytes_AsString(key); + keystr = PyString_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { PyErr_NoMemory(); @@ -963,7 +963,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyBytes_FromString("Nav.error"); + ErrorObject = PyString_FromString("Nav.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/trunk/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/trunk/Mac/Modules/ae/_AEmodule.c (original) +++ python/trunk/Mac/Modules/ae/_AEmodule.c Mon Jun 9 06:58:54 2008 @@ -840,9 +840,9 @@ OSErr err; size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyBytes_FromStringAndSize(NULL, size)) == NULL ) + if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) return NULL; - if ( (ptr = PyBytes_AsString(res)) == NULL ) + if ( (ptr = PyString_AsString(res)) == NULL ) return NULL; if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) return PyMac_Error(err); Modified: python/trunk/Mac/Modules/cf/_CFmodule.c ============================================================================== --- python/trunk/Mac/Modules/cf/_CFmodule.c (original) +++ python/trunk/Mac/Modules/cf/_CFmodule.c Mon Jun 9 06:58:54 2008 @@ -392,7 +392,7 @@ { char buf[100]; sprintf(buf, "", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFTypeRefObj_hash(CFTypeRefObject *self) @@ -596,7 +596,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFArrayRefObj_hash(CFArrayRefObject *self) @@ -836,7 +836,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self) @@ -1029,7 +1029,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self) @@ -1206,7 +1206,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyBytes_FromStringAndSize(data, size); + _res = (PyObject *)PyString_FromStringAndSize(data, size); return _res; } @@ -1437,7 +1437,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFDataRefObj_hash(CFDataRefObject *self) @@ -1702,7 +1702,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyBytes_FromString(data); + _res = (PyObject *)PyString_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) Modified: python/trunk/Mac/Modules/cf/pycfbridge.c ============================================================================== --- python/trunk/Mac/Modules/cf/pycfbridge.c (original) +++ python/trunk/Mac/Modules/cf/pycfbridge.c Mon Jun 9 06:58:54 2008 @@ -146,7 +146,7 @@ int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ return (*dst != NULL); } #endif - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ CFIndex size; UniChar *unichars; - if (PyBytes_Check(src)) { + if (PyString_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); Modified: python/trunk/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/trunk/Mac/Modules/file/_Filemodule.c (original) +++ python/trunk/Mac/Modules/file/_Filemodule.c Mon Jun 9 06:58:54 2008 @@ -961,7 +961,7 @@ size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); - rv = PyBytes_FromStringAndSize(*(Handle)self->ob_itself, size); + rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; @@ -1362,7 +1362,7 @@ PyMac_Error(err); return NULL; } - _res = PyBytes_FromString(strbuf); + _res = PyString_FromString(strbuf); return _res; } @@ -1419,7 +1419,7 @@ static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSSpec_set_data NULL @@ -1440,7 +1440,7 @@ self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #define FSSpec_hash NULL @@ -2015,7 +2015,7 @@ static PyObject *FSRef_get_data(FSRefObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSRef_set_data NULL @@ -3131,7 +3131,7 @@ if (!PyArg_ParseTuple(_args, "O", &obj)) return NULL; - if (PyBytes_Check(obj)) { + if (PyString_Check(obj)) { Py_INCREF(obj); return obj; } @@ -3301,7 +3301,7 @@ } /* On OSX we now try a pathname */ - if ( PyBytes_Check(v) || PyUnicode_Check(v)) { + if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; Modified: python/trunk/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/trunk/Mac/Modules/qd/_Qdmodule.c (original) +++ python/trunk/Mac/Modules/qd/_Qdmodule.c Mon Jun 9 06:58:54 2008 @@ -1458,7 +1458,7 @@ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - _res = PyBytes_FromStringAndSize(cp, length); + _res = PyString_FromStringAndSize(cp, length); return _res; } @@ -1511,14 +1511,14 @@ static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); + return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); } #define BMObj_set_bitmap_data NULL static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); + return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); } #define BMObj_set_pixmap_data NULL @@ -6501,10 +6501,10 @@ int rowbytes; char *data; - if ( !PyArg_ParseTuple(_args, "O!iO&", &PyBytes_Type, &source, &rowbytes, PyMac_GetRect, + if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, &bounds) ) return NULL; - data = PyBytes_AsString(source); + data = PyString_AsString(source); if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) return PyErr_NoMemory(); ptr->baseAddr = (Ptr)data; @@ -6528,15 +6528,15 @@ BitMap *ptr; PyObject *source; - if ( !PyArg_ParseTuple(_args, "O!", &PyBytes_Type, &source) ) + if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) return NULL; - if ( PyBytes_Size(source) != sizeof(BitMap) && PyBytes_Size(source) != sizeof(PixMap) ) { + if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { PyErr_Format(PyExc_TypeError, "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)", - PyBytes_Size(source), sizeof(BitMap), sizeof(PixMap)); + PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } - ptr = (BitMapPtr)PyBytes_AsString(source); + ptr = (BitMapPtr)PyString_AsString(source); if ( (_res = BMObj_New(ptr)) == NULL ) { return NULL; } Modified: python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/trunk/Mac/Modules/qdoffs/_Qdoffsmodule.c Mon Jun 9 06:58:54 2008 @@ -609,7 +609,7 @@ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) ) return NULL; cp = GetPixBaseAddr(pm)+from; - _res = PyBytes_FromStringAndSize(cp, length); + _res = PyString_FromStringAndSize(cp, length); return _res; } Modified: python/trunk/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/trunk/Mac/Modules/res/_Resmodule.c (original) +++ python/trunk/Mac/Modules/res/_Resmodule.c Mon Jun 9 06:58:54 2008 @@ -523,7 +523,7 @@ state = HGetState(self->ob_itself); HLock(self->ob_itself); - res = PyBytes_FromStringAndSize( + res = PyString_FromStringAndSize( *self->ob_itself, GetHandleSize(self->ob_itself)); HUnlock(self->ob_itself); @@ -540,10 +540,10 @@ if ( v == NULL ) return -1; - if ( !PyBytes_Check(v) ) + if ( !PyString_Check(v) ) return -1; - size = PyBytes_Size(v); - data = PyBytes_AsString(v); + size = PyString_Size(v); + data = PyString_AsString(v); /* XXXX Do I need the GetState/SetState calls? */ SetHandleSize(self->ob_itself, size); if ( MemError()) Modified: python/trunk/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/trunk/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/trunk/Mac/Modules/scrap/_Scrapmodule.c Mon Jun 9 06:58:54 2008 @@ -106,12 +106,12 @@ flavorType, &byteCount); if (_err != noErr) return PyMac_Error(_err); - _res = PyBytes_FromStringAndSize(NULL, (int)byteCount); + _res = PyString_FromStringAndSize(NULL, (int)byteCount); if ( _res == NULL ) return NULL; _err = GetScrapFlavorData(_self->ob_itself, flavorType, &byteCount, - PyBytes_AS_STRING(_res)); + PyString_AS_STRING(_res)); if (_err != noErr) { Py_XDECREF(_res); return PyMac_Error(_err); Modified: python/trunk/Mac/Modules/snd/_Sndihooks.c ============================================================================== --- python/trunk/Mac/Modules/snd/_Sndihooks.c (original) +++ python/trunk/Mac/Modules/snd/_Sndihooks.c Mon Jun 9 06:58:54 2008 @@ -500,7 +500,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyBytes_FromString("Sndihooks.error"); + ErrorObject = PyString_FromString("Sndihooks.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/trunk/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/trunk/Mac/Modules/win/_Winmodule.c (original) +++ python/trunk/Mac/Modules/win/_Winmodule.c Mon Jun 9 06:58:54 2008 @@ -2580,7 +2580,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int WinObj_hash(WindowObject *self) Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Mon Jun 9 06:58:54 2008 @@ -584,7 +584,6 @@ Include/bitset.h \ Include/boolobject.h \ Include/bytes_methods.h \ - Include/bytearrayobject.h \ Include/bytesobject.h \ Include/bufferobject.h \ Include/cellobject.h \ Modified: python/trunk/Modules/_bytesio.c ============================================================================== --- python/trunk/Modules/_bytesio.c (original) +++ python/trunk/Modules/_bytesio.c Mon Jun 9 06:58:54 2008 @@ -175,7 +175,7 @@ bytesio_getvalue(BytesIOObject *self) { CHECK_CLOSED(self); - return PyBytes_FromStringAndSize(self->buf, self->string_size); + return PyString_FromStringAndSize(self->buf, self->string_size); } PyDoc_STRVAR(isatty_doc, @@ -244,7 +244,7 @@ output = self->buf + self->pos; self->pos += size; - return PyBytes_FromStringAndSize(output, size); + return PyString_FromStringAndSize(output, size); } @@ -307,7 +307,7 @@ self->pos -= size; } - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(readlines_doc, @@ -349,7 +349,7 @@ return NULL; while ((n = get_line(self, &output)) != 0) { - line = PyBytes_FromStringAndSize(output, n); + line = PyString_FromStringAndSize(output, n); if (!line) goto on_error; if (PyList_Append(result, line) == -1) { @@ -455,7 +455,7 @@ if (!next || n == 0) return NULL; - return PyBytes_FromStringAndSize(next, n); + return PyString_FromStringAndSize(next, n); } PyDoc_STRVAR(seek_doc, Modified: python/trunk/Modules/_codecsmodule.c ============================================================================== --- python/trunk/Modules/_codecsmodule.c (original) +++ python/trunk/Modules/_codecsmodule.c Mon Jun 9 06:58:54 2008 @@ -168,7 +168,7 @@ if (!PyArg_ParseTuple(args, "s#|z:escape_decode", &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL), + return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), size); } @@ -182,21 +182,21 @@ Py_ssize_t len; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyBytes_Type, &str, &errors)) + &PyString_Type, &str, &errors)) return NULL; - str = PyBytes_Repr(str, 0); + str = PyString_Repr(str, 0); if (!str) return NULL; /* The string will be quoted. Unquote, similar to unicode-escape. */ - buf = PyBytes_AS_STRING (str); - len = PyBytes_GET_SIZE (str); + buf = PyString_AS_STRING (str); + len = PyString_GET_SIZE (str); memmove(buf, buf+1, len-2); - if (_PyBytes_Resize(&str, len-2) < 0) + if (_PyString_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyBytes_Size(str)); + return codec_tuple(str, PyString_Size(str)); } #ifdef Py_USING_UNICODE @@ -640,7 +640,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -656,7 +656,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -676,13 +676,13 @@ if (PyUnicode_Check(obj)) { data = PyUnicode_AS_DATA(obj); size = PyUnicode_GET_DATA_SIZE(obj); - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } } Modified: python/trunk/Modules/_collectionsmodule.c ============================================================================== --- python/trunk/Modules/_collectionsmodule.c (original) +++ python/trunk/Modules/_collectionsmodule.c Mon Jun 9 06:58:54 2008 @@ -668,7 +668,7 @@ if (i != 0) { if (i < 0) return NULL; - return PyBytes_FromString("[...]"); + return PyString_FromString("[...]"); } aslist = PySequence_List(deque); @@ -677,16 +677,16 @@ return NULL; } if (((dequeobject *)deque)->maxlen != -1) - fmt = PyBytes_FromFormat("deque(%%r, maxlen=%i)", + fmt = PyString_FromFormat("deque(%%r, maxlen=%i)", ((dequeobject *)deque)->maxlen); else - fmt = PyBytes_FromString("deque(%r)"); + fmt = PyString_FromString("deque(%r)"); if (fmt == NULL) { Py_DECREF(aslist); Py_ReprLeave(deque); return NULL; } - result = PyBytes_Format(fmt, aslist); + result = PyString_Format(fmt, aslist); Py_DECREF(fmt); Py_DECREF(aslist); Py_ReprLeave(deque); @@ -1298,14 +1298,14 @@ if (baserepr == NULL) return NULL; if (dd->default_factory == NULL) - defrepr = PyBytes_FromString("None"); + defrepr = PyString_FromString("None"); else { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { if (status < 0) return NULL; - defrepr = PyBytes_FromString("..."); + defrepr = PyString_FromString("..."); } else defrepr = PyObject_Repr(dd->default_factory); @@ -1315,9 +1315,9 @@ Py_DECREF(baserepr); return NULL; } - result = PyBytes_FromFormat("defaultdict(%s, %s)", - PyBytes_AS_STRING(defrepr), - PyBytes_AS_STRING(baserepr)); + result = PyString_FromFormat("defaultdict(%s, %s)", + PyString_AS_STRING(defrepr), + PyString_AS_STRING(baserepr)); Py_DECREF(defrepr); Py_DECREF(baserepr); return result; Modified: python/trunk/Modules/_csv.c ============================================================================== --- python/trunk/Modules/_csv.c (original) +++ python/trunk/Modules/_csv.c Mon Jun 9 06:58:54 2008 @@ -176,7 +176,7 @@ return Py_None; } else - return PyBytes_FromStringAndSize((char*)&c, 1); + return PyString_FromStringAndSize((char*)&c, 1); } static PyObject * @@ -235,16 +235,16 @@ if (src == NULL) *target = dflt; else { - if (src == Py_None || PyBytes_Size(src) == 0) + if (src == Py_None || PyString_Size(src) == 0) *target = '\0'; - else if (!PyBytes_Check(src) || PyBytes_Size(src) != 1) { + else if (!PyString_Check(src) || PyString_Size(src) != 1) { PyErr_Format(PyExc_TypeError, "\"%s\" must be an 1-character string", name); return -1; } else { - char *s = PyBytes_AsString(src); + char *s = PyString_AsString(src); if (s == NULL) return -1; *target = s[0]; @@ -257,7 +257,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) { if (src == NULL) - *target = PyBytes_FromString(dflt); + *target = PyString_FromString(dflt); else { if (src == Py_None) *target = NULL; @@ -528,7 +528,7 @@ { PyObject *field; - field = PyBytes_FromStringAndSize(self->field, self->field_len); + field = PyString_FromStringAndSize(self->field, self->field_len); if (field == NULL) return -1; self->field_len = 0; @@ -787,8 +787,8 @@ } ++self->line_num; - line = PyBytes_AsString(lineobj); - linelen = PyBytes_Size(lineobj); + line = PyString_AsString(lineobj); + linelen = PyString_Size(lineobj); if (line == NULL || linelen < 0) { Py_DECREF(lineobj); @@ -976,7 +976,7 @@ rec_len++;\ } while(0) - lineterm = PyBytes_AsString(dialect->lineterminator); + lineterm = PyString_AsString(dialect->lineterminator); if (lineterm == NULL) return -1; @@ -1101,7 +1101,7 @@ int terminator_len; char *terminator; - terminator_len = PyBytes_Size(self->dialect->lineterminator); + terminator_len = PyString_Size(self->dialect->lineterminator); if (terminator_len == -1) return 0; @@ -1109,7 +1109,7 @@ if (!join_check_rec_size(self, self->rec_len + terminator_len)) return 0; - terminator = PyBytes_AsString(self->dialect->lineterminator); + terminator = PyString_AsString(self->dialect->lineterminator); if (terminator == NULL) return 0; memmove(self->rec + self->rec_len, terminator, terminator_len); @@ -1161,9 +1161,9 @@ break; } - if (PyBytes_Check(field)) { + if (PyString_Check(field)) { append_ok = join_append(self, - PyBytes_AS_STRING(field), + PyString_AS_STRING(field), "ed, len == 1); Py_DECREF(field); } @@ -1179,7 +1179,7 @@ if (str == NULL) return NULL; - append_ok = join_append(self, PyBytes_AS_STRING(str), + append_ok = join_append(self, PyString_AS_STRING(str), "ed, len == 1); Py_DECREF(str); } Modified: python/trunk/Modules/_ctypes/_ctypes.c ============================================================================== --- python/trunk/Modules/_ctypes/_ctypes.c (original) +++ python/trunk/Modules/_ctypes/_ctypes.c Mon Jun 9 06:58:54 2008 @@ -714,8 +714,8 @@ if (-1 == PyType_Type.tp_setattro(self, key, value)) return -1; - if (value && PyBytes_Check(key) && - 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) + if (value && PyString_Check(key) && + 0 == strcmp(PyString_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 1); return 0; } @@ -728,8 +728,8 @@ if (-1 == PyObject_GenericSetAttr(self, key, value)) return -1; - if (PyBytes_Check(key) && - 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) + if (PyString_Check(key) && + 0 == strcmp(PyString_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 0); return 0; } @@ -1065,7 +1065,7 @@ size = Py_TYPE(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr); if (size < 0) return -1; - } else if (-1 == PyBytes_AsStringAndSize(value, &ptr, &size)) { + } else if (-1 == PyString_AsStringAndSize(value, &ptr, &size)) { return -1; } if (size > self->b_size) { @@ -1082,7 +1082,7 @@ static PyObject * CharArray_get_raw(CDataObject *self) { - return PyBytes_FromStringAndSize(self->b_ptr, self->b_size); + return PyString_FromStringAndSize(self->b_ptr, self->b_size); } static PyObject * @@ -1093,7 +1093,7 @@ for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') break; - return PyBytes_FromStringAndSize(self->b_ptr, i); + return PyString_FromStringAndSize(self->b_ptr, i); } static int @@ -1114,14 +1114,14 @@ conversion_mode_errors); if (!value) return -1; - } else if (!PyBytes_Check(value)) { + } else if (!PyString_Check(value)) { PyErr_Format(PyExc_TypeError, "string expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else Py_INCREF(value); - size = PyBytes_GET_SIZE(value); + size = PyString_GET_SIZE(value); if (size > self->b_size) { PyErr_SetString(PyExc_ValueError, "string too long"); @@ -1129,7 +1129,7 @@ return -1; } - ptr = PyBytes_AS_STRING(value); + ptr = PyString_AS_STRING(value); memcpy(self->b_ptr, ptr, size); if (size < self->b_size) self->b_ptr[size] = '\0'; @@ -1168,7 +1168,7 @@ "can't delete attribute"); return -1; } - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1465,7 +1465,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyUnicode_Check(value) || PyBytes_Check(value)) { + if (PyUnicode_Check(value) || PyString_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("Z"); @@ -1529,7 +1529,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyBytes_Check(value) || PyUnicode_Check(value)) { + if (PyString_Check(value) || PyUnicode_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1615,7 +1615,7 @@ return (PyObject *)parg; } /* string */ - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1686,10 +1686,10 @@ } /* c_char_p, c_wchar_p */ stgd = PyObject_stgdict(value); - if (stgd && CDataObject_Check(value) && stgd->proto && PyBytes_Check(stgd->proto)) { + if (stgd && CDataObject_Check(value) && stgd->proto && PyString_Check(stgd->proto)) { PyCArgObject *parg; - switch (PyBytes_AS_STRING(stgd->proto)[0]) { + switch (PyString_AS_STRING(stgd->proto)[0]) { case 'z': /* c_char_p */ case 'Z': /* c_wchar_p */ parg = new_CArgObject(); @@ -1746,13 +1746,13 @@ if (suffix == NULL) #ifdef WORDS_BIGENDIAN - suffix = PyBytes_InternFromString("_le"); + suffix = PyString_InternFromString("_le"); #else - suffix = PyBytes_InternFromString("_be"); + suffix = PyString_InternFromString("_be"); #endif Py_INCREF(name); - PyBytes_Concat(&name, suffix); + PyString_Concat(&name, suffix); if (name == NULL) return NULL; @@ -1807,7 +1807,7 @@ dict = PyObject_stgdict((PyObject *)self); assert(dict); /* Cannot be NULL for CDataObject instances */ - fmt = PyBytes_AsString(dict->proto); + fmt = PyString_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -1872,12 +1872,12 @@ SIMPLE_TYPE_CHARS); goto error; } - fmt = getentry(PyBytes_AS_STRING(proto)); + fmt = getentry(PyString_AS_STRING(proto)); if (fmt == NULL) { Py_DECREF(result); PyErr_Format(PyExc_ValueError, "_type_ '%s' not supported", - PyBytes_AS_STRING(proto)); + PyString_AS_STRING(proto)); return NULL; } @@ -1927,7 +1927,7 @@ Overrides the SimpleType_from_param generic method. */ if (result->tp_base == &Simple_Type) { - switch (PyBytes_AS_STRING(proto)[0]) { + switch (PyString_AS_STRING(proto)[0]) { case 'z': /* c_char_p */ ml = &c_char_p_method; stgdict->flags |= TYPEFLAG_ISPOINTER; @@ -2042,7 +2042,7 @@ assert(dict); /* I think we can rely on this being a one-character string */ - fmt = PyBytes_AsString(dict->proto); + fmt = PyString_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -2399,7 +2399,7 @@ #endif target = target->b_base; } - return PyBytes_FromStringAndSize(string, cp-string); + return PyString_FromStringAndSize(string, cp-string); } /* @@ -2571,7 +2571,7 @@ _unpickle, Py_TYPE(_self), PyObject_GetAttrString(_self, "__dict__"), - PyBytes_FromStringAndSize(self->b_ptr, self->b_size)); + PyString_FromStringAndSize(self->b_ptr, self->b_size)); } static PyObject * @@ -3120,9 +3120,9 @@ dict = PyType_stgdict(arg); if (dict /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ - && PyBytes_Check(dict->proto) + && PyString_Check(dict->proto) /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ - && (strchr("PzZ", PyBytes_AS_STRING(dict->proto)[0]))) { + && (strchr("PzZ", PyString_AS_STRING(dict->proto)[0]))) { return 1; } @@ -3207,8 +3207,8 @@ return 1; } #endif - if (PyBytes_Check(obj) || PyUnicode_Check(obj)) { - *pname = PyBytes_AsString(obj); + if (PyString_Check(obj) || PyUnicode_Check(obj)) { + *pname = PyString_AsString(obj); return *pname ? 1 : 0; } PyErr_SetString(PyExc_TypeError, @@ -3558,7 +3558,7 @@ /* We HAVE already checked that the tuple can be parsed with "i|zO", so... */ Py_ssize_t tsize = PyTuple_GET_SIZE(item); flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0)); - name = tsize > 1 ? PyBytes_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; + name = tsize > 1 ? PyString_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL; switch (flag & (PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID)) { @@ -3612,7 +3612,7 @@ "NULL stgdict unexpected"); goto error; } - if (PyBytes_Check(dict->proto)) { + if (PyString_Check(dict->proto)) { PyErr_Format( PyExc_TypeError, "%s 'out' parameter must be passed as default value", @@ -3910,12 +3910,12 @@ { #ifdef MS_WIN32 if (self->index) - return PyBytes_FromFormat("", + return PyString_FromFormat("", self->index - 0x1000, Py_TYPE(self)->tp_name, self); #endif - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -4044,7 +4044,7 @@ } if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyBytes_AsString(name); + char *field = PyString_AsString(name); if (field == NULL) { PyErr_Clear(); field = "???"; @@ -4246,7 +4246,7 @@ type, so this cannot be NULL */ if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = (char *)self->b_ptr; - return PyBytes_FromStringAndSize(ptr + ilow, len); + return PyString_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; @@ -4303,9 +4303,9 @@ char *dest; if (slicelen <= 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (step == 1) { - return PyBytes_FromStringAndSize(ptr + start, + return PyString_FromStringAndSize(ptr + start, slicelen); } dest = (char *)PyMem_Malloc(slicelen); @@ -4318,7 +4318,7 @@ dest[i] = ptr[cur]; } - np = PyBytes_FromStringAndSize(dest, slicelen); + np = PyString_FromStringAndSize(dest, slicelen); PyMem_Free(dest); return np; } @@ -4728,12 +4728,12 @@ static PyObject *format; if (Py_TYPE(self)->tp_base != &Simple_Type) { - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } if (format == NULL) { - format = PyBytes_InternFromString("%s(%r)"); + format = PyString_InternFromString("%s(%r)"); if (format == NULL) return NULL; } @@ -4742,7 +4742,7 @@ if (val == NULL) return NULL; - name = PyBytes_FromString(Py_TYPE(self)->tp_name); + name = PyString_FromString(Py_TYPE(self)->tp_name); if (name == NULL) { Py_DECREF(val); return NULL; @@ -4754,7 +4754,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; } @@ -4988,7 +4988,7 @@ assert(itemdict); if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = *(char **)self->b_ptr; - return PyBytes_FromStringAndSize(ptr + ilow, len); + return PyString_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; @@ -5085,9 +5085,9 @@ char *dest; if (len <= 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (step == 1) { - return PyBytes_FromStringAndSize(ptr + start, + return PyString_FromStringAndSize(ptr + start, len); } dest = (char *)PyMem_Malloc(len); @@ -5096,7 +5096,7 @@ for (cur = start, i = 0; i < len; cur += step, i++) { dest[i] = ptr[cur]; } - np = PyBytes_FromStringAndSize(dest, len); + np = PyString_FromStringAndSize(dest, len); PyMem_Free(dest); return np; } @@ -5276,7 +5276,7 @@ ++methods; } - s = PyBytes_FromString(comerror_doc); + s = PyString_FromString(comerror_doc); if (s == NULL) goto error; status = PyDict_SetItemString(dict, "__doc__", s); @@ -5302,8 +5302,8 @@ string_at(const char *ptr, int size) { if (size == -1) - return PyBytes_FromString(ptr); - return PyBytes_FromStringAndSize(ptr, size); + return PyString_FromString(ptr); + return PyString_FromStringAndSize(ptr, size); } static int @@ -5317,8 +5317,8 @@ return 1; dict = PyType_stgdict(arg); if (dict) { - if (PyBytes_Check(dict->proto) - && (strchr("sPzUZXO", PyBytes_AS_STRING(dict->proto)[0]))) { + if (PyString_Check(dict->proto) + && (strchr("sPzUZXO", PyString_AS_STRING(dict->proto)[0]))) { /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ return 1; } Modified: python/trunk/Modules/_ctypes/callbacks.c ============================================================================== --- python/trunk/Modules/_ctypes/callbacks.c (original) +++ python/trunk/Modules/_ctypes/callbacks.c Mon Jun 9 06:58:54 2008 @@ -107,15 +107,15 @@ PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_srcfile = PyBytes_FromString(filename); + py_srcfile = PyString_FromString(filename); if (!py_srcfile) goto bad; - py_funcname = PyBytes_FromString(funcname); + py_funcname = PyString_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyDict_New(); if (!py_globals) goto bad; empty_tuple = PyTuple_New(0); if (!empty_tuple) goto bad; - empty_string = PyBytes_FromString(""); + empty_string = PyString_FromString(""); if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ @@ -498,7 +498,7 @@ static PyObject *context; if (context == NULL) - context = PyBytes_InternFromString("_ctypes.DllGetClassObject"); + context = PyString_InternFromString("_ctypes.DllGetClassObject"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { @@ -577,7 +577,7 @@ static PyObject *context; if (context == NULL) - context = PyBytes_InternFromString("_ctypes.DllCanUnloadNow"); + context = PyString_InternFromString("_ctypes.DllCanUnloadNow"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Mon Jun 9 06:58:54 2008 @@ -498,7 +498,7 @@ self->tag, self); break; } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } static PyMemberDef PyCArgType_members[] = { @@ -646,9 +646,9 @@ return 0; } - if (PyBytes_Check(obj)) { + if (PyString_Check(obj)) { pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyBytes_AS_STRING(obj); + pa->value.p = PyString_AS_STRING(obj); Py_INCREF(obj); pa->keep = obj; return 0; @@ -937,7 +937,7 @@ PyObject *tp, *v, *tb, *s, *cls_str, *msg_str; va_start(vargs, fmt); - s = PyBytes_FromFormatV(fmt, vargs); + s = PyString_FromFormatV(fmt, vargs); va_end(vargs); if (!s) return; @@ -946,18 +946,18 @@ PyErr_NormalizeException(&tp, &v, &tb); cls_str = PyObject_Str(tp); if (cls_str) { - PyBytes_ConcatAndDel(&s, cls_str); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(": ")); + PyString_ConcatAndDel(&s, cls_str); + PyString_ConcatAndDel(&s, PyString_FromString(": ")); if (s == NULL) goto error; } else PyErr_Clear(); msg_str = PyObject_Str(v); if (msg_str) - PyBytes_ConcatAndDel(&s, msg_str); + PyString_ConcatAndDel(&s, msg_str); else { PyErr_Clear(); - PyBytes_ConcatAndDel(&s, PyBytes_FromString("???")); + PyString_ConcatAndDel(&s, PyString_FromString("???")); if (s == NULL) goto error; } @@ -1261,7 +1261,7 @@ if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) return NULL; #ifdef _UNICODE - name = alloca((PyBytes_Size(nameobj) + 1) * sizeof(WCHAR)); + name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); if (!name) { PyErr_NoMemory(); return NULL; @@ -1269,14 +1269,14 @@ { int r; - char *aname = PyBytes_AsString(nameobj); + char *aname = PyString_AsString(nameobj); if(!aname) return NULL; - r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyBytes_Size(nameobj) + 1); + r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyString_Size(nameobj) + 1); name[r] = 0; } #else - name = PyBytes_AsString(nameobj); + name = PyString_AsString(nameobj); if(!name) return NULL; #endif @@ -1769,9 +1769,9 @@ Py_INCREF(result); return result; } - if (PyBytes_CheckExact(cls)) { - buf = alloca(strlen(PyBytes_AS_STRING(cls)) + 3 + 1); - sprintf(buf, "LP_%s", PyBytes_AS_STRING(cls)); + if (PyString_CheckExact(cls)) { + buf = alloca(strlen(PyString_AS_STRING(cls)) + 3 + 1); + sprintf(buf, "LP_%s", PyString_AS_STRING(cls)); result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type), "s(O){}", buf, Modified: python/trunk/Modules/_ctypes/cfield.c ============================================================================== --- python/trunk/Modules/_ctypes/cfield.c (original) +++ python/trunk/Modules/_ctypes/cfield.c Mon Jun 9 06:58:54 2008 @@ -272,7 +272,7 @@ name = ((PyTypeObject *)self->proto)->tp_name; if (bits) - result = PyBytes_FromFormat( + result = PyString_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -280,7 +280,7 @@ #endif name, self->offset, size, bits); else - result = PyBytes_FromFormat( + result = PyString_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -1164,12 +1164,12 @@ static PyObject * c_set(void *ptr, PyObject *value, Py_ssize_t size) { - if (!PyBytes_Check(value) || (1 != PyBytes_Size(value))) { + if (!PyString_Check(value) || (1 != PyString_Size(value))) { PyErr_Format(PyExc_TypeError, "one character string expected"); return NULL; } - *(char *)ptr = PyBytes_AS_STRING(value)[0]; + *(char *)ptr = PyString_AS_STRING(value)[0]; _RET(value); } @@ -1177,7 +1177,7 @@ static PyObject * c_get(void *ptr, Py_ssize_t size) { - return PyBytes_FromStringAndSize((char *)ptr, 1); + return PyString_FromStringAndSize((char *)ptr, 1); } #ifdef CTYPES_UNICODE @@ -1187,7 +1187,7 @@ { Py_ssize_t len; - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1262,7 +1262,7 @@ /* It's easier to calculate in characters than in bytes */ length /= sizeof(wchar_t); - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1301,21 +1301,21 @@ PyObject *result; size_t slen; - result = PyBytes_FromString((char *)ptr); + result = PyString_FromString((char *)ptr); if (!result) return NULL; /* chop off at the first NUL character, if any. * On error, result will be deallocated and set to NULL. */ - slen = strlen(PyBytes_AS_STRING(result)); + slen = strlen(PyString_AS_STRING(result)); size = min(size, (Py_ssize_t)slen); if (result->ob_refcnt == 1) { /* shorten the result */ - _PyBytes_Resize(&result, size); + _PyString_Resize(&result, size); return result; } else /* cannot shorten the result */ - return PyBytes_FromStringAndSize(ptr, size); + return PyString_FromStringAndSize(ptr, size); } static PyObject * @@ -1324,7 +1324,7 @@ char *data; Py_ssize_t size; - data = PyBytes_AsString(value); + data = PyString_AsString(value); if (!data) return NULL; size = strlen(data); @@ -1356,8 +1356,8 @@ Py_INCREF(value); return value; } - if (PyBytes_Check(value)) { - *(char **)ptr = PyBytes_AS_STRING(value); + if (PyString_Check(value)) { + *(char **)ptr = PyString_AS_STRING(value); Py_INCREF(value); return value; } else if (PyUnicode_Check(value)) { @@ -1366,7 +1366,7 @@ conversion_mode_errors); if (str == NULL) return NULL; - *(char **)ptr = PyBytes_AS_STRING(str); + *(char **)ptr = PyString_AS_STRING(str); return str; } else if (PyInt_Check(value) || PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG @@ -1395,7 +1395,7 @@ return NULL; } #endif - return PyBytes_FromString(*(char **)ptr); + return PyString_FromString(*(char **)ptr); } else { Py_INCREF(Py_None); return Py_None; @@ -1411,7 +1411,7 @@ Py_INCREF(value); return value; } - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1502,7 +1502,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyBytes_Check(value)) { + } else if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); Modified: python/trunk/Modules/_curses_panel.c ============================================================================== --- python/trunk/Modules/_curses_panel.c (original) +++ python/trunk/Modules/_curses_panel.c Mon Jun 9 06:58:54 2008 @@ -472,7 +472,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyBytes_FromString(PyCursesVersion); + v = PyString_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/trunk/Modules/_cursesmodule.c ============================================================================== --- python/trunk/Modules/_cursesmodule.c (original) +++ python/trunk/Modules/_cursesmodule.c Mon Jun 9 06:58:54 2008 @@ -198,9 +198,9 @@ { if (PyInt_Check(obj)) { *ch = (chtype) PyInt_AsLong(obj); - } else if(PyBytes_Check(obj) - && (PyBytes_Size(obj) == 1)) { - *ch = (chtype) *PyBytes_AsString(obj); + } else if(PyString_Check(obj) + && (PyString_Size(obj) == 1)) { + *ch = (chtype) *PyString_AsString(obj); } else { return 0; } @@ -886,9 +886,9 @@ return Py_BuildValue("c", rtn); else #if defined(__NetBSD__) - return PyBytes_FromString(unctrl(rtn)); + return PyString_FromString(unctrl(rtn)); #else - return PyBytes_FromString((char *)keyname(rtn)); + return PyString_FromString((char *)keyname(rtn)); #endif } @@ -943,7 +943,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyBytes_FromString(rtn); + return PyString_FromString(rtn); } static PyObject * @@ -1095,7 +1095,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyBytes_FromString(rtn); + return PyString_FromString(rtn); } static PyObject * @@ -1757,7 +1757,7 @@ ch = erasechar(); - return PyBytes_FromStringAndSize(&ch, 1); + return PyString_FromStringAndSize(&ch, 1); } static PyObject * @@ -2114,7 +2114,7 @@ } knp = keyname(ch); - return PyBytes_FromString((knp == NULL) ? "" : (char *)knp); + return PyString_FromString((knp == NULL) ? "" : (char *)knp); } #endif @@ -2125,7 +2125,7 @@ ch = killchar(); - return PyBytes_FromStringAndSize(&ch, 1); + return PyString_FromStringAndSize(&ch, 1); } static PyObject * @@ -2496,7 +2496,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString( capname ); + return PyString_FromString( capname ); } static PyObject * @@ -2520,7 +2520,7 @@ return NULL; } - return PyBytes_FromString(result); + return PyString_FromString(result); } static PyObject * @@ -2547,14 +2547,14 @@ if (PyInt_Check(temp)) ch = (chtype) PyInt_AsLong(temp); - else if (PyBytes_Check(temp)) - ch = (chtype) *PyBytes_AsString(temp); + else if (PyString_Check(temp)) + ch = (chtype) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; } - return PyBytes_FromString(unctrl(ch)); + return PyString_FromString(unctrl(ch)); } static PyObject * @@ -2569,8 +2569,8 @@ if (PyInt_Check(temp)) ch = (int) PyInt_AsLong(temp); - else if (PyBytes_Check(temp)) - ch = (int) *PyBytes_AsString(temp); + else if (PyString_Check(temp)) + ch = (int) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; @@ -2753,7 +2753,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyBytes_FromString(PyCursesVersion); + v = PyString_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/trunk/Modules/_elementtree.c ============================================================================== --- python/trunk/Modules/_elementtree.c (original) +++ python/trunk/Modules/_elementtree.c Mon Jun 9 06:58:54 2008 @@ -103,7 +103,7 @@ #define PyDict_CheckExact PyDict_Check #if (PY_VERSION_HEX < 0x02020000) #define PyList_CheckExact PyList_Check -#define PyBytes_CheckExact PyBytes_Check +#define PyString_CheckExact PyString_Check #if (PY_VERSION_HEX >= 0x01060000) #define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */ #endif @@ -173,7 +173,7 @@ switch (PyList_GET_SIZE(list)) { case 0: Py_DECREF(list); - return PyBytes_FromString(""); + return PyString_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); Py_INCREF(result); @@ -748,9 +748,9 @@ return 0; } #endif - if (PyBytes_Check(tag)) { - char *p = PyBytes_AS_STRING(tag); - for (i = 0; i < PyBytes_GET_SIZE(tag); i++) { + if (PyString_Check(tag)) { + char *p = PyString_AS_STRING(tag); + for (i = 0; i < PyString_GET_SIZE(tag); i++) { if (p[i] == '{') check = 0; else if (p[i] == '}') @@ -818,7 +818,7 @@ if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { PyObject* text = element_get_text(item); if (text == Py_None) - return PyBytes_FromString(""); + return PyString_FromString(""); Py_XINCREF(text); return text; } @@ -1154,12 +1154,12 @@ PyObject* repr; char buffer[100]; - repr = PyBytes_FromString("tag)); + PyString_ConcatAndDel(&repr, PyObject_Repr(self->tag)); sprintf(buffer, " at %p>", self); - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(buffer)); + PyString_ConcatAndDel(&repr, PyString_FromString(buffer)); return repr; } @@ -1617,14 +1617,14 @@ Py_INCREF(data); self->data = data; } else { /* more than one item; use a list to collect items */ - if (PyBytes_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && - PyBytes_CheckExact(data) && PyBytes_GET_SIZE(data) == 1) { + if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && + PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) { /* expat often generates single character data sections; handle the most common case by resizing the existing string... */ - Py_ssize_t size = PyBytes_GET_SIZE(self->data); - if (_PyBytes_Resize(&self->data, size + 1) < 0) + Py_ssize_t size = PyString_GET_SIZE(self->data); + if (_PyString_Resize(&self->data, size + 1) < 0) return NULL; - PyBytes_AS_STRING(self->data)[size] = PyBytes_AS_STRING(data)[0]; + PyString_AS_STRING(self->data)[size] = PyString_AS_STRING(data)[0]; } else if (PyList_CheckExact(self->data)) { if (PyList_Append(self->data, data) < 0) return NULL; @@ -1896,7 +1896,7 @@ return PyUnicode_DecodeUTF8(string, size, "strict"); #endif - return PyBytes_FromStringAndSize(string, size); + return PyString_FromStringAndSize(string, size); } LOCAL(PyObject*) @@ -1910,7 +1910,7 @@ PyObject* value; /* look the 'raw' name up in the names dictionary */ - key = PyBytes_FromStringAndSize(string, size); + key = PyString_FromStringAndSize(string, size); if (!key) return NULL; @@ -1932,8 +1932,8 @@ break; if (i != size) { /* convert to universal name */ - tag = PyBytes_FromStringAndSize(NULL, size+1); - p = PyBytes_AS_STRING(tag); + tag = PyString_FromStringAndSize(NULL, size+1); + p = PyString_AS_STRING(tag); p[0] = '{'; memcpy(p+1, string, size); size++; @@ -1947,7 +1947,7 @@ #if defined(Py_USING_UNICODE) /* inline makestring, to avoid duplicating the source string if it's not an utf-8 string */ - p = PyBytes_AS_STRING(tag); + p = PyString_AS_STRING(tag); if (checkstring(p, size)) { value = PyUnicode_DecodeUTF8(p, size, "strict"); Py_DECREF(tag); @@ -2004,7 +2004,7 @@ } else { PyErr_Format( PyExc_SyntaxError, "undefined entity &%s;: line %ld, column %ld", - PyBytes_AS_STRING(key), + PyString_AS_STRING(key), EXPAT(GetErrorLineNumber)(self->parser), EXPAT(GetErrorColumnNumber)(self->parser) ); @@ -2435,13 +2435,13 @@ return NULL; } - if (!PyBytes_CheckExact(buffer) || PyBytes_GET_SIZE(buffer) == 0) { + if (!PyString_CheckExact(buffer) || PyString_GET_SIZE(buffer) == 0) { Py_DECREF(buffer); break; } res = expat_parse( - self, PyBytes_AS_STRING(buffer), PyBytes_GET_SIZE(buffer), 0 + self, PyString_AS_STRING(buffer), PyString_GET_SIZE(buffer), 0 ); Py_DECREF(buffer); @@ -2503,7 +2503,7 @@ if (event_set == Py_None) { /* default is "end" only */ - target->end_event_obj = PyBytes_FromString("end"); + target->end_event_obj = PyString_FromString("end"); Py_RETURN_NONE; } @@ -2513,9 +2513,9 @@ for (i = 0; i < PyTuple_GET_SIZE(event_set); i++) { PyObject* item = PyTuple_GET_ITEM(event_set, i); char* event; - if (!PyBytes_Check(item)) + if (!PyString_Check(item)) goto error; - event = PyBytes_AS_STRING(item); + event = PyString_AS_STRING(item); if (strcmp(event, "start") == 0) { Py_INCREF(item); target->start_event_obj = item; @@ -2587,7 +2587,7 @@ char buffer[100]; sprintf(buffer, "Expat %d.%d.%d", XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } else { PyErr_SetString(PyExc_AttributeError, name); return NULL; Modified: python/trunk/Modules/_fileio.c ============================================================================== --- python/trunk/Modules/_fileio.c (original) +++ python/trunk/Modules/_fileio.c Mon Jun 9 06:58:54 2008 @@ -392,14 +392,14 @@ Py_ssize_t total = 0; int n; - result = PyBytes_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); + result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); if (result == NULL) return NULL; while (1) { Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyBytes_GET_SIZE(result) < newsize) { - if (_PyBytes_Resize(&result, newsize) < 0) { + if (PyString_GET_SIZE(result) < newsize) { + if (_PyString_Resize(&result, newsize) < 0) { if (total == 0) { Py_DECREF(result); return NULL; @@ -411,7 +411,7 @@ Py_BEGIN_ALLOW_THREADS errno = 0; n = read(self->fd, - PyBytes_AS_STRING(result) + total, + PyString_AS_STRING(result) + total, newsize - total); Py_END_ALLOW_THREADS if (n == 0) @@ -430,8 +430,8 @@ total += n; } - if (PyBytes_GET_SIZE(result) > total) { - if (_PyBytes_Resize(&result, total) < 0) { + if (PyString_GET_SIZE(result) > total) { + if (_PyString_Resize(&result, total) < 0) { /* This should never happen, but just in case */ Py_DECREF(result); return NULL; @@ -460,10 +460,10 @@ return fileio_readall(self); } - bytes = PyBytes_FromStringAndSize(NULL, size); + bytes = PyString_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; - ptr = PyBytes_AS_STRING(bytes); + ptr = PyString_AS_STRING(bytes); Py_BEGIN_ALLOW_THREADS errno = 0; @@ -478,7 +478,7 @@ } if (n != size) { - if (_PyBytes_Resize(&bytes, n) < 0) { + if (_PyString_Resize(&bytes, n) < 0) { Py_DECREF(bytes); return NULL; } @@ -690,9 +690,9 @@ fileio_repr(PyFileIOObject *self) { if (self->fd < 0) - return PyBytes_FromFormat("_fileio._FileIO(-1)"); + return PyString_FromFormat("_fileio._FileIO(-1)"); - return PyBytes_FromFormat("_fileio._FileIO(%d, '%s')", + return PyString_FromFormat("_fileio._FileIO(%d, '%s')", self->fd, mode_string(self)); } @@ -816,7 +816,7 @@ static PyObject * get_mode(PyFileIOObject *self, void *closure) { - return PyBytes_FromString(mode_string(self)); + return PyString_FromString(mode_string(self)); } static PyGetSetDef fileio_getsetlist[] = { Modified: python/trunk/Modules/_hashopenssl.c ============================================================================== --- python/trunk/Modules/_hashopenssl.c (original) +++ python/trunk/Modules/_hashopenssl.c Mon Jun 9 06:58:54 2008 @@ -103,7 +103,7 @@ digest_size = EVP_MD_CTX_size(&temp_ctx); EVP_DigestFinal(&temp_ctx, digest, NULL); - retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); + retval = PyString_FromStringAndSize((const char *)digest, digest_size); EVP_MD_CTX_cleanup(&temp_ctx); return retval; } @@ -130,10 +130,10 @@ /* Create a new string */ /* NOTE: not thread safe! modifying an already created string object */ /* (not a problem because we hold the GIL by default) */ - retval = PyBytes_FromStringAndSize(NULL, digest_size * 2); + retval = PyString_FromStringAndSize(NULL, digest_size * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -220,8 +220,8 @@ { char buf[100]; PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>", - PyBytes_AsString(((EVPobject *)self)->name), self); - return PyBytes_FromString(buf); + PyString_AsString(((EVPobject *)self)->name), self); + return PyString_FromString(buf); } #if HASH_OBJ_CONSTRUCTOR @@ -421,7 +421,7 @@ /* used in the init function to setup a constructor */ #define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ - CONST_ ## NAME ## _name_obj = PyBytes_FromString(#NAME); \ + CONST_ ## NAME ## _name_obj = PyString_FromString(#NAME); \ if (EVP_get_digestbyname(#NAME)) { \ CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ Modified: python/trunk/Modules/_heapqmodule.c ============================================================================== --- python/trunk/Modules/_heapqmodule.c (original) +++ python/trunk/Modules/_heapqmodule.c Mon Jun 9 06:58:54 2008 @@ -687,6 +687,6 @@ m = Py_InitModule3("_heapq", heapq_methods, module_doc); if (m == NULL) return; - PyModule_AddObject(m, "__about__", PyBytes_FromString(__about__)); + PyModule_AddObject(m, "__about__", PyString_FromString(__about__)); } Modified: python/trunk/Modules/_hotshot.c ============================================================================== --- python/trunk/Modules/_hotshot.c (original) +++ python/trunk/Modules/_hotshot.c Mon Jun 9 06:58:54 2008 @@ -326,7 +326,7 @@ return ERR_EOF; } } - *pvalue = PyBytes_FromStringAndSize(buf, len); + *pvalue = PyString_FromStringAndSize(buf, len); free(buf); if (*pvalue == NULL) { return ERR_EXCEPTION; @@ -562,7 +562,7 @@ self->index - written); self->index -= written; if (written == 0) { - char *s = PyBytes_AsString(self->logfilename); + char *s = PyString_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -570,7 +570,7 @@ } if (written > 0) { if (fflush(self->logfp)) { - char *s = PyBytes_AsString(self->logfilename); + char *s = PyString_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -792,7 +792,7 @@ self->next_fileno++; Py_DECREF(obj); if (pack_define_file(self, fileno, - PyBytes_AS_STRING(fcode->co_filename)) < 0) + PyString_AS_STRING(fcode->co_filename)) < 0) return -1; } else { @@ -810,7 +810,7 @@ PyObject *name = PyDict_GetItem(dict, obj); if (name == NULL) { if (pack_define_func(self, fileno, fcode->co_firstlineno, - PyBytes_AS_STRING(fcode->co_name)) < 0) { + PyString_AS_STRING(fcode->co_name)) < 0) { Py_DECREF(obj); return -1; } @@ -1471,7 +1471,7 @@ len = PyList_GET_SIZE(temp); for (i = 0; i < len; ++i) { PyObject *item = PyList_GET_ITEM(temp, i); - buffer = PyBytes_AsString(item); + buffer = PyString_AsString(item); if (buffer == NULL) { pack_add_info(self, "sys-path-entry", ""); PyErr_Clear(); Modified: python/trunk/Modules/_json.c ============================================================================== --- python/trunk/Modules/_json.c (original) +++ python/trunk/Modules/_json.c Mon Jun 9 06:58:54 2008 @@ -70,11 +70,11 @@ input_unicode = PyUnicode_AS_UNICODE(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyBytes_FromStringAndSize(NULL, output_size); + rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -92,14 +92,14 @@ if (output_size > 2 + (input_chars * MAX_EXPANSION)) { output_size = 2 + (input_chars * MAX_EXPANSION); } - if (_PyBytes_Resize(&rval, output_size) == -1) { + if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyBytes_Resize(&rval, chars) == -1) { + if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -116,15 +116,15 @@ char *output; char *input_str; - input_chars = PyBytes_GET_SIZE(pystr); - input_str = PyBytes_AS_STRING(pystr); + input_chars = PyString_GET_SIZE(pystr); + input_str = PyString_AS_STRING(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyBytes_FromStringAndSize(NULL, output_size); + rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -154,14 +154,14 @@ if (output_size > 2 + (input_chars * MIN_EXPANSION)) { output_size = 2 + (input_chars * MIN_EXPANSION); } - if (_PyBytes_Resize(&rval, output_size) == -1) { + if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyBytes_Resize(&rval, chars) == -1) { + if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -215,7 +215,7 @@ ustr = PyUnicode_FromUnicode(&c, 0); } if (joinstr == NULL) { - joinstr = PyBytes_InternFromString("join"); + joinstr = PyString_InternFromString("join"); } if (joinstr == NULL || ustr == NULL) { return NULL; @@ -227,10 +227,10 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) { PyObject *rval; - Py_ssize_t len = PyBytes_GET_SIZE(pystr); + Py_ssize_t len = PyString_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; - char *buf = PyBytes_AS_STRING(pystr); + char *buf = PyString_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; @@ -555,7 +555,7 @@ if (encoding == NULL) { encoding = DEFAULT_ENCODING; } - if (PyBytes_Check(pystr)) { + if (PyString_Check(pystr)) { return scanstring_str(pystr, end, encoding, strict); } else if (PyUnicode_Check(pystr)) { @@ -576,7 +576,7 @@ py_encode_basestring_ascii(PyObject* self, PyObject *pystr) { /* METH_O */ - if (PyBytes_Check(pystr)) { + if (PyString_Check(pystr)) { return ascii_escape_str(pystr); } else if (PyUnicode_Check(pystr)) { Modified: python/trunk/Modules/_localemodule.c ============================================================================== --- python/trunk/Modules/_localemodule.c (original) +++ python/trunk/Modules/_localemodule.c Mon Jun 9 06:58:54 2008 @@ -119,7 +119,7 @@ if (isupper(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -134,7 +134,7 @@ if (islower(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -149,7 +149,7 @@ if (isalpha(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -175,7 +175,7 @@ PyErr_SetString(Error, "unsupported locale setting"); return NULL; } - result_object = PyBytes_FromString(result); + result_object = PyString_FromString(result); if (!result_object) return NULL; /* record changes to LC_CTYPE */ @@ -190,7 +190,7 @@ PyErr_SetString(Error, "locale query failed"); return NULL; } - result_object = PyBytes_FromString(result); + result_object = PyString_FromString(result); } return result_object; } @@ -216,7 +216,7 @@ involved herein */ #define RESULT_STRING(s)\ - x = PyBytes_FromString(l->s);\ + x = PyString_FromString(l->s);\ if (!x) goto failed;\ PyDict_SetItemString(result, #s, x);\ Py_XDECREF(x) @@ -284,9 +284,9 @@ if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2)) return NULL; /* If both arguments are byte strings, use strcoll. */ - if (PyBytes_Check(os1) && PyBytes_Check(os2)) - return PyInt_FromLong(strcoll(PyBytes_AS_STRING(os1), - PyBytes_AS_STRING(os2))); + if (PyString_Check(os1) && PyString_Check(os2)) + return PyInt_FromLong(strcoll(PyString_AS_STRING(os1), + PyString_AS_STRING(os2))); /* If neither argument is unicode, it's an error. */ if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) { PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings"); @@ -368,7 +368,7 @@ return PyErr_NoMemory(); strxfrm(buf, s, n2); } - result = PyBytes_FromString(buf); + result = PyString_FromString(buf); PyMem_Free(buf); return result; } @@ -563,13 +563,13 @@ return NULL; /* Check whether this is a supported constant. GNU libc sometimes returns numeric values in the char* return value, which would - crash PyBytes_FromString. */ + crash PyString_FromString. */ for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) { /* Check NULL as a workaround for GNU libc's returning NULL instead of an empty string for nl_langinfo(ERA). */ const char *result = nl_langinfo(item); - return PyBytes_FromString(result != NULL ? result : ""); + return PyString_FromString(result != NULL ? result : ""); } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; @@ -588,7 +588,7 @@ char *in; if (!PyArg_ParseTuple(args, "z", &in)) return 0; - return PyBytes_FromString(gettext(in)); + return PyString_FromString(gettext(in)); } PyDoc_STRVAR(dgettext__doc__, @@ -601,7 +601,7 @@ char *domain, *in; if (!PyArg_ParseTuple(args, "zz", &domain, &in)) return 0; - return PyBytes_FromString(dgettext(domain, in)); + return PyString_FromString(dgettext(domain, in)); } PyDoc_STRVAR(dcgettext__doc__, @@ -615,7 +615,7 @@ int category; if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category)) return 0; - return PyBytes_FromString(dcgettext(domain,msgid,category)); + return PyString_FromString(dcgettext(domain,msgid,category)); } PyDoc_STRVAR(textdomain__doc__, @@ -633,7 +633,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyBytes_FromString(domain); + return PyString_FromString(domain); } PyDoc_STRVAR(bindtextdomain__doc__, @@ -651,7 +651,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyBytes_FromString(dirname); + return PyString_FromString(dirname); } #ifdef HAVE_BIND_TEXTDOMAIN_CODESET @@ -667,7 +667,7 @@ return NULL; codeset = bind_textdomain_codeset(domain, codeset); if (codeset) - return PyBytes_FromString(codeset); + return PyString_FromString(codeset); Py_RETURN_NONE; } #endif @@ -760,7 +760,7 @@ Error = PyErr_NewException("locale.Error", NULL, NULL); PyDict_SetItemString(d, "Error", Error); - x = PyBytes_FromString(locale__doc__); + x = PyString_FromString(locale__doc__); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/trunk/Modules/_lsprof.c ============================================================================== --- python/trunk/Modules/_lsprof.c (original) +++ python/trunk/Modules/_lsprof.c Mon Jun 9 06:58:54 2008 @@ -179,8 +179,8 @@ /* built-in function: look up the module name */ PyObject *mod = fn->m_module; char *modname; - if (mod && PyBytes_Check(mod)) { - modname = PyBytes_AS_STRING(mod); + if (mod && PyString_Check(mod)) { + modname = PyString_AS_STRING(mod); } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); @@ -193,11 +193,11 @@ modname = "__builtin__"; } if (strcmp(modname, "__builtin__") != 0) - return PyBytes_FromFormat("<%s.%s>", + return PyString_FromFormat("<%s.%s>", modname, fn->m_ml->ml_name); else - return PyBytes_FromFormat("<%s>", + return PyString_FromFormat("<%s>", fn->m_ml->ml_name); } else { @@ -205,7 +205,7 @@ repr(getattr(type(__self__), __name__)) */ PyObject *self = fn->m_self; - PyObject *name = PyBytes_FromString(fn->m_ml->ml_name); + PyObject *name = PyString_FromString(fn->m_ml->ml_name); if (name != NULL) { PyObject *mo = _PyType_Lookup(Py_TYPE(self), name); Py_XINCREF(mo); @@ -218,7 +218,7 @@ } } PyErr_Clear(); - return PyBytes_FromFormat("", + return PyString_FromFormat("", fn->m_ml->ml_name); } } Modified: python/trunk/Modules/_sqlite/cache.c ============================================================================== --- python/trunk/Modules/_sqlite/cache.c (original) +++ python/trunk/Modules/_sqlite/cache.c Mon Jun 9 06:58:54 2008 @@ -241,12 +241,12 @@ if (!fmt_args) { return NULL; } - template = PyBytes_FromString("%s <- %s ->%s\n"); + template = PyString_FromString("%s <- %s ->%s\n"); if (!template) { Py_DECREF(fmt_args); return NULL; } - display_str = PyBytes_Format(template, fmt_args); + display_str = PyString_Format(template, fmt_args); Py_DECREF(template); Py_DECREF(fmt_args); if (!display_str) { Modified: python/trunk/Modules/_sqlite/connection.c ============================================================================== --- python/trunk/Modules/_sqlite/connection.c (original) +++ python/trunk/Modules/_sqlite/connection.c Mon Jun 9 06:58:54 2008 @@ -84,8 +84,8 @@ Py_INCREF(&PyUnicode_Type); self->text_factory = (PyObject*)&PyUnicode_Type; - if (PyBytes_Check(database) || PyUnicode_Check(database)) { - if (PyBytes_Check(database)) { + if (PyString_Check(database) || PyUnicode_Check(database)) { + if (PyString_Check(database)) { database_utf8 = database; Py_INCREF(database_utf8); } else { @@ -96,7 +96,7 @@ } Py_BEGIN_ALLOW_THREADS - rc = sqlite3_open(PyBytes_AsString(database_utf8), &self->db); + rc = sqlite3_open(PyString_AsString(database_utf8), &self->db); Py_END_ALLOW_THREADS Py_DECREF(database_utf8); @@ -111,7 +111,7 @@ if (class_attr) { class_attr_str = PyObject_Str(class_attr); if (class_attr_str) { - if (strcmp(PyBytes_AsString(class_attr_str), "") == 0) { + if (strcmp(PyString_AsString(class_attr_str), "") == 0) { /* In the APSW Connection object, the first entry after * PyObject_HEAD is the sqlite3* we want to get hold of. * Luckily, this is the same layout as we have in our @@ -134,7 +134,7 @@ } if (!isolation_level) { - isolation_level = PyBytes_FromString(""); + isolation_level = PyString_FromString(""); if (!isolation_level) { return -1; } @@ -499,12 +499,12 @@ } else { sqlite3_result_blob(context, buffer, buflen, SQLITE_TRANSIENT); } - } else if (PyBytes_Check(py_val)) { - sqlite3_result_text(context, PyBytes_AsString(py_val), -1, SQLITE_TRANSIENT); + } else if (PyString_Check(py_val)) { + sqlite3_result_text(context, PyString_AsString(py_val), -1, SQLITE_TRANSIENT); } else if (PyUnicode_Check(py_val)) { stringval = PyUnicode_AsUTF8String(py_val); if (stringval) { - sqlite3_result_text(context, PyBytes_AsString(stringval), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, PyString_AsString(stringval), -1, SQLITE_TRANSIENT); Py_DECREF(stringval); } } else { @@ -963,21 +963,21 @@ Py_INCREF(isolation_level); self->isolation_level = isolation_level; - begin_statement = PyBytes_FromString("BEGIN "); + begin_statement = PyString_FromString("BEGIN "); if (!begin_statement) { return -1; } - PyBytes_Concat(&begin_statement, isolation_level); + PyString_Concat(&begin_statement, isolation_level); if (!begin_statement) { return -1; } - self->begin_statement = PyMem_Malloc(PyBytes_Size(begin_statement) + 2); + self->begin_statement = PyMem_Malloc(PyString_Size(begin_statement) + 2); if (!self->begin_statement) { return -1; } - strcpy(self->begin_statement, PyBytes_AsString(begin_statement)); + strcpy(self->begin_statement, PyString_AsString(begin_statement)); Py_DECREF(begin_statement); } @@ -1152,8 +1152,8 @@ goto finally; } - string1 = PyBytes_FromStringAndSize((const char*)text1_data, text1_length); - string2 = PyBytes_FromStringAndSize((const char*)text2_data, text2_length); + string1 = PyString_FromStringAndSize((const char*)text1_data, text1_length); + string2 = PyString_FromStringAndSize((const char*)text2_data, text2_length); if (!string1 || !string2) { goto finally; /* failed to allocate strings */ @@ -1259,7 +1259,7 @@ goto finally; } - if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyBytes_Type, &name, &callable)) { + if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyString_Type, &name, &callable)) { goto finally; } @@ -1268,7 +1268,7 @@ goto finally; } - chk = PyBytes_AsString(uppercase_name); + chk = PyString_AsString(uppercase_name); while (*chk) { if ((*chk >= '0' && *chk <= '9') || (*chk >= 'A' && *chk <= 'Z') @@ -1293,7 +1293,7 @@ } rc = sqlite3_create_collation(self->db, - PyBytes_AsString(uppercase_name), + PyString_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, (callable != Py_None) ? pysqlite_collation_callback : NULL); Modified: python/trunk/Modules/_sqlite/connection.h ============================================================================== --- python/trunk/Modules/_sqlite/connection.h (original) +++ python/trunk/Modules/_sqlite/connection.h Mon Jun 9 06:58:54 2008 @@ -80,7 +80,7 @@ /* Determines how bytestrings from SQLite are converted to Python objects: * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created. - * - PyBytes_Type: PyStrings are created as-is. + * - PyString_Type: PyStrings are created as-is. * - Any custom callable: Any object returned from the callable called with the bytestring * as single parameter. */ Modified: python/trunk/Modules/_sqlite/cursor.c ============================================================================== --- python/trunk/Modules/_sqlite/cursor.c (original) +++ python/trunk/Modules/_sqlite/cursor.c Mon Jun 9 06:58:54 2008 @@ -178,7 +178,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyBytes_FromStringAndSize(type_start, pos - type_start); + key = PyString_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -203,7 +203,7 @@ * 'NUMBER(10)' to be treated as 'NUMBER', for example. * In other words, it will work as people expect it to work.*/ if (*pos == ' ' || *pos == '(' || *pos == 0) { - py_decltype = PyBytes_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; } @@ -248,7 +248,7 @@ if ((*pos == '[') && (pos > colname) && (*(pos-1) == ' ')) { pos--; } - return PyBytes_FromStringAndSize(colname, pos - colname); + return PyString_FromStringAndSize(colname, pos - colname); } } } @@ -273,7 +273,7 @@ } if (is_ascii) { - return PyBytes_FromString(val_str); + return PyString_FromString(val_str); } else { return PyUnicode_DecodeUTF8(val_str, strlen(val_str), NULL); } @@ -327,7 +327,7 @@ Py_INCREF(Py_None); converted = Py_None; } else { - item = PyBytes_FromStringAndSize(val_str, nbytes); + item = PyString_FromStringAndSize(val_str, nbytes); if (!item) { return NULL; } @@ -370,8 +370,8 @@ colname , val_str); PyErr_SetString(pysqlite_OperationalError, buf); } - } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) { - converted = PyBytes_FromString(val_str); + } else if (self->connection->text_factory == (PyObject*)&PyString_Type) { + converted = PyString_FromString(val_str); } else { converted = PyObject_CallFunction(self->connection->text_factory, "s", val_str); } @@ -442,7 +442,7 @@ return NULL; } - if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -464,7 +464,7 @@ return NULL; } - if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -499,15 +499,15 @@ rc = pysqlite_statement_reset(self->statement); } - if (PyBytes_Check(operation)) { - operation_cstr = PyBytes_AsString(operation); + if (PyString_Check(operation)) { + operation_cstr = PyString_AsString(operation); } else { operation_bytestr = PyUnicode_AsUTF8String(operation); if (!operation_bytestr) { goto error; } - operation_cstr = PyBytes_AsString(operation_bytestr); + operation_cstr = PyString_AsString(operation_bytestr); } /* reset description and rowcount */ @@ -764,15 +764,15 @@ return NULL; } - if (PyBytes_Check(script_obj)) { - script_cstr = PyBytes_AsString(script_obj); + if (PyString_Check(script_obj)) { + script_cstr = PyString_AsString(script_obj); } else if (PyUnicode_Check(script_obj)) { script_str = PyUnicode_AsUTF8String(script_obj); if (!script_str) { return NULL; } - script_cstr = PyBytes_AsString(script_str); + script_cstr = PyString_AsString(script_str); } else { PyErr_SetString(PyExc_ValueError, "script argument must be unicode or string."); return NULL; Modified: python/trunk/Modules/_sqlite/module.c ============================================================================== --- python/trunk/Modules/_sqlite/module.c (original) +++ python/trunk/Modules/_sqlite/module.c Mon Jun 9 06:58:54 2008 @@ -137,7 +137,7 @@ /* a basic type is adapted; there's a performance optimization if that's not the case * (99 % of all usages) */ if (type == &PyInt_Type || type == &PyLong_Type || type == &PyFloat_Type - || type == &PyBytes_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { + || type == &PyString_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { pysqlite_BaseTypeAdapted = 1; } @@ -367,13 +367,13 @@ Py_DECREF(tmp_obj); } - if (!(tmp_obj = PyBytes_FromString(PYSQLITE_VERSION))) { + if (!(tmp_obj = PyString_FromString(PYSQLITE_VERSION))) { goto error; } PyDict_SetItemString(dict, "version", tmp_obj); Py_DECREF(tmp_obj); - if (!(tmp_obj = PyBytes_FromString(sqlite3_libversion()))) { + if (!(tmp_obj = PyString_FromString(sqlite3_libversion()))) { goto error; } PyDict_SetItemString(dict, "sqlite_version", tmp_obj); Modified: python/trunk/Modules/_sqlite/row.c ============================================================================== --- python/trunk/Modules/_sqlite/row.c (original) +++ python/trunk/Modules/_sqlite/row.c Mon Jun 9 06:58:54 2008 @@ -86,13 +86,13 @@ item = PyTuple_GetItem(self->data, _idx); Py_XINCREF(item); return item; - } else if (PyBytes_Check(idx)) { - key = PyBytes_AsString(idx); + } else if (PyString_Check(idx)) { + key = PyString_AsString(idx); nitems = PyTuple_Size(self->description); for (i = 0; i < nitems; i++) { - compare_key = PyBytes_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); + compare_key = PyString_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); if (!compare_key) { return NULL; } Modified: python/trunk/Modules/_sqlite/statement.c ============================================================================== --- python/trunk/Modules/_sqlite/statement.c (original) +++ python/trunk/Modules/_sqlite/statement.c Mon Jun 9 06:58:54 2008 @@ -60,7 +60,7 @@ self->st = NULL; self->in_use = 0; - if (PyBytes_Check(sql)) { + if (PyString_Check(sql)) { sql_str = sql; Py_INCREF(sql_str); } else if (PyUnicode_Check(sql)) { @@ -77,7 +77,7 @@ self->in_weakreflist = NULL; self->sql = sql_str; - sql_cstr = PyBytes_AsString(sql_str); + sql_cstr = PyString_AsString(sql_str); rc = sqlite3_prepare(connection->db, sql_cstr, @@ -119,7 +119,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_CheckExact(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_CheckExact(parameter)) { + } else if (PyString_CheckExact(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_CheckExact(parameter)) { paramtype = TYPE_UNICODE; @@ -131,7 +131,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_Check(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_Check(parameter)) { + } else if (PyString_Check(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_Check(parameter)) { paramtype = TYPE_UNICODE; @@ -140,7 +140,7 @@ } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); @@ -164,12 +164,12 @@ rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_STRING: - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_UNICODE: stringval = PyUnicode_AsUTF8String(parameter); - string = PyBytes_AsString(stringval); + string = PyString_AsString(stringval); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); break; @@ -197,7 +197,7 @@ } if (PyInt_CheckExact(obj) || PyLong_CheckExact(obj) - || PyFloat_CheckExact(obj) || PyBytes_CheckExact(obj) + || PyFloat_CheckExact(obj) || PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || PyBuffer_Check(obj)) { return 0; } else { @@ -326,7 +326,7 @@ char* sql_cstr; sqlite3_stmt* new_st; - sql_cstr = PyBytes_AsString(self->sql); + sql_cstr = PyString_AsString(self->sql); rc = sqlite3_prepare(self->db, sql_cstr, Modified: python/trunk/Modules/_sre.c ============================================================================== --- python/trunk/Modules/_sre.c (original) +++ python/trunk/Modules/_sre.c Mon Jun 9 06:58:54 2008 @@ -1715,7 +1715,7 @@ size = PyObject_Length(string); #endif - if (PyBytes_Check(string) || bytes == size) + if (PyString_Check(string) || bytes == size) charsize = 1; #if defined(HAVE_UNICODE) else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE))) @@ -1949,7 +1949,7 @@ if (!args) return NULL; - name = PyBytes_FromString(module); + name = PyString_FromString(module); if (!name) return NULL; mod = PyImport_Import(name); @@ -3416,7 +3416,7 @@ Py_DECREF(x); } - x = PyBytes_FromString(copyright); + x = PyString_FromString(copyright); if (x) { PyDict_SetItemString(d, "copyright", x); Py_DECREF(x); Modified: python/trunk/Modules/_ssl.c ============================================================================== --- python/trunk/Modules/_ssl.c (original) +++ python/trunk/Modules/_ssl.c Mon Jun 9 06:58:54 2008 @@ -491,13 +491,13 @@ static PyObject * PySSL_server(PySSLObject *self) { - return PyBytes_FromString(self->server); + return PyString_FromString(self->server); } static PyObject * PySSL_issuer(PySSLObject *self) { - return PyBytes_FromString(self->issuer); + return PyString_FromString(self->issuer); } static PyObject * @@ -515,7 +515,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail; } - name_obj = PyBytes_FromStringAndSize(namebuf, buflen); + name_obj = PyString_FromStringAndSize(namebuf, buflen); if (name_obj == NULL) goto fail; @@ -603,8 +603,8 @@ /* fprintf(stderr, "RDN level %d, attribute %s: %s\n", entry->set, - PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 0)), - PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 1))); + PyString_AS_STRING(PyTuple_GET_ITEM(attr, 0)), + PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1))); */ if (attr == NULL) goto fail1; @@ -711,7 +711,7 @@ goto fail; } - v = PyBytes_FromString("DirName"); + v = PyString_FromString("DirName"); if (v == NULL) { Py_DECREF(t); goto fail; @@ -742,13 +742,13 @@ t = PyTuple_New(2); if (t == NULL) goto fail; - v = PyBytes_FromStringAndSize(buf, (vptr - buf)); + v = PyString_FromStringAndSize(buf, (vptr - buf)); if (v == NULL) { Py_DECREF(t); goto fail; } PyTuple_SET_ITEM(t, 0, v); - v = PyBytes_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); + v = PyString_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); if (v == NULL) { Py_DECREF(t); goto fail; @@ -849,7 +849,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - sn_obj = PyBytes_FromStringAndSize(buf, len); + sn_obj = PyString_FromStringAndSize(buf, len); if (sn_obj == NULL) goto fail1; if (PyDict_SetItemString(retval, "serialNumber", sn_obj) < 0) { @@ -866,7 +866,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotBefore = PyBytes_FromStringAndSize(buf, len); + pnotBefore = PyString_FromStringAndSize(buf, len); if (pnotBefore == NULL) goto fail1; if (PyDict_SetItemString(retval, "notBefore", pnotBefore) < 0) { @@ -884,7 +884,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotAfter = PyBytes_FromStringAndSize(buf, len); + pnotAfter = PyString_FromStringAndSize(buf, len); if (pnotAfter == NULL) goto fail1; if (PyDict_SetItemString(retval, "notAfter", pnotAfter) < 0) { @@ -981,7 +981,7 @@ PySSL_SetError(self, len, __FILE__, __LINE__); return NULL; } - retval = PyBytes_FromStringAndSize((const char *) bytes_buf, len); + retval = PyString_FromStringAndSize((const char *) bytes_buf, len); OPENSSL_free(bytes_buf); return retval; @@ -1028,7 +1028,7 @@ if (cipher_name == NULL) { PyTuple_SET_ITEM(retval, 0, Py_None); } else { - v = PyBytes_FromString(cipher_name); + v = PyString_FromString(cipher_name); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 0, v); @@ -1037,7 +1037,7 @@ if (cipher_protocol == NULL) { PyTuple_SET_ITEM(retval, 1, Py_None); } else { - v = PyBytes_FromString(cipher_protocol); + v = PyString_FromString(cipher_protocol); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 1, v); @@ -1211,7 +1211,7 @@ if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; - if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) + if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; /* first check if there are bytes ready to be read */ @@ -1233,14 +1233,14 @@ return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { /* should contain a zero-length string */ - _PyBytes_Resize(&buf, 0); + _PyString_Resize(&buf, 0); return buf; } } do { err = 0; PySSL_BEGIN_ALLOW_THREADS - count = SSL_read(self->ssl, PyBytes_AsString(buf), len); + count = SSL_read(self->ssl, PyString_AsString(buf), len); err = SSL_get_error(self->ssl, count); PySSL_END_ALLOW_THREADS if(PyErr_CheckSignals()) { @@ -1257,7 +1257,7 @@ (SSL_get_shutdown(self->ssl) == SSL_RECEIVED_SHUTDOWN)) { - _PyBytes_Resize(&buf, 0); + _PyString_Resize(&buf, 0); return buf; } else { sockstate = SOCKET_OPERATION_OK; @@ -1276,7 +1276,7 @@ return PySSL_SetError(self, count, __FILE__, __LINE__); } if (count != len) - _PyBytes_Resize(&buf, count); + _PyString_Resize(&buf, count); return buf; } @@ -1362,11 +1362,11 @@ { int bytes; - if (!PyBytes_Check(arg)) + if (!PyString_Check(arg)) return PyErr_Format(PyExc_TypeError, "RAND_egd() expected string, found %s", Py_TYPE(arg)->tp_name); - bytes = RAND_egd(PyBytes_AS_STRING(arg)); + bytes = RAND_egd(PyString_AS_STRING(arg)); if (bytes == -1) { PyErr_SetString(PySSLErrorObject, "EGD connection failed or EGD did not return " Modified: python/trunk/Modules/_struct.c ============================================================================== --- python/trunk/Modules/_struct.c (original) +++ python/trunk/Modules/_struct.c Mon Jun 9 06:58:54 2008 @@ -413,7 +413,7 @@ if (msg == NULL) return -1; rval = PyErr_WarnEx(PyExc_DeprecationWarning, - PyBytes_AS_STRING(msg), 2); + PyString_AS_STRING(msg), 2); Py_DECREF(msg); if (rval == 0) return 0; @@ -446,7 +446,7 @@ static PyObject * nu_char(const char *p, const formatdef *f) { - return PyBytes_FromStringAndSize(p, 1); + return PyString_FromStringAndSize(p, 1); } static PyObject * @@ -610,12 +610,12 @@ static int np_char(char *p, PyObject *v, const formatdef *f) { - if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) { + if (!PyString_Check(v) || PyString_Size(v) != 1) { PyErr_SetString(StructError, "char format require string of length 1"); return -1; } - *p = *PyBytes_AsString(v); + *p = *PyString_AsString(v); return 0; } @@ -1335,7 +1335,7 @@ char c; Py_ssize_t size, len, num, itemsize, x; - fmt = PyBytes_AS_STRING(self->s_format); + fmt = PyString_AS_STRING(self->s_format); f = whichtable((char **)&fmt); @@ -1503,12 +1503,12 @@ const formatdef *e = code->fmtdef; const char *res = startfrom + code->offset; if (e->format == 's') { - v = PyBytes_FromStringAndSize(res, code->size); + v = PyString_FromStringAndSize(res, code->size); } else if (e->format == 'p') { Py_ssize_t n = *(unsigned char*)res; if (n >= code->size) n = code->size - 1; - v = PyBytes_FromStringAndSize(res + 1, n); + v = PyString_FromStringAndSize(res + 1, n); } else { v = e->unpack(res, e); } @@ -1542,9 +1542,9 @@ assert(soself->s_codes != NULL); if (inputstr == NULL) goto fail; - if (PyBytes_Check(inputstr) && - PyBytes_GET_SIZE(inputstr) == soself->s_size) { - return s_unpack_internal(soself, PyBytes_AS_STRING(inputstr)); + if (PyString_Check(inputstr) && + PyString_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); } args = PyTuple_Pack(1, inputstr); if (args == NULL) @@ -1637,27 +1637,27 @@ const formatdef *e = code->fmtdef; char *res = buf + code->offset; if (e->format == 's') { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(StructError, "argument for 's' must be a string"); return -1; } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > code->size) n = code->size; if (n > 0) - memcpy(res, PyBytes_AS_STRING(v), n); + memcpy(res, PyString_AS_STRING(v), n); } else if (e->format == 'p') { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(StructError, "argument for 'p' must be a string"); return -1; } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > (code->size - 1)) n = code->size - 1; if (n > 0) - memcpy(res + 1, PyBytes_AS_STRING(v), n); + memcpy(res + 1, PyString_AS_STRING(v), n); if (n > 255) n = 255; *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); @@ -1700,12 +1700,12 @@ } /* Allocate a new string */ - result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size); + result = PyString_FromStringAndSize((char *)NULL, soself->s_size); if (result == NULL) return NULL; /* Call the guts */ - if ( s_pack_internal(soself, args, 0, PyBytes_AS_STRING(result)) != 0 ) { + if ( s_pack_internal(soself, args, 0, PyString_AS_STRING(result)) != 0 ) { Py_DECREF(result); return NULL; } @@ -2061,7 +2061,7 @@ { PyObject *ver, *m; - ver = PyBytes_FromString("0.2"); + ver = PyString_FromString("0.2"); if (ver == NULL) return; Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Mon Jun 9 06:58:54 2008 @@ -691,7 +691,7 @@ } #endif -/* Some tests of PyBytes_FromFormat(). This needs more tests. */ +/* Some tests of PyString_FromFormat(). This needs more tests. */ static PyObject * test_string_from_format(PyObject *self, PyObject *args) { @@ -699,10 +699,10 @@ char *msg; #define CHECK_1_FORMAT(FORMAT, TYPE) \ - result = PyBytes_FromFormat(FORMAT, (TYPE)1); \ + result = PyString_FromFormat(FORMAT, (TYPE)1); \ if (result == NULL) \ return NULL; \ - if (strcmp(PyBytes_AsString(result), "1")) { \ + if (strcmp(PyString_AsString(result), "1")) { \ msg = FORMAT " failed at 1"; \ goto Fail; \ } \ Modified: python/trunk/Modules/_tkinter.c ============================================================================== --- python/trunk/Modules/_tkinter.c (original) +++ python/trunk/Modules/_tkinter.c Mon Jun 9 06:58:54 2008 @@ -335,8 +335,8 @@ static char * AsString(PyObject *value, PyObject *tmp) { - if (PyBytes_Check(value)) - return PyBytes_AsString(value); + if (PyString_Check(value)) + return PyString_AsString(value); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { PyObject *v = PyUnicode_AsUTF8String(value); @@ -347,7 +347,7 @@ return NULL; } Py_DECREF(v); - return PyBytes_AsString(v); + return PyString_AsString(v); } #endif else { @@ -359,7 +359,7 @@ return NULL; } Py_DECREF(v); - return PyBytes_AsString(v); + return PyString_AsString(v); } } @@ -462,13 +462,13 @@ * Could be a quoted string containing funnies, e.g. {"}. * Return the string itself. */ - return PyBytes_FromString(list); + return PyString_FromString(list); } if (argc == 0) - v = PyBytes_FromString(""); + v = PyString_FromString(""); else if (argc == 1) - v = PyBytes_FromString(argv[0]); + v = PyString_FromString(argv[0]); else if ((v = PyTuple_New(argc)) != NULL) { int i; PyObject *w; @@ -530,10 +530,10 @@ return result; /* Fall through, returning arg. */ } - else if (PyBytes_Check(arg)) { + else if (PyString_Check(arg)) { int argc; char **argv; - char *list = PyBytes_AsString(arg); + char *list = PyString_AsString(arg); if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { Py_INCREF(arg); @@ -541,7 +541,7 @@ } Tcl_Free(FREECAST argv); if (argc > 1) - return Split(PyBytes_AsString(arg)); + return Split(PyString_AsString(arg)); /* Fall through, returning arg. */ } Py_INCREF(arg); @@ -747,12 +747,12 @@ static PyObject * PyTclObject_str(PyTclObject *self) { - if (self->string && PyBytes_Check(self->string)) { + if (self->string && PyString_Check(self->string)) { Py_INCREF(self->string); return self->string; } /* XXX Could cache value if it is an ASCII string. */ - return PyBytes_FromString(Tcl_GetString(self->value)); + return PyString_FromString(Tcl_GetString(self->value)); } static char* @@ -778,16 +778,16 @@ #ifdef Py_USING_UNICODE if (i == len) /* It is an ASCII string. */ - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); else { self->string = PyUnicode_DecodeUTF8(s, len, "strict"); if (!self->string) { PyErr_Clear(); - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); } } #else - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); #endif if (!self->string) return NULL; @@ -820,7 +820,7 @@ char buf[50]; PyOS_snprintf(buf, 50, "<%s object at %p>", self->value->typePtr->name, self->value); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int @@ -839,7 +839,7 @@ static PyObject* get_typename(PyTclObject* obj, void* ignored) { - return PyBytes_FromString(obj->value->typePtr->name); + return PyString_FromString(obj->value->typePtr->name); } @@ -908,9 +908,9 @@ { Tcl_Obj *result; - if (PyBytes_Check(value)) - return Tcl_NewStringObj(PyBytes_AS_STRING(value), - PyBytes_GET_SIZE(value)); + if (PyString_Check(value)) + return Tcl_NewStringObj(PyString_AS_STRING(value), + PyString_GET_SIZE(value)); else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyInt_Check(value)) @@ -999,17 +999,17 @@ } if (i == value->length) - result = PyBytes_FromStringAndSize(s, len); + result = PyString_FromStringAndSize(s, len); else { /* Convert UTF-8 to Unicode string */ result = PyUnicode_DecodeUTF8(s, len, "strict"); if (result == NULL) { PyErr_Clear(); - result = PyBytes_FromStringAndSize(s, len); + result = PyString_FromStringAndSize(s, len); } } #else - result = PyBytes_FromStringAndSize(value->bytes, value->length); + result = PyString_FromStringAndSize(value->bytes, value->length); #endif return result; } @@ -1023,7 +1023,7 @@ if (value->typePtr == app->ByteArrayType) { int size; char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); - return PyBytes_FromStringAndSize(data, size); + return PyString_FromStringAndSize(data, size); } if (value->typePtr == app->DoubleType) { @@ -1092,7 +1092,7 @@ int size; char *c; c = Tcl_GetStringFromObj(value, &size); - return PyBytes_FromStringAndSize(c, size); + return PyString_FromStringAndSize(c, size); #endif } @@ -1204,19 +1204,19 @@ } if (*p == '\0') - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); else { /* Convert UTF-8 to Unicode string */ p = strchr(p, '\0'); res = PyUnicode_DecodeUTF8(s, (int)(p-s), "strict"); if (res == NULL) { PyErr_Clear(); - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); } } #else p = strchr(p, '\0'); - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); #endif } return res; @@ -1370,7 +1370,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL ckfree(cmd); } @@ -1396,7 +1396,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1419,7 +1419,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1443,7 +1443,7 @@ res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1466,7 +1466,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1511,8 +1511,8 @@ varname_converter(PyObject *in, void *_out) { char **out = (char**)_out; - if (PyBytes_Check(in)) { - *out = PyBytes_AsString(in); + if (PyString_Check(in)) { + *out = PyString_AsString(in); return 1; } if (PyTclObject_Check(in)) { @@ -1676,7 +1676,7 @@ res = FromObj(self, tres); } else { - res = PyBytes_FromString(Tcl_GetString(tres)); + res = PyString_FromString(Tcl_GetString(tres)); } } LEAVE_OVERLAP_TCL @@ -1920,7 +1920,7 @@ goto finally; for (i = 0; i < argc; i++) { - PyObject *s = PyBytes_FromString(argv[i]); + PyObject *s = PyString_FromString(argv[i]); if (!s || PyTuple_SetItem(v, i, s)) { Py_DECREF(v); v = NULL; @@ -1961,7 +1961,7 @@ PyObject *res = NULL; if (s) { - res = PyBytes_FromString(s); + res = PyString_FromString(s); ckfree(s); } @@ -2011,7 +2011,7 @@ return PythonCmd_Error(interp); for (i = 0; i < (argc - 1); i++) { - PyObject *s = PyBytes_FromString(argv[i + 1]); + PyObject *s = PyString_FromString(argv[i + 1]); if (!s || PyTuple_SetItem(arg, i, s)) { Py_DECREF(arg); return PythonCmd_Error(interp); @@ -2406,7 +2406,7 @@ PyOS_snprintf(buf, sizeof(buf), "", v, v->func == NULL ? ", handler deleted" : ""); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -3087,7 +3087,7 @@ static void ins_string(PyObject *d, char *name, char *val) { - PyObject *v = PyBytes_FromString(val); + PyObject *v = PyString_FromString(val); if (v) { PyDict_SetItemString(d, name, v); Py_DECREF(v); Modified: python/trunk/Modules/almodule.c ============================================================================== --- python/trunk/Modules/almodule.c (original) +++ python/trunk/Modules/almodule.c Mon Jun 9 06:58:54 2008 @@ -84,7 +84,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString((char *) value.ptr); + return PyString_FromString((char *) value.ptr); default: PyErr_SetString(ErrorObject, "unknown element type"); return NULL; @@ -149,12 +149,12 @@ PyErr_SetString(ErrorObject, "unknown element type"); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_BadArgument(); return -1; } - param->value.ptr = PyBytes_AS_STRING(value); - param->sizeIn = PyBytes_GET_SIZE(value)+1; /*account for NUL*/ + param->value.ptr = PyString_AS_STRING(value); + param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ break; case AL_SET_VAL: case AL_VECTOR_VAL: @@ -765,12 +765,12 @@ return NULL; } size *= ch; - v = PyBytes_FromStringAndSize((char *) NULL, size * framecount); + v = PyString_FromStringAndSize((char *) NULL, size * framecount); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyBytes_AS_STRING(v), framecount); + alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); Py_END_ALLOW_THREADS return v; @@ -1068,12 +1068,12 @@ width = ALgetwidth(c); #endif /* AL_405 */ ALfreeconfig(c); - v = PyBytes_FromStringAndSize((char *)NULL, width * count); + v = PyString_FromStringAndSize((char *)NULL, width * count); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyBytes_AsString(v), count); + ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); Py_END_ALLOW_THREADS if (ret == -1) { Py_DECREF(v); @@ -1498,7 +1498,7 @@ Py_INCREF(item); break; case AL_STRING_VAL: - item = PyBytes_FromString(pvs[i].value.ptr); + item = PyString_FromString(pvs[i].value.ptr); PyMem_DEL(pvs[i].value.ptr); break; case AL_MATRIX_VAL: @@ -1725,7 +1725,7 @@ PyDict_SetItemString(v, "elementType", item); Py_DECREF(item); - item = PyBytes_FromString(pinfo.name); + item = PyString_FromString(pinfo.name); PyDict_SetItemString(v, "name", item); Py_DECREF(item); @@ -1920,7 +1920,7 @@ return NULL; if ((name = ALgetname(device, descriptor)) == NULL) return NULL; - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Mon Jun 9 06:58:54 2008 @@ -104,7 +104,7 @@ static PyObject * c_getitem(arrayobject *ap, Py_ssize_t i) { - return PyBytes_FromStringAndSize(&((char *)ap->ob_item)[i], 1); + return PyString_FromStringAndSize(&((char *)ap->ob_item)[i], 1); } static int @@ -1414,7 +1414,7 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyBytes_FromStringAndSize(self->ob_item, + return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } @@ -1494,7 +1494,7 @@ array_get_typecode(arrayobject *a, void *closure) { char tc = a->ob_descr->typecode; - return PyBytes_FromStringAndSize(&tc, 1); + return PyString_FromStringAndSize(&tc, 1); } static PyObject * @@ -1578,7 +1578,7 @@ typecode = a->ob_descr->typecode; if (len == 0) { PyOS_snprintf(buf, sizeof(buf), "array('%c')", typecode); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } if (typecode == 'c') @@ -1593,9 +1593,9 @@ Py_XDECREF(v); PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); - s = PyBytes_FromString(buf); - PyBytes_ConcatAndDel(&s, t); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); + s = PyString_FromString(buf); + PyString_ConcatAndDel(&s, t); + PyString_ConcatAndDel(&s, PyString_FromString(")")); return s; } @@ -1881,7 +1881,7 @@ return NULL; if (!(initial == NULL || PyList_Check(initial) - || PyBytes_Check(initial) || PyTuple_Check(initial) + || PyString_Check(initial) || PyTuple_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { it = PyObject_GetIter(initial); if (it == NULL) @@ -1924,7 +1924,7 @@ } Py_DECREF(v); } - } else if (initial != NULL && PyBytes_Check(initial)) { + } else if (initial != NULL && PyString_Check(initial)) { PyObject *t_initial, *v; t_initial = PyTuple_Pack(1, initial); if (t_initial == NULL) { Modified: python/trunk/Modules/audioop.c ============================================================================== --- python/trunk/Modules/audioop.c (original) +++ python/trunk/Modules/audioop.c Mon Jun 9 06:58:54 2008 @@ -474,7 +474,7 @@ /* Passing a short** for an 's' argument is correct only if the string contents is aligned for interpretation - as short[]. Due to the definition of PyBytesObject, + as short[]. Due to the definition of PyStringObject, this is currently (Python 2.6) the case. */ if ( !PyArg_ParseTuple(args, "s#s#:findfit", (char**)&cp1, &len1, (char**)&cp2, &len2) ) @@ -759,10 +759,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -801,10 +801,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/2); + rv = PyString_FromStringAndSize(NULL, len/2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size*2 ) { @@ -846,10 +846,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*2); + rv = PyString_FromStringAndSize(NULL, len*2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -903,10 +903,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len1); + rv = PyString_FromStringAndSize(NULL, len1); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len1; i += size ) { if ( size == 1 ) val1 = (int)*CHARP(cp1, i); @@ -949,10 +949,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -985,10 +985,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1023,10 +1023,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len/size)*size2); + rv = PyString_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1157,7 +1157,7 @@ nbytes / bytes_per_frame != ceiling) str = NULL; else - str = PyBytes_FromStringAndSize(NULL, nbytes); + str = PyString_FromStringAndSize(NULL, nbytes); if (str == NULL) { PyErr_SetString(PyExc_MemoryError, @@ -1165,7 +1165,7 @@ goto exit; } } - ncp = PyBytes_AsString(str); + ncp = PyString_AsString(str); for (;;) { while (d < 0) { @@ -1182,13 +1182,13 @@ goto exit; /* We have checked before that the length * of the string fits into int. */ - len = (int)(ncp - PyBytes_AsString(str)); + len = (int)(ncp - PyString_AsString(str)); if (len == 0) { /*don't want to resize to zero length*/ - rv = PyBytes_FromStringAndSize("", 0); + rv = PyString_FromStringAndSize("", 0); Py_DECREF(str); str = rv; - } else if (_PyBytes_Resize(&str, len) < 0) + } else if (_PyString_Resize(&str, len) < 0) goto exit; rv = Py_BuildValue("(O(iO))", str, d, samps); Py_DECREF(samps); @@ -1255,10 +1255,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/size); + rv = PyString_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1289,10 +1289,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*size); + rv = PyString_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1323,10 +1323,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/size); + rv = PyString_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1357,10 +1357,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*size); + rv = PyString_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1393,10 +1393,10 @@ return 0; } - str = PyBytes_FromStringAndSize(NULL, len/(size*2)); + str = PyString_FromStringAndSize(NULL, len/(size*2)); if ( str == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(str); + ncp = (signed char *)PyString_AsString(str); /* Decode state, should have (value, step) */ if ( state == Py_None ) { @@ -1509,10 +1509,10 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyBytes_FromStringAndSize(NULL, len*size*2); + str = PyString_FromStringAndSize(NULL, len*size*2); if ( str == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(str); + ncp = (signed char *)PyString_AsString(str); step = stepsizeTable[index]; bufferstep = 0; Modified: python/trunk/Modules/binascii.c ============================================================================== --- python/trunk/Modules/binascii.c (original) +++ python/trunk/Modules/binascii.c Mon Jun 9 06:58:54 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyBytesObject) - 3) +#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -203,9 +203,9 @@ ascii_len--; /* Allocate the buffer */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { /* XXX is it really best to add NULs if there's no more data */ @@ -280,9 +280,9 @@ } /* We're lazy and allocate to much (fixed up later) */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyBytes_AsString(rv); + ascii_data = (unsigned char *)PyString_AsString(rv); /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); @@ -304,8 +304,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -354,9 +354,9 @@ bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); bin_len = 0; for( ; ascii_len > 0; ascii_len--, ascii_data++) { @@ -415,13 +415,13 @@ /* And set string size correctly. If the result string is empty ** (because the input was all invalid) return the shared empty - ** string instead; _PyBytes_Resize() won't do this for us. + ** string instead; _PyString_Resize() won't do this for us. */ if (bin_len > 0) - _PyBytes_Resize(&rv, bin_len); + _PyString_Resize(&rv, bin_len); else { Py_DECREF(rv); - rv = PyBytes_FromString(""); + rv = PyString_FromString(""); } return rv; } @@ -448,9 +448,9 @@ /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing newline. Note that 'b' gets encoded as 'Yg==\n' (1 in, 5 out). */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyBytes_AsString(rv); + ascii_data = (unsigned char *)PyString_AsString(rv); for( ; bin_len > 0 ; bin_len--, bin_data++ ) { /* Shift the data into our buffer */ @@ -474,8 +474,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -498,9 +498,9 @@ /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ - if ( (rv=PyBytes_FromStringAndSize(NULL, len+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, len+2)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); for( ; len > 0 ; len--, ascii_data++ ) { /* Get the byte and look it up */ @@ -534,8 +534,8 @@ Py_DECREF(rv); return NULL; } - _PyBytes_Resize( - &rv, (bin_data - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize( + &rv, (bin_data - (unsigned char *)PyString_AsString(rv))); if (rv) { PyObject *rrv = Py_BuildValue("Oi", rv, done); Py_DECREF(rv); @@ -559,9 +559,9 @@ return NULL; /* Worst case: output is twice as big as input (fixed later) */ - if ( (rv=PyBytes_FromStringAndSize(NULL, len*2+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; - out_data = (unsigned char *)PyBytes_AsString(rv); + out_data = (unsigned char *)PyString_AsString(rv); for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ @@ -627,8 +627,8 @@ leftchar <<= (6-leftbits); *ascii_data++ = table_b2a_hqx[leftchar & 0x3f]; } - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -647,14 +647,14 @@ /* Empty string is a special case */ if ( in_len == 0 ) - return PyBytes_FromString(""); + return PyString_FromString(""); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; - if ( (rv=PyBytes_FromStringAndSize(NULL, out_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, out_len)) == NULL ) return NULL; out_len_left = out_len; - out_data = (unsigned char *)PyBytes_AsString(rv); + out_data = (unsigned char *)PyString_AsString(rv); /* ** We need two macros here to get/put bytes and handle @@ -673,9 +673,9 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ - _PyBytes_Resize(&rv, 2*out_len); \ + _PyString_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ - out_data = (unsigned char *)PyBytes_AsString(rv) \ + out_data = (unsigned char *)PyString_AsString(rv) \ + out_len; \ out_len_left = out_len-1; \ out_len = out_len * 2; \ @@ -723,8 +723,8 @@ OUTBYTE(in_byte); } } - _PyBytes_Resize(&rv, (out_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (out_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -923,10 +923,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; - retval = PyBytes_FromStringAndSize(NULL, arglen*2); + retval = PyString_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; - retbuf = PyBytes_AsString(retval); + retbuf = PyString_AsString(retval); if (!retbuf) goto finally; @@ -989,10 +989,10 @@ return NULL; } - retval = PyBytes_FromStringAndSize(NULL, (arglen/2)); + retval = PyString_FromStringAndSize(NULL, (arglen/2)); if (!retval) return NULL; - retbuf = PyBytes_AsString(retval); + retbuf = PyString_AsString(retval); if (!retbuf) goto finally; @@ -1106,7 +1106,7 @@ out++; } } - if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1306,7 +1306,7 @@ } } } - if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1354,7 +1354,7 @@ return; d = PyModule_GetDict(m); - x = PyBytes_FromString(doc_binascii); + x = PyString_FromString(doc_binascii); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/trunk/Modules/bsddbmodule.c ============================================================================== --- python/trunk/Modules/bsddbmodule.c (original) +++ python/trunk/Modules/bsddbmodule.c Mon Jun 9 06:58:54 2008 @@ -312,7 +312,7 @@ return NULL; } - result = PyBytes_FromStringAndSize(data, (int)drec.size); + result = PyString_FromStringAndSize(data, (int)drec.size); if (data != buf) free(data); return result; } @@ -424,7 +424,7 @@ if (dp->di_type == DB_RECNO) item = PyInt_FromLong(*((int*)data)); else - item = PyBytes_FromStringAndSize(data, + item = PyString_FromStringAndSize(data, (int)krec.size); if (data != buf) free(data); if (item == NULL) { Modified: python/trunk/Modules/bz2module.c ============================================================================== --- python/trunk/Modules/bz2module.c (original) +++ python/trunk/Modules/bz2module.c Mon Jun 9 06:58:54 2008 @@ -34,7 +34,7 @@ #error "Large file support, but neither off_t nor fpos_t is large enough." #endif -#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) +#define BUF(v) PyString_AS_STRING((PyStringObject *)v) #define MODE_CLOSED 0 #define MODE_READ 1 @@ -241,7 +241,7 @@ int univ_newline = f->f_univ_newline; total_v_size = n > 0 ? n : 100; - v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); + v = PyString_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; @@ -307,7 +307,7 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, total_v_size) < 0) + if (_PyString_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -315,7 +315,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyBytes_Resize(&v, used_v_size); + _PyString_Resize(&v, used_v_size); return v; } @@ -438,10 +438,10 @@ /* This is a hacked version of Python's * fileobject.c:readahead_get_line_skip(). */ -static PyBytesObject * +static PyStringObject * Util_ReadAheadGetLineSkip(BZ2FileObject *f, int skip, int bufsize) { - PyBytesObject* s; + PyStringObject* s; char *bufptr; char *buf; int len; @@ -452,17 +452,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip); + return (PyStringObject *) + PyString_FromStringAndSize(NULL, skip); bufptr = memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip+len); + s = (PyStringObject *) + PyString_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) Util_DropReadAhead(f); @@ -476,7 +476,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -509,7 +509,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -531,7 +531,7 @@ "more than a Python string can hold"); goto cleanup; } - ret = PyBytes_FromStringAndSize((char *)NULL, buffersize); + ret = PyString_FromStringAndSize((char *)NULL, buffersize); if (ret == NULL) goto cleanup; bytesread = 0; @@ -557,14 +557,14 @@ } if (bytesrequested < 0) { buffersize = Util_NewBufferSize(buffersize); - if (_PyBytes_Resize(&ret, buffersize) < 0) + if (_PyString_Resize(&ret, buffersize) < 0) goto cleanup; } else { break; } } if (bytesread != buffersize) - _PyBytes_Resize(&ret, bytesread); + _PyString_Resize(&ret, bytesread); cleanup: RELEASE_LOCK(self); @@ -594,7 +594,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -607,7 +607,7 @@ } if (sizehint == 0) - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); else ret = Util_GetLine(self, (sizehint < 0) ? 0 : sizehint); @@ -701,17 +701,17 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyBytes_FromStringAndSize( + big_buffer = PyString_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - _PyBytes_Resize(&big_buffer, buffersize); - buffer = PyBytes_AS_STRING(big_buffer); + _PyString_Resize(&big_buffer, buffersize); + buffer = PyString_AS_STRING(big_buffer); } continue; } @@ -720,7 +720,7 @@ while (p != NULL) { /* Process complete lines */ p++; - line = PyBytes_FromStringAndSize(q, p-q); + line = PyString_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -743,7 +743,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyBytes_FromStringAndSize(buffer, nfilled); + line = PyString_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -753,7 +753,7 @@ Py_DECREF(line); goto error; } - PyBytes_Concat(&line, rest); + PyString_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -915,7 +915,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { const char *buffer; Py_ssize_t len; if (PyObject_AsCharBuffer(v, &buffer, &len)) { @@ -926,7 +926,7 @@ "strings"); goto error; } - line = PyBytes_FromStringAndSize(buffer, + line = PyString_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -942,9 +942,9 @@ Py_BEGIN_ALLOW_THREADS for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyBytes_GET_SIZE(line); + len = PyString_GET_SIZE(line); BZ2_bzWrite (&bzerror, self->fp, - PyBytes_AS_STRING(line), len); + PyString_AS_STRING(line), len); if (bzerror != BZ_OK) { Py_BLOCK_THREADS Util_CatchBZ2Error(bzerror); @@ -1224,13 +1224,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyBytes_FromString("\r"); + return PyString_FromString("\r"); case NEWLINE_LF: - return PyBytes_FromString("\n"); + return PyString_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyBytes_FromString("\r\n"); + return PyString_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -1448,7 +1448,7 @@ static PyObject * BZ2File_iternext(BZ2FileObject *self) { - PyBytesObject* ret; + PyStringObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { PyErr_SetString(PyExc_ValueError, @@ -1457,7 +1457,7 @@ } ret = Util_ReadAheadGetLineSkip(self, 0, READAHEAD_BUFSIZE); RELEASE_LOCK(self); - if (ret == NULL || PyBytes_GET_SIZE(ret) == 0) { + if (ret == NULL || PyString_GET_SIZE(ret) == 0) { Py_XDECREF(ret); return NULL; } @@ -1559,7 +1559,7 @@ return NULL; if (datasize == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); ACQUIRE_LOCK(self); if (!self->running) { @@ -1568,7 +1568,7 @@ goto error; } - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1591,7 +1591,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); goto error; } @@ -1601,7 +1601,7 @@ } } - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1636,7 +1636,7 @@ } self->running = 0; - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1657,7 +1657,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) + if (_PyString_Resize(&ret, bufsize) < 0) goto error; bzs->next_out = BUF(ret); bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) @@ -1667,7 +1667,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1849,7 +1849,7 @@ goto error; } - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1868,7 +1868,7 @@ if (bzs->avail_in != 0) { Py_DECREF(self->unused_data); self->unused_data = - PyBytes_FromStringAndSize(bzs->next_in, + PyString_FromStringAndSize(bzs->next_in, bzs->avail_in); } self->running = 0; @@ -1882,7 +1882,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); goto error; } @@ -1894,7 +1894,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1930,7 +1930,7 @@ } #endif - self->unused_data = PyBytes_FromString(""); + self->unused_data = PyString_FromString(""); if (!self->unused_data) goto error; @@ -2063,7 +2063,7 @@ * data in one shot. We will check it later anyway. */ bufsize = datasize + (datasize/100+1) + 600; - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2095,7 +2095,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2106,7 +2106,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); return ret; @@ -2134,9 +2134,9 @@ return NULL; if (datasize == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2175,7 +2175,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2186,7 +2186,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); return ret; @@ -2223,7 +2223,7 @@ if (m == NULL) return; - PyModule_AddObject(m, "__author__", PyBytes_FromString(__author__)); + PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); Py_INCREF(&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); Modified: python/trunk/Modules/cPickle.c ============================================================================== --- python/trunk/Modules/cPickle.c (original) +++ python/trunk/Modules/cPickle.c Mon Jun 9 06:58:54 2008 @@ -393,13 +393,13 @@ if (format) args = Py_VaBuildValue(format, va); va_end(va); if (format && ! args) return NULL; - if (stringformat && !(retval=PyBytes_FromString(stringformat))) + if (stringformat && !(retval=PyString_FromString(stringformat))) return NULL; if (retval) { if (args) { PyObject *v; - v=PyBytes_Format(retval, args); + v=PyString_Format(retval, args); Py_DECREF(retval); Py_DECREF(args); if (! v) return NULL; @@ -477,7 +477,7 @@ n = (int)_n; if (s == NULL) { if (!( self->buf_size )) return 0; - py_str = PyBytes_FromStringAndSize(self->write_buf, + py_str = PyString_FromStringAndSize(self->write_buf, self->buf_size); if (!py_str) return -1; @@ -490,7 +490,7 @@ if (n > WRITE_BUF_SIZE) { if (!( py_str = - PyBytes_FromStringAndSize(s, n))) + PyString_FromStringAndSize(s, n))) return -1; } else { @@ -655,7 +655,7 @@ Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyBytes_AsString(str))) return -1; + if (! (*s = PyString_AsString(str))) return -1; return n; } @@ -670,13 +670,13 @@ return -1; } - if ((str_size = PyBytes_Size(str)) < 0) + if ((str_size = PyString_Size(str)) < 0) return -1; Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyBytes_AsString(str))) + if (! (*s = PyString_AsString(str))) return -1; return str_size; @@ -1078,9 +1078,9 @@ "to pickle"); goto finally; } - repr = PyBytes_FromStringAndSize(NULL, (int)nbytes); + repr = PyString_FromStringAndSize(NULL, (int)nbytes); if (repr == NULL) goto finally; - pdata = (unsigned char *)PyBytes_AS_STRING(repr); + pdata = (unsigned char *)PyString_AS_STRING(repr); i = _PyLong_AsByteArray((PyLongObject *)args, pdata, nbytes, 1 /* little endian */, 1 /* signed */); @@ -1121,14 +1121,14 @@ if (!( repr = PyObject_Repr(args))) goto finally; - if ((size = PyBytes_Size(repr)) < 0) + if ((size = PyString_Size(repr)) < 0) goto finally; if (self->write_func(self, &l, 1) < 0) goto finally; if (self->write_func(self, - PyBytes_AS_STRING((PyBytesObject *)repr), + PyString_AS_STRING((PyStringObject *)repr), size) < 0) goto finally; @@ -1177,7 +1177,7 @@ int size, len; PyObject *repr=0; - if ((size = PyBytes_Size(args)) < 0) + if ((size = PyString_Size(args)) < 0) return -1; if (!self->bin) { @@ -1188,9 +1188,9 @@ if (!( repr = PyObject_Repr(args))) return -1; - if ((len = PyBytes_Size(repr)) < 0) + if ((len = PyString_Size(repr)) < 0) goto err; - repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); + repr_str = PyString_AS_STRING((PyStringObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1207,7 +1207,7 @@ int i; char c_str[5]; - if ((size = PyBytes_Size(args)) < 0) + if ((size = PyString_Size(args)) < 0) return -1; if (size < 256) { @@ -1233,8 +1233,8 @@ } else { if (self->write_func(self, - PyBytes_AS_STRING( - (PyBytesObject *)args), + PyString_AS_STRING( + (PyStringObject *)args), size) < 0) return -1; } @@ -1264,13 +1264,13 @@ static const char *hexdigit = "0123456789ABCDEF"; - repr = PyBytes_FromStringAndSize(NULL, 6 * size); + repr = PyString_FromStringAndSize(NULL, 6 * size); if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyBytes_AS_STRING(repr); + p = q = PyString_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; /* Map 16-bit characters to '\uxxxx' */ @@ -1287,7 +1287,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyBytes_Resize(&repr, p - q); + _PyString_Resize(&repr, p - q); return repr; } @@ -1310,9 +1310,9 @@ if (!repr) return -1; - if ((len = PyBytes_Size(repr)) < 0) + if ((len = PyString_Size(repr)) < 0) goto err; - repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); + repr_str = PyString_AS_STRING((PyStringObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1332,7 +1332,7 @@ if (!( repr = PyUnicode_AsUTF8String(args))) return -1; - if ((size = PyBytes_Size(repr)) < 0) + if ((size = PyString_Size(repr)) < 0) goto err; if (size > INT_MAX) return -1; /* string too large */ @@ -1351,7 +1351,7 @@ PDATA_APPEND(self->file, repr, -1); } else { - if (self->write_func(self, PyBytes_AS_STRING(repr), + if (self->write_func(self, PyString_AS_STRING(repr), size) < 0) goto err; } @@ -1861,12 +1861,12 @@ goto finally; - if ((module_size = PyBytes_Size(module)) < 0 || - (name_size = PyBytes_Size(name)) < 0) + if ((module_size = PyString_Size(module)) < 0 || + (name_size = PyString_Size(name)) < 0) goto finally; - module_str = PyBytes_AS_STRING((PyBytesObject *)module); - name_str = PyBytes_AS_STRING((PyBytesObject *)name); + module_str = PyString_AS_STRING((PyStringObject *)module); + name_str = PyString_AS_STRING((PyStringObject *)name); if (self->write_func(self, &inst, 1) < 0) goto finally; @@ -1961,12 +1961,12 @@ if (!( module = whichmodule(args, global_name))) goto finally; - if ((module_size = PyBytes_Size(module)) < 0 || - (name_size = PyBytes_Size(global_name)) < 0) + if ((module_size = PyString_Size(module)) < 0 || + (name_size = PyString_Size(global_name)) < 0) goto finally; - module_str = PyBytes_AS_STRING((PyBytesObject *)module); - name_str = PyBytes_AS_STRING((PyBytesObject *)global_name); + module_str = PyString_AS_STRING((PyStringObject *)module); + name_str = PyString_AS_STRING((PyStringObject *)global_name); /* XXX This can be doing a relative import. Clearly it shouldn't, but I don't know how to stop it. :-( */ @@ -2099,7 +2099,7 @@ if (pid != Py_None) { if (!self->bin) { - if (!PyBytes_Check(pid)) { + if (!PyString_Check(pid)) { PyErr_SetString(PicklingError, "persistent id must be string"); goto finally; @@ -2108,12 +2108,12 @@ if (self->write_func(self, &persid, 1) < 0) goto finally; - if ((size = PyBytes_Size(pid)) < 0) + if ((size = PyString_Size(pid)) < 0) goto finally; if (self->write_func(self, - PyBytes_AS_STRING( - (PyBytesObject *)pid), + PyString_AS_STRING( + (PyStringObject *)pid), size) < 0) goto finally; @@ -2194,8 +2194,8 @@ use_newobj = 0; } else { - use_newobj = PyBytes_Check(temp) && - strcmp(PyBytes_AS_STRING(temp), + use_newobj = PyString_Check(temp) && + strcmp(PyString_AS_STRING(temp), "__newobj__") == 0; Py_DECREF(temp); } @@ -2362,14 +2362,14 @@ break; case 's': - if ((type == &PyBytes_Type) && (PyBytes_GET_SIZE(args) < 2)) { + if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_string(self, args, 0); goto finally; } #ifdef Py_USING_UNICODE case 'u': - if ((type == &PyUnicode_Type) && (PyBytes_GET_SIZE(args) < 2)) { + if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } @@ -2391,7 +2391,7 @@ switch (type->tp_name[0]) { case 's': - if (type == &PyBytes_Type) { + if (type == &PyString_Type) { res = save_string(self, args, 1); goto finally; } @@ -2526,7 +2526,7 @@ if (t == NULL) goto finally; - if (PyBytes_Check(t)) { + if (PyString_Check(t)) { res = save_global(self, args, t); goto finally; } @@ -2640,8 +2640,8 @@ for (rsize = 0, i = l; --i >= 0; ) { k = data->data[i]; - if (PyBytes_Check(k)) - rsize += PyBytes_GET_SIZE(k); + if (PyString_Check(k)) + rsize += PyString_GET_SIZE(k); else if (PyInt_Check(k)) { /* put */ ik = PyInt_AS_LONG((PyIntObject*)k); @@ -2676,17 +2676,17 @@ } /* Now generate the result */ - r = PyBytes_FromStringAndSize(NULL, rsize); + r = PyString_FromStringAndSize(NULL, rsize); if (r == NULL) goto err; - s = PyBytes_AS_STRING((PyBytesObject *)r); + s = PyString_AS_STRING((PyStringObject *)r); for (i = 0; i < l; i++) { k = data->data[i]; - if (PyBytes_Check(k)) { - ssize = PyBytes_GET_SIZE(k); + if (PyString_Check(k)) { + ssize = PyString_GET_SIZE(k); if (ssize) { - p=PyBytes_AS_STRING((PyBytesObject *)k); + p=PyString_AS_STRING((PyStringObject *)k); while (--ssize >= 0) *s++ = *p++; } @@ -3410,7 +3410,7 @@ goto insecure; /********************************************/ - str = PyBytes_DecodeEscape(p, len, NULL, 0, NULL); + str = PyString_DecodeEscape(p, len, NULL, 0, NULL); free(s); if (str) { PDATA_PUSH(self->stack, str, -1); @@ -3439,7 +3439,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyBytes_FromStringAndSize(s, l))) + if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); @@ -3461,7 +3461,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; + if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); return 0; @@ -3688,12 +3688,12 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyBytes_FromStringAndSize(s, len - 1); + module_name = PyString_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { if (len < 2) return bad_readline(); - if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3772,7 +3772,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyBytes_FromStringAndSize(s, len - 1); + module_name = PyString_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { @@ -3780,7 +3780,7 @@ Py_DECREF(module_name); return bad_readline(); } - if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3805,7 +3805,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - pid = PyBytes_FromStringAndSize(s, len - 1); + pid = PyString_FromStringAndSize(s, len - 1); if (!pid) return -1; if (PyList_Check(self->pers_func)) { @@ -3938,7 +3938,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - if (!( py_str = PyBytes_FromStringAndSize(s, len - 1))) return -1; + if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; value = PyDict_GetItem(self->memo, py_str); if (! value) { @@ -4064,8 +4064,8 @@ * confirm that pair is really a 2-tuple of strings. */ if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || - !PyBytes_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || - !PyBytes_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { + !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || + !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { Py_DECREF(py_code); PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " "isn't a 2-tuple of strings", code); @@ -4098,7 +4098,7 @@ if ((l = self->readline_func(self, &s)) < 0) return -1; if (l < 2) return bad_readline(); if (!( len=self->stack->length )) return stackUnderflow(); - if (!( py_str = PyBytes_FromStringAndSize(s, l - 1))) return -1; + if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; value=self->stack->data[len-1]; l=PyDict_SetItem(self->memo, py_str, value); Py_DECREF(py_str); @@ -5568,7 +5568,7 @@ { PyObject *copyreg, *t, *r; -#define INIT_STR(S) if (!( S ## _str=PyBytes_InternFromString(#S))) return -1; +#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; if (PyType_Ready(&Unpicklertype) < 0) return -1; @@ -5736,7 +5736,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - v = PyBytes_FromString(rev); + v = PyString_FromString(rev); PyDict_SetItemString(d, "__version__", v); Py_XDECREF(v); @@ -5755,7 +5755,7 @@ /* These are purely informational; no code uses them. */ /* File format version we write. */ - format_version = PyBytes_FromString("2.0"); + format_version = PyString_FromString("2.0"); /* Format versions we can read. */ compatible_formats = Py_BuildValue("[sssss]", "1.0", /* Original protocol 0 */ Modified: python/trunk/Modules/cStringIO.c ============================================================================== --- python/trunk/Modules/cStringIO.c (original) +++ python/trunk/Modules/cStringIO.c Mon Jun 9 06:58:54 2008 @@ -119,7 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; - return PyBytes_FromStringAndSize(((IOobject*)self)->buf, + return PyString_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,7 +137,7 @@ } else s=self->string_size; - return PyBytes_FromStringAndSize(self->buf, s); + return PyString_FromStringAndSize(self->buf, s); } PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); @@ -177,7 +177,7 @@ if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); @@ -215,7 +215,7 @@ n -= m; self->pos -= m; } - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); @@ -238,7 +238,7 @@ goto err; if (n == 0) break; - line = PyBytes_FromStringAndSize (output, n); + line = PyString_FromStringAndSize (output, n); if (!line) goto err; if (PyList_Append (result, line) == -1) { @@ -315,7 +315,7 @@ next = IO_readline((IOobject *)self, NULL); if (!next) return NULL; - if (!PyBytes_GET_SIZE(next)) { + if (!PyString_GET_SIZE(next)) { Py_DECREF(next); PyErr_SetNone(PyExc_StopIteration); return NULL; @@ -456,7 +456,7 @@ while ((s = PyIter_Next(it)) != NULL) { Py_ssize_t n; char *c; - if (PyBytes_AsStringAndSize(s, &c, &n) == -1) { + if (PyString_AsStringAndSize(s, &c, &n) == -1) { Py_DECREF(it); Py_DECREF(s); return NULL; Modified: python/trunk/Modules/cdmodule.c ============================================================================== --- python/trunk/Modules/cdmodule.c (original) +++ python/trunk/Modules/cdmodule.c Mon Jun 9 06:58:54 2008 @@ -239,19 +239,19 @@ if (!PyArg_ParseTuple(args, "i:readda", &numframes)) return NULL; - result = PyBytes_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); + result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); if (result == NULL) return NULL; n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyBytes_AsString(result), numframes); + (CDFRAME *) PyString_AsString(result), numframes); if (n == -1) { Py_DECREF(result); PyErr_SetFromErrno(CdError); return NULL; } if (n < numframes) - _PyBytes_Resize(&result, n * sizeof(CDFRAME)); + _PyString_Resize(&result, n * sizeof(CDFRAME)); return result; } @@ -468,7 +468,7 @@ PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); switch (type) { case cd_audio: - v = PyBytes_FromStringAndSize(data, CDDA_DATASIZE); + v = PyString_FromStringAndSize(data, CDDA_DATASIZE); break; case cd_pnum: case cd_index: @@ -484,15 +484,15 @@ #undef ptr break; case cd_catalog: - v = PyBytes_FromStringAndSize(NULL, 13); - p = PyBytes_AsString(v); + v = PyString_FromStringAndSize(NULL, 13); + p = PyString_AsString(v); for (i = 0; i < 13; i++) *p++ = ((char *) data)[i] + '0'; break; case cd_ident: #define ptr ((struct cdident *) data) - v = PyBytes_FromStringAndSize(NULL, 12); - p = PyBytes_AsString(v); + v = PyString_FromStringAndSize(NULL, 12); + p = PyString_AsString(v); CDsbtoa(p, ptr->country, 2); p += 2; CDsbtoa(p, ptr->owner, 3); Modified: python/trunk/Modules/cgensupport.c ============================================================================== --- python/trunk/Modules/cgensupport.c (original) +++ python/trunk/Modules/cgensupport.c Mon Jun 9 06:58:54 2008 @@ -119,10 +119,10 @@ PyObject *v; if (!PyArg_GetObject(args, nargs, i, &v)) return 0; - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { return PyErr_BadArgument(); } - *p_arg = PyBytes_AsString(v); + *p_arg = PyString_AsString(v); return 1; } Modified: python/trunk/Modules/cjkcodecs/cjkcodecs.h ============================================================================== --- python/trunk/Modules/cjkcodecs/cjkcodecs.h (original) +++ python/trunk/Modules/cjkcodecs/cjkcodecs.h Mon Jun 9 06:58:54 2008 @@ -261,7 +261,7 @@ const MultibyteCodec *codec; const char *enc; - if (!PyBytes_Check(encoding)) { + if (!PyString_Check(encoding)) { PyErr_SetString(PyExc_TypeError, "encoding name must be a string."); return NULL; @@ -271,7 +271,7 @@ if (cofunc == NULL) return NULL; - enc = PyBytes_AS_STRING(encoding); + enc = PyString_AS_STRING(encoding); for (codec = codec_list; codec->encoding[0]; codec++) if (strcmp(codec->encoding, enc) == 0) break; Modified: python/trunk/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/trunk/Modules/cjkcodecs/multibytecodec.c (original) +++ python/trunk/Modules/cjkcodecs/multibytecodec.c Mon Jun 9 06:58:54 2008 @@ -85,7 +85,7 @@ else if (strcmp(errors, "replace") == 0) return ERROR_REPLACE; else - return PyBytes_FromString(errors); + return PyString_FromString(errors); } static PyObject * @@ -93,8 +93,8 @@ { PyObject *args, *cb, *r; - assert(PyBytes_Check(errors)); - cb = PyCodec_LookupError(PyBytes_AS_STRING(errors)); + assert(PyString_Check(errors)); + cb = PyCodec_LookupError(PyString_AS_STRING(errors)); if (cb == NULL) return NULL; @@ -129,7 +129,7 @@ return self->errors; } - return PyBytes_FromString(errors); + return PyString_FromString(errors); } static int @@ -138,12 +138,12 @@ { PyObject *cb; - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "errors must be a string"); return -1; } - cb = internal_error_callback(PyBytes_AS_STRING(value)); + cb = internal_error_callback(PyString_AS_STRING(value)); if (cb == NULL) return -1; @@ -166,15 +166,15 @@ Py_ssize_t orgpos, orgsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - - PyBytes_AS_STRING(buf->outobj)); - orgsize = PyBytes_GET_SIZE(buf->outobj); - if (_PyBytes_Resize(&buf->outobj, orgsize + ( + PyString_AS_STRING(buf->outobj)); + orgsize = PyString_GET_SIZE(buf->outobj); + if (_PyString_Resize(&buf->outobj, orgsize + ( esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) return -1; - buf->outbuf = (unsigned char *)PyBytes_AS_STRING(buf->outobj) +orgpos; - buf->outbuf_end = (unsigned char *)PyBytes_AS_STRING(buf->outobj) - + PyBytes_GET_SIZE(buf->outobj); + buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; + buf->outbuf_end = (unsigned char *)PyString_AS_STRING(buf->outobj) + + PyString_GET_SIZE(buf->outobj); return 0; } @@ -322,10 +322,10 @@ goto errorexit; } - retstrsize = PyBytes_GET_SIZE(retstr); + retstrsize = PyString_GET_SIZE(retstr); REQUIRE_ENCODEBUFFER(buf, retstrsize); - memcpy(buf->outbuf, PyBytes_AS_STRING(retstr), retstrsize); + memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); buf->outbuf += retstrsize; newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); @@ -468,16 +468,16 @@ Py_ssize_t finalsize, r = 0; if (datalen == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; - buf.outobj = PyBytes_FromStringAndSize(NULL, datalen * 2 + 16); + buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; - buf.outbuf = (unsigned char *)PyBytes_AS_STRING(buf.outobj); - buf.outbuf_end = buf.outbuf + PyBytes_GET_SIZE(buf.outobj); + buf.outbuf = (unsigned char *)PyString_AS_STRING(buf.outobj); + buf.outbuf_end = buf.outbuf + PyString_GET_SIZE(buf.outobj); while (buf.inbuf < buf.inbuf_end) { Py_ssize_t inleft, outleft; @@ -512,10 +512,10 @@ } finalsize = (Py_ssize_t)((char *)buf.outbuf - - PyBytes_AS_STRING(buf.outobj)); + PyString_AS_STRING(buf.outobj)); - if (finalsize != PyBytes_GET_SIZE(buf.outobj)) - if (_PyBytes_Resize(&buf.outobj, finalsize) == -1) + if (finalsize != PyString_GET_SIZE(buf.outobj)) + if (_PyString_Resize(&buf.outobj, finalsize) == -1) goto errorexit; Py_XDECREF(buf.excobj); @@ -1222,35 +1222,35 @@ if (cres == NULL) goto errorexit; - if (!PyBytes_Check(cres)) { + if (!PyString_Check(cres)) { PyErr_SetString(PyExc_TypeError, "stream function returned a " "non-string object"); goto errorexit; } - endoffile = (PyBytes_GET_SIZE(cres) == 0); + endoffile = (PyString_GET_SIZE(cres) == 0); if (self->pendingsize > 0) { PyObject *ctr; char *ctrdata; - rsize = PyBytes_GET_SIZE(cres) + self->pendingsize; - ctr = PyBytes_FromStringAndSize(NULL, rsize); + rsize = PyString_GET_SIZE(cres) + self->pendingsize; + ctr = PyString_FromStringAndSize(NULL, rsize); if (ctr == NULL) goto errorexit; - ctrdata = PyBytes_AS_STRING(ctr); + ctrdata = PyString_AS_STRING(ctr); memcpy(ctrdata, self->pending, self->pendingsize); memcpy(ctrdata + self->pendingsize, - PyBytes_AS_STRING(cres), - PyBytes_GET_SIZE(cres)); + PyString_AS_STRING(cres), + PyString_GET_SIZE(cres)); Py_DECREF(cres); cres = ctr; self->pendingsize = 0; } - rsize = PyBytes_GET_SIZE(cres); - if (decoder_prepare_buffer(&buf, PyBytes_AS_STRING(cres), + rsize = PyString_GET_SIZE(cres); + if (decoder_prepare_buffer(&buf, PyString_AS_STRING(cres), rsize) != 0) goto errorexit; @@ -1585,7 +1585,7 @@ if (pwrt == NULL) return NULL; - if (PyBytes_Size(pwrt) > 0) { + if (PyString_Size(pwrt) > 0) { PyObject *wr; wr = PyObject_CallMethod(self->stream, "write", "O", pwrt); if (wr == NULL) { Modified: python/trunk/Modules/clmodule.c ============================================================================== --- python/trunk/Modules/clmodule.c (original) +++ python/trunk/Modules/clmodule.c Mon Jun 9 06:58:54 2008 @@ -111,7 +111,7 @@ return NULL; retry: - compressedBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); + compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); if (compressedBuffer == NULL) return NULL; @@ -120,7 +120,7 @@ if (clCompressImage(compressionScheme, width, height, originalFormat, compressionRatio, (void *) frameBuffer, &compressedBufferSize, - (void *) PyBytes_AsString(compressedBuffer)) + (void *) PyString_AsString(compressedBuffer)) == FAILURE || error_handler_called) { Py_DECREF(compressedBuffer); if (!error_handler_called) @@ -135,7 +135,7 @@ } if (compressedBufferSize < frameBufferSize) - _PyBytes_Resize(&compressedBuffer, compressedBufferSize); + _PyString_Resize(&compressedBuffer, compressedBufferSize); return compressedBuffer; } @@ -155,14 +155,14 @@ frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - frameBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); + frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); if (frameBuffer == NULL) return NULL; error_handler_called = 0; if (clDecompressImage(compressionScheme, width, height, originalFormat, compressedBufferSize, compressedBuffer, - (void *) PyBytes_AsString(frameBuffer)) + (void *) PyString_AsString(frameBuffer)) == FAILURE || error_handler_called) { Py_DECREF(frameBuffer); if (!error_handler_called) @@ -236,14 +236,14 @@ if (error_handler_called) return NULL; - data = PyBytes_FromStringAndSize(NULL, size); + data = PyString_FromStringAndSize(NULL, size); if (data == NULL) return NULL; error_handler_called = 0; if (clCompress(SELF->ob_compressorHdl, numberOfFrames, (void *) frameBuffer, &compressedBufferSize, - (void *) PyBytes_AsString(data)) == FAILURE || + (void *) PyString_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -252,7 +252,7 @@ } if (compressedBufferSize < size) - if (_PyBytes_Resize(&data, compressedBufferSize)) + if (_PyString_Resize(&data, compressedBufferSize)) return NULL; if (compressedBufferSize > size) { @@ -285,14 +285,14 @@ if (error_handler_called) return NULL; - data = PyBytes_FromStringAndSize(NULL, dataSize); + data = PyString_FromStringAndSize(NULL, dataSize); if (data == NULL) return NULL; error_handler_called = 0; if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, compressedDataSize, (void *) compressedData, - (void *) PyBytes_AsString(data)) == FAILURE || + (void *) PyString_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -514,7 +514,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyBytes_FromString((char *) PVbuffer[i])); + PyString_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -563,7 +563,7 @@ return NULL; } - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * @@ -775,7 +775,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyBytes_FromString((char *) PVbuffer[i])); + PyString_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -818,7 +818,7 @@ return NULL; } - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * Modified: python/trunk/Modules/datetimemodule.c ============================================================================== --- python/trunk/Modules/datetimemodule.c (original) +++ python/trunk/Modules/datetimemodule.c Mon Jun 9 06:58:54 2008 @@ -947,7 +947,7 @@ else result = PyObject_CallMethod(tzinfo, "tzname", "O", tzinfoarg); - if (result != NULL && result != Py_None && ! PyBytes_Check(result)) { + if (result != NULL && result != Py_None && ! PyString_Check(result)) { PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " "return None or a string, not '%s'", Py_TYPE(result)->tp_name); @@ -1046,27 +1046,27 @@ { PyObject *temp; - assert(PyBytes_Check(repr)); + assert(PyString_Check(repr)); assert(tzinfo); if (tzinfo == Py_None) return repr; /* Get rid of the trailing ')'. */ - assert(PyBytes_AsString(repr)[PyBytes_Size(repr)-1] == ')'); - temp = PyBytes_FromStringAndSize(PyBytes_AsString(repr), - PyBytes_Size(repr) - 1); + assert(PyString_AsString(repr)[PyString_Size(repr)-1] == ')'); + temp = PyString_FromStringAndSize(PyString_AsString(repr), + PyString_Size(repr) - 1); Py_DECREF(repr); if (temp == NULL) return NULL; repr = temp; /* Append ", tzinfo=". */ - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(", tzinfo=")); + PyString_ConcatAndDel(&repr, PyString_FromString(", tzinfo=")); /* Append repr(tzinfo). */ - PyBytes_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); + PyString_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); /* Add a closing paren. */ - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(")")); + PyString_ConcatAndDel(&repr, PyString_FromString(")")); return repr; } @@ -1092,7 +1092,7 @@ DayNames[wday], MonthNames[GET_MONTH(date) - 1], GET_DAY(date), hours, minutes, seconds, GET_YEAR(date)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* Add an hours & minutes UTC offset string to buf. buf has no more than @@ -1143,7 +1143,7 @@ else sprintf(freplacement, "%06d", 0); - return PyBytes_FromStringAndSize(freplacement, strlen(freplacement)); + return PyString_FromStringAndSize(freplacement, strlen(freplacement)); } /* I sure don't want to reproduce the strftime code from the time module, @@ -1230,7 +1230,7 @@ /* format utcoffset */ char buf[100]; PyObject *tzinfo = get_tzinfo_member(object); - zreplacement = PyBytes_FromString(""); + zreplacement = PyString_FromString(""); if (zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { assert(tzinfoarg != NULL); @@ -1241,19 +1241,19 @@ tzinfoarg) < 0) goto Done; Py_DECREF(zreplacement); - zreplacement = PyBytes_FromString(buf); + zreplacement = PyString_FromString(buf); if (zreplacement == NULL) goto Done; } } assert(zreplacement != NULL); - ptoappend = PyBytes_AS_STRING(zreplacement); - ntoappend = PyBytes_GET_SIZE(zreplacement); + ptoappend = PyString_AS_STRING(zreplacement); + ntoappend = PyString_GET_SIZE(zreplacement); } else if (ch == 'Z') { /* format tzname */ if (Zreplacement == NULL) { PyObject *tzinfo = get_tzinfo_member(object); - Zreplacement = PyBytes_FromString(""); + Zreplacement = PyString_FromString(""); if (Zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { PyObject *temp; @@ -1261,7 +1261,7 @@ temp = call_tzname(tzinfo, tzinfoarg); if (temp == NULL) goto Done; if (temp != Py_None) { - assert(PyBytes_Check(temp)); + assert(PyString_Check(temp)); /* Since the tzname is getting * stuffed into the format, we * have to double any % signs @@ -1275,7 +1275,7 @@ Py_DECREF(temp); if (Zreplacement == NULL) goto Done; - if (!PyBytes_Check(Zreplacement)) { + if (!PyString_Check(Zreplacement)) { PyErr_SetString(PyExc_TypeError, "tzname.replace() did not return a string"); goto Done; } @@ -1285,8 +1285,8 @@ } } assert(Zreplacement != NULL); - ptoappend = PyBytes_AS_STRING(Zreplacement); - ntoappend = PyBytes_GET_SIZE(Zreplacement); + ptoappend = PyString_AS_STRING(Zreplacement); + ntoappend = PyString_GET_SIZE(Zreplacement); } else if (ch == 'f') { /* format microseconds */ @@ -1296,9 +1296,9 @@ goto Done; } assert(freplacement != NULL); - assert(PyBytes_Check(freplacement)); - ptoappend = PyBytes_AS_STRING(freplacement); - ntoappend = PyBytes_GET_SIZE(freplacement); + assert(PyString_Check(freplacement)); + ptoappend = PyString_AS_STRING(freplacement); + ntoappend = PyString_GET_SIZE(freplacement); } else { /* percent followed by neither z nor Z */ @@ -1319,10 +1319,10 @@ PyErr_NoMemory(); goto Done; } - if (_PyBytes_Resize(&newfmt, bigger) < 0) + if (_PyString_Resize(&newfmt, bigger) < 0) goto Done; totalnew = bigger; - pnew = PyBytes_AsString(newfmt) + usednew; + pnew = PyString_AsString(newfmt) + usednew; } memcpy(pnew, ptoappend, ntoappend); pnew += ntoappend; @@ -1330,7 +1330,7 @@ assert(usednew <= totalnew); } /* end while() */ - if (_PyBytes_Resize(&newfmt, usednew) < 0) + if (_PyString_Resize(&newfmt, usednew) < 0) goto Done; { PyObject *time = PyImport_ImportModuleNoBlock("time"); @@ -2008,18 +2008,18 @@ delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) - return PyBytes_FromFormat("%s(%d, %d, %d)", + return PyString_FromFormat("%s(%d, %d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) - return PyBytes_FromFormat("%s(%d, %d)", + return PyString_FromFormat("%s(%d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); - return PyBytes_FromFormat("%s(%d)", + return PyString_FromFormat("%s(%d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self)); } @@ -2063,7 +2063,7 @@ pbuf += n; } - return PyBytes_FromStringAndSize(buf, pbuf - buf); + return PyString_FromStringAndSize(buf, pbuf - buf); Fail: PyErr_SetString(PyExc_SystemError, "goofy result from PyOS_snprintf"); @@ -2242,15 +2242,15 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) == 1 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_Date *me; me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); me->hashcode = -1; } @@ -2448,7 +2448,7 @@ type_name, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } static PyObject * @@ -2457,7 +2457,7 @@ char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* str() calls the appropriate isoformat() method. */ @@ -2508,9 +2508,9 @@ return NULL; /* Check for str or unicode */ - if (PyBytes_Check(format)) { + if (PyString_Check(format)) { /* If format is zero length, return str(self) */ - if (PyBytes_GET_SIZE(format) == 0) + if (PyString_GET_SIZE(format) == 0) return PyObject_Str((PyObject *)self); } else if (PyUnicode_Check(format)) { /* If format is zero length, return str(self) */ @@ -2653,7 +2653,7 @@ { return Py_BuildValue( "(N)", - PyBytes_FromStringAndSize((char *)self->data, + PyString_FromStringAndSize((char *)self->data, _PyDateTime_DATE_DATASIZE)); } @@ -3109,9 +3109,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyBytes_AS_STRING(state)[0])) < 24) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && + ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) { PyDateTime_Time *me; char aware; @@ -3127,7 +3127,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); me->hashcode = -1; @@ -3213,7 +3213,7 @@ else PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d)", type_name, h, m); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); if (result != NULL && HASTZINFO(self)) result = append_keyword_tzinfo(result, self->tzinfo); return result; @@ -3240,7 +3240,7 @@ _PyDateTime_TIME_DATASIZE); isoformat_time(pdatetime, buf, sizeof(buf)); - result = PyBytes_FromString(buf); + result = PyString_FromString(buf); if (result == NULL || ! HASTZINFO(self) || self->tzinfo == Py_None) return result; @@ -3250,7 +3250,7 @@ Py_DECREF(result); return NULL; } - PyBytes_ConcatAndDel(&result, PyBytes_FromString(buf)); + PyString_ConcatAndDel(&result, PyString_FromString(buf)); return result; } @@ -3364,7 +3364,7 @@ /* Reduce this to a hash of another object. */ if (offset == 0) - temp = PyBytes_FromStringAndSize((char *)self->data, + temp = PyString_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); else { int hour; @@ -3452,7 +3452,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, + basestate = PyString_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) @@ -3639,9 +3639,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_DateTime *me; char aware; @@ -3657,7 +3657,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); me->hashcode = -1; @@ -4166,7 +4166,7 @@ GET_YEAR(self), GET_MONTH(self), GET_DAY(self), DATE_GET_HOUR(self), DATE_GET_MINUTE(self)); } - baserepr = PyBytes_FromString(buffer); + baserepr = PyString_FromString(buffer); if (baserepr == NULL || ! HASTZINFO(self)) return baserepr; return append_keyword_tzinfo(baserepr, self->tzinfo); @@ -4194,7 +4194,7 @@ assert(cp != NULL); *cp++ = sep; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); if (result == NULL || ! HASTZINFO(self)) return result; @@ -4204,7 +4204,7 @@ Py_DECREF(result); return NULL; } - PyBytes_ConcatAndDel(&result, PyBytes_FromString(buffer)); + PyString_ConcatAndDel(&result, PyString_FromString(buffer)); return result; } @@ -4310,7 +4310,7 @@ /* Reduce this to a hash of another object. */ if (n == OFFSET_NAIVE) - temp = PyBytes_FromStringAndSize( + temp = PyString_FromStringAndSize( (char *)self->data, _PyDateTime_DATETIME_DATASIZE); else { @@ -4533,7 +4533,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, + basestate = PyString_FromStringAndSize((char *)self->data, _PyDateTime_DATETIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) Modified: python/trunk/Modules/dbmmodule.c ============================================================================== --- python/trunk/Modules/dbmmodule.c (original) +++ python/trunk/Modules/dbmmodule.c Mon Jun 9 06:58:54 2008 @@ -104,7 +104,7 @@ drec = dbm_fetch(dp->di_dbm, krec); if ( drec.dptr == 0 ) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)key)); + PyString_AS_STRING((PyStringObject *)key)); return NULL; } if ( dbm_error(dp->di_dbm) ) { @@ -112,7 +112,7 @@ PyErr_SetString(DbmError, ""); return NULL; } - return PyBytes_FromStringAndSize(drec.dptr, drec.dsize); + return PyString_FromStringAndSize(drec.dptr, drec.dsize); } static int @@ -136,7 +136,7 @@ if ( dbm_delete(dp->di_dbm, krec) < 0 ) { dbm_clearerr(dp->di_dbm); PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)v)); + PyString_AS_STRING((PyStringObject *)v)); return -1; } } else { @@ -166,7 +166,7 @@ { datum key, val; - if (PyBytes_AsStringAndSize(v, (char **)&key.dptr, + if (PyString_AsStringAndSize(v, (char **)&key.dptr, (Py_ssize_t *)&key.dsize)) { return -1; } @@ -222,7 +222,7 @@ return NULL; for (key = dbm_firstkey(dp->di_dbm); key.dptr; key = dbm_nextkey(dp->di_dbm)) { - item = PyBytes_FromStringAndSize(key.dptr, key.dsize); + item = PyString_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { Py_DECREF(v); return NULL; @@ -269,7 +269,7 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyBytes_FromStringAndSize(val.dptr, val.dsize); + return PyString_FromStringAndSize(val.dptr, val.dsize); else { Py_INCREF(defvalue); return defvalue; @@ -292,16 +292,16 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyBytes_FromStringAndSize(val.dptr, val.dsize); + return PyString_FromStringAndSize(val.dptr, val.dsize); if (defvalue == NULL) { - defvalue = PyBytes_FromStringAndSize(NULL, 0); + defvalue = PyString_FromStringAndSize(NULL, 0); if (defvalue == NULL) return NULL; } else Py_INCREF(defvalue); - val.dptr = PyBytes_AS_STRING(defvalue); - val.dsize = PyBytes_GET_SIZE(defvalue); + val.dptr = PyString_AS_STRING(defvalue); + val.dsize = PyString_GET_SIZE(defvalue); if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) { dbm_clearerr(dp->di_dbm); PyErr_SetString(DbmError, "cannot add item to database"); @@ -404,7 +404,7 @@ d = PyModule_GetDict(m); if (DbmError == NULL) DbmError = PyErr_NewException("dbm.error", NULL, NULL); - s = PyBytes_FromString(which_dbm); + s = PyString_FromString(which_dbm); if (s != NULL) { PyDict_SetItemString(d, "library", s); Py_DECREF(s); Modified: python/trunk/Modules/dlmodule.c ============================================================================== --- python/trunk/Modules/dlmodule.c (original) +++ python/trunk/Modules/dlmodule.c Mon Jun 9 06:58:54 2008 @@ -58,8 +58,8 @@ { char *name; PyUnivPtr *func; - if (PyBytes_Check(args)) { - name = PyBytes_AS_STRING(args); + if (PyString_Check(args)) { + name = PyString_AS_STRING(args); } else { PyErr_Format(PyExc_TypeError, "expected string, found %.200s", Py_TYPE(args)->tp_name); @@ -88,14 +88,14 @@ return NULL; } name = PyTuple_GetItem(args, 0); - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "function name must be a string"); return NULL; } func = (long (*)(long, long, long, long, long, long, long, long, long, long)) - dlsym(xp->dl_handle, PyBytes_AsString(name)); + dlsym(xp->dl_handle, PyString_AsString(name)); if (func == NULL) { PyErr_SetString(PyExc_ValueError, dlerror()); return NULL; @@ -109,8 +109,8 @@ PyObject *v = PyTuple_GetItem(args, i); if (PyInt_Check(v)) alist[i-1] = PyInt_AsLong(v); - else if (PyBytes_Check(v)) - alist[i-1] = (long)PyBytes_AsString(v); + else if (PyString_Check(v)) + alist[i-1] = (long)PyString_AsString(v); else if (v == Py_None) alist[i-1] = (long) ((char *)NULL); else { Modified: python/trunk/Modules/errnomodule.c ============================================================================== --- python/trunk/Modules/errnomodule.c (original) +++ python/trunk/Modules/errnomodule.c Mon Jun 9 06:58:54 2008 @@ -21,7 +21,7 @@ static void _inscode(PyObject *d, PyObject *de, char *name, int code) { - PyObject *u = PyBytes_FromString(name); + PyObject *u = PyString_FromString(name); PyObject *v = PyInt_FromLong((long) code); /* Don't bother checking for errors; they'll be caught at the end Modified: python/trunk/Modules/fcntlmodule.c ============================================================================== --- python/trunk/Modules/fcntlmodule.c (original) +++ python/trunk/Modules/fcntlmodule.c Mon Jun 9 06:58:54 2008 @@ -55,7 +55,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } PyErr_Clear(); @@ -164,7 +164,7 @@ return PyInt_FromLong(ret); } else { - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } } @@ -185,7 +185,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } PyErr_Clear(); Modified: python/trunk/Modules/flmodule.c ============================================================================== --- python/trunk/Modules/flmodule.c (original) +++ python/trunk/Modules/flmodule.c Mon Jun 9 06:58:54 2008 @@ -324,7 +324,7 @@ /* "label" is an exception, getmember only works for char pointers, not for char arrays */ if (strcmp(name, "label") == 0) - return PyBytes_FromString(g->ob_generic->label); + return PyString_FromString(g->ob_generic->label); return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); } @@ -343,12 +343,12 @@ /* "label" is an exception: setmember doesn't set strings; and FORMS wants you to call a function to set the label */ if (strcmp(name, "label") == 0) { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(PyExc_TypeError, "label attr must be string"); return -1; } - fl_set_object_label(g->ob_generic, PyBytes_AsString(v)); + fl_set_object_label(g->ob_generic, PyString_AsString(v)); return 0; } @@ -369,7 +369,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", g, g->ob_generic->objclass); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyTypeObject GenericObjecttype = { @@ -530,7 +530,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString (str); + return PyString_FromString (str); } /* int func (object) */ @@ -628,7 +628,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString (str); + return PyString_FromString (str); } static PyObject * @@ -1594,7 +1594,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", f, f->ob_form->window); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyTypeObject Formtype = { @@ -2027,7 +2027,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * @@ -2046,7 +2046,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } @@ -2061,7 +2061,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * Modified: python/trunk/Modules/fmmodule.c ============================================================================== --- python/trunk/Modules/fmmodule.c (original) +++ python/trunk/Modules/fmmodule.c Mon Jun 9 06:58:54 2008 @@ -66,7 +66,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); return NULL; } - return PyBytes_FromStringAndSize(fontname, len); + return PyString_FromStringAndSize(fontname, len); } static PyObject * @@ -79,7 +79,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); return NULL; } - return PyBytes_FromStringAndSize(comment, len); + return PyString_FromStringAndSize(comment, len); } static PyObject * @@ -200,7 +200,7 @@ PyObject *v; if (fontlist == NULL) return; - v = PyBytes_FromString(fontname); + v = PyString_FromString(fontname); if (v == NULL) err = -1; else { @@ -240,7 +240,7 @@ static PyObject * fm_fontpath(PyObject *self) { - return PyBytes_FromString(fmfontpath()); + return PyString_FromString(fmfontpath()); } static PyMethodDef fm_methods[] = { Modified: python/trunk/Modules/gcmodule.c ============================================================================== --- python/trunk/Modules/gcmodule.c (original) +++ python/trunk/Modules/gcmodule.c Mon Jun 9 06:58:54 2008 @@ -639,8 +639,8 @@ char *cname; /* simple version of instance_repr */ PyObject *classname = inst->in_class->cl_name; - if (classname != NULL && PyBytes_Check(classname)) - cname = PyBytes_AsString(classname); + if (classname != NULL && PyString_Check(classname)) + cname = PyString_AsString(classname); else cname = "?"; PySys_WriteStderr("gc: %.100s <%.100s instance at %p>\n", @@ -754,7 +754,7 @@ double t1 = 0.0; if (delstr == NULL) { - delstr = PyBytes_InternFromString("__del__"); + delstr = PyString_InternFromString("__del__"); if (delstr == NULL) Py_FatalError("gc couldn't allocate \"__del__\""); } @@ -898,7 +898,7 @@ if (PyErr_Occurred()) { if (gc_str == NULL) - gc_str = PyBytes_FromString("garbage collection"); + gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); } Modified: python/trunk/Modules/gdbmmodule.c ============================================================================== --- python/trunk/Modules/gdbmmodule.c (original) +++ python/trunk/Modules/gdbmmodule.c Mon Jun 9 06:58:54 2008 @@ -128,10 +128,10 @@ drec = gdbm_fetch(dp->di_dbm, krec); if (drec.dptr == 0) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)key)); + PyString_AS_STRING((PyStringObject *)key)); return NULL; } - v = PyBytes_FromStringAndSize(drec.dptr, drec.dsize); + v = PyString_FromStringAndSize(drec.dptr, drec.dsize); free(drec.dptr); return v; } @@ -155,7 +155,7 @@ if (w == NULL) { if (gdbm_delete(dp->di_dbm, krec) < 0) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)v)); + PyString_AS_STRING((PyStringObject *)v)); return -1; } } @@ -188,14 +188,14 @@ "GDBM object has already been closed"); return -1; } - if (!PyBytes_Check(arg)) { + if (!PyString_Check(arg)) { PyErr_Format(PyExc_TypeError, "gdbm key must be string, not %.100s", arg->ob_type->tp_name); return -1; } - key.dptr = PyBytes_AS_STRING(arg); - key.dsize = PyBytes_GET_SIZE(arg); + key.dptr = PyString_AS_STRING(arg); + key.dsize = PyString_GET_SIZE(arg); return gdbm_exists(dp->di_dbm, key); } @@ -255,7 +255,7 @@ key = gdbm_firstkey(dp->di_dbm); while (key.dptr) { - item = PyBytes_FromStringAndSize(key.dptr, key.dsize); + item = PyString_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { free(key.dptr); Py_DECREF(v); @@ -306,7 +306,7 @@ check_dbmobject_open(dp); key = gdbm_firstkey(dp->di_dbm); if (key.dptr) { - v = PyBytes_FromStringAndSize(key.dptr, key.dsize); + v = PyString_FromStringAndSize(key.dptr, key.dsize); free(key.dptr); return v; } @@ -338,7 +338,7 @@ check_dbmobject_open(dp); nextkey = gdbm_nextkey(dp->di_dbm, key); if (nextkey.dptr) { - v = PyBytes_FromStringAndSize(nextkey.dptr, nextkey.dsize); + v = PyString_FromStringAndSize(nextkey.dptr, nextkey.dsize); free(nextkey.dptr); return v; } @@ -541,7 +541,7 @@ DbmError = PyErr_NewException("gdbm.error", NULL, NULL); if (DbmError != NULL) { PyDict_SetItemString(d, "error", DbmError); - s = PyBytes_FromString(dbmmodule_open_flags); + s = PyString_FromString(dbmmodule_open_flags); PyDict_SetItemString(d, "open_flags", s); Py_DECREF(s); } Modified: python/trunk/Modules/glmodule.c ============================================================================== --- python/trunk/Modules/glmodule.c (original) +++ python/trunk/Modules/glmodule.c Mon Jun 9 06:58:54 2008 @@ -593,7 +593,7 @@ #if 0 /* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyBytes_Check(s) || PyBytes_Size(s) != pixcount*sizeof(long)) { + if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to lrectwrite has wrong size"); return NULL; @@ -623,10 +623,10 @@ if (!PyArg_GetShort(args, 4, 3, &y2)) return NULL; pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (parray == NULL) return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyBytes_AsString(parray)); + lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); return parray; } @@ -642,10 +642,10 @@ if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) return 0; size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyBytes_FromStringAndSize((char *)NULL, size*sizeof(long)); + rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); if ( rv == NULL ) return NULL; - parray = (unsigned long *)PyBytes_AsString(rv); + parray = (unsigned long *)PyString_AsString(rv); size_ret = readdisplay(x1, y1, x2, y2, parray, hints); if ( size_ret != size ) { printf("gl_readdisplay: got %ld pixels, expected %ld\n", @@ -700,16 +700,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyBytes_Size(unpacked) != pixcount*sizeof(long)) { + if (PyString_Size(unpacked) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to packrect has wrong size"); return NULL; } - packed = PyBytes_FromStringAndSize((char *)NULL, packedcount); + packed = PyString_FromStringAndSize((char *)NULL, packedcount); if (packed == NULL) return NULL; - parray = (unsigned long *) PyBytes_AsString(unpacked); - p = (unsigned char *) PyBytes_AsString(packed); + parray = (unsigned long *) PyString_AsString(unpacked); + p = (unsigned char *) PyString_AsString(packed); for (y = 0; y < height; y += packfactor, parray += packfactor*width) { for (x = 0; x < width; x += packfactor) { pixel = parray[x]; @@ -758,16 +758,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyBytes_Size(packed) != packedcount) { + if (PyString_Size(packed) != packedcount) { PyErr_SetString(PyExc_RuntimeError, "string arg to unpackrect has wrong size"); return NULL; } - unpacked = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (unpacked == NULL) return NULL; - parray = (unsigned long *) PyBytes_AsString(unpacked); - p = (unsigned char *) PyBytes_AsString(packed); + parray = (unsigned long *) PyString_AsString(unpacked); + p = (unsigned char *) PyString_AsString(packed); if (packfactor == 1 && width*height > 0) { /* Just expand bytes to longs */ register int x = width * height; @@ -799,7 +799,7 @@ { char buf[20]; gversion(buf); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } Modified: python/trunk/Modules/grpmodule.c ============================================================================== --- python/trunk/Modules/grpmodule.c (original) +++ python/trunk/Modules/grpmodule.c Mon Jun 9 06:58:54 2008 @@ -47,7 +47,7 @@ return NULL; } for (member = p->gr_mem; *member != NULL; member++) { - PyObject *x = PyBytes_FromString(*member); + PyObject *x = PyString_FromString(*member); if (x == NULL || PyList_Append(w, x) != 0) { Py_XDECREF(x); Py_DECREF(w); @@ -58,13 +58,13 @@ } #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) - SET(setIndex++, PyBytes_FromString(p->gr_name)); + SET(setIndex++, PyString_FromString(p->gr_name)); #ifdef __VMS SET(setIndex++, Py_None); Py_INCREF(Py_None); #else if (p->gr_passwd) - SET(setIndex++, PyBytes_FromString(p->gr_passwd)); + SET(setIndex++, PyString_FromString(p->gr_passwd)); else { SET(setIndex++, Py_None); Py_INCREF(Py_None); @@ -113,7 +113,7 @@ py_str_name = PyObject_Str(pyo_name); if (!py_str_name) return NULL; - name = PyBytes_AS_STRING(py_str_name); + name = PyString_AS_STRING(py_str_name); if ((p = getgrnam(name)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name); Modified: python/trunk/Modules/imageop.c ============================================================================== --- python/trunk/Modules/imageop.c (original) +++ python/trunk/Modules/imageop.c Mon Jun 9 06:58:54 2008 @@ -54,7 +54,7 @@ return 1; if (bcos == NULL) { /* cache string object for future use */ - bcos = PyBytes_FromString("backward_compatible"); + bcos = PyString_FromString("backward_compatible"); if (bcos == NULL) return 1; } @@ -97,11 +97,11 @@ xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; - rv = PyBytes_FromStringAndSize(NULL, + rv = PyString_FromStringAndSize(NULL, (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); if ( rv == 0 ) return 0; - ncp = (char *)PyBytes_AsString(rv); + ncp = (char *)PyString_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; newy2 += ystep; @@ -150,10 +150,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, newx*newy*size); + rv = PyString_FromStringAndSize(NULL, newx*newy*size); if ( rv == 0 ) return 0; - ncp = (char *)PyBytes_AsString(rv); + ncp = (char *)PyString_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; for( iy = 0; iy < newy; iy++ ) { @@ -195,10 +195,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); if ( width == 1 ) { memcpy(ncp, cp, maxx); /* Copy first line */ @@ -245,10 +245,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; ovalue = 0; @@ -286,10 +286,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+1)/2); + rv = PyString_FromStringAndSize(NULL, (len+1)/2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -325,10 +325,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -363,10 +363,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; ovalue = 0; @@ -409,10 +409,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 1; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -449,10 +449,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; for ( i=0; i < nlen; i++ ) { @@ -486,10 +486,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -522,10 +522,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -559,10 +559,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */ @@ -603,10 +603,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen*4); + rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: RRRBBGGG @@ -653,10 +653,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { if (backward_compatible) { @@ -698,10 +698,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen*4); + rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { value = *cp++; Modified: python/trunk/Modules/imgfile.c ============================================================================== --- python/trunk/Modules/imgfile.c (original) +++ python/trunk/Modules/imgfile.c Mon Jun 9 06:58:54 2008 @@ -130,12 +130,12 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyBytes_FromStringAndSize((char *)NULL, xsize*ysize*zsize); + rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); if ( rv == NULL ) { iclose(image); return NULL; } - cdatap = PyBytes_AsString(rv); + cdatap = PyString_AsString(rv); idatap = (long *)cdatap; if (top_to_bottom) { @@ -319,7 +319,7 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyBytes_FromStringAndSize(NULL, xwtd*ywtd*zsize); + rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); if ( rv == NULL ) { iclose(image); return NULL; @@ -328,7 +328,7 @@ xfac = (float)xsize/(float)xwtd; yfac = (float)ysize/(float)ywtd; PyFPE_END_PROTECT(yfac) - cdatap = PyBytes_AsString(rv); + cdatap = PyString_AsString(rv); idatap = (long *)cdatap; if ( extended ) { Modified: python/trunk/Modules/itertoolsmodule.c ============================================================================== --- python/trunk/Modules/itertoolsmodule.c (original) +++ python/trunk/Modules/itertoolsmodule.c Mon Jun 9 06:58:54 2008 @@ -2904,12 +2904,12 @@ PyObject *result; if (lz->cnt != PY_SSIZE_T_MAX) - return PyBytes_FromFormat("count(%zd)", lz->cnt); + return PyString_FromFormat("count(%zd)", lz->cnt); cnt_repr = PyObject_Repr(lz->long_cnt); if (cnt_repr == NULL) return NULL; - result = PyBytes_FromFormat("count(%s)", PyBytes_AS_STRING(cnt_repr)); + result = PyString_FromFormat("count(%s)", PyString_AS_STRING(cnt_repr)); Py_DECREF(cnt_repr); return result; } @@ -3221,11 +3221,11 @@ return NULL; if (ro->cnt == -1) - result = PyBytes_FromFormat("repeat(%s)", - PyBytes_AS_STRING(objrepr)); + result = PyString_FromFormat("repeat(%s)", + PyString_AS_STRING(objrepr)); else - result = PyBytes_FromFormat("repeat(%s, %zd)", - PyBytes_AS_STRING(objrepr), ro->cnt); + result = PyString_FromFormat("repeat(%s, %zd)", + PyString_AS_STRING(objrepr), ro->cnt); Py_DECREF(objrepr); return result; } Modified: python/trunk/Modules/linuxaudiodev.c ============================================================================== --- python/trunk/Modules/linuxaudiodev.c (original) +++ python/trunk/Modules/linuxaudiodev.c Mon Jun 9 06:58:54 2008 @@ -162,17 +162,17 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyBytes_AS_STRING(rv); + cp = PyString_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; } self->x_icount += count; - _PyBytes_Resize(&rv, count); + _PyString_Resize(&rv, count); return rv; } Modified: python/trunk/Modules/main.c ============================================================================== --- python/trunk/Modules/main.c (original) +++ python/trunk/Modules/main.c Mon Jun 9 06:58:54 2008 @@ -196,7 +196,7 @@ { PyObject *argv0 = NULL, *importer = NULL; - if ((argv0 = PyBytes_FromString(filename)) && + if ((argv0 = PyString_FromString(filename)) && (importer = PyImport_GetImporter(argv0)) && (importer->ob_type != &PyNullImporter_Type)) { Modified: python/trunk/Modules/md5module.c ============================================================================== --- python/trunk/Modules/md5module.c (original) +++ python/trunk/Modules/md5module.c Mon Jun 9 06:58:54 2008 @@ -80,7 +80,7 @@ mdContext = self->md5; md5_finish(&mdContext, aDigest); - return PyBytes_FromStringAndSize((char *)aDigest, 16); + return PyString_FromStringAndSize((char *)aDigest, 16); } PyDoc_STRVAR(digest_doc, @@ -113,7 +113,7 @@ c = (c>9) ? c+'a'-10 : c + '0'; hexdigest[j++] = c; } - return PyBytes_FromStringAndSize((char*)hexdigest, 32); + return PyString_FromStringAndSize((char*)hexdigest, 32); } @@ -165,7 +165,7 @@ static PyObject * md5_get_name(PyObject *self, void *closure) { - return PyBytes_FromStringAndSize("MD5", 3); + return PyString_FromStringAndSize("MD5", 3); } static PyGetSetDef md5_getseters[] = { Modified: python/trunk/Modules/mmapmodule.c ============================================================================== --- python/trunk/Modules/mmapmodule.c (original) +++ python/trunk/Modules/mmapmodule.c Mon Jun 9 06:58:54 2008 @@ -222,7 +222,7 @@ else ++eol; /* we're interested in the position after the newline. */ - result = PyBytes_FromStringAndSize(start, (eol - start)); + result = PyString_FromStringAndSize(start, (eol - start)); self->pos += (eol - start); return result; } @@ -700,7 +700,7 @@ PyErr_SetString(PyExc_IndexError, "mmap index out of range"); return NULL; } - return PyBytes_FromStringAndSize(self->data + i, 1); + return PyString_FromStringAndSize(self->data + i, 1); } static PyObject * @@ -718,7 +718,7 @@ else if ((size_t)ihigh > self->size) ihigh = self->size; - return PyBytes_FromStringAndSize(self->data + ilow, ihigh-ilow); + return PyString_FromStringAndSize(self->data + ilow, ihigh-ilow); } static PyObject * @@ -736,7 +736,7 @@ "mmap index out of range"); return NULL; } - return PyBytes_FromStringAndSize(self->data + i, 1); + return PyString_FromStringAndSize(self->data + i, 1); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; @@ -747,9 +747,9 @@ } if (slicelen <= 0) - return PyBytes_FromStringAndSize("", 0); + return PyString_FromStringAndSize("", 0); else if (step == 1) - return PyBytes_FromStringAndSize(self->data + start, + return PyString_FromStringAndSize(self->data + start, slicelen); else { char *result_buf = (char *)PyMem_Malloc(slicelen); @@ -762,7 +762,7 @@ cur += step, i++) { result_buf[i] = self->data[cur]; } - result = PyBytes_FromStringAndSize(result_buf, + result = PyString_FromStringAndSize(result_buf, slicelen); PyMem_Free(result_buf); return result; @@ -815,19 +815,19 @@ "mmap object doesn't support slice deletion"); return -1; } - if (! (PyBytes_Check(v)) ) { + if (! (PyString_Check(v)) ) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyBytes_Size(v) != (ihigh - ilow)) { + if (PyString_Size(v) != (ihigh - ilow)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(v); + buf = PyString_AsString(v); memcpy(self->data + ilow, buf, ihigh-ilow); return 0; } @@ -847,14 +847,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) { + if (! (PyString_Check(v) && PyString_Size(v)==1) ) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(v); + buf = PyString_AsString(v); self->data[i] = buf[0]; return 0; } @@ -882,14 +882,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (!PyBytes_Check(value) || PyBytes_Size(value) != 1) { + if (!PyString_Check(value) || PyString_Size(value) != 1) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(value); + buf = PyString_AsString(value); self->data[i] = buf[0]; return 0; } @@ -906,12 +906,12 @@ "mmap object doesn't support slice deletion"); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyBytes_Size(value) != slicelen) { + if (PyString_Size(value) != slicelen) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; @@ -922,7 +922,7 @@ if (slicelen == 0) return 0; else if (step == 1) { - const char *buf = PyBytes_AsString(value); + const char *buf = PyString_AsString(value); if (buf == NULL) return -1; @@ -931,7 +931,7 @@ } else { Py_ssize_t cur, i; - const char *buf = PyBytes_AsString(value); + const char *buf = PyString_AsString(value); if (buf == NULL) return -1; Modified: python/trunk/Modules/nismodule.c ============================================================================== --- python/trunk/Modules/nismodule.c (original) +++ python/trunk/Modules/nismodule.c Mon Jun 9 06:58:54 2008 @@ -115,8 +115,8 @@ if (invallen > 0 && inval[invallen-1] == '\0') invallen--; } - key = PyBytes_FromStringAndSize(inkey, inkeylen); - val = PyBytes_FromStringAndSize(inval, invallen); + key = PyString_FromStringAndSize(inkey, inkeylen); + val = PyString_FromStringAndSize(inval, invallen); if (key == NULL || val == NULL) { /* XXX error -- don't know how to handle */ PyErr_Clear(); @@ -146,7 +146,7 @@ if ((err = yp_get_default_domain(&domain)) != 0) return nis_error(err); - res = PyBytes_FromStringAndSize (domain, strlen(domain)); + res = PyString_FromStringAndSize (domain, strlen(domain)); return res; } @@ -178,7 +178,7 @@ len--; if (err != 0) return nis_error(err); - res = PyBytes_FromStringAndSize (match, len); + res = PyString_FromStringAndSize (match, len); free (match); return res; } @@ -398,7 +398,7 @@ if ((list = PyList_New(0)) == NULL) return NULL; for (maps = maps; maps; maps = maps->next) { - PyObject *str = PyBytes_FromString(maps->map); + PyObject *str = PyString_FromString(maps->map); if (!str || PyList_Append(list, str) < 0) { Py_DECREF(list); Modified: python/trunk/Modules/operator.c ============================================================================== --- python/trunk/Modules/operator.c (original) +++ python/trunk/Modules/operator.c Mon Jun 9 06:58:54 2008 @@ -508,19 +508,19 @@ } #endif - if (!PyBytes_Check(attr)) { + if (!PyString_Check(attr)) { PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); return NULL; } - s = PyBytes_AS_STRING(attr); + s = PyString_AS_STRING(attr); Py_INCREF(obj); for (;;) { PyObject *newobj, *str; p = strchr(s, '.'); - str = p ? PyBytes_FromStringAndSize(s, (p-s)) : - PyBytes_FromString(s); + str = p ? PyString_FromStringAndSize(s, (p-s)) : + PyString_FromString(s); if (str == NULL) { Py_DECREF(obj); return NULL; Modified: python/trunk/Modules/ossaudiodev.c ============================================================================== --- python/trunk/Modules/ossaudiodev.c (original) +++ python/trunk/Modules/ossaudiodev.c Mon Jun 9 06:58:54 2008 @@ -366,10 +366,10 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyBytes_AS_STRING(rv); + cp = PyString_AS_STRING(rv); Py_BEGIN_ALLOW_THREADS count = read(self->fd, cp, size); @@ -381,7 +381,7 @@ return NULL; } self->icount += count; - _PyBytes_Resize(&rv, count); + _PyString_Resize(&rv, count); return rv; } @@ -811,20 +811,20 @@ Py_INCREF(rval); } else if (strcmp(name, "name") == 0) { - rval = PyBytes_FromString(self->devicename); + rval = PyString_FromString(self->devicename); } else if (strcmp(name, "mode") == 0) { /* No need for a "default" in this switch: from newossobject(), self->mode can only be one of these three values. */ switch(self->mode) { case O_RDONLY: - rval = PyBytes_FromString("r"); + rval = PyString_FromString("r"); break; case O_RDWR: - rval = PyBytes_FromString("rw"); + rval = PyString_FromString("rw"); break; case O_WRONLY: - rval = PyBytes_FromString("w"); + rval = PyString_FromString("w"); break; } } @@ -913,12 +913,12 @@ if (labels == NULL || names == NULL) goto error2; for (i = 0; i < num_controls; i++) { - s = PyBytes_FromString(control_labels[i]); + s = PyString_FromString(control_labels[i]); if (s == NULL) goto error2; PyList_SET_ITEM(labels, i, s); - s = PyBytes_FromString(control_names[i]); + s = PyString_FromString(control_names[i]); if (s == NULL) goto error2; PyList_SET_ITEM(names, i, s); Modified: python/trunk/Modules/parsermodule.c ============================================================================== --- python/trunk/Modules/parsermodule.c (original) +++ python/trunk/Modules/parsermodule.c Mon Jun 9 06:58:54 2008 @@ -105,14 +105,14 @@ } if (TYPE(n) == encoding_decl) - (void) addelem(v, i+1, PyBytes_FromString(STR(n))); + (void) addelem(v, i+1, PyString_FromString(STR(n))); return (v); } else if (ISTERMINAL(TYPE(n))) { PyObject *result = mkseq(2 + lineno + col_offset); if (result != NULL) { (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); - (void) addelem(result, 1, PyBytes_FromString(STR(n))); + (void) addelem(result, 1, PyString_FromString(STR(n))); if (lineno == 1) (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); if (col_offset == 1) @@ -689,7 +689,7 @@ temp = PySequence_GetItem(elem, 1); if (temp == NULL) return 0; - if (!PyBytes_Check(temp)) { + if (!PyString_Check(temp)) { PyErr_Format(parser_error, "second item in terminal node must be a string," " found %s", @@ -714,10 +714,10 @@ Py_DECREF(o); } } - len = PyBytes_GET_SIZE(temp) + 1; + len = PyString_GET_SIZE(temp) + 1; strn = (char *)PyObject_MALLOC(len); if (strn != NULL) - (void) memcpy(strn, PyBytes_AS_STRING(temp), len); + (void) memcpy(strn, PyString_AS_STRING(temp), len); Py_DECREF(temp); } else if (!ISNONTERMINAL(type)) { @@ -800,10 +800,10 @@ } if (res && encoding) { Py_ssize_t len; - len = PyBytes_GET_SIZE(encoding) + 1; + len = PyString_GET_SIZE(encoding) + 1; res->n_str = (char *)PyObject_MALLOC(len); if (res->n_str != NULL) - (void) memcpy(res->n_str, PyBytes_AS_STRING(encoding), len); + (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len); Py_DECREF(encoding); Py_DECREF(tuple); } Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Mon Jun 9 06:58:54 2008 @@ -375,12 +375,12 @@ char *p = strchr(*e, '='); if (p == NULL) continue; - k = PyBytes_FromStringAndSize(*e, (int)(p-*e)); + k = PyString_FromStringAndSize(*e, (int)(p-*e)); if (k == NULL) { PyErr_Clear(); continue; } - v = PyBytes_FromString(p+1); + v = PyString_FromString(p+1); if (v == NULL) { PyErr_Clear(); Py_DECREF(k); @@ -400,13 +400,13 @@ rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); + PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "BEGINLIBPATH", v); Py_DECREF(v); } rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); + PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "ENDLIBPATH", v); Py_DECREF(v); } @@ -1598,7 +1598,7 @@ #endif if (ret == NULL) return posix_error(); - return PyBytes_FromString(ret); + return PyString_FromString(ret); } #endif @@ -1620,7 +1620,7 @@ #endif if (ret == NULL) return posix_error(); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } #endif @@ -1968,7 +1968,7 @@ Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #ifdef Py_USING_UNICODE @@ -2174,7 +2174,7 @@ /* Skip over . and .. */ if (strcmp(FileData.cFileName, ".") != 0 && strcmp(FileData.cFileName, "..") != 0) { - v = PyBytes_FromString(FileData.cFileName); + v = PyString_FromString(FileData.cFileName); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2262,7 +2262,7 @@ /* Leave Case of Name Alone -- In Native Form */ /* (Removed Forced Lowercasing Code) */ - v = PyBytes_FromString(namebuf); + v = PyString_FromString(namebuf); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2312,7 +2312,7 @@ (NAMLEN(ep) == 1 || (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) continue; - v = PyBytes_FromStringAndSize(ep->d_name, NAMLEN(ep)); + v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2397,7 +2397,7 @@ return PyUnicode_Decode(outbuf, strlen(outbuf), Py_FileSystemDefaultEncoding, NULL); } - return PyBytes_FromString(outbuf); + return PyString_FromString(outbuf); } /* end of posix__getfullpathname */ #endif /* MS_WINDOWS */ @@ -3062,7 +3062,7 @@ /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { #endif - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3292,7 +3292,7 @@ { goto fail_2; } - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3525,7 +3525,7 @@ { goto fail_2; } - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3895,7 +3895,7 @@ "unable to determine login name"); } else - result = PyBytes_FromString(name); + result = PyString_FromString(name); errno = old_errno; return result; @@ -5884,7 +5884,7 @@ return posix_error_with_allocated_filename(path); PyMem_Free(path); - v = PyBytes_FromStringAndSize(buf, n); + v = PyString_FromStringAndSize(buf, n); #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -6289,18 +6289,18 @@ errno = EINVAL; return posix_error(); } - buffer = PyBytes_FromStringAndSize((char *)NULL, size); + buffer = PyString_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - n = read(fd, PyBytes_AsString(buffer), size); + n = read(fd, PyString_AsString(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) - _PyBytes_Resize(&buffer, n); + _PyString_Resize(&buffer, n); return buffer; } @@ -6647,11 +6647,11 @@ /* XXX This can leak memory -- not easy to fix :-( */ len = strlen(s1) + strlen(s2) + 2; /* len includes space for a trailing \0; the size arg to - PyBytes_FromStringAndSize does not count that */ - newstr = PyBytes_FromStringAndSize(NULL, (int)len - 1); + PyString_FromStringAndSize does not count that */ + newstr = PyString_FromStringAndSize(NULL, (int)len - 1); if (newstr == NULL) return PyErr_NoMemory(); - newenv = PyBytes_AS_STRING(newstr); + newenv = PyString_AS_STRING(newstr); PyOS_snprintf(newenv, len, "%s=%s", s1, s2); if (putenv(newenv)) { Py_DECREF(newstr); @@ -6727,7 +6727,7 @@ "strerror() argument out of range"); return NULL; } - return PyBytes_FromString(message); + return PyString_FromString(message); } @@ -7009,7 +7009,7 @@ #endif if (name == NULL) return PyErr_NoMemory(); - result = PyBytes_FromString(name); + result = PyString_FromString(name); free(name); return result; } @@ -7066,7 +7066,7 @@ Py_XDECREF(err); return NULL; } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } #endif @@ -7095,13 +7095,13 @@ *valuep = PyInt_AS_LONG(arg); return 1; } - if (PyBytes_Check(arg)) { + if (PyString_Check(arg)) { /* look up the value in the table using a binary search */ size_t lo = 0; size_t mid; size_t hi = tablesize; int cmp; - char *confname = PyBytes_AS_STRING(arg); + char *confname = PyString_AS_STRING(arg); while (lo < hi) { mid = (lo + hi) / 2; cmp = strcmp(confname, table[mid].name); @@ -7431,12 +7431,12 @@ } else { if ((unsigned int)len >= sizeof(buffer)) { - result = PyBytes_FromStringAndSize(NULL, len-1); + result = PyString_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyBytes_AS_STRING(result), len); + confstr(name, PyString_AS_STRING(result), len); } else - result = PyBytes_FromStringAndSize(buffer, len-1); + result = PyString_FromStringAndSize(buffer, len-1); } } return result; @@ -8225,11 +8225,11 @@ } /* Allocate bytes */ - result = PyBytes_FromStringAndSize(NULL, howMany); + result = PyString_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) - PyBytes_AS_STRING(result))) { + PyString_AS_STRING(result))) { Py_DECREF(result); return win32_error("CryptGenRandom", NULL); } @@ -8259,11 +8259,11 @@ "negative argument not allowed"); /* Allocate bytes */ - result = PyBytes_FromStringAndSize(NULL, howMany); + result = PyString_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (RAND_pseudo_bytes((unsigned char*) - PyBytes_AS_STRING(result), + PyString_AS_STRING(result), howMany) < 0) { Py_DECREF(result); return PyErr_Format(PyExc_ValueError, Modified: python/trunk/Modules/pwdmodule.c ============================================================================== --- python/trunk/Modules/pwdmodule.c (original) +++ python/trunk/Modules/pwdmodule.c Mon Jun 9 06:58:54 2008 @@ -49,7 +49,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/trunk/Modules/pyexpat.c ============================================================================== --- python/trunk/Modules/pyexpat.c (original) +++ python/trunk/Modules/pyexpat.c Mon Jun 9 06:58:54 2008 @@ -153,7 +153,7 @@ { PyObject *name = hinfo->nameobj; if (name == NULL) { - name = PyBytes_FromString(hinfo->name); + name = PyString_FromString(hinfo->name); hinfo->nameobj = name; } Py_XINCREF(name); @@ -205,7 +205,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromStringAndSize((const char *)str, len); + return PyString_FromStringAndSize((const char *)str, len); } /* Callback routines */ @@ -267,16 +267,16 @@ PyObject *filename = NULL; if (handler_info[slot].tb_code == NULL) { - code = PyBytes_FromString(""); + code = PyString_FromString(""); if (code == NULL) goto failed; - name = PyBytes_FromString(func_name); + name = PyString_FromString(func_name); if (name == NULL) goto failed; nulltuple = PyTuple_New(0); if (nulltuple == NULL) goto failed; - filename = PyBytes_FromString(__FILE__); + filename = PyString_FromString(__FILE__); handler_info[slot].tb_code = PyCode_New(0, /* argcount */ 0, /* nlocals */ @@ -971,13 +971,13 @@ goto finally; /* XXX what to do if it returns a Unicode string? */ - if (!PyBytes_Check(str)) { + if (!PyString_Check(str)) { PyErr_Format(PyExc_TypeError, "read() did not return a string object (type=%.400s)", Py_TYPE(str)->tp_name); goto finally; } - len = PyBytes_GET_SIZE(str); + len = PyString_GET_SIZE(str); if (len > buf_size) { PyErr_Format(PyExc_ValueError, "read() returned too much data: " @@ -985,7 +985,7 @@ buf_size, len); goto finally; } - memcpy(buf, PyBytes_AsString(str), len); + memcpy(buf, PyString_AsString(str), len); finally: Py_XDECREF(arg); Py_XDECREF(str); @@ -1094,7 +1094,7 @@ = XML_GetInputContext(self->itself, &offset, &size); if (buffer != NULL) - return PyBytes_FromStringAndSize(buffer + offset, + return PyString_FromStringAndSize(buffer + offset, size - offset); else Py_RETURN_NONE; @@ -1511,7 +1511,7 @@ #define APPEND(list, str) \ do { \ - PyObject *o = PyBytes_FromString(str); \ + PyObject *o = PyString_FromString(str); \ if (o != NULL) \ PyList_Append(list, o); \ Py_XDECREF(o); \ @@ -1862,7 +1862,7 @@ while (rev[i] != ' ' && rev[i] != '\0') ++i; - return PyBytes_FromStringAndSize(rev, i); + return PyString_FromStringAndSize(rev, i); } /* Initialization function for the module */ @@ -1889,7 +1889,7 @@ MODULE_INITFUNC(void) { PyObject *m, *d; - PyObject *errmod_name = PyBytes_FromString(MODULE_NAME ".errors"); + PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; @@ -1899,7 +1899,7 @@ if (errmod_name == NULL) return; - modelmod_name = PyBytes_FromString(MODULE_NAME ".model"); + modelmod_name = PyString_FromString(MODULE_NAME ".model"); if (modelmod_name == NULL) return; Modified: python/trunk/Modules/readline.c ============================================================================== --- python/trunk/Modules/readline.c (original) +++ python/trunk/Modules/readline.c Mon Jun 9 06:58:54 2008 @@ -421,7 +421,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyBytes_FromString(rl_completer_word_break_characters); + return PyString_FromString(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -471,7 +471,7 @@ if (!PyArg_ParseTuple(args, "i:index", &idx)) return NULL; if ((hist_ent = history_get(idx))) - return PyBytes_FromString(hist_ent->line); + return PyString_FromString(hist_ent->line); else { Py_RETURN_NONE; } @@ -503,7 +503,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyBytes_FromString(rl_line_buffer); + return PyString_FromString(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -676,7 +676,7 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyBytes_FromString(matches[i+1]); + s = PyString_FromString(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) @@ -725,7 +725,7 @@ result = NULL; } else { - char *s = PyBytes_AsString(r); + char *s = PyString_AsString(r); if (s == NULL) goto error; result = strdup(s); Modified: python/trunk/Modules/selectmodule.c ============================================================================== --- python/trunk/Modules/selectmodule.c (original) +++ python/trunk/Modules/selectmodule.c Mon Jun 9 06:58:54 2008 @@ -1219,7 +1219,7 @@ "data=0x%lx udata=%p>", (unsigned long)(s->e.ident), s->e.filter, s->e.flags, s->e.fflags, (long)(s->e.data), s->e.udata); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int Modified: python/trunk/Modules/sha256module.c ============================================================================== --- python/trunk/Modules/sha256module.c (original) +++ python/trunk/Modules/sha256module.c Mon Jun 9 06:58:54 2008 @@ -432,7 +432,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); + return PyString_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA256_hexdigest__doc__, @@ -452,10 +452,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -510,9 +510,9 @@ SHA256_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 32) - return PyBytes_FromStringAndSize("SHA256", 6); + return PyString_FromStringAndSize("SHA256", 6); else - return PyBytes_FromStringAndSize("SHA224", 6); + return PyString_FromStringAndSize("SHA224", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/trunk/Modules/sha512module.c ============================================================================== --- python/trunk/Modules/sha512module.c (original) +++ python/trunk/Modules/sha512module.c Mon Jun 9 06:58:54 2008 @@ -498,7 +498,7 @@ SHAcopy(self, &temp); sha512_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); + return PyString_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA512_hexdigest__doc__, @@ -518,10 +518,10 @@ sha512_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -576,9 +576,9 @@ SHA512_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 64) - return PyBytes_FromStringAndSize("SHA512", 6); + return PyString_FromStringAndSize("SHA512", 6); else - return PyBytes_FromStringAndSize("SHA384", 6); + return PyString_FromStringAndSize("SHA384", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/trunk/Modules/shamodule.c ============================================================================== --- python/trunk/Modules/shamodule.c (original) +++ python/trunk/Modules/shamodule.c Mon Jun 9 06:58:54 2008 @@ -380,7 +380,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, sizeof(digest)); + return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); } PyDoc_STRVAR(SHA_hexdigest__doc__, @@ -400,10 +400,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, sizeof(digest) * 2); + retval = PyString_FromStringAndSize(NULL, sizeof(digest) * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -463,7 +463,7 @@ static PyObject * SHA_get_name(PyObject *self, void *closure) { - return PyBytes_FromStringAndSize("SHA1", 4); + return PyString_FromStringAndSize("SHA1", 4); } static PyGetSetDef SHA_getseters[] = { Modified: python/trunk/Modules/socketmodule.c ============================================================================== --- python/trunk/Modules/socketmodule.c (original) +++ python/trunk/Modules/socketmodule.c Mon Jun 9 06:58:54 2008 @@ -911,7 +911,7 @@ set_gaierror(error); return NULL; } - return PyBytes_FromString(buf); + return PyString_FromString(buf); } @@ -955,7 +955,7 @@ sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #endif @@ -1002,14 +1002,14 @@ #ifdef linux if (a->sun_path[0] == 0) { /* Linux abstract namespace */ addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyBytes_FromStringAndSize(a->sun_path, + return PyString_FromStringAndSize(a->sun_path, addrlen); } else #endif /* linux */ { /* regular NULL-terminated string */ - return PyBytes_FromString(a->sun_path); + return PyString_FromString(a->sun_path); } } #endif /* AF_UNIX */ @@ -1362,7 +1362,7 @@ addr = (struct sockaddr_sco *)addr_ret; _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; - straddr = PyBytes_AsString(args); + straddr = PyString_AsString(args); if (straddr == NULL) { PyErr_SetString(socket_error, "getsockaddrarg: " "wrong format"); @@ -1854,16 +1854,16 @@ "getsockopt buflen out of range"); return NULL; } - buf = PyBytes_FromStringAndSize((char *)NULL, buflen); + buf = PyString_FromStringAndSize((char *)NULL, buflen); if (buf == NULL) return NULL; res = getsockopt(s->sock_fd, level, optname, - (void *)PyBytes_AS_STRING(buf), &buflen); + (void *)PyString_AS_STRING(buf), &buflen); if (res < 0) { Py_DECREF(buf); return s->errorhandler(); } - _PyBytes_Resize(&buf, buflen); + _PyString_Resize(&buf, buflen); return buf; #endif /* __BEOS__ */ } @@ -2386,12 +2386,12 @@ } /* Allocate a new string. */ - buf = PyBytes_FromStringAndSize((char *) 0, recvlen); + buf = PyString_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; /* Call the guts */ - outlen = sock_recv_guts(s, PyBytes_AS_STRING(buf), recvlen, flags); + outlen = sock_recv_guts(s, PyString_AS_STRING(buf), recvlen, flags); if (outlen < 0) { /* An error occurred, release the string and return an error. */ @@ -2401,7 +2401,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyBytes_Resize(&buf, outlen) < 0) + if (_PyString_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ return NULL; } @@ -2560,11 +2560,11 @@ return NULL; } - buf = PyBytes_FromStringAndSize((char *) 0, recvlen); + buf = PyString_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; - outlen = sock_recvfrom_guts(s, PyBytes_AS_STRING(buf), + outlen = sock_recvfrom_guts(s, PyString_AS_STRING(buf), recvlen, flags, &addr); if (outlen < 0) { goto finally; @@ -2573,7 +2573,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyBytes_Resize(&buf, outlen) < 0) + if (_PyString_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ goto finally; } @@ -2941,7 +2941,7 @@ (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } @@ -3057,7 +3057,7 @@ if (res < 0) return set_error(); buf[sizeof buf - 1] = '\0'; - return PyBytes_FromString(buf); + return PyString_FromString(buf); } PyDoc_STRVAR(gethostname_doc, @@ -3143,7 +3143,7 @@ if (h->h_aliases) { for (pch = h->h_aliases; *pch != NULL; pch++) { int status; - tmp = PyBytes_FromString(*pch); + tmp = PyString_FromString(*pch); if (tmp == NULL) goto err; @@ -3432,7 +3432,7 @@ PyErr_SetString(socket_error, "port/proto not found"); return NULL; } - return PyBytes_FromString(sp->s_name); + return PyString_FromString(sp->s_name); } PyDoc_STRVAR(getservbyport_doc, @@ -3734,7 +3734,7 @@ if (inet_aton != NULL) { #endif if (inet_aton(ip_addr, &buf)) - return PyBytes_FromStringAndSize((char *)(&buf), + return PyString_FromStringAndSize((char *)(&buf), sizeof(buf)); PyErr_SetString(socket_error, @@ -3763,7 +3763,7 @@ return NULL; } } - return PyBytes_FromStringAndSize((char *) &packed_addr, + return PyString_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); #ifdef USE_INET_ATON_WEAKLINK @@ -3797,7 +3797,7 @@ memcpy(&packed_addr, packed_str, addr_len); - return PyBytes_FromString(inet_ntoa(packed_addr)); + return PyString_FromString(inet_ntoa(packed_addr)); } #ifdef HAVE_INET_PTON @@ -3840,11 +3840,11 @@ "illegal IP address string passed to inet_pton"); return NULL; } else if (af == AF_INET) { - return PyBytes_FromStringAndSize(packed, + return PyString_FromStringAndSize(packed, sizeof(struct in_addr)); #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { - return PyBytes_FromStringAndSize(packed, + return PyString_FromStringAndSize(packed, sizeof(struct in6_addr)); #endif } else { @@ -3871,7 +3871,7 @@ char ip[INET_ADDRSTRLEN + 1]; #endif - /* Guarantee NUL-termination for PyBytes_FromString() below */ + /* Guarantee NUL-termination for PyString_FromString() below */ memset((void *) &ip[0], '\0', sizeof(ip)); if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { @@ -3903,7 +3903,7 @@ PyErr_SetFromErrno(socket_error); return NULL; } else { - return PyBytes_FromString(retval); + return PyString_FromString(retval); } /* NOTREACHED */ @@ -3944,9 +3944,9 @@ idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); if (!idna) return NULL; - hptr = PyBytes_AsString(idna); - } else if (PyBytes_Check(hobj)) { - hptr = PyBytes_AsString(hobj); + hptr = PyString_AsString(idna); + } else if (PyString_Check(hobj)) { + hptr = PyString_AsString(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); @@ -3955,8 +3955,8 @@ if (PyInt_Check(pobj)) { PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); pptr = pbuf; - } else if (PyBytes_Check(pobj)) { - pptr = PyBytes_AsString(pobj); + } else if (PyString_Check(pobj)) { + pptr = PyString_AsString(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { Modified: python/trunk/Modules/spwdmodule.c ============================================================================== --- python/trunk/Modules/spwdmodule.c (original) +++ python/trunk/Modules/spwdmodule.c Mon Jun 9 06:58:54 2008 @@ -60,7 +60,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/trunk/Modules/stropmodule.c ============================================================================== --- python/trunk/Modules/stropmodule.c (original) +++ python/trunk/Modules/stropmodule.c Mon Jun 9 06:58:54 2008 @@ -47,7 +47,7 @@ i = i+1; } if (j < i) { - item = PyBytes_FromStringAndSize(s+j, i-j); + item = PyString_FromStringAndSize(s+j, i-j); if (item == NULL) goto finally; @@ -61,7 +61,7 @@ i = i+1; } if (maxsplit && (countsplit >= maxsplit) && i < len) { - item = PyBytes_FromStringAndSize( + item = PyString_FromStringAndSize( s+i, len - i); if (item == NULL) goto finally; @@ -122,7 +122,7 @@ i = j = 0; while (i+n <= len) { if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) { - item = PyBytes_FromStringAndSize(s+j, i-j); + item = PyString_FromStringAndSize(s+j, i-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -137,7 +137,7 @@ else i++; } - item = PyBytes_FromStringAndSize(s+j, len-j); + item = PyString_FromStringAndSize(s+j, len-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -189,7 +189,7 @@ if (seqlen == 1) { /* Optimization if there's only one item */ PyObject *item = PySequence_GetItem(seq, 0); - if (item && !PyBytes_Check(item)) { + if (item && !PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(item); @@ -198,9 +198,9 @@ return item; } - if (!(res = PyBytes_FromStringAndSize((char*)NULL, sz))) + if (!(res = PyString_FromStringAndSize((char*)NULL, sz))) return NULL; - p = PyBytes_AsString(res); + p = PyString_AsString(res); /* optimize for lists, since it's the most common case. all others * (tuples and arbitrary sequences) just use the sequence abstract @@ -209,29 +209,29 @@ if (PyList_Check(seq)) { for (i = 0; i < seqlen; i++) { PyObject *item = PyList_GET_ITEM(seq, i); - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); return NULL; } - slen = PyBytes_GET_SIZE(item); + slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyBytes_Resize(&res, sz * 2) < 0) + if (_PyString_Resize(&res, sz * 2) < 0) return NULL; sz *= 2; - p = PyBytes_AsString(res) + reslen; + p = PyString_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyBytes_AS_STRING(item), slen); + memcpy(p, PyString_AS_STRING(item), slen); p += slen; reslen += slen; } - _PyBytes_Resize(&res, reslen); + _PyString_Resize(&res, reslen); return res; } @@ -245,33 +245,33 @@ /* This is now type safe */ for (i = 0; i < seqlen; i++) { PyObject *item = getitemfunc(seq, i); - if (!item || !PyBytes_Check(item)) { + if (!item || !PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); Py_XDECREF(item); return NULL; } - slen = PyBytes_GET_SIZE(item); + slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyBytes_Resize(&res, sz * 2) < 0) { + if (_PyString_Resize(&res, sz * 2) < 0) { Py_DECREF(item); return NULL; } sz *= 2; - p = PyBytes_AsString(res) + reslen; + p = PyString_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyBytes_AS_STRING(item), slen); + memcpy(p, PyString_AS_STRING(item), slen); p += slen; reslen += slen; Py_DECREF(item); } - _PyBytes_Resize(&res, reslen); + _PyString_Resize(&res, reslen); return res; } @@ -369,7 +369,7 @@ Py_ssize_t len, i, j; - if (PyBytes_AsStringAndSize(args, &s, &len)) + if (PyString_AsStringAndSize(args, &s, &len)) return NULL; i = 0; @@ -392,7 +392,7 @@ return args; } else - return PyBytes_FromStringAndSize(s+i, j-i); + return PyString_FromStringAndSize(s+i, j-i); } @@ -450,12 +450,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -489,12 +489,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -529,12 +529,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; if (0 < n) { int c = Py_CHARMASK(*s++); @@ -610,12 +610,12 @@ } /* Second pass: create output string and fill it */ - out = PyBytes_FromStringAndSize(NULL, i+j); + out = PyString_FromStringAndSize(NULL, i+j); if (out == NULL) return NULL; i = 0; - q = PyBytes_AS_STRING(out); + q = PyString_AS_STRING(out); for (p = string; p < e; p++) { if (*p == '\t') { @@ -695,12 +695,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -898,10 +898,10 @@ return NULL; } - result = PyBytes_FromStringAndSize((char *)NULL, 256); + result = PyString_FromStringAndSize((char *)NULL, 256); if (result == NULL) return NULL; - c = (unsigned char *) PyBytes_AS_STRING((PyBytesObject *)result); + c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result); for (i = 0; i < 256; i++) c[i]=(unsigned char)i; for (i = 0; i < fromlen; i++) @@ -942,12 +942,12 @@ } table = table1; - inlen = PyBytes_GET_SIZE(input_obj); - result = PyBytes_FromStringAndSize((char *)NULL, inlen); + inlen = PyString_GET_SIZE(input_obj); + result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; - output_start = output = PyBytes_AsString(result); - input = PyBytes_AsString(input_obj); + output_start = output = PyString_AsString(result); + input = PyString_AsString(input_obj); if (dellen == 0) { /* If no deletions are required, use faster code */ @@ -983,7 +983,7 @@ } /* Fix the size of the resulting string */ if (inlen > 0) - _PyBytes_Resize(&result, output - output_start); + _PyString_Resize(&result, output - output_start); return result; } @@ -1169,7 +1169,7 @@ Py_XINCREF(newstr); } else { - newstr = PyBytes_FromStringAndSize(new_s, out_len); + newstr = PyString_FromStringAndSize(new_s, out_len); PyMem_FREE(new_s); } return newstr; @@ -1222,7 +1222,7 @@ if (isspace(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "whitespace", s); @@ -1232,7 +1232,7 @@ if (islower(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "lowercase", s); @@ -1242,7 +1242,7 @@ if (isupper(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "uppercase", s); } Modified: python/trunk/Modules/sunaudiodev.c ============================================================================== --- python/trunk/Modules/sunaudiodev.c (original) +++ python/trunk/Modules/sunaudiodev.c Mon Jun 9 06:58:54 2008 @@ -135,11 +135,11 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - if (!(cp = PyBytes_AsString(rv))) + if (!(cp = PyString_AsString(rv))) goto finally; count = read(self->x_fd, cp, size); Modified: python/trunk/Modules/svmodule.c ============================================================================== --- python/trunk/Modules/svmodule.c (original) +++ python/trunk/Modules/svmodule.c Mon Jun 9 06:58:54 2008 @@ -47,13 +47,13 @@ if (!PyArg_Parse(args, "i", &invert)) return NULL; - if (!(output = PyBytes_FromStringAndSize( + if (!(output = PyString_FromStringAndSize( NULL, (int)(self->ob_info.width * self->ob_info.height * factor)))) { return NULL; } - if (!(outstr = PyBytes_AsString(output))) { + if (!(outstr = PyString_AsString(output))) { Py_DECREF(output); return NULL; } @@ -152,9 +152,9 @@ fieldsize = self->ob_info.width * self->ob_info.height / 2; obcapture = (char*)self->ob_capture; - if (!(f1 = PyBytes_FromStringAndSize(obcapture, fieldsize))) + if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) goto finally; - if (!(f2 = PyBytes_FromStringAndSize(obcapture + fieldsize, + if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, fieldsize))) goto finally; ret = PyTuple_Pack(2, f1, f2); @@ -535,12 +535,12 @@ goto finally; } - if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) goto finally; /* XXX -- need to do something about the bitvector */ { - char* str = PyBytes_AsString(videodata); + char* str = PyString_AsString(videodata); if (!str) goto finally; @@ -615,10 +615,10 @@ if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) return sv_error(); - if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) return NULL; - str = PyBytes_AsString(videodata); + str = PyString_AsString(videodata); if (!str) goto finally; @@ -849,11 +849,11 @@ return NULL; } - if (!(output = PyBytes_FromStringAndSize(NULL, + if (!(output = PyString_FromStringAndSize(NULL, (int)(width * height * factor)))) return NULL; - str = PyBytes_AsString(output); + str = PyString_AsString(output); if (!str) { Py_DECREF(output); return NULL; Modified: python/trunk/Modules/syslogmodule.c ============================================================================== --- python/trunk/Modules/syslogmodule.c (original) +++ python/trunk/Modules/syslogmodule.c Mon Jun 9 06:58:54 2008 @@ -71,7 +71,7 @@ S_ident_o = new_S_ident_o; Py_INCREF(S_ident_o); - openlog(PyBytes_AsString(S_ident_o), logopt, facility); + openlog(PyString_AsString(S_ident_o), logopt, facility); Py_INCREF(Py_None); return Py_None; Modified: python/trunk/Modules/termios.c ============================================================================== --- python/trunk/Modules/termios.c (original) +++ python/trunk/Modules/termios.c Mon Jun 9 06:58:54 2008 @@ -91,7 +91,7 @@ return NULL; for (i = 0; i < NCCS; i++) { ch = (char)mode.c_cc[i]; - v = PyBytes_FromStringAndSize(&ch, 1); + v = PyString_FromStringAndSize(&ch, 1); if (v == NULL) goto err; PyList_SetItem(cc, i, v); @@ -183,8 +183,8 @@ for (i = 0; i < NCCS; i++) { v = PyList_GetItem(cc, i); - if (PyBytes_Check(v) && PyBytes_Size(v) == 1) - mode.c_cc[i] = (cc_t) * PyBytes_AsString(v); + if (PyString_Check(v) && PyString_Size(v) == 1) + mode.c_cc[i] = (cc_t) * PyString_AsString(v); else if (PyInt_Check(v)) mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { Modified: python/trunk/Modules/threadmodule.c ============================================================================== --- python/trunk/Modules/threadmodule.c (original) +++ python/trunk/Modules/threadmodule.c Mon Jun 9 06:58:54 2008 @@ -190,7 +190,7 @@ Py_XINCREF(kw); self->kw = kw; self->dict = NULL; /* making sure */ - self->key = PyBytes_FromFormat("thread.local.%p", self); + self->key = PyString_FromFormat("thread.local.%p", self); if (self->key == NULL) goto err; Modified: python/trunk/Modules/timemodule.c ============================================================================== --- python/trunk/Modules/timemodule.c (original) +++ python/trunk/Modules/timemodule.c Mon Jun 9 06:58:54 2008 @@ -488,7 +488,7 @@ e.g. an empty format, or %Z when the timezone is unknown. */ PyObject *ret; - ret = PyBytes_FromStringAndSize(outbuf, buflen); + ret = PyString_FromStringAndSize(outbuf, buflen); free(outbuf); return ret; } @@ -548,7 +548,7 @@ p = asctime(&buf); if (p[24] == '\n') p[24] = '\0'; - return PyBytes_FromString(p); + return PyString_FromString(p); } PyDoc_STRVAR(asctime_doc, @@ -584,7 +584,7 @@ } if (p[24] == '\n') p[24] = '\0'; - return PyBytes_FromString(p); + return PyString_FromString(p); } PyDoc_STRVAR(ctime_doc, Modified: python/trunk/Modules/unicodedata.c ============================================================================== --- python/trunk/Modules/unicodedata.c (original) +++ python/trunk/Modules/unicodedata.c Mon Jun 9 06:58:54 2008 @@ -266,7 +266,7 @@ if (old->category_changed != 0xFF) index = old->category_changed; } - return PyBytes_FromString(_PyUnicode_CategoryNames[index]); + return PyString_FromString(_PyUnicode_CategoryNames[index]); } PyDoc_STRVAR(unicodedata_bidirectional__doc__, @@ -297,7 +297,7 @@ else if (old->bidir_changed != 0xFF) index = old->bidir_changed; } - return PyBytes_FromString(_PyUnicode_BidirectionalNames[index]); + return PyString_FromString(_PyUnicode_BidirectionalNames[index]); } PyDoc_STRVAR(unicodedata_combining__doc__, @@ -383,7 +383,7 @@ if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyBytes_FromString(_PyUnicode_EastAsianWidthNames[index]); + return PyString_FromString(_PyUnicode_EastAsianWidthNames[index]); } PyDoc_STRVAR(unicodedata_decomposition__doc__, @@ -414,7 +414,7 @@ if (self) { const change_record *old = get_old_record(self, c); if (old->category_changed == 0) - return PyBytes_FromString(""); /* unassigned */ + return PyString_FromString(""); /* unassigned */ } if (code < 0 || code >= 0x110000) @@ -453,7 +453,7 @@ decomp[i] = '\0'; - return PyBytes_FromString(decomp); + return PyString_FromString(decomp); } static void @@ -518,7 +518,7 @@ /* Hangul Decomposition adds three characters in a single step, so we need atleast that much room. */ if (space < 3) { - Py_ssize_t newsize = PyBytes_GET_SIZE(result) + 10; + Py_ssize_t newsize = PyString_GET_SIZE(result) + 10; space += 10; if (PyUnicode_Resize(&result, newsize) == -1) return NULL; Modified: python/trunk/Modules/zipimport.c ============================================================================== --- python/trunk/Modules/zipimport.c (original) +++ python/trunk/Modules/zipimport.c Mon Jun 9 06:58:54 2008 @@ -154,11 +154,11 @@ } } - self->archive = PyBytes_FromString(buf); + self->archive = PyString_FromString(buf); if (self->archive == NULL) return -1; - self->prefix = PyBytes_FromString(prefix); + self->prefix = PyString_FromString(prefix); if (self->prefix == NULL) return -1; @@ -191,10 +191,10 @@ char *archive = "???"; char *prefix = ""; - if (self->archive != NULL && PyBytes_Check(self->archive)) - archive = PyBytes_AsString(self->archive); - if (self->prefix != NULL && PyBytes_Check(self->prefix)) - prefix = PyBytes_AsString(self->prefix); + if (self->archive != NULL && PyString_Check(self->archive)) + archive = PyString_AsString(self->archive); + if (self->prefix != NULL && PyString_Check(self->prefix)) + prefix = PyString_AsString(self->prefix); if (prefix != NULL && *prefix) PyOS_snprintf(buf, sizeof(buf), "", @@ -203,7 +203,7 @@ PyOS_snprintf(buf, sizeof(buf), "", archive); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } /* return fullname.split(".")[-1] */ @@ -263,7 +263,7 @@ subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return MI_ERROR; @@ -336,12 +336,12 @@ /* add __path__ to the module *before* the code gets executed */ PyObject *pkgpath, *fullpath; - char *prefix = PyBytes_AsString(self->prefix); + char *prefix = PyString_AsString(self->prefix); char *subname = get_subname(fullname); int err; - fullpath = PyBytes_FromFormat("%s%c%s%s", - PyBytes_AsString(self->archive), + fullpath = PyString_FromFormat("%s%c%s%s", + PyString_AsString(self->archive), SEP, *prefix ? prefix : "", subname); @@ -418,9 +418,9 @@ } path = buf; #endif - len = PyBytes_Size(self->archive); + len = PyString_Size(self->archive); if ((size_t)len < strlen(path) && - strncmp(path, PyBytes_AsString(self->archive), len) == 0 && + strncmp(path, PyString_AsString(self->archive), len) == 0 && path[len] == SEP) { path = path + len + 1; } @@ -430,7 +430,7 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); return NULL; } - return get_data(PyBytes_AsString(self->archive), toc_entry); + return get_data(PyString_AsString(self->archive), toc_entry); } static PyObject * @@ -467,7 +467,7 @@ } subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -480,7 +480,7 @@ toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) - return get_data(PyBytes_AsString(self->archive), toc_entry); + return get_data(PyString_AsString(self->archive), toc_entry); /* we have the module, but no source */ Py_INCREF(Py_None); @@ -843,13 +843,13 @@ PyMarshal_ReadShortFromFile(fp); /* local header size */ file_offset += l; /* Start of file data */ - raw_data = PyBytes_FromStringAndSize((char *)NULL, compress == 0 ? + raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ? data_size : data_size + 1); if (raw_data == NULL) { fclose(fp); return NULL; } - buf = PyBytes_AsString(raw_data); + buf = PyString_AsString(raw_data); err = fseek(fp, file_offset, 0); if (err == 0) @@ -907,8 +907,8 @@ unmarshal_code(char *pathname, PyObject *data, time_t mtime) { PyObject *code; - char *buf = PyBytes_AsString(data); - Py_ssize_t size = PyBytes_Size(data); + char *buf = PyString_AsString(data); + Py_ssize_t size = PyString_Size(data); if (size <= 9) { PyErr_SetString(ZipImportError, @@ -953,14 +953,14 @@ static PyObject * normalize_line_endings(PyObject *source) { - char *buf, *q, *p = PyBytes_AsString(source); + char *buf, *q, *p = PyString_AsString(source); PyObject *fixed_source; if (!p) return NULL; /* one char extra for trailing \n and one for terminating \0 */ - buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2); + buf = (char *)PyMem_Malloc(PyString_Size(source) + 2); if (buf == NULL) { PyErr_SetString(PyExc_MemoryError, "zipimport: no memory to allocate " @@ -979,7 +979,7 @@ } *q++ = '\n'; /* add trailing \n */ *q = '\0'; - fixed_source = PyBytes_FromString(buf); + fixed_source = PyString_FromString(buf); PyMem_Free(buf); return fixed_source; } @@ -995,7 +995,7 @@ if (fixed_source == NULL) return NULL; - code = Py_CompileString(PyBytes_AsString(fixed_source), pathname, + code = Py_CompileString(PyString_AsString(fixed_source), pathname, Py_file_input); Py_DECREF(fixed_source); return code; @@ -1054,7 +1054,7 @@ { PyObject *data, *code; char *modpath; - char *archive = PyBytes_AsString(self->archive); + char *archive = PyString_AsString(self->archive); if (archive == NULL) return NULL; @@ -1063,7 +1063,7 @@ if (data == NULL) return NULL; - modpath = PyBytes_AsString(PyTuple_GetItem(toc_entry, 0)); + modpath = PyString_AsString(PyTuple_GetItem(toc_entry, 0)); if (isbytecode) { code = unmarshal_code(modpath, data, mtime); @@ -1088,7 +1088,7 @@ subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -1098,7 +1098,7 @@ strcpy(path + len, zso->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s%c%s\n", - PyBytes_AsString(self->archive), + PyString_AsString(self->archive), SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { @@ -1120,7 +1120,7 @@ continue; } if (code != NULL && p_modpath != NULL) - *p_modpath = PyBytes_AsString( + *p_modpath = PyString_AsString( PyTuple_GetItem(toc_entry, 0)); return code; } Modified: python/trunk/Modules/zlibmodule.c ============================================================================== --- python/trunk/Modules/zlibmodule.c (original) +++ python/trunk/Modules/zlibmodule.c Mon Jun 9 06:58:54 2008 @@ -96,12 +96,12 @@ if (self == NULL) return NULL; self->is_initialised = 0; - self->unused_data = PyBytes_FromString(""); + self->unused_data = PyString_FromString(""); if (self->unused_data == NULL) { Py_DECREF(self); return NULL; } - self->unconsumed_tail = PyBytes_FromString(""); + self->unconsumed_tail = PyString_FromString(""); if (self->unconsumed_tail == NULL) { Py_DECREF(self); return NULL; @@ -174,7 +174,7 @@ err=deflateEnd(&zst); if (err == Z_OK) - ReturnVal = PyBytes_FromStringAndSize((char *)output, + ReturnVal = PyString_FromStringAndSize((char *)output, zst.total_out); else zlib_error(zst, err, "while finishing compression"); @@ -211,12 +211,12 @@ zst.avail_in = length; zst.avail_out = r_strlen; - if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen))) + if (!(result_str = PyString_FromStringAndSize(NULL, r_strlen))) return NULL; zst.zalloc = (alloc_func)NULL; zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)PyBytes_AS_STRING(result_str); + zst.next_out = (Byte *)PyString_AS_STRING(result_str); zst.next_in = (Byte *)input; err = inflateInit2(&zst, wsize); @@ -256,11 +256,11 @@ /* fall through */ case(Z_OK): /* need more memory */ - if (_PyBytes_Resize(&result_str, r_strlen << 1) < 0) { + if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { inflateEnd(&zst); goto error; } - zst.next_out = (unsigned char *)PyBytes_AS_STRING(result_str) \ + zst.next_out = (unsigned char *)PyString_AS_STRING(result_str) \ + r_strlen; zst.avail_out = r_strlen; r_strlen = r_strlen << 1; @@ -278,7 +278,7 @@ goto error; } - _PyBytes_Resize(&result_str, zst.total_out); + _PyString_Resize(&result_str, zst.total_out); return result_str; error: @@ -400,7 +400,7 @@ if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) return NULL; - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -409,7 +409,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), Z_NO_FLUSH); @@ -418,9 +418,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&RetVal, length << 1) < 0) + if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -440,7 +440,7 @@ RetVal = NULL; goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -479,7 +479,7 @@ /* limit amount of data allocated to max_length */ if (max_length && length > max_length) length = max_length; - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -488,7 +488,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); @@ -510,9 +510,9 @@ if (max_length && length > max_length) length = max_length; - if (_PyBytes_Resize(&RetVal, length) < 0) + if (_PyString_Resize(&RetVal, length) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + old_length; self->zst.avail_out = length - old_length; @@ -525,7 +525,7 @@ of specified size. Return the unconsumed tail in an attribute.*/ if(max_length) { Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in, + self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); if(!self->unconsumed_tail) { Py_DECREF(RetVal); @@ -542,7 +542,7 @@ */ if (err == Z_STREAM_END) { Py_XDECREF(self->unused_data); /* Free original empty string */ - self->unused_data = PyBytes_FromStringAndSize( + self->unused_data = PyString_FromStringAndSize( (char *)self->zst.next_in, self->zst.avail_in); if (self->unused_data == NULL) { Py_DECREF(RetVal); @@ -559,7 +559,7 @@ goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -589,10 +589,10 @@ /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in doing any work at all; just return an empty string. */ if (flushmode == Z_NO_FLUSH) { - return PyBytes_FromStringAndSize(NULL, 0); + return PyString_FromStringAndSize(NULL, 0); } - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -600,7 +600,7 @@ start_total_out = self->zst.total_out; self->zst.avail_in = 0; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), flushmode); @@ -609,9 +609,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&RetVal, length << 1) < 0) + if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -646,7 +646,7 @@ goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -778,7 +778,7 @@ PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); return NULL; } - if (!(retval = PyBytes_FromStringAndSize(NULL, length))) + if (!(retval = PyString_FromStringAndSize(NULL, length))) return NULL; @@ -786,7 +786,7 @@ start_total_out = self->zst.total_out; self->zst.avail_out = length; - self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval); + self->zst.next_out = (Byte *)PyString_AS_STRING(retval); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_FINISH); @@ -795,9 +795,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&retval, length << 1) < 0) + if (_PyString_Resize(&retval, length << 1) < 0) goto error; - self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval) + length; + self->zst.next_out = (Byte *)PyString_AS_STRING(retval) + length; self->zst.avail_out = length; length = length << 1; @@ -819,7 +819,7 @@ goto error; } } - _PyBytes_Resize(&retval, self->zst.total_out - start_total_out); + _PyString_Resize(&retval, self->zst.total_out - start_total_out); error: @@ -1027,7 +1027,7 @@ PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); - ver = PyBytes_FromString(ZLIB_VERSION); + ver = PyString_FromString(ZLIB_VERSION); if (ver != NULL) PyModule_AddObject(m, "ZLIB_VERSION", ver); Modified: python/trunk/Objects/abstract.c ============================================================================== --- python/trunk/Objects/abstract.c (original) +++ python/trunk/Objects/abstract.c Mon Jun 9 06:58:54 2008 @@ -105,7 +105,7 @@ /* cache a hashed version of the attribute string */ if (hintstrobj == NULL) { - hintstrobj = PyBytes_InternFromString("__length_hint__"); + hintstrobj = PyString_InternFromString("__length_hint__"); if (hintstrobj == NULL) goto defaultcase; } @@ -227,7 +227,7 @@ null_error(); return -1; } - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return -1; ret = PyObject_DelItem(o, okey); @@ -723,21 +723,21 @@ /* Initialize cached value */ if (str__format__ == NULL) { /* Initialize static variable needed by _PyType_Lookup */ - str__format__ = PyBytes_InternFromString("__format__"); + str__format__ = PyString_InternFromString("__format__"); if (str__format__ == NULL) goto done; } /* If no format_spec is provided, use an empty string */ if (format_spec == NULL) { - empty = PyBytes_FromStringAndSize(NULL, 0); + empty = PyString_FromStringAndSize(NULL, 0); format_spec = empty; } /* Check the format_spec type, and make sure it's str or unicode */ if (PyUnicode_Check(format_spec)) spec_is_unicode = 1; - else if (PyBytes_Check(format_spec)) + else if (PyString_Check(format_spec)) spec_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -817,7 +817,7 @@ /* Check the result type, and make sure it's str or unicode */ if (PyUnicode_Check(result)) result_is_unicode = 1; - else if (PyBytes_Check(result)) + else if (PyString_Check(result)) result_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -1535,7 +1535,7 @@ const char *type_name; static PyObject *int_name = NULL; if (int_name == NULL) { - int_name = PyBytes_InternFromString("__int__"); + int_name = PyString_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1561,7 +1561,7 @@ non_integral_error: if (PyInstance_Check(integral)) { - type_name = PyBytes_AS_STRING(((PyInstanceObject *)integral) + type_name = PyString_AS_STRING(((PyInstanceObject *)integral) ->in_class->cl_name); } else { @@ -1583,7 +1583,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyBytes_InternFromString("__trunc__"); + trunc_name = PyString_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1623,9 +1623,9 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyBytes_Check(o)) - return int_from_string(PyBytes_AS_STRING(o), - PyBytes_GET_SIZE(o)); + if (PyString_Check(o)) + return int_from_string(PyString_AS_STRING(o), + PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), @@ -1668,7 +1668,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyBytes_InternFromString("__trunc__"); + trunc_name = PyString_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1710,13 +1710,13 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyBytes_Check(o)) + if (PyString_Check(o)) /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. */ - return long_from_string(PyBytes_AS_STRING(o), - PyBytes_GET_SIZE(o)); + return long_from_string(PyString_AS_STRING(o), + PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ @@ -2407,7 +2407,7 @@ if (key == NULL) return null_error(); - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return NULL; r = PyObject_GetItem(o, okey); @@ -2426,7 +2426,7 @@ return -1; } - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return -1; r = PyObject_SetItem(o, okey, value); @@ -2754,7 +2754,7 @@ PyObject *bases; if (__bases__ == NULL) { - __bases__ = PyBytes_InternFromString("__bases__"); + __bases__ = PyString_InternFromString("__bases__"); if (__bases__ == NULL) return NULL; } @@ -2832,7 +2832,7 @@ int retval = 0; if (__class__ == NULL) { - __class__ = PyBytes_InternFromString("__class__"); + __class__ = PyString_InternFromString("__class__"); if (__class__ == NULL) return -1; } @@ -2908,7 +2908,7 @@ return 1; if (name == NULL) { - name = PyBytes_InternFromString("__instancecheck__"); + name = PyString_InternFromString("__instancecheck__"); if (name == NULL) return -1; } @@ -2992,7 +2992,7 @@ PyErr_Fetch(&t, &v, &tb); if (name == NULL) { - name = PyBytes_InternFromString("__subclasscheck__"); + name = PyString_InternFromString("__subclasscheck__"); if (name == NULL) return -1; } Modified: python/trunk/Objects/boolobject.c ============================================================================== --- python/trunk/Objects/boolobject.c (original) +++ python/trunk/Objects/boolobject.c Mon Jun 9 06:58:54 2008 @@ -25,10 +25,10 @@ if (self->ob_ival) s = true_str ? true_str : - (true_str = PyBytes_InternFromString("True")); + (true_str = PyString_InternFromString("True")); else s = false_str ? false_str : - (false_str = PyBytes_InternFromString("False")); + (false_str = PyString_InternFromString("False")); Py_XINCREF(s); return s; } Modified: python/trunk/Objects/bufferobject.c ============================================================================== --- python/trunk/Objects/bufferobject.c (original) +++ python/trunk/Objects/bufferobject.c Mon Jun 9 06:58:54 2008 @@ -287,13 +287,13 @@ const char *status = self->b_readonly ? "read-only" : "read-write"; if ( self->b_base == NULL ) - return PyBytes_FromFormat("<%s buffer ptr %p, size %zd at %p>", + return PyString_FromFormat("<%s buffer ptr %p, size %zd at %p>", status, self->b_ptr, self->b_size, self); else - return PyBytes_FromFormat( + return PyString_FromFormat( "<%s buffer for %p, size %zd, offset %zd at %p>", status, self->b_base, @@ -318,7 +318,7 @@ * underlying memory is immutable. b_readonly is a necessary but not * sufficient condition for a buffer to be hashable. Perhaps it would * be better to only allow hashing if the underlying object is known to - * be immutable (e.g. PyBytes_Check() is true). Another idea would + * be immutable (e.g. PyString_Check() is true). Another idea would * be to call tp_hash on the underlying object and see if it raises * an error. */ if ( !self->b_readonly ) @@ -349,7 +349,7 @@ Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - return PyBytes_FromStringAndSize((const char *)ptr, size); + return PyString_FromStringAndSize((const char *)ptr, size); } /* Sequence methods */ @@ -401,10 +401,10 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; - ob = PyBytes_FromStringAndSize(NULL, size + count); + ob = PyString_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; - p = PyBytes_AS_STRING(ob); + p = PyString_AS_STRING(ob); memcpy(p, ptr1, size); memcpy(p + size, ptr2, count); @@ -426,11 +426,11 @@ count = 0; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - ob = PyBytes_FromStringAndSize(NULL, size * count); + ob = PyString_FromStringAndSize(NULL, size * count); if ( ob == NULL ) return NULL; - p = PyBytes_AS_STRING(ob); + p = PyString_AS_STRING(ob); while ( count-- ) { memcpy(p, ptr, size); @@ -454,7 +454,7 @@ PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } - return PyBytes_FromStringAndSize((char *)ptr + idx, 1); + return PyString_FromStringAndSize((char *)ptr + idx, 1); } static PyObject * @@ -472,7 +472,7 @@ right = size; if ( right < left ) right = left; - return PyBytes_FromStringAndSize((char *)ptr + left, + return PyString_FromStringAndSize((char *)ptr + left, right - left); } @@ -501,9 +501,9 @@ } if (slicelength <= 0) - return PyBytes_FromStringAndSize("", 0); + return PyString_FromStringAndSize("", 0); else if (step == 1) - return PyBytes_FromStringAndSize((char *)p + start, + return PyString_FromStringAndSize((char *)p + start, stop - start); else { PyObject *result; @@ -518,7 +518,7 @@ result_buf[i] = source_buf[cur]; } - result = PyBytes_FromStringAndSize(result_buf, + result = PyString_FromStringAndSize(result_buf, slicelength); PyMem_Free(result_buf); return result; Modified: python/trunk/Objects/bytes_methods.c ============================================================================== --- python/trunk/Objects/bytes_methods.c (original) +++ python/trunk/Objects/bytes_methods.c Mon Jun 9 06:58:54 2008 @@ -462,11 +462,11 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -490,11 +490,11 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -520,10 +520,10 @@ int previous_is_cased = 0; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); @@ -553,10 +553,10 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); @@ -589,10 +589,10 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); Modified: python/trunk/Objects/bytesobject.c ============================================================================== --- python/trunk/Objects/bytesobject.c (original) +++ python/trunk/Objects/bytesobject.c Mon Jun 9 06:58:54 2008 @@ -87,13 +87,13 @@ /* share short strings */ if (size == 0) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1 && str != NULL) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); @@ -140,13 +140,13 @@ /* share short strings */ if (size == 0) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); @@ -5093,12 +5093,12 @@ } void -PyBytes_InternInPlace(PyObject **p) +PyString_InternInPlace(PyObject **p) { register PyBytesObject *s = (PyBytesObject *)(*p); PyObject *t; if (s == NULL || !PyBytes_Check(s)) - Py_FatalError("PyBytes_InternInPlace: strings only please!"); + Py_FatalError("PyString_InternInPlace: strings only please!"); /* If it's a string subclass, we don't really know what putting it in the interned dict might do. */ if (!PyBytes_CheckExact(s)) @@ -5131,9 +5131,9 @@ } void -PyBytes_InternImmortal(PyObject **p) +PyString_InternImmortal(PyObject **p) { - PyBytes_InternInPlace(p); + PyString_InternInPlace(p); if (PyBytes_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { PyBytes_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; Py_INCREF(*p); @@ -5142,17 +5142,17 @@ PyObject * -PyBytes_InternFromString(const char *cp) +PyString_InternFromString(const char *cp) { PyObject *s = PyBytes_FromString(cp); if (s == NULL) return NULL; - PyBytes_InternInPlace(&s); + PyString_InternInPlace(&s); return s; } void -PyBytes_Fini(void) +PyString_Fini(void) { int i; for (i = 0; i < UCHAR_MAX + 1; i++) { Modified: python/trunk/Objects/cellobject.c ============================================================================== --- python/trunk/Objects/cellobject.c (original) +++ python/trunk/Objects/cellobject.c Mon Jun 9 06:58:54 2008 @@ -73,9 +73,9 @@ cell_repr(PyCellObject *op) { if (op->ob_ref == NULL) - return PyBytes_FromFormat("", op); + return PyString_FromFormat("", op); - return PyBytes_FromFormat("", + return PyString_FromFormat("", op, op->ob_ref->ob_type->tp_name, op->ob_ref); } Modified: python/trunk/Objects/classobject.c ============================================================================== --- python/trunk/Objects/classobject.c (original) +++ python/trunk/Objects/classobject.c Mon Jun 9 06:58:54 2008 @@ -32,21 +32,21 @@ PyClassObject *op, *dummy; static PyObject *docstr, *modstr, *namestr; if (docstr == NULL) { - docstr= PyBytes_InternFromString("__doc__"); + docstr= PyString_InternFromString("__doc__"); if (docstr == NULL) return NULL; } if (modstr == NULL) { - modstr= PyBytes_InternFromString("__module__"); + modstr= PyString_InternFromString("__module__"); if (modstr == NULL) return NULL; } if (namestr == NULL) { - namestr= PyBytes_InternFromString("__name__"); + namestr= PyString_InternFromString("__name__"); if (namestr == NULL) return NULL; } - if (name == NULL || !PyBytes_Check(name)) { + if (name == NULL || !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "PyClass_New: name must be a string"); return NULL; @@ -101,13 +101,13 @@ } if (getattrstr == NULL) { - getattrstr = PyBytes_InternFromString("__getattr__"); + getattrstr = PyString_InternFromString("__getattr__"); if (getattrstr == NULL) goto alloc_error; - setattrstr = PyBytes_InternFromString("__setattr__"); + setattrstr = PyString_InternFromString("__setattr__"); if (setattrstr == NULL) goto alloc_error; - delattrstr = PyBytes_InternFromString("__delattr__"); + delattrstr = PyString_InternFromString("__delattr__"); if (delattrstr == NULL) goto alloc_error; } @@ -222,7 +222,7 @@ class_getattr(register PyClassObject *op, PyObject *name) { register PyObject *v; - register char *sname = PyBytes_AsString(name); + register char *sname = PyString_AsString(name); PyClassObject *klass; descrgetfunc f; @@ -253,7 +253,7 @@ if (v == NULL) { PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyBytes_AS_STRING(op->cl_name), sname); + PyString_AS_STRING(op->cl_name), sname); return NULL; } f = TP_DESCR_GET(v->ob_type); @@ -316,9 +316,9 @@ static char * set_name(PyClassObject *c, PyObject *v) { - if (v == NULL || !PyBytes_Check(v)) + if (v == NULL || !PyString_Check(v)) return "__name__ must be a string object"; - if (strlen(PyBytes_AS_STRING(v)) != (size_t)PyBytes_GET_SIZE(v)) + if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v)) return "__name__ must not contain null bytes"; set_slot(&c->cl_name, v); return ""; @@ -333,9 +333,9 @@ "classes are read-only in restricted mode"); return -1; } - sname = PyBytes_AsString(name); + sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyBytes_Size(name); + Py_ssize_t n = PyString_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { char *err = NULL; if (strcmp(sname, "__dict__") == 0) @@ -365,7 +365,7 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyBytes_AS_STRING(op->cl_name), sname); + PyString_AS_STRING(op->cl_name), sname); return rv; } else @@ -377,15 +377,15 @@ { PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); char *name; - if (op->cl_name == NULL || !PyBytes_Check(op->cl_name)) + if (op->cl_name == NULL || !PyString_Check(op->cl_name)) name = "?"; else - name = PyBytes_AsString(op->cl_name); - if (mod == NULL || !PyBytes_Check(mod)) - return PyBytes_FromFormat("", name, op); + name = PyString_AsString(op->cl_name); + if (mod == NULL || !PyString_Check(mod)) + return PyString_FromFormat("", name, op); else - return PyBytes_FromFormat("", - PyBytes_AsString(mod), + return PyString_FromFormat("", + PyString_AsString(mod), name, op); } @@ -397,21 +397,21 @@ PyObject *res; Py_ssize_t m, n; - if (name == NULL || !PyBytes_Check(name)) + if (name == NULL || !PyString_Check(name)) return class_repr(op); - if (mod == NULL || !PyBytes_Check(mod)) { + if (mod == NULL || !PyString_Check(mod)) { Py_INCREF(name); return name; } - m = PyBytes_GET_SIZE(mod); - n = PyBytes_GET_SIZE(name); - res = PyBytes_FromStringAndSize((char *)NULL, m+1+n); + m = PyString_GET_SIZE(mod); + n = PyString_GET_SIZE(name); + res = PyString_FromStringAndSize((char *)NULL, m+1+n); if (res != NULL) { - char *s = PyBytes_AS_STRING(res); - memcpy(s, PyBytes_AS_STRING(mod), m); + char *s = PyString_AS_STRING(res); + memcpy(s, PyString_AS_STRING(mod), m); s += m; *s++ = '.'; - memcpy(s, PyBytes_AS_STRING(name), n); + memcpy(s, PyString_AS_STRING(name), n); } return res; } @@ -541,7 +541,7 @@ static PyObject *initstr; if (initstr == NULL) { - initstr = PyBytes_InternFromString("__init__"); + initstr = PyString_InternFromString("__init__"); if (initstr == NULL) return NULL; } @@ -634,7 +634,7 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ if (delstr == NULL) { - delstr = PyBytes_InternFromString("__del__"); + delstr = PyString_InternFromString("__del__"); if (delstr == NULL) PyErr_WriteUnraisable((PyObject*)inst); } @@ -696,7 +696,7 @@ instance_getattr1(register PyInstanceObject *inst, PyObject *name) { register PyObject *v; - register char *sname = PyBytes_AsString(name); + register char *sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -716,7 +716,7 @@ if (v == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyBytes_AS_STRING(inst->in_class->cl_name), sname); + PyString_AS_STRING(inst->in_class->cl_name), sname); } return v; } @@ -779,7 +779,7 @@ assert(PyInstance_Check(pinst)); inst = (PyInstanceObject *)pinst; - assert(PyBytes_Check(name)); + assert(PyString_Check(name)); v = PyDict_GetItem(inst->in_dict, name); if (v == NULL) @@ -795,8 +795,8 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyBytes_AS_STRING(inst->in_class->cl_name), - PyBytes_AS_STRING(name)); + PyString_AS_STRING(inst->in_class->cl_name), + PyString_AS_STRING(name)); return rv; } else @@ -807,9 +807,9 @@ instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v) { PyObject *func, *args, *res, *tmp; - char *sname = PyBytes_AsString(name); + char *sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyBytes_Size(name); + Py_ssize_t n = PyString_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -875,7 +875,7 @@ static PyObject *reprstr; if (reprstr == NULL) { - reprstr = PyBytes_InternFromString("__repr__"); + reprstr = PyString_InternFromString("__repr__"); if (reprstr == NULL) return NULL; } @@ -889,16 +889,16 @@ classname = inst->in_class->cl_name; mod = PyDict_GetItemString(inst->in_class->cl_dict, "__module__"); - if (classname != NULL && PyBytes_Check(classname)) - cname = PyBytes_AsString(classname); + if (classname != NULL && PyString_Check(classname)) + cname = PyString_AsString(classname); else cname = "?"; - if (mod == NULL || !PyBytes_Check(mod)) - return PyBytes_FromFormat("", + if (mod == NULL || !PyString_Check(mod)) + return PyString_FromFormat("", cname, inst); else - return PyBytes_FromFormat("<%s.%s instance at %p>", - PyBytes_AsString(mod), + return PyString_FromFormat("<%s.%s instance at %p>", + PyString_AsString(mod), cname, inst); } res = PyEval_CallObject(func, (PyObject *)NULL); @@ -914,7 +914,7 @@ static PyObject *strstr; if (strstr == NULL) { - strstr = PyBytes_InternFromString("__str__"); + strstr = PyString_InternFromString("__str__"); if (strstr == NULL) return NULL; } @@ -939,7 +939,7 @@ static PyObject *hashstr, *eqstr, *cmpstr; if (hashstr == NULL) { - hashstr = PyBytes_InternFromString("__hash__"); + hashstr = PyString_InternFromString("__hash__"); if (hashstr == NULL) return -1; } @@ -952,7 +952,7 @@ address. If an __eq__ or __cmp__ method exists, there must be a __hash__. */ if (eqstr == NULL) { - eqstr = PyBytes_InternFromString("__eq__"); + eqstr = PyString_InternFromString("__eq__"); if (eqstr == NULL) return -1; } @@ -962,7 +962,7 @@ return -1; PyErr_Clear(); if (cmpstr == NULL) { - cmpstr = PyBytes_InternFromString("__cmp__"); + cmpstr = PyString_InternFromString("__cmp__"); if (cmpstr == NULL) return -1; } @@ -1014,7 +1014,7 @@ Py_ssize_t outcome; if (lenstr == NULL) { - lenstr = PyBytes_InternFromString("__len__"); + lenstr = PyString_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1063,7 +1063,7 @@ PyObject *res; if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1090,7 +1090,7 @@ if (value == NULL) { if (delitemstr == NULL) { - delitemstr = PyBytes_InternFromString("__delitem__"); + delitemstr = PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1098,7 +1098,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyBytes_InternFromString("__setitem__"); + setitemstr = PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1135,7 +1135,7 @@ PyObject *func, *res; if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1154,7 +1154,7 @@ static PyObject *getslicestr; if (getslicestr == NULL) { - getslicestr = PyBytes_InternFromString("__getslice__"); + getslicestr = PyString_InternFromString("__getslice__"); if (getslicestr == NULL) return NULL; } @@ -1166,7 +1166,7 @@ PyErr_Clear(); if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1194,7 +1194,7 @@ if (item == NULL) { if (delitemstr == NULL) { - delitemstr = PyBytes_InternFromString("__delitem__"); + delitemstr = PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1202,7 +1202,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyBytes_InternFromString("__setitem__"); + setitemstr = PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1236,7 +1236,7 @@ if (value == NULL) { if (delslicestr == NULL) { delslicestr = - PyBytes_InternFromString("__delslice__"); + PyString_InternFromString("__delslice__"); if (delslicestr == NULL) return -1; } @@ -1247,7 +1247,7 @@ PyErr_Clear(); if (delitemstr == NULL) { delitemstr = - PyBytes_InternFromString("__delitem__"); + PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1263,7 +1263,7 @@ else { if (setslicestr == NULL) { setslicestr = - PyBytes_InternFromString("__setslice__"); + PyString_InternFromString("__setslice__"); if (setslicestr == NULL) return -1; } @@ -1274,7 +1274,7 @@ PyErr_Clear(); if (setitemstr == NULL) { setitemstr = - PyBytes_InternFromString("__setitem__"); + PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1311,7 +1311,7 @@ */ if(__contains__ == NULL) { - __contains__ = PyBytes_InternFromString("__contains__"); + __contains__ = PyString_InternFromString("__contains__"); if(__contains__ == NULL) return -1; } @@ -1417,7 +1417,7 @@ } if (coerce_obj == NULL) { - coerce_obj = PyBytes_InternFromString("__coerce__"); + coerce_obj = PyString_InternFromString("__coerce__"); if (coerce_obj == NULL) return NULL; } @@ -1504,7 +1504,7 @@ PyObject *coerced; if (coerce_obj == NULL) { - coerce_obj = PyBytes_InternFromString("__coerce__"); + coerce_obj = PyString_InternFromString("__coerce__"); if (coerce_obj == NULL) return -1; } @@ -1552,7 +1552,7 @@ #define UNARY(funcname, methodname) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyBytes_InternFromString(methodname); \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ if (o == NULL) return NULL; } \ return generic_unary_op(self, o); \ } @@ -1561,7 +1561,7 @@ #define UNARY_FB(funcname, methodname, funcname_fb) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyBytes_InternFromString(methodname); \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ if (o == NULL) return NULL; } \ if (PyObject_HasAttr((PyObject*)self, o)) \ return generic_unary_op(self, o); \ @@ -1630,7 +1630,7 @@ assert(PyInstance_Check(v)); if (cmp_obj == NULL) { - cmp_obj = PyBytes_InternFromString("__cmp__"); + cmp_obj = PyString_InternFromString("__cmp__"); if (cmp_obj == NULL) return -2; } @@ -1738,7 +1738,7 @@ static PyObject *nonzerostr; if (nonzerostr == NULL) { - nonzerostr = PyBytes_InternFromString("__nonzero__"); + nonzerostr = PyString_InternFromString("__nonzero__"); if (nonzerostr == NULL) return -1; } @@ -1747,7 +1747,7 @@ return -1; PyErr_Clear(); if (lenstr == NULL) { - lenstr = PyBytes_InternFromString("__len__"); + lenstr = PyString_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1787,7 +1787,7 @@ static PyObject *indexstr = NULL; if (indexstr == NULL) { - indexstr = PyBytes_InternFromString("__index__"); + indexstr = PyString_InternFromString("__index__"); if (indexstr == NULL) return NULL; } @@ -1814,7 +1814,7 @@ PyObject *truncated; static PyObject *int_name; if (int_name == NULL) { - int_name = PyBytes_InternFromString("__int__"); + int_name = PyString_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1929,7 +1929,7 @@ if (name_op == NULL) return -1; for (i = 0; i < NAME_OPS; ++i) { - name_op[i] = PyBytes_InternFromString(_name_op[i]); + name_op[i] = PyString_InternFromString(_name_op[i]); if (name_op[i] == NULL) return -1; } @@ -2012,12 +2012,12 @@ PyObject *func; if (iterstr == NULL) { - iterstr = PyBytes_InternFromString("__iter__"); + iterstr = PyString_InternFromString("__iter__"); if (iterstr == NULL) return NULL; } if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -2055,7 +2055,7 @@ PyObject *func; if (nextstr == NULL) { - nextstr = PyBytes_InternFromString("next"); + nextstr = PyString_InternFromString("next"); if (nextstr == NULL) return NULL; } @@ -2087,7 +2087,7 @@ PyErr_Clear(); PyErr_Format(PyExc_AttributeError, "%.200s instance has no __call__ method", - PyBytes_AsString(inst->in_class->cl_name)); + PyString_AsString(inst->in_class->cl_name)); return NULL; } /* We must check and increment the recursion depth here. Scenario: @@ -2261,7 +2261,7 @@ { static PyObject *docstr; if (docstr == NULL) { - docstr= PyBytes_InternFromString("__doc__"); + docstr= PyString_InternFromString("__doc__"); if (docstr == NULL) return NULL; } @@ -2384,12 +2384,12 @@ return NULL; PyErr_Clear(); } - else if (!PyBytes_Check(funcname)) { + else if (!PyString_Check(funcname)) { Py_DECREF(funcname); funcname = NULL; } else - sfuncname = PyBytes_AS_STRING(funcname); + sfuncname = PyString_AS_STRING(funcname); if (klass == NULL) klassname = NULL; else { @@ -2399,28 +2399,28 @@ return NULL; PyErr_Clear(); } - else if (!PyBytes_Check(klassname)) { + else if (!PyString_Check(klassname)) { Py_DECREF(klassname); klassname = NULL; } else - sklassname = PyBytes_AS_STRING(klassname); + sklassname = PyString_AS_STRING(klassname); } if (self == NULL) - result = PyBytes_FromFormat("", + result = PyString_FromFormat("", sklassname, sfuncname); else { /* XXX Shouldn't use repr() here! */ PyObject *selfrepr = PyObject_Repr(self); if (selfrepr == NULL) goto fail; - if (!PyBytes_Check(selfrepr)) { + if (!PyString_Check(selfrepr)) { Py_DECREF(selfrepr); goto fail; } - result = PyBytes_FromFormat("", + result = PyString_FromFormat("", sklassname, sfuncname, - PyBytes_AS_STRING(selfrepr)); + PyString_AS_STRING(selfrepr)); Py_DECREF(selfrepr); } fail: @@ -2472,8 +2472,8 @@ PyErr_Clear(); return; } - if (PyBytes_Check(name)) { - strncpy(buf, PyBytes_AS_STRING(name), bufsize); + if (PyString_Check(name)) { + strncpy(buf, PyString_AS_STRING(name), bufsize); buf[bufsize-1] = '\0'; } Py_DECREF(name); Modified: python/trunk/Objects/codeobject.c ============================================================================== --- python/trunk/Objects/codeobject.c (original) +++ python/trunk/Objects/codeobject.c Mon Jun 9 06:58:54 2008 @@ -32,10 +32,10 @@ for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); - if (v == NULL || !PyBytes_CheckExact(v)) { + if (v == NULL || !PyString_CheckExact(v)) { Py_FatalError("non-string found in code slot"); } - PyBytes_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); + PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); } } @@ -57,9 +57,9 @@ varnames == NULL || !PyTuple_Check(varnames) || freevars == NULL || !PyTuple_Check(freevars) || cellvars == NULL || !PyTuple_Check(cellvars) || - name == NULL || !PyBytes_Check(name) || - filename == NULL || !PyBytes_Check(filename) || - lnotab == NULL || !PyBytes_Check(lnotab) || + name == NULL || !PyString_Check(name) || + filename == NULL || !PyString_Check(filename) || + lnotab == NULL || !PyString_Check(lnotab) || !PyObject_CheckReadBuffer(code)) { PyErr_BadInternalCall(); return NULL; @@ -71,11 +71,11 @@ /* Intern selected string constants */ for (i = PyTuple_Size(consts); --i >= 0; ) { PyObject *v = PyTuple_GetItem(consts, i); - if (!PyBytes_Check(v)) + if (!PyString_Check(v)) continue; - if (!all_name_chars((unsigned char *)PyBytes_AS_STRING(v))) + if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) continue; - PyBytes_InternInPlace(&PyTuple_GET_ITEM(consts, i)); + PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); } co = PyObject_NEW(PyCodeObject, &PyCode_Type); if (co != NULL) { @@ -145,10 +145,10 @@ for (i = 0; i < len; i++) { item = PyTuple_GET_ITEM(tup, i); - if (PyBytes_CheckExact(item)) { + if (PyString_CheckExact(item)) { Py_INCREF(item); } - else if (!PyBytes_Check(item)) { + else if (!PyString_Check(item)) { PyErr_Format( PyExc_TypeError, "name tuples must contain only " @@ -158,9 +158,9 @@ return NULL; } else { - item = PyBytes_FromStringAndSize( - PyBytes_AS_STRING(item), - PyBytes_GET_SIZE(item)); + item = PyString_FromStringAndSize( + PyString_AS_STRING(item), + PyString_GET_SIZE(item)); if (item == NULL) { Py_DECREF(newtuple); return NULL; @@ -281,14 +281,14 @@ if (co->co_firstlineno != 0) lineno = co->co_firstlineno; - if (co->co_filename && PyBytes_Check(co->co_filename)) - filename = PyBytes_AS_STRING(co->co_filename); - if (co->co_name && PyBytes_Check(co->co_name)) - name = PyBytes_AS_STRING(co->co_name); + if (co->co_filename && PyString_Check(co->co_filename)) + filename = PyString_AS_STRING(co->co_filename); + if (co->co_name && PyString_Check(co->co_name)) + name = PyString_AS_STRING(co->co_name); PyOS_snprintf(buf, sizeof(buf), "", name, co, filename, lineno); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int @@ -508,8 +508,8 @@ int PyCode_Addr2Line(PyCodeObject *co, int addrq) { - int size = PyBytes_Size(co->co_lnotab) / 2; - unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab); + int size = PyString_Size(co->co_lnotab) / 2; + unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); int line = co->co_firstlineno; int addr = 0; while (--size >= 0) { @@ -604,8 +604,8 @@ int size, addr, line; unsigned char* p; - p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab); - size = PyBytes_GET_SIZE(co->co_lnotab) / 2; + p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); + size = PyString_GET_SIZE(co->co_lnotab) / 2; addr = 0; line = co->co_firstlineno; Modified: python/trunk/Objects/complexobject.c ============================================================================== --- python/trunk/Objects/complexobject.c (original) +++ python/trunk/Objects/complexobject.c Mon Jun 9 06:58:54 2008 @@ -303,7 +303,7 @@ cv.imag = 0.; if (complex_str == NULL) { - if (!(complex_str = PyBytes_InternFromString("__complex__"))) + if (!(complex_str = PyString_InternFromString("__complex__"))) return cv; } @@ -421,7 +421,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_REPR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -429,7 +429,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_STR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static long @@ -877,9 +877,9 @@ #endif Py_ssize_t len; - if (PyBytes_Check(v)) { - s = PyBytes_AS_STRING(v); - len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + s = PyString_AS_STRING(v); + len = PyString_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -1065,7 +1065,7 @@ Py_INCREF(r); return r; } - if (PyBytes_Check(r) || PyUnicode_Check(r)) { + if (PyString_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -1074,7 +1074,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL; @@ -1082,7 +1082,7 @@ /* XXX Hack to support classes with __complex__ method */ if (complexstr == NULL) { - complexstr = PyBytes_InternFromString("__complex__"); + complexstr = PyString_InternFromString("__complex__"); if (complexstr == NULL) return NULL; } Modified: python/trunk/Objects/descrobject.c ============================================================================== --- python/trunk/Objects/descrobject.c (original) +++ python/trunk/Objects/descrobject.c Mon Jun 9 06:58:54 2008 @@ -15,8 +15,8 @@ static char * descr_name(PyDescrObject *descr) { - if (descr->d_name != NULL && PyBytes_Check(descr->d_name)) - return PyBytes_AS_STRING(descr->d_name); + if (descr->d_name != NULL && PyString_Check(descr->d_name)) + return PyString_AS_STRING(descr->d_name); else return "?"; } @@ -24,7 +24,7 @@ static PyObject * descr_repr(PyDescrObject *descr, char *format) { - return PyBytes_FromFormat(format, descr_name(descr), + return PyString_FromFormat(format, descr_name(descr), descr->d_type->tp_name); } @@ -314,7 +314,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_method->ml_doc); + return PyString_FromString(descr->d_method->ml_doc); } static PyMemberDef descr_members[] = { @@ -335,7 +335,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_member->doc); + return PyString_FromString(descr->d_member->doc); } static PyGetSetDef member_getset[] = { @@ -350,7 +350,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_getset->doc); + return PyString_FromString(descr->d_getset->doc); } static PyGetSetDef getset_getset[] = { @@ -365,7 +365,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_base->doc); + return PyString_FromString(descr->d_base->doc); } static PyGetSetDef wrapperdescr_getset[] = { @@ -576,7 +576,7 @@ if (descr != NULL) { Py_XINCREF(type); descr->d_type = type; - descr->d_name = PyBytes_InternFromString(name); + descr->d_name = PyString_InternFromString(name); if (descr->d_name == NULL) { Py_DECREF(descr); descr = NULL; @@ -922,7 +922,7 @@ static PyObject * wrapper_repr(wrapperobject *wp) { - return PyBytes_FromFormat("", + return PyString_FromFormat("", wp->descr->d_base->name, wp->self->ob_type->tp_name, wp->self); @@ -947,7 +947,7 @@ { char *s = wp->descr->d_base->name; - return PyBytes_FromString(s); + return PyString_FromString(s); } static PyObject * @@ -960,7 +960,7 @@ return Py_None; } else { - return PyBytes_FromString(s); + return PyString_FromString(s); } } Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Mon Jun 9 06:58:54 2008 @@ -224,7 +224,7 @@ { register PyDictObject *mp; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyBytes_FromString(""); + dummy = PyString_FromString(""); if (dummy == NULL) return NULL; #ifdef SHOW_CONVERSION_COUNTS @@ -373,7 +373,7 @@ * this assumption allows testing for errors during PyObject_RichCompareBool() * to be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_RichCompareBool(); we can always - * use _PyBytes_Eq() directly. + * use _PyString_Eq() directly. * * This is valuable because dicts with only string keys are very common. */ @@ -391,7 +391,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyBytes_CheckExact(key)) { + if (!PyString_CheckExact(key)) { #ifdef SHOW_CONVERSION_COUNTS ++converted; #endif @@ -405,7 +405,7 @@ if (ep->me_key == dummy) freeslot = ep; else { - if (ep->me_hash == hash && _PyBytes_Eq(ep->me_key, key)) + if (ep->me_hash == hash && _PyString_Eq(ep->me_key, key)) return ep; freeslot = NULL; } @@ -420,7 +420,7 @@ if (ep->me_key == key || (ep->me_hash == hash && ep->me_key != dummy - && _PyBytes_Eq(ep->me_key, key))) + && _PyString_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; @@ -626,8 +626,8 @@ PyThreadState *tstate; if (!PyDict_Check(op)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) { @@ -680,8 +680,8 @@ assert(key); assert(value); mp = (PyDictObject *)op; - if (PyBytes_CheckExact(key)) { - hash = ((PyBytesObject *)key)->ob_shash; + if (PyString_CheckExact(key)) { + hash = ((PyStringObject *)key)->ob_shash; if (hash == -1) hash = PyObject_Hash(key); } @@ -728,8 +728,8 @@ return -1; } assert(key); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -982,11 +982,11 @@ i = Py_ReprEnter((PyObject *)mp); if (i != 0) { - return i > 0 ? PyBytes_FromString("{...}") : NULL; + return i > 0 ? PyString_FromString("{...}") : NULL; } if (mp->ma_used == 0) { - result = PyBytes_FromString("{}"); + result = PyString_FromString("{}"); goto Done; } @@ -994,7 +994,7 @@ if (pieces == NULL) goto Done; - colon = PyBytes_FromString(": "); + colon = PyString_FromString(": "); if (colon == NULL) goto Done; @@ -1006,8 +1006,8 @@ /* Prevent repr from deleting value during key format. */ Py_INCREF(value); s = PyObject_Repr(key); - PyBytes_Concat(&s, colon); - PyBytes_ConcatAndDel(&s, PyObject_Repr(value)); + PyString_Concat(&s, colon); + PyString_ConcatAndDel(&s, PyObject_Repr(value)); Py_DECREF(value); if (s == NULL) goto Done; @@ -1019,29 +1019,29 @@ /* Add "{}" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyBytes_FromString("{"); + s = PyString_FromString("{"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString("}"); + s = PyString_FromString("}"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: @@ -1064,8 +1064,8 @@ long hash; PyDictEntry *ep; assert(mp->ma_table != NULL); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1081,7 +1081,7 @@ static PyObject *missing_str = NULL; if (missing_str == NULL) missing_str = - PyBytes_InternFromString("__missing__"); + PyString_InternFromString("__missing__"); missing = _PyType_Lookup(Py_TYPE(mp), missing_str); if (missing != NULL) return PyObject_CallFunctionObjArgs(missing, @@ -1794,8 +1794,8 @@ long hash; PyDictEntry *ep; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1827,8 +1827,8 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1856,8 +1856,8 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1902,8 +1902,8 @@ "pop(): dictionary is empty"); return NULL; } - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -2148,8 +2148,8 @@ PyDictObject *mp = (PyDictObject *)op; PyDictEntry *ep; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -2275,7 +2275,7 @@ PyDict_GetItemString(PyObject *v, const char *key) { PyObject *kv, *rv; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return NULL; rv = PyDict_GetItem(v, kv); @@ -2288,10 +2288,10 @@ { PyObject *kv; int err; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return -1; - PyBytes_InternInPlace(&kv); /* XXX Should we really? */ + PyString_InternInPlace(&kv); /* XXX Should we really? */ err = PyDict_SetItem(v, kv, item); Py_DECREF(kv); return err; @@ -2302,7 +2302,7 @@ { PyObject *kv; int err; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return -1; err = PyDict_DelItem(v, kv); Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Mon Jun 9 06:58:54 2008 @@ -44,7 +44,7 @@ return NULL; } - self->message = PyBytes_FromString(""); + self->message = PyString_FromString(""); if (!self->message) { Py_DECREF(self); return NULL; @@ -104,7 +104,7 @@ switch (PyTuple_GET_SIZE(self->args)) { case 0: - out = PyBytes_FromString(""); + out = PyString_FromString(""); break; case 1: out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0)); @@ -133,13 +133,13 @@ dot = strrchr(name, '.'); if (dot != NULL) name = dot+1; - repr = PyBytes_FromString(name); + repr = PyString_FromString(name); if (!repr) { Py_DECREF(repr_suffix); return NULL; } - PyBytes_ConcatAndDel(&repr, repr_suffix); + PyString_ConcatAndDel(&repr, repr_suffix); return repr; } @@ -610,7 +610,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyBytes_FromString("[Errno %s] %s: %s"); + fmt = PyString_FromString("[Errno %s] %s: %s"); if (!fmt) return NULL; @@ -645,7 +645,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -654,7 +654,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyBytes_FromString("[Errno %s] %s"); + fmt = PyString_FromString("[Errno %s] %s"); if (!fmt) return NULL; @@ -681,7 +681,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -841,7 +841,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyBytes_FromString("[Error %s] %s: %s"); + fmt = PyString_FromString("[Error %s] %s: %s"); if (!fmt) return NULL; @@ -876,7 +876,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -885,7 +885,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyBytes_FromString("[Error %s] %s"); + fmt = PyString_FromString("[Error %s] %s"); if (!fmt) return NULL; @@ -912,7 +912,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -1109,21 +1109,21 @@ str = PyObject_Str(Py_None); if (!str) return NULL; /* Don't fiddle with non-string return (shouldn't happen anyway) */ - if (!PyBytes_Check(str)) return str; + if (!PyString_Check(str)) return str; /* XXX -- do all the additional formatting with filename and lineno here */ have_filename = (self->filename != NULL) && - PyBytes_Check(self->filename); + PyString_Check(self->filename); have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); if (!have_filename && !have_lineno) return str; - bufsize = PyBytes_GET_SIZE(str) + 64; + bufsize = PyString_GET_SIZE(str) + 64; if (have_filename) - bufsize += PyBytes_GET_SIZE(self->filename); + bufsize += PyString_GET_SIZE(self->filename); buffer = PyMem_MALLOC(bufsize); if (buffer == NULL) @@ -1131,19 +1131,19 @@ if (have_filename && have_lineno) PyOS_snprintf(buffer, bufsize, "%s (%s, line %ld)", - PyBytes_AS_STRING(str), - my_basename(PyBytes_AS_STRING(self->filename)), + PyString_AS_STRING(str), + my_basename(PyString_AS_STRING(self->filename)), PyInt_AsLong(self->lineno)); else if (have_filename) PyOS_snprintf(buffer, bufsize, "%s (%s)", - PyBytes_AS_STRING(str), - my_basename(PyBytes_AS_STRING(self->filename))); + PyString_AS_STRING(str), + my_basename(PyString_AS_STRING(self->filename))); else /* only have_lineno */ PyOS_snprintf(buffer, bufsize, "%s (line %ld)", - PyBytes_AS_STRING(str), + PyString_AS_STRING(str), PyInt_AsLong(self->lineno)); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); PyMem_FREE(buffer); if (result == NULL) @@ -1250,7 +1250,7 @@ return NULL; } - if (!PyBytes_Check(attr)) { + if (!PyString_Check(attr)) { PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); return NULL; } @@ -1262,7 +1262,7 @@ static int set_string(PyObject **attr, const char *value) { - PyObject *obj = PyBytes_FromString(value); + PyObject *obj = PyString_FromString(value); if (!obj) return -1; Py_CLEAR(*attr); @@ -1345,7 +1345,7 @@ "object"); if (!obj) return -1; - size = PyBytes_GET_SIZE(obj); + size = PyString_GET_SIZE(obj); *start = ((PyUnicodeErrorObject *)exc)->start; if (*start<0) *start = 0; @@ -1415,7 +1415,7 @@ if (!obj) return -1; *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyBytes_GET_SIZE(obj); + size = PyString_GET_SIZE(obj); if (*end<1) *end = 1; if (*end>size) @@ -1506,11 +1506,11 @@ Py_CLEAR(self->reason); if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyBytes_Type, &self->encoding, + &PyString_Type, &self->encoding, objecttype, &self->object, &self->start, &self->end, - &PyBytes_Type, &self->reason)) { + &PyString_Type, &self->reason)) { self->encoding = self->object = self->reason = NULL; return -1; } @@ -1590,20 +1590,20 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't encode character u'\\%s' in position %zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), badchar_str, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't encode characters in position %zd-%zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -1642,7 +1642,7 @@ if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) return -1; return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyBytes_Type); + kwds, &PyString_Type); } static PyObject * @@ -1654,21 +1654,21 @@ /* FromFormat does not support %02x, so format that separately */ char byte[4]; PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyBytes_AS_STRING(uself->object)[uself->start])&0xff); - return PyBytes_FromFormat( + ((int)PyString_AS_STRING(uself->object)[uself->start])&0xff); + return PyString_FromFormat( "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), byte, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't decode bytes in position %zd-%zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -1718,7 +1718,7 @@ &PyUnicode_Type, &self->object, &self->start, &self->end, - &PyBytes_Type, &self->reason)) { + &PyString_Type, &self->reason)) { self->object = self->reason = NULL; return -1; } @@ -1744,18 +1744,18 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyBytes_FromFormat( + return PyString_FromFormat( "can't translate character u'\\%s' in position %zd: %.400s", badchar_str, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "can't translate characters in position %zd-%zd: %.400s", uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -2111,7 +2111,7 @@ (PyBaseExceptionObject *)PyExc_RecursionErrorInst; PyObject *args_tuple; PyObject *exc_message; - exc_message = PyBytes_FromString("maximum recursion depth exceeded"); + exc_message = PyString_FromString("maximum recursion depth exceeded"); if (!exc_message) Py_FatalError("cannot allocate argument for RuntimeError " "pre-allocation"); Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Mon Jun 9 06:58:54 2008 @@ -26,7 +26,7 @@ #include #endif -#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) +#define BUF(v) PyString_AS_STRING((PyStringObject *)v) #ifndef DONT_HAVE_ERRNO_H #include @@ -160,7 +160,7 @@ Py_INCREF(name); f->f_name = name; - f->f_mode = PyBytes_FromString(mode); + f->f_mode = PyString_FromString(mode); f->f_close = close; f->f_softspace = 0; @@ -370,7 +370,7 @@ PyFileObject *f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); if (f != NULL) { - PyObject *o_name = PyBytes_FromString(name); + PyObject *o_name = PyString_FromString(name); if (o_name == NULL) return NULL; if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { @@ -525,20 +525,20 @@ #ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); - const char *name_str = name ? PyBytes_AsString(name) : "?"; - ret = PyBytes_FromFormat("<%s file u'%s', mode '%s' at %p>", + const char *name_str = name ? PyString_AsString(name) : "?"; + ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", name_str, - PyBytes_AsString(f->f_mode), + PyString_AsString(f->f_mode), f); Py_XDECREF(name); return ret; #endif } else { - return PyBytes_FromFormat("<%s file '%s', mode '%s' at %p>", + return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", - PyBytes_AsString(f->f_name), - PyBytes_AsString(f->f_mode), + PyString_AsString(f->f_name), + PyString_AsString(f->f_mode), f); } } @@ -958,7 +958,7 @@ "requested number of bytes is more than a Python string can hold"); return NULL; } - v = PyBytes_FromStringAndSize((char *)NULL, buffersize); + v = PyString_FromStringAndSize((char *)NULL, buffersize); if (v == NULL) return NULL; bytesread = 0; @@ -989,7 +989,7 @@ } if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); - if (_PyBytes_Resize(&v, buffersize) < 0) + if (_PyString_Resize(&v, buffersize) < 0) return NULL; } else { /* Got what was requested. */ @@ -997,7 +997,7 @@ } } if (bytesread != buffersize) - _PyBytes_Resize(&v, bytesread); + _PyString_Resize(&v, bytesread); return v; } @@ -1115,7 +1115,7 @@ size_t increment; /* amount to increment the buffer */ size_t prev_v_size; - /* Optimize for normal case: avoid _PyBytes_Resize if at all + /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". */ total_v_size = INITBUFSIZE; /* start small and pray */ @@ -1133,7 +1133,7 @@ clearerr(fp); if (PyErr_CheckSignals()) return NULL; - v = PyBytes_FromStringAndSize(buf, pvfree - buf); + v = PyString_FromStringAndSize(buf, pvfree - buf); return v; } /* fgets read *something* */ @@ -1162,7 +1162,7 @@ assert(p > pvfree && *(p-1) == '\0'); --p; /* don't include \0 from fgets */ } - v = PyBytes_FromStringAndSize(buf, p - buf); + v = PyString_FromStringAndSize(buf, p - buf); return v; } /* yuck: fgets overwrote all the newlines, i.e. the entire @@ -1183,7 +1183,7 @@ * into its buffer. */ total_v_size = MAXBUFSIZE << 1; - v = PyBytes_FromStringAndSize((char*)NULL, (int)total_v_size); + v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size); if (v == NULL) return v; /* copy over everything except the last null byte */ @@ -1238,13 +1238,13 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, (int)total_v_size) < 0) + if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) - _PyBytes_Resize(&v, p - BUF(v)); + _PyString_Resize(&v, p - BUF(v)); return v; #undef INITBUFSIZE #undef MAXBUFSIZE @@ -1276,7 +1276,7 @@ return getline_via_fgets(f, fp); #endif total_v_size = n > 0 ? n : 100; - v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); + v = PyString_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; buf = BUF(v); @@ -1349,7 +1349,7 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, total_v_size) < 0) + if (_PyString_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -1357,7 +1357,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyBytes_Resize(&v, used_v_size); + _PyString_Resize(&v, used_v_size); return v; } @@ -1402,7 +1402,7 @@ result = PyEval_CallObject(reader, args); Py_DECREF(reader); Py_DECREF(args); - if (result != NULL && !PyBytes_Check(result) && + if (result != NULL && !PyString_Check(result) && !PyUnicode_Check(result)) { Py_DECREF(result); result = NULL; @@ -1411,9 +1411,9 @@ } } - if (n < 0 && result != NULL && PyBytes_Check(result)) { - char *s = PyBytes_AS_STRING(result); - Py_ssize_t len = PyBytes_GET_SIZE(result); + if (n < 0 && result != NULL && PyString_Check(result)) { + char *s = PyString_AS_STRING(result); + Py_ssize_t len = PyString_GET_SIZE(result); if (len == 0) { Py_DECREF(result); result = NULL; @@ -1422,10 +1422,10 @@ } else if (s[len-1] == '\n') { if (result->ob_refcnt == 1) - _PyBytes_Resize(&result, len-1); + _PyString_Resize(&result, len-1); else { PyObject *v; - v = PyBytes_FromStringAndSize(s, len-1); + v = PyString_FromStringAndSize(s, len-1); Py_DECREF(result); result = v; } @@ -1473,7 +1473,7 @@ if (!PyArg_ParseTuple(args, "|i:readline", &n)) return NULL; if (n == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (n < 0) n = 0; return get_line(f, n); @@ -1539,18 +1539,18 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyBytes_FromStringAndSize( + big_buffer = PyString_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - if ( _PyBytes_Resize(&big_buffer, buffersize) < 0 ) + if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); } continue; } @@ -1559,7 +1559,7 @@ do { /* Process complete lines */ p++; - line = PyBytes_FromStringAndSize(q, p-q); + line = PyString_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -1578,7 +1578,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyBytes_FromStringAndSize(buffer, nfilled); + line = PyString_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -1588,7 +1588,7 @@ Py_DECREF(line); goto error; } - PyBytes_Concat(&line, rest); + PyString_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -1695,7 +1695,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { const char *buffer; if (((f->f_binary && PyObject_AsReadBuffer(v, @@ -1708,7 +1708,7 @@ "writelines() argument must be a sequence of strings"); goto error; } - line = PyBytes_FromStringAndSize(buffer, + line = PyString_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -1724,8 +1724,8 @@ errno = 0; for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyBytes_GET_SIZE(line); - nwritten = fwrite(PyBytes_AS_STRING(line), + len = PyString_GET_SIZE(line); + nwritten = fwrite(PyString_AS_STRING(line), 1, len, f->f_fp); if (nwritten != len) { FILE_ABORT_ALLOW_THREADS(f) @@ -1921,13 +1921,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyBytes_FromString("\r"); + return PyString_FromString("\r"); case NEWLINE_LF: - return PyBytes_FromString("\n"); + return PyString_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyBytes_FromString("\r\n"); + return PyString_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -2029,10 +2029,10 @@ horrified by the recursive call: maximum recursion depth is limited by logarithmic buffer growth to about 50 even when reading a 1gb line. */ -static PyBytesObject * +static PyStringObject * readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { - PyBytesObject* s; + PyStringObject* s; char *bufptr; char *buf; Py_ssize_t len; @@ -2043,17 +2043,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip); + return (PyStringObject *) + PyString_FromStringAndSize(NULL, skip); bufptr = (char *)memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip+len); + s = (PyStringObject *) + PyString_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) drop_readahead(f); @@ -2068,7 +2068,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -2080,13 +2080,13 @@ static PyObject * file_iternext(PyFileObject *f) { - PyBytesObject* l; + PyStringObject* l; if (f->f_fp == NULL) return err_closed(); l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); - if (l == NULL || PyBytes_GET_SIZE(l) == 0) { + if (l == NULL || PyString_GET_SIZE(l) == 0) { Py_XDECREF(l); return NULL; } @@ -2103,7 +2103,7 @@ assert(type != NULL && type->tp_alloc != NULL); if (not_yet_string == NULL) { - not_yet_string = PyBytes_InternFromString(""); + not_yet_string = PyString_InternFromString(""); if (not_yet_string == NULL) return NULL; } @@ -2394,7 +2394,7 @@ return 0; } else if (!PyErr_Occurred()) { - PyObject *v = PyBytes_FromString(s); + PyObject *v = PyString_FromString(s); int err; if (v == NULL) return -1; Modified: python/trunk/Objects/floatobject.c ============================================================================== --- python/trunk/Objects/floatobject.c (original) +++ python/trunk/Objects/floatobject.c Mon Jun 9 06:58:54 2008 @@ -182,9 +182,9 @@ if (pend) *pend = NULL; - if (PyBytes_Check(v)) { - s = PyBytes_AS_STRING(v); - len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + s = PyString_AS_STRING(v); + len = PyString_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -485,7 +485,7 @@ char buf[100]; format_float(buf, sizeof(buf), v, PREC_REPR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -493,7 +493,7 @@ { char buf[100]; format_float(buf, sizeof(buf), v, PREC_STR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } /* Comparison is pretty much a nightmare. When comparing float to float, @@ -1218,7 +1218,7 @@ return float_subtype_new(type, args, kwds); /* Wimp out */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x)) return NULL; - if (PyBytes_Check(x)) + if (PyString_Check(x)) return PyFloat_FromString(x, NULL); return PyNumber_Float(x); } @@ -1269,13 +1269,13 @@ char* s; float_format_type r; - if (!PyBytes_Check(arg)) { + if (!PyString_Check(arg)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", Py_TYPE(arg)->tp_name); return NULL; } - s = PyBytes_AS_STRING(arg); + s = PyString_AS_STRING(arg); if (strcmp(s, "double") == 0) { r = double_format; } @@ -1291,11 +1291,11 @@ switch (r) { case unknown_format: - return PyBytes_FromString("unknown"); + return PyString_FromString("unknown"); case ieee_little_endian_format: - return PyBytes_FromString("IEEE, little-endian"); + return PyString_FromString("IEEE, little-endian"); case ieee_big_endian_format: - return PyBytes_FromString("IEEE, big-endian"); + return PyString_FromString("IEEE, big-endian"); default: Py_FatalError("insane float_format or double_format"); return NULL; Modified: python/trunk/Objects/frameobject.c ============================================================================== --- python/trunk/Objects/frameobject.c (original) +++ python/trunk/Objects/frameobject.c Mon Jun 9 06:58:54 2008 @@ -114,7 +114,7 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; @@ -137,7 +137,7 @@ } /* We're now ready to look at the bytecode. */ - PyBytes_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); + PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); min_addr = MIN(new_lasti, f->f_lasti); max_addr = MAX(new_lasti, f->f_lasti); @@ -548,7 +548,7 @@ int _PyFrame_Init() { - builtin_object = PyBytes_InternFromString("__builtins__"); + builtin_object = PyString_InternFromString("__builtins__"); return (builtin_object != NULL); } @@ -728,7 +728,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; - assert(PyBytes_Check(key)); + assert(PyString_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); @@ -776,7 +776,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = PyObject_GetItem(dict, key); - assert(PyBytes_Check(key)); + assert(PyString_Check(key)); /* We only care about NULLs if clear is true. */ if (value == NULL) { PyErr_Clear(); Modified: python/trunk/Objects/funcobject.c ============================================================================== --- python/trunk/Objects/funcobject.c (original) +++ python/trunk/Objects/funcobject.c Mon Jun 9 06:58:54 2008 @@ -28,7 +28,7 @@ consts = ((PyCodeObject *)code)->co_consts; if (PyTuple_Size(consts) >= 1) { doc = PyTuple_GetItem(consts, 0); - if (!PyBytes_Check(doc) && !PyUnicode_Check(doc)) + if (!PyString_Check(doc) && !PyUnicode_Check(doc)) doc = Py_None; } else @@ -42,7 +42,7 @@ Otherwise, use None. */ if (!__name__) { - __name__ = PyBytes_InternFromString("__name__"); + __name__ = PyString_InternFromString("__name__"); if (!__name__) { Py_DECREF(op); return NULL; @@ -254,7 +254,7 @@ PyErr_Format(PyExc_ValueError, "%s() requires a code object with %zd free vars," " not %zd", - PyBytes_AsString(op->func_name), + PyString_AsString(op->func_name), nclosure, nfree); return -1; } @@ -281,7 +281,7 @@ return -1; /* Not legal to del f.func_name or to set it to anything * other than a string object. */ - if (value == NULL || !PyBytes_Check(value)) { + if (value == NULL || !PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -380,7 +380,7 @@ &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; - if (name != Py_None && !PyBytes_Check(name)) { + if (name != Py_None && !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); return NULL; @@ -409,7 +409,7 @@ if (nfree != nclosure) return PyErr_Format(PyExc_ValueError, "%s requires closure of length %zd, not %zd", - PyBytes_AS_STRING(code->co_name), + PyString_AS_STRING(code->co_name), nfree, nclosure); if (nclosure) { Py_ssize_t i; @@ -465,8 +465,8 @@ static PyObject* func_repr(PyFunctionObject *op) { - return PyBytes_FromFormat("", - PyBytes_AsString(op->func_name), + return PyString_FromFormat("", + PyString_AsString(op->func_name), op); } Modified: python/trunk/Objects/genobject.c ============================================================================== --- python/trunk/Objects/genobject.c (original) +++ python/trunk/Objects/genobject.c Mon Jun 9 06:58:54 2008 @@ -285,10 +285,10 @@ gen_repr(PyGenObject *gen) { char *code_name; - code_name = PyBytes_AsString(((PyCodeObject *)gen->gi_code)->co_name); + code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name); if (code_name == NULL) return NULL; - return PyBytes_FromFormat("", + return PyString_FromFormat("", code_name, gen); } Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Mon Jun 9 06:58:54 2008 @@ -367,7 +367,7 @@ if (*end != '\0') { bad: slen = strlen(s) < 200 ? strlen(s) : 200; - sobj = PyBytes_FromStringAndSize(s, slen); + sobj = PyString_FromStringAndSize(s, slen); if (sobj == NULL) return NULL; srepr = PyObject_Repr(sobj); @@ -376,7 +376,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -964,11 +964,11 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyBytes_Check(x)) { + if (PyString_Check(x)) { /* Since PyInt_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyBytes_AS_STRING(x); - if (strlen(string) != PyBytes_Size(x)) { + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { /* create a repr() of the input string, * just like PyInt_FromString does */ PyObject *srepr; @@ -977,7 +977,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -1105,7 +1105,7 @@ if (negative) *--p = '-'; - return PyBytes_FromStringAndSize(p, &buf[sizeof(buf)] - p); + return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p); } static PyObject * Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Mon Jun 9 06:58:54 2008 @@ -174,7 +174,7 @@ } if (i < 0 || i >= Py_SIZE(op)) { if (indexerr == NULL) - indexerr = PyBytes_FromString( + indexerr = PyString_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; @@ -349,11 +349,11 @@ i = Py_ReprEnter((PyObject*)v); if (i != 0) { - return i > 0 ? PyBytes_FromString("[...]") : NULL; + return i > 0 ? PyString_FromString("[...]") : NULL; } if (Py_SIZE(v) == 0) { - result = PyBytes_FromString("[]"); + result = PyString_FromString("[]"); goto Done; } @@ -379,29 +379,29 @@ /* Add "[]" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyBytes_FromString("["); + s = PyString_FromString("["); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString("]"); + s = PyString_FromString("]"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: @@ -433,7 +433,7 @@ { if (i < 0 || i >= Py_SIZE(a)) { if (indexerr == NULL) - indexerr = PyBytes_FromString( + indexerr = PyString_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Mon Jun 9 06:58:54 2008 @@ -1199,7 +1199,7 @@ _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) { register PyLongObject *a = (PyLongObject *)aa; - PyBytesObject *str; + PyStringObject *str; Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; @@ -1228,10 +1228,10 @@ "long is too large to format"); return NULL; } - str = (PyBytesObject *) PyBytes_FromStringAndSize((char *)0, sz); + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyBytes_AS_STRING(str) + sz; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1257,7 +1257,7 @@ do { char cdigit = (char)(accum & (base - 1)); cdigit += (cdigit < 10) ? '0' : 'a'-10; - assert(p > PyBytes_AS_STRING(str)); + assert(p > PyString_AS_STRING(str)); *--p = cdigit; accumbits -= basebits; accum >>= basebits; @@ -1309,7 +1309,7 @@ do { digit nextrem = (digit)(rem / base); char c = (char)(rem - nextrem * base); - assert(p > PyBytes_AS_STRING(str)); + assert(p > PyString_AS_STRING(str)); c += (c < 10) ? '0' : 'a'-10; *--p = c; rem = nextrem; @@ -1347,14 +1347,14 @@ } if (sign) *--p = sign; - if (p != PyBytes_AS_STRING(str)) { - char *q = PyBytes_AS_STRING(str); + if (p != PyString_AS_STRING(str)) { + char *q = PyString_AS_STRING(str); assert(p > q); do { } while ((*q++ = *p++) != '\0'); q--; - _PyBytes_Resize((PyObject **)&str, - (Py_ssize_t) (q - PyBytes_AS_STRING(str))); + _PyString_Resize((PyObject **)&str, + (Py_ssize_t) (q - PyString_AS_STRING(str))); } return (PyObject *)str; } @@ -1718,7 +1718,7 @@ onError: Py_XDECREF(z); slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; - strobj = PyBytes_FromStringAndSize(orig_str, slen); + strobj = PyString_FromStringAndSize(orig_str, slen); if (strobj == NULL) return NULL; strrepr = PyObject_Repr(strobj); @@ -1727,7 +1727,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyBytes_AS_STRING(strrepr)); + base, PyString_AS_STRING(strrepr)); Py_DECREF(strrepr); return NULL; } @@ -3331,11 +3331,11 @@ return PyLong_FromLong(0L); if (base == -909) return PyNumber_Long(x); - else if (PyBytes_Check(x)) { + else if (PyString_Check(x)) { /* Since PyLong_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyBytes_AS_STRING(x); - if (strlen(string) != PyBytes_Size(x)) { + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { /* create a repr() of the input string, * just like PyLong_FromString does. */ PyObject *srepr; @@ -3344,11 +3344,11 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } - return PyLong_FromString(PyBytes_AS_STRING(x), NULL, base); + return PyLong_FromString(PyString_AS_STRING(x), NULL, base); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) Modified: python/trunk/Objects/methodobject.c ============================================================================== --- python/trunk/Objects/methodobject.c (original) +++ python/trunk/Objects/methodobject.c Mon Jun 9 06:58:54 2008 @@ -149,7 +149,7 @@ const char *doc = m->m_ml->ml_doc; if (doc != NULL) - return PyBytes_FromString(doc); + return PyString_FromString(doc); Py_INCREF(Py_None); return Py_None; } @@ -157,7 +157,7 @@ static PyObject * meth_get__name__(PyCFunctionObject *m, void *closure) { - return PyBytes_FromString(m->m_ml->ml_name); + return PyString_FromString(m->m_ml->ml_name); } static int @@ -202,9 +202,9 @@ meth_repr(PyCFunctionObject *m) { if (m->m_self == NULL) - return PyBytes_FromFormat("", + return PyString_FromFormat("", m->m_ml->ml_name); - return PyBytes_FromFormat("", + return PyString_FromFormat("", m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_self); @@ -333,7 +333,7 @@ i = 0; for (c = chain; c != NULL; c = c->link) { for (ml = c->methods; ml->ml_name != NULL; ml++) { - PyList_SetItem(v, i, PyBytes_FromString(ml->ml_name)); + PyList_SetItem(v, i, PyString_FromString(ml->ml_name)); i++; } } @@ -360,7 +360,7 @@ if (strcmp(name, "__doc__") == 0) { const char *doc = self->ob_type->tp_doc; if (doc != NULL) - return PyBytes_FromString(doc); + return PyString_FromString(doc); } } while (chain != NULL) { Modified: python/trunk/Objects/moduleobject.c ============================================================================== --- python/trunk/Objects/moduleobject.c (original) +++ python/trunk/Objects/moduleobject.c Mon Jun 9 06:58:54 2008 @@ -22,7 +22,7 @@ m = PyObject_GC_New(PyModuleObject, &PyModule_Type); if (m == NULL) return NULL; - nameobj = PyBytes_FromString(name); + nameobj = PyString_FromString(name); m->md_dict = PyDict_New(); if (m->md_dict == NULL || nameobj == NULL) goto fail; @@ -68,12 +68,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (nameobj = PyDict_GetItemString(d, "__name__")) == NULL || - !PyBytes_Check(nameobj)) + !PyString_Check(nameobj)) { PyErr_SetString(PyExc_SystemError, "nameless module"); return NULL; } - return PyBytes_AsString(nameobj); + return PyString_AsString(nameobj); } char * @@ -88,12 +88,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || - !PyBytes_Check(fileobj)) + !PyString_Check(fileobj)) { PyErr_SetString(PyExc_SystemError, "module filename missing"); return NULL; } - return PyBytes_AsString(fileobj); + return PyString_AsString(fileobj); } void @@ -117,8 +117,8 @@ /* First, clear only names starting with a single underscore */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyBytes_Check(key)) { - char *s = PyBytes_AsString(key); + if (value != Py_None && PyString_Check(key)) { + char *s = PyString_AsString(key); if (s[0] == '_' && s[1] != '_') { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[1] %s\n", s); @@ -130,8 +130,8 @@ /* Next, clear all names except for __builtins__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyBytes_Check(key)) { - char *s = PyBytes_AsString(key); + if (value != Py_None && PyString_Check(key)) { + char *s = PyString_AsString(key); if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); @@ -195,9 +195,9 @@ filename = PyModule_GetFilename((PyObject *)m); if (filename == NULL) { PyErr_Clear(); - return PyBytes_FromFormat("", name); + return PyString_FromFormat("", name); } - return PyBytes_FromFormat("", name, filename); + return PyString_FromFormat("", name, filename); } /* We only need a traverse function, no clear function: If the module Modified: python/trunk/Objects/object.c ============================================================================== --- python/trunk/Objects/object.c (original) +++ python/trunk/Objects/object.c Mon Jun 9 06:58:54 2008 @@ -357,9 +357,9 @@ } #endif if (v == NULL) - return PyBytes_FromString(""); + return PyString_FromString(""); else if (Py_TYPE(v)->tp_repr == NULL) - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(v)->tp_name, v); else { PyObject *res; @@ -377,7 +377,7 @@ return NULL; } #endif - if (!PyBytes_Check(res)) { + if (!PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", Py_TYPE(res)->tp_name); @@ -394,8 +394,8 @@ PyObject *res; int type_ok; if (v == NULL) - return PyBytes_FromString(""); - if (PyBytes_CheckExact(v)) { + return PyString_FromString(""); + if (PyString_CheckExact(v)) { Py_INCREF(v); return v; } @@ -416,7 +416,7 @@ Py_LeaveRecursiveCall(); if (res == NULL) return NULL; - type_ok = PyBytes_Check(res); + type_ok = PyString_Check(res); #ifdef Py_USING_UNICODE type_ok = type_ok || PyUnicode_Check(res); #endif @@ -447,7 +447,7 @@ return NULL; } #endif - assert(PyBytes_Check(res)); + assert(PyString_Check(res)); return res; } @@ -461,7 +461,7 @@ static PyObject *unicodestr; if (v == NULL) { - res = PyBytes_FromString(""); + res = PyString_FromString(""); if (res == NULL) return NULL; str = PyUnicode_FromEncodedObject(res, NULL, "strict"); @@ -475,7 +475,7 @@ check this before trying the __unicode__ method. */ if (unicodestr == NULL) { - unicodestr= PyBytes_InternFromString("__unicode__"); + unicodestr= PyString_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } @@ -492,7 +492,7 @@ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), PyUnicode_GET_SIZE(v)); } - if (PyBytes_CheckExact(v)) { + if (PyString_CheckExact(v)) { Py_INCREF(v); res = v; } @@ -1084,7 +1084,7 @@ if (Py_TYPE(v)->tp_getattr != NULL) return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); - w = PyBytes_InternFromString(name); + w = PyString_InternFromString(name); if (w == NULL) return NULL; res = PyObject_GetAttr(v, w); @@ -1112,7 +1112,7 @@ if (Py_TYPE(v)->tp_setattr != NULL) return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); - s = PyBytes_InternFromString(name); + s = PyString_InternFromString(name); if (s == NULL) return -1; res = PyObject_SetAttr(v, s, w); @@ -1125,7 +1125,7 @@ { PyTypeObject *tp = Py_TYPE(v); - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name @@ -1147,10 +1147,10 @@ if (tp->tp_getattro != NULL) return (*tp->tp_getattro)(v, name); if (tp->tp_getattr != NULL) - return (*tp->tp_getattr)(v, PyBytes_AS_STRING(name)); + return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); return NULL; } @@ -1172,7 +1172,7 @@ PyTypeObject *tp = Py_TYPE(v); int err; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1194,14 +1194,14 @@ else Py_INCREF(name); - PyBytes_InternInPlace(&name); + PyString_InternInPlace(&name); if (tp->tp_setattro != NULL) { err = (*tp->tp_setattro)(v, name, value); Py_DECREF(name); return err; } if (tp->tp_setattr != NULL) { - err = (*tp->tp_setattr)(v, PyBytes_AS_STRING(name), value); + err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); Py_DECREF(name); return err; } @@ -1212,14 +1212,14 @@ "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); else PyErr_Format(PyExc_TypeError, "'%.100s' object has only read-only attributes " "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); return -1; } @@ -1271,7 +1271,7 @@ Py_ssize_t dictoffset; PyObject **dictptr; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1386,7 +1386,7 @@ PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1401,7 +1401,7 @@ PyObject **dictptr; int res = -1; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1469,13 +1469,13 @@ if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); goto done; } PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1682,7 +1682,7 @@ int i; for (i = 0; i < PyList_GET_SIZE(list); ++i) { PyObject *item = PyList_GET_ITEM(list, i); - if (PyBytes_Check(item)) { + if (PyString_Check(item)) { result = PyDict_SetItem(dict, item, Py_None); if (result < 0) break; @@ -1904,7 +1904,7 @@ static PyObject * none_repr(PyObject *op) { - return PyBytes_FromString("None"); + return PyString_FromString("None"); } /* ARGUSED */ @@ -1946,7 +1946,7 @@ static PyObject * NotImplemented_repr(PyObject *op) { - return PyBytes_FromString("NotImplemented"); + return PyString_FromString("NotImplemented"); } static PyTypeObject PyNotImplemented_Type = { @@ -1983,7 +1983,7 @@ if (PyType_Ready(&PyBool_Type) < 0) Py_FatalError("Can't initialize 'bool'"); - if (PyType_Ready(&PyBytes_Type) < 0) + if (PyType_Ready(&PyString_Type) < 0) Py_FatalError("Can't initialize 'str'"); if (PyType_Ready(&PyByteArray_Type) < 0) Modified: python/trunk/Objects/rangeobject.c ============================================================================== --- python/trunk/Objects/rangeobject.c (original) +++ python/trunk/Objects/rangeobject.c Mon Jun 9 06:58:54 2008 @@ -113,16 +113,16 @@ PyObject *rtn; if (r->start == 0 && r->step == 1) - rtn = PyBytes_FromFormat("xrange(%ld)", + rtn = PyString_FromFormat("xrange(%ld)", r->start + r->len * r->step); else if (r->step == 1) - rtn = PyBytes_FromFormat("xrange(%ld, %ld)", + rtn = PyString_FromFormat("xrange(%ld, %ld)", r->start, r->start + r->len * r->step); else - rtn = PyBytes_FromFormat("xrange(%ld, %ld, %ld)", + rtn = PyString_FromFormat("xrange(%ld, %ld, %ld)", r->start, r->start + r->len * r->step, r->step); Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Mon Jun 9 06:58:54 2008 @@ -151,7 +151,7 @@ /* * Hacked up version of set_lookkey which can assume keys are always strings; - * This means we can always use _PyBytes_Eq directly and not have to check to + * This means we can always use _PyString_Eq directly and not have to check to * see if the comparison altered the table. */ static setentry * @@ -168,7 +168,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyBytes_CheckExact(key)) { + if (!PyString_CheckExact(key)) { so->lookup = set_lookkey; return set_lookkey(so, key, hash); } @@ -179,7 +179,7 @@ if (entry->key == dummy) freeslot = entry; else { - if (entry->hash == hash && _PyBytes_Eq(entry->key, key)) + if (entry->hash == hash && _PyString_Eq(entry->key, key)) return entry; freeslot = NULL; } @@ -194,7 +194,7 @@ if (entry->key == key || (entry->hash == hash && entry->key != dummy - && _PyBytes_Eq(entry->key, key))) + && _PyString_Eq(entry->key, key))) return entry; if (entry->key == dummy && freeslot == NULL) freeslot = entry; @@ -381,8 +381,8 @@ register long hash; register Py_ssize_t n_used; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -428,8 +428,8 @@ PyObject *old_key; assert (PyAnySet_Check(so)); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -618,7 +618,7 @@ if (status != 0) { if (status < 0) return NULL; - return PyBytes_FromFormat("%s(...)", so->ob_type->tp_name); + return PyString_FromFormat("%s(...)", so->ob_type->tp_name); } keys = PySequence_List((PyObject *)so); @@ -629,8 +629,8 @@ if (listrepr == NULL) goto done; - result = PyBytes_FromFormat("%s(%s)", so->ob_type->tp_name, - PyBytes_AS_STRING(listrepr)); + result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, + PyString_AS_STRING(listrepr)); Py_DECREF(listrepr); done: Py_ReprLeave((PyObject*)so); @@ -685,8 +685,8 @@ long hash; setentry *entry; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -983,7 +983,7 @@ register PySetObject *so = NULL; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyBytes_FromString(""); + dummy = PyString_FromString(""); if (dummy == NULL) return NULL; } @@ -2322,7 +2322,7 @@ /* Exercise direct iteration */ i = 0, count = 0; while (_PySet_Next((PyObject *)dup, &i, &x)) { - s = PyBytes_AsString(x); + s = PyString_AsString(x); assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); count++; } Modified: python/trunk/Objects/sliceobject.c ============================================================================== --- python/trunk/Objects/sliceobject.c (original) +++ python/trunk/Objects/sliceobject.c Mon Jun 9 06:58:54 2008 @@ -19,7 +19,7 @@ static PyObject * ellipsis_repr(PyObject *op) { - return PyBytes_FromString("Ellipsis"); + return PyString_FromString("Ellipsis"); } static PyTypeObject PyEllipsis_Type = { @@ -228,14 +228,14 @@ { PyObject *s, *comma; - s = PyBytes_FromString("slice("); - comma = PyBytes_FromString(", "); - PyBytes_ConcatAndDel(&s, PyObject_Repr(r->start)); - PyBytes_Concat(&s, comma); - PyBytes_ConcatAndDel(&s, PyObject_Repr(r->stop)); - PyBytes_Concat(&s, comma); - PyBytes_ConcatAndDel(&s, PyObject_Repr(r->step)); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); + s = PyString_FromString("slice("); + comma = PyString_FromString(", "); + PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); + PyString_Concat(&s, comma); + PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); + PyString_Concat(&s, comma); + PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); + PyString_ConcatAndDel(&s, PyString_FromString(")")); Py_DECREF(comma); return s; } Modified: python/trunk/Objects/stringlib/string_format.h ============================================================================== --- python/trunk/Objects/stringlib/string_format.h (original) +++ python/trunk/Objects/stringlib/string_format.h Mon Jun 9 06:58:54 2008 @@ -496,7 +496,7 @@ #if PY_VERSION_HEX >= 0x03000000 assert(PyUnicode_Check(result)); #else - assert(PyBytes_Check(result) || PyUnicode_Check(result)); + assert(PyString_Check(result) || PyUnicode_Check(result)); /* Convert result to our type. We could be str, and result could be unicode */ Modified: python/trunk/Objects/stringlib/stringdefs.h ============================================================================== --- python/trunk/Objects/stringlib/stringdefs.h (original) +++ python/trunk/Objects/stringlib/stringdefs.h Mon Jun 9 06:58:54 2008 @@ -6,7 +6,7 @@ compiled as unicode. */ #define STRINGLIB_IS_UNICODE 0 -#define STRINGLIB_OBJECT PyBytesObject +#define STRINGLIB_OBJECT PyStringObject #define STRINGLIB_CHAR char #define STRINGLIB_TYPE_NAME "string" #define STRINGLIB_PARSE_CODE "S" @@ -16,13 +16,13 @@ #define STRINGLIB_TOUPPER toupper #define STRINGLIB_TOLOWER tolower #define STRINGLIB_FILL memset -#define STRINGLIB_STR PyBytes_AS_STRING -#define STRINGLIB_LEN PyBytes_GET_SIZE -#define STRINGLIB_NEW PyBytes_FromStringAndSize -#define STRINGLIB_RESIZE _PyBytes_Resize -#define STRINGLIB_CHECK PyBytes_Check +#define STRINGLIB_STR PyString_AS_STRING +#define STRINGLIB_LEN PyString_GET_SIZE +#define STRINGLIB_NEW PyString_FromStringAndSize +#define STRINGLIB_RESIZE _PyString_Resize +#define STRINGLIB_CHECK PyString_Check #define STRINGLIB_CMP memcmp #define STRINGLIB_TOSTR PyObject_Str -#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping +#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping #endif /* !STRINGLIB_STRINGDEFS_H */ Modified: python/trunk/Objects/structseq.c ============================================================================== --- python/trunk/Objects/structseq.c (original) +++ python/trunk/Objects/structseq.c Mon Jun 9 06:58:54 2008 @@ -270,7 +270,7 @@ Py_DECREF(tup); return NULL; } - crepr = PyBytes_AsString(repr); + crepr = PyString_AsString(repr); if (crepr == NULL) { Py_DECREF(tup); Py_DECREF(repr); @@ -306,7 +306,7 @@ *pbuf++ = ')'; *pbuf = '\0'; - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * Modified: python/trunk/Objects/tupleobject.c ============================================================================== --- python/trunk/Objects/tupleobject.c (original) +++ python/trunk/Objects/tupleobject.c Mon Jun 9 06:58:54 2008 @@ -218,7 +218,7 @@ n = Py_SIZE(v); if (n == 0) - return PyBytes_FromString("()"); + return PyString_FromString("()"); /* While not mutable, it is still possible to end up with a cycle in a tuple through an object that stores itself within a tuple (and thus @@ -226,7 +226,7 @@ possible within a type. */ i = Py_ReprEnter((PyObject *)v); if (i != 0) { - return i > 0 ? PyBytes_FromString("(...)") : NULL; + return i > 0 ? PyString_FromString("(...)") : NULL; } pieces = PyTuple_New(n); @@ -246,29 +246,29 @@ /* Add "()" decorations to the first and last items. */ assert(n > 0); - s = PyBytes_FromString("("); + s = PyString_FromString("("); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyTuple_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString(n == 1 ? ",)" : ")"); + s = PyString_FromString(n == 1 ? ",)" : ")"); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, n-1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyTuple_SET_ITEM(pieces, n-1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Mon Jun 9 06:58:54 2008 @@ -19,10 +19,10 @@ >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ - ((PyBytesObject *)(name))->ob_shash) + ((PyStringObject *)(name))->ob_shash) #define MCACHE_CACHEABLE_NAME(name) \ - PyBytes_CheckExact(name) && \ - PyBytes_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE + PyString_CheckExact(name) && \ + PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { unsigned int version; @@ -217,7 +217,7 @@ s = type->tp_name; else s++; - return PyBytes_FromString(s); + return PyString_FromString(s); } } @@ -236,14 +236,14 @@ "can't delete %s.__name__", type->tp_name); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_Format(PyExc_TypeError, "can only assign string to %s.__name__, not '%s'", type->tp_name, Py_TYPE(value)->tp_name); return -1; } - if (strlen(PyBytes_AS_STRING(value)) - != (size_t)PyBytes_GET_SIZE(value)) { + if (strlen(PyString_AS_STRING(value)) + != (size_t)PyString_GET_SIZE(value)) { PyErr_Format(PyExc_ValueError, "__name__ must not contain null bytes"); return -1; @@ -256,7 +256,7 @@ Py_DECREF(et->ht_name); et->ht_name = value; - type->tp_name = PyBytes_AS_STRING(value); + type->tp_name = PyString_AS_STRING(value); return 0; } @@ -279,9 +279,9 @@ else { s = strrchr(type->tp_name, '.'); if (s != NULL) - return PyBytes_FromStringAndSize( + return PyString_FromStringAndSize( type->tp_name, (Py_ssize_t)(s - type->tp_name)); - return PyBytes_FromString("__builtin__"); + return PyString_FromString("__builtin__"); } } @@ -555,7 +555,7 @@ { PyObject *result; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) - return PyBytes_FromString(type->tp_doc); + return PyString_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); if (result == NULL) { result = Py_None; @@ -644,7 +644,7 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyBytes_Check(mod)) { + else if (!PyString_Check(mod)) { Py_DECREF(mod); mod = NULL; } @@ -657,14 +657,14 @@ else kind = "type"; - if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) { - rtn = PyBytes_FromFormat("<%s '%s.%s'>", + if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) { + rtn = PyString_FromFormat("<%s '%s.%s'>", kind, - PyBytes_AS_STRING(mod), - PyBytes_AS_STRING(name)); + PyString_AS_STRING(mod), + PyString_AS_STRING(name)); } else - rtn = PyBytes_FromFormat("<%s '%s'>", kind, type->tp_name); + rtn = PyString_FromFormat("<%s '%s'>", kind, type->tp_name); Py_XDECREF(mod); Py_DECREF(name); @@ -1136,7 +1136,7 @@ PyObject *res; if (*attrobj == NULL) { - *attrobj = PyBytes_InternFromString(attrstr); + *attrobj = PyString_InternFromString(attrstr); if (*attrobj == NULL) return NULL; } @@ -1328,7 +1328,7 @@ } if (name == NULL) return NULL; - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { Py_DECREF(name); return NULL; } @@ -1350,7 +1350,7 @@ o = class_name(o); PyErr_Format(PyExc_TypeError, "duplicate base class %s", - o ? PyBytes_AS_STRING(o) : "?"); + o ? PyString_AS_STRING(o) : "?"); Py_XDECREF(o); return -1; } @@ -1396,7 +1396,7 @@ while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { PyObject *name = class_name(k); off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", - name ? PyBytes_AS_STRING(name) : "?"); + name ? PyString_AS_STRING(name) : "?"); Py_XDECREF(name); if (--n && (size_t)(off+1) < sizeof(buf)) { buf[off++] = ','; @@ -1749,7 +1749,7 @@ PyObject *descr; if (dict_str == NULL) { - dict_str = PyBytes_InternFromString("__dict__"); + dict_str = PyString_InternFromString("__dict__"); if (dict_str == NULL) return NULL; } @@ -1898,14 +1898,14 @@ unsigned char *p; Py_ssize_t i, n; - if (!PyBytes_Check(s)) { + if (!PyString_Check(s)) { PyErr_Format(PyExc_TypeError, "__slots__ items must be strings, not '%.200s'", Py_TYPE(s)->tp_name); return 0; } - p = (unsigned char *) PyBytes_AS_STRING(s); - n = PyBytes_GET_SIZE(s); + p = (unsigned char *) PyString_AS_STRING(s); + n = PyString_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the length to 1 so that the loop will balk on the trailing \0. */ if (n == 0) @@ -2107,7 +2107,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyBytes_Check(slots) || PyUnicode_Check(slots)) + if (PyString_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); @@ -2145,8 +2145,8 @@ char *s; if (!valid_identifier(tmp)) goto bad_slots; - assert(PyBytes_Check(tmp)); - s = PyBytes_AS_STRING(tmp); + assert(PyString_Check(tmp)); + s = PyString_AS_STRING(tmp); if (strcmp(s, "__dict__") == 0) { if (!may_add_dict || add_dict) { PyErr_SetString(PyExc_TypeError, @@ -2178,7 +2178,7 @@ for (i = j = 0; i < nslots; i++) { char *s; tmp = PyTuple_GET_ITEM(slots, i); - s = PyBytes_AS_STRING(tmp); + s = PyString_AS_STRING(tmp); if ((add_dict && strcmp(s, "__dict__") == 0) || (add_weak && strcmp(s, "__weakref__") == 0)) continue; @@ -2271,7 +2271,7 @@ type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; - type->tp_name = PyBytes_AS_STRING(name); + type->tp_name = PyString_AS_STRING(name); /* Set tp_base and tp_bases */ type->tp_bases = bases; @@ -2304,14 +2304,14 @@ */ { PyObject *doc = PyDict_GetItemString(dict, "__doc__"); - if (doc != NULL && PyBytes_Check(doc)) { - const size_t n = (size_t)PyBytes_GET_SIZE(doc); + if (doc != NULL && PyString_Check(doc)) { + const size_t n = (size_t)PyString_GET_SIZE(doc); char *tp_doc = (char *)PyObject_MALLOC(n+1); if (tp_doc == NULL) { Py_DECREF(type); return NULL; } - memcpy(tp_doc, PyBytes_AS_STRING(doc), n+1); + memcpy(tp_doc, PyString_AS_STRING(doc), n+1); type->tp_doc = tp_doc; } } @@ -2334,7 +2334,7 @@ slotoffset = base->tp_basicsize; if (slots != NULL) { for (i = 0; i < nslots; i++, mp++) { - mp->name = PyBytes_AS_STRING( + mp->name = PyString_AS_STRING( PyTuple_GET_ITEM(slots, i)); mp->type = T_OBJECT_EX; mp->offset = slotoffset; @@ -2535,7 +2535,7 @@ /* Give up */ PyErr_Format(PyExc_AttributeError, "type object '%.50s' has no attribute '%.400s'", - type->tp_name, PyBytes_AS_STRING(name)); + type->tp_name, PyString_AS_STRING(name)); return NULL; } @@ -2854,7 +2854,7 @@ if (sorted_methods == NULL) goto error; if (comma == NULL) { - comma = PyBytes_InternFromString(", "); + comma = PyString_InternFromString(", "); if (comma == NULL) goto error; } @@ -2862,7 +2862,7 @@ "O", sorted_methods); if (joined == NULL) goto error; - joined_str = PyBytes_AsString(joined); + joined_str = PyString_AsString(joined); if (joined_str == NULL) goto error; @@ -2896,20 +2896,20 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyBytes_Check(mod)) { + else if (!PyString_Check(mod)) { Py_DECREF(mod); mod = NULL; } name = type_name(type, NULL); if (name == NULL) return NULL; - if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) - rtn = PyBytes_FromFormat("<%s.%s object at %p>", - PyBytes_AS_STRING(mod), - PyBytes_AS_STRING(name), + if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) + rtn = PyString_FromFormat("<%s.%s object at %p>", + PyString_AS_STRING(mod), + PyString_AS_STRING(name), self); else - rtn = PyBytes_FromFormat("<%s object at %p>", + rtn = PyString_FromFormat("<%s object at %p>", type->tp_name, self); Py_XDECREF(mod); Py_DECREF(name); @@ -3069,7 +3069,7 @@ static PyObject *copyreg_str; if (!copyreg_str) { - copyreg_str = PyBytes_InternFromString("copy_reg"); + copyreg_str = PyString_InternFromString("copy_reg"); if (copyreg_str == NULL) return NULL; } @@ -3375,7 +3375,7 @@ return NULL; if (PyUnicode_Check(format_spec)) { self_as_str = PyObject_Unicode(self); - } else if (PyBytes_Check(format_spec)) { + } else if (PyString_Check(format_spec)) { self_as_str = PyObject_Str(self); } else { PyErr_SetString(PyExc_TypeError, "argument to __format__ must be unicode or str"); @@ -3634,7 +3634,7 @@ type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; else if (PyType_IsSubtype(base, &PyLong_Type)) type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; - else if (PyType_IsSubtype(base, &PyBytes_Type)) + else if (PyType_IsSubtype(base, &PyString_Type)) type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; #ifdef Py_USING_UNICODE else if (PyType_IsSubtype(base, &PyUnicode_Type)) @@ -3973,7 +3973,7 @@ */ if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { if (type->tp_doc != NULL) { - PyObject *doc = PyBytes_FromString(type->tp_doc); + PyObject *doc = PyString_FromString(type->tp_doc); if (doc == NULL) goto error; PyDict_SetItemString(type->tp_dict, "__doc__", doc); @@ -4861,7 +4861,7 @@ descrgetfunc f; if (getitem_str == NULL) { - getitem_str = PyBytes_InternFromString("__getitem__"); + getitem_str = PyString_InternFromString("__getitem__"); if (getitem_str == NULL) return NULL; } @@ -5229,7 +5229,7 @@ return res; } PyErr_Clear(); - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -5337,13 +5337,13 @@ static PyObject *getattr_str = NULL; if (getattr_str == NULL) { - getattr_str = PyBytes_InternFromString("__getattr__"); + getattr_str = PyString_InternFromString("__getattr__"); if (getattr_str == NULL) return NULL; } if (getattribute_str == NULL) { getattribute_str = - PyBytes_InternFromString("__getattribute__"); + PyString_InternFromString("__getattribute__"); if (getattribute_str == NULL) return NULL; } @@ -5484,7 +5484,7 @@ static PyObject *get_str = NULL; if (get_str == NULL) { - get_str = PyBytes_InternFromString("__get__"); + get_str = PyString_InternFromString("__get__"); if (get_str == NULL) return NULL; } @@ -5554,7 +5554,7 @@ Py_ssize_t i, n; if (new_str == NULL) { - new_str = PyBytes_InternFromString("__new__"); + new_str = PyString_InternFromString("__new__"); if (new_str == NULL) return NULL; } @@ -6084,7 +6084,7 @@ if (initialized) return; for (p = slotdefs; p->name; p++) { - p->name_strobj = PyBytes_InternFromString(p->name); + p->name_strobj = PyString_InternFromString(p->name); if (!p->name_strobj) Py_FatalError("Out of memory interning slotdef names"); } @@ -6299,12 +6299,12 @@ superobject *su = (superobject *)self; if (su->obj_type) - return PyBytes_FromFormat( + return PyString_FromFormat( ", <%s object>>", su->type ? su->type->tp_name : "NULL", su->obj_type->tp_name); else - return PyBytes_FromFormat( + return PyString_FromFormat( ", NULL>", su->type ? su->type->tp_name : "NULL"); } @@ -6318,9 +6318,9 @@ if (!skip) { /* We want __class__ to return the class of the super object (i.e. super, or a subclass), not the class of su->obj. */ - skip = (PyBytes_Check(name) && - PyBytes_GET_SIZE(name) == 9 && - strcmp(PyBytes_AS_STRING(name), "__class__") == 0); + skip = (PyString_Check(name) && + PyString_GET_SIZE(name) == 9 && + strcmp(PyString_AS_STRING(name), "__class__") == 0); } if (!skip) { @@ -6412,7 +6412,7 @@ PyObject *class_attr; if (class_str == NULL) { - class_str = PyBytes_FromString("__class__"); + class_str = PyString_FromString("__class__"); if (class_str == NULL) return NULL; } Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Mon Jun 9 06:58:54 2008 @@ -1078,9 +1078,9 @@ #endif /* Coerce object */ - if (PyBytes_Check(obj)) { - s = PyBytes_AS_STRING(obj); - len = PyBytes_GET_SIZE(obj); + if (PyString_Check(obj)) { + s = PyString_AS_STRING(obj); + len = PyString_GET_SIZE(obj); } else if (PyByteArray_Check(obj)) { /* Python 2.x specific */ @@ -1252,7 +1252,7 @@ v = PyCodec_Encode(unicode, encoding, errors); if (v == NULL) goto onError; - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -1652,13 +1652,13 @@ char * start; if (size == 0) - return PyBytes_FromStringAndSize(NULL, 0); + return PyString_FromStringAndSize(NULL, 0); - v = PyBytes_FromStringAndSize(NULL, cbAllocated); + v = PyString_FromStringAndSize(NULL, cbAllocated); if (v == NULL) return NULL; - start = out = PyBytes_AS_STRING(v); + start = out = PyString_AS_STRING(v); for (;i < size; ++i) { Py_UNICODE ch = s[i]; @@ -1724,7 +1724,7 @@ *out++ = '-'; } - _PyBytes_Resize(&v, out - start); + _PyString_Resize(&v, out - start); return v; } @@ -1989,10 +1989,10 @@ nallocated = size * 4; if (nallocated / 4 != size) /* overflow! */ return PyErr_NoMemory(); - v = PyBytes_FromStringAndSize(NULL, nallocated); + v = PyString_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; - p = PyBytes_AS_STRING(v); + p = PyString_AS_STRING(v); } for (i = 0; i < size;) { @@ -2040,13 +2040,13 @@ /* This was stack allocated. */ nneeded = p - stackbuf; assert(nneeded <= nallocated); - v = PyBytes_FromStringAndSize(stackbuf, nneeded); + v = PyString_FromStringAndSize(stackbuf, nneeded); } else { /* Cut back to size actually needed. */ - nneeded = p - PyBytes_AS_STRING(v); + nneeded = p - PyString_AS_STRING(v); assert(nneeded <= nallocated); - _PyBytes_Resize(&v, nneeded); + _PyString_Resize(&v, nneeded); } return v; @@ -2274,12 +2274,12 @@ 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) pairs++; #endif - v = PyBytes_FromStringAndSize(NULL, + v = PyString_FromStringAndSize(NULL, 4 * (size - pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyBytes_AS_STRING(v); + p = (unsigned char *)PyString_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2539,12 +2539,12 @@ if (s[i] >= 0x10000) pairs++; #endif - v = PyBytes_FromStringAndSize(NULL, + v = PyString_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyBytes_AS_STRING(v); + p = (unsigned char *)PyString_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2887,7 +2887,7 @@ escape. */ - repr = PyBytes_FromStringAndSize(NULL, + repr = PyString_FromStringAndSize(NULL, 2 #ifdef Py_UNICODE_WIDE + 10*size @@ -2898,7 +2898,7 @@ if (repr == NULL) return NULL; - p = PyBytes_AS_STRING(repr); + p = PyString_AS_STRING(repr); if (quotes) { *p++ = 'u'; @@ -2910,7 +2910,7 @@ /* Escape quotes and backslashes */ if ((quotes && - ch == (Py_UNICODE) PyBytes_AS_STRING(repr)[1]) || ch == '\\') { + ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { *p++ = '\\'; *p++ = (char) ch; continue; @@ -2996,10 +2996,10 @@ *p++ = (char) ch; } if (quotes) - *p++ = PyBytes_AS_STRING(repr)[1]; + *p++ = PyString_AS_STRING(repr)[1]; *p = '\0'; - _PyBytes_Resize(&repr, p - PyBytes_AS_STRING(repr)); + _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); return repr; } @@ -3148,16 +3148,16 @@ static const char *hexdigit = "0123456789abcdef"; #ifdef Py_UNICODE_WIDE - repr = PyBytes_FromStringAndSize(NULL, 10 * size); + repr = PyString_FromStringAndSize(NULL, 10 * size); #else - repr = PyBytes_FromStringAndSize(NULL, 6 * size); + repr = PyString_FromStringAndSize(NULL, 6 * size); #endif if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyBytes_AS_STRING(repr); + p = q = PyString_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; #ifdef Py_UNICODE_WIDE @@ -3216,7 +3216,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyBytes_Resize(&repr, p - q); + _PyString_Resize(&repr, p - q); return repr; } @@ -3456,12 +3456,12 @@ /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ - res = PyBytes_FromStringAndSize(NULL, size); + res = PyString_FromStringAndSize(NULL, size); if (res == NULL) goto onError; if (size == 0) return res; - str = PyBytes_AS_STRING(res); + str = PyString_AS_STRING(res); ressize = size; while (p ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyBytes_Resize(&res, requiredsize)) + if (_PyString_Resize(&res, requiredsize)) goto onError; - str = PyBytes_AS_STRING(res) + respos; + str = PyString_AS_STRING(res) + respos; ressize = requiredsize; } /* generate replacement (temporarily (mis)uses p) */ @@ -3558,17 +3558,17 @@ /* 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); + respos = str-PyString_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)) { + if (_PyString_Resize(&res, requiredsize)) { Py_DECREF(repunicode); goto onError; } - str = PyBytes_AS_STRING(res) + respos; + str = PyString_AS_STRING(res) + respos; ressize = requiredsize; } /* check if there is anything unencodable in the replacement @@ -3589,10 +3589,10 @@ } } /* Resize if we allocated to much */ - respos = str-PyBytes_AS_STRING(res); + respos = str-PyString_AS_STRING(res); if (respos 0) { - char *s = PyBytes_AS_STRING(*repr) + n; + char *s = PyString_AS_STRING(*repr) + n; if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { PyErr_SetFromWindowsErrWithFilename(0, NULL); return -1; @@ -4327,7 +4327,7 @@ } return x; } - else if (PyBytes_Check(x)) + else if (PyString_Check(x)) return x; else { /* wrong return value */ @@ -4341,11 +4341,11 @@ static int charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) { - Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); + Py_ssize_t outsize = PyString_GET_SIZE(*outobj); /* exponentially overallocate to minimize reallocations */ if (requiredsize < 2*outsize) requiredsize = 2*outsize; - if (_PyBytes_Resize(outobj, requiredsize)) { + if (_PyString_Resize(outobj, requiredsize)) { return 0; } return 1; @@ -4366,7 +4366,7 @@ { PyObject *rep; char *outstart; - Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); + Py_ssize_t outsize = PyString_GET_SIZE(*outobj); if (Py_TYPE(mapping) == &EncodingMapType) { int res = encoding_map_lookup(c, mapping); @@ -4376,7 +4376,7 @@ if (outsize" : "", @@ -177,7 +177,7 @@ name); Py_XDECREF(nameobj); } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* Weak references only support equality, not ordering. Two weak references @@ -448,7 +448,7 @@ "", proxy, Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name, PyWeakref_GET_OBJECT(proxy)); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } Modified: python/trunk/PC/_msi.c ============================================================================== --- python/trunk/PC/_msi.c (original) +++ python/trunk/PC/_msi.c Mon Jun 9 06:58:54 2008 @@ -35,7 +35,7 @@ return NULL; } - oresult = PyBytes_FromString(cresult); + oresult = PyString_FromString(cresult); RpcStringFree(&cresult); return oresult; @@ -136,14 +136,14 @@ PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab); if (result == NULL) return -1; - if (!PyBytes_Check(result)) { + if (!PyString_Check(result)) { PyErr_Format(PyExc_TypeError, "Incorrect return type %s from getnextcabinet", result->ob_type->tp_name); Py_DECREF(result); return FALSE; } - strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab)); + strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab)); return TRUE; } return FALSE; @@ -554,7 +554,7 @@ PyErr_SetString(PyExc_NotImplementedError, "FILETIME result"); return NULL; case VT_LPSTR: - result = PyBytes_FromStringAndSize(sval, ssize); + result = PyString_FromStringAndSize(sval, ssize); if (sval != sbuf) free(sval); return result; @@ -586,9 +586,9 @@ if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data)) return NULL; - if (PyBytes_Check(data)) { + if (PyString_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR, - 0, NULL, PyBytes_AsString(data)); + 0, NULL, PyString_AsString(data)); } else if (PyInt_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, PyInt_AsLong(data), NULL, NULL); Modified: python/trunk/PC/_subprocess.c ============================================================================== --- python/trunk/PC/_subprocess.c (original) +++ python/trunk/PC/_subprocess.c Mon Jun 9 06:58:54 2008 @@ -304,42 +304,42 @@ if (!keys || !values) goto error; - out = PyBytes_FromStringAndSize(NULL, 2048); + out = PyString_FromStringAndSize(NULL, 2048); if (! out) goto error; - p = PyBytes_AS_STRING(out); + p = PyString_AS_STRING(out); for (i = 0; i < envsize; i++) { int ksize, vsize, totalsize; PyObject* key = PyList_GET_ITEM(keys, i); PyObject* value = PyList_GET_ITEM(values, i); - if (! PyBytes_Check(key) || ! PyBytes_Check(value)) { + if (! PyString_Check(key) || ! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } - ksize = PyBytes_GET_SIZE(key); - vsize = PyBytes_GET_SIZE(value); - totalsize = (p - PyBytes_AS_STRING(out)) + ksize + 1 + + ksize = PyString_GET_SIZE(key); + vsize = PyString_GET_SIZE(value); + totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 + vsize + 1 + 1; - if (totalsize > PyBytes_GET_SIZE(out)) { - int offset = p - PyBytes_AS_STRING(out); - _PyBytes_Resize(&out, totalsize + 1024); - p = PyBytes_AS_STRING(out) + offset; + if (totalsize > PyString_GET_SIZE(out)) { + int offset = p - PyString_AS_STRING(out); + _PyString_Resize(&out, totalsize + 1024); + p = PyString_AS_STRING(out) + offset; } - memcpy(p, PyBytes_AS_STRING(key), ksize); + memcpy(p, PyString_AS_STRING(key), ksize); p += ksize; *p++ = '='; - memcpy(p, PyBytes_AS_STRING(value), vsize); + memcpy(p, PyString_AS_STRING(value), vsize); p += vsize; *p++ = '\0'; } /* add trailing null byte */ *p++ = '\0'; - _PyBytes_Resize(&out, p - PyBytes_AS_STRING(out)); + _PyString_Resize(&out, p - PyString_AS_STRING(out)); /* PyObject_Print(out, stdout, 0); */ @@ -413,7 +413,7 @@ NULL, inherit_handles, creation_flags, - environment ? PyBytes_AS_STRING(environment) : NULL, + environment ? PyString_AS_STRING(environment) : NULL, current_directory, &si, &pi); @@ -516,7 +516,7 @@ if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyBytes_FromString(filename); + return PyString_FromString(filename); } static PyMethodDef sp_functions[] = { Modified: python/trunk/PC/_winreg.c ============================================================================== --- python/trunk/PC/_winreg.c (original) +++ python/trunk/PC/_winreg.c Mon Jun 9 06:58:54 2008 @@ -424,7 +424,7 @@ PyHKEYObject *pyhkey = (PyHKEYObject *)ob; char resBuf[160]; wsprintf(resBuf, "", pyhkey->hkey); - return PyBytes_FromString(resBuf); + return PyString_FromString(resBuf); } static int @@ -767,11 +767,11 @@ return FALSE; need_decref = 1; } - if (!PyBytes_Check(value)) + if (!PyString_Check(value)) return FALSE; *retDataSize = 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)value)); + PyString_AS_STRING( + (PyStringObject *)value)); } *retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize); if (*retDataBuf==NULL){ @@ -782,8 +782,8 @@ strcpy((char *)*retDataBuf, ""); else strcpy((char *)*retDataBuf, - PyBytes_AS_STRING( - (PyBytesObject *)value)); + PyString_AS_STRING( + (PyStringObject *)value)); if (need_decref) Py_DECREF(value); break; @@ -808,7 +808,7 @@ PyObject *t; t = PyList_GET_ITEM( (PyListObject *)value,j); - if (PyBytes_Check(t)) { + if (PyString_Check(t)) { obs[j] = t; Py_INCREF(t); } else if (PyUnicode_Check(t)) { @@ -821,8 +821,8 @@ } else goto reg_multi_fail; size += 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)obs[j])); + PyString_AS_STRING( + (PyStringObject *)obs[j])); } *retDataSize = size + 1; @@ -839,11 +839,11 @@ PyObject *t; t = obs[j]; strcpy(P, - PyBytes_AS_STRING( - (PyBytesObject *)t)); + PyString_AS_STRING( + (PyStringObject *)t)); P += 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)t)); + PyString_AS_STRING( + (PyStringObject *)t)); Py_DECREF(obs[j]); } /* And doubly-terminate the list... */ @@ -1085,7 +1085,7 @@ if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx"); - retStr = PyBytes_FromStringAndSize(tmpbuf, len); + retStr = PyString_FromStringAndSize(tmpbuf, len); return retStr; /* can be NULL */ } @@ -1303,17 +1303,17 @@ != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); - retStr = PyBytes_FromStringAndSize(NULL, bufSize); + retStr = PyString_FromStringAndSize(NULL, bufSize); if (retStr == NULL) return NULL; - retBuf = PyBytes_AS_STRING(retStr); + retBuf = PyString_AS_STRING(retStr); if ((rc = RegQueryValue(hKey, subKey, retBuf, &bufSize)) != ERROR_SUCCESS) { Py_DECREF(retStr); return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); } - _PyBytes_Resize(&retStr, strlen(retBuf)); + _PyString_Resize(&retStr, strlen(retBuf)); return retStr; } @@ -1414,14 +1414,14 @@ return NULL; } /* XXX - need Unicode support */ - str = PyBytes_AsString(obStrVal); + str = PyString_AsString(obStrVal); if (str == NULL) return NULL; - len = PyBytes_Size(obStrVal); + len = PyString_Size(obStrVal); if (obSubKey == Py_None) subKey = NULL; else { - subKey = PyBytes_AsString(obSubKey); + subKey = PyString_AsString(obSubKey); if (subKey == NULL) return NULL; } Modified: python/trunk/PC/msvcrtmodule.c ============================================================================== --- python/trunk/PC/msvcrtmodule.c (original) +++ python/trunk/PC/msvcrtmodule.c Mon Jun 9 06:58:54 2008 @@ -140,7 +140,7 @@ ch = _getch(); Py_END_ALLOW_THREADS s[0] = ch; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } static PyObject * @@ -172,7 +172,7 @@ ch = _getche(); Py_END_ALLOW_THREADS s[0] = ch; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } static PyObject * Modified: python/trunk/PC/winsound.c ============================================================================== --- python/trunk/PC/winsound.c (original) +++ python/trunk/PC/winsound.c Mon Jun 9 06:58:54 2008 @@ -151,7 +151,7 @@ static void add_define(PyObject *dict, const char *key, long value) { - PyObject *k=PyBytes_FromString(key); + PyObject *k=PyString_FromString(key); PyObject *v=PyLong_FromLong(value); if(v&&k) { Modified: python/trunk/Parser/asdl_c.py ============================================================================== --- python/trunk/Parser/asdl_c.py (original) +++ python/trunk/Parser/asdl_c.py Mon Jun 9 06:58:54 2008 @@ -375,7 +375,7 @@ # there's really nothing more we can do if this fails ... self.emit("if (tmp == NULL) goto failed;", 1) error = "expected some sort of %s, but got %%.400s" % name - format = "PyErr_Format(PyExc_TypeError, \"%s\", PyBytes_AS_STRING(tmp));" + format = "PyErr_Format(PyExc_TypeError, \"%s\", PyString_AS_STRING(tmp));" self.emit(format % error, 1, reflow=False) self.emit("failed:", 0) self.emit("Py_XDECREF(tmp);", 1) @@ -704,7 +704,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyBytes_FromString(fields[i]); + PyObject *field = PyString_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -723,7 +723,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyBytes_FromString(attrs[i]); + s = PyString_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -797,7 +797,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -815,7 +815,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } Modified: python/trunk/Parser/tokenizer.c ============================================================================== --- python/trunk/Parser/tokenizer.c (original) +++ python/trunk/Parser/tokenizer.c Mon Jun 9 06:58:54 2008 @@ -12,7 +12,7 @@ #ifndef PGEN #include "unicodeobject.h" -#include "bytesobject.h" +#include "stringobject.h" #include "fileobject.h" #include "codecs.h" #include "abstract.h" @@ -344,7 +344,7 @@ 1) NULL: need to call tok->decoding_readline to get a new line 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and stored the result in tok->decoding_buffer - 3) PyBytesObject *: previous call to fp_readl did not have enough room + 3) PyStringObject *: previous call to fp_readl did not have enough room (in the s buffer) to copy entire contents of the line read by tok->decoding_readline. tok->decoding_buffer has the overflow. In this case, fp_readl is called in a loop (with an expanded buffer) @@ -375,7 +375,7 @@ return error_ret(tok); } else { tok->decoding_buffer = NULL; - if (PyBytes_CheckExact(buf)) + if (PyString_CheckExact(buf)) utf8 = buf; } if (utf8 == NULL) { @@ -384,10 +384,10 @@ if (utf8 == NULL) return error_ret(tok); } - str = PyBytes_AsString(utf8); - utf8len = PyBytes_GET_SIZE(utf8); + str = PyString_AsString(utf8); + utf8len = PyString_GET_SIZE(utf8); if (utf8len > size) { - tok->decoding_buffer = PyBytes_FromStringAndSize(str+size, utf8len-size); + tok->decoding_buffer = PyString_FromStringAndSize(str+size, utf8len-size); if (tok->decoding_buffer == NULL) { Py_DECREF(utf8); return error_ret(tok); @@ -591,7 +591,7 @@ utf8 = translate_into_utf8(str, tok->enc); if (utf8 == NULL) return error_ret(tok); - str = PyBytes_AsString(utf8); + str = PyString_AsString(utf8); } #endif for (s = str;; s++) { @@ -624,7 +624,7 @@ "unknown encoding: %s", tok->enc); return error_ret(tok); } - str = PyBytes_AsString(utf8); + str = PyString_AsString(utf8); } #endif assert(tok->decoding_buffer == NULL); @@ -706,11 +706,11 @@ return 0; enc = ((PyFileObject *)sysstdin)->f_encoding; - if (enc == NULL || !PyBytes_Check(enc)) + if (enc == NULL || !PyString_Check(enc)) return 0; Py_INCREF(enc); - encoding = PyBytes_AsString(enc); + encoding = PyString_AsString(enc); decoded = PyUnicode_Decode(*inp, strlen(*inp), encoding, NULL); if (decoded == NULL) goto error_clear; @@ -720,9 +720,9 @@ if (utf8 == NULL) goto error_clear; - assert(PyBytes_Check(utf8)); - converted = new_string(PyBytes_AS_STRING(utf8), - PyBytes_GET_SIZE(utf8)); + assert(PyString_Check(utf8)); + converted = new_string(PyString_AS_STRING(utf8), + PyString_GET_SIZE(utf8)); Py_DECREF(utf8); if (converted == NULL) goto error_nomem; @@ -1609,8 +1609,8 @@ /* convert source to original encondig */ PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len); if (lineobj != NULL) { - int linelen = PyBytes_Size(lineobj); - const char *line = PyBytes_AsString(lineobj); + int linelen = PyString_Size(lineobj); + const char *line = PyString_AsString(lineobj); text = PyObject_MALLOC(linelen + 1); if (text != NULL && line != NULL) { if (linelen) @@ -1624,7 +1624,7 @@ PyObject *offsetobj = dec_utf8(tok->encoding, tok->buf, *offset-1); if (offsetobj) { - *offset = PyBytes_Size(offsetobj) + 1; + *offset = PyString_Size(offsetobj) + 1; Py_DECREF(offsetobj); } } Modified: python/trunk/Python/Python-ast.c ============================================================================== --- python/trunk/Python/Python-ast.c (original) +++ python/trunk/Python/Python-ast.c Mon Jun 9 06:58:54 2008 @@ -495,7 +495,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyBytes_FromString(fields[i]); + PyObject *field = PyString_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -514,7 +514,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyBytes_FromString(attrs[i]); + s = PyString_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -588,7 +588,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -606,7 +606,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -3286,7 +3286,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -4414,7 +4414,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5261,7 +5261,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5299,7 +5299,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5417,7 +5417,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5439,7 +5439,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5501,7 +5501,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5531,7 +5531,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5585,7 +5585,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5751,7 +5751,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; Modified: python/trunk/Python/_warnings.c ============================================================================== --- python/trunk/Python/_warnings.c (original) +++ python/trunk/Python/_warnings.c Mon Jun 9 06:58:54 2008 @@ -44,7 +44,7 @@ int result; if (warnings_str == NULL) { - warnings_str = PyBytes_InternFromString("warnings"); + warnings_str = PyString_InternFromString("warnings"); if (warnings_str == NULL) return NULL; } @@ -132,7 +132,7 @@ return NULL; if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyBytes_AsString(action); + return PyString_AsString(action); } m = PyImport_ImportModule(MODULE_NAME); @@ -144,7 +144,7 @@ return NULL; action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME); if (action != NULL) - return PyBytes_AsString(action); + return PyString_AsString(action); PyErr_SetString(PyExc_ValueError, MODULE_NAME "." DEFAULT_ACTION_NAME " not found"); @@ -184,17 +184,17 @@ if (rc == -1) return NULL; else if (rc == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); - mod_str = PyBytes_AsString(filename); + mod_str = PyString_AsString(filename); if (mod_str == NULL) return NULL; - len = PyBytes_Size(filename); + len = PyString_Size(filename); if (len < 0) return NULL; if (len >= 3 && strncmp(mod_str + (len - 3), ".py", 3) == 0) { - module = PyBytes_FromStringAndSize(mod_str, len-3); + module = PyString_FromStringAndSize(mod_str, len-3); } else { module = filename; @@ -258,7 +258,7 @@ /* Print " source_line\n" */ PyFile_WriteString(" ", f_stderr); if (sourceline) { - char *source_line_str = PyBytes_AS_STRING(sourceline); + char *source_line_str = PyString_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || *source_line_str == '\014') source_line_str++; @@ -267,7 +267,7 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyBytes_AS_STRING(filename), lineno); + Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); PyErr_Clear(); } @@ -359,7 +359,7 @@ const char *err_str = "???"; if (to_str != NULL) - err_str = PyBytes_AS_STRING(to_str); + err_str = PyString_AS_STRING(to_str); PyErr_Format(PyExc_RuntimeError, "Unrecognized action (%s) in warnings.filters:\n %s", action, err_str); @@ -380,7 +380,7 @@ else { const char *msg = "functions overriding warnings.showwarning() " "must support the 'line' argument"; - const char *text_char = PyBytes_AS_STRING(text); + const char *text_char = PyString_AS_STRING(text); if (strcmp(msg, text_char) == 0) { /* Prevent infinite recursion by using built-in implementation @@ -484,7 +484,7 @@ /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); if (*module == NULL) { - *module = PyBytes_FromString(""); + *module = PyString_FromString(""); if (*module == NULL) goto handle_error; } @@ -494,8 +494,8 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); if (*filename != NULL) { - Py_ssize_t len = PyBytes_Size(*filename); - const char *file_str = PyBytes_AsString(*filename); + Py_ssize_t len = PyString_Size(*filename); + const char *file_str = PyString_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) goto handle_error; @@ -507,7 +507,7 @@ (tolower(file_str[len-1]) == 'c' || tolower(file_str[len-1]) == 'o')) { - *filename = PyBytes_FromStringAndSize(file_str, len-1); + *filename = PyString_FromStringAndSize(file_str, len-1); if (*filename == NULL) goto handle_error; } @@ -515,7 +515,7 @@ Py_INCREF(*filename); } else { - const char *module_str = PyBytes_AsString(*module); + const char *module_str = PyString_AsString(*module); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { @@ -530,14 +530,14 @@ } else if (!is_true) { Py_DECREF(*filename); - *filename = PyBytes_FromString("__main__"); + *filename = PyString_FromString("__main__"); if (*filename == NULL) goto handle_error; } } else { /* embedded interpreters don't have sys.argv, see bug #839151 */ - *filename = PyBytes_FromString("__main__"); + *filename = PyString_FromString("__main__"); if (*filename == NULL) goto handle_error; } @@ -649,12 +649,12 @@ PyObject *returned; if (get_source_name == NULL) { - get_source_name = PyBytes_InternFromString("get_source"); + get_source_name = PyString_InternFromString("get_source"); if (!get_source_name) return NULL; } if (splitlines_name == NULL) { - splitlines_name = PyBytes_InternFromString("splitlines"); + splitlines_name = PyString_InternFromString("splitlines"); if (!splitlines_name) return NULL; } @@ -711,7 +711,7 @@ PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) { PyObject *res; - PyObject *message = PyBytes_FromString(text); + PyObject *message = PyString_FromString(text); if (message == NULL) return -1; @@ -745,15 +745,15 @@ const char *module_str, PyObject *registry) { PyObject *res; - PyObject *message = PyBytes_FromString(text); - PyObject *filename = PyBytes_FromString(filename_str); + PyObject *message = PyString_FromString(text); + PyObject *filename = PyString_FromString(filename_str); PyObject *module = NULL; int ret = -1; if (message == NULL || filename == NULL) goto exit; if (module_str != NULL) { - module = PyBytes_FromString(module_str); + module = PyString_FromString(module_str); if (module == NULL) goto exit; } @@ -803,7 +803,7 @@ if (!strcmp(action, "ignore")) { if (ignore_str == NULL) { - ignore_str = PyBytes_InternFromString("ignore"); + ignore_str = PyString_InternFromString("ignore"); if (ignore_str == NULL) return NULL; } @@ -811,7 +811,7 @@ } else if (!strcmp(action, "error")) { if (error_str == NULL) { - error_str = PyBytes_InternFromString("error"); + error_str = PyString_InternFromString("error"); if (error_str == NULL) return NULL; } @@ -819,7 +819,7 @@ } else if (!strcmp(action, "default")) { if (default_str == NULL) { - default_str = PyBytes_InternFromString("default"); + default_str = PyString_InternFromString("default"); if (default_str == NULL) return NULL; } @@ -892,7 +892,7 @@ if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) return; - default_action = PyBytes_InternFromString("default"); + default_action = PyString_InternFromString("default"); if (default_action == NULL) return; if (PyModule_AddObject(m, DEFAULT_ACTION_NAME, default_action) < 0) Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Mon Jun 9 06:58:54 2008 @@ -46,7 +46,7 @@ static identifier new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyBytes_InternFromString(n); + PyObject* id = PyString_InternFromString(n); PyArena_AddPyObject(arena, id); return id; } @@ -1291,7 +1291,7 @@ if (errstr) { char *s = ""; char buf[128]; - s = PyBytes_AsString(errstr); + s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { @@ -2333,10 +2333,10 @@ /* length of string plus one for the dot */ len += strlen(STR(CHILD(n, i))) + 1; len--; /* the last name doesn't have a dot */ - str = PyBytes_FromStringAndSize(NULL, len); + str = PyString_FromStringAndSize(NULL, len); if (!str) return NULL; - s = PyBytes_AS_STRING(str); + s = PyString_AS_STRING(str); if (!s) return NULL; for (i = 0; i < NCH(n); i += 2) { @@ -2347,13 +2347,13 @@ } --s; *s = '\0'; - PyBytes_InternInPlace(&str); + PyString_InternInPlace(&str); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); } break; case STAR: - str = PyBytes_InternFromString("*"); + str = PyString_InternFromString("*"); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); default: @@ -3201,10 +3201,10 @@ u = NULL; } else { /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ - u = PyBytes_FromStringAndSize((char *)NULL, len * 4); + u = PyString_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) return NULL; - p = buf = PyBytes_AsString(u); + p = buf = PyString_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { @@ -3223,8 +3223,8 @@ Py_DECREF(u); return NULL; } - r = PyBytes_AsString(w); - rn = PyBytes_Size(w); + r = PyString_AsString(w); + rn = PyString_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", @@ -3323,11 +3323,11 @@ return v; #endif } else { - return PyBytes_FromStringAndSize(s, len); + return PyString_FromStringAndSize(s, len); } } - return PyBytes_DecodeEscape(s, len, NULL, unicode, + return PyString_DecodeEscape(s, len, NULL, unicode, need_encoding ? c->c_encoding : NULL); } @@ -3348,8 +3348,8 @@ s = parsestr(c, STR(CHILD(n, i))); if (s == NULL) goto onError; - if (PyBytes_Check(v) && PyBytes_Check(s)) { - PyBytes_ConcatAndDel(&v, s); + if (PyString_Check(v) && PyString_Check(s)) { + PyString_ConcatAndDel(&v, s); if (v == NULL) goto onError; } Modified: python/trunk/Python/bltinmodule.c ============================================================================== --- python/trunk/Python/bltinmodule.c (original) +++ python/trunk/Python/bltinmodule.c Mon Jun 9 06:58:54 2008 @@ -247,7 +247,7 @@ return NULL; /* Strings and tuples return a result of the same type. */ - if (PyBytes_Check(seq)) + if (PyString_Check(seq)) return filterstring(func, seq); #ifdef Py_USING_UNICODE if (PyUnicode_Check(seq)) @@ -381,7 +381,7 @@ return NULL; } s[0] = (char)x; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } PyDoc_STRVAR(chr_doc, @@ -652,7 +652,7 @@ return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } - if (!PyBytes_Check(cmd) && + if (!PyString_Check(cmd) && !PyUnicode_Check(cmd)) { PyErr_SetString(PyExc_TypeError, "eval() arg 1 must be a string or code object"); @@ -669,7 +669,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyBytes_AsStringAndSize(cmd, &str, NULL)) { + if (PyString_AsStringAndSize(cmd, &str, NULL)) { Py_XDECREF(tmp); return NULL; } @@ -814,7 +814,7 @@ } #endif - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "getattr(): attribute name must be string"); return NULL; @@ -870,7 +870,7 @@ } #endif - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return NULL; @@ -1189,7 +1189,7 @@ return NULL; } res = (*nb->nb_hex)(v); - if (res && !PyBytes_Check(res)) { + if (res && !PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__hex__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1249,13 +1249,13 @@ PyObject *s; if (!PyArg_ParseTuple(args, "S:intern", &s)) return NULL; - if (!PyBytes_CheckExact(s)) { + if (!PyString_CheckExact(s)) { PyErr_SetString(PyExc_TypeError, "can't intern subclass of string"); return NULL; } Py_INCREF(s); - PyBytes_InternInPlace(&s); + PyString_InternInPlace(&s); return s; } @@ -1457,7 +1457,7 @@ return NULL; } res = (*nb->nb_oct)(v); - if (res && !PyBytes_Check(res)) { + if (res && !PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__oct__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1492,10 +1492,10 @@ long ord; Py_ssize_t size; - if (PyBytes_Check(obj)) { - size = PyBytes_GET_SIZE(obj); + if (PyString_Check(obj)) { + size = PyString_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); + ord = (long)((unsigned char)*PyString_AS_STRING(obj)); return PyInt_FromLong(ord); } } else if (PyByteArray_Check(obj)) { @@ -1572,14 +1572,14 @@ Py_RETURN_NONE; } - if (sep && sep != Py_None && !PyBytes_Check(sep) && + if (sep && sep != Py_None && !PyString_Check(sep) && !PyUnicode_Check(sep)) { PyErr_Format(PyExc_TypeError, "sep must be None, str or unicode, not %.200s", sep->ob_type->tp_name); return NULL; } - if (end && end != Py_None && !PyBytes_Check(end) && + if (end && end != Py_None && !PyString_Check(end) && !PyUnicode_Check(end)) { PyErr_Format(PyExc_TypeError, "end must be None, str or unicode, not %.200s", @@ -1948,7 +1948,7 @@ po = PyObject_Str(v); if (po == NULL) return NULL; - prompt = PyBytes_AsString(po); + prompt = PyString_AsString(po); if (prompt == NULL) return NULL; } @@ -1976,7 +1976,7 @@ result = NULL; } else { - result = PyBytes_FromStringAndSize(s, len-1); + result = PyString_FromStringAndSize(s, len-1); } } PyMem_FREE(s); @@ -2619,7 +2619,7 @@ SETBUILTIN("bool", &PyBool_Type); /* SETBUILTIN("memoryview", &PyMemoryView_Type); */ SETBUILTIN("bytearray", &PyByteArray_Type); - SETBUILTIN("bytes", &PyBytes_Type); + SETBUILTIN("bytes", &PyString_Type); SETBUILTIN("buffer", &PyBuffer_Type); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX @@ -2639,7 +2639,7 @@ SETBUILTIN("set", &PySet_Type); SETBUILTIN("slice", &PySlice_Type); SETBUILTIN("staticmethod", &PyStaticMethod_Type); - SETBUILTIN("str", &PyBytes_Type); + SETBUILTIN("str", &PyString_Type); SETBUILTIN("super", &PySuper_Type); SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); @@ -2737,7 +2737,7 @@ { PyObject *result; Py_ssize_t i, j; - Py_ssize_t len = PyBytes_Size(strobj); + Py_ssize_t len = PyString_Size(strobj); Py_ssize_t outlen = len; if (func == Py_None) { @@ -2745,12 +2745,12 @@ * as no character is ever false and __getitem__ * does return this character. If it's a subclass * we must go through the __getitem__ loop */ - if (PyBytes_CheckExact(strobj)) { + if (PyString_CheckExact(strobj)) { Py_INCREF(strobj); return strobj; } } - if ((result = PyBytes_FromStringAndSize(NULL, len)) == NULL) + if ((result = PyString_FromStringAndSize(NULL, len)) == NULL) return NULL; for (i = j = 0; i < len; ++i) { @@ -2780,16 +2780,16 @@ } if (ok) { Py_ssize_t reslen; - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "can't filter str to str:" " __getitem__ returned different type"); Py_DECREF(item); goto Fail_1; } - reslen = PyBytes_GET_SIZE(item); + reslen = PyString_GET_SIZE(item); if (reslen == 1) { - PyBytes_AS_STRING(result)[j++] = - PyBytes_AS_STRING(item)[0]; + PyString_AS_STRING(result)[j++] = + PyString_AS_STRING(item)[0]; } else { /* do we need more space? */ Py_ssize_t need = j + reslen + len-i-1; @@ -2797,15 +2797,15 @@ /* overallocate, to avoid reallocations */ if (need<2*outlen) need = 2*outlen; - if (_PyBytes_Resize(&result, need)) { + if (_PyString_Resize(&result, need)) { Py_DECREF(item); return NULL; } outlen = need; } memcpy( - PyBytes_AS_STRING(result) + j, - PyBytes_AS_STRING(item), + PyString_AS_STRING(result) + j, + PyString_AS_STRING(item), reslen ); j += reslen; @@ -2815,7 +2815,7 @@ } if (j < outlen) - _PyBytes_Resize(&result, j); + _PyString_Resize(&result, j); return result; Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Mon Jun 9 06:58:54 2008 @@ -739,7 +739,7 @@ consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + co->co_nlocals; - first_instr = (unsigned char*) PyBytes_AS_STRING(co->co_code); + first_instr = (unsigned char*) PyString_AS_STRING(co->co_code); /* An explanation is in order for the next line. f->f_lasti now refers to the index of the last instruction @@ -766,7 +766,7 @@ lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyBytes_AsString(co->co_filename); + filename = PyString_AsString(co->co_filename); #endif why = WHY_NOT; @@ -1147,8 +1147,8 @@ goto slow_add; x = PyInt_FromLong(i); } - else if (PyBytes_CheckExact(v) && - PyBytes_CheckExact(w)) { + else if (PyString_CheckExact(v) && + PyString_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_vx; @@ -1349,8 +1349,8 @@ goto slow_iadd; x = PyInt_FromLong(i); } - else if (PyBytes_CheckExact(v) && - PyBytes_CheckExact(w)) { + else if (PyString_CheckExact(v) && + PyString_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_v; @@ -1576,9 +1576,9 @@ err = PyFile_WriteObject(v, w, Py_PRINT_RAW); if (err == 0) { /* XXX move into writeobject() ? */ - if (PyBytes_Check(v)) { - char *s = PyBytes_AS_STRING(v); - Py_ssize_t len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + char *s = PyString_AS_STRING(v); + Py_ssize_t len = PyString_GET_SIZE(v); if (len == 0 || !isspace(Py_CHARMASK(s[len-1])) || s[len-1] == ' ') @@ -1705,7 +1705,7 @@ retval = POP(); } else if (PyExceptionClass_Check(v) || - PyBytes_Check(v)) { + PyString_Check(v)) { w = POP(); u = POP(); PyErr_Restore(v, w, u); @@ -1869,11 +1869,11 @@ case LOAD_GLOBAL: w = GETITEM(names, oparg); - if (PyBytes_CheckExact(w)) { + if (PyString_CheckExact(w)) { /* Inline the PyDict_GetItem() calls. WARNING: this is an extreme speed hack. Do not try this at home. */ - long hash = ((PyBytesObject *)w)->ob_shash; + long hash = ((PyStringObject *)w)->ob_shash; if (hash != -1) { PyDictObject *d; PyDictEntry *e; @@ -2726,7 +2726,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), defcount ? "at most" : "exactly", co->co_argcount, kwcount ? "non-keyword " : "", @@ -2756,10 +2756,10 @@ PyObject *keyword = kws[2*i]; PyObject *value = kws[2*i + 1]; int j; - if (keyword == NULL || !PyBytes_Check(keyword)) { + if (keyword == NULL || !PyString_Check(keyword)) { PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", - PyBytes_AsString(co->co_name)); + PyString_AsString(co->co_name)); goto fail; } /* XXX slow -- speed up using dictionary? */ @@ -2781,8 +2781,8 @@ PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected " "keyword argument '%.400s'", - PyBytes_AsString(co->co_name), - PyBytes_AsString(keyword)); + PyString_AsString(co->co_name), + PyString_AsString(keyword)); goto fail; } PyDict_SetItem(kwdict, keyword, value); @@ -2793,8 +2793,8 @@ "%.200s() got multiple " "values for keyword " "argument '%.400s'", - PyBytes_AsString(co->co_name), - PyBytes_AsString(keyword)); + PyString_AsString(co->co_name), + PyString_AsString(keyword)); goto fail; } Py_INCREF(value); @@ -2808,7 +2808,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), ((co->co_flags & CO_VARARGS) || defcount) ? "at least" : "exactly", @@ -2834,7 +2834,7 @@ if (argcount > 0 || kwcount > 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), argcount + kwcount); goto fail; } @@ -2860,11 +2860,11 @@ list so that we can march over it more efficiently? */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { - cellname = PyBytes_AS_STRING( + cellname = PyString_AS_STRING( PyTuple_GET_ITEM(co->co_cellvars, i)); found = 0; for (j = 0; j < nargs; j++) { - argname = PyBytes_AS_STRING( + argname = PyString_AS_STRING( PyTuple_GET_ITEM(co->co_varnames, j)); if (strcmp(cellname, argname) == 0) { c = PyCell_New(GETLOCAL(j)); @@ -3522,13 +3522,13 @@ if (PyMethod_Check(func)) return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) - return PyBytes_AsString(((PyFunctionObject*)func)->func_name); + return PyString_AsString(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else if (PyClass_Check(func)) - return PyBytes_AsString(((PyClassObject*)func)->cl_name); + return PyString_AsString(((PyClassObject*)func)->cl_name); else if (PyInstance_Check(func)) { - return PyBytes_AsString( + return PyString_AsString( ((PyInstanceObject*)func)->in_class->cl_name); } else { return func->ob_type->tp_name; @@ -3767,7 +3767,7 @@ "for keyword argument '%.200s'", PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), - PyBytes_AsString(key)); + PyString_AsString(key)); Py_DECREF(key); Py_DECREF(value); Py_DECREF(kwdict); @@ -4086,7 +4086,7 @@ length = PyTuple_Size(w); for (i = 0; i < length; i += 1) { PyObject *exc = PyTuple_GET_ITEM(w, i); - if (PyBytes_Check(exc)) { + if (PyString_Check(exc)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4109,7 +4109,7 @@ } } else { - if (PyBytes_Check(w)) { + if (PyString_Check(w)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4149,7 +4149,7 @@ if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, "cannot import name %.230s", - PyBytes_AsString(name)); + PyString_AsString(name)); } return x; } @@ -4191,8 +4191,8 @@ break; } if (skip_leading_underscores && - PyBytes_Check(name) && - PyBytes_AS_STRING(name)[0] == '_') + PyString_Check(name) && + PyString_AS_STRING(name)[0] == '_') { Py_DECREF(name); continue; @@ -4251,12 +4251,12 @@ PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); - if (PyBytes_Check(pvalue)) { + if (PyString_Check(pvalue)) { PyObject *newmsg; - newmsg = PyBytes_FromFormat( + newmsg = PyString_FromFormat( "Error when calling the metaclass bases\n" " %s", - PyBytes_AS_STRING(pvalue)); + PyString_AS_STRING(pvalue)); if (newmsg != NULL) { Py_DECREF(pvalue); pvalue = newmsg; @@ -4297,7 +4297,7 @@ } else if (locals == Py_None) locals = globals; - if (!PyBytes_Check(prog) && + if (!PyString_Check(prog) && !PyUnicode_Check(prog) && !PyCode_Check(prog) && !PyFile_Check(prog)) { @@ -4327,7 +4327,7 @@ } else if (PyFile_Check(prog)) { FILE *fp = PyFile_AsFile(prog); - char *name = PyBytes_AsString(PyFile_Name(prog)); + char *name = PyString_AsString(PyFile_Name(prog)); PyCompilerFlags cf; if (name == NULL) return -1; @@ -4353,7 +4353,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyBytes_AsStringAndSize(prog, &str, NULL)) + if (PyString_AsStringAndSize(prog, &str, NULL)) return -1; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, @@ -4378,7 +4378,7 @@ if (!obj) return; - obj_str = PyBytes_AsString(obj); + obj_str = PyString_AsString(obj); if (!obj_str) return; @@ -4391,8 +4391,8 @@ { /* This function implements 'variable += expr' when both arguments are strings. */ - Py_ssize_t v_len = PyBytes_GET_SIZE(v); - Py_ssize_t w_len = PyBytes_GET_SIZE(w); + Py_ssize_t v_len = PyString_GET_SIZE(v); + Py_ssize_t w_len = PyString_GET_SIZE(w); Py_ssize_t new_len = v_len + w_len; if (new_len < 0) { PyErr_SetString(PyExc_OverflowError, @@ -4441,12 +4441,12 @@ } } - if (v->ob_refcnt == 1 && !PyBytes_CHECK_INTERNED(v)) { + if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) { /* Now we own the last reference to 'v', so we can resize it * in-place. */ - if (_PyBytes_Resize(&v, new_len) != 0) { - /* XXX if _PyBytes_Resize() fails, 'v' has been + if (_PyString_Resize(&v, new_len) != 0) { + /* XXX if _PyString_Resize() fails, 'v' has been * deallocated so it cannot be put back into * 'variable'. The MemoryError is raised when there * is no value in 'variable', which might (very @@ -4455,13 +4455,13 @@ return NULL; } /* copy 'w' into the newly allocated area of 'v' */ - memcpy(PyBytes_AS_STRING(v) + v_len, - PyBytes_AS_STRING(w), w_len); + memcpy(PyString_AS_STRING(v) + v_len, + PyString_AS_STRING(w), w_len); return v; } else { /* When in-place resizing is not an option. */ - PyBytes_Concat(&v, w); + PyString_Concat(&v, w); return v; } } Modified: python/trunk/Python/codecs.c ============================================================================== --- python/trunk/Python/codecs.c (original) +++ python/trunk/Python/codecs.c Mon Jun 9 06:58:54 2008 @@ -61,10 +61,10 @@ return NULL; } - v = PyBytes_FromStringAndSize(NULL, len); + v = PyString_FromStringAndSize(NULL, len); if (v == NULL) return NULL; - p = PyBytes_AS_STRING(v); + p = PyString_AS_STRING(v); for (i = 0; i < len; i++) { register char ch = string[i]; if (ch == ' ') @@ -112,7 +112,7 @@ v = normalizestring(encoding); if (v == NULL) goto onError; - PyBytes_InternInPlace(&v); + PyString_InternInPlace(&v); /* First, try to lookup the name in the registry dictionary */ result = PyDict_GetItem(interp->codec_search_cache, v); @@ -190,7 +190,7 @@ if (errors) { PyObject *v; - v = PyBytes_FromString(errors); + v = PyString_FromString(errors); if (v == NULL) { Py_DECREF(args); return NULL; @@ -451,7 +451,7 @@ if (string != NULL) { PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", - PyBytes_AS_STRING(string)); + PyString_AS_STRING(string)); Py_DECREF(string); } } Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Mon Jun 9 06:58:54 2008 @@ -184,15 +184,15 @@ { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ - const char *p, *name = PyBytes_AsString(ident); + const char *p, *name = PyString_AsString(ident); char *buffer; size_t nlen, plen; - if (privateobj == NULL || !PyBytes_Check(privateobj) || + if (privateobj == NULL || !PyString_Check(privateobj) || name == NULL || name[0] != '_' || name[1] != '_') { Py_INCREF(ident); return ident; } - p = PyBytes_AsString(privateobj); + p = PyString_AsString(privateobj); nlen = strlen(name); /* Don't mangle __id__ or names with dots. @@ -216,11 +216,11 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); - ident = PyBytes_FromStringAndSize(NULL, 1 + nlen + plen); + ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ - buffer = PyBytes_AS_STRING(ident); + buffer = PyString_AS_STRING(ident); buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); @@ -249,7 +249,7 @@ int merged; if (!__doc__) { - __doc__ = PyBytes_InternFromString("__doc__"); + __doc__ = PyString_InternFromString("__doc__"); if (!__doc__) return NULL; } @@ -540,7 +540,7 @@ { char tmpname[256]; PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyBytes_FromString(tmpname); + return PyString_FromString(tmpname); } /* Allocate a new block and return a pointer to it. @@ -1193,7 +1193,7 @@ int addNone = 1; static PyObject *module; if (!module) { - module = PyBytes_InternFromString(""); + module = PyString_InternFromString(""); if (!module) return NULL; } @@ -1245,8 +1245,8 @@ PyOS_snprintf(buf, sizeof(buf), "unknown scope for %.100s in %.100s(%s) in %s\n" "symbols: %s\nlocals: %s\nglobals: %s\n", - PyBytes_AS_STRING(name), - PyBytes_AS_STRING(c->u->u_name), + PyString_AS_STRING(name), + PyString_AS_STRING(c->u->u_name), PyObject_REPR(c->u->u_ste->ste_id), c->c_filename, PyObject_REPR(c->u->u_ste->ste_symbols), @@ -1304,9 +1304,9 @@ printf("lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), - PyBytes_AS_STRING(c->u->u_name), + PyString_AS_STRING(c->u->u_name), reftype, arg, - PyBytes_AS_STRING(co->co_name), + PyString_AS_STRING(co->co_name), PyObject_REPR(co->co_freevars)); Py_FatalError("compiler_make_closure()"); } @@ -1341,7 +1341,7 @@ for (i = 0; i < n; i++) { expr_ty arg = (expr_ty)asdl_seq_GET(args->args, i); if (arg->kind == Tuple_kind) { - PyObject *id = PyBytes_FromFormat(".%d", i); + PyObject *id = PyString_FromFormat(".%d", i); if (id == NULL) { return 0; } @@ -1434,7 +1434,7 @@ Py_XDECREF(c->u->u_private); c->u->u_private = s->v.ClassDef.name; Py_INCREF(c->u->u_private); - str = PyBytes_InternFromString("__name__"); + str = PyString_InternFromString("__name__"); if (!str || !compiler_nameop(c, str, Load)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1442,7 +1442,7 @@ } Py_DECREF(str); - str = PyBytes_InternFromString("__module__"); + str = PyString_InternFromString("__module__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1509,7 +1509,7 @@ assert(e->kind == Lambda_kind); if (!name) { - name = PyBytes_InternFromString(""); + name = PyString_InternFromString(""); if (!name) return 0; } @@ -1899,7 +1899,7 @@ If there is a dot in name, we need to split it and emit a LOAD_ATTR for each name. */ - const char *src = PyBytes_AS_STRING(name); + const char *src = PyString_AS_STRING(name); const char *dot = strchr(src, '.'); if (dot) { /* Consume the base module name to get the first attribute */ @@ -1908,7 +1908,7 @@ /* NB src is only defined when dot != NULL */ PyObject *attr; dot = strchr(src, '.'); - attr = PyBytes_FromStringAndSize(src, + attr = PyString_FromStringAndSize(src, dot ? dot - src : strlen(src)); if (!attr) return -1; @@ -1957,10 +1957,10 @@ } else { identifier tmp = alias->name; - const char *base = PyBytes_AS_STRING(alias->name); + const char *base = PyString_AS_STRING(alias->name); char *dot = strchr(base, '.'); if (dot) - tmp = PyBytes_FromStringAndSize(base, + tmp = PyString_FromStringAndSize(base, dot - base); r = compiler_nameop(c, tmp, Store); if (dot) { @@ -2003,7 +2003,7 @@ } if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyBytes_AS_STRING(s->v.ImportFrom.module), + if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), "__future__")) { Py_DECREF(level); Py_DECREF(names); @@ -2023,7 +2023,7 @@ alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; - if (i == 0 && *PyBytes_AS_STRING(alias->name) == '*') { + if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { assert(n == 1); ADDOP(c, IMPORT_STAR); return 1; @@ -2053,7 +2053,7 @@ if (Py_OptimizeFlag) return 1; if (assertion_error == NULL) { - assertion_error = PyBytes_InternFromString("AssertionError"); + assertion_error = PyString_InternFromString("AssertionError"); if (assertion_error == NULL) return 0; } @@ -2336,7 +2336,7 @@ /* First check for assignment to __debug__. Param? */ if ((ctx == Store || ctx == AugStore || ctx == Del) - && !strcmp(PyBytes_AS_STRING(name), "__debug__")) { + && !strcmp(PyString_AS_STRING(name), "__debug__")) { return compiler_error(c, "can not assign to __debug__"); } @@ -2374,7 +2374,7 @@ } /* XXX Leave assert here, but handle __doc__ and the like better */ - assert(scope || PyBytes_AS_STRING(name)[0] == '_'); + assert(scope || PyString_AS_STRING(name)[0] == '_'); switch (optype) { case OP_DEREF: @@ -2388,7 +2388,7 @@ PyErr_Format(PyExc_SyntaxError, "can not delete variable '%s' referenced " "in nested scope", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); Py_DECREF(mangled); return 0; case Param: @@ -2773,7 +2773,7 @@ 0)))->iter; if (!name) { - name = PyBytes_FromString(""); + name = PyString_FromString(""); if (!name) return 0; } @@ -2822,7 +2822,7 @@ case Name_kind: /* __debug__ is not assignable, so we can optimize * it away in if and while statements */ - if (strcmp(PyBytes_AS_STRING(e->v.Name.id), + if (strcmp(PyString_AS_STRING(e->v.Name.id), "__debug__") == 0) return ! Py_OptimizeFlag; /* fall through */ @@ -2864,12 +2864,12 @@ assert(s->kind == With_kind); if (!enter_attr) { - enter_attr = PyBytes_InternFromString("__enter__"); + enter_attr = PyString_InternFromString("__enter__"); if (!enter_attr) return 0; } if (!exit_attr) { - exit_attr = PyBytes_InternFromString("__exit__"); + exit_attr = PyString_InternFromString("__exit__"); if (!exit_attr) return 0; } @@ -3472,10 +3472,10 @@ { memset(a, 0, sizeof(struct assembler)); a->a_lineno = firstlineno; - a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); + a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); if (!a->a_bytecode) return 0; - a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); + a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; a->a_postorder = (basicblock **)PyObject_Malloc( @@ -3584,17 +3584,17 @@ if (d_bytecode > 255) { int j, nbytes, ncodes = d_bytecode / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyBytes_Resize(&a->a_lnotab, len) < 0) + if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; for (j = 0; j < ncodes; j++) { *lnotab++ = 255; *lnotab++ = 0; @@ -3606,17 +3606,17 @@ if (d_lineno > 255) { int j, nbytes, ncodes = d_lineno / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyBytes_Resize(&a->a_lnotab, len) < 0) + if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; *lnotab++ = d_bytecode; *lnotab++ = 255; d_bytecode = 0; @@ -3628,13 +3628,13 @@ a->a_lnotab_off += ncodes * 2; } - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (a->a_lnotab_off + 2 >= len) { - if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) + if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; a->a_lnotab_off += 2; if (d_bytecode) { @@ -3659,7 +3659,7 @@ assemble_emit(struct assembler *a, struct instr *i) { int size, arg = 0, ext = 0; - Py_ssize_t len = PyBytes_GET_SIZE(a->a_bytecode); + Py_ssize_t len = PyString_GET_SIZE(a->a_bytecode); char *code; size = instrsize(i); @@ -3670,10 +3670,10 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { - if (_PyBytes_Resize(&a->a_bytecode, len * 2) < 0) + if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) return 0; } - code = PyBytes_AS_STRING(a->a_bytecode) + a->a_offset; + code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; a->a_offset += size; if (size == 6) { assert(i->i_hasarg); @@ -3846,7 +3846,7 @@ freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); if (!freevars) goto error; - filename = PyBytes_FromString(c->c_filename); + filename = PyString_FromString(c->c_filename); if (!filename) goto error; @@ -3966,9 +3966,9 @@ goto error; } - if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) + if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) goto error; - if (_PyBytes_Resize(&a.a_bytecode, a.a_offset) < 0) + if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0) goto error; co = makecode(c, &a); Modified: python/trunk/Python/errors.c ============================================================================== --- python/trunk/Python/errors.c (original) +++ python/trunk/Python/errors.c Mon Jun 9 06:58:54 2008 @@ -66,7 +66,7 @@ void PyErr_SetString(PyObject *exception, const char *string) { - PyObject *value = PyBytes_FromString(string); + PyObject *value = PyString_FromString(string); PyErr_SetObject(exception, value); Py_XDECREF(value); } @@ -351,7 +351,7 @@ PyObject * PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); Py_XDECREF(name); return result; @@ -430,7 +430,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, ierr, name); @@ -469,7 +469,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( PyExc_WindowsError, ierr, name); @@ -527,7 +527,7 @@ va_start(vargs); #endif - string = PyBytes_FromFormatV(format, vargs); + string = PyString_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); va_end(vargs); @@ -559,7 +559,7 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyBytes_FromStringAndSize(name, + modulename = PyString_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; @@ -611,7 +611,7 @@ if (moduleName == NULL) PyFile_WriteString("", f); else { - char* modstr = PyBytes_AsString(moduleName); + char* modstr = PyString_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions") != 0) { @@ -665,7 +665,7 @@ Py_DECREF(tmp); } if (filename != NULL) { - tmp = PyBytes_FromString(filename); + tmp = PyString_FromString(filename); if (tmp == NULL) PyErr_Clear(); else { @@ -742,7 +742,7 @@ char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - return PyBytes_FromString(p); + return PyString_FromString(p); } return NULL; } Modified: python/trunk/Python/future.c ============================================================================== --- python/trunk/Python/future.c (original) +++ python/trunk/Python/future.c Mon Jun 9 06:58:54 2008 @@ -20,7 +20,7 @@ names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyBytes_AsString(name->name); + const char *feature = PyString_AsString(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { @@ -59,7 +59,7 @@ static PyObject *future; if (!future) { - future = PyBytes_InternFromString("__future__"); + future = PyString_InternFromString("__future__"); if (!future) return 0; } Modified: python/trunk/Python/getargs.c ============================================================================== --- python/trunk/Python/getargs.c (original) +++ python/trunk/Python/getargs.c Mon Jun 9 06:58:54 2008 @@ -418,7 +418,7 @@ n++; } - if (!PySequence_Check(arg) || PyBytes_Check(arg)) { + if (!PySequence_Check(arg) || PyString_Check(arg)) { levels[0] = 0; PyOS_snprintf(msgbuf, bufsize, toplevel ? "expected %d arguments, not %.50s" : @@ -765,8 +765,8 @@ case 'c': {/* char */ char *p = va_arg(*p_va, char *); - if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1) - *p = PyBytes_AS_STRING(arg)[0]; + if (PyString_Check(arg) && PyString_Size(arg) == 1) + *p = PyString_AS_STRING(arg)[0]; else return converterr("char", arg, msgbuf, bufsize); break; @@ -777,9 +777,9 @@ void **p = (void **)va_arg(*p_va, char **); FETCH_SIZE; - if (PyBytes_Check(arg)) { - *p = PyBytes_AS_STRING(arg); - STORE_SIZE(PyBytes_GET_SIZE(arg)); + if (PyString_Check(arg)) { + *p = PyString_AS_STRING(arg); + STORE_SIZE(PyString_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -787,8 +787,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); - STORE_SIZE(PyBytes_GET_SIZE(uarg)); + *p = PyString_AS_STRING(uarg); + STORE_SIZE(PyString_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -802,20 +802,20 @@ } else { char **p = va_arg(*p_va, char **); - if (PyBytes_Check(arg)) - *p = PyBytes_AS_STRING(arg); + if (PyString_Check(arg)) + *p = PyString_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); + *p = PyString_AS_STRING(uarg); } #endif else return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -831,9 +831,9 @@ *p = 0; STORE_SIZE(0); } - else if (PyBytes_Check(arg)) { - *p = PyBytes_AS_STRING(arg); - STORE_SIZE(PyBytes_GET_SIZE(arg)); + else if (PyString_Check(arg)) { + *p = PyString_AS_STRING(arg); + STORE_SIZE(PyString_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -841,8 +841,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); - STORE_SIZE(PyBytes_GET_SIZE(uarg)); + *p = PyString_AS_STRING(uarg); + STORE_SIZE(PyString_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -858,15 +858,15 @@ if (arg == Py_None) *p = 0; - else if (PyBytes_Check(arg)) - *p = PyBytes_AS_STRING(arg); + else if (PyString_Check(arg)) + *p = PyString_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); + *p = PyString_AS_STRING(uarg); } #endif else @@ -878,11 +878,11 @@ if (arg == Py_None) *q = 0; else - *q = PyBytes_Size(arg); + *q = PyString_Size(arg); format++; } else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) + (Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -923,7 +923,7 @@ arg, msgbuf, bufsize); /* Encode object */ - if (!recode_strings && PyBytes_Check(arg)) { + if (!recode_strings && PyString_Check(arg)) { s = arg; Py_INCREF(s); } @@ -946,7 +946,7 @@ if (s == NULL) return converterr("(encoding failed)", arg, msgbuf, bufsize); - if (!PyBytes_Check(s)) { + if (!PyString_Check(s)) { Py_DECREF(s); return converterr( "(encoder failed to return a string)", @@ -956,7 +956,7 @@ return converterr("string", arg, msgbuf, bufsize); #endif } - size = PyBytes_GET_SIZE(s); + size = PyString_GET_SIZE(s); /* Write output; output is guaranteed to be 0-terminated */ if (*format == '#') { @@ -1013,7 +1013,7 @@ } } memcpy(*buffer, - PyBytes_AS_STRING(s), + PyString_AS_STRING(s), size + 1); STORE_SIZE(size); } else { @@ -1030,7 +1030,7 @@ PyMem_Free()ing it after usage */ - if ((Py_ssize_t)strlen(PyBytes_AS_STRING(s)) + if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) != size) { Py_DECREF(s); return converterr( @@ -1049,7 +1049,7 @@ arg, msgbuf, bufsize); } memcpy(*buffer, - PyBytes_AS_STRING(s), + PyString_AS_STRING(s), size + 1); } Py_DECREF(s); @@ -1083,7 +1083,7 @@ case 'S': { /* string object */ PyObject **p = va_arg(*p_va, PyObject **); - if (PyBytes_Check(arg)) + if (PyString_Check(arg)) *p = arg; else return converterr("string", arg, msgbuf, bufsize); @@ -1473,12 +1473,12 @@ while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; char *ks; - if (!PyBytes_Check(key)) { + if (!PyString_Check(key)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return cleanreturn(0, freelist); } - ks = PyBytes_AsString(key); + ks = PyString_AsString(key); for (i = 0; i < len; i++) { if (!strcmp(ks, kwlist[i])) { match = 1; Modified: python/trunk/Python/import.c ============================================================================== --- python/trunk/Python/import.c (original) +++ python/trunk/Python/import.c Mon Jun 9 06:58:54 2008 @@ -467,8 +467,8 @@ while (PyDict_Next(modules, &pos, &key, &value)) { if (value->ob_refcnt != 1) continue; - if (PyBytes_Check(key) && PyModule_Check(value)) { - name = PyBytes_AS_STRING(key); + if (PyString_Check(key) && PyModule_Check(value)) { + name = PyString_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -486,8 +486,8 @@ /* Next, delete all modules (still skipping __builtin__ and sys) */ pos = 0; while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyBytes_Check(key) && PyModule_Check(value)) { - name = PyBytes_AS_STRING(key); + if (PyString_Check(key) && PyModule_Check(value)) { + name = PyString_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -665,7 +665,7 @@ /* Remember the filename as the __file__ attribute */ v = NULL; if (pathname != NULL) { - v = PyBytes_FromString(pathname); + v = PyString_FromString(pathname); if (v == NULL) PyErr_Clear(); } @@ -1002,7 +1002,7 @@ PySys_WriteStderr("import %s # directory %s\n", name, pathname); d = PyModule_GetDict(m); - file = PyBytes_FromString(pathname); + file = PyString_FromString(pathname); if (file == NULL) goto error; path = Py_BuildValue("[O]", file); @@ -1214,15 +1214,15 @@ Py_DECREF(meta_path); } - if (path != NULL && PyBytes_Check(path)) { + if (path != NULL && PyString_Check(path)) { /* The only type of submodule allowed inside a "frozen" package are other frozen modules or packages. */ - if (PyBytes_Size(path) + 1 + strlen(name) >= (size_t)buflen) { + if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) { PyErr_SetString(PyExc_ImportError, "full frozen module name too long"); return NULL; } - strcpy(buf, PyBytes_AsString(path)); + strcpy(buf, PyString_AsString(path)); strcat(buf, "."); strcat(buf, name); strcpy(name, buf); @@ -1291,14 +1291,14 @@ } else #endif - if (!PyBytes_Check(v)) + if (!PyString_Check(v)) continue; - len = PyBytes_GET_SIZE(v); + len = PyString_GET_SIZE(v); if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyBytes_AS_STRING(v)); + strcpy(buf, PyString_AS_STRING(v)); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */ @@ -1963,7 +1963,7 @@ if (m == NULL) goto err_return; d = PyModule_GetDict(m); - s = PyBytes_InternFromString(name); + s = PyString_InternFromString(name); if (s == NULL) goto err_return; err = PyDict_SetItemString(d, "__path__", s); @@ -1992,7 +1992,7 @@ PyObject *pname; PyObject *result; - pname = PyBytes_FromString(name); + pname = PyString_FromString(name); if (pname == NULL) return NULL; result = PyImport_Import(pname); @@ -2165,17 +2165,17 @@ return Py_None; if (namestr == NULL) { - namestr = PyBytes_InternFromString("__name__"); + namestr = PyString_InternFromString("__name__"); if (namestr == NULL) return NULL; } if (pathstr == NULL) { - pathstr = PyBytes_InternFromString("__path__"); + pathstr = PyString_InternFromString("__path__"); if (pathstr == NULL) return NULL; } if (pkgstr == NULL) { - pkgstr = PyBytes_InternFromString("__package__"); + pkgstr = PyString_InternFromString("__package__"); if (pkgstr == NULL) return NULL; } @@ -2187,12 +2187,12 @@ if ((pkgname != NULL) && (pkgname != Py_None)) { /* __package__ is set, so use it */ Py_ssize_t len; - if (!PyBytes_Check(pkgname)) { + if (!PyString_Check(pkgname)) { PyErr_SetString(PyExc_ValueError, "__package__ set to non-string"); return NULL; } - len = PyBytes_GET_SIZE(pkgname); + len = PyString_GET_SIZE(pkgname); if (len == 0) { if (level > 0) { PyErr_SetString(PyExc_ValueError, @@ -2206,24 +2206,24 @@ "Package name too long"); return NULL; } - strcpy(buf, PyBytes_AS_STRING(pkgname)); + strcpy(buf, PyString_AS_STRING(pkgname)); } else { /* __package__ not set, so figure it out and set it */ modname = PyDict_GetItem(globals, namestr); - if (modname == NULL || !PyBytes_Check(modname)) + if (modname == NULL || !PyString_Check(modname)) return Py_None; modpath = PyDict_GetItem(globals, pathstr); if (modpath != NULL) { /* __path__ is set, so modname is already the package name */ - Py_ssize_t len = PyBytes_GET_SIZE(modname); + Py_ssize_t len = PyString_GET_SIZE(modname); int error; if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long"); return NULL; } - strcpy(buf, PyBytes_AS_STRING(modname)); + strcpy(buf, PyString_AS_STRING(modname)); error = PyDict_SetItem(globals, pkgstr, modname); if (error) { PyErr_SetString(PyExc_ValueError, @@ -2232,7 +2232,7 @@ } } else { /* Normal module, so work out the package name if any */ - char *start = PyBytes_AS_STRING(modname); + char *start = PyString_AS_STRING(modname); char *lastdot = strrchr(start, '.'); size_t len; int error; @@ -2258,7 +2258,7 @@ } strncpy(buf, start, len); buf[len] = '\0'; - pkgname = PyBytes_FromString(buf); + pkgname = PyString_FromString(buf); if (pkgname == NULL) { return NULL; } @@ -2394,13 +2394,13 @@ } return 0; } - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "Item in ``from list'' not a string"); Py_DECREF(item); return 0; } - if (PyBytes_AS_STRING(item)[0] == '*') { + if (PyString_AS_STRING(item)[0] == '*') { PyObject *all; Py_DECREF(item); /* See if the package defines __all__ */ @@ -2419,7 +2419,7 @@ } hasit = PyObject_HasAttr(mod, item); if (!hasit) { - char *subname = PyBytes_AS_STRING(item); + char *subname = PyString_AS_STRING(item); PyObject *submod; char *p; if (buflen + strlen(subname) >= MAXPATHLEN) { @@ -2585,7 +2585,7 @@ subname = name; else { PyObject *parentname, *parent; - parentname = PyBytes_FromStringAndSize(name, (subname-name)); + parentname = PyString_FromStringAndSize(name, (subname-name)); if (parentname == NULL) { imp_modules_reloading_clear(); return NULL; @@ -2594,7 +2594,7 @@ if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - PyBytes_AS_STRING(parentname)); + PyString_AS_STRING(parentname)); Py_DECREF(parentname); imp_modules_reloading_clear(); return NULL; @@ -2639,7 +2639,7 @@ done using whatever import hooks are installed in the current environment, e.g. by "rexec". A dummy list ["__doc__"] is passed as the 4th argument so that - e.g. PyImport_Import(PyBytes_FromString("win32com.client.gencache")) + e.g. PyImport_Import(PyString_FromString("win32com.client.gencache")) will return instead of . */ PyObject * @@ -2655,10 +2655,10 @@ /* Initialize constant string objects */ if (silly_list == NULL) { - import_str = PyBytes_InternFromString("__import__"); + import_str = PyString_InternFromString("__import__"); if (import_str == NULL) return NULL; - builtins_str = PyBytes_InternFromString("__builtins__"); + builtins_str = PyString_InternFromString("__builtins__"); if (builtins_str == NULL) return NULL; silly_list = Py_BuildValue("[s]", "__doc__"); @@ -2726,7 +2726,7 @@ buf[2] = (char) ((pyc_magic >> 16) & 0xff); buf[3] = (char) ((pyc_magic >> 24) & 0xff); - return PyBytes_FromStringAndSize(buf, 4); + return PyString_FromStringAndSize(buf, 4); } static PyObject * Modified: python/trunk/Python/mactoolboxglue.c ============================================================================== --- python/trunk/Python/mactoolboxglue.c (original) +++ python/trunk/Python/mactoolboxglue.c Mon Jun 9 06:58:54 2008 @@ -52,7 +52,7 @@ buf[0] = '\0'; } else { - char *input = PyBytes_AsString(rv); + char *input = PyString_AsString(rv); if (!input) { PyErr_Clear(); buf[0] = '\0'; @@ -125,7 +125,7 @@ if (!rv) goto error; - input = PyBytes_AsString(rv); + input = PyString_AsString(rv); if (!input) goto error; @@ -161,12 +161,12 @@ PyMac_GetOSType(PyObject *v, OSType *pr) { uint32_t tmp; - if (!PyBytes_Check(v) || PyBytes_Size(v) != 4) { + if (!PyString_Check(v) || PyString_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)&tmp, PyBytes_AsString(v), 4); + memcpy((char *)&tmp, PyString_AsString(v), 4); *pr = (OSType)ntohl(tmp); return 1; } @@ -176,7 +176,7 @@ PyMac_BuildOSType(OSType t) { uint32_t tmp = htonl((uint32_t)t); - return PyBytes_FromStringAndSize((char *)&tmp, 4); + return PyString_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -192,13 +192,13 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf) { int len; - if (!PyBytes_Check(v) || (len = PyBytes_Size(v)) > 255) { + if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { PyErr_SetString(PyExc_TypeError, "Str255 arg must be string of at most 255 chars"); return 0; } pbuf[0] = len; - memcpy((char *)(pbuf+1), PyBytes_AsString(v), len); + memcpy((char *)(pbuf+1), PyString_AsString(v), len); return 1; } @@ -210,7 +210,7 @@ PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); return NULL; } - return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); } PyObject * @@ -220,7 +220,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); } Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Mon Jun 9 06:58:54 2008 @@ -64,18 +64,18 @@ Py_ssize_t size, newsize; if (p->str == NULL) return; /* An error already occurred */ - size = PyBytes_Size(p->str); + size = PyString_Size(p->str); newsize = size + size + 1024; if (newsize > 32*1024*1024) { newsize = size + 1024*1024; } - if (_PyBytes_Resize(&p->str, newsize) != 0) { + if (_PyString_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; } else { - p->ptr = PyBytes_AS_STRING((PyBytesObject *)p->str) + size; + p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size; p->end = - PyBytes_AS_STRING((PyBytesObject *)p->str) + newsize; + PyString_AS_STRING((PyStringObject *)p->str) + newsize; *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char); } } @@ -239,8 +239,8 @@ } } #endif - else if (PyBytes_CheckExact(v)) { - if (p->strings && PyBytes_CHECK_INTERNED(v)) { + else if (PyString_CheckExact(v)) { + if (p->strings && PyString_CHECK_INTERNED(v)) { PyObject *o = PyDict_GetItem(p->strings, v); if (o) { long w = PyInt_AsLong(o); @@ -265,7 +265,7 @@ else { w_byte(TYPE_STRING, p); } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > INT_MAX) { /* huge strings are not supported */ p->depth--; @@ -273,7 +273,7 @@ return; } w_long((long)n, p); - w_string(PyBytes_AS_STRING(v), (int)n, p); + w_string(PyString_AS_STRING(v), (int)n, p); } #ifdef Py_USING_UNICODE else if (PyUnicode_CheckExact(v)) { @@ -285,14 +285,14 @@ return; } w_byte(TYPE_UNICODE, p); - n = PyBytes_GET_SIZE(utf8); + n = PyString_GET_SIZE(utf8); if (n > INT_MAX) { p->depth--; p->error = 1; return; } w_long((long)n, p); - w_string(PyBytes_AS_STRING(utf8), (int)n, p); + w_string(PyString_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } #endif @@ -713,12 +713,12 @@ retval = NULL; break; } - v = PyBytes_FromStringAndSize((char *)NULL, n); + v = PyString_FromStringAndSize((char *)NULL, n); if (v == NULL) { retval = NULL; break; } - if (r_string(PyBytes_AS_STRING(v), (int)n, p) != n) { + if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); @@ -726,7 +726,7 @@ break; } if (type == TYPE_INTERNED) { - PyBytes_InternInPlace(&v); + PyString_InternInPlace(&v); if (PyList_Append(p->strings, v) < 0) { retval = NULL; break; @@ -1113,11 +1113,11 @@ { WFILE wf; wf.fp = NULL; - wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); + wf.str = PyString_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; - wf.ptr = PyBytes_AS_STRING((PyBytesObject *)wf.str); - wf.end = wf.ptr + PyBytes_Size(wf.str); + wf.ptr = PyString_AS_STRING((PyStringObject *)wf.str); + wf.end = wf.ptr + PyString_Size(wf.str); wf.error = 0; wf.depth = 0; wf.version = version; @@ -1125,14 +1125,14 @@ w_object(x, &wf); Py_XDECREF(wf.strings); if (wf.str != NULL) { - char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); + char *base = PyString_AS_STRING((PyStringObject *)wf.str); if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, "too much marshall data for a string"); return NULL; } - _PyBytes_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); } if (wf.error) { Py_XDECREF(wf.str); Modified: python/trunk/Python/modsupport.c ============================================================================== --- python/trunk/Python/modsupport.c (original) +++ python/trunk/Python/modsupport.c Mon Jun 9 06:58:54 2008 @@ -65,7 +65,7 @@ return NULL; d = PyModule_GetDict(m); if (methods != NULL) { - n = PyBytes_FromString(name); + n = PyString_FromString(name); if (n == NULL) return NULL; for (ml = methods; ml->ml_name != NULL; ml++) { @@ -92,7 +92,7 @@ Py_DECREF(n); } if (doc != NULL) { - v = PyBytes_FromString(doc); + v = PyString_FromString(doc); if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { Py_XDECREF(v); return NULL; @@ -391,7 +391,7 @@ { char p[1]; p[0] = (char)va_arg(*p_va, int); - return PyBytes_FromStringAndSize(p, 1); + return PyString_FromStringAndSize(p, 1); } case 's': @@ -423,7 +423,7 @@ } n = (Py_ssize_t)m; } - v = PyBytes_FromStringAndSize(str, n); + v = PyString_FromStringAndSize(str, n); } return v; } @@ -633,7 +633,7 @@ int PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) { - PyObject *o = PyBytes_FromString(value); + PyObject *o = PyString_FromString(value); if (!o) return -1; if (PyModule_AddObject(m, name, o) == 0) Modified: python/trunk/Python/peephole.c ============================================================================== --- python/trunk/Python/peephole.c (original) +++ python/trunk/Python/peephole.c Mon Jun 9 06:58:54 2008 @@ -300,15 +300,15 @@ goto exitUnchanged; /* Bypass optimization when the lineno table is too complex */ - assert(PyBytes_Check(lineno_obj)); - lineno = (unsigned char*)PyBytes_AS_STRING(lineno_obj); - tabsiz = PyBytes_GET_SIZE(lineno_obj); + assert(PyString_Check(lineno_obj)); + lineno = (unsigned char*)PyString_AS_STRING(lineno_obj); + tabsiz = PyString_GET_SIZE(lineno_obj); if (memchr(lineno, 255, tabsiz) != NULL) goto exitUnchanged; /* Avoid situations where jump retargeting could overflow */ - assert(PyBytes_Check(code)); - codelen = PyBytes_GET_SIZE(code); + assert(PyString_Check(code)); + codelen = PyString_GET_SIZE(code); if (codelen > 32700) goto exitUnchanged; @@ -317,7 +317,7 @@ if (codestr == NULL) goto exitUnchanged; codestr = (unsigned char *)memcpy(codestr, - PyBytes_AS_STRING(code), codelen); + PyString_AS_STRING(code), codelen); /* Verify that RETURN_VALUE terminates the codestring. This allows the various transformation patterns to look ahead several @@ -382,7 +382,7 @@ case LOAD_NAME: case LOAD_GLOBAL: j = GETARG(codestr, i); - name = PyBytes_AsString(PyTuple_GET_ITEM(names, j)); + name = PyString_AsString(PyTuple_GET_ITEM(names, j)); if (name == NULL || strcmp(name, "None") != 0) continue; for (j=0 ; j < PyList_GET_SIZE(consts) ; j++) { @@ -612,7 +612,7 @@ } assert(h + nops == codelen); - code = PyBytes_FromStringAndSize((char *)codestr, h); + code = PyString_FromStringAndSize((char *)codestr, h); PyMem_Free(addrmap); PyMem_Free(codestr); PyMem_Free(blocks); Modified: python/trunk/Python/pystrtod.c ============================================================================== --- python/trunk/Python/pystrtod.c (original) +++ python/trunk/Python/pystrtod.c Mon Jun 9 06:58:54 2008 @@ -364,7 +364,7 @@ /* At this point, p points just past the right-most character we want to format. We need to add the grouping string for the characters between buffer and p. */ - return _PyBytes_InsertThousandsGrouping(buffer, len, p, + return _PyString_InsertThousandsGrouping(buffer, len, p, buf_size, NULL, 1); } Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Mon Jun 9 06:58:54 2008 @@ -495,7 +495,7 @@ PyTuple_Fini(); PyList_Fini(); PySet_Fini(); - PyBytes_Fini(); + PyString_Fini(); PyByteArray_Fini(); PyInt_Fini(); PyFloat_Fini(); @@ -744,12 +744,12 @@ } v = PySys_GetObject("ps1"); if (v == NULL) { - PySys_SetObject("ps1", v = PyBytes_FromString(">>> ")); + PySys_SetObject("ps1", v = PyString_FromString(">>> ")); Py_XDECREF(v); } v = PySys_GetObject("ps2"); if (v == NULL) { - PySys_SetObject("ps2", v = PyBytes_FromString("... ")); + PySys_SetObject("ps2", v = PyString_FromString("... ")); Py_XDECREF(v); } for (;;) { @@ -796,16 +796,16 @@ v = PyObject_Str(v); if (v == NULL) PyErr_Clear(); - else if (PyBytes_Check(v)) - ps1 = PyBytes_AsString(v); + else if (PyString_Check(v)) + ps1 = PyString_AsString(v); } w = PySys_GetObject("ps2"); if (w != NULL) { w = PyObject_Str(w); if (w == NULL) PyErr_Clear(); - else if (PyBytes_Check(w)) - ps2 = PyBytes_AsString(w); + else if (PyString_Check(w)) + ps2 = PyString_AsString(w); } arena = PyArena_New(); if (arena == NULL) { @@ -898,7 +898,7 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, "__file__") == NULL) { - PyObject *f = PyBytes_FromString(filename); + PyObject *f = PyString_FromString(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, "__file__", f) < 0) { @@ -982,7 +982,7 @@ goto finally; if (v == Py_None) *filename = NULL; - else if (! (*filename = PyBytes_AsString(v))) + else if (! (*filename = PyString_AsString(v))) goto finally; Py_DECREF(v); @@ -1014,7 +1014,7 @@ goto finally; if (v == Py_None) *text = NULL; - else if (! (*text = PyBytes_AsString(v))) + else if (! (*text = PyString_AsString(v))) goto finally; Py_DECREF(v); return 1; @@ -1237,7 +1237,7 @@ if (moduleName == NULL) err = PyFile_WriteString("", f); else { - char* modstr = PyBytes_AsString(moduleName); + char* modstr = PyString_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); @@ -1261,8 +1261,8 @@ */ if (s == NULL) err = -1; - else if (!PyBytes_Check(s) || - PyBytes_GET_SIZE(s) != 0) + else if (!PyString_Check(s) || + PyString_GET_SIZE(s) != 0) err = PyFile_WriteString(": ", f); if (err == 0) err = PyFile_WriteObject(s, f, Py_PRINT_RAW); @@ -1581,7 +1581,7 @@ if (value != NULL) { u = PyObject_Str(value); if (u != NULL) { - msg = PyBytes_AsString(u); + msg = PyString_AsString(u); } } if (msg == NULL) Modified: python/trunk/Python/structmember.c ============================================================================== --- python/trunk/Python/structmember.c (original) +++ python/trunk/Python/structmember.c Mon Jun 9 06:58:54 2008 @@ -16,7 +16,7 @@ if (v != NULL) { for (i = 0; i < n; i++) PyList_SetItem(v, i, - PyBytes_FromString(mlist[i].name)); + PyString_FromString(mlist[i].name)); if (PyErr_Occurred()) { Py_DECREF(v); v = NULL; @@ -103,13 +103,13 @@ v = Py_None; } else - v = PyBytes_FromString(*(char**)addr); + v = PyString_FromString(*(char**)addr); break; case T_STRING_INPLACE: - v = PyBytes_FromString((char*)addr); + v = PyString_FromString((char*)addr); break; case T_CHAR: - v = PyBytes_FromStringAndSize((char*)addr, 1); + v = PyString_FromStringAndSize((char*)addr, 1); break; case T_OBJECT: v = *(PyObject **)addr; @@ -310,8 +310,8 @@ Py_XDECREF(oldv); break; case T_CHAR: - if (PyBytes_Check(v) && PyBytes_Size(v) == 1) { - *(char*)addr = PyBytes_AsString(v)[0]; + if (PyString_Check(v) && PyString_Size(v) == 1) { + *(char*)addr = PyString_AsString(v)[0]; } else { PyErr_BadArgument(); Modified: python/trunk/Python/symtable.c ============================================================================== --- python/trunk/Python/symtable.c (original) +++ python/trunk/Python/symtable.c Mon Jun 9 06:58:54 2008 @@ -87,9 +87,9 @@ PyOS_snprintf(buf, sizeof(buf), "", - PyBytes_AS_STRING(ste->ste_name), + PyString_AS_STRING(ste->ste_name), PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static void @@ -180,7 +180,7 @@ static identifier top = NULL, lambda = NULL, genexpr = NULL; #define GET_IDENTIFIER(VAR) \ - ((VAR) ? (VAR) : ((VAR) = PyBytes_InternFromString(# VAR))) + ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) #define DUPLICATE_ARGUMENT \ "duplicate argument '%s' in function definition" @@ -372,7 +372,7 @@ if (flags & DEF_PARAM) { PyErr_Format(PyExc_SyntaxError, "name '%s' is local and global", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); return 0; } SET_SCOPE(dict, name, GLOBAL_EXPLICIT); @@ -487,19 +487,19 @@ PyOS_snprintf(buf, sizeof(buf), "import * is not allowed in function '%.100s' " "because it is %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; case OPT_BARE_EXEC: PyOS_snprintf(buf, sizeof(buf), "unqualified exec is not allowed in function " "'%.100s' it %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; default: PyOS_snprintf(buf, sizeof(buf), "function '%.100s' uses import * and bare exec, " "which are illegal because it %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; } @@ -800,7 +800,7 @@ if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, - PyBytes_AsString(name)); + PyString_AsString(name)); PyErr_SyntaxLocation(st->st_filename, st->st_cur->ste_lineno); goto error; @@ -914,7 +914,7 @@ PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++st->st_cur->ste_tmpname); - tmp = PyBytes_InternFromString(tmpname); + tmp = PyString_InternFromString(tmpname); if (!tmp) return 0; if (!symtable_add_def(st, tmp, DEF_LOCAL)) @@ -1065,7 +1065,7 @@ asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyBytes_AS_STRING(name); + char *c_name = PyString_AS_STRING(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; @@ -1218,7 +1218,7 @@ static int symtable_implicit_arg(struct symtable *st, int pos) { - PyObject *id = PyBytes_FromFormat(".%d", pos); + PyObject *id = PyString_FromFormat(".%d", pos); if (id == NULL) return 0; if (!symtable_add_def(st, id, DEF_PARAM)) { @@ -1326,10 +1326,10 @@ */ PyObject *store_name; PyObject *name = (a->asname == NULL) ? a->name : a->asname; - const char *base = PyBytes_AS_STRING(name); + const char *base = PyString_AS_STRING(name); char *dot = strchr(base, '.'); if (dot) { - store_name = PyBytes_FromStringAndSize(base, dot - base); + store_name = PyString_FromStringAndSize(base, dot - base); if (!store_name) return 0; } @@ -1337,7 +1337,7 @@ store_name = name; Py_INCREF(store_name); } - if (strcmp(PyBytes_AS_STRING(name), "*")) { + if (strcmp(PyString_AS_STRING(name), "*")) { int r = symtable_add_def(st, store_name, DEF_IMPORT); Py_DECREF(store_name); return r; Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Mon Jun 9 06:58:54 2008 @@ -229,7 +229,7 @@ static PyObject * sys_getdefaultencoding(PyObject *self) { - return PyBytes_FromString(PyUnicode_GetDefaultEncoding()); + return PyString_FromString(PyUnicode_GetDefaultEncoding()); } PyDoc_STRVAR(getdefaultencoding_doc, @@ -261,7 +261,7 @@ sys_getfilesystemencoding(PyObject *self) { if (Py_FileSystemDefaultEncoding) - return PyBytes_FromString(Py_FileSystemDefaultEncoding); + return PyString_FromString(Py_FileSystemDefaultEncoding); Py_INCREF(Py_None); return Py_None; } @@ -290,7 +290,7 @@ int i; for (i = 0; i < 7; ++i) { if (whatstrings[i] == NULL) { - name = PyBytes_InternFromString(whatnames[i]); + name = PyString_InternFromString(whatnames[i]); if (name == NULL) return -1; whatstrings[i] = name; @@ -931,7 +931,7 @@ if (list == NULL) return NULL; for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - PyObject *name = PyBytes_FromString( + PyObject *name = PyString_FromString( PyImport_Inittab[i].name); if (name == NULL) break; @@ -971,7 +971,7 @@ if (warnoptions == NULL) return; } - str = PyBytes_FromString(s); + str = PyString_FromString(s); if (str != NULL) { PyList_Append(warnoptions, str); Py_DECREF(str); @@ -1327,7 +1327,7 @@ Py_XDECREF(syserr); SET_SYS_FROM_STRING("version", - PyBytes_FromString(Py_GetVersion())); + PyString_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyInt_FromLong(PY_VERSION_HEX)); svnversion_init(); @@ -1358,15 +1358,15 @@ SET_SYS_FROM_STRING("api_version", PyInt_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", - PyBytes_FromString(Py_GetCopyright())); + PyString_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", - PyBytes_FromString(Py_GetPlatform())); + PyString_FromString(Py_GetPlatform())); SET_SYS_FROM_STRING("executable", - PyBytes_FromString(Py_GetProgramFullPath())); + PyString_FromString(Py_GetProgramFullPath())); SET_SYS_FROM_STRING("prefix", - PyBytes_FromString(Py_GetPrefix())); + PyString_FromString(Py_GetPrefix())); SET_SYS_FROM_STRING("exec_prefix", - PyBytes_FromString(Py_GetExecPrefix())); + PyString_FromString(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxsize", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("maxint", @@ -1393,13 +1393,13 @@ else value = "little"; SET_SYS_FROM_STRING("byteorder", - PyBytes_FromString(value)); + PyString_FromString(value)); } #ifdef MS_COREDLL SET_SYS_FROM_STRING("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); SET_SYS_FROM_STRING("winver", - PyBytes_FromString(PyWin_DLLVersionString)); + PyString_FromString(PyWin_DLLVersionString)); #endif if (warnoptions == NULL) { warnoptions = PyList_New(0); @@ -1444,7 +1444,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyBytes_FromStringAndSize(path, (Py_ssize_t) (p - path)); + w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; @@ -1489,14 +1489,14 @@ if (i == 0) { char* fn = decc$translate_vms(argv[0]); if ((fn == (char *)0) || fn == (char *)-1) - v = PyBytes_FromString(argv[0]); + v = PyString_FromString(argv[0]); else - v = PyBytes_FromString( + v = PyString_FromString( decc$translate_vms(argv[0])); } else - v = PyBytes_FromString(argv[i]); + v = PyString_FromString(argv[i]); #else - PyObject *v = PyBytes_FromString(argv[i]); + PyObject *v = PyString_FromString(argv[i]); #endif if (v == NULL) { Py_DECREF(av); @@ -1600,7 +1600,7 @@ #endif /* Unix */ } #endif /* All others */ - a = PyBytes_FromStringAndSize(argv0, n); + a = PyString_FromStringAndSize(argv0, n); if (a == NULL) Py_FatalError("no mem for sys.path insertion"); if (PyList_Insert(path, 0, a) < 0) Modified: python/trunk/Python/traceback.c ============================================================================== --- python/trunk/Python/traceback.c (original) +++ python/trunk/Python/traceback.c Mon Jun 9 06:58:54 2008 @@ -155,12 +155,12 @@ PyErr_Clear(); break; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { size_t len; - len = PyBytes_GET_SIZE(v); + len = PyString_GET_SIZE(v); if (len + 1 + taillen >= MAXPATHLEN) continue; /* Too long */ - strcpy(namebuf, PyBytes_AsString(v)); + strcpy(namebuf, PyString_AsString(v)); if (strlen(namebuf) != len) continue; /* v contains '\0' */ if (len > 0 && namebuf[len-1] != SEP) @@ -238,10 +238,10 @@ while (tb != NULL && err == 0) { if (depth <= limit) { err = tb_displayline(f, - PyBytes_AsString( + PyString_AsString( tb->tb_frame->f_code->co_filename), tb->tb_lineno, - PyBytes_AsString(tb->tb_frame->f_code->co_name)); + PyString_AsString(tb->tb_frame->f_code->co_name)); } depth--; tb = tb->tb_next; Modified: python/trunk/RISCOS/Modules/drawfmodule.c ============================================================================== --- python/trunk/RISCOS/Modules/drawfmodule.c (original) +++ python/trunk/RISCOS/Modules/drawfmodule.c Mon Jun 9 06:58:54 2008 @@ -333,7 +333,7 @@ char *dtable; if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyBytes_Size(value); + { int m=PyString_Size(value); if(m<0||!PyInt_Check(key)) return NULL; size+=m+2; } @@ -350,9 +350,9 @@ memset(dtable,0,size-8); n=0; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyBytes_Size(value); + { int m=PyString_Size(value); *dtable=(char)PyInt_AsLong(key); - strcpy(dtable+1,PyBytes_AsString(value)); + strcpy(dtable+1,PyString_AsString(value)); dtable+=m+2; } Py_INCREF(Py_None);return Py_None; @@ -609,8 +609,8 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(2); if (list) - { PyList_SetItem(list, 0, PyBytes_FromString("size")); - PyList_SetItem(list, 1, PyBytes_FromString("start")); + { PyList_SetItem(list, 0, PyString_FromString("size")); + PyList_SetItem(list, 1, PyString_FromString("start")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -659,6 +659,6 @@ { PyObject *m, *d; m = Py_InitModule("drawf", DrawFMethods); d = PyModule_GetDict(m); - DrawFError=PyBytes_FromString("drawf.error"); + DrawFError=PyString_FromString("drawf.error"); PyDict_SetItemString(d,"error",DrawFError); } Modified: python/trunk/RISCOS/Modules/riscosmodule.c ============================================================================== --- python/trunk/RISCOS/Modules/riscosmodule.c (original) +++ python/trunk/RISCOS/Modules/riscosmodule.c Mon Jun 9 06:58:54 2008 @@ -79,9 +79,9 @@ char *buf; e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); if(e) return riscos_oserror(); - obj=PyBytes_FromStringAndSize(NULL,-len); + obj=PyString_FromStringAndSize(NULL,-len); if(obj==NULL) return NULL; - buf=PyBytes_AsString(obj); + buf=PyString_AsString(obj); e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); if(len!=1) return riscos_error("Error expanding path"); if(!e) return obj; @@ -131,7 +131,7 @@ { Py_DECREF(d);return riscos_oserror(); } if(count) - { v=PyBytes_FromString(buf); + { v=PyString_FromString(buf); if(!v) { Py_DECREF(d);return 0;} if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} } @@ -320,7 +320,7 @@ char *name,*value; if(!PyArg_ParseTuple(args,"s:getenv",&name)) return NULL; value=getenv(name); - if(value) return PyBytes_FromString(value); + if(value) return PyString_FromString(value); Py_INCREF(Py_None); return Py_None; } @@ -371,7 +371,7 @@ os_VARTYPE_EXPANDED,&size,(int *)&context,0)) { PyObject *v; value[size]='\0'; - v = PyBytes_FromString(value); + v = PyString_FromString(value); if (v == NULL) continue; PyDict_SetItemString(dict, context, v); Py_DECREF(v); Modified: python/trunk/RISCOS/Modules/swimodule.c ============================================================================== --- python/trunk/RISCOS/Modules/swimodule.c (original) +++ python/trunk/RISCOS/Modules/swimodule.c Mon Jun 9 06:58:54 2008 @@ -66,10 +66,10 @@ b->length=4*size; b->heap=1; if(init) - { if(PyBytes_Check(init)) - { int n=PyBytes_Size(init); + { if(PyString_Check(init)) + { int n=PyString_Size(init); if (n>4*size) n=4*size; - memcpy(b->block,PyBytes_AsString(init),n); + memcpy(b->block,PyString_AsString(init),n); memset((char*)b->block+n,0,4*size-n); } else @@ -113,7 +113,7 @@ { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } - return PyBytes_FromStringAndSize((char*)self->block+s,e-s); + return PyString_FromStringAndSize((char*)self->block+s,e-s); } static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) @@ -125,7 +125,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyString_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) @@ -137,7 +137,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyString_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) @@ -296,9 +296,9 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(3); if (list) - { PyList_SetItem(list, 0, PyBytes_FromString("length")); - PyList_SetItem(list, 1, PyBytes_FromString("start")); - PyList_SetItem(list, 2, PyBytes_FromString("end")); + { PyList_SetItem(list, 0, PyString_FromString("length")); + PyList_SetItem(list, 1, PyString_FromString("start")); + PyList_SetItem(list, 2, PyString_FromString("end")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -402,7 +402,7 @@ for(;*fmt;fmt++) { switch(*fmt) { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; - case 's':v=PyBytes_FromString((char*)(r.r[rno++])); break; + case 's':v=PyString_FromString((char*)(r.r[rno++])); break; case '.':rno++; continue; case '*':v=PyInt_FromLong((long)carry); break; } @@ -421,7 +421,7 @@ if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL; if (l==-1) l = strlen(s); - return PyBytes_FromStringAndSize((char*)s, l); + return PyString_FromStringAndSize((char*)s, l); } static char swi_string__doc__[] = From buildbot at python.org Mon Jun 9 07:03:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 05:03:35 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20080609050336.03BD11E4004@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%203.0/builds/49 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 07:45:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 05:45:15 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080609054515.7B98E1E4005@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1085 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 08:50:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 06:50:50 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080609065051.4B1CA1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/1012 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 9 08:54:45 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 9 Jun 2008 08:54:45 +0200 (CEST) Subject: [Python-checkins] r64050 - in python/trunk: Doc/library/math.rst Lib/test/test_math.py Misc/NEWS Modules/mathmodule.c Message-ID: <20080609065445.A5F171E4004@bag.python.org> Author: raymond.hettinger Date: Mon Jun 9 08:54:45 2008 New Revision: 64050 Log: Issue #2138: Add math.factorial(). Modified: python/trunk/Doc/library/math.rst python/trunk/Lib/test/test_math.py python/trunk/Misc/NEWS python/trunk/Modules/mathmodule.c Modified: python/trunk/Doc/library/math.rst ============================================================================== --- python/trunk/Doc/library/math.rst (original) +++ python/trunk/Doc/library/math.rst Mon Jun 9 08:54:45 2008 @@ -42,6 +42,10 @@ Return the absolute value of *x*. +.. function:: factorial(x) + + Return *x* factorial. Raises :exc:`ValueError` if *x* is not intergral or + is negative. .. function:: floor(x) Modified: python/trunk/Lib/test/test_math.py ============================================================================== --- python/trunk/Lib/test/test_math.py (original) +++ python/trunk/Lib/test/test_math.py Mon Jun 9 08:54:45 2008 @@ -6,6 +6,7 @@ import math import os import sys +import random eps = 1E-05 NAN = float('nan') @@ -277,6 +278,20 @@ self.ftest('fabs(0)', math.fabs(0), 0) self.ftest('fabs(1)', math.fabs(1), 1) + def testFactorial(self): + def fact(n): + result = 1 + for i in range(1, int(n)+1): + result *= i + return result + values = range(10) + [50, 100, 500] + random.shuffle(values) + for x in range(10): + for cast in (int, long, float): + self.assertEqual(math.factorial(cast(x)), fact(x), (x, fact(x), math.factorial(x))) + self.assertRaises(ValueError, math.factorial, -1) + self.assertRaises(ValueError, math.factorial, math.pi) + def testFloor(self): self.assertRaises(TypeError, math.floor) # These types will be int in py3k. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 9 08:54:45 2008 @@ -40,6 +40,8 @@ Extension Modules ----------------- +- Issue #2138: Add factorial() the math module. + - The heapq module does comparisons using LT instead of LE. This makes its implementation match that used by list.sort(). Modified: python/trunk/Modules/mathmodule.c ============================================================================== --- python/trunk/Modules/mathmodule.c (original) +++ python/trunk/Modules/mathmodule.c Mon Jun 9 08:54:45 2008 @@ -512,6 +512,55 @@ Return an accurate floating point sum of values in the iterable.\n\ Assumes IEEE-754 floating point arithmetic."); + +static PyObject * +math_factorial(PyObject *self, PyObject *arg) +{ + long i, x; + PyObject *result, *iobj, *newresult; + + if (PyFloat_Check(arg)) { + double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg); + if (dx != floor(dx)) { + PyErr_SetString(PyExc_ValueError, + "factorial() only accepts integral values"); + return NULL; + } + } + + x = PyInt_AsLong(arg); + if (x == -1 && PyErr_Occurred()) + return NULL; + if (x < 0) { + PyErr_SetString(PyExc_ValueError, + "factorial() not defined for negative values"); + return NULL; + } + + result = (PyObject *)PyInt_FromLong(1); + if (result == NULL) + return NULL; + for (i=1 ; i<=x ; i++) { + iobj = (PyObject *)PyInt_FromLong(i); + if (iobj == NULL) + goto error; + newresult = PyNumber_Multiply(result, iobj); + Py_DECREF(iobj); + if (newresult == NULL) + goto error; + Py_DECREF(result); + result = newresult; + } + return result; + +error: + Py_DECREF(result); + Py_XDECREF(iobj); + return NULL; +} + +PyDoc_STRVAR(math_factorial_doc, "Return n!"); + static PyObject * math_trunc(PyObject *self, PyObject *number) { @@ -949,6 +998,7 @@ {"degrees", math_degrees, METH_O, math_degrees_doc}, {"exp", math_exp, METH_O, math_exp_doc}, {"fabs", math_fabs, METH_O, math_fabs_doc}, + {"factorial", math_factorial, METH_O, math_factorial_doc}, {"floor", math_floor, METH_O, math_floor_doc}, {"fmod", math_fmod, METH_VARARGS, math_fmod_doc}, {"frexp", math_frexp, METH_O, math_frexp_doc}, From buildbot at python.org Mon Jun 9 09:03:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 07:03:59 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080609070359.8F87C1E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/983 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From qgallet at gmail.com Mon Jun 9 09:16:41 2008 From: qgallet at gmail.com (Quentin Gallet-Gilles) Date: Mon, 9 Jun 2008 09:16:41 +0200 Subject: [Python-checkins] r64050 - in python/trunk: Doc/library/math.rst Lib/test/test_math.py Misc/NEWS Modules/mathmodule.c In-Reply-To: <20080609065445.A5F171E4004@bag.python.org> References: <20080609065445.A5F171E4004@bag.python.org> Message-ID: <8b943f2b0806090016x7f2eb506s388559f244433f70@mail.gmail.com> On Mon, Jun 9, 2008 at 8:54 AM, raymond.hettinger < python-checkins at python.org> wrote: > Author: raymond.hettinger > Date: Mon Jun 9 08:54:45 2008 > New Revision: 64050 > > Log: > Issue #2138: Add math.factorial(). > > Modified: > python/trunk/Doc/library/math.rst > python/trunk/Lib/test/test_math.py > python/trunk/Misc/NEWS > python/trunk/Modules/mathmodule.c > > Modified: python/trunk/Doc/library/math.rst > > ============================================================================== > --- python/trunk/Doc/library/math.rst (original) > +++ python/trunk/Doc/library/math.rst Mon Jun 9 08:54:45 2008 > @@ -42,6 +42,10 @@ > > Return the absolute value of *x*. > > +.. function:: factorial(x) > + > + Return *x* factorial. Raises :exc:`ValueError` if *x* is not intergral > or > + is negative. > There's a small typo : intergral -> integral > [snip] Quentin -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Mon Jun 9 10:33:38 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 9 Jun 2008 10:33:38 +0200 (CEST) Subject: [Python-checkins] r64051 - in python/trunk: Doc/library/stdtypes.rst Lib/test/test_set.py Misc/NEWS Objects/setobject.c Message-ID: <20080609083338.150241E4004@bag.python.org> Author: raymond.hettinger Date: Mon Jun 9 10:33:37 2008 New Revision: 64051 Log: Let set.union() and set.update() accept multiple inputs. Modified: python/trunk/Doc/library/stdtypes.rst python/trunk/Lib/test/test_set.py python/trunk/Misc/NEWS python/trunk/Objects/setobject.c Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Mon Jun 9 10:33:37 2008 @@ -1567,11 +1567,14 @@ Test whether the set is a true superset of *other*, that is, ``set >= other and set != other``. - .. method:: union(other) - set | other + .. method:: union(other, ...) + set | other | ... Return a new set with elements from both sets. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: intersection(other) set & other @@ -1628,11 +1631,14 @@ The following table lists operations available for :class:`set` that do not apply to immutable instances of :class:`frozenset`: - .. method:: update(other) - set |= other + .. method:: update(other, ...) + set |= other | ... Update the set, adding elements from *other*. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: intersection_update(other) set &= other Modified: python/trunk/Lib/test/test_set.py ============================================================================== --- python/trunk/Lib/test/test_set.py (original) +++ python/trunk/Lib/test/test_set.py Mon Jun 9 10:33:37 2008 @@ -78,6 +78,7 @@ self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg')) self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc')) self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef')) + self.assertEqual(self.thetype('abcba').union(C('ef'), C('fg')), set('abcefg')) def test_or(self): i = self.s.union(self.otherword) @@ -401,6 +402,12 @@ s = self.thetype('abcba') self.assertEqual(s.update(C(p)), None) self.assertEqual(s, set(q)) + for p in ('cdc', 'efgfe', 'ccb', 'ef', 'abcda'): + q = 'ahi' + for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + s = self.thetype('abcba') + self.assertEqual(s.update(C(p), C(q)), None) + self.assertEqual(s, set(s) | set(p) | set(q)) def test_ior(self): self.s |= set(self.otherword) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 9 10:33:37 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- The set methods, update() and union() now accept multiple arguments. + - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. - New environment variable PYTHONIOENCODING. Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Mon Jun 9 10:33:37 2008 @@ -967,15 +967,20 @@ } static PyObject * -set_update(PySetObject *so, PyObject *other) +set_update(PySetObject *so, PyObject *args) { - if (set_update_internal(so, other) == -1) - return NULL; + Py_ssize_t i; + + for (i=0 ; i Author: raymond.hettinger Date: Mon Jun 9 11:29:17 2008 New Revision: 64052 Log: Address double-rounding scenarios by setting all variables to long doubles. Modified: python/trunk/Modules/mathmodule.c Modified: python/trunk/Modules/mathmodule.c ============================================================================== --- python/trunk/Modules/mathmodule.c (original) +++ python/trunk/Modules/mathmodule.c Mon Jun 9 11:29:17 2008 @@ -324,17 +324,12 @@ Note 3: The itermediate values lo, yr, and hi are declared volatile so aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. - Also, the volatile declaration forces the values to be stored in memory as - regular doubles instead of extended long precision (80-bit) values. This - prevents double rounding because any addition or substraction of two doubles - can be resolved exactly into double-sized hi and lo values. As long as the - hi value gets forced into a double before yr and lo are computed, the extra - bits in downstream extended precision operations (x87 for example) will be - exactly zero and therefore can be losslessly stored back into a double, - thereby preventing double rounding. - Note 4: A similar implementation is in Modules/cmathmodule.c. - Be sure to update both when making changes. + Note 4: Intermediate values and partial sums are declared as long doubles + as a way to eliminate double rounding environments where the operations + are carried-out in extended precision but stored in double precision + variables. In some cases, this doesn't help because the compiler + treats long doubles as doubles (i.e. the MS compiler for Win32 builds). Note 5: The signature of math.sum() differs from __builtin__.sum() because the start argument doesn't make sense in the context of @@ -347,28 +342,28 @@ /* Extend the partials array p[] by doubling its size. */ static int /* non-zero on error */ -_sum_realloc(double **p_ptr, Py_ssize_t n, - double *ps, Py_ssize_t *m_ptr) +_sum_realloc(long double **p_ptr, Py_ssize_t n, + long double *ps, Py_ssize_t *m_ptr) { void *v = NULL; Py_ssize_t m = *m_ptr; - m += m; /* double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { - double *p = *p_ptr; + m += m; /* long double */ + if (n < m && m < (PY_SSIZE_T_MAX / sizeof(long double))) { + long double *p = *p_ptr; if (p == ps) { - v = PyMem_Malloc(sizeof(double) * m); + v = PyMem_Malloc(sizeof(long double) * m); if (v != NULL) - memcpy(v, ps, sizeof(double) * n); + memcpy(v, ps, sizeof(long double) * n); } else - v = PyMem_Realloc(p, sizeof(double) * m); + v = PyMem_Realloc(p, sizeof(long double) * m); } if (v == NULL) { /* size overflow or no memory */ PyErr_SetString(PyExc_MemoryError, "math sum partials"); return 1; } - *p_ptr = (double*) v; + *p_ptr = (long double*) v; *m_ptr = m; return 0; } @@ -408,8 +403,8 @@ { PyObject *item, *iter, *sum = NULL; Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - double x, y, t, ps[NUM_PARTIALS], *p = ps; - volatile double hi, yr, lo; + long double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile long double hi, yr, lo; iter = PyObject_GetIter(seq); if (iter == NULL) @@ -428,7 +423,7 @@ goto _sum_error; break; } - x = PyFloat_AsDouble(item); + x = (long double)PyFloat_AsDouble(item); Py_DECREF(item); if (PyErr_Occurred()) goto _sum_error; @@ -495,7 +490,7 @@ goto _sum_error; } } - sum = PyFloat_FromDouble(hi); + sum = PyFloat_FromDouble((double)hi); _sum_error: PyFPE_END_PROTECT(hi) From buildbot at python.org Mon Jun 9 11:56:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 09:56:22 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080609095623.051251E4004@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/985 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_math ====================================================================== FAIL: testSum (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_math.py", line 770, in testSum (i, m, s.__name__, vals)) AssertionError: test 3 failed: got 1e+308, expected 'OverflowError' for math.sum([1e+308, 1e+308, -1e+308]) make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 11:57:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 09:57:22 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080609095722.9A06A1E4008@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/419 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: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_math ====================================================================== FAIL: testSum (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_math.py", line 770, in testSum (i, m, s.__name__, vals)) AssertionError: test 3 failed: got 1e+308, expected 'OverflowError' for math.sum([1e+308, 1e+308, -1e+308]) make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 12:09:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 10:09:05 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080609100905.57D6F1E4004@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/1548 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: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_math ====================================================================== FAIL: testSum (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_math.py", line 773, in testSum self.assertEqual(math.sum(vals), s) AssertionError: 2e-100 != 1e-100 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 12:17:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 10:17:48 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080609101748.E450D1E4005@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1457 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 12:19:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 10:19:40 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080609101940.DBD961E4004@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/84 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_math ====================================================================== FAIL: testSum (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_math.py", line 770, in testSum (i, m, s.__name__, vals)) AssertionError: test 3 failed: got 1e+308, expected 'OverflowError' for math.sum([1e+308, 1e+308, -1e+308]) sincerely, -The Buildbot From buildbot at python.org Mon Jun 9 12:29:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 09 Jun 2008 10:29:06 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080609102906.35AD41E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3514 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_math ====================================================================== FAIL: testSum (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_math.py", line 773, in testSum self.assertEqual(math.sum(vals), s) AssertionError: 2e-100 != 1e-100 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 9 12:52:57 2008 From: python-checkins at python.org (thomas.lee) Date: Mon, 9 Jun 2008 12:52:57 +0200 (CEST) Subject: [Python-checkins] r64053 - in python/branches/tlee-ast-optimize: Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/library/collections.rst Doc/library/math.rst Doc/library/stdtypes.rst Doc/library/tokenize.rst Include/bytesobject.h Include/object.h Include/py_curses.h Include/pyerrors.h Include/pyport.h Include/pythonrun.h Include/stringobject.h Lib/collections.py Lib/test/test_collections.py Lib/test/test_math.py Lib/test/test_py3kwarn.py Lib/test/test_set.py Mac/Modules/MacOS.c Mac/Modules/Nav.c Mac/Modules/ae/_AEmodule.c Mac/Modules/cf/_CFmodule.c Mac/Modules/cf/pycfbridge.c Mac/Modules/file/_Filemodule.c Mac/Modules/qd/_Qdmodule.c Mac/Modules/qdoffs/_Qdoffsmodule.c Mac/Modules/res/_Resmodule.c Mac/Modules/scrap/_Scrapmodule.c Mac/Modules/snd/_Sndihooks.c Mac/Modules/win/_Winmodule.c Makefile.pre.in Misc/NEWS Modules/_bytesio.c Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_csv.c Modules/_ctypes/_ctypes.c Modules/_ctypes/callbacks.c Modules/_ctypes/callproc.c Modules/_ctypes/cfield.c Modules/_curses_panel.c Modules/_cursesmodule.c Modules/_elementtree.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_heapqmodule.c Modules/_hotshot.c Modules/_json.c Modules/_localemodule.c Modules/_lsprof.c Modules/_sqlite/cache.c Modules/_sqlite/connection.c Modules/_sqlite/connection.h Modules/_sqlite/cursor.c Modules/_sqlite/module.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_sre.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/almodule.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/bsddbmodule.c Modules/bz2module.c Modules/cPickle.c Modules/cStringIO.c Modules/cdmodule.c Modules/cgensupport.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/clmodule.c Modules/datetimemodule.c Modules/dbmmodule.c Modules/dlmodule.c Modules/errnomodule.c Modules/fcntlmodule.c Modules/flmodule.c Modules/fmmodule.c Modules/gcmodule.c Modules/gdbmmodule.c Modules/glmodule.c Modules/grpmodule.c Modules/imageop.c Modules/imgfile.c Modules/itertoolsmodule.c Modules/linuxaudiodev.c Modules/main.c Modules/mathmodule.c Modules/md5module.c Modules/mmapmodule.c Modules/nismodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pwdmodule.c Modules/pyexpat.c Modules/readline.c Modules/selectmodule.c Modules/sha256module.c Modules/sha512module.c Modules/shamodule.c Modules/socketmodule.c Modules/spwdmodule.c Modules/stropmodule.c Modules/sunaudiodev.c Modules/svmodule.c Modules/syslogmodule.c Modules/termios.c Modules/threadmodule.c Modules/timemodule.c Modules/unicodedata.c Modules/zipimport.c Modules/zlibmodule.c Objects/abstract.c Objects/boolobject.c Objects/bufferobject.c Objects/bytes_methods.c Objects/bytesobject.c Objects/cellobject.c Objects/classobject.c Objects/codeobject.c Objects/complexobject.c Objects/descrobject.c Objects/dictobject.c Objects/exceptions.c Objects/fileobject.c Objects/floatobject.c Objects/frameobject.c Objects/funcobject.c Objects/genobject.c Objects/intobject.c Objects/listobject.c Objects/longobject.c Objects/methodobject.c Objects/moduleobject.c Objects/object.c Objects/rangeobject.c Objects/setobject.c Objects/sliceobject.c Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/structseq.c Objects/tupleobject.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c PC/_msi.c PC/_subprocess.c PC/_winreg.c PC/msvcrtmodule.c PC/winsound.c Parser/asdl_c.py Parser/tokenizer.c Python/Python-ast.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/codecs.c Python/compile.c Python/errors.c Python/future.c Python/getargs.c Python/import.c Python/mactoolboxglue.c Python/marshal.c Python/modsupport.c Python/peephole.c Python/pystrtod.c Python/pythonrun.c Python/structmember.c Python/symtable.c Python/sysmodule.c Python/traceback.c RISCOS/Modules/drawfmodule.c RISCOS/Modules/riscosmodule.c RISCOS/Modules/swimodule.c Message-ID: <20080609105257.1FAF61E4004@bag.python.org> Author: thomas.lee Date: Mon Jun 9 12:52:48 2008 New Revision: 64053 Log: Merged revisions 64036-64052 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64036 | georg.brandl | 2008-06-08 18:54:40 +1000 (Sun, 08 Jun 2008) | 2 lines #3028: tokenize passes the physical line. ........ r64037 | georg.brandl | 2008-06-08 18:59:38 +1000 (Sun, 08 Jun 2008) | 2 lines Argh, I read it wrong. Reverted 64036 and added a clarifying remark. ........ r64040 | benjamin.peterson | 2008-06-09 01:45:23 +1000 (Mon, 09 Jun 2008) | 2 lines add an ast_warn helper function to make adding those Py3k warnings easier ........ r64044 | benjamin.peterson | 2008-06-09 08:52:37 +1000 (Mon, 09 Jun 2008) | 2 lines Warn about assigning to Py3k keywords (True and False) ........ r64045 | benjamin.peterson | 2008-06-09 09:00:00 +1000 (Mon, 09 Jun 2008) | 2 lines warn about parameter tuple unpacking ........ r64047 | raymond.hettinger | 2008-06-09 11:28:30 +1000 (Mon, 09 Jun 2008) | 1 line Issue3065: Fixed pickling of named tuples. Added tests. ........ r64048 | gregory.p.smith | 2008-06-09 14:58:54 +1000 (Mon, 09 Jun 2008) | 8 lines This reverts r63675 based on the discussion in this thread: http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread. ........ r64050 | raymond.hettinger | 2008-06-09 16:54:45 +1000 (Mon, 09 Jun 2008) | 1 line Issue #2138: Add math.factorial(). ........ r64051 | raymond.hettinger | 2008-06-09 18:33:37 +1000 (Mon, 09 Jun 2008) | 1 line Let set.union() and set.update() accept multiple inputs. ........ r64052 | raymond.hettinger | 2008-06-09 19:29:17 +1000 (Mon, 09 Jun 2008) | 1 line Address double-rounding scenarios by setting all variables to long doubles. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/includes/noddy2.c python/branches/tlee-ast-optimize/Doc/includes/noddy3.c python/branches/tlee-ast-optimize/Doc/includes/noddy4.c python/branches/tlee-ast-optimize/Doc/includes/run-func.c python/branches/tlee-ast-optimize/Doc/library/collections.rst python/branches/tlee-ast-optimize/Doc/library/math.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/tokenize.rst python/branches/tlee-ast-optimize/Include/bytesobject.h python/branches/tlee-ast-optimize/Include/object.h python/branches/tlee-ast-optimize/Include/py_curses.h python/branches/tlee-ast-optimize/Include/pyerrors.h python/branches/tlee-ast-optimize/Include/pyport.h python/branches/tlee-ast-optimize/Include/pythonrun.h python/branches/tlee-ast-optimize/Include/stringobject.h python/branches/tlee-ast-optimize/Lib/collections.py python/branches/tlee-ast-optimize/Lib/test/test_collections.py python/branches/tlee-ast-optimize/Lib/test/test_math.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_set.py python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c python/branches/tlee-ast-optimize/Mac/Modules/Nav.c python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c python/branches/tlee-ast-optimize/Makefile.pre.in python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_bytesio.c python/branches/tlee-ast-optimize/Modules/_codecsmodule.c python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c python/branches/tlee-ast-optimize/Modules/_csv.c python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c python/branches/tlee-ast-optimize/Modules/_curses_panel.c python/branches/tlee-ast-optimize/Modules/_cursesmodule.c python/branches/tlee-ast-optimize/Modules/_elementtree.c python/branches/tlee-ast-optimize/Modules/_fileio.c python/branches/tlee-ast-optimize/Modules/_hashopenssl.c python/branches/tlee-ast-optimize/Modules/_heapqmodule.c python/branches/tlee-ast-optimize/Modules/_hotshot.c python/branches/tlee-ast-optimize/Modules/_json.c python/branches/tlee-ast-optimize/Modules/_localemodule.c python/branches/tlee-ast-optimize/Modules/_lsprof.c python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c python/branches/tlee-ast-optimize/Modules/_sqlite/module.c python/branches/tlee-ast-optimize/Modules/_sqlite/row.c python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c python/branches/tlee-ast-optimize/Modules/_sre.c python/branches/tlee-ast-optimize/Modules/_ssl.c python/branches/tlee-ast-optimize/Modules/_struct.c python/branches/tlee-ast-optimize/Modules/_testcapimodule.c python/branches/tlee-ast-optimize/Modules/_tkinter.c python/branches/tlee-ast-optimize/Modules/almodule.c python/branches/tlee-ast-optimize/Modules/arraymodule.c python/branches/tlee-ast-optimize/Modules/audioop.c python/branches/tlee-ast-optimize/Modules/binascii.c python/branches/tlee-ast-optimize/Modules/bsddbmodule.c python/branches/tlee-ast-optimize/Modules/bz2module.c python/branches/tlee-ast-optimize/Modules/cPickle.c python/branches/tlee-ast-optimize/Modules/cStringIO.c python/branches/tlee-ast-optimize/Modules/cdmodule.c python/branches/tlee-ast-optimize/Modules/cgensupport.c python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c python/branches/tlee-ast-optimize/Modules/clmodule.c python/branches/tlee-ast-optimize/Modules/datetimemodule.c python/branches/tlee-ast-optimize/Modules/dbmmodule.c python/branches/tlee-ast-optimize/Modules/dlmodule.c python/branches/tlee-ast-optimize/Modules/errnomodule.c python/branches/tlee-ast-optimize/Modules/fcntlmodule.c python/branches/tlee-ast-optimize/Modules/flmodule.c python/branches/tlee-ast-optimize/Modules/fmmodule.c python/branches/tlee-ast-optimize/Modules/gcmodule.c python/branches/tlee-ast-optimize/Modules/gdbmmodule.c python/branches/tlee-ast-optimize/Modules/glmodule.c python/branches/tlee-ast-optimize/Modules/grpmodule.c python/branches/tlee-ast-optimize/Modules/imageop.c python/branches/tlee-ast-optimize/Modules/imgfile.c python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c python/branches/tlee-ast-optimize/Modules/main.c python/branches/tlee-ast-optimize/Modules/mathmodule.c python/branches/tlee-ast-optimize/Modules/md5module.c python/branches/tlee-ast-optimize/Modules/mmapmodule.c python/branches/tlee-ast-optimize/Modules/nismodule.c python/branches/tlee-ast-optimize/Modules/operator.c python/branches/tlee-ast-optimize/Modules/ossaudiodev.c python/branches/tlee-ast-optimize/Modules/parsermodule.c python/branches/tlee-ast-optimize/Modules/posixmodule.c python/branches/tlee-ast-optimize/Modules/pwdmodule.c python/branches/tlee-ast-optimize/Modules/pyexpat.c python/branches/tlee-ast-optimize/Modules/readline.c python/branches/tlee-ast-optimize/Modules/selectmodule.c python/branches/tlee-ast-optimize/Modules/sha256module.c python/branches/tlee-ast-optimize/Modules/sha512module.c python/branches/tlee-ast-optimize/Modules/shamodule.c python/branches/tlee-ast-optimize/Modules/socketmodule.c python/branches/tlee-ast-optimize/Modules/spwdmodule.c python/branches/tlee-ast-optimize/Modules/stropmodule.c python/branches/tlee-ast-optimize/Modules/sunaudiodev.c python/branches/tlee-ast-optimize/Modules/svmodule.c python/branches/tlee-ast-optimize/Modules/syslogmodule.c python/branches/tlee-ast-optimize/Modules/termios.c python/branches/tlee-ast-optimize/Modules/threadmodule.c python/branches/tlee-ast-optimize/Modules/timemodule.c python/branches/tlee-ast-optimize/Modules/unicodedata.c python/branches/tlee-ast-optimize/Modules/zipimport.c python/branches/tlee-ast-optimize/Modules/zlibmodule.c python/branches/tlee-ast-optimize/Objects/abstract.c python/branches/tlee-ast-optimize/Objects/boolobject.c python/branches/tlee-ast-optimize/Objects/bufferobject.c python/branches/tlee-ast-optimize/Objects/bytes_methods.c python/branches/tlee-ast-optimize/Objects/bytesobject.c python/branches/tlee-ast-optimize/Objects/cellobject.c python/branches/tlee-ast-optimize/Objects/classobject.c python/branches/tlee-ast-optimize/Objects/codeobject.c python/branches/tlee-ast-optimize/Objects/complexobject.c python/branches/tlee-ast-optimize/Objects/descrobject.c python/branches/tlee-ast-optimize/Objects/dictobject.c python/branches/tlee-ast-optimize/Objects/exceptions.c python/branches/tlee-ast-optimize/Objects/fileobject.c python/branches/tlee-ast-optimize/Objects/floatobject.c python/branches/tlee-ast-optimize/Objects/frameobject.c python/branches/tlee-ast-optimize/Objects/funcobject.c python/branches/tlee-ast-optimize/Objects/genobject.c python/branches/tlee-ast-optimize/Objects/intobject.c python/branches/tlee-ast-optimize/Objects/listobject.c python/branches/tlee-ast-optimize/Objects/longobject.c python/branches/tlee-ast-optimize/Objects/methodobject.c python/branches/tlee-ast-optimize/Objects/moduleobject.c python/branches/tlee-ast-optimize/Objects/object.c python/branches/tlee-ast-optimize/Objects/rangeobject.c python/branches/tlee-ast-optimize/Objects/setobject.c python/branches/tlee-ast-optimize/Objects/sliceobject.c python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h python/branches/tlee-ast-optimize/Objects/structseq.c python/branches/tlee-ast-optimize/Objects/tupleobject.c python/branches/tlee-ast-optimize/Objects/typeobject.c python/branches/tlee-ast-optimize/Objects/unicodeobject.c python/branches/tlee-ast-optimize/Objects/weakrefobject.c python/branches/tlee-ast-optimize/PC/_msi.c python/branches/tlee-ast-optimize/PC/_subprocess.c python/branches/tlee-ast-optimize/PC/_winreg.c python/branches/tlee-ast-optimize/PC/msvcrtmodule.c python/branches/tlee-ast-optimize/PC/winsound.c python/branches/tlee-ast-optimize/Parser/asdl_c.py python/branches/tlee-ast-optimize/Parser/tokenizer.c python/branches/tlee-ast-optimize/Python/Python-ast.c python/branches/tlee-ast-optimize/Python/_warnings.c python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/ceval.c python/branches/tlee-ast-optimize/Python/codecs.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Python/errors.c python/branches/tlee-ast-optimize/Python/future.c python/branches/tlee-ast-optimize/Python/getargs.c python/branches/tlee-ast-optimize/Python/import.c python/branches/tlee-ast-optimize/Python/mactoolboxglue.c python/branches/tlee-ast-optimize/Python/marshal.c python/branches/tlee-ast-optimize/Python/modsupport.c python/branches/tlee-ast-optimize/Python/peephole.c python/branches/tlee-ast-optimize/Python/pystrtod.c python/branches/tlee-ast-optimize/Python/pythonrun.c python/branches/tlee-ast-optimize/Python/structmember.c python/branches/tlee-ast-optimize/Python/symtable.c python/branches/tlee-ast-optimize/Python/sysmodule.c python/branches/tlee-ast-optimize/Python/traceback.c python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy2.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy2.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy2.c Mon Jun 9 12:52:48 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -90,7 +90,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -109,7 +109,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy3.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy3.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy3.c Mon Jun 9 12:52:48 2008 @@ -23,14 +23,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -93,7 +93,7 @@ return -1; } - if (! PyBytes_Check(value)) { + if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The first attribute value must be a string"); return -1; @@ -121,7 +121,7 @@ return -1; } - if (! PyBytes_Check(value)) { + if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The last attribute value must be a string"); return -1; @@ -153,7 +153,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -162,7 +162,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/noddy4.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/noddy4.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/noddy4.c Mon Jun 9 12:52:48 2008 @@ -57,14 +57,14 @@ self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyBytes_FromString(""); + self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyBytes_FromString(""); + self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); @@ -124,7 +124,7 @@ PyObject *args, *result; if (format == NULL) { - format = PyBytes_FromString("%s %s"); + format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } @@ -143,7 +143,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; Modified: python/branches/tlee-ast-optimize/Doc/includes/run-func.c ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/run-func.c (original) +++ python/branches/tlee-ast-optimize/Doc/includes/run-func.c Mon Jun 9 12:52:48 2008 @@ -13,7 +13,7 @@ } Py_Initialize(); - pName = PyBytes_FromString(argv[1]); + pName = PyString_FromString(argv[1]); /* Error checking of pName left out */ pModule = PyImport_Import(pName); Modified: python/branches/tlee-ast-optimize/Doc/library/collections.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/collections.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/collections.rst Mon Jun 9 12:52:48 2008 @@ -539,6 +539,9 @@ if kwds: raise ValueError('Got unexpected field names: %r' % kwds.keys()) return result + + def __getnewargs__(self): + return tuple(self) x = property(itemgetter(0)) y = property(itemgetter(1)) Modified: python/branches/tlee-ast-optimize/Doc/library/math.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/math.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/math.rst Mon Jun 9 12:52:48 2008 @@ -42,6 +42,10 @@ Return the absolute value of *x*. +.. function:: factorial(x) + + Return *x* factorial. Raises :exc:`ValueError` if *x* is not intergral or + is negative. .. function:: floor(x) Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Mon Jun 9 12:52:48 2008 @@ -1567,11 +1567,14 @@ Test whether the set is a true superset of *other*, that is, ``set >= other and set != other``. - .. method:: union(other) - set | other + .. method:: union(other, ...) + set | other | ... Return a new set with elements from both sets. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: intersection(other) set & other @@ -1628,11 +1631,14 @@ The following table lists operations available for :class:`set` that do not apply to immutable instances of :class:`frozenset`: - .. method:: update(other) - set |= other + .. method:: update(other, ...) + set |= other | ... Update the set, adding elements from *other*. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: intersection_update(other) set &= other Modified: python/branches/tlee-ast-optimize/Doc/library/tokenize.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/tokenize.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/tokenize.rst Mon Jun 9 12:52:48 2008 @@ -15,21 +15,20 @@ The primary entry point is a :term:`generator`: - .. function:: generate_tokens(readline) - The :func:`generate_tokens` generator requires one argument, *readline*, which - must be a callable object which provides the same interface as the + The :func:`generate_tokens` generator requires one argument, *readline*, + which must be a callable object which provides the same interface as the :meth:`readline` method of built-in file objects (see section - :ref:`bltin-file-objects`). Each call to the function should return one line of - input as a string. + :ref:`bltin-file-objects`). Each call to the function should return one line + of input as a string. The generator produces 5-tuples with these members: the token type; the token - string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column where - the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints specifying - the row and column where the token ends in the source; and the line on which the - token was found. The line passed is the *logical* line; continuation lines are - included. + string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column + where the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints + specifying the row and column where the token ends in the source; and the + line on which the token was found. The line passed (the last tuple item) is + the *logical* line; continuation lines are included. .. versionadded:: 2.2 Modified: python/branches/tlee-ast-optimize/Include/bytesobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/bytesobject.h (original) +++ python/branches/tlee-ast-optimize/Include/bytesobject.h Mon Jun 9 12:52:48 2008 @@ -1,5 +1,5 @@ -/* Bytes (String) object interface */ +/* String (Bytes) object interface */ #ifndef Py_BYTESOBJECT_H #define Py_BYTESOBJECT_H @@ -10,7 +10,7 @@ #include /* -Type PyBytesObject represents a character string. An extra zero byte is +Type PyStringObject represents a character string. An extra zero byte is reserved at the end to ensure it is zero-terminated, but a size is present so strings with null bytes in them can be represented. This is an immutable object type. @@ -46,61 +46,61 @@ * 'interned' dictionary; in this case the two references * from 'interned' to this object are *not counted* in ob_refcnt. */ -} PyBytesObject; +} PyStringObject; #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 #define SSTATE_INTERNED_IMMORTAL 2 PyAPI_DATA(PyTypeObject) PyBaseString_Type; -PyAPI_DATA(PyTypeObject) PyBytes_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; -#define PyBytes_Check(op) \ +#define PyString_Check(op) \ PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) -PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); -PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) Py_GCC_ATTRIBUTE((format(printf, 1, 0))); -PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); -PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); -PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); -PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *); -PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *); -PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(int) _PyBytes_Eq(PyObject *, PyObject*); -PyAPI_FUNC(PyObject *) PyBytes_Format(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyBytes_FormatLong(PyObject*, int, int, +PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, int, char**, int*); -PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, +PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); -PyAPI_FUNC(void) PyBytes_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyBytes_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyBytes_InternFromString(const char *); +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); /* Use only if you know it's a string */ -#define PyBytes_CHECK_INTERNED(op) (((PyBytesObject *)(op))->ob_sstate) +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) /* Macro, trading safety for speed */ -#define PyBytes_AS_STRING(op) (((PyBytesObject *)(op))->ob_sval) -#define PyBytes_GET_SIZE(op) Py_SIZE(op) +#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) +#define PyString_GET_SIZE(op) Py_SIZE(op) -/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, +/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, x must be an iterable object. */ -PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); /* --- Generic Codecs ----------------------------------------------------- */ /* Create an object by decoding the encoded string s of the given size. */ -PyAPI_FUNC(PyObject*) PyBytes_Decode( +PyAPI_FUNC(PyObject*) PyString_Decode( const char *s, /* encoded string */ Py_ssize_t size, /* size of buffer */ const char *encoding, /* encoding */ @@ -110,7 +110,7 @@ /* Encodes a char buffer of the given size and returns a Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_Encode( +PyAPI_FUNC(PyObject*) PyString_Encode( const char *s, /* string char buffer */ Py_ssize_t size, /* number of chars to encode */ const char *encoding, /* encoding */ @@ -120,7 +120,7 @@ /* Encodes a string object and returns the result as Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_AsEncodedObject( +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -132,9 +132,9 @@ If the codec returns an Unicode object, the object is converted back to a string using the default encoding. - DEPRECATED - use PyBytes_AsEncodedObject() instead. */ + DEPRECATED - use PyString_AsEncodedObject() instead. */ -PyAPI_FUNC(PyObject*) PyBytes_AsEncodedString( +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -143,7 +143,7 @@ /* Decodes a string object and returns the result as Python object. */ -PyAPI_FUNC(PyObject*) PyBytes_AsDecodedObject( +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -155,9 +155,9 @@ If the codec returns an Unicode object, the object is converted back to a string using the default encoding. - DEPRECATED - use PyBytes_AsDecodedObject() instead. */ + DEPRECATED - use PyString_AsDecodedObject() instead. */ -PyAPI_FUNC(PyObject*) PyBytes_AsDecodedString( +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ const char *errors /* error handling */ @@ -169,7 +169,7 @@ 0-terminated (passing a string with embedded NULL characters will cause an exception). */ -PyAPI_FUNC(int) PyBytes_AsStringAndSize( +PyAPI_FUNC(int) PyString_AsStringAndSize( register PyObject *obj, /* string or Unicode object */ register char **s, /* pointer to buffer variable */ register Py_ssize_t *len /* pointer to length variable or NULL @@ -181,7 +181,7 @@ into the string pointed to by buffer. For the argument descriptions, see Objects/stringlib/localeutil.h */ -PyAPI_FUNC(int) _PyBytes_InsertThousandsGrouping(char *buffer, +PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, Py_ssize_t len, char *plast, Py_ssize_t buf_size, Modified: python/branches/tlee-ast-optimize/Include/object.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/object.h (original) +++ python/branches/tlee-ast-optimize/Include/object.h Mon Jun 9 12:52:48 2008 @@ -504,7 +504,7 @@ PyAPI_FUNC(long) _Py_HashPointer(void*); /* Helper for passing objects to printf and the like */ -#define PyObject_REPR(obj) PyBytes_AS_STRING(PyObject_Repr(obj)) +#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) /* Flag bits for printing: */ #define Py_PRINT_RAW 1 /* No string quotes etc. */ @@ -598,7 +598,7 @@ #define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) #define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) #define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) -#define Py_TPFLAGS_BYTES_SUBCLASS (1L<<27) +#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) #define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) #define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) Modified: python/branches/tlee-ast-optimize/Include/py_curses.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/py_curses.h (original) +++ python/branches/tlee-ast-optimize/Include/py_curses.h Mon Jun 9 12:52:48 2008 @@ -146,7 +146,7 @@ static PyObject *PyCurses_ ## X (PyObject *self) \ { \ PyCursesInitialised \ - return PyBytes_FromString(X()); } + return PyString_FromString(X()); } #define NoArgTrueFalseFunction(X) \ static PyObject *PyCurses_ ## X (PyObject *self) \ Modified: python/branches/tlee-ast-optimize/Include/pyerrors.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pyerrors.h (original) +++ python/branches/tlee-ast-optimize/Include/pyerrors.h Mon Jun 9 12:52:48 2008 @@ -104,7 +104,7 @@ #define PyExceptionClass_Name(x) \ (PyClass_Check((x)) \ - ? PyBytes_AS_STRING(((PyClassObject*)(x))->cl_name) \ + ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ : (char *)(((PyTypeObject*)(x))->tp_name)) #define PyExceptionInstance_Class(x) \ Modified: python/branches/tlee-ast-optimize/Include/pyport.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pyport.h (original) +++ python/branches/tlee-ast-optimize/Include/pyport.h Mon Jun 9 12:52:48 2008 @@ -135,9 +135,9 @@ * all platforms (Python interprets the format string itself, and does whatever * the platform C requires to convert a size_t/Py_ssize_t argument): * - * PyBytes_FromFormat + * PyString_FromFormat * PyErr_Format - * PyBytes_FromFormatV + * PyString_FromFormatV * * Lower-level uses require that you interpolate the correct format modifier * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for Modified: python/branches/tlee-ast-optimize/Include/pythonrun.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pythonrun.h (original) +++ python/branches/tlee-ast-optimize/Include/pythonrun.h Mon Jun 9 12:52:48 2008 @@ -137,7 +137,7 @@ PyAPI_FUNC(void) PyTuple_Fini(void); PyAPI_FUNC(void) PyList_Fini(void); PyAPI_FUNC(void) PySet_Fini(void); -PyAPI_FUNC(void) PyBytes_Fini(void); +PyAPI_FUNC(void) PyString_Fini(void); PyAPI_FUNC(void) PyInt_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); Modified: python/branches/tlee-ast-optimize/Include/stringobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/stringobject.h (original) +++ python/branches/tlee-ast-optimize/Include/stringobject.h Mon Jun 9 12:52:48 2008 @@ -1,13 +1,12 @@ #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type -#define PyString_Check PyBytes_Check -#define PyString_CheckExact PyBytes_CheckExact -#define PyString_CHECK_INTERNED PyBytes_CHECK_INTERNED -#define PyString_AS_STRING PyBytes_AS_STRING -#define PyString_GET_SIZE PyBytes_GET_SIZE - -#define Py_TPFLAGS_STRING_SUBCLASS Py_TPFLAGS_BYTES_SUBCLASS +#define PyBytes_Check PyString_Check +#define PyBytes_CheckExact PyString_CheckExact +#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromString PyString_FromString @@ -23,9 +22,6 @@ #define PyBytes_Format PyString_Format #define _PyBytes_FormatLong _PyString_FormatLong #define PyBytes_DecodeEscape PyString_DecodeEscape -#define PyBytes_InternInPlace PyString_InternInPlace -#define PyBytes_InternImmortal PyString_InternImmortal -#define PyBytes_InternFromString PyString_InternFromString #define _PyBytes_Join _PyString_Join #define PyBytes_Decode PyString_Decode #define PyBytes_Encode PyString_Encode Modified: python/branches/tlee-ast-optimize/Lib/collections.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/collections.py (original) +++ python/branches/tlee-ast-optimize/Lib/collections.py Mon Jun 9 12:52:48 2008 @@ -82,7 +82,9 @@ result = self._make(map(kwds.pop, %(field_names)r, self)) if kwds: raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) - return result \n\n''' % locals() + return result \n + def __getnewargs__(self): + return tuple(self) \n\n''' % locals() for i, name in enumerate(field_names): template += ' %s = property(itemgetter(%d))\n' % (name, i) if verbose: Modified: python/branches/tlee-ast-optimize/Lib/test/test_collections.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_collections.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_collections.py Mon Jun 9 12:52:48 2008 @@ -1,12 +1,14 @@ import unittest, doctest from test import test_support from collections import namedtuple +import pickle, cPickle, copy from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable from collections import Set, MutableSet from collections import Mapping, MutableMapping from collections import Sequence, MutableSequence +TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests class TestNamedTuple(unittest.TestCase): @@ -108,7 +110,7 @@ self.assertEqual(Dot(1)._replace(d=999), (999,)) self.assertEqual(Dot(1)._fields, ('d',)) - n = 10000 + n = 5000 import string, random names = list(set(''.join([random.choice(string.ascii_letters) for j in range(10)]) for i in range(n))) @@ -130,6 +132,23 @@ self.assertEqual(b2, tuple(b2_expected)) self.assertEqual(b._fields, tuple(names)) + def test_pickle(self): + p = TestNT(x=10, y=20, z=30) + for module in pickle, cPickle: + loads = getattr(module, 'loads') + dumps = getattr(module, 'dumps') + for protocol in -1, 0, 1, 2: + q = loads(dumps(p, protocol)) + self.assertEqual(p, q) + self.assertEqual(p._fields, q._fields) + + def test_copy(self): + p = TestNT(x=10, y=20, z=30) + for copier in copy.copy, copy.deepcopy: + q = copier(p) + self.assertEqual(p, q) + self.assertEqual(p._fields, q._fields) + class TestOneTrickPonyABCs(unittest.TestCase): def test_Hashable(self): Modified: python/branches/tlee-ast-optimize/Lib/test/test_math.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_math.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_math.py Mon Jun 9 12:52:48 2008 @@ -6,6 +6,7 @@ import math import os import sys +import random eps = 1E-05 NAN = float('nan') @@ -277,6 +278,20 @@ self.ftest('fabs(0)', math.fabs(0), 0) self.ftest('fabs(1)', math.fabs(1), 1) + def testFactorial(self): + def fact(n): + result = 1 + for i in range(1, int(n)+1): + result *= i + return result + values = range(10) + [50, 100, 500] + random.shuffle(values) + for x in range(10): + for cast in (int, long, float): + self.assertEqual(math.factorial(cast(x)), fact(x), (x, fact(x), math.factorial(x))) + self.assertRaises(ValueError, math.factorial, -1) + self.assertRaises(ValueError, math.factorial, math.pi) + def testFloor(self): self.assertRaises(TypeError, math.floor) # These types will be int in py3k. Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py Mon Jun 9 12:52:48 2008 @@ -16,6 +16,55 @@ exec "`2`" in {} self.assertWarning(None, w, expected) + def test_bool_assign(self): + # So we don't screw up our globals + def safe_exec(expr): + def f(**kwargs): pass + exec expr in {'f' : f} + + expected = "assignment to True or False is forbidden in 3.x" + with catch_warning() as w: + safe_exec("True = False") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("False = True") + self.assertWarning(None, w, expected) + with catch_warning() as w: + try: + safe_exec("obj.False = True") + except NameError: pass + self.assertWarning(None, w, expected) + with catch_warning() as w: + try: + safe_exec("obj.True = False") + except NameError: pass + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def False(): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def True(): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("class False: pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("class True: pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def f(True=43): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("def f(False=None): pass") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("f(False=True)") + self.assertWarning(None, w, expected) + with catch_warning() as w: + safe_exec("f(True=1)") + self.assertWarning(None, w, expected) + + def test_type_inequality_comparisons(self): expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: @@ -124,6 +173,12 @@ with catch_warning() as w: self.assertWarning(set(), w, expected) + def test_tuple_parameter_unpacking(self): + expected = "tuple parameter unpacking has been removed in 3.x" + with catch_warning() as w: + exec "def f((a, b)): pass" + self.assertWarning(None, w, expected) + def test_buffer(self): expected = 'buffer() not supported in 3.x; use memoryview()' with catch_warning() as w: Modified: python/branches/tlee-ast-optimize/Lib/test/test_set.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_set.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_set.py Mon Jun 9 12:52:48 2008 @@ -78,6 +78,7 @@ self.assertEqual(self.thetype('abcba').union(C('efgfe')), set('abcefg')) self.assertEqual(self.thetype('abcba').union(C('ccb')), set('abc')) self.assertEqual(self.thetype('abcba').union(C('ef')), set('abcef')) + self.assertEqual(self.thetype('abcba').union(C('ef'), C('fg')), set('abcefg')) def test_or(self): i = self.s.union(self.otherword) @@ -401,6 +402,12 @@ s = self.thetype('abcba') self.assertEqual(s.update(C(p)), None) self.assertEqual(s, set(q)) + for p in ('cdc', 'efgfe', 'ccb', 'ef', 'abcda'): + q = 'ahi' + for C in set, frozenset, dict.fromkeys, str, unicode, list, tuple: + s = self.thetype('abcba') + self.assertEqual(s.update(C(p), C(q)), None) + self.assertEqual(s, set(s) | set(p) | set(q)) def test_ior(self): self.s |= set(self.otherword) Modified: python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/MacOS.c Mon Jun 9 12:52:48 2008 @@ -706,7 +706,7 @@ ** some of the image and sound processing interfaces on the mac:-( */ { - PyBytesObject *p = 0; + PyStringObject *p = 0; long off = (long)&(p->ob_sval[0]); if( PyDict_SetItemString(d, "string_id_to_buffer", Py_BuildValue("i", off)) != 0) Modified: python/branches/tlee-ast-optimize/Mac/Modules/Nav.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/Nav.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/Nav.c Mon Jun 9 12:52:48 2008 @@ -139,11 +139,11 @@ NavGetDefaultDialogOptions(opt); while ( PyDict_Next(d, &pos, &key, &value) ) { - if ( !key || !value || !PyBytes_Check(key) ) { + if ( !key || !value || !PyString_Check(key) ) { PyErr_SetString(ErrorObject, "DialogOption has non-string key"); return 0; } - keystr = PyBytes_AsString(key); + keystr = PyString_AsString(key); if( strcmp(keystr, "defaultLocation") == 0 ) { if ( (defaultLocation_storage = PyMem_NEW(AEDesc, 1)) == NULL ) { PyErr_NoMemory(); @@ -963,7 +963,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyBytes_FromString("Nav.error"); + ErrorObject = PyString_FromString("Nav.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/ae/_AEmodule.c Mon Jun 9 12:52:48 2008 @@ -840,9 +840,9 @@ OSErr err; size = AEGetDescDataSize(&self->ob_itself); - if ( (res = PyBytes_FromStringAndSize(NULL, size)) == NULL ) + if ( (res = PyString_FromStringAndSize(NULL, size)) == NULL ) return NULL; - if ( (ptr = PyBytes_AsString(res)) == NULL ) + if ( (ptr = PyString_AsString(res)) == NULL ) return NULL; if ( (err=AEGetDescData(&self->ob_itself, ptr, size)) < 0 ) return PyMac_Error(err); Modified: python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cf/_CFmodule.c Mon Jun 9 12:52:48 2008 @@ -392,7 +392,7 @@ { char buf[100]; sprintf(buf, "", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFTypeRefObj_hash(CFTypeRefObject *self) @@ -596,7 +596,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFArrayRefObj_hash(CFArrayRefObject *self) @@ -836,7 +836,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self) @@ -1029,7 +1029,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self) @@ -1206,7 +1206,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self) @@ -1327,10 +1327,10 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; Py_ssize_t cLen; - if( PyBytes_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; + if( PyString_AsStringAndSize(v, &cStr, &cLen) < 0 ) return 0; *p_itself = CFDataCreate((CFAllocatorRef)NULL, (unsigned char *)cStr, cLen); return 1; } @@ -1405,7 +1405,7 @@ int size = CFDataGetLength(_self->ob_itself); char *data = (char *)CFDataGetBytePtr(_self->ob_itself); - _res = (PyObject *)PyBytes_FromStringAndSize(data, size); + _res = (PyObject *)PyString_FromStringAndSize(data, size); return _res; } @@ -1437,7 +1437,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFDataRefObj_hash(CFDataRefObject *self) @@ -1702,7 +1702,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self) @@ -1823,7 +1823,7 @@ { if (v == Py_None) { *p_itself = NULL; return 1; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { char *cStr; if (!PyArg_Parse(v, "es", "ascii", &cStr)) return 0; @@ -2344,7 +2344,7 @@ if( data == NULL ) return PyErr_NoMemory(); if ( CFStringGetCString(_self->ob_itself, data, size, 0) ) { - _res = (PyObject *)PyBytes_FromString(data); + _res = (PyObject *)PyString_FromString(data); } else { PyErr_SetString(PyExc_RuntimeError, "CFStringGetCString could not fit the string"); _res = NULL; @@ -2445,7 +2445,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFStringRefObj_hash(CFStringRefObject *self) @@ -2833,7 +2833,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self) @@ -3485,7 +3485,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int CFURLRefObj_hash(CFURLRefObject *self) Modified: python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/cf/pycfbridge.c Mon Jun 9 12:52:48 2008 @@ -146,7 +146,7 @@ int PyCF_Python2CF(PyObject *src, CFTypeRef *dst) { - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_simple(src, dst); if (PySequence_Check(src)) return PyCF_Python2CF_sequence(src, (CFArrayRef *)dst); @@ -249,7 +249,7 @@ return (*dst != NULL); } #endif - if (PyBytes_Check(src) || PyUnicode_Check(src)) + if (PyString_Check(src) || PyUnicode_Check(src)) return PyCF_Python2CF_string(src, (CFStringRef *)dst); if (PyBool_Check(src)) { if (src == Py_True) @@ -281,7 +281,7 @@ CFIndex size; UniChar *unichars; - if (PyBytes_Check(src)) { + if (PyString_Check(src)) { if (!PyArg_Parse(src, "es", "ascii", &chars)) return 0; /* This error is more descriptive than the general one below */ *dst = CFStringCreateWithCString((CFAllocatorRef)NULL, chars, kCFStringEncodingASCII); Modified: python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/file/_Filemodule.c Mon Jun 9 12:52:48 2008 @@ -961,7 +961,7 @@ size = GetHandleSize((Handle)self->ob_itself); HLock((Handle)self->ob_itself); - rv = PyBytes_FromStringAndSize(*(Handle)self->ob_itself, size); + rv = PyString_FromStringAndSize(*(Handle)self->ob_itself, size); HUnlock((Handle)self->ob_itself); return rv; @@ -1362,7 +1362,7 @@ PyMac_Error(err); return NULL; } - _res = PyBytes_FromString(strbuf); + _res = PyString_FromString(strbuf); return _res; } @@ -1419,7 +1419,7 @@ static PyObject *FSSpec_get_data(FSSpecObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSSpec_set_data NULL @@ -1440,7 +1440,7 @@ self->ob_itself.vRefNum, self->ob_itself.parID, self->ob_itself.name[0], self->ob_itself.name+1); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #define FSSpec_hash NULL @@ -2015,7 +2015,7 @@ static PyObject *FSRef_get_data(FSRefObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); + return PyString_FromStringAndSize((char *)&self->ob_itself, sizeof(self->ob_itself)); } #define FSRef_set_data NULL @@ -3131,7 +3131,7 @@ if (!PyArg_ParseTuple(_args, "O", &obj)) return NULL; - if (PyBytes_Check(obj)) { + if (PyString_Check(obj)) { Py_INCREF(obj); return obj; } @@ -3301,7 +3301,7 @@ } /* On OSX we now try a pathname */ - if ( PyBytes_Check(v) || PyUnicode_Check(v)) { + if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) return 0; Modified: python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qd/_Qdmodule.c Mon Jun 9 12:52:48 2008 @@ -1458,7 +1458,7 @@ if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - _res = PyBytes_FromStringAndSize(cp, length); + _res = PyString_FromStringAndSize(cp, length); return _res; } @@ -1511,14 +1511,14 @@ static PyObject *BMObj_get_bitmap_data(BitMapObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); + return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(BitMap)); } #define BMObj_set_bitmap_data NULL static PyObject *BMObj_get_pixmap_data(BitMapObject *self, void *closure) { - return PyBytes_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); + return PyString_FromStringAndSize((char *)self->ob_itself, sizeof(PixMap)); } #define BMObj_set_pixmap_data NULL @@ -6501,10 +6501,10 @@ int rowbytes; char *data; - if ( !PyArg_ParseTuple(_args, "O!iO&", &PyBytes_Type, &source, &rowbytes, PyMac_GetRect, + if ( !PyArg_ParseTuple(_args, "O!iO&", &PyString_Type, &source, &rowbytes, PyMac_GetRect, &bounds) ) return NULL; - data = PyBytes_AsString(source); + data = PyString_AsString(source); if ((ptr=(BitMap *)malloc(sizeof(BitMap))) == NULL ) return PyErr_NoMemory(); ptr->baseAddr = (Ptr)data; @@ -6528,15 +6528,15 @@ BitMap *ptr; PyObject *source; - if ( !PyArg_ParseTuple(_args, "O!", &PyBytes_Type, &source) ) + if ( !PyArg_ParseTuple(_args, "O!", &PyString_Type, &source) ) return NULL; - if ( PyBytes_Size(source) != sizeof(BitMap) && PyBytes_Size(source) != sizeof(PixMap) ) { + if ( PyString_Size(source) != sizeof(BitMap) && PyString_Size(source) != sizeof(PixMap) ) { PyErr_Format(PyExc_TypeError, "Argument size was %ld, should be %lu (sizeof BitMap) or %lu (sizeof PixMap)", - PyBytes_Size(source), sizeof(BitMap), sizeof(PixMap)); + PyString_Size(source), sizeof(BitMap), sizeof(PixMap)); return NULL; } - ptr = (BitMapPtr)PyBytes_AsString(source); + ptr = (BitMapPtr)PyString_AsString(source); if ( (_res = BMObj_New(ptr)) == NULL ) { return NULL; } Modified: python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/qdoffs/_Qdoffsmodule.c Mon Jun 9 12:52:48 2008 @@ -609,7 +609,7 @@ if ( !PyArg_ParseTuple(_args, "O&ii", ResObj_Convert, &pm, &from, &length) ) return NULL; cp = GetPixBaseAddr(pm)+from; - _res = PyBytes_FromStringAndSize(cp, length); + _res = PyString_FromStringAndSize(cp, length); return _res; } Modified: python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/res/_Resmodule.c Mon Jun 9 12:52:48 2008 @@ -523,7 +523,7 @@ state = HGetState(self->ob_itself); HLock(self->ob_itself); - res = PyBytes_FromStringAndSize( + res = PyString_FromStringAndSize( *self->ob_itself, GetHandleSize(self->ob_itself)); HUnlock(self->ob_itself); @@ -540,10 +540,10 @@ if ( v == NULL ) return -1; - if ( !PyBytes_Check(v) ) + if ( !PyString_Check(v) ) return -1; - size = PyBytes_Size(v); - data = PyBytes_AsString(v); + size = PyString_Size(v); + data = PyString_AsString(v); /* XXXX Do I need the GetState/SetState calls? */ SetHandleSize(self->ob_itself, size); if ( MemError()) Modified: python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/scrap/_Scrapmodule.c Mon Jun 9 12:52:48 2008 @@ -106,12 +106,12 @@ flavorType, &byteCount); if (_err != noErr) return PyMac_Error(_err); - _res = PyBytes_FromStringAndSize(NULL, (int)byteCount); + _res = PyString_FromStringAndSize(NULL, (int)byteCount); if ( _res == NULL ) return NULL; _err = GetScrapFlavorData(_self->ob_itself, flavorType, &byteCount, - PyBytes_AS_STRING(_res)); + PyString_AS_STRING(_res)); if (_err != noErr) { Py_XDECREF(_res); return PyMac_Error(_err); Modified: python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/snd/_Sndihooks.c Mon Jun 9 12:52:48 2008 @@ -500,7 +500,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - ErrorObject = PyBytes_FromString("Sndihooks.error"); + ErrorObject = PyString_FromString("Sndihooks.error"); PyDict_SetItemString(d, "error", ErrorObject); /* XXXX Add constants here */ Modified: python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c (original) +++ python/branches/tlee-ast-optimize/Mac/Modules/win/_Winmodule.c Mon Jun 9 12:52:48 2008 @@ -2580,7 +2580,7 @@ { char buf[100]; sprintf(buf, "", (unsigned)self, (unsigned)self->ob_itself); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int WinObj_hash(WindowObject *self) Modified: python/branches/tlee-ast-optimize/Makefile.pre.in ============================================================================== --- python/branches/tlee-ast-optimize/Makefile.pre.in (original) +++ python/branches/tlee-ast-optimize/Makefile.pre.in Mon Jun 9 12:52:48 2008 @@ -585,7 +585,6 @@ Include/bitset.h \ Include/boolobject.h \ Include/bytes_methods.h \ - Include/bytearrayobject.h \ Include/bytesobject.h \ Include/bufferobject.h \ Include/cellobject.h \ Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Mon Jun 9 12:52:48 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- The set methods, update() and union() now accept multiple arguments. + - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. - New environment variable PYTHONIOENCODING. @@ -40,6 +42,8 @@ Extension Modules ----------------- +- Issue #2138: Add factorial() the math module. + - The heapq module does comparisons using LT instead of LE. This makes its implementation match that used by list.sort(). Modified: python/branches/tlee-ast-optimize/Modules/_bytesio.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_bytesio.c (original) +++ python/branches/tlee-ast-optimize/Modules/_bytesio.c Mon Jun 9 12:52:48 2008 @@ -175,7 +175,7 @@ bytesio_getvalue(BytesIOObject *self) { CHECK_CLOSED(self); - return PyBytes_FromStringAndSize(self->buf, self->string_size); + return PyString_FromStringAndSize(self->buf, self->string_size); } PyDoc_STRVAR(isatty_doc, @@ -244,7 +244,7 @@ output = self->buf + self->pos; self->pos += size; - return PyBytes_FromStringAndSize(output, size); + return PyString_FromStringAndSize(output, size); } @@ -307,7 +307,7 @@ self->pos -= size; } - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(readlines_doc, @@ -349,7 +349,7 @@ return NULL; while ((n = get_line(self, &output)) != 0) { - line = PyBytes_FromStringAndSize(output, n); + line = PyString_FromStringAndSize(output, n); if (!line) goto on_error; if (PyList_Append(result, line) == -1) { @@ -455,7 +455,7 @@ if (!next || n == 0) return NULL; - return PyBytes_FromStringAndSize(next, n); + return PyString_FromStringAndSize(next, n); } PyDoc_STRVAR(seek_doc, Modified: python/branches/tlee-ast-optimize/Modules/_codecsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_codecsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_codecsmodule.c Mon Jun 9 12:52:48 2008 @@ -168,7 +168,7 @@ if (!PyArg_ParseTuple(args, "s#|z:escape_decode", &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL), + return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), size); } @@ -182,21 +182,21 @@ Py_ssize_t len; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyBytes_Type, &str, &errors)) + &PyString_Type, &str, &errors)) return NULL; - str = PyBytes_Repr(str, 0); + str = PyString_Repr(str, 0); if (!str) return NULL; /* The string will be quoted. Unquote, similar to unicode-escape. */ - buf = PyBytes_AS_STRING (str); - len = PyBytes_GET_SIZE (str); + buf = PyString_AS_STRING (str); + len = PyString_GET_SIZE (str); memmove(buf, buf+1, len-2); - if (_PyBytes_Resize(&str, len-2) < 0) + if (_PyString_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyBytes_Size(str)); + return codec_tuple(str, PyString_Size(str)); } #ifdef Py_USING_UNICODE @@ -640,7 +640,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -656,7 +656,7 @@ &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -676,13 +676,13 @@ if (PyUnicode_Check(obj)) { data = PyUnicode_AS_DATA(obj); size = PyUnicode_GET_DATA_SIZE(obj); - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } } Modified: python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c Mon Jun 9 12:52:48 2008 @@ -668,7 +668,7 @@ if (i != 0) { if (i < 0) return NULL; - return PyBytes_FromString("[...]"); + return PyString_FromString("[...]"); } aslist = PySequence_List(deque); @@ -677,16 +677,16 @@ return NULL; } if (((dequeobject *)deque)->maxlen != -1) - fmt = PyBytes_FromFormat("deque(%%r, maxlen=%i)", + fmt = PyString_FromFormat("deque(%%r, maxlen=%i)", ((dequeobject *)deque)->maxlen); else - fmt = PyBytes_FromString("deque(%r)"); + fmt = PyString_FromString("deque(%r)"); if (fmt == NULL) { Py_DECREF(aslist); Py_ReprLeave(deque); return NULL; } - result = PyBytes_Format(fmt, aslist); + result = PyString_Format(fmt, aslist); Py_DECREF(fmt); Py_DECREF(aslist); Py_ReprLeave(deque); @@ -1298,14 +1298,14 @@ if (baserepr == NULL) return NULL; if (dd->default_factory == NULL) - defrepr = PyBytes_FromString("None"); + defrepr = PyString_FromString("None"); else { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { if (status < 0) return NULL; - defrepr = PyBytes_FromString("..."); + defrepr = PyString_FromString("..."); } else defrepr = PyObject_Repr(dd->default_factory); @@ -1315,9 +1315,9 @@ Py_DECREF(baserepr); return NULL; } - result = PyBytes_FromFormat("defaultdict(%s, %s)", - PyBytes_AS_STRING(defrepr), - PyBytes_AS_STRING(baserepr)); + result = PyString_FromFormat("defaultdict(%s, %s)", + PyString_AS_STRING(defrepr), + PyString_AS_STRING(baserepr)); Py_DECREF(defrepr); Py_DECREF(baserepr); return result; Modified: python/branches/tlee-ast-optimize/Modules/_csv.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_csv.c (original) +++ python/branches/tlee-ast-optimize/Modules/_csv.c Mon Jun 9 12:52:48 2008 @@ -176,7 +176,7 @@ return Py_None; } else - return PyBytes_FromStringAndSize((char*)&c, 1); + return PyString_FromStringAndSize((char*)&c, 1); } static PyObject * @@ -235,16 +235,16 @@ if (src == NULL) *target = dflt; else { - if (src == Py_None || PyBytes_Size(src) == 0) + if (src == Py_None || PyString_Size(src) == 0) *target = '\0'; - else if (!PyBytes_Check(src) || PyBytes_Size(src) != 1) { + else if (!PyString_Check(src) || PyString_Size(src) != 1) { PyErr_Format(PyExc_TypeError, "\"%s\" must be an 1-character string", name); return -1; } else { - char *s = PyBytes_AsString(src); + char *s = PyString_AsString(src); if (s == NULL) return -1; *target = s[0]; @@ -257,7 +257,7 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) { if (src == NULL) - *target = PyBytes_FromString(dflt); + *target = PyString_FromString(dflt); else { if (src == Py_None) *target = NULL; @@ -528,7 +528,7 @@ { PyObject *field; - field = PyBytes_FromStringAndSize(self->field, self->field_len); + field = PyString_FromStringAndSize(self->field, self->field_len); if (field == NULL) return -1; self->field_len = 0; @@ -787,8 +787,8 @@ } ++self->line_num; - line = PyBytes_AsString(lineobj); - linelen = PyBytes_Size(lineobj); + line = PyString_AsString(lineobj); + linelen = PyString_Size(lineobj); if (line == NULL || linelen < 0) { Py_DECREF(lineobj); @@ -976,7 +976,7 @@ rec_len++;\ } while(0) - lineterm = PyBytes_AsString(dialect->lineterminator); + lineterm = PyString_AsString(dialect->lineterminator); if (lineterm == NULL) return -1; @@ -1101,7 +1101,7 @@ int terminator_len; char *terminator; - terminator_len = PyBytes_Size(self->dialect->lineterminator); + terminator_len = PyString_Size(self->dialect->lineterminator); if (terminator_len == -1) return 0; @@ -1109,7 +1109,7 @@ if (!join_check_rec_size(self, self->rec_len + terminator_len)) return 0; - terminator = PyBytes_AsString(self->dialect->lineterminator); + terminator = PyString_AsString(self->dialect->lineterminator); if (terminator == NULL) return 0; memmove(self->rec + self->rec_len, terminator, terminator_len); @@ -1161,9 +1161,9 @@ break; } - if (PyBytes_Check(field)) { + if (PyString_Check(field)) { append_ok = join_append(self, - PyBytes_AS_STRING(field), + PyString_AS_STRING(field), "ed, len == 1); Py_DECREF(field); } @@ -1179,7 +1179,7 @@ if (str == NULL) return NULL; - append_ok = join_append(self, PyBytes_AS_STRING(str), + append_ok = join_append(self, PyString_AS_STRING(str), "ed, len == 1); Py_DECREF(str); } Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/_ctypes.c Mon Jun 9 12:52:48 2008 @@ -714,8 +714,8 @@ if (-1 == PyType_Type.tp_setattro(self, key, value)) return -1; - if (value && PyBytes_Check(key) && - 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) + if (value && PyString_Check(key) && + 0 == strcmp(PyString_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 1); return 0; } @@ -728,8 +728,8 @@ if (-1 == PyObject_GenericSetAttr(self, key, value)) return -1; - if (PyBytes_Check(key) && - 0 == strcmp(PyBytes_AS_STRING(key), "_fields_")) + if (PyString_Check(key) && + 0 == strcmp(PyString_AS_STRING(key), "_fields_")) return StructUnionType_update_stgdict(self, value, 0); return 0; } @@ -1065,7 +1065,7 @@ size = Py_TYPE(value)->tp_as_buffer->bf_getreadbuffer(value, 0, (void *)&ptr); if (size < 0) return -1; - } else if (-1 == PyBytes_AsStringAndSize(value, &ptr, &size)) { + } else if (-1 == PyString_AsStringAndSize(value, &ptr, &size)) { return -1; } if (size > self->b_size) { @@ -1082,7 +1082,7 @@ static PyObject * CharArray_get_raw(CDataObject *self) { - return PyBytes_FromStringAndSize(self->b_ptr, self->b_size); + return PyString_FromStringAndSize(self->b_ptr, self->b_size); } static PyObject * @@ -1093,7 +1093,7 @@ for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') break; - return PyBytes_FromStringAndSize(self->b_ptr, i); + return PyString_FromStringAndSize(self->b_ptr, i); } static int @@ -1114,14 +1114,14 @@ conversion_mode_errors); if (!value) return -1; - } else if (!PyBytes_Check(value)) { + } else if (!PyString_Check(value)) { PyErr_Format(PyExc_TypeError, "string expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else Py_INCREF(value); - size = PyBytes_GET_SIZE(value); + size = PyString_GET_SIZE(value); if (size > self->b_size) { PyErr_SetString(PyExc_ValueError, "string too long"); @@ -1129,7 +1129,7 @@ return -1; } - ptr = PyBytes_AS_STRING(value); + ptr = PyString_AS_STRING(value); memcpy(self->b_ptr, ptr, size); if (size < self->b_size) self->b_ptr[size] = '\0'; @@ -1168,7 +1168,7 @@ "can't delete attribute"); return -1; } - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1465,7 +1465,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyUnicode_Check(value) || PyBytes_Check(value)) { + if (PyUnicode_Check(value) || PyString_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("Z"); @@ -1529,7 +1529,7 @@ Py_INCREF(Py_None); return Py_None; } - if (PyBytes_Check(value) || PyUnicode_Check(value)) { + if (PyString_Check(value) || PyUnicode_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1615,7 +1615,7 @@ return (PyObject *)parg; } /* string */ - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { PyCArgObject *parg; struct fielddesc *fd = getentry("z"); @@ -1686,10 +1686,10 @@ } /* c_char_p, c_wchar_p */ stgd = PyObject_stgdict(value); - if (stgd && CDataObject_Check(value) && stgd->proto && PyBytes_Check(stgd->proto)) { + if (stgd && CDataObject_Check(value) && stgd->proto && PyString_Check(stgd->proto)) { PyCArgObject *parg; - switch (PyBytes_AS_STRING(stgd->proto)[0]) { + switch (PyString_AS_STRING(stgd->proto)[0]) { case 'z': /* c_char_p */ case 'Z': /* c_wchar_p */ parg = new_CArgObject(); @@ -1746,13 +1746,13 @@ if (suffix == NULL) #ifdef WORDS_BIGENDIAN - suffix = PyBytes_InternFromString("_le"); + suffix = PyString_InternFromString("_le"); #else - suffix = PyBytes_InternFromString("_be"); + suffix = PyString_InternFromString("_be"); #endif Py_INCREF(name); - PyBytes_Concat(&name, suffix); + PyString_Concat(&name, suffix); if (name == NULL) return NULL; @@ -1807,7 +1807,7 @@ dict = PyObject_stgdict((PyObject *)self); assert(dict); /* Cannot be NULL for CDataObject instances */ - fmt = PyBytes_AsString(dict->proto); + fmt = PyString_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -1872,12 +1872,12 @@ SIMPLE_TYPE_CHARS); goto error; } - fmt = getentry(PyBytes_AS_STRING(proto)); + fmt = getentry(PyString_AS_STRING(proto)); if (fmt == NULL) { Py_DECREF(result); PyErr_Format(PyExc_ValueError, "_type_ '%s' not supported", - PyBytes_AS_STRING(proto)); + PyString_AS_STRING(proto)); return NULL; } @@ -1927,7 +1927,7 @@ Overrides the SimpleType_from_param generic method. */ if (result->tp_base == &Simple_Type) { - switch (PyBytes_AS_STRING(proto)[0]) { + switch (PyString_AS_STRING(proto)[0]) { case 'z': /* c_char_p */ ml = &c_char_p_method; stgdict->flags |= TYPEFLAG_ISPOINTER; @@ -2042,7 +2042,7 @@ assert(dict); /* I think we can rely on this being a one-character string */ - fmt = PyBytes_AsString(dict->proto); + fmt = PyString_AsString(dict->proto); assert(fmt); fd = getentry(fmt); @@ -2399,7 +2399,7 @@ #endif target = target->b_base; } - return PyBytes_FromStringAndSize(string, cp-string); + return PyString_FromStringAndSize(string, cp-string); } /* @@ -2571,7 +2571,7 @@ _unpickle, Py_TYPE(_self), PyObject_GetAttrString(_self, "__dict__"), - PyBytes_FromStringAndSize(self->b_ptr, self->b_size)); + PyString_FromStringAndSize(self->b_ptr, self->b_size)); } static PyObject * @@ -3120,9 +3120,9 @@ dict = PyType_stgdict(arg); if (dict /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ - && PyBytes_Check(dict->proto) + && PyString_Check(dict->proto) /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */ - && (strchr("PzZ", PyBytes_AS_STRING(dict->proto)[0]))) { + && (strchr("PzZ", PyString_AS_STRING(dict->proto)[0]))) { return 1; } @@ -3207,8 +3207,8 @@ return 1; } #endif - if (PyBytes_Check(obj) || PyUnicode_Check(obj)) { - *pname = PyBytes_AsString(obj); + if (PyString_Check(obj) || PyUnicode_Check(obj)) { + *pname = PyString_AsString(obj); return *pname ? 1 : 0; } PyErr_SetString(PyExc_TypeError, @@ -3558,7 +3558,7 @@ /* We HAVE already checked that the tuple can be parsed with "i|zO", so... */ Py_ssize_t tsize = PyTuple_GET_SIZE(item); flag = PyInt_AS_LONG(PyTuple_GET_ITEM(item, 0)); - name = tsize > 1 ? PyBytes_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; + name = tsize > 1 ? PyString_AS_STRING(PyTuple_GET_ITEM(item, 1)) : NULL; defval = tsize > 2 ? PyTuple_GET_ITEM(item, 2) : NULL; switch (flag & (PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID)) { @@ -3612,7 +3612,7 @@ "NULL stgdict unexpected"); goto error; } - if (PyBytes_Check(dict->proto)) { + if (PyString_Check(dict->proto)) { PyErr_Format( PyExc_TypeError, "%s 'out' parameter must be passed as default value", @@ -3910,12 +3910,12 @@ { #ifdef MS_WIN32 if (self->index) - return PyBytes_FromFormat("", + return PyString_FromFormat("", self->index - 0x1000, Py_TYPE(self)->tp_name, self); #endif - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -4044,7 +4044,7 @@ } if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyBytes_AsString(name); + char *field = PyString_AsString(name); if (field == NULL) { PyErr_Clear(); field = "???"; @@ -4246,7 +4246,7 @@ type, so this cannot be NULL */ if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = (char *)self->b_ptr; - return PyBytes_FromStringAndSize(ptr + ilow, len); + return PyString_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = (wchar_t *)self->b_ptr; @@ -4303,9 +4303,9 @@ char *dest; if (slicelen <= 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (step == 1) { - return PyBytes_FromStringAndSize(ptr + start, + return PyString_FromStringAndSize(ptr + start, slicelen); } dest = (char *)PyMem_Malloc(slicelen); @@ -4318,7 +4318,7 @@ dest[i] = ptr[cur]; } - np = PyBytes_FromStringAndSize(dest, slicelen); + np = PyString_FromStringAndSize(dest, slicelen); PyMem_Free(dest); return np; } @@ -4728,12 +4728,12 @@ static PyObject *format; if (Py_TYPE(self)->tp_base != &Simple_Type) { - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } if (format == NULL) { - format = PyBytes_InternFromString("%s(%r)"); + format = PyString_InternFromString("%s(%r)"); if (format == NULL) return NULL; } @@ -4742,7 +4742,7 @@ if (val == NULL) return NULL; - name = PyBytes_FromString(Py_TYPE(self)->tp_name); + name = PyString_FromString(Py_TYPE(self)->tp_name); if (name == NULL) { Py_DECREF(val); return NULL; @@ -4754,7 +4754,7 @@ if (args == NULL) return NULL; - result = PyBytes_Format(format, args); + result = PyString_Format(format, args); Py_DECREF(args); return result; } @@ -4988,7 +4988,7 @@ assert(itemdict); if (itemdict->getfunc == getentry("c")->getfunc) { char *ptr = *(char **)self->b_ptr; - return PyBytes_FromStringAndSize(ptr + ilow, len); + return PyString_FromStringAndSize(ptr + ilow, len); #ifdef CTYPES_UNICODE } else if (itemdict->getfunc == getentry("u")->getfunc) { wchar_t *ptr = *(wchar_t **)self->b_ptr; @@ -5085,9 +5085,9 @@ char *dest; if (len <= 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (step == 1) { - return PyBytes_FromStringAndSize(ptr + start, + return PyString_FromStringAndSize(ptr + start, len); } dest = (char *)PyMem_Malloc(len); @@ -5096,7 +5096,7 @@ for (cur = start, i = 0; i < len; cur += step, i++) { dest[i] = ptr[cur]; } - np = PyBytes_FromStringAndSize(dest, len); + np = PyString_FromStringAndSize(dest, len); PyMem_Free(dest); return np; } @@ -5276,7 +5276,7 @@ ++methods; } - s = PyBytes_FromString(comerror_doc); + s = PyString_FromString(comerror_doc); if (s == NULL) goto error; status = PyDict_SetItemString(dict, "__doc__", s); @@ -5302,8 +5302,8 @@ string_at(const char *ptr, int size) { if (size == -1) - return PyBytes_FromString(ptr); - return PyBytes_FromStringAndSize(ptr, size); + return PyString_FromString(ptr); + return PyString_FromStringAndSize(ptr, size); } static int @@ -5317,8 +5317,8 @@ return 1; dict = PyType_stgdict(arg); if (dict) { - if (PyBytes_Check(dict->proto) - && (strchr("sPzUZXO", PyBytes_AS_STRING(dict->proto)[0]))) { + if (PyString_Check(dict->proto) + && (strchr("sPzUZXO", PyString_AS_STRING(dict->proto)[0]))) { /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */ return 1; } Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callbacks.c Mon Jun 9 12:52:48 2008 @@ -107,15 +107,15 @@ PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_srcfile = PyBytes_FromString(filename); + py_srcfile = PyString_FromString(filename); if (!py_srcfile) goto bad; - py_funcname = PyBytes_FromString(funcname); + py_funcname = PyString_FromString(funcname); if (!py_funcname) goto bad; py_globals = PyDict_New(); if (!py_globals) goto bad; empty_tuple = PyTuple_New(0); if (!empty_tuple) goto bad; - empty_string = PyBytes_FromString(""); + empty_string = PyString_FromString(""); if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ @@ -498,7 +498,7 @@ static PyObject *context; if (context == NULL) - context = PyBytes_InternFromString("_ctypes.DllGetClassObject"); + context = PyString_InternFromString("_ctypes.DllGetClassObject"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { @@ -577,7 +577,7 @@ static PyObject *context; if (context == NULL) - context = PyBytes_InternFromString("_ctypes.DllCanUnloadNow"); + context = PyString_InternFromString("_ctypes.DllCanUnloadNow"); mod = PyImport_ImportModuleNoBlock("ctypes"); if (!mod) { Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c Mon Jun 9 12:52:48 2008 @@ -498,7 +498,7 @@ self->tag, self); break; } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } static PyMemberDef PyCArgType_members[] = { @@ -646,9 +646,9 @@ return 0; } - if (PyBytes_Check(obj)) { + if (PyString_Check(obj)) { pa->ffi_type = &ffi_type_pointer; - pa->value.p = PyBytes_AS_STRING(obj); + pa->value.p = PyString_AS_STRING(obj); Py_INCREF(obj); pa->keep = obj; return 0; @@ -937,7 +937,7 @@ PyObject *tp, *v, *tb, *s, *cls_str, *msg_str; va_start(vargs, fmt); - s = PyBytes_FromFormatV(fmt, vargs); + s = PyString_FromFormatV(fmt, vargs); va_end(vargs); if (!s) return; @@ -946,18 +946,18 @@ PyErr_NormalizeException(&tp, &v, &tb); cls_str = PyObject_Str(tp); if (cls_str) { - PyBytes_ConcatAndDel(&s, cls_str); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(": ")); + PyString_ConcatAndDel(&s, cls_str); + PyString_ConcatAndDel(&s, PyString_FromString(": ")); if (s == NULL) goto error; } else PyErr_Clear(); msg_str = PyObject_Str(v); if (msg_str) - PyBytes_ConcatAndDel(&s, msg_str); + PyString_ConcatAndDel(&s, msg_str); else { PyErr_Clear(); - PyBytes_ConcatAndDel(&s, PyBytes_FromString("???")); + PyString_ConcatAndDel(&s, PyString_FromString("???")); if (s == NULL) goto error; } @@ -1261,7 +1261,7 @@ if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) return NULL; #ifdef _UNICODE - name = alloca((PyBytes_Size(nameobj) + 1) * sizeof(WCHAR)); + name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); if (!name) { PyErr_NoMemory(); return NULL; @@ -1269,14 +1269,14 @@ { int r; - char *aname = PyBytes_AsString(nameobj); + char *aname = PyString_AsString(nameobj); if(!aname) return NULL; - r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyBytes_Size(nameobj) + 1); + r = MultiByteToWideChar(CP_ACP, 0, aname, -1, name, PyString_Size(nameobj) + 1); name[r] = 0; } #else - name = PyBytes_AsString(nameobj); + name = PyString_AsString(nameobj); if(!name) return NULL; #endif @@ -1769,9 +1769,9 @@ Py_INCREF(result); return result; } - if (PyBytes_CheckExact(cls)) { - buf = alloca(strlen(PyBytes_AS_STRING(cls)) + 3 + 1); - sprintf(buf, "LP_%s", PyBytes_AS_STRING(cls)); + if (PyString_CheckExact(cls)) { + buf = alloca(strlen(PyString_AS_STRING(cls)) + 3 + 1); + sprintf(buf, "LP_%s", PyString_AS_STRING(cls)); result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type), "s(O){}", buf, Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/cfield.c Mon Jun 9 12:52:48 2008 @@ -272,7 +272,7 @@ name = ((PyTypeObject *)self->proto)->tp_name; if (bits) - result = PyBytes_FromFormat( + result = PyString_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -280,7 +280,7 @@ #endif name, self->offset, size, bits); else - result = PyBytes_FromFormat( + result = PyString_FromFormat( #if (PY_VERSION_HEX < 0x02050000) "", #else @@ -1164,12 +1164,12 @@ static PyObject * c_set(void *ptr, PyObject *value, Py_ssize_t size) { - if (!PyBytes_Check(value) || (1 != PyBytes_Size(value))) { + if (!PyString_Check(value) || (1 != PyString_Size(value))) { PyErr_Format(PyExc_TypeError, "one character string expected"); return NULL; } - *(char *)ptr = PyBytes_AS_STRING(value)[0]; + *(char *)ptr = PyString_AS_STRING(value)[0]; _RET(value); } @@ -1177,7 +1177,7 @@ static PyObject * c_get(void *ptr, Py_ssize_t size) { - return PyBytes_FromStringAndSize((char *)ptr, 1); + return PyString_FromStringAndSize((char *)ptr, 1); } #ifdef CTYPES_UNICODE @@ -1187,7 +1187,7 @@ { Py_ssize_t len; - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1262,7 +1262,7 @@ /* It's easier to calculate in characters than in bytes */ length /= sizeof(wchar_t); - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1301,21 +1301,21 @@ PyObject *result; size_t slen; - result = PyBytes_FromString((char *)ptr); + result = PyString_FromString((char *)ptr); if (!result) return NULL; /* chop off at the first NUL character, if any. * On error, result will be deallocated and set to NULL. */ - slen = strlen(PyBytes_AS_STRING(result)); + slen = strlen(PyString_AS_STRING(result)); size = min(size, (Py_ssize_t)slen); if (result->ob_refcnt == 1) { /* shorten the result */ - _PyBytes_Resize(&result, size); + _PyString_Resize(&result, size); return result; } else /* cannot shorten the result */ - return PyBytes_FromStringAndSize(ptr, size); + return PyString_FromStringAndSize(ptr, size); } static PyObject * @@ -1324,7 +1324,7 @@ char *data; Py_ssize_t size; - data = PyBytes_AsString(value); + data = PyString_AsString(value); if (!data) return NULL; size = strlen(data); @@ -1356,8 +1356,8 @@ Py_INCREF(value); return value; } - if (PyBytes_Check(value)) { - *(char **)ptr = PyBytes_AS_STRING(value); + if (PyString_Check(value)) { + *(char **)ptr = PyString_AS_STRING(value); Py_INCREF(value); return value; } else if (PyUnicode_Check(value)) { @@ -1366,7 +1366,7 @@ conversion_mode_errors); if (str == NULL) return NULL; - *(char **)ptr = PyBytes_AS_STRING(str); + *(char **)ptr = PyString_AS_STRING(str); return str; } else if (PyInt_Check(value) || PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG @@ -1395,7 +1395,7 @@ return NULL; } #endif - return PyBytes_FromString(*(char **)ptr); + return PyString_FromString(*(char **)ptr); } else { Py_INCREF(Py_None); return Py_None; @@ -1411,7 +1411,7 @@ Py_INCREF(value); return value; } - if (PyBytes_Check(value)) { + if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); @@ -1502,7 +1502,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyBytes_Check(value)) { + } else if (PyString_Check(value)) { value = PyUnicode_FromEncodedObject(value, conversion_mode_encoding, conversion_mode_errors); Modified: python/branches/tlee-ast-optimize/Modules/_curses_panel.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_curses_panel.c (original) +++ python/branches/tlee-ast-optimize/Modules/_curses_panel.c Mon Jun 9 12:52:48 2008 @@ -472,7 +472,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyBytes_FromString(PyCursesVersion); + v = PyString_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/_cursesmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_cursesmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_cursesmodule.c Mon Jun 9 12:52:48 2008 @@ -198,9 +198,9 @@ { if (PyInt_Check(obj)) { *ch = (chtype) PyInt_AsLong(obj); - } else if(PyBytes_Check(obj) - && (PyBytes_Size(obj) == 1)) { - *ch = (chtype) *PyBytes_AsString(obj); + } else if(PyString_Check(obj) + && (PyString_Size(obj) == 1)) { + *ch = (chtype) *PyString_AsString(obj); } else { return 0; } @@ -886,9 +886,9 @@ return Py_BuildValue("c", rtn); else #if defined(__NetBSD__) - return PyBytes_FromString(unctrl(rtn)); + return PyString_FromString(unctrl(rtn)); #else - return PyBytes_FromString((char *)keyname(rtn)); + return PyString_FromString((char *)keyname(rtn)); #endif } @@ -943,7 +943,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyBytes_FromString(rtn); + return PyString_FromString(rtn); } static PyObject * @@ -1095,7 +1095,7 @@ } if (rtn2 == ERR) rtn[0] = 0; - return PyBytes_FromString(rtn); + return PyString_FromString(rtn); } static PyObject * @@ -1757,7 +1757,7 @@ ch = erasechar(); - return PyBytes_FromStringAndSize(&ch, 1); + return PyString_FromStringAndSize(&ch, 1); } static PyObject * @@ -2114,7 +2114,7 @@ } knp = keyname(ch); - return PyBytes_FromString((knp == NULL) ? "" : (char *)knp); + return PyString_FromString((knp == NULL) ? "" : (char *)knp); } #endif @@ -2125,7 +2125,7 @@ ch = killchar(); - return PyBytes_FromStringAndSize(&ch, 1); + return PyString_FromStringAndSize(&ch, 1); } static PyObject * @@ -2496,7 +2496,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString( capname ); + return PyString_FromString( capname ); } static PyObject * @@ -2520,7 +2520,7 @@ return NULL; } - return PyBytes_FromString(result); + return PyString_FromString(result); } static PyObject * @@ -2547,14 +2547,14 @@ if (PyInt_Check(temp)) ch = (chtype) PyInt_AsLong(temp); - else if (PyBytes_Check(temp)) - ch = (chtype) *PyBytes_AsString(temp); + else if (PyString_Check(temp)) + ch = (chtype) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; } - return PyBytes_FromString(unctrl(ch)); + return PyString_FromString(unctrl(ch)); } static PyObject * @@ -2569,8 +2569,8 @@ if (PyInt_Check(temp)) ch = (int) PyInt_AsLong(temp); - else if (PyBytes_Check(temp)) - ch = (int) *PyBytes_AsString(temp); + else if (PyString_Check(temp)) + ch = (int) *PyString_AsString(temp); else { PyErr_SetString(PyExc_TypeError, "argument must be a ch or an int"); return NULL; @@ -2753,7 +2753,7 @@ PyDict_SetItemString(d, "error", PyCursesError); /* Make the version available */ - v = PyBytes_FromString(PyCursesVersion); + v = PyString_FromString(PyCursesVersion); PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/_elementtree.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_elementtree.c (original) +++ python/branches/tlee-ast-optimize/Modules/_elementtree.c Mon Jun 9 12:52:48 2008 @@ -103,7 +103,7 @@ #define PyDict_CheckExact PyDict_Check #if (PY_VERSION_HEX < 0x02020000) #define PyList_CheckExact PyList_Check -#define PyBytes_CheckExact PyBytes_Check +#define PyString_CheckExact PyString_Check #if (PY_VERSION_HEX >= 0x01060000) #define Py_USING_UNICODE /* always enabled for 2.0 and 2.1 */ #endif @@ -173,7 +173,7 @@ switch (PyList_GET_SIZE(list)) { case 0: Py_DECREF(list); - return PyBytes_FromString(""); + return PyString_FromString(""); case 1: result = PyList_GET_ITEM(list, 0); Py_INCREF(result); @@ -748,9 +748,9 @@ return 0; } #endif - if (PyBytes_Check(tag)) { - char *p = PyBytes_AS_STRING(tag); - for (i = 0; i < PyBytes_GET_SIZE(tag); i++) { + if (PyString_Check(tag)) { + char *p = PyString_AS_STRING(tag); + for (i = 0; i < PyString_GET_SIZE(tag); i++) { if (p[i] == '{') check = 0; else if (p[i] == '}') @@ -818,7 +818,7 @@ if (Element_CheckExact(item) && !PyObject_Compare(item->tag, tag)) { PyObject* text = element_get_text(item); if (text == Py_None) - return PyBytes_FromString(""); + return PyString_FromString(""); Py_XINCREF(text); return text; } @@ -1154,12 +1154,12 @@ PyObject* repr; char buffer[100]; - repr = PyBytes_FromString("tag)); + PyString_ConcatAndDel(&repr, PyObject_Repr(self->tag)); sprintf(buffer, " at %p>", self); - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(buffer)); + PyString_ConcatAndDel(&repr, PyString_FromString(buffer)); return repr; } @@ -1617,14 +1617,14 @@ Py_INCREF(data); self->data = data; } else { /* more than one item; use a list to collect items */ - if (PyBytes_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && - PyBytes_CheckExact(data) && PyBytes_GET_SIZE(data) == 1) { + if (PyString_CheckExact(self->data) && Py_REFCNT(self->data) == 1 && + PyString_CheckExact(data) && PyString_GET_SIZE(data) == 1) { /* expat often generates single character data sections; handle the most common case by resizing the existing string... */ - Py_ssize_t size = PyBytes_GET_SIZE(self->data); - if (_PyBytes_Resize(&self->data, size + 1) < 0) + Py_ssize_t size = PyString_GET_SIZE(self->data); + if (_PyString_Resize(&self->data, size + 1) < 0) return NULL; - PyBytes_AS_STRING(self->data)[size] = PyBytes_AS_STRING(data)[0]; + PyString_AS_STRING(self->data)[size] = PyString_AS_STRING(data)[0]; } else if (PyList_CheckExact(self->data)) { if (PyList_Append(self->data, data) < 0) return NULL; @@ -1896,7 +1896,7 @@ return PyUnicode_DecodeUTF8(string, size, "strict"); #endif - return PyBytes_FromStringAndSize(string, size); + return PyString_FromStringAndSize(string, size); } LOCAL(PyObject*) @@ -1910,7 +1910,7 @@ PyObject* value; /* look the 'raw' name up in the names dictionary */ - key = PyBytes_FromStringAndSize(string, size); + key = PyString_FromStringAndSize(string, size); if (!key) return NULL; @@ -1932,8 +1932,8 @@ break; if (i != size) { /* convert to universal name */ - tag = PyBytes_FromStringAndSize(NULL, size+1); - p = PyBytes_AS_STRING(tag); + tag = PyString_FromStringAndSize(NULL, size+1); + p = PyString_AS_STRING(tag); p[0] = '{'; memcpy(p+1, string, size); size++; @@ -1947,7 +1947,7 @@ #if defined(Py_USING_UNICODE) /* inline makestring, to avoid duplicating the source string if it's not an utf-8 string */ - p = PyBytes_AS_STRING(tag); + p = PyString_AS_STRING(tag); if (checkstring(p, size)) { value = PyUnicode_DecodeUTF8(p, size, "strict"); Py_DECREF(tag); @@ -2004,7 +2004,7 @@ } else { PyErr_Format( PyExc_SyntaxError, "undefined entity &%s;: line %ld, column %ld", - PyBytes_AS_STRING(key), + PyString_AS_STRING(key), EXPAT(GetErrorLineNumber)(self->parser), EXPAT(GetErrorColumnNumber)(self->parser) ); @@ -2435,13 +2435,13 @@ return NULL; } - if (!PyBytes_CheckExact(buffer) || PyBytes_GET_SIZE(buffer) == 0) { + if (!PyString_CheckExact(buffer) || PyString_GET_SIZE(buffer) == 0) { Py_DECREF(buffer); break; } res = expat_parse( - self, PyBytes_AS_STRING(buffer), PyBytes_GET_SIZE(buffer), 0 + self, PyString_AS_STRING(buffer), PyString_GET_SIZE(buffer), 0 ); Py_DECREF(buffer); @@ -2503,7 +2503,7 @@ if (event_set == Py_None) { /* default is "end" only */ - target->end_event_obj = PyBytes_FromString("end"); + target->end_event_obj = PyString_FromString("end"); Py_RETURN_NONE; } @@ -2513,9 +2513,9 @@ for (i = 0; i < PyTuple_GET_SIZE(event_set); i++) { PyObject* item = PyTuple_GET_ITEM(event_set, i); char* event; - if (!PyBytes_Check(item)) + if (!PyString_Check(item)) goto error; - event = PyBytes_AS_STRING(item); + event = PyString_AS_STRING(item); if (strcmp(event, "start") == 0) { Py_INCREF(item); target->start_event_obj = item; @@ -2587,7 +2587,7 @@ char buffer[100]; sprintf(buffer, "Expat %d.%d.%d", XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } else { PyErr_SetString(PyExc_AttributeError, name); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/_fileio.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_fileio.c (original) +++ python/branches/tlee-ast-optimize/Modules/_fileio.c Mon Jun 9 12:52:48 2008 @@ -392,14 +392,14 @@ Py_ssize_t total = 0; int n; - result = PyBytes_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); + result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); if (result == NULL) return NULL; while (1) { Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyBytes_GET_SIZE(result) < newsize) { - if (_PyBytes_Resize(&result, newsize) < 0) { + if (PyString_GET_SIZE(result) < newsize) { + if (_PyString_Resize(&result, newsize) < 0) { if (total == 0) { Py_DECREF(result); return NULL; @@ -411,7 +411,7 @@ Py_BEGIN_ALLOW_THREADS errno = 0; n = read(self->fd, - PyBytes_AS_STRING(result) + total, + PyString_AS_STRING(result) + total, newsize - total); Py_END_ALLOW_THREADS if (n == 0) @@ -430,8 +430,8 @@ total += n; } - if (PyBytes_GET_SIZE(result) > total) { - if (_PyBytes_Resize(&result, total) < 0) { + if (PyString_GET_SIZE(result) > total) { + if (_PyString_Resize(&result, total) < 0) { /* This should never happen, but just in case */ Py_DECREF(result); return NULL; @@ -460,10 +460,10 @@ return fileio_readall(self); } - bytes = PyBytes_FromStringAndSize(NULL, size); + bytes = PyString_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; - ptr = PyBytes_AS_STRING(bytes); + ptr = PyString_AS_STRING(bytes); Py_BEGIN_ALLOW_THREADS errno = 0; @@ -478,7 +478,7 @@ } if (n != size) { - if (_PyBytes_Resize(&bytes, n) < 0) { + if (_PyString_Resize(&bytes, n) < 0) { Py_DECREF(bytes); return NULL; } @@ -690,9 +690,9 @@ fileio_repr(PyFileIOObject *self) { if (self->fd < 0) - return PyBytes_FromFormat("_fileio._FileIO(-1)"); + return PyString_FromFormat("_fileio._FileIO(-1)"); - return PyBytes_FromFormat("_fileio._FileIO(%d, '%s')", + return PyString_FromFormat("_fileio._FileIO(%d, '%s')", self->fd, mode_string(self)); } @@ -816,7 +816,7 @@ static PyObject * get_mode(PyFileIOObject *self, void *closure) { - return PyBytes_FromString(mode_string(self)); + return PyString_FromString(mode_string(self)); } static PyGetSetDef fileio_getsetlist[] = { Modified: python/branches/tlee-ast-optimize/Modules/_hashopenssl.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_hashopenssl.c (original) +++ python/branches/tlee-ast-optimize/Modules/_hashopenssl.c Mon Jun 9 12:52:48 2008 @@ -103,7 +103,7 @@ digest_size = EVP_MD_CTX_size(&temp_ctx); EVP_DigestFinal(&temp_ctx, digest, NULL); - retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); + retval = PyString_FromStringAndSize((const char *)digest, digest_size); EVP_MD_CTX_cleanup(&temp_ctx); return retval; } @@ -130,10 +130,10 @@ /* Create a new string */ /* NOTE: not thread safe! modifying an already created string object */ /* (not a problem because we hold the GIL by default) */ - retval = PyBytes_FromStringAndSize(NULL, digest_size * 2); + retval = PyString_FromStringAndSize(NULL, digest_size * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -220,8 +220,8 @@ { char buf[100]; PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>", - PyBytes_AsString(((EVPobject *)self)->name), self); - return PyBytes_FromString(buf); + PyString_AsString(((EVPobject *)self)->name), self); + return PyString_FromString(buf); } #if HASH_OBJ_CONSTRUCTOR @@ -421,7 +421,7 @@ /* used in the init function to setup a constructor */ #define INIT_CONSTRUCTOR_CONSTANTS(NAME) do { \ - CONST_ ## NAME ## _name_obj = PyBytes_FromString(#NAME); \ + CONST_ ## NAME ## _name_obj = PyString_FromString(#NAME); \ if (EVP_get_digestbyname(#NAME)) { \ CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ Modified: python/branches/tlee-ast-optimize/Modules/_heapqmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_heapqmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_heapqmodule.c Mon Jun 9 12:52:48 2008 @@ -687,6 +687,6 @@ m = Py_InitModule3("_heapq", heapq_methods, module_doc); if (m == NULL) return; - PyModule_AddObject(m, "__about__", PyBytes_FromString(__about__)); + PyModule_AddObject(m, "__about__", PyString_FromString(__about__)); } Modified: python/branches/tlee-ast-optimize/Modules/_hotshot.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_hotshot.c (original) +++ python/branches/tlee-ast-optimize/Modules/_hotshot.c Mon Jun 9 12:52:48 2008 @@ -326,7 +326,7 @@ return ERR_EOF; } } - *pvalue = PyBytes_FromStringAndSize(buf, len); + *pvalue = PyString_FromStringAndSize(buf, len); free(buf); if (*pvalue == NULL) { return ERR_EXCEPTION; @@ -562,7 +562,7 @@ self->index - written); self->index -= written; if (written == 0) { - char *s = PyBytes_AsString(self->logfilename); + char *s = PyString_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -570,7 +570,7 @@ } if (written > 0) { if (fflush(self->logfp)) { - char *s = PyBytes_AsString(self->logfilename); + char *s = PyString_AsString(self->logfilename); PyErr_SetFromErrnoWithFilename(PyExc_IOError, s); do_stop(self); return -1; @@ -792,7 +792,7 @@ self->next_fileno++; Py_DECREF(obj); if (pack_define_file(self, fileno, - PyBytes_AS_STRING(fcode->co_filename)) < 0) + PyString_AS_STRING(fcode->co_filename)) < 0) return -1; } else { @@ -810,7 +810,7 @@ PyObject *name = PyDict_GetItem(dict, obj); if (name == NULL) { if (pack_define_func(self, fileno, fcode->co_firstlineno, - PyBytes_AS_STRING(fcode->co_name)) < 0) { + PyString_AS_STRING(fcode->co_name)) < 0) { Py_DECREF(obj); return -1; } @@ -1471,7 +1471,7 @@ len = PyList_GET_SIZE(temp); for (i = 0; i < len; ++i) { PyObject *item = PyList_GET_ITEM(temp, i); - buffer = PyBytes_AsString(item); + buffer = PyString_AsString(item); if (buffer == NULL) { pack_add_info(self, "sys-path-entry", ""); PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Modules/_json.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_json.c (original) +++ python/branches/tlee-ast-optimize/Modules/_json.c Mon Jun 9 12:52:48 2008 @@ -70,11 +70,11 @@ input_unicode = PyUnicode_AS_UNICODE(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyBytes_FromStringAndSize(NULL, output_size); + rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -92,14 +92,14 @@ if (output_size > 2 + (input_chars * MAX_EXPANSION)) { output_size = 2 + (input_chars * MAX_EXPANSION); } - if (_PyBytes_Resize(&rval, output_size) == -1) { + if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyBytes_Resize(&rval, chars) == -1) { + if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -116,15 +116,15 @@ char *output; char *input_str; - input_chars = PyBytes_GET_SIZE(pystr); - input_str = PyBytes_AS_STRING(pystr); + input_chars = PyString_GET_SIZE(pystr); + input_str = PyString_AS_STRING(pystr); /* One char input can be up to 6 chars output, estimate 4 of these */ output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - rval = PyBytes_FromStringAndSize(NULL, output_size); + rval = PyString_FromStringAndSize(NULL, output_size); if (rval == NULL) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); chars = 0; output[chars++] = '"'; for (i = 0; i < input_chars; i++) { @@ -154,14 +154,14 @@ if (output_size > 2 + (input_chars * MIN_EXPANSION)) { output_size = 2 + (input_chars * MIN_EXPANSION); } - if (_PyBytes_Resize(&rval, output_size) == -1) { + if (_PyString_Resize(&rval, output_size) == -1) { return NULL; } - output = PyBytes_AS_STRING(rval); + output = PyString_AS_STRING(rval); } } output[chars++] = '"'; - if (_PyBytes_Resize(&rval, chars) == -1) { + if (_PyString_Resize(&rval, chars) == -1) { return NULL; } return rval; @@ -215,7 +215,7 @@ ustr = PyUnicode_FromUnicode(&c, 0); } if (joinstr == NULL) { - joinstr = PyBytes_InternFromString("join"); + joinstr = PyString_InternFromString("join"); } if (joinstr == NULL || ustr == NULL) { return NULL; @@ -227,10 +227,10 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict) { PyObject *rval; - Py_ssize_t len = PyBytes_GET_SIZE(pystr); + Py_ssize_t len = PyString_GET_SIZE(pystr); Py_ssize_t begin = end - 1; Py_ssize_t next = begin; - char *buf = PyBytes_AS_STRING(pystr); + char *buf = PyString_AS_STRING(pystr); PyObject *chunks = PyList_New(0); if (chunks == NULL) { goto bail; @@ -555,7 +555,7 @@ if (encoding == NULL) { encoding = DEFAULT_ENCODING; } - if (PyBytes_Check(pystr)) { + if (PyString_Check(pystr)) { return scanstring_str(pystr, end, encoding, strict); } else if (PyUnicode_Check(pystr)) { @@ -576,7 +576,7 @@ py_encode_basestring_ascii(PyObject* self, PyObject *pystr) { /* METH_O */ - if (PyBytes_Check(pystr)) { + if (PyString_Check(pystr)) { return ascii_escape_str(pystr); } else if (PyUnicode_Check(pystr)) { Modified: python/branches/tlee-ast-optimize/Modules/_localemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_localemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_localemodule.c Mon Jun 9 12:52:48 2008 @@ -119,7 +119,7 @@ if (isupper(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -134,7 +134,7 @@ if (islower(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -149,7 +149,7 @@ if (isalpha(c)) ul[n++] = c; } - ulo = PyBytes_FromStringAndSize((const char *)ul, n); + ulo = PyString_FromStringAndSize((const char *)ul, n); if (!ulo) return; if (string) @@ -175,7 +175,7 @@ PyErr_SetString(Error, "unsupported locale setting"); return NULL; } - result_object = PyBytes_FromString(result); + result_object = PyString_FromString(result); if (!result_object) return NULL; /* record changes to LC_CTYPE */ @@ -190,7 +190,7 @@ PyErr_SetString(Error, "locale query failed"); return NULL; } - result_object = PyBytes_FromString(result); + result_object = PyString_FromString(result); } return result_object; } @@ -216,7 +216,7 @@ involved herein */ #define RESULT_STRING(s)\ - x = PyBytes_FromString(l->s);\ + x = PyString_FromString(l->s);\ if (!x) goto failed;\ PyDict_SetItemString(result, #s, x);\ Py_XDECREF(x) @@ -284,9 +284,9 @@ if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2)) return NULL; /* If both arguments are byte strings, use strcoll. */ - if (PyBytes_Check(os1) && PyBytes_Check(os2)) - return PyInt_FromLong(strcoll(PyBytes_AS_STRING(os1), - PyBytes_AS_STRING(os2))); + if (PyString_Check(os1) && PyString_Check(os2)) + return PyInt_FromLong(strcoll(PyString_AS_STRING(os1), + PyString_AS_STRING(os2))); /* If neither argument is unicode, it's an error. */ if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) { PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings"); @@ -368,7 +368,7 @@ return PyErr_NoMemory(); strxfrm(buf, s, n2); } - result = PyBytes_FromString(buf); + result = PyString_FromString(buf); PyMem_Free(buf); return result; } @@ -563,13 +563,13 @@ return NULL; /* Check whether this is a supported constant. GNU libc sometimes returns numeric values in the char* return value, which would - crash PyBytes_FromString. */ + crash PyString_FromString. */ for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) { /* Check NULL as a workaround for GNU libc's returning NULL instead of an empty string for nl_langinfo(ERA). */ const char *result = nl_langinfo(item); - return PyBytes_FromString(result != NULL ? result : ""); + return PyString_FromString(result != NULL ? result : ""); } PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); return NULL; @@ -588,7 +588,7 @@ char *in; if (!PyArg_ParseTuple(args, "z", &in)) return 0; - return PyBytes_FromString(gettext(in)); + return PyString_FromString(gettext(in)); } PyDoc_STRVAR(dgettext__doc__, @@ -601,7 +601,7 @@ char *domain, *in; if (!PyArg_ParseTuple(args, "zz", &domain, &in)) return 0; - return PyBytes_FromString(dgettext(domain, in)); + return PyString_FromString(dgettext(domain, in)); } PyDoc_STRVAR(dcgettext__doc__, @@ -615,7 +615,7 @@ int category; if (!PyArg_ParseTuple(args, "zzi", &domain, &msgid, &category)) return 0; - return PyBytes_FromString(dcgettext(domain,msgid,category)); + return PyString_FromString(dcgettext(domain,msgid,category)); } PyDoc_STRVAR(textdomain__doc__, @@ -633,7 +633,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyBytes_FromString(domain); + return PyString_FromString(domain); } PyDoc_STRVAR(bindtextdomain__doc__, @@ -651,7 +651,7 @@ PyErr_SetFromErrno(PyExc_OSError); return NULL; } - return PyBytes_FromString(dirname); + return PyString_FromString(dirname); } #ifdef HAVE_BIND_TEXTDOMAIN_CODESET @@ -667,7 +667,7 @@ return NULL; codeset = bind_textdomain_codeset(domain, codeset); if (codeset) - return PyBytes_FromString(codeset); + return PyString_FromString(codeset); Py_RETURN_NONE; } #endif @@ -760,7 +760,7 @@ Error = PyErr_NewException("locale.Error", NULL, NULL); PyDict_SetItemString(d, "Error", Error); - x = PyBytes_FromString(locale__doc__); + x = PyString_FromString(locale__doc__); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/_lsprof.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_lsprof.c (original) +++ python/branches/tlee-ast-optimize/Modules/_lsprof.c Mon Jun 9 12:52:48 2008 @@ -179,8 +179,8 @@ /* built-in function: look up the module name */ PyObject *mod = fn->m_module; char *modname; - if (mod && PyBytes_Check(mod)) { - modname = PyBytes_AS_STRING(mod); + if (mod && PyString_Check(mod)) { + modname = PyString_AS_STRING(mod); } else if (mod && PyModule_Check(mod)) { modname = PyModule_GetName(mod); @@ -193,11 +193,11 @@ modname = "__builtin__"; } if (strcmp(modname, "__builtin__") != 0) - return PyBytes_FromFormat("<%s.%s>", + return PyString_FromFormat("<%s.%s>", modname, fn->m_ml->ml_name); else - return PyBytes_FromFormat("<%s>", + return PyString_FromFormat("<%s>", fn->m_ml->ml_name); } else { @@ -205,7 +205,7 @@ repr(getattr(type(__self__), __name__)) */ PyObject *self = fn->m_self; - PyObject *name = PyBytes_FromString(fn->m_ml->ml_name); + PyObject *name = PyString_FromString(fn->m_ml->ml_name); if (name != NULL) { PyObject *mo = _PyType_Lookup(Py_TYPE(self), name); Py_XINCREF(mo); @@ -218,7 +218,7 @@ } } PyErr_Clear(); - return PyBytes_FromFormat("", + return PyString_FromFormat("", fn->m_ml->ml_name); } } Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/cache.c Mon Jun 9 12:52:48 2008 @@ -241,12 +241,12 @@ if (!fmt_args) { return NULL; } - template = PyBytes_FromString("%s <- %s ->%s\n"); + template = PyString_FromString("%s <- %s ->%s\n"); if (!template) { Py_DECREF(fmt_args); return NULL; } - display_str = PyBytes_Format(template, fmt_args); + display_str = PyString_Format(template, fmt_args); Py_DECREF(template); Py_DECREF(fmt_args); if (!display_str) { Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/connection.c Mon Jun 9 12:52:48 2008 @@ -84,8 +84,8 @@ Py_INCREF(&PyUnicode_Type); self->text_factory = (PyObject*)&PyUnicode_Type; - if (PyBytes_Check(database) || PyUnicode_Check(database)) { - if (PyBytes_Check(database)) { + if (PyString_Check(database) || PyUnicode_Check(database)) { + if (PyString_Check(database)) { database_utf8 = database; Py_INCREF(database_utf8); } else { @@ -96,7 +96,7 @@ } Py_BEGIN_ALLOW_THREADS - rc = sqlite3_open(PyBytes_AsString(database_utf8), &self->db); + rc = sqlite3_open(PyString_AsString(database_utf8), &self->db); Py_END_ALLOW_THREADS Py_DECREF(database_utf8); @@ -111,7 +111,7 @@ if (class_attr) { class_attr_str = PyObject_Str(class_attr); if (class_attr_str) { - if (strcmp(PyBytes_AsString(class_attr_str), "") == 0) { + if (strcmp(PyString_AsString(class_attr_str), "") == 0) { /* In the APSW Connection object, the first entry after * PyObject_HEAD is the sqlite3* we want to get hold of. * Luckily, this is the same layout as we have in our @@ -134,7 +134,7 @@ } if (!isolation_level) { - isolation_level = PyBytes_FromString(""); + isolation_level = PyString_FromString(""); if (!isolation_level) { return -1; } @@ -499,12 +499,12 @@ } else { sqlite3_result_blob(context, buffer, buflen, SQLITE_TRANSIENT); } - } else if (PyBytes_Check(py_val)) { - sqlite3_result_text(context, PyBytes_AsString(py_val), -1, SQLITE_TRANSIENT); + } else if (PyString_Check(py_val)) { + sqlite3_result_text(context, PyString_AsString(py_val), -1, SQLITE_TRANSIENT); } else if (PyUnicode_Check(py_val)) { stringval = PyUnicode_AsUTF8String(py_val); if (stringval) { - sqlite3_result_text(context, PyBytes_AsString(stringval), -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, PyString_AsString(stringval), -1, SQLITE_TRANSIENT); Py_DECREF(stringval); } } else { @@ -963,21 +963,21 @@ Py_INCREF(isolation_level); self->isolation_level = isolation_level; - begin_statement = PyBytes_FromString("BEGIN "); + begin_statement = PyString_FromString("BEGIN "); if (!begin_statement) { return -1; } - PyBytes_Concat(&begin_statement, isolation_level); + PyString_Concat(&begin_statement, isolation_level); if (!begin_statement) { return -1; } - self->begin_statement = PyMem_Malloc(PyBytes_Size(begin_statement) + 2); + self->begin_statement = PyMem_Malloc(PyString_Size(begin_statement) + 2); if (!self->begin_statement) { return -1; } - strcpy(self->begin_statement, PyBytes_AsString(begin_statement)); + strcpy(self->begin_statement, PyString_AsString(begin_statement)); Py_DECREF(begin_statement); } @@ -1152,8 +1152,8 @@ goto finally; } - string1 = PyBytes_FromStringAndSize((const char*)text1_data, text1_length); - string2 = PyBytes_FromStringAndSize((const char*)text2_data, text2_length); + string1 = PyString_FromStringAndSize((const char*)text1_data, text1_length); + string2 = PyString_FromStringAndSize((const char*)text2_data, text2_length); if (!string1 || !string2) { goto finally; /* failed to allocate strings */ @@ -1259,7 +1259,7 @@ goto finally; } - if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyBytes_Type, &name, &callable)) { + if (!PyArg_ParseTuple(args, "O!O:create_collation(name, callback)", &PyString_Type, &name, &callable)) { goto finally; } @@ -1268,7 +1268,7 @@ goto finally; } - chk = PyBytes_AsString(uppercase_name); + chk = PyString_AsString(uppercase_name); while (*chk) { if ((*chk >= '0' && *chk <= '9') || (*chk >= 'A' && *chk <= 'Z') @@ -1293,7 +1293,7 @@ } rc = sqlite3_create_collation(self->db, - PyBytes_AsString(uppercase_name), + PyString_AsString(uppercase_name), SQLITE_UTF8, (callable != Py_None) ? callable : NULL, (callable != Py_None) ? pysqlite_collation_callback : NULL); Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/connection.h Mon Jun 9 12:52:48 2008 @@ -80,7 +80,7 @@ /* Determines how bytestrings from SQLite are converted to Python objects: * - PyUnicode_Type: Python Unicode objects are constructed from UTF-8 bytestrings * - OptimizedUnicode: Like before, but for ASCII data, only PyStrings are created. - * - PyBytes_Type: PyStrings are created as-is. + * - PyString_Type: PyStrings are created as-is. * - Any custom callable: Any object returned from the callable called with the bytestring * as single parameter. */ Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/cursor.c Mon Jun 9 12:52:48 2008 @@ -178,7 +178,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyBytes_FromStringAndSize(type_start, pos - type_start); + key = PyString_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -203,7 +203,7 @@ * 'NUMBER(10)' to be treated as 'NUMBER', for example. * In other words, it will work as people expect it to work.*/ if (*pos == ' ' || *pos == '(' || *pos == 0) { - py_decltype = PyBytes_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; } @@ -248,7 +248,7 @@ if ((*pos == '[') && (pos > colname) && (*(pos-1) == ' ')) { pos--; } - return PyBytes_FromStringAndSize(colname, pos - colname); + return PyString_FromStringAndSize(colname, pos - colname); } } } @@ -273,7 +273,7 @@ } if (is_ascii) { - return PyBytes_FromString(val_str); + return PyString_FromString(val_str); } else { return PyUnicode_DecodeUTF8(val_str, strlen(val_str), NULL); } @@ -327,7 +327,7 @@ Py_INCREF(Py_None); converted = Py_None; } else { - item = PyBytes_FromStringAndSize(val_str, nbytes); + item = PyString_FromStringAndSize(val_str, nbytes); if (!item) { return NULL; } @@ -370,8 +370,8 @@ colname , val_str); PyErr_SetString(pysqlite_OperationalError, buf); } - } else if (self->connection->text_factory == (PyObject*)&PyBytes_Type) { - converted = PyBytes_FromString(val_str); + } else if (self->connection->text_factory == (PyObject*)&PyString_Type) { + converted = PyString_FromString(val_str); } else { converted = PyObject_CallFunction(self->connection->text_factory, "s", val_str); } @@ -442,7 +442,7 @@ return NULL; } - if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -464,7 +464,7 @@ return NULL; } - if (!PyBytes_Check(operation) && !PyUnicode_Check(operation)) { + if (!PyString_Check(operation) && !PyUnicode_Check(operation)) { PyErr_SetString(PyExc_ValueError, "operation parameter must be str or unicode"); return NULL; } @@ -499,15 +499,15 @@ rc = pysqlite_statement_reset(self->statement); } - if (PyBytes_Check(operation)) { - operation_cstr = PyBytes_AsString(operation); + if (PyString_Check(operation)) { + operation_cstr = PyString_AsString(operation); } else { operation_bytestr = PyUnicode_AsUTF8String(operation); if (!operation_bytestr) { goto error; } - operation_cstr = PyBytes_AsString(operation_bytestr); + operation_cstr = PyString_AsString(operation_bytestr); } /* reset description and rowcount */ @@ -764,15 +764,15 @@ return NULL; } - if (PyBytes_Check(script_obj)) { - script_cstr = PyBytes_AsString(script_obj); + if (PyString_Check(script_obj)) { + script_cstr = PyString_AsString(script_obj); } else if (PyUnicode_Check(script_obj)) { script_str = PyUnicode_AsUTF8String(script_obj); if (!script_str) { return NULL; } - script_cstr = PyBytes_AsString(script_str); + script_cstr = PyString_AsString(script_str); } else { PyErr_SetString(PyExc_ValueError, "script argument must be unicode or string."); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/module.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/module.c Mon Jun 9 12:52:48 2008 @@ -137,7 +137,7 @@ /* a basic type is adapted; there's a performance optimization if that's not the case * (99 % of all usages) */ if (type == &PyInt_Type || type == &PyLong_Type || type == &PyFloat_Type - || type == &PyBytes_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { + || type == &PyString_Type || type == &PyUnicode_Type || type == &PyBuffer_Type) { pysqlite_BaseTypeAdapted = 1; } @@ -367,13 +367,13 @@ Py_DECREF(tmp_obj); } - if (!(tmp_obj = PyBytes_FromString(PYSQLITE_VERSION))) { + if (!(tmp_obj = PyString_FromString(PYSQLITE_VERSION))) { goto error; } PyDict_SetItemString(dict, "version", tmp_obj); Py_DECREF(tmp_obj); - if (!(tmp_obj = PyBytes_FromString(sqlite3_libversion()))) { + if (!(tmp_obj = PyString_FromString(sqlite3_libversion()))) { goto error; } PyDict_SetItemString(dict, "sqlite_version", tmp_obj); Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/row.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/row.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/row.c Mon Jun 9 12:52:48 2008 @@ -86,13 +86,13 @@ item = PyTuple_GetItem(self->data, _idx); Py_XINCREF(item); return item; - } else if (PyBytes_Check(idx)) { - key = PyBytes_AsString(idx); + } else if (PyString_Check(idx)) { + key = PyString_AsString(idx); nitems = PyTuple_Size(self->description); for (i = 0; i < nitems; i++) { - compare_key = PyBytes_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); + compare_key = PyString_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0)); if (!compare_key) { return NULL; } Modified: python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sqlite/statement.c Mon Jun 9 12:52:48 2008 @@ -60,7 +60,7 @@ self->st = NULL; self->in_use = 0; - if (PyBytes_Check(sql)) { + if (PyString_Check(sql)) { sql_str = sql; Py_INCREF(sql_str); } else if (PyUnicode_Check(sql)) { @@ -77,7 +77,7 @@ self->in_weakreflist = NULL; self->sql = sql_str; - sql_cstr = PyBytes_AsString(sql_str); + sql_cstr = PyString_AsString(sql_str); rc = sqlite3_prepare(connection->db, sql_cstr, @@ -119,7 +119,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_CheckExact(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_CheckExact(parameter)) { + } else if (PyString_CheckExact(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_CheckExact(parameter)) { paramtype = TYPE_UNICODE; @@ -131,7 +131,7 @@ paramtype = TYPE_LONG; } else if (PyFloat_Check(parameter)) { paramtype = TYPE_FLOAT; - } else if (PyBytes_Check(parameter)) { + } else if (PyString_Check(parameter)) { paramtype = TYPE_STRING; } else if (PyUnicode_Check(parameter)) { paramtype = TYPE_UNICODE; @@ -140,7 +140,7 @@ } if (paramtype == TYPE_STRING && !allow_8bit_chars) { - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); for (c = string; *c != 0; c++) { if (*c & 0x80) { PyErr_SetString(pysqlite_ProgrammingError, "You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings."); @@ -164,12 +164,12 @@ rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); break; case TYPE_STRING: - string = PyBytes_AS_STRING(parameter); + string = PyString_AS_STRING(parameter); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); break; case TYPE_UNICODE: stringval = PyUnicode_AsUTF8String(parameter); - string = PyBytes_AsString(stringval); + string = PyString_AsString(stringval); rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT); Py_DECREF(stringval); break; @@ -197,7 +197,7 @@ } if (PyInt_CheckExact(obj) || PyLong_CheckExact(obj) - || PyFloat_CheckExact(obj) || PyBytes_CheckExact(obj) + || PyFloat_CheckExact(obj) || PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || PyBuffer_Check(obj)) { return 0; } else { @@ -326,7 +326,7 @@ char* sql_cstr; sqlite3_stmt* new_st; - sql_cstr = PyBytes_AsString(self->sql); + sql_cstr = PyString_AsString(self->sql); rc = sqlite3_prepare(self->db, sql_cstr, Modified: python/branches/tlee-ast-optimize/Modules/_sre.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_sre.c (original) +++ python/branches/tlee-ast-optimize/Modules/_sre.c Mon Jun 9 12:52:48 2008 @@ -1715,7 +1715,7 @@ size = PyObject_Length(string); #endif - if (PyBytes_Check(string) || bytes == size) + if (PyString_Check(string) || bytes == size) charsize = 1; #if defined(HAVE_UNICODE) else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE))) @@ -1949,7 +1949,7 @@ if (!args) return NULL; - name = PyBytes_FromString(module); + name = PyString_FromString(module); if (!name) return NULL; mod = PyImport_Import(name); @@ -3416,7 +3416,7 @@ Py_DECREF(x); } - x = PyBytes_FromString(copyright); + x = PyString_FromString(copyright); if (x) { PyDict_SetItemString(d, "copyright", x); Py_DECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/_ssl.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ssl.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ssl.c Mon Jun 9 12:52:48 2008 @@ -491,13 +491,13 @@ static PyObject * PySSL_server(PySSLObject *self) { - return PyBytes_FromString(self->server); + return PyString_FromString(self->server); } static PyObject * PySSL_issuer(PySSLObject *self) { - return PyBytes_FromString(self->issuer); + return PyString_FromString(self->issuer); } static PyObject * @@ -515,7 +515,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail; } - name_obj = PyBytes_FromStringAndSize(namebuf, buflen); + name_obj = PyString_FromStringAndSize(namebuf, buflen); if (name_obj == NULL) goto fail; @@ -603,8 +603,8 @@ /* fprintf(stderr, "RDN level %d, attribute %s: %s\n", entry->set, - PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 0)), - PyBytes_AS_STRING(PyTuple_GET_ITEM(attr, 1))); + PyString_AS_STRING(PyTuple_GET_ITEM(attr, 0)), + PyString_AS_STRING(PyTuple_GET_ITEM(attr, 1))); */ if (attr == NULL) goto fail1; @@ -711,7 +711,7 @@ goto fail; } - v = PyBytes_FromString("DirName"); + v = PyString_FromString("DirName"); if (v == NULL) { Py_DECREF(t); goto fail; @@ -742,13 +742,13 @@ t = PyTuple_New(2); if (t == NULL) goto fail; - v = PyBytes_FromStringAndSize(buf, (vptr - buf)); + v = PyString_FromStringAndSize(buf, (vptr - buf)); if (v == NULL) { Py_DECREF(t); goto fail; } PyTuple_SET_ITEM(t, 0, v); - v = PyBytes_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); + v = PyString_FromStringAndSize((vptr + 1), (len - (vptr - buf + 1))); if (v == NULL) { Py_DECREF(t); goto fail; @@ -849,7 +849,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - sn_obj = PyBytes_FromStringAndSize(buf, len); + sn_obj = PyString_FromStringAndSize(buf, len); if (sn_obj == NULL) goto fail1; if (PyDict_SetItemString(retval, "serialNumber", sn_obj) < 0) { @@ -866,7 +866,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotBefore = PyBytes_FromStringAndSize(buf, len); + pnotBefore = PyString_FromStringAndSize(buf, len); if (pnotBefore == NULL) goto fail1; if (PyDict_SetItemString(retval, "notBefore", pnotBefore) < 0) { @@ -884,7 +884,7 @@ _setSSLError(NULL, 0, __FILE__, __LINE__); goto fail1; } - pnotAfter = PyBytes_FromStringAndSize(buf, len); + pnotAfter = PyString_FromStringAndSize(buf, len); if (pnotAfter == NULL) goto fail1; if (PyDict_SetItemString(retval, "notAfter", pnotAfter) < 0) { @@ -981,7 +981,7 @@ PySSL_SetError(self, len, __FILE__, __LINE__); return NULL; } - retval = PyBytes_FromStringAndSize((const char *) bytes_buf, len); + retval = PyString_FromStringAndSize((const char *) bytes_buf, len); OPENSSL_free(bytes_buf); return retval; @@ -1028,7 +1028,7 @@ if (cipher_name == NULL) { PyTuple_SET_ITEM(retval, 0, Py_None); } else { - v = PyBytes_FromString(cipher_name); + v = PyString_FromString(cipher_name); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 0, v); @@ -1037,7 +1037,7 @@ if (cipher_protocol == NULL) { PyTuple_SET_ITEM(retval, 1, Py_None); } else { - v = PyBytes_FromString(cipher_protocol); + v = PyString_FromString(cipher_protocol); if (v == NULL) goto fail0; PyTuple_SET_ITEM(retval, 1, v); @@ -1211,7 +1211,7 @@ if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; - if (!(buf = PyBytes_FromStringAndSize((char *) 0, len))) + if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; /* first check if there are bytes ready to be read */ @@ -1233,14 +1233,14 @@ return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { /* should contain a zero-length string */ - _PyBytes_Resize(&buf, 0); + _PyString_Resize(&buf, 0); return buf; } } do { err = 0; PySSL_BEGIN_ALLOW_THREADS - count = SSL_read(self->ssl, PyBytes_AsString(buf), len); + count = SSL_read(self->ssl, PyString_AsString(buf), len); err = SSL_get_error(self->ssl, count); PySSL_END_ALLOW_THREADS if(PyErr_CheckSignals()) { @@ -1257,7 +1257,7 @@ (SSL_get_shutdown(self->ssl) == SSL_RECEIVED_SHUTDOWN)) { - _PyBytes_Resize(&buf, 0); + _PyString_Resize(&buf, 0); return buf; } else { sockstate = SOCKET_OPERATION_OK; @@ -1276,7 +1276,7 @@ return PySSL_SetError(self, count, __FILE__, __LINE__); } if (count != len) - _PyBytes_Resize(&buf, count); + _PyString_Resize(&buf, count); return buf; } @@ -1362,11 +1362,11 @@ { int bytes; - if (!PyBytes_Check(arg)) + if (!PyString_Check(arg)) return PyErr_Format(PyExc_TypeError, "RAND_egd() expected string, found %s", Py_TYPE(arg)->tp_name); - bytes = RAND_egd(PyBytes_AS_STRING(arg)); + bytes = RAND_egd(PyString_AS_STRING(arg)); if (bytes == -1) { PyErr_SetString(PySSLErrorObject, "EGD connection failed or EGD did not return " Modified: python/branches/tlee-ast-optimize/Modules/_struct.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_struct.c (original) +++ python/branches/tlee-ast-optimize/Modules/_struct.c Mon Jun 9 12:52:48 2008 @@ -413,7 +413,7 @@ if (msg == NULL) return -1; rval = PyErr_WarnEx(PyExc_DeprecationWarning, - PyBytes_AS_STRING(msg), 2); + PyString_AS_STRING(msg), 2); Py_DECREF(msg); if (rval == 0) return 0; @@ -446,7 +446,7 @@ static PyObject * nu_char(const char *p, const formatdef *f) { - return PyBytes_FromStringAndSize(p, 1); + return PyString_FromStringAndSize(p, 1); } static PyObject * @@ -610,12 +610,12 @@ static int np_char(char *p, PyObject *v, const formatdef *f) { - if (!PyBytes_Check(v) || PyBytes_Size(v) != 1) { + if (!PyString_Check(v) || PyString_Size(v) != 1) { PyErr_SetString(StructError, "char format require string of length 1"); return -1; } - *p = *PyBytes_AsString(v); + *p = *PyString_AsString(v); return 0; } @@ -1335,7 +1335,7 @@ char c; Py_ssize_t size, len, num, itemsize, x; - fmt = PyBytes_AS_STRING(self->s_format); + fmt = PyString_AS_STRING(self->s_format); f = whichtable((char **)&fmt); @@ -1503,12 +1503,12 @@ const formatdef *e = code->fmtdef; const char *res = startfrom + code->offset; if (e->format == 's') { - v = PyBytes_FromStringAndSize(res, code->size); + v = PyString_FromStringAndSize(res, code->size); } else if (e->format == 'p') { Py_ssize_t n = *(unsigned char*)res; if (n >= code->size) n = code->size - 1; - v = PyBytes_FromStringAndSize(res + 1, n); + v = PyString_FromStringAndSize(res + 1, n); } else { v = e->unpack(res, e); } @@ -1542,9 +1542,9 @@ assert(soself->s_codes != NULL); if (inputstr == NULL) goto fail; - if (PyBytes_Check(inputstr) && - PyBytes_GET_SIZE(inputstr) == soself->s_size) { - return s_unpack_internal(soself, PyBytes_AS_STRING(inputstr)); + if (PyString_Check(inputstr) && + PyString_GET_SIZE(inputstr) == soself->s_size) { + return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); } args = PyTuple_Pack(1, inputstr); if (args == NULL) @@ -1637,27 +1637,27 @@ const formatdef *e = code->fmtdef; char *res = buf + code->offset; if (e->format == 's') { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(StructError, "argument for 's' must be a string"); return -1; } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > code->size) n = code->size; if (n > 0) - memcpy(res, PyBytes_AS_STRING(v), n); + memcpy(res, PyString_AS_STRING(v), n); } else if (e->format == 'p') { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(StructError, "argument for 'p' must be a string"); return -1; } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > (code->size - 1)) n = code->size - 1; if (n > 0) - memcpy(res + 1, PyBytes_AS_STRING(v), n); + memcpy(res + 1, PyString_AS_STRING(v), n); if (n > 255) n = 255; *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); @@ -1700,12 +1700,12 @@ } /* Allocate a new string */ - result = PyBytes_FromStringAndSize((char *)NULL, soself->s_size); + result = PyString_FromStringAndSize((char *)NULL, soself->s_size); if (result == NULL) return NULL; /* Call the guts */ - if ( s_pack_internal(soself, args, 0, PyBytes_AS_STRING(result)) != 0 ) { + if ( s_pack_internal(soself, args, 0, PyString_AS_STRING(result)) != 0 ) { Py_DECREF(result); return NULL; } @@ -2061,7 +2061,7 @@ { PyObject *ver, *m; - ver = PyBytes_FromString("0.2"); + ver = PyString_FromString("0.2"); if (ver == NULL) return; Modified: python/branches/tlee-ast-optimize/Modules/_testcapimodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_testcapimodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_testcapimodule.c Mon Jun 9 12:52:48 2008 @@ -691,7 +691,7 @@ } #endif -/* Some tests of PyBytes_FromFormat(). This needs more tests. */ +/* Some tests of PyString_FromFormat(). This needs more tests. */ static PyObject * test_string_from_format(PyObject *self, PyObject *args) { @@ -699,10 +699,10 @@ char *msg; #define CHECK_1_FORMAT(FORMAT, TYPE) \ - result = PyBytes_FromFormat(FORMAT, (TYPE)1); \ + result = PyString_FromFormat(FORMAT, (TYPE)1); \ if (result == NULL) \ return NULL; \ - if (strcmp(PyBytes_AsString(result), "1")) { \ + if (strcmp(PyString_AsString(result), "1")) { \ msg = FORMAT " failed at 1"; \ goto Fail; \ } \ Modified: python/branches/tlee-ast-optimize/Modules/_tkinter.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_tkinter.c (original) +++ python/branches/tlee-ast-optimize/Modules/_tkinter.c Mon Jun 9 12:52:48 2008 @@ -335,8 +335,8 @@ static char * AsString(PyObject *value, PyObject *tmp) { - if (PyBytes_Check(value)) - return PyBytes_AsString(value); + if (PyString_Check(value)) + return PyString_AsString(value); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(value)) { PyObject *v = PyUnicode_AsUTF8String(value); @@ -347,7 +347,7 @@ return NULL; } Py_DECREF(v); - return PyBytes_AsString(v); + return PyString_AsString(v); } #endif else { @@ -359,7 +359,7 @@ return NULL; } Py_DECREF(v); - return PyBytes_AsString(v); + return PyString_AsString(v); } } @@ -462,13 +462,13 @@ * Could be a quoted string containing funnies, e.g. {"}. * Return the string itself. */ - return PyBytes_FromString(list); + return PyString_FromString(list); } if (argc == 0) - v = PyBytes_FromString(""); + v = PyString_FromString(""); else if (argc == 1) - v = PyBytes_FromString(argv[0]); + v = PyString_FromString(argv[0]); else if ((v = PyTuple_New(argc)) != NULL) { int i; PyObject *w; @@ -530,10 +530,10 @@ return result; /* Fall through, returning arg. */ } - else if (PyBytes_Check(arg)) { + else if (PyString_Check(arg)) { int argc; char **argv; - char *list = PyBytes_AsString(arg); + char *list = PyString_AsString(arg); if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { Py_INCREF(arg); @@ -541,7 +541,7 @@ } Tcl_Free(FREECAST argv); if (argc > 1) - return Split(PyBytes_AsString(arg)); + return Split(PyString_AsString(arg)); /* Fall through, returning arg. */ } Py_INCREF(arg); @@ -747,12 +747,12 @@ static PyObject * PyTclObject_str(PyTclObject *self) { - if (self->string && PyBytes_Check(self->string)) { + if (self->string && PyString_Check(self->string)) { Py_INCREF(self->string); return self->string; } /* XXX Could cache value if it is an ASCII string. */ - return PyBytes_FromString(Tcl_GetString(self->value)); + return PyString_FromString(Tcl_GetString(self->value)); } static char* @@ -778,16 +778,16 @@ #ifdef Py_USING_UNICODE if (i == len) /* It is an ASCII string. */ - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); else { self->string = PyUnicode_DecodeUTF8(s, len, "strict"); if (!self->string) { PyErr_Clear(); - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); } } #else - self->string = PyBytes_FromStringAndSize(s, len); + self->string = PyString_FromStringAndSize(s, len); #endif if (!self->string) return NULL; @@ -820,7 +820,7 @@ char buf[50]; PyOS_snprintf(buf, 50, "<%s object at %p>", self->value->typePtr->name, self->value); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int @@ -839,7 +839,7 @@ static PyObject* get_typename(PyTclObject* obj, void* ignored) { - return PyBytes_FromString(obj->value->typePtr->name); + return PyString_FromString(obj->value->typePtr->name); } @@ -908,9 +908,9 @@ { Tcl_Obj *result; - if (PyBytes_Check(value)) - return Tcl_NewStringObj(PyBytes_AS_STRING(value), - PyBytes_GET_SIZE(value)); + if (PyString_Check(value)) + return Tcl_NewStringObj(PyString_AS_STRING(value), + PyString_GET_SIZE(value)); else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyInt_Check(value)) @@ -999,17 +999,17 @@ } if (i == value->length) - result = PyBytes_FromStringAndSize(s, len); + result = PyString_FromStringAndSize(s, len); else { /* Convert UTF-8 to Unicode string */ result = PyUnicode_DecodeUTF8(s, len, "strict"); if (result == NULL) { PyErr_Clear(); - result = PyBytes_FromStringAndSize(s, len); + result = PyString_FromStringAndSize(s, len); } } #else - result = PyBytes_FromStringAndSize(value->bytes, value->length); + result = PyString_FromStringAndSize(value->bytes, value->length); #endif return result; } @@ -1023,7 +1023,7 @@ if (value->typePtr == app->ByteArrayType) { int size; char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); - return PyBytes_FromStringAndSize(data, size); + return PyString_FromStringAndSize(data, size); } if (value->typePtr == app->DoubleType) { @@ -1092,7 +1092,7 @@ int size; char *c; c = Tcl_GetStringFromObj(value, &size); - return PyBytes_FromStringAndSize(c, size); + return PyString_FromStringAndSize(c, size); #endif } @@ -1204,19 +1204,19 @@ } if (*p == '\0') - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); else { /* Convert UTF-8 to Unicode string */ p = strchr(p, '\0'); res = PyUnicode_DecodeUTF8(s, (int)(p-s), "strict"); if (res == NULL) { PyErr_Clear(); - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); } } #else p = strchr(p, '\0'); - res = PyBytes_FromStringAndSize(s, (int)(p-s)); + res = PyString_FromStringAndSize(s, (int)(p-s)); #endif } return res; @@ -1370,7 +1370,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL ckfree(cmd); } @@ -1396,7 +1396,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1419,7 +1419,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1443,7 +1443,7 @@ res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1466,7 +1466,7 @@ if (err == TCL_ERROR) res = Tkinter_Error(self); else - res = PyBytes_FromString(Tkapp_Result(self)); + res = PyString_FromString(Tkapp_Result(self)); LEAVE_OVERLAP_TCL return res; } @@ -1511,8 +1511,8 @@ varname_converter(PyObject *in, void *_out) { char **out = (char**)_out; - if (PyBytes_Check(in)) { - *out = PyBytes_AsString(in); + if (PyString_Check(in)) { + *out = PyString_AsString(in); return 1; } if (PyTclObject_Check(in)) { @@ -1676,7 +1676,7 @@ res = FromObj(self, tres); } else { - res = PyBytes_FromString(Tcl_GetString(tres)); + res = PyString_FromString(Tcl_GetString(tres)); } } LEAVE_OVERLAP_TCL @@ -1920,7 +1920,7 @@ goto finally; for (i = 0; i < argc; i++) { - PyObject *s = PyBytes_FromString(argv[i]); + PyObject *s = PyString_FromString(argv[i]); if (!s || PyTuple_SetItem(v, i, s)) { Py_DECREF(v); v = NULL; @@ -1961,7 +1961,7 @@ PyObject *res = NULL; if (s) { - res = PyBytes_FromString(s); + res = PyString_FromString(s); ckfree(s); } @@ -2011,7 +2011,7 @@ return PythonCmd_Error(interp); for (i = 0; i < (argc - 1); i++) { - PyObject *s = PyBytes_FromString(argv[i + 1]); + PyObject *s = PyString_FromString(argv[i + 1]); if (!s || PyTuple_SetItem(arg, i, s)) { Py_DECREF(arg); return PythonCmd_Error(interp); @@ -2406,7 +2406,7 @@ PyOS_snprintf(buf, sizeof(buf), "", v, v->func == NULL ? ", handler deleted" : ""); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -3087,7 +3087,7 @@ static void ins_string(PyObject *d, char *name, char *val) { - PyObject *v = PyBytes_FromString(val); + PyObject *v = PyString_FromString(val); if (v) { PyDict_SetItemString(d, name, v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/Modules/almodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/almodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/almodule.c Mon Jun 9 12:52:48 2008 @@ -84,7 +84,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString((char *) value.ptr); + return PyString_FromString((char *) value.ptr); default: PyErr_SetString(ErrorObject, "unknown element type"); return NULL; @@ -149,12 +149,12 @@ PyErr_SetString(ErrorObject, "unknown element type"); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_BadArgument(); return -1; } - param->value.ptr = PyBytes_AS_STRING(value); - param->sizeIn = PyBytes_GET_SIZE(value)+1; /*account for NUL*/ + param->value.ptr = PyString_AS_STRING(value); + param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/ break; case AL_SET_VAL: case AL_VECTOR_VAL: @@ -765,12 +765,12 @@ return NULL; } size *= ch; - v = PyBytes_FromStringAndSize((char *) NULL, size * framecount); + v = PyString_FromStringAndSize((char *) NULL, size * framecount); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - alReadFrames(self->port, (void *) PyBytes_AS_STRING(v), framecount); + alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); Py_END_ALLOW_THREADS return v; @@ -1068,12 +1068,12 @@ width = ALgetwidth(c); #endif /* AL_405 */ ALfreeconfig(c); - v = PyBytes_FromStringAndSize((char *)NULL, width * count); + v = PyString_FromStringAndSize((char *)NULL, width * count); if (v == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - ret = ALreadsamps(self->port, (void *) PyBytes_AsString(v), count); + ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); Py_END_ALLOW_THREADS if (ret == -1) { Py_DECREF(v); @@ -1498,7 +1498,7 @@ Py_INCREF(item); break; case AL_STRING_VAL: - item = PyBytes_FromString(pvs[i].value.ptr); + item = PyString_FromString(pvs[i].value.ptr); PyMem_DEL(pvs[i].value.ptr); break; case AL_MATRIX_VAL: @@ -1725,7 +1725,7 @@ PyDict_SetItemString(v, "elementType", item); Py_DECREF(item); - item = PyBytes_FromString(pinfo.name); + item = PyString_FromString(pinfo.name); PyDict_SetItemString(v, "name", item); Py_DECREF(item); @@ -1920,7 +1920,7 @@ return NULL; if ((name = ALgetname(device, descriptor)) == NULL) return NULL; - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/arraymodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/arraymodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/arraymodule.c Mon Jun 9 12:52:48 2008 @@ -104,7 +104,7 @@ static PyObject * c_getitem(arrayobject *ap, Py_ssize_t i) { - return PyBytes_FromStringAndSize(&((char *)ap->ob_item)[i], 1); + return PyString_FromStringAndSize(&((char *)ap->ob_item)[i], 1); } static int @@ -1414,7 +1414,7 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyBytes_FromStringAndSize(self->ob_item, + return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } @@ -1494,7 +1494,7 @@ array_get_typecode(arrayobject *a, void *closure) { char tc = a->ob_descr->typecode; - return PyBytes_FromStringAndSize(&tc, 1); + return PyString_FromStringAndSize(&tc, 1); } static PyObject * @@ -1578,7 +1578,7 @@ typecode = a->ob_descr->typecode; if (len == 0) { PyOS_snprintf(buf, sizeof(buf), "array('%c')", typecode); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } if (typecode == 'c') @@ -1593,9 +1593,9 @@ Py_XDECREF(v); PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); - s = PyBytes_FromString(buf); - PyBytes_ConcatAndDel(&s, t); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); + s = PyString_FromString(buf); + PyString_ConcatAndDel(&s, t); + PyString_ConcatAndDel(&s, PyString_FromString(")")); return s; } @@ -1881,7 +1881,7 @@ return NULL; if (!(initial == NULL || PyList_Check(initial) - || PyBytes_Check(initial) || PyTuple_Check(initial) + || PyString_Check(initial) || PyTuple_Check(initial) || (c == 'u' && PyUnicode_Check(initial)))) { it = PyObject_GetIter(initial); if (it == NULL) @@ -1924,7 +1924,7 @@ } Py_DECREF(v); } - } else if (initial != NULL && PyBytes_Check(initial)) { + } else if (initial != NULL && PyString_Check(initial)) { PyObject *t_initial, *v; t_initial = PyTuple_Pack(1, initial); if (t_initial == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/audioop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/audioop.c (original) +++ python/branches/tlee-ast-optimize/Modules/audioop.c Mon Jun 9 12:52:48 2008 @@ -474,7 +474,7 @@ /* Passing a short** for an 's' argument is correct only if the string contents is aligned for interpretation - as short[]. Due to the definition of PyBytesObject, + as short[]. Due to the definition of PyStringObject, this is currently (Python 2.6) the case. */ if ( !PyArg_ParseTuple(args, "s#s#:findfit", (char**)&cp1, &len1, (char**)&cp2, &len2) ) @@ -759,10 +759,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -801,10 +801,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/2); + rv = PyString_FromStringAndSize(NULL, len/2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size*2 ) { @@ -846,10 +846,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*2); + rv = PyString_FromStringAndSize(NULL, len*2); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -903,10 +903,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len1); + rv = PyString_FromStringAndSize(NULL, len1); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len1; i += size ) { if ( size == 1 ) val1 = (int)*CHARP(cp1, i); @@ -949,10 +949,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { @@ -985,10 +985,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1023,10 +1023,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len/size)*size2); + rv = PyString_FromStringAndSize(NULL, (len/size)*size2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0, j=0; i < len; i += size, j += size2 ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1157,7 +1157,7 @@ nbytes / bytes_per_frame != ceiling) str = NULL; else - str = PyBytes_FromStringAndSize(NULL, nbytes); + str = PyString_FromStringAndSize(NULL, nbytes); if (str == NULL) { PyErr_SetString(PyExc_MemoryError, @@ -1165,7 +1165,7 @@ goto exit; } } - ncp = PyBytes_AsString(str); + ncp = PyString_AsString(str); for (;;) { while (d < 0) { @@ -1182,13 +1182,13 @@ goto exit; /* We have checked before that the length * of the string fits into int. */ - len = (int)(ncp - PyBytes_AsString(str)); + len = (int)(ncp - PyString_AsString(str)); if (len == 0) { /*don't want to resize to zero length*/ - rv = PyBytes_FromStringAndSize("", 0); + rv = PyString_FromStringAndSize("", 0); Py_DECREF(str); str = rv; - } else if (_PyBytes_Resize(&str, len) < 0) + } else if (_PyString_Resize(&str, len) < 0) goto exit; rv = Py_BuildValue("(O(iO))", str, d, samps); Py_DECREF(samps); @@ -1255,10 +1255,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/size); + rv = PyString_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1289,10 +1289,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*size); + rv = PyString_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1323,10 +1323,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len/size); + rv = PyString_FromStringAndSize(NULL, len/size); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < len; i += size ) { if ( size == 1 ) val = ((int)*CHARP(cp, i)) << 8; @@ -1357,10 +1357,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len*size); + rv = PyString_FromStringAndSize(NULL, len*size); if ( rv == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(rv); + ncp = (signed char *)PyString_AsString(rv); for ( i=0; i < len*size; i += size ) { cval = *cp++; @@ -1393,10 +1393,10 @@ return 0; } - str = PyBytes_FromStringAndSize(NULL, len/(size*2)); + str = PyString_FromStringAndSize(NULL, len/(size*2)); if ( str == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(str); + ncp = (signed char *)PyString_AsString(str); /* Decode state, should have (value, step) */ if ( state == Py_None ) { @@ -1509,10 +1509,10 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyBytes_FromStringAndSize(NULL, len*size*2); + str = PyString_FromStringAndSize(NULL, len*size*2); if ( str == 0 ) return 0; - ncp = (signed char *)PyBytes_AsString(str); + ncp = (signed char *)PyString_AsString(str); step = stepsizeTable[index]; bufferstep = 0; Modified: python/branches/tlee-ast-optimize/Modules/binascii.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/binascii.c (original) +++ python/branches/tlee-ast-optimize/Modules/binascii.c Mon Jun 9 12:52:48 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyBytesObject) - 3) +#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -203,9 +203,9 @@ ascii_len--; /* Allocate the buffer */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { /* XXX is it really best to add NULs if there's no more data */ @@ -280,9 +280,9 @@ } /* We're lazy and allocate to much (fixed up later) */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2+2)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyBytes_AsString(rv); + ascii_data = (unsigned char *)PyString_AsString(rv); /* Store the length */ *ascii_data++ = ' ' + (bin_len & 077); @@ -304,8 +304,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -354,9 +354,9 @@ bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); bin_len = 0; for( ; ascii_len > 0; ascii_len--, ascii_data++) { @@ -415,13 +415,13 @@ /* And set string size correctly. If the result string is empty ** (because the input was all invalid) return the shared empty - ** string instead; _PyBytes_Resize() won't do this for us. + ** string instead; _PyString_Resize() won't do this for us. */ if (bin_len > 0) - _PyBytes_Resize(&rv, bin_len); + _PyString_Resize(&rv, bin_len); else { Py_DECREF(rv); - rv = PyBytes_FromString(""); + rv = PyString_FromString(""); } return rv; } @@ -448,9 +448,9 @@ /* We're lazy and allocate too much (fixed up later). "+3" leaves room for up to two pad characters and a trailing newline. Note that 'b' gets encoded as 'Yg==\n' (1 in, 5 out). */ - if ( (rv=PyBytes_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) return NULL; - ascii_data = (unsigned char *)PyBytes_AsString(rv); + ascii_data = (unsigned char *)PyString_AsString(rv); for( ; bin_len > 0 ; bin_len--, bin_data++ ) { /* Shift the data into our buffer */ @@ -474,8 +474,8 @@ } *ascii_data++ = '\n'; /* Append a courtesy newline */ - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -498,9 +498,9 @@ /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ - if ( (rv=PyBytes_FromStringAndSize(NULL, len+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, len+2)) == NULL ) return NULL; - bin_data = (unsigned char *)PyBytes_AsString(rv); + bin_data = (unsigned char *)PyString_AsString(rv); for( ; len > 0 ; len--, ascii_data++ ) { /* Get the byte and look it up */ @@ -534,8 +534,8 @@ Py_DECREF(rv); return NULL; } - _PyBytes_Resize( - &rv, (bin_data - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize( + &rv, (bin_data - (unsigned char *)PyString_AsString(rv))); if (rv) { PyObject *rrv = Py_BuildValue("Oi", rv, done); Py_DECREF(rv); @@ -559,9 +559,9 @@ return NULL; /* Worst case: output is twice as big as input (fixed later) */ - if ( (rv=PyBytes_FromStringAndSize(NULL, len*2+2)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; - out_data = (unsigned char *)PyBytes_AsString(rv); + out_data = (unsigned char *)PyString_AsString(rv); for( in=0; in 0 ; len--, bin_data++ ) { /* Shift into our buffer, and output any 6bits ready */ @@ -627,8 +627,8 @@ leftchar <<= (6-leftbits); *ascii_data++ = table_b2a_hqx[leftchar & 0x3f]; } - _PyBytes_Resize(&rv, (ascii_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (ascii_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -647,14 +647,14 @@ /* Empty string is a special case */ if ( in_len == 0 ) - return PyBytes_FromString(""); + return PyString_FromString(""); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; - if ( (rv=PyBytes_FromStringAndSize(NULL, out_len)) == NULL ) + if ( (rv=PyString_FromStringAndSize(NULL, out_len)) == NULL ) return NULL; out_len_left = out_len; - out_data = (unsigned char *)PyBytes_AsString(rv); + out_data = (unsigned char *)PyString_AsString(rv); /* ** We need two macros here to get/put bytes and handle @@ -673,9 +673,9 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ - _PyBytes_Resize(&rv, 2*out_len); \ + _PyString_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ - out_data = (unsigned char *)PyBytes_AsString(rv) \ + out_data = (unsigned char *)PyString_AsString(rv) \ + out_len; \ out_len_left = out_len-1; \ out_len = out_len * 2; \ @@ -723,8 +723,8 @@ OUTBYTE(in_byte); } } - _PyBytes_Resize(&rv, (out_data - - (unsigned char *)PyBytes_AsString(rv))); + _PyString_Resize(&rv, (out_data - + (unsigned char *)PyString_AsString(rv))); return rv; } @@ -923,10 +923,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; - retval = PyBytes_FromStringAndSize(NULL, arglen*2); + retval = PyString_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; - retbuf = PyBytes_AsString(retval); + retbuf = PyString_AsString(retval); if (!retbuf) goto finally; @@ -989,10 +989,10 @@ return NULL; } - retval = PyBytes_FromStringAndSize(NULL, (arglen/2)); + retval = PyString_FromStringAndSize(NULL, (arglen/2)); if (!retval) return NULL; - retbuf = PyBytes_AsString(retval); + retbuf = PyString_AsString(retval); if (!retbuf) goto finally; @@ -1106,7 +1106,7 @@ out++; } } - if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1306,7 +1306,7 @@ } } } - if ((rv = PyBytes_FromStringAndSize((char *)odata, out)) == NULL) { + if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { PyMem_Free(odata); return NULL; } @@ -1354,7 +1354,7 @@ return; d = PyModule_GetDict(m); - x = PyBytes_FromString(doc_binascii); + x = PyString_FromString(doc_binascii); PyDict_SetItemString(d, "__doc__", x); Py_XDECREF(x); Modified: python/branches/tlee-ast-optimize/Modules/bsddbmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/bsddbmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/bsddbmodule.c Mon Jun 9 12:52:48 2008 @@ -312,7 +312,7 @@ return NULL; } - result = PyBytes_FromStringAndSize(data, (int)drec.size); + result = PyString_FromStringAndSize(data, (int)drec.size); if (data != buf) free(data); return result; } @@ -424,7 +424,7 @@ if (dp->di_type == DB_RECNO) item = PyInt_FromLong(*((int*)data)); else - item = PyBytes_FromStringAndSize(data, + item = PyString_FromStringAndSize(data, (int)krec.size); if (data != buf) free(data); if (item == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/bz2module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/bz2module.c (original) +++ python/branches/tlee-ast-optimize/Modules/bz2module.c Mon Jun 9 12:52:48 2008 @@ -34,7 +34,7 @@ #error "Large file support, but neither off_t nor fpos_t is large enough." #endif -#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) +#define BUF(v) PyString_AS_STRING((PyStringObject *)v) #define MODE_CLOSED 0 #define MODE_READ 1 @@ -241,7 +241,7 @@ int univ_newline = f->f_univ_newline; total_v_size = n > 0 ? n : 100; - v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); + v = PyString_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; @@ -307,7 +307,7 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, total_v_size) < 0) + if (_PyString_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -315,7 +315,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyBytes_Resize(&v, used_v_size); + _PyString_Resize(&v, used_v_size); return v; } @@ -438,10 +438,10 @@ /* This is a hacked version of Python's * fileobject.c:readahead_get_line_skip(). */ -static PyBytesObject * +static PyStringObject * Util_ReadAheadGetLineSkip(BZ2FileObject *f, int skip, int bufsize) { - PyBytesObject* s; + PyStringObject* s; char *bufptr; char *buf; int len; @@ -452,17 +452,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip); + return (PyStringObject *) + PyString_FromStringAndSize(NULL, skip); bufptr = memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip+len); + s = (PyStringObject *) + PyString_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) Util_DropReadAhead(f); @@ -476,7 +476,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -509,7 +509,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -531,7 +531,7 @@ "more than a Python string can hold"); goto cleanup; } - ret = PyBytes_FromStringAndSize((char *)NULL, buffersize); + ret = PyString_FromStringAndSize((char *)NULL, buffersize); if (ret == NULL) goto cleanup; bytesread = 0; @@ -557,14 +557,14 @@ } if (bytesrequested < 0) { buffersize = Util_NewBufferSize(buffersize); - if (_PyBytes_Resize(&ret, buffersize) < 0) + if (_PyString_Resize(&ret, buffersize) < 0) goto cleanup; } else { break; } } if (bytesread != buffersize) - _PyBytes_Resize(&ret, bytesread); + _PyString_Resize(&ret, bytesread); cleanup: RELEASE_LOCK(self); @@ -594,7 +594,7 @@ case MODE_READ: break; case MODE_READ_EOF: - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); goto cleanup; case MODE_CLOSED: PyErr_SetString(PyExc_ValueError, @@ -607,7 +607,7 @@ } if (sizehint == 0) - ret = PyBytes_FromString(""); + ret = PyString_FromString(""); else ret = Util_GetLine(self, (sizehint < 0) ? 0 : sizehint); @@ -701,17 +701,17 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyBytes_FromStringAndSize( + big_buffer = PyString_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - _PyBytes_Resize(&big_buffer, buffersize); - buffer = PyBytes_AS_STRING(big_buffer); + _PyString_Resize(&big_buffer, buffersize); + buffer = PyString_AS_STRING(big_buffer); } continue; } @@ -720,7 +720,7 @@ while (p != NULL) { /* Process complete lines */ p++; - line = PyBytes_FromStringAndSize(q, p-q); + line = PyString_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -743,7 +743,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyBytes_FromStringAndSize(buffer, nfilled); + line = PyString_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -753,7 +753,7 @@ Py_DECREF(line); goto error; } - PyBytes_Concat(&line, rest); + PyString_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -915,7 +915,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { const char *buffer; Py_ssize_t len; if (PyObject_AsCharBuffer(v, &buffer, &len)) { @@ -926,7 +926,7 @@ "strings"); goto error; } - line = PyBytes_FromStringAndSize(buffer, + line = PyString_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -942,9 +942,9 @@ Py_BEGIN_ALLOW_THREADS for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyBytes_GET_SIZE(line); + len = PyString_GET_SIZE(line); BZ2_bzWrite (&bzerror, self->fp, - PyBytes_AS_STRING(line), len); + PyString_AS_STRING(line), len); if (bzerror != BZ_OK) { Py_BLOCK_THREADS Util_CatchBZ2Error(bzerror); @@ -1224,13 +1224,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyBytes_FromString("\r"); + return PyString_FromString("\r"); case NEWLINE_LF: - return PyBytes_FromString("\n"); + return PyString_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyBytes_FromString("\r\n"); + return PyString_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -1448,7 +1448,7 @@ static PyObject * BZ2File_iternext(BZ2FileObject *self) { - PyBytesObject* ret; + PyStringObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { PyErr_SetString(PyExc_ValueError, @@ -1457,7 +1457,7 @@ } ret = Util_ReadAheadGetLineSkip(self, 0, READAHEAD_BUFSIZE); RELEASE_LOCK(self); - if (ret == NULL || PyBytes_GET_SIZE(ret) == 0) { + if (ret == NULL || PyString_GET_SIZE(ret) == 0) { Py_XDECREF(ret); return NULL; } @@ -1559,7 +1559,7 @@ return NULL; if (datasize == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); ACQUIRE_LOCK(self); if (!self->running) { @@ -1568,7 +1568,7 @@ goto error; } - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1591,7 +1591,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); goto error; } @@ -1601,7 +1601,7 @@ } } - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1636,7 +1636,7 @@ } self->running = 0; - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1657,7 +1657,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) + if (_PyString_Resize(&ret, bufsize) < 0) goto error; bzs->next_out = BUF(ret); bzs->next_out = BUF(ret) + (BZS_TOTAL_OUT(bzs) @@ -1667,7 +1667,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1849,7 +1849,7 @@ goto error; } - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) goto error; @@ -1868,7 +1868,7 @@ if (bzs->avail_in != 0) { Py_DECREF(self->unused_data); self->unused_data = - PyBytes_FromStringAndSize(bzs->next_in, + PyString_FromStringAndSize(bzs->next_in, bzs->avail_in); } self->running = 0; @@ -1882,7 +1882,7 @@ break; /* no more input data */ if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); goto error; } @@ -1894,7 +1894,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); + _PyString_Resize(&ret, (Py_ssize_t)(BZS_TOTAL_OUT(bzs) - totalout)); RELEASE_LOCK(self); return ret; @@ -1930,7 +1930,7 @@ } #endif - self->unused_data = PyBytes_FromString(""); + self->unused_data = PyString_FromString(""); if (!self->unused_data) goto error; @@ -2063,7 +2063,7 @@ * data in one shot. We will check it later anyway. */ bufsize = datasize + (datasize/100+1) + 600; - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2095,7 +2095,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzCompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2106,7 +2106,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzCompressEnd(bzs); return ret; @@ -2134,9 +2134,9 @@ return NULL; if (datasize == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); - ret = PyBytes_FromStringAndSize(NULL, bufsize); + ret = PyString_FromStringAndSize(NULL, bufsize); if (!ret) return NULL; @@ -2175,7 +2175,7 @@ } if (bzs->avail_out == 0) { bufsize = Util_NewBufferSize(bufsize); - if (_PyBytes_Resize(&ret, bufsize) < 0) { + if (_PyString_Resize(&ret, bufsize) < 0) { BZ2_bzDecompressEnd(bzs); Py_DECREF(ret); return NULL; @@ -2186,7 +2186,7 @@ } if (bzs->avail_out != 0) - _PyBytes_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); + _PyString_Resize(&ret, (Py_ssize_t)BZS_TOTAL_OUT(bzs)); BZ2_bzDecompressEnd(bzs); return ret; @@ -2223,7 +2223,7 @@ if (m == NULL) return; - PyModule_AddObject(m, "__author__", PyBytes_FromString(__author__)); + PyModule_AddObject(m, "__author__", PyString_FromString(__author__)); Py_INCREF(&BZ2File_Type); PyModule_AddObject(m, "BZ2File", (PyObject *)&BZ2File_Type); Modified: python/branches/tlee-ast-optimize/Modules/cPickle.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cPickle.c (original) +++ python/branches/tlee-ast-optimize/Modules/cPickle.c Mon Jun 9 12:52:48 2008 @@ -393,13 +393,13 @@ if (format) args = Py_VaBuildValue(format, va); va_end(va); if (format && ! args) return NULL; - if (stringformat && !(retval=PyBytes_FromString(stringformat))) + if (stringformat && !(retval=PyString_FromString(stringformat))) return NULL; if (retval) { if (args) { PyObject *v; - v=PyBytes_Format(retval, args); + v=PyString_Format(retval, args); Py_DECREF(retval); Py_DECREF(args); if (! v) return NULL; @@ -477,7 +477,7 @@ n = (int)_n; if (s == NULL) { if (!( self->buf_size )) return 0; - py_str = PyBytes_FromStringAndSize(self->write_buf, + py_str = PyString_FromStringAndSize(self->write_buf, self->buf_size); if (!py_str) return -1; @@ -490,7 +490,7 @@ if (n > WRITE_BUF_SIZE) { if (!( py_str = - PyBytes_FromStringAndSize(s, n))) + PyString_FromStringAndSize(s, n))) return -1; } else { @@ -655,7 +655,7 @@ Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyBytes_AsString(str))) return -1; + if (! (*s = PyString_AsString(str))) return -1; return n; } @@ -670,13 +670,13 @@ return -1; } - if ((str_size = PyBytes_Size(str)) < 0) + if ((str_size = PyString_Size(str)) < 0) return -1; Py_XDECREF(self->last_string); self->last_string = str; - if (! (*s = PyBytes_AsString(str))) + if (! (*s = PyString_AsString(str))) return -1; return str_size; @@ -1078,9 +1078,9 @@ "to pickle"); goto finally; } - repr = PyBytes_FromStringAndSize(NULL, (int)nbytes); + repr = PyString_FromStringAndSize(NULL, (int)nbytes); if (repr == NULL) goto finally; - pdata = (unsigned char *)PyBytes_AS_STRING(repr); + pdata = (unsigned char *)PyString_AS_STRING(repr); i = _PyLong_AsByteArray((PyLongObject *)args, pdata, nbytes, 1 /* little endian */, 1 /* signed */); @@ -1121,14 +1121,14 @@ if (!( repr = PyObject_Repr(args))) goto finally; - if ((size = PyBytes_Size(repr)) < 0) + if ((size = PyString_Size(repr)) < 0) goto finally; if (self->write_func(self, &l, 1) < 0) goto finally; if (self->write_func(self, - PyBytes_AS_STRING((PyBytesObject *)repr), + PyString_AS_STRING((PyStringObject *)repr), size) < 0) goto finally; @@ -1177,7 +1177,7 @@ int size, len; PyObject *repr=0; - if ((size = PyBytes_Size(args)) < 0) + if ((size = PyString_Size(args)) < 0) return -1; if (!self->bin) { @@ -1188,9 +1188,9 @@ if (!( repr = PyObject_Repr(args))) return -1; - if ((len = PyBytes_Size(repr)) < 0) + if ((len = PyString_Size(repr)) < 0) goto err; - repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); + repr_str = PyString_AS_STRING((PyStringObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1207,7 +1207,7 @@ int i; char c_str[5]; - if ((size = PyBytes_Size(args)) < 0) + if ((size = PyString_Size(args)) < 0) return -1; if (size < 256) { @@ -1233,8 +1233,8 @@ } else { if (self->write_func(self, - PyBytes_AS_STRING( - (PyBytesObject *)args), + PyString_AS_STRING( + (PyStringObject *)args), size) < 0) return -1; } @@ -1264,13 +1264,13 @@ static const char *hexdigit = "0123456789ABCDEF"; - repr = PyBytes_FromStringAndSize(NULL, 6 * size); + repr = PyString_FromStringAndSize(NULL, 6 * size); if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyBytes_AS_STRING(repr); + p = q = PyString_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; /* Map 16-bit characters to '\uxxxx' */ @@ -1287,7 +1287,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyBytes_Resize(&repr, p - q); + _PyString_Resize(&repr, p - q); return repr; } @@ -1310,9 +1310,9 @@ if (!repr) return -1; - if ((len = PyBytes_Size(repr)) < 0) + if ((len = PyString_Size(repr)) < 0) goto err; - repr_str = PyBytes_AS_STRING((PyBytesObject *)repr); + repr_str = PyString_AS_STRING((PyStringObject *)repr); if (self->write_func(self, &string, 1) < 0) goto err; @@ -1332,7 +1332,7 @@ if (!( repr = PyUnicode_AsUTF8String(args))) return -1; - if ((size = PyBytes_Size(repr)) < 0) + if ((size = PyString_Size(repr)) < 0) goto err; if (size > INT_MAX) return -1; /* string too large */ @@ -1351,7 +1351,7 @@ PDATA_APPEND(self->file, repr, -1); } else { - if (self->write_func(self, PyBytes_AS_STRING(repr), + if (self->write_func(self, PyString_AS_STRING(repr), size) < 0) goto err; } @@ -1861,12 +1861,12 @@ goto finally; - if ((module_size = PyBytes_Size(module)) < 0 || - (name_size = PyBytes_Size(name)) < 0) + if ((module_size = PyString_Size(module)) < 0 || + (name_size = PyString_Size(name)) < 0) goto finally; - module_str = PyBytes_AS_STRING((PyBytesObject *)module); - name_str = PyBytes_AS_STRING((PyBytesObject *)name); + module_str = PyString_AS_STRING((PyStringObject *)module); + name_str = PyString_AS_STRING((PyStringObject *)name); if (self->write_func(self, &inst, 1) < 0) goto finally; @@ -1961,12 +1961,12 @@ if (!( module = whichmodule(args, global_name))) goto finally; - if ((module_size = PyBytes_Size(module)) < 0 || - (name_size = PyBytes_Size(global_name)) < 0) + if ((module_size = PyString_Size(module)) < 0 || + (name_size = PyString_Size(global_name)) < 0) goto finally; - module_str = PyBytes_AS_STRING((PyBytesObject *)module); - name_str = PyBytes_AS_STRING((PyBytesObject *)global_name); + module_str = PyString_AS_STRING((PyStringObject *)module); + name_str = PyString_AS_STRING((PyStringObject *)global_name); /* XXX This can be doing a relative import. Clearly it shouldn't, but I don't know how to stop it. :-( */ @@ -2099,7 +2099,7 @@ if (pid != Py_None) { if (!self->bin) { - if (!PyBytes_Check(pid)) { + if (!PyString_Check(pid)) { PyErr_SetString(PicklingError, "persistent id must be string"); goto finally; @@ -2108,12 +2108,12 @@ if (self->write_func(self, &persid, 1) < 0) goto finally; - if ((size = PyBytes_Size(pid)) < 0) + if ((size = PyString_Size(pid)) < 0) goto finally; if (self->write_func(self, - PyBytes_AS_STRING( - (PyBytesObject *)pid), + PyString_AS_STRING( + (PyStringObject *)pid), size) < 0) goto finally; @@ -2194,8 +2194,8 @@ use_newobj = 0; } else { - use_newobj = PyBytes_Check(temp) && - strcmp(PyBytes_AS_STRING(temp), + use_newobj = PyString_Check(temp) && + strcmp(PyString_AS_STRING(temp), "__newobj__") == 0; Py_DECREF(temp); } @@ -2362,14 +2362,14 @@ break; case 's': - if ((type == &PyBytes_Type) && (PyBytes_GET_SIZE(args) < 2)) { + if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_string(self, args, 0); goto finally; } #ifdef Py_USING_UNICODE case 'u': - if ((type == &PyUnicode_Type) && (PyBytes_GET_SIZE(args) < 2)) { + if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { res = save_unicode(self, args, 0); goto finally; } @@ -2391,7 +2391,7 @@ switch (type->tp_name[0]) { case 's': - if (type == &PyBytes_Type) { + if (type == &PyString_Type) { res = save_string(self, args, 1); goto finally; } @@ -2526,7 +2526,7 @@ if (t == NULL) goto finally; - if (PyBytes_Check(t)) { + if (PyString_Check(t)) { res = save_global(self, args, t); goto finally; } @@ -2640,8 +2640,8 @@ for (rsize = 0, i = l; --i >= 0; ) { k = data->data[i]; - if (PyBytes_Check(k)) - rsize += PyBytes_GET_SIZE(k); + if (PyString_Check(k)) + rsize += PyString_GET_SIZE(k); else if (PyInt_Check(k)) { /* put */ ik = PyInt_AS_LONG((PyIntObject*)k); @@ -2676,17 +2676,17 @@ } /* Now generate the result */ - r = PyBytes_FromStringAndSize(NULL, rsize); + r = PyString_FromStringAndSize(NULL, rsize); if (r == NULL) goto err; - s = PyBytes_AS_STRING((PyBytesObject *)r); + s = PyString_AS_STRING((PyStringObject *)r); for (i = 0; i < l; i++) { k = data->data[i]; - if (PyBytes_Check(k)) { - ssize = PyBytes_GET_SIZE(k); + if (PyString_Check(k)) { + ssize = PyString_GET_SIZE(k); if (ssize) { - p=PyBytes_AS_STRING((PyBytesObject *)k); + p=PyString_AS_STRING((PyStringObject *)k); while (--ssize >= 0) *s++ = *p++; } @@ -3410,7 +3410,7 @@ goto insecure; /********************************************/ - str = PyBytes_DecodeEscape(p, len, NULL, 0, NULL); + str = PyString_DecodeEscape(p, len, NULL, 0, NULL); free(s); if (str) { PDATA_PUSH(self->stack, str, -1); @@ -3439,7 +3439,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyBytes_FromStringAndSize(s, l))) + if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); @@ -3461,7 +3461,7 @@ if (self->read_func(self, &s, l) < 0) return -1; - if (!( py_string = PyBytes_FromStringAndSize(s, l))) return -1; + if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; PDATA_PUSH(self->stack, py_string, -1); return 0; @@ -3688,12 +3688,12 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyBytes_FromStringAndSize(s, len - 1); + module_name = PyString_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { if (len < 2) return bad_readline(); - if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3772,7 +3772,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - module_name = PyBytes_FromStringAndSize(s, len - 1); + module_name = PyString_FromStringAndSize(s, len - 1); if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { @@ -3780,7 +3780,7 @@ Py_DECREF(module_name); return bad_readline(); } - if ((class_name = PyBytes_FromStringAndSize(s, len - 1))) { + if ((class_name = PyString_FromStringAndSize(s, len - 1))) { class = find_class(module_name, class_name, self->find_class); Py_DECREF(class_name); @@ -3805,7 +3805,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - pid = PyBytes_FromStringAndSize(s, len - 1); + pid = PyString_FromStringAndSize(s, len - 1); if (!pid) return -1; if (PyList_Check(self->pers_func)) { @@ -3938,7 +3938,7 @@ if ((len = self->readline_func(self, &s)) < 0) return -1; if (len < 2) return bad_readline(); - if (!( py_str = PyBytes_FromStringAndSize(s, len - 1))) return -1; + if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; value = PyDict_GetItem(self->memo, py_str); if (! value) { @@ -4064,8 +4064,8 @@ * confirm that pair is really a 2-tuple of strings. */ if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || - !PyBytes_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || - !PyBytes_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { + !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || + !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { Py_DECREF(py_code); PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " "isn't a 2-tuple of strings", code); @@ -4098,7 +4098,7 @@ if ((l = self->readline_func(self, &s)) < 0) return -1; if (l < 2) return bad_readline(); if (!( len=self->stack->length )) return stackUnderflow(); - if (!( py_str = PyBytes_FromStringAndSize(s, l - 1))) return -1; + if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; value=self->stack->data[len-1]; l=PyDict_SetItem(self->memo, py_str, value); Py_DECREF(py_str); @@ -5568,7 +5568,7 @@ { PyObject *copyreg, *t, *r; -#define INIT_STR(S) if (!( S ## _str=PyBytes_InternFromString(#S))) return -1; +#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; if (PyType_Ready(&Unpicklertype) < 0) return -1; @@ -5736,7 +5736,7 @@ /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); - v = PyBytes_FromString(rev); + v = PyString_FromString(rev); PyDict_SetItemString(d, "__version__", v); Py_XDECREF(v); @@ -5755,7 +5755,7 @@ /* These are purely informational; no code uses them. */ /* File format version we write. */ - format_version = PyBytes_FromString("2.0"); + format_version = PyString_FromString("2.0"); /* Format versions we can read. */ compatible_formats = Py_BuildValue("[sssss]", "1.0", /* Original protocol 0 */ Modified: python/branches/tlee-ast-optimize/Modules/cStringIO.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cStringIO.c (original) +++ python/branches/tlee-ast-optimize/Modules/cStringIO.c Mon Jun 9 12:52:48 2008 @@ -119,7 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; - return PyBytes_FromStringAndSize(((IOobject*)self)->buf, + return PyString_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,7 +137,7 @@ } else s=self->string_size; - return PyBytes_FromStringAndSize(self->buf, s); + return PyString_FromStringAndSize(self->buf, s); } PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); @@ -177,7 +177,7 @@ if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); @@ -215,7 +215,7 @@ n -= m; self->pos -= m; } - return PyBytes_FromStringAndSize(output, n); + return PyString_FromStringAndSize(output, n); } PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); @@ -238,7 +238,7 @@ goto err; if (n == 0) break; - line = PyBytes_FromStringAndSize (output, n); + line = PyString_FromStringAndSize (output, n); if (!line) goto err; if (PyList_Append (result, line) == -1) { @@ -315,7 +315,7 @@ next = IO_readline((IOobject *)self, NULL); if (!next) return NULL; - if (!PyBytes_GET_SIZE(next)) { + if (!PyString_GET_SIZE(next)) { Py_DECREF(next); PyErr_SetNone(PyExc_StopIteration); return NULL; @@ -456,7 +456,7 @@ while ((s = PyIter_Next(it)) != NULL) { Py_ssize_t n; char *c; - if (PyBytes_AsStringAndSize(s, &c, &n) == -1) { + if (PyString_AsStringAndSize(s, &c, &n) == -1) { Py_DECREF(it); Py_DECREF(s); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/cdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/cdmodule.c Mon Jun 9 12:52:48 2008 @@ -239,19 +239,19 @@ if (!PyArg_ParseTuple(args, "i:readda", &numframes)) return NULL; - result = PyBytes_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); + result = PyString_FromStringAndSize(NULL, numframes * sizeof(CDFRAME)); if (result == NULL) return NULL; n = CDreadda(self->ob_cdplayer, - (CDFRAME *) PyBytes_AsString(result), numframes); + (CDFRAME *) PyString_AsString(result), numframes); if (n == -1) { Py_DECREF(result); PyErr_SetFromErrno(CdError); return NULL; } if (n < numframes) - _PyBytes_Resize(&result, n * sizeof(CDFRAME)); + _PyString_Resize(&result, n * sizeof(CDFRAME)); return result; } @@ -468,7 +468,7 @@ PyTuple_SetItem(args, 1, PyInt_FromLong((long) type)); switch (type) { case cd_audio: - v = PyBytes_FromStringAndSize(data, CDDA_DATASIZE); + v = PyString_FromStringAndSize(data, CDDA_DATASIZE); break; case cd_pnum: case cd_index: @@ -484,15 +484,15 @@ #undef ptr break; case cd_catalog: - v = PyBytes_FromStringAndSize(NULL, 13); - p = PyBytes_AsString(v); + v = PyString_FromStringAndSize(NULL, 13); + p = PyString_AsString(v); for (i = 0; i < 13; i++) *p++ = ((char *) data)[i] + '0'; break; case cd_ident: #define ptr ((struct cdident *) data) - v = PyBytes_FromStringAndSize(NULL, 12); - p = PyBytes_AsString(v); + v = PyString_FromStringAndSize(NULL, 12); + p = PyString_AsString(v); CDsbtoa(p, ptr->country, 2); p += 2; CDsbtoa(p, ptr->owner, 3); Modified: python/branches/tlee-ast-optimize/Modules/cgensupport.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cgensupport.c (original) +++ python/branches/tlee-ast-optimize/Modules/cgensupport.c Mon Jun 9 12:52:48 2008 @@ -119,10 +119,10 @@ PyObject *v; if (!PyArg_GetObject(args, nargs, i, &v)) return 0; - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { return PyErr_BadArgument(); } - *p_arg = PyBytes_AsString(v); + *p_arg = PyString_AsString(v); return 1; } Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h (original) +++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/cjkcodecs.h Mon Jun 9 12:52:48 2008 @@ -261,7 +261,7 @@ const MultibyteCodec *codec; const char *enc; - if (!PyBytes_Check(encoding)) { + if (!PyString_Check(encoding)) { PyErr_SetString(PyExc_TypeError, "encoding name must be a string."); return NULL; @@ -271,7 +271,7 @@ if (cofunc == NULL) return NULL; - enc = PyBytes_AS_STRING(encoding); + enc = PyString_AS_STRING(encoding); for (codec = codec_list; codec->encoding[0]; codec++) if (strcmp(codec->encoding, enc) == 0) break; Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c (original) +++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c Mon Jun 9 12:52:48 2008 @@ -85,7 +85,7 @@ else if (strcmp(errors, "replace") == 0) return ERROR_REPLACE; else - return PyBytes_FromString(errors); + return PyString_FromString(errors); } static PyObject * @@ -93,8 +93,8 @@ { PyObject *args, *cb, *r; - assert(PyBytes_Check(errors)); - cb = PyCodec_LookupError(PyBytes_AS_STRING(errors)); + assert(PyString_Check(errors)); + cb = PyCodec_LookupError(PyString_AS_STRING(errors)); if (cb == NULL) return NULL; @@ -129,7 +129,7 @@ return self->errors; } - return PyBytes_FromString(errors); + return PyString_FromString(errors); } static int @@ -138,12 +138,12 @@ { PyObject *cb; - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "errors must be a string"); return -1; } - cb = internal_error_callback(PyBytes_AS_STRING(value)); + cb = internal_error_callback(PyString_AS_STRING(value)); if (cb == NULL) return -1; @@ -166,15 +166,15 @@ Py_ssize_t orgpos, orgsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - - PyBytes_AS_STRING(buf->outobj)); - orgsize = PyBytes_GET_SIZE(buf->outobj); - if (_PyBytes_Resize(&buf->outobj, orgsize + ( + PyString_AS_STRING(buf->outobj)); + orgsize = PyString_GET_SIZE(buf->outobj); + if (_PyString_Resize(&buf->outobj, orgsize + ( esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) return -1; - buf->outbuf = (unsigned char *)PyBytes_AS_STRING(buf->outobj) +orgpos; - buf->outbuf_end = (unsigned char *)PyBytes_AS_STRING(buf->outobj) - + PyBytes_GET_SIZE(buf->outobj); + buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; + buf->outbuf_end = (unsigned char *)PyString_AS_STRING(buf->outobj) + + PyString_GET_SIZE(buf->outobj); return 0; } @@ -322,10 +322,10 @@ goto errorexit; } - retstrsize = PyBytes_GET_SIZE(retstr); + retstrsize = PyString_GET_SIZE(retstr); REQUIRE_ENCODEBUFFER(buf, retstrsize); - memcpy(buf->outbuf, PyBytes_AS_STRING(retstr), retstrsize); + memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); buf->outbuf += retstrsize; newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); @@ -468,16 +468,16 @@ Py_ssize_t finalsize, r = 0; if (datalen == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; - buf.outobj = PyBytes_FromStringAndSize(NULL, datalen * 2 + 16); + buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; - buf.outbuf = (unsigned char *)PyBytes_AS_STRING(buf.outobj); - buf.outbuf_end = buf.outbuf + PyBytes_GET_SIZE(buf.outobj); + buf.outbuf = (unsigned char *)PyString_AS_STRING(buf.outobj); + buf.outbuf_end = buf.outbuf + PyString_GET_SIZE(buf.outobj); while (buf.inbuf < buf.inbuf_end) { Py_ssize_t inleft, outleft; @@ -512,10 +512,10 @@ } finalsize = (Py_ssize_t)((char *)buf.outbuf - - PyBytes_AS_STRING(buf.outobj)); + PyString_AS_STRING(buf.outobj)); - if (finalsize != PyBytes_GET_SIZE(buf.outobj)) - if (_PyBytes_Resize(&buf.outobj, finalsize) == -1) + if (finalsize != PyString_GET_SIZE(buf.outobj)) + if (_PyString_Resize(&buf.outobj, finalsize) == -1) goto errorexit; Py_XDECREF(buf.excobj); @@ -1222,35 +1222,35 @@ if (cres == NULL) goto errorexit; - if (!PyBytes_Check(cres)) { + if (!PyString_Check(cres)) { PyErr_SetString(PyExc_TypeError, "stream function returned a " "non-string object"); goto errorexit; } - endoffile = (PyBytes_GET_SIZE(cres) == 0); + endoffile = (PyString_GET_SIZE(cres) == 0); if (self->pendingsize > 0) { PyObject *ctr; char *ctrdata; - rsize = PyBytes_GET_SIZE(cres) + self->pendingsize; - ctr = PyBytes_FromStringAndSize(NULL, rsize); + rsize = PyString_GET_SIZE(cres) + self->pendingsize; + ctr = PyString_FromStringAndSize(NULL, rsize); if (ctr == NULL) goto errorexit; - ctrdata = PyBytes_AS_STRING(ctr); + ctrdata = PyString_AS_STRING(ctr); memcpy(ctrdata, self->pending, self->pendingsize); memcpy(ctrdata + self->pendingsize, - PyBytes_AS_STRING(cres), - PyBytes_GET_SIZE(cres)); + PyString_AS_STRING(cres), + PyString_GET_SIZE(cres)); Py_DECREF(cres); cres = ctr; self->pendingsize = 0; } - rsize = PyBytes_GET_SIZE(cres); - if (decoder_prepare_buffer(&buf, PyBytes_AS_STRING(cres), + rsize = PyString_GET_SIZE(cres); + if (decoder_prepare_buffer(&buf, PyString_AS_STRING(cres), rsize) != 0) goto errorexit; @@ -1585,7 +1585,7 @@ if (pwrt == NULL) return NULL; - if (PyBytes_Size(pwrt) > 0) { + if (PyString_Size(pwrt) > 0) { PyObject *wr; wr = PyObject_CallMethod(self->stream, "write", "O", pwrt); if (wr == NULL) { Modified: python/branches/tlee-ast-optimize/Modules/clmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/clmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/clmodule.c Mon Jun 9 12:52:48 2008 @@ -111,7 +111,7 @@ return NULL; retry: - compressedBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); + compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); if (compressedBuffer == NULL) return NULL; @@ -120,7 +120,7 @@ if (clCompressImage(compressionScheme, width, height, originalFormat, compressionRatio, (void *) frameBuffer, &compressedBufferSize, - (void *) PyBytes_AsString(compressedBuffer)) + (void *) PyString_AsString(compressedBuffer)) == FAILURE || error_handler_called) { Py_DECREF(compressedBuffer); if (!error_handler_called) @@ -135,7 +135,7 @@ } if (compressedBufferSize < frameBufferSize) - _PyBytes_Resize(&compressedBuffer, compressedBufferSize); + _PyString_Resize(&compressedBuffer, compressedBufferSize); return compressedBuffer; } @@ -155,14 +155,14 @@ frameBufferSize = width * height * CL_BytesPerPixel(originalFormat); - frameBuffer = PyBytes_FromStringAndSize(NULL, frameBufferSize); + frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize); if (frameBuffer == NULL) return NULL; error_handler_called = 0; if (clDecompressImage(compressionScheme, width, height, originalFormat, compressedBufferSize, compressedBuffer, - (void *) PyBytes_AsString(frameBuffer)) + (void *) PyString_AsString(frameBuffer)) == FAILURE || error_handler_called) { Py_DECREF(frameBuffer); if (!error_handler_called) @@ -236,14 +236,14 @@ if (error_handler_called) return NULL; - data = PyBytes_FromStringAndSize(NULL, size); + data = PyString_FromStringAndSize(NULL, size); if (data == NULL) return NULL; error_handler_called = 0; if (clCompress(SELF->ob_compressorHdl, numberOfFrames, (void *) frameBuffer, &compressedBufferSize, - (void *) PyBytes_AsString(data)) == FAILURE || + (void *) PyString_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -252,7 +252,7 @@ } if (compressedBufferSize < size) - if (_PyBytes_Resize(&data, compressedBufferSize)) + if (_PyString_Resize(&data, compressedBufferSize)) return NULL; if (compressedBufferSize > size) { @@ -285,14 +285,14 @@ if (error_handler_called) return NULL; - data = PyBytes_FromStringAndSize(NULL, dataSize); + data = PyString_FromStringAndSize(NULL, dataSize); if (data == NULL) return NULL; error_handler_called = 0; if (clDecompress(SELF->ob_compressorHdl, numberOfFrames, compressedDataSize, (void *) compressedData, - (void *) PyBytes_AsString(data)) == FAILURE || + (void *) PyString_AsString(data)) == FAILURE || error_handler_called) { Py_DECREF(data); if (!error_handler_called) @@ -514,7 +514,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyBytes_FromString((char *) PVbuffer[i])); + PyString_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -563,7 +563,7 @@ return NULL; } - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * @@ -775,7 +775,7 @@ PyList_SetItem(list, i, Py_None); } else PyList_SetItem(list, i, - PyBytes_FromString((char *) PVbuffer[i])); + PyString_FromString((char *) PVbuffer[i])); } PyMem_DEL(PVbuffer); @@ -818,7 +818,7 @@ return NULL; } - return PyBytes_FromString(name); + return PyString_FromString(name); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/datetimemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/datetimemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/datetimemodule.c Mon Jun 9 12:52:48 2008 @@ -947,7 +947,7 @@ else result = PyObject_CallMethod(tzinfo, "tzname", "O", tzinfoarg); - if (result != NULL && result != Py_None && ! PyBytes_Check(result)) { + if (result != NULL && result != Py_None && ! PyString_Check(result)) { PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " "return None or a string, not '%s'", Py_TYPE(result)->tp_name); @@ -1046,27 +1046,27 @@ { PyObject *temp; - assert(PyBytes_Check(repr)); + assert(PyString_Check(repr)); assert(tzinfo); if (tzinfo == Py_None) return repr; /* Get rid of the trailing ')'. */ - assert(PyBytes_AsString(repr)[PyBytes_Size(repr)-1] == ')'); - temp = PyBytes_FromStringAndSize(PyBytes_AsString(repr), - PyBytes_Size(repr) - 1); + assert(PyString_AsString(repr)[PyString_Size(repr)-1] == ')'); + temp = PyString_FromStringAndSize(PyString_AsString(repr), + PyString_Size(repr) - 1); Py_DECREF(repr); if (temp == NULL) return NULL; repr = temp; /* Append ", tzinfo=". */ - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(", tzinfo=")); + PyString_ConcatAndDel(&repr, PyString_FromString(", tzinfo=")); /* Append repr(tzinfo). */ - PyBytes_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); + PyString_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); /* Add a closing paren. */ - PyBytes_ConcatAndDel(&repr, PyBytes_FromString(")")); + PyString_ConcatAndDel(&repr, PyString_FromString(")")); return repr; } @@ -1092,7 +1092,7 @@ DayNames[wday], MonthNames[GET_MONTH(date) - 1], GET_DAY(date), hours, minutes, seconds, GET_YEAR(date)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* Add an hours & minutes UTC offset string to buf. buf has no more than @@ -1143,7 +1143,7 @@ else sprintf(freplacement, "%06d", 0); - return PyBytes_FromStringAndSize(freplacement, strlen(freplacement)); + return PyString_FromStringAndSize(freplacement, strlen(freplacement)); } /* I sure don't want to reproduce the strftime code from the time module, @@ -1230,7 +1230,7 @@ /* format utcoffset */ char buf[100]; PyObject *tzinfo = get_tzinfo_member(object); - zreplacement = PyBytes_FromString(""); + zreplacement = PyString_FromString(""); if (zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { assert(tzinfoarg != NULL); @@ -1241,19 +1241,19 @@ tzinfoarg) < 0) goto Done; Py_DECREF(zreplacement); - zreplacement = PyBytes_FromString(buf); + zreplacement = PyString_FromString(buf); if (zreplacement == NULL) goto Done; } } assert(zreplacement != NULL); - ptoappend = PyBytes_AS_STRING(zreplacement); - ntoappend = PyBytes_GET_SIZE(zreplacement); + ptoappend = PyString_AS_STRING(zreplacement); + ntoappend = PyString_GET_SIZE(zreplacement); } else if (ch == 'Z') { /* format tzname */ if (Zreplacement == NULL) { PyObject *tzinfo = get_tzinfo_member(object); - Zreplacement = PyBytes_FromString(""); + Zreplacement = PyString_FromString(""); if (Zreplacement == NULL) goto Done; if (tzinfo != Py_None && tzinfo != NULL) { PyObject *temp; @@ -1261,7 +1261,7 @@ temp = call_tzname(tzinfo, tzinfoarg); if (temp == NULL) goto Done; if (temp != Py_None) { - assert(PyBytes_Check(temp)); + assert(PyString_Check(temp)); /* Since the tzname is getting * stuffed into the format, we * have to double any % signs @@ -1275,7 +1275,7 @@ Py_DECREF(temp); if (Zreplacement == NULL) goto Done; - if (!PyBytes_Check(Zreplacement)) { + if (!PyString_Check(Zreplacement)) { PyErr_SetString(PyExc_TypeError, "tzname.replace() did not return a string"); goto Done; } @@ -1285,8 +1285,8 @@ } } assert(Zreplacement != NULL); - ptoappend = PyBytes_AS_STRING(Zreplacement); - ntoappend = PyBytes_GET_SIZE(Zreplacement); + ptoappend = PyString_AS_STRING(Zreplacement); + ntoappend = PyString_GET_SIZE(Zreplacement); } else if (ch == 'f') { /* format microseconds */ @@ -1296,9 +1296,9 @@ goto Done; } assert(freplacement != NULL); - assert(PyBytes_Check(freplacement)); - ptoappend = PyBytes_AS_STRING(freplacement); - ntoappend = PyBytes_GET_SIZE(freplacement); + assert(PyString_Check(freplacement)); + ptoappend = PyString_AS_STRING(freplacement); + ntoappend = PyString_GET_SIZE(freplacement); } else { /* percent followed by neither z nor Z */ @@ -1319,10 +1319,10 @@ PyErr_NoMemory(); goto Done; } - if (_PyBytes_Resize(&newfmt, bigger) < 0) + if (_PyString_Resize(&newfmt, bigger) < 0) goto Done; totalnew = bigger; - pnew = PyBytes_AsString(newfmt) + usednew; + pnew = PyString_AsString(newfmt) + usednew; } memcpy(pnew, ptoappend, ntoappend); pnew += ntoappend; @@ -1330,7 +1330,7 @@ assert(usednew <= totalnew); } /* end while() */ - if (_PyBytes_Resize(&newfmt, usednew) < 0) + if (_PyString_Resize(&newfmt, usednew) < 0) goto Done; { PyObject *time = PyImport_ImportModuleNoBlock("time"); @@ -2008,18 +2008,18 @@ delta_repr(PyDateTime_Delta *self) { if (GET_TD_MICROSECONDS(self) != 0) - return PyBytes_FromFormat("%s(%d, %d, %d)", + return PyString_FromFormat("%s(%d, %d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self), GET_TD_MICROSECONDS(self)); if (GET_TD_SECONDS(self) != 0) - return PyBytes_FromFormat("%s(%d, %d)", + return PyString_FromFormat("%s(%d, %d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self), GET_TD_SECONDS(self)); - return PyBytes_FromFormat("%s(%d)", + return PyString_FromFormat("%s(%d)", Py_TYPE(self)->tp_name, GET_TD_DAYS(self)); } @@ -2063,7 +2063,7 @@ pbuf += n; } - return PyBytes_FromStringAndSize(buf, pbuf - buf); + return PyString_FromStringAndSize(buf, pbuf - buf); Fail: PyErr_SetString(PyExc_SystemError, "goofy result from PyOS_snprintf"); @@ -2242,15 +2242,15 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) == 1 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_Date *me; me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); me->hashcode = -1; } @@ -2448,7 +2448,7 @@ type_name, GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } static PyObject * @@ -2457,7 +2457,7 @@ char buffer[128]; isoformat_date(self, buffer, sizeof(buffer)); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* str() calls the appropriate isoformat() method. */ @@ -2508,9 +2508,9 @@ return NULL; /* Check for str or unicode */ - if (PyBytes_Check(format)) { + if (PyString_Check(format)) { /* If format is zero length, return str(self) */ - if (PyBytes_GET_SIZE(format) == 0) + if (PyString_GET_SIZE(format) == 0) return PyObject_Str((PyObject *)self); } else if (PyUnicode_Check(format)) { /* If format is zero length, return str(self) */ @@ -2653,7 +2653,7 @@ { return Py_BuildValue( "(N)", - PyBytes_FromStringAndSize((char *)self->data, + PyString_FromStringAndSize((char *)self->data, _PyDateTime_DATE_DATASIZE)); } @@ -3109,9 +3109,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyBytes_AS_STRING(state)[0])) < 24) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && + ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) { PyDateTime_Time *me; char aware; @@ -3127,7 +3127,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); me->hashcode = -1; @@ -3213,7 +3213,7 @@ else PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d)", type_name, h, m); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); if (result != NULL && HASTZINFO(self)) result = append_keyword_tzinfo(result, self->tzinfo); return result; @@ -3240,7 +3240,7 @@ _PyDateTime_TIME_DATASIZE); isoformat_time(pdatetime, buf, sizeof(buf)); - result = PyBytes_FromString(buf); + result = PyString_FromString(buf); if (result == NULL || ! HASTZINFO(self) || self->tzinfo == Py_None) return result; @@ -3250,7 +3250,7 @@ Py_DECREF(result); return NULL; } - PyBytes_ConcatAndDel(&result, PyBytes_FromString(buf)); + PyString_ConcatAndDel(&result, PyString_FromString(buf)); return result; } @@ -3364,7 +3364,7 @@ /* Reduce this to a hash of another object. */ if (offset == 0) - temp = PyBytes_FromStringAndSize((char *)self->data, + temp = PyString_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); else { int hour; @@ -3452,7 +3452,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, + basestate = PyString_FromStringAndSize((char *)self->data, _PyDateTime_TIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) @@ -3639,9 +3639,9 @@ /* Check for invocation from pickle with __getstate__ state */ if (PyTuple_GET_SIZE(args) >= 1 && PyTuple_GET_SIZE(args) <= 2 && - PyBytes_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyBytes_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyBytes_AS_STRING(state)[2])) + PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && + PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && + MONTH_IS_SANE(PyString_AS_STRING(state)[2])) { PyDateTime_DateTime *me; char aware; @@ -3657,7 +3657,7 @@ aware = (char)(tzinfo != Py_None); me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { - char *pdata = PyBytes_AS_STRING(state); + char *pdata = PyString_AS_STRING(state); memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); me->hashcode = -1; @@ -4166,7 +4166,7 @@ GET_YEAR(self), GET_MONTH(self), GET_DAY(self), DATE_GET_HOUR(self), DATE_GET_MINUTE(self)); } - baserepr = PyBytes_FromString(buffer); + baserepr = PyString_FromString(buffer); if (baserepr == NULL || ! HASTZINFO(self)) return baserepr; return append_keyword_tzinfo(baserepr, self->tzinfo); @@ -4194,7 +4194,7 @@ assert(cp != NULL); *cp++ = sep; isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); if (result == NULL || ! HASTZINFO(self)) return result; @@ -4204,7 +4204,7 @@ Py_DECREF(result); return NULL; } - PyBytes_ConcatAndDel(&result, PyBytes_FromString(buffer)); + PyString_ConcatAndDel(&result, PyString_FromString(buffer)); return result; } @@ -4310,7 +4310,7 @@ /* Reduce this to a hash of another object. */ if (n == OFFSET_NAIVE) - temp = PyBytes_FromStringAndSize( + temp = PyString_FromStringAndSize( (char *)self->data, _PyDateTime_DATETIME_DATASIZE); else { @@ -4533,7 +4533,7 @@ PyObject *basestate; PyObject *result = NULL; - basestate = PyBytes_FromStringAndSize((char *)self->data, + basestate = PyString_FromStringAndSize((char *)self->data, _PyDateTime_DATETIME_DATASIZE); if (basestate != NULL) { if (! HASTZINFO(self) || self->tzinfo == Py_None) Modified: python/branches/tlee-ast-optimize/Modules/dbmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/dbmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/dbmmodule.c Mon Jun 9 12:52:48 2008 @@ -104,7 +104,7 @@ drec = dbm_fetch(dp->di_dbm, krec); if ( drec.dptr == 0 ) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)key)); + PyString_AS_STRING((PyStringObject *)key)); return NULL; } if ( dbm_error(dp->di_dbm) ) { @@ -112,7 +112,7 @@ PyErr_SetString(DbmError, ""); return NULL; } - return PyBytes_FromStringAndSize(drec.dptr, drec.dsize); + return PyString_FromStringAndSize(drec.dptr, drec.dsize); } static int @@ -136,7 +136,7 @@ if ( dbm_delete(dp->di_dbm, krec) < 0 ) { dbm_clearerr(dp->di_dbm); PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)v)); + PyString_AS_STRING((PyStringObject *)v)); return -1; } } else { @@ -166,7 +166,7 @@ { datum key, val; - if (PyBytes_AsStringAndSize(v, (char **)&key.dptr, + if (PyString_AsStringAndSize(v, (char **)&key.dptr, (Py_ssize_t *)&key.dsize)) { return -1; } @@ -222,7 +222,7 @@ return NULL; for (key = dbm_firstkey(dp->di_dbm); key.dptr; key = dbm_nextkey(dp->di_dbm)) { - item = PyBytes_FromStringAndSize(key.dptr, key.dsize); + item = PyString_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { Py_DECREF(v); return NULL; @@ -269,7 +269,7 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyBytes_FromStringAndSize(val.dptr, val.dsize); + return PyString_FromStringAndSize(val.dptr, val.dsize); else { Py_INCREF(defvalue); return defvalue; @@ -292,16 +292,16 @@ check_dbmobject_open(dp); val = dbm_fetch(dp->di_dbm, key); if (val.dptr != NULL) - return PyBytes_FromStringAndSize(val.dptr, val.dsize); + return PyString_FromStringAndSize(val.dptr, val.dsize); if (defvalue == NULL) { - defvalue = PyBytes_FromStringAndSize(NULL, 0); + defvalue = PyString_FromStringAndSize(NULL, 0); if (defvalue == NULL) return NULL; } else Py_INCREF(defvalue); - val.dptr = PyBytes_AS_STRING(defvalue); - val.dsize = PyBytes_GET_SIZE(defvalue); + val.dptr = PyString_AS_STRING(defvalue); + val.dsize = PyString_GET_SIZE(defvalue); if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) { dbm_clearerr(dp->di_dbm); PyErr_SetString(DbmError, "cannot add item to database"); @@ -404,7 +404,7 @@ d = PyModule_GetDict(m); if (DbmError == NULL) DbmError = PyErr_NewException("dbm.error", NULL, NULL); - s = PyBytes_FromString(which_dbm); + s = PyString_FromString(which_dbm); if (s != NULL) { PyDict_SetItemString(d, "library", s); Py_DECREF(s); Modified: python/branches/tlee-ast-optimize/Modules/dlmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/dlmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/dlmodule.c Mon Jun 9 12:52:48 2008 @@ -58,8 +58,8 @@ { char *name; PyUnivPtr *func; - if (PyBytes_Check(args)) { - name = PyBytes_AS_STRING(args); + if (PyString_Check(args)) { + name = PyString_AS_STRING(args); } else { PyErr_Format(PyExc_TypeError, "expected string, found %.200s", Py_TYPE(args)->tp_name); @@ -88,14 +88,14 @@ return NULL; } name = PyTuple_GetItem(args, 0); - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "function name must be a string"); return NULL; } func = (long (*)(long, long, long, long, long, long, long, long, long, long)) - dlsym(xp->dl_handle, PyBytes_AsString(name)); + dlsym(xp->dl_handle, PyString_AsString(name)); if (func == NULL) { PyErr_SetString(PyExc_ValueError, dlerror()); return NULL; @@ -109,8 +109,8 @@ PyObject *v = PyTuple_GetItem(args, i); if (PyInt_Check(v)) alist[i-1] = PyInt_AsLong(v); - else if (PyBytes_Check(v)) - alist[i-1] = (long)PyBytes_AsString(v); + else if (PyString_Check(v)) + alist[i-1] = (long)PyString_AsString(v); else if (v == Py_None) alist[i-1] = (long) ((char *)NULL); else { Modified: python/branches/tlee-ast-optimize/Modules/errnomodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/errnomodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/errnomodule.c Mon Jun 9 12:52:48 2008 @@ -21,7 +21,7 @@ static void _inscode(PyObject *d, PyObject *de, char *name, int code) { - PyObject *u = PyBytes_FromString(name); + PyObject *u = PyString_FromString(name); PyObject *v = PyInt_FromLong((long) code); /* Don't bother checking for errors; they'll be caught at the end Modified: python/branches/tlee-ast-optimize/Modules/fcntlmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/fcntlmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/fcntlmodule.c Mon Jun 9 12:52:48 2008 @@ -55,7 +55,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } PyErr_Clear(); @@ -164,7 +164,7 @@ return PyInt_FromLong(ret); } else { - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } } @@ -185,7 +185,7 @@ PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return PyBytes_FromStringAndSize(buf, len); + return PyString_FromStringAndSize(buf, len); } PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Modules/flmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/flmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/flmodule.c Mon Jun 9 12:52:48 2008 @@ -324,7 +324,7 @@ /* "label" is an exception, getmember only works for char pointers, not for char arrays */ if (strcmp(name, "label") == 0) - return PyBytes_FromString(g->ob_generic->label); + return PyString_FromString(g->ob_generic->label); return PyMember_Get((char *)g->ob_generic, generic_memberlist, name); } @@ -343,12 +343,12 @@ /* "label" is an exception: setmember doesn't set strings; and FORMS wants you to call a function to set the label */ if (strcmp(name, "label") == 0) { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_SetString(PyExc_TypeError, "label attr must be string"); return -1; } - fl_set_object_label(g->ob_generic, PyBytes_AsString(v)); + fl_set_object_label(g->ob_generic, PyString_AsString(v)); return 0; } @@ -369,7 +369,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", g, g->ob_generic->objclass); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyTypeObject GenericObjecttype = { @@ -530,7 +530,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString (str); + return PyString_FromString (str); } /* int func (object) */ @@ -628,7 +628,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString (str); + return PyString_FromString (str); } static PyObject * @@ -1594,7 +1594,7 @@ char buf[100]; PyOS_snprintf(buf, sizeof(buf), "", f, f->ob_form->window); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyTypeObject Formtype = { @@ -2027,7 +2027,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * @@ -2046,7 +2046,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } @@ -2061,7 +2061,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * Modified: python/branches/tlee-ast-optimize/Modules/fmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/fmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/fmmodule.c Mon Jun 9 12:52:48 2008 @@ -66,7 +66,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); return NULL; } - return PyBytes_FromStringAndSize(fontname, len); + return PyString_FromStringAndSize(fontname, len); } static PyObject * @@ -79,7 +79,7 @@ PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); return NULL; } - return PyBytes_FromStringAndSize(comment, len); + return PyString_FromStringAndSize(comment, len); } static PyObject * @@ -200,7 +200,7 @@ PyObject *v; if (fontlist == NULL) return; - v = PyBytes_FromString(fontname); + v = PyString_FromString(fontname); if (v == NULL) err = -1; else { @@ -240,7 +240,7 @@ static PyObject * fm_fontpath(PyObject *self) { - return PyBytes_FromString(fmfontpath()); + return PyString_FromString(fmfontpath()); } static PyMethodDef fm_methods[] = { Modified: python/branches/tlee-ast-optimize/Modules/gcmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/gcmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/gcmodule.c Mon Jun 9 12:52:48 2008 @@ -639,8 +639,8 @@ char *cname; /* simple version of instance_repr */ PyObject *classname = inst->in_class->cl_name; - if (classname != NULL && PyBytes_Check(classname)) - cname = PyBytes_AsString(classname); + if (classname != NULL && PyString_Check(classname)) + cname = PyString_AsString(classname); else cname = "?"; PySys_WriteStderr("gc: %.100s <%.100s instance at %p>\n", @@ -754,7 +754,7 @@ double t1 = 0.0; if (delstr == NULL) { - delstr = PyBytes_InternFromString("__del__"); + delstr = PyString_InternFromString("__del__"); if (delstr == NULL) Py_FatalError("gc couldn't allocate \"__del__\""); } @@ -898,7 +898,7 @@ if (PyErr_Occurred()) { if (gc_str == NULL) - gc_str = PyBytes_FromString("garbage collection"); + gc_str = PyString_FromString("garbage collection"); PyErr_WriteUnraisable(gc_str); Py_FatalError("unexpected exception during garbage collection"); } Modified: python/branches/tlee-ast-optimize/Modules/gdbmmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/gdbmmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/gdbmmodule.c Mon Jun 9 12:52:48 2008 @@ -128,10 +128,10 @@ drec = gdbm_fetch(dp->di_dbm, krec); if (drec.dptr == 0) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)key)); + PyString_AS_STRING((PyStringObject *)key)); return NULL; } - v = PyBytes_FromStringAndSize(drec.dptr, drec.dsize); + v = PyString_FromStringAndSize(drec.dptr, drec.dsize); free(drec.dptr); return v; } @@ -155,7 +155,7 @@ if (w == NULL) { if (gdbm_delete(dp->di_dbm, krec) < 0) { PyErr_SetString(PyExc_KeyError, - PyBytes_AS_STRING((PyBytesObject *)v)); + PyString_AS_STRING((PyStringObject *)v)); return -1; } } @@ -188,14 +188,14 @@ "GDBM object has already been closed"); return -1; } - if (!PyBytes_Check(arg)) { + if (!PyString_Check(arg)) { PyErr_Format(PyExc_TypeError, "gdbm key must be string, not %.100s", arg->ob_type->tp_name); return -1; } - key.dptr = PyBytes_AS_STRING(arg); - key.dsize = PyBytes_GET_SIZE(arg); + key.dptr = PyString_AS_STRING(arg); + key.dsize = PyString_GET_SIZE(arg); return gdbm_exists(dp->di_dbm, key); } @@ -255,7 +255,7 @@ key = gdbm_firstkey(dp->di_dbm); while (key.dptr) { - item = PyBytes_FromStringAndSize(key.dptr, key.dsize); + item = PyString_FromStringAndSize(key.dptr, key.dsize); if (item == NULL) { free(key.dptr); Py_DECREF(v); @@ -306,7 +306,7 @@ check_dbmobject_open(dp); key = gdbm_firstkey(dp->di_dbm); if (key.dptr) { - v = PyBytes_FromStringAndSize(key.dptr, key.dsize); + v = PyString_FromStringAndSize(key.dptr, key.dsize); free(key.dptr); return v; } @@ -338,7 +338,7 @@ check_dbmobject_open(dp); nextkey = gdbm_nextkey(dp->di_dbm, key); if (nextkey.dptr) { - v = PyBytes_FromStringAndSize(nextkey.dptr, nextkey.dsize); + v = PyString_FromStringAndSize(nextkey.dptr, nextkey.dsize); free(nextkey.dptr); return v; } @@ -541,7 +541,7 @@ DbmError = PyErr_NewException("gdbm.error", NULL, NULL); if (DbmError != NULL) { PyDict_SetItemString(d, "error", DbmError); - s = PyBytes_FromString(dbmmodule_open_flags); + s = PyString_FromString(dbmmodule_open_flags); PyDict_SetItemString(d, "open_flags", s); Py_DECREF(s); } Modified: python/branches/tlee-ast-optimize/Modules/glmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/glmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/glmodule.c Mon Jun 9 12:52:48 2008 @@ -593,7 +593,7 @@ #if 0 /* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */ pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - if (!PyBytes_Check(s) || PyBytes_Size(s) != pixcount*sizeof(long)) { + if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to lrectwrite has wrong size"); return NULL; @@ -623,10 +623,10 @@ if (!PyArg_GetShort(args, 4, 3, &y2)) return NULL; pixcount = (long)(x2+1-x1) * (long)(y2+1-y1); - parray = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (parray == NULL) return NULL; /* No memory */ - lrectread(x1, y1, x2, y2, (unsigned long *) PyBytes_AsString(parray)); + lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray)); return parray; } @@ -642,10 +642,10 @@ if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) ) return 0; size = (long)(x2+1-x1) * (long)(y2+1-y1); - rv = PyBytes_FromStringAndSize((char *)NULL, size*sizeof(long)); + rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long)); if ( rv == NULL ) return NULL; - parray = (unsigned long *)PyBytes_AsString(rv); + parray = (unsigned long *)PyString_AsString(rv); size_ret = readdisplay(x1, y1, x2, y2, parray, hints); if ( size_ret != size ) { printf("gl_readdisplay: got %ld pixels, expected %ld\n", @@ -700,16 +700,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyBytes_Size(unpacked) != pixcount*sizeof(long)) { + if (PyString_Size(unpacked) != pixcount*sizeof(long)) { PyErr_SetString(PyExc_RuntimeError, "string arg to packrect has wrong size"); return NULL; } - packed = PyBytes_FromStringAndSize((char *)NULL, packedcount); + packed = PyString_FromStringAndSize((char *)NULL, packedcount); if (packed == NULL) return NULL; - parray = (unsigned long *) PyBytes_AsString(unpacked); - p = (unsigned char *) PyBytes_AsString(packed); + parray = (unsigned long *) PyString_AsString(unpacked); + p = (unsigned char *) PyString_AsString(packed); for (y = 0; y < height; y += packfactor, parray += packfactor*width) { for (x = 0; x < width; x += packfactor) { pixel = parray[x]; @@ -758,16 +758,16 @@ pixcount = width*height; packedcount = ((width+packfactor-1)/packfactor) * ((height+packfactor-1)/packfactor); - if (PyBytes_Size(packed) != packedcount) { + if (PyString_Size(packed) != packedcount) { PyErr_SetString(PyExc_RuntimeError, "string arg to unpackrect has wrong size"); return NULL; } - unpacked = PyBytes_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); + unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long)); if (unpacked == NULL) return NULL; - parray = (unsigned long *) PyBytes_AsString(unpacked); - p = (unsigned char *) PyBytes_AsString(packed); + parray = (unsigned long *) PyString_AsString(unpacked); + p = (unsigned char *) PyString_AsString(packed); if (packfactor == 1 && width*height > 0) { /* Just expand bytes to longs */ register int x = width * height; @@ -799,7 +799,7 @@ { char buf[20]; gversion(buf); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } Modified: python/branches/tlee-ast-optimize/Modules/grpmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/grpmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/grpmodule.c Mon Jun 9 12:52:48 2008 @@ -47,7 +47,7 @@ return NULL; } for (member = p->gr_mem; *member != NULL; member++) { - PyObject *x = PyBytes_FromString(*member); + PyObject *x = PyString_FromString(*member); if (x == NULL || PyList_Append(w, x) != 0) { Py_XDECREF(x); Py_DECREF(w); @@ -58,13 +58,13 @@ } #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) - SET(setIndex++, PyBytes_FromString(p->gr_name)); + SET(setIndex++, PyString_FromString(p->gr_name)); #ifdef __VMS SET(setIndex++, Py_None); Py_INCREF(Py_None); #else if (p->gr_passwd) - SET(setIndex++, PyBytes_FromString(p->gr_passwd)); + SET(setIndex++, PyString_FromString(p->gr_passwd)); else { SET(setIndex++, Py_None); Py_INCREF(Py_None); @@ -113,7 +113,7 @@ py_str_name = PyObject_Str(pyo_name); if (!py_str_name) return NULL; - name = PyBytes_AS_STRING(py_str_name); + name = PyString_AS_STRING(py_str_name); if ((p = getgrnam(name)) == NULL) { PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name); Modified: python/branches/tlee-ast-optimize/Modules/imageop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/imageop.c (original) +++ python/branches/tlee-ast-optimize/Modules/imageop.c Mon Jun 9 12:52:48 2008 @@ -54,7 +54,7 @@ return 1; if (bcos == NULL) { /* cache string object for future use */ - bcos = PyBytes_FromString("backward_compatible"); + bcos = PyString_FromString("backward_compatible"); if (bcos == NULL) return 1; } @@ -97,11 +97,11 @@ xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; - rv = PyBytes_FromStringAndSize(NULL, + rv = PyString_FromStringAndSize(NULL, (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); if ( rv == 0 ) return 0; - ncp = (char *)PyBytes_AsString(rv); + ncp = (char *)PyString_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; newy2 += ystep; @@ -150,10 +150,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, newx*newy*size); + rv = PyString_FromStringAndSize(NULL, newx*newy*size); if ( rv == 0 ) return 0; - ncp = (char *)PyBytes_AsString(rv); + ncp = (char *)PyString_AsString(rv); nsp = (short *)ncp; nlp = (Py_Int32 *)ncp; for( iy = 0; iy < newy; iy++ ) { @@ -195,10 +195,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, len); + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); if ( width == 1 ) { memcpy(ncp, cp, maxx); /* Copy first line */ @@ -245,10 +245,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; ovalue = 0; @@ -286,10 +286,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+1)/2); + rv = PyString_FromStringAndSize(NULL, (len+1)/2); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -325,10 +325,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -363,10 +363,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+7)/8); + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; ovalue = 0; @@ -409,10 +409,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, (len+3)/4); + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 1; ovalue = 0; for ( i=0; i < len; i++ ) { @@ -449,10 +449,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); bit = 0x80; for ( i=0; i < nlen; i++ ) { @@ -486,10 +486,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -522,10 +522,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); pos = 0; for ( i=0; i < nlen; i++ ) { @@ -559,10 +559,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: aaaaaaaa BBbbbbbb GGGggggg RRRrrrrr */ @@ -603,10 +603,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen*4); + rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { /* Bits in source: RRRBBGGG @@ -653,10 +653,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { if (backward_compatible) { @@ -698,10 +698,10 @@ return 0; } - rv = PyBytes_FromStringAndSize(NULL, nlen*4); + rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) return 0; - ncp = (unsigned char *)PyBytes_AsString(rv); + ncp = (unsigned char *)PyString_AsString(rv); for ( i=0; i < nlen; i++ ) { value = *cp++; Modified: python/branches/tlee-ast-optimize/Modules/imgfile.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/imgfile.c (original) +++ python/branches/tlee-ast-optimize/Modules/imgfile.c Mon Jun 9 12:52:48 2008 @@ -130,12 +130,12 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyBytes_FromStringAndSize((char *)NULL, xsize*ysize*zsize); + rv = PyString_FromStringAndSize((char *)NULL, xsize*ysize*zsize); if ( rv == NULL ) { iclose(image); return NULL; } - cdatap = PyBytes_AsString(rv); + cdatap = PyString_AsString(rv); idatap = (long *)cdatap; if (top_to_bottom) { @@ -319,7 +319,7 @@ } if ( zsize == 3 ) zsize = 4; - rv = PyBytes_FromStringAndSize(NULL, xwtd*ywtd*zsize); + rv = PyString_FromStringAndSize(NULL, xwtd*ywtd*zsize); if ( rv == NULL ) { iclose(image); return NULL; @@ -328,7 +328,7 @@ xfac = (float)xsize/(float)xwtd; yfac = (float)ysize/(float)ywtd; PyFPE_END_PROTECT(yfac) - cdatap = PyBytes_AsString(rv); + cdatap = PyString_AsString(rv); idatap = (long *)cdatap; if ( extended ) { Modified: python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c Mon Jun 9 12:52:48 2008 @@ -2904,12 +2904,12 @@ PyObject *result; if (lz->cnt != PY_SSIZE_T_MAX) - return PyBytes_FromFormat("count(%zd)", lz->cnt); + return PyString_FromFormat("count(%zd)", lz->cnt); cnt_repr = PyObject_Repr(lz->long_cnt); if (cnt_repr == NULL) return NULL; - result = PyBytes_FromFormat("count(%s)", PyBytes_AS_STRING(cnt_repr)); + result = PyString_FromFormat("count(%s)", PyString_AS_STRING(cnt_repr)); Py_DECREF(cnt_repr); return result; } @@ -3221,11 +3221,11 @@ return NULL; if (ro->cnt == -1) - result = PyBytes_FromFormat("repeat(%s)", - PyBytes_AS_STRING(objrepr)); + result = PyString_FromFormat("repeat(%s)", + PyString_AS_STRING(objrepr)); else - result = PyBytes_FromFormat("repeat(%s, %zd)", - PyBytes_AS_STRING(objrepr), ro->cnt); + result = PyString_FromFormat("repeat(%s, %zd)", + PyString_AS_STRING(objrepr), ro->cnt); Py_DECREF(objrepr); return result; } Modified: python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/linuxaudiodev.c Mon Jun 9 12:52:48 2008 @@ -162,17 +162,17 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyBytes_AS_STRING(rv); + cp = PyString_AS_STRING(rv); if ((count = read(self->x_fd, cp, size)) < 0) { PyErr_SetFromErrno(LinuxAudioError); Py_DECREF(rv); return NULL; } self->x_icount += count; - _PyBytes_Resize(&rv, count); + _PyString_Resize(&rv, count); return rv; } Modified: python/branches/tlee-ast-optimize/Modules/main.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/main.c (original) +++ python/branches/tlee-ast-optimize/Modules/main.c Mon Jun 9 12:52:48 2008 @@ -196,7 +196,7 @@ { PyObject *argv0 = NULL, *importer = NULL; - if ((argv0 = PyBytes_FromString(filename)) && + if ((argv0 = PyString_FromString(filename)) && (importer = PyImport_GetImporter(argv0)) && (importer->ob_type != &PyNullImporter_Type)) { Modified: python/branches/tlee-ast-optimize/Modules/mathmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/mathmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/mathmodule.c Mon Jun 9 12:52:48 2008 @@ -324,17 +324,12 @@ Note 3: The itermediate values lo, yr, and hi are declared volatile so aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. - Also, the volatile declaration forces the values to be stored in memory as - regular doubles instead of extended long precision (80-bit) values. This - prevents double rounding because any addition or substraction of two doubles - can be resolved exactly into double-sized hi and lo values. As long as the - hi value gets forced into a double before yr and lo are computed, the extra - bits in downstream extended precision operations (x87 for example) will be - exactly zero and therefore can be losslessly stored back into a double, - thereby preventing double rounding. - Note 4: A similar implementation is in Modules/cmathmodule.c. - Be sure to update both when making changes. + Note 4: Intermediate values and partial sums are declared as long doubles + as a way to eliminate double rounding environments where the operations + are carried-out in extended precision but stored in double precision + variables. In some cases, this doesn't help because the compiler + treats long doubles as doubles (i.e. the MS compiler for Win32 builds). Note 5: The signature of math.sum() differs from __builtin__.sum() because the start argument doesn't make sense in the context of @@ -347,28 +342,28 @@ /* Extend the partials array p[] by doubling its size. */ static int /* non-zero on error */ -_sum_realloc(double **p_ptr, Py_ssize_t n, - double *ps, Py_ssize_t *m_ptr) +_sum_realloc(long double **p_ptr, Py_ssize_t n, + long double *ps, Py_ssize_t *m_ptr) { void *v = NULL; Py_ssize_t m = *m_ptr; - m += m; /* double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { - double *p = *p_ptr; + m += m; /* long double */ + if (n < m && m < (PY_SSIZE_T_MAX / sizeof(long double))) { + long double *p = *p_ptr; if (p == ps) { - v = PyMem_Malloc(sizeof(double) * m); + v = PyMem_Malloc(sizeof(long double) * m); if (v != NULL) - memcpy(v, ps, sizeof(double) * n); + memcpy(v, ps, sizeof(long double) * n); } else - v = PyMem_Realloc(p, sizeof(double) * m); + v = PyMem_Realloc(p, sizeof(long double) * m); } if (v == NULL) { /* size overflow or no memory */ PyErr_SetString(PyExc_MemoryError, "math sum partials"); return 1; } - *p_ptr = (double*) v; + *p_ptr = (long double*) v; *m_ptr = m; return 0; } @@ -408,8 +403,8 @@ { PyObject *item, *iter, *sum = NULL; Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - double x, y, t, ps[NUM_PARTIALS], *p = ps; - volatile double hi, yr, lo; + long double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile long double hi, yr, lo; iter = PyObject_GetIter(seq); if (iter == NULL) @@ -428,7 +423,7 @@ goto _sum_error; break; } - x = PyFloat_AsDouble(item); + x = (long double)PyFloat_AsDouble(item); Py_DECREF(item); if (PyErr_Occurred()) goto _sum_error; @@ -495,7 +490,7 @@ goto _sum_error; } } - sum = PyFloat_FromDouble(hi); + sum = PyFloat_FromDouble((double)hi); _sum_error: PyFPE_END_PROTECT(hi) @@ -512,6 +507,55 @@ Return an accurate floating point sum of values in the iterable.\n\ Assumes IEEE-754 floating point arithmetic."); + +static PyObject * +math_factorial(PyObject *self, PyObject *arg) +{ + long i, x; + PyObject *result, *iobj, *newresult; + + if (PyFloat_Check(arg)) { + double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg); + if (dx != floor(dx)) { + PyErr_SetString(PyExc_ValueError, + "factorial() only accepts integral values"); + return NULL; + } + } + + x = PyInt_AsLong(arg); + if (x == -1 && PyErr_Occurred()) + return NULL; + if (x < 0) { + PyErr_SetString(PyExc_ValueError, + "factorial() not defined for negative values"); + return NULL; + } + + result = (PyObject *)PyInt_FromLong(1); + if (result == NULL) + return NULL; + for (i=1 ; i<=x ; i++) { + iobj = (PyObject *)PyInt_FromLong(i); + if (iobj == NULL) + goto error; + newresult = PyNumber_Multiply(result, iobj); + Py_DECREF(iobj); + if (newresult == NULL) + goto error; + Py_DECREF(result); + result = newresult; + } + return result; + +error: + Py_DECREF(result); + Py_XDECREF(iobj); + return NULL; +} + +PyDoc_STRVAR(math_factorial_doc, "Return n!"); + static PyObject * math_trunc(PyObject *self, PyObject *number) { @@ -949,6 +993,7 @@ {"degrees", math_degrees, METH_O, math_degrees_doc}, {"exp", math_exp, METH_O, math_exp_doc}, {"fabs", math_fabs, METH_O, math_fabs_doc}, + {"factorial", math_factorial, METH_O, math_factorial_doc}, {"floor", math_floor, METH_O, math_floor_doc}, {"fmod", math_fmod, METH_VARARGS, math_fmod_doc}, {"frexp", math_frexp, METH_O, math_frexp_doc}, Modified: python/branches/tlee-ast-optimize/Modules/md5module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/md5module.c (original) +++ python/branches/tlee-ast-optimize/Modules/md5module.c Mon Jun 9 12:52:48 2008 @@ -80,7 +80,7 @@ mdContext = self->md5; md5_finish(&mdContext, aDigest); - return PyBytes_FromStringAndSize((char *)aDigest, 16); + return PyString_FromStringAndSize((char *)aDigest, 16); } PyDoc_STRVAR(digest_doc, @@ -113,7 +113,7 @@ c = (c>9) ? c+'a'-10 : c + '0'; hexdigest[j++] = c; } - return PyBytes_FromStringAndSize((char*)hexdigest, 32); + return PyString_FromStringAndSize((char*)hexdigest, 32); } @@ -165,7 +165,7 @@ static PyObject * md5_get_name(PyObject *self, void *closure) { - return PyBytes_FromStringAndSize("MD5", 3); + return PyString_FromStringAndSize("MD5", 3); } static PyGetSetDef md5_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/mmapmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/mmapmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/mmapmodule.c Mon Jun 9 12:52:48 2008 @@ -222,7 +222,7 @@ else ++eol; /* we're interested in the position after the newline. */ - result = PyBytes_FromStringAndSize(start, (eol - start)); + result = PyString_FromStringAndSize(start, (eol - start)); self->pos += (eol - start); return result; } @@ -700,7 +700,7 @@ PyErr_SetString(PyExc_IndexError, "mmap index out of range"); return NULL; } - return PyBytes_FromStringAndSize(self->data + i, 1); + return PyString_FromStringAndSize(self->data + i, 1); } static PyObject * @@ -718,7 +718,7 @@ else if ((size_t)ihigh > self->size) ihigh = self->size; - return PyBytes_FromStringAndSize(self->data + ilow, ihigh-ilow); + return PyString_FromStringAndSize(self->data + ilow, ihigh-ilow); } static PyObject * @@ -736,7 +736,7 @@ "mmap index out of range"); return NULL; } - return PyBytes_FromStringAndSize(self->data + i, 1); + return PyString_FromStringAndSize(self->data + i, 1); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelen; @@ -747,9 +747,9 @@ } if (slicelen <= 0) - return PyBytes_FromStringAndSize("", 0); + return PyString_FromStringAndSize("", 0); else if (step == 1) - return PyBytes_FromStringAndSize(self->data + start, + return PyString_FromStringAndSize(self->data + start, slicelen); else { char *result_buf = (char *)PyMem_Malloc(slicelen); @@ -762,7 +762,7 @@ cur += step, i++) { result_buf[i] = self->data[cur]; } - result = PyBytes_FromStringAndSize(result_buf, + result = PyString_FromStringAndSize(result_buf, slicelen); PyMem_Free(result_buf); return result; @@ -815,19 +815,19 @@ "mmap object doesn't support slice deletion"); return -1; } - if (! (PyBytes_Check(v)) ) { + if (! (PyString_Check(v)) ) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyBytes_Size(v) != (ihigh - ilow)) { + if (PyString_Size(v) != (ihigh - ilow)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(v); + buf = PyString_AsString(v); memcpy(self->data + ilow, buf, ihigh-ilow); return 0; } @@ -847,14 +847,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (! (PyBytes_Check(v) && PyBytes_Size(v)==1) ) { + if (! (PyString_Check(v) && PyString_Size(v)==1) ) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(v); + buf = PyString_AsString(v); self->data[i] = buf[0]; return 0; } @@ -882,14 +882,14 @@ "mmap object doesn't support item deletion"); return -1; } - if (!PyBytes_Check(value) || PyBytes_Size(value) != 1) { + if (!PyString_Check(value) || PyString_Size(value) != 1) { PyErr_SetString(PyExc_IndexError, "mmap assignment must be single-character string"); return -1; } if (!is_writeable(self)) return -1; - buf = PyBytes_AsString(value); + buf = PyString_AsString(value); self->data[i] = buf[0]; return 0; } @@ -906,12 +906,12 @@ "mmap object doesn't support slice deletion"); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment must be a string"); return -1; } - if (PyBytes_Size(value) != slicelen) { + if (PyString_Size(value) != slicelen) { PyErr_SetString(PyExc_IndexError, "mmap slice assignment is wrong size"); return -1; @@ -922,7 +922,7 @@ if (slicelen == 0) return 0; else if (step == 1) { - const char *buf = PyBytes_AsString(value); + const char *buf = PyString_AsString(value); if (buf == NULL) return -1; @@ -931,7 +931,7 @@ } else { Py_ssize_t cur, i; - const char *buf = PyBytes_AsString(value); + const char *buf = PyString_AsString(value); if (buf == NULL) return -1; Modified: python/branches/tlee-ast-optimize/Modules/nismodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/nismodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/nismodule.c Mon Jun 9 12:52:48 2008 @@ -115,8 +115,8 @@ if (invallen > 0 && inval[invallen-1] == '\0') invallen--; } - key = PyBytes_FromStringAndSize(inkey, inkeylen); - val = PyBytes_FromStringAndSize(inval, invallen); + key = PyString_FromStringAndSize(inkey, inkeylen); + val = PyString_FromStringAndSize(inval, invallen); if (key == NULL || val == NULL) { /* XXX error -- don't know how to handle */ PyErr_Clear(); @@ -146,7 +146,7 @@ if ((err = yp_get_default_domain(&domain)) != 0) return nis_error(err); - res = PyBytes_FromStringAndSize (domain, strlen(domain)); + res = PyString_FromStringAndSize (domain, strlen(domain)); return res; } @@ -178,7 +178,7 @@ len--; if (err != 0) return nis_error(err); - res = PyBytes_FromStringAndSize (match, len); + res = PyString_FromStringAndSize (match, len); free (match); return res; } @@ -398,7 +398,7 @@ if ((list = PyList_New(0)) == NULL) return NULL; for (maps = maps; maps; maps = maps->next) { - PyObject *str = PyBytes_FromString(maps->map); + PyObject *str = PyString_FromString(maps->map); if (!str || PyList_Append(list, str) < 0) { Py_DECREF(list); Modified: python/branches/tlee-ast-optimize/Modules/operator.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/operator.c (original) +++ python/branches/tlee-ast-optimize/Modules/operator.c Mon Jun 9 12:52:48 2008 @@ -508,19 +508,19 @@ } #endif - if (!PyBytes_Check(attr)) { + if (!PyString_Check(attr)) { PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); return NULL; } - s = PyBytes_AS_STRING(attr); + s = PyString_AS_STRING(attr); Py_INCREF(obj); for (;;) { PyObject *newobj, *str; p = strchr(s, '.'); - str = p ? PyBytes_FromStringAndSize(s, (p-s)) : - PyBytes_FromString(s); + str = p ? PyString_FromStringAndSize(s, (p-s)) : + PyString_FromString(s); if (str == NULL) { Py_DECREF(obj); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/ossaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/ossaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/ossaudiodev.c Mon Jun 9 12:52:48 2008 @@ -366,10 +366,10 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - cp = PyBytes_AS_STRING(rv); + cp = PyString_AS_STRING(rv); Py_BEGIN_ALLOW_THREADS count = read(self->fd, cp, size); @@ -381,7 +381,7 @@ return NULL; } self->icount += count; - _PyBytes_Resize(&rv, count); + _PyString_Resize(&rv, count); return rv; } @@ -811,20 +811,20 @@ Py_INCREF(rval); } else if (strcmp(name, "name") == 0) { - rval = PyBytes_FromString(self->devicename); + rval = PyString_FromString(self->devicename); } else if (strcmp(name, "mode") == 0) { /* No need for a "default" in this switch: from newossobject(), self->mode can only be one of these three values. */ switch(self->mode) { case O_RDONLY: - rval = PyBytes_FromString("r"); + rval = PyString_FromString("r"); break; case O_RDWR: - rval = PyBytes_FromString("rw"); + rval = PyString_FromString("rw"); break; case O_WRONLY: - rval = PyBytes_FromString("w"); + rval = PyString_FromString("w"); break; } } @@ -913,12 +913,12 @@ if (labels == NULL || names == NULL) goto error2; for (i = 0; i < num_controls; i++) { - s = PyBytes_FromString(control_labels[i]); + s = PyString_FromString(control_labels[i]); if (s == NULL) goto error2; PyList_SET_ITEM(labels, i, s); - s = PyBytes_FromString(control_names[i]); + s = PyString_FromString(control_names[i]); if (s == NULL) goto error2; PyList_SET_ITEM(names, i, s); Modified: python/branches/tlee-ast-optimize/Modules/parsermodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/parsermodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/parsermodule.c Mon Jun 9 12:52:48 2008 @@ -105,14 +105,14 @@ } if (TYPE(n) == encoding_decl) - (void) addelem(v, i+1, PyBytes_FromString(STR(n))); + (void) addelem(v, i+1, PyString_FromString(STR(n))); return (v); } else if (ISTERMINAL(TYPE(n))) { PyObject *result = mkseq(2 + lineno + col_offset); if (result != NULL) { (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); - (void) addelem(result, 1, PyBytes_FromString(STR(n))); + (void) addelem(result, 1, PyString_FromString(STR(n))); if (lineno == 1) (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); if (col_offset == 1) @@ -689,7 +689,7 @@ temp = PySequence_GetItem(elem, 1); if (temp == NULL) return 0; - if (!PyBytes_Check(temp)) { + if (!PyString_Check(temp)) { PyErr_Format(parser_error, "second item in terminal node must be a string," " found %s", @@ -714,10 +714,10 @@ Py_DECREF(o); } } - len = PyBytes_GET_SIZE(temp) + 1; + len = PyString_GET_SIZE(temp) + 1; strn = (char *)PyObject_MALLOC(len); if (strn != NULL) - (void) memcpy(strn, PyBytes_AS_STRING(temp), len); + (void) memcpy(strn, PyString_AS_STRING(temp), len); Py_DECREF(temp); } else if (!ISNONTERMINAL(type)) { @@ -800,10 +800,10 @@ } if (res && encoding) { Py_ssize_t len; - len = PyBytes_GET_SIZE(encoding) + 1; + len = PyString_GET_SIZE(encoding) + 1; res->n_str = (char *)PyObject_MALLOC(len); if (res->n_str != NULL) - (void) memcpy(res->n_str, PyBytes_AS_STRING(encoding), len); + (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len); Py_DECREF(encoding); Py_DECREF(tuple); } Modified: python/branches/tlee-ast-optimize/Modules/posixmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/posixmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/posixmodule.c Mon Jun 9 12:52:48 2008 @@ -375,12 +375,12 @@ char *p = strchr(*e, '='); if (p == NULL) continue; - k = PyBytes_FromStringAndSize(*e, (int)(p-*e)); + k = PyString_FromStringAndSize(*e, (int)(p-*e)); if (k == NULL) { PyErr_Clear(); continue; } - v = PyBytes_FromString(p+1); + v = PyString_FromString(p+1); if (v == NULL) { PyErr_Clear(); Py_DECREF(k); @@ -400,13 +400,13 @@ rc = DosQueryExtLIBPATH(buffer, BEGIN_LIBPATH); if (rc == NO_ERROR) { /* (not a type, envname is NOT 'BEGIN_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); + PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "BEGINLIBPATH", v); Py_DECREF(v); } rc = DosQueryExtLIBPATH(buffer, END_LIBPATH); if (rc == NO_ERROR) { /* (not a typo, envname is NOT 'END_LIBPATH') */ - PyObject *v = PyBytes_FromString(buffer); + PyObject *v = PyString_FromString(buffer); PyDict_SetItemString(d, "ENDLIBPATH", v); Py_DECREF(v); } @@ -1598,7 +1598,7 @@ #endif if (ret == NULL) return posix_error(); - return PyBytes_FromString(ret); + return PyString_FromString(ret); } #endif @@ -1620,7 +1620,7 @@ #endif if (ret == NULL) return posix_error(); - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } #endif @@ -1968,7 +1968,7 @@ Py_END_ALLOW_THREADS if (res == NULL) return posix_error(); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #ifdef Py_USING_UNICODE @@ -2174,7 +2174,7 @@ /* Skip over . and .. */ if (strcmp(FileData.cFileName, ".") != 0 && strcmp(FileData.cFileName, "..") != 0) { - v = PyBytes_FromString(FileData.cFileName); + v = PyString_FromString(FileData.cFileName); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2262,7 +2262,7 @@ /* Leave Case of Name Alone -- In Native Form */ /* (Removed Forced Lowercasing Code) */ - v = PyBytes_FromString(namebuf); + v = PyString_FromString(namebuf); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2312,7 +2312,7 @@ (NAMLEN(ep) == 1 || (ep->d_name[1] == '.' && NAMLEN(ep) == 2))) continue; - v = PyBytes_FromStringAndSize(ep->d_name, NAMLEN(ep)); + v = PyString_FromStringAndSize(ep->d_name, NAMLEN(ep)); if (v == NULL) { Py_DECREF(d); d = NULL; @@ -2397,7 +2397,7 @@ return PyUnicode_Decode(outbuf, strlen(outbuf), Py_FileSystemDefaultEncoding, NULL); } - return PyBytes_FromString(outbuf); + return PyString_FromString(outbuf); } /* end of posix__getfullpathname */ #endif /* MS_WINDOWS */ @@ -3062,7 +3062,7 @@ /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { #endif - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3292,7 +3292,7 @@ { goto fail_2; } - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3525,7 +3525,7 @@ { goto fail_2; } - len = PyBytes_Size(key) + PyBytes_Size(val) + 2; + len = PyString_Size(key) + PyString_Size(val) + 2; p = PyMem_NEW(char, len); if (p == NULL) { PyErr_NoMemory(); @@ -3895,7 +3895,7 @@ "unable to determine login name"); } else - result = PyBytes_FromString(name); + result = PyString_FromString(name); errno = old_errno; return result; @@ -5884,7 +5884,7 @@ return posix_error_with_allocated_filename(path); PyMem_Free(path); - v = PyBytes_FromStringAndSize(buf, n); + v = PyString_FromStringAndSize(buf, n); #ifdef Py_USING_UNICODE if (arg_is_unicode) { PyObject *w; @@ -6289,18 +6289,18 @@ errno = EINVAL; return posix_error(); } - buffer = PyBytes_FromStringAndSize((char *)NULL, size); + buffer = PyString_FromStringAndSize((char *)NULL, size); if (buffer == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - n = read(fd, PyBytes_AsString(buffer), size); + n = read(fd, PyString_AsString(buffer), size); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buffer); return posix_error(); } if (n != size) - _PyBytes_Resize(&buffer, n); + _PyString_Resize(&buffer, n); return buffer; } @@ -6647,11 +6647,11 @@ /* XXX This can leak memory -- not easy to fix :-( */ len = strlen(s1) + strlen(s2) + 2; /* len includes space for a trailing \0; the size arg to - PyBytes_FromStringAndSize does not count that */ - newstr = PyBytes_FromStringAndSize(NULL, (int)len - 1); + PyString_FromStringAndSize does not count that */ + newstr = PyString_FromStringAndSize(NULL, (int)len - 1); if (newstr == NULL) return PyErr_NoMemory(); - newenv = PyBytes_AS_STRING(newstr); + newenv = PyString_AS_STRING(newstr); PyOS_snprintf(newenv, len, "%s=%s", s1, s2); if (putenv(newenv)) { Py_DECREF(newstr); @@ -6727,7 +6727,7 @@ "strerror() argument out of range"); return NULL; } - return PyBytes_FromString(message); + return PyString_FromString(message); } @@ -7009,7 +7009,7 @@ #endif if (name == NULL) return PyErr_NoMemory(); - result = PyBytes_FromString(name); + result = PyString_FromString(name); free(name); return result; } @@ -7066,7 +7066,7 @@ Py_XDECREF(err); return NULL; } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } #endif @@ -7095,13 +7095,13 @@ *valuep = PyInt_AS_LONG(arg); return 1; } - if (PyBytes_Check(arg)) { + if (PyString_Check(arg)) { /* look up the value in the table using a binary search */ size_t lo = 0; size_t mid; size_t hi = tablesize; int cmp; - char *confname = PyBytes_AS_STRING(arg); + char *confname = PyString_AS_STRING(arg); while (lo < hi) { mid = (lo + hi) / 2; cmp = strcmp(confname, table[mid].name); @@ -7431,12 +7431,12 @@ } else { if ((unsigned int)len >= sizeof(buffer)) { - result = PyBytes_FromStringAndSize(NULL, len-1); + result = PyString_FromStringAndSize(NULL, len-1); if (result != NULL) - confstr(name, PyBytes_AS_STRING(result), len); + confstr(name, PyString_AS_STRING(result), len); } else - result = PyBytes_FromStringAndSize(buffer, len-1); + result = PyString_FromStringAndSize(buffer, len-1); } } return result; @@ -8225,11 +8225,11 @@ } /* Allocate bytes */ - result = PyBytes_FromStringAndSize(NULL, howMany); + result = PyString_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*) - PyBytes_AS_STRING(result))) { + PyString_AS_STRING(result))) { Py_DECREF(result); return win32_error("CryptGenRandom", NULL); } @@ -8259,11 +8259,11 @@ "negative argument not allowed"); /* Allocate bytes */ - result = PyBytes_FromStringAndSize(NULL, howMany); + result = PyString_FromStringAndSize(NULL, howMany); if (result != NULL) { /* Get random data */ if (RAND_pseudo_bytes((unsigned char*) - PyBytes_AS_STRING(result), + PyString_AS_STRING(result), howMany) < 0) { Py_DECREF(result); return PyErr_Format(PyExc_ValueError, Modified: python/branches/tlee-ast-optimize/Modules/pwdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/pwdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/pwdmodule.c Mon Jun 9 12:52:48 2008 @@ -49,7 +49,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/tlee-ast-optimize/Modules/pyexpat.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/pyexpat.c (original) +++ python/branches/tlee-ast-optimize/Modules/pyexpat.c Mon Jun 9 12:52:48 2008 @@ -153,7 +153,7 @@ { PyObject *name = hinfo->nameobj; if (name == NULL) { - name = PyBytes_FromString(hinfo->name); + name = PyString_FromString(hinfo->name); hinfo->nameobj = name; } Py_XINCREF(name); @@ -205,7 +205,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(str); + return PyString_FromString(str); } static PyObject * @@ -218,7 +218,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromStringAndSize((const char *)str, len); + return PyString_FromStringAndSize((const char *)str, len); } /* Callback routines */ @@ -267,16 +267,16 @@ PyObject *filename = NULL; if (handler_info[slot].tb_code == NULL) { - code = PyBytes_FromString(""); + code = PyString_FromString(""); if (code == NULL) goto failed; - name = PyBytes_FromString(func_name); + name = PyString_FromString(func_name); if (name == NULL) goto failed; nulltuple = PyTuple_New(0); if (nulltuple == NULL) goto failed; - filename = PyBytes_FromString(__FILE__); + filename = PyString_FromString(__FILE__); handler_info[slot].tb_code = PyCode_New(0, /* argcount */ 0, /* nlocals */ @@ -971,13 +971,13 @@ goto finally; /* XXX what to do if it returns a Unicode string? */ - if (!PyBytes_Check(str)) { + if (!PyString_Check(str)) { PyErr_Format(PyExc_TypeError, "read() did not return a string object (type=%.400s)", Py_TYPE(str)->tp_name); goto finally; } - len = PyBytes_GET_SIZE(str); + len = PyString_GET_SIZE(str); if (len > buf_size) { PyErr_Format(PyExc_ValueError, "read() returned too much data: " @@ -985,7 +985,7 @@ buf_size, len); goto finally; } - memcpy(buf, PyBytes_AsString(str), len); + memcpy(buf, PyString_AsString(str), len); finally: Py_XDECREF(arg); Py_XDECREF(str); @@ -1094,7 +1094,7 @@ = XML_GetInputContext(self->itself, &offset, &size); if (buffer != NULL) - return PyBytes_FromStringAndSize(buffer + offset, + return PyString_FromStringAndSize(buffer + offset, size - offset); else Py_RETURN_NONE; @@ -1511,7 +1511,7 @@ #define APPEND(list, str) \ do { \ - PyObject *o = PyBytes_FromString(str); \ + PyObject *o = PyString_FromString(str); \ if (o != NULL) \ PyList_Append(list, o); \ Py_XDECREF(o); \ @@ -1862,7 +1862,7 @@ while (rev[i] != ' ' && rev[i] != '\0') ++i; - return PyBytes_FromStringAndSize(rev, i); + return PyString_FromStringAndSize(rev, i); } /* Initialization function for the module */ @@ -1889,7 +1889,7 @@ MODULE_INITFUNC(void) { PyObject *m, *d; - PyObject *errmod_name = PyBytes_FromString(MODULE_NAME ".errors"); + PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; @@ -1899,7 +1899,7 @@ if (errmod_name == NULL) return; - modelmod_name = PyBytes_FromString(MODULE_NAME ".model"); + modelmod_name = PyString_FromString(MODULE_NAME ".model"); if (modelmod_name == NULL) return; Modified: python/branches/tlee-ast-optimize/Modules/readline.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/readline.c (original) +++ python/branches/tlee-ast-optimize/Modules/readline.c Mon Jun 9 12:52:48 2008 @@ -421,7 +421,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyBytes_FromString(rl_completer_word_break_characters); + return PyString_FromString(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -471,7 +471,7 @@ if (!PyArg_ParseTuple(args, "i:index", &idx)) return NULL; if ((hist_ent = history_get(idx))) - return PyBytes_FromString(hist_ent->line); + return PyString_FromString(hist_ent->line); else { Py_RETURN_NONE; } @@ -503,7 +503,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyBytes_FromString(rl_line_buffer); + return PyString_FromString(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -676,7 +676,7 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyBytes_FromString(matches[i+1]); + s = PyString_FromString(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) @@ -725,7 +725,7 @@ result = NULL; } else { - char *s = PyBytes_AsString(r); + char *s = PyString_AsString(r); if (s == NULL) goto error; result = strdup(s); Modified: python/branches/tlee-ast-optimize/Modules/selectmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/selectmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/selectmodule.c Mon Jun 9 12:52:48 2008 @@ -1219,7 +1219,7 @@ "data=0x%lx udata=%p>", (unsigned long)(s->e.ident), s->e.filter, s->e.flags, s->e.fflags, (long)(s->e.data), s->e.udata); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int Modified: python/branches/tlee-ast-optimize/Modules/sha256module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sha256module.c (original) +++ python/branches/tlee-ast-optimize/Modules/sha256module.c Mon Jun 9 12:52:48 2008 @@ -432,7 +432,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); + return PyString_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA256_hexdigest__doc__, @@ -452,10 +452,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -510,9 +510,9 @@ SHA256_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 32) - return PyBytes_FromStringAndSize("SHA256", 6); + return PyString_FromStringAndSize("SHA256", 6); else - return PyBytes_FromStringAndSize("SHA224", 6); + return PyString_FromStringAndSize("SHA224", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/sha512module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sha512module.c (original) +++ python/branches/tlee-ast-optimize/Modules/sha512module.c Mon Jun 9 12:52:48 2008 @@ -498,7 +498,7 @@ SHAcopy(self, &temp); sha512_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, self->digestsize); + return PyString_FromStringAndSize((const char *)digest, self->digestsize); } PyDoc_STRVAR(SHA512_hexdigest__doc__, @@ -518,10 +518,10 @@ sha512_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, self->digestsize * 2); + retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -576,9 +576,9 @@ SHA512_get_name(PyObject *self, void *closure) { if (((SHAobject *)self)->digestsize == 64) - return PyBytes_FromStringAndSize("SHA512", 6); + return PyString_FromStringAndSize("SHA512", 6); else - return PyBytes_FromStringAndSize("SHA384", 6); + return PyString_FromStringAndSize("SHA384", 6); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/shamodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/shamodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/shamodule.c Mon Jun 9 12:52:48 2008 @@ -380,7 +380,7 @@ SHAcopy(self, &temp); sha_final(digest, &temp); - return PyBytes_FromStringAndSize((const char *)digest, sizeof(digest)); + return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); } PyDoc_STRVAR(SHA_hexdigest__doc__, @@ -400,10 +400,10 @@ sha_final(digest, &temp); /* Create a new string */ - retval = PyBytes_FromStringAndSize(NULL, sizeof(digest) * 2); + retval = PyString_FromStringAndSize(NULL, sizeof(digest) * 2); if (!retval) return NULL; - hex_digest = PyBytes_AsString(retval); + hex_digest = PyString_AsString(retval); if (!hex_digest) { Py_DECREF(retval); return NULL; @@ -463,7 +463,7 @@ static PyObject * SHA_get_name(PyObject *self, void *closure) { - return PyBytes_FromStringAndSize("SHA1", 4); + return PyString_FromStringAndSize("SHA1", 4); } static PyGetSetDef SHA_getseters[] = { Modified: python/branches/tlee-ast-optimize/Modules/socketmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/socketmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/socketmodule.c Mon Jun 9 12:52:48 2008 @@ -911,7 +911,7 @@ set_gaierror(error); return NULL; } - return PyBytes_FromString(buf); + return PyString_FromString(buf); } @@ -955,7 +955,7 @@ sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } #endif @@ -1002,14 +1002,14 @@ #ifdef linux if (a->sun_path[0] == 0) { /* Linux abstract namespace */ addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyBytes_FromStringAndSize(a->sun_path, + return PyString_FromStringAndSize(a->sun_path, addrlen); } else #endif /* linux */ { /* regular NULL-terminated string */ - return PyBytes_FromString(a->sun_path); + return PyString_FromString(a->sun_path); } } #endif /* AF_UNIX */ @@ -1362,7 +1362,7 @@ addr = (struct sockaddr_sco *)addr_ret; _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; - straddr = PyBytes_AsString(args); + straddr = PyString_AsString(args); if (straddr == NULL) { PyErr_SetString(socket_error, "getsockaddrarg: " "wrong format"); @@ -1854,16 +1854,16 @@ "getsockopt buflen out of range"); return NULL; } - buf = PyBytes_FromStringAndSize((char *)NULL, buflen); + buf = PyString_FromStringAndSize((char *)NULL, buflen); if (buf == NULL) return NULL; res = getsockopt(s->sock_fd, level, optname, - (void *)PyBytes_AS_STRING(buf), &buflen); + (void *)PyString_AS_STRING(buf), &buflen); if (res < 0) { Py_DECREF(buf); return s->errorhandler(); } - _PyBytes_Resize(&buf, buflen); + _PyString_Resize(&buf, buflen); return buf; #endif /* __BEOS__ */ } @@ -2386,12 +2386,12 @@ } /* Allocate a new string. */ - buf = PyBytes_FromStringAndSize((char *) 0, recvlen); + buf = PyString_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; /* Call the guts */ - outlen = sock_recv_guts(s, PyBytes_AS_STRING(buf), recvlen, flags); + outlen = sock_recv_guts(s, PyString_AS_STRING(buf), recvlen, flags); if (outlen < 0) { /* An error occurred, release the string and return an error. */ @@ -2401,7 +2401,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyBytes_Resize(&buf, outlen) < 0) + if (_PyString_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ return NULL; } @@ -2560,11 +2560,11 @@ return NULL; } - buf = PyBytes_FromStringAndSize((char *) 0, recvlen); + buf = PyString_FromStringAndSize((char *) 0, recvlen); if (buf == NULL) return NULL; - outlen = sock_recvfrom_guts(s, PyBytes_AS_STRING(buf), + outlen = sock_recvfrom_guts(s, PyString_AS_STRING(buf), recvlen, flags, &addr); if (outlen < 0) { goto finally; @@ -2573,7 +2573,7 @@ if (outlen != recvlen) { /* We did not read as many bytes as we anticipated, resize the string if possible and be succesful. */ - if (_PyBytes_Resize(&buf, outlen) < 0) + if (_PyString_Resize(&buf, outlen) < 0) /* Oopsy, not so succesful after all. */ goto finally; } @@ -2941,7 +2941,7 @@ (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } @@ -3057,7 +3057,7 @@ if (res < 0) return set_error(); buf[sizeof buf - 1] = '\0'; - return PyBytes_FromString(buf); + return PyString_FromString(buf); } PyDoc_STRVAR(gethostname_doc, @@ -3143,7 +3143,7 @@ if (h->h_aliases) { for (pch = h->h_aliases; *pch != NULL; pch++) { int status; - tmp = PyBytes_FromString(*pch); + tmp = PyString_FromString(*pch); if (tmp == NULL) goto err; @@ -3432,7 +3432,7 @@ PyErr_SetString(socket_error, "port/proto not found"); return NULL; } - return PyBytes_FromString(sp->s_name); + return PyString_FromString(sp->s_name); } PyDoc_STRVAR(getservbyport_doc, @@ -3734,7 +3734,7 @@ if (inet_aton != NULL) { #endif if (inet_aton(ip_addr, &buf)) - return PyBytes_FromStringAndSize((char *)(&buf), + return PyString_FromStringAndSize((char *)(&buf), sizeof(buf)); PyErr_SetString(socket_error, @@ -3763,7 +3763,7 @@ return NULL; } } - return PyBytes_FromStringAndSize((char *) &packed_addr, + return PyString_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); #ifdef USE_INET_ATON_WEAKLINK @@ -3797,7 +3797,7 @@ memcpy(&packed_addr, packed_str, addr_len); - return PyBytes_FromString(inet_ntoa(packed_addr)); + return PyString_FromString(inet_ntoa(packed_addr)); } #ifdef HAVE_INET_PTON @@ -3840,11 +3840,11 @@ "illegal IP address string passed to inet_pton"); return NULL; } else if (af == AF_INET) { - return PyBytes_FromStringAndSize(packed, + return PyString_FromStringAndSize(packed, sizeof(struct in_addr)); #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { - return PyBytes_FromStringAndSize(packed, + return PyString_FromStringAndSize(packed, sizeof(struct in6_addr)); #endif } else { @@ -3871,7 +3871,7 @@ char ip[INET_ADDRSTRLEN + 1]; #endif - /* Guarantee NUL-termination for PyBytes_FromString() below */ + /* Guarantee NUL-termination for PyString_FromString() below */ memset((void *) &ip[0], '\0', sizeof(ip)); if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { @@ -3903,7 +3903,7 @@ PyErr_SetFromErrno(socket_error); return NULL; } else { - return PyBytes_FromString(retval); + return PyString_FromString(retval); } /* NOTREACHED */ @@ -3944,9 +3944,9 @@ idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); if (!idna) return NULL; - hptr = PyBytes_AsString(idna); - } else if (PyBytes_Check(hobj)) { - hptr = PyBytes_AsString(hobj); + hptr = PyString_AsString(idna); + } else if (PyString_Check(hobj)) { + hptr = PyString_AsString(hobj); } else { PyErr_SetString(PyExc_TypeError, "getaddrinfo() argument 1 must be string or None"); @@ -3955,8 +3955,8 @@ if (PyInt_Check(pobj)) { PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", PyInt_AsLong(pobj)); pptr = pbuf; - } else if (PyBytes_Check(pobj)) { - pptr = PyBytes_AsString(pobj); + } else if (PyString_Check(pobj)) { + pptr = PyString_AsString(pobj); } else if (pobj == Py_None) { pptr = (char *)NULL; } else { Modified: python/branches/tlee-ast-optimize/Modules/spwdmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/spwdmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/spwdmodule.c Mon Jun 9 12:52:48 2008 @@ -60,7 +60,7 @@ sets(PyObject *v, int i, char* val) { if (val) - PyStructSequence_SET_ITEM(v, i, PyBytes_FromString(val)); + PyStructSequence_SET_ITEM(v, i, PyString_FromString(val)); else { PyStructSequence_SET_ITEM(v, i, Py_None); Py_INCREF(Py_None); Modified: python/branches/tlee-ast-optimize/Modules/stropmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/stropmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/stropmodule.c Mon Jun 9 12:52:48 2008 @@ -47,7 +47,7 @@ i = i+1; } if (j < i) { - item = PyBytes_FromStringAndSize(s+j, i-j); + item = PyString_FromStringAndSize(s+j, i-j); if (item == NULL) goto finally; @@ -61,7 +61,7 @@ i = i+1; } if (maxsplit && (countsplit >= maxsplit) && i < len) { - item = PyBytes_FromStringAndSize( + item = PyString_FromStringAndSize( s+i, len - i); if (item == NULL) goto finally; @@ -122,7 +122,7 @@ i = j = 0; while (i+n <= len) { if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) { - item = PyBytes_FromStringAndSize(s+j, i-j); + item = PyString_FromStringAndSize(s+j, i-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -137,7 +137,7 @@ else i++; } - item = PyBytes_FromStringAndSize(s+j, len-j); + item = PyString_FromStringAndSize(s+j, len-j); if (item == NULL) goto fail; err = PyList_Append(list, item); @@ -189,7 +189,7 @@ if (seqlen == 1) { /* Optimization if there's only one item */ PyObject *item = PySequence_GetItem(seq, 0); - if (item && !PyBytes_Check(item)) { + if (item && !PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(item); @@ -198,9 +198,9 @@ return item; } - if (!(res = PyBytes_FromStringAndSize((char*)NULL, sz))) + if (!(res = PyString_FromStringAndSize((char*)NULL, sz))) return NULL; - p = PyBytes_AsString(res); + p = PyString_AsString(res); /* optimize for lists, since it's the most common case. all others * (tuples and arbitrary sequences) just use the sequence abstract @@ -209,29 +209,29 @@ if (PyList_Check(seq)) { for (i = 0; i < seqlen; i++) { PyObject *item = PyList_GET_ITEM(seq, i); - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); return NULL; } - slen = PyBytes_GET_SIZE(item); + slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyBytes_Resize(&res, sz * 2) < 0) + if (_PyString_Resize(&res, sz * 2) < 0) return NULL; sz *= 2; - p = PyBytes_AsString(res) + reslen; + p = PyString_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyBytes_AS_STRING(item), slen); + memcpy(p, PyString_AS_STRING(item), slen); p += slen; reslen += slen; } - _PyBytes_Resize(&res, reslen); + _PyString_Resize(&res, reslen); return res; } @@ -245,33 +245,33 @@ /* This is now type safe */ for (i = 0; i < seqlen; i++) { PyObject *item = getitemfunc(seq, i); - if (!item || !PyBytes_Check(item)) { + if (!item || !PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "first argument must be sequence of strings"); Py_DECREF(res); Py_XDECREF(item); return NULL; } - slen = PyBytes_GET_SIZE(item); + slen = PyString_GET_SIZE(item); while (reslen + slen + seplen >= sz) { - if (_PyBytes_Resize(&res, sz * 2) < 0) { + if (_PyString_Resize(&res, sz * 2) < 0) { Py_DECREF(item); return NULL; } sz *= 2; - p = PyBytes_AsString(res) + reslen; + p = PyString_AsString(res) + reslen; } if (i > 0) { memcpy(p, sep, seplen); p += seplen; reslen += seplen; } - memcpy(p, PyBytes_AS_STRING(item), slen); + memcpy(p, PyString_AS_STRING(item), slen); p += slen; reslen += slen; Py_DECREF(item); } - _PyBytes_Resize(&res, reslen); + _PyString_Resize(&res, reslen); return res; } @@ -369,7 +369,7 @@ Py_ssize_t len, i, j; - if (PyBytes_AsStringAndSize(args, &s, &len)) + if (PyString_AsStringAndSize(args, &s, &len)) return NULL; i = 0; @@ -392,7 +392,7 @@ return args; } else - return PyBytes_FromStringAndSize(s+i, j-i); + return PyString_FromStringAndSize(s+i, j-i); } @@ -450,12 +450,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -489,12 +489,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -529,12 +529,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; if (0 < n) { int c = Py_CHARMASK(*s++); @@ -610,12 +610,12 @@ } /* Second pass: create output string and fill it */ - out = PyBytes_FromStringAndSize(NULL, i+j); + out = PyString_FromStringAndSize(NULL, i+j); if (out == NULL) return NULL; i = 0; - q = PyBytes_AS_STRING(out); + q = PyString_AS_STRING(out); for (p = string; p < e; p++) { if (*p == '\t') { @@ -695,12 +695,12 @@ int changed; WARN; - if (PyBytes_AsStringAndSize(args, &s, &n)) + if (PyString_AsStringAndSize(args, &s, &n)) return NULL; - newstr = PyBytes_FromStringAndSize(NULL, n); + newstr = PyString_FromStringAndSize(NULL, n); if (newstr == NULL) return NULL; - s_new = PyBytes_AsString(newstr); + s_new = PyString_AsString(newstr); changed = 0; for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); @@ -898,10 +898,10 @@ return NULL; } - result = PyBytes_FromStringAndSize((char *)NULL, 256); + result = PyString_FromStringAndSize((char *)NULL, 256); if (result == NULL) return NULL; - c = (unsigned char *) PyBytes_AS_STRING((PyBytesObject *)result); + c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result); for (i = 0; i < 256; i++) c[i]=(unsigned char)i; for (i = 0; i < fromlen; i++) @@ -942,12 +942,12 @@ } table = table1; - inlen = PyBytes_GET_SIZE(input_obj); - result = PyBytes_FromStringAndSize((char *)NULL, inlen); + inlen = PyString_GET_SIZE(input_obj); + result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; - output_start = output = PyBytes_AsString(result); - input = PyBytes_AsString(input_obj); + output_start = output = PyString_AsString(result); + input = PyString_AsString(input_obj); if (dellen == 0) { /* If no deletions are required, use faster code */ @@ -983,7 +983,7 @@ } /* Fix the size of the resulting string */ if (inlen > 0) - _PyBytes_Resize(&result, output - output_start); + _PyString_Resize(&result, output - output_start); return result; } @@ -1169,7 +1169,7 @@ Py_XINCREF(newstr); } else { - newstr = PyBytes_FromStringAndSize(new_s, out_len); + newstr = PyString_FromStringAndSize(new_s, out_len); PyMem_FREE(new_s); } return newstr; @@ -1222,7 +1222,7 @@ if (isspace(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "whitespace", s); @@ -1232,7 +1232,7 @@ if (islower(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "lowercase", s); @@ -1242,7 +1242,7 @@ if (isupper(c)) buf[n++] = c; } - s = PyBytes_FromStringAndSize(buf, n); + s = PyString_FromStringAndSize(buf, n); if (s) PyModule_AddObject(m, "uppercase", s); } Modified: python/branches/tlee-ast-optimize/Modules/sunaudiodev.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/sunaudiodev.c (original) +++ python/branches/tlee-ast-optimize/Modules/sunaudiodev.c Mon Jun 9 12:52:48 2008 @@ -135,11 +135,11 @@ if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; - rv = PyBytes_FromStringAndSize(NULL, size); + rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) return NULL; - if (!(cp = PyBytes_AsString(rv))) + if (!(cp = PyString_AsString(rv))) goto finally; count = read(self->x_fd, cp, size); Modified: python/branches/tlee-ast-optimize/Modules/svmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/svmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/svmodule.c Mon Jun 9 12:52:48 2008 @@ -47,13 +47,13 @@ if (!PyArg_Parse(args, "i", &invert)) return NULL; - if (!(output = PyBytes_FromStringAndSize( + if (!(output = PyString_FromStringAndSize( NULL, (int)(self->ob_info.width * self->ob_info.height * factor)))) { return NULL; } - if (!(outstr = PyBytes_AsString(output))) { + if (!(outstr = PyString_AsString(output))) { Py_DECREF(output); return NULL; } @@ -152,9 +152,9 @@ fieldsize = self->ob_info.width * self->ob_info.height / 2; obcapture = (char*)self->ob_capture; - if (!(f1 = PyBytes_FromStringAndSize(obcapture, fieldsize))) + if (!(f1 = PyString_FromStringAndSize(obcapture, fieldsize))) goto finally; - if (!(f2 = PyBytes_FromStringAndSize(obcapture + fieldsize, + if (!(f2 = PyString_FromStringAndSize(obcapture + fieldsize, fieldsize))) goto finally; ret = PyTuple_Pack(2, f1, f2); @@ -535,12 +535,12 @@ goto finally; } - if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) goto finally; /* XXX -- need to do something about the bitvector */ { - char* str = PyBytes_AsString(videodata); + char* str = PyString_AsString(videodata); if (!str) goto finally; @@ -615,10 +615,10 @@ if (svQueryCaptureBufferSize(self->ob_svideo, &info, &bytes)) return sv_error(); - if (!(videodata = PyBytes_FromStringAndSize(NULL, bytes))) + if (!(videodata = PyString_FromStringAndSize(NULL, bytes))) return NULL; - str = PyBytes_AsString(videodata); + str = PyString_AsString(videodata); if (!str) goto finally; @@ -849,11 +849,11 @@ return NULL; } - if (!(output = PyBytes_FromStringAndSize(NULL, + if (!(output = PyString_FromStringAndSize(NULL, (int)(width * height * factor)))) return NULL; - str = PyBytes_AsString(output); + str = PyString_AsString(output); if (!str) { Py_DECREF(output); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/syslogmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/syslogmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/syslogmodule.c Mon Jun 9 12:52:48 2008 @@ -71,7 +71,7 @@ S_ident_o = new_S_ident_o; Py_INCREF(S_ident_o); - openlog(PyBytes_AsString(S_ident_o), logopt, facility); + openlog(PyString_AsString(S_ident_o), logopt, facility); Py_INCREF(Py_None); return Py_None; Modified: python/branches/tlee-ast-optimize/Modules/termios.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/termios.c (original) +++ python/branches/tlee-ast-optimize/Modules/termios.c Mon Jun 9 12:52:48 2008 @@ -91,7 +91,7 @@ return NULL; for (i = 0; i < NCCS; i++) { ch = (char)mode.c_cc[i]; - v = PyBytes_FromStringAndSize(&ch, 1); + v = PyString_FromStringAndSize(&ch, 1); if (v == NULL) goto err; PyList_SetItem(cc, i, v); @@ -183,8 +183,8 @@ for (i = 0; i < NCCS; i++) { v = PyList_GetItem(cc, i); - if (PyBytes_Check(v) && PyBytes_Size(v) == 1) - mode.c_cc[i] = (cc_t) * PyBytes_AsString(v); + if (PyString_Check(v) && PyString_Size(v) == 1) + mode.c_cc[i] = (cc_t) * PyString_AsString(v); else if (PyInt_Check(v)) mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { Modified: python/branches/tlee-ast-optimize/Modules/threadmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/threadmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/threadmodule.c Mon Jun 9 12:52:48 2008 @@ -190,7 +190,7 @@ Py_XINCREF(kw); self->kw = kw; self->dict = NULL; /* making sure */ - self->key = PyBytes_FromFormat("thread.local.%p", self); + self->key = PyString_FromFormat("thread.local.%p", self); if (self->key == NULL) goto err; Modified: python/branches/tlee-ast-optimize/Modules/timemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/timemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/timemodule.c Mon Jun 9 12:52:48 2008 @@ -488,7 +488,7 @@ e.g. an empty format, or %Z when the timezone is unknown. */ PyObject *ret; - ret = PyBytes_FromStringAndSize(outbuf, buflen); + ret = PyString_FromStringAndSize(outbuf, buflen); free(outbuf); return ret; } @@ -548,7 +548,7 @@ p = asctime(&buf); if (p[24] == '\n') p[24] = '\0'; - return PyBytes_FromString(p); + return PyString_FromString(p); } PyDoc_STRVAR(asctime_doc, @@ -584,7 +584,7 @@ } if (p[24] == '\n') p[24] = '\0'; - return PyBytes_FromString(p); + return PyString_FromString(p); } PyDoc_STRVAR(ctime_doc, Modified: python/branches/tlee-ast-optimize/Modules/unicodedata.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/unicodedata.c (original) +++ python/branches/tlee-ast-optimize/Modules/unicodedata.c Mon Jun 9 12:52:48 2008 @@ -266,7 +266,7 @@ if (old->category_changed != 0xFF) index = old->category_changed; } - return PyBytes_FromString(_PyUnicode_CategoryNames[index]); + return PyString_FromString(_PyUnicode_CategoryNames[index]); } PyDoc_STRVAR(unicodedata_bidirectional__doc__, @@ -297,7 +297,7 @@ else if (old->bidir_changed != 0xFF) index = old->bidir_changed; } - return PyBytes_FromString(_PyUnicode_BidirectionalNames[index]); + return PyString_FromString(_PyUnicode_BidirectionalNames[index]); } PyDoc_STRVAR(unicodedata_combining__doc__, @@ -383,7 +383,7 @@ if (old->category_changed == 0) index = 0; /* unassigned */ } - return PyBytes_FromString(_PyUnicode_EastAsianWidthNames[index]); + return PyString_FromString(_PyUnicode_EastAsianWidthNames[index]); } PyDoc_STRVAR(unicodedata_decomposition__doc__, @@ -414,7 +414,7 @@ if (self) { const change_record *old = get_old_record(self, c); if (old->category_changed == 0) - return PyBytes_FromString(""); /* unassigned */ + return PyString_FromString(""); /* unassigned */ } if (code < 0 || code >= 0x110000) @@ -453,7 +453,7 @@ decomp[i] = '\0'; - return PyBytes_FromString(decomp); + return PyString_FromString(decomp); } static void @@ -518,7 +518,7 @@ /* Hangul Decomposition adds three characters in a single step, so we need atleast that much room. */ if (space < 3) { - Py_ssize_t newsize = PyBytes_GET_SIZE(result) + 10; + Py_ssize_t newsize = PyString_GET_SIZE(result) + 10; space += 10; if (PyUnicode_Resize(&result, newsize) == -1) return NULL; Modified: python/branches/tlee-ast-optimize/Modules/zipimport.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/zipimport.c (original) +++ python/branches/tlee-ast-optimize/Modules/zipimport.c Mon Jun 9 12:52:48 2008 @@ -154,11 +154,11 @@ } } - self->archive = PyBytes_FromString(buf); + self->archive = PyString_FromString(buf); if (self->archive == NULL) return -1; - self->prefix = PyBytes_FromString(prefix); + self->prefix = PyString_FromString(prefix); if (self->prefix == NULL) return -1; @@ -191,10 +191,10 @@ char *archive = "???"; char *prefix = ""; - if (self->archive != NULL && PyBytes_Check(self->archive)) - archive = PyBytes_AsString(self->archive); - if (self->prefix != NULL && PyBytes_Check(self->prefix)) - prefix = PyBytes_AsString(self->prefix); + if (self->archive != NULL && PyString_Check(self->archive)) + archive = PyString_AsString(self->archive); + if (self->prefix != NULL && PyString_Check(self->prefix)) + prefix = PyString_AsString(self->prefix); if (prefix != NULL && *prefix) PyOS_snprintf(buf, sizeof(buf), "", @@ -203,7 +203,7 @@ PyOS_snprintf(buf, sizeof(buf), "", archive); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } /* return fullname.split(".")[-1] */ @@ -263,7 +263,7 @@ subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return MI_ERROR; @@ -336,12 +336,12 @@ /* add __path__ to the module *before* the code gets executed */ PyObject *pkgpath, *fullpath; - char *prefix = PyBytes_AsString(self->prefix); + char *prefix = PyString_AsString(self->prefix); char *subname = get_subname(fullname); int err; - fullpath = PyBytes_FromFormat("%s%c%s%s", - PyBytes_AsString(self->archive), + fullpath = PyString_FromFormat("%s%c%s%s", + PyString_AsString(self->archive), SEP, *prefix ? prefix : "", subname); @@ -418,9 +418,9 @@ } path = buf; #endif - len = PyBytes_Size(self->archive); + len = PyString_Size(self->archive); if ((size_t)len < strlen(path) && - strncmp(path, PyBytes_AsString(self->archive), len) == 0 && + strncmp(path, PyString_AsString(self->archive), len) == 0 && path[len] == SEP) { path = path + len + 1; } @@ -430,7 +430,7 @@ PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); return NULL; } - return get_data(PyBytes_AsString(self->archive), toc_entry); + return get_data(PyString_AsString(self->archive), toc_entry); } static PyObject * @@ -467,7 +467,7 @@ } subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -480,7 +480,7 @@ toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) - return get_data(PyBytes_AsString(self->archive), toc_entry); + return get_data(PyString_AsString(self->archive), toc_entry); /* we have the module, but no source */ Py_INCREF(Py_None); @@ -843,13 +843,13 @@ PyMarshal_ReadShortFromFile(fp); /* local header size */ file_offset += l; /* Start of file data */ - raw_data = PyBytes_FromStringAndSize((char *)NULL, compress == 0 ? + raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ? data_size : data_size + 1); if (raw_data == NULL) { fclose(fp); return NULL; } - buf = PyBytes_AsString(raw_data); + buf = PyString_AsString(raw_data); err = fseek(fp, file_offset, 0); if (err == 0) @@ -907,8 +907,8 @@ unmarshal_code(char *pathname, PyObject *data, time_t mtime) { PyObject *code; - char *buf = PyBytes_AsString(data); - Py_ssize_t size = PyBytes_Size(data); + char *buf = PyString_AsString(data); + Py_ssize_t size = PyString_Size(data); if (size <= 9) { PyErr_SetString(ZipImportError, @@ -953,14 +953,14 @@ static PyObject * normalize_line_endings(PyObject *source) { - char *buf, *q, *p = PyBytes_AsString(source); + char *buf, *q, *p = PyString_AsString(source); PyObject *fixed_source; if (!p) return NULL; /* one char extra for trailing \n and one for terminating \0 */ - buf = (char *)PyMem_Malloc(PyBytes_Size(source) + 2); + buf = (char *)PyMem_Malloc(PyString_Size(source) + 2); if (buf == NULL) { PyErr_SetString(PyExc_MemoryError, "zipimport: no memory to allocate " @@ -979,7 +979,7 @@ } *q++ = '\n'; /* add trailing \n */ *q = '\0'; - fixed_source = PyBytes_FromString(buf); + fixed_source = PyString_FromString(buf); PyMem_Free(buf); return fixed_source; } @@ -995,7 +995,7 @@ if (fixed_source == NULL) return NULL; - code = Py_CompileString(PyBytes_AsString(fixed_source), pathname, + code = Py_CompileString(PyString_AsString(fixed_source), pathname, Py_file_input); Py_DECREF(fixed_source); return code; @@ -1054,7 +1054,7 @@ { PyObject *data, *code; char *modpath; - char *archive = PyBytes_AsString(self->archive); + char *archive = PyString_AsString(self->archive); if (archive == NULL) return NULL; @@ -1063,7 +1063,7 @@ if (data == NULL) return NULL; - modpath = PyBytes_AsString(PyTuple_GetItem(toc_entry, 0)); + modpath = PyString_AsString(PyTuple_GetItem(toc_entry, 0)); if (isbytecode) { code = unmarshal_code(modpath, data, mtime); @@ -1088,7 +1088,7 @@ subname = get_subname(fullname); - len = make_filename(PyBytes_AsString(self->prefix), subname, path); + len = make_filename(PyString_AsString(self->prefix), subname, path); if (len < 0) return NULL; @@ -1098,7 +1098,7 @@ strcpy(path + len, zso->suffix); if (Py_VerboseFlag > 1) PySys_WriteStderr("# trying %s%c%s\n", - PyBytes_AsString(self->archive), + PyString_AsString(self->archive), SEP, path); toc_entry = PyDict_GetItemString(self->files, path); if (toc_entry != NULL) { @@ -1120,7 +1120,7 @@ continue; } if (code != NULL && p_modpath != NULL) - *p_modpath = PyBytes_AsString( + *p_modpath = PyString_AsString( PyTuple_GetItem(toc_entry, 0)); return code; } Modified: python/branches/tlee-ast-optimize/Modules/zlibmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/zlibmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/zlibmodule.c Mon Jun 9 12:52:48 2008 @@ -96,12 +96,12 @@ if (self == NULL) return NULL; self->is_initialised = 0; - self->unused_data = PyBytes_FromString(""); + self->unused_data = PyString_FromString(""); if (self->unused_data == NULL) { Py_DECREF(self); return NULL; } - self->unconsumed_tail = PyBytes_FromString(""); + self->unconsumed_tail = PyString_FromString(""); if (self->unconsumed_tail == NULL) { Py_DECREF(self); return NULL; @@ -174,7 +174,7 @@ err=deflateEnd(&zst); if (err == Z_OK) - ReturnVal = PyBytes_FromStringAndSize((char *)output, + ReturnVal = PyString_FromStringAndSize((char *)output, zst.total_out); else zlib_error(zst, err, "while finishing compression"); @@ -211,12 +211,12 @@ zst.avail_in = length; zst.avail_out = r_strlen; - if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen))) + if (!(result_str = PyString_FromStringAndSize(NULL, r_strlen))) return NULL; zst.zalloc = (alloc_func)NULL; zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)PyBytes_AS_STRING(result_str); + zst.next_out = (Byte *)PyString_AS_STRING(result_str); zst.next_in = (Byte *)input; err = inflateInit2(&zst, wsize); @@ -256,11 +256,11 @@ /* fall through */ case(Z_OK): /* need more memory */ - if (_PyBytes_Resize(&result_str, r_strlen << 1) < 0) { + if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { inflateEnd(&zst); goto error; } - zst.next_out = (unsigned char *)PyBytes_AS_STRING(result_str) \ + zst.next_out = (unsigned char *)PyString_AS_STRING(result_str) \ + r_strlen; zst.avail_out = r_strlen; r_strlen = r_strlen << 1; @@ -278,7 +278,7 @@ goto error; } - _PyBytes_Resize(&result_str, zst.total_out); + _PyString_Resize(&result_str, zst.total_out); return result_str; error: @@ -400,7 +400,7 @@ if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) return NULL; - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -409,7 +409,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), Z_NO_FLUSH); @@ -418,9 +418,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&RetVal, length << 1) < 0) + if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -440,7 +440,7 @@ RetVal = NULL; goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -479,7 +479,7 @@ /* limit amount of data allocated to max_length */ if (max_length && length > max_length) length = max_length; - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -488,7 +488,7 @@ self->zst.avail_in = inplen; self->zst.next_in = input; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); @@ -510,9 +510,9 @@ if (max_length && length > max_length) length = max_length; - if (_PyBytes_Resize(&RetVal, length) < 0) + if (_PyString_Resize(&RetVal, length) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + old_length; self->zst.avail_out = length - old_length; @@ -525,7 +525,7 @@ of specified size. Return the unconsumed tail in an attribute.*/ if(max_length) { Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in, + self->unconsumed_tail = PyString_FromStringAndSize((char *)self->zst.next_in, self->zst.avail_in); if(!self->unconsumed_tail) { Py_DECREF(RetVal); @@ -542,7 +542,7 @@ */ if (err == Z_STREAM_END) { Py_XDECREF(self->unused_data); /* Free original empty string */ - self->unused_data = PyBytes_FromStringAndSize( + self->unused_data = PyString_FromStringAndSize( (char *)self->zst.next_in, self->zst.avail_in); if (self->unused_data == NULL) { Py_DECREF(RetVal); @@ -559,7 +559,7 @@ goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -589,10 +589,10 @@ /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in doing any work at all; just return an empty string. */ if (flushmode == Z_NO_FLUSH) { - return PyBytes_FromStringAndSize(NULL, 0); + return PyString_FromStringAndSize(NULL, 0); } - if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) + if (!(RetVal = PyString_FromStringAndSize(NULL, length))) return NULL; ENTER_ZLIB @@ -600,7 +600,7 @@ start_total_out = self->zst.total_out; self->zst.avail_in = 0; self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal); + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); Py_BEGIN_ALLOW_THREADS err = deflate(&(self->zst), flushmode); @@ -609,9 +609,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&RetVal, length << 1) < 0) + if (_PyString_Resize(&RetVal, length << 1) < 0) goto error; - self->zst.next_out = (unsigned char *)PyBytes_AS_STRING(RetVal) \ + self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ + length; self->zst.avail_out = length; length = length << 1; @@ -646,7 +646,7 @@ goto error; } - _PyBytes_Resize(&RetVal, self->zst.total_out - start_total_out); + _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); error: LEAVE_ZLIB @@ -778,7 +778,7 @@ PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); return NULL; } - if (!(retval = PyBytes_FromStringAndSize(NULL, length))) + if (!(retval = PyString_FromStringAndSize(NULL, length))) return NULL; @@ -786,7 +786,7 @@ start_total_out = self->zst.total_out; self->zst.avail_out = length; - self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval); + self->zst.next_out = (Byte *)PyString_AS_STRING(retval); Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_FINISH); @@ -795,9 +795,9 @@ /* while Z_OK and the output buffer is full, there might be more output, so extend the output buffer and try again */ while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) { - if (_PyBytes_Resize(&retval, length << 1) < 0) + if (_PyString_Resize(&retval, length << 1) < 0) goto error; - self->zst.next_out = (Byte *)PyBytes_AS_STRING(retval) + length; + self->zst.next_out = (Byte *)PyString_AS_STRING(retval) + length; self->zst.avail_out = length; length = length << 1; @@ -819,7 +819,7 @@ goto error; } } - _PyBytes_Resize(&retval, self->zst.total_out - start_total_out); + _PyString_Resize(&retval, self->zst.total_out - start_total_out); error: @@ -1027,7 +1027,7 @@ PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); - ver = PyBytes_FromString(ZLIB_VERSION); + ver = PyString_FromString(ZLIB_VERSION); if (ver != NULL) PyModule_AddObject(m, "ZLIB_VERSION", ver); Modified: python/branches/tlee-ast-optimize/Objects/abstract.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/abstract.c (original) +++ python/branches/tlee-ast-optimize/Objects/abstract.c Mon Jun 9 12:52:48 2008 @@ -105,7 +105,7 @@ /* cache a hashed version of the attribute string */ if (hintstrobj == NULL) { - hintstrobj = PyBytes_InternFromString("__length_hint__"); + hintstrobj = PyString_InternFromString("__length_hint__"); if (hintstrobj == NULL) goto defaultcase; } @@ -227,7 +227,7 @@ null_error(); return -1; } - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return -1; ret = PyObject_DelItem(o, okey); @@ -723,21 +723,21 @@ /* Initialize cached value */ if (str__format__ == NULL) { /* Initialize static variable needed by _PyType_Lookup */ - str__format__ = PyBytes_InternFromString("__format__"); + str__format__ = PyString_InternFromString("__format__"); if (str__format__ == NULL) goto done; } /* If no format_spec is provided, use an empty string */ if (format_spec == NULL) { - empty = PyBytes_FromStringAndSize(NULL, 0); + empty = PyString_FromStringAndSize(NULL, 0); format_spec = empty; } /* Check the format_spec type, and make sure it's str or unicode */ if (PyUnicode_Check(format_spec)) spec_is_unicode = 1; - else if (PyBytes_Check(format_spec)) + else if (PyString_Check(format_spec)) spec_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -817,7 +817,7 @@ /* Check the result type, and make sure it's str or unicode */ if (PyUnicode_Check(result)) result_is_unicode = 1; - else if (PyBytes_Check(result)) + else if (PyString_Check(result)) result_is_unicode = 0; else { PyErr_Format(PyExc_TypeError, @@ -1535,7 +1535,7 @@ const char *type_name; static PyObject *int_name = NULL; if (int_name == NULL) { - int_name = PyBytes_InternFromString("__int__"); + int_name = PyString_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1561,7 +1561,7 @@ non_integral_error: if (PyInstance_Check(integral)) { - type_name = PyBytes_AS_STRING(((PyInstanceObject *)integral) + type_name = PyString_AS_STRING(((PyInstanceObject *)integral) ->in_class->cl_name); } else { @@ -1583,7 +1583,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyBytes_InternFromString("__trunc__"); + trunc_name = PyString_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1623,9 +1623,9 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyBytes_Check(o)) - return int_from_string(PyBytes_AS_STRING(o), - PyBytes_GET_SIZE(o)); + if (PyString_Check(o)) + return int_from_string(PyString_AS_STRING(o), + PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), @@ -1668,7 +1668,7 @@ Py_ssize_t buffer_len; if (trunc_name == NULL) { - trunc_name = PyBytes_InternFromString("__trunc__"); + trunc_name = PyString_InternFromString("__trunc__"); if (trunc_name == NULL) return NULL; } @@ -1710,13 +1710,13 @@ } PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - if (PyBytes_Check(o)) + if (PyString_Check(o)) /* need to do extra error checking that PyLong_FromString() * doesn't do. In particular long('9.5') must raise an * exception, not truncate the float. */ - return long_from_string(PyBytes_AS_STRING(o), - PyBytes_GET_SIZE(o)); + return long_from_string(PyString_AS_STRING(o), + PyString_GET_SIZE(o)); #ifdef Py_USING_UNICODE if (PyUnicode_Check(o)) /* The above check is done in PyLong_FromUnicode(). */ @@ -2407,7 +2407,7 @@ if (key == NULL) return null_error(); - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return NULL; r = PyObject_GetItem(o, okey); @@ -2426,7 +2426,7 @@ return -1; } - okey = PyBytes_FromString(key); + okey = PyString_FromString(key); if (okey == NULL) return -1; r = PyObject_SetItem(o, okey, value); @@ -2754,7 +2754,7 @@ PyObject *bases; if (__bases__ == NULL) { - __bases__ = PyBytes_InternFromString("__bases__"); + __bases__ = PyString_InternFromString("__bases__"); if (__bases__ == NULL) return NULL; } @@ -2832,7 +2832,7 @@ int retval = 0; if (__class__ == NULL) { - __class__ = PyBytes_InternFromString("__class__"); + __class__ = PyString_InternFromString("__class__"); if (__class__ == NULL) return -1; } @@ -2908,7 +2908,7 @@ return 1; if (name == NULL) { - name = PyBytes_InternFromString("__instancecheck__"); + name = PyString_InternFromString("__instancecheck__"); if (name == NULL) return -1; } @@ -2992,7 +2992,7 @@ PyErr_Fetch(&t, &v, &tb); if (name == NULL) { - name = PyBytes_InternFromString("__subclasscheck__"); + name = PyString_InternFromString("__subclasscheck__"); if (name == NULL) return -1; } Modified: python/branches/tlee-ast-optimize/Objects/boolobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/boolobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/boolobject.c Mon Jun 9 12:52:48 2008 @@ -25,10 +25,10 @@ if (self->ob_ival) s = true_str ? true_str : - (true_str = PyBytes_InternFromString("True")); + (true_str = PyString_InternFromString("True")); else s = false_str ? false_str : - (false_str = PyBytes_InternFromString("False")); + (false_str = PyString_InternFromString("False")); Py_XINCREF(s); return s; } Modified: python/branches/tlee-ast-optimize/Objects/bufferobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bufferobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bufferobject.c Mon Jun 9 12:52:48 2008 @@ -287,13 +287,13 @@ const char *status = self->b_readonly ? "read-only" : "read-write"; if ( self->b_base == NULL ) - return PyBytes_FromFormat("<%s buffer ptr %p, size %zd at %p>", + return PyString_FromFormat("<%s buffer ptr %p, size %zd at %p>", status, self->b_ptr, self->b_size, self); else - return PyBytes_FromFormat( + return PyString_FromFormat( "<%s buffer for %p, size %zd, offset %zd at %p>", status, self->b_base, @@ -318,7 +318,7 @@ * underlying memory is immutable. b_readonly is a necessary but not * sufficient condition for a buffer to be hashable. Perhaps it would * be better to only allow hashing if the underlying object is known to - * be immutable (e.g. PyBytes_Check() is true). Another idea would + * be immutable (e.g. PyString_Check() is true). Another idea would * be to call tp_hash on the underlying object and see if it raises * an error. */ if ( !self->b_readonly ) @@ -349,7 +349,7 @@ Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - return PyBytes_FromStringAndSize((const char *)ptr, size); + return PyString_FromStringAndSize((const char *)ptr, size); } /* Sequence methods */ @@ -401,10 +401,10 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; - ob = PyBytes_FromStringAndSize(NULL, size + count); + ob = PyString_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; - p = PyBytes_AS_STRING(ob); + p = PyString_AS_STRING(ob); memcpy(p, ptr1, size); memcpy(p + size, ptr2, count); @@ -426,11 +426,11 @@ count = 0; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - ob = PyBytes_FromStringAndSize(NULL, size * count); + ob = PyString_FromStringAndSize(NULL, size * count); if ( ob == NULL ) return NULL; - p = PyBytes_AS_STRING(ob); + p = PyString_AS_STRING(ob); while ( count-- ) { memcpy(p, ptr, size); @@ -454,7 +454,7 @@ PyErr_SetString(PyExc_IndexError, "buffer index out of range"); return NULL; } - return PyBytes_FromStringAndSize((char *)ptr + idx, 1); + return PyString_FromStringAndSize((char *)ptr + idx, 1); } static PyObject * @@ -472,7 +472,7 @@ right = size; if ( right < left ) right = left; - return PyBytes_FromStringAndSize((char *)ptr + left, + return PyString_FromStringAndSize((char *)ptr + left, right - left); } @@ -501,9 +501,9 @@ } if (slicelength <= 0) - return PyBytes_FromStringAndSize("", 0); + return PyString_FromStringAndSize("", 0); else if (step == 1) - return PyBytes_FromStringAndSize((char *)p + start, + return PyString_FromStringAndSize((char *)p + start, stop - start); else { PyObject *result; @@ -518,7 +518,7 @@ result_buf[i] = source_buf[cur]; } - result = PyBytes_FromStringAndSize(result_buf, + result = PyString_FromStringAndSize(result_buf, slicelength); PyMem_Free(result_buf); return result; Modified: python/branches/tlee-ast-optimize/Objects/bytes_methods.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytes_methods.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytes_methods.c Mon Jun 9 12:52:48 2008 @@ -462,11 +462,11 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -490,11 +490,11 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); */ Py_MEMCPY(result, cptr, len); @@ -520,10 +520,10 @@ int previous_is_cased = 0; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); @@ -553,10 +553,10 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ if (0 < len) { int c = Py_CHARMASK(*s++); @@ -589,10 +589,10 @@ Py_ssize_t i; /* - newobj = PyBytes_FromStringAndSize(NULL, len); + newobj = PyString_FromStringAndSize(NULL, len); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); */ for (i = 0; i < len; i++) { int c = Py_CHARMASK(*s++); Modified: python/branches/tlee-ast-optimize/Objects/bytesobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytesobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytesobject.c Mon Jun 9 12:52:48 2008 @@ -87,13 +87,13 @@ /* share short strings */ if (size == 0) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1 && str != NULL) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); @@ -140,13 +140,13 @@ /* share short strings */ if (size == 0) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1) { PyObject *t = (PyObject *)op; - PyBytes_InternInPlace(&t); + PyString_InternInPlace(&t); op = (PyBytesObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); @@ -5093,12 +5093,12 @@ } void -PyBytes_InternInPlace(PyObject **p) +PyString_InternInPlace(PyObject **p) { register PyBytesObject *s = (PyBytesObject *)(*p); PyObject *t; if (s == NULL || !PyBytes_Check(s)) - Py_FatalError("PyBytes_InternInPlace: strings only please!"); + Py_FatalError("PyString_InternInPlace: strings only please!"); /* If it's a string subclass, we don't really know what putting it in the interned dict might do. */ if (!PyBytes_CheckExact(s)) @@ -5131,9 +5131,9 @@ } void -PyBytes_InternImmortal(PyObject **p) +PyString_InternImmortal(PyObject **p) { - PyBytes_InternInPlace(p); + PyString_InternInPlace(p); if (PyBytes_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { PyBytes_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; Py_INCREF(*p); @@ -5142,17 +5142,17 @@ PyObject * -PyBytes_InternFromString(const char *cp) +PyString_InternFromString(const char *cp) { PyObject *s = PyBytes_FromString(cp); if (s == NULL) return NULL; - PyBytes_InternInPlace(&s); + PyString_InternInPlace(&s); return s; } void -PyBytes_Fini(void) +PyString_Fini(void) { int i; for (i = 0; i < UCHAR_MAX + 1; i++) { Modified: python/branches/tlee-ast-optimize/Objects/cellobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/cellobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/cellobject.c Mon Jun 9 12:52:48 2008 @@ -73,9 +73,9 @@ cell_repr(PyCellObject *op) { if (op->ob_ref == NULL) - return PyBytes_FromFormat("", op); + return PyString_FromFormat("", op); - return PyBytes_FromFormat("", + return PyString_FromFormat("", op, op->ob_ref->ob_type->tp_name, op->ob_ref); } Modified: python/branches/tlee-ast-optimize/Objects/classobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/classobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/classobject.c Mon Jun 9 12:52:48 2008 @@ -32,21 +32,21 @@ PyClassObject *op, *dummy; static PyObject *docstr, *modstr, *namestr; if (docstr == NULL) { - docstr= PyBytes_InternFromString("__doc__"); + docstr= PyString_InternFromString("__doc__"); if (docstr == NULL) return NULL; } if (modstr == NULL) { - modstr= PyBytes_InternFromString("__module__"); + modstr= PyString_InternFromString("__module__"); if (modstr == NULL) return NULL; } if (namestr == NULL) { - namestr= PyBytes_InternFromString("__name__"); + namestr= PyString_InternFromString("__name__"); if (namestr == NULL) return NULL; } - if (name == NULL || !PyBytes_Check(name)) { + if (name == NULL || !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "PyClass_New: name must be a string"); return NULL; @@ -101,13 +101,13 @@ } if (getattrstr == NULL) { - getattrstr = PyBytes_InternFromString("__getattr__"); + getattrstr = PyString_InternFromString("__getattr__"); if (getattrstr == NULL) goto alloc_error; - setattrstr = PyBytes_InternFromString("__setattr__"); + setattrstr = PyString_InternFromString("__setattr__"); if (setattrstr == NULL) goto alloc_error; - delattrstr = PyBytes_InternFromString("__delattr__"); + delattrstr = PyString_InternFromString("__delattr__"); if (delattrstr == NULL) goto alloc_error; } @@ -222,7 +222,7 @@ class_getattr(register PyClassObject *op, PyObject *name) { register PyObject *v; - register char *sname = PyBytes_AsString(name); + register char *sname = PyString_AsString(name); PyClassObject *klass; descrgetfunc f; @@ -253,7 +253,7 @@ if (v == NULL) { PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyBytes_AS_STRING(op->cl_name), sname); + PyString_AS_STRING(op->cl_name), sname); return NULL; } f = TP_DESCR_GET(v->ob_type); @@ -316,9 +316,9 @@ static char * set_name(PyClassObject *c, PyObject *v) { - if (v == NULL || !PyBytes_Check(v)) + if (v == NULL || !PyString_Check(v)) return "__name__ must be a string object"; - if (strlen(PyBytes_AS_STRING(v)) != (size_t)PyBytes_GET_SIZE(v)) + if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v)) return "__name__ must not contain null bytes"; set_slot(&c->cl_name, v); return ""; @@ -333,9 +333,9 @@ "classes are read-only in restricted mode"); return -1; } - sname = PyBytes_AsString(name); + sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyBytes_Size(name); + Py_ssize_t n = PyString_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { char *err = NULL; if (strcmp(sname, "__dict__") == 0) @@ -365,7 +365,7 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "class %.50s has no attribute '%.400s'", - PyBytes_AS_STRING(op->cl_name), sname); + PyString_AS_STRING(op->cl_name), sname); return rv; } else @@ -377,15 +377,15 @@ { PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); char *name; - if (op->cl_name == NULL || !PyBytes_Check(op->cl_name)) + if (op->cl_name == NULL || !PyString_Check(op->cl_name)) name = "?"; else - name = PyBytes_AsString(op->cl_name); - if (mod == NULL || !PyBytes_Check(mod)) - return PyBytes_FromFormat("", name, op); + name = PyString_AsString(op->cl_name); + if (mod == NULL || !PyString_Check(mod)) + return PyString_FromFormat("", name, op); else - return PyBytes_FromFormat("", - PyBytes_AsString(mod), + return PyString_FromFormat("", + PyString_AsString(mod), name, op); } @@ -397,21 +397,21 @@ PyObject *res; Py_ssize_t m, n; - if (name == NULL || !PyBytes_Check(name)) + if (name == NULL || !PyString_Check(name)) return class_repr(op); - if (mod == NULL || !PyBytes_Check(mod)) { + if (mod == NULL || !PyString_Check(mod)) { Py_INCREF(name); return name; } - m = PyBytes_GET_SIZE(mod); - n = PyBytes_GET_SIZE(name); - res = PyBytes_FromStringAndSize((char *)NULL, m+1+n); + m = PyString_GET_SIZE(mod); + n = PyString_GET_SIZE(name); + res = PyString_FromStringAndSize((char *)NULL, m+1+n); if (res != NULL) { - char *s = PyBytes_AS_STRING(res); - memcpy(s, PyBytes_AS_STRING(mod), m); + char *s = PyString_AS_STRING(res); + memcpy(s, PyString_AS_STRING(mod), m); s += m; *s++ = '.'; - memcpy(s, PyBytes_AS_STRING(name), n); + memcpy(s, PyString_AS_STRING(name), n); } return res; } @@ -541,7 +541,7 @@ static PyObject *initstr; if (initstr == NULL) { - initstr = PyBytes_InternFromString("__init__"); + initstr = PyString_InternFromString("__init__"); if (initstr == NULL) return NULL; } @@ -634,7 +634,7 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ if (delstr == NULL) { - delstr = PyBytes_InternFromString("__del__"); + delstr = PyString_InternFromString("__del__"); if (delstr == NULL) PyErr_WriteUnraisable((PyObject*)inst); } @@ -696,7 +696,7 @@ instance_getattr1(register PyInstanceObject *inst, PyObject *name) { register PyObject *v; - register char *sname = PyBytes_AsString(name); + register char *sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -716,7 +716,7 @@ if (v == NULL && !PyErr_Occurred()) { PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyBytes_AS_STRING(inst->in_class->cl_name), sname); + PyString_AS_STRING(inst->in_class->cl_name), sname); } return v; } @@ -779,7 +779,7 @@ assert(PyInstance_Check(pinst)); inst = (PyInstanceObject *)pinst; - assert(PyBytes_Check(name)); + assert(PyString_Check(name)); v = PyDict_GetItem(inst->in_dict, name); if (v == NULL) @@ -795,8 +795,8 @@ if (rv < 0) PyErr_Format(PyExc_AttributeError, "%.50s instance has no attribute '%.400s'", - PyBytes_AS_STRING(inst->in_class->cl_name), - PyBytes_AS_STRING(name)); + PyString_AS_STRING(inst->in_class->cl_name), + PyString_AS_STRING(name)); return rv; } else @@ -807,9 +807,9 @@ instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v) { PyObject *func, *args, *res, *tmp; - char *sname = PyBytes_AsString(name); + char *sname = PyString_AsString(name); if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyBytes_Size(name); + Py_ssize_t n = PyString_Size(name); if (sname[n-1] == '_' && sname[n-2] == '_') { if (strcmp(sname, "__dict__") == 0) { if (PyEval_GetRestricted()) { @@ -875,7 +875,7 @@ static PyObject *reprstr; if (reprstr == NULL) { - reprstr = PyBytes_InternFromString("__repr__"); + reprstr = PyString_InternFromString("__repr__"); if (reprstr == NULL) return NULL; } @@ -889,16 +889,16 @@ classname = inst->in_class->cl_name; mod = PyDict_GetItemString(inst->in_class->cl_dict, "__module__"); - if (classname != NULL && PyBytes_Check(classname)) - cname = PyBytes_AsString(classname); + if (classname != NULL && PyString_Check(classname)) + cname = PyString_AsString(classname); else cname = "?"; - if (mod == NULL || !PyBytes_Check(mod)) - return PyBytes_FromFormat("", + if (mod == NULL || !PyString_Check(mod)) + return PyString_FromFormat("", cname, inst); else - return PyBytes_FromFormat("<%s.%s instance at %p>", - PyBytes_AsString(mod), + return PyString_FromFormat("<%s.%s instance at %p>", + PyString_AsString(mod), cname, inst); } res = PyEval_CallObject(func, (PyObject *)NULL); @@ -914,7 +914,7 @@ static PyObject *strstr; if (strstr == NULL) { - strstr = PyBytes_InternFromString("__str__"); + strstr = PyString_InternFromString("__str__"); if (strstr == NULL) return NULL; } @@ -939,7 +939,7 @@ static PyObject *hashstr, *eqstr, *cmpstr; if (hashstr == NULL) { - hashstr = PyBytes_InternFromString("__hash__"); + hashstr = PyString_InternFromString("__hash__"); if (hashstr == NULL) return -1; } @@ -952,7 +952,7 @@ address. If an __eq__ or __cmp__ method exists, there must be a __hash__. */ if (eqstr == NULL) { - eqstr = PyBytes_InternFromString("__eq__"); + eqstr = PyString_InternFromString("__eq__"); if (eqstr == NULL) return -1; } @@ -962,7 +962,7 @@ return -1; PyErr_Clear(); if (cmpstr == NULL) { - cmpstr = PyBytes_InternFromString("__cmp__"); + cmpstr = PyString_InternFromString("__cmp__"); if (cmpstr == NULL) return -1; } @@ -1014,7 +1014,7 @@ Py_ssize_t outcome; if (lenstr == NULL) { - lenstr = PyBytes_InternFromString("__len__"); + lenstr = PyString_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1063,7 +1063,7 @@ PyObject *res; if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1090,7 +1090,7 @@ if (value == NULL) { if (delitemstr == NULL) { - delitemstr = PyBytes_InternFromString("__delitem__"); + delitemstr = PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1098,7 +1098,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyBytes_InternFromString("__setitem__"); + setitemstr = PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1135,7 +1135,7 @@ PyObject *func, *res; if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1154,7 +1154,7 @@ static PyObject *getslicestr; if (getslicestr == NULL) { - getslicestr = PyBytes_InternFromString("__getslice__"); + getslicestr = PyString_InternFromString("__getslice__"); if (getslicestr == NULL) return NULL; } @@ -1166,7 +1166,7 @@ PyErr_Clear(); if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -1194,7 +1194,7 @@ if (item == NULL) { if (delitemstr == NULL) { - delitemstr = PyBytes_InternFromString("__delitem__"); + delitemstr = PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1202,7 +1202,7 @@ } else { if (setitemstr == NULL) { - setitemstr = PyBytes_InternFromString("__setitem__"); + setitemstr = PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1236,7 +1236,7 @@ if (value == NULL) { if (delslicestr == NULL) { delslicestr = - PyBytes_InternFromString("__delslice__"); + PyString_InternFromString("__delslice__"); if (delslicestr == NULL) return -1; } @@ -1247,7 +1247,7 @@ PyErr_Clear(); if (delitemstr == NULL) { delitemstr = - PyBytes_InternFromString("__delitem__"); + PyString_InternFromString("__delitem__"); if (delitemstr == NULL) return -1; } @@ -1263,7 +1263,7 @@ else { if (setslicestr == NULL) { setslicestr = - PyBytes_InternFromString("__setslice__"); + PyString_InternFromString("__setslice__"); if (setslicestr == NULL) return -1; } @@ -1274,7 +1274,7 @@ PyErr_Clear(); if (setitemstr == NULL) { setitemstr = - PyBytes_InternFromString("__setitem__"); + PyString_InternFromString("__setitem__"); if (setitemstr == NULL) return -1; } @@ -1311,7 +1311,7 @@ */ if(__contains__ == NULL) { - __contains__ = PyBytes_InternFromString("__contains__"); + __contains__ = PyString_InternFromString("__contains__"); if(__contains__ == NULL) return -1; } @@ -1417,7 +1417,7 @@ } if (coerce_obj == NULL) { - coerce_obj = PyBytes_InternFromString("__coerce__"); + coerce_obj = PyString_InternFromString("__coerce__"); if (coerce_obj == NULL) return NULL; } @@ -1504,7 +1504,7 @@ PyObject *coerced; if (coerce_obj == NULL) { - coerce_obj = PyBytes_InternFromString("__coerce__"); + coerce_obj = PyString_InternFromString("__coerce__"); if (coerce_obj == NULL) return -1; } @@ -1552,7 +1552,7 @@ #define UNARY(funcname, methodname) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyBytes_InternFromString(methodname); \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ if (o == NULL) return NULL; } \ return generic_unary_op(self, o); \ } @@ -1561,7 +1561,7 @@ #define UNARY_FB(funcname, methodname, funcname_fb) \ static PyObject *funcname(PyInstanceObject *self) { \ static PyObject *o; \ - if (o == NULL) { o = PyBytes_InternFromString(methodname); \ + if (o == NULL) { o = PyString_InternFromString(methodname); \ if (o == NULL) return NULL; } \ if (PyObject_HasAttr((PyObject*)self, o)) \ return generic_unary_op(self, o); \ @@ -1630,7 +1630,7 @@ assert(PyInstance_Check(v)); if (cmp_obj == NULL) { - cmp_obj = PyBytes_InternFromString("__cmp__"); + cmp_obj = PyString_InternFromString("__cmp__"); if (cmp_obj == NULL) return -2; } @@ -1738,7 +1738,7 @@ static PyObject *nonzerostr; if (nonzerostr == NULL) { - nonzerostr = PyBytes_InternFromString("__nonzero__"); + nonzerostr = PyString_InternFromString("__nonzero__"); if (nonzerostr == NULL) return -1; } @@ -1747,7 +1747,7 @@ return -1; PyErr_Clear(); if (lenstr == NULL) { - lenstr = PyBytes_InternFromString("__len__"); + lenstr = PyString_InternFromString("__len__"); if (lenstr == NULL) return -1; } @@ -1787,7 +1787,7 @@ static PyObject *indexstr = NULL; if (indexstr == NULL) { - indexstr = PyBytes_InternFromString("__index__"); + indexstr = PyString_InternFromString("__index__"); if (indexstr == NULL) return NULL; } @@ -1814,7 +1814,7 @@ PyObject *truncated; static PyObject *int_name; if (int_name == NULL) { - int_name = PyBytes_InternFromString("__int__"); + int_name = PyString_InternFromString("__int__"); if (int_name == NULL) return NULL; } @@ -1929,7 +1929,7 @@ if (name_op == NULL) return -1; for (i = 0; i < NAME_OPS; ++i) { - name_op[i] = PyBytes_InternFromString(_name_op[i]); + name_op[i] = PyString_InternFromString(_name_op[i]); if (name_op[i] == NULL) return -1; } @@ -2012,12 +2012,12 @@ PyObject *func; if (iterstr == NULL) { - iterstr = PyBytes_InternFromString("__iter__"); + iterstr = PyString_InternFromString("__iter__"); if (iterstr == NULL) return NULL; } if (getitemstr == NULL) { - getitemstr = PyBytes_InternFromString("__getitem__"); + getitemstr = PyString_InternFromString("__getitem__"); if (getitemstr == NULL) return NULL; } @@ -2055,7 +2055,7 @@ PyObject *func; if (nextstr == NULL) { - nextstr = PyBytes_InternFromString("next"); + nextstr = PyString_InternFromString("next"); if (nextstr == NULL) return NULL; } @@ -2087,7 +2087,7 @@ PyErr_Clear(); PyErr_Format(PyExc_AttributeError, "%.200s instance has no __call__ method", - PyBytes_AsString(inst->in_class->cl_name)); + PyString_AsString(inst->in_class->cl_name)); return NULL; } /* We must check and increment the recursion depth here. Scenario: @@ -2261,7 +2261,7 @@ { static PyObject *docstr; if (docstr == NULL) { - docstr= PyBytes_InternFromString("__doc__"); + docstr= PyString_InternFromString("__doc__"); if (docstr == NULL) return NULL; } @@ -2384,12 +2384,12 @@ return NULL; PyErr_Clear(); } - else if (!PyBytes_Check(funcname)) { + else if (!PyString_Check(funcname)) { Py_DECREF(funcname); funcname = NULL; } else - sfuncname = PyBytes_AS_STRING(funcname); + sfuncname = PyString_AS_STRING(funcname); if (klass == NULL) klassname = NULL; else { @@ -2399,28 +2399,28 @@ return NULL; PyErr_Clear(); } - else if (!PyBytes_Check(klassname)) { + else if (!PyString_Check(klassname)) { Py_DECREF(klassname); klassname = NULL; } else - sklassname = PyBytes_AS_STRING(klassname); + sklassname = PyString_AS_STRING(klassname); } if (self == NULL) - result = PyBytes_FromFormat("", + result = PyString_FromFormat("", sklassname, sfuncname); else { /* XXX Shouldn't use repr() here! */ PyObject *selfrepr = PyObject_Repr(self); if (selfrepr == NULL) goto fail; - if (!PyBytes_Check(selfrepr)) { + if (!PyString_Check(selfrepr)) { Py_DECREF(selfrepr); goto fail; } - result = PyBytes_FromFormat("", + result = PyString_FromFormat("", sklassname, sfuncname, - PyBytes_AS_STRING(selfrepr)); + PyString_AS_STRING(selfrepr)); Py_DECREF(selfrepr); } fail: @@ -2472,8 +2472,8 @@ PyErr_Clear(); return; } - if (PyBytes_Check(name)) { - strncpy(buf, PyBytes_AS_STRING(name), bufsize); + if (PyString_Check(name)) { + strncpy(buf, PyString_AS_STRING(name), bufsize); buf[bufsize-1] = '\0'; } Py_DECREF(name); Modified: python/branches/tlee-ast-optimize/Objects/codeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/codeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/codeobject.c Mon Jun 9 12:52:48 2008 @@ -32,10 +32,10 @@ for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { PyObject *v = PyTuple_GET_ITEM(tuple, i); - if (v == NULL || !PyBytes_CheckExact(v)) { + if (v == NULL || !PyString_CheckExact(v)) { Py_FatalError("non-string found in code slot"); } - PyBytes_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); + PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); } } @@ -57,9 +57,9 @@ varnames == NULL || !PyTuple_Check(varnames) || freevars == NULL || !PyTuple_Check(freevars) || cellvars == NULL || !PyTuple_Check(cellvars) || - name == NULL || !PyBytes_Check(name) || - filename == NULL || !PyBytes_Check(filename) || - lnotab == NULL || !PyBytes_Check(lnotab) || + name == NULL || !PyString_Check(name) || + filename == NULL || !PyString_Check(filename) || + lnotab == NULL || !PyString_Check(lnotab) || !PyObject_CheckReadBuffer(code)) { PyErr_BadInternalCall(); return NULL; @@ -71,11 +71,11 @@ /* Intern selected string constants */ for (i = PyTuple_Size(consts); --i >= 0; ) { PyObject *v = PyTuple_GetItem(consts, i); - if (!PyBytes_Check(v)) + if (!PyString_Check(v)) continue; - if (!all_name_chars((unsigned char *)PyBytes_AS_STRING(v))) + if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) continue; - PyBytes_InternInPlace(&PyTuple_GET_ITEM(consts, i)); + PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); } co = PyObject_NEW(PyCodeObject, &PyCode_Type); if (co != NULL) { @@ -145,10 +145,10 @@ for (i = 0; i < len; i++) { item = PyTuple_GET_ITEM(tup, i); - if (PyBytes_CheckExact(item)) { + if (PyString_CheckExact(item)) { Py_INCREF(item); } - else if (!PyBytes_Check(item)) { + else if (!PyString_Check(item)) { PyErr_Format( PyExc_TypeError, "name tuples must contain only " @@ -158,9 +158,9 @@ return NULL; } else { - item = PyBytes_FromStringAndSize( - PyBytes_AS_STRING(item), - PyBytes_GET_SIZE(item)); + item = PyString_FromStringAndSize( + PyString_AS_STRING(item), + PyString_GET_SIZE(item)); if (item == NULL) { Py_DECREF(newtuple); return NULL; @@ -281,14 +281,14 @@ if (co->co_firstlineno != 0) lineno = co->co_firstlineno; - if (co->co_filename && PyBytes_Check(co->co_filename)) - filename = PyBytes_AS_STRING(co->co_filename); - if (co->co_name && PyBytes_Check(co->co_name)) - name = PyBytes_AS_STRING(co->co_name); + if (co->co_filename && PyString_Check(co->co_filename)) + filename = PyString_AS_STRING(co->co_filename); + if (co->co_name && PyString_Check(co->co_name)) + name = PyString_AS_STRING(co->co_name); PyOS_snprintf(buf, sizeof(buf), "", name, co, filename, lineno); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static int @@ -508,8 +508,8 @@ int PyCode_Addr2Line(PyCodeObject *co, int addrq) { - int size = PyBytes_Size(co->co_lnotab) / 2; - unsigned char *p = (unsigned char*)PyBytes_AsString(co->co_lnotab); + int size = PyString_Size(co->co_lnotab) / 2; + unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); int line = co->co_firstlineno; int addr = 0; while (--size >= 0) { @@ -604,8 +604,8 @@ int size, addr, line; unsigned char* p; - p = (unsigned char*)PyBytes_AS_STRING(co->co_lnotab); - size = PyBytes_GET_SIZE(co->co_lnotab) / 2; + p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); + size = PyString_GET_SIZE(co->co_lnotab) / 2; addr = 0; line = co->co_firstlineno; Modified: python/branches/tlee-ast-optimize/Objects/complexobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/complexobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/complexobject.c Mon Jun 9 12:52:48 2008 @@ -303,7 +303,7 @@ cv.imag = 0.; if (complex_str == NULL) { - if (!(complex_str = PyBytes_InternFromString("__complex__"))) + if (!(complex_str = PyString_InternFromString("__complex__"))) return cv; } @@ -421,7 +421,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_REPR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -429,7 +429,7 @@ { char buf[100]; complex_to_buf(buf, sizeof(buf), v, PREC_STR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static long @@ -877,9 +877,9 @@ #endif Py_ssize_t len; - if (PyBytes_Check(v)) { - s = PyBytes_AS_STRING(v); - len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + s = PyString_AS_STRING(v); + len = PyString_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -1065,7 +1065,7 @@ Py_INCREF(r); return r; } - if (PyBytes_Check(r) || PyUnicode_Check(r)) { + if (PyString_Check(r) || PyUnicode_Check(r)) { if (i != NULL) { PyErr_SetString(PyExc_TypeError, "complex() can't take second arg" @@ -1074,7 +1074,7 @@ } return complex_subtype_from_string(type, r); } - if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) { + if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { PyErr_SetString(PyExc_TypeError, "complex() second arg can't be a string"); return NULL; @@ -1082,7 +1082,7 @@ /* XXX Hack to support classes with __complex__ method */ if (complexstr == NULL) { - complexstr = PyBytes_InternFromString("__complex__"); + complexstr = PyString_InternFromString("__complex__"); if (complexstr == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/Objects/descrobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/descrobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/descrobject.c Mon Jun 9 12:52:48 2008 @@ -15,8 +15,8 @@ static char * descr_name(PyDescrObject *descr) { - if (descr->d_name != NULL && PyBytes_Check(descr->d_name)) - return PyBytes_AS_STRING(descr->d_name); + if (descr->d_name != NULL && PyString_Check(descr->d_name)) + return PyString_AS_STRING(descr->d_name); else return "?"; } @@ -24,7 +24,7 @@ static PyObject * descr_repr(PyDescrObject *descr, char *format) { - return PyBytes_FromFormat(format, descr_name(descr), + return PyString_FromFormat(format, descr_name(descr), descr->d_type->tp_name); } @@ -314,7 +314,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_method->ml_doc); + return PyString_FromString(descr->d_method->ml_doc); } static PyMemberDef descr_members[] = { @@ -335,7 +335,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_member->doc); + return PyString_FromString(descr->d_member->doc); } static PyGetSetDef member_getset[] = { @@ -350,7 +350,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_getset->doc); + return PyString_FromString(descr->d_getset->doc); } static PyGetSetDef getset_getset[] = { @@ -365,7 +365,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromString(descr->d_base->doc); + return PyString_FromString(descr->d_base->doc); } static PyGetSetDef wrapperdescr_getset[] = { @@ -576,7 +576,7 @@ if (descr != NULL) { Py_XINCREF(type); descr->d_type = type; - descr->d_name = PyBytes_InternFromString(name); + descr->d_name = PyString_InternFromString(name); if (descr->d_name == NULL) { Py_DECREF(descr); descr = NULL; @@ -922,7 +922,7 @@ static PyObject * wrapper_repr(wrapperobject *wp) { - return PyBytes_FromFormat("", + return PyString_FromFormat("", wp->descr->d_base->name, wp->self->ob_type->tp_name, wp->self); @@ -947,7 +947,7 @@ { char *s = wp->descr->d_base->name; - return PyBytes_FromString(s); + return PyString_FromString(s); } static PyObject * @@ -960,7 +960,7 @@ return Py_None; } else { - return PyBytes_FromString(s); + return PyString_FromString(s); } } Modified: python/branches/tlee-ast-optimize/Objects/dictobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/dictobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/dictobject.c Mon Jun 9 12:52:48 2008 @@ -224,7 +224,7 @@ { register PyDictObject *mp; if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyBytes_FromString(""); + dummy = PyString_FromString(""); if (dummy == NULL) return NULL; #ifdef SHOW_CONVERSION_COUNTS @@ -373,7 +373,7 @@ * this assumption allows testing for errors during PyObject_RichCompareBool() * to be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_RichCompareBool(); we can always - * use _PyBytes_Eq() directly. + * use _PyString_Eq() directly. * * This is valuable because dicts with only string keys are very common. */ @@ -391,7 +391,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyBytes_CheckExact(key)) { + if (!PyString_CheckExact(key)) { #ifdef SHOW_CONVERSION_COUNTS ++converted; #endif @@ -405,7 +405,7 @@ if (ep->me_key == dummy) freeslot = ep; else { - if (ep->me_hash == hash && _PyBytes_Eq(ep->me_key, key)) + if (ep->me_hash == hash && _PyString_Eq(ep->me_key, key)) return ep; freeslot = NULL; } @@ -420,7 +420,7 @@ if (ep->me_key == key || (ep->me_hash == hash && ep->me_key != dummy - && _PyBytes_Eq(ep->me_key, key))) + && _PyString_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; @@ -626,8 +626,8 @@ PyThreadState *tstate; if (!PyDict_Check(op)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) { @@ -680,8 +680,8 @@ assert(key); assert(value); mp = (PyDictObject *)op; - if (PyBytes_CheckExact(key)) { - hash = ((PyBytesObject *)key)->ob_shash; + if (PyString_CheckExact(key)) { + hash = ((PyStringObject *)key)->ob_shash; if (hash == -1) hash = PyObject_Hash(key); } @@ -728,8 +728,8 @@ return -1; } assert(key); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -982,11 +982,11 @@ i = Py_ReprEnter((PyObject *)mp); if (i != 0) { - return i > 0 ? PyBytes_FromString("{...}") : NULL; + return i > 0 ? PyString_FromString("{...}") : NULL; } if (mp->ma_used == 0) { - result = PyBytes_FromString("{}"); + result = PyString_FromString("{}"); goto Done; } @@ -994,7 +994,7 @@ if (pieces == NULL) goto Done; - colon = PyBytes_FromString(": "); + colon = PyString_FromString(": "); if (colon == NULL) goto Done; @@ -1006,8 +1006,8 @@ /* Prevent repr from deleting value during key format. */ Py_INCREF(value); s = PyObject_Repr(key); - PyBytes_Concat(&s, colon); - PyBytes_ConcatAndDel(&s, PyObject_Repr(value)); + PyString_Concat(&s, colon); + PyString_ConcatAndDel(&s, PyObject_Repr(value)); Py_DECREF(value); if (s == NULL) goto Done; @@ -1019,29 +1019,29 @@ /* Add "{}" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyBytes_FromString("{"); + s = PyString_FromString("{"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString("}"); + s = PyString_FromString("}"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: @@ -1064,8 +1064,8 @@ long hash; PyDictEntry *ep; assert(mp->ma_table != NULL); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1081,7 +1081,7 @@ static PyObject *missing_str = NULL; if (missing_str == NULL) missing_str = - PyBytes_InternFromString("__missing__"); + PyString_InternFromString("__missing__"); missing = _PyType_Lookup(Py_TYPE(mp), missing_str); if (missing != NULL) return PyObject_CallFunctionObjArgs(missing, @@ -1794,8 +1794,8 @@ long hash; PyDictEntry *ep; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1827,8 +1827,8 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1856,8 +1856,8 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) return NULL; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -1902,8 +1902,8 @@ "pop(): dictionary is empty"); return NULL; } - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return NULL; @@ -2148,8 +2148,8 @@ PyDictObject *mp = (PyDictObject *)op; PyDictEntry *ep; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -2275,7 +2275,7 @@ PyDict_GetItemString(PyObject *v, const char *key) { PyObject *kv, *rv; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return NULL; rv = PyDict_GetItem(v, kv); @@ -2288,10 +2288,10 @@ { PyObject *kv; int err; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return -1; - PyBytes_InternInPlace(&kv); /* XXX Should we really? */ + PyString_InternInPlace(&kv); /* XXX Should we really? */ err = PyDict_SetItem(v, kv, item); Py_DECREF(kv); return err; @@ -2302,7 +2302,7 @@ { PyObject *kv; int err; - kv = PyBytes_FromString(key); + kv = PyString_FromString(key); if (kv == NULL) return -1; err = PyDict_DelItem(v, kv); Modified: python/branches/tlee-ast-optimize/Objects/exceptions.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/exceptions.c (original) +++ python/branches/tlee-ast-optimize/Objects/exceptions.c Mon Jun 9 12:52:48 2008 @@ -44,7 +44,7 @@ return NULL; } - self->message = PyBytes_FromString(""); + self->message = PyString_FromString(""); if (!self->message) { Py_DECREF(self); return NULL; @@ -104,7 +104,7 @@ switch (PyTuple_GET_SIZE(self->args)) { case 0: - out = PyBytes_FromString(""); + out = PyString_FromString(""); break; case 1: out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0)); @@ -133,13 +133,13 @@ dot = strrchr(name, '.'); if (dot != NULL) name = dot+1; - repr = PyBytes_FromString(name); + repr = PyString_FromString(name); if (!repr) { Py_DECREF(repr_suffix); return NULL; } - PyBytes_ConcatAndDel(&repr, repr_suffix); + PyString_ConcatAndDel(&repr, repr_suffix); return repr; } @@ -610,7 +610,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyBytes_FromString("[Errno %s] %s: %s"); + fmt = PyString_FromString("[Errno %s] %s: %s"); if (!fmt) return NULL; @@ -645,7 +645,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -654,7 +654,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyBytes_FromString("[Errno %s] %s"); + fmt = PyString_FromString("[Errno %s] %s"); if (!fmt) return NULL; @@ -681,7 +681,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -841,7 +841,7 @@ PyObject *repr; PyObject *tuple; - fmt = PyBytes_FromString("[Error %s] %s: %s"); + fmt = PyString_FromString("[Error %s] %s: %s"); if (!fmt) return NULL; @@ -876,7 +876,7 @@ PyTuple_SET_ITEM(tuple, 2, repr); - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -885,7 +885,7 @@ PyObject *fmt; PyObject *tuple; - fmt = PyBytes_FromString("[Error %s] %s"); + fmt = PyString_FromString("[Error %s] %s"); if (!fmt) return NULL; @@ -912,7 +912,7 @@ PyTuple_SET_ITEM(tuple, 1, Py_None); } - rtnval = PyBytes_Format(fmt, tuple); + rtnval = PyString_Format(fmt, tuple); Py_DECREF(fmt); Py_DECREF(tuple); @@ -1109,21 +1109,21 @@ str = PyObject_Str(Py_None); if (!str) return NULL; /* Don't fiddle with non-string return (shouldn't happen anyway) */ - if (!PyBytes_Check(str)) return str; + if (!PyString_Check(str)) return str; /* XXX -- do all the additional formatting with filename and lineno here */ have_filename = (self->filename != NULL) && - PyBytes_Check(self->filename); + PyString_Check(self->filename); have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); if (!have_filename && !have_lineno) return str; - bufsize = PyBytes_GET_SIZE(str) + 64; + bufsize = PyString_GET_SIZE(str) + 64; if (have_filename) - bufsize += PyBytes_GET_SIZE(self->filename); + bufsize += PyString_GET_SIZE(self->filename); buffer = PyMem_MALLOC(bufsize); if (buffer == NULL) @@ -1131,19 +1131,19 @@ if (have_filename && have_lineno) PyOS_snprintf(buffer, bufsize, "%s (%s, line %ld)", - PyBytes_AS_STRING(str), - my_basename(PyBytes_AS_STRING(self->filename)), + PyString_AS_STRING(str), + my_basename(PyString_AS_STRING(self->filename)), PyInt_AsLong(self->lineno)); else if (have_filename) PyOS_snprintf(buffer, bufsize, "%s (%s)", - PyBytes_AS_STRING(str), - my_basename(PyBytes_AS_STRING(self->filename))); + PyString_AS_STRING(str), + my_basename(PyString_AS_STRING(self->filename))); else /* only have_lineno */ PyOS_snprintf(buffer, bufsize, "%s (line %ld)", - PyBytes_AS_STRING(str), + PyString_AS_STRING(str), PyInt_AsLong(self->lineno)); - result = PyBytes_FromString(buffer); + result = PyString_FromString(buffer); PyMem_FREE(buffer); if (result == NULL) @@ -1250,7 +1250,7 @@ return NULL; } - if (!PyBytes_Check(attr)) { + if (!PyString_Check(attr)) { PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); return NULL; } @@ -1262,7 +1262,7 @@ static int set_string(PyObject **attr, const char *value) { - PyObject *obj = PyBytes_FromString(value); + PyObject *obj = PyString_FromString(value); if (!obj) return -1; Py_CLEAR(*attr); @@ -1345,7 +1345,7 @@ "object"); if (!obj) return -1; - size = PyBytes_GET_SIZE(obj); + size = PyString_GET_SIZE(obj); *start = ((PyUnicodeErrorObject *)exc)->start; if (*start<0) *start = 0; @@ -1415,7 +1415,7 @@ if (!obj) return -1; *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyBytes_GET_SIZE(obj); + size = PyString_GET_SIZE(obj); if (*end<1) *end = 1; if (*end>size) @@ -1506,11 +1506,11 @@ Py_CLEAR(self->reason); if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyBytes_Type, &self->encoding, + &PyString_Type, &self->encoding, objecttype, &self->object, &self->start, &self->end, - &PyBytes_Type, &self->reason)) { + &PyString_Type, &self->reason)) { self->encoding = self->object = self->reason = NULL; return -1; } @@ -1590,20 +1590,20 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't encode character u'\\%s' in position %zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), badchar_str, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't encode characters in position %zd-%zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -1642,7 +1642,7 @@ if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) return -1; return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyBytes_Type); + kwds, &PyString_Type); } static PyObject * @@ -1654,21 +1654,21 @@ /* FromFormat does not support %02x, so format that separately */ char byte[4]; PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyBytes_AS_STRING(uself->object)[uself->start])&0xff); - return PyBytes_FromFormat( + ((int)PyString_AS_STRING(uself->object)[uself->start])&0xff); + return PyString_FromFormat( "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), byte, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "'%.400s' codec can't decode bytes in position %zd-%zd: %.400s", - PyBytes_AS_STRING(uself->encoding), + PyString_AS_STRING(uself->encoding), uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -1718,7 +1718,7 @@ &PyUnicode_Type, &self->object, &self->start, &self->end, - &PyBytes_Type, &self->reason)) { + &PyString_Type, &self->reason)) { self->object = self->reason = NULL; return -1; } @@ -1744,18 +1744,18 @@ PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); else PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - return PyBytes_FromFormat( + return PyString_FromFormat( "can't translate character u'\\%s' in position %zd: %.400s", badchar_str, uself->start, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } - return PyBytes_FromFormat( + return PyString_FromFormat( "can't translate characters in position %zd-%zd: %.400s", uself->start, uself->end-1, - PyBytes_AS_STRING(uself->reason) + PyString_AS_STRING(uself->reason) ); } @@ -2111,7 +2111,7 @@ (PyBaseExceptionObject *)PyExc_RecursionErrorInst; PyObject *args_tuple; PyObject *exc_message; - exc_message = PyBytes_FromString("maximum recursion depth exceeded"); + exc_message = PyString_FromString("maximum recursion depth exceeded"); if (!exc_message) Py_FatalError("cannot allocate argument for RuntimeError " "pre-allocation"); Modified: python/branches/tlee-ast-optimize/Objects/fileobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/fileobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/fileobject.c Mon Jun 9 12:52:48 2008 @@ -26,7 +26,7 @@ #include #endif -#define BUF(v) PyBytes_AS_STRING((PyBytesObject *)v) +#define BUF(v) PyString_AS_STRING((PyStringObject *)v) #ifndef DONT_HAVE_ERRNO_H #include @@ -160,7 +160,7 @@ Py_INCREF(name); f->f_name = name; - f->f_mode = PyBytes_FromString(mode); + f->f_mode = PyString_FromString(mode); f->f_close = close; f->f_softspace = 0; @@ -370,7 +370,7 @@ PyFileObject *f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); if (f != NULL) { - PyObject *o_name = PyBytes_FromString(name); + PyObject *o_name = PyString_FromString(name); if (o_name == NULL) return NULL; if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { @@ -525,20 +525,20 @@ #ifdef Py_USING_UNICODE PyObject *ret = NULL; PyObject *name = PyUnicode_AsUnicodeEscapeString(f->f_name); - const char *name_str = name ? PyBytes_AsString(name) : "?"; - ret = PyBytes_FromFormat("<%s file u'%s', mode '%s' at %p>", + const char *name_str = name ? PyString_AsString(name) : "?"; + ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", name_str, - PyBytes_AsString(f->f_mode), + PyString_AsString(f->f_mode), f); Py_XDECREF(name); return ret; #endif } else { - return PyBytes_FromFormat("<%s file '%s', mode '%s' at %p>", + return PyString_FromFormat("<%s file '%s', mode '%s' at %p>", f->f_fp == NULL ? "closed" : "open", - PyBytes_AsString(f->f_name), - PyBytes_AsString(f->f_mode), + PyString_AsString(f->f_name), + PyString_AsString(f->f_mode), f); } } @@ -958,7 +958,7 @@ "requested number of bytes is more than a Python string can hold"); return NULL; } - v = PyBytes_FromStringAndSize((char *)NULL, buffersize); + v = PyString_FromStringAndSize((char *)NULL, buffersize); if (v == NULL) return NULL; bytesread = 0; @@ -989,7 +989,7 @@ } if (bytesrequested < 0) { buffersize = new_buffersize(f, buffersize); - if (_PyBytes_Resize(&v, buffersize) < 0) + if (_PyString_Resize(&v, buffersize) < 0) return NULL; } else { /* Got what was requested. */ @@ -997,7 +997,7 @@ } } if (bytesread != buffersize) - _PyBytes_Resize(&v, bytesread); + _PyString_Resize(&v, bytesread); return v; } @@ -1115,7 +1115,7 @@ size_t increment; /* amount to increment the buffer */ size_t prev_v_size; - /* Optimize for normal case: avoid _PyBytes_Resize if at all + /* Optimize for normal case: avoid _PyString_Resize if at all * possible via first reading into stack buffer "buf". */ total_v_size = INITBUFSIZE; /* start small and pray */ @@ -1133,7 +1133,7 @@ clearerr(fp); if (PyErr_CheckSignals()) return NULL; - v = PyBytes_FromStringAndSize(buf, pvfree - buf); + v = PyString_FromStringAndSize(buf, pvfree - buf); return v; } /* fgets read *something* */ @@ -1162,7 +1162,7 @@ assert(p > pvfree && *(p-1) == '\0'); --p; /* don't include \0 from fgets */ } - v = PyBytes_FromStringAndSize(buf, p - buf); + v = PyString_FromStringAndSize(buf, p - buf); return v; } /* yuck: fgets overwrote all the newlines, i.e. the entire @@ -1183,7 +1183,7 @@ * into its buffer. */ total_v_size = MAXBUFSIZE << 1; - v = PyBytes_FromStringAndSize((char*)NULL, (int)total_v_size); + v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size); if (v == NULL) return v; /* copy over everything except the last null byte */ @@ -1238,13 +1238,13 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, (int)total_v_size) < 0) + if (_PyString_Resize(&v, (int)total_v_size) < 0) return NULL; /* overwrite the trailing null byte */ pvfree = BUF(v) + (prev_v_size - 1); } if (BUF(v) + total_v_size != p) - _PyBytes_Resize(&v, p - BUF(v)); + _PyString_Resize(&v, p - BUF(v)); return v; #undef INITBUFSIZE #undef MAXBUFSIZE @@ -1276,7 +1276,7 @@ return getline_via_fgets(f, fp); #endif total_v_size = n > 0 ? n : 100; - v = PyBytes_FromStringAndSize((char *)NULL, total_v_size); + v = PyString_FromStringAndSize((char *)NULL, total_v_size); if (v == NULL) return NULL; buf = BUF(v); @@ -1349,7 +1349,7 @@ Py_DECREF(v); return NULL; } - if (_PyBytes_Resize(&v, total_v_size) < 0) + if (_PyString_Resize(&v, total_v_size) < 0) return NULL; buf = BUF(v) + used_v_size; end = BUF(v) + total_v_size; @@ -1357,7 +1357,7 @@ used_v_size = buf - BUF(v); if (used_v_size != total_v_size) - _PyBytes_Resize(&v, used_v_size); + _PyString_Resize(&v, used_v_size); return v; } @@ -1402,7 +1402,7 @@ result = PyEval_CallObject(reader, args); Py_DECREF(reader); Py_DECREF(args); - if (result != NULL && !PyBytes_Check(result) && + if (result != NULL && !PyString_Check(result) && !PyUnicode_Check(result)) { Py_DECREF(result); result = NULL; @@ -1411,9 +1411,9 @@ } } - if (n < 0 && result != NULL && PyBytes_Check(result)) { - char *s = PyBytes_AS_STRING(result); - Py_ssize_t len = PyBytes_GET_SIZE(result); + if (n < 0 && result != NULL && PyString_Check(result)) { + char *s = PyString_AS_STRING(result); + Py_ssize_t len = PyString_GET_SIZE(result); if (len == 0) { Py_DECREF(result); result = NULL; @@ -1422,10 +1422,10 @@ } else if (s[len-1] == '\n') { if (result->ob_refcnt == 1) - _PyBytes_Resize(&result, len-1); + _PyString_Resize(&result, len-1); else { PyObject *v; - v = PyBytes_FromStringAndSize(s, len-1); + v = PyString_FromStringAndSize(s, len-1); Py_DECREF(result); result = v; } @@ -1473,7 +1473,7 @@ if (!PyArg_ParseTuple(args, "|i:readline", &n)) return NULL; if (n == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); if (n < 0) n = 0; return get_line(f, n); @@ -1539,18 +1539,18 @@ } if (big_buffer == NULL) { /* Create the big buffer */ - big_buffer = PyBytes_FromStringAndSize( + big_buffer = PyString_FromStringAndSize( NULL, buffersize); if (big_buffer == NULL) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); memcpy(buffer, small_buffer, nfilled); } else { /* Grow the big buffer */ - if ( _PyBytes_Resize(&big_buffer, buffersize) < 0 ) + if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) goto error; - buffer = PyBytes_AS_STRING(big_buffer); + buffer = PyString_AS_STRING(big_buffer); } continue; } @@ -1559,7 +1559,7 @@ do { /* Process complete lines */ p++; - line = PyBytes_FromStringAndSize(q, p-q); + line = PyString_FromStringAndSize(q, p-q); if (line == NULL) goto error; err = PyList_Append(list, line); @@ -1578,7 +1578,7 @@ } if (nfilled != 0) { /* Partial last line */ - line = PyBytes_FromStringAndSize(buffer, nfilled); + line = PyString_FromStringAndSize(buffer, nfilled); if (line == NULL) goto error; if (sizehint > 0) { @@ -1588,7 +1588,7 @@ Py_DECREF(line); goto error; } - PyBytes_Concat(&line, rest); + PyString_Concat(&line, rest); Py_DECREF(rest); if (line == NULL) goto error; @@ -1695,7 +1695,7 @@ could potentially execute Python code. */ for (i = 0; i < j; i++) { PyObject *v = PyList_GET_ITEM(list, i); - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { const char *buffer; if (((f->f_binary && PyObject_AsReadBuffer(v, @@ -1708,7 +1708,7 @@ "writelines() argument must be a sequence of strings"); goto error; } - line = PyBytes_FromStringAndSize(buffer, + line = PyString_FromStringAndSize(buffer, len); if (line == NULL) goto error; @@ -1724,8 +1724,8 @@ errno = 0; for (i = 0; i < j; i++) { line = PyList_GET_ITEM(list, i); - len = PyBytes_GET_SIZE(line); - nwritten = fwrite(PyBytes_AS_STRING(line), + len = PyString_GET_SIZE(line); + nwritten = fwrite(PyString_AS_STRING(line), 1, len, f->f_fp); if (nwritten != len) { FILE_ABORT_ALLOW_THREADS(f) @@ -1921,13 +1921,13 @@ Py_INCREF(Py_None); return Py_None; case NEWLINE_CR: - return PyBytes_FromString("\r"); + return PyString_FromString("\r"); case NEWLINE_LF: - return PyBytes_FromString("\n"); + return PyString_FromString("\n"); case NEWLINE_CR|NEWLINE_LF: return Py_BuildValue("(ss)", "\r", "\n"); case NEWLINE_CRLF: - return PyBytes_FromString("\r\n"); + return PyString_FromString("\r\n"); case NEWLINE_CR|NEWLINE_CRLF: return Py_BuildValue("(ss)", "\r", "\r\n"); case NEWLINE_LF|NEWLINE_CRLF: @@ -2029,10 +2029,10 @@ horrified by the recursive call: maximum recursion depth is limited by logarithmic buffer growth to about 50 even when reading a 1gb line. */ -static PyBytesObject * +static PyStringObject * readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) { - PyBytesObject* s; + PyStringObject* s; char *bufptr; char *buf; Py_ssize_t len; @@ -2043,17 +2043,17 @@ len = f->f_bufend - f->f_bufptr; if (len == 0) - return (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip); + return (PyStringObject *) + PyString_FromStringAndSize(NULL, skip); bufptr = (char *)memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; - s = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, skip+len); + s = (PyStringObject *) + PyString_FromStringAndSize(NULL, skip+len); if (s == NULL) return NULL; - memcpy(PyBytes_AS_STRING(s)+skip, f->f_bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, f->f_bufptr, len); f->f_bufptr = bufptr; if (bufptr == f->f_bufend) drop_readahead(f); @@ -2068,7 +2068,7 @@ PyMem_Free(buf); return NULL; } - memcpy(PyBytes_AS_STRING(s)+skip, bufptr, len); + memcpy(PyString_AS_STRING(s)+skip, bufptr, len); PyMem_Free(buf); } return s; @@ -2080,13 +2080,13 @@ static PyObject * file_iternext(PyFileObject *f) { - PyBytesObject* l; + PyStringObject* l; if (f->f_fp == NULL) return err_closed(); l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); - if (l == NULL || PyBytes_GET_SIZE(l) == 0) { + if (l == NULL || PyString_GET_SIZE(l) == 0) { Py_XDECREF(l); return NULL; } @@ -2103,7 +2103,7 @@ assert(type != NULL && type->tp_alloc != NULL); if (not_yet_string == NULL) { - not_yet_string = PyBytes_InternFromString(""); + not_yet_string = PyString_InternFromString(""); if (not_yet_string == NULL) return NULL; } @@ -2394,7 +2394,7 @@ return 0; } else if (!PyErr_Occurred()) { - PyObject *v = PyBytes_FromString(s); + PyObject *v = PyString_FromString(s); int err; if (v == NULL) return -1; Modified: python/branches/tlee-ast-optimize/Objects/floatobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/floatobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/floatobject.c Mon Jun 9 12:52:48 2008 @@ -182,9 +182,9 @@ if (pend) *pend = NULL; - if (PyBytes_Check(v)) { - s = PyBytes_AS_STRING(v); - len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + s = PyString_AS_STRING(v); + len = PyString_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -485,7 +485,7 @@ char buf[100]; format_float(buf, sizeof(buf), v, PREC_REPR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * @@ -493,7 +493,7 @@ { char buf[100]; format_float(buf, sizeof(buf), v, PREC_STR); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } /* Comparison is pretty much a nightmare. When comparing float to float, @@ -1218,7 +1218,7 @@ return float_subtype_new(type, args, kwds); /* Wimp out */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x)) return NULL; - if (PyBytes_Check(x)) + if (PyString_Check(x)) return PyFloat_FromString(x, NULL); return PyNumber_Float(x); } @@ -1269,13 +1269,13 @@ char* s; float_format_type r; - if (!PyBytes_Check(arg)) { + if (!PyString_Check(arg)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", Py_TYPE(arg)->tp_name); return NULL; } - s = PyBytes_AS_STRING(arg); + s = PyString_AS_STRING(arg); if (strcmp(s, "double") == 0) { r = double_format; } @@ -1291,11 +1291,11 @@ switch (r) { case unknown_format: - return PyBytes_FromString("unknown"); + return PyString_FromString("unknown"); case ieee_little_endian_format: - return PyBytes_FromString("IEEE, little-endian"); + return PyString_FromString("IEEE, little-endian"); case ieee_big_endian_format: - return PyBytes_FromString("IEEE, big-endian"); + return PyString_FromString("IEEE, big-endian"); default: Py_FatalError("insane float_format or double_format"); return NULL; Modified: python/branches/tlee-ast-optimize/Objects/frameobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/frameobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/frameobject.c Mon Jun 9 12:52:48 2008 @@ -114,7 +114,7 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; @@ -137,7 +137,7 @@ } /* We're now ready to look at the bytecode. */ - PyBytes_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); + PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); min_addr = MIN(new_lasti, f->f_lasti); max_addr = MAX(new_lasti, f->f_lasti); @@ -548,7 +548,7 @@ int _PyFrame_Init() { - builtin_object = PyBytes_InternFromString("__builtins__"); + builtin_object = PyString_InternFromString("__builtins__"); return (builtin_object != NULL); } @@ -728,7 +728,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; - assert(PyBytes_Check(key)); + assert(PyString_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); @@ -776,7 +776,7 @@ for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = PyObject_GetItem(dict, key); - assert(PyBytes_Check(key)); + assert(PyString_Check(key)); /* We only care about NULLs if clear is true. */ if (value == NULL) { PyErr_Clear(); Modified: python/branches/tlee-ast-optimize/Objects/funcobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/funcobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/funcobject.c Mon Jun 9 12:52:48 2008 @@ -28,7 +28,7 @@ consts = ((PyCodeObject *)code)->co_consts; if (PyTuple_Size(consts) >= 1) { doc = PyTuple_GetItem(consts, 0); - if (!PyBytes_Check(doc) && !PyUnicode_Check(doc)) + if (!PyString_Check(doc) && !PyUnicode_Check(doc)) doc = Py_None; } else @@ -42,7 +42,7 @@ Otherwise, use None. */ if (!__name__) { - __name__ = PyBytes_InternFromString("__name__"); + __name__ = PyString_InternFromString("__name__"); if (!__name__) { Py_DECREF(op); return NULL; @@ -254,7 +254,7 @@ PyErr_Format(PyExc_ValueError, "%s() requires a code object with %zd free vars," " not %zd", - PyBytes_AsString(op->func_name), + PyString_AsString(op->func_name), nclosure, nfree); return -1; } @@ -281,7 +281,7 @@ return -1; /* Not legal to del f.func_name or to set it to anything * other than a string object. */ - if (value == NULL || !PyBytes_Check(value)) { + if (value == NULL || !PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; @@ -380,7 +380,7 @@ &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; - if (name != Py_None && !PyBytes_Check(name)) { + if (name != Py_None && !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); return NULL; @@ -409,7 +409,7 @@ if (nfree != nclosure) return PyErr_Format(PyExc_ValueError, "%s requires closure of length %zd, not %zd", - PyBytes_AS_STRING(code->co_name), + PyString_AS_STRING(code->co_name), nfree, nclosure); if (nclosure) { Py_ssize_t i; @@ -465,8 +465,8 @@ static PyObject* func_repr(PyFunctionObject *op) { - return PyBytes_FromFormat("", - PyBytes_AsString(op->func_name), + return PyString_FromFormat("", + PyString_AsString(op->func_name), op); } Modified: python/branches/tlee-ast-optimize/Objects/genobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/genobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/genobject.c Mon Jun 9 12:52:48 2008 @@ -285,10 +285,10 @@ gen_repr(PyGenObject *gen) { char *code_name; - code_name = PyBytes_AsString(((PyCodeObject *)gen->gi_code)->co_name); + code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name); if (code_name == NULL) return NULL; - return PyBytes_FromFormat("", + return PyString_FromFormat("", code_name, gen); } Modified: python/branches/tlee-ast-optimize/Objects/intobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/intobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/intobject.c Mon Jun 9 12:52:48 2008 @@ -367,7 +367,7 @@ if (*end != '\0') { bad: slen = strlen(s) < 200 ? strlen(s) : 200; - sobj = PyBytes_FromStringAndSize(s, slen); + sobj = PyString_FromStringAndSize(s, slen); if (sobj == NULL) return NULL; srepr = PyObject_Repr(sobj); @@ -376,7 +376,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -964,11 +964,11 @@ return PyInt_FromLong(0L); if (base == -909) return PyNumber_Int(x); - if (PyBytes_Check(x)) { + if (PyString_Check(x)) { /* Since PyInt_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyBytes_AS_STRING(x); - if (strlen(string) != PyBytes_Size(x)) { + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { /* create a repr() of the input string, * just like PyInt_FromString does */ PyObject *srepr; @@ -977,7 +977,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for int() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } @@ -1105,7 +1105,7 @@ if (negative) *--p = '-'; - return PyBytes_FromStringAndSize(p, &buf[sizeof(buf)] - p); + return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p); } static PyObject * Modified: python/branches/tlee-ast-optimize/Objects/listobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/listobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/listobject.c Mon Jun 9 12:52:48 2008 @@ -174,7 +174,7 @@ } if (i < 0 || i >= Py_SIZE(op)) { if (indexerr == NULL) - indexerr = PyBytes_FromString( + indexerr = PyString_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; @@ -349,11 +349,11 @@ i = Py_ReprEnter((PyObject*)v); if (i != 0) { - return i > 0 ? PyBytes_FromString("[...]") : NULL; + return i > 0 ? PyString_FromString("[...]") : NULL; } if (Py_SIZE(v) == 0) { - result = PyBytes_FromString("[]"); + result = PyString_FromString("[]"); goto Done; } @@ -379,29 +379,29 @@ /* Add "[]" decorations to the first and last items. */ assert(PyList_GET_SIZE(pieces) > 0); - s = PyBytes_FromString("["); + s = PyString_FromString("["); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyList_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString("]"); + s = PyString_FromString("]"); if (s == NULL) goto Done; temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: @@ -433,7 +433,7 @@ { if (i < 0 || i >= Py_SIZE(a)) { if (indexerr == NULL) - indexerr = PyBytes_FromString( + indexerr = PyString_FromString( "list index out of range"); PyErr_SetObject(PyExc_IndexError, indexerr); return NULL; Modified: python/branches/tlee-ast-optimize/Objects/longobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/longobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/longobject.c Mon Jun 9 12:52:48 2008 @@ -1199,7 +1199,7 @@ _PyLong_Format(PyObject *aa, int base, int addL, int newstyle) { register PyLongObject *a = (PyLongObject *)aa; - PyBytesObject *str; + PyStringObject *str; Py_ssize_t i, j, sz; Py_ssize_t size_a; char *p; @@ -1228,10 +1228,10 @@ "long is too large to format"); return NULL; } - str = (PyBytesObject *) PyBytes_FromStringAndSize((char *)0, sz); + str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); if (str == NULL) return NULL; - p = PyBytes_AS_STRING(str) + sz; + p = PyString_AS_STRING(str) + sz; *p = '\0'; if (addL) *--p = 'L'; @@ -1257,7 +1257,7 @@ do { char cdigit = (char)(accum & (base - 1)); cdigit += (cdigit < 10) ? '0' : 'a'-10; - assert(p > PyBytes_AS_STRING(str)); + assert(p > PyString_AS_STRING(str)); *--p = cdigit; accumbits -= basebits; accum >>= basebits; @@ -1309,7 +1309,7 @@ do { digit nextrem = (digit)(rem / base); char c = (char)(rem - nextrem * base); - assert(p > PyBytes_AS_STRING(str)); + assert(p > PyString_AS_STRING(str)); c += (c < 10) ? '0' : 'a'-10; *--p = c; rem = nextrem; @@ -1347,14 +1347,14 @@ } if (sign) *--p = sign; - if (p != PyBytes_AS_STRING(str)) { - char *q = PyBytes_AS_STRING(str); + if (p != PyString_AS_STRING(str)) { + char *q = PyString_AS_STRING(str); assert(p > q); do { } while ((*q++ = *p++) != '\0'); q--; - _PyBytes_Resize((PyObject **)&str, - (Py_ssize_t) (q - PyBytes_AS_STRING(str))); + _PyString_Resize((PyObject **)&str, + (Py_ssize_t) (q - PyString_AS_STRING(str))); } return (PyObject *)str; } @@ -1718,7 +1718,7 @@ onError: Py_XDECREF(z); slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; - strobj = PyBytes_FromStringAndSize(orig_str, slen); + strobj = PyString_FromStringAndSize(orig_str, slen); if (strobj == NULL) return NULL; strrepr = PyObject_Repr(strobj); @@ -1727,7 +1727,7 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyBytes_AS_STRING(strrepr)); + base, PyString_AS_STRING(strrepr)); Py_DECREF(strrepr); return NULL; } @@ -3331,11 +3331,11 @@ return PyLong_FromLong(0L); if (base == -909) return PyNumber_Long(x); - else if (PyBytes_Check(x)) { + else if (PyString_Check(x)) { /* Since PyLong_FromString doesn't have a length parameter, * check here for possible NULs in the string. */ - char *string = PyBytes_AS_STRING(x); - if (strlen(string) != PyBytes_Size(x)) { + char *string = PyString_AS_STRING(x); + if (strlen(string) != PyString_Size(x)) { /* create a repr() of the input string, * just like PyLong_FromString does. */ PyObject *srepr; @@ -3344,11 +3344,11 @@ return NULL; PyErr_Format(PyExc_ValueError, "invalid literal for long() with base %d: %s", - base, PyBytes_AS_STRING(srepr)); + base, PyString_AS_STRING(srepr)); Py_DECREF(srepr); return NULL; } - return PyLong_FromString(PyBytes_AS_STRING(x), NULL, base); + return PyLong_FromString(PyString_AS_STRING(x), NULL, base); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(x)) Modified: python/branches/tlee-ast-optimize/Objects/methodobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/methodobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/methodobject.c Mon Jun 9 12:52:48 2008 @@ -149,7 +149,7 @@ const char *doc = m->m_ml->ml_doc; if (doc != NULL) - return PyBytes_FromString(doc); + return PyString_FromString(doc); Py_INCREF(Py_None); return Py_None; } @@ -157,7 +157,7 @@ static PyObject * meth_get__name__(PyCFunctionObject *m, void *closure) { - return PyBytes_FromString(m->m_ml->ml_name); + return PyString_FromString(m->m_ml->ml_name); } static int @@ -202,9 +202,9 @@ meth_repr(PyCFunctionObject *m) { if (m->m_self == NULL) - return PyBytes_FromFormat("", + return PyString_FromFormat("", m->m_ml->ml_name); - return PyBytes_FromFormat("", + return PyString_FromFormat("", m->m_ml->ml_name, m->m_self->ob_type->tp_name, m->m_self); @@ -333,7 +333,7 @@ i = 0; for (c = chain; c != NULL; c = c->link) { for (ml = c->methods; ml->ml_name != NULL; ml++) { - PyList_SetItem(v, i, PyBytes_FromString(ml->ml_name)); + PyList_SetItem(v, i, PyString_FromString(ml->ml_name)); i++; } } @@ -360,7 +360,7 @@ if (strcmp(name, "__doc__") == 0) { const char *doc = self->ob_type->tp_doc; if (doc != NULL) - return PyBytes_FromString(doc); + return PyString_FromString(doc); } } while (chain != NULL) { Modified: python/branches/tlee-ast-optimize/Objects/moduleobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/moduleobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/moduleobject.c Mon Jun 9 12:52:48 2008 @@ -22,7 +22,7 @@ m = PyObject_GC_New(PyModuleObject, &PyModule_Type); if (m == NULL) return NULL; - nameobj = PyBytes_FromString(name); + nameobj = PyString_FromString(name); m->md_dict = PyDict_New(); if (m->md_dict == NULL || nameobj == NULL) goto fail; @@ -68,12 +68,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (nameobj = PyDict_GetItemString(d, "__name__")) == NULL || - !PyBytes_Check(nameobj)) + !PyString_Check(nameobj)) { PyErr_SetString(PyExc_SystemError, "nameless module"); return NULL; } - return PyBytes_AsString(nameobj); + return PyString_AsString(nameobj); } char * @@ -88,12 +88,12 @@ d = ((PyModuleObject *)m)->md_dict; if (d == NULL || (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || - !PyBytes_Check(fileobj)) + !PyString_Check(fileobj)) { PyErr_SetString(PyExc_SystemError, "module filename missing"); return NULL; } - return PyBytes_AsString(fileobj); + return PyString_AsString(fileobj); } void @@ -117,8 +117,8 @@ /* First, clear only names starting with a single underscore */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyBytes_Check(key)) { - char *s = PyBytes_AsString(key); + if (value != Py_None && PyString_Check(key)) { + char *s = PyString_AsString(key); if (s[0] == '_' && s[1] != '_') { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[1] %s\n", s); @@ -130,8 +130,8 @@ /* Next, clear all names except for __builtins__ */ pos = 0; while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyBytes_Check(key)) { - char *s = PyBytes_AsString(key); + if (value != Py_None && PyString_Check(key)) { + char *s = PyString_AsString(key); if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { if (Py_VerboseFlag > 1) PySys_WriteStderr("# clear[2] %s\n", s); @@ -195,9 +195,9 @@ filename = PyModule_GetFilename((PyObject *)m); if (filename == NULL) { PyErr_Clear(); - return PyBytes_FromFormat("", name); + return PyString_FromFormat("", name); } - return PyBytes_FromFormat("", name, filename); + return PyString_FromFormat("", name, filename); } /* We only need a traverse function, no clear function: If the module Modified: python/branches/tlee-ast-optimize/Objects/object.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/object.c (original) +++ python/branches/tlee-ast-optimize/Objects/object.c Mon Jun 9 12:52:48 2008 @@ -357,9 +357,9 @@ } #endif if (v == NULL) - return PyBytes_FromString(""); + return PyString_FromString(""); else if (Py_TYPE(v)->tp_repr == NULL) - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(v)->tp_name, v); else { PyObject *res; @@ -377,7 +377,7 @@ return NULL; } #endif - if (!PyBytes_Check(res)) { + if (!PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__repr__ returned non-string (type %.200s)", Py_TYPE(res)->tp_name); @@ -394,8 +394,8 @@ PyObject *res; int type_ok; if (v == NULL) - return PyBytes_FromString(""); - if (PyBytes_CheckExact(v)) { + return PyString_FromString(""); + if (PyString_CheckExact(v)) { Py_INCREF(v); return v; } @@ -416,7 +416,7 @@ Py_LeaveRecursiveCall(); if (res == NULL) return NULL; - type_ok = PyBytes_Check(res); + type_ok = PyString_Check(res); #ifdef Py_USING_UNICODE type_ok = type_ok || PyUnicode_Check(res); #endif @@ -447,7 +447,7 @@ return NULL; } #endif - assert(PyBytes_Check(res)); + assert(PyString_Check(res)); return res; } @@ -461,7 +461,7 @@ static PyObject *unicodestr; if (v == NULL) { - res = PyBytes_FromString(""); + res = PyString_FromString(""); if (res == NULL) return NULL; str = PyUnicode_FromEncodedObject(res, NULL, "strict"); @@ -475,7 +475,7 @@ check this before trying the __unicode__ method. */ if (unicodestr == NULL) { - unicodestr= PyBytes_InternFromString("__unicode__"); + unicodestr= PyString_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } @@ -492,7 +492,7 @@ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), PyUnicode_GET_SIZE(v)); } - if (PyBytes_CheckExact(v)) { + if (PyString_CheckExact(v)) { Py_INCREF(v); res = v; } @@ -1084,7 +1084,7 @@ if (Py_TYPE(v)->tp_getattr != NULL) return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); - w = PyBytes_InternFromString(name); + w = PyString_InternFromString(name); if (w == NULL) return NULL; res = PyObject_GetAttr(v, w); @@ -1112,7 +1112,7 @@ if (Py_TYPE(v)->tp_setattr != NULL) return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); - s = PyBytes_InternFromString(name); + s = PyString_InternFromString(name); if (s == NULL) return -1; res = PyObject_SetAttr(v, s, w); @@ -1125,7 +1125,7 @@ { PyTypeObject *tp = Py_TYPE(v); - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_getattro slots expect a string object as name @@ -1147,10 +1147,10 @@ if (tp->tp_getattro != NULL) return (*tp->tp_getattro)(v, name); if (tp->tp_getattr != NULL) - return (*tp->tp_getattr)(v, PyBytes_AS_STRING(name)); + return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); return NULL; } @@ -1172,7 +1172,7 @@ PyTypeObject *tp = Py_TYPE(v); int err; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1194,14 +1194,14 @@ else Py_INCREF(name); - PyBytes_InternInPlace(&name); + PyString_InternInPlace(&name); if (tp->tp_setattro != NULL) { err = (*tp->tp_setattro)(v, name, value); Py_DECREF(name); return err; } if (tp->tp_setattr != NULL) { - err = (*tp->tp_setattr)(v, PyBytes_AS_STRING(name), value); + err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); Py_DECREF(name); return err; } @@ -1212,14 +1212,14 @@ "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); else PyErr_Format(PyExc_TypeError, "'%.100s' object has only read-only attributes " "(%s .%.100s)", tp->tp_name, value==NULL ? "del" : "assign to", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); return -1; } @@ -1271,7 +1271,7 @@ Py_ssize_t dictoffset; PyObject **dictptr; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1386,7 +1386,7 @@ PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1401,7 +1401,7 @@ PyObject **dictptr; int res = -1; - if (!PyBytes_Check(name)){ + if (!PyString_Check(name)){ #ifdef Py_USING_UNICODE /* The Unicode to string conversion is done here because the existing tp_setattro slots expect a string object as name @@ -1469,13 +1469,13 @@ if (descr == NULL) { PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); goto done; } PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", - tp->tp_name, PyBytes_AS_STRING(name)); + tp->tp_name, PyString_AS_STRING(name)); done: Py_DECREF(name); return res; @@ -1682,7 +1682,7 @@ int i; for (i = 0; i < PyList_GET_SIZE(list); ++i) { PyObject *item = PyList_GET_ITEM(list, i); - if (PyBytes_Check(item)) { + if (PyString_Check(item)) { result = PyDict_SetItem(dict, item, Py_None); if (result < 0) break; @@ -1904,7 +1904,7 @@ static PyObject * none_repr(PyObject *op) { - return PyBytes_FromString("None"); + return PyString_FromString("None"); } /* ARGUSED */ @@ -1946,7 +1946,7 @@ static PyObject * NotImplemented_repr(PyObject *op) { - return PyBytes_FromString("NotImplemented"); + return PyString_FromString("NotImplemented"); } static PyTypeObject PyNotImplemented_Type = { @@ -1983,7 +1983,7 @@ if (PyType_Ready(&PyBool_Type) < 0) Py_FatalError("Can't initialize 'bool'"); - if (PyType_Ready(&PyBytes_Type) < 0) + if (PyType_Ready(&PyString_Type) < 0) Py_FatalError("Can't initialize 'str'"); if (PyType_Ready(&PyByteArray_Type) < 0) Modified: python/branches/tlee-ast-optimize/Objects/rangeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/rangeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/rangeobject.c Mon Jun 9 12:52:48 2008 @@ -113,16 +113,16 @@ PyObject *rtn; if (r->start == 0 && r->step == 1) - rtn = PyBytes_FromFormat("xrange(%ld)", + rtn = PyString_FromFormat("xrange(%ld)", r->start + r->len * r->step); else if (r->step == 1) - rtn = PyBytes_FromFormat("xrange(%ld, %ld)", + rtn = PyString_FromFormat("xrange(%ld, %ld)", r->start, r->start + r->len * r->step); else - rtn = PyBytes_FromFormat("xrange(%ld, %ld, %ld)", + rtn = PyString_FromFormat("xrange(%ld, %ld, %ld)", r->start, r->start + r->len * r->step, r->step); Modified: python/branches/tlee-ast-optimize/Objects/setobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/setobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/setobject.c Mon Jun 9 12:52:48 2008 @@ -151,7 +151,7 @@ /* * Hacked up version of set_lookkey which can assume keys are always strings; - * This means we can always use _PyBytes_Eq directly and not have to check to + * This means we can always use _PyString_Eq directly and not have to check to * see if the comparison altered the table. */ static setentry * @@ -168,7 +168,7 @@ including subclasses of str; e.g., one reason to subclass strings is to override __eq__, and for speed we don't cater to that here. */ - if (!PyBytes_CheckExact(key)) { + if (!PyString_CheckExact(key)) { so->lookup = set_lookkey; return set_lookkey(so, key, hash); } @@ -179,7 +179,7 @@ if (entry->key == dummy) freeslot = entry; else { - if (entry->hash == hash && _PyBytes_Eq(entry->key, key)) + if (entry->hash == hash && _PyString_Eq(entry->key, key)) return entry; freeslot = NULL; } @@ -194,7 +194,7 @@ if (entry->key == key || (entry->hash == hash && entry->key != dummy - && _PyBytes_Eq(entry->key, key))) + && _PyString_Eq(entry->key, key))) return entry; if (entry->key == dummy && freeslot == NULL) freeslot = entry; @@ -381,8 +381,8 @@ register long hash; register Py_ssize_t n_used; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -428,8 +428,8 @@ PyObject *old_key; assert (PyAnySet_Check(so)); - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -618,7 +618,7 @@ if (status != 0) { if (status < 0) return NULL; - return PyBytes_FromFormat("%s(...)", so->ob_type->tp_name); + return PyString_FromFormat("%s(...)", so->ob_type->tp_name); } keys = PySequence_List((PyObject *)so); @@ -629,8 +629,8 @@ if (listrepr == NULL) goto done; - result = PyBytes_FromFormat("%s(%s)", so->ob_type->tp_name, - PyBytes_AS_STRING(listrepr)); + result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, + PyString_AS_STRING(listrepr)); Py_DECREF(listrepr); done: Py_ReprLeave((PyObject*)so); @@ -685,8 +685,8 @@ long hash; setentry *entry; - if (!PyBytes_CheckExact(key) || - (hash = ((PyBytesObject *) key)->ob_shash) == -1) { + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { hash = PyObject_Hash(key); if (hash == -1) return -1; @@ -967,15 +967,20 @@ } static PyObject * -set_update(PySetObject *so, PyObject *other) +set_update(PySetObject *so, PyObject *args) { - if (set_update_internal(so, other) == -1) - return NULL; + Py_ssize_t i; + + for (i=0 ; i"); + dummy = PyString_FromString(""); if (dummy == NULL) return NULL; } @@ -1156,35 +1161,53 @@ PyDoc_STRVAR(clear_doc, "Remove all elements from this set."); static PyObject * -set_union(PySetObject *so, PyObject *other) +set_union(PySetObject *so, PyObject *args) { PySetObject *result; + PyObject *other; + Py_ssize_t i; result = (PySetObject *)set_copy(so); if (result == NULL) return NULL; - if ((PyObject *)so == other) - return (PyObject *)result; - if (set_update_internal(result, other) == -1) { - Py_DECREF(result); - return NULL; + + for (i=0 ; istart)); - PyBytes_Concat(&s, comma); - PyBytes_ConcatAndDel(&s, PyObject_Repr(r->stop)); - PyBytes_Concat(&s, comma); - PyBytes_ConcatAndDel(&s, PyObject_Repr(r->step)); - PyBytes_ConcatAndDel(&s, PyBytes_FromString(")")); + s = PyString_FromString("slice("); + comma = PyString_FromString(", "); + PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); + PyString_Concat(&s, comma); + PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); + PyString_Concat(&s, comma); + PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); + PyString_ConcatAndDel(&s, PyString_FromString(")")); Py_DECREF(comma); return s; } Modified: python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h (original) +++ python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h Mon Jun 9 12:52:48 2008 @@ -496,7 +496,7 @@ #if PY_VERSION_HEX >= 0x03000000 assert(PyUnicode_Check(result)); #else - assert(PyBytes_Check(result) || PyUnicode_Check(result)); + assert(PyString_Check(result) || PyUnicode_Check(result)); /* Convert result to our type. We could be str, and result could be unicode */ Modified: python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h ============================================================================== --- python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h (original) +++ python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h Mon Jun 9 12:52:48 2008 @@ -6,7 +6,7 @@ compiled as unicode. */ #define STRINGLIB_IS_UNICODE 0 -#define STRINGLIB_OBJECT PyBytesObject +#define STRINGLIB_OBJECT PyStringObject #define STRINGLIB_CHAR char #define STRINGLIB_TYPE_NAME "string" #define STRINGLIB_PARSE_CODE "S" @@ -16,13 +16,13 @@ #define STRINGLIB_TOUPPER toupper #define STRINGLIB_TOLOWER tolower #define STRINGLIB_FILL memset -#define STRINGLIB_STR PyBytes_AS_STRING -#define STRINGLIB_LEN PyBytes_GET_SIZE -#define STRINGLIB_NEW PyBytes_FromStringAndSize -#define STRINGLIB_RESIZE _PyBytes_Resize -#define STRINGLIB_CHECK PyBytes_Check +#define STRINGLIB_STR PyString_AS_STRING +#define STRINGLIB_LEN PyString_GET_SIZE +#define STRINGLIB_NEW PyString_FromStringAndSize +#define STRINGLIB_RESIZE _PyString_Resize +#define STRINGLIB_CHECK PyString_Check #define STRINGLIB_CMP memcmp #define STRINGLIB_TOSTR PyObject_Str -#define STRINGLIB_GROUPING _PyBytes_InsertThousandsGrouping +#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping #endif /* !STRINGLIB_STRINGDEFS_H */ Modified: python/branches/tlee-ast-optimize/Objects/structseq.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/structseq.c (original) +++ python/branches/tlee-ast-optimize/Objects/structseq.c Mon Jun 9 12:52:48 2008 @@ -270,7 +270,7 @@ Py_DECREF(tup); return NULL; } - crepr = PyBytes_AsString(repr); + crepr = PyString_AsString(repr); if (crepr == NULL) { Py_DECREF(tup); Py_DECREF(repr); @@ -306,7 +306,7 @@ *pbuf++ = ')'; *pbuf = '\0'; - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static PyObject * Modified: python/branches/tlee-ast-optimize/Objects/tupleobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/tupleobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/tupleobject.c Mon Jun 9 12:52:48 2008 @@ -218,7 +218,7 @@ n = Py_SIZE(v); if (n == 0) - return PyBytes_FromString("()"); + return PyString_FromString("()"); /* While not mutable, it is still possible to end up with a cycle in a tuple through an object that stores itself within a tuple (and thus @@ -226,7 +226,7 @@ possible within a type. */ i = Py_ReprEnter((PyObject *)v); if (i != 0) { - return i > 0 ? PyBytes_FromString("(...)") : NULL; + return i > 0 ? PyString_FromString("(...)") : NULL; } pieces = PyTuple_New(n); @@ -246,29 +246,29 @@ /* Add "()" decorations to the first and last items. */ assert(n > 0); - s = PyBytes_FromString("("); + s = PyString_FromString("("); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, 0); - PyBytes_ConcatAndDel(&s, temp); + PyString_ConcatAndDel(&s, temp); PyTuple_SET_ITEM(pieces, 0, s); if (s == NULL) goto Done; - s = PyBytes_FromString(n == 1 ? ",)" : ")"); + s = PyString_FromString(n == 1 ? ",)" : ")"); if (s == NULL) goto Done; temp = PyTuple_GET_ITEM(pieces, n-1); - PyBytes_ConcatAndDel(&temp, s); + PyString_ConcatAndDel(&temp, s); PyTuple_SET_ITEM(pieces, n-1, temp); if (temp == NULL) goto Done; /* Paste them all together with ", " between. */ - s = PyBytes_FromString(", "); + s = PyString_FromString(", "); if (s == NULL) goto Done; - result = _PyBytes_Join(s, pieces); + result = _PyString_Join(s, pieces); Py_DECREF(s); Done: Modified: python/branches/tlee-ast-optimize/Objects/typeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/typeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/typeobject.c Mon Jun 9 12:52:48 2008 @@ -19,10 +19,10 @@ >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) #define MCACHE_HASH_METHOD(type, name) \ MCACHE_HASH((type)->tp_version_tag, \ - ((PyBytesObject *)(name))->ob_shash) + ((PyStringObject *)(name))->ob_shash) #define MCACHE_CACHEABLE_NAME(name) \ - PyBytes_CheckExact(name) && \ - PyBytes_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE + PyString_CheckExact(name) && \ + PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE struct method_cache_entry { unsigned int version; @@ -217,7 +217,7 @@ s = type->tp_name; else s++; - return PyBytes_FromString(s); + return PyString_FromString(s); } } @@ -236,14 +236,14 @@ "can't delete %s.__name__", type->tp_name); return -1; } - if (!PyBytes_Check(value)) { + if (!PyString_Check(value)) { PyErr_Format(PyExc_TypeError, "can only assign string to %s.__name__, not '%s'", type->tp_name, Py_TYPE(value)->tp_name); return -1; } - if (strlen(PyBytes_AS_STRING(value)) - != (size_t)PyBytes_GET_SIZE(value)) { + if (strlen(PyString_AS_STRING(value)) + != (size_t)PyString_GET_SIZE(value)) { PyErr_Format(PyExc_ValueError, "__name__ must not contain null bytes"); return -1; @@ -256,7 +256,7 @@ Py_DECREF(et->ht_name); et->ht_name = value; - type->tp_name = PyBytes_AS_STRING(value); + type->tp_name = PyString_AS_STRING(value); return 0; } @@ -279,9 +279,9 @@ else { s = strrchr(type->tp_name, '.'); if (s != NULL) - return PyBytes_FromStringAndSize( + return PyString_FromStringAndSize( type->tp_name, (Py_ssize_t)(s - type->tp_name)); - return PyBytes_FromString("__builtin__"); + return PyString_FromString("__builtin__"); } } @@ -555,7 +555,7 @@ { PyObject *result; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) - return PyBytes_FromString(type->tp_doc); + return PyString_FromString(type->tp_doc); result = PyDict_GetItemString(type->tp_dict, "__doc__"); if (result == NULL) { result = Py_None; @@ -644,7 +644,7 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyBytes_Check(mod)) { + else if (!PyString_Check(mod)) { Py_DECREF(mod); mod = NULL; } @@ -657,14 +657,14 @@ else kind = "type"; - if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) { - rtn = PyBytes_FromFormat("<%s '%s.%s'>", + if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) { + rtn = PyString_FromFormat("<%s '%s.%s'>", kind, - PyBytes_AS_STRING(mod), - PyBytes_AS_STRING(name)); + PyString_AS_STRING(mod), + PyString_AS_STRING(name)); } else - rtn = PyBytes_FromFormat("<%s '%s'>", kind, type->tp_name); + rtn = PyString_FromFormat("<%s '%s'>", kind, type->tp_name); Py_XDECREF(mod); Py_DECREF(name); @@ -1136,7 +1136,7 @@ PyObject *res; if (*attrobj == NULL) { - *attrobj = PyBytes_InternFromString(attrstr); + *attrobj = PyString_InternFromString(attrstr); if (*attrobj == NULL) return NULL; } @@ -1328,7 +1328,7 @@ } if (name == NULL) return NULL; - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { Py_DECREF(name); return NULL; } @@ -1350,7 +1350,7 @@ o = class_name(o); PyErr_Format(PyExc_TypeError, "duplicate base class %s", - o ? PyBytes_AS_STRING(o) : "?"); + o ? PyString_AS_STRING(o) : "?"); Py_XDECREF(o); return -1; } @@ -1396,7 +1396,7 @@ while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { PyObject *name = class_name(k); off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", - name ? PyBytes_AS_STRING(name) : "?"); + name ? PyString_AS_STRING(name) : "?"); Py_XDECREF(name); if (--n && (size_t)(off+1) < sizeof(buf)) { buf[off++] = ','; @@ -1749,7 +1749,7 @@ PyObject *descr; if (dict_str == NULL) { - dict_str = PyBytes_InternFromString("__dict__"); + dict_str = PyString_InternFromString("__dict__"); if (dict_str == NULL) return NULL; } @@ -1898,14 +1898,14 @@ unsigned char *p; Py_ssize_t i, n; - if (!PyBytes_Check(s)) { + if (!PyString_Check(s)) { PyErr_Format(PyExc_TypeError, "__slots__ items must be strings, not '%.200s'", Py_TYPE(s)->tp_name); return 0; } - p = (unsigned char *) PyBytes_AS_STRING(s); - n = PyBytes_GET_SIZE(s); + p = (unsigned char *) PyString_AS_STRING(s); + n = PyString_GET_SIZE(s); /* We must reject an empty name. As a hack, we bump the length to 1 so that the loop will balk on the trailing \0. */ if (n == 0) @@ -2107,7 +2107,7 @@ /* Have slots */ /* Make it into a tuple */ - if (PyBytes_Check(slots) || PyUnicode_Check(slots)) + if (PyString_Check(slots) || PyUnicode_Check(slots)) slots = PyTuple_Pack(1, slots); else slots = PySequence_Tuple(slots); @@ -2145,8 +2145,8 @@ char *s; if (!valid_identifier(tmp)) goto bad_slots; - assert(PyBytes_Check(tmp)); - s = PyBytes_AS_STRING(tmp); + assert(PyString_Check(tmp)); + s = PyString_AS_STRING(tmp); if (strcmp(s, "__dict__") == 0) { if (!may_add_dict || add_dict) { PyErr_SetString(PyExc_TypeError, @@ -2178,7 +2178,7 @@ for (i = j = 0; i < nslots; i++) { char *s; tmp = PyTuple_GET_ITEM(slots, i); - s = PyBytes_AS_STRING(tmp); + s = PyString_AS_STRING(tmp); if ((add_dict && strcmp(s, "__dict__") == 0) || (add_weak && strcmp(s, "__weakref__") == 0)) continue; @@ -2271,7 +2271,7 @@ type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; - type->tp_name = PyBytes_AS_STRING(name); + type->tp_name = PyString_AS_STRING(name); /* Set tp_base and tp_bases */ type->tp_bases = bases; @@ -2304,14 +2304,14 @@ */ { PyObject *doc = PyDict_GetItemString(dict, "__doc__"); - if (doc != NULL && PyBytes_Check(doc)) { - const size_t n = (size_t)PyBytes_GET_SIZE(doc); + if (doc != NULL && PyString_Check(doc)) { + const size_t n = (size_t)PyString_GET_SIZE(doc); char *tp_doc = (char *)PyObject_MALLOC(n+1); if (tp_doc == NULL) { Py_DECREF(type); return NULL; } - memcpy(tp_doc, PyBytes_AS_STRING(doc), n+1); + memcpy(tp_doc, PyString_AS_STRING(doc), n+1); type->tp_doc = tp_doc; } } @@ -2334,7 +2334,7 @@ slotoffset = base->tp_basicsize; if (slots != NULL) { for (i = 0; i < nslots; i++, mp++) { - mp->name = PyBytes_AS_STRING( + mp->name = PyString_AS_STRING( PyTuple_GET_ITEM(slots, i)); mp->type = T_OBJECT_EX; mp->offset = slotoffset; @@ -2535,7 +2535,7 @@ /* Give up */ PyErr_Format(PyExc_AttributeError, "type object '%.50s' has no attribute '%.400s'", - type->tp_name, PyBytes_AS_STRING(name)); + type->tp_name, PyString_AS_STRING(name)); return NULL; } @@ -2854,7 +2854,7 @@ if (sorted_methods == NULL) goto error; if (comma == NULL) { - comma = PyBytes_InternFromString(", "); + comma = PyString_InternFromString(", "); if (comma == NULL) goto error; } @@ -2862,7 +2862,7 @@ "O", sorted_methods); if (joined == NULL) goto error; - joined_str = PyBytes_AsString(joined); + joined_str = PyString_AsString(joined); if (joined_str == NULL) goto error; @@ -2896,20 +2896,20 @@ mod = type_module(type, NULL); if (mod == NULL) PyErr_Clear(); - else if (!PyBytes_Check(mod)) { + else if (!PyString_Check(mod)) { Py_DECREF(mod); mod = NULL; } name = type_name(type, NULL); if (name == NULL) return NULL; - if (mod != NULL && strcmp(PyBytes_AS_STRING(mod), "__builtin__")) - rtn = PyBytes_FromFormat("<%s.%s object at %p>", - PyBytes_AS_STRING(mod), - PyBytes_AS_STRING(name), + if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) + rtn = PyString_FromFormat("<%s.%s object at %p>", + PyString_AS_STRING(mod), + PyString_AS_STRING(name), self); else - rtn = PyBytes_FromFormat("<%s object at %p>", + rtn = PyString_FromFormat("<%s object at %p>", type->tp_name, self); Py_XDECREF(mod); Py_DECREF(name); @@ -3069,7 +3069,7 @@ static PyObject *copyreg_str; if (!copyreg_str) { - copyreg_str = PyBytes_InternFromString("copy_reg"); + copyreg_str = PyString_InternFromString("copy_reg"); if (copyreg_str == NULL) return NULL; } @@ -3375,7 +3375,7 @@ return NULL; if (PyUnicode_Check(format_spec)) { self_as_str = PyObject_Unicode(self); - } else if (PyBytes_Check(format_spec)) { + } else if (PyString_Check(format_spec)) { self_as_str = PyObject_Str(self); } else { PyErr_SetString(PyExc_TypeError, "argument to __format__ must be unicode or str"); @@ -3634,7 +3634,7 @@ type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; else if (PyType_IsSubtype(base, &PyLong_Type)) type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; - else if (PyType_IsSubtype(base, &PyBytes_Type)) + else if (PyType_IsSubtype(base, &PyString_Type)) type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; #ifdef Py_USING_UNICODE else if (PyType_IsSubtype(base, &PyUnicode_Type)) @@ -3973,7 +3973,7 @@ */ if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { if (type->tp_doc != NULL) { - PyObject *doc = PyBytes_FromString(type->tp_doc); + PyObject *doc = PyString_FromString(type->tp_doc); if (doc == NULL) goto error; PyDict_SetItemString(type->tp_dict, "__doc__", doc); @@ -4861,7 +4861,7 @@ descrgetfunc f; if (getitem_str == NULL) { - getitem_str = PyBytes_InternFromString("__getitem__"); + getitem_str = PyString_InternFromString("__getitem__"); if (getitem_str == NULL) return NULL; } @@ -5229,7 +5229,7 @@ return res; } PyErr_Clear(); - return PyBytes_FromFormat("<%s object at %p>", + return PyString_FromFormat("<%s object at %p>", Py_TYPE(self)->tp_name, self); } @@ -5337,13 +5337,13 @@ static PyObject *getattr_str = NULL; if (getattr_str == NULL) { - getattr_str = PyBytes_InternFromString("__getattr__"); + getattr_str = PyString_InternFromString("__getattr__"); if (getattr_str == NULL) return NULL; } if (getattribute_str == NULL) { getattribute_str = - PyBytes_InternFromString("__getattribute__"); + PyString_InternFromString("__getattribute__"); if (getattribute_str == NULL) return NULL; } @@ -5484,7 +5484,7 @@ static PyObject *get_str = NULL; if (get_str == NULL) { - get_str = PyBytes_InternFromString("__get__"); + get_str = PyString_InternFromString("__get__"); if (get_str == NULL) return NULL; } @@ -5554,7 +5554,7 @@ Py_ssize_t i, n; if (new_str == NULL) { - new_str = PyBytes_InternFromString("__new__"); + new_str = PyString_InternFromString("__new__"); if (new_str == NULL) return NULL; } @@ -6084,7 +6084,7 @@ if (initialized) return; for (p = slotdefs; p->name; p++) { - p->name_strobj = PyBytes_InternFromString(p->name); + p->name_strobj = PyString_InternFromString(p->name); if (!p->name_strobj) Py_FatalError("Out of memory interning slotdef names"); } @@ -6299,12 +6299,12 @@ superobject *su = (superobject *)self; if (su->obj_type) - return PyBytes_FromFormat( + return PyString_FromFormat( ", <%s object>>", su->type ? su->type->tp_name : "NULL", su->obj_type->tp_name); else - return PyBytes_FromFormat( + return PyString_FromFormat( ", NULL>", su->type ? su->type->tp_name : "NULL"); } @@ -6318,9 +6318,9 @@ if (!skip) { /* We want __class__ to return the class of the super object (i.e. super, or a subclass), not the class of su->obj. */ - skip = (PyBytes_Check(name) && - PyBytes_GET_SIZE(name) == 9 && - strcmp(PyBytes_AS_STRING(name), "__class__") == 0); + skip = (PyString_Check(name) && + PyString_GET_SIZE(name) == 9 && + strcmp(PyString_AS_STRING(name), "__class__") == 0); } if (!skip) { @@ -6412,7 +6412,7 @@ PyObject *class_attr; if (class_str == NULL) { - class_str = PyBytes_FromString("__class__"); + class_str = PyString_FromString("__class__"); if (class_str == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/Objects/unicodeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/unicodeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/unicodeobject.c Mon Jun 9 12:52:48 2008 @@ -1078,9 +1078,9 @@ #endif /* Coerce object */ - if (PyBytes_Check(obj)) { - s = PyBytes_AS_STRING(obj); - len = PyBytes_GET_SIZE(obj); + if (PyString_Check(obj)) { + s = PyString_AS_STRING(obj); + len = PyString_GET_SIZE(obj); } else if (PyByteArray_Check(obj)) { /* Python 2.x specific */ @@ -1252,7 +1252,7 @@ v = PyCodec_Encode(unicode, encoding, errors); if (v == NULL) goto onError; - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -1652,13 +1652,13 @@ char * start; if (size == 0) - return PyBytes_FromStringAndSize(NULL, 0); + return PyString_FromStringAndSize(NULL, 0); - v = PyBytes_FromStringAndSize(NULL, cbAllocated); + v = PyString_FromStringAndSize(NULL, cbAllocated); if (v == NULL) return NULL; - start = out = PyBytes_AS_STRING(v); + start = out = PyString_AS_STRING(v); for (;i < size; ++i) { Py_UNICODE ch = s[i]; @@ -1724,7 +1724,7 @@ *out++ = '-'; } - _PyBytes_Resize(&v, out - start); + _PyString_Resize(&v, out - start); return v; } @@ -1989,10 +1989,10 @@ nallocated = size * 4; if (nallocated / 4 != size) /* overflow! */ return PyErr_NoMemory(); - v = PyBytes_FromStringAndSize(NULL, nallocated); + v = PyString_FromStringAndSize(NULL, nallocated); if (v == NULL) return NULL; - p = PyBytes_AS_STRING(v); + p = PyString_AS_STRING(v); } for (i = 0; i < size;) { @@ -2040,13 +2040,13 @@ /* This was stack allocated. */ nneeded = p - stackbuf; assert(nneeded <= nallocated); - v = PyBytes_FromStringAndSize(stackbuf, nneeded); + v = PyString_FromStringAndSize(stackbuf, nneeded); } else { /* Cut back to size actually needed. */ - nneeded = p - PyBytes_AS_STRING(v); + nneeded = p - PyString_AS_STRING(v); assert(nneeded <= nallocated); - _PyBytes_Resize(&v, nneeded); + _PyString_Resize(&v, nneeded); } return v; @@ -2274,12 +2274,12 @@ 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) pairs++; #endif - v = PyBytes_FromStringAndSize(NULL, + v = PyString_FromStringAndSize(NULL, 4 * (size - pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyBytes_AS_STRING(v); + p = (unsigned char *)PyString_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2539,12 +2539,12 @@ if (s[i] >= 0x10000) pairs++; #endif - v = PyBytes_FromStringAndSize(NULL, + v = PyString_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); if (v == NULL) return NULL; - p = (unsigned char *)PyBytes_AS_STRING(v); + p = (unsigned char *)PyString_AS_STRING(v); if (byteorder == 0) STORECHAR(0xFEFF); if (size == 0) @@ -2887,7 +2887,7 @@ escape. */ - repr = PyBytes_FromStringAndSize(NULL, + repr = PyString_FromStringAndSize(NULL, 2 #ifdef Py_UNICODE_WIDE + 10*size @@ -2898,7 +2898,7 @@ if (repr == NULL) return NULL; - p = PyBytes_AS_STRING(repr); + p = PyString_AS_STRING(repr); if (quotes) { *p++ = 'u'; @@ -2910,7 +2910,7 @@ /* Escape quotes and backslashes */ if ((quotes && - ch == (Py_UNICODE) PyBytes_AS_STRING(repr)[1]) || ch == '\\') { + ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { *p++ = '\\'; *p++ = (char) ch; continue; @@ -2996,10 +2996,10 @@ *p++ = (char) ch; } if (quotes) - *p++ = PyBytes_AS_STRING(repr)[1]; + *p++ = PyString_AS_STRING(repr)[1]; *p = '\0'; - _PyBytes_Resize(&repr, p - PyBytes_AS_STRING(repr)); + _PyString_Resize(&repr, p - PyString_AS_STRING(repr)); return repr; } @@ -3148,16 +3148,16 @@ static const char *hexdigit = "0123456789abcdef"; #ifdef Py_UNICODE_WIDE - repr = PyBytes_FromStringAndSize(NULL, 10 * size); + repr = PyString_FromStringAndSize(NULL, 10 * size); #else - repr = PyBytes_FromStringAndSize(NULL, 6 * size); + repr = PyString_FromStringAndSize(NULL, 6 * size); #endif if (repr == NULL) return NULL; if (size == 0) return repr; - p = q = PyBytes_AS_STRING(repr); + p = q = PyString_AS_STRING(repr); while (size-- > 0) { Py_UNICODE ch = *s++; #ifdef Py_UNICODE_WIDE @@ -3216,7 +3216,7 @@ *p++ = (char) ch; } *p = '\0'; - _PyBytes_Resize(&repr, p - q); + _PyString_Resize(&repr, p - q); return repr; } @@ -3456,12 +3456,12 @@ /* allocate enough for a simple encoding without replacements, if we need more, we'll resize */ - res = PyBytes_FromStringAndSize(NULL, size); + res = PyString_FromStringAndSize(NULL, size); if (res == NULL) goto onError; if (size == 0) return res; - str = PyBytes_AS_STRING(res); + str = PyString_AS_STRING(res); ressize = size; while (p ressize) { if (requiredsize<2*ressize) requiredsize = 2*ressize; - if (_PyBytes_Resize(&res, requiredsize)) + if (_PyString_Resize(&res, requiredsize)) goto onError; - str = PyBytes_AS_STRING(res) + respos; + str = PyString_AS_STRING(res) + respos; ressize = requiredsize; } /* generate replacement (temporarily (mis)uses p) */ @@ -3558,17 +3558,17 @@ /* 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); + respos = str-PyString_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)) { + if (_PyString_Resize(&res, requiredsize)) { Py_DECREF(repunicode); goto onError; } - str = PyBytes_AS_STRING(res) + respos; + str = PyString_AS_STRING(res) + respos; ressize = requiredsize; } /* check if there is anything unencodable in the replacement @@ -3589,10 +3589,10 @@ } } /* Resize if we allocated to much */ - respos = str-PyBytes_AS_STRING(res); + respos = str-PyString_AS_STRING(res); if (respos 0) { - char *s = PyBytes_AS_STRING(*repr) + n; + char *s = PyString_AS_STRING(*repr) + n; if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { PyErr_SetFromWindowsErrWithFilename(0, NULL); return -1; @@ -4327,7 +4327,7 @@ } return x; } - else if (PyBytes_Check(x)) + else if (PyString_Check(x)) return x; else { /* wrong return value */ @@ -4341,11 +4341,11 @@ static int charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) { - Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); + Py_ssize_t outsize = PyString_GET_SIZE(*outobj); /* exponentially overallocate to minimize reallocations */ if (requiredsize < 2*outsize) requiredsize = 2*outsize; - if (_PyBytes_Resize(outobj, requiredsize)) { + if (_PyString_Resize(outobj, requiredsize)) { return 0; } return 1; @@ -4366,7 +4366,7 @@ { PyObject *rep; char *outstart; - Py_ssize_t outsize = PyBytes_GET_SIZE(*outobj); + Py_ssize_t outsize = PyString_GET_SIZE(*outobj); if (Py_TYPE(mapping) == &EncodingMapType) { int res = encoding_map_lookup(c, mapping); @@ -4376,7 +4376,7 @@ if (outsize" : "", @@ -177,7 +177,7 @@ name); Py_XDECREF(nameobj); } - return PyBytes_FromString(buffer); + return PyString_FromString(buffer); } /* Weak references only support equality, not ordering. Two weak references @@ -448,7 +448,7 @@ "", proxy, Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name, PyWeakref_GET_OBJECT(proxy)); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } Modified: python/branches/tlee-ast-optimize/PC/_msi.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_msi.c (original) +++ python/branches/tlee-ast-optimize/PC/_msi.c Mon Jun 9 12:52:48 2008 @@ -35,7 +35,7 @@ return NULL; } - oresult = PyBytes_FromString(cresult); + oresult = PyString_FromString(cresult); RpcStringFree(&cresult); return oresult; @@ -136,14 +136,14 @@ PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab); if (result == NULL) return -1; - if (!PyBytes_Check(result)) { + if (!PyString_Check(result)) { PyErr_Format(PyExc_TypeError, "Incorrect return type %s from getnextcabinet", result->ob_type->tp_name); Py_DECREF(result); return FALSE; } - strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab)); + strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab)); return TRUE; } return FALSE; @@ -554,7 +554,7 @@ PyErr_SetString(PyExc_NotImplementedError, "FILETIME result"); return NULL; case VT_LPSTR: - result = PyBytes_FromStringAndSize(sval, ssize); + result = PyString_FromStringAndSize(sval, ssize); if (sval != sbuf) free(sval); return result; @@ -586,9 +586,9 @@ if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data)) return NULL; - if (PyBytes_Check(data)) { + if (PyString_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR, - 0, NULL, PyBytes_AsString(data)); + 0, NULL, PyString_AsString(data)); } else if (PyInt_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, PyInt_AsLong(data), NULL, NULL); Modified: python/branches/tlee-ast-optimize/PC/_subprocess.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_subprocess.c (original) +++ python/branches/tlee-ast-optimize/PC/_subprocess.c Mon Jun 9 12:52:48 2008 @@ -304,42 +304,42 @@ if (!keys || !values) goto error; - out = PyBytes_FromStringAndSize(NULL, 2048); + out = PyString_FromStringAndSize(NULL, 2048); if (! out) goto error; - p = PyBytes_AS_STRING(out); + p = PyString_AS_STRING(out); for (i = 0; i < envsize; i++) { int ksize, vsize, totalsize; PyObject* key = PyList_GET_ITEM(keys, i); PyObject* value = PyList_GET_ITEM(values, i); - if (! PyBytes_Check(key) || ! PyBytes_Check(value)) { + if (! PyString_Check(key) || ! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "environment can only contain strings"); goto error; } - ksize = PyBytes_GET_SIZE(key); - vsize = PyBytes_GET_SIZE(value); - totalsize = (p - PyBytes_AS_STRING(out)) + ksize + 1 + + ksize = PyString_GET_SIZE(key); + vsize = PyString_GET_SIZE(value); + totalsize = (p - PyString_AS_STRING(out)) + ksize + 1 + vsize + 1 + 1; - if (totalsize > PyBytes_GET_SIZE(out)) { - int offset = p - PyBytes_AS_STRING(out); - _PyBytes_Resize(&out, totalsize + 1024); - p = PyBytes_AS_STRING(out) + offset; + if (totalsize > PyString_GET_SIZE(out)) { + int offset = p - PyString_AS_STRING(out); + _PyString_Resize(&out, totalsize + 1024); + p = PyString_AS_STRING(out) + offset; } - memcpy(p, PyBytes_AS_STRING(key), ksize); + memcpy(p, PyString_AS_STRING(key), ksize); p += ksize; *p++ = '='; - memcpy(p, PyBytes_AS_STRING(value), vsize); + memcpy(p, PyString_AS_STRING(value), vsize); p += vsize; *p++ = '\0'; } /* add trailing null byte */ *p++ = '\0'; - _PyBytes_Resize(&out, p - PyBytes_AS_STRING(out)); + _PyString_Resize(&out, p - PyString_AS_STRING(out)); /* PyObject_Print(out, stdout, 0); */ @@ -413,7 +413,7 @@ NULL, inherit_handles, creation_flags, - environment ? PyBytes_AS_STRING(environment) : NULL, + environment ? PyString_AS_STRING(environment) : NULL, current_directory, &si, &pi); @@ -516,7 +516,7 @@ if (! result) return PyErr_SetFromWindowsErr(GetLastError()); - return PyBytes_FromString(filename); + return PyString_FromString(filename); } static PyMethodDef sp_functions[] = { Modified: python/branches/tlee-ast-optimize/PC/_winreg.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/_winreg.c (original) +++ python/branches/tlee-ast-optimize/PC/_winreg.c Mon Jun 9 12:52:48 2008 @@ -424,7 +424,7 @@ PyHKEYObject *pyhkey = (PyHKEYObject *)ob; char resBuf[160]; wsprintf(resBuf, "", pyhkey->hkey); - return PyBytes_FromString(resBuf); + return PyString_FromString(resBuf); } static int @@ -767,11 +767,11 @@ return FALSE; need_decref = 1; } - if (!PyBytes_Check(value)) + if (!PyString_Check(value)) return FALSE; *retDataSize = 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)value)); + PyString_AS_STRING( + (PyStringObject *)value)); } *retDataBuf = (BYTE *)PyMem_NEW(DWORD, *retDataSize); if (*retDataBuf==NULL){ @@ -782,8 +782,8 @@ strcpy((char *)*retDataBuf, ""); else strcpy((char *)*retDataBuf, - PyBytes_AS_STRING( - (PyBytesObject *)value)); + PyString_AS_STRING( + (PyStringObject *)value)); if (need_decref) Py_DECREF(value); break; @@ -808,7 +808,7 @@ PyObject *t; t = PyList_GET_ITEM( (PyListObject *)value,j); - if (PyBytes_Check(t)) { + if (PyString_Check(t)) { obs[j] = t; Py_INCREF(t); } else if (PyUnicode_Check(t)) { @@ -821,8 +821,8 @@ } else goto reg_multi_fail; size += 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)obs[j])); + PyString_AS_STRING( + (PyStringObject *)obs[j])); } *retDataSize = size + 1; @@ -839,11 +839,11 @@ PyObject *t; t = obs[j]; strcpy(P, - PyBytes_AS_STRING( - (PyBytesObject *)t)); + PyString_AS_STRING( + (PyStringObject *)t)); P += 1 + strlen( - PyBytes_AS_STRING( - (PyBytesObject *)t)); + PyString_AS_STRING( + (PyStringObject *)t)); Py_DECREF(obs[j]); } /* And doubly-terminate the list... */ @@ -1085,7 +1085,7 @@ if (rc != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx"); - retStr = PyBytes_FromStringAndSize(tmpbuf, len); + retStr = PyString_FromStringAndSize(tmpbuf, len); return retStr; /* can be NULL */ } @@ -1303,17 +1303,17 @@ != ERROR_SUCCESS) return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); - retStr = PyBytes_FromStringAndSize(NULL, bufSize); + retStr = PyString_FromStringAndSize(NULL, bufSize); if (retStr == NULL) return NULL; - retBuf = PyBytes_AS_STRING(retStr); + retBuf = PyString_AS_STRING(retStr); if ((rc = RegQueryValue(hKey, subKey, retBuf, &bufSize)) != ERROR_SUCCESS) { Py_DECREF(retStr); return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryValue"); } - _PyBytes_Resize(&retStr, strlen(retBuf)); + _PyString_Resize(&retStr, strlen(retBuf)); return retStr; } @@ -1414,14 +1414,14 @@ return NULL; } /* XXX - need Unicode support */ - str = PyBytes_AsString(obStrVal); + str = PyString_AsString(obStrVal); if (str == NULL) return NULL; - len = PyBytes_Size(obStrVal); + len = PyString_Size(obStrVal); if (obSubKey == Py_None) subKey = NULL; else { - subKey = PyBytes_AsString(obSubKey); + subKey = PyString_AsString(obSubKey); if (subKey == NULL) return NULL; } Modified: python/branches/tlee-ast-optimize/PC/msvcrtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/msvcrtmodule.c (original) +++ python/branches/tlee-ast-optimize/PC/msvcrtmodule.c Mon Jun 9 12:52:48 2008 @@ -140,7 +140,7 @@ ch = _getch(); Py_END_ALLOW_THREADS s[0] = ch; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } static PyObject * @@ -172,7 +172,7 @@ ch = _getche(); Py_END_ALLOW_THREADS s[0] = ch; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } static PyObject * Modified: python/branches/tlee-ast-optimize/PC/winsound.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/winsound.c (original) +++ python/branches/tlee-ast-optimize/PC/winsound.c Mon Jun 9 12:52:48 2008 @@ -151,7 +151,7 @@ static void add_define(PyObject *dict, const char *key, long value) { - PyObject *k=PyBytes_FromString(key); + PyObject *k=PyString_FromString(key); PyObject *v=PyLong_FromLong(value); if(v&&k) { Modified: python/branches/tlee-ast-optimize/Parser/asdl_c.py ============================================================================== --- python/branches/tlee-ast-optimize/Parser/asdl_c.py (original) +++ python/branches/tlee-ast-optimize/Parser/asdl_c.py Mon Jun 9 12:52:48 2008 @@ -375,7 +375,7 @@ # there's really nothing more we can do if this fails ... self.emit("if (tmp == NULL) goto failed;", 1) error = "expected some sort of %s, but got %%.400s" % name - format = "PyErr_Format(PyExc_TypeError, \"%s\", PyBytes_AS_STRING(tmp));" + format = "PyErr_Format(PyExc_TypeError, \"%s\", PyString_AS_STRING(tmp));" self.emit(format % error, 1, reflow=False) self.emit("failed:", 0) self.emit("Py_XDECREF(tmp);", 1) @@ -710,7 +710,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyBytes_FromString(fields[i]); + PyObject *field = PyString_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -729,7 +729,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyBytes_FromString(attrs[i]); + s = PyString_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -803,7 +803,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -821,7 +821,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } Modified: python/branches/tlee-ast-optimize/Parser/tokenizer.c ============================================================================== --- python/branches/tlee-ast-optimize/Parser/tokenizer.c (original) +++ python/branches/tlee-ast-optimize/Parser/tokenizer.c Mon Jun 9 12:52:48 2008 @@ -12,7 +12,7 @@ #ifndef PGEN #include "unicodeobject.h" -#include "bytesobject.h" +#include "stringobject.h" #include "fileobject.h" #include "codecs.h" #include "abstract.h" @@ -344,7 +344,7 @@ 1) NULL: need to call tok->decoding_readline to get a new line 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and stored the result in tok->decoding_buffer - 3) PyBytesObject *: previous call to fp_readl did not have enough room + 3) PyStringObject *: previous call to fp_readl did not have enough room (in the s buffer) to copy entire contents of the line read by tok->decoding_readline. tok->decoding_buffer has the overflow. In this case, fp_readl is called in a loop (with an expanded buffer) @@ -375,7 +375,7 @@ return error_ret(tok); } else { tok->decoding_buffer = NULL; - if (PyBytes_CheckExact(buf)) + if (PyString_CheckExact(buf)) utf8 = buf; } if (utf8 == NULL) { @@ -384,10 +384,10 @@ if (utf8 == NULL) return error_ret(tok); } - str = PyBytes_AsString(utf8); - utf8len = PyBytes_GET_SIZE(utf8); + str = PyString_AsString(utf8); + utf8len = PyString_GET_SIZE(utf8); if (utf8len > size) { - tok->decoding_buffer = PyBytes_FromStringAndSize(str+size, utf8len-size); + tok->decoding_buffer = PyString_FromStringAndSize(str+size, utf8len-size); if (tok->decoding_buffer == NULL) { Py_DECREF(utf8); return error_ret(tok); @@ -591,7 +591,7 @@ utf8 = translate_into_utf8(str, tok->enc); if (utf8 == NULL) return error_ret(tok); - str = PyBytes_AsString(utf8); + str = PyString_AsString(utf8); } #endif for (s = str;; s++) { @@ -624,7 +624,7 @@ "unknown encoding: %s", tok->enc); return error_ret(tok); } - str = PyBytes_AsString(utf8); + str = PyString_AsString(utf8); } #endif assert(tok->decoding_buffer == NULL); @@ -706,11 +706,11 @@ return 0; enc = ((PyFileObject *)sysstdin)->f_encoding; - if (enc == NULL || !PyBytes_Check(enc)) + if (enc == NULL || !PyString_Check(enc)) return 0; Py_INCREF(enc); - encoding = PyBytes_AsString(enc); + encoding = PyString_AsString(enc); decoded = PyUnicode_Decode(*inp, strlen(*inp), encoding, NULL); if (decoded == NULL) goto error_clear; @@ -720,9 +720,9 @@ if (utf8 == NULL) goto error_clear; - assert(PyBytes_Check(utf8)); - converted = new_string(PyBytes_AS_STRING(utf8), - PyBytes_GET_SIZE(utf8)); + assert(PyString_Check(utf8)); + converted = new_string(PyString_AS_STRING(utf8), + PyString_GET_SIZE(utf8)); Py_DECREF(utf8); if (converted == NULL) goto error_nomem; @@ -1609,8 +1609,8 @@ /* convert source to original encondig */ PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len); if (lineobj != NULL) { - int linelen = PyBytes_Size(lineobj); - const char *line = PyBytes_AsString(lineobj); + int linelen = PyString_Size(lineobj); + const char *line = PyString_AsString(lineobj); text = PyObject_MALLOC(linelen + 1); if (text != NULL && line != NULL) { if (linelen) @@ -1624,7 +1624,7 @@ PyObject *offsetobj = dec_utf8(tok->encoding, tok->buf, *offset-1); if (offsetobj) { - *offset = PyBytes_Size(offsetobj) + 1; + *offset = PyString_Size(offsetobj) + 1; Py_DECREF(offsetobj); } } Modified: python/branches/tlee-ast-optimize/Python/Python-ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/Python-ast.c (original) +++ python/branches/tlee-ast-optimize/Python/Python-ast.c Mon Jun 9 12:52:48 2008 @@ -499,7 +499,7 @@ fnames = PyTuple_New(num_fields); if (!fnames) return NULL; for (i = 0; i < num_fields; i++) { - PyObject *field = PyBytes_FromString(fields[i]); + PyObject *field = PyString_FromString(fields[i]); if (!field) { Py_DECREF(fnames); return NULL; @@ -518,7 +518,7 @@ PyObject *s, *l = PyTuple_New(num_fields); if (!l) return 0; for(i = 0; i < num_fields; i++) { - s = PyBytes_FromString(attrs[i]); + s = PyString_FromString(attrs[i]); if (!s) { Py_DECREF(l); return 0; @@ -592,7 +592,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -610,7 +610,7 @@ PyObject *s = PyObject_Repr(obj); if (s == NULL) return 1; PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyBytes_AS_STRING(s)); + PyString_AS_STRING(s)); Py_DECREF(s); return 1; } @@ -3320,7 +3320,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -4448,7 +4448,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5318,7 +5318,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5356,7 +5356,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5474,7 +5474,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5496,7 +5496,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5558,7 +5558,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5588,7 +5588,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5642,7 +5642,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; @@ -5808,7 +5808,7 @@ tmp = PyObject_Repr(obj); if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyBytes_AS_STRING(tmp)); + PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); failed: Py_XDECREF(tmp); return 1; Modified: python/branches/tlee-ast-optimize/Python/_warnings.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/_warnings.c (original) +++ python/branches/tlee-ast-optimize/Python/_warnings.c Mon Jun 9 12:52:48 2008 @@ -44,7 +44,7 @@ int result; if (warnings_str == NULL) { - warnings_str = PyBytes_InternFromString("warnings"); + warnings_str = PyString_InternFromString("warnings"); if (warnings_str == NULL) return NULL; } @@ -132,7 +132,7 @@ return NULL; if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyBytes_AsString(action); + return PyString_AsString(action); } m = PyImport_ImportModule(MODULE_NAME); @@ -144,7 +144,7 @@ return NULL; action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME); if (action != NULL) - return PyBytes_AsString(action); + return PyString_AsString(action); PyErr_SetString(PyExc_ValueError, MODULE_NAME "." DEFAULT_ACTION_NAME " not found"); @@ -184,17 +184,17 @@ if (rc == -1) return NULL; else if (rc == 0) - return PyBytes_FromString(""); + return PyString_FromString(""); - mod_str = PyBytes_AsString(filename); + mod_str = PyString_AsString(filename); if (mod_str == NULL) return NULL; - len = PyBytes_Size(filename); + len = PyString_Size(filename); if (len < 0) return NULL; if (len >= 3 && strncmp(mod_str + (len - 3), ".py", 3) == 0) { - module = PyBytes_FromStringAndSize(mod_str, len-3); + module = PyString_FromStringAndSize(mod_str, len-3); } else { module = filename; @@ -258,7 +258,7 @@ /* Print " source_line\n" */ PyFile_WriteString(" ", f_stderr); if (sourceline) { - char *source_line_str = PyBytes_AS_STRING(sourceline); + char *source_line_str = PyString_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || *source_line_str == '\014') source_line_str++; @@ -267,7 +267,7 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyBytes_AS_STRING(filename), lineno); + Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); PyErr_Clear(); } @@ -359,7 +359,7 @@ const char *err_str = "???"; if (to_str != NULL) - err_str = PyBytes_AS_STRING(to_str); + err_str = PyString_AS_STRING(to_str); PyErr_Format(PyExc_RuntimeError, "Unrecognized action (%s) in warnings.filters:\n %s", action, err_str); @@ -380,7 +380,7 @@ else { const char *msg = "functions overriding warnings.showwarning() " "must support the 'line' argument"; - const char *text_char = PyBytes_AS_STRING(text); + const char *text_char = PyString_AS_STRING(text); if (strcmp(msg, text_char) == 0) { /* Prevent infinite recursion by using built-in implementation @@ -484,7 +484,7 @@ /* Setup module. */ *module = PyDict_GetItemString(globals, "__name__"); if (*module == NULL) { - *module = PyBytes_FromString(""); + *module = PyString_FromString(""); if (*module == NULL) goto handle_error; } @@ -494,8 +494,8 @@ /* Setup filename. */ *filename = PyDict_GetItemString(globals, "__file__"); if (*filename != NULL) { - Py_ssize_t len = PyBytes_Size(*filename); - const char *file_str = PyBytes_AsString(*filename); + Py_ssize_t len = PyString_Size(*filename); + const char *file_str = PyString_AsString(*filename); if (file_str == NULL || (len < 0 && PyErr_Occurred())) goto handle_error; @@ -507,7 +507,7 @@ (tolower(file_str[len-1]) == 'c' || tolower(file_str[len-1]) == 'o')) { - *filename = PyBytes_FromStringAndSize(file_str, len-1); + *filename = PyString_FromStringAndSize(file_str, len-1); if (*filename == NULL) goto handle_error; } @@ -515,7 +515,7 @@ Py_INCREF(*filename); } else { - const char *module_str = PyBytes_AsString(*module); + const char *module_str = PyString_AsString(*module); if (module_str && strcmp(module_str, "__main__") == 0) { PyObject *argv = PySys_GetObject("argv"); if (argv != NULL && PyList_Size(argv) > 0) { @@ -530,14 +530,14 @@ } else if (!is_true) { Py_DECREF(*filename); - *filename = PyBytes_FromString("__main__"); + *filename = PyString_FromString("__main__"); if (*filename == NULL) goto handle_error; } } else { /* embedded interpreters don't have sys.argv, see bug #839151 */ - *filename = PyBytes_FromString("__main__"); + *filename = PyString_FromString("__main__"); if (*filename == NULL) goto handle_error; } @@ -649,12 +649,12 @@ PyObject *returned; if (get_source_name == NULL) { - get_source_name = PyBytes_InternFromString("get_source"); + get_source_name = PyString_InternFromString("get_source"); if (!get_source_name) return NULL; } if (splitlines_name == NULL) { - splitlines_name = PyBytes_InternFromString("splitlines"); + splitlines_name = PyString_InternFromString("splitlines"); if (!splitlines_name) return NULL; } @@ -711,7 +711,7 @@ PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) { PyObject *res; - PyObject *message = PyBytes_FromString(text); + PyObject *message = PyString_FromString(text); if (message == NULL) return -1; @@ -745,15 +745,15 @@ const char *module_str, PyObject *registry) { PyObject *res; - PyObject *message = PyBytes_FromString(text); - PyObject *filename = PyBytes_FromString(filename_str); + PyObject *message = PyString_FromString(text); + PyObject *filename = PyString_FromString(filename_str); PyObject *module = NULL; int ret = -1; if (message == NULL || filename == NULL) goto exit; if (module_str != NULL) { - module = PyBytes_FromString(module_str); + module = PyString_FromString(module_str); if (module == NULL) goto exit; } @@ -803,7 +803,7 @@ if (!strcmp(action, "ignore")) { if (ignore_str == NULL) { - ignore_str = PyBytes_InternFromString("ignore"); + ignore_str = PyString_InternFromString("ignore"); if (ignore_str == NULL) return NULL; } @@ -811,7 +811,7 @@ } else if (!strcmp(action, "error")) { if (error_str == NULL) { - error_str = PyBytes_InternFromString("error"); + error_str = PyString_InternFromString("error"); if (error_str == NULL) return NULL; } @@ -819,7 +819,7 @@ } else if (!strcmp(action, "default")) { if (default_str == NULL) { - default_str = PyBytes_InternFromString("default"); + default_str = PyString_InternFromString("default"); if (default_str == NULL) return NULL; } @@ -892,7 +892,7 @@ if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) return; - default_action = PyBytes_InternFromString("default"); + default_action = PyString_InternFromString("default"); if (default_action == NULL) return; if (PyModule_AddObject(m, DEFAULT_ACTION_NAME, default_action) < 0) Modified: python/branches/tlee-ast-optimize/Python/ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ast.c (original) +++ python/branches/tlee-ast-optimize/Python/ast.c Mon Jun 9 12:52:48 2008 @@ -46,7 +46,7 @@ static identifier new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyBytes_InternFromString(n); + PyObject* id = PyString_InternFromString(n); PyArena_AddPyObject(arena, id); return id; } @@ -113,6 +113,30 @@ PyErr_Restore(type, value, tback); } +static int +ast_warn(struct compiling *c, const node *n, char *msg) +{ + if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, LINENO(n), + NULL, NULL) < 0) { + /* if -Werr, change it to a SyntaxError */ + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SyntaxWarning)) + ast_error(n, msg); + return 0; + } + return 1; +} + +static int +forbidden_check(struct compiling *c, const node *n, const char *x) +{ + if (!strcmp(x, "None")) + return ast_error(n, "assignment to None"); + if (Py_Py3kWarningFlag && !(strcmp(x, "True") && strcmp(x, "False")) && + !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) + return 0; + return 1; +} + /* num_stmts() returns number of contained statements. Use this routine to determine how big a sequence is needed for @@ -351,20 +375,18 @@ switch (e->kind) { case Attribute_kind: - if (ctx == Store && - !strcmp(PyBytes_AS_STRING(e->v.Attribute.attr), "None")) { - return ast_error(n, "assignment to None"); - } + if (ctx == Store && !forbidden_check(c, n, + PyBytes_AS_STRING(e->v.Attribute.attr))) + return 0; e->v.Attribute.ctx = ctx; break; case Subscript_kind: e->v.Subscript.ctx = ctx; break; case Name_kind: - if (ctx == Store && - !strcmp(PyBytes_AS_STRING(e->v.Name.id), "None")) { - return ast_error(n, "assignment to None"); - } + if (ctx == Store && !forbidden_check(c, n, + PyBytes_AS_STRING(e->v.Name.id))) + return 0; e->v.Name.ctx = ctx; break; case List_kind: @@ -582,10 +604,8 @@ /* fpdef_node is either a NAME or an fplist */ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { - if (!strcmp(STR(child), "None")) { - ast_error(child, "assignment to None"); - return NULL; - } + if (!forbidden_check(c, n, STR(child))) + return NULL; arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), child->n_col_offset, c->c_arena); } @@ -681,6 +701,9 @@ /* def foo((x)): is not complex, special case. */ if (NCH(ch) != 1) { /* We have complex arguments, setup for unpacking. */ + if (Py_Py3kWarningFlag && !ast_warn(c, ch, + "tuple parameter unpacking has been removed in 3.x")) + goto error; asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); if (!asdl_seq_GET(args, k-1)) goto error; @@ -695,10 +718,8 @@ } if (TYPE(CHILD(ch, 0)) == NAME) { expr_ty name; - if (!strcmp(STR(CHILD(ch, 0)), "None")) { - ast_error(CHILD(ch, 0), "assignment to None"); + if (!forbidden_check(c, n, STR(CHILD(ch, 0)))) goto error; - } name = Name(NEW_IDENTIFIER(CHILD(ch, 0)), Param, LINENO(ch), ch->n_col_offset, c->c_arena); @@ -710,18 +731,14 @@ i += 2; /* the name and the comma */ break; case STAR: - if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); + if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; - } vararg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; break; case DOUBLESTAR: - if (!strcmp(STR(CHILD(n, i+1)), "None")) { - ast_error(CHILD(n, i+1), "assignment to None"); + if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; - } kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); i += 3; break; @@ -844,10 +861,8 @@ name = NEW_IDENTIFIER(CHILD(n, name_i)); if (!name) return NULL; - else if (!strcmp(STR(CHILD(n, name_i)), "None")) { - ast_error(CHILD(n, name_i), "assignment to None"); + else if (!forbidden_check(c, CHILD(n, name_i), STR(CHILD(n, name_i)))) return NULL; - } args = ast_for_arguments(c, CHILD(n, name_i + 1)); if (!args) return NULL; @@ -1276,7 +1291,7 @@ if (errstr) { char *s = ""; char buf[128]; - s = PyBytes_AsString(errstr); + s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); } else { @@ -1363,14 +1378,9 @@ } case BACKQUOTE: { /* repr */ expr_ty expression; - if (Py_Py3kWarningFlag) { - if (PyErr_WarnExplicit(PyExc_SyntaxWarning, - "backquote not supported in 3.x; use repr()", - c->c_filename, LINENO(n), - NULL, NULL)) { + if (Py_Py3kWarningFlag && + !ast_warn(c, n, "backquote not supported in 3.x; use repr()")) return NULL; - } - } expression = ast_for_testlist(c, CHILD(n, 1)); if (!expression) return NULL; @@ -1921,10 +1931,8 @@ return NULL; } key = e->v.Name.id; - if (!strcmp(PyBytes_AS_STRING(key), "None")) { - ast_error(CHILD(ch, 0), "assignment to None"); + if (!forbidden_check(c, CHILD(ch, 0), PyBytes_AS_STRING(key))) return NULL; - } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL; @@ -2051,10 +2059,9 @@ return NULL; case Name_kind: { const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); - if (var_name[0] == 'N' && !strcmp(var_name, "None")) { - ast_error(ch, "assignment to None"); + if ((var_name[0] == 'N' || var_name[0] == 'T' || var_name[0] == 'F') && + !forbidden_check(c, ch, var_name)) return NULL; - } break; } case Attribute_kind: @@ -2326,10 +2333,10 @@ /* length of string plus one for the dot */ len += strlen(STR(CHILD(n, i))) + 1; len--; /* the last name doesn't have a dot */ - str = PyBytes_FromStringAndSize(NULL, len); + str = PyString_FromStringAndSize(NULL, len); if (!str) return NULL; - s = PyBytes_AS_STRING(str); + s = PyString_AS_STRING(str); if (!s) return NULL; for (i = 0; i < NCH(n); i += 2) { @@ -2340,13 +2347,13 @@ } --s; *s = '\0'; - PyBytes_InternInPlace(&str); + PyString_InternInPlace(&str); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); } break; case STAR: - str = PyBytes_InternFromString("*"); + str = PyString_InternFromString("*"); PyArena_AddPyObject(c->c_arena, str); return alias(str, NULL, c->c_arena); default: @@ -2997,10 +3004,8 @@ REQ(n, classdef); - if (!strcmp(STR(CHILD(n, 1)), "None")) { - ast_error(n, "assignment to None"); + if (!forbidden_check(c, n, STR(CHILD(n, 1)))) return NULL; - } if (NCH(n) == 4) { s = ast_for_suite(c, CHILD(n, 3)); @@ -3196,10 +3201,10 @@ u = NULL; } else { /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ - u = PyBytes_FromStringAndSize((char *)NULL, len * 4); + u = PyString_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) return NULL; - p = buf = PyBytes_AsString(u); + p = buf = PyString_AsString(u); end = s + len; while (s < end) { if (*s == '\\') { @@ -3218,8 +3223,8 @@ Py_DECREF(u); return NULL; } - r = PyBytes_AsString(w); - rn = PyBytes_Size(w); + r = PyString_AsString(w); + rn = PyString_Size(w); assert(rn % 2 == 0); for (i = 0; i < rn; i += 2) { sprintf(p, "\\u%02x%02x", @@ -3318,11 +3323,11 @@ return v; #endif } else { - return PyBytes_FromStringAndSize(s, len); + return PyString_FromStringAndSize(s, len); } } - return PyBytes_DecodeEscape(s, len, NULL, unicode, + return PyString_DecodeEscape(s, len, NULL, unicode, need_encoding ? c->c_encoding : NULL); } @@ -3343,8 +3348,8 @@ s = parsestr(c, STR(CHILD(n, i))); if (s == NULL) goto onError; - if (PyBytes_Check(v) && PyBytes_Check(s)) { - PyBytes_ConcatAndDel(&v, s); + if (PyString_Check(v) && PyString_Check(s)) { + PyString_ConcatAndDel(&v, s); if (v == NULL) goto onError; } Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Mon Jun 9 12:52:48 2008 @@ -249,7 +249,7 @@ return NULL; /* Strings and tuples return a result of the same type. */ - if (PyBytes_Check(seq)) + if (PyString_Check(seq)) return filterstring(func, seq); #ifdef Py_USING_UNICODE if (PyUnicode_Check(seq)) @@ -383,7 +383,7 @@ return NULL; } s[0] = (char)x; - return PyBytes_FromStringAndSize(s, 1); + return PyString_FromStringAndSize(s, 1); } PyDoc_STRVAR(chr_doc, @@ -695,7 +695,7 @@ return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); } - if (!PyBytes_Check(cmd) && + if (!PyString_Check(cmd) && !PyUnicode_Check(cmd)) { PyErr_SetString(PyExc_TypeError, "eval() arg 1 must be a string or code object"); @@ -712,7 +712,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyBytes_AsStringAndSize(cmd, &str, NULL)) { + if (PyString_AsStringAndSize(cmd, &str, NULL)) { Py_XDECREF(tmp); return NULL; } @@ -857,7 +857,7 @@ } #endif - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "getattr(): attribute name must be string"); return NULL; @@ -913,7 +913,7 @@ } #endif - if (!PyBytes_Check(name)) { + if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return NULL; @@ -1232,7 +1232,7 @@ return NULL; } res = (*nb->nb_hex)(v); - if (res && !PyBytes_Check(res)) { + if (res && !PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__hex__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1292,13 +1292,13 @@ PyObject *s; if (!PyArg_ParseTuple(args, "S:intern", &s)) return NULL; - if (!PyBytes_CheckExact(s)) { + if (!PyString_CheckExact(s)) { PyErr_SetString(PyExc_TypeError, "can't intern subclass of string"); return NULL; } Py_INCREF(s); - PyBytes_InternInPlace(&s); + PyString_InternInPlace(&s); return s; } @@ -1500,7 +1500,7 @@ return NULL; } res = (*nb->nb_oct)(v); - if (res && !PyBytes_Check(res)) { + if (res && !PyString_Check(res)) { PyErr_Format(PyExc_TypeError, "__oct__ returned non-string (type %.200s)", res->ob_type->tp_name); @@ -1535,10 +1535,10 @@ long ord; Py_ssize_t size; - if (PyBytes_Check(obj)) { - size = PyBytes_GET_SIZE(obj); + if (PyString_Check(obj)) { + size = PyString_GET_SIZE(obj); if (size == 1) { - ord = (long)((unsigned char)*PyBytes_AS_STRING(obj)); + ord = (long)((unsigned char)*PyString_AS_STRING(obj)); return PyInt_FromLong(ord); } } else if (PyByteArray_Check(obj)) { @@ -1615,14 +1615,14 @@ Py_RETURN_NONE; } - if (sep && sep != Py_None && !PyBytes_Check(sep) && + if (sep && sep != Py_None && !PyString_Check(sep) && !PyUnicode_Check(sep)) { PyErr_Format(PyExc_TypeError, "sep must be None, str or unicode, not %.200s", sep->ob_type->tp_name); return NULL; } - if (end && end != Py_None && !PyBytes_Check(end) && + if (end && end != Py_None && !PyString_Check(end) && !PyUnicode_Check(end)) { PyErr_Format(PyExc_TypeError, "end must be None, str or unicode, not %.200s", @@ -1991,7 +1991,7 @@ po = PyObject_Str(v); if (po == NULL) return NULL; - prompt = PyBytes_AsString(po); + prompt = PyString_AsString(po); if (prompt == NULL) return NULL; } @@ -2019,7 +2019,7 @@ result = NULL; } else { - result = PyBytes_FromStringAndSize(s, len-1); + result = PyString_FromStringAndSize(s, len-1); } } PyMem_FREE(s); @@ -2662,7 +2662,7 @@ SETBUILTIN("bool", &PyBool_Type); /* SETBUILTIN("memoryview", &PyMemoryView_Type); */ SETBUILTIN("bytearray", &PyByteArray_Type); - SETBUILTIN("bytes", &PyBytes_Type); + SETBUILTIN("bytes", &PyString_Type); SETBUILTIN("buffer", &PyBuffer_Type); SETBUILTIN("classmethod", &PyClassMethod_Type); #ifndef WITHOUT_COMPLEX @@ -2682,7 +2682,7 @@ SETBUILTIN("set", &PySet_Type); SETBUILTIN("slice", &PySlice_Type); SETBUILTIN("staticmethod", &PyStaticMethod_Type); - SETBUILTIN("str", &PyBytes_Type); + SETBUILTIN("str", &PyString_Type); SETBUILTIN("super", &PySuper_Type); SETBUILTIN("tuple", &PyTuple_Type); SETBUILTIN("type", &PyType_Type); @@ -2780,7 +2780,7 @@ { PyObject *result; Py_ssize_t i, j; - Py_ssize_t len = PyBytes_Size(strobj); + Py_ssize_t len = PyString_Size(strobj); Py_ssize_t outlen = len; if (func == Py_None) { @@ -2788,12 +2788,12 @@ * as no character is ever false and __getitem__ * does return this character. If it's a subclass * we must go through the __getitem__ loop */ - if (PyBytes_CheckExact(strobj)) { + if (PyString_CheckExact(strobj)) { Py_INCREF(strobj); return strobj; } } - if ((result = PyBytes_FromStringAndSize(NULL, len)) == NULL) + if ((result = PyString_FromStringAndSize(NULL, len)) == NULL) return NULL; for (i = j = 0; i < len; ++i) { @@ -2823,16 +2823,16 @@ } if (ok) { Py_ssize_t reslen; - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "can't filter str to str:" " __getitem__ returned different type"); Py_DECREF(item); goto Fail_1; } - reslen = PyBytes_GET_SIZE(item); + reslen = PyString_GET_SIZE(item); if (reslen == 1) { - PyBytes_AS_STRING(result)[j++] = - PyBytes_AS_STRING(item)[0]; + PyString_AS_STRING(result)[j++] = + PyString_AS_STRING(item)[0]; } else { /* do we need more space? */ Py_ssize_t need = j + reslen + len-i-1; @@ -2840,15 +2840,15 @@ /* overallocate, to avoid reallocations */ if (need<2*outlen) need = 2*outlen; - if (_PyBytes_Resize(&result, need)) { + if (_PyString_Resize(&result, need)) { Py_DECREF(item); return NULL; } outlen = need; } memcpy( - PyBytes_AS_STRING(result) + j, - PyBytes_AS_STRING(item), + PyString_AS_STRING(result) + j, + PyString_AS_STRING(item), reslen ); j += reslen; @@ -2858,7 +2858,7 @@ } if (j < outlen) - _PyBytes_Resize(&result, j); + _PyString_Resize(&result, j); return result; Modified: python/branches/tlee-ast-optimize/Python/ceval.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ceval.c (original) +++ python/branches/tlee-ast-optimize/Python/ceval.c Mon Jun 9 12:52:48 2008 @@ -739,7 +739,7 @@ consts = co->co_consts; fastlocals = f->f_localsplus; freevars = f->f_localsplus + co->co_nlocals; - first_instr = (unsigned char*) PyBytes_AS_STRING(co->co_code); + first_instr = (unsigned char*) PyString_AS_STRING(co->co_code); /* An explanation is in order for the next line. f->f_lasti now refers to the index of the last instruction @@ -766,7 +766,7 @@ lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyBytes_AsString(co->co_filename); + filename = PyString_AsString(co->co_filename); #endif why = WHY_NOT; @@ -1147,8 +1147,8 @@ goto slow_add; x = PyInt_FromLong(i); } - else if (PyBytes_CheckExact(v) && - PyBytes_CheckExact(w)) { + else if (PyString_CheckExact(v) && + PyString_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_vx; @@ -1349,8 +1349,8 @@ goto slow_iadd; x = PyInt_FromLong(i); } - else if (PyBytes_CheckExact(v) && - PyBytes_CheckExact(w)) { + else if (PyString_CheckExact(v) && + PyString_CheckExact(w)) { x = string_concatenate(v, w, f, next_instr); /* string_concatenate consumed the ref to v */ goto skip_decref_v; @@ -1576,9 +1576,9 @@ err = PyFile_WriteObject(v, w, Py_PRINT_RAW); if (err == 0) { /* XXX move into writeobject() ? */ - if (PyBytes_Check(v)) { - char *s = PyBytes_AS_STRING(v); - Py_ssize_t len = PyBytes_GET_SIZE(v); + if (PyString_Check(v)) { + char *s = PyString_AS_STRING(v); + Py_ssize_t len = PyString_GET_SIZE(v); if (len == 0 || !isspace(Py_CHARMASK(s[len-1])) || s[len-1] == ' ') @@ -1705,7 +1705,7 @@ retval = POP(); } else if (PyExceptionClass_Check(v) || - PyBytes_Check(v)) { + PyString_Check(v)) { w = POP(); u = POP(); PyErr_Restore(v, w, u); @@ -1869,11 +1869,11 @@ case LOAD_GLOBAL: w = GETITEM(names, oparg); - if (PyBytes_CheckExact(w)) { + if (PyString_CheckExact(w)) { /* Inline the PyDict_GetItem() calls. WARNING: this is an extreme speed hack. Do not try this at home. */ - long hash = ((PyBytesObject *)w)->ob_shash; + long hash = ((PyStringObject *)w)->ob_shash; if (hash != -1) { PyDictObject *d; PyDictEntry *e; @@ -2726,7 +2726,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), defcount ? "at most" : "exactly", co->co_argcount, kwcount ? "non-keyword " : "", @@ -2756,10 +2756,10 @@ PyObject *keyword = kws[2*i]; PyObject *value = kws[2*i + 1]; int j; - if (keyword == NULL || !PyBytes_Check(keyword)) { + if (keyword == NULL || !PyString_Check(keyword)) { PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", - PyBytes_AsString(co->co_name)); + PyString_AsString(co->co_name)); goto fail; } /* XXX slow -- speed up using dictionary? */ @@ -2781,8 +2781,8 @@ PyErr_Format(PyExc_TypeError, "%.200s() got an unexpected " "keyword argument '%.400s'", - PyBytes_AsString(co->co_name), - PyBytes_AsString(keyword)); + PyString_AsString(co->co_name), + PyString_AsString(keyword)); goto fail; } PyDict_SetItem(kwdict, keyword, value); @@ -2793,8 +2793,8 @@ "%.200s() got multiple " "values for keyword " "argument '%.400s'", - PyBytes_AsString(co->co_name), - PyBytes_AsString(keyword)); + PyString_AsString(co->co_name), + PyString_AsString(keyword)); goto fail; } Py_INCREF(value); @@ -2808,7 +2808,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes %s %d " "%sargument%s (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), ((co->co_flags & CO_VARARGS) || defcount) ? "at least" : "exactly", @@ -2834,7 +2834,7 @@ if (argcount > 0 || kwcount > 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%d given)", - PyBytes_AsString(co->co_name), + PyString_AsString(co->co_name), argcount + kwcount); goto fail; } @@ -2860,11 +2860,11 @@ list so that we can march over it more efficiently? */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { - cellname = PyBytes_AS_STRING( + cellname = PyString_AS_STRING( PyTuple_GET_ITEM(co->co_cellvars, i)); found = 0; for (j = 0; j < nargs; j++) { - argname = PyBytes_AS_STRING( + argname = PyString_AS_STRING( PyTuple_GET_ITEM(co->co_varnames, j)); if (strcmp(cellname, argname) == 0) { c = PyCell_New(GETLOCAL(j)); @@ -3522,13 +3522,13 @@ if (PyMethod_Check(func)) return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) - return PyBytes_AsString(((PyFunctionObject*)func)->func_name); + return PyString_AsString(((PyFunctionObject*)func)->func_name); else if (PyCFunction_Check(func)) return ((PyCFunctionObject*)func)->m_ml->ml_name; else if (PyClass_Check(func)) - return PyBytes_AsString(((PyClassObject*)func)->cl_name); + return PyString_AsString(((PyClassObject*)func)->cl_name); else if (PyInstance_Check(func)) { - return PyBytes_AsString( + return PyString_AsString( ((PyInstanceObject*)func)->in_class->cl_name); } else { return func->ob_type->tp_name; @@ -3767,7 +3767,7 @@ "for keyword argument '%.200s'", PyEval_GetFuncName(func), PyEval_GetFuncDesc(func), - PyBytes_AsString(key)); + PyString_AsString(key)); Py_DECREF(key); Py_DECREF(value); Py_DECREF(kwdict); @@ -4086,7 +4086,7 @@ length = PyTuple_Size(w); for (i = 0; i < length; i += 1) { PyObject *exc = PyTuple_GET_ITEM(w, i); - if (PyBytes_Check(exc)) { + if (PyString_Check(exc)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4109,7 +4109,7 @@ } } else { - if (PyBytes_Check(w)) { + if (PyString_Check(w)) { int ret_val; ret_val = PyErr_WarnEx( PyExc_DeprecationWarning, @@ -4149,7 +4149,7 @@ if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, "cannot import name %.230s", - PyBytes_AsString(name)); + PyString_AsString(name)); } return x; } @@ -4191,8 +4191,8 @@ break; } if (skip_leading_underscores && - PyBytes_Check(name) && - PyBytes_AS_STRING(name)[0] == '_') + PyString_Check(name) && + PyString_AS_STRING(name)[0] == '_') { Py_DECREF(name); continue; @@ -4251,12 +4251,12 @@ PyObject *ptype, *pvalue, *ptraceback; PyErr_Fetch(&ptype, &pvalue, &ptraceback); - if (PyBytes_Check(pvalue)) { + if (PyString_Check(pvalue)) { PyObject *newmsg; - newmsg = PyBytes_FromFormat( + newmsg = PyString_FromFormat( "Error when calling the metaclass bases\n" " %s", - PyBytes_AS_STRING(pvalue)); + PyString_AS_STRING(pvalue)); if (newmsg != NULL) { Py_DECREF(pvalue); pvalue = newmsg; @@ -4297,7 +4297,7 @@ } else if (locals == Py_None) locals = globals; - if (!PyBytes_Check(prog) && + if (!PyString_Check(prog) && !PyUnicode_Check(prog) && !PyCode_Check(prog) && !PyFile_Check(prog)) { @@ -4327,7 +4327,7 @@ } else if (PyFile_Check(prog)) { FILE *fp = PyFile_AsFile(prog); - char *name = PyBytes_AsString(PyFile_Name(prog)); + char *name = PyString_AsString(PyFile_Name(prog)); PyCompilerFlags cf; if (name == NULL) return -1; @@ -4353,7 +4353,7 @@ cf.cf_flags |= PyCF_SOURCE_IS_UTF8; } #endif - if (PyBytes_AsStringAndSize(prog, &str, NULL)) + if (PyString_AsStringAndSize(prog, &str, NULL)) return -1; if (PyEval_MergeCompilerFlags(&cf)) v = PyRun_StringFlags(str, Py_file_input, globals, @@ -4378,7 +4378,7 @@ if (!obj) return; - obj_str = PyBytes_AsString(obj); + obj_str = PyString_AsString(obj); if (!obj_str) return; @@ -4391,8 +4391,8 @@ { /* This function implements 'variable += expr' when both arguments are strings. */ - Py_ssize_t v_len = PyBytes_GET_SIZE(v); - Py_ssize_t w_len = PyBytes_GET_SIZE(w); + Py_ssize_t v_len = PyString_GET_SIZE(v); + Py_ssize_t w_len = PyString_GET_SIZE(w); Py_ssize_t new_len = v_len + w_len; if (new_len < 0) { PyErr_SetString(PyExc_OverflowError, @@ -4441,12 +4441,12 @@ } } - if (v->ob_refcnt == 1 && !PyBytes_CHECK_INTERNED(v)) { + if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) { /* Now we own the last reference to 'v', so we can resize it * in-place. */ - if (_PyBytes_Resize(&v, new_len) != 0) { - /* XXX if _PyBytes_Resize() fails, 'v' has been + if (_PyString_Resize(&v, new_len) != 0) { + /* XXX if _PyString_Resize() fails, 'v' has been * deallocated so it cannot be put back into * 'variable'. The MemoryError is raised when there * is no value in 'variable', which might (very @@ -4455,13 +4455,13 @@ return NULL; } /* copy 'w' into the newly allocated area of 'v' */ - memcpy(PyBytes_AS_STRING(v) + v_len, - PyBytes_AS_STRING(w), w_len); + memcpy(PyString_AS_STRING(v) + v_len, + PyString_AS_STRING(w), w_len); return v; } else { /* When in-place resizing is not an option. */ - PyBytes_Concat(&v, w); + PyString_Concat(&v, w); return v; } } Modified: python/branches/tlee-ast-optimize/Python/codecs.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/codecs.c (original) +++ python/branches/tlee-ast-optimize/Python/codecs.c Mon Jun 9 12:52:48 2008 @@ -61,10 +61,10 @@ return NULL; } - v = PyBytes_FromStringAndSize(NULL, len); + v = PyString_FromStringAndSize(NULL, len); if (v == NULL) return NULL; - p = PyBytes_AS_STRING(v); + p = PyString_AS_STRING(v); for (i = 0; i < len; i++) { register char ch = string[i]; if (ch == ' ') @@ -112,7 +112,7 @@ v = normalizestring(encoding); if (v == NULL) goto onError; - PyBytes_InternInPlace(&v); + PyString_InternInPlace(&v); /* First, try to lookup the name in the registry dictionary */ result = PyDict_GetItem(interp->codec_search_cache, v); @@ -190,7 +190,7 @@ if (errors) { PyObject *v; - v = PyBytes_FromString(errors); + v = PyString_FromString(errors); if (v == NULL) { Py_DECREF(args); return NULL; @@ -451,7 +451,7 @@ if (string != NULL) { PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback", - PyBytes_AS_STRING(string)); + PyString_AS_STRING(string)); Py_DECREF(string); } } Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Mon Jun 9 12:52:48 2008 @@ -185,15 +185,15 @@ { /* Name mangling: __private becomes _classname__private. This is independent from how the name is used. */ - const char *p, *name = PyBytes_AsString(ident); + const char *p, *name = PyString_AsString(ident); char *buffer; size_t nlen, plen; - if (privateobj == NULL || !PyBytes_Check(privateobj) || + if (privateobj == NULL || !PyString_Check(privateobj) || name == NULL || name[0] != '_' || name[1] != '_') { Py_INCREF(ident); return ident; } - p = PyBytes_AsString(privateobj); + p = PyString_AsString(privateobj); nlen = strlen(name); /* Don't mangle __id__ or names with dots. @@ -217,11 +217,11 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); - ident = PyBytes_FromStringAndSize(NULL, 1 + nlen + plen); + ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ - buffer = PyBytes_AS_STRING(ident); + buffer = PyString_AS_STRING(ident); buffer[0] = '_'; strncpy(buffer+1, p, plen); strcpy(buffer+1+plen, name); @@ -250,7 +250,7 @@ PyCompilerFlags* flags = info->ci_flags; if (!__doc__) { - __doc__ = PyBytes_InternFromString("__doc__"); + __doc__ = PyString_InternFromString("__doc__"); if (!__doc__) return NULL; } @@ -586,7 +586,7 @@ { char tmpname[256]; PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyBytes_FromString(tmpname); + return PyString_FromString(tmpname); } /* Allocate a new block and return a pointer to it. @@ -1239,7 +1239,7 @@ int addNone = 1; static PyObject *module; if (!module) { - module = PyBytes_InternFromString(""); + module = PyString_InternFromString(""); if (!module) return NULL; } @@ -1291,8 +1291,8 @@ PyOS_snprintf(buf, sizeof(buf), "unknown scope for %.100s in %.100s(%s) in %s\n" "symbols: %s\nlocals: %s\nglobals: %s\n", - PyBytes_AS_STRING(name), - PyBytes_AS_STRING(c->u->u_name), + PyString_AS_STRING(name), + PyString_AS_STRING(c->u->u_name), PyObject_REPR(c->u->u_ste->ste_id), c->c_filename, PyObject_REPR(c->u->u_ste->ste_symbols), @@ -1350,9 +1350,9 @@ printf("lookup %s in %s %d %d\n" "freevars of %s: %s\n", PyObject_REPR(name), - PyBytes_AS_STRING(c->u->u_name), + PyString_AS_STRING(c->u->u_name), reftype, arg, - PyBytes_AS_STRING(co->co_name), + PyString_AS_STRING(co->co_name), PyObject_REPR(co->co_freevars)); Py_FatalError("compiler_make_closure()"); } @@ -1387,7 +1387,7 @@ for (i = 0; i < n; i++) { expr_ty arg = (expr_ty)asdl_seq_GET(args->args, i); if (arg->kind == Tuple_kind) { - PyObject *id = PyBytes_FromFormat(".%d", i); + PyObject *id = PyString_FromFormat(".%d", i); if (id == NULL) { return 0; } @@ -1480,7 +1480,7 @@ Py_XDECREF(c->u->u_private); c->u->u_private = s->v.ClassDef.name; Py_INCREF(c->u->u_private); - str = PyBytes_InternFromString("__name__"); + str = PyString_InternFromString("__name__"); if (!str || !compiler_nameop(c, str, Load)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1488,7 +1488,7 @@ } Py_DECREF(str); - str = PyBytes_InternFromString("__module__"); + str = PyString_InternFromString("__module__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); compiler_exit_scope(c); @@ -1555,7 +1555,7 @@ assert(e->kind == Lambda_kind); if (!name) { - name = PyBytes_InternFromString(""); + name = PyString_InternFromString(""); if (!name) return 0; } @@ -1945,7 +1945,7 @@ If there is a dot in name, we need to split it and emit a LOAD_ATTR for each name. */ - const char *src = PyBytes_AS_STRING(name); + const char *src = PyString_AS_STRING(name); const char *dot = strchr(src, '.'); if (dot) { /* Consume the base module name to get the first attribute */ @@ -1954,7 +1954,7 @@ /* NB src is only defined when dot != NULL */ PyObject *attr; dot = strchr(src, '.'); - attr = PyBytes_FromStringAndSize(src, + attr = PyString_FromStringAndSize(src, dot ? dot - src : strlen(src)); if (!attr) return -1; @@ -2003,10 +2003,10 @@ } else { identifier tmp = alias->name; - const char *base = PyBytes_AS_STRING(alias->name); + const char *base = PyString_AS_STRING(alias->name); char *dot = strchr(base, '.'); if (dot) - tmp = PyBytes_FromStringAndSize(base, + tmp = PyString_FromStringAndSize(base, dot - base); r = compiler_nameop(c, tmp, Store); if (dot) { @@ -2049,7 +2049,7 @@ } if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyBytes_AS_STRING(s->v.ImportFrom.module), + if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), "__future__")) { Py_DECREF(level); Py_DECREF(names); @@ -2069,7 +2069,7 @@ alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; - if (i == 0 && *PyBytes_AS_STRING(alias->name) == '*') { + if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { assert(n == 1); ADDOP(c, IMPORT_STAR); return 1; @@ -2099,7 +2099,7 @@ if (Py_OptimizeFlag) return 1; if (assertion_error == NULL) { - assertion_error = PyBytes_InternFromString("AssertionError"); + assertion_error = PyString_InternFromString("AssertionError"); if (assertion_error == NULL) return 0; } @@ -2382,7 +2382,7 @@ /* First check for assignment to __debug__. Param? */ if ((ctx == Store || ctx == AugStore || ctx == Del) - && !strcmp(PyBytes_AS_STRING(name), "__debug__")) { + && !strcmp(PyString_AS_STRING(name), "__debug__")) { return compiler_error(c, "can not assign to __debug__"); } @@ -2420,7 +2420,7 @@ } /* XXX Leave assert here, but handle __doc__ and the like better */ - assert(scope || PyBytes_AS_STRING(name)[0] == '_'); + assert(scope || PyString_AS_STRING(name)[0] == '_'); switch (optype) { case OP_DEREF: @@ -2434,7 +2434,7 @@ PyErr_Format(PyExc_SyntaxError, "can not delete variable '%s' referenced " "in nested scope", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); Py_DECREF(mangled); return 0; case Param: @@ -2819,7 +2819,7 @@ 0)))->iter; if (!name) { - name = PyBytes_FromString(""); + name = PyString_FromString(""); if (!name) return 0; } @@ -2868,7 +2868,7 @@ case Name_kind: /* __debug__ is not assignable, so we can optimize * it away in if and while statements */ - if (strcmp(PyBytes_AS_STRING(e->v.Name.id), + if (strcmp(PyString_AS_STRING(e->v.Name.id), "__debug__") == 0) return ! Py_OptimizeFlag; /* fall through */ @@ -2910,12 +2910,12 @@ assert(s->kind == With_kind); if (!enter_attr) { - enter_attr = PyBytes_InternFromString("__enter__"); + enter_attr = PyString_InternFromString("__enter__"); if (!enter_attr) return 0; } if (!exit_attr) { - exit_attr = PyBytes_InternFromString("__exit__"); + exit_attr = PyString_InternFromString("__exit__"); if (!exit_attr) return 0; } @@ -3521,10 +3521,10 @@ { memset(a, 0, sizeof(struct assembler)); a->a_lineno = firstlineno; - a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); + a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); if (!a->a_bytecode) return 0; - a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); + a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; a->a_postorder = (basicblock **)PyObject_Malloc( @@ -3636,17 +3636,17 @@ if (d_bytecode > 255) { int j, nbytes, ncodes = d_bytecode / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyBytes_Resize(&a->a_lnotab, len) < 0) + if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; for (j = 0; j < ncodes; j++) { *lnotab++ = 255; *lnotab++ = 0; @@ -3658,17 +3658,17 @@ if (d_lineno > 255) { int j, nbytes, ncodes = d_lineno / 255; nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { if (len * 2 < nbytes) len = nbytes; else len *= 2; - if (_PyBytes_Resize(&a->a_lnotab, len) < 0) + if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; *lnotab++ = d_bytecode; *lnotab++ = 255; d_bytecode = 0; @@ -3680,13 +3680,13 @@ a->a_lnotab_off += ncodes * 2; } - len = PyBytes_GET_SIZE(a->a_lnotab); + len = PyString_GET_SIZE(a->a_lnotab); if (a->a_lnotab_off + 2 >= len) { - if (_PyBytes_Resize(&a->a_lnotab, len * 2) < 0) + if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) return 0; } lnotab = (unsigned char *) - PyBytes_AS_STRING(a->a_lnotab) + a->a_lnotab_off; + PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; a->a_lnotab_off += 2; if (d_bytecode) { @@ -3711,7 +3711,7 @@ assemble_emit(struct assembler *a, struct instr *i) { int size, arg = 0, ext = 0; - Py_ssize_t len = PyBytes_GET_SIZE(a->a_bytecode); + Py_ssize_t len = PyString_GET_SIZE(a->a_bytecode); char *code; size = instrsize(i); @@ -3722,10 +3722,10 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { - if (_PyBytes_Resize(&a->a_bytecode, len * 2) < 0) + if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) return 0; } - code = PyBytes_AS_STRING(a->a_bytecode) + a->a_offset; + code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; a->a_offset += size; if (size == 6) { assert(i->i_hasarg); @@ -3898,7 +3898,7 @@ freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); if (!freevars) goto error; - filename = PyBytes_FromString(c->c_filename); + filename = PyString_FromString(c->c_filename); if (!filename) goto error; @@ -4018,9 +4018,9 @@ goto error; } - if (_PyBytes_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) + if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) goto error; - if (_PyBytes_Resize(&a.a_bytecode, a.a_offset) < 0) + if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0) goto error; co = makecode(c, &a); Modified: python/branches/tlee-ast-optimize/Python/errors.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/errors.c (original) +++ python/branches/tlee-ast-optimize/Python/errors.c Mon Jun 9 12:52:48 2008 @@ -66,7 +66,7 @@ void PyErr_SetString(PyObject *exception, const char *string) { - PyObject *value = PyBytes_FromString(string); + PyObject *value = PyString_FromString(string); PyErr_SetObject(exception, value); Py_XDECREF(value); } @@ -351,7 +351,7 @@ PyObject * PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); Py_XDECREF(name); return result; @@ -430,7 +430,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, ierr, name); @@ -469,7 +469,7 @@ int ierr, const char *filename) { - PyObject *name = filename ? PyBytes_FromString(filename) : NULL; + PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( PyExc_WindowsError, ierr, name); @@ -527,7 +527,7 @@ va_start(vargs); #endif - string = PyBytes_FromFormatV(format, vargs); + string = PyString_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); va_end(vargs); @@ -559,7 +559,7 @@ goto failure; } if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyBytes_FromStringAndSize(name, + modulename = PyString_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) goto failure; @@ -611,7 +611,7 @@ if (moduleName == NULL) PyFile_WriteString("", f); else { - char* modstr = PyBytes_AsString(moduleName); + char* modstr = PyString_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions") != 0) { @@ -665,7 +665,7 @@ Py_DECREF(tmp); } if (filename != NULL) { - tmp = PyBytes_FromString(filename); + tmp = PyString_FromString(filename); if (tmp == NULL) PyErr_Clear(); else { @@ -742,7 +742,7 @@ char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - return PyBytes_FromString(p); + return PyString_FromString(p); } return NULL; } Modified: python/branches/tlee-ast-optimize/Python/future.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/future.c (original) +++ python/branches/tlee-ast-optimize/Python/future.c Mon Jun 9 12:52:48 2008 @@ -20,7 +20,7 @@ names = s->v.ImportFrom.names; for (i = 0; i < asdl_seq_LEN(names); i++) { alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyBytes_AsString(name->name); + const char *feature = PyString_AsString(name->name); if (!feature) return 0; if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { @@ -59,7 +59,7 @@ static PyObject *future; if (!future) { - future = PyBytes_InternFromString("__future__"); + future = PyString_InternFromString("__future__"); if (!future) return 0; } Modified: python/branches/tlee-ast-optimize/Python/getargs.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/getargs.c (original) +++ python/branches/tlee-ast-optimize/Python/getargs.c Mon Jun 9 12:52:48 2008 @@ -418,7 +418,7 @@ n++; } - if (!PySequence_Check(arg) || PyBytes_Check(arg)) { + if (!PySequence_Check(arg) || PyString_Check(arg)) { levels[0] = 0; PyOS_snprintf(msgbuf, bufsize, toplevel ? "expected %d arguments, not %.50s" : @@ -765,8 +765,8 @@ case 'c': {/* char */ char *p = va_arg(*p_va, char *); - if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1) - *p = PyBytes_AS_STRING(arg)[0]; + if (PyString_Check(arg) && PyString_Size(arg) == 1) + *p = PyString_AS_STRING(arg)[0]; else return converterr("char", arg, msgbuf, bufsize); break; @@ -777,9 +777,9 @@ void **p = (void **)va_arg(*p_va, char **); FETCH_SIZE; - if (PyBytes_Check(arg)) { - *p = PyBytes_AS_STRING(arg); - STORE_SIZE(PyBytes_GET_SIZE(arg)); + if (PyString_Check(arg)) { + *p = PyString_AS_STRING(arg); + STORE_SIZE(PyString_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -787,8 +787,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); - STORE_SIZE(PyBytes_GET_SIZE(uarg)); + *p = PyString_AS_STRING(uarg); + STORE_SIZE(PyString_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -802,20 +802,20 @@ } else { char **p = va_arg(*p_va, char **); - if (PyBytes_Check(arg)) - *p = PyBytes_AS_STRING(arg); + if (PyString_Check(arg)) + *p = PyString_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); + *p = PyString_AS_STRING(uarg); } #endif else return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -831,9 +831,9 @@ *p = 0; STORE_SIZE(0); } - else if (PyBytes_Check(arg)) { - *p = PyBytes_AS_STRING(arg); - STORE_SIZE(PyBytes_GET_SIZE(arg)); + else if (PyString_Check(arg)) { + *p = PyString_AS_STRING(arg); + STORE_SIZE(PyString_GET_SIZE(arg)); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { @@ -841,8 +841,8 @@ if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); - STORE_SIZE(PyBytes_GET_SIZE(uarg)); + *p = PyString_AS_STRING(uarg); + STORE_SIZE(PyString_GET_SIZE(uarg)); } #endif else { /* any buffer-like object */ @@ -858,15 +858,15 @@ if (arg == Py_None) *p = 0; - else if (PyBytes_Check(arg)) - *p = PyBytes_AS_STRING(arg); + else if (PyString_Check(arg)) + *p = PyString_AS_STRING(arg); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) return converterr(CONV_UNICODE, arg, msgbuf, bufsize); - *p = PyBytes_AS_STRING(uarg); + *p = PyString_AS_STRING(uarg); } #endif else @@ -878,11 +878,11 @@ if (arg == Py_None) *q = 0; else - *q = PyBytes_Size(arg); + *q = PyString_Size(arg); format++; } else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyBytes_Size(arg)) + (Py_ssize_t)strlen(*p) != PyString_Size(arg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize); @@ -923,7 +923,7 @@ arg, msgbuf, bufsize); /* Encode object */ - if (!recode_strings && PyBytes_Check(arg)) { + if (!recode_strings && PyString_Check(arg)) { s = arg; Py_INCREF(s); } @@ -946,7 +946,7 @@ if (s == NULL) return converterr("(encoding failed)", arg, msgbuf, bufsize); - if (!PyBytes_Check(s)) { + if (!PyString_Check(s)) { Py_DECREF(s); return converterr( "(encoder failed to return a string)", @@ -956,7 +956,7 @@ return converterr("string", arg, msgbuf, bufsize); #endif } - size = PyBytes_GET_SIZE(s); + size = PyString_GET_SIZE(s); /* Write output; output is guaranteed to be 0-terminated */ if (*format == '#') { @@ -1013,7 +1013,7 @@ } } memcpy(*buffer, - PyBytes_AS_STRING(s), + PyString_AS_STRING(s), size + 1); STORE_SIZE(size); } else { @@ -1030,7 +1030,7 @@ PyMem_Free()ing it after usage */ - if ((Py_ssize_t)strlen(PyBytes_AS_STRING(s)) + if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) != size) { Py_DECREF(s); return converterr( @@ -1049,7 +1049,7 @@ arg, msgbuf, bufsize); } memcpy(*buffer, - PyBytes_AS_STRING(s), + PyString_AS_STRING(s), size + 1); } Py_DECREF(s); @@ -1083,7 +1083,7 @@ case 'S': { /* string object */ PyObject **p = va_arg(*p_va, PyObject **); - if (PyBytes_Check(arg)) + if (PyString_Check(arg)) *p = arg; else return converterr("string", arg, msgbuf, bufsize); @@ -1473,12 +1473,12 @@ while (PyDict_Next(keywords, &pos, &key, &value)) { int match = 0; char *ks; - if (!PyBytes_Check(key)) { + if (!PyString_Check(key)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return cleanreturn(0, freelist); } - ks = PyBytes_AsString(key); + ks = PyString_AsString(key); for (i = 0; i < len; i++) { if (!strcmp(ks, kwlist[i])) { match = 1; Modified: python/branches/tlee-ast-optimize/Python/import.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/import.c (original) +++ python/branches/tlee-ast-optimize/Python/import.c Mon Jun 9 12:52:48 2008 @@ -469,8 +469,8 @@ while (PyDict_Next(modules, &pos, &key, &value)) { if (value->ob_refcnt != 1) continue; - if (PyBytes_Check(key) && PyModule_Check(value)) { - name = PyBytes_AS_STRING(key); + if (PyString_Check(key) && PyModule_Check(value)) { + name = PyString_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -488,8 +488,8 @@ /* Next, delete all modules (still skipping __builtin__ and sys) */ pos = 0; while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyBytes_Check(key) && PyModule_Check(value)) { - name = PyBytes_AS_STRING(key); + if (PyString_Check(key) && PyModule_Check(value)) { + name = PyString_AS_STRING(key); if (strcmp(name, "__builtin__") == 0) continue; if (strcmp(name, "sys") == 0) @@ -667,7 +667,7 @@ /* Remember the filename as the __file__ attribute */ v = NULL; if (pathname != NULL) { - v = PyBytes_FromString(pathname); + v = PyString_FromString(pathname); if (v == NULL) PyErr_Clear(); } @@ -1022,7 +1022,7 @@ PySys_WriteStderr("import %s # directory %s\n", name, pathname); d = PyModule_GetDict(m); - file = PyBytes_FromString(pathname); + file = PyString_FromString(pathname); if (file == NULL) goto error; path = Py_BuildValue("[O]", file); @@ -1234,15 +1234,15 @@ Py_DECREF(meta_path); } - if (path != NULL && PyBytes_Check(path)) { + if (path != NULL && PyString_Check(path)) { /* The only type of submodule allowed inside a "frozen" package are other frozen modules or packages. */ - if (PyBytes_Size(path) + 1 + strlen(name) >= (size_t)buflen) { + if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) { PyErr_SetString(PyExc_ImportError, "full frozen module name too long"); return NULL; } - strcpy(buf, PyBytes_AsString(path)); + strcpy(buf, PyString_AsString(path)); strcat(buf, "."); strcat(buf, name); strcpy(name, buf); @@ -1311,14 +1311,14 @@ } else #endif - if (!PyBytes_Check(v)) + if (!PyString_Check(v)) continue; - len = PyBytes_GET_SIZE(v); + len = PyString_GET_SIZE(v); if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyBytes_AS_STRING(v)); + strcpy(buf, PyString_AS_STRING(v)); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */ @@ -1983,7 +1983,7 @@ if (m == NULL) goto err_return; d = PyModule_GetDict(m); - s = PyBytes_InternFromString(name); + s = PyString_InternFromString(name); if (s == NULL) goto err_return; err = PyDict_SetItemString(d, "__path__", s); @@ -2012,7 +2012,7 @@ PyObject *pname; PyObject *result; - pname = PyBytes_FromString(name); + pname = PyString_FromString(name); if (pname == NULL) return NULL; result = PyImport_Import(pname); @@ -2185,17 +2185,17 @@ return Py_None; if (namestr == NULL) { - namestr = PyBytes_InternFromString("__name__"); + namestr = PyString_InternFromString("__name__"); if (namestr == NULL) return NULL; } if (pathstr == NULL) { - pathstr = PyBytes_InternFromString("__path__"); + pathstr = PyString_InternFromString("__path__"); if (pathstr == NULL) return NULL; } if (pkgstr == NULL) { - pkgstr = PyBytes_InternFromString("__package__"); + pkgstr = PyString_InternFromString("__package__"); if (pkgstr == NULL) return NULL; } @@ -2207,12 +2207,12 @@ if ((pkgname != NULL) && (pkgname != Py_None)) { /* __package__ is set, so use it */ Py_ssize_t len; - if (!PyBytes_Check(pkgname)) { + if (!PyString_Check(pkgname)) { PyErr_SetString(PyExc_ValueError, "__package__ set to non-string"); return NULL; } - len = PyBytes_GET_SIZE(pkgname); + len = PyString_GET_SIZE(pkgname); if (len == 0) { if (level > 0) { PyErr_SetString(PyExc_ValueError, @@ -2226,24 +2226,24 @@ "Package name too long"); return NULL; } - strcpy(buf, PyBytes_AS_STRING(pkgname)); + strcpy(buf, PyString_AS_STRING(pkgname)); } else { /* __package__ not set, so figure it out and set it */ modname = PyDict_GetItem(globals, namestr); - if (modname == NULL || !PyBytes_Check(modname)) + if (modname == NULL || !PyString_Check(modname)) return Py_None; modpath = PyDict_GetItem(globals, pathstr); if (modpath != NULL) { /* __path__ is set, so modname is already the package name */ - Py_ssize_t len = PyBytes_GET_SIZE(modname); + Py_ssize_t len = PyString_GET_SIZE(modname); int error; if (len > MAXPATHLEN) { PyErr_SetString(PyExc_ValueError, "Module name too long"); return NULL; } - strcpy(buf, PyBytes_AS_STRING(modname)); + strcpy(buf, PyString_AS_STRING(modname)); error = PyDict_SetItem(globals, pkgstr, modname); if (error) { PyErr_SetString(PyExc_ValueError, @@ -2252,7 +2252,7 @@ } } else { /* Normal module, so work out the package name if any */ - char *start = PyBytes_AS_STRING(modname); + char *start = PyString_AS_STRING(modname); char *lastdot = strrchr(start, '.'); size_t len; int error; @@ -2278,7 +2278,7 @@ } strncpy(buf, start, len); buf[len] = '\0'; - pkgname = PyBytes_FromString(buf); + pkgname = PyString_FromString(buf); if (pkgname == NULL) { return NULL; } @@ -2414,13 +2414,13 @@ } return 0; } - if (!PyBytes_Check(item)) { + if (!PyString_Check(item)) { PyErr_SetString(PyExc_TypeError, "Item in ``from list'' not a string"); Py_DECREF(item); return 0; } - if (PyBytes_AS_STRING(item)[0] == '*') { + if (PyString_AS_STRING(item)[0] == '*') { PyObject *all; Py_DECREF(item); /* See if the package defines __all__ */ @@ -2439,7 +2439,7 @@ } hasit = PyObject_HasAttr(mod, item); if (!hasit) { - char *subname = PyBytes_AS_STRING(item); + char *subname = PyString_AS_STRING(item); PyObject *submod; char *p; if (buflen + strlen(subname) >= MAXPATHLEN) { @@ -2605,7 +2605,7 @@ subname = name; else { PyObject *parentname, *parent; - parentname = PyBytes_FromStringAndSize(name, (subname-name)); + parentname = PyString_FromStringAndSize(name, (subname-name)); if (parentname == NULL) { imp_modules_reloading_clear(); return NULL; @@ -2614,7 +2614,7 @@ if (parent == NULL) { PyErr_Format(PyExc_ImportError, "reload(): parent %.200s not in sys.modules", - PyBytes_AS_STRING(parentname)); + PyString_AS_STRING(parentname)); Py_DECREF(parentname); imp_modules_reloading_clear(); return NULL; @@ -2659,7 +2659,7 @@ done using whatever import hooks are installed in the current environment, e.g. by "rexec". A dummy list ["__doc__"] is passed as the 4th argument so that - e.g. PyImport_Import(PyBytes_FromString("win32com.client.gencache")) + e.g. PyImport_Import(PyString_FromString("win32com.client.gencache")) will return instead of . */ PyObject * @@ -2675,10 +2675,10 @@ /* Initialize constant string objects */ if (silly_list == NULL) { - import_str = PyBytes_InternFromString("__import__"); + import_str = PyString_InternFromString("__import__"); if (import_str == NULL) return NULL; - builtins_str = PyBytes_InternFromString("__builtins__"); + builtins_str = PyString_InternFromString("__builtins__"); if (builtins_str == NULL) return NULL; silly_list = Py_BuildValue("[s]", "__doc__"); @@ -2746,7 +2746,7 @@ buf[2] = (char) ((pyc_magic >> 16) & 0xff); buf[3] = (char) ((pyc_magic >> 24) & 0xff); - return PyBytes_FromStringAndSize(buf, 4); + return PyString_FromStringAndSize(buf, 4); } static PyObject * Modified: python/branches/tlee-ast-optimize/Python/mactoolboxglue.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/mactoolboxglue.c (original) +++ python/branches/tlee-ast-optimize/Python/mactoolboxglue.c Mon Jun 9 12:52:48 2008 @@ -52,7 +52,7 @@ buf[0] = '\0'; } else { - char *input = PyBytes_AsString(rv); + char *input = PyString_AsString(rv); if (!input) { PyErr_Clear(); buf[0] = '\0'; @@ -125,7 +125,7 @@ if (!rv) goto error; - input = PyBytes_AsString(rv); + input = PyString_AsString(rv); if (!input) goto error; @@ -161,12 +161,12 @@ PyMac_GetOSType(PyObject *v, OSType *pr) { uint32_t tmp; - if (!PyBytes_Check(v) || PyBytes_Size(v) != 4) { + if (!PyString_Check(v) || PyString_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)&tmp, PyBytes_AsString(v), 4); + memcpy((char *)&tmp, PyString_AsString(v), 4); *pr = (OSType)ntohl(tmp); return 1; } @@ -176,7 +176,7 @@ PyMac_BuildOSType(OSType t) { uint32_t tmp = htonl((uint32_t)t); - return PyBytes_FromStringAndSize((char *)&tmp, 4); + return PyString_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -192,13 +192,13 @@ PyMac_GetStr255(PyObject *v, Str255 pbuf) { int len; - if (!PyBytes_Check(v) || (len = PyBytes_Size(v)) > 255) { + if (!PyString_Check(v) || (len = PyString_Size(v)) > 255) { PyErr_SetString(PyExc_TypeError, "Str255 arg must be string of at most 255 chars"); return 0; } pbuf[0] = len; - memcpy((char *)(pbuf+1), PyBytes_AsString(v), len); + memcpy((char *)(pbuf+1), PyString_AsString(v), len); return 1; } @@ -210,7 +210,7 @@ PyErr_SetString(PyExc_SystemError, "Str255 pointer is NULL"); return NULL; } - return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); } PyObject * @@ -220,7 +220,7 @@ Py_INCREF(Py_None); return Py_None; } - return PyBytes_FromStringAndSize((char *)&s[1], (int)s[0]); + return PyString_FromStringAndSize((char *)&s[1], (int)s[0]); } Modified: python/branches/tlee-ast-optimize/Python/marshal.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/marshal.c (original) +++ python/branches/tlee-ast-optimize/Python/marshal.c Mon Jun 9 12:52:48 2008 @@ -64,18 +64,18 @@ Py_ssize_t size, newsize; if (p->str == NULL) return; /* An error already occurred */ - size = PyBytes_Size(p->str); + size = PyString_Size(p->str); newsize = size + size + 1024; if (newsize > 32*1024*1024) { newsize = size + 1024*1024; } - if (_PyBytes_Resize(&p->str, newsize) != 0) { + if (_PyString_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; } else { - p->ptr = PyBytes_AS_STRING((PyBytesObject *)p->str) + size; + p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size; p->end = - PyBytes_AS_STRING((PyBytesObject *)p->str) + newsize; + PyString_AS_STRING((PyStringObject *)p->str) + newsize; *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char); } } @@ -239,8 +239,8 @@ } } #endif - else if (PyBytes_CheckExact(v)) { - if (p->strings && PyBytes_CHECK_INTERNED(v)) { + else if (PyString_CheckExact(v)) { + if (p->strings && PyString_CHECK_INTERNED(v)) { PyObject *o = PyDict_GetItem(p->strings, v); if (o) { long w = PyInt_AsLong(o); @@ -265,7 +265,7 @@ else { w_byte(TYPE_STRING, p); } - n = PyBytes_GET_SIZE(v); + n = PyString_GET_SIZE(v); if (n > INT_MAX) { /* huge strings are not supported */ p->depth--; @@ -273,7 +273,7 @@ return; } w_long((long)n, p); - w_string(PyBytes_AS_STRING(v), (int)n, p); + w_string(PyString_AS_STRING(v), (int)n, p); } #ifdef Py_USING_UNICODE else if (PyUnicode_CheckExact(v)) { @@ -285,14 +285,14 @@ return; } w_byte(TYPE_UNICODE, p); - n = PyBytes_GET_SIZE(utf8); + n = PyString_GET_SIZE(utf8); if (n > INT_MAX) { p->depth--; p->error = 1; return; } w_long((long)n, p); - w_string(PyBytes_AS_STRING(utf8), (int)n, p); + w_string(PyString_AS_STRING(utf8), (int)n, p); Py_DECREF(utf8); } #endif @@ -713,12 +713,12 @@ retval = NULL; break; } - v = PyBytes_FromStringAndSize((char *)NULL, n); + v = PyString_FromStringAndSize((char *)NULL, n); if (v == NULL) { retval = NULL; break; } - if (r_string(PyBytes_AS_STRING(v), (int)n, p) != n) { + if (r_string(PyString_AS_STRING(v), (int)n, p) != n) { Py_DECREF(v); PyErr_SetString(PyExc_EOFError, "EOF read where object expected"); @@ -726,7 +726,7 @@ break; } if (type == TYPE_INTERNED) { - PyBytes_InternInPlace(&v); + PyString_InternInPlace(&v); if (PyList_Append(p->strings, v) < 0) { retval = NULL; break; @@ -1113,11 +1113,11 @@ { WFILE wf; wf.fp = NULL; - wf.str = PyBytes_FromStringAndSize((char *)NULL, 50); + wf.str = PyString_FromStringAndSize((char *)NULL, 50); if (wf.str == NULL) return NULL; - wf.ptr = PyBytes_AS_STRING((PyBytesObject *)wf.str); - wf.end = wf.ptr + PyBytes_Size(wf.str); + wf.ptr = PyString_AS_STRING((PyStringObject *)wf.str); + wf.end = wf.ptr + PyString_Size(wf.str); wf.error = 0; wf.depth = 0; wf.version = version; @@ -1125,14 +1125,14 @@ w_object(x, &wf); Py_XDECREF(wf.strings); if (wf.str != NULL) { - char *base = PyBytes_AS_STRING((PyBytesObject *)wf.str); + char *base = PyString_AS_STRING((PyStringObject *)wf.str); if (wf.ptr - base > PY_SSIZE_T_MAX) { Py_DECREF(wf.str); PyErr_SetString(PyExc_OverflowError, "too much marshall data for a string"); return NULL; } - _PyBytes_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); + _PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base)); } if (wf.error) { Py_XDECREF(wf.str); Modified: python/branches/tlee-ast-optimize/Python/modsupport.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/modsupport.c (original) +++ python/branches/tlee-ast-optimize/Python/modsupport.c Mon Jun 9 12:52:48 2008 @@ -65,7 +65,7 @@ return NULL; d = PyModule_GetDict(m); if (methods != NULL) { - n = PyBytes_FromString(name); + n = PyString_FromString(name); if (n == NULL) return NULL; for (ml = methods; ml->ml_name != NULL; ml++) { @@ -92,7 +92,7 @@ Py_DECREF(n); } if (doc != NULL) { - v = PyBytes_FromString(doc); + v = PyString_FromString(doc); if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { Py_XDECREF(v); return NULL; @@ -391,7 +391,7 @@ { char p[1]; p[0] = (char)va_arg(*p_va, int); - return PyBytes_FromStringAndSize(p, 1); + return PyString_FromStringAndSize(p, 1); } case 's': @@ -423,7 +423,7 @@ } n = (Py_ssize_t)m; } - v = PyBytes_FromStringAndSize(str, n); + v = PyString_FromStringAndSize(str, n); } return v; } @@ -633,7 +633,7 @@ int PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) { - PyObject *o = PyBytes_FromString(value); + PyObject *o = PyString_FromString(value); if (!o) return -1; if (PyModule_AddObject(m, name, o) == 0) Modified: python/branches/tlee-ast-optimize/Python/peephole.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/peephole.c (original) +++ python/branches/tlee-ast-optimize/Python/peephole.c Mon Jun 9 12:52:48 2008 @@ -92,15 +92,15 @@ goto exitUnchanged; /* Bypass optimization when the lineno table is too complex */ - assert(PyBytes_Check(lineno_obj)); - lineno = (unsigned char*)PyBytes_AS_STRING(lineno_obj); - tabsiz = PyBytes_GET_SIZE(lineno_obj); + assert(PyString_Check(lineno_obj)); + lineno = (unsigned char*)PyString_AS_STRING(lineno_obj); + tabsiz = PyString_GET_SIZE(lineno_obj); if (memchr(lineno, 255, tabsiz) != NULL) goto exitUnchanged; /* Avoid situations where jump retargeting could overflow */ - assert(PyBytes_Check(code)); - codelen = PyBytes_GET_SIZE(code); + assert(PyString_Check(code)); + codelen = PyString_GET_SIZE(code); if (codelen > 32700) goto exitUnchanged; @@ -109,7 +109,7 @@ if (codestr == NULL) goto exitUnchanged; codestr = (unsigned char *)memcpy(codestr, - PyBytes_AS_STRING(code), codelen); + PyString_AS_STRING(code), codelen); /* Verify that RETURN_VALUE terminates the codestring. This allows the various transformation patterns to look ahead several @@ -260,7 +260,7 @@ } assert(h + nops == codelen); - code = PyBytes_FromStringAndSize((char *)codestr, h); + code = PyString_FromStringAndSize((char *)codestr, h); PyMem_Free(addrmap); PyMem_Free(codestr); PyMem_Free(blocks); Modified: python/branches/tlee-ast-optimize/Python/pystrtod.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pystrtod.c (original) +++ python/branches/tlee-ast-optimize/Python/pystrtod.c Mon Jun 9 12:52:48 2008 @@ -364,7 +364,7 @@ /* At this point, p points just past the right-most character we want to format. We need to add the grouping string for the characters between buffer and p. */ - return _PyBytes_InsertThousandsGrouping(buffer, len, p, + return _PyString_InsertThousandsGrouping(buffer, len, p, buf_size, NULL, 1); } Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Mon Jun 9 12:52:48 2008 @@ -497,7 +497,7 @@ PyTuple_Fini(); PyList_Fini(); PySet_Fini(); - PyBytes_Fini(); + PyString_Fini(); PyByteArray_Fini(); PyInt_Fini(); PyFloat_Fini(); @@ -746,12 +746,12 @@ } v = PySys_GetObject("ps1"); if (v == NULL) { - PySys_SetObject("ps1", v = PyBytes_FromString(">>> ")); + PySys_SetObject("ps1", v = PyString_FromString(">>> ")); Py_XDECREF(v); } v = PySys_GetObject("ps2"); if (v == NULL) { - PySys_SetObject("ps2", v = PyBytes_FromString("... ")); + PySys_SetObject("ps2", v = PyString_FromString("... ")); Py_XDECREF(v); } for (;;) { @@ -798,16 +798,16 @@ v = PyObject_Str(v); if (v == NULL) PyErr_Clear(); - else if (PyBytes_Check(v)) - ps1 = PyBytes_AsString(v); + else if (PyString_Check(v)) + ps1 = PyString_AsString(v); } w = PySys_GetObject("ps2"); if (w != NULL) { w = PyObject_Str(w); if (w == NULL) PyErr_Clear(); - else if (PyBytes_Check(w)) - ps2 = PyBytes_AsString(w); + else if (PyString_Check(w)) + ps2 = PyString_AsString(w); } arena = PyArena_New(); if (arena == NULL) { @@ -900,7 +900,7 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, "__file__") == NULL) { - PyObject *f = PyBytes_FromString(filename); + PyObject *f = PyString_FromString(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, "__file__", f) < 0) { @@ -984,7 +984,7 @@ goto finally; if (v == Py_None) *filename = NULL; - else if (! (*filename = PyBytes_AsString(v))) + else if (! (*filename = PyString_AsString(v))) goto finally; Py_DECREF(v); @@ -1016,7 +1016,7 @@ goto finally; if (v == Py_None) *text = NULL; - else if (! (*text = PyBytes_AsString(v))) + else if (! (*text = PyString_AsString(v))) goto finally; Py_DECREF(v); return 1; @@ -1239,7 +1239,7 @@ if (moduleName == NULL) err = PyFile_WriteString("", f); else { - char* modstr = PyBytes_AsString(moduleName); + char* modstr = PyString_AsString(moduleName); if (modstr && strcmp(modstr, "exceptions")) { err = PyFile_WriteString(modstr, f); @@ -1263,8 +1263,8 @@ */ if (s == NULL) err = -1; - else if (!PyBytes_Check(s) || - PyBytes_GET_SIZE(s) != 0) + else if (!PyString_Check(s) || + PyString_GET_SIZE(s) != 0) err = PyFile_WriteString(": ", f); if (err == 0) err = PyFile_WriteObject(s, f, Py_PRINT_RAW); @@ -1623,7 +1623,7 @@ if (value != NULL) { u = PyObject_Str(value); if (u != NULL) { - msg = PyBytes_AsString(u); + msg = PyString_AsString(u); } } if (msg == NULL) Modified: python/branches/tlee-ast-optimize/Python/structmember.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/structmember.c (original) +++ python/branches/tlee-ast-optimize/Python/structmember.c Mon Jun 9 12:52:48 2008 @@ -16,7 +16,7 @@ if (v != NULL) { for (i = 0; i < n; i++) PyList_SetItem(v, i, - PyBytes_FromString(mlist[i].name)); + PyString_FromString(mlist[i].name)); if (PyErr_Occurred()) { Py_DECREF(v); v = NULL; @@ -103,13 +103,13 @@ v = Py_None; } else - v = PyBytes_FromString(*(char**)addr); + v = PyString_FromString(*(char**)addr); break; case T_STRING_INPLACE: - v = PyBytes_FromString((char*)addr); + v = PyString_FromString((char*)addr); break; case T_CHAR: - v = PyBytes_FromStringAndSize((char*)addr, 1); + v = PyString_FromStringAndSize((char*)addr, 1); break; case T_OBJECT: v = *(PyObject **)addr; @@ -310,8 +310,8 @@ Py_XDECREF(oldv); break; case T_CHAR: - if (PyBytes_Check(v) && PyBytes_Size(v) == 1) { - *(char*)addr = PyBytes_AsString(v)[0]; + if (PyString_Check(v) && PyString_Size(v) == 1) { + *(char*)addr = PyString_AsString(v)[0]; } else { PyErr_BadArgument(); Modified: python/branches/tlee-ast-optimize/Python/symtable.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/symtable.c (original) +++ python/branches/tlee-ast-optimize/Python/symtable.c Mon Jun 9 12:52:48 2008 @@ -87,9 +87,9 @@ PyOS_snprintf(buf, sizeof(buf), "", - PyBytes_AS_STRING(ste->ste_name), + PyString_AS_STRING(ste->ste_name), PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); - return PyBytes_FromString(buf); + return PyString_FromString(buf); } static void @@ -180,7 +180,7 @@ static identifier top = NULL, lambda = NULL, genexpr = NULL; #define GET_IDENTIFIER(VAR) \ - ((VAR) ? (VAR) : ((VAR) = PyBytes_InternFromString(# VAR))) + ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) #define DUPLICATE_ARGUMENT \ "duplicate argument '%s' in function definition" @@ -372,7 +372,7 @@ if (flags & DEF_PARAM) { PyErr_Format(PyExc_SyntaxError, "name '%s' is local and global", - PyBytes_AS_STRING(name)); + PyString_AS_STRING(name)); return 0; } SET_SCOPE(dict, name, GLOBAL_EXPLICIT); @@ -487,19 +487,19 @@ PyOS_snprintf(buf, sizeof(buf), "import * is not allowed in function '%.100s' " "because it is %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; case OPT_BARE_EXEC: PyOS_snprintf(buf, sizeof(buf), "unqualified exec is not allowed in function " "'%.100s' it %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; default: PyOS_snprintf(buf, sizeof(buf), "function '%.100s' uses import * and bare exec, " "which are illegal because it %s", - PyBytes_AS_STRING(ste->ste_name), trailer); + PyString_AS_STRING(ste->ste_name), trailer); break; } @@ -800,7 +800,7 @@ if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { /* Is it better to use 'mangled' or 'name' here? */ PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, - PyBytes_AsString(name)); + PyString_AsString(name)); PyErr_SyntaxLocation(st->st_filename, st->st_cur->ste_lineno); goto error; @@ -914,7 +914,7 @@ PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++st->st_cur->ste_tmpname); - tmp = PyBytes_InternFromString(tmpname); + tmp = PyString_InternFromString(tmpname); if (!tmp) return 0; if (!symtable_add_def(st, tmp, DEF_LOCAL)) @@ -1065,7 +1065,7 @@ asdl_seq *seq = s->v.Global.names; for (i = 0; i < asdl_seq_LEN(seq); i++) { identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyBytes_AS_STRING(name); + char *c_name = PyString_AS_STRING(name); long cur = symtable_lookup(st, name); if (cur < 0) return 0; @@ -1219,7 +1219,7 @@ static int symtable_implicit_arg(struct symtable *st, int pos) { - PyObject *id = PyBytes_FromFormat(".%d", pos); + PyObject *id = PyString_FromFormat(".%d", pos); if (id == NULL) return 0; if (!symtable_add_def(st, id, DEF_PARAM)) { @@ -1327,10 +1327,10 @@ */ PyObject *store_name; PyObject *name = (a->asname == NULL) ? a->name : a->asname; - const char *base = PyBytes_AS_STRING(name); + const char *base = PyString_AS_STRING(name); char *dot = strchr(base, '.'); if (dot) { - store_name = PyBytes_FromStringAndSize(base, dot - base); + store_name = PyString_FromStringAndSize(base, dot - base); if (!store_name) return 0; } @@ -1338,7 +1338,7 @@ store_name = name; Py_INCREF(store_name); } - if (strcmp(PyBytes_AS_STRING(name), "*")) { + if (strcmp(PyString_AS_STRING(name), "*")) { int r = symtable_add_def(st, store_name, DEF_IMPORT); Py_DECREF(store_name); return r; Modified: python/branches/tlee-ast-optimize/Python/sysmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/sysmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/sysmodule.c Mon Jun 9 12:52:48 2008 @@ -229,7 +229,7 @@ static PyObject * sys_getdefaultencoding(PyObject *self) { - return PyBytes_FromString(PyUnicode_GetDefaultEncoding()); + return PyString_FromString(PyUnicode_GetDefaultEncoding()); } PyDoc_STRVAR(getdefaultencoding_doc, @@ -261,7 +261,7 @@ sys_getfilesystemencoding(PyObject *self) { if (Py_FileSystemDefaultEncoding) - return PyBytes_FromString(Py_FileSystemDefaultEncoding); + return PyString_FromString(Py_FileSystemDefaultEncoding); Py_INCREF(Py_None); return Py_None; } @@ -290,7 +290,7 @@ int i; for (i = 0; i < 7; ++i) { if (whatstrings[i] == NULL) { - name = PyBytes_InternFromString(whatnames[i]); + name = PyString_InternFromString(whatnames[i]); if (name == NULL) return -1; whatstrings[i] = name; @@ -931,7 +931,7 @@ if (list == NULL) return NULL; for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - PyObject *name = PyBytes_FromString( + PyObject *name = PyString_FromString( PyImport_Inittab[i].name); if (name == NULL) break; @@ -971,7 +971,7 @@ if (warnoptions == NULL) return; } - str = PyBytes_FromString(s); + str = PyString_FromString(s); if (str != NULL) { PyList_Append(warnoptions, str); Py_DECREF(str); @@ -1327,7 +1327,7 @@ Py_XDECREF(syserr); SET_SYS_FROM_STRING("version", - PyBytes_FromString(Py_GetVersion())); + PyString_FromString(Py_GetVersion())); SET_SYS_FROM_STRING("hexversion", PyInt_FromLong(PY_VERSION_HEX)); svnversion_init(); @@ -1358,15 +1358,15 @@ SET_SYS_FROM_STRING("api_version", PyInt_FromLong(PYTHON_API_VERSION)); SET_SYS_FROM_STRING("copyright", - PyBytes_FromString(Py_GetCopyright())); + PyString_FromString(Py_GetCopyright())); SET_SYS_FROM_STRING("platform", - PyBytes_FromString(Py_GetPlatform())); + PyString_FromString(Py_GetPlatform())); SET_SYS_FROM_STRING("executable", - PyBytes_FromString(Py_GetProgramFullPath())); + PyString_FromString(Py_GetProgramFullPath())); SET_SYS_FROM_STRING("prefix", - PyBytes_FromString(Py_GetPrefix())); + PyString_FromString(Py_GetPrefix())); SET_SYS_FROM_STRING("exec_prefix", - PyBytes_FromString(Py_GetExecPrefix())); + PyString_FromString(Py_GetExecPrefix())); SET_SYS_FROM_STRING("maxsize", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); SET_SYS_FROM_STRING("maxint", @@ -1393,13 +1393,13 @@ else value = "little"; SET_SYS_FROM_STRING("byteorder", - PyBytes_FromString(value)); + PyString_FromString(value)); } #ifdef MS_COREDLL SET_SYS_FROM_STRING("dllhandle", PyLong_FromVoidPtr(PyWin_DLLhModule)); SET_SYS_FROM_STRING("winver", - PyBytes_FromString(PyWin_DLLVersionString)); + PyString_FromString(PyWin_DLLVersionString)); #endif if (warnoptions == NULL) { warnoptions = PyList_New(0); @@ -1444,7 +1444,7 @@ p = strchr(path, delim); if (p == NULL) p = strchr(path, '\0'); /* End of string */ - w = PyBytes_FromStringAndSize(path, (Py_ssize_t) (p - path)); + w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); if (w == NULL) { Py_DECREF(v); return NULL; @@ -1489,14 +1489,14 @@ if (i == 0) { char* fn = decc$translate_vms(argv[0]); if ((fn == (char *)0) || fn == (char *)-1) - v = PyBytes_FromString(argv[0]); + v = PyString_FromString(argv[0]); else - v = PyBytes_FromString( + v = PyString_FromString( decc$translate_vms(argv[0])); } else - v = PyBytes_FromString(argv[i]); + v = PyString_FromString(argv[i]); #else - PyObject *v = PyBytes_FromString(argv[i]); + PyObject *v = PyString_FromString(argv[i]); #endif if (v == NULL) { Py_DECREF(av); @@ -1600,7 +1600,7 @@ #endif /* Unix */ } #endif /* All others */ - a = PyBytes_FromStringAndSize(argv0, n); + a = PyString_FromStringAndSize(argv0, n); if (a == NULL) Py_FatalError("no mem for sys.path insertion"); if (PyList_Insert(path, 0, a) < 0) Modified: python/branches/tlee-ast-optimize/Python/traceback.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/traceback.c (original) +++ python/branches/tlee-ast-optimize/Python/traceback.c Mon Jun 9 12:52:48 2008 @@ -155,12 +155,12 @@ PyErr_Clear(); break; } - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { size_t len; - len = PyBytes_GET_SIZE(v); + len = PyString_GET_SIZE(v); if (len + 1 + taillen >= MAXPATHLEN) continue; /* Too long */ - strcpy(namebuf, PyBytes_AsString(v)); + strcpy(namebuf, PyString_AsString(v)); if (strlen(namebuf) != len) continue; /* v contains '\0' */ if (len > 0 && namebuf[len-1] != SEP) @@ -238,10 +238,10 @@ while (tb != NULL && err == 0) { if (depth <= limit) { err = tb_displayline(f, - PyBytes_AsString( + PyString_AsString( tb->tb_frame->f_code->co_filename), tb->tb_lineno, - PyBytes_AsString(tb->tb_frame->f_code->co_name)); + PyString_AsString(tb->tb_frame->f_code->co_name)); } depth--; tb = tb->tb_next; Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/drawfmodule.c Mon Jun 9 12:52:48 2008 @@ -333,7 +333,7 @@ char *dtable; if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyBytes_Size(value); + { int m=PyString_Size(value); if(m<0||!PyInt_Check(key)) return NULL; size+=m+2; } @@ -350,9 +350,9 @@ memset(dtable,0,size-8); n=0; while(PyDict_Next(d,&n,&key,&value)) - { int m=PyBytes_Size(value); + { int m=PyString_Size(value); *dtable=(char)PyInt_AsLong(key); - strcpy(dtable+1,PyBytes_AsString(value)); + strcpy(dtable+1,PyString_AsString(value)); dtable+=m+2; } Py_INCREF(Py_None);return Py_None; @@ -609,8 +609,8 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(2); if (list) - { PyList_SetItem(list, 0, PyBytes_FromString("size")); - PyList_SetItem(list, 1, PyBytes_FromString("start")); + { PyList_SetItem(list, 0, PyString_FromString("size")); + PyList_SetItem(list, 1, PyString_FromString("start")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -659,6 +659,6 @@ { PyObject *m, *d; m = Py_InitModule("drawf", DrawFMethods); d = PyModule_GetDict(m); - DrawFError=PyBytes_FromString("drawf.error"); + DrawFError=PyString_FromString("drawf.error"); PyDict_SetItemString(d,"error",DrawFError); } Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/riscosmodule.c Mon Jun 9 12:52:48 2008 @@ -79,9 +79,9 @@ char *buf; e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); if(e) return riscos_oserror(); - obj=PyBytes_FromStringAndSize(NULL,-len); + obj=PyString_FromStringAndSize(NULL,-len); if(obj==NULL) return NULL; - buf=PyBytes_AsString(obj); + buf=PyString_AsString(obj); e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); if(len!=1) return riscos_error("Error expanding path"); if(!e) return obj; @@ -131,7 +131,7 @@ { Py_DECREF(d);return riscos_oserror(); } if(count) - { v=PyBytes_FromString(buf); + { v=PyString_FromString(buf); if(!v) { Py_DECREF(d);return 0;} if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} } @@ -320,7 +320,7 @@ char *name,*value; if(!PyArg_ParseTuple(args,"s:getenv",&name)) return NULL; value=getenv(name); - if(value) return PyBytes_FromString(value); + if(value) return PyString_FromString(value); Py_INCREF(Py_None); return Py_None; } @@ -371,7 +371,7 @@ os_VARTYPE_EXPANDED,&size,(int *)&context,0)) { PyObject *v; value[size]='\0'; - v = PyBytes_FromString(value); + v = PyString_FromString(value); if (v == NULL) continue; PyDict_SetItemString(dict, context, v); Py_DECREF(v); Modified: python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c ============================================================================== --- python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c (original) +++ python/branches/tlee-ast-optimize/RISCOS/Modules/swimodule.c Mon Jun 9 12:52:48 2008 @@ -66,10 +66,10 @@ b->length=4*size; b->heap=1; if(init) - { if(PyBytes_Check(init)) - { int n=PyBytes_Size(init); + { if(PyString_Check(init)) + { int n=PyString_Size(init); if (n>4*size) n=4*size; - memcpy(b->block,PyBytes_AsString(init),n); + memcpy(b->block,PyString_AsString(init),n); memset((char*)b->block+n,0,4*size-n); } else @@ -113,7 +113,7 @@ { PyErr_SetString(PyExc_IndexError,"block index out of range"); return NULL; } - return PyBytes_FromStringAndSize((char*)self->block+s,e-s); + return PyString_FromStringAndSize((char*)self->block+s,e-s); } static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) @@ -125,7 +125,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyString_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) @@ -137,7 +137,7 @@ return NULL; } for(i=s;iblock+s,i-s); + return PyString_FromStringAndSize((char*)self->block+s,i-s); } static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) @@ -296,9 +296,9 @@ if (!strcmp(name, "__members__")) { PyObject *list = PyList_New(3); if (list) - { PyList_SetItem(list, 0, PyBytes_FromString("length")); - PyList_SetItem(list, 1, PyBytes_FromString("start")); - PyList_SetItem(list, 2, PyBytes_FromString("end")); + { PyList_SetItem(list, 0, PyString_FromString("length")); + PyList_SetItem(list, 1, PyString_FromString("start")); + PyList_SetItem(list, 2, PyString_FromString("end")); if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} } return list; @@ -402,7 +402,7 @@ for(;*fmt;fmt++) { switch(*fmt) { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; - case 's':v=PyBytes_FromString((char*)(r.r[rno++])); break; + case 's':v=PyString_FromString((char*)(r.r[rno++])); break; case '.':rno++; continue; case '*':v=PyInt_FromLong((long)carry); break; } @@ -421,7 +421,7 @@ if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL; if (l==-1) l = strlen(s); - return PyBytes_FromStringAndSize((char*)s, l); + return PyString_FromStringAndSize((char*)s, l); } static char swi_string__doc__[] = From python-checkins at python.org Mon Jun 9 13:24:49 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 9 Jun 2008 13:24:49 +0200 (CEST) Subject: [Python-checkins] r64054 - python/trunk/Modules/mathmodule.c Message-ID: <20080609112449.17B731E4004@bag.python.org> Author: raymond.hettinger Date: Mon Jun 9 13:24:47 2008 New Revision: 64054 Log: Unhappy buildbots. Revert 64052. Long doubles have unexpected effects on some builds. Modified: python/trunk/Modules/mathmodule.c Modified: python/trunk/Modules/mathmodule.c ============================================================================== --- python/trunk/Modules/mathmodule.c (original) +++ python/trunk/Modules/mathmodule.c Mon Jun 9 13:24:47 2008 @@ -324,12 +324,17 @@ Note 3: The itermediate values lo, yr, and hi are declared volatile so aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. + Also, the volatile declaration forces the values to be stored in memory as + regular doubles instead of extended long precision (80-bit) values. This + prevents double rounding because any addition or substraction of two doubles + can be resolved exactly into double-sized hi and lo values. As long as the + hi value gets forced into a double before yr and lo are computed, the extra + bits in downstream extended precision operations (x87 for example) will be + exactly zero and therefore can be losslessly stored back into a double, + thereby preventing double rounding. - Note 4: Intermediate values and partial sums are declared as long doubles - as a way to eliminate double rounding environments where the operations - are carried-out in extended precision but stored in double precision - variables. In some cases, this doesn't help because the compiler - treats long doubles as doubles (i.e. the MS compiler for Win32 builds). + Note 4: A similar implementation is in Modules/cmathmodule.c. + Be sure to update both when making changes. Note 5: The signature of math.sum() differs from __builtin__.sum() because the start argument doesn't make sense in the context of @@ -342,28 +347,28 @@ /* Extend the partials array p[] by doubling its size. */ static int /* non-zero on error */ -_sum_realloc(long double **p_ptr, Py_ssize_t n, - long double *ps, Py_ssize_t *m_ptr) +_sum_realloc(double **p_ptr, Py_ssize_t n, + double *ps, Py_ssize_t *m_ptr) { void *v = NULL; Py_ssize_t m = *m_ptr; - m += m; /* long double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(long double))) { - long double *p = *p_ptr; + m += m; /* double */ + if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { + double *p = *p_ptr; if (p == ps) { - v = PyMem_Malloc(sizeof(long double) * m); + v = PyMem_Malloc(sizeof(double) * m); if (v != NULL) - memcpy(v, ps, sizeof(long double) * n); + memcpy(v, ps, sizeof(double) * n); } else - v = PyMem_Realloc(p, sizeof(long double) * m); + v = PyMem_Realloc(p, sizeof(double) * m); } if (v == NULL) { /* size overflow or no memory */ PyErr_SetString(PyExc_MemoryError, "math sum partials"); return 1; } - *p_ptr = (long double*) v; + *p_ptr = (double*) v; *m_ptr = m; return 0; } @@ -403,8 +408,8 @@ { PyObject *item, *iter, *sum = NULL; Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - long double x, y, t, ps[NUM_PARTIALS], *p = ps; - volatile long double hi, yr, lo; + double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile double hi, yr, lo; iter = PyObject_GetIter(seq); if (iter == NULL) @@ -423,7 +428,7 @@ goto _sum_error; break; } - x = (long double)PyFloat_AsDouble(item); + x = PyFloat_AsDouble(item); Py_DECREF(item); if (PyErr_Occurred()) goto _sum_error; @@ -490,7 +495,7 @@ goto _sum_error; } } - sum = PyFloat_FromDouble((double)hi); + sum = PyFloat_FromDouble(hi); _sum_error: PyFPE_END_PROTECT(hi) @@ -507,7 +512,6 @@ Return an accurate floating point sum of values in the iterable.\n\ Assumes IEEE-754 floating point arithmetic."); - static PyObject * math_factorial(PyObject *self, PyObject *arg) { From python-checkins at python.org Mon Jun 9 15:07:28 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 9 Jun 2008 15:07:28 +0200 (CEST) Subject: [Python-checkins] r64055 - in python/trunk: Doc/library/stdtypes.rst Lib/test/test_set.py Misc/NEWS Objects/setobject.c Message-ID: <20080609130728.11D131E4004@bag.python.org> Author: raymond.hettinger Date: Mon Jun 9 15:07:27 2008 New Revision: 64055 Log: Let set.intersection() and set.intersection_update() take multiple input arguments. Modified: python/trunk/Doc/library/stdtypes.rst python/trunk/Lib/test/test_set.py python/trunk/Misc/NEWS python/trunk/Objects/setobject.c Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Mon Jun 9 15:07:27 2008 @@ -1575,11 +1575,14 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: intersection(other) - set & other + .. method:: intersection(other, ...) + set & other & ... Return a new set with elements common to both sets. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: difference(other) set - other @@ -1639,11 +1642,14 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: intersection_update(other) - set &= other + .. method:: intersection_update(other, ...) + set &= other & ... Update the set, keeping only elements found in it and *other*. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: difference_update(other) set -= other Modified: python/trunk/Lib/test/test_set.py ============================================================================== --- python/trunk/Lib/test/test_set.py (original) +++ python/trunk/Lib/test/test_set.py Mon Jun 9 15:07:27 2008 @@ -103,6 +103,7 @@ self.assertEqual(self.thetype('abcba').intersection(C('efgfe')), set('')) self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) self.assertEqual(self.thetype('abcba').intersection(C('ef')), set('')) + self.assertEqual(self.thetype('abcba').intersection(C('cbcf'), C('bag')), set('b')) def test_isdisjoint(self): def f(s1, s2): @@ -429,6 +430,11 @@ s = self.thetype('abcba') self.assertEqual(s.intersection_update(C(p)), None) self.assertEqual(s, set(q)) + ss = 'abcba' + s = self.thetype(ss) + t = 'cbc' + self.assertEqual(s.intersection_update(C(p), C(t)), None) + self.assertEqual(s, set('abcba')&set(p)&set(t)) def test_iand(self): self.s &= set(self.otherword) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 9 15:07:27 2008 @@ -12,7 +12,8 @@ Core and Builtins ----------------- -- The set methods, update() and union() now accept multiple arguments. +- Several set methods now accept multiple arguments: update(), union(), + intersection() and intersection_update(). - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Mon Jun 9 15:07:27 2008 @@ -1306,6 +1306,26 @@ return (PyObject *)result; } +static PyObject * +set_intersection_multi(PySetObject *so, PyObject *args) +{ + Py_ssize_t i; + PyObject *result = (PyObject *)so; + + Py_INCREF(so); + for (i=0 ; i Author: thomas.lee Date: Mon Jun 9 16:00:44 2008 New Revision: 64056 Log: Remove some tests that are no longer relevant with the new AST optimizer in place. Modified: python/branches/tlee-ast-optimize/Lib/test/test_peepholer.py Modified: python/branches/tlee-ast-optimize/Lib/test/test_peepholer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_peepholer.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_peepholer.py Mon Jun 9 16:00:44 2008 @@ -18,17 +18,6 @@ class TestTranforms(unittest.TestCase): - def test_unot(self): - # UNARY_NOT JUMP_IF_FALSE POP_TOP --> JUMP_IF_TRUE POP_TOP' - def unot(x): - if not x == 2: - del x - asm = disassemble(unot) - for elem in ('UNARY_NOT', 'JUMP_IF_FALSE'): - self.assert_(elem not in asm) - for elem in ('JUMP_IF_TRUE', 'POP_TOP'): - self.assert_(elem in asm) - def test_elim_inversion_of_is_or_in(self): for line, elem in ( ('not a is b', '(is not)',), @@ -39,22 +28,6 @@ asm = dis_single(line) self.assert_(elem in asm) - def test_none_as_constant(self): - # LOAD_GLOBAL None --> LOAD_CONST None - def f(x): - None - return x - asm = disassemble(f) - for elem in ('LOAD_GLOBAL',): - self.assert_(elem not in asm) - for elem in ('LOAD_CONST', '(None)'): - self.assert_(elem in asm) - def f(): - 'Adding a docstring made this test fail in Py2.5.0' - return None - self.assert_('LOAD_CONST' in disassemble(f)) - self.assert_('LOAD_GLOBAL' not in disassemble(f)) - def test_while_one(self): # Skip over: LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP def f(): @@ -78,44 +51,6 @@ self.assert_('BUILD_TUPLE' not in asm) self.assert_('UNPACK_TUPLE' not in asm) - def test_folding_of_tuples_of_constants(self): - for line, elem in ( - ('a = 1,2,3', '((1, 2, 3))'), - ('("a","b","c")', "(('a', 'b', 'c'))"), - ('a,b,c = 1,2,3', '((1, 2, 3))'), - ('(None, 1, None)', '((None, 1, None))'), - ('((1, 2), 3, 4)', '(((1, 2), 3, 4))'), - ): - asm = dis_single(line) - self.assert_(elem in asm) - self.assert_('BUILD_TUPLE' not in asm) - - # Bug 1053819: Tuple of constants misidentified when presented with: - # . . . opcode_with_arg 100 unary_opcode BUILD_TUPLE 1 . . . - # The following would segfault upon compilation - def crater(): - (~[ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - ],) - - def test_elim_extra_return(self): - # RETURN LOAD_CONST None RETURN --> RETURN - def f(x): - return x - asm = disassemble(f) - self.assert_('LOAD_CONST' not in asm) - self.assert_('(None)' not in asm) - self.assertEqual(asm.split().count('RETURN_VALUE'), 1) - def test_elim_jump_to_return(self): # JUMP_FORWARD to RETURN --> RETURN def f(cond, true_value, false_value): From skip at pobox.com Mon Jun 9 18:12:37 2008 From: skip at pobox.com (skip at pobox.com) Date: Mon, 9 Jun 2008 11:12:37 -0500 Subject: [Python-checkins] r63965 - python/trunk/Lib/tokenize.py In-Reply-To: <1afaf6160806051554o1c6254c4h4fd3c0501aab2a91@mail.gmail.com> References: <20080605223934.EC04E1E4004@bag.python.org> <3AB916E21C864CA39F033302C6FE4B7C@RaymondLaptop1> <1afaf6160806051554o1c6254c4h4fd3c0501aab2a91@mail.gmail.com> Message-ID: <18509.22133.533602.713157@montanaro-dyndns-org.local> Benjamin> Thanks for letting me know. It's still using while 1 in Benjamin> 3.0. Shall I revert the 2.6 revision, and change it in 3.0? That would seem to make sense. Python 2.6: >>> import dis >>> def while1(): ... while 1: ... pass ... >>> dis.dis(while1) 2 0 SETUP_LOOP 3 (to 6) 3 >> 3 JUMP_ABSOLUTE 3 >> 6 LOAD_CONST 0 (None) 9 RETURN_VALUE >>> def whileTrue(): ... while True: ... pass ... >>> dis.dis(whileTrue) 2 0 SETUP_LOOP 12 (to 15) >> 3 LOAD_GLOBAL 0 (True) 6 JUMP_IF_FALSE 4 (to 13) 9 POP_TOP 3 10 JUMP_ABSOLUTE 3 >> 13 POP_TOP 14 POP_BLOCK >> 15 LOAD_CONST 0 (None) 18 RETURN_VALUE Python 3.0: >>> import dis >>> def while1(): ... while 1: ... pass ... >>> dis.dis(while1) 2 0 SETUP_LOOP 3 (to 6) 3 >> 3 JUMP_ABSOLUTE 3 >> 6 LOAD_CONST 0 (None) 9 RETURN_VALUE >>> def whileTrue(): ... while True: ... pass ... >>> dis.dis(whileTrue) 2 0 SETUP_LOOP 3 (to 6) 3 >> 3 JUMP_ABSOLUTE 3 >> 6 LOAD_CONST 0 (None) 9 RETURN_VALUE Skip From python-checkins at python.org Tue Jun 10 05:34:54 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Tue, 10 Jun 2008 05:34:54 +0200 (CEST) Subject: [Python-checkins] r64057 - in python/trunk: Lib/test/test_xrange.py Objects/rangeobject.c Message-ID: <20080610033454.3CC7D1E4002@bag.python.org> Author: alexandre.vassalotti Date: Tue Jun 10 05:34:53 2008 New Revision: 64057 Log: Issue 2582: Fix pickling of xrange objects. Modified: python/trunk/Lib/test/test_xrange.py python/trunk/Objects/rangeobject.c Modified: python/trunk/Lib/test/test_xrange.py ============================================================================== --- python/trunk/Lib/test/test_xrange.py (original) +++ python/trunk/Lib/test/test_xrange.py Tue Jun 10 05:34:53 2008 @@ -57,6 +57,16 @@ self.assertEqual(len(r), sys.maxint) self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2) + def test_getnewargs(self): + def test(*args): + r = xrange(*args) + return list(r) == list(xrange(*r.__getnewargs__())) + tests = [(13,), (0, 11), (-22, 10), (20, 3, -1), + (13, 21, 3), (-2, 2, 2)] + for t in tests: + self.assert_(test(*t), + "xrange.__getnewargs__() failed with %r" % (t,)) + def test_main(): test.test_support.run_unittest(XrangeTest) Modified: python/trunk/Objects/rangeobject.c ============================================================================== --- python/trunk/Objects/rangeobject.c (original) +++ python/trunk/Objects/rangeobject.c Tue Jun 10 05:34:53 2008 @@ -129,6 +129,16 @@ return rtn; } +/* Pickling support */ +static PyObject * +range_getnewargs(rangeobject *r) +{ + return Py_BuildValue("(iii)", + r->start, + r->start + r->len * r->step, + r->step); +} + static PySequenceMethods range_as_sequence = { (lenfunc)range_length, /* sq_length */ 0, /* sq_concat */ @@ -145,6 +155,7 @@ static PyMethodDef range_methods[] = { {"__reversed__", (PyCFunction)range_reverse, METH_NOARGS, reverse_doc}, + {"__getnewargs__", (PyCFunction)range_getnewargs, METH_NOARGS}, {NULL, NULL} /* sentinel */ }; From buildbot at python.org Tue Jun 10 05:58:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 03:58:24 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080610035824.2ED101E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3184 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpftOIF4/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 06:01:23 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Tue, 10 Jun 2008 06:01:23 +0200 (CEST) Subject: [Python-checkins] r64058 - in python/trunk: Lib/test/test_xrange.py Objects/rangeobject.c Message-ID: <20080610040123.BE6581E4004@bag.python.org> Author: alexandre.vassalotti Date: Tue Jun 10 06:01:23 2008 New Revision: 64058 Log: Added better pickling support to xrange objects. Cleaned up the unit test. Modified: python/trunk/Lib/test/test_xrange.py python/trunk/Objects/rangeobject.c Modified: python/trunk/Lib/test/test_xrange.py ============================================================================== --- python/trunk/Lib/test/test_xrange.py (original) +++ python/trunk/Lib/test/test_xrange.py Tue Jun 10 06:01:23 2008 @@ -2,6 +2,7 @@ import test.test_support, unittest import sys +import pickle import warnings warnings.filterwarnings("ignore", "integer argument expected", @@ -57,15 +58,15 @@ self.assertEqual(len(r), sys.maxint) self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2) - def test_getnewargs(self): - def test(*args): - r = xrange(*args) - return list(r) == list(xrange(*r.__getnewargs__())) - tests = [(13,), (0, 11), (-22, 10), (20, 3, -1), - (13, 21, 3), (-2, 2, 2)] - for t in tests: - self.assert_(test(*t), - "xrange.__getnewargs__() failed with %r" % (t,)) + def test_pickling(self): + testcases = [(13,), (0, 11), (-22, 10), (20, 3, -1), + (13, 21, 3), (-2, 2, 2)] + for proto in range(pickle.HIGHEST_PROTOCOL): + for t in testcases: + r = xrange(*t) + self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), + list(r)) + def test_main(): test.test_support.run_unittest(XrangeTest) Modified: python/trunk/Objects/rangeobject.c ============================================================================== --- python/trunk/Objects/rangeobject.c (original) +++ python/trunk/Objects/rangeobject.c Tue Jun 10 06:01:23 2008 @@ -131,9 +131,9 @@ /* Pickling support */ static PyObject * -range_getnewargs(rangeobject *r) +range_reduce(rangeobject *r, PyObject *args) { - return Py_BuildValue("(iii)", + return Py_BuildValue("(O(iii))", Py_TYPE(r), r->start, r->start + r->len * r->step, r->step); @@ -155,7 +155,7 @@ static PyMethodDef range_methods[] = { {"__reversed__", (PyCFunction)range_reverse, METH_NOARGS, reverse_doc}, - {"__getnewargs__", (PyCFunction)range_getnewargs, METH_NOARGS}, + {"__reduce__", (PyCFunction)range_reduce, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; From buildbot at python.org Tue Jun 10 06:28:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 04:28:17 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080610042818.1E7A11E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/88 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: alexandre.vassalotti BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 06:29:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 04:29:43 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080610042944.0D3311E4002@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/103 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: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 07:00:08 2008 From: python-checkins at python.org (josiah.carlson) Date: Tue, 10 Jun 2008 07:00:08 +0200 (CEST) Subject: [Python-checkins] r64062 - in python/trunk: Doc/library/asynchat.rst Doc/library/asyncore.rst Lib/asynchat.py Lib/asyncore.py Lib/test/test_asyncore.py Message-ID: <20080610050008.EB48A1E4002@bag.python.org> Author: josiah.carlson Date: Tue Jun 10 07:00:08 2008 New Revision: 64062 Log: Applying updated patch from Issue 1736190, which addresses partial issues in: 909005 and 17361001, as well as completely as possible issues 539444, 760475, 777588, 889153, 953599, 1025525, 1063924, and 658749. This patch also includes doc and test updates as necessary. Modified: python/trunk/Doc/library/asynchat.rst python/trunk/Doc/library/asyncore.rst python/trunk/Lib/asynchat.py python/trunk/Lib/asyncore.py python/trunk/Lib/test/test_asyncore.py Modified: python/trunk/Doc/library/asynchat.rst ============================================================================== --- python/trunk/Doc/library/asynchat.rst (original) +++ python/trunk/Doc/library/asynchat.rst Tue Jun 10 07:00:08 2008 @@ -81,6 +81,12 @@ :exc:`NotImplementedError` exception. +.. method:: async_chat._collect_incoming_data(data) + + Sample implementation of a data collection rutine to be used in conjunction + with :meth:`_get_data` in a user-specified :meth:`found_terminator`. + + .. method:: async_chat.discard_buffers() In emergencies this method will discard any data held in the input and/or @@ -95,6 +101,12 @@ should be available via an instance attribute. +.. method:: async_chat._get_data() + + Will return and clear the data received with the sample + :meth:`_collect_incoming_data` implementation. + + .. method:: async_chat.get_terminator() Returns the current terminator for the channel. Modified: python/trunk/Doc/library/asyncore.rst ============================================================================== --- python/trunk/Doc/library/asyncore.rst (original) +++ python/trunk/Doc/library/asyncore.rst Tue Jun 10 07:00:08 2008 @@ -222,6 +222,20 @@ flushed). Sockets are automatically closed when they are garbage-collected. +.. class:: file_dispatcher() + A file_dispatcher takes a file descriptor or file object along with an + optional map argument and wraps it for use with the :cfunc:`poll`\ or + :cfunc:`loop`\ functions. If provided a file object or anything with a + :cfunc:`fileno`\ method, that method will be called and passed to the + :class:`file_wrapper` constructor. + Availability: UNIX + +.. class::file_wrapper() + A file_wrapper takes an integer file descriptor and calls os.dup() to + duplicate the handle so that the original handle may be closed independently + of the file_wrapper. This class implements sufficient methods to emulate a + socket for use by the file_dispatcher class. + Availability: UNIX .. _asyncore-example: Modified: python/trunk/Lib/asynchat.py ============================================================================== --- python/trunk/Lib/asynchat.py (original) +++ python/trunk/Lib/asynchat.py Tue Jun 10 07:00:08 2008 @@ -60,16 +60,35 @@ ac_out_buffer_size = 4096 def __init__ (self, conn=None): + # for string terminator matching self.ac_in_buffer = '' - self.ac_out_buffer = '' - self.producer_fifo = fifo() + + # we use a list here rather than cStringIO for a few reasons... + # del lst[:] is faster than sio.truncate(0) + # lst = [] is faster than sio.truncate(0) + # cStringIO will be gaining unicode support in py3k, which + # will negatively affect the performance of bytes compared to + # a ''.join() equivalent + self.incoming = [] + + # we toss the use of the "simple producer" and replace it with + # a pure deque, which the original fifo was a wrapping of + self.producer_fifo = deque() asyncore.dispatcher.__init__ (self, conn) def collect_incoming_data(self, data): - raise NotImplementedError, "must be implemented in subclass" + raise NotImplementedError("must be implemented in subclass") + + def _collect_incoming_data(self, data): + self.incoming.append(data) + + def _get_data(self): + d = ''.join(self.incoming) + del self.incoming[:] + return d def found_terminator(self): - raise NotImplementedError, "must be implemented in subclass" + raise NotImplementedError("must be implemented in subclass") def set_terminator (self, term): "Set the input delimiter. Can be a fixed string of any length, an integer, or None" @@ -96,7 +115,7 @@ # Continue to search for self.terminator in self.ac_in_buffer, # while calling self.collect_incoming_data. The while loop # is necessary because we might read several data+terminator - # combos with a single recv(1024). + # combos with a single recv(4096). while self.ac_in_buffer: lb = len(self.ac_in_buffer) @@ -150,87 +169,82 @@ self.ac_in_buffer = '' def handle_write (self): - self.initiate_send () + self.initiate_send() def handle_close (self): self.close() def push (self, data): - self.producer_fifo.push (simple_producer (data)) + sabs = self.ac_out_buffer_size + if len(data) > sabs: + for i in xrange(0, len(data), sabs): + self.producer_fifo.append(data[i:i+sabs]) + else: + self.producer_fifo.append(data) self.initiate_send() def push_with_producer (self, producer): - self.producer_fifo.push (producer) + self.producer_fifo.append(producer) self.initiate_send() def readable (self): "predicate for inclusion in the readable for select()" - return (len(self.ac_in_buffer) <= self.ac_in_buffer_size) + # cannot use the old predicate, it violates the claim of the + # set_terminator method. + + # return (len(self.ac_in_buffer) <= self.ac_in_buffer_size) + return 1 def writable (self): "predicate for inclusion in the writable for select()" - # return len(self.ac_out_buffer) or len(self.producer_fifo) or (not self.connected) - # this is about twice as fast, though not as clear. - return not ( - (self.ac_out_buffer == '') and - self.producer_fifo.is_empty() and - self.connected - ) + return self.producer_fifo or (not self.connected) def close_when_done (self): "automatically close this channel once the outgoing queue is empty" - self.producer_fifo.push (None) + self.producer_fifo.append(None) - # refill the outgoing buffer by calling the more() method - # of the first producer in the queue - def refill_buffer (self): - while 1: - if len(self.producer_fifo): - p = self.producer_fifo.first() - # a 'None' in the producer fifo is a sentinel, - # telling us to close the channel. - if p is None: - if not self.ac_out_buffer: - self.producer_fifo.pop() - self.close() - return - elif isinstance(p, str): - self.producer_fifo.pop() - self.ac_out_buffer = self.ac_out_buffer + p + def initiate_send(self): + while self.producer_fifo and self.connected: + first = self.producer_fifo[0] + # handle empty string/buffer or None entry + if not first: + del self.producer_fifo[0] + if first is None: + self.handle_close() return - data = p.more() + + # handle classic producer behavior + obs = self.ac_out_buffer_size + try: + data = buffer(first, 0, obs) + except TypeError: + data = first.more() if data: - self.ac_out_buffer = self.ac_out_buffer + data - return + self.producer_fifo.appendleft(data) else: - self.producer_fifo.pop() - else: - return + del self.producer_fifo[0] + continue - def initiate_send (self): - obs = self.ac_out_buffer_size - # try to refill the buffer - if (len (self.ac_out_buffer) < obs): - self.refill_buffer() - - if self.ac_out_buffer and self.connected: - # try to send the buffer + # send the data try: - num_sent = self.send (self.ac_out_buffer[:obs]) - if num_sent: - self.ac_out_buffer = self.ac_out_buffer[num_sent:] - - except socket.error, why: + num_sent = self.send(data) + except socket.error: self.handle_error() return + if num_sent: + if num_sent < len(data) or obs < len(first): + self.producer_fifo[0] = first[num_sent:] + else: + del self.producer_fifo[0] + # we tried to send some actual data + return + def discard_buffers (self): # Emergencies only! self.ac_in_buffer = '' - self.ac_out_buffer = '' - while self.producer_fifo: - self.producer_fifo.pop() - + del self.incoming[:] + self.producer_fifo.clear() class simple_producer: Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Tue Jun 10 07:00:08 2008 @@ -53,20 +53,26 @@ import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ - ENOTCONN, ESHUTDOWN, EINTR, EISCONN, errorcode + ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode try: socket_map except NameError: socket_map = {} +def _strerror(err): + res = os.strerror(err) + if res == 'Unknown error': + res = errorcode[err] + return res + class ExitNow(Exception): pass def read(obj): try: obj.handle_read_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -74,15 +80,15 @@ def write(obj): try: obj.handle_write_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() -def _exception (obj): +def _exception(obj): try: obj.handle_expt_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -95,7 +101,7 @@ obj.handle_write_event() if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): obj.handle_expt_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -116,14 +122,15 @@ e.append(fd) if [] == r == w == e: time.sleep(timeout) - else: - try: - r, w, e = select.select(r, w, e, timeout) - except select.error, err: - if err[0] != EINTR: - raise - else: - return + return + + try: + r, w, e = select.select(r, w, e, timeout) + except select.error, err: + if err[0] != EINTR: + raise + else: + return for fd in r: obj = map.get(fd) @@ -209,18 +216,29 @@ else: self._map = map + self._fileno = None + if sock: + # Set to nonblocking just to make sure for cases where we + # get a socket from a blocking source. + sock.setblocking(0) self.set_socket(sock, map) - # I think it should inherit this anyway - self.socket.setblocking(0) self.connected = True - # XXX Does the constructor require that the socket passed - # be connected? + # The constructor no longer requires that the socket + # passed be connected. try: self.addr = sock.getpeername() except socket.error: - # The addr isn't crucial - pass + if err[0] == ENOTCONN: + # To handle the case where we got an unconnected + # socket. + self.connected = False + else: + # The socket is broken in some unknown way, alert + # the user and remove it from the map (to prevent + # polling of broken sockets). + self.del_channel(map) + raise else: self.socket = None @@ -254,10 +272,9 @@ def create_socket(self, family, type): self.family_and_type = family, type - self.socket = socket.socket(family, type) - self.socket.setblocking(0) - self._fileno = self.socket.fileno() - self.add_channel() + sock = socket.socket(family, type) + sock.setblocking(0) + self.set_socket(sock) def set_socket(self, sock, map=None): self.socket = sock @@ -295,7 +312,7 @@ def listen(self, num): self.accepting = True if os.name == 'nt' and num > 5: - num = 1 + num = 5 return self.socket.listen(num) def bind(self, addr): @@ -310,10 +327,9 @@ return if err in (0, EISCONN): self.addr = address - self.connected = True - self.handle_connect() + self.handle_connect_event() else: - raise socket.error, (err, errorcode[err]) + raise socket.error(err, errorcode[err]) def accept(self): # XXX can return either an address pair or None @@ -333,9 +349,11 @@ except socket.error, why: if why[0] == EWOULDBLOCK: return 0 + elif why[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): + self.handle_close() + return 0 else: raise - return 0 def recv(self, buffer_size): try: @@ -349,15 +367,21 @@ return data except socket.error, why: # winsock sometimes throws ENOTCONN - if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: + if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED]: self.handle_close() return '' else: raise def close(self): + self.connected = False + self.accepting = False self.del_channel() - self.socket.close() + try: + self.socket.close() + except socket.error, why: + if why[0] not in (ENOTCONN, EBADF): + raise # cheap inheritance, used to pass all other attribute # references to the underlying socket object. @@ -377,27 +401,53 @@ def handle_read_event(self): if self.accepting: - # for an accepting socket, getting a read implies - # that we are connected - if not self.connected: - self.connected = True + # accepting sockets are never connected, they "spawn" new + # sockets that are connected self.handle_accept() elif not self.connected: - self.handle_connect() - self.connected = True + self.handle_connect_event() self.handle_read() else: self.handle_read() + def handle_connect_event(self): + self.connected = True + self.handle_connect() + def handle_write_event(self): - # getting a write implies that we are connected + if self.accepting: + # Accepting sockets shouldn't get a write event. + # We will pretend it didn't happen. + return + if not self.connected: - self.handle_connect() - self.connected = True + #check for errors + err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) + if err != 0: + raise socket.error(err, strerror(err)) + + self.handle_connect_event() self.handle_write() def handle_expt_event(self): - self.handle_expt() + # if the handle_expt is the same default worthless method, + # we'll not even bother calling it, we'll instead generate + # a useful error + x = True + try: + y1 = self.__class__.handle_expt.im_func + y2 = dispatcher.handle_expt.im_func + x = y1 is y2 + except AttributeError: + pass + + if x: + err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) + msg = _strerror(err) + + raise socket.error(err, msg) + else: + self.handle_expt() def handle_error(self): nil, t, v, tbinfo = compact_traceback() @@ -473,7 +523,8 @@ def compact_traceback(): t, v, tb = sys.exc_info() tbinfo = [] - assert tb # Must have a traceback + if not tb: # Must have a traceback + raise AssertionError("traceback does not exist") while tb: tbinfo.append(( tb.tb_frame.f_code.co_filename, @@ -489,11 +540,22 @@ info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo]) return (file, function, line), t, v, info -def close_all(map=None): +def close_all(map=None, ignore_all=False): if map is None: map = socket_map for x in map.values(): - x.socket.close() + try: + x.close() + except OSError, x: + if x[0] == EBADF: + pass + elif not ignore_all: + raise + except (ExitNow, KeyboardInterrupt, SystemExit): + raise + except: + if not ignore_all: + raise map.clear() # Asynchronous File I/O: @@ -513,11 +575,12 @@ import fcntl class file_wrapper: - # here we override just enough to make a file + # Here we override just enough to make a file # look like a socket for the purposes of asyncore. + # The passed fd is automatically os.dup()'d def __init__(self, fd): - self.fd = fd + self.fd = os.dup(fd) def recv(self, *args): return os.read(self.fd, *args) @@ -539,6 +602,10 @@ def __init__(self, fd, map=None): dispatcher.__init__(self, None, map) self.connected = True + try: + fd = fd.fileno() + except AttributeError: + pass self.set_file(fd) # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) Modified: python/trunk/Lib/test/test_asyncore.py ============================================================================== --- python/trunk/Lib/test/test_asyncore.py (original) +++ python/trunk/Lib/test/test_asyncore.py Tue Jun 10 07:00:08 2008 @@ -27,6 +27,9 @@ def __init__(self): self.socket = dummysocket() + def close(self): + self.socket.close() + class exitingdummy: def __init__(self): pass From python-checkins at python.org Tue Jun 10 07:03:36 2008 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 10 Jun 2008 07:03:36 +0200 (CEST) Subject: [Python-checkins] r64063 - python/trunk/Misc/developers.txt Message-ID: <20080610050336.062E31E400D@bag.python.org> Author: martin.v.loewis Date: Tue Jun 10 07:03:35 2008 New Revision: 64063 Log: Add Gregor Lingl. Modified: python/trunk/Misc/developers.txt Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Tue Jun 10 07:03:35 2008 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Gregor Lingl was given SVN access on 10 June 2008 by MvL, + for work on the turtle module. + - Robert Schuppenies was given SVN access on 21 May 2008 by MvL, for GSoC contributions. From buildbot at python.org Tue Jun 10 07:18:55 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 05:18:55 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080610051855.9144B1E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/126 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 16 != 15 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 07:25:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 05:25:02 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080610052503.10CAC1E4002@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/3789 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 16 != 12 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 07:29:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 05:29:00 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080610052900.F2C131E4002@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/990 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 14 != 13 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 07:37:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 05:37:58 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080610053758.6F3EF1E4004@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/424 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: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 21 != 20 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 08:06:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 06:06:40 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080610060640.92B0E1E4012@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1462 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 09:06:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 07:06:30 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080610070630.B54A91E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3519 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 20 != 14 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 09:45:29 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 10 Jun 2008 09:45:29 +0200 (CEST) Subject: [Python-checkins] r64064 - in python/trunk: Doc/ACKS.txt Doc/library/_ast.rst Doc/library/ast.rst Doc/library/language.rst Lib/ast.py Lib/test/test_ast.py Misc/ACKS Misc/NEWS Message-ID: <20080610074529.104861E4002@bag.python.org> Author: georg.brandl Date: Tue Jun 10 09:45:28 2008 New Revision: 64064 Log: Add the "ast" module, containing helpers to ease use of the "_ast" classes. Added: python/trunk/Doc/library/ast.rst python/trunk/Lib/ast.py Removed: python/trunk/Doc/library/_ast.rst Modified: python/trunk/Doc/ACKS.txt python/trunk/Doc/library/language.rst python/trunk/Lib/test/test_ast.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Doc/ACKS.txt ============================================================================== --- python/trunk/Doc/ACKS.txt (original) +++ python/trunk/Doc/ACKS.txt Tue Jun 10 09:45:28 2008 @@ -157,6 +157,7 @@ * Bernhard Reiter * Armin Rigo * Wes Rishel + * Armin Ronacher * Jim Roskind * Guido van Rossum * Donald Wallace Rouse II Deleted: python/trunk/Doc/library/_ast.rst ============================================================================== --- python/trunk/Doc/library/_ast.rst Tue Jun 10 09:45:28 2008 +++ (empty file) @@ -1,85 +0,0 @@ -.. _ast: - -Abstract Syntax Trees -===================== - -.. module:: _ast - :synopsis: Abstract Syntax Tree classes. - -.. sectionauthor:: Martin v. L?wis - - -.. versionadded:: 2.5 - -The ``_ast`` module helps Python applications to process trees of the Python -abstract syntax grammar. The abstract syntax itself might change with each -Python release; this module helps to find out programmatically what the current -grammar looks like. - -An abstract syntax tree can be generated by passing :data:`_ast.PyCF_ONLY_AST` -as a flag to the :func:`compile` builtin function. The result will be a tree of -objects whose classes all inherit from :class:`_ast.AST`. - -A modified abstract syntax tree can be compiled into a Python code object using -the built-in :func:`compile` function. - -The actual classes are derived from the ``Parser/Python.asdl`` file, which is -reproduced below. There is one class defined for each left-hand side symbol in -the abstract grammar (for example, ``_ast.stmt`` or ``_ast.expr``). In addition, -there is one class defined for each constructor on the right-hand side; these -classes inherit from the classes for the left-hand side trees. For example, -``_ast.BinOp`` inherits from ``_ast.expr``. For production rules with -alternatives (aka "sums"), the left-hand side class is abstract: only instances -of specific constructor nodes are ever created. - -Each concrete class has an attribute ``_fields`` which gives the names of all -child nodes. - -Each instance of a concrete class has one attribute for each child node, of the -type as defined in the grammar. For example, ``_ast.BinOp`` instances have an -attribute ``left`` of type ``_ast.expr``. Instances of ``_ast.expr`` and -``_ast.stmt`` subclasses also have lineno and col_offset attributes. The lineno -is the line number of source text (1 indexed so the first line is line 1) and -the col_offset is the utf8 byte offset of the first token that generated the -node. The utf8 offset is recorded because the parser uses utf8 internally. - -If these attributes are marked as optional in the grammar (using a question -mark), the value might be ``None``. If the attributes can have zero-or-more -values (marked with an asterisk), the values are represented as Python lists. -All possible attributes must be present and have valid values when compiling an -AST with :func:`compile`. - -The constructor of a class ``_ast.T`` parses their arguments as follows: - -* If there are positional arguments, there must be as many as there are items in - ``T._fields``; they will be assigned as attributes of these names. -* If there are keyword arguments, they will set the attributes of the same names - to the given values. - -For example, to create and populate a ``UnaryOp`` node, you could use :: - - node = _ast.UnaryOp() - node.op = _ast.USub() - node.operand = _ast.Num() - node.operand.n = 5 - node.operand.lineno = 0 - node.operand.col_offset = 0 - node.lineno = 0 - node.col_offset = 0 - -or the more compact :: - - node = _ast.UnaryOp(_ast.USub(), _ast.Num(5, lineno=0, col_offset=0), - lineno=0, col_offset=0) - - - -Abstract Grammar ----------------- - -The module defines a string constant ``__version__`` which is the decimal -Subversion revision number of the file shown below. - -The abstract grammar is currently defined as follows: - -.. literalinclude:: ../../Parser/Python.asdl Added: python/trunk/Doc/library/ast.rst ============================================================================== --- (empty file) +++ python/trunk/Doc/library/ast.rst Tue Jun 10 09:45:28 2008 @@ -0,0 +1,257 @@ +.. _ast: + +Abstract Syntax Trees +===================== + +.. module:: ast + :synopsis: Abstract Syntax Tree classes and manipulation. + +.. sectionauthor:: Martin v. L?wis +.. sectionauthor:: Georg Brandl + +.. versionadded:: 2.5 + The low-level ``_ast`` module containing only the node classes. + +.. versionadded:: 2.6 + The high-level ``ast`` module containing all helpers. + + +The :mod:`ast` module helps Python applications to process trees of the Python +abstract syntax grammar. The abstract syntax itself might change with each +Python release; this module helps to find out programmatically what the current +grammar looks like. + +An abstract syntax tree can be generated by passing :data:`_ast.PyCF_ONLY_AST` +as a flag to the :func:`compile` builtin function, or using the :func:`parse` +helper provided in this module. The result will be a tree of objects whose +classes all inherit from :class:`ast.AST`. + +A modified abstract syntax tree can be compiled into a Python code object using +the built-in :func:`compile` function. + +Node classes +------------ + +.. class:: AST + + This is the base of all AST node classes. The actual node classes are + derived from the :file:`Parser/Python.asdl` file, which is reproduced + :ref:`below `. They are defined in the :mod:`_ast` C + module and re-exported in :mod:`ast`. + + There is one class defined for each left-hand side symbol in the abstract + grammar (for example, :class:`ast.stmt` or :class:`ast.expr`). In addition, + there is one class defined for each constructor on the right-hand side; these + classes inherit from the classes for the left-hand side trees. For example, + :class:`ast.BinOp` inherits from :class:`ast.expr`. For production rules + with alternatives (aka "sums"), the left-hand side class is abstract: only + instances of specific constructor nodes are ever created. + + .. attribute:: _fields + + Each concrete class has an attribute :attr:`_fields` which gives the names + of all child nodes. + + Each instance of a concrete class has one attribute for each child node, + of the type as defined in the grammar. For example, :class:`ast.BinOp` + instances have an attribute :attr:`left` of type :class:`ast.expr`. + + If these attributes are marked as optional in the grammar (using a + question mark), the value might be ``None``. If the attributes can have + zero-or-more values (marked with an asterisk), the values are represented + as Python lists. All possible attributes must be present and have valid + values when compiling an AST with :func:`compile`. + + .. attribute:: lineno + col_offset + + Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have + :attr:`lineno` and :attr:`col_offset` attributes. The :attr:`lineno` is + the line number of source text (1-indexed so the first line is line 1) and + the :attr:`col_offset` is the UTF-8 byte offset of the first token that + generated the node. The UTF-8 offset is recorded because the parser uses + UTF-8 internally. + + The constructor of a class :class:`ast.T` parses its arguments as follows: + + * If there are positional arguments, there must be as many as there are items + in :attr:`T._fields`; they will be assigned as attributes of these names. + * If there are keyword arguments, they will set the attributes of the same + names to the given values. + + For example, to create and populate an :class:`ast.UnaryOp` node, you could + use :: + + node = ast.UnaryOp() + node.op = ast.USub() + node.operand = ast.Num() + node.operand.n = 5 + node.operand.lineno = 0 + node.operand.col_offset = 0 + node.lineno = 0 + node.col_offset = 0 + + or the more compact :: + + node = ast.UnaryOp(ast.USub(), ast.Num(5, lineno=0, col_offset=0), + lineno=0, col_offset=0) + + +.. _abstract-grammar: + +Abstract Grammar +---------------- + +The module defines a string constant ``__version__`` which is the decimal +Subversion revision number of the file shown below. + +The abstract grammar is currently defined as follows: + +.. literalinclude:: ../../Parser/Python.asdl + + +:mod:`ast` Helpers +------------------ + +.. versionadded:: 2.6 + +Apart from the node classes, :mod:`ast` module defines these utility functions +and classes for traversing abstract syntax trees: + +.. function:: parse(expr, filename='', mode='exec') + + Parse an expression into an AST node. Equivalent to ``compile(expr, + filename, mode, PyCF_ONLY_AST)``. + + +.. function:: literal_eval(node_or_string) + + Safely evaluate an expression node or a string containing a Python + expression. The string or node provided may only consist of the following + Python literal structures: strings, numbers, tuples, lists, dicts, booleans, + and ``None``. + + This can be used for safely evaluating strings containing Python expressions + from untrusted sources without the need to parse the values oneself. + + +.. function:: get_docstring(node, clean=True): + + Return the docstring of the given *node* (which must be a + :class:`FunctionDef`, :class:`ClassDef` or :class:`Module` node), or ``None`` + if it has no docstring. If *clean* is true, clean up the docstring's + indentation with :func:`inspect.cleandoc`. + + +.. function:: fix_missing_locations(node) + + When you compile a node tree with :func:`compile`, the compiler expects + :attr:`lineno` and :attr:`col_offset` attributes for every node that supports + them. This is rather tedious to fill in for generated nodes, so this helper + adds these attributes recursively where not already set, by setting them to + the values of the parent node. It works recursively starting at *node*. + + +.. function:: increment_lineno(node, n=1) + + Increment the line number of each node in the tree starting at *node* by *n*. + This is useful to "move code" to a different location in a file. + + +.. function:: copy_location(new_node, old_node) + + Copy source location (:attr:`lineno` and :attr:`col_offset`) from *old_node* + to *new_node* if possible, and return *new_node*. + + +.. function:: iter_fields(node) + + Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` + that is present on *node*. + + +.. function:: iter_child_nodes(node) + + Yield all direct child nodes of *node*, that is, all fields that are nodes + and all items of fields that are lists of nodes. + + +.. function:: walk(node) + + Recursively yield all child nodes of *node*, in no specified order. This is + useful if you only want to modify nodes in place and don't care about the + context. + + +.. class:: NodeVisitor() + + A node visitor base class that walks the abstract syntax tree and calls a + visitor function for every node found. This function may return a value + which is forwarded by the `visit` method. + + This class is meant to be subclassed, with the subclass adding visitor + methods. + + .. method:: visit(node) + + Visit a node. The default implementation calls the method called + :samp:`self.visit_{classname}` where *classname* is the name of the node + class, or :meth:`generic_visit` if that method doesn't exist. + + .. method:: generic_visit(node) + + This visitor calls :meth:`visit` on all children of the node. + + Note that child nodes of nodes that have a custom visitor method won't be + visited unless the visitor calls :meth:`generic_visit` or visits them + itself. + + Don't use the :class:`NodeVisitor` if you want to apply changes to nodes + during traversal. For this a special visitor exists + (:class:`NodeTransformer`) that allows modifications. + + +.. class:: NodeTransformer() + + A :class:`NodeVisitor` subclass that walks the abstract syntax tree and + allows modification of nodes. + + The `NodeTransformer` will walk the AST and use the return value of the + visitor methods to replace or remove the old node. If the return value of + the visitor method is ``None``, the node will be removed from its location, + otherwise it is replaced with the return value. The return value may be the + original node in which case no replacement takes place. + + Here is an example transformer that rewrites all occurrences of name lookups + (``foo``) to ``data['foo']``:: + + class RewriteName(NodeTransformer): + + def visit_Name(self, node): + return copy_location(Subscript( + value=Name(id='data', ctx=Load()), + slice=Index(value=Str(s=node.id)), + ctx=node.ctx + ), node) + + Keep in mind that if the node you're operating on has child nodes you must + either transform the child nodes yourself or call the :meth:`generic_visit` + method for the node first. + + For nodes that were part of a collection of statements (that applies to all + statement nodes), the visitor may also return a list of nodes rather than + just a single node. + + Usually you use the transformer like this:: + + node = YourTransformer().visit(node) + + +.. function:: dump(node, annotate_fields=True, include_attributes=False) + + Return a formatted dump of the tree in *node*. This is mainly useful for + debugging purposes. The returned string will show the names and the values + for fields. This makes the code impossible to evaluate, so if evaluation is + wanted *annotate_fields* must be set to False. Attributes such as line + numbers and column offsets are dumped by default. If this is wanted, + *include_attributes* can be set to ``True``. Modified: python/trunk/Doc/library/language.rst ============================================================================== --- python/trunk/Doc/library/language.rst (original) +++ python/trunk/Doc/library/language.rst Tue Jun 10 09:45:28 2008 @@ -15,7 +15,7 @@ .. toctree:: parser.rst - _ast.rst + ast.rst symbol.rst token.rst keyword.rst Added: python/trunk/Lib/ast.py ============================================================================== --- (empty file) +++ python/trunk/Lib/ast.py Tue Jun 10 09:45:28 2008 @@ -0,0 +1,300 @@ +# -*- coding: utf-8 -*- +""" + ast + ~~~ + + The `ast` module helps Python applications to process trees of the Python + abstract syntax grammar. The abstract syntax itself might change with + each Python release; this module helps to find out programmatically what + the current grammar looks like and allows modifications of it. + + An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as + a flag to the `compile()` builtin function or by using the `parse()` + function from this module. The result will be a tree of objects whose + classes all inherit from `ast.AST`. + + A modified abstract syntax tree can be compiled into a Python code object + using the built-in `compile()` function. + + Additionally various helper functions are provided that make working with + the trees simpler. The main intention of the helper functions and this + module in general is to provide an easy to use interface for libraries + that work tightly with the python syntax (template engines for example). + + + :copyright: Copyright 2008 by Armin Ronacher. + :license: Python License. +""" +from _ast import * + + +def parse(expr, filename='', mode='exec'): + """ + Parse an expression into an AST node. + Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST). + """ + return compile(expr, filename, mode, PyCF_ONLY_AST) + + +def literal_eval(node_or_string): + """ + Safely evaluate an expression node or a string containing a Python + expression. The string or node provided may only consist of the following + Python literal structures: strings, numbers, tuples, lists, dicts, booleans, + and None. + """ + _safe_names = {'None': None, 'True': True, 'False': False} + if isinstance(node_or_string, basestring): + node_or_string = parse(node_or_string, mode='eval') + if isinstance(node_or_string, Expression): + node_or_string = node_or_string.body + def _convert(node): + if isinstance(node, Str): + return node.s + elif isinstance(node, Num): + return node.n + elif isinstance(node, Tuple): + return tuple(map(_convert, node.elts)) + elif isinstance(node, List): + return list(map(_convert, node.elts)) + elif isinstance(node, Dict): + return dict((_convert(k), _convert(v)) for k, v + in zip(node.keys, node.values)) + elif isinstance(node, Name): + if node.id in _safe_names: + return _safe_names[node.id] + raise ValueError('malformed string') + return _convert(node_or_string) + + +def dump(node, annotate_fields=True, include_attributes=False): + """ + Return a formatted dump of the tree in *node*. This is mainly useful for + debugging purposes. The returned string will show the names and the values + for fields. This makes the code impossible to evaluate, so if evaluation is + wanted *annotate_fields* must be set to False. Attributes such as line + numbers and column offsets are dumped by default. If this is wanted, + *include_attributes* can be set to True. + """ + def _format(node): + if isinstance(node, AST): + fields = [(a, _format(b)) for a, b in iter_fields(node)] + rv = '%s(%s' % (node.__class__.__name__, ', '.join( + ('%s=%s' % field for field in fields) + if annotate_fields else + (b for a, b in fields) + )) + if include_attributes and node._attributes: + rv += fields and ', ' or ' ' + rv += ', '.join('%s=%s' % (a, _format(getattr(node, a))) + for a in node._attributes) + return rv + ')' + elif isinstance(node, list): + return '[%s]' % ', '.join(_format(x) for x in node) + return repr(node) + if not isinstance(node, AST): + raise TypeError('expected AST, got %r' % node.__class__.__name__) + return _format(node) + + +def copy_location(new_node, old_node): + """ + Copy source location (`lineno` and `col_offset` attributes) from + *old_node* to *new_node* if possible, and return *new_node*. + """ + for attr in 'lineno', 'col_offset': + if attr in old_node._attributes and attr in new_node._attributes \ + and hasattr(old_node, attr): + setattr(new_node, attr, getattr(old_node, attr)) + return new_node + + +def fix_missing_locations(node): + """ + When you compile a node tree with compile(), the compiler expects lineno and + col_offset attributes for every node that supports them. This is rather + tedious to fill in for generated nodes, so this helper adds these attributes + recursively where not already set, by setting them to the values of the + parent node. It works recursively starting at *node*. + """ + def _fix(node, lineno, col_offset): + if 'lineno' in node._attributes: + if not hasattr(node, 'lineno'): + node.lineno = lineno + else: + lineno = node.lineno + if 'col_offset' in node._attributes: + if not hasattr(node, 'col_offset'): + node.col_offset = col_offset + else: + col_offset = node.col_offset + for child in iter_child_nodes(node): + _fix(child, lineno, col_offset) + _fix(node, 1, 0) + return node + + +def increment_lineno(node, n=1): + """ + Increment the line number of each node in the tree starting at *node* by *n*. + This is useful to "move code" to a different location in a file. + """ + if 'lineno' in node._attributes: + node.lineno = getattr(node, 'lineno', 0) + n + for child in walk(node): + if 'lineno' in child._attributes: + child.lineno = getattr(child, 'lineno', 0) + n + return node + + +def iter_fields(node): + """ + Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` + that is present on *node*. + """ + for field in node._fields: + try: + yield field, getattr(node, field) + except AttributeError: + pass + + +def iter_child_nodes(node): + """ + Yield all direct child nodes of *node*, that is, all fields that are nodes + and all items of fields that are lists of nodes. + """ + for name, field in iter_fields(node): + if isinstance(field, AST): + yield field + elif isinstance(field, list): + for item in field: + if isinstance(item, AST): + yield item + + +def get_docstring(node, clean=True): + """ + Return the docstring for the given node or None if no docstring can + be found. If the node provided does not have docstrings a TypeError + will be raised. + """ + if not isinstance(node, (FunctionDef, ClassDef, Module)): + raise TypeError("%r can't have docstrings" % node.__class__.__name__) + if node.body and isinstance(node.body[0], Expr) and \ + isinstance(node.body[0].value, Str): + if clean: + import inspect + return inspect.cleandoc(node.body[0].value.s) + return node.body[0].value.s + + +def walk(node): + """ + Recursively yield all child nodes of *node*, in no specified order. This is + useful if you only want to modify nodes in place and don't care about the + context. + """ + from collections import deque + todo = deque([node]) + while todo: + node = todo.popleft() + todo.extend(iter_child_nodes(node)) + yield node + + +class NodeVisitor(object): + """ + A node visitor base class that walks the abstract syntax tree and calls a + visitor function for every node found. This function may return a value + which is forwarded by the `visit` method. + + This class is meant to be subclassed, with the subclass adding visitor + methods. + + Per default the visitor functions for the nodes are ``'visit_'`` + + class name of the node. So a `TryFinally` node visit function would + be `visit_TryFinally`. This behavior can be changed by overriding + the `visit` method. If no visitor function exists for a node + (return value `None`) the `generic_visit` visitor is used instead. + + Don't use the `NodeVisitor` if you want to apply changes to nodes during + traversing. For this a special visitor exists (`NodeTransformer`) that + allows modifications. + """ + + def visit(self, node): + """Visit a node.""" + method = 'visit_' + node.__class__.__name__ + visitor = getattr(self, method, self.generic_visit) + return visitor(node) + + def generic_visit(self, node): + """Called if no explicit visitor function exists for a node.""" + for field, value in iter_fields(node): + if isinstance(value, list): + for item in value: + if isinstance(item, AST): + self.visit(item) + elif isinstance(value, AST): + self.visit(value) + + +class NodeTransformer(NodeVisitor): + """ + A :class:`NodeVisitor` subclass that walks the abstract syntax tree and + allows modification of nodes. + + The `NodeTransformer` will walk the AST and use the return value of the + visitor methods to replace or remove the old node. If the return value of + the visitor method is ``None``, the node will be removed from its location, + otherwise it is replaced with the return value. The return value may be the + original node in which case no replacement takes place. + + Here is an example transformer that rewrites all occurrences of name lookups + (``foo``) to ``data['foo']``:: + + class RewriteName(NodeTransformer): + + def visit_Name(self, node): + return copy_location(Subscript( + value=Name(id='data', ctx=Load()), + slice=Index(value=Str(s=node.id)), + ctx=node.ctx + ), node) + + Keep in mind that if the node you're operating on has child nodes you must + either transform the child nodes yourself or call the :meth:`generic_visit` + method for the node first. + + For nodes that were part of a collection of statements (that applies to all + statement nodes), the visitor may also return a list of nodes rather than + just a single node. + + Usually you use the transformer like this:: + + node = YourTransformer().visit(node) + """ + + def generic_visit(self, node): + for field, old_value in iter_fields(node): + old_value = getattr(node, field, None) + if isinstance(old_value, list): + new_values = [] + for value in old_value: + if isinstance(value, AST): + value = self.visit(value) + if value is None: + continue + elif not isinstance(value, AST): + new_values.extend(value) + continue + new_values.append(value) + old_value[:] = new_values + elif isinstance(old_value, AST): + new_node = self.visit(old_value) + if new_node is None: + delattr(node, field) + else: + setattr(node, field, new_node) + return node Modified: python/trunk/Lib/test/test_ast.py ============================================================================== --- python/trunk/Lib/test/test_ast.py (original) +++ python/trunk/Lib/test/test_ast.py Tue Jun 10 09:45:28 2008 @@ -1,6 +1,6 @@ import sys, itertools, unittest from test import test_support -import _ast +import ast def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): @@ -123,9 +123,9 @@ class AST_Tests(unittest.TestCase): def _assert_order(self, ast_node, parent_pos): - if not isinstance(ast_node, _ast.AST) or ast_node._fields is None: + if not isinstance(ast_node, ast.AST) or ast_node._fields is None: return - if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): + if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) self.assert_(node_pos >= parent_pos) parent_pos = (ast_node.lineno, ast_node.col_offset) @@ -142,29 +142,29 @@ (single_tests, single_results, "single"), (eval_tests, eval_results, "eval")): for i, o in itertools.izip(input, output): - ast_tree = compile(i, "?", kind, _ast.PyCF_ONLY_AST) + ast_tree = compile(i, "?", kind, ast.PyCF_ONLY_AST) self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) def test_nodeclasses(self): - x = _ast.BinOp(1, 2, 3, lineno=0) + x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # node raises exception when not given enough arguments - self.assertRaises(TypeError, _ast.BinOp, 1, 2) + self.assertRaises(TypeError, ast.BinOp, 1, 2) # can set attributes through kwargs too - x = _ast.BinOp(left=1, op=2, right=3, lineno=0) + x = ast.BinOp(left=1, op=2, right=3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # this used to fail because Sub._fields was None - x = _ast.Sub() + x = ast.Sub() def test_pickling(self): import pickle @@ -181,8 +181,99 @@ ast2 = mod.loads(mod.dumps(ast, protocol)) self.assertEquals(to_tuple(ast2), to_tuple(ast)) + +class ASTHelpers_Test(unittest.TestCase): + + def test_parse(self): + a = ast.parse('foo(1 + 1)') + b = compile('foo(1 + 1)', '', 'exec', ast.PyCF_ONLY_AST) + self.assertEqual(ast.dump(a), ast.dump(b)) + + def test_dump(self): + node = ast.parse('spam(eggs, "and cheese")') + self.assertEqual(ast.dump(node), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), " + "args=[Name(id='eggs', ctx=Load()), Str(s='and cheese')], " + "keywords=[], starargs=None, kwargs=None))])" + ) + self.assertEqual(ast.dump(node, annotate_fields=False), + "Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), " + "Str('and cheese')], [], None, None))])" + ) + self.assertEqual(ast.dump(node, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), " + "lineno=1, col_offset=0), args=[Name(id='eggs', ctx=Load(), " + "lineno=1, col_offset=5), Str(s='and cheese', lineno=1, " + "col_offset=11)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_copy_location(self): + src = ast.parse('1 + 1', mode='eval') + src.body.right = ast.copy_location(ast.Num(2), src.body.right) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=1, col_offset=0), ' + 'op=Add(), right=Num(n=2, lineno=1, col_offset=4), lineno=1, ' + 'col_offset=0))' + ) + + def test_fix_missing_locations(self): + src = ast.parse('write("spam")') + src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()), + [ast.Str('eggs')], [], None, None))) + self.assertEqual(src, ast.fix_missing_locations(src)) + self.assertEqual(ast.dump(src, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), " + "lineno=1, col_offset=0), args=[Str(s='spam', lineno=1, " + "col_offset=6)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0), " + "Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, " + "col_offset=0), args=[Str(s='eggs', lineno=1, col_offset=0)], " + "keywords=[], starargs=None, kwargs=None, lineno=1, " + "col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_increment_lineno(self): + src = ast.parse('1 + 1', mode='eval') + self.assertEqual(ast.increment_lineno(src, n=3), src) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), ' + 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' + 'col_offset=0))' + ) + + def test_iter_fields(self): + node = ast.parse('foo()', mode='eval') + d = dict(ast.iter_fields(node.body)) + self.assertEqual(d.pop('func').id, 'foo') + self.assertEqual(d, {'keywords': [], 'kwargs': None, + 'args': [], 'starargs': None}) + + def test_iter_child_nodes(self): + node = ast.parse("spam(23, 42, eggs='leek')", mode='eval') + self.assertEqual(len(list(ast.iter_child_nodes(node.body))), 4) + iterator = ast.iter_child_nodes(node.body) + self.assertEqual(next(iterator).id, 'spam') + self.assertEqual(next(iterator).n, 23) + self.assertEqual(next(iterator).n, 42) + self.assertEqual(ast.dump(next(iterator)), + "keyword(arg='eggs', value=Str(s='leek'))" + ) + + def test_get_docstring(self): + node = ast.parse('def foo():\n """line one\n line two"""') + self.assertEqual(ast.get_docstring(node.body[0]), + 'line one\nline two') + + def test_literal_eval(self): + self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) + self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) + self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None)) + self.assertRaises(ValueError, ast.literal_eval, 'foo()') + + def test_main(): - test_support.run_unittest(AST_Tests) + test_support.run_unittest(AST_Tests, ASTHelpers_Test) def main(): if __name__ != '__main__': Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Tue Jun 10 09:45:28 2008 @@ -574,6 +574,7 @@ Kevin Rodgers Giampaolo Rodola Mike Romberg +Armin Ronacher Case Roole Timothy Roscoe Jim Roskind Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 10 09:45:28 2008 @@ -77,6 +77,8 @@ Library ------- +- Added the ast module. + - Factored out the indentation cleaning from inspect.getdoc() into inspect.cleandoc() to ease standalone use. From python-checkins at python.org Tue Jun 10 09:57:16 2008 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 10 Jun 2008 09:57:16 +0200 (CEST) Subject: [Python-checkins] r64065 - python/trunk/Misc/ACKS Message-ID: <20080610075716.1571B1E4002@bag.python.org> Author: raymond.hettinger Date: Tue Jun 10 09:57:15 2008 New Revision: 64065 Log: Add Arnaud for his efforts on multi-arg set operations. Modified: python/trunk/Misc/ACKS Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Tue Jun 10 09:57:15 2008 @@ -156,6 +156,7 @@ Jonathan Dasteel John DeGood Vincent Delft +Arnaud Delobelle Erik Demaine Roger Dev Raghuram Devarakonda From buildbot at python.org Tue Jun 10 10:13:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 08:13:07 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian trunk Message-ID: <20080610081307.72FF41E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%20trunk/builds/1041 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 17 != 14 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Tue Jun 10 10:16:07 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 10 Jun 2008 04:16:07 -0400 Subject: [Python-checkins] Python Regression Test Failures basics (1) Message-ID: <20080610081607.GA9475@python.psfb.org> 326 tests OK. 1 test failed: test_asyncore 32 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos test_macostools test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test test_asyncore failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 6 != 3 test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12407 refs] [12407 refs] [20634 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12412 refs] [12412 refs] [12412 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17290 refs] test_pyexpat test_queue test_quopri [14926 refs] [14926 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12407 refs] [12407 refs] [12410 refs] [12407 refs] test_slice test_smtplib test_socket test_socket_ssl test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [14311 refs] [12625 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] . [12407 refs] [12407 refs] this bit of output is from a test of stdout in a different process ... [12407 refs] [12407 refs] [12625 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12407 refs] [12407 refs] [12636 refs] [12430 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12410 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15637 refs] [16247 refs] test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 326 tests OK. 1 test failed: test_asyncore 32 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos test_macostools test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl [633715 refs] From nnorwitz at gmail.com Tue Jun 10 10:22:42 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 10 Jun 2008 04:22:42 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20080610082242.GA10766@python.psfb.org> 326 tests OK. 1 test failed: test_asyncore 32 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos test_macostools test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test test_asyncore failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 6 != 3 test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [16585 refs] test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12407 refs] [12407 refs] [20634 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12412 refs] [12412 refs] [12412 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17290 refs] test_pyexpat test_queue test_quopri [14926 refs] [14926 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12407 refs] [12407 refs] [12410 refs] [12407 refs] test_slice test_smtplib test_socket test_socket_ssl test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [14311 refs] [12625 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] . [12407 refs] [12407 refs] this bit of output is from a test of stdout in a different process ... [12407 refs] [12407 refs] [12625 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12407 refs] [12407 refs] [12636 refs] [12430 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12410 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15634 refs] [16247 refs] test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 326 tests OK. 1 test failed: test_asyncore 32 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos test_macostools test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl [633093 refs] From buildbot at python.org Tue Jun 10 10:41:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 08:41:07 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080610084107.85E301E4002@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/1553 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: josiah.carlson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_recv (test.test_asyncore.FileWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 11 != 10 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 11:34:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 09:34:23 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080610093423.9EAD91E4002@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/1097 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From nnorwitz at gmail.com Tue Jun 10 11:38:59 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 10 Jun 2008 05:38:59 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20080610093859.GA22148@python.psfb.org> 331 tests OK. 1 test failed: test_asyncore 24 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test test_asyncore failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_asyncore.py", line 387, in test_recv self.assertEqual(w.fd, fd) AssertionError: 6 != 3 test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-19750 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12407 refs] [12407 refs] [20634 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12412 refs] [12412 refs] [12412 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17290 refs] test_pyexpat test_queue test_quopri [14926 refs] [14926 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12407 refs] [12407 refs] [12410 refs] [12407 refs] test_slice test_smtplib test_socket test_socket_ssl test_socketserver test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [14311 refs] [12625 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] [12407 refs] . [12407 refs] [12407 refs] this bit of output is from a test of stdout in a different process ... [12407 refs] [12407 refs] [12625 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12407 refs] [12407 refs] [12636 refs] [12430 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12410 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15637 refs] [16247 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 331 tests OK. 1 test failed: test_asyncore 24 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl [645671 refs] From buildbot at python.org Tue Jun 10 11:48:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 09:48:19 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: <20080610094819.5FDDF1E4002@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/779 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti,benjamin.peterson,georg.brandl,gregory.p.smith,marc-andre.lemburg,martin.v.loewis,robert.schuppenies,thomas.heller,travis.oliphant BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 12:10:32 2008 From: python-checkins at python.org (robert.schuppenies) Date: Tue, 10 Jun 2008 12:10:32 +0200 (CEST) Subject: [Python-checkins] r64066 - in python/trunk: Lib/test/test_sys.py Objects/unicodeobject.c Message-ID: <20080610101032.0BBA31E4002@bag.python.org> Author: robert.schuppenies Date: Tue Jun 10 12:10:31 2008 New Revision: 64066 Log: Issue 3048: Fixed sys.getsizeof for unicode objects. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Objects/unicodeobject.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Tue Jun 10 12:10:31 2008 @@ -421,11 +421,14 @@ self.file.close() test.test_support.unlink(test.test_support.TESTFN) - def check_sizeof(self, o, size): + def check_sizeof(self, o, size, size2=None): + """Check size of o. Possible are size and optionally size2).""" result = sys.getsizeof(o) - msg = 'wrong size for %s: got %d, expected %d' \ - % (type(o), result, size) - self.assertEqual(result, size, msg) + msg = 'wrong size for %s: got %d, expected ' % (type(o), result) + if (size2 != None) and (result != size): + self.assertEqual(result, size2, msg + str(size2)) + else: + self.assertEqual(result, size, msg + str(size)) def align(self, value): mod = value % self.p @@ -517,10 +520,10 @@ pass # type (PyTypeObject + PyNumberMethods + PyMappingMethods + # PySequenceMethods + PyBufferProcs) - len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p + len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p +\ + l + 11*p + self.align(4) self.check_sizeof(class_newstyle, - h + len_typeobject + 42*p + 10*p + 3*p + 6*p) - + h + len_typeobject + 41*p + 10*p + 3*p + 6*p) def test_specialtypes(self): i = self.i @@ -534,6 +537,24 @@ # list self.check_sizeof([], h + l + p + l) self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) + # unicode + import math + usize = math.log(sys.maxunicode + 1, 2) / 8 + samples = [u'', u'1'*100] + # we need to test for both sizes, because we don't know if the string + # has been cached + for s in samples: + basicsize = h + l + p + l + p + usize * (len(s) + 1) + self.check_sizeof(s, basicsize,\ + size2=basicsize + sys.getsizeof(str(s))) + # XXX trigger caching encoded version as Python string + s = samples[1] + try: + getattr(sys, s) + except AttributeError: + pass + finally: + self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) h += l # long Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Tue Jun 10 12:10:31 2008 @@ -7895,6 +7895,29 @@ \n\ "); +static PyObject * +unicode__sizeof__(PyUnicodeObject *v) +{ + PyObject *res = NULL, *defsize = NULL; + + res = PyInt_FromSsize_t(sizeof(PyUnicodeObject) + + sizeof(Py_UNICODE) * (v->length + 1)); + if (v->defenc) { + defsize = PyObject_CallMethod(v->defenc, "__sizeof__", NULL); + if (defsize == NULL) { + Py_DECREF(res); + return NULL; + } + res = PyNumber_Add(res, defsize); + Py_DECREF(defsize); + } + return res; +} + +PyDoc_STRVAR(sizeof__doc__, +"S.__sizeof__() -> size of S in memory, in bytes\n\ +\n\ +"); static PyObject * unicode_getnewargs(PyUnicodeObject *v) @@ -7952,6 +7975,7 @@ {"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__}, {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, + {"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__}, #if 0 {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif From python-checkins at python.org Tue Jun 10 14:46:39 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 10 Jun 2008 14:46:39 +0200 (CEST) Subject: [Python-checkins] r64067 - python/trunk/Modules/itertoolsmodule.c Message-ID: <20080610124639.A68D61E4002@bag.python.org> Author: georg.brandl Date: Tue Jun 10 14:46:39 2008 New Revision: 64067 Log: #2536: fix itertools.permutations and itertools.combinations docstrings. Modified: python/trunk/Modules/itertoolsmodule.c Modified: python/trunk/Modules/itertoolsmodule.c ============================================================================== --- python/trunk/Modules/itertoolsmodule.c (original) +++ python/trunk/Modules/itertoolsmodule.c Tue Jun 10 14:46:39 2008 @@ -2198,7 +2198,7 @@ } PyDoc_STRVAR(combinations_doc, -"combinations(iterables) --> combinations object\n\ +"combinations(iterable[, r]) --> combinations object\n\ \n\ Return successive r-length combinations of elements in the iterable.\n\n\ combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); @@ -2469,10 +2469,10 @@ } PyDoc_STRVAR(permutations_doc, -"permutations(iterables[, r]) --> permutations object\n\ +"permutations(iterable[, r]) --> permutations object\n\ \n\ Return successive r-length permutations of elements in the iterable.\n\n\ -permutations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); +permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)"); static PyTypeObject permutations_type = { PyVarObject_HEAD_INIT(NULL, 0) From python-checkins at python.org Tue Jun 10 15:37:13 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 10 Jun 2008 15:37:13 +0200 (CEST) Subject: [Python-checkins] r64068 - python/trunk/Doc/library/asyncore.rst Message-ID: <20080610133713.F29D81E4002@bag.python.org> Author: benjamin.peterson Date: Tue Jun 10 15:37:13 2008 New Revision: 64068 Log: fix markup Modified: python/trunk/Doc/library/asyncore.rst Modified: python/trunk/Doc/library/asyncore.rst ============================================================================== --- python/trunk/Doc/library/asyncore.rst (original) +++ python/trunk/Doc/library/asyncore.rst Tue Jun 10 15:37:13 2008 @@ -223,19 +223,20 @@ garbage-collected. .. class:: file_dispatcher() + A file_dispatcher takes a file descriptor or file object along with an optional map argument and wraps it for use with the :cfunc:`poll`\ or :cfunc:`loop`\ functions. If provided a file object or anything with a :cfunc:`fileno`\ method, that method will be called and passed to the - :class:`file_wrapper` constructor. - Availability: UNIX + :class:`file_wrapper` constructor. Availability: UNIX + +.. class:: file_wrapper() -.. class::file_wrapper() A file_wrapper takes an integer file descriptor and calls os.dup() to duplicate the handle so that the original handle may be closed independently of the file_wrapper. This class implements sufficient methods to emulate a - socket for use by the file_dispatcher class. - Availability: UNIX + socket for use by the file_dispatcher class. Availability: UNIX + .. _asyncore-example: From python-checkins at python.org Tue Jun 10 15:53:25 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 10 Jun 2008 15:53:25 +0200 (CEST) Subject: [Python-checkins] r64069 - python/trunk/Doc/library/asyncore.rst Message-ID: <20080610135325.97FDD1E4002@bag.python.org> Author: georg.brandl Date: Tue Jun 10 15:53:24 2008 New Revision: 64069 Log: more markup fix. Modified: python/trunk/Doc/library/asyncore.rst Modified: python/trunk/Doc/library/asyncore.rst ============================================================================== --- python/trunk/Doc/library/asyncore.rst (original) +++ python/trunk/Doc/library/asyncore.rst Tue Jun 10 15:53:24 2008 @@ -224,18 +224,18 @@ .. class:: file_dispatcher() - A file_dispatcher takes a file descriptor or file object along with an - optional map argument and wraps it for use with the :cfunc:`poll`\ or - :cfunc:`loop`\ functions. If provided a file object or anything with a - :cfunc:`fileno`\ method, that method will be called and passed to the - :class:`file_wrapper` constructor. Availability: UNIX + A file_dispatcher takes a file descriptor or file object along with an + optional map argument and wraps it for use with the :cfunc:`poll` or + :cfunc:`loop` functions. If provided a file object or anything with a + :cfunc:`fileno` method, that method will be called and passed to the + :class:`file_wrapper` constructor. Availability: UNIX. .. class:: file_wrapper() - A file_wrapper takes an integer file descriptor and calls os.dup() to - duplicate the handle so that the original handle may be closed independently - of the file_wrapper. This class implements sufficient methods to emulate a - socket for use by the file_dispatcher class. Availability: UNIX + A file_wrapper takes an integer file descriptor and calls :func:`os.dup` to + duplicate the handle so that the original handle may be closed independently + of the file_wrapper. This class implements sufficient methods to emulate a + socket for use by the :class:`file_dispatcher` class. Availability: UNIX. .. _asyncore-example: From python-checkins at python.org Tue Jun 10 16:02:46 2008 From: python-checkins at python.org (thomas.heller) Date: Tue, 10 Jun 2008 16:02:46 +0200 (CEST) Subject: [Python-checkins] r64070 - python/trunk/Modules/_ctypes/callproc.c Message-ID: <20080610140246.630D11E4002@bag.python.org> Author: thomas.heller Date: Tue Jun 10 16:02:46 2008 New Revision: 64070 Log: Add an optional 'offset' parameter to byref, defaultingto zero. Modified: python/trunk/Modules/_ctypes/callproc.c Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Tue Jun 10 16:02:46 2008 @@ -1561,7 +1561,7 @@ } static char byref_doc[] = -"byref(C instance) -> byref-object\n" +"byref(C instance[, offset=0]) -> byref-object\n" "Return a pointer lookalike to a C instance, only usable\n" "as function argument"; @@ -1570,9 +1570,21 @@ * but still has a reference to self. */ static PyObject * -byref(PyObject *self, PyObject *obj) +byref(PyObject *self, PyObject *args) { PyCArgObject *parg; + PyObject *obj; + PyObject *pyoffset = NULL; + Py_ssize_t offset = 0; + + if (!PyArg_UnpackTuple(args, "byref", 1, 2, + &obj, &pyoffset)) + return NULL; + if (pyoffset) { + offset = PyNumber_AsSsize_t(pyoffset, NULL); + if (offset == -1 && PyErr_Occurred()) + return NULL; + } if (!CDataObject_Check(obj)) { PyErr_Format(PyExc_TypeError, "byref() argument must be a ctypes instance, not '%s'", @@ -1588,7 +1600,7 @@ parg->pffi_type = &ffi_type_pointer; Py_INCREF(obj); parg->obj = obj; - parg->value.p = ((CDataObject *)obj)->b_ptr; + parg->value.p = (char *)((CDataObject *)obj)->b_ptr + offset; return (PyObject *)parg; } @@ -1876,7 +1888,7 @@ #endif {"alignment", align_func, METH_O, alignment_doc}, {"sizeof", sizeof_func, METH_O, sizeof_doc}, - {"byref", byref, METH_O, byref_doc}, + {"byref", byref, METH_VARARGS, byref_doc}, {"addressof", addressof, METH_O, addressof_doc}, {"call_function", call_function, METH_VARARGS }, {"call_cdeclfunction", call_cdeclfunction, METH_VARARGS }, From python-checkins at python.org Tue Jun 10 16:07:13 2008 From: python-checkins at python.org (thomas.heller) Date: Tue, 10 Jun 2008 16:07:13 +0200 (CEST) Subject: [Python-checkins] r64071 - python/trunk/Misc/NEWS Message-ID: <20080610140713.317491E4002@bag.python.org> Author: thomas.heller Date: Tue Jun 10 16:07:12 2008 New Revision: 64071 Log: NEWS entry for: Add an optional 'offset' parameter to byref, defaulting to zero. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 10 16:07:12 2008 @@ -77,6 +77,10 @@ Library ------- +- The ctypes.byref function now takes an optional second parameter + which allows to specify an offset in bytes for the constructed + pointer-like object. + - Added the ast module. - Factored out the indentation cleaning from inspect.getdoc() into From python-checkins at python.org Tue Jun 10 16:31:48 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 10 Jun 2008 16:31:48 +0200 (CEST) Subject: [Python-checkins] r64072 - in python/branches/tlee-ast-optimize: Doc/library/stdtypes.rst Lib/test/test_set.py Misc/NEWS Modules/mathmodule.c Objects/setobject.c Message-ID: <20080610143148.7953E1E4056@bag.python.org> Author: thomas.lee Date: Tue Jun 10 16:31:47 2008 New Revision: 64072 Log: Merged revisions 64053-64056 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64054 | raymond.hettinger | 2008-06-09 21:24:47 +1000 (Mon, 09 Jun 2008) | 1 line Unhappy buildbots. Revert 64052. Long doubles have unexpected effects on some builds. ........ r64055 | raymond.hettinger | 2008-06-09 23:07:27 +1000 (Mon, 09 Jun 2008) | 1 line Let set.intersection() and set.intersection_update() take multiple input arguments. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Lib/test/test_set.py python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/mathmodule.c python/branches/tlee-ast-optimize/Objects/setobject.c Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Tue Jun 10 16:31:47 2008 @@ -1575,11 +1575,14 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: intersection(other) - set & other + .. method:: intersection(other, ...) + set & other & ... Return a new set with elements common to both sets. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: difference(other) set - other @@ -1639,11 +1642,14 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: intersection_update(other) - set &= other + .. method:: intersection_update(other, ...) + set &= other & ... Update the set, keeping only elements found in it and *other*. + .. versionchanged:: 2.6 + Accepts multiple input iterables. + .. method:: difference_update(other) set -= other Modified: python/branches/tlee-ast-optimize/Lib/test/test_set.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_set.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_set.py Tue Jun 10 16:31:47 2008 @@ -103,6 +103,7 @@ self.assertEqual(self.thetype('abcba').intersection(C('efgfe')), set('')) self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) self.assertEqual(self.thetype('abcba').intersection(C('ef')), set('')) + self.assertEqual(self.thetype('abcba').intersection(C('cbcf'), C('bag')), set('b')) def test_isdisjoint(self): def f(s1, s2): @@ -429,6 +430,11 @@ s = self.thetype('abcba') self.assertEqual(s.intersection_update(C(p)), None) self.assertEqual(s, set(q)) + ss = 'abcba' + s = self.thetype(ss) + t = 'cbc' + self.assertEqual(s.intersection_update(C(p), C(t)), None) + self.assertEqual(s, set('abcba')&set(p)&set(t)) def test_iand(self): self.s &= set(self.otherword) Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Tue Jun 10 16:31:47 2008 @@ -12,7 +12,8 @@ Core and Builtins ----------------- -- The set methods, update() and union() now accept multiple arguments. +- Several set methods now accept multiple arguments: update(), union(), + intersection() and intersection_update(). - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. Modified: python/branches/tlee-ast-optimize/Modules/mathmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/mathmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/mathmodule.c Tue Jun 10 16:31:47 2008 @@ -324,12 +324,17 @@ Note 3: The itermediate values lo, yr, and hi are declared volatile so aggressive compilers won't algebraicly reduce lo to always be exactly 0.0. + Also, the volatile declaration forces the values to be stored in memory as + regular doubles instead of extended long precision (80-bit) values. This + prevents double rounding because any addition or substraction of two doubles + can be resolved exactly into double-sized hi and lo values. As long as the + hi value gets forced into a double before yr and lo are computed, the extra + bits in downstream extended precision operations (x87 for example) will be + exactly zero and therefore can be losslessly stored back into a double, + thereby preventing double rounding. - Note 4: Intermediate values and partial sums are declared as long doubles - as a way to eliminate double rounding environments where the operations - are carried-out in extended precision but stored in double precision - variables. In some cases, this doesn't help because the compiler - treats long doubles as doubles (i.e. the MS compiler for Win32 builds). + Note 4: A similar implementation is in Modules/cmathmodule.c. + Be sure to update both when making changes. Note 5: The signature of math.sum() differs from __builtin__.sum() because the start argument doesn't make sense in the context of @@ -342,28 +347,28 @@ /* Extend the partials array p[] by doubling its size. */ static int /* non-zero on error */ -_sum_realloc(long double **p_ptr, Py_ssize_t n, - long double *ps, Py_ssize_t *m_ptr) +_sum_realloc(double **p_ptr, Py_ssize_t n, + double *ps, Py_ssize_t *m_ptr) { void *v = NULL; Py_ssize_t m = *m_ptr; - m += m; /* long double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(long double))) { - long double *p = *p_ptr; + m += m; /* double */ + if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { + double *p = *p_ptr; if (p == ps) { - v = PyMem_Malloc(sizeof(long double) * m); + v = PyMem_Malloc(sizeof(double) * m); if (v != NULL) - memcpy(v, ps, sizeof(long double) * n); + memcpy(v, ps, sizeof(double) * n); } else - v = PyMem_Realloc(p, sizeof(long double) * m); + v = PyMem_Realloc(p, sizeof(double) * m); } if (v == NULL) { /* size overflow or no memory */ PyErr_SetString(PyExc_MemoryError, "math sum partials"); return 1; } - *p_ptr = (long double*) v; + *p_ptr = (double*) v; *m_ptr = m; return 0; } @@ -403,8 +408,8 @@ { PyObject *item, *iter, *sum = NULL; Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - long double x, y, t, ps[NUM_PARTIALS], *p = ps; - volatile long double hi, yr, lo; + double x, y, t, ps[NUM_PARTIALS], *p = ps; + volatile double hi, yr, lo; iter = PyObject_GetIter(seq); if (iter == NULL) @@ -423,7 +428,7 @@ goto _sum_error; break; } - x = (long double)PyFloat_AsDouble(item); + x = PyFloat_AsDouble(item); Py_DECREF(item); if (PyErr_Occurred()) goto _sum_error; @@ -490,7 +495,7 @@ goto _sum_error; } } - sum = PyFloat_FromDouble((double)hi); + sum = PyFloat_FromDouble(hi); _sum_error: PyFPE_END_PROTECT(hi) @@ -507,7 +512,6 @@ Return an accurate floating point sum of values in the iterable.\n\ Assumes IEEE-754 floating point arithmetic."); - static PyObject * math_factorial(PyObject *self, PyObject *arg) { Modified: python/branches/tlee-ast-optimize/Objects/setobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/setobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/setobject.c Tue Jun 10 16:31:47 2008 @@ -1306,6 +1306,26 @@ return (PyObject *)result; } +static PyObject * +set_intersection_multi(PySetObject *so, PyObject *args) +{ + Py_ssize_t i; + PyObject *result = (PyObject *)so; + + Py_INCREF(so); + for (i=0 ; i Author: thomas.lee Date: Tue Jun 10 17:03:15 2008 New Revision: 64074 Log: Merged revisions 64057-64072 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64057 | alexandre.vassalotti | 2008-06-10 13:34:53 +1000 (Tue, 10 Jun 2008) | 2 lines Issue 2582: Fix pickling of xrange objects. ........ r64058 | alexandre.vassalotti | 2008-06-10 14:01:23 +1000 (Tue, 10 Jun 2008) | 3 lines Added better pickling support to xrange objects. Cleaned up the unit test. ........ r64062 | josiah.carlson | 2008-06-10 15:00:08 +1000 (Tue, 10 Jun 2008) | 5 lines Applying updated patch from Issue 1736190, which addresses partial issues in: 909005 and 17361001, as well as completely as possible issues 539444, 760475, 777588, 889153, 953599, 1025525, 1063924, and 658749. This patch also includes doc and test updates as necessary. ........ r64063 | martin.v.loewis | 2008-06-10 15:03:35 +1000 (Tue, 10 Jun 2008) | 2 lines Add Gregor Lingl. ........ r64064 | georg.brandl | 2008-06-10 17:45:28 +1000 (Tue, 10 Jun 2008) | 2 lines Add the "ast" module, containing helpers to ease use of the "_ast" classes. ........ r64065 | raymond.hettinger | 2008-06-10 17:57:15 +1000 (Tue, 10 Jun 2008) | 1 line Add Arnaud for his efforts on multi-arg set operations. ........ r64066 | robert.schuppenies | 2008-06-10 20:10:31 +1000 (Tue, 10 Jun 2008) | 2 lines Issue 3048: Fixed sys.getsizeof for unicode objects. ........ r64067 | georg.brandl | 2008-06-10 22:46:39 +1000 (Tue, 10 Jun 2008) | 2 lines #2536: fix itertools.permutations and itertools.combinations docstrings. ........ r64068 | benjamin.peterson | 2008-06-10 23:37:13 +1000 (Tue, 10 Jun 2008) | 2 lines fix markup ........ r64069 | georg.brandl | 2008-06-10 23:53:24 +1000 (Tue, 10 Jun 2008) | 2 lines more markup fix. ........ r64070 | thomas.heller | 2008-06-11 00:02:46 +1000 (Wed, 11 Jun 2008) | 2 lines Add an optional 'offset' parameter to byref, defaultingto zero. ........ r64071 | thomas.heller | 2008-06-11 00:07:12 +1000 (Wed, 11 Jun 2008) | 3 lines NEWS entry for: Add an optional 'offset' parameter to byref, defaulting to zero. ........ Added: python/branches/tlee-ast-optimize/Doc/library/ast.rst - copied unchanged from r64071, /python/trunk/Doc/library/ast.rst python/branches/tlee-ast-optimize/Lib/ast.py - copied unchanged from r64071, /python/trunk/Lib/ast.py Removed: python/branches/tlee-ast-optimize/Doc/library/_ast.rst Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/ACKS.txt python/branches/tlee-ast-optimize/Doc/library/asynchat.rst python/branches/tlee-ast-optimize/Doc/library/asyncore.rst python/branches/tlee-ast-optimize/Doc/library/language.rst python/branches/tlee-ast-optimize/Lib/asynchat.py python/branches/tlee-ast-optimize/Lib/asyncore.py python/branches/tlee-ast-optimize/Lib/test/test_ast.py python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_xrange.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Misc/developers.txt python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c python/branches/tlee-ast-optimize/Objects/rangeobject.c python/branches/tlee-ast-optimize/Objects/unicodeobject.c Modified: python/branches/tlee-ast-optimize/Doc/ACKS.txt ============================================================================== --- python/branches/tlee-ast-optimize/Doc/ACKS.txt (original) +++ python/branches/tlee-ast-optimize/Doc/ACKS.txt Tue Jun 10 17:03:15 2008 @@ -157,6 +157,7 @@ * Bernhard Reiter * Armin Rigo * Wes Rishel + * Armin Ronacher * Jim Roskind * Guido van Rossum * Donald Wallace Rouse II Deleted: python/branches/tlee-ast-optimize/Doc/library/_ast.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/_ast.rst Tue Jun 10 17:03:15 2008 +++ (empty file) @@ -1,85 +0,0 @@ -.. _ast: - -Abstract Syntax Trees -===================== - -.. module:: _ast - :synopsis: Abstract Syntax Tree classes. - -.. sectionauthor:: Martin v. L?wis - - -.. versionadded:: 2.5 - -The ``_ast`` module helps Python applications to process trees of the Python -abstract syntax grammar. The abstract syntax itself might change with each -Python release; this module helps to find out programmatically what the current -grammar looks like. - -An abstract syntax tree can be generated by passing :data:`_ast.PyCF_ONLY_AST` -as a flag to the :func:`compile` builtin function. The result will be a tree of -objects whose classes all inherit from :class:`_ast.AST`. - -A modified abstract syntax tree can be compiled into a Python code object using -the built-in :func:`compile` function. - -The actual classes are derived from the ``Parser/Python.asdl`` file, which is -reproduced below. There is one class defined for each left-hand side symbol in -the abstract grammar (for example, ``_ast.stmt`` or ``_ast.expr``). In addition, -there is one class defined for each constructor on the right-hand side; these -classes inherit from the classes for the left-hand side trees. For example, -``_ast.BinOp`` inherits from ``_ast.expr``. For production rules with -alternatives (aka "sums"), the left-hand side class is abstract: only instances -of specific constructor nodes are ever created. - -Each concrete class has an attribute ``_fields`` which gives the names of all -child nodes. - -Each instance of a concrete class has one attribute for each child node, of the -type as defined in the grammar. For example, ``_ast.BinOp`` instances have an -attribute ``left`` of type ``_ast.expr``. Instances of ``_ast.expr`` and -``_ast.stmt`` subclasses also have lineno and col_offset attributes. The lineno -is the line number of source text (1 indexed so the first line is line 1) and -the col_offset is the utf8 byte offset of the first token that generated the -node. The utf8 offset is recorded because the parser uses utf8 internally. - -If these attributes are marked as optional in the grammar (using a question -mark), the value might be ``None``. If the attributes can have zero-or-more -values (marked with an asterisk), the values are represented as Python lists. -All possible attributes must be present and have valid values when compiling an -AST with :func:`compile`. - -The constructor of a class ``_ast.T`` parses their arguments as follows: - -* If there are positional arguments, there must be as many as there are items in - ``T._fields``; they will be assigned as attributes of these names. -* If there are keyword arguments, they will set the attributes of the same names - to the given values. - -For example, to create and populate a ``UnaryOp`` node, you could use :: - - node = _ast.UnaryOp() - node.op = _ast.USub() - node.operand = _ast.Num() - node.operand.n = 5 - node.operand.lineno = 0 - node.operand.col_offset = 0 - node.lineno = 0 - node.col_offset = 0 - -or the more compact :: - - node = _ast.UnaryOp(_ast.USub(), _ast.Num(5, lineno=0, col_offset=0), - lineno=0, col_offset=0) - - - -Abstract Grammar ----------------- - -The module defines a string constant ``__version__`` which is the decimal -Subversion revision number of the file shown below. - -The abstract grammar is currently defined as follows: - -.. literalinclude:: ../../Parser/Python.asdl Modified: python/branches/tlee-ast-optimize/Doc/library/asynchat.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/asynchat.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/asynchat.rst Tue Jun 10 17:03:15 2008 @@ -81,6 +81,12 @@ :exc:`NotImplementedError` exception. +.. method:: async_chat._collect_incoming_data(data) + + Sample implementation of a data collection rutine to be used in conjunction + with :meth:`_get_data` in a user-specified :meth:`found_terminator`. + + .. method:: async_chat.discard_buffers() In emergencies this method will discard any data held in the input and/or @@ -95,6 +101,12 @@ should be available via an instance attribute. +.. method:: async_chat._get_data() + + Will return and clear the data received with the sample + :meth:`_collect_incoming_data` implementation. + + .. method:: async_chat.get_terminator() Returns the current terminator for the channel. Modified: python/branches/tlee-ast-optimize/Doc/library/asyncore.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/asyncore.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/asyncore.rst Tue Jun 10 17:03:15 2008 @@ -222,6 +222,21 @@ flushed). Sockets are automatically closed when they are garbage-collected. +.. class:: file_dispatcher() + + A file_dispatcher takes a file descriptor or file object along with an + optional map argument and wraps it for use with the :cfunc:`poll` or + :cfunc:`loop` functions. If provided a file object or anything with a + :cfunc:`fileno` method, that method will be called and passed to the + :class:`file_wrapper` constructor. Availability: UNIX. + +.. class:: file_wrapper() + + A file_wrapper takes an integer file descriptor and calls :func:`os.dup` to + duplicate the handle so that the original handle may be closed independently + of the file_wrapper. This class implements sufficient methods to emulate a + socket for use by the :class:`file_dispatcher` class. Availability: UNIX. + .. _asyncore-example: Modified: python/branches/tlee-ast-optimize/Doc/library/language.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/language.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/language.rst Tue Jun 10 17:03:15 2008 @@ -15,7 +15,7 @@ .. toctree:: parser.rst - _ast.rst + ast.rst symbol.rst token.rst keyword.rst Modified: python/branches/tlee-ast-optimize/Lib/asynchat.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/asynchat.py (original) +++ python/branches/tlee-ast-optimize/Lib/asynchat.py Tue Jun 10 17:03:15 2008 @@ -60,16 +60,35 @@ ac_out_buffer_size = 4096 def __init__ (self, conn=None): + # for string terminator matching self.ac_in_buffer = '' - self.ac_out_buffer = '' - self.producer_fifo = fifo() + + # we use a list here rather than cStringIO for a few reasons... + # del lst[:] is faster than sio.truncate(0) + # lst = [] is faster than sio.truncate(0) + # cStringIO will be gaining unicode support in py3k, which + # will negatively affect the performance of bytes compared to + # a ''.join() equivalent + self.incoming = [] + + # we toss the use of the "simple producer" and replace it with + # a pure deque, which the original fifo was a wrapping of + self.producer_fifo = deque() asyncore.dispatcher.__init__ (self, conn) def collect_incoming_data(self, data): - raise NotImplementedError, "must be implemented in subclass" + raise NotImplementedError("must be implemented in subclass") + + def _collect_incoming_data(self, data): + self.incoming.append(data) + + def _get_data(self): + d = ''.join(self.incoming) + del self.incoming[:] + return d def found_terminator(self): - raise NotImplementedError, "must be implemented in subclass" + raise NotImplementedError("must be implemented in subclass") def set_terminator (self, term): "Set the input delimiter. Can be a fixed string of any length, an integer, or None" @@ -96,7 +115,7 @@ # Continue to search for self.terminator in self.ac_in_buffer, # while calling self.collect_incoming_data. The while loop # is necessary because we might read several data+terminator - # combos with a single recv(1024). + # combos with a single recv(4096). while self.ac_in_buffer: lb = len(self.ac_in_buffer) @@ -150,87 +169,82 @@ self.ac_in_buffer = '' def handle_write (self): - self.initiate_send () + self.initiate_send() def handle_close (self): self.close() def push (self, data): - self.producer_fifo.push (simple_producer (data)) + sabs = self.ac_out_buffer_size + if len(data) > sabs: + for i in xrange(0, len(data), sabs): + self.producer_fifo.append(data[i:i+sabs]) + else: + self.producer_fifo.append(data) self.initiate_send() def push_with_producer (self, producer): - self.producer_fifo.push (producer) + self.producer_fifo.append(producer) self.initiate_send() def readable (self): "predicate for inclusion in the readable for select()" - return (len(self.ac_in_buffer) <= self.ac_in_buffer_size) + # cannot use the old predicate, it violates the claim of the + # set_terminator method. + + # return (len(self.ac_in_buffer) <= self.ac_in_buffer_size) + return 1 def writable (self): "predicate for inclusion in the writable for select()" - # return len(self.ac_out_buffer) or len(self.producer_fifo) or (not self.connected) - # this is about twice as fast, though not as clear. - return not ( - (self.ac_out_buffer == '') and - self.producer_fifo.is_empty() and - self.connected - ) + return self.producer_fifo or (not self.connected) def close_when_done (self): "automatically close this channel once the outgoing queue is empty" - self.producer_fifo.push (None) + self.producer_fifo.append(None) - # refill the outgoing buffer by calling the more() method - # of the first producer in the queue - def refill_buffer (self): - while 1: - if len(self.producer_fifo): - p = self.producer_fifo.first() - # a 'None' in the producer fifo is a sentinel, - # telling us to close the channel. - if p is None: - if not self.ac_out_buffer: - self.producer_fifo.pop() - self.close() - return - elif isinstance(p, str): - self.producer_fifo.pop() - self.ac_out_buffer = self.ac_out_buffer + p + def initiate_send(self): + while self.producer_fifo and self.connected: + first = self.producer_fifo[0] + # handle empty string/buffer or None entry + if not first: + del self.producer_fifo[0] + if first is None: + self.handle_close() return - data = p.more() + + # handle classic producer behavior + obs = self.ac_out_buffer_size + try: + data = buffer(first, 0, obs) + except TypeError: + data = first.more() if data: - self.ac_out_buffer = self.ac_out_buffer + data - return + self.producer_fifo.appendleft(data) else: - self.producer_fifo.pop() - else: - return + del self.producer_fifo[0] + continue - def initiate_send (self): - obs = self.ac_out_buffer_size - # try to refill the buffer - if (len (self.ac_out_buffer) < obs): - self.refill_buffer() - - if self.ac_out_buffer and self.connected: - # try to send the buffer + # send the data try: - num_sent = self.send (self.ac_out_buffer[:obs]) - if num_sent: - self.ac_out_buffer = self.ac_out_buffer[num_sent:] - - except socket.error, why: + num_sent = self.send(data) + except socket.error: self.handle_error() return + if num_sent: + if num_sent < len(data) or obs < len(first): + self.producer_fifo[0] = first[num_sent:] + else: + del self.producer_fifo[0] + # we tried to send some actual data + return + def discard_buffers (self): # Emergencies only! self.ac_in_buffer = '' - self.ac_out_buffer = '' - while self.producer_fifo: - self.producer_fifo.pop() - + del self.incoming[:] + self.producer_fifo.clear() class simple_producer: Modified: python/branches/tlee-ast-optimize/Lib/asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/asyncore.py Tue Jun 10 17:03:15 2008 @@ -53,20 +53,26 @@ import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ - ENOTCONN, ESHUTDOWN, EINTR, EISCONN, errorcode + ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, errorcode try: socket_map except NameError: socket_map = {} +def _strerror(err): + res = os.strerror(err) + if res == 'Unknown error': + res = errorcode[err] + return res + class ExitNow(Exception): pass def read(obj): try: obj.handle_read_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -74,15 +80,15 @@ def write(obj): try: obj.handle_write_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() -def _exception (obj): +def _exception(obj): try: obj.handle_expt_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -95,7 +101,7 @@ obj.handle_write_event() if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): obj.handle_expt_event() - except ExitNow: + except (ExitNow, KeyboardInterrupt, SystemExit): raise except: obj.handle_error() @@ -116,14 +122,15 @@ e.append(fd) if [] == r == w == e: time.sleep(timeout) - else: - try: - r, w, e = select.select(r, w, e, timeout) - except select.error, err: - if err[0] != EINTR: - raise - else: - return + return + + try: + r, w, e = select.select(r, w, e, timeout) + except select.error, err: + if err[0] != EINTR: + raise + else: + return for fd in r: obj = map.get(fd) @@ -209,18 +216,29 @@ else: self._map = map + self._fileno = None + if sock: + # Set to nonblocking just to make sure for cases where we + # get a socket from a blocking source. + sock.setblocking(0) self.set_socket(sock, map) - # I think it should inherit this anyway - self.socket.setblocking(0) self.connected = True - # XXX Does the constructor require that the socket passed - # be connected? + # The constructor no longer requires that the socket + # passed be connected. try: self.addr = sock.getpeername() except socket.error: - # The addr isn't crucial - pass + if err[0] == ENOTCONN: + # To handle the case where we got an unconnected + # socket. + self.connected = False + else: + # The socket is broken in some unknown way, alert + # the user and remove it from the map (to prevent + # polling of broken sockets). + self.del_channel(map) + raise else: self.socket = None @@ -254,10 +272,9 @@ def create_socket(self, family, type): self.family_and_type = family, type - self.socket = socket.socket(family, type) - self.socket.setblocking(0) - self._fileno = self.socket.fileno() - self.add_channel() + sock = socket.socket(family, type) + sock.setblocking(0) + self.set_socket(sock) def set_socket(self, sock, map=None): self.socket = sock @@ -295,7 +312,7 @@ def listen(self, num): self.accepting = True if os.name == 'nt' and num > 5: - num = 1 + num = 5 return self.socket.listen(num) def bind(self, addr): @@ -310,10 +327,9 @@ return if err in (0, EISCONN): self.addr = address - self.connected = True - self.handle_connect() + self.handle_connect_event() else: - raise socket.error, (err, errorcode[err]) + raise socket.error(err, errorcode[err]) def accept(self): # XXX can return either an address pair or None @@ -333,9 +349,11 @@ except socket.error, why: if why[0] == EWOULDBLOCK: return 0 + elif why[0] in (ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): + self.handle_close() + return 0 else: raise - return 0 def recv(self, buffer_size): try: @@ -349,15 +367,21 @@ return data except socket.error, why: # winsock sometimes throws ENOTCONN - if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: + if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED]: self.handle_close() return '' else: raise def close(self): + self.connected = False + self.accepting = False self.del_channel() - self.socket.close() + try: + self.socket.close() + except socket.error, why: + if why[0] not in (ENOTCONN, EBADF): + raise # cheap inheritance, used to pass all other attribute # references to the underlying socket object. @@ -377,27 +401,53 @@ def handle_read_event(self): if self.accepting: - # for an accepting socket, getting a read implies - # that we are connected - if not self.connected: - self.connected = True + # accepting sockets are never connected, they "spawn" new + # sockets that are connected self.handle_accept() elif not self.connected: - self.handle_connect() - self.connected = True + self.handle_connect_event() self.handle_read() else: self.handle_read() + def handle_connect_event(self): + self.connected = True + self.handle_connect() + def handle_write_event(self): - # getting a write implies that we are connected + if self.accepting: + # Accepting sockets shouldn't get a write event. + # We will pretend it didn't happen. + return + if not self.connected: - self.handle_connect() - self.connected = True + #check for errors + err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) + if err != 0: + raise socket.error(err, strerror(err)) + + self.handle_connect_event() self.handle_write() def handle_expt_event(self): - self.handle_expt() + # if the handle_expt is the same default worthless method, + # we'll not even bother calling it, we'll instead generate + # a useful error + x = True + try: + y1 = self.__class__.handle_expt.im_func + y2 = dispatcher.handle_expt.im_func + x = y1 is y2 + except AttributeError: + pass + + if x: + err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) + msg = _strerror(err) + + raise socket.error(err, msg) + else: + self.handle_expt() def handle_error(self): nil, t, v, tbinfo = compact_traceback() @@ -473,7 +523,8 @@ def compact_traceback(): t, v, tb = sys.exc_info() tbinfo = [] - assert tb # Must have a traceback + if not tb: # Must have a traceback + raise AssertionError("traceback does not exist") while tb: tbinfo.append(( tb.tb_frame.f_code.co_filename, @@ -489,11 +540,22 @@ info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo]) return (file, function, line), t, v, info -def close_all(map=None): +def close_all(map=None, ignore_all=False): if map is None: map = socket_map for x in map.values(): - x.socket.close() + try: + x.close() + except OSError, x: + if x[0] == EBADF: + pass + elif not ignore_all: + raise + except (ExitNow, KeyboardInterrupt, SystemExit): + raise + except: + if not ignore_all: + raise map.clear() # Asynchronous File I/O: @@ -513,11 +575,12 @@ import fcntl class file_wrapper: - # here we override just enough to make a file + # Here we override just enough to make a file # look like a socket for the purposes of asyncore. + # The passed fd is automatically os.dup()'d def __init__(self, fd): - self.fd = fd + self.fd = os.dup(fd) def recv(self, *args): return os.read(self.fd, *args) @@ -539,6 +602,10 @@ def __init__(self, fd, map=None): dispatcher.__init__(self, None, map) self.connected = True + try: + fd = fd.fileno() + except AttributeError: + pass self.set_file(fd) # set it to non-blocking mode flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0) Modified: python/branches/tlee-ast-optimize/Lib/test/test_ast.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_ast.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_ast.py Tue Jun 10 17:03:15 2008 @@ -1,6 +1,6 @@ import sys, itertools, unittest from test import test_support -import _ast +import ast def to_tuple(t): if t is None or isinstance(t, (basestring, int, long, complex)): @@ -123,9 +123,9 @@ class AST_Tests(unittest.TestCase): def _assert_order(self, ast_node, parent_pos): - if not isinstance(ast_node, _ast.AST) or ast_node._fields is None: + if not isinstance(ast_node, ast.AST) or ast_node._fields is None: return - if isinstance(ast_node, (_ast.expr, _ast.stmt, _ast.excepthandler)): + if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)): node_pos = (ast_node.lineno, ast_node.col_offset) self.assert_(node_pos >= parent_pos) parent_pos = (ast_node.lineno, ast_node.col_offset) @@ -148,24 +148,24 @@ self._assert_order(ast_tree, (0, 0)) def test_nodeclasses(self): - x = _ast.BinOp(1, 2, 3, lineno=0) + x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # node raises exception when not given enough arguments - self.assertRaises(TypeError, _ast.BinOp, 1, 2) + self.assertRaises(TypeError, ast.BinOp, 1, 2) # can set attributes through kwargs too - x = _ast.BinOp(left=1, op=2, right=3, lineno=0) + x = ast.BinOp(left=1, op=2, right=3, lineno=0) self.assertEquals(x.left, 1) self.assertEquals(x.op, 2) self.assertEquals(x.right, 3) self.assertEquals(x.lineno, 0) # this used to fail because Sub._fields was None - x = _ast.Sub() + x = ast.Sub() def test_pickling(self): import pickle @@ -182,8 +182,99 @@ ast2 = mod.loads(mod.dumps(ast, protocol)) self.assertEquals(to_tuple(ast2), to_tuple(ast)) + +class ASTHelpers_Test(unittest.TestCase): + + def test_parse(self): + a = ast.parse('foo(1 + 1)') + b = compile('foo(1 + 1)', '', 'exec', ast.PyCF_ONLY_AST) + self.assertEqual(ast.dump(a), ast.dump(b)) + + def test_dump(self): + node = ast.parse('spam(eggs, "and cheese")') + self.assertEqual(ast.dump(node), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), " + "args=[Name(id='eggs', ctx=Load()), Str(s='and cheese')], " + "keywords=[], starargs=None, kwargs=None))])" + ) + self.assertEqual(ast.dump(node, annotate_fields=False), + "Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), " + "Str('and cheese')], [], None, None))])" + ) + self.assertEqual(ast.dump(node, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), " + "lineno=1, col_offset=0), args=[Name(id='eggs', ctx=Load(), " + "lineno=1, col_offset=5), Str(s='and cheese', lineno=1, " + "col_offset=11)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_copy_location(self): + src = ast.parse('1 + 1', mode='eval') + src.body.right = ast.copy_location(ast.Num(2), src.body.right) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=1, col_offset=0), ' + 'op=Add(), right=Num(n=2, lineno=1, col_offset=4), lineno=1, ' + 'col_offset=0))' + ) + + def test_fix_missing_locations(self): + src = ast.parse('write("spam")') + src.body.append(ast.Expr(ast.Call(ast.Name('spam', ast.Load()), + [ast.Str('eggs')], [], None, None))) + self.assertEqual(src, ast.fix_missing_locations(src)) + self.assertEqual(ast.dump(src, include_attributes=True), + "Module(body=[Expr(value=Call(func=Name(id='write', ctx=Load(), " + "lineno=1, col_offset=0), args=[Str(s='spam', lineno=1, " + "col_offset=6)], keywords=[], starargs=None, kwargs=None, " + "lineno=1, col_offset=0), lineno=1, col_offset=0), " + "Expr(value=Call(func=Name(id='spam', ctx=Load(), lineno=1, " + "col_offset=0), args=[Str(s='eggs', lineno=1, col_offset=0)], " + "keywords=[], starargs=None, kwargs=None, lineno=1, " + "col_offset=0), lineno=1, col_offset=0)])" + ) + + def test_increment_lineno(self): + src = ast.parse('1 + 1', mode='eval') + self.assertEqual(ast.increment_lineno(src, n=3), src) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), ' + 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' + 'col_offset=0))' + ) + + def test_iter_fields(self): + node = ast.parse('foo()', mode='eval') + d = dict(ast.iter_fields(node.body)) + self.assertEqual(d.pop('func').id, 'foo') + self.assertEqual(d, {'keywords': [], 'kwargs': None, + 'args': [], 'starargs': None}) + + def test_iter_child_nodes(self): + node = ast.parse("spam(23, 42, eggs='leek')", mode='eval') + self.assertEqual(len(list(ast.iter_child_nodes(node.body))), 4) + iterator = ast.iter_child_nodes(node.body) + self.assertEqual(next(iterator).id, 'spam') + self.assertEqual(next(iterator).n, 23) + self.assertEqual(next(iterator).n, 42) + self.assertEqual(ast.dump(next(iterator)), + "keyword(arg='eggs', value=Str(s='leek'))" + ) + + def test_get_docstring(self): + node = ast.parse('def foo():\n """line one\n line two"""') + self.assertEqual(ast.get_docstring(node.body[0]), + 'line one\nline two') + + def test_literal_eval(self): + self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) + self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) + self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None)) + self.assertRaises(ValueError, ast.literal_eval, 'foo()') + + def test_main(): - test_support.run_unittest(AST_Tests) + test_support.run_unittest(AST_Tests, ASTHelpers_Test) def main(): if __name__ != '__main__': Modified: python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py Tue Jun 10 17:03:15 2008 @@ -27,6 +27,9 @@ def __init__(self): self.socket = dummysocket() + def close(self): + self.socket.close() + class exitingdummy: def __init__(self): pass Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Tue Jun 10 17:03:15 2008 @@ -421,11 +421,14 @@ self.file.close() test.test_support.unlink(test.test_support.TESTFN) - def check_sizeof(self, o, size): + def check_sizeof(self, o, size, size2=None): + """Check size of o. Possible are size and optionally size2).""" result = sys.getsizeof(o) - msg = 'wrong size for %s: got %d, expected %d' \ - % (type(o), result, size) - self.assertEqual(result, size, msg) + msg = 'wrong size for %s: got %d, expected ' % (type(o), result) + if (size2 != None) and (result != size): + self.assertEqual(result, size2, msg + str(size2)) + else: + self.assertEqual(result, size, msg + str(size)) def align(self, value): mod = value % self.p @@ -517,10 +520,10 @@ pass # type (PyTypeObject + PyNumberMethods + PyMappingMethods + # PySequenceMethods + PyBufferProcs) - len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p + l + 11*p + len_typeobject = p + 2*l + 15*p + l + 4*p + l + 9*p +\ + l + 11*p + self.align(4) self.check_sizeof(class_newstyle, - h + len_typeobject + 42*p + 10*p + 3*p + 6*p) - + h + len_typeobject + 41*p + 10*p + 3*p + 6*p) def test_specialtypes(self): i = self.i @@ -534,6 +537,24 @@ # list self.check_sizeof([], h + l + p + l) self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) + # unicode + import math + usize = math.log(sys.maxunicode + 1, 2) / 8 + samples = [u'', u'1'*100] + # we need to test for both sizes, because we don't know if the string + # has been cached + for s in samples: + basicsize = h + l + p + l + p + usize * (len(s) + 1) + self.check_sizeof(s, basicsize,\ + size2=basicsize + sys.getsizeof(str(s))) + # XXX trigger caching encoded version as Python string + s = samples[1] + try: + getattr(sys, s) + except AttributeError: + pass + finally: + self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) h += l # long Modified: python/branches/tlee-ast-optimize/Lib/test/test_xrange.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_xrange.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_xrange.py Tue Jun 10 17:03:15 2008 @@ -2,6 +2,7 @@ import test.test_support, unittest import sys +import pickle import warnings warnings.filterwarnings("ignore", "integer argument expected", @@ -57,6 +58,16 @@ self.assertEqual(len(r), sys.maxint) self.assertRaises(OverflowError, xrange, -sys.maxint-1, sys.maxint, 2) + def test_pickling(self): + testcases = [(13,), (0, 11), (-22, 10), (20, 3, -1), + (13, 21, 3), (-2, 2, 2)] + for proto in range(pickle.HIGHEST_PROTOCOL): + for t in testcases: + r = xrange(*t) + self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), + list(r)) + + def test_main(): test.test_support.run_unittest(XrangeTest) Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Tue Jun 10 17:03:15 2008 @@ -156,6 +156,7 @@ Jonathan Dasteel John DeGood Vincent Delft +Arnaud Delobelle Erik Demaine Roger Dev Raghuram Devarakonda @@ -574,6 +575,7 @@ Kevin Rodgers Giampaolo Rodola Mike Romberg +Armin Ronacher Case Roole Timothy Roscoe Jim Roskind Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Tue Jun 10 17:03:15 2008 @@ -77,6 +77,12 @@ Library ------- +- The ctypes.byref function now takes an optional second parameter + which allows to specify an offset in bytes for the constructed + pointer-like object. + +- Added the ast module. + - Factored out the indentation cleaning from inspect.getdoc() into inspect.cleandoc() to ease standalone use. Modified: python/branches/tlee-ast-optimize/Misc/developers.txt ============================================================================== --- python/branches/tlee-ast-optimize/Misc/developers.txt (original) +++ python/branches/tlee-ast-optimize/Misc/developers.txt Tue Jun 10 17:03:15 2008 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Gregor Lingl was given SVN access on 10 June 2008 by MvL, + for work on the turtle module. + - Robert Schuppenies was given SVN access on 21 May 2008 by MvL, for GSoC contributions. Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c Tue Jun 10 17:03:15 2008 @@ -1561,7 +1561,7 @@ } static char byref_doc[] = -"byref(C instance) -> byref-object\n" +"byref(C instance[, offset=0]) -> byref-object\n" "Return a pointer lookalike to a C instance, only usable\n" "as function argument"; @@ -1570,9 +1570,21 @@ * but still has a reference to self. */ static PyObject * -byref(PyObject *self, PyObject *obj) +byref(PyObject *self, PyObject *args) { PyCArgObject *parg; + PyObject *obj; + PyObject *pyoffset = NULL; + Py_ssize_t offset = 0; + + if (!PyArg_UnpackTuple(args, "byref", 1, 2, + &obj, &pyoffset)) + return NULL; + if (pyoffset) { + offset = PyNumber_AsSsize_t(pyoffset, NULL); + if (offset == -1 && PyErr_Occurred()) + return NULL; + } if (!CDataObject_Check(obj)) { PyErr_Format(PyExc_TypeError, "byref() argument must be a ctypes instance, not '%s'", @@ -1588,7 +1600,7 @@ parg->pffi_type = &ffi_type_pointer; Py_INCREF(obj); parg->obj = obj; - parg->value.p = ((CDataObject *)obj)->b_ptr; + parg->value.p = (char *)((CDataObject *)obj)->b_ptr + offset; return (PyObject *)parg; } @@ -1876,7 +1888,7 @@ #endif {"alignment", align_func, METH_O, alignment_doc}, {"sizeof", sizeof_func, METH_O, sizeof_doc}, - {"byref", byref, METH_O, byref_doc}, + {"byref", byref, METH_VARARGS, byref_doc}, {"addressof", addressof, METH_O, addressof_doc}, {"call_function", call_function, METH_VARARGS }, {"call_cdeclfunction", call_cdeclfunction, METH_VARARGS }, Modified: python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/itertoolsmodule.c Tue Jun 10 17:03:15 2008 @@ -2198,7 +2198,7 @@ } PyDoc_STRVAR(combinations_doc, -"combinations(iterables) --> combinations object\n\ +"combinations(iterable[, r]) --> combinations object\n\ \n\ Return successive r-length combinations of elements in the iterable.\n\n\ combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); @@ -2469,10 +2469,10 @@ } PyDoc_STRVAR(permutations_doc, -"permutations(iterables[, r]) --> permutations object\n\ +"permutations(iterable[, r]) --> permutations object\n\ \n\ Return successive r-length permutations of elements in the iterable.\n\n\ -permutations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); +permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)"); static PyTypeObject permutations_type = { PyVarObject_HEAD_INIT(NULL, 0) Modified: python/branches/tlee-ast-optimize/Objects/rangeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/rangeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/rangeobject.c Tue Jun 10 17:03:15 2008 @@ -129,6 +129,16 @@ return rtn; } +/* Pickling support */ +static PyObject * +range_reduce(rangeobject *r, PyObject *args) +{ + return Py_BuildValue("(O(iii))", Py_TYPE(r), + r->start, + r->start + r->len * r->step, + r->step); +} + static PySequenceMethods range_as_sequence = { (lenfunc)range_length, /* sq_length */ 0, /* sq_concat */ @@ -145,6 +155,7 @@ static PyMethodDef range_methods[] = { {"__reversed__", (PyCFunction)range_reverse, METH_NOARGS, reverse_doc}, + {"__reduce__", (PyCFunction)range_reduce, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; Modified: python/branches/tlee-ast-optimize/Objects/unicodeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/unicodeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/unicodeobject.c Tue Jun 10 17:03:15 2008 @@ -7895,6 +7895,29 @@ \n\ "); +static PyObject * +unicode__sizeof__(PyUnicodeObject *v) +{ + PyObject *res = NULL, *defsize = NULL; + + res = PyInt_FromSsize_t(sizeof(PyUnicodeObject) + + sizeof(Py_UNICODE) * (v->length + 1)); + if (v->defenc) { + defsize = PyObject_CallMethod(v->defenc, "__sizeof__", NULL); + if (defsize == NULL) { + Py_DECREF(res); + return NULL; + } + res = PyNumber_Add(res, defsize); + Py_DECREF(defsize); + } + return res; +} + +PyDoc_STRVAR(sizeof__doc__, +"S.__sizeof__() -> size of S in memory, in bytes\n\ +\n\ +"); static PyObject * unicode_getnewargs(PyUnicodeObject *v) @@ -7952,6 +7975,7 @@ {"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__}, {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, + {"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__}, #if 0 {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, #endif From python-checkins at python.org Tue Jun 10 17:38:23 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 10 Jun 2008 17:38:23 +0200 (CEST) Subject: [Python-checkins] r64078 - python/branches/tlee-ast-optimize/Lib/test/test_ast.py Message-ID: <20080610153823.A1B4D1E4014@bag.python.org> Author: thomas.lee Date: Tue Jun 10 17:38:23 2008 New Revision: 64078 Log: Botched up an earlier merge. Test is still broken, but ready for the future when we make a decision about parse() and compile() with optimization turned on & off. Modified: python/branches/tlee-ast-optimize/Lib/test/test_ast.py Modified: python/branches/tlee-ast-optimize/Lib/test/test_ast.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_ast.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_ast.py Tue Jun 10 17:38:23 2008 @@ -142,7 +142,7 @@ (single_tests, single_results, "single"), (eval_tests, eval_results, "eval")): for i, o in itertools.izip(input, output): - flags = _ast.PyCF_ONLY_AST | _ast.PyCF_NO_OPTIMIZE + flags = ast.PyCF_ONLY_AST | ast.PyCF_NO_OPTIMIZE ast_tree = compile(i, "?", kind, flags) self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) From buildbot at python.org Tue Jun 10 17:47:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 15:47:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080610154731.076CF1E4002@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/322 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_compile test_email make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 17:58:20 2008 From: python-checkins at python.org (josiah.carlson) Date: Tue, 10 Jun 2008 17:58:20 +0200 (CEST) Subject: [Python-checkins] r64080 - in python/trunk/Lib: asyncore.py test/test_asyncore.py Message-ID: <20080610155820.076E11E4002@bag.python.org> Author: josiah.carlson Date: Tue Jun 10 17:58:19 2008 New Revision: 64080 Log: Fixed test to reflect new filedispatcher semantics, as well as two NameErrors pointed out by Giampaolo. Modified: python/trunk/Lib/asyncore.py python/trunk/Lib/test/test_asyncore.py Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Tue Jun 10 17:58:19 2008 @@ -228,7 +228,7 @@ # passed be connected. try: self.addr = sock.getpeername() - except socket.error: + except socket.error, err: if err[0] == ENOTCONN: # To handle the case where we got an unconnected # socket. @@ -424,7 +424,7 @@ #check for errors err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: - raise socket.error(err, strerror(err)) + raise socket.error(err, _strerror(err)) self.handle_connect_event() self.handle_write() Modified: python/trunk/Lib/test/test_asyncore.py ============================================================================== --- python/trunk/Lib/test/test_asyncore.py (original) +++ python/trunk/Lib/test/test_asyncore.py Tue Jun 10 17:58:19 2008 @@ -384,8 +384,8 @@ fd = os.open(TESTFN, os.O_RDONLY) w = asyncore.file_wrapper(fd) - self.assertEqual(w.fd, fd) - self.assertEqual(w.fileno(), fd) + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) self.assertEqual(w.recv(13), "It's not dead") self.assertEqual(w.read(6), ", it's") w.close() From buildbot at python.org Tue Jun 10 19:13:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 17:13:57 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080610171357.8FDF41E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/986 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 19:20:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 17:20:20 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080610172020.E07501E4016@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/1016 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 19:27:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 17:27:01 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080610172731.9D79F1E4009@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1049 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 19:37:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 17:37:53 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080610173753.D9BF51E400A@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/326 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_calendar test_email make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 19:42:37 2008 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 10 Jun 2008 19:42:37 +0200 (CEST) Subject: [Python-checkins] r64086 - in python/trunk: Modules/datetimemodule.c Objects/bytesobject.c Objects/fileobject.c Message-ID: <20080610174237.DC3B51E4002@bag.python.org> Author: gregory.p.smith Date: Tue Jun 10 19:42:36 2008 New Revision: 64086 Log: More reverting of r63675 per the mailing list discussions. This restores occurances of PyBytes_ in the code to their original PyString_ names. The bytesobject.c file will be renamed back to stringobject.c in a future checkin. Modified: python/trunk/Modules/datetimemodule.c python/trunk/Objects/bytesobject.c python/trunk/Objects/fileobject.c Modified: python/trunk/Modules/datetimemodule.c ============================================================================== --- python/trunk/Modules/datetimemodule.c (original) +++ python/trunk/Modules/datetimemodule.c Tue Jun 10 19:42:36 2008 @@ -1207,9 +1207,9 @@ * is expensive, don't unless they're actually used. */ totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ - newfmt = PyBytes_FromStringAndSize(NULL, totalnew); + newfmt = PyString_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; - pnew = PyBytes_AsString(newfmt); + pnew = PyString_AsString(newfmt); usednew = 0; pin = format; Modified: python/trunk/Objects/bytesobject.c ============================================================================== --- python/trunk/Objects/bytesobject.c (original) +++ python/trunk/Objects/bytesobject.c Tue Jun 10 19:42:36 2008 @@ -1,4 +1,4 @@ -/* String object implementation */ +/* String (str/bytes) object implementation */ #define PY_SSIZE_T_CLEAN @@ -9,8 +9,8 @@ int null_strings, one_strings; #endif -static PyBytesObject *characters[UCHAR_MAX + 1]; -static PyBytesObject *nullstring; +static PyStringObject *characters[UCHAR_MAX + 1]; +static PyStringObject *nullstring; /* This dictionary holds all interned strings. Note that references to strings in this dictionary are *not* counted in the string's ob_refcnt. @@ -23,19 +23,19 @@ static PyObject *interned; /* - For both PyBytes_FromString() and PyBytes_FromStringAndSize(), the + For both PyString_FromString() and PyString_FromStringAndSize(), the parameter `size' denotes number of characters to allocate, not counting any null terminating character. - For PyBytes_FromString(), the parameter `str' points to a null-terminated + For PyString_FromString(), the parameter `str' points to a null-terminated string containing exactly `size' bytes. - For PyBytes_FromStringAndSize(), the parameter the parameter `str' is + For PyString_FromStringAndSize(), the parameter the parameter `str' is either NULL or else points to a string containing at least `size' bytes. - For PyBytes_FromStringAndSize(), the string in the `str' parameter does + For PyString_FromStringAndSize(), the string in the `str' parameter does not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyBytes_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyBytes_FromStringAndSize() will allocate `size+1' + substring by calling `PyString_FromStringAndSize(origstring, substrlen)'.) + If `str' is NULL then PyString_FromStringAndSize() will allocate `size+1' bytes (setting the last byte to the null terminating character) and you can fill in the data yourself. If `str' is non-NULL then the resulting PyString object must be treated as immutable and you must not fill in nor @@ -45,16 +45,16 @@ items" in a variable-size object, will contain the number of bytes allocated for string data, not counting the null terminating character. It is therefore equal to the equal to the `size' parameter (for - PyBytes_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyBytes_FromString()). + PyString_FromStringAndSize()) or the length of the string in the `str' + parameter (for PyString_FromString()). */ PyObject * -PyBytes_FromStringAndSize(const char *str, Py_ssize_t size) +PyString_FromStringAndSize(const char *str, Py_ssize_t size) { - register PyBytesObject *op; + register PyStringObject *op; if (size < 0) { PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyBytes_FromStringAndSize"); + "Negative size passed to PyString_FromStringAndSize"); return NULL; } if (size == 0 && (op = nullstring) != NULL) { @@ -75,10 +75,10 @@ } /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); + op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); + PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; if (str != NULL) @@ -88,13 +88,13 @@ if (size == 0) { PyObject *t = (PyObject *)op; PyString_InternInPlace(&t); - op = (PyBytesObject *)t; + op = (PyStringObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1 && str != NULL) { PyObject *t = (PyObject *)op; PyString_InternInPlace(&t); - op = (PyBytesObject *)t; + op = (PyStringObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); } @@ -102,10 +102,10 @@ } PyObject * -PyBytes_FromString(const char *str) +PyString_FromString(const char *str) { register size_t size; - register PyBytesObject *op; + register PyStringObject *op; assert(str != NULL); size = strlen(str); @@ -130,10 +130,10 @@ } /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); + op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); + PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; Py_MEMCPY(op->ob_sval, str, size+1); @@ -141,13 +141,13 @@ if (size == 0) { PyObject *t = (PyObject *)op; PyString_InternInPlace(&t); - op = (PyBytesObject *)t; + op = (PyStringObject *)t; nullstring = op; Py_INCREF(op); } else if (size == 1) { PyObject *t = (PyObject *)op; PyString_InternInPlace(&t); - op = (PyBytesObject *)t; + op = (PyStringObject *)t; characters[*str & UCHAR_MAX] = op; Py_INCREF(op); } @@ -155,7 +155,7 @@ } PyObject * -PyBytes_FromFormatV(const char *format, va_list vargs) +PyString_FromFormatV(const char *format, va_list vargs) { va_list count; Py_ssize_t n = 0; @@ -230,11 +230,11 @@ /* step 2: fill the buffer */ /* Since we've analyzed how much space we need for the worst case, use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyBytes_FromStringAndSize(NULL, n); + string = PyString_FromStringAndSize(NULL, n); if (!string) return NULL; - s = PyBytes_AsString(string); + s = PyString_AsString(string); for (f = format; *f; f++) { if (*f == '%') { @@ -334,12 +334,12 @@ } end: - _PyBytes_Resize(&string, s - PyBytes_AS_STRING(string)); + _PyString_Resize(&string, s - PyString_AS_STRING(string)); return string; } PyObject * -PyBytes_FromFormat(const char *format, ...) +PyString_FromFormat(const char *format, ...) { PyObject* ret; va_list vargs; @@ -349,34 +349,34 @@ #else va_start(vargs); #endif - ret = PyBytes_FromFormatV(format, vargs); + ret = PyString_FromFormatV(format, vargs); va_end(vargs); return ret; } -PyObject *PyBytes_Decode(const char *s, +PyObject *PyString_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) { PyObject *v, *str; - str = PyBytes_FromStringAndSize(s, size); + str = PyString_FromStringAndSize(s, size); if (str == NULL) return NULL; - v = PyBytes_AsDecodedString(str, encoding, errors); + v = PyString_AsDecodedString(str, encoding, errors); Py_DECREF(str); return v; } -PyObject *PyBytes_AsDecodedObject(PyObject *str, +PyObject *PyString_AsDecodedObject(PyObject *str, const char *encoding, const char *errors) { PyObject *v; - if (!PyBytes_Check(str)) { + if (!PyString_Check(str)) { PyErr_BadArgument(); goto onError; } @@ -401,13 +401,13 @@ return NULL; } -PyObject *PyBytes_AsDecodedString(PyObject *str, +PyObject *PyString_AsDecodedString(PyObject *str, const char *encoding, const char *errors) { PyObject *v; - v = PyBytes_AsDecodedObject(str, encoding, errors); + v = PyString_AsDecodedObject(str, encoding, errors); if (v == NULL) goto onError; @@ -421,7 +421,7 @@ goto onError; } #endif - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "decoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -435,28 +435,28 @@ return NULL; } -PyObject *PyBytes_Encode(const char *s, +PyObject *PyString_Encode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) { PyObject *v, *str; - str = PyBytes_FromStringAndSize(s, size); + str = PyString_FromStringAndSize(s, size); if (str == NULL) return NULL; - v = PyBytes_AsEncodedString(str, encoding, errors); + v = PyString_AsEncodedString(str, encoding, errors); Py_DECREF(str); return v; } -PyObject *PyBytes_AsEncodedObject(PyObject *str, +PyObject *PyString_AsEncodedObject(PyObject *str, const char *encoding, const char *errors) { PyObject *v; - if (!PyBytes_Check(str)) { + if (!PyString_Check(str)) { PyErr_BadArgument(); goto onError; } @@ -481,13 +481,13 @@ return NULL; } -PyObject *PyBytes_AsEncodedString(PyObject *str, +PyObject *PyString_AsEncodedString(PyObject *str, const char *encoding, const char *errors) { PyObject *v; - v = PyBytes_AsEncodedObject(str, encoding, errors); + v = PyString_AsEncodedObject(str, encoding, errors); if (v == NULL) goto onError; @@ -501,7 +501,7 @@ goto onError; } #endif - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string object (type=%.400s)", Py_TYPE(v)->tp_name); @@ -518,7 +518,7 @@ static void string_dealloc(PyObject *op) { - switch (PyBytes_CHECK_INTERNED(op)) { + switch (PyString_CHECK_INTERNED(op)) { case SSTATE_NOT_INTERNED: break; @@ -544,7 +544,7 @@ the string is UTF-8 encoded and should be re-encoded in the specified encoding. */ -PyObject *PyBytes_DecodeEscape(const char *s, +PyObject *PyString_DecodeEscape(const char *s, Py_ssize_t len, const char *errors, Py_ssize_t unicode, @@ -555,10 +555,10 @@ const char *end; PyObject *v; Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyBytes_FromStringAndSize((char *)NULL, newlen); + v = PyString_FromStringAndSize((char *)NULL, newlen); if (v == NULL) return NULL; - p = buf = PyBytes_AsString(v); + p = buf = PyString_AsString(v); end = s + len; while (s < end) { if (*s != '\\') { @@ -582,9 +582,9 @@ if (!w) goto failed; /* Append bytes to output buffer. */ - assert(PyBytes_Check(w)); - r = PyBytes_AS_STRING(w); - rn = PyBytes_GET_SIZE(w); + assert(PyString_Check(w)); + r = PyString_AS_STRING(w); + rn = PyString_GET_SIZE(w); Py_MEMCPY(p, r, rn); p += rn; Py_DECREF(w); @@ -687,7 +687,7 @@ } } if (p-buf < newlen) - _PyBytes_Resize(&v, p - buf); + _PyString_Resize(&v, p - buf); return v; failed: Py_DECREF(v); @@ -702,7 +702,7 @@ { char *s; Py_ssize_t len; - if (PyBytes_AsStringAndSize(op, &s, &len)) + if (PyString_AsStringAndSize(op, &s, &len)) return -1; return len; } @@ -712,29 +712,29 @@ { char *s; Py_ssize_t len; - if (PyBytes_AsStringAndSize(op, &s, &len)) + if (PyString_AsStringAndSize(op, &s, &len)) return NULL; return s; } Py_ssize_t -PyBytes_Size(register PyObject *op) +PyString_Size(register PyObject *op) { - if (!PyBytes_Check(op)) + if (!PyString_Check(op)) return string_getsize(op); return Py_SIZE(op); } /*const*/ char * -PyBytes_AsString(register PyObject *op) +PyString_AsString(register PyObject *op) { - if (!PyBytes_Check(op)) + if (!PyString_Check(op)) return string_getbuffer(op); - return ((PyBytesObject *)op) -> ob_sval; + return ((PyStringObject *)op) -> ob_sval; } int -PyBytes_AsStringAndSize(register PyObject *obj, +PyString_AsStringAndSize(register PyObject *obj, register char **s, register Py_ssize_t *len) { @@ -743,7 +743,7 @@ return -1; } - if (!PyBytes_Check(obj)) { + if (!PyString_Check(obj)) { #ifdef Py_USING_UNICODE if (PyUnicode_Check(obj)) { obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); @@ -760,10 +760,10 @@ } } - *s = PyBytes_AS_STRING(obj); + *s = PyString_AS_STRING(obj); if (len != NULL) - *len = PyBytes_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyBytes_GET_SIZE(obj)) { + *len = PyString_GET_SIZE(obj); + else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) { PyErr_SetString(PyExc_TypeError, "expected string without null bytes"); return -1; @@ -781,23 +781,23 @@ #include "stringlib/find.h" #include "stringlib/partition.h" -#define _Py_InsertThousandsGrouping _PyBytes_InsertThousandsGrouping +#define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping #include "stringlib/localeutil.h" static int -string_print(PyBytesObject *op, FILE *fp, int flags) +string_print(PyStringObject *op, FILE *fp, int flags) { Py_ssize_t i, str_len; char c; int quote; /* XXX Ought to check for interrupts when writing long strings */ - if (! PyBytes_CheckExact(op)) { + if (! PyString_CheckExact(op)) { int ret; /* A str subclass may have its own __str__ method. */ - op = (PyBytesObject *) PyObject_Str((PyObject *)op); + op = (PyStringObject *) PyObject_Str((PyObject *)op); if (op == NULL) return -1; ret = string_print(op, fp, flags); @@ -860,9 +860,9 @@ } PyObject * -PyBytes_Repr(PyObject *obj, int smartquotes) +PyString_Repr(PyObject *obj, int smartquotes) { - register PyBytesObject* op = (PyBytesObject*) obj; + register PyStringObject* op = (PyStringObject*) obj; size_t newsize = 2 + 4 * Py_SIZE(op); PyObject *v; if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_SIZE(op)) { @@ -870,7 +870,7 @@ "string is too large to make repr"); return NULL; } - v = PyBytes_FromStringAndSize((char *)NULL, newsize); + v = PyString_FromStringAndSize((char *)NULL, newsize); if (v == NULL) { return NULL; } @@ -887,12 +887,12 @@ !memchr(op->ob_sval, '"', Py_SIZE(op))) quote = '"'; - p = PyBytes_AS_STRING(v); + p = PyString_AS_STRING(v); *p++ = quote; for (i = 0; i < Py_SIZE(op); i++) { /* There's at least enough room for a hex escape and a closing quote. */ - assert(newsize - (p - PyBytes_AS_STRING(v)) >= 5); + assert(newsize - (p - PyString_AS_STRING(v)) >= 5); c = op->ob_sval[i]; if (c == quote || c == '\\') *p++ = '\\', *p++ = c; @@ -912,11 +912,11 @@ else *p++ = c; } - assert(newsize - (p - PyBytes_AS_STRING(v)) >= 1); + assert(newsize - (p - PyString_AS_STRING(v)) >= 1); *p++ = quote; *p = '\0'; - _PyBytes_Resize( - &v, (p - PyBytes_AS_STRING(v))); + _PyString_Resize( + &v, (p - PyString_AS_STRING(v))); return v; } } @@ -924,36 +924,36 @@ static PyObject * string_repr(PyObject *op) { - return PyBytes_Repr(op, 1); + return PyString_Repr(op, 1); } static PyObject * string_str(PyObject *s) { - assert(PyBytes_Check(s)); - if (PyBytes_CheckExact(s)) { + assert(PyString_Check(s)); + if (PyString_CheckExact(s)) { Py_INCREF(s); return s; } else { /* Subtype -- return genuine string with the same value. */ - PyBytesObject *t = (PyBytesObject *) s; - return PyBytes_FromStringAndSize(t->ob_sval, Py_SIZE(t)); + PyStringObject *t = (PyStringObject *) s; + return PyString_FromStringAndSize(t->ob_sval, Py_SIZE(t)); } } static Py_ssize_t -string_length(PyBytesObject *a) +string_length(PyStringObject *a) { return Py_SIZE(a); } static PyObject * -string_concat(register PyBytesObject *a, register PyObject *bb) +string_concat(register PyStringObject *a, register PyObject *bb) { register Py_ssize_t size; - register PyBytesObject *op; - if (!PyBytes_Check(bb)) { + register PyStringObject *op; + if (!PyString_Check(bb)) { #ifdef Py_USING_UNICODE if (PyUnicode_Check(bb)) return PyUnicode_Concat((PyObject *)a, bb); @@ -965,10 +965,10 @@ Py_TYPE(bb)->tp_name); return NULL; } -#define b ((PyBytesObject *)bb) +#define b ((PyStringObject *)bb) /* Optimize cases with empty left or right operand */ if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyBytes_CheckExact(a) && PyBytes_CheckExact(b)) { + PyString_CheckExact(a) && PyString_CheckExact(b)) { if (Py_SIZE(a) == 0) { Py_INCREF(bb); return bb; @@ -984,10 +984,10 @@ } /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); + op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); + PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); @@ -998,12 +998,12 @@ } static PyObject * -string_repeat(register PyBytesObject *a, register Py_ssize_t n) +string_repeat(register PyStringObject *a, register Py_ssize_t n) { register Py_ssize_t i; register Py_ssize_t j; register Py_ssize_t size; - register PyBytesObject *op; + register PyStringObject *op; size_t nbytes; if (n < 0) n = 0; @@ -1016,21 +1016,21 @@ "repeated string is too long"); return NULL; } - if (size == Py_SIZE(a) && PyBytes_CheckExact(a)) { + if (size == Py_SIZE(a) && PyString_CheckExact(a)) { Py_INCREF(a); return (PyObject *)a; } nbytes = (size_t)size; - if (nbytes + sizeof(PyBytesObject) <= nbytes) { + if (nbytes + sizeof(PyStringObject) <= nbytes) { PyErr_SetString(PyExc_OverflowError, "repeated string is too long"); return NULL; } - op = (PyBytesObject *) - PyObject_MALLOC(sizeof(PyBytesObject) + nbytes); + op = (PyStringObject *) + PyObject_MALLOC(sizeof(PyStringObject) + nbytes); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); + PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; op->ob_sval[size] = '\0'; @@ -1054,7 +1054,7 @@ /* String slice a[i:j] consists of characters a[i] ... a[j-1] */ static PyObject * -string_slice(register PyBytesObject *a, register Py_ssize_t i, +string_slice(register PyStringObject *a, register Py_ssize_t i, register Py_ssize_t j) /* j -- may be negative! */ { @@ -1064,25 +1064,25 @@ j = 0; /* Avoid signed/unsigned bug in next line */ if (j > Py_SIZE(a)) j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyBytes_CheckExact(a)) { + if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) { /* It's the same as a */ Py_INCREF(a); return (PyObject *)a; } if (j < i) j = i; - return PyBytes_FromStringAndSize(a->ob_sval + i, j-i); + return PyString_FromStringAndSize(a->ob_sval + i, j-i); } static int string_contains(PyObject *str_obj, PyObject *sub_obj) { - if (!PyBytes_CheckExact(sub_obj)) { + if (!PyString_CheckExact(sub_obj)) { #ifdef Py_USING_UNICODE if (PyUnicode_Check(sub_obj)) return PyUnicode_Contains(str_obj, sub_obj); #endif - if (!PyBytes_Check(sub_obj)) { + if (!PyString_Check(sub_obj)) { PyErr_Format(PyExc_TypeError, "'in ' requires string as left operand, " "not %.200s", Py_TYPE(sub_obj)->tp_name); @@ -1094,7 +1094,7 @@ } static PyObject * -string_item(PyBytesObject *a, register Py_ssize_t i) +string_item(PyStringObject *a, register Py_ssize_t i) { char pchar; PyObject *v; @@ -1105,7 +1105,7 @@ pchar = a->ob_sval[i]; v = (PyObject *)characters[pchar & UCHAR_MAX]; if (v == NULL) - v = PyBytes_FromStringAndSize(&pchar, 1); + v = PyString_FromStringAndSize(&pchar, 1); else { #ifdef COUNT_ALLOCS one_strings++; @@ -1116,7 +1116,7 @@ } static PyObject* -string_richcompare(PyBytesObject *a, PyBytesObject *b, int op) +string_richcompare(PyStringObject *a, PyStringObject *b, int op) { int c; Py_ssize_t len_a, len_b; @@ -1124,7 +1124,7 @@ PyObject *result; /* Make sure both arguments are strings. */ - if (!(PyBytes_Check(a) && PyBytes_Check(b))) { + if (!(PyString_Check(a) && PyString_Check(b))) { result = Py_NotImplemented; goto out; } @@ -1178,17 +1178,17 @@ } int -_PyBytes_Eq(PyObject *o1, PyObject *o2) +_PyString_Eq(PyObject *o1, PyObject *o2) { - PyBytesObject *a = (PyBytesObject*) o1; - PyBytesObject *b = (PyBytesObject*) o2; + PyStringObject *a = (PyStringObject*) o1; + PyStringObject *b = (PyStringObject*) o2; return Py_SIZE(a) == Py_SIZE(b) && *a->ob_sval == *b->ob_sval && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; } static long -string_hash(PyBytesObject *a) +string_hash(PyStringObject *a) { register Py_ssize_t len; register unsigned char *p; @@ -1209,14 +1209,14 @@ } static PyObject* -string_subscript(PyBytesObject* self, PyObject* item) +string_subscript(PyStringObject* self, PyObject* item) { if (PyIndex_Check(item)) { Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return NULL; if (i < 0) - i += PyBytes_GET_SIZE(self); + i += PyString_GET_SIZE(self); return string_item(self, i); } else if (PySlice_Check(item)) { @@ -1226,27 +1226,27 @@ PyObject* result; if (PySlice_GetIndicesEx((PySliceObject*)item, - PyBytes_GET_SIZE(self), + PyString_GET_SIZE(self), &start, &stop, &step, &slicelength) < 0) { return NULL; } if (slicelength <= 0) { - return PyBytes_FromStringAndSize("", 0); + return PyString_FromStringAndSize("", 0); } else if (start == 0 && step == 1 && - slicelength == PyBytes_GET_SIZE(self) && - PyBytes_CheckExact(self)) { + slicelength == PyString_GET_SIZE(self) && + PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject *)self; } else if (step == 1) { - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self) + start, + return PyString_FromStringAndSize( + PyString_AS_STRING(self) + start, slicelength); } else { - source_buf = PyBytes_AsString((PyObject*)self); + source_buf = PyString_AsString((PyObject*)self); result_buf = (char *)PyMem_Malloc(slicelength); if (result_buf == NULL) return PyErr_NoMemory(); @@ -1256,7 +1256,7 @@ result_buf[i] = source_buf[cur]; } - result = PyBytes_FromStringAndSize(result_buf, + result = PyString_FromStringAndSize(result_buf, slicelength); PyMem_Free(result_buf); return result; @@ -1271,7 +1271,7 @@ } static Py_ssize_t -string_buffer_getreadbuf(PyBytesObject *self, Py_ssize_t index, const void **ptr) +string_buffer_getreadbuf(PyStringObject *self, Py_ssize_t index, const void **ptr) { if ( index != 0 ) { PyErr_SetString(PyExc_SystemError, @@ -1283,7 +1283,7 @@ } static Py_ssize_t -string_buffer_getwritebuf(PyBytesObject *self, Py_ssize_t index, const void **ptr) +string_buffer_getwritebuf(PyStringObject *self, Py_ssize_t index, const void **ptr) { PyErr_SetString(PyExc_TypeError, "Cannot use string as modifiable buffer"); @@ -1291,7 +1291,7 @@ } static Py_ssize_t -string_buffer_getsegcount(PyBytesObject *self, Py_ssize_t *lenp) +string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp) { if ( lenp ) *lenp = Py_SIZE(self); @@ -1299,7 +1299,7 @@ } static Py_ssize_t -string_buffer_getcharbuf(PyBytesObject *self, Py_ssize_t index, const char **ptr) +string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **ptr) { if ( index != 0 ) { PyErr_SetString(PyExc_SystemError, @@ -1311,7 +1311,7 @@ } static int -string_buffer_getbuffer(PyBytesObject *self, Py_buffer *view, int flags) +string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags) { return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self), 0, flags); @@ -1376,7 +1376,7 @@ (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) #define SPLIT_APPEND(data, left, right) \ - str = PyBytes_FromStringAndSize((data) + (left), \ + str = PyString_FromStringAndSize((data) + (left), \ (right) - (left)); \ if (str == NULL) \ goto onError; \ @@ -1388,7 +1388,7 @@ Py_DECREF(str); #define SPLIT_ADD(data, left, right) { \ - str = PyBytes_FromStringAndSize((data) + (left), \ + str = PyString_FromStringAndSize((data) + (left), \ (right) - (left)); \ if (str == NULL) \ goto onError; \ @@ -1413,9 +1413,9 @@ #define RSKIP_NONSPACE(s, i) { while (i>=0 && !isspace(Py_CHARMASK(s[i]))) i--; } Py_LOCAL_INLINE(PyObject *) -split_whitespace(PyBytesObject *self, Py_ssize_t len, Py_ssize_t maxsplit) +split_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) { - const char *s = PyBytes_AS_STRING(self); + const char *s = PyString_AS_STRING(self); Py_ssize_t i, j, count=0; PyObject *str; PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); @@ -1430,7 +1430,7 @@ if (i==len) break; j = i; i++; SKIP_NONSPACE(s, i, len); - if (j == 0 && i == len && PyBytes_CheckExact(self)) { + if (j == 0 && i == len && PyString_CheckExact(self)) { /* No whitespace in self, so just use it as list[0] */ Py_INCREF(self); PyList_SET_ITEM(list, 0, (PyObject *)self); @@ -1455,9 +1455,9 @@ } Py_LOCAL_INLINE(PyObject *) -split_char(PyBytesObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) +split_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) { - const char *s = PyBytes_AS_STRING(self); + const char *s = PyString_AS_STRING(self); register Py_ssize_t i, j, count=0; PyObject *str; PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); @@ -1476,7 +1476,7 @@ } } } - if (i == 0 && count == 0 && PyBytes_CheckExact(self)) { + if (i == 0 && count == 0 && PyString_CheckExact(self)) { /* ch not in self, so just use self as list[0] */ Py_INCREF(self); PyList_SET_ITEM(list, 0, (PyObject *)self); @@ -1503,11 +1503,11 @@ from the result."); static PyObject * -string_split(PyBytesObject *self, PyObject *args) +string_split(PyStringObject *self, PyObject *args) { - Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j; + Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; Py_ssize_t maxsplit = -1, count=0; - const char *s = PyBytes_AS_STRING(self), *sub; + const char *s = PyString_AS_STRING(self), *sub; PyObject *list, *str, *subobj = Py_None; #ifdef USE_FAST Py_ssize_t pos; @@ -1519,9 +1519,9 @@ maxsplit = PY_SSIZE_T_MAX; if (subobj == Py_None) return split_whitespace(self, len, maxsplit); - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - n = PyBytes_GET_SIZE(subobj); + if (PyString_Check(subobj)) { + sub = PyString_AS_STRING(subobj); + n = PyString_GET_SIZE(subobj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) @@ -1580,14 +1580,14 @@ found, returns S and two empty strings."); static PyObject * -string_partition(PyBytesObject *self, PyObject *sep_obj) +string_partition(PyStringObject *self, PyObject *sep_obj) { const char *sep; Py_ssize_t sep_len; - if (PyBytes_Check(sep_obj)) { - sep = PyBytes_AS_STRING(sep_obj); - sep_len = PyBytes_GET_SIZE(sep_obj); + if (PyString_Check(sep_obj)) { + sep = PyString_AS_STRING(sep_obj); + sep_len = PyString_GET_SIZE(sep_obj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep_obj)) @@ -1598,7 +1598,7 @@ return stringlib_partition( (PyObject*) self, - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), + PyString_AS_STRING(self), PyString_GET_SIZE(self), sep_obj, sep, sep_len ); } @@ -1611,14 +1611,14 @@ separator is not found, returns two empty strings and S."); static PyObject * -string_rpartition(PyBytesObject *self, PyObject *sep_obj) +string_rpartition(PyStringObject *self, PyObject *sep_obj) { const char *sep; Py_ssize_t sep_len; - if (PyBytes_Check(sep_obj)) { - sep = PyBytes_AS_STRING(sep_obj); - sep_len = PyBytes_GET_SIZE(sep_obj); + if (PyString_Check(sep_obj)) { + sep = PyString_AS_STRING(sep_obj); + sep_len = PyString_GET_SIZE(sep_obj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep_obj)) @@ -1629,15 +1629,15 @@ return stringlib_rpartition( (PyObject*) self, - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), + PyString_AS_STRING(self), PyString_GET_SIZE(self), sep_obj, sep, sep_len ); } Py_LOCAL_INLINE(PyObject *) -rsplit_whitespace(PyBytesObject *self, Py_ssize_t len, Py_ssize_t maxsplit) +rsplit_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) { - const char *s = PyBytes_AS_STRING(self); + const char *s = PyString_AS_STRING(self); Py_ssize_t i, j, count=0; PyObject *str; PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); @@ -1652,7 +1652,7 @@ if (i<0) break; j = i; i--; RSKIP_NONSPACE(s, i); - if (j == len-1 && i < 0 && PyBytes_CheckExact(self)) { + if (j == len-1 && i < 0 && PyString_CheckExact(self)) { /* No whitespace in self, so just use it as list[0] */ Py_INCREF(self); PyList_SET_ITEM(list, 0, (PyObject *)self); @@ -1679,9 +1679,9 @@ } Py_LOCAL_INLINE(PyObject *) -rsplit_char(PyBytesObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) +rsplit_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) { - const char *s = PyBytes_AS_STRING(self); + const char *s = PyString_AS_STRING(self); register Py_ssize_t i, j, count=0; PyObject *str; PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); @@ -1699,7 +1699,7 @@ } } } - if (i < 0 && count == 0 && PyBytes_CheckExact(self)) { + if (i < 0 && count == 0 && PyString_CheckExact(self)) { /* ch not in self, so just use self as list[0] */ Py_INCREF(self); PyList_SET_ITEM(list, 0, (PyObject *)self); @@ -1728,9 +1728,9 @@ is a separator."); static PyObject * -string_rsplit(PyBytesObject *self, PyObject *args) +string_rsplit(PyStringObject *self, PyObject *args) { - Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j; + Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; Py_ssize_t maxsplit = -1, count=0; const char *s, *sub; PyObject *list, *str, *subobj = Py_None; @@ -1741,9 +1741,9 @@ maxsplit = PY_SSIZE_T_MAX; if (subobj == Py_None) return rsplit_whitespace(self, len, maxsplit); - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - n = PyBytes_GET_SIZE(subobj); + if (PyString_Check(subobj)) { + sub = PyString_AS_STRING(subobj); + n = PyString_GET_SIZE(subobj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) @@ -1766,7 +1766,7 @@ j = len; i = j - n; - s = PyBytes_AS_STRING(self); + s = PyString_AS_STRING(self); while ( (i >= 0) && (maxsplit-- > 0) ) { for (; i>=0; i--) { if (Py_STRING_MATCH(s, i, sub, n)) { @@ -1796,10 +1796,10 @@ sequence. The separator between elements is S."); static PyObject * -string_join(PyBytesObject *self, PyObject *orig) +string_join(PyStringObject *self, PyObject *orig) { - char *sep = PyBytes_AS_STRING(self); - const Py_ssize_t seplen = PyBytes_GET_SIZE(self); + char *sep = PyString_AS_STRING(self); + const Py_ssize_t seplen = PyString_GET_SIZE(self); PyObject *res = NULL; char *p; Py_ssize_t seqlen = 0; @@ -1815,11 +1815,11 @@ seqlen = PySequence_Size(seq); if (seqlen == 0) { Py_DECREF(seq); - return PyBytes_FromString(""); + return PyString_FromString(""); } if (seqlen == 1) { item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyBytes_CheckExact(item) || PyUnicode_CheckExact(item)) { + if (PyString_CheckExact(item) || PyUnicode_CheckExact(item)) { Py_INCREF(item); Py_DECREF(seq); return item; @@ -1835,7 +1835,7 @@ for (i = 0; i < seqlen; i++) { const size_t old_sz = sz; item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyBytes_Check(item)){ + if (!PyString_Check(item)){ #ifdef Py_USING_UNICODE if (PyUnicode_Check(item)) { /* Defer to Unicode join. @@ -1856,7 +1856,7 @@ Py_DECREF(seq); return NULL; } - sz += PyBytes_GET_SIZE(item); + sz += PyString_GET_SIZE(item); if (i != 0) sz += seplen; if (sz < old_sz || sz > PY_SSIZE_T_MAX) { @@ -1868,19 +1868,19 @@ } /* Allocate result space. */ - res = PyBytes_FromStringAndSize((char*)NULL, sz); + res = PyString_FromStringAndSize((char*)NULL, sz); if (res == NULL) { Py_DECREF(seq); return NULL; } /* Catenate everything. */ - p = PyBytes_AS_STRING(res); + p = PyString_AS_STRING(res); for (i = 0; i < seqlen; ++i) { size_t n; item = PySequence_Fast_GET_ITEM(seq, i); - n = PyBytes_GET_SIZE(item); - Py_MEMCPY(p, PyBytes_AS_STRING(item), n); + n = PyString_GET_SIZE(item); + Py_MEMCPY(p, PyString_AS_STRING(item), n); p += n; if (i < seqlen - 1) { Py_MEMCPY(p, sep, seplen); @@ -1893,11 +1893,11 @@ } PyObject * -_PyBytes_Join(PyObject *sep, PyObject *x) +_PyString_Join(PyObject *sep, PyObject *x) { - assert(sep != NULL && PyBytes_Check(sep)); + assert(sep != NULL && PyString_Check(sep)); assert(x != NULL); - return string_join((PyBytesObject *)sep, x); + return string_join((PyStringObject *)sep, x); } Py_LOCAL_INLINE(void) @@ -1916,7 +1916,7 @@ } Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyBytesObject *self, PyObject *args, int dir) +string_find_internal(PyStringObject *self, PyObject *args, int dir) { PyObject *subobj; const char *sub; @@ -1937,9 +1937,9 @@ if (!_PyEval_SliceIndex(obj_end, &end)) return -2; - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - sub_len = PyBytes_GET_SIZE(subobj); + if (PyString_Check(subobj)) { + sub = PyString_AS_STRING(subobj); + sub_len = PyString_GET_SIZE(subobj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(subobj)) @@ -1953,11 +1953,11 @@ if (dir > 0) return stringlib_find_slice( - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), + PyString_AS_STRING(self), PyString_GET_SIZE(self), sub, sub_len, start, end); else return stringlib_rfind_slice( - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), + PyString_AS_STRING(self), PyString_GET_SIZE(self), sub, sub_len, start, end); } @@ -1972,7 +1972,7 @@ Return -1 on failure."); static PyObject * -string_find(PyBytesObject *self, PyObject *args) +string_find(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, +1); if (result == -2) @@ -1987,7 +1987,7 @@ Like S.find() but raise ValueError when the substring is not found."); static PyObject * -string_index(PyBytesObject *self, PyObject *args) +string_index(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, +1); if (result == -2) @@ -2011,7 +2011,7 @@ Return -1 on failure."); static PyObject * -string_rfind(PyBytesObject *self, PyObject *args) +string_rfind(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, -1); if (result == -2) @@ -2026,7 +2026,7 @@ Like S.rfind() but raise ValueError when the substring is not found."); static PyObject * -string_rindex(PyBytesObject *self, PyObject *args) +string_rindex(PyStringObject *self, PyObject *args) { Py_ssize_t result = string_find_internal(self, args, -1); if (result == -2) @@ -2041,12 +2041,12 @@ Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyBytesObject *self, int striptype, PyObject *sepobj) +do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) { - char *s = PyBytes_AS_STRING(self); - Py_ssize_t len = PyBytes_GET_SIZE(self); - char *sep = PyBytes_AS_STRING(sepobj); - Py_ssize_t seplen = PyBytes_GET_SIZE(sepobj); + char *s = PyString_AS_STRING(self); + Py_ssize_t len = PyString_GET_SIZE(self); + char *sep = PyString_AS_STRING(sepobj); + Py_ssize_t seplen = PyString_GET_SIZE(sepobj); Py_ssize_t i, j; i = 0; @@ -2064,20 +2064,20 @@ j++; } - if (i == 0 && j == len && PyBytes_CheckExact(self)) { + if (i == 0 && j == len && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*)self; } else - return PyBytes_FromStringAndSize(s+i, j-i); + return PyString_FromStringAndSize(s+i, j-i); } Py_LOCAL_INLINE(PyObject *) -do_strip(PyBytesObject *self, int striptype) +do_strip(PyStringObject *self, int striptype) { - char *s = PyBytes_AS_STRING(self); - Py_ssize_t len = PyBytes_GET_SIZE(self), i, j; + char *s = PyString_AS_STRING(self); + Py_ssize_t len = PyString_GET_SIZE(self), i, j; i = 0; if (striptype != RIGHTSTRIP) { @@ -2094,17 +2094,17 @@ j++; } - if (i == 0 && j == len && PyBytes_CheckExact(self)) { + if (i == 0 && j == len && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*)self; } else - return PyBytes_FromStringAndSize(s+i, j-i); + return PyString_FromStringAndSize(s+i, j-i); } Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyBytesObject *self, int striptype, PyObject *args) +do_argstrip(PyStringObject *self, int striptype, PyObject *args) { PyObject *sep = NULL; @@ -2112,7 +2112,7 @@ return NULL; if (sep != NULL && sep != Py_None) { - if (PyBytes_Check(sep)) + if (PyString_Check(sep)) return do_xstrip(self, striptype, sep); #ifdef Py_USING_UNICODE else if (PyUnicode_Check(sep)) { @@ -2149,7 +2149,7 @@ If chars is unicode, S will be converted to unicode before stripping"); static PyObject * -string_strip(PyBytesObject *self, PyObject *args) +string_strip(PyStringObject *self, PyObject *args) { if (PyTuple_GET_SIZE(args) == 0) return do_strip(self, BOTHSTRIP); /* Common case */ @@ -2166,7 +2166,7 @@ If chars is unicode, S will be converted to unicode before stripping"); static PyObject * -string_lstrip(PyBytesObject *self, PyObject *args) +string_lstrip(PyStringObject *self, PyObject *args) { if (PyTuple_GET_SIZE(args) == 0) return do_strip(self, LEFTSTRIP); /* Common case */ @@ -2183,7 +2183,7 @@ If chars is unicode, S will be converted to unicode before stripping"); static PyObject * -string_rstrip(PyBytesObject *self, PyObject *args) +string_rstrip(PyStringObject *self, PyObject *args) { if (PyTuple_GET_SIZE(args) == 0) return do_strip(self, RIGHTSTRIP); /* Common case */ @@ -2203,19 +2203,19 @@ #endif static PyObject * -string_lower(PyBytesObject *self) +string_lower(PyStringObject *self) { char *s; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); + Py_ssize_t i, n = PyString_GET_SIZE(self); PyObject *newobj; - newobj = PyBytes_FromStringAndSize(NULL, n); + newobj = PyString_FromStringAndSize(NULL, n); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); - Py_MEMCPY(s, PyBytes_AS_STRING(self), n); + Py_MEMCPY(s, PyString_AS_STRING(self), n); for (i = 0; i < n; i++) { int c = Py_CHARMASK(s[i]); @@ -2236,19 +2236,19 @@ #endif static PyObject * -string_upper(PyBytesObject *self) +string_upper(PyStringObject *self) { char *s; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); + Py_ssize_t i, n = PyString_GET_SIZE(self); PyObject *newobj; - newobj = PyBytes_FromStringAndSize(NULL, n); + newobj = PyString_FromStringAndSize(NULL, n); if (!newobj) return NULL; - s = PyBytes_AS_STRING(newobj); + s = PyString_AS_STRING(newobj); - Py_MEMCPY(s, PyBytes_AS_STRING(self), n); + Py_MEMCPY(s, PyString_AS_STRING(self), n); for (i = 0; i < n; i++) { int c = Py_CHARMASK(s[i]); @@ -2266,17 +2266,17 @@ characters, all remaining cased characters have lowercase."); static PyObject* -string_title(PyBytesObject *self) +string_title(PyStringObject *self) { - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); + char *s = PyString_AS_STRING(self), *s_new; + Py_ssize_t i, n = PyString_GET_SIZE(self); int previous_is_cased = 0; PyObject *newobj; - newobj = PyBytes_FromStringAndSize(NULL, n); + newobj = PyString_FromStringAndSize(NULL, n); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); if (islower(c)) { @@ -2301,16 +2301,16 @@ capitalized."); static PyObject * -string_capitalize(PyBytesObject *self) +string_capitalize(PyStringObject *self) { - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); + char *s = PyString_AS_STRING(self), *s_new; + Py_ssize_t i, n = PyString_GET_SIZE(self); PyObject *newobj; - newobj = PyBytes_FromStringAndSize(NULL, n); + newobj = PyString_FromStringAndSize(NULL, n); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); if (0 < n) { int c = Py_CHARMASK(*s++); if (islower(c)) @@ -2339,10 +2339,10 @@ as in slice notation."); static PyObject * -string_count(PyBytesObject *self, PyObject *args) +string_count(PyStringObject *self, PyObject *args) { PyObject *sub_obj; - const char *str = PyBytes_AS_STRING(self), *sub; + const char *str = PyString_AS_STRING(self), *sub; Py_ssize_t sub_len; Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; @@ -2350,9 +2350,9 @@ _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) return NULL; - if (PyBytes_Check(sub_obj)) { - sub = PyBytes_AS_STRING(sub_obj); - sub_len = PyBytes_GET_SIZE(sub_obj); + if (PyString_Check(sub_obj)) { + sub = PyString_AS_STRING(sub_obj); + sub_len = PyString_GET_SIZE(sub_obj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(sub_obj)) { @@ -2367,7 +2367,7 @@ else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) return NULL; - string_adjust_indices(&start, &end, PyBytes_GET_SIZE(self)); + string_adjust_indices(&start, &end, PyString_GET_SIZE(self)); return PyInt_FromSsize_t( stringlib_count(str + start, end - start, sub, sub_len) @@ -2381,16 +2381,16 @@ converted to lowercase and vice versa."); static PyObject * -string_swapcase(PyBytesObject *self) +string_swapcase(PyStringObject *self) { - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); + char *s = PyString_AS_STRING(self), *s_new; + Py_ssize_t i, n = PyString_GET_SIZE(self); PyObject *newobj; - newobj = PyBytes_FromStringAndSize(NULL, n); + newobj = PyString_FromStringAndSize(NULL, n); if (newobj == NULL) return NULL; - s_new = PyBytes_AsString(newobj); + s_new = PyString_AsString(newobj); for (i = 0; i < n; i++) { int c = Py_CHARMASK(*s++); if (islower(c)) { @@ -2416,7 +2416,7 @@ translation table, which must be a string of length 256."); static PyObject * -string_translate(PyBytesObject *self, PyObject *args) +string_translate(PyStringObject *self, PyObject *args) { register char *input, *output; const char *table; @@ -2432,9 +2432,9 @@ &tableobj, &delobj)) return NULL; - if (PyBytes_Check(tableobj)) { - table = PyBytes_AS_STRING(tableobj); - tablen = PyBytes_GET_SIZE(tableobj); + if (PyString_Check(tableobj)) { + table = PyString_AS_STRING(tableobj); + tablen = PyString_GET_SIZE(tableobj); } else if (tableobj == Py_None) { table = NULL; @@ -2463,9 +2463,9 @@ } if (delobj != NULL) { - if (PyBytes_Check(delobj)) { - del_table = PyBytes_AS_STRING(delobj); - dellen = PyBytes_GET_SIZE(delobj); + if (PyString_Check(delobj)) { + del_table = PyString_AS_STRING(delobj); + dellen = PyString_GET_SIZE(delobj); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(delobj)) { @@ -2482,12 +2482,12 @@ dellen = 0; } - inlen = PyBytes_GET_SIZE(input_obj); - result = PyBytes_FromStringAndSize((char *)NULL, inlen); + inlen = PyString_GET_SIZE(input_obj); + result = PyString_FromStringAndSize((char *)NULL, inlen); if (result == NULL) return NULL; - output_start = output = PyBytes_AsString(result); - input = PyBytes_AS_STRING(input_obj); + output_start = output = PyString_AsString(result); + input = PyString_AS_STRING(input_obj); if (dellen == 0 && table != NULL) { /* If no deletions are required, use faster code */ @@ -2496,7 +2496,7 @@ if (Py_CHARMASK((*output++ = table[c])) != c) changed = 1; } - if (changed || !PyBytes_CheckExact(input_obj)) + if (changed || !PyString_CheckExact(input_obj)) return result; Py_DECREF(result); Py_INCREF(input_obj); @@ -2521,14 +2521,14 @@ continue; changed = 1; } - if (!changed && PyBytes_CheckExact(input_obj)) { + if (!changed && PyString_CheckExact(input_obj)) { Py_DECREF(result); Py_INCREF(input_obj); return input_obj; } /* Fix the size of the resulting string */ if (inlen > 0) - _PyBytes_Resize(&result, output - output_start); + _PyString_Resize(&result, output - output_start); return result; } @@ -2543,16 +2543,16 @@ /* String ops must return a string. */ /* If the object is subclass of string, create a copy */ -Py_LOCAL(PyBytesObject *) -return_self(PyBytesObject *self) +Py_LOCAL(PyStringObject *) +return_self(PyStringObject *self) { - if (PyBytes_CheckExact(self)) { + if (PyString_CheckExact(self)) { Py_INCREF(self); return self; } - return (PyBytesObject *)PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self)); + return (PyStringObject *)PyString_FromStringAndSize( + PyString_AS_STRING(self), + PyString_GET_SIZE(self)); } Py_LOCAL_INLINE(Py_ssize_t) @@ -2662,17 +2662,17 @@ /* Algorithms for different cases of string replacement */ /* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_interleave(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_interleave(PyStringObject *self, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) { char *self_s, *result_s; Py_ssize_t self_len, result_len; Py_ssize_t count, i, product; - PyBytesObject *result; + PyStringObject *result; - self_len = PyBytes_GET_SIZE(self); + self_len = PyString_GET_SIZE(self); /* 1 at the end plus 1 after every character */ count = self_len+1; @@ -2694,12 +2694,12 @@ return NULL; } - if (! (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) ) + if (! (result = (PyStringObject *) + PyString_FromStringAndSize(NULL, result_len)) ) return NULL; - self_s = PyBytes_AS_STRING(self); - result_s = PyBytes_AS_STRING(result); + self_s = PyString_AS_STRING(self); + result_s = PyString_AS_STRING(result); /* TODO: special case single character, which doesn't need memcpy */ @@ -2722,18 +2722,18 @@ /* Special case for deleting a single character */ /* len(self)>=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_delete_single_character(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_delete_single_character(PyStringObject *self, char from_c, Py_ssize_t maxcount) { char *self_s, *result_s; char *start, *next, *end; Py_ssize_t self_len, result_len; Py_ssize_t count; - PyBytesObject *result; + PyStringObject *result; - self_len = PyBytes_GET_SIZE(self); - self_s = PyBytes_AS_STRING(self); + self_len = PyString_GET_SIZE(self); + self_s = PyString_AS_STRING(self); count = countchar(self_s, self_len, from_c, maxcount); if (count == 0) { @@ -2743,10 +2743,10 @@ result_len = self_len - count; /* from_len == 1 */ assert(result_len>=0); - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) + if ( (result = (PyStringObject *) + PyString_FromStringAndSize(NULL, result_len)) == NULL) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); start = self_s; end = self_s + self_len; @@ -2765,18 +2765,18 @@ /* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_delete_substring(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_delete_substring(PyStringObject *self, const char *from_s, Py_ssize_t from_len, Py_ssize_t maxcount) { char *self_s, *result_s; char *start, *next, *end; Py_ssize_t self_len, result_len; Py_ssize_t count, offset; - PyBytesObject *result; + PyStringObject *result; - self_len = PyBytes_GET_SIZE(self); - self_s = PyBytes_AS_STRING(self); + self_len = PyString_GET_SIZE(self); + self_s = PyString_AS_STRING(self); count = countstring(self_s, self_len, from_s, from_len, @@ -2791,11 +2791,11 @@ result_len = self_len - (count * from_len); assert (result_len>=0); - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL ) + if ( (result = (PyStringObject *) + PyString_FromStringAndSize(NULL, result_len)) == NULL ) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); start = self_s; end = self_s + self_len; @@ -2817,18 +2817,18 @@ } /* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_single_character_in_place(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_single_character_in_place(PyStringObject *self, char from_c, char to_c, Py_ssize_t maxcount) { char *self_s, *result_s, *start, *end, *next; Py_ssize_t self_len; - PyBytesObject *result; + PyStringObject *result; /* The result string will be the same size */ - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); + self_s = PyString_AS_STRING(self); + self_len = PyString_GET_SIZE(self); next = findchar(self_s, self_len, from_c); @@ -2838,10 +2838,10 @@ } /* Need to make a new string */ - result = (PyBytesObject *) PyBytes_FromStringAndSize(NULL, self_len); + result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); if (result == NULL) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); Py_MEMCPY(result_s, self_s, self_len); /* change everything in-place, starting with this one */ @@ -2862,8 +2862,8 @@ } /* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_substring_in_place(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_substring_in_place(PyStringObject *self, const char *from_s, Py_ssize_t from_len, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) @@ -2871,12 +2871,12 @@ char *result_s, *start, *end; char *self_s; Py_ssize_t self_len, offset; - PyBytesObject *result; + PyStringObject *result; /* The result string will be the same size */ - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); + self_s = PyString_AS_STRING(self); + self_len = PyString_GET_SIZE(self); offset = findstring(self_s, self_len, from_s, from_len, @@ -2887,10 +2887,10 @@ } /* Need to make a new string */ - result = (PyBytesObject *) PyBytes_FromStringAndSize(NULL, self_len); + result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); if (result == NULL) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); Py_MEMCPY(result_s, self_s, self_len); /* change everything in-place, starting with this one */ @@ -2913,8 +2913,8 @@ } /* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_single_character(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_single_character(PyStringObject *self, char from_c, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) @@ -2923,10 +2923,10 @@ char *start, *next, *end; Py_ssize_t self_len, result_len; Py_ssize_t count, product; - PyBytesObject *result; + PyStringObject *result; - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); + self_s = PyString_AS_STRING(self); + self_len = PyString_GET_SIZE(self); count = countchar(self_s, self_len, from_c, maxcount); if (count == 0) { @@ -2947,10 +2947,10 @@ return NULL; } - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) + if ( (result = (PyStringObject *) + PyString_FromStringAndSize(NULL, result_len)) == NULL) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); start = self_s; end = self_s + self_len; @@ -2980,8 +2980,8 @@ } /* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_substring(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace_substring(PyStringObject *self, const char *from_s, Py_ssize_t from_len, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) { @@ -2989,10 +2989,10 @@ char *start, *next, *end; Py_ssize_t self_len, result_len; Py_ssize_t count, offset, product; - PyBytesObject *result; + PyStringObject *result; - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); + self_s = PyString_AS_STRING(self); + self_len = PyString_GET_SIZE(self); count = countstring(self_s, self_len, from_s, from_len, @@ -3015,10 +3015,10 @@ return NULL; } - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) + if ( (result = (PyStringObject *) + PyString_FromStringAndSize(NULL, result_len)) == NULL) return NULL; - result_s = PyBytes_AS_STRING(result); + result_s = PyString_AS_STRING(result); start = self_s; end = self_s + self_len; @@ -3050,15 +3050,15 @@ } -Py_LOCAL(PyBytesObject *) -replace(PyBytesObject *self, +Py_LOCAL(PyStringObject *) +replace(PyStringObject *self, const char *from_s, Py_ssize_t from_len, const char *to_s, Py_ssize_t to_len, Py_ssize_t maxcount) { if (maxcount < 0) { maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyBytes_GET_SIZE(self) == 0) { + } else if (maxcount == 0 || PyString_GET_SIZE(self) == 0) { /* nothing to do; return the original string */ return return_self(self); } @@ -3081,7 +3081,7 @@ /* Except for "".replace("", "A") == "A" there is no way beyond this */ /* point for an empty self string to generate a non-empty string */ /* Special case so the remaining code always gets a non-empty string */ - if (PyBytes_GET_SIZE(self) == 0) { + if (PyString_GET_SIZE(self) == 0) { return return_self(self); } @@ -3128,7 +3128,7 @@ given, only the first count occurrences are replaced."); static PyObject * -string_replace(PyBytesObject *self, PyObject *args) +string_replace(PyStringObject *self, PyObject *args) { Py_ssize_t count = -1; PyObject *from, *to; @@ -3138,9 +3138,9 @@ if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) return NULL; - if (PyBytes_Check(from)) { - from_s = PyBytes_AS_STRING(from); - from_len = PyBytes_GET_SIZE(from); + if (PyString_Check(from)) { + from_s = PyString_AS_STRING(from); + from_len = PyString_GET_SIZE(from); } #ifdef Py_USING_UNICODE if (PyUnicode_Check(from)) @@ -3150,9 +3150,9 @@ else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) return NULL; - if (PyBytes_Check(to)) { - to_s = PyBytes_AS_STRING(to); - to_len = PyBytes_GET_SIZE(to); + if (PyString_Check(to)) { + to_s = PyString_AS_STRING(to); + to_len = PyString_GET_SIZE(to); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(to)) @@ -3162,7 +3162,7 @@ else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) return NULL; - return (PyObject *)replace((PyBytesObject *) self, + return (PyObject *)replace((PyStringObject *) self, from_s, from_len, to_s, to_len, count); } @@ -3174,17 +3174,17 @@ * -1 on error, 0 if not found and 1 if found. */ Py_LOCAL(int) -_string_tailmatch(PyBytesObject *self, PyObject *substr, Py_ssize_t start, +_string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) { - Py_ssize_t len = PyBytes_GET_SIZE(self); + Py_ssize_t len = PyString_GET_SIZE(self); Py_ssize_t slen; const char* sub; const char* str; - if (PyBytes_Check(substr)) { - sub = PyBytes_AS_STRING(substr); - slen = PyBytes_GET_SIZE(substr); + if (PyString_Check(substr)) { + sub = PyString_AS_STRING(substr); + slen = PyString_GET_SIZE(substr); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(substr)) @@ -3193,7 +3193,7 @@ #endif else if (PyObject_AsCharBuffer(substr, &sub, &slen)) return -1; - str = PyBytes_AS_STRING(self); + str = PyString_AS_STRING(self); string_adjust_indices(&start, &end, len); @@ -3224,7 +3224,7 @@ prefix can also be a tuple of strings to try."); static PyObject * -string_startswith(PyBytesObject *self, PyObject *args) +string_startswith(PyStringObject *self, PyObject *args) { Py_ssize_t start = 0; Py_ssize_t end = PY_SSIZE_T_MAX; @@ -3265,7 +3265,7 @@ suffix can also be a tuple of strings to try."); static PyObject * -string_endswith(PyBytesObject *self, PyObject *args) +string_endswith(PyStringObject *self, PyObject *args) { Py_ssize_t start = 0; Py_ssize_t end = PY_SSIZE_T_MAX; @@ -3308,7 +3308,7 @@ codecs.register_error that is able to handle UnicodeEncodeErrors."); static PyObject * -string_encode(PyBytesObject *self, PyObject *args) +string_encode(PyStringObject *self, PyObject *args) { char *encoding = NULL; char *errors = NULL; @@ -3316,10 +3316,10 @@ if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) return NULL; - v = PyBytes_AsEncodedObject((PyObject *)self, encoding, errors); + v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); if (v == NULL) goto onError; - if (!PyBytes_Check(v) && !PyUnicode_Check(v)) { + if (!PyString_Check(v) && !PyUnicode_Check(v)) { PyErr_Format(PyExc_TypeError, "encoder did not return a string/unicode object " "(type=%.400s)", @@ -3345,7 +3345,7 @@ able to handle UnicodeDecodeErrors."); static PyObject * -string_decode(PyBytesObject *self, PyObject *args) +string_decode(PyStringObject *self, PyObject *args) { char *encoding = NULL; char *errors = NULL; @@ -3353,10 +3353,10 @@ if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) return NULL; - v = PyBytes_AsDecodedObject((PyObject *)self, encoding, errors); + v = PyString_AsDecodedObject((PyObject *)self, encoding, errors); if (v == NULL) goto onError; - if (!PyBytes_Check(v) && !PyUnicode_Check(v)) { + if (!PyString_Check(v) && !PyUnicode_Check(v)) { PyErr_Format(PyExc_TypeError, "decoder did not return a string/unicode object " "(type=%.400s)", @@ -3378,7 +3378,7 @@ If tabsize is not given, a tab size of 8 characters is assumed."); static PyObject* -string_expandtabs(PyBytesObject *self, PyObject *args) +string_expandtabs(PyStringObject *self, PyObject *args) { const char *e, *p, *qe; char *q; @@ -3392,8 +3392,8 @@ /* First pass: determine size of output string */ i = 0; /* chars up to and including most recent \n or \r */ j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyBytes_AS_STRING(self) + PyBytes_GET_SIZE(self); /* end of input */ - for (p = PyBytes_AS_STRING(self); p < e; p++) + e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */ + for (p = PyString_AS_STRING(self); p < e; p++) if (*p == '\t') { if (tabsize > 0) { incr = tabsize - (j % tabsize); @@ -3418,15 +3418,15 @@ goto overflow1; /* Second pass: create output string and fill it */ - u = PyBytes_FromStringAndSize(NULL, i + j); + u = PyString_FromStringAndSize(NULL, i + j); if (!u) return NULL; j = 0; /* same as in first pass */ - q = PyBytes_AS_STRING(u); /* next output char */ - qe = PyBytes_AS_STRING(u) + PyBytes_GET_SIZE(u); /* end of output */ + q = PyString_AS_STRING(u); /* next output char */ + qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */ - for (p = PyBytes_AS_STRING(self); p < e; p++) + for (p = PyString_AS_STRING(self); p < e; p++) if (*p == '\t') { if (tabsize > 0) { i = tabsize - (j % tabsize); @@ -3457,7 +3457,7 @@ } Py_LOCAL_INLINE(PyObject *) -pad(PyBytesObject *self, Py_ssize_t left, Py_ssize_t right, char fill) +pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill) { PyObject *u; @@ -3466,21 +3466,21 @@ if (right < 0) right = 0; - if (left == 0 && right == 0 && PyBytes_CheckExact(self)) { + if (left == 0 && right == 0 && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject *)self; } - u = PyBytes_FromStringAndSize(NULL, - left + PyBytes_GET_SIZE(self) + right); + u = PyString_FromStringAndSize(NULL, + left + PyString_GET_SIZE(self) + right); if (u) { if (left) - memset(PyBytes_AS_STRING(u), fill, left); - Py_MEMCPY(PyBytes_AS_STRING(u) + left, - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self)); + memset(PyString_AS_STRING(u), fill, left); + Py_MEMCPY(PyString_AS_STRING(u) + left, + PyString_AS_STRING(self), + PyString_GET_SIZE(self)); if (right) - memset(PyBytes_AS_STRING(u) + left + PyBytes_GET_SIZE(self), + memset(PyString_AS_STRING(u) + left + PyString_GET_SIZE(self), fill, right); } @@ -3494,7 +3494,7 @@ "done using the specified fill character (default is a space)."); static PyObject * -string_ljust(PyBytesObject *self, PyObject *args) +string_ljust(PyStringObject *self, PyObject *args) { Py_ssize_t width; char fillchar = ' '; @@ -3502,12 +3502,12 @@ if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) return NULL; - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { + if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*) self; } - return pad(self, 0, width - PyBytes_GET_SIZE(self), fillchar); + return pad(self, 0, width - PyString_GET_SIZE(self), fillchar); } @@ -3518,7 +3518,7 @@ "done using the specified fill character (default is a space)"); static PyObject * -string_rjust(PyBytesObject *self, PyObject *args) +string_rjust(PyStringObject *self, PyObject *args) { Py_ssize_t width; char fillchar = ' '; @@ -3526,12 +3526,12 @@ if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) return NULL; - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { + if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*) self; } - return pad(self, width - PyBytes_GET_SIZE(self), 0, fillchar); + return pad(self, width - PyString_GET_SIZE(self), 0, fillchar); } @@ -3542,7 +3542,7 @@ "done using the specified fill character (default is a space)"); static PyObject * -string_center(PyBytesObject *self, PyObject *args) +string_center(PyStringObject *self, PyObject *args) { Py_ssize_t marg, left; Py_ssize_t width; @@ -3551,12 +3551,12 @@ if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) return NULL; - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { + if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*) self; } - marg = width - PyBytes_GET_SIZE(self); + marg = width - PyString_GET_SIZE(self); left = marg / 2 + (marg & width & 1); return pad(self, left, marg - left, fillchar); @@ -3569,7 +3569,7 @@ "of the specified width. The string S is never truncated."); static PyObject * -string_zfill(PyBytesObject *self, PyObject *args) +string_zfill(PyStringObject *self, PyObject *args) { Py_ssize_t fill; PyObject *s; @@ -3579,26 +3579,26 @@ if (!PyArg_ParseTuple(args, "n:zfill", &width)) return NULL; - if (PyBytes_GET_SIZE(self) >= width) { - if (PyBytes_CheckExact(self)) { + if (PyString_GET_SIZE(self) >= width) { + if (PyString_CheckExact(self)) { Py_INCREF(self); return (PyObject*) self; } else - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self) + return PyString_FromStringAndSize( + PyString_AS_STRING(self), + PyString_GET_SIZE(self) ); } - fill = width - PyBytes_GET_SIZE(self); + fill = width - PyString_GET_SIZE(self); s = pad(self, fill, 0, '0'); if (s == NULL) return NULL; - p = PyBytes_AS_STRING(s); + p = PyString_AS_STRING(s); if (p[fill] == '+' || p[fill] == '-') { /* move sign to beginning of string */ p[0] = p[fill]; @@ -3615,22 +3615,22 @@ and there is at least one character in S, False otherwise."); static PyObject* -string_isspace(PyBytesObject *self) +string_isspace(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && + if (PyString_GET_SIZE(self) == 1 && isspace(*p)) return PyBool_FromLong(1); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isspace(*p)) return PyBool_FromLong(0); @@ -3646,22 +3646,22 @@ and there is at least one character in S, False otherwise."); static PyObject* -string_isalpha(PyBytesObject *self) +string_isalpha(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && + if (PyString_GET_SIZE(self) == 1 && isalpha(*p)) return PyBool_FromLong(1); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalpha(*p)) return PyBool_FromLong(0); @@ -3677,22 +3677,22 @@ and there is at least one character in S, False otherwise."); static PyObject* -string_isalnum(PyBytesObject *self) +string_isalnum(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && + if (PyString_GET_SIZE(self) == 1 && isalnum(*p)) return PyBool_FromLong(1); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isalnum(*p)) return PyBool_FromLong(0); @@ -3708,22 +3708,22 @@ and there is at least one character in S, False otherwise."); static PyObject* -string_isdigit(PyBytesObject *self) +string_isdigit(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && + if (PyString_GET_SIZE(self) == 1 && isdigit(*p)) return PyBool_FromLong(1); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); for (; p < e; p++) { if (!isdigit(*p)) return PyBool_FromLong(0); @@ -3739,22 +3739,22 @@ at least one cased character in S, False otherwise."); static PyObject* -string_islower(PyBytesObject *self) +string_islower(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; int cased; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) + if (PyString_GET_SIZE(self) == 1) return PyBool_FromLong(islower(*p) != 0); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); cased = 0; for (; p < e; p++) { if (isupper(*p)) @@ -3773,22 +3773,22 @@ at least one cased character in S, False otherwise."); static PyObject* -string_isupper(PyBytesObject *self) +string_isupper(PyStringObject *self) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; int cased; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) + if (PyString_GET_SIZE(self) == 1) return PyBool_FromLong(isupper(*p) != 0); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); cased = 0; for (; p < e; p++) { if (islower(*p)) @@ -3809,22 +3809,22 @@ otherwise."); static PyObject* -string_istitle(PyBytesObject *self, PyObject *uncased) +string_istitle(PyStringObject *self, PyObject *uncased) { register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); + = (unsigned char *) PyString_AS_STRING(self); register const unsigned char *e; int cased, previous_is_cased; /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) + if (PyString_GET_SIZE(self) == 1) return PyBool_FromLong(isupper(*p) != 0); /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) + if (PyString_GET_SIZE(self) == 0) return PyBool_FromLong(0); - e = p + PyBytes_GET_SIZE(self); + e = p + PyString_GET_SIZE(self); cased = 0; previous_is_cased = 0; for (; p < e; p++) { @@ -3857,7 +3857,7 @@ is given and true."); static PyObject* -string_splitlines(PyBytesObject *self, PyObject *args) +string_splitlines(PyStringObject *self, PyObject *args) { register Py_ssize_t i; register Py_ssize_t j; @@ -3870,8 +3870,8 @@ if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) return NULL; - data = PyBytes_AS_STRING(self); - len = PyBytes_GET_SIZE(self); + data = PyString_AS_STRING(self); + len = PyString_GET_SIZE(self); /* This does not use the preallocated list because splitlines is usually run with hundreds of newlines. The overhead of @@ -3921,10 +3921,10 @@ "S.__sizeof__() -> size of S in memory, in bytes"); static PyObject * -string_sizeof(PyBytesObject *v) +string_sizeof(PyStringObject *v) { Py_ssize_t res; - res = sizeof(PyBytesObject) + v->ob_size * v->ob_type->tp_itemsize; + res = sizeof(PyStringObject) + v->ob_size * v->ob_type->tp_itemsize; return PyInt_FromSsize_t(res); } @@ -3934,7 +3934,7 @@ #undef PREALLOC_SIZE static PyObject * -string_getnewargs(PyBytesObject *v) +string_getnewargs(PyStringObject *v) { return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); } @@ -3958,7 +3958,7 @@ /* This is to allow things like u''.format('') */ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) goto done; - if (!(PyBytes_Check(format_spec) || PyUnicode_Check(format_spec))) { + if (!(PyString_Check(format_spec) || PyUnicode_Check(format_spec))) { PyErr_Format(PyExc_TypeError, "__format__ arg must be str " "or unicode, not %s", Py_TYPE(format_spec)->tp_name); goto done; @@ -3969,8 +3969,8 @@ format_spec = tmp; result = _PyBytes_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); + PyString_AS_STRING(format_spec), + PyString_GET_SIZE(format_spec)); done: Py_XDECREF(tmp); return result; @@ -4050,12 +4050,12 @@ PyObject *x = NULL; static char *kwlist[] = {"object", 0}; - if (type != &PyBytes_Type) + if (type != &PyString_Type) return str_subtype_new(type, args, kwds); if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) return NULL; if (x == NULL) - return PyBytes_FromString(""); + return PyString_FromString(""); return PyObject_Str(x); } @@ -4065,18 +4065,18 @@ PyObject *tmp, *pnew; Py_ssize_t n; - assert(PyType_IsSubtype(type, &PyBytes_Type)); - tmp = string_new(&PyBytes_Type, args, kwds); + assert(PyType_IsSubtype(type, &PyString_Type)); + tmp = string_new(&PyString_Type, args, kwds); if (tmp == NULL) return NULL; - assert(PyBytes_CheckExact(tmp)); - n = PyBytes_GET_SIZE(tmp); + assert(PyString_CheckExact(tmp)); + n = PyString_GET_SIZE(tmp); pnew = type->tp_alloc(type, n); if (pnew != NULL) { - Py_MEMCPY(PyBytes_AS_STRING(pnew), PyBytes_AS_STRING(tmp), n+1); - ((PyBytesObject *)pnew)->ob_shash = - ((PyBytesObject *)tmp)->ob_shash; - ((PyBytesObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; + Py_MEMCPY(PyString_AS_STRING(pnew), PyString_AS_STRING(tmp), n+1); + ((PyStringObject *)pnew)->ob_shash = + ((PyStringObject *)tmp)->ob_shash; + ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; } Py_DECREF(tmp); return pnew; @@ -4093,11 +4093,11 @@ static PyObject * string_mod(PyObject *v, PyObject *w) { - if (!PyBytes_Check(v)) { + if (!PyString_Check(v)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } - return PyBytes_Format(v, w); + return PyString_Format(v, w); } PyDoc_STRVAR(basestring_doc, @@ -4160,10 +4160,10 @@ Return a nice string representation of the object.\n\ If the argument is a string, the return value is the same object."); -PyTypeObject PyBytes_Type = { +PyTypeObject PyString_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "str", - sizeof(PyBytesObject), + sizeof(PyStringObject), sizeof(char), string_dealloc, /* tp_dealloc */ (printfunc)string_print, /* tp_print */ @@ -4205,25 +4205,25 @@ }; void -PyBytes_Concat(register PyObject **pv, register PyObject *w) +PyString_Concat(register PyObject **pv, register PyObject *w) { register PyObject *v; if (*pv == NULL) return; - if (w == NULL || !PyBytes_Check(*pv)) { + if (w == NULL || !PyString_Check(*pv)) { Py_DECREF(*pv); *pv = NULL; return; } - v = string_concat((PyBytesObject *) *pv, w); + v = string_concat((PyStringObject *) *pv, w); Py_DECREF(*pv); *pv = v; } void -PyBytes_ConcatAndDel(register PyObject **pv, register PyObject *w) +PyString_ConcatAndDel(register PyObject **pv, register PyObject *w) { - PyBytes_Concat(pv, w); + PyString_Concat(pv, w); Py_XDECREF(w); } @@ -4243,13 +4243,13 @@ */ int -_PyBytes_Resize(PyObject **pv, Py_ssize_t newsize) +_PyString_Resize(PyObject **pv, Py_ssize_t newsize) { register PyObject *v; - register PyBytesObject *sv; + register PyStringObject *sv; v = *pv; - if (!PyBytes_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyBytes_CHECK_INTERNED(v)) { + if (!PyString_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || + PyString_CHECK_INTERNED(v)) { *pv = 0; Py_DECREF(v); PyErr_BadInternalCall(); @@ -4259,14 +4259,14 @@ _Py_DEC_REFTOTAL; _Py_ForgetReference(v); *pv = (PyObject *) - PyObject_REALLOC((char *)v, sizeof(PyBytesObject) + newsize); + PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize); if (*pv == NULL) { PyObject_Del(v); PyErr_NoMemory(); return -1; } _Py_NewReference(*pv); - sv = (PyBytesObject *) *pv; + sv = (PyStringObject *) *pv; Py_SIZE(sv) = newsize; sv->ob_sval[newsize] = '\0'; sv->ob_shash = -1; /* invalidate cached hash value */ @@ -4352,7 +4352,7 @@ return (int)strlen(buf); } -/* _PyBytes_FormatLong emulates the format codes d, u, o, x and X, and +/* _PyString_FormatLong emulates the format codes d, u, o, x and X, and * the F_ALT flag, for Python's long (unbounded) ints. It's not used for * Python's regular ints. * Return value: a new PyString*, or NULL if error. @@ -4374,7 +4374,7 @@ * produce a '-' sign, but can for Python's unbounded ints. */ PyObject* -_PyBytes_FormatLong(PyObject *val, int flags, int prec, int type, +_PyString_FormatLong(PyObject *val, int flags, int prec, int type, char **pbuf, int *plen) { PyObject *result = NULL; @@ -4405,7 +4405,7 @@ if (!result) return NULL; - buf = PyBytes_AsString(result); + buf = PyString_AsString(result); if (!buf) { Py_DECREF(result); return NULL; @@ -4416,9 +4416,9 @@ PyErr_BadInternalCall(); return NULL; } - llen = PyBytes_Size(result); + llen = PyString_Size(result); if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyBytes_FormatLong"); + PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); return NULL; } len = (int)llen; @@ -4464,14 +4464,14 @@ /* Fill with leading zeroes to meet minimum width. */ if (prec > numdigits) { - PyObject *r1 = PyBytes_FromStringAndSize(NULL, + PyObject *r1 = PyString_FromStringAndSize(NULL, numnondigits + prec); char *b1; if (!r1) { Py_DECREF(result); return NULL; } - b1 = PyBytes_AS_STRING(r1); + b1 = PyString_AS_STRING(r1); for (i = 0; i < numnondigits; ++i) *b1++ = *buf++; for (i = 0; i < prec - numdigits; i++) @@ -4481,7 +4481,7 @@ *b1 = '\0'; Py_DECREF(result); result = r1; - buf = PyBytes_AS_STRING(result); + buf = PyString_AS_STRING(result); len = numnondigits + prec; } @@ -4575,7 +4575,7 @@ formatchar(char *buf, size_t buflen, PyObject *v) { /* presume that the buffer is at least 2 characters long */ - if (PyBytes_Check(v)) { + if (PyString_Check(v)) { if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) return -1; } @@ -4598,7 +4598,7 @@ #define FORMATBUFLEN (size_t)120 PyObject * -PyBytes_Format(PyObject *format, PyObject *args) +PyString_Format(PyObject *format, PyObject *args) { char *fmt, *res; Py_ssize_t arglen, argidx; @@ -4609,18 +4609,18 @@ PyObject *v, *w; #endif PyObject *dict = NULL; - if (format == NULL || !PyBytes_Check(format) || args == NULL) { + if (format == NULL || !PyString_Check(format) || args == NULL) { PyErr_BadInternalCall(); return NULL; } orig_args = args; - fmt = PyBytes_AS_STRING(format); - fmtcnt = PyBytes_GET_SIZE(format); + fmt = PyString_AS_STRING(format); + fmtcnt = PyString_GET_SIZE(format); reslen = rescnt = fmtcnt + 100; - result = PyBytes_FromStringAndSize((char *)NULL, reslen); + result = PyString_FromStringAndSize((char *)NULL, reslen); if (result == NULL) return NULL; - res = PyBytes_AsString(result); + res = PyString_AsString(result); if (PyTuple_Check(args)) { arglen = PyTuple_GET_SIZE(args); argidx = 0; @@ -4637,9 +4637,9 @@ if (--rescnt < 0) { rescnt = fmtcnt + 100; reslen += rescnt; - if (_PyBytes_Resize(&result, reslen) < 0) + if (_PyString_Resize(&result, reslen) < 0) return NULL; - res = PyBytes_AS_STRING(result) + res = PyString_AS_STRING(result) + reslen - rescnt; --rescnt; } @@ -4694,7 +4694,7 @@ "incomplete format key"); goto error; } - key = PyBytes_FromStringAndSize(keystart, + key = PyString_FromStringAndSize(keystart, keylen); if (key == NULL) goto error; @@ -4835,14 +4835,14 @@ temp = PyObject_Repr(v); if (temp == NULL) goto error; - if (!PyBytes_Check(temp)) { + if (!PyString_Check(temp)) { PyErr_SetString(PyExc_TypeError, "%s argument has non-string str()"); Py_DECREF(temp); goto error; } - pbuf = PyBytes_AS_STRING(temp); - len = PyBytes_GET_SIZE(temp); + pbuf = PyString_AS_STRING(temp); + len = PyString_GET_SIZE(temp); if (prec >= 0 && len > prec) len = prec; break; @@ -4882,7 +4882,7 @@ int ilen; isnumok = 1; - temp = _PyBytes_FormatLong(iobj, flags, + temp = _PyString_FormatLong(iobj, flags, prec, c, &pbuf, &ilen); Py_DECREF(iobj); len = ilen; @@ -4940,7 +4940,7 @@ "at index %zd", c, c, (Py_ssize_t)(fmt - 1 - - PyBytes_AsString(format))); + PyString_AsString(format))); goto error; } if (sign) { @@ -4966,11 +4966,11 @@ Py_XDECREF(temp); return PyErr_NoMemory(); } - if (_PyBytes_Resize(&result, reslen) < 0) { + if (_PyString_Resize(&result, reslen) < 0) { Py_XDECREF(temp); return NULL; } - res = PyBytes_AS_STRING(result) + res = PyString_AS_STRING(result) + reslen - rescnt; } if (sign) { @@ -5034,7 +5034,7 @@ if (args_owned) { Py_DECREF(args); } - _PyBytes_Resize(&result, reslen - rescnt); + _PyString_Resize(&result, reslen - rescnt); return result; #ifdef Py_USING_UNICODE @@ -5063,11 +5063,11 @@ args_owned = 1; /* Take what we have of the result and let the Unicode formatting function format the rest of the input. */ - rescnt = res - PyBytes_AS_STRING(result); - if (_PyBytes_Resize(&result, rescnt)) + rescnt = res - PyString_AS_STRING(result); + if (_PyString_Resize(&result, rescnt)) goto error; - fmtcnt = PyBytes_GET_SIZE(format) - \ - (fmt - PyBytes_AS_STRING(format)); + fmtcnt = PyString_GET_SIZE(format) - \ + (fmt - PyString_AS_STRING(format)); format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); if (format == NULL) goto error; @@ -5095,15 +5095,15 @@ void PyString_InternInPlace(PyObject **p) { - register PyBytesObject *s = (PyBytesObject *)(*p); + register PyStringObject *s = (PyStringObject *)(*p); PyObject *t; - if (s == NULL || !PyBytes_Check(s)) + if (s == NULL || !PyString_Check(s)) Py_FatalError("PyString_InternInPlace: strings only please!"); /* If it's a string subclass, we don't really know what putting it in the interned dict might do. */ - if (!PyBytes_CheckExact(s)) + if (!PyString_CheckExact(s)) return; - if (PyBytes_CHECK_INTERNED(s)) + if (PyString_CHECK_INTERNED(s)) return; if (interned == NULL) { interned = PyDict_New(); @@ -5127,15 +5127,15 @@ /* The two references in interned are not counted by refcnt. The string deallocator will take care of this */ Py_REFCNT(s) -= 2; - PyBytes_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; + PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; } void PyString_InternImmortal(PyObject **p) { PyString_InternInPlace(p); - if (PyBytes_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyBytes_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; + if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { + PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; Py_INCREF(*p); } } @@ -5144,7 +5144,7 @@ PyObject * PyString_InternFromString(const char *cp) { - PyObject *s = PyBytes_FromString(cp); + PyObject *s = PyString_FromString(cp); if (s == NULL) return NULL; PyString_InternInPlace(&s); @@ -5166,7 +5166,7 @@ void _Py_ReleaseInternedStrings(void) { PyObject *keys; - PyBytesObject *s; + PyStringObject *s; Py_ssize_t i, n; Py_ssize_t immortal_size = 0, mortal_size = 0; @@ -5187,7 +5187,7 @@ fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n", n); for (i = 0; i < n; i++) { - s = (PyBytesObject *) PyList_GET_ITEM(keys, i); + s = (PyStringObject *) PyList_GET_ITEM(keys, i); switch (s->ob_sstate) { case SSTATE_NOT_INTERNED: /* XXX Shouldn't happen */ Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Tue Jun 10 19:42:36 2008 @@ -453,7 +453,7 @@ PyObject *str, *oerrors; assert(PyFile_Check(f)); - str = PyBytes_FromString(enc); + str = PyString_FromString(enc); if (!str) return 0; if (errors) { @@ -2321,9 +2321,9 @@ #ifdef Py_USING_UNICODE if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { - char *cenc = PyBytes_AS_STRING(enc); + char *cenc = PyString_AS_STRING(enc); char *errors = fobj->f_errors == Py_None ? - "strict" : PyBytes_AS_STRING(fobj->f_errors); + "strict" : PyString_AS_STRING(fobj->f_errors); value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) return -1; From buildbot at python.org Tue Jun 10 20:21:04 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 18:21:04 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080610182104.481731E4002@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/3795 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 BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 20:29:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 18:29:47 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080610182947.A69891E4003@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/1559 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: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_tarfile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 20:47:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 18:47:54 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080610184754.DE36A1E4002@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/617 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: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net ====================================================================== ERROR: test_current_time (test.test_xmlrpc_net.CurrentTimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_xmlrpc_net.py", line 18, in test_current_time t0 = server.currentTime.getCurrentTime() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/xmlrpc/client.py", line 1095, in __call__ return self.__send(self.__name, args) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/xmlrpc/client.py", line 1353, in __request verbose=self.__verbose File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/xmlrpc/client.py", line 1136, in request return self._parse_response(resp, None) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/xmlrpc/client.py", line 1246, in _parse_response p.feed(response) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/xmlrpc/client.py", line 516, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: mismatched tag: line 10, column 7 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 21:11:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 19:11:56 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080610191156.742A71E4016@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1051 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net ====================================================================== ERROR: test_current_time (test.test_xmlrpc_net.CurrentTimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_xmlrpc_net.py", line 18, in test_current_time t0 = server.currentTime.getCurrentTime() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/xmlrpc/client.py", line 1095, in __call__ return self.__send(self.__name, args) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/xmlrpc/client.py", line 1353, in __request verbose=self.__verbose File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/xmlrpc/client.py", line 1136, in request return self._parse_response(resp, None) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/xmlrpc/client.py", line 1246, in _parse_response p.feed(response) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/xmlrpc/client.py", line 516, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: mismatched tag: line 10, column 7 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 22:13:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 20:13:15 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080610201328.931D11E4002@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/1018 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 22:14:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 20:14:03 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080610201412.F14E71E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/964 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net ====================================================================== ERROR: test_current_time (test.test_xmlrpc_net.CurrentTimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_xmlrpc_net.py", line 18, in test_current_time t0 = server.currentTime.getCurrentTime() File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1095, in __call__ return self.__send(self.__name, args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1353, in __request verbose=self.__verbose File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1136, in request return self._parse_response(resp, None) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1246, in _parse_response p.feed(response) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 516, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: mismatched tag: line 10, column 7 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 10 22:25:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 20:25:00 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080610202501.18F5D1E4005@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/469 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_funcattrs test_xmlrpc_net ====================================================================== ERROR: test_current_time (test.test_xmlrpc_net.CurrentTimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_xmlrpc_net.py", line 18, in test_current_time t0 = server.currentTime.getCurrentTime() File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/xmlrpc/client.py", line 1095, in __call__ return self.__send(self.__name, args) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/xmlrpc/client.py", line 1353, in __request verbose=self.__verbose File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/xmlrpc/client.py", line 1136, in request return self._parse_response(resp, None) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/xmlrpc/client.py", line 1246, in _parse_response p.feed(response) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/xmlrpc/client.py", line 516, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: mismatched tag: line 10, column 7 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 10 22:37:02 2008 From: python-checkins at python.org (armin.ronacher) Date: Tue, 10 Jun 2008 22:37:02 +0200 (CEST) Subject: [Python-checkins] r64089 - python/trunk/Doc/library/ast.rst Message-ID: <20080610203702.7715A1E4002@bag.python.org> Author: armin.ronacher Date: Tue Jun 10 22:37:02 2008 New Revision: 64089 Log: Fix a formatting error in the ast documentation. Modified: python/trunk/Doc/library/ast.rst Modified: python/trunk/Doc/library/ast.rst ============================================================================== --- python/trunk/Doc/library/ast.rst (original) +++ python/trunk/Doc/library/ast.rst Tue Jun 10 22:37:02 2008 @@ -135,7 +135,7 @@ from untrusted sources without the need to parse the values oneself. -.. function:: get_docstring(node, clean=True): +.. function:: get_docstring(node, clean=True) Return the docstring of the given *node* (which must be a :class:`FunctionDef`, :class:`ClassDef` or :class:`Module` node), or ``None`` From python-checkins at python.org Tue Jun 10 22:52:20 2008 From: python-checkins at python.org (armin.ronacher) Date: Tue, 10 Jun 2008 22:52:20 +0200 (CEST) Subject: [Python-checkins] r64090 - python/trunk/Doc/library/ast.rst Message-ID: <20080610205220.25D941E4011@bag.python.org> Author: armin.ronacher Date: Tue Jun 10 22:52:19 2008 New Revision: 64090 Log: Documented the new AST constructor. Modified: python/trunk/Doc/library/ast.rst Modified: python/trunk/Doc/library/ast.rst ============================================================================== --- python/trunk/Doc/library/ast.rst (original) +++ python/trunk/Doc/library/ast.rst Tue Jun 10 22:52:19 2008 @@ -96,6 +96,11 @@ node = ast.UnaryOp(ast.USub(), ast.Num(5, lineno=0, col_offset=0), lineno=0, col_offset=0) + .. versionadded:: 2.6 + The constructor as explained above was added. In Python 2.5 nodes had + to be created by calling the class constructor without arguments and + setting the attributes afterwards. + .. _abstract-grammar: From python-checkins at python.org Tue Jun 10 23:23:23 2008 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 10 Jun 2008 23:23:23 +0200 (CEST) Subject: [Python-checkins] r64093 - in python/trunk: Makefile.pre.in Objects/bytesobject.c Objects/stringobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PCbuild/pythoncore.vcproj Message-ID: <20080610212323.B81C11E4003@bag.python.org> Author: gregory.p.smith Date: Tue Jun 10 23:23:22 2008 New Revision: 64093 Log: Rename bytesobject.c back to stringobject.c to keep with the PyString theme. Part of reverting most of r63675 per the mailing list discussion. Added: python/trunk/Objects/stringobject.c - copied unchanged from r64086, /python/trunk/Objects/bytesobject.c Removed: python/trunk/Objects/bytesobject.c Modified: python/trunk/Makefile.pre.in python/trunk/PC/VC6/pythoncore.dsp python/trunk/PC/VS7.1/pythoncore.vcproj python/trunk/PC/VS8.0/pythoncore.vcproj python/trunk/PCbuild/pythoncore.vcproj Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Tue Jun 10 23:23:22 2008 @@ -303,7 +303,6 @@ Objects/bufferobject.o \ Objects/bytes_methods.o \ Objects/bytearrayobject.o \ - Objects/bytesobject.o \ Objects/cellobject.o \ Objects/classobject.o \ Objects/cobject.o \ @@ -327,8 +326,9 @@ Objects/object.o \ Objects/obmalloc.o \ Objects/rangeobject.o \ - Objects/setobject.o \ + Objects/setobject.o \ Objects/sliceobject.o \ + Objects/stringobject.o \ Objects/structseq.o \ Objects/tupleobject.o \ Objects/typeobject.o \ @@ -563,8 +563,6 @@ Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \ $(STRINGLIB_HEADERS) -Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c \ - $(STRINGLIB_HEADERS) Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \ $(STRINGLIB_HEADERS) Deleted: python/trunk/Objects/bytesobject.c ============================================================================== --- python/trunk/Objects/bytesobject.c Tue Jun 10 23:23:22 2008 +++ (empty file) @@ -1,5215 +0,0 @@ -/* String (str/bytes) object implementation */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include - -#ifdef COUNT_ALLOCS -int null_strings, one_strings; -#endif - -static PyStringObject *characters[UCHAR_MAX + 1]; -static PyStringObject *nullstring; - -/* This dictionary holds all interned strings. Note that references to - strings in this dictionary are *not* counted in the string's ob_refcnt. - When the interned string reaches a refcnt of 0 the string deallocation - function will delete the reference from this dictionary. - - Another way to look at this is that to say that the actual reference - count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) -*/ -static PyObject *interned; - -/* - For both PyString_FromString() and PyString_FromStringAndSize(), the - parameter `size' denotes number of characters to allocate, not counting any - null terminating character. - - For PyString_FromString(), the parameter `str' points to a null-terminated - string containing exactly `size' bytes. - - For PyString_FromStringAndSize(), the parameter the parameter `str' is - either NULL or else points to a string containing at least `size' bytes. - For PyString_FromStringAndSize(), the string in the `str' parameter does - not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyString_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyString_FromStringAndSize() will allocate `size+1' - bytes (setting the last byte to the null terminating character) and you can - fill in the data yourself. If `str' is non-NULL then the resulting - PyString object must be treated as immutable and you must not fill in nor - alter the data yourself, since the strings may be shared. - - The PyObject member `op->ob_size', which denotes the number of "extra - items" in a variable-size object, will contain the number of bytes - allocated for string data, not counting the null terminating character. It - is therefore equal to the equal to the `size' parameter (for - PyString_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyString_FromString()). -*/ -PyObject * -PyString_FromStringAndSize(const char *str, Py_ssize_t size) -{ - register PyStringObject *op; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyString_FromStringAndSize"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && str != NULL && - (op = characters[*str & UCHAR_MAX]) != NULL) - { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - if (str != NULL) - Py_MEMCPY(op->ob_sval, str, size); - op->ob_sval[size] = '\0'; - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1 && str != NULL) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromString(const char *str) -{ - register size_t size; - register PyStringObject *op; - - assert(str != NULL); - size = strlen(str); - if (size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string is too long for a Python string"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, str, size+1); - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t n = 0; - const char* f; - char *s; - PyObject* string; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f; - while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*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. */ - n += 20; - break; - case 's': - s = va_arg(count, char*); - n += strlen(s); - 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: - /* step 2: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyString_FromStringAndSize(NULL, n); - if (!string) - return NULL; - - s = PyString_AsString(string); - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - Py_ssize_t i; - int longflag = 0; - int size_tflag = 0; - /* parse the width.precision part (we're only - interested in the precision value, if any) */ - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - if (*f == '.') { - f++; - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - } - while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - f++; - /* 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': - if (longflag) - sprintf(s, "%ld", va_arg(vargs, long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "d", - va_arg(vargs, Py_ssize_t)); - else - sprintf(s, "%d", va_arg(vargs, int)); - s += strlen(s); - break; - case 'u': - if (longflag) - sprintf(s, "%lu", - va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "u", - va_arg(vargs, size_t)); - else - sprintf(s, "%u", - va_arg(vargs, unsigned int)); - s += strlen(s); - break; - case 'i': - sprintf(s, "%i", va_arg(vargs, int)); - s += strlen(s); - break; - case 'x': - sprintf(s, "%x", va_arg(vargs, int)); - s += strlen(s); - break; - case 's': - p = va_arg(vargs, char*); - i = strlen(p); - if (n > 0 && i > n) - i = n; - Py_MEMCPY(s, p, i); - s += i; - break; - case 'p': - sprintf(s, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (s[1] == 'X') - s[1] = 'x'; - else if (s[1] != 'x') { - memmove(s+2, s, strlen(s)+1); - s[0] = '0'; - s[1] = 'x'; - } - s += strlen(s); - break; - case '%': - *s++ = '%'; - break; - default: - strcpy(s, p); - s += strlen(s); - goto end; - } - } else - *s++ = *f; - } - - end: - _PyString_Resize(&string, s - PyString_AS_STRING(string)); - return string; -} - -PyObject * -PyString_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyString_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - - -PyObject *PyString_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsDecodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsDecodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Decode via the codec registry */ - v = PyCodec_Decode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsDecodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsDecodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -PyObject *PyString_Encode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsEncodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsEncodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsEncodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsEncodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -static void -string_dealloc(PyObject *op) -{ - switch (PyString_CHECK_INTERNED(op)) { - case SSTATE_NOT_INTERNED: - break; - - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(op) = 3; - if (PyDict_DelItem(interned, op) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; - - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); - - default: - Py_FatalError("Inconsistent interned string state."); - } - Py_TYPE(op)->tp_free(op); -} - -/* Unescape a backslash-escaped string. If unicode is non-zero, - the string is a u-literal. If recode_encoding is non-zero, - the string is UTF-8 encoded and should be re-encoded in the - specified encoding. */ - -PyObject *PyString_DecodeEscape(const char *s, - Py_ssize_t len, - const char *errors, - Py_ssize_t unicode, - const char *recode_encoding) -{ - int c; - char *p, *buf; - const char *end; - PyObject *v; - Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyString_FromStringAndSize((char *)NULL, newlen); - if (v == NULL) - return NULL; - p = buf = PyString_AsString(v); - end = s + len; - while (s < end) { - if (*s != '\\') { - non_esc: -#ifdef Py_USING_UNICODE - if (recode_encoding && (*s & 0x80)) { - PyObject *u, *w; - char *r; - const char* t; - Py_ssize_t rn; - t = s; - /* Decode non-ASCII bytes as UTF-8. */ - while (t < end && (*t & 0x80)) t++; - u = PyUnicode_DecodeUTF8(s, t - s, errors); - if(!u) goto failed; - - /* Recode them in target encoding. */ - w = PyUnicode_AsEncodedString( - u, recode_encoding, errors); - Py_DECREF(u); - if (!w) goto failed; - - /* Append bytes to output buffer. */ - assert(PyString_Check(w)); - r = PyString_AS_STRING(w); - rn = PyString_GET_SIZE(w); - Py_MEMCPY(p, r, rn); - p += rn; - Py_DECREF(w); - s = t; - } else { - *p++ = *s++; - } -#else - *p++ = *s++; -#endif - continue; - } - s++; - if (s==end) { - PyErr_SetString(PyExc_ValueError, - "Trailing \\ in string"); - goto failed; - } - switch (*s++) { - /* XXX This assumes ASCII! */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - c = (c<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - c = (c<<3) + *s++ - '0'; - } - *p++ = c; - break; - case 'x': - if (s+1 < end && - isxdigit(Py_CHARMASK(s[0])) && - isxdigit(Py_CHARMASK(s[1]))) - { - unsigned int x = 0; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x = c - '0'; - else if (islower(c)) - x = 10 + c - 'a'; - else - x = 10 + c - 'A'; - x = x << 4; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x += c - '0'; - else if (islower(c)) - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - *p++ = x; - break; - } - if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); - goto failed; - } - if (strcmp(errors, "replace") == 0) { - *p++ = '?'; - } else if (strcmp(errors, "ignore") == 0) - /* do nothing */; - else { - PyErr_Format(PyExc_ValueError, - "decoding error; " - "unknown error handling code: %.400s", - errors); - goto failed; - } -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif - default: - *p++ = '\\'; - s--; - goto non_esc; /* an arbitry number of unescaped - UTF-8 bytes may follow. */ - } - } - if (p-buf < newlen) - _PyString_Resize(&v, p - buf); - return v; - failed: - Py_DECREF(v); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* object api */ - -static Py_ssize_t -string_getsize(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return -1; - return len; -} - -static /*const*/ char * -string_getbuffer(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return NULL; - return s; -} - -Py_ssize_t -PyString_Size(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getsize(op); - return Py_SIZE(op); -} - -/*const*/ char * -PyString_AsString(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getbuffer(op); - return ((PyStringObject *)op) -> ob_sval; -} - -int -PyString_AsStringAndSize(register PyObject *obj, - register char **s, - register Py_ssize_t *len) -{ - if (s == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (!PyString_Check(obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(obj)) { - obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); - if (obj == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " - "%.200s found", Py_TYPE(obj)->tp_name); - return -1; - } - } - - *s = PyString_AS_STRING(obj); - if (len != NULL) - *len = PyString_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) { - PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); - return -1; - } - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#include "stringlib/stringdefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" - -#define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping -#include "stringlib/localeutil.h" - - - -static int -string_print(PyStringObject *op, FILE *fp, int flags) -{ - Py_ssize_t i, str_len; - char c; - int quote; - - /* XXX Ought to check for interrupts when writing long strings */ - if (! PyString_CheckExact(op)) { - int ret; - /* A str subclass may have its own __str__ method. */ - op = (PyStringObject *) PyObject_Str((PyObject *)op); - if (op == NULL) - return -1; - ret = string_print(op, fp, flags); - Py_DECREF(op); - return ret; - } - if (flags & Py_PRINT_RAW) { - char *data = op->ob_sval; - Py_ssize_t size = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - while (size > INT_MAX) { - /* Very long strings cannot be written atomically. - * But don't write exactly INT_MAX bytes at a time - * to avoid memory aligment issues. - */ - const int chunk_size = INT_MAX & ~0x3FFF; - fwrite(data, 1, chunk_size, fp); - data += chunk_size; - size -= chunk_size; - } -#ifdef __VMS - if (size) fwrite(data, (int)size, 1, fp); -#else - fwrite(data, 1, (int)size, fp); -#endif - Py_END_ALLOW_THREADS - return 0; - } - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - str_len = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - fputc(quote, fp); - for (i = 0; i < str_len; i++) { - /* Since strings are immutable and the caller should have a - reference, accessing the interal buffer should not be an issue - with the GIL released. */ - c = op->ob_sval[i]; - if (c == quote || c == '\\') - fprintf(fp, "\\%c", c); - else if (c == '\t') - fprintf(fp, "\\t"); - else if (c == '\n') - fprintf(fp, "\\n"); - else if (c == '\r') - fprintf(fp, "\\r"); - else if (c < ' ' || c >= 0x7f) - fprintf(fp, "\\x%02x", c & 0xff); - else - fputc(c, fp); - } - fputc(quote, fp); - Py_END_ALLOW_THREADS - return 0; -} - -PyObject * -PyString_Repr(PyObject *obj, int smartquotes) -{ - register PyStringObject* op = (PyStringObject*) obj; - size_t newsize = 2 + 4 * Py_SIZE(op); - PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_SIZE(op)) { - PyErr_SetString(PyExc_OverflowError, - "string is too large to make repr"); - return NULL; - } - v = PyString_FromStringAndSize((char *)NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (smartquotes && - memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - p = PyString_AS_STRING(v); - *p++ = quote; - for (i = 0; i < Py_SIZE(op); i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyString_AS_STRING(v)) >= 5); - c = op->ob_sval[i]; - if (c == quote || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c < ' ' || c >= 0x7f) { - /* For performance, we don't want to call - PyOS_snprintf here (extra layers of - function call). */ - sprintf(p, "\\x%02x", c & 0xff); - p += 4; - } - else - *p++ = c; - } - assert(newsize - (p - PyString_AS_STRING(v)) >= 1); - *p++ = quote; - *p = '\0'; - _PyString_Resize( - &v, (p - PyString_AS_STRING(v))); - return v; - } -} - -static PyObject * -string_repr(PyObject *op) -{ - return PyString_Repr(op, 1); -} - -static PyObject * -string_str(PyObject *s) -{ - assert(PyString_Check(s)); - if (PyString_CheckExact(s)) { - Py_INCREF(s); - return s; - } - else { - /* Subtype -- return genuine string with the same value. */ - PyStringObject *t = (PyStringObject *) s; - return PyString_FromStringAndSize(t->ob_sval, Py_SIZE(t)); - } -} - -static Py_ssize_t -string_length(PyStringObject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -string_concat(register PyStringObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register PyStringObject *op; - if (!PyString_Check(bb)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(bb)) - return PyUnicode_Concat((PyObject *)a, bb); -#endif - if (PyByteArray_Check(bb)) - return PyByteArray_Concat((PyObject *)a, bb); - PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str' and '%.200s' objects", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyStringObject *)bb) - /* Optimize cases with empty left or right operand */ - if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyString_CheckExact(a) && PyString_CheckExact(b)) { - if (Py_SIZE(a) == 0) { - Py_INCREF(bb); - return bb; - } - Py_INCREF(a); - return (PyObject *)a; - } - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - Py_MEMCPY(op->ob_sval + Py_SIZE(a), b->ob_sval, Py_SIZE(b)); - op->ob_sval[size] = '\0'; - return (PyObject *) op; -#undef b -} - -static PyObject * -string_repeat(register PyStringObject *a, register Py_ssize_t n) -{ - register Py_ssize_t i; - register Py_ssize_t j; - register Py_ssize_t size; - register PyStringObject *op; - size_t nbytes; - if (n < 0) - n = 0; - /* watch out for overflows: the size can overflow int, - * and the # of bytes needed can overflow size_t - */ - size = Py_SIZE(a) * n; - if (n && size / n != Py_SIZE(a)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - if (size == Py_SIZE(a) && PyString_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - nbytes = (size_t)size; - if (nbytes + sizeof(PyStringObject) <= nbytes) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - op = (PyStringObject *) - PyObject_MALLOC(sizeof(PyStringObject) + nbytes); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - op->ob_sval[size] = '\0'; - if (Py_SIZE(a) == 1 && n > 0) { - memset(op->ob_sval, a->ob_sval[0] , n); - return (PyObject *) op; - } - i = 0; - if (i < size) { - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - i = Py_SIZE(a); - } - while (i < size) { - j = (i <= size-i) ? i : size-i; - Py_MEMCPY(op->ob_sval+i, op->ob_sval, j); - i += j; - } - return (PyObject *) op; -} - -/* String slice a[i:j] consists of characters a[i] ... a[j-1] */ - -static PyObject * -string_slice(register PyStringObject *a, register Py_ssize_t i, - register Py_ssize_t j) - /* j -- may be negative! */ -{ - if (i < 0) - i = 0; - if (j < 0) - j = 0; /* Avoid signed/unsigned bug in next line */ - if (j > Py_SIZE(a)) - j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) { - /* It's the same as a */ - Py_INCREF(a); - return (PyObject *)a; - } - if (j < i) - j = i; - return PyString_FromStringAndSize(a->ob_sval + i, j-i); -} - -static int -string_contains(PyObject *str_obj, PyObject *sub_obj) -{ - if (!PyString_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(sub_obj)) - return PyUnicode_Contains(str_obj, sub_obj); -#endif - if (!PyString_Check(sub_obj)) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, " - "not %.200s", Py_TYPE(sub_obj)->tp_name); - return -1; - } - } - - return stringlib_contains_obj(str_obj, sub_obj); -} - -static PyObject * -string_item(PyStringObject *a, register Py_ssize_t i) -{ - char pchar; - PyObject *v; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - pchar = a->ob_sval[i]; - v = (PyObject *)characters[pchar & UCHAR_MAX]; - if (v == NULL) - v = PyString_FromStringAndSize(&pchar, 1); - else { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(v); - } - return v; -} - -static PyObject* -string_richcompare(PyStringObject *a, PyStringObject *b, int op) -{ - int c; - Py_ssize_t len_a, len_b; - Py_ssize_t min_len; - PyObject *result; - - /* Make sure both arguments are strings. */ - if (!(PyString_Check(a) && PyString_Check(b))) { - result = Py_NotImplemented; - goto out; - } - if (a == b) { - switch (op) { - case Py_EQ:case Py_LE:case Py_GE: - result = Py_True; - goto out; - case Py_NE:case Py_LT:case Py_GT: - result = Py_False; - goto out; - } - } - if (op == Py_EQ) { - /* Supporting Py_NE here as well does not save - much time, since Py_NE is rarely used. */ - if (Py_SIZE(a) == Py_SIZE(b) - && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0)) { - result = Py_True; - } else { - result = Py_False; - } - goto out; - } - len_a = Py_SIZE(a); len_b = Py_SIZE(b); - min_len = (len_a < len_b) ? len_a : len_b; - if (min_len > 0) { - c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); - if (c==0) - c = memcmp(a->ob_sval, b->ob_sval, min_len); - } else - c = 0; - if (c == 0) - c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: assert(0); break; /* unreachable */ - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - out: - Py_INCREF(result); - return result; -} - -int -_PyString_Eq(PyObject *o1, PyObject *o2) -{ - PyStringObject *a = (PyStringObject*) o1; - PyStringObject *b = (PyStringObject*) o2; - return Py_SIZE(a) == Py_SIZE(b) - && *a->ob_sval == *b->ob_sval - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; -} - -static long -string_hash(PyStringObject *a) -{ - register Py_ssize_t len; - register unsigned char *p; - register long x; - - if (a->ob_shash != -1) - return a->ob_shash; - len = Py_SIZE(a); - p = (unsigned char *) a->ob_sval; - x = *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= Py_SIZE(a); - if (x == -1) - x = -2; - a->ob_shash = x; - return x; -} - -static PyObject* -string_subscript(PyStringObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyString_GET_SIZE(self); - return string_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - char* source_buf; - char* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyString_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyString_FromStringAndSize("", 0); - } - else if (start == 0 && step == 1 && - slicelength == PyString_GET_SIZE(self) && - PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else if (step == 1) { - return PyString_FromStringAndSize( - PyString_AS_STRING(self) + start, - slicelength); - } - else { - source_buf = PyString_AsString((PyObject*)self); - result_buf = (char *)PyMem_Malloc(slicelength); - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyString_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "string indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static Py_ssize_t -string_buffer_getreadbuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = (void *)self->ob_sval; - return Py_SIZE(self); -} - -static Py_ssize_t -string_buffer_getwritebuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "Cannot use string as modifiable buffer"); - return -1; -} - -static Py_ssize_t -string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = self->ob_sval; - return Py_SIZE(self); -} - -static int -string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags) -{ - return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self), - 0, flags); -} - -static PySequenceMethods string_as_sequence = { - (lenfunc)string_length, /*sq_length*/ - (binaryfunc)string_concat, /*sq_concat*/ - (ssizeargfunc)string_repeat, /*sq_repeat*/ - (ssizeargfunc)string_item, /*sq_item*/ - (ssizessizeargfunc)string_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - (objobjproc)string_contains /*sq_contains*/ -}; - -static PyMappingMethods string_as_mapping = { - (lenfunc)string_length, - (binaryfunc)string_subscript, - 0, -}; - -static PyBufferProcs string_as_buffer = { - (readbufferproc)string_buffer_getreadbuf, - (writebufferproc)string_buffer_getwritebuf, - (segcountproc)string_buffer_getsegcount, - (charbufferproc)string_buffer_getcharbuf, - (getbufferproc)string_buffer_getbuffer, - 0, /* XXX */ -}; - - - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - - -/* Don't call if length < 2 */ -#define Py_STRING_MATCH(target, offset, pattern, length) \ - (target[offset] == pattern[0] && \ - target[offset+length-1] == pattern[length-1] && \ - !memcmp(target+offset+1, pattern+1, length-2) ) - - -/* Overallocate the initial list to reduce the number of reallocs for small - split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three - resizes, to sizes 4, 8, then 16. Most observed string splits are for human - text (roughly 11 words per line) and field delimited data (usually 1-10 - fields). For large strings the split algorithms are bandwidth limited - so increasing the preallocation likely will not improve things.*/ - -#define MAX_PREALLOC 12 - -/* 5 splits gives 6 elements */ -#define PREALLOC_SIZE(maxsplit) \ - (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) - -#define SPLIT_APPEND(data, left, right) \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); - -#define SPLIT_ADD(data, left, right) { \ - str = PyString_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (count < MAX_PREALLOC) { \ - PyList_SET_ITEM(list, count, str); \ - } else { \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); \ - } \ - count++; } - -/* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SIZE(list) = count - -#define SKIP_SPACE(s, i, len) { while (i=0 && isspace(Py_CHARMASK(s[i]))) i--; } -#define RSKIP_NONSPACE(s, i) { while (i>=0 && !isspace(Py_CHARMASK(s[i]))) i--; } - -Py_LOCAL_INLINE(PyObject *) -split_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = 0; - - while (maxsplit-- > 0) { - SKIP_SPACE(s, i, len); - if (i==len) break; - j = i; i++; - SKIP_NONSPACE(s, i, len); - if (j == 0 && i == len && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, j, i); - } - - if (i < len) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to end of string */ - SKIP_SPACE(s, i, len); - if (i != len) - SPLIT_ADD(s, i, len); - } - FIX_PREALLOC_SIZE(list); - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -split_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = 0; - while ((j < len) && (maxcount-- > 0)) { - for(; j list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are removed\n\ -from the result."); - -static PyObject * -string_split(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s = PyString_AS_STRING(self), *sub; - PyObject *list, *str, *subobj = Py_None; -#ifdef USE_FAST - Py_ssize_t pos; -#endif - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return split_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return split_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - -#ifdef USE_FAST - i = j = 0; - while (maxsplit-- > 0) { - pos = fastsearch(s+i, len-i, sub, n, FAST_SEARCH); - if (pos < 0) - break; - j = i+pos; - SPLIT_ADD(s, i, j); - i = j + n; - } -#else - i = j = 0; - while ((j+n <= len) && (maxsplit-- > 0)) { - for (; j+n <= len; j++) { - if (Py_STRING_MATCH(s, j, sub, n)) { - SPLIT_ADD(s, i, j); - i = j = j + n; - break; - } - } - } -#endif - SPLIT_ADD(s, i, len); - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in S, and returns the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, returns S and two empty strings."); - -static PyObject * -string_partition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_partition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (tail, sep, head)\n\ -\n\ -Searches for the separator sep in S, starting at the end of S, and returns\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, returns two empty strings and S."); - -static PyObject * -string_rpartition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_rpartition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_whitespace(PyStringObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyString_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = len-1; - - while (maxsplit-- > 0) { - RSKIP_SPACE(s, i); - if (i<0) break; - j = i; i--; - RSKIP_NONSPACE(s, i); - if (j == len-1 && i < 0 && PyString_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, i + 1, j + 1); - } - if (i >= 0) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to beginning of string */ - RSKIP_SPACE(s, i); - if (i >= 0) - SPLIT_ADD(s, 0, i + 1); - - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_char(PyStringObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyString_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = len - 1; - while ((i >= 0) && (maxcount-- > 0)) { - for (; i >= 0; i--) { - if (s[i] == ch) { - SPLIT_ADD(s, i + 1, j + 1); - j = i = i - 1; - break; - } - } - } - if (i < 0 && count == 0 && PyString_CheckExact(self)) { - /* ch not in self, so just use self as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - } - else if (j >= -1) { - SPLIT_ADD(s, 0, j + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string, starting at the end of the string and working\n\ -to the front. If maxsplit is given, at most maxsplit splits are\n\ -done. If sep is not specified or is None, any whitespace string\n\ -is a separator."); - -static PyObject * -string_rsplit(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s, *sub; - PyObject *list, *str, *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return rsplit_whitespace(self, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return rsplit_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - - j = len; - i = j - n; - - s = PyString_AS_STRING(self); - while ( (i >= 0) && (maxsplit-- > 0) ) { - for (; i>=0; i--) { - if (Py_STRING_MATCH(s, i, sub, n)) { - SPLIT_ADD(s, i + n, j); - j = i; - i -= n; - break; - } - } - } - SPLIT_ADD(s, 0, j); - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - -onError: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(join__doc__, -"S.join(sequence) -> string\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."); - -static PyObject * -string_join(PyStringObject *self, PyObject *orig) -{ - char *sep = PyString_AS_STRING(self); - const Py_ssize_t seplen = PyString_GET_SIZE(self); - PyObject *res = NULL; - char *p; - Py_ssize_t seqlen = 0; - size_t sz = 0; - Py_ssize_t i; - PyObject *seq, *item; - - seq = PySequence_Fast(orig, ""); - if (seq == NULL) { - return NULL; - } - - seqlen = PySequence_Size(seq); - if (seqlen == 0) { - Py_DECREF(seq); - return PyString_FromString(""); - } - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyString_CheckExact(item) || PyUnicode_CheckExact(item)) { - Py_INCREF(item); - Py_DECREF(seq); - return item; - } - } - - /* There are at least two things to join, or else we have a subclass - * of the builtin types in the sequence. - * Do a pre-pass to figure out the total amount of space we'll - * need (sz), see whether any argument is absurd, and defer to - * the Unicode join if appropriate. - */ - for (i = 0; i < seqlen; i++) { - const size_t old_sz = sz; - item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyString_Check(item)){ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(item)) { - /* Defer to Unicode join. - * CAUTION: There's no gurantee that the - * original sequence can be iterated over - * again, so we must pass seq here. - */ - PyObject *result; - result = PyUnicode_Join((PyObject *)self, seq); - Py_DECREF(seq); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string," - " %.80s found", - i, Py_TYPE(item)->tp_name); - Py_DECREF(seq); - return NULL; - } - sz += PyString_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"); - Py_DECREF(seq); - return NULL; - } - } - - /* Allocate result space. */ - res = PyString_FromStringAndSize((char*)NULL, sz); - if (res == NULL) { - Py_DECREF(seq); - return NULL; - } - - /* Catenate everything. */ - p = PyString_AS_STRING(res); - for (i = 0; i < seqlen; ++i) { - size_t n; - item = PySequence_Fast_GET_ITEM(seq, i); - n = PyString_GET_SIZE(item); - Py_MEMCPY(p, PyString_AS_STRING(item), n); - p += n; - if (i < seqlen - 1) { - Py_MEMCPY(p, sep, seplen); - p += seplen; - } - } - - Py_DECREF(seq); - return res; -} - -PyObject * -_PyString_Join(PyObject *sep, PyObject *x) -{ - assert(sep != NULL && PyString_Check(sep)); - assert(x != NULL); - return string_join((PyStringObject *)sep, x); -} - -Py_LOCAL_INLINE(void) -string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len) -{ - if (*end > len) - *end = len; - else if (*end < 0) - *end += len; - if (*end < 0) - *end = 0; - if (*start < 0) - *start += len; - if (*start < 0) - *start = 0; -} - -Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyStringObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - const char *sub; - Py_ssize_t sub_len; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - PyObject *obj_start=Py_None, *obj_end=Py_None; - - if (!PyArg_ParseTuple(args, "O|OO:find/rfind/index/rindex", &subobj, - &obj_start, &obj_end)) - return -2; - /* To support None in "start" and "end" arguments, meaning - the same as if they were not passed. - */ - if (obj_start != Py_None) - if (!_PyEval_SliceIndex(obj_start, &start)) - return -2; - if (obj_end != Py_None) - if (!_PyEval_SliceIndex(obj_end, &end)) - return -2; - - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - sub_len = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Find( - (PyObject *)self, subobj, start, end, dir); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) - /* XXX - the "expected a character buffer object" is pretty - confusing for a non-expert. remap to something else ? */ - return -2; - - if (dir > 0) - return stringlib_find_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); - else - return stringlib_rfind_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); -} - - -PyDoc_STRVAR(find__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_find(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(index__doc__, -"S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -string_index(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_rfind(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -string_rindex(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self); - char *sep = PyString_AS_STRING(sepobj); - Py_ssize_t seplen = PyString_GET_SIZE(sepobj); - Py_ssize_t i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_strip(PyStringObject *self, int striptype) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyStringObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyString_Check(sep)) - return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep)) { - PyObject *uniself = PyUnicode_FromObject((PyObject *)self); - PyObject *res; - if (uniself==NULL) - return NULL; - res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, - striptype, sep); - Py_DECREF(uniself); - return res; - } -#endif - PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else - "%s arg must be None or str", -#endif - STRIPNAME(striptype)); - return NULL; - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_strip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_lstrip(PyStringObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_rstrip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -PyDoc_STRVAR(lower__doc__, -"S.lower() -> string\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */ -#ifndef _tolower -#define _tolower tolower -#endif - -static PyObject * -string_lower(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (isupper(c)) - s[i] = _tolower(c); - } - - return newobj; -} - -PyDoc_STRVAR(upper__doc__, -"S.upper() -> string\n\ -\n\ -Return a copy of the string S converted to uppercase."); - -#ifndef _toupper -#define _toupper toupper -#endif - -static PyObject * -string_upper(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (islower(c)) - s[i] = _toupper(c); - } - - return newobj; -} - -PyDoc_STRVAR(title__doc__, -"S.title() -> string\n\ -\n\ -Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -static PyObject* -string_title(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - int previous_is_cased = 0; - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - if (!previous_is_cased) - c = toupper(c); - previous_is_cased = 1; - } else if (isupper(c)) { - if (previous_is_cased) - c = tolower(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *s_new++ = c; - } - return newobj; -} - -PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> string\n\ -\n\ -Return a copy of the string S with only its first character\n\ -capitalized."); - -static PyObject * -string_capitalize(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) - *s_new = toupper(c); - else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) - *s_new = tolower(c); - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(count__doc__, -"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 interpreted\n\ -as in slice notation."); - -static PyObject * -string_count(PyStringObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyString_AS_STRING(self), *sub; - Py_ssize_t sub_len; - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - - if (!PyArg_ParseTuple(args, "O|O&O&:count", &sub_obj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; - - if (PyString_Check(sub_obj)) { - sub = PyString_AS_STRING(sub_obj); - sub_len = PyString_GET_SIZE(sub_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sub_obj)) { - Py_ssize_t count; - count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); - if (count == -1) - return NULL; - else - return PyInt_FromSsize_t(count); - } -#endif - else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) - return NULL; - - string_adjust_indices(&start, &end, PyString_GET_SIZE(self)); - - return PyInt_FromSsize_t( - stringlib_count(str + start, end - start, sub, sub_len) - ); -} - -PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> string\n\ -\n\ -Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."); - -static PyObject * -string_swapcase(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - *s_new = toupper(c); - } - else if (isupper(c)) { - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(translate__doc__, -"S.translate(table [,deletechars]) -> string\n\ -\n\ -Return a copy of the string S, where all characters occurring\n\ -in the optional argument deletechars are removed, and the\n\ -remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256."); - -static PyObject * -string_translate(PyStringObject *self, PyObject *args) -{ - register char *input, *output; - const char *table; - register Py_ssize_t i, c, changed = 0; - PyObject *input_obj = (PyObject*)self; - const char *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - PyObject *tableobj, *delobj = NULL; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (PyString_Check(tableobj)) { - table = PyString_AS_STRING(tableobj); - tablen = PyString_GET_SIZE(tableobj); - } - else if (tableobj == Py_None) { - table = NULL; - tablen = 256; - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(tableobj)) { - /* Unicode .translate() does not support the deletechars - parameter; instead a mapping to None will cause characters - to be deleted. */ - if (delobj != NULL) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } - return PyUnicode_Translate((PyObject *)self, tableobj, NULL); - } -#endif - else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) - return NULL; - - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - if (delobj != NULL) { - if (PyString_Check(delobj)) { - del_table = PyString_AS_STRING(delobj); - dellen = PyString_GET_SIZE(delobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(delobj)) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } -#endif - else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) - return NULL; - } - else { - del_table = NULL; - dellen = 0; - } - - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AS_STRING(input_obj); - - if (dellen == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed || !PyString_CheckExact(input_obj)) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed && PyString_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - _PyString_Resize(&result, output - output_start); - return result; -} - - -#define FORWARD 1 -#define REVERSE -1 - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - -/* String ops must return a string. */ -/* If the object is subclass of string, create a copy */ -Py_LOCAL(PyStringObject *) -return_self(PyStringObject *self) -{ - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return self; - } - return (PyStringObject *)PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, int target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - -Py_LOCAL(Py_ssize_t) -findstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings always match at the first attempt */ - if (pattern_len == 0) - return (direction > 0) ? start : end; - - end -= pattern_len; - - if (direction < 0) { - for (; end >= start; end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) - return end; - } else { - for (; start <= end; start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) - return start; - } - return -1; -} - -Py_LOCAL_INLINE(Py_ssize_t) -countstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings match everywhere */ - if (pattern_len == 0 || maxcount == 0) { - if (target_len+1 < maxcount) - return target_len+1; - return maxcount; - } - - end -= pattern_len; - if (direction < 0) { - for (; (end >= start); end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) break; - end -= pattern_len-1; - } - } else { - for (; (start <= end); start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) - break; - start += pattern_len-1; - } - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_interleave(PyStringObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyString_AS_STRING(self); - result_s = PyString_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_delete_single_character(PyStringObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyStringObject *) -replace_delete_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, 1, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character_in_place(PyStringObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyStringObject *result; - - /* The result string will be the same size */ - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring_in_place(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyStringObject *result; - - /* The result string will be the same size */ - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - offset = findstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD); - if (offset == -1) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character(PyStringObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyStringObject *) -replace(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyString_GET_SIZE(self) == 0) { - /* nothing to do; return the original string */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original string */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' string everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self string to generate a non-empty string */ - /* Special case so the remaining code always gets a non-empty string */ - if (PyString_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' string */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both strings have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - -PyDoc_STRVAR(replace__doc__, -"S.replace (old, new[, count]) -> string\n\ -\n\ -Return a copy of string S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -string_replace(PyStringObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to; - const char *from_s, *to_s; - Py_ssize_t from_len, to_len; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (PyString_Check(from)) { - from_s = PyString_AS_STRING(from); - from_len = PyString_GET_SIZE(from); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(from)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) - return NULL; - - if (PyString_Check(to)) { - to_s = PyString_AS_STRING(to); - to_len = PyString_GET_SIZE(to); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(to)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) - return NULL; - - return (PyObject *)replace((PyStringObject *) self, - from_s, from_len, - to_s, to_len, count); -} - -/** End DALKE **/ - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyString_GET_SIZE(self); - Py_ssize_t slen; - const char* sub; - const char* str; - - if (PyString_Check(substr)) { - sub = PyString_AS_STRING(substr); - slen = PyString_GET_SIZE(substr); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(substr)) - return PyUnicode_Tailmatch((PyObject *)self, - substr, start, end, direction); -#endif - else if (PyObject_AsCharBuffer(substr, &sub, &slen)) - return -1; - str = PyString_AS_STRING(self); - - string_adjust_indices(&start, &end, len); - - if (direction < 0) { - /* startswith */ - if (start+slen > len) - return 0; - } else { - /* endswith */ - if (end-start < slen || start > len) - return 0; - - if (end-slen > start) - start = end - slen; - } - if (end-start >= slen) - return ! memcmp(str+start, sub, slen); - return 0; -} - - -PyDoc_STRVAR(startswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -string_startswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, -1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -string_endswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, +1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[,errors]]) -> object\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeEncodeErrors."); - -static PyObject * -string_encode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) - return NULL; - v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(decode__doc__, -"S.decode([encoding[,errors]]) -> object\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registerd with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -string_decode(PyStringObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) - return NULL; - v = PyString_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> string\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."); - -static PyObject* -string_expandtabs(PyStringObject *self, PyObject *args) -{ - const char *e, *p, *qe; - char *q; - Py_ssize_t i, j, incr; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */ - for (p = PyString_AS_STRING(self); p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = PyString_FromStringAndSize(NULL, i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = PyString_AS_STRING(u); /* next output char */ - qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */ - - for (p = PyString_AS_STRING(self); 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; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - - return u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - - u = PyString_FromStringAndSize(NULL, - left + PyString_GET_SIZE(self) + right); - if (u) { - if (left) - memset(PyString_AS_STRING(u), fill, left); - Py_MEMCPY(PyString_AS_STRING(u) + left, - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); - if (right) - memset(PyString_AS_STRING(u) + left + PyString_GET_SIZE(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> string\n" -"\n" -"Return S left justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -string_ljust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, 0, width - PyString_GET_SIZE(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> string\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)"); - -static PyObject * -string_rjust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, width - PyString_GET_SIZE(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> string\n" -"\n" -"Return S centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_center(PyStringObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - PyString_GET_SIZE(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> string\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."); - -static PyObject * -string_zfill(PyStringObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (PyString_GET_SIZE(self) >= width) { - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self) - ); - } - - fill = width - PyString_GET_SIZE(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = PyString_AS_STRING(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} - -PyDoc_STRVAR(isspace__doc__, -"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."); - -static PyObject* -string_isspace(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isspace(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isspace(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalpha__doc__, -"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."); - -static PyObject* -string_isalpha(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalpha(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalpha(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalnum__doc__, -"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."); - -static PyObject* -string_isalnum(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalnum(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalnum(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isdigit__doc__, -"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."); - -static PyObject* -string_isdigit(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isdigit(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isdigit(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(islower__doc__, -"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."); - -static PyObject* -string_islower(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(islower(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (isupper(*p)) - return PyBool_FromLong(0); - else if (!cased && islower(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(isupper__doc__, -"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."); - -static PyObject* -string_isupper(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (islower(*p)) - return PyBool_FromLong(0); - else if (!cased && isupper(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(istitle__doc__, -"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. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -static PyObject* -string_istitle(PyStringObject *self, PyObject *uncased) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (isupper(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (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(splitlines__doc__, -"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\ -is given and true."); - -static PyObject* -string_splitlines(PyStringObject *self, PyObject *args) -{ - register Py_ssize_t i; - register Py_ssize_t j; - Py_ssize_t len; - int keepends = 0; - PyObject *list; - PyObject *str; - char *data; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - data = PyString_AS_STRING(self); - len = PyString_GET_SIZE(self); - - /* This does not use the preallocated list because splitlines is - usually run with hundreds of newlines. The overhead of - switching between PyList_SET_ITEM and append causes about a - 2-3% slowdown for that common case. A smarter implementation - could move the if check out, so the SET_ITEMs are done first - and the appends only done when the prealloc buffer is full. - That's too much work for little gain.*/ - - list = PyList_New(0); - if (!list) - goto onError; - - for (i = j = 0; i < len; ) { - Py_ssize_t eol; - - /* Find a line and append it */ - while (i < len && data[i] != '\n' && data[i] != '\r') - 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); - } - - return list; - - onError: - Py_XDECREF(list); - return NULL; -} - -PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in memory, in bytes"); - -static PyObject * -string_sizeof(PyStringObject *v) -{ - Py_ssize_t res; - res = sizeof(PyStringObject) + v->ob_size * v->ob_type->tp_itemsize; - return PyInt_FromSsize_t(res); -} - -#undef SPLIT_APPEND -#undef SPLIT_ADD -#undef MAX_PREALLOC -#undef PREALLOC_SIZE - -static PyObject * -string_getnewargs(PyStringObject *v) -{ - return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); -} - - -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> unicode\n\ -\n\ -"); - -static PyObject * -string__format__(PyObject* self, PyObject* args) -{ - PyObject *format_spec; - PyObject *result = NULL; - PyObject *tmp = NULL; - - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyString_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = PyObject_Str(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; - - result = _PyBytes_FormatAdvanced(self, - PyString_AS_STRING(format_spec), - PyString_GET_SIZE(format_spec)); -done: - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> unicode\n\ -\n\ -"); - - -static PyMethodDef -string_methods[] = { - /* Counterparts of the obsolete stropmodule functions; except - string.maketrans(). */ - {"join", (PyCFunction)string_join, METH_O, join__doc__}, - {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, - {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, - {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, - {"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__}, - {"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__}, - {"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__}, - {"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__}, - {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, - {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, - capitalize__doc__}, - {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, - {"endswith", (PyCFunction)string_endswith, METH_VARARGS, - endswith__doc__}, - {"partition", (PyCFunction)string_partition, METH_O, partition__doc__}, - {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, - {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, - {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, - {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, - {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, - {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction)string_rpartition, METH_O, - rpartition__doc__}, - {"startswith", (PyCFunction)string_startswith, METH_VARARGS, - startswith__doc__}, - {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, - swapcase__doc__}, - {"translate", (PyCFunction)string_translate, METH_VARARGS, - translate__doc__}, - {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, - {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, - {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, - {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, - {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) string__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, - {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, - {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, - splitlines__doc__}, - {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, - sizeof__doc__}, - {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"object", 0}; - - if (type != &PyString_Type) - return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) - return NULL; - if (x == NULL) - return PyString_FromString(""); - return PyObject_Str(x); -} - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyString_Type)); - tmp = string_new(&PyString_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyString_CheckExact(tmp)); - n = PyString_GET_SIZE(tmp); - pnew = type->tp_alloc(type, n); - if (pnew != NULL) { - Py_MEMCPY(PyString_AS_STRING(pnew), PyString_AS_STRING(tmp), n+1); - ((PyStringObject *)pnew)->ob_shash = - ((PyStringObject *)tmp)->ob_shash; - ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; - } - Py_DECREF(tmp); - return pnew; -} - -static PyObject * -basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, - "The basestring type cannot be instantiated"); - return NULL; -} - -static PyObject * -string_mod(PyObject *v, PyObject *w) -{ - if (!PyString_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyString_Format(v, w); -} - -PyDoc_STRVAR(basestring_doc, -"Type basestring cannot be instantiated; it is the base for str and unicode."); - -static PyNumberMethods string_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - string_mod, /*nb_remainder*/ -}; - - -PyTypeObject PyBaseString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "basestring", - 0, - 0, - 0, /* 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 | Py_TPFLAGS_BASETYPE, /* tp_flags */ - basestring_doc, /* 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 */ - 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 */ - basestring_new, /* tp_new */ - 0, /* tp_free */ -}; - -PyDoc_STRVAR(string_doc, -"str(object) -> string\n\ -\n\ -Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."); - -PyTypeObject PyString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", - sizeof(PyStringObject), - sizeof(char), - string_dealloc, /* tp_dealloc */ - (printfunc)string_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - string_repr, /* tp_repr */ - &string_as_number, /* tp_as_number */ - &string_as_sequence, /* tp_as_sequence */ - &string_as_mapping, /* tp_as_mapping */ - (hashfunc)string_hash, /* tp_hash */ - 0, /* tp_call */ - string_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - string_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)string_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - string_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - string_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -void -PyString_Concat(register PyObject **pv, register PyObject *w) -{ - register PyObject *v; - if (*pv == NULL) - return; - if (w == NULL || !PyString_Check(*pv)) { - Py_DECREF(*pv); - *pv = NULL; - return; - } - v = string_concat((PyStringObject *) *pv, w); - Py_DECREF(*pv); - *pv = v; -} - -void -PyString_ConcatAndDel(register PyObject **pv, register PyObject *w) -{ - PyString_Concat(pv, w); - Py_XDECREF(w); -} - - -/* The following function breaks the notion that strings are immutable: - it changes the size of a string. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new string object and destroying the old one, only - more efficiently. In any case, don't use this if the string may - already be known to some other part of the code... - Note that if there's not enough memory to resize the string, the original - string object at *pv is deallocated, *pv is set to NULL, an "out of - memory" exception is set, and -1 is returned. Else (on success) 0 is - returned, and the value in *pv may or may not be the same as on input. - As always, an extra byte is allocated for a trailing \0 byte (newsize - does *not* include that), and a trailing \0 byte is stored. -*/ - -int -_PyString_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyObject *v; - register PyStringObject *sv; - v = *pv; - if (!PyString_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyString_CHECK_INTERNED(v)) { - *pv = 0; - Py_DECREF(v); - PyErr_BadInternalCall(); - return -1; - } - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference(v); - *pv = (PyObject *) - PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize); - if (*pv == NULL) { - PyObject_Del(v); - PyErr_NoMemory(); - return -1; - } - _Py_NewReference(*pv); - sv = (PyStringObject *) *pv; - Py_SIZE(sv) = newsize; - sv->ob_sval[newsize] = '\0'; - sv->ob_shash = -1; /* invalidate cached hash value */ - return 0; -} - -/* Helpers for formatstring */ - -Py_LOCAL_INLINE(PyObject *) -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -Py_LOCAL_INLINE(int) -formatfloat(char *buf, 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)*/ - char fmt[20]; - double x; - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "float argument required, " - "not %.200s", Py_TYPE(v)->tp_name); - return -1; - } - if (prec < 0) - prec = 6; - if (type == 'f' && fabs(x)/1e25 >= 1e25) - 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 - - 'f' formats: - 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; - } - PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); - PyOS_ascii_formatd(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -/* _PyString_FormatLong emulates the format codes d, u, o, x and X, and - * the F_ALT flag, for Python's long (unbounded) ints. It's not used for - * Python's regular ints. - * Return value: a new PyString*, or NULL if error. - * . *pbuf is set to point into it, - * *plen set to the # of chars following that. - * Caller must decref it when done using pbuf. - * The string starting at *pbuf is of the form - * "-"? ("0x" | "0X")? digit+ - * "0x"/"0X" are present only for x and X conversions, with F_ALT - * set in flags. The case of hex digits will be correct, - * There will be at least prec digits, zero-filled on the left if - * necessary to get that many. - * val object to be converted - * flags bitmask of format flags; only F_ALT is looked at - * prec minimum number of digits; 0-fill on left if needed - * type a character in [duoxX]; u acts the same as d - * - * CAUTION: o, x and X conversions on regular ints can never - * produce a '-' sign, but can for Python's unbounded ints. - */ -PyObject* -_PyString_FormatLong(PyObject *val, int flags, int prec, int type, - char **pbuf, int *plen) -{ - PyObject *result = NULL; - char *buf; - Py_ssize_t i; - int sign; /* 1 if '-', else 0 */ - int len; /* number of characters */ - Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; - - switch (type) { - case 'd': - case 'u': - result = Py_TYPE(val)->tp_str(val); - break; - case 'o': - result = Py_TYPE(val)->tp_as_number->nb_oct(val); - break; - case 'x': - case 'X': - numnondigits = 2; - result = Py_TYPE(val)->tp_as_number->nb_hex(val); - break; - default: - assert(!"'type' not in [duoxX]"); - } - if (!result) - return NULL; - - buf = PyString_AsString(result); - if (!buf) { - Py_DECREF(result); - return NULL; - } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyString_Size(result); - if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); - return NULL; - } - len = (int)llen; - if (buf[len-1] == 'L') { - --len; - buf[len] = '\0'; - } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); - skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); - } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyString_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); - return NULL; - } - b1 = PyString_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; - for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyString_AS_STRING(result); - len = numnondigits + prec; - } - - /* Fix up case for hex conversions. */ - if (type == 'X') { - /* Need to convert all lower case letters to upper case. - and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') - buf[i] -= 'a'-'A'; - } - *pbuf = buf; - *plen = len; - return result; -} - -Py_LOCAL_INLINE(int) -formatint(char *buf, 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) - + 1 + 1 = 24 */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", - Py_TYPE(v)->tp_name); - return -1; - } - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - 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 - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in unicodeobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - if (sign[0]) - PyOS_snprintf(buf, buflen, fmt, -x); - else - PyOS_snprintf(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -Py_LOCAL_INLINE(int) -formatchar(char *buf, size_t buflen, PyObject *v) -{ - /* presume that the buffer is at least 2 characters long */ - if (PyString_Check(v)) { - if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) - return -1; - } - else { - if (!PyArg_Parse(v, "b;%c requires int or char", &buf[0])) - return -1; - } - buf[1] = '\0'; - return 1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the floats, ints, & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject * -PyString_Format(PyObject *format, PyObject *args) -{ - char *fmt, *res; - Py_ssize_t arglen, argidx; - Py_ssize_t reslen, rescnt, fmtcnt; - int args_owned = 0; - PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE - PyObject *v, *w; -#endif - PyObject *dict = NULL; - if (format == NULL || !PyString_Check(format) || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - orig_args = args; - fmt = PyString_AS_STRING(format); - fmtcnt = PyString_GET_SIZE(format); - reslen = rescnt = fmtcnt + 100; - result = PyString_FromStringAndSize((char *)NULL, reslen); - if (result == NULL) - return NULL; - res = PyString_AsString(result); - if (PyTuple_Check(args)) { - arglen = PyTuple_GET_SIZE(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyString_Resize(&result, reslen) < 0) - return NULL; - res = PyString_AS_STRING(result) - + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - int c = '\0'; - int fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; - int sign; - Py_ssize_t len; - char formatbuf[FORMATBUFLEN]; - /* For format{float,int,char}() */ -#ifdef Py_USING_UNICODE - char *fmt_start = fmt; - Py_ssize_t argidx_start = argidx; -#endif - - fmt++; - if (*fmt == '(') { - char *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto error; - } - ++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 error; - } - key = PyString_FromStringAndSize(keystart, - keylen); - if (key == NULL) - goto error; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto error; - } - width = PyInt_AsLong(v); - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - width = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((width*10) / 10 != width) { - PyErr_SetString( - PyExc_ValueError, - "width too big"); - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString( - PyExc_TypeError, - "* wants int"); - goto error; - } - prec = PyInt_AsLong(v); - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((prec*10) / 10 != prec) { - PyErr_SetString( - PyExc_ValueError, - "prec too big"); - goto error; - } - 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 error; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - } - sign = 0; - fill = ' '; - switch (c) { - case '%': - pbuf = "%"; - len = 1; - break; - case 's': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE - if (temp != NULL && PyUnicode_Check(temp)) { - Py_DECREF(temp); - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - /* Fall through */ - case 'r': - if (c == 'r') - temp = PyObject_Repr(v); - if (temp == NULL) - goto error; - if (!PyString_Check(temp)) { - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - Py_DECREF(temp); - goto error; - } - pbuf = PyString_AS_STRING(temp); - len = PyString_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 (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, - sizeof(formatbuf), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto error; - sign = 1; - } - else if (PyLong_Check(iobj)) { - int ilen; - - isnumok = 1; - temp = _PyString_FormatLong(iobj, flags, - prec, c, &pbuf, &ilen); - Py_DECREF(iobj); - len = ilen; - if (!temp) - goto error; - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", c, Py_TYPE(v)->tp_name); - goto error; - } - 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), - flags, prec, c, v); - if (len < 0) - goto error; - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - case 'c': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf), v); - if (len < 0) - goto error; - break; - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - c, c, - (Py_ssize_t)(fmt - 1 - - PyString_AsString(format))); - goto error; - } - 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_DECREF(result); - Py_XDECREF(temp); - return PyErr_NoMemory(); - } - if (_PyString_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - return NULL; - } - res = PyString_AS_STRING(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - 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')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_MEMCPY(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 error; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto error; - } - if (args_owned) { - Py_DECREF(args); - } - _PyString_Resize(&result, reslen - rescnt); - return result; - -#ifdef Py_USING_UNICODE - unicode: - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - /* Fiddle args right (remove the first argidx arguments) */ - if (PyTuple_Check(orig_args) && argidx > 0) { - PyObject *v; - Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx; - v = PyTuple_New(n); - if (v == NULL) - goto error; - while (--n >= 0) { - PyObject *w = PyTuple_GET_ITEM(orig_args, n + argidx); - Py_INCREF(w); - PyTuple_SET_ITEM(v, n, w); - } - args = v; - } else { - Py_INCREF(orig_args); - args = orig_args; - } - args_owned = 1; - /* Take what we have of the result and let the Unicode formatting - function format the rest of the input. */ - rescnt = res - PyString_AS_STRING(result); - if (_PyString_Resize(&result, rescnt)) - goto error; - fmtcnt = PyString_GET_SIZE(format) - \ - (fmt - PyString_AS_STRING(format)); - format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); - if (format == NULL) - goto error; - v = PyUnicode_Format(format, args); - Py_DECREF(format); - if (v == NULL) - goto error; - /* Paste what we have (result) to what the Unicode formatting - function returned (v) and return the result (or error) */ - w = PyUnicode_Concat(result, v); - Py_DECREF(result); - Py_DECREF(v); - Py_DECREF(args); - return w; -#endif /* Py_USING_UNICODE */ - - error: - Py_DECREF(result); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -void -PyString_InternInPlace(PyObject **p) -{ - register PyStringObject *s = (PyStringObject *)(*p); - PyObject *t; - if (s == NULL || !PyString_Check(s)) - Py_FatalError("PyString_InternInPlace: strings only please!"); - /* If it's a string subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyString_CheckExact(s)) - return; - if (PyString_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - t = PyDict_GetItem(interned, (PyObject *)s); - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - return; - } - /* The two references in interned are not counted by refcnt. - The string deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; -} - -void -PyString_InternImmortal(PyObject **p) -{ - PyString_InternInPlace(p); - if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } -} - - -PyObject * -PyString_InternFromString(const char *cp) -{ - PyObject *s = PyString_FromString(cp); - if (s == NULL) - return NULL; - PyString_InternInPlace(&s); - return s; -} - -void -PyString_Fini(void) -{ - int i; - for (i = 0; i < UCHAR_MAX + 1; i++) { - Py_XDECREF(characters[i]); - characters[i] = NULL; - } - Py_XDECREF(nullstring); - nullstring = NULL; -} - -void _Py_ReleaseInternedStrings(void) -{ - PyObject *keys; - PyStringObject *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_ReleaseInternedStrings() is intended to help a leak - detector, interned 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 = (PyStringObject *) PyList_GET_ITEM(keys, i); - switch (s->ob_sstate) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += Py_SIZE(s); - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += Py_SIZE(s); - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->ob_sstate = 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; -} Modified: python/trunk/PC/VC6/pythoncore.dsp ============================================================================== --- python/trunk/PC/VC6/pythoncore.dsp (original) +++ python/trunk/PC/VC6/pythoncore.dsp Tue Jun 10 23:23:22 2008 @@ -241,7 +241,7 @@ # End Source File # Begin Source File -SOURCE=..\..\Objects\bytesobject.c +SOURCE=..\..\Objects\stringobject.c # End Source File # Begin Source File Modified: python/trunk/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/trunk/PC/VS7.1/pythoncore.vcproj (original) +++ python/trunk/PC/VS7.1/pythoncore.vcproj Tue Jun 10 23:23:22 2008 @@ -446,7 +446,7 @@ RelativePath="..\..\Objects\bytearrayobject.c"> + RelativePath="..\..\Objects\stringobject.c"> Modified: python/trunk/PC/VS8.0/pythoncore.vcproj ============================================================================== --- python/trunk/PC/VS8.0/pythoncore.vcproj (original) +++ python/trunk/PC/VS8.0/pythoncore.vcproj Tue Jun 10 23:23:22 2008 @@ -1379,7 +1379,7 @@ > Author: amaury.forgeotdarc Date: Tue Jun 10 23:37:15 2008 New Revision: 64095 Log: Correct test_pydoc for win32 platforms, to account for normalized URLs: C:\temp => file:///C|temp/ Modified: python/trunk/Lib/test/test_pydoc.py Modified: python/trunk/Lib/test/test_pydoc.py ============================================================================== --- python/trunk/Lib/test/test_pydoc.py (original) +++ python/trunk/Lib/test/test_pydoc.py Tue Jun 10 23:37:15 2008 @@ -214,7 +214,12 @@ def test_html_doc(self): result, doc_loc = get_pydoc_html(pydoc_mod) mod_file = inspect.getabsfile(pydoc_mod) - expected_html = expected_html_pattern % (mod_file, mod_file, doc_loc) + if sys.platform == 'win32': + import nturl2path + mod_url = nturl2path.pathname2url(mod_file) + else: + mod_url = mod_file + expected_html = expected_html_pattern % (mod_url, mod_file, doc_loc) if result != expected_html: print_diffs(expected_html, result) self.fail("outputs are not equal, see diff above") From nnorwitz at gmail.com Tue Jun 10 23:36:39 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 10 Jun 2008 17:36:39 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20080610213639.GA10200@python.psfb.org> 331 tests OK. 1 test failed: test_ssl 24 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-26856 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12411 refs] [12411 refs] [20638 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12416 refs] [12416 refs] [12416 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17294 refs] test_pyexpat test_queue test_quopri [14930 refs] [14930 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12411 refs] [12411 refs] [12414 refs] [12411 refs] test_slice test_smtplib test_socket test_socket_ssl test_socketserver test_softspace test_sort test_sqlite test_ssl test test_ssl failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_ssl.py", line 147, in testFetchServerCert pem = ssl.get_server_certificate(("svn.python.org", 443), ca_certs=SVN_PYTHON_ORG_ROOT_CERT) File "/tmp/python-test/local/lib/python2.6/ssl.py", line 526, in get_server_certificate s.connect(addr) File "/tmp/python-test/local/lib/python2.6/ssl.py", line 204, in connect self.ca_certs) SSLError: [Errno 8] _ssl.c:429: EOF occurred in violation of protocol test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [14315 refs] [12629 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] [12411 refs] . [12411 refs] [12411 refs] this bit of output is from a test of stdout in a different process ... [12411 refs] [12411 refs] [12629 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12411 refs] [12411 refs] [12640 refs] [12434 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12414 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15641 refs] [16251 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 331 tests OK. 1 test failed: test_ssl 24 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_macos test_epoll test_ioctl [645707 refs] From buildbot at python.org Tue Jun 10 23:55:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 21:55:35 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080610215535.9F9561E4003@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/431 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: armin.ronacher,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 00:34:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 10 Jun 2008 22:34:09 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20080610223409.ED6AB1E4009@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%203.0/builds/54 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti,georg.brandl,gregory.p.smith,thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 00:39:25 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 00:39:25 +0200 (CEST) Subject: [Python-checkins] r64097 - python/trunk/Lib/test/test_platform.py Message-ID: <20080610223925.7241F1E4004@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 00:39:25 2008 New Revision: 64097 Log: backport of 64096 Modified: python/trunk/Lib/test/test_platform.py Modified: python/trunk/Lib/test/test_platform.py ============================================================================== --- python/trunk/Lib/test/test_platform.py (original) +++ python/trunk/Lib/test/test_platform.py Wed Jun 11 00:39:25 2008 @@ -72,7 +72,7 @@ else: have_toolbox_glue = True - if have_toolbox_glue and os.uname()[0] == 'Darwin': + if have_toolbox_glue and platform.uname()[0] == 'Darwin': # We're on a MacOSX system, check that # the right version information is returned fd = os.popen('sw_vers', 'r') From python-checkins at python.org Wed Jun 11 02:25:29 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 02:25:29 +0200 (CEST) Subject: [Python-checkins] r64098 - python/trunk/Lib/numbers.py Message-ID: <20080611002529.750451E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 02:25:29 2008 New Revision: 64098 Log: Mini-PEP: Simplifying numbers.py * Convert binary methods in Integral to mixin methods * Remove three-arg __pow__ as a required method * Make __int__ the root method instead of __long__. Modified: python/trunk/Lib/numbers.py Modified: python/trunk/Lib/numbers.py ============================================================================== --- python/trunk/Lib/numbers.py (original) +++ python/trunk/Lib/numbers.py Wed Jun 11 02:25:29 2008 @@ -283,87 +283,54 @@ class Integral(Rational): - """Integral adds a conversion to long and the bit-string operations.""" + """Integral adds a conversion to int and the bit-string operations.""" @abstractmethod - def __long__(self): - """long(self)""" + def __int__(self): + """int(self)""" raise NotImplementedError def __index__(self): """index(self)""" - return long(self) + return int(self) - @abstractmethod - def __pow__(self, exponent, modulus=None): - """self ** exponent % modulus, but maybe faster. - - Accept the modulus argument if you want to support the - 3-argument version of pow(). Raise a TypeError if exponent < 0 - or any argument isn't Integral. Otherwise, just implement the - 2-argument version described in Complex. - """ - raise NotImplementedError - - @abstractmethod def __lshift__(self, other): - """self << other""" - raise NotImplementedError + return int(self) << int(other) - @abstractmethod def __rlshift__(self, other): - """other << self""" - raise NotImplementedError + return int(other) << int(self) - @abstractmethod def __rshift__(self, other): - """self >> other""" - raise NotImplementedError + return int(self) >> int(other) - @abstractmethod def __rrshift__(self, other): - """other >> self""" - raise NotImplementedError + return int(other) >> int(self) - @abstractmethod def __and__(self, other): - """self & other""" - raise NotImplementedError + return int(self) & int(other) - @abstractmethod def __rand__(self, other): - """other & self""" - raise NotImplementedError + return int(other) & int(self) - @abstractmethod def __xor__(self, other): - """self ^ other""" - raise NotImplementedError + return int(self) ^ int(other) - @abstractmethod def __rxor__(self, other): - """other ^ self""" - raise NotImplementedError + return int(other) ^ int(self) - @abstractmethod def __or__(self, other): - """self | other""" - raise NotImplementedError + return int(self) | int(other) - @abstractmethod def __ror__(self, other): - """other | self""" - raise NotImplementedError + return int(other) | int(self) - @abstractmethod def __invert__(self): - """~self""" - raise NotImplementedError + return ~int(self) # Concrete implementations of Rational and Real abstract methods. def __float__(self): - """float(self) == float(long(self))""" - return float(long(self)) + """float(self) == float(int(self))""" + return float(int(self)) @property def numerator(self): From python-checkins at python.org Wed Jun 11 02:26:20 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 02:26:20 +0200 (CEST) Subject: [Python-checkins] r64099 - peps/trunk/pep-3141.txt Message-ID: <20080611002620.E984B1E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 02:26:20 2008 New Revision: 64099 Log: Update PEP to match the mini-pep for simplifying Intergal. Modified: peps/trunk/pep-3141.txt Modified: peps/trunk/pep-3141.txt ============================================================================== --- peps/trunk/pep-3141.txt (original) +++ peps/trunk/pep-3141.txt Wed Jun 11 02:26:20 2008 @@ -319,76 +319,52 @@ """__index__() exists because float has __int__().""" return int(self) - @abstractmethod - def __pow__(self, exponent, modulus=None): - """self ** exponent % modulus, but maybe faster. - - Implement this if you want to support the 3-argument - version of pow(). Otherwise, just implement the 2-argument - version described in Complex. If modulus is None, this - should behave as the 2-argument version; otherwise, raise - a TypeError if exponent < 0 or any argument isn't - Integral. - """ - raise NotImplementedError - - @abstractmethod def __lshift__(self, other): - """i<>j returns i // 2**j.""" - raise NotImplementedError + return int(self) >> int(other) - @abstractmethod def __rrshift__(self, other): - raise NotImplementedError + return int(other) >> int(self) - @abstractmethod def __and__(self, other): - raise NotImplementedError + return int(self) & int(other) - @abstractmethod def __rand__(self, other): - raise NotImplementedError + return int(other) & int(self) - @abstractmethod def __xor__(self, other): - raise NotImplementedError + return int(self) ^ int(other) - @abstractmethod def __rxor__(self, other): - raise NotImplementedError + return int(other) ^ int(self) - @abstractmethod def __or__(self, other): - raise NotImplementedError + return int(self) | int(other) - @abstractmethod def __ror__(self, other): - raise NotImplementedError + return int(other) | int(self) - @abstractmethod def __invert__(self): - raise NotImplementedError + return ~int(self) # Concrete implementations of Rational and Real abstract methods. - def __float__(self): + """float(self) == float(int(self))""" return float(int(self)) @property def numerator(self): + """Integers are their own numerators.""" return +self @property def denominator(self): + """Integers have a denominator of 1.""" return 1 From python-checkins at python.org Wed Jun 11 02:28:51 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 02:28:51 +0200 (CEST) Subject: [Python-checkins] r64100 - python/trunk/Doc/library/numbers.rst Message-ID: <20080611002851.95C341E400A@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 02:28:51 2008 New Revision: 64100 Log: Update numbers doc for the Integral simplification. Modified: python/trunk/Doc/library/numbers.rst Modified: python/trunk/Doc/library/numbers.rst ============================================================================== --- python/trunk/Doc/library/numbers.rst (original) +++ python/trunk/Doc/library/numbers.rst Wed Jun 11 02:28:51 2008 @@ -73,10 +73,10 @@ .. class:: Integral - Subtypes :class:`Rational` and adds a conversion to :class:`long`, the - 3-argument form of :func:`pow`, and the bit-string operations: ``<<``, - ``>>``, ``&``, ``^``, ``|``, ``~``. Provides defaults for :func:`float`, - :attr:`Rational.numerator`, and :attr:`Rational.denominator`. + Subtypes :class:`Rational` and adds a conversion to :class:`int`. + Provides defaults for :func:`float`, :attr:`Rational.numerator`, and + :attr:`Rational.denominator`, and bit-string operations: ``<<``, + ``>>``, ``&``, ``^``, ``|``, ``~``. Notes for type implementors From python-checkins at python.org Wed Jun 11 02:44:48 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 02:44:48 +0200 (CEST) Subject: [Python-checkins] r64101 - in python/trunk: Lib/test/test_set.py Objects/setobject.c Message-ID: <20080611004448.01EEE1E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 02:44:47 2008 New Revision: 64101 Log: Handle the case with zero arguments. Modified: python/trunk/Lib/test/test_set.py python/trunk/Objects/setobject.c Modified: python/trunk/Lib/test/test_set.py ============================================================================== --- python/trunk/Lib/test/test_set.py (original) +++ python/trunk/Lib/test/test_set.py Wed Jun 11 02:44:47 2008 @@ -104,6 +104,12 @@ self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) self.assertEqual(self.thetype('abcba').intersection(C('ef')), set('')) self.assertEqual(self.thetype('abcba').intersection(C('cbcf'), C('bag')), set('b')) + s = self.thetype('abcba') + z = s.intersection() + if self.thetype == frozenset(): + self.assertEqual(id(s), id(z)) + else: + self.assertNotEqual(id(s), id(z)) def test_isdisjoint(self): def f(s1, s2): Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Wed Jun 11 02:44:47 2008 @@ -1312,6 +1312,9 @@ Py_ssize_t i; PyObject *result = (PyObject *)so; + if (PyTuple_GET_SIZE(args) == 0) + return set_copy(so); + Py_INCREF(so); for (i=0 ; i The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/742 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_site sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 03:31:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 03:31:29 +0200 (CEST) Subject: [Python-checkins] r64102 - python/trunk/Lib/test/test_struct.py Message-ID: <20080611013129.8D4DC1E4003@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 03:31:28 2008 New Revision: 64102 Log: convert test_struct to a unittest thanks to Giampaolo Rodola I had to disable one test because it was functioning incorrectly, see #1530559 I also removed the debugging prints Modified: python/trunk/Lib/test/test_struct.py Modified: python/trunk/Lib/test/test_struct.py ============================================================================== --- python/trunk/Lib/test/test_struct.py (original) +++ python/trunk/Lib/test/test_struct.py Wed Jun 11 03:31:28 2008 @@ -1,14 +1,14 @@ -from test.test_support import TestFailed, verbose, verify, vereq -import test.test_support -import struct import array +import unittest +import struct import warnings +from functools import wraps +from test.test_support import TestFailed, verbose, run_unittest, catch_warning + import sys ISBIGENDIAN = sys.byteorder == "big" del sys -verify((struct.pack('=i', 1)[0] == chr(0)) == ISBIGENDIAN, - "bigendian determination appears wrong") try: import _struct @@ -30,39 +30,21 @@ else: return string_reverse(value) -def simple_err(func, *args): - try: - func(*args) - except struct.error: - pass - else: - raise TestFailed, "%s%s did not raise struct.error" % ( - func.__name__, args) - -def any_err(func, *args): - try: - func(*args) - except (struct.error, TypeError): - pass - else: - raise TestFailed, "%s%s did not raise error" % ( - func.__name__, args) - def with_warning_restore(func): - def _with_warning_restore(*args, **kw): - with test.test_support.catch_warning(): + @wraps(func) + def decorator(*args, **kw): + with catch_warning(): # Grrr, we need this function to warn every time. Without removing # the warningregistry, running test_tarfile then test_struct would fail # on 64-bit platforms. globals = func.func_globals if '__warningregistry__' in globals: del globals['__warningregistry__'] - warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning) - warnings.filterwarnings("error", r""".*format requires.*""", - DeprecationWarning) + warnings.filterwarnings("error", category=DeprecationWarning) return func(*args, **kw) - return _with_warning_restore + return decorator + at with_warning_restore def deprecated_err(func, *args): try: func(*args) @@ -75,602 +57,520 @@ else: raise TestFailed, "%s%s did not raise error" % ( func.__name__, args) -deprecated_err = with_warning_restore(deprecated_err) - -simple_err(struct.calcsize, 'Z') -sz = struct.calcsize('i') -if sz * 3 != struct.calcsize('iii'): - raise TestFailed, 'inconsistent sizes' - -fmt = 'cbxxxxxxhhhhiillffd?' -fmt3 = '3c3b18x12h6i6l6f3d3?' -sz = struct.calcsize(fmt) -sz3 = struct.calcsize(fmt3) -if sz * 3 != sz3: - raise TestFailed, 'inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % ( - fmt, sz, 3*sz, fmt3, sz3) - -simple_err(struct.pack, 'iii', 3) -simple_err(struct.pack, 'i', 3, 3, 3) -simple_err(struct.pack, 'i', 'foo') -simple_err(struct.pack, 'P', 'foo') -simple_err(struct.unpack, 'd', 'flap') -s = struct.pack('ii', 1, 2) -simple_err(struct.unpack, 'iii', s) -simple_err(struct.unpack, 'i', s) - -c = 'a' -b = 1 -h = 255 -i = 65535 -l = 65536 -f = 3.1415 -d = 3.1415 -t = True - -for prefix in ('', '@', '<', '>', '=', '!'): - for format in ('xcbhilfd?', 'xcBHILfd?'): - format = prefix + format - if verbose: - print "trying:", format - s = struct.pack(format, c, b, h, i, l, f, d, t) - cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) - if (cp != c or bp != b or hp != h or ip != i or lp != l or - int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d) or - tp != t): - # ^^^ calculate only to two decimal places - raise TestFailed, "unpack/pack not transitive (%s, %s)" % ( - str(format), str((cp, bp, hp, ip, lp, fp, dp, tp))) - -# Test some of the new features in detail - -# (format, argument, big-endian result, little-endian result, asymmetric) -tests = [ - ('c', 'a', 'a', 'a', 0), - ('xc', 'a', '\0a', '\0a', 0), - ('cx', 'a', 'a\0', 'a\0', 0), - ('s', 'a', 'a', 'a', 0), - ('0s', 'helloworld', '', '', 1), - ('1s', 'helloworld', 'h', 'h', 1), - ('9s', 'helloworld', 'helloworl', 'helloworl', 1), - ('10s', 'helloworld', 'helloworld', 'helloworld', 0), - ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), - ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), - ('b', 7, '\7', '\7', 0), - ('b', -7, '\371', '\371', 0), - ('B', 7, '\7', '\7', 0), - ('B', 249, '\371', '\371', 0), - ('h', 700, '\002\274', '\274\002', 0), - ('h', -700, '\375D', 'D\375', 0), - ('H', 700, '\002\274', '\274\002', 0), - ('H', 0x10000-700, '\375D', 'D\375', 0), - ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), - ('d', 2.0, '@\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000@', 0), - ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), - ('d', -2.0, '\300\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000\300', 0), - ('?', 0, '\0', '\0', 0), - ('?', 3, '\1', '\1', 1), - ('?', True, '\1', '\1', 0), - ('?', [], '\0', '\0', 1), - ('?', (1,), '\1', '\1', 1), -] - -for fmt, arg, big, lil, asy in tests: - if verbose: - print "%r %r %r %r" % (fmt, arg, big, lil) - for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), - ('='+fmt, ISBIGENDIAN and big or lil)]: - res = struct.pack(xfmt, arg) - if res != exp: - raise TestFailed, "pack(%r, %r) -> %r # expected %r" % ( - fmt, arg, res, exp) - n = struct.calcsize(xfmt) - if n != len(res): - raise TestFailed, "calcsize(%r) -> %d # expected %d" % ( - xfmt, n, len(res)) - rev = struct.unpack(xfmt, res)[0] - if rev != arg and not asy: - raise TestFailed, "unpack(%r, %r) -> (%r,) # expected (%r,)" % ( - fmt, res, rev, arg) - -########################################################################### -# Simple native q/Q tests. - -has_native_qQ = 1 -try: - struct.pack("q", 5) -except struct.error: - has_native_qQ = 0 - -if verbose: - print "Platform has native q/Q?", has_native_qQ and "Yes." or "No." - -any_err(struct.pack, "Q", -1) # can't pack -1 as unsigned regardless -simple_err(struct.pack, "q", "a") # can't pack string as 'q' regardless -simple_err(struct.pack, "Q", "a") # ditto, but 'Q' - -def test_native_qQ(): - bytes = struct.calcsize('q') - # The expected values here are in big-endian format, primarily because - # I'm on a little-endian machine and so this is the clearest way (for - # me) to force the code to get exercised. - for format, input, expected in ( - ('q', -1, '\xff' * bytes), - ('q', 0, '\x00' * bytes), - ('Q', 0, '\x00' * bytes), - ('q', 1L, '\x00' * (bytes-1) + '\x01'), - ('Q', (1L << (8*bytes))-1, '\xff' * bytes), - ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): - got = struct.pack(format, input) - native_expected = bigendian_to_native(expected) - verify(got == native_expected, - "%r-pack of %r gave %r, not %r" % - (format, input, got, native_expected)) - retrieved = struct.unpack(format, got)[0] - verify(retrieved == input, - "%r-unpack of %r gave %r, not %r" % - (format, got, retrieved, input)) - -if has_native_qQ: - test_native_qQ() - -########################################################################### -# Standard integer tests (bBhHiIlLqQ). - -import binascii - -class IntTester: - - # XXX Most std integer modes fail to test for out-of-range. - # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but - # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C - # reported by Mark Favas). - BUGGY_RANGE_CHECK = "bBhHiIlL" - - def __init__(self, formatpair, bytesize): - assert len(formatpair) == 2 - self.formatpair = formatpair - for direction in "<>!=": - for code in formatpair: - format = direction + code - verify(struct.calcsize(format) == bytesize) - self.bytesize = bytesize - self.bitsize = bytesize * 8 - self.signed_code, self.unsigned_code = formatpair - self.unsigned_min = 0 - self.unsigned_max = 2L**self.bitsize - 1 - self.signed_min = -(2L**(self.bitsize-1)) - self.signed_max = 2L**(self.bitsize-1) - 1 - - def test_one(self, x, pack=struct.pack, - unpack=struct.unpack, - unhexlify=binascii.unhexlify): - if verbose: - print "trying std", self.formatpair, "on", x, "==", hex(x) - - # Try signed. - code = self.signed_code - if self.signed_min <= x <= self.signed_max: - # Try big-endian. - expected = long(x) - if x < 0: - expected += 1L << self.bitsize - assert expected > 0 - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - format = ">" + code - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) +class StructTest(unittest.TestCase): + @with_warning_restore + def check_float_coerce(self, format, number): + # SF bug 1530559. struct.pack raises TypeError where it used to convert. + if PY_STRUCT_FLOAT_COERCE == 2: + # Test for pre-2.5 struct module + packed = struct.pack(format, number) + floored = struct.unpack(format, packed)[0] + self.assertEqual(floored, int(number), + "did not correcly coerce float to int") + return + try: + struct.pack(format, number) + except (struct.error, TypeError): + if PY_STRUCT_FLOAT_COERCE: + self.fail("expected DeprecationWarning for float coerce") + except DeprecationWarning: + if not PY_STRUCT_FLOAT_COERCE: + self.fail("expected to raise struct.error for float coerce") else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - # Much the same for unsigned. - code = self.unsigned_code - if self.unsigned_min <= x <= self.unsigned_max: - # Try big-endian. - format = ">" + code - expected = long(x) - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) + self.fail("did not raise error for float coerce") + + def test_isbigendian(self): + self.assertEqual((struct.pack('=i', 1)[0] == chr(0)), ISBIGENDIAN) - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) + def test_consistence(self): + self.assertRaises(struct.error, struct.calcsize, 'Z') + sz = struct.calcsize('i') + self.assertEqual(sz * 3, struct.calcsize('iii')) + + fmt = 'cbxxxxxxhhhhiillffd?' + fmt3 = '3c3b18x12h6i6l6f3d3?' + sz = struct.calcsize(fmt) + sz3 = struct.calcsize(fmt3) + self.assertEqual(sz * 3, sz3) + + self.assertRaises(struct.error, struct.pack, 'iii', 3) + self.assertRaises(struct.error, struct.pack, 'i', 3, 3, 3) + self.assertRaises(struct.error, struct.pack, 'i', 'foo') + self.assertRaises(struct.error, struct.pack, 'P', 'foo') + self.assertRaises(struct.error, struct.unpack, 'd', 'flap') + s = struct.pack('ii', 1, 2) + self.assertRaises(struct.error, struct.unpack, 'iii', s) + self.assertRaises(struct.error, struct.unpack, 'i', s) + + def test_transitiveness(self): + c = 'a' + b = 1 + h = 255 + i = 65535 + l = 65536 + f = 3.1415 + d = 3.1415 + t = True + + for prefix in ('', '@', '<', '>', '=', '!'): + for format in ('xcbhilfd?', 'xcBHILfd?'): + format = prefix + format + s = struct.pack(format, c, b, h, i, l, f, d, t) + cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) + self.assertEqual(cp, c) + self.assertEqual(bp, b) + self.assertEqual(hp, h) + self.assertEqual(ip, i) + self.assertEqual(lp, l) + self.assertEqual(int(100 * fp), int(100 * f)) + self.assertEqual(int(100 * dp), int(100 * d)) + self.assertEqual(tp, t) + + def test_new_features(self): + # Test some of the new features in detail + # (format, argument, big-endian result, little-endian result, asymmetric) + tests = [ + ('c', 'a', 'a', 'a', 0), + ('xc', 'a', '\0a', '\0a', 0), + ('cx', 'a', 'a\0', 'a\0', 0), + ('s', 'a', 'a', 'a', 0), + ('0s', 'helloworld', '', '', 1), + ('1s', 'helloworld', 'h', 'h', 1), + ('9s', 'helloworld', 'helloworl', 'helloworl', 1), + ('10s', 'helloworld', 'helloworld', 'helloworld', 0), + ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), + ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), + ('b', 7, '\7', '\7', 0), + ('b', -7, '\371', '\371', 0), + ('B', 7, '\7', '\7', 0), + ('B', 249, '\371', '\371', 0), + ('h', 700, '\002\274', '\274\002', 0), + ('h', -700, '\375D', 'D\375', 0), + ('H', 700, '\002\274', '\274\002', 0), + ('H', 0x10000-700, '\375D', 'D\375', 0), + ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), + ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), + ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), + ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), + ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), + ('d', 2.0, '@\000\000\000\000\000\000\000', + '\000\000\000\000\000\000\000@', 0), + ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), + ('d', -2.0, '\300\000\000\000\000\000\000\000', + '\000\000\000\000\000\000\000\300', 0), + ('?', 0, '\0', '\0', 0), + ('?', 3, '\1', '\1', 1), + ('?', True, '\1', '\1', 0), + ('?', [], '\0', '\0', 1), + ('?', (1,), '\1', '\1', 1), + ] + + for fmt, arg, big, lil, asy in tests: + for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), + ('='+fmt, ISBIGENDIAN and big or lil)]: + res = struct.pack(xfmt, arg) + self.assertEqual(res, exp) + self.assertEqual(struct.calcsize(xfmt), len(res)) + rev = struct.unpack(xfmt, res)[0] + if rev != arg: + self.assert_(asy) + + def test_native_qQ(self): + # can't pack -1 as unsigned regardless + self.assertRaises((struct.error, TypeError), struct.pack, "Q", -1) + # can't pack string as 'q' regardless + self.assertRaises(struct.error, struct.pack, "q", "a") + # ditto, but 'Q' + self.assertRaises(struct.error, struct.pack, "Q", "a") + + try: + struct.pack("q", 5) + except struct.error: + # does not have native q/Q + pass else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - def run(self): - from random import randrange - - # Create all interesting powers of 2. - values = [] - for exp in range(self.bitsize + 3): - values.append(1L << exp) - - # Add some random values. - for i in range(self.bitsize): - val = 0L - for j in range(self.bytesize): - val = (val << 8) | randrange(256) - values.append(val) - - # Try all those, and their negations, and +-1 from them. Note - # that this tests all power-of-2 boundaries in range, and a few out - # of range, plus +-(2**n +- 1). - for base in values: - for val in -base, base: - for incr in -1, 0, 1: - x = val + incr - try: - x = int(x) - except OverflowError: - pass - self.test_one(x) - - # Some error cases. - for direction in "<>": - for code in self.formatpair: - for badobject in "a string", 3+42j, randrange: - any_err(struct.pack, direction + code, badobject) - -for args in [("bB", 1), - ("hH", 2), - ("iI", 4), - ("lL", 4), - ("qQ", 8)]: - t = IntTester(*args) - t.run() - - -########################################################################### -# The p ("Pascal string") code. - -def test_p_code(): - for code, input, expected, expectedback in [ - ('p','abc', '\x00', ''), - ('1p', 'abc', '\x00', ''), - ('2p', 'abc', '\x01a', 'a'), - ('3p', 'abc', '\x02ab', 'ab'), - ('4p', 'abc', '\x03abc', 'abc'), - ('5p', 'abc', '\x03abc\x00', 'abc'), - ('6p', 'abc', '\x03abc\x00\x00', 'abc'), - ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: - got = struct.pack(code, input) - if got != expected: - raise TestFailed("pack(%r, %r) == %r but expected %r" % - (code, input, got, expected)) - (got,) = struct.unpack(code, got) - if got != expectedback: - raise TestFailed("unpack(%r, %r) == %r but expected %r" % - (code, input, got, expectedback)) - -test_p_code() - - -########################################################################### -# SF bug 705836. "f" had a severe rounding bug, where a carry -# from the low-order discarded bits could propagate into the exponent -# field, causing the result to be wrong by a factor of 2. - -def test_705836(): - import math - - for base in range(1, 33): - # smaller <- largest representable float less than base. - delta = 0.5 - while base - delta / 2.0 != base: - delta /= 2.0 - smaller = base - delta - # Packing this rounds away a solid string of trailing 1 bits. - packed = struct.pack("f", smaller) - verify(bigpacked == string_reverse(packed), - ">f pack should be byte-reversal of f", bigpacked)[0] - verify(base == unpacked) - - # Largest finite IEEE single. - big = (1 << 24) - 1 - big = math.ldexp(big, 127 - 23) - packed = struct.pack(">f", big) - unpacked = struct.unpack(">f", packed)[0] - verify(big == unpacked) - - # The same, but tack on a 1 bit so it rounds up to infinity. - big = (1 << 25) - 1 - big = math.ldexp(big, 127 - 24) - try: + bytes = struct.calcsize('q') + # The expected values here are in big-endian format, primarily + # because I'm on a little-endian machine and so this is the + # clearest way (for me) to force the code to get exercised. + for format, input, expected in ( + ('q', -1, '\xff' * bytes), + ('q', 0, '\x00' * bytes), + ('Q', 0, '\x00' * bytes), + ('q', 1L, '\x00' * (bytes-1) + '\x01'), + ('Q', (1L << (8*bytes))-1, '\xff' * bytes), + ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): + got = struct.pack(format, input) + native_expected = bigendian_to_native(expected) + self.assertEqual(got, native_expected) + retrieved = struct.unpack(format, got)[0] + self.assertEqual(retrieved, input) + + def test_standard_integers(self): + # Standard integer tests (bBhHiIlLqQ). + import binascii + + class IntTester(unittest.TestCase): + + # XXX Most std integer modes fail to test for out-of-range. + # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but + # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C + # reported by Mark Favas). + BUGGY_RANGE_CHECK = "bBhHiIlL" + + def __init__(self, formatpair, bytesize): + self.assertEqual(len(formatpair), 2) + self.formatpair = formatpair + for direction in "<>!=": + for code in formatpair: + format = direction + code + self.assertEqual(struct.calcsize(format), bytesize) + self.bytesize = bytesize + self.bitsize = bytesize * 8 + self.signed_code, self.unsigned_code = formatpair + self.unsigned_min = 0 + self.unsigned_max = 2L**self.bitsize - 1 + self.signed_min = -(2L**(self.bitsize-1)) + self.signed_max = 2L**(self.bitsize-1) - 1 + + def test_one(self, x, pack=struct.pack, + unpack=struct.unpack, + unhexlify=binascii.unhexlify): + # Try signed. + code = self.signed_code + if self.signed_min <= x <= self.signed_max: + # Try big-endian. + expected = long(x) + if x < 0: + expected += 1L << self.bitsize + self.assert_(expected > 0) + expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' + if len(expected) & 1: + expected = "0" + expected + expected = unhexlify(expected) + expected = "\x00" * (self.bytesize - len(expected)) + expected + + # Pack work? + format = ">" + code + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + # Try little-endian. + format = "<" + code + expected = string_reverse(expected) + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + else: + # x is out of range -- verify pack realizes that. + if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: + if verbose: + print "Skipping buggy range check for code", code + else: + deprecated_err(pack, ">" + code, x) + deprecated_err(pack, "<" + code, x) + + # Much the same for unsigned. + code = self.unsigned_code + if self.unsigned_min <= x <= self.unsigned_max: + # Try big-endian. + format = ">" + code + expected = long(x) + expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' + if len(expected) & 1: + expected = "0" + expected + expected = unhexlify(expected) + expected = "\x00" * (self.bytesize - len(expected)) + expected + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + # Try little-endian. + format = "<" + code + expected = string_reverse(expected) + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + else: + # x is out of range -- verify pack realizes that. + if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: + if verbose: + print "Skipping buggy range check for code", code + else: + deprecated_err(pack, ">" + code, x) + deprecated_err(pack, "<" + code, x) + + def run(self): + from random import randrange + + # Create all interesting powers of 2. + values = [] + for exp in range(self.bitsize + 3): + values.append(1L << exp) + + # Add some random values. + for i in range(self.bitsize): + val = 0L + for j in range(self.bytesize): + val = (val << 8) | randrange(256) + values.append(val) + + # Try all those, and their negations, and +-1 from them. Note + # that this tests all power-of-2 boundaries in range, and a few out + # of range, plus +-(2**n +- 1). + for base in values: + for val in -base, base: + for incr in -1, 0, 1: + x = val + incr + try: + x = int(x) + except OverflowError: + pass + self.test_one(x) + + # Some error cases. + for direction in "<>": + for code in self.formatpair: + for badobject in "a string", 3+42j, randrange: + self.assertRaises((struct.error, TypeError), + struct.pack, direction + code, + badobject) + + for args in [("bB", 1), + ("hH", 2), + ("iI", 4), + ("lL", 4), + ("qQ", 8)]: + t = IntTester(*args) + t.run() + + def test_p_code(self): + # Test p ("Pascal string") code. + for code, input, expected, expectedback in [ + ('p','abc', '\x00', ''), + ('1p', 'abc', '\x00', ''), + ('2p', 'abc', '\x01a', 'a'), + ('3p', 'abc', '\x02ab', 'ab'), + ('4p', 'abc', '\x03abc', 'abc'), + ('5p', 'abc', '\x03abc\x00', 'abc'), + ('6p', 'abc', '\x03abc\x00\x00', 'abc'), + ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: + got = struct.pack(code, input) + self.assertEqual(got, expected) + (got,) = struct.unpack(code, got) + self.assertEqual(got, expectedback) + + def test_705836(self): + # SF bug 705836. "f" had a severe rounding bug, where a carry + # from the low-order discarded bits could propagate into the exponent + # field, causing the result to be wrong by a factor of 2. + import math + + for base in range(1, 33): + # smaller <- largest representable float less than base. + delta = 0.5 + while base - delta / 2.0 != base: + delta /= 2.0 + smaller = base - delta + # Packing this rounds away a solid string of trailing 1 bits. + packed = struct.pack("f", smaller) + self.assertEqual(bigpacked, string_reverse(packed)) + unpacked = struct.unpack(">f", bigpacked)[0] + self.assertEqual(base, unpacked) + + # Largest finite IEEE single. + big = (1 << 24) - 1 + big = math.ldexp(big, 127 - 23) packed = struct.pack(">f", big) - except OverflowError: - pass - else: - raise TestFailed("expected OverflowError") - -test_705836() + unpacked = struct.unpack(">f", packed)[0] + self.assertEqual(big, unpacked) -########################################################################### -# SF bug 1229380. No struct.pack exception for some out of range integers + # The same, but tack on a 1 bit so it rounds up to infinity. + big = (1 << 25) - 1 + big = math.ldexp(big, 127 - 24) + self.assertRaises(OverflowError, struct.pack, ">f", big) + + if PY_STRUCT_RANGE_CHECKING: + def test_1229380(self): + # SF bug 1229380. No struct.pack exception for some out of + # range integers + import sys + for endian in ('', '>', '<'): + for cls in (int, long): + for fmt in ('B', 'H', 'I', 'L'): + deprecated_err(struct.pack, endian + fmt, cls(-1)) + + deprecated_err(struct.pack, endian + 'B', cls(300)) + deprecated_err(struct.pack, endian + 'H', cls(70000)) + + deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L) + deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L) + + def XXXtest_1530559(self): + # XXX This is broken: see the bug report + # SF bug 1530559. struct.pack raises TypeError where it used to convert. + for endian in ('', '>', '<'): + for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'): + self.check_float_coerce(endian + fmt, 1.0) + self.check_float_coerce(endian + fmt, 1.5) + + def test_unpack_from(self): + test_string = 'abcd01234' + fmt = '4s' + s = struct.Struct(fmt) + for cls in (str, buffer): + data = cls(test_string) + self.assertEqual(s.unpack_from(data), ('abcd',)) + self.assertEqual(s.unpack_from(data, 2), ('cd01',)) + self.assertEqual(s.unpack_from(data, 4), ('0123',)) + for i in xrange(6): + self.assertEqual(s.unpack_from(data, i), (data[i:i+4],)) + for i in xrange(6, len(test_string) + 1): + self.assertRaises(struct.error, s.unpack_from, data, i) + for cls in (str, buffer): + data = cls(test_string) + self.assertEqual(struct.unpack_from(fmt, data), ('abcd',)) + self.assertEqual(struct.unpack_from(fmt, data, 2), ('cd01',)) + self.assertEqual(struct.unpack_from(fmt, data, 4), ('0123',)) + for i in xrange(6): + self.assertEqual(struct.unpack_from(fmt, data, i), (data[i:i+4],)) + for i in xrange(6, len(test_string) + 1): + self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + + def test_pack_into(self): + test_string = 'Reykjavik rocks, eow!' + writable_buf = array.array('c', ' '*100) + fmt = '21s' + s = struct.Struct(fmt) + + # Test without offset + s.pack_into(writable_buf, 0, test_string) + from_buf = writable_buf.tostring()[:len(test_string)] + self.assertEqual(from_buf, test_string) + + # Test with offset. + s.pack_into(writable_buf, 10, test_string) + from_buf = writable_buf.tostring()[:len(test_string)+10] + self.assertEqual(from_buf, test_string[:10] + test_string) + + # Go beyond boundaries. + small_buf = array.array('c', ' '*10) + self.assertRaises(struct.error, s.pack_into, small_buf, 0, test_string) + self.assertRaises(struct.error, s.pack_into, small_buf, 2, test_string) + + def test_pack_into_fn(self): + test_string = 'Reykjavik rocks, eow!' + writable_buf = array.array('c', ' '*100) + fmt = '21s' + pack_into = lambda *args: struct.pack_into(fmt, *args) + + # Test without offset. + pack_into(writable_buf, 0, test_string) + from_buf = writable_buf.tostring()[:len(test_string)] + self.assertEqual(from_buf, test_string) + + # Test with offset. + pack_into(writable_buf, 10, test_string) + from_buf = writable_buf.tostring()[:len(test_string)+10] + self.assertEqual(from_buf, test_string[:10] + test_string) + + # Go beyond boundaries. + small_buf = array.array('c', ' '*10) + self.assertRaises(struct.error, pack_into, small_buf, 0, test_string) + self.assertRaises(struct.error, pack_into, small_buf, 2, test_string) + + def test_unpack_with_buffer(self): + # SF bug 1563759: struct.unpack doens't support buffer protocol objects + data1 = array.array('B', '\x12\x34\x56\x78') + data2 = buffer('......\x12\x34\x56\x78......', 6, 4) + for data in [data1, data2]: + value, = struct.unpack('>I', data) + self.assertEqual(value, 0x12345678) + + def test_bool(self): + for prefix in tuple("<>!=")+('',): + false = (), [], [], '', 0 + true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 + + falseFormat = prefix + '?' * len(false) + packedFalse = struct.pack(falseFormat, *false) + unpackedFalse = struct.unpack(falseFormat, packedFalse) + + trueFormat = prefix + '?' * len(true) + packedTrue = struct.pack(trueFormat, *true) + unpackedTrue = struct.unpack(trueFormat, packedTrue) + + self.assertEqual(len(true), len(unpackedTrue)) + self.assertEqual(len(false), len(unpackedFalse)) + + for t in unpackedFalse: + self.assertFalse(t) + for t in unpackedTrue: + self.assertTrue(t) + + packed = struct.pack(prefix+'?', 1) + + self.assertEqual(len(packed), struct.calcsize(prefix+'?')) + + if len(packed) != 1: + self.assertFalse(prefix, msg='encoded bool is not one byte: %r' + %packed) + + for c in '\x01\x7f\xff\x0f\xf0': + self.assertTrue(struct.unpack('>?', c)[0]) -def test_1229380(): - import sys - for endian in ('', '>', '<'): - for cls in (int, long): - for fmt in ('B', 'H', 'I', 'L'): - deprecated_err(struct.pack, endian + fmt, cls(-1)) - - deprecated_err(struct.pack, endian + 'B', cls(300)) - deprecated_err(struct.pack, endian + 'H', cls(70000)) - - deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L) - deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L) - -if PY_STRUCT_RANGE_CHECKING: - test_1229380() - -########################################################################### -# SF bug 1530559. struct.pack raises TypeError where it used to convert. - -def check_float_coerce(format, number): - if PY_STRUCT_FLOAT_COERCE == 2: - # Test for pre-2.5 struct module - packed = struct.pack(format, number) - floored = struct.unpack(format, packed)[0] - if floored != int(number): - raise TestFailed("did not correcly coerce float to int") - return - try: - func(*args) - except (struct.error, TypeError): - if PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected DeprecationWarning for float coerce") - except DeprecationWarning: - if not PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected to raise struct.error for float coerce") - else: - raise TestFailed("did not raise error for float coerce") - -check_float_coerce = with_warning_restore(deprecated_err) - -def test_1530559(): - for endian in ('', '>', '<'): - for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'): - check_float_coerce(endian + fmt, 1.0) - check_float_coerce(endian + fmt, 1.5) - -test_1530559() - -########################################################################### -# Packing and unpacking to/from buffers. - -# Copied and modified from unittest. -def assertRaises(excClass, callableObj, *args, **kwargs): - try: - callableObj(*args, **kwargs) - except excClass: - return - else: - raise TestFailed("%s not raised." % excClass) -def test_unpack_from(): - test_string = 'abcd01234' - fmt = '4s' - s = struct.Struct(fmt) - for cls in (str, buffer): - data = cls(test_string) - vereq(s.unpack_from(data), ('abcd',)) - vereq(s.unpack_from(data, 2), ('cd01',)) - vereq(s.unpack_from(data, 4), ('0123',)) - for i in xrange(6): - vereq(s.unpack_from(data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(s.unpack_from, data, i) - for cls in (str, buffer): - data = cls(test_string) - vereq(struct.unpack_from(fmt, data), ('abcd',)) - vereq(struct.unpack_from(fmt, data, 2), ('cd01',)) - vereq(struct.unpack_from(fmt, data, 4), ('0123',)) - for i in xrange(6): - vereq(struct.unpack_from(fmt, data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(struct.unpack_from, fmt, data, i) - -def test_pack_into(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - s = struct.Struct(fmt) - - # Test without offset - s.pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - s.pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, s.pack_into, small_buf, 0, test_string) - assertRaises(struct.error, s.pack_into, small_buf, 2, test_string) - -def test_pack_into_fn(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - pack_into = lambda *args: struct.pack_into(fmt, *args) - - # Test without offset. - pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, pack_into, small_buf, 0, test_string) - assertRaises(struct.error, pack_into, small_buf, 2, test_string) - -def test_unpack_with_buffer(): - # SF bug 1563759: struct.unpack doens't support buffer protocol objects - data1 = array.array('B', '\x12\x34\x56\x78') - data2 = buffer('......\x12\x34\x56\x78......', 6, 4) - for data in [data1, data2]: - value, = struct.unpack('>I', data) - vereq(value, 0x12345678) - -# Test methods to pack and unpack from buffers rather than strings. -test_unpack_from() -test_pack_into() -test_pack_into_fn() -test_unpack_with_buffer() - -def test_bool(): - for prefix in tuple("<>!=")+('',): - false = (), [], [], '', 0 - true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 - - falseFormat = prefix + '?' * len(false) - if verbose: - print 'trying bool pack/unpack on', false, 'using format', falseFormat - packedFalse = struct.pack(falseFormat, *false) - unpackedFalse = struct.unpack(falseFormat, packedFalse) - - trueFormat = prefix + '?' * len(true) - if verbose: - print 'trying bool pack/unpack on', true, 'using format', trueFormat - packedTrue = struct.pack(trueFormat, *true) - unpackedTrue = struct.unpack(trueFormat, packedTrue) - - if len(true) != len(unpackedTrue): - raise TestFailed('unpacked true array is not of same size as input') - if len(false) != len(unpackedFalse): - raise TestFailed('unpacked false array is not of same size as input') - - for t in unpackedFalse: - if t is not False: - raise TestFailed('%r did not unpack as False' % t) - for t in unpackedTrue: - if t is not True: - raise TestFailed('%r did not unpack as false' % t) - - if prefix and verbose: - print 'trying size of bool with format %r' % (prefix+'?') - packed = struct.pack(prefix+'?', 1) - - if len(packed) != struct.calcsize(prefix+'?'): - raise TestFailed('packed length is not equal to calculated size') - - if len(packed) != 1 and prefix: - raise TestFailed('encoded bool is not one byte: %r' % packed) - elif not prefix and verbose: - print 'size of bool in native format is %i' % (len(packed)) - - for c in '\x01\x7f\xff\x0f\xf0': - if struct.unpack('>?', c)[0] is not True: - raise TestFailed('%c did not unpack as True' % c) +def test_main(): + run_unittest(StructTest) -test_bool() +if __name__ == '__main__': + test_main() From buildbot at python.org Wed Jun 11 03:34:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 01:34:51 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080611013451.DC5231E4003@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1471 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 04:40:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 04:40:29 +0200 (CEST) Subject: [Python-checkins] r64104 - in python/trunk: Doc/includes/mp_benchmarks.py Doc/includes/mp_distributing.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/library/multiprocessing.rst Doc/library/someos.rst Lib/multiprocessing Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/sharedctypes.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/test/test_multiprocessing.py Modules/_multiprocessing Modules/_multiprocessing/connection.h Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/semaphore.c Modules/_multiprocessing/socket_connection.c Modules/_multiprocessing/win32_functions.c setup.py Message-ID: <20080611024029.99DCD1E4012@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 04:40:25 2008 New Revision: 64104 Log: add the multiprocessing package to fulfill PEP 371 Added: python/trunk/Doc/includes/mp_benchmarks.py python/trunk/Doc/includes/mp_distributing.py python/trunk/Doc/includes/mp_newtype.py python/trunk/Doc/includes/mp_pool.py python/trunk/Doc/includes/mp_synchronize.py python/trunk/Doc/includes/mp_webserver.py python/trunk/Doc/includes/mp_workers.py python/trunk/Doc/library/multiprocessing.rst python/trunk/Lib/multiprocessing/ python/trunk/Lib/multiprocessing/__init__.py python/trunk/Lib/multiprocessing/connection.py python/trunk/Lib/multiprocessing/dummy/ python/trunk/Lib/multiprocessing/dummy/__init__.py python/trunk/Lib/multiprocessing/dummy/connection.py python/trunk/Lib/multiprocessing/forking.py python/trunk/Lib/multiprocessing/heap.py python/trunk/Lib/multiprocessing/managers.py python/trunk/Lib/multiprocessing/pool.py python/trunk/Lib/multiprocessing/process.py python/trunk/Lib/multiprocessing/queues.py python/trunk/Lib/multiprocessing/reduction.py python/trunk/Lib/multiprocessing/sharedctypes.py python/trunk/Lib/multiprocessing/synchronize.py python/trunk/Lib/multiprocessing/util.py python/trunk/Lib/test/test_multiprocessing.py python/trunk/Modules/_multiprocessing/ python/trunk/Modules/_multiprocessing/connection.h python/trunk/Modules/_multiprocessing/multiprocessing.c python/trunk/Modules/_multiprocessing/multiprocessing.h python/trunk/Modules/_multiprocessing/pipe_connection.c python/trunk/Modules/_multiprocessing/semaphore.c python/trunk/Modules/_multiprocessing/socket_connection.c python/trunk/Modules/_multiprocessing/win32_functions.c Modified: python/trunk/Doc/library/someos.rst python/trunk/setup.py Added: python/trunk/Doc/includes/mp_benchmarks.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_benchmarks.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,235 @@ +# +# Simple benchmarks for the multiprocessing package +# + +import time, sys, multiprocessing, threading, Queue, gc + +if sys.platform == 'win32': + _timer = time.clock +else: + _timer = time.time + +delta = 1 + + +#### TEST_QUEUESPEED + +def queuespeed_func(q, c, iterations): + a = '0' * 256 + c.acquire() + c.notify() + c.release() + + for i in xrange(iterations): + q.put(a) + + q.put('STOP') + +def test_queuespeed(Process, q, c): + elapsed = 0 + iterations = 1 + + while elapsed < delta: + iterations *= 2 + + p = Process(target=queuespeed_func, args=(q, c, iterations)) + c.acquire() + p.start() + c.wait() + c.release() + + result = None + t = _timer() + + while result != 'STOP': + result = q.get() + + elapsed = _timer() - t + + p.join() + + print iterations, 'objects passed through the queue in', elapsed, 'seconds' + print 'average number/sec:', iterations/elapsed + + +#### TEST_PIPESPEED + +def pipe_func(c, cond, iterations): + a = '0' * 256 + cond.acquire() + cond.notify() + cond.release() + + for i in xrange(iterations): + c.send(a) + + c.send('STOP') + +def test_pipespeed(): + c, d = multiprocessing.Pipe() + cond = multiprocessing.Condition() + elapsed = 0 + iterations = 1 + + while elapsed < delta: + iterations *= 2 + + p = multiprocessing.Process(target=pipe_func, + args=(d, cond, iterations)) + cond.acquire() + p.start() + cond.wait() + cond.release() + + result = None + t = _timer() + + while result != 'STOP': + result = c.recv() + + elapsed = _timer() - t + p.join() + + print iterations, 'objects passed through connection in',elapsed,'seconds' + print 'average number/sec:', iterations/elapsed + + +#### TEST_SEQSPEED + +def test_seqspeed(seq): + elapsed = 0 + iterations = 1 + + while elapsed < delta: + iterations *= 2 + + t = _timer() + + for i in xrange(iterations): + a = seq[5] + + elapsed = _timer()-t + + print iterations, 'iterations in', elapsed, 'seconds' + print 'average number/sec:', iterations/elapsed + + +#### TEST_LOCK + +def test_lockspeed(l): + elapsed = 0 + iterations = 1 + + while elapsed < delta: + iterations *= 2 + + t = _timer() + + for i in xrange(iterations): + l.acquire() + l.release() + + elapsed = _timer()-t + + print iterations, 'iterations in', elapsed, 'seconds' + print 'average number/sec:', iterations/elapsed + + +#### TEST_CONDITION + +def conditionspeed_func(c, N): + c.acquire() + c.notify() + + for i in xrange(N): + c.wait() + c.notify() + + c.release() + +def test_conditionspeed(Process, c): + elapsed = 0 + iterations = 1 + + while elapsed < delta: + iterations *= 2 + + c.acquire() + p = Process(target=conditionspeed_func, args=(c, iterations)) + p.start() + + c.wait() + + t = _timer() + + for i in xrange(iterations): + c.notify() + c.wait() + + elapsed = _timer()-t + + c.release() + p.join() + + print iterations * 2, 'waits in', elapsed, 'seconds' + print 'average number/sec:', iterations * 2 / elapsed + +#### + +def test(): + manager = multiprocessing.Manager() + + gc.disable() + + print '\n\t######## testing Queue.Queue\n' + test_queuespeed(threading.Thread, Queue.Queue(), + threading.Condition()) + print '\n\t######## testing multiprocessing.Queue\n' + test_queuespeed(multiprocessing.Process, multiprocessing.Queue(), + multiprocessing.Condition()) + print '\n\t######## testing Queue managed by server process\n' + test_queuespeed(multiprocessing.Process, manager.Queue(), + manager.Condition()) + print '\n\t######## testing multiprocessing.Pipe\n' + test_pipespeed() + + print + + print '\n\t######## testing list\n' + test_seqspeed(range(10)) + print '\n\t######## testing list managed by server process\n' + test_seqspeed(manager.list(range(10))) + print '\n\t######## testing Array("i", ..., lock=False)\n' + test_seqspeed(multiprocessing.Array('i', range(10), lock=False)) + print '\n\t######## testing Array("i", ..., lock=True)\n' + test_seqspeed(multiprocessing.Array('i', range(10), lock=True)) + + print + + print '\n\t######## testing threading.Lock\n' + test_lockspeed(threading.Lock()) + print '\n\t######## testing threading.RLock\n' + test_lockspeed(threading.RLock()) + print '\n\t######## testing multiprocessing.Lock\n' + test_lockspeed(multiprocessing.Lock()) + print '\n\t######## testing multiprocessing.RLock\n' + test_lockspeed(multiprocessing.RLock()) + print '\n\t######## testing lock managed by server process\n' + test_lockspeed(manager.Lock()) + print '\n\t######## testing rlock managed by server process\n' + test_lockspeed(manager.RLock()) + + print + + print '\n\t######## testing threading.Condition\n' + test_conditionspeed(threading.Thread, threading.Condition()) + print '\n\t######## testing multiprocessing.Condition\n' + test_conditionspeed(multiprocessing.Process, multiprocessing.Condition()) + print '\n\t######## testing condition managed by a server process\n' + test_conditionspeed(multiprocessing.Process, manager.Condition()) + + gc.enable() + +if __name__ == '__main__': + multiprocessing.freeze_support() + test() Added: python/trunk/Doc/includes/mp_distributing.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_distributing.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,362 @@ +# +# Module to allow spawning of processes on foreign host +# +# Depends on `multiprocessing` package -- tested with `processing-0.60` +# + +__all__ = ['Cluster', 'Host', 'get_logger', 'current_process'] + +# +# Imports +# + +import sys +import os +import tarfile +import shutil +import subprocess +import logging +import itertools +import Queue + +try: + import cPickle as pickle +except ImportError: + import pickle + +from multiprocessing import Process, current_process, cpu_count +from multiprocessing import util, managers, connection, forking, pool + +# +# Logging +# + +def get_logger(): + return _logger + +_logger = logging.getLogger('distributing') +_logger.propogate = 0 + +util.fix_up_logger(_logger) +_formatter = logging.Formatter(util.DEFAULT_LOGGING_FORMAT) +_handler = logging.StreamHandler() +_handler.setFormatter(_formatter) +_logger.addHandler(_handler) + +info = _logger.info +debug = _logger.debug + +# +# Get number of cpus +# + +try: + slot_count = cpu_count() +except NotImplemented: + slot_count = 1 + +# +# Manager type which spawns subprocesses +# + +class HostManager(managers.SyncManager): + ''' + Manager type used for spawning processes on a (presumably) foreign host + ''' + def __init__(self, address, authkey): + managers.SyncManager.__init__(self, address, authkey) + self._name = 'Host-unknown' + + def Process(self, group=None, target=None, name=None, args=(), kwargs={}): + if hasattr(sys.modules['__main__'], '__file__'): + main_path = os.path.basename(sys.modules['__main__'].__file__) + else: + main_path = None + data = pickle.dumps((target, args, kwargs)) + p = self._RemoteProcess(data, main_path) + if name is None: + temp = self._name.split('Host-')[-1] + '/Process-%s' + name = temp % ':'.join(map(str, p.get_identity())) + p.set_name(name) + return p + + @classmethod + def from_address(cls, address, authkey): + manager = cls(address, authkey) + managers.transact(address, authkey, 'dummy') + manager._state.value = managers.State.STARTED + manager._name = 'Host-%s:%s' % manager.address + manager.shutdown = util.Finalize( + manager, HostManager._finalize_host, + args=(manager._address, manager._authkey, manager._name), + exitpriority=-10 + ) + return manager + + @staticmethod + def _finalize_host(address, authkey, name): + managers.transact(address, authkey, 'shutdown') + + def __repr__(self): + return '' % self._name + +# +# Process subclass representing a process on (possibly) a remote machine +# + +class RemoteProcess(Process): + ''' + Represents a process started on a remote host + ''' + def __init__(self, data, main_path): + assert not main_path or os.path.basename(main_path) == main_path + Process.__init__(self) + self._data = data + self._main_path = main_path + + def _bootstrap(self): + forking.prepare({'main_path': self._main_path}) + self._target, self._args, self._kwargs = pickle.loads(self._data) + return Process._bootstrap(self) + + def get_identity(self): + return self._identity + +HostManager.register('_RemoteProcess', RemoteProcess) + +# +# A Pool class that uses a cluster +# + +class DistributedPool(pool.Pool): + + def __init__(self, cluster, processes=None, initializer=None, initargs=()): + self._cluster = cluster + self.Process = cluster.Process + pool.Pool.__init__(self, processes or len(cluster), + initializer, initargs) + + def _setup_queues(self): + self._inqueue = self._cluster._SettableQueue() + self._outqueue = self._cluster._SettableQueue() + self._quick_put = self._inqueue.put + self._quick_get = self._outqueue.get + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + inqueue.set_contents([None] * size) + +# +# Manager type which starts host managers on other machines +# + +def LocalProcess(**kwds): + p = Process(**kwds) + p.set_name('localhost/' + p.get_name()) + return p + +class Cluster(managers.SyncManager): + ''' + Represents collection of slots running on various hosts. + + `Cluster` is a subclass of `SyncManager` so it allows creation of + various types of shared objects. + ''' + def __init__(self, hostlist, modules): + managers.SyncManager.__init__(self, address=('localhost', 0)) + self._hostlist = hostlist + self._modules = modules + if __name__ not in modules: + modules.append(__name__) + files = [sys.modules[name].__file__ for name in modules] + for i, file in enumerate(files): + if file.endswith('.pyc') or file.endswith('.pyo'): + files[i] = file[:-4] + '.py' + self._files = [os.path.abspath(file) for file in files] + + def start(self): + managers.SyncManager.start(self) + + l = connection.Listener(family='AF_INET', authkey=self._authkey) + + for i, host in enumerate(self._hostlist): + host._start_manager(i, self._authkey, l.address, self._files) + + for host in self._hostlist: + if host.hostname != 'localhost': + conn = l.accept() + i, address, cpus = conn.recv() + conn.close() + other_host = self._hostlist[i] + other_host.manager = HostManager.from_address(address, + self._authkey) + other_host.slots = other_host.slots or cpus + other_host.Process = other_host.manager.Process + else: + host.slots = host.slots or slot_count + host.Process = LocalProcess + + self._slotlist = [ + Slot(host) for host in self._hostlist for i in range(host.slots) + ] + self._slot_iterator = itertools.cycle(self._slotlist) + self._base_shutdown = self.shutdown + del self.shutdown + + def shutdown(self): + for host in self._hostlist: + if host.hostname != 'localhost': + host.manager.shutdown() + self._base_shutdown() + + def Process(self, group=None, target=None, name=None, args=(), kwargs={}): + slot = self._slot_iterator.next() + return slot.Process( + group=group, target=target, name=name, args=args, kwargs=kwargs + ) + + def Pool(self, processes=None, initializer=None, initargs=()): + return DistributedPool(self, processes, initializer, initargs) + + def __getitem__(self, i): + return self._slotlist[i] + + def __len__(self): + return len(self._slotlist) + + def __iter__(self): + return iter(self._slotlist) + +# +# Queue subclass used by distributed pool +# + +class SettableQueue(Queue.Queue): + def empty(self): + return not self.queue + def full(self): + return self.maxsize > 0 and len(self.queue) == self.maxsize + def set_contents(self, contents): + # length of contents must be at least as large as the number of + # threads which have potentially called get() + self.not_empty.acquire() + try: + self.queue.clear() + self.queue.extend(contents) + self.not_empty.notifyAll() + finally: + self.not_empty.release() + +Cluster.register('_SettableQueue', SettableQueue) + +# +# Class representing a notional cpu in the cluster +# + +class Slot(object): + def __init__(self, host): + self.host = host + self.Process = host.Process + +# +# Host +# + +class Host(object): + ''' + Represents a host to use as a node in a cluster. + + `hostname` gives the name of the host. If hostname is not + "localhost" then ssh is used to log in to the host. To log in as + a different user use a host name of the form + "username at somewhere.org" + + `slots` is used to specify the number of slots for processes on + the host. This affects how often processes will be allocated to + this host. Normally this should be equal to the number of cpus on + that host. + ''' + def __init__(self, hostname, slots=None): + self.hostname = hostname + self.slots = slots + + def _start_manager(self, index, authkey, address, files): + if self.hostname != 'localhost': + tempdir = copy_to_remote_temporary_directory(self.hostname, files) + debug('startup files copied to %s:%s', self.hostname, tempdir) + p = subprocess.Popen( + ['ssh', self.hostname, 'python', '-c', + '"import os; os.chdir(%r); ' + 'from distributing import main; main()"' % tempdir], + stdin=subprocess.PIPE + ) + data = dict( + name='BoostrappingHost', index=index, + dist_log_level=_logger.getEffectiveLevel(), + dir=tempdir, authkey=str(authkey), parent_address=address + ) + pickle.dump(data, p.stdin, pickle.HIGHEST_PROTOCOL) + p.stdin.close() + +# +# Copy files to remote directory, returning name of directory +# + +unzip_code = '''" +import tempfile, os, sys, tarfile +tempdir = tempfile.mkdtemp(prefix='distrib-') +os.chdir(tempdir) +tf = tarfile.open(fileobj=sys.stdin, mode='r|gz') +for ti in tf: + tf.extract(ti) +print tempdir +"''' + +def copy_to_remote_temporary_directory(host, files): + p = subprocess.Popen( + ['ssh', host, 'python', '-c', unzip_code], + stdout=subprocess.PIPE, stdin=subprocess.PIPE + ) + tf = tarfile.open(fileobj=p.stdin, mode='w|gz') + for name in files: + tf.add(name, os.path.basename(name)) + tf.close() + p.stdin.close() + return p.stdout.read().rstrip() + +# +# Code which runs a host manager +# + +def main(): + # get data from parent over stdin + data = pickle.load(sys.stdin) + sys.stdin.close() + + # set some stuff + _logger.setLevel(data['dist_log_level']) + forking.prepare(data) + + # create server for a `HostManager` object + server = managers.Server(HostManager._registry, ('', 0), data['authkey']) + current_process()._server = server + + # report server address and number of cpus back to parent + conn = connection.Client(data['parent_address'], authkey=data['authkey']) + conn.send((data['index'], server.address, slot_count)) + conn.close() + + # set name etc + current_process().set_name('Host-%s:%s' % server.address) + util._run_after_forkers() + + # register a cleanup function + def cleanup(directory): + debug('removing directory %s', directory) + shutil.rmtree(directory) + debug('shutting down host manager') + util.Finalize(None, cleanup, args=[data['dir']], exitpriority=0) + + # start host manager + debug('remote host manager starting in %s', data['dir']) + server.serve_forever() Added: python/trunk/Doc/includes/mp_newtype.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_newtype.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,98 @@ +# +# This module shows how to use arbitrary callables with a subclass of +# `BaseManager`. +# + +from multiprocessing import freeze_support +from multiprocessing.managers import BaseManager, BaseProxy +import operator + +## + +class Foo(object): + def f(self): + print 'you called Foo.f()' + def g(self): + print 'you called Foo.g()' + def _h(self): + print 'you called Foo._h()' + +# A simple generator function +def baz(): + for i in xrange(10): + yield i*i + +# Proxy type for generator objects +class GeneratorProxy(BaseProxy): + _exposed_ = ('next', '__next__') + def __iter__(self): + return self + def next(self): + return self._callmethod('next') + def __next__(self): + return self._callmethod('__next__') + +# Function to return the operator module +def get_operator_module(): + return operator + +## + +class MyManager(BaseManager): + pass + +# register the Foo class; make `f()` and `g()` accessible via proxy +MyManager.register('Foo1', Foo) + +# register the Foo class; make `g()` and `_h()` accessible via proxy +MyManager.register('Foo2', Foo, exposed=('g', '_h')) + +# register the generator function baz; use `GeneratorProxy` to make proxies +MyManager.register('baz', baz, proxytype=GeneratorProxy) + +# register get_operator_module(); make public functions accessible via proxy +MyManager.register('operator', get_operator_module) + +## + +def test(): + manager = MyManager() + manager.start() + + print '-' * 20 + + f1 = manager.Foo1() + f1.f() + f1.g() + assert not hasattr(f1, '_h') + assert sorted(f1._exposed_) == sorted(['f', 'g']) + + print '-' * 20 + + f2 = manager.Foo2() + f2.g() + f2._h() + assert not hasattr(f2, 'f') + assert sorted(f2._exposed_) == sorted(['g', '_h']) + + print '-' * 20 + + it = manager.baz() + for i in it: + print '<%d>' % i, + print + + print '-' * 20 + + op = manager.operator() + print 'op.add(23, 45) =', op.add(23, 45) + print 'op.pow(2, 94) =', op.pow(2, 94) + print 'op.getslice(range(10), 2, 6) =', op.getslice(range(10), 2, 6) + print 'op.repeat(range(5), 3) =', op.repeat(range(5), 3) + print 'op._exposed_ =', op._exposed_ + +## + +if __name__ == '__main__': + freeze_support() + test() Added: python/trunk/Doc/includes/mp_pool.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_pool.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,311 @@ +# +# A test of `multiprocessing.Pool` class +# + +import multiprocessing +import time +import random +import sys + +# +# Functions used by test code +# + +def calculate(func, args): + result = func(*args) + return '%s says that %s%s = %s' % ( + multiprocessing.current_process().get_name(), + func.__name__, args, result + ) + +def calculatestar(args): + return calculate(*args) + +def mul(a, b): + time.sleep(0.5*random.random()) + return a * b + +def plus(a, b): + time.sleep(0.5*random.random()) + return a + b + +def f(x): + return 1.0 / (x-5.0) + +def pow3(x): + return x**3 + +def noop(x): + pass + +# +# Test code +# + +def test(): + print 'cpu_count() = %d\n' % multiprocessing.cpu_count() + + # + # Create pool + # + + PROCESSES = 4 + print 'Creating pool with %d processes\n' % PROCESSES + pool = multiprocessing.Pool(PROCESSES) + print 'pool = %s' % pool + print + + # + # Tests + # + + TASKS = [(mul, (i, 7)) for i in range(10)] + \ + [(plus, (i, 8)) for i in range(10)] + + results = [pool.apply_async(calculate, t) for t in TASKS] + imap_it = pool.imap(calculatestar, TASKS) + imap_unordered_it = pool.imap_unordered(calculatestar, TASKS) + + print 'Ordered results using pool.apply_async():' + for r in results: + print '\t', r.get() + print + + print 'Ordered results using pool.imap():' + for x in imap_it: + print '\t', x + print + + print 'Unordered results using pool.imap_unordered():' + for x in imap_unordered_it: + print '\t', x + print + + print 'Ordered results using pool.map() --- will block till complete:' + for x in pool.map(calculatestar, TASKS): + print '\t', x + print + + # + # Simple benchmarks + # + + N = 100000 + print 'def pow3(x): return x**3' + + t = time.time() + A = map(pow3, xrange(N)) + print '\tmap(pow3, xrange(%d)):\n\t\t%s seconds' % \ + (N, time.time() - t) + + t = time.time() + B = pool.map(pow3, xrange(N)) + print '\tpool.map(pow3, xrange(%d)):\n\t\t%s seconds' % \ + (N, time.time() - t) + + t = time.time() + C = list(pool.imap(pow3, xrange(N), chunksize=N//8)) + print '\tlist(pool.imap(pow3, xrange(%d), chunksize=%d)):\n\t\t%s' \ + ' seconds' % (N, N//8, time.time() - t) + + assert A == B == C, (len(A), len(B), len(C)) + print + + L = [None] * 1000000 + print 'def noop(x): pass' + print 'L = [None] * 1000000' + + t = time.time() + A = map(noop, L) + print '\tmap(noop, L):\n\t\t%s seconds' % \ + (time.time() - t) + + t = time.time() + B = pool.map(noop, L) + print '\tpool.map(noop, L):\n\t\t%s seconds' % \ + (time.time() - t) + + t = time.time() + C = list(pool.imap(noop, L, chunksize=len(L)//8)) + print '\tlist(pool.imap(noop, L, chunksize=%d)):\n\t\t%s seconds' % \ + (len(L)//8, time.time() - t) + + assert A == B == C, (len(A), len(B), len(C)) + print + + del A, B, C, L + + # + # Test error handling + # + + print 'Testing error handling:' + + try: + print pool.apply(f, (5,)) + except ZeroDivisionError: + print '\tGot ZeroDivisionError as expected from pool.apply()' + else: + raise AssertionError, 'expected ZeroDivisionError' + + try: + print pool.map(f, range(10)) + except ZeroDivisionError: + print '\tGot ZeroDivisionError as expected from pool.map()' + else: + raise AssertionError, 'expected ZeroDivisionError' + + try: + print list(pool.imap(f, range(10))) + except ZeroDivisionError: + print '\tGot ZeroDivisionError as expected from list(pool.imap())' + else: + raise AssertionError, 'expected ZeroDivisionError' + + it = pool.imap(f, range(10)) + for i in range(10): + try: + x = it.next() + except ZeroDivisionError: + if i == 5: + pass + except StopIteration: + break + else: + if i == 5: + raise AssertionError, 'expected ZeroDivisionError' + + assert i == 9 + print '\tGot ZeroDivisionError as expected from IMapIterator.next()' + print + + # + # Testing timeouts + # + + print 'Testing ApplyResult.get() with timeout:', + res = pool.apply_async(calculate, TASKS[0]) + while 1: + sys.stdout.flush() + try: + sys.stdout.write('\n\t%s' % res.get(0.02)) + break + except multiprocessing.TimeoutError: + sys.stdout.write('.') + print + print + + print 'Testing IMapIterator.next() with timeout:', + it = pool.imap(calculatestar, TASKS) + while 1: + sys.stdout.flush() + try: + sys.stdout.write('\n\t%s' % it.next(0.02)) + except StopIteration: + break + except multiprocessing.TimeoutError: + sys.stdout.write('.') + print + print + + # + # Testing callback + # + + print 'Testing callback:' + + A = [] + B = [56, 0, 1, 8, 27, 64, 125, 216, 343, 512, 729] + + r = pool.apply_async(mul, (7, 8), callback=A.append) + r.wait() + + r = pool.map_async(pow3, range(10), callback=A.extend) + r.wait() + + if A == B: + print '\tcallbacks succeeded\n' + else: + print '\t*** callbacks failed\n\t\t%s != %s\n' % (A, B) + + # + # Check there are no outstanding tasks + # + + assert not pool._cache, 'cache = %r' % pool._cache + + # + # Check close() methods + # + + print 'Testing close():' + + for worker in pool._pool: + assert worker.is_alive() + + result = pool.apply_async(time.sleep, [0.5]) + pool.close() + pool.join() + + assert result.get() is None + + for worker in pool._pool: + assert not worker.is_alive() + + print '\tclose() succeeded\n' + + # + # Check terminate() method + # + + print 'Testing terminate():' + + pool = multiprocessing.Pool(2) + DELTA = 0.1 + ignore = pool.apply(pow3, [2]) + results = [pool.apply_async(time.sleep, [DELTA]) for i in range(100)] + pool.terminate() + pool.join() + + for worker in pool._pool: + assert not worker.is_alive() + + print '\tterminate() succeeded\n' + + # + # Check garbage collection + # + + print 'Testing garbage collection:' + + pool = multiprocessing.Pool(2) + DELTA = 0.1 + processes = pool._pool + ignore = pool.apply(pow3, [2]) + results = [pool.apply_async(time.sleep, [DELTA]) for i in range(100)] + + results = pool = None + + time.sleep(DELTA * 2) + + for worker in processes: + assert not worker.is_alive() + + print '\tgarbage collection succeeded\n' + + +if __name__ == '__main__': + multiprocessing.freeze_support() + + assert len(sys.argv) in (1, 2) + + if len(sys.argv) == 1 or sys.argv[1] == 'processes': + print ' Using processes '.center(79, '-') + elif sys.argv[1] == 'threads': + print ' Using threads '.center(79, '-') + import multiprocessing.dummy as multiprocessing + else: + print 'Usage:\n\t%s [processes | threads]' % sys.argv[0] + raise SystemExit(2) + + test() Added: python/trunk/Doc/includes/mp_synchronize.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_synchronize.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,273 @@ +# +# A test file for the `multiprocessing` package +# + +import time, sys, random +from Queue import Empty + +import multiprocessing # may get overwritten + + +#### TEST_VALUE + +def value_func(running, mutex): + random.seed() + time.sleep(random.random()*4) + + mutex.acquire() + print '\n\t\t\t' + str(multiprocessing.current_process()) + ' has finished' + running.value -= 1 + mutex.release() + +def test_value(): + TASKS = 10 + running = multiprocessing.Value('i', TASKS) + mutex = multiprocessing.Lock() + + for i in range(TASKS): + p = multiprocessing.Process(target=value_func, args=(running, mutex)) + p.start() + + while running.value > 0: + time.sleep(0.08) + mutex.acquire() + print running.value, + sys.stdout.flush() + mutex.release() + + print + print 'No more running processes' + + +#### TEST_QUEUE + +def queue_func(queue): + for i in range(30): + time.sleep(0.5 * random.random()) + queue.put(i*i) + queue.put('STOP') + +def test_queue(): + q = multiprocessing.Queue() + + p = multiprocessing.Process(target=queue_func, args=(q,)) + p.start() + + o = None + while o != 'STOP': + try: + o = q.get(timeout=0.3) + print o, + sys.stdout.flush() + except Empty: + print 'TIMEOUT' + + print + + +#### TEST_CONDITION + +def condition_func(cond): + cond.acquire() + print '\t' + str(cond) + time.sleep(2) + print '\tchild is notifying' + print '\t' + str(cond) + cond.notify() + cond.release() + +def test_condition(): + cond = multiprocessing.Condition() + + p = multiprocessing.Process(target=condition_func, args=(cond,)) + print cond + + cond.acquire() + print cond + cond.acquire() + print cond + + p.start() + + print 'main is waiting' + cond.wait() + print 'main has woken up' + + print cond + cond.release() + print cond + cond.release() + + p.join() + print cond + + +#### TEST_SEMAPHORE + +def semaphore_func(sema, mutex, running): + sema.acquire() + + mutex.acquire() + running.value += 1 + print running.value, 'tasks are running' + mutex.release() + + random.seed() + time.sleep(random.random()*2) + + mutex.acquire() + running.value -= 1 + print '%s has finished' % multiprocessing.current_process() + mutex.release() + + sema.release() + +def test_semaphore(): + sema = multiprocessing.Semaphore(3) + mutex = multiprocessing.RLock() + running = multiprocessing.Value('i', 0) + + processes = [ + multiprocessing.Process(target=semaphore_func, + args=(sema, mutex, running)) + for i in range(10) + ] + + for p in processes: + p.start() + + for p in processes: + p.join() + + +#### TEST_JOIN_TIMEOUT + +def join_timeout_func(): + print '\tchild sleeping' + time.sleep(5.5) + print '\n\tchild terminating' + +def test_join_timeout(): + p = multiprocessing.Process(target=join_timeout_func) + p.start() + + print 'waiting for process to finish' + + while 1: + p.join(timeout=1) + if not p.is_alive(): + break + print '.', + sys.stdout.flush() + + +#### TEST_EVENT + +def event_func(event): + print '\t%r is waiting' % multiprocessing.current_process() + event.wait() + print '\t%r has woken up' % multiprocessing.current_process() + +def test_event(): + event = multiprocessing.Event() + + processes = [multiprocessing.Process(target=event_func, args=(event,)) + for i in range(5)] + + for p in processes: + p.start() + + print 'main is sleeping' + time.sleep(2) + + print 'main is setting event' + event.set() + + for p in processes: + p.join() + + +#### TEST_SHAREDVALUES + +def sharedvalues_func(values, arrays, shared_values, shared_arrays): + for i in range(len(values)): + v = values[i][1] + sv = shared_values[i].value + assert v == sv + + for i in range(len(values)): + a = arrays[i][1] + sa = list(shared_arrays[i][:]) + assert a == sa + + print 'Tests passed' + +def test_sharedvalues(): + values = [ + ('i', 10), + ('h', -2), + ('d', 1.25) + ] + arrays = [ + ('i', range(100)), + ('d', [0.25 * i for i in range(100)]), + ('H', range(1000)) + ] + + shared_values = [multiprocessing.Value(id, v) for id, v in values] + shared_arrays = [multiprocessing.Array(id, a) for id, a in arrays] + + p = multiprocessing.Process( + target=sharedvalues_func, + args=(values, arrays, shared_values, shared_arrays) + ) + p.start() + p.join() + + assert p.get_exitcode() == 0 + + +#### + +def test(namespace=multiprocessing): + global multiprocessing + + multiprocessing = namespace + + for func in [ test_value, test_queue, test_condition, + test_semaphore, test_join_timeout, test_event, + test_sharedvalues ]: + + print '\n\t######## %s\n' % func.__name__ + func() + + ignore = multiprocessing.active_children() # cleanup any old processes + if hasattr(multiprocessing, '_debug_info'): + info = multiprocessing._debug_info() + if info: + print info + raise ValueError, 'there should be no positive refcounts left' + + +if __name__ == '__main__': + multiprocessing.freeze_support() + + assert len(sys.argv) in (1, 2) + + if len(sys.argv) == 1 or sys.argv[1] == 'processes': + print ' Using processes '.center(79, '-') + namespace = multiprocessing + elif sys.argv[1] == 'manager': + print ' Using processes and a manager '.center(79, '-') + namespace = multiprocessing.Manager() + namespace.Process = multiprocessing.Process + namespace.current_process = multiprocessing.current_process + namespace.active_children = multiprocessing.active_children + elif sys.argv[1] == 'threads': + print ' Using threads '.center(79, '-') + import multiprocessing.dummy as namespace + else: + print 'Usage:\n\t%s [processes | manager | threads]' % sys.argv[0] + raise SystemExit, 2 + + test(namespace) Added: python/trunk/Doc/includes/mp_webserver.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_webserver.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,67 @@ +# +# Example where a pool of http servers share a single listening socket +# +# On Windows this module depends on the ability to pickle a socket +# object so that the worker processes can inherit a copy of the server +# object. (We import `multiprocessing.reduction` to enable this pickling.) +# +# Not sure if we should synchronize access to `socket.accept()` method by +# using a process-shared lock -- does not seem to be necessary. +# + +import os +import sys + +from multiprocessing import Process, current_process, freeze_support +from BaseHTTPServer import HTTPServer +from SimpleHTTPServer import SimpleHTTPRequestHandler + +if sys.platform == 'win32': + import multiprocessing.reduction # make sockets pickable/inheritable + + +def note(format, *args): + sys.stderr.write('[%s]\t%s\n' % (current_process().get_name(),format%args)) + + +class RequestHandler(SimpleHTTPRequestHandler): + # we override log_message() to show which process is handling the request + def log_message(self, format, *args): + note(format, *args) + +def serve_forever(server): + note('starting server') + try: + server.serve_forever() + except KeyboardInterrupt: + pass + + +def runpool(address, number_of_processes): + # create a single server object -- children will each inherit a copy + server = HTTPServer(address, RequestHandler) + + # create child processes to act as workers + for i in range(number_of_processes-1): + Process(target=serve_forever, args=(server,)).start() + + # main process also acts as a worker + serve_forever(server) + + +def test(): + DIR = os.path.join(os.path.dirname(__file__), '..') + ADDRESS = ('localhost', 8000) + NUMBER_OF_PROCESSES = 4 + + print 'Serving at http://%s:%d using %d worker processes' % \ + (ADDRESS[0], ADDRESS[1], NUMBER_OF_PROCESSES) + print 'To exit press Ctrl-' + ['C', 'Break'][sys.platform=='win32'] + + os.chdir(DIR) + runpool(ADDRESS, NUMBER_OF_PROCESSES) + + +if __name__ == '__main__': + freeze_support() + test() Added: python/trunk/Doc/includes/mp_workers.py ============================================================================== --- (empty file) +++ python/trunk/Doc/includes/mp_workers.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,87 @@ +# +# Simple example which uses a pool of workers to carry out some tasks. +# +# Notice that the results will probably not come out of the output +# queue in the same in the same order as the corresponding tasks were +# put on the input queue. If it is important to get the results back +# in the original order then consider using `Pool.map()` or +# `Pool.imap()` (which will save on the amount of code needed anyway). +# + +import time +import random + +from multiprocessing import Process, Queue, current_process, freeze_support + +# +# Function run by worker processes +# + +def worker(input, output): + for func, args in iter(input.get, 'STOP'): + result = calculate(func, args) + output.put(result) + +# +# Function used to calculate result +# + +def calculate(func, args): + result = func(*args) + return '%s says that %s%s = %s' % \ + (current_process().get_name(), func.__name__, args, result) + +# +# Functions referenced by tasks +# + +def mul(a, b): + time.sleep(0.5*random.random()) + return a * b + +def plus(a, b): + time.sleep(0.5*random.random()) + return a + b + +# +# +# + +def test(): + NUMBER_OF_PROCESSES = 4 + TASKS1 = [(mul, (i, 7)) for i in range(20)] + TASKS2 = [(plus, (i, 8)) for i in range(10)] + + # Create queues + task_queue = Queue() + done_queue = Queue() + + # Submit tasks + for task in TASKS1: + task_queue.put(task) + + # Start worker processes + for i in range(NUMBER_OF_PROCESSES): + Process(target=worker, args=(task_queue, done_queue)).start() + + # Get and print results + print 'Unordered results:' + for i in range(len(TASKS1)): + print '\t', done_queue.get() + + # Add more tasks using `put()` + for task in TASKS2: + task_queue.put(task) + + # Get and print some more results + for i in range(len(TASKS2)): + print '\t', done_queue.get() + + # Tell child processes to stop + for i in range(NUMBER_OF_PROCESSES): + task_queue.put('STOP') + + +if __name__ == '__main__': + freeze_support() + test() Added: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- (empty file) +++ python/trunk/Doc/library/multiprocessing.rst Wed Jun 11 04:40:25 2008 @@ -0,0 +1,2108 @@ +:mod:`multiprocessing` --- Process-based "threading" interface +============================================================== + +.. module:: multiprocessing + :synopsis: Process-based "threading" interface. + +.. versionadded:: 2.6 + +:mod:`multiprocessing` is a package for the Python language which supports the +spawning of processes using a similar API of the :mod:`threading` module. It +runs on both Unix and Windows. + +The :mod:`multiprocessing` module offers the capability of both local and remote +concurrency effectively side-stepping the Global Interpreter Lock by utilizing +subprocesses for "threads". Due to this, the :mod:`multiprocessing` module +allows the programmer to fully leverage multiple processors on a given machine. + + +Introduction +------------ + + +Threads, processes and the GIL +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To run more than one piece of code at the same time on the same computer one has +the choice of either using multiple processes or multiple threads. + +Although a program can be made up of multiple processes, these processes are in +effect completely independent of one another: different processes are not able +to cooperate with one another unless one sets up some means of communication +between them (such as by using sockets). If a lot of data must be transferred +between processes then this can be inefficient. + +On the other hand, multiple threads within a single process are intimately +connected: they share their data but often can interfere badly with one another. +It is often argued that the only way to make multithreaded programming "easy" is +to avoid relying on any shared state and for the threads to only communicate by +passing messages to each other. + +CPython has a *Global Interpreter Lock* (GIL) which in many ways makes threading +easier than it is in most languages by making sure that only one thread can +manipulate the interpreter's objects at a time. As a result, it is often safe +to let multiple threads access data without using any additional locking as one +would need to in a language such as C. + +One downside of the GIL is that on multi-processor (or multi-core) systems a +multithreaded Python program can only make use of one processor at a time unless +your application makes heavy use of I/O which effectively side-steps this. This +is a problem that can be overcome by using multiple processes instead. + +This package allows one to write multi-process programs using much the same API +that one uses for writing threaded programs. + + +Forking and spawning +~~~~~~~~~~~~~~~~~~~~ + +There are two ways of creating a new process in Python: + +* The current process can *fork* a new child process by using the + :func:`os.fork` function. This effectively creates an identical copy of the + current process which is now able to go off and perform some task set by the + parent process. This means that the child process inherits *copies* of all + variables that the parent process had. However, :func:`os.fork` is not + available on every platform: in particular Windows does not support it. + +* Alternatively, the current process can spawn a completely new Python + interpreter by using the :mod:`subprocess` module or one of the + :func:`os.spawn*` functions. Getting this new interpreter in to a fit state + to perform the task set for it by its parent process is, however, a bit of a + challenge. + +The :mod:`multiprocessing` module uses :func:`os.fork` if it is available since +it makes life a lot simpler. Forking the process is also more efficient in +terms of memory usage and the time needed to create the new process. + + +The :class:`Process` class +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In :mod:`multiprocessing`, processes are spawned by creating a :class:`Process` +object and then calling its :meth:`Process.start` method. :class:`Process` +follows the API of :class:`threading.Thread`. A trivial example of a +multiprocess program is :: + + from multiprocessing import Process + + def f(name): + print 'hello', name + + if __name__ == '__main__': + p = Process(target=f, args=('bob',)) + p.start() + p.join() + +Here the function ``f`` is run in a child process. + +For an explanation of why (on Windows) the ``if __name__ == '__main__'`` part is +necessary, see :ref:`multiprocessing-programming`. + + + +Exchanging objects between processes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:mod:`multiprocessing` supports two types of communication channel between +processes: + +**Queues** + + The :class:`Queue` class is a near clone of :class:`Queue.Queue`. For + example:: + + from multiprocessing import Process, Queue + + def f(q): + q.put([42, None, 'hello']) + + if __name__ == '__main__': + q = Queue() + p = Process(target=f, args=(q,)) + p.start() + print q.get() # prints "[42, None, 'hello']" + p.join() + + Queues are thread and process safe. + +**Pipes** + + The :func:`Pipe` function returns a pair of connection objects connected by a + pipe which by default is duplex (two-way). For example:: + + from multiprocessing import Process, Pipe + + def f(conn): + conn.send([42, None, 'hello']) + conn.close() + + if __name__ == '__main__': + parent_conn, child_conn = Pipe() + p = Process(target=f, args=(child_conn,)) + p.start() + print parent_conn.recv() # prints "[42, None, 'hello']" + p.join() + + The two connection objects returned by :func:`Pipe` represent the two ends of + the pipe. Each connection object has :meth:`send` and :meth:`recv` methods + (among others). Note that data in a pipe may become corrupted if two + processes (or threads) try to read from or write to the *same* end of the + pipe at the same time. Of course there is no risk of corruption from + processes using different ends of the pipe at the same time. + + +Synchronization between processes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:mod:`multiprocessing` contains equivalents of all the synchronization +primitives from :mod:`threading`. For instance one can use a lock to ensure +that only one process prints to standard output at a time:: + + from multiprocessing import Process, Lock + + def f(l, i): + l.acquire() + print 'hello world', i + l.release() + + if __name__ == '__main__': + lock = Lock() + + for num in range(10): + Process(target=f, args=(lock, num)).start() + +Without using the lock output from the different processes is liable to get all +mixed up. + + +Sharing state between processes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +As mentioned above, when doing concurrent programming it is usually best to +avoid using shared state as far as possible. This is particularly true when +using multiple processes. + +However, if you really do need to use some shared data then +:mod:`multiprocessing` provides a couple of ways of doing so. + +**Shared memory** + + Data can be stored in a shared memory map using :class:`Value` or + :class:`Array`. For example, the following code :: + + from multiprocessing import Process, Value, Array + + def f(n, a): + n.value = 3.1415927 + for i in range(len(a)): + a[i] = -a[i] + + if __name__ == '__main__': + num = Value('d', 0.0) + arr = Array('i', range(10)) + + p = Process(target=f, args=(num, arr)) + p.start() + p.join() + + print num.value + print arr[:] + + will print :: + + 3.1415927 + [0, -1, -2, -3, -4, -5, -6, -7, -8, -9] + + The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are + typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a + double precision float and ``'i'`` inidicates a signed integer. These shared + objects will be process and thread safe. + + For more flexibility in using shared memory one can use the + :mod:`multiprocessing.sharedctypes` module which supports the creation of + arbitrary ctypes objects allocated from shared memory. + +**Server process** + + A manager object returned by :func:`Manager` controls a server process which + holds python objects and allows other processes to manipulate them using + proxies. + + A manager returned by :func:`Manager` will support types :class:`list`, + :class:`dict`, :class:`Namespace`, :class:`Lock`, :class:`RLock`, + :class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`, + :class:`Event`, :class:`Queue`, :class:`Value` and :class:`Array`. For + example, :: + + from multiprocessing import Process, Manager + + def f(d, l): + d[1] = '1' + d['2'] = 2 + d[0.25] = None + l.reverse() + + if __name__ == '__main__': + manager = Manager() + + d = manager.dict() + l = manager.list(range(10)) + + p = Process(target=f, args=(d, l)) + p.start() + p.join() + + print d + print l + + will print :: + + {0.25: None, 1: '1', '2': 2} + [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + + Server process managers are more flexible than using shared memory objects + because they can be made to support arbitrary object types. Also, a single + manager can be shared by processes on different computers over a network. + They are, however, slower than using shared memory. + + +Using a pool of workers +~~~~~~~~~~~~~~~~~~~~~~~ + +The :class:`multiprocessing.pool.Pool()` class represens a pool of worker +processes. It has methods which allows tasks to be offloaded to the worker +processes in a few different ways. + +For example:: + + from multiprocessing import Pool + + def f(x): + return x*x + + if __name__ == '__main__': + pool = Pool(processes=4) # start 4 worker processes + result = pool.applyAsync(f, [10]) # evaluate "f(10)" asynchronously + print result.get(timeout=1) # prints "100" unless your computer is *very* slow + print pool.map(f, range(10)) # prints "[0, 1, 4,..., 81]" + + +Reference +--------- + +The :mod:`multiprocessing` package mostly replicates the API of the +:mod:`threading` module. + + +:class:`Process` and exceptions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. class:: Process([group[, target[, name[, args[, kwargs]]]]]) + + Process objects represent activity that is run in a separate process. The + :class:`Process` class has equivalents of all the methods of + :class:`threading.Thread`. + + The constructor should always be called with keyword arguments. *group* + should always be ``None``; it exists soley for compatibility with + :class:`threading.Thread`. *target* is the callable object to be invoked by + the :meth:`run()` method. It defaults to None, meaning nothing is + called. *name* is the process name. By default, a unique name is constructed + of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\ + :sub:`1`,N\ :sub:`2`,...,N\ :sub:`k` is a sequence of integers whose length + is determined by the *generation* of the process. *args* is the argument + tuple for the target invocation. *kwargs* is a dictionary of keyword + arguments for the target invocation. By default, no arguments are passed to + *target*. + + If a subclass overrides the constructor, it must make sure it invokes the + base class constructor (:meth:`Process.__init__`) before doing anything else + to the process. + + .. method:: run() + + Method representing the process's activity. + + You may override this method in a subclass. The standard :meth:`run` + method invokes the callable object passed to the object's constructor as + the target argument, if any, with sequential and keyword arguments taken + from the *args* and *kwargs* arguments, respectively. + + .. method:: start() + + Start the process's activity. + + This must be called at most once per process object. It arranges for the + object's :meth:`run` method to be invoked in a separate process. + + .. method:: join([timeout]) + + Block the calling thread until the process whose :meth:`join` method is + called terminates or until the optional timeout occurs. + + If *timeout* is ``None`` then there is no timeout. + + A process can be joined many times. + + A process cannot join itself because this would cause a deadlock. It is + an error to attempt to join a process before it has been started. + + .. method:: get_name() + + Return the process's name. + + .. method:: set_name(name) + + Set the process's name. + + The name is a string used for identification purposes only. It has no + semantics. Multiple processes may be given the same name. The initial + name is set by the constructor. + + .. method:: is_alive() + + Return whether the process is alive. + + Roughly, a process object is alive from the moment the :meth:`start` + method returns until the child process terminates. + + .. method:: is_daemon() + + Return the process's daemon flag. + + .. method:: set_daemon(daemonic) + + Set the process's daemon flag to the Boolean value *daemonic*. This must + be called before :meth:`start` is called. + + The initial value is inherited from the creating process. + + When a process exits, it attempts to terminate all of its daemonic child + processes. + + Note that a daemonic process is not allowed to create child processes. + Otherwise a daemonic process would leave its children orphaned if it gets + terminated when its parent process exits. + + In addition process objects also support the following methods: + + .. method:: get_pid() + + Return the process ID. Before the process is spawned, this will be + ``None``. + + .. method:: get_exit_code() + + Return the child's exit code. This will be ``None`` if the process has + not yet terminated. A negative value *-N* indicates that the child was + terminated by signal *N*. + + .. method:: get_auth_key() + + Return the process's authentication key (a byte string). + + When :mod:`multiprocessing` is initialized the main process is assigned a + random string using :func:`os.random`. + + When a :class:`Process` object is created, it will inherit the + authentication key of its parent process, although this may be changed + using :meth:`set_auth_key` below. + + See :ref:`multiprocessing-auth-keys`. + + .. method:: set_auth_key(authkey) + + Set the process's authentication key which must be a byte string. + + .. method:: terminate()` + + Terminate the process. On Unix this is done using the ``SIGTERM`` signal, + on Windows ``TerminateProcess()`` is used. Note that exit handlers and + finally clauses etc will not be executed. + + Note that descendant processes of the process will *not* be terminated -- + they will simply become orphaned. + + .. warning:: + + If this method is used when the associated process is using a pipe or + queue then the pipe or queue is liable to become corrupted and may + become unusable by other process. Similarly, if the process has + acquired a lock or semaphore etc. then terminating it is liable to + cause other processes to deadlock. + + Note that the :meth:`start`, :meth:`join`, :meth:`is_alive` and + :meth:`get_exit_code` methods should only be called by the process that + created the process object. + + Example usage of some of the methods of :class:`Process`:: + + >>> import processing, time, signal + >>> p = processing.Process(target=time.sleep, args=(1000,)) + >>> print p, p.is_alive() + False + >>> p.start() + >>> print p, p.is_alive() + True + >>> p.terminate() + >>> print p, p.is_alive() + False + >>> p.get_exit_code() == -signal.SIGTERM + True + + +.. exception:: BufferTooShort + + Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied + buffer object is too small for the message read. + + If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give + the message as a byte string. + + +Pipes and Queues +~~~~~~~~~~~~~~~~ + +When using multiple processes, one generally uses message passing for +communication between processes and avoids having to use any synchronization +primitives like locks. + +For passing messages one can use :func:`Pipe` (for a connection between two +processes) or a queue (which allows multiple producers and consumers). + +The :class:`Queue` and :class:`JoinableQueue` types are multi-producer, +multi-consumer FIFO queues modelled on the :class:`Queue.Queue` class in the +standard library. They differ in that :class:`Queue` lacks the +:meth:`task_done` and :meth:`join` methods introduced into Python 2.5's +:class:`Queue.Queue` class. + +If you use :class:`JoinableQueue` then you **must** call +:meth:`JoinableQueue.task_done` for each task removed from the queue or else the +semaphore used to count the number of unfinished tasks may eventually overflow +raising an exception. + +.. note:: + + :mod:`multiprocessing` uses the usual :exc:`Queue.Empty` and + :exc:`Queue.Full` exceptions to signal a timeout. They are not available in + the :mod:`multiprocessing` namespace so you need to import them from + :mod:`Queue`. + + +.. warning:: + + If a process is killed using :meth:`Process.terminate` or :func:`os.kill` + while it is trying to use a :class:`Queue`, then the data in the queue is + likely to become corrupted. This may cause any other processes to get an + exception when it tries to use the queue later on. + +.. warning:: + + As mentioned above, if a child process has put items on a queue (and it has + not used :meth:`JoinableQueue.cancel_join_thread`), then that process will + not terminate until all buffered items have been flushed to the pipe. + + This means that if you try joining that process you may get a deadlock unless + you are sure that all items which have been put on the queue have been + consumed. Similarly, if the child process is non-daemonic then the parent + process may hang on exit when it tries to join all it non-daemonic children. + + Note that a queue created using a manager does not have this issue. See + :ref:`multiprocessing-programming`. + +Note that one can also create a shared queue by using a manager object -- see +:ref:`multiprocessing-managers`. + +For an example of the usage of queues for interprocess communication see +:ref:`multiprocessing-examples`. + + +.. function:: Pipe([duplex]) + + Returns a pair ``(conn1, conn2)`` of :class:`Connection` objects representing + the ends of a pipe. + + If *duplex* is ``True`` (the default) then the pipe is bidirectional. If + *duplex* is ``False`` then the pipe is unidirectional: ``conn1`` can only be + used for receiving messages and ``conn2`` can only be used for sending + messages. + + +.. class:: Queue([maxsize]) + + Returns a process shared queue implemented using a pipe and a few + locks/semaphores. When a process first puts an item on the queue a feeder + thread is started which transfers objects from a buffer into the pipe. + + The usual :exc:`Queue.Empty` and :exc:`Queue.Full` exceptions from the + standard library's :mod:`Queue` module are raised to signal timeouts. + + :class:`Queue` implements all the methods of :class:`Queue.Queue` except for + :meth:`task_done` and :meth:`join`. + + .. method:: qsize() + + Return the approximate size of the queue. Because of + multithreading/multiprocessing semantics, this number is not reliable. + + Note that this may raise :exc:`NotImplementedError` on Unix platforms like + MacOS X where ``sem_getvalue()`` is not implemented. + + .. method:: empty() + + Return ``True`` if the queue is empty, ``False`` otherwise. Because of + multithreading/multiprocessing semantics, this is not reliable. + + .. method:: full() + + Return ``True`` if the queue is full, ``False`` otherwise. Because of + multithreading/multiprocessing semantics, this is not reliable. + + .. method:: put(item[, block[, timeout]])` + + Put item into the queue. If optional args *block* is ``True`` (the + default) and *timeout* is ``None`` (the default), block if necessary until + a free slot is available. If *timeout* is a positive number, it blocks at + most *timeout* seconds and raises the :exc:`Queue.Full` exception if no + free slot was available within that time. Otherwise (*block* is + ``False``), put an item on the queue if a free slot is immediately + available, else raise the :exc:`Queue.Full` exception (*timeout* is + ignored in that case). + + .. method:: put_nowait(item) + + Equivalent to ``put(item, False)``. + + .. method:: get([block[, timeout]]) + + Remove and return an item from the queue. If optional args *block* is + ``True`` (the default) and *timeout* is ``None`` (the default), block if + necessary until an item is available. If *timeout* is a positive number, + it blocks at most *timeout* seconds and raises the :exc:`Queue.Empty` + exception if no item was available within that time. Otherwise (block is + ``False``), return an item if one is immediately available, else raise the + :exc:`Queue.Empty` exception (*timeout* is ignored in that case). + + .. method:: get_nowait() + get_no_wait() + + Equivalent to ``get(False)``. + + :class:`multiprocessing.Queue` has a few additional methods not found in + :class:`Queue.Queue` which are usually unnecessary: + + .. method:: close() + + Indicate that no more data will be put on this queue by the current + process. The background thread will quit once it has flushed all buffered + data to the pipe. This is called automatically when the queue is garbage + collected. + + .. method:: join_thread() + + Join the background thread. This can only be used after :meth:`close` has + been called. It blocks until the background thread exits, ensuring that + all data in the buffer has been flushed to the pipe. + + By default if a process is not the creator of the queue then on exit it + will attempt to join the queue's background thread. The process can call + :meth:`cancel_join_thread()` to make :meth:`join_thread()` do nothing. + + .. method:: cancel_join_thread() + + Prevent :meth:`join_thread` from blocking. In particular, this prevents + the background thread from being joined automatically when the process + exits -- see :meth:`join_thread()`. + + +.. class:: JoinableQueue([maxsize]) + + :class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which + additionally has :meth:`task_done` and :meth:`join` methods. + + .. method:: task_done() + + Indicate that a formerly enqueued task is complete. Used by queue consumer + threads. For each :meth:`get` used to fetch a task, a subsequent call to + :meth:`task_done` tells the queue that the processing on the task is + complete. + + If a :meth:`join` is currently blocking, it will resume when all items + have been processed (meaning that a :meth:`task_done` call was received + for every item that had been :meth:`put` into the queue). + + Raises a :exc:`ValueError` if called more times than there were items + placed in the queue. + + + .. method:: join() + + Block until all items in the queue have been gotten and processed. + + The count of unfinished tasks goes up whenever an item is added to the + queue. The count goes down whenever a consumer thread calls + :meth:`task_done` to indicate that the item was retrieved and all work on + it is complete. When the count of unfinished tasks drops to zero, + :meth:`join` unblocks. + + +Miscellaneous +~~~~~~~~~~~~~ + +.. function:: active_children() + + Return list of all live children of the current process. + + Calling this has the side affect of "joining" any processes which have + already finished. + +.. function:: cpu_count() + + Return the number of CPUs in the system. May raise + :exc:`NotImplementedError`. + +.. function:: current_process() + + Return the :class:`Process` object corresponding to the current process. + + An analogue of :func:`threading.current_thread`. + +.. function:: freeze_support() + + Add support for when a program which uses :mod:`multiprocessing` has been + frozen to produce a Windows executable. (Has been tested with **py2exe**, + **PyInstaller** and **cx_Freeze**.) + + One needs to call this function straight after the ``if __name__ == + '__main__'`` line of the main module. For example:: + + from multiprocessing import Process, freeze_support + + def f(): + print 'hello world!' + + if __name__ == '__main__': + freeze_support() + Process(target=f).start() + + If the :func:`freeze_support()` line is missed out then trying to run the + frozen executable will raise :exc:`RuntimeError`. + + If the module is being run normally by the Python interpreter then + :func:`freeze_support()` has no effect. + +.. function:: set_executable() + + Sets the path of the python interpreter to use when starting a child process. + (By default `sys.executable` is used). Embedders will probably need to do + some thing like :: + + setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe')) + + before they can create child processes. (Windows only) + + +.. note:: + + :mod:`multiprocessing` contains no analogues of + :func:`threading.active_count`, :func:`threading.enumerate`, + :func:`threading.settrace`, :func:`threading.setprofile`, + :class:`threading.Timer`, or :class:`threading.local`. + + +Connection Objects +~~~~~~~~~~~~~~~~~~ + +Connection objects allow the sending and receiving of picklable objects or +strings. They can be thought of as message oriented connected sockets. + +Connection objects usually created using :func:`Pipe()` -- see also +:ref:`multiprocessing-listeners-clients`. + +.. class:: Connection + + .. method:: send(obj) + + Send an object to the other end of the connection which should be read + using :meth:`recv`. + + The object must be picklable. + + .. method:: recv() + + Return an object sent from the other end of the connection using + :meth:`send`. Raises :exc:`EOFError` if there is nothing left to receive + and the other end was closed. + + .. method:: fileno() + + Returns the file descriptor or handle used by the connection. + + .. method:: close() + + Close the connection. + + This is called automatically when the connection is garbage collected. + + .. method:: poll([timeout]) + + Return whether there is any data available to be read. + + If *timeout* is not specified then it will return immediately. If + *timeout* is a number then this specifies the maximum time in seconds to + block. If *timeout* is ``None`` then an infinite timeout is used. + + .. method:: send_bytes(buffer[, offset[, size]]) + + Send byte data from an object supporting the buffer interface as a + complete message. + + If *offset* is given then data is read from that position in *buffer*. If + *size* is given then that many bytes will be read from buffer. + + .. method:: recv_bytes([maxlength]) + + Return a complete message of byte data sent from the other end of the + connection as a string. Raises :exc:`EOFError` if there is nothing left + to receive and the other end has closed. + + If *maxlength* is specified and the message is longer than *maxlength* + then :exc:`IOError` is raised and the connection will no longer be + readable. + + .. method:: recv_bytes_into(buffer[, offset]) + + Read into *buffer* a complete message of byte data sent from the other end + of the connection and return the number of bytes in the message. Raises + :exc:`EOFError` if there is nothing left to receive and the other end was + closed. + + *buffer* must be an object satisfying the writable buffer interface. If + *offset* is given then the message will be written into the buffer from + *that position. Offset must be a non-negative integer less than the + *length of *buffer* (in bytes). + + If the buffer is too short then a :exc:`BufferTooShort` exception is + raised and the complete message is available as ``e.args[0]`` where ``e`` + is the exception instance. + + +For example: + + >>> from multiprocessing import Pipe + >>> a, b = Pipe() + >>> a.send([1, 'hello', None]) + >>> b.recv() + [1, 'hello', None] + >>> b.send_bytes('thank you') + >>> a.recv_bytes() + 'thank you' + >>> import array + >>> arr1 = array.array('i', range(5)) + >>> arr2 = array.array('i', [0] * 10) + >>> a.send_bytes(arr1) + >>> count = b.recv_bytes_into(arr2) + >>> assert count == len(arr1) * arr1.itemsize + >>> arr2 + array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0]) + + +.. warning:: + + The :meth:`Connection.recv` method automatically unpickles the data it + receives, which can be a security risk unless you can trust the process + which sent the message. + + Therefore, unless the connection object was produced using :func:`Pipe()` + you should only use the `recv()` and `send()` methods after performing some + sort of authentication. See :ref:`multiprocessing-auth-keys`. + +.. warning:: + + If a process is killed while it is trying to read or write to a pipe then + the data in the pipe is likely to become corrupted, because it may become + impossible to be sure where the message boundaries lie. + + +Synchronization primitives +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Generally synchronization primitives are not as necessary in a multiprocess +program as they are in a mulithreaded program. See the documentation for the +standard library's :mod:`threading` module. + +Note that one can also create synchronization primitives by using a manager +object -- see :ref:`multiprocessing-managers`. + +.. class:: BoundedSemaphore([value]) + + A bounded semaphore object: a clone of :class:`threading.BoundedSemaphore`. + + (On Mac OSX this is indistiguishable from :class:`Semaphore` because + ``sem_getvalue()`` is not implemented on that platform). + +.. class:: Condition([lock]) + + A condition variable: a clone of `threading.Condition`. + + If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` + object from :mod:`multiprocessing`. + +.. class:: Event() + + A clone of :class:`threading.Event`. + +.. class:: Lock() + + A non-recursive lock object: a clone of :class:`threading.Lock`. + +.. class:: RLock() + + A recursive lock object: a clone of :class:`threading.RLock`. + +.. class:: Semaphore([value]) + + A bounded semaphore object: a clone of :class:`threading.Semaphore`. + +.. note:: + + The :meth:`acquire()` method of :class:`BoundedSemaphore`, :class:`Lock`, + :class:`RLock` and :class:`Semaphore` has a timeout parameter not supported + by the equivalents in :mod:`threading`. The signature is + ``acquire(block=True, timeout=None)`` with keyword parameters being + acceptable. If *block* is ``True`` and *timeout* is not ``None`` then it + specifies a timeout in seconds. If *block* is ``False`` then *timeout* is + ignored. + +.. note:: + + If the SIGINT signal generated by Ctrl-C arrives while the main thread is + blocked by a call to :meth:`BoundedSemaphore.acquire`, :meth:`Lock.acquire`, + :meth:`RLock.acquire`, :meth:`Semaphore.acquire`, :meth:`Condition.acquire` + or :meth:`Condition.wait` then the call will be immediately interrupted and + :exc:`KeyboardInterrupt` will be raised. + + This differs from the behaviour of :mod:`threading` where SIGINT will be + ignored while the equivalent blocking calls are in progress. + + +Shared :mod:`ctypes` Objects +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It is possible to create shared objects using shared memory which can be +inherited by child processes. + +.. function:: Value(typecode_or_type[, lock[, *args]]) + + Return a :mod:`ctypes` object allocated from shared memory. By default the + return value is actually a synchronized wrapper for the object. + + *typecode_or_type* determines the type of the returned object: it is either a + ctypes type or a one character typecode of the kind used by the :mod:`array` + module. *\*args* is passed on to the constructor for the type. + + If *lock* is ``True`` (the default) then a new lock object is created to + synchronize access to the value. If *lock* is a :class:`Lock` or + :class:`RLock` object then that will be used to synchronize access to the + value. If *lock* is ``False`` then access to the returned object will not be + automatically protected by a lock, so it will not necessarily be + "process-safe". + + Note that *lock* is a keyword-only argument. + +.. function:: Array(typecode_or_type, size_or_initializer, *, lock=True) + + Return a ctypes array allocated from shared memory. By default the return + value is actually a synchronized wrapper for the array. + + *typecode_or_type* determines the type of the elements of the returned array: + it is either a ctypes type or a one character typecode of the kind used by + the :mod:`array` module. If *size_or_initializer* is an integer, then it + determines the length of the array, and the array will be initially zeroed. + Otherwise, *size_or_initializer* is a sequence which is used to initialize + the array and whose length determines the length of the array. + + If *lock* is ``True`` (the default) then a new lock object is created to + synchronize access to the value. If *lock* is a :class:`Lock` or + :class:`RLock` object then that will be used to synchronize access to the + value. If *lock* is ``False`` then access to the returned object will not be + automatically protected by a lock, so it will not necessarily be + "process-safe". + + Note that *lock* is a keyword only argument. + + Note that an array of :data:`ctypes.c_char` has *value* and *rawvalue* + attributes which allow one to use it to store and retrieve strings. + + +The :mod:`multiprocessing.sharedctypes` module +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + +.. module:: multiprocessing.sharedctypes + :synopsis: Allocate ctypes objects from shared memory. + +The :mod:`multiprocessing.sharedctypes` module provides functions for allocating +:mod:`ctypes` objects from shared memory which can be inherited by child +processes. + +.. note:: + + Although it is posible to store a pointer in shared memory remember that this + will refer to a location in the address space of a specific process. + However, the pointer is quite likely to be invalid in the context of a second + process and trying to dereference the pointer from the second process may + cause a crash. + +.. function:: RawArray(typecode_or_type, size_or_initializer) + + Return a ctypes array allocated from shared memory. + + *typecode_or_type* determines the type of the elements of the returned array: + it is either a ctypes type or a one character typecode of the kind used by + the :mod:`array` module. If *size_or_initializer* is an integer then it + determines the length of the array, and the array will be initially zeroed. + Otherwise *size_or_initializer* is a sequence which is used to initialize the + array and whose length determines the length of the array. + + Note that setting and getting an element is potentially non-atomic -- use + :func:`Array` instead to make sure that access is automatically synchronized + using a lock. + +.. function:: RawValue(typecode_or_type, *args) + + Return a ctypes object allocated from shared memory. + + *typecode_or_type* determines the type of the returned object: it is either a + ctypes type or a one character typecode of the kind used by the :mod:`array` + module. */*args* is passed on to the constructor for the type. + + Note that setting and getting the value is potentially non-atomic -- use + :func:`Value` instead to make sure that access is automatically synchronized + using a lock. + + Note that an array of :data:`ctypes.c_char` has ``value`` and ``rawvalue`` + attributes which allow one to use it to store and retrieve strings -- see + documentation for :mod:`ctypes`. + +.. function:: Array(typecode_or_type, size_or_initializer[, lock[, *args]]) + + The same as :func:`RawArray` except that depending on the value of *lock* a + process-safe synchronization wrapper may be returned instead of a raw ctypes + array. + + If *lock* is ``True`` (the default) then a new lock object is created to + synchronize access to the value. If *lock* is a :class:`Lock` or + :class:`RLock` object then that will be used to synchronize access to the + value. If *lock* is ``False`` then access to the returned object will not be + automatically protected by a lock, so it will not necessarily be + "process-safe". + + Note that *lock* is a keyword-only argument. + +.. function:: Value(typecode_or_type, *args[, lock]) + + The same as :func:`RawValue` except that depending on the value of *lock* a + process-safe synchronization wrapper may be returned instead of a raw ctypes + object. + + If *lock* is ``True`` (the default) then a new lock object is created to + synchronize access to the value. If *lock* is a :class:`Lock` or + :class:`RLock` object then that will be used to synchronize access to the + value. If *lock* is ``False`` then access to the returned object will not be + automatically protected by a lock, so it will not necessarily be + "process-safe". + + Note that *lock* is a keyword-only argument. + +.. function:: copy(obj) + + Return a ctypes object allocated from shared memory which is a copy of the + ctypes object *obj*. + +.. function:: synchronized(obj[, lock]) + + Return a process-safe wrapper object for a ctypes object which uses *lock* to + synchronize access. If *lock* is ``None`` (the default) then a + :class:`multiprocessing.RLock` object is created automatically. + + A synchronized wrapper will have two methods in addition to those of the + object it wraps: :meth:`get_obj()` returns the wrapped object and + :meth:`get_lock()` returns the lock object used for synchronization. + + Note that accessing the ctypes object through the wrapper can be a lot slower + han accessing the raw ctypes object. + + +The table below compares the syntax for creating shared ctypes objects from +shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is some +subclass of :class:`ctypes.Structure`.) + +==================== ========================== =========================== +ctypes sharedctypes using type sharedctypes using typecode +==================== ========================== =========================== +c_double(2.4) RawValue(c_double, 2.4) RawValue('d', 2.4) +MyStruct(4, 6) RawValue(MyStruct, 4, 6) +(c_short * 7)() RawArray(c_short, 7) RawArray('h', 7) +(c_int * 3)(9, 2, 8) RawArray(c_int, (9, 2, 8)) RawArray('i', (9, 2, 8)) +==================== ========================== =========================== + + +Below is an example where a number of ctypes objects are modified by a child +process:: + + from multiprocessing import Process, Lock + from multiprocessing.sharedctypes import Value, Array + from ctypes import Structure, c_double + + class Point(Structure): + _fields_ = [('x', c_double), ('y', c_double)] + + def modify(n, x, s, A): + n.value **= 2 + x.value **= 2 + s.value = s.value.upper() + for a in A: + a.x **= 2 + a.y **= 2 + + if __name__ == '__main__': + lock = Lock() + + n = Value('i', 7) + x = Value(ctypes.c_double, 1.0/3.0, lock=False) + s = Array('c', 'hello world', lock=lock) + A = Array(Point, [(1.875,-6.25), (-5.75,2.0), (2.375,9.5)], lock=lock) + + p = Process(target=modify, args=(n, x, s, A)) + p.start() + p.join() + + print n.value + print x.value + print s.value + print [(a.x, a.y) for a in A] + + +.. highlightlang:: none + +The results printed are :: + + 49 + 0.1111111111111111 + HELLO WORLD + [(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)] + +.. highlightlang:: python + + +.. _multiprocessing-managers: + +Managers +~~~~~~~~ + +Managers provide a way to create data which can be shared between different +processes. A manager object controls a server process which manages *shared +objects*. Other processes can access the shared objects by using proxies. + +.. function:: multiprocessing.Manager() + + Returns a started :class:`SyncManager` object which can be used for sharing + objects between processes. The returned manager object corresponds to a + spawned child process and has methods which will create shared objects and + return corresponding proxies. + +.. module:: multiprocessing.managers + :synopsis: Share data between process with shared objects. + +Manager processes will be shutdown as soon as they are garbage collected or +their parent process exits. The manager classes are defined in the +:mod:`multiprocessing.managers` module: + +.. class:: BaseManager([address[, authkey]]) + + Create a BaseManager object. + + Once created one should call :meth:`start` or :meth:`serve_forever` to ensure + that the manager object refers to a started manager process. + + *address* is the address on which the manager process listens for new + connections. If *address* is ``None`` then an arbitrary one is chosen. + + *authkey* is the authentication key which will be used to check the validity + of incoming connections to the server process. If *authkey* is ``None`` then + ``current_process().get_auth_key()``. Otherwise *authkey* is used and it + must be a string. + + .. method:: start() + + Start a subprocess to start the manager. + + .. method:: server_forever() + + Run the server in the current process. + + .. method:: from_address(address, authkey) + + A class method which creates a manager object referring to a pre-existing + server process which is using the given address and authentication key. + + .. method:: shutdown() + + Stop the process used by the manager. This is only available if + meth:`start` has been used to start the server process. + + This can be called multiple times. + + .. method:: register(typeid[, callable[, proxytype[, exposed[, method_to_typeid[, create_method]]]]]) + + A classmethod which can be used for registering a type or callable with + the manager class. + + *typeid* is a "type identifier" which is used to identify a particular + type of shared object. This must be a string. + + *callable* is a callable used for creating objects for this type + identifier. If a manager instance will be created using the + :meth:`from_address()` classmethod or if the *create_method* argument is + ``False`` then this can be left as ``None``. + + *proxytype* is a subclass of :class:`multiprocessing.managers.BaseProxy` + which is used to create proxies for shared objects with this *typeid*. If + ``None`` then a proxy class is created automatically. + + *exposed* is used to specify a sequence of method names which proxies for + this typeid should be allowed to access using + :meth:`BaseProxy._callMethod`. (If *exposed* is ``None`` then + :attr:`proxytype._exposed_` is used instead if it exists.) In the case + where no exposed list is specified, all "public methods" of the shared + object will be accessible. (Here a "public method" means any attribute + which has a ``__call__()`` method and whose name does not begin with + ``'_'``.) + + *method_to_typeid* is a mapping used to specify the return type of those + exposed methods which should return a proxy. It maps method names to + typeid strings. (If *method_to_typeid* is ``None`` then + :attr:`proxytype._method_to_typeid_` is used instead if it exists.) If a + method's name is not a key of this mapping or if the mapping is ``None`` + then the object returned by the method will be copied by value. + + *create_method* determines whether a method should be created with name + *typeid* which can be used to tell the server process to create a new + shared object and return a proxy for it. By default it is ``True``. + + :class:`BaseManager` instances also have one read-only property: + + .. attribute:: address + + The address used by the manager. + + +.. class:: SyncManager + + A subclass of :class:`BaseManager` which can be used for the synchronization + of processes. Objects of this type are returned by + :func:`multiprocessing.Manager()`. + + It also supports creation of shared lists and dictionaries. + + .. method:: BoundedSemaphore([value]) + + Create a shared :class:`threading.BoundedSemaphore` object and return a + proxy for it. + + .. method:: Condition([lock]) + + Create a shared :class:`threading.Condition` object and return a proxy for + it. + + If *lock* is supplied then it should be a proxy for a + :class:`threading.Lock` or :class:`threading.RLock` object. + + .. method:: Event() + + Create a shared :class:`threading.Event` object and return a proxy for it. + + .. method:: Lock() + + Create a shared :class:`threading.Lock` object and return a proxy for it. + + .. method:: Namespace() + + Create a shared :class:`Namespace` object and return a proxy for it. + + .. method:: Queue([maxsize]) + + Create a shared `Queue.Queue` object and return a proxy for it. + + .. method:: RLock() + + Create a shared :class:`threading.RLock` object and return a proxy for it. + + .. method:: Semaphore([value]) + + Create a shared :class:`threading.Semaphore` object and return a proxy for + it. + + .. method:: Array(typecode, sequence) + + Create an array and return a proxy for it. (*format* is ignored.) + + .. method:: Value(typecode, value) + + Create an object with a writable ``value`` attribute and return a proxy + for it. + + .. method:: dict() + dict(mapping) + dict(sequence) + + Create a shared ``dict`` object and return a proxy for it. + + .. method:: list() + list(sequence) + + Create a shared ``list`` object and return a proxy for it. + + +Namespace objects +>>>>>>>>>>>>>>>>> + +A namespace object has no public methods, but does have writable attributes. +Its representation shows the values of its attributes. + +However, when using a proxy for a namespace object, an attribute beginning with +``'_'`` will be an attribute of the proxy and not an attribute of the referent:: + + >>> manager = multiprocessing.Manager() + >>> Global = manager.Namespace() + >>> Global.x = 10 + >>> Global.y = 'hello' + >>> Global._z = 12.3 # this is an attribute of the proxy + >>> print Global + Namespace(x=10, y='hello') + + +Customized managers +>>>>>>>>>>>>>>>>>>> + +To create one's own manager, one creates a subclass of :class:`BaseManager` and +use the :meth:`resgister()` classmethod to register new types or callables with +the manager class. For example:: + + from multiprocessing.managers import BaseManager + + class MathsClass(object): + def add(self, x, y): + return x + y + def mul(self, x, y): + return x * y + + class MyManager(BaseManager): + pass + + MyManager.register('Maths', MathsClass) + + if __name__ == '__main__': + manager = MyManager() + manager.start() + maths = manager.Maths() + print maths.add(4, 3) # prints 7 + print maths.mul(7, 8) # prints 56 + + +Using a remote manager +>>>>>>>>>>>>>>>>>>>>>> + +It is possible to run a manager server on one machine and have clients use it +from other machines (assuming that the firewalls involved allow it). + +Running the following commands creates a server for a single shared queue which +remote clients can access:: + + >>> from multiprocessing.managers import BaseManager + >>> import Queue + >>> queue = Queue.Queue() + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('getQueue', callable=lambda:queue) + >>> m = QueueManager(address=('', 50000), authkey='abracadabra') + >>> m.serveForever() + +One client can access the server as follows:: + + >>> from multiprocessing.managers import BaseManager + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('getQueue') + >>> m = QueueManager.from_address(address=('foo.bar.org', 50000), + >>> authkey='abracadabra') + >>> queue = m.getQueue() + >>> queue.put('hello') + +Another client can also use it:: + + >>> from multiprocessing.managers import BaseManager + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('getQueue') + >>> m = QueueManager.from_address(address=('foo.bar.org', 50000), authkey='abracadabra') + >>> queue = m.getQueue() + >>> queue.get() + 'hello' + + +Proxy Objects +~~~~~~~~~~~~~ + +A proxy is an object which *refers* to a shared object which lives (presumably) +in a different process. The shared object is said to be the *referent* of the +proxy. Multiple proxy objects may have the same referent. + +A proxy object has methods which invoke corresponding methods of its referent +(although not every method of the referent will necessarily be available through +the proxy). A proxy can usually be used in most of the same ways that its +referent can:: + + >>> from multiprocessing import Manager + >>> manager = Manager() + >>> l = manager.list([i*i for i in range(10)]) + >>> print l + [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] + >>> print repr(l) + + >>> l[4] + 16 + >>> l[2:5] + [4, 9, 16] + +Notice that applying :func:`str` to a proxy will return the representation of +the referent, whereas applying :func:`repr` will return the representation of +the proxy. + +An important feature of proxy objects is that they are picklable so they can be +passed between processes. Note, however, that if a proxy is sent to the +corresponding manager's process then unpickling it will produce the referent +itself. This means, for example, that one shared object can contain a second:: + + >>> a = manager.list() + >>> b = manager.list() + >>> a.append(b) # referent of `a` now contains referent of `b` + >>> print a, b + [[]] [] + >>> b.append('hello') + >>> print a, b + [['hello']] ['hello'] + +.. note:: + + The proxy types in :mod:`multiprocessing` do nothing to support comparisons + by value. So, for instance, :: + + manager.list([1,2,3]) == [1,2,3] + + will return ``False``. One should just use a copy of the referent instead + when making comparisons. + +.. class:: BaseProxy + + Proxy objects are instances of subclasses of :class:`BaseProxy`. + + .. method:: _call_method(methodname[, args[, kwds]]) + + Call and return the result of a method of the proxy's referent. + + If ``proxy`` is a proxy whose referent is ``obj`` then the expression :: + + proxy._call_method(methodname, args, kwds) + + will evaluate the expression :: + + getattr(obj, methodname)(*args, **kwds) + + in the manager's process. + + The returned value will be a copy of the result of the call or a proxy to + a new shared object -- see documentation for the *method_to_typeid* + argument of :meth:`BaseManager.register`. + + If an exception is raised by the call, then then is re-raised by + :meth:`_call_method`. If some other exception is raised in the manager's + process then this is converted into a :exc:`RemoteError` exception and is + raised by :meth:`_call_method`. + + Note in particular that an exception will be raised if *methodname* has + not been *exposed* + + An example of the usage of :meth:`_call_method()`:: + + >>> l = manager.list(range(10)) + >>> l._call_method('__len__') + 10 + >>> l._call_method('__getslice__', (2, 7)) # equiv to `l[2:7]` + [2, 3, 4, 5, 6] + >>> l._call_method('__getitem__', (20,)) # equiv to `l[20]` + Traceback (most recent call last): + ... + IndexError: list index out of range + + .. method:: _get_value() + + Return a copy of the referent. + + If the referent is unpicklable then this will raise an exception. + + .. method:: __repr__ + + Return a representation of the proxy object. + + .. method:: __str__ + + Return the representation of the referent. + + +Cleanup +>>>>>>> + +A proxy object uses a weakref callback so that when it gets garbage collected it +deregisters itself from the manager which owns its referent. + +A shared object gets deleted from the manager process when there are no longer +any proxies referring to it. + + +Process Pools +~~~~~~~~~~~~~ + +.. module:: multiprocessing.pool + :synopsis: Create pools of processes. + +One can create a pool of processes which will carry out tasks submitted to it +with the :class:`Pool` class in :mod:`multiprocess.pool`. + +.. class:: multiprocessing.Pool([processes[, initializer[, initargs]]]) + + A process pool object which controls a pool of worker processes to which jobs + can be submitted. It supports asynchronous results with timeouts and + callbacks and has a parallel map implementation. + + *processes* is the number of worker processes to use. If *processes* is + ``None`` then the number returned by :func:`cpu_count` is used. If + *initializer* is not ``None`` then each worker process will call + ``initializer(*initargs)`` when it starts. + + .. method:: apply(func[, args[, kwds]]) + + Equivalent of the :func:`apply` builtin function. It blocks till the + result is ready. + + .. method:: apply_async(func[, args[, kwds[, callback]]]) + + A variant of the :meth:`apply` method which returns a result object. + + If *callback* is specified then it should be a callable which accepts a + single argument. When the result becomes ready *callback* is applied to + it (unless the call failed). *callback* should complete immediately since + otherwise the thread which handles the results will get blocked. + + .. method:: map(func, iterable[, chunksize]) + + A parallel equivalent of the :func:`map` builtin function. It blocks till + the result is ready. + + This method chops the iterable into a number of chunks which it submits to + the process pool as separate tasks. The (approximate) size of these + chunks can be specified by setting *chunksize* to a positive integer. + + .. method:: map_async(func, iterable[, chunksize[, callback]]) + + A variant of the :meth:`.map` method which returns a result object. + + If *callback* is specified then it should be a callable which accepts a + single argument. When the result becomes ready *callback* is applied to + it (unless the call failed). *callback* should complete immediately since + otherwise the thread which handles the results will get blocked. + + .. method:: imap(func, iterable[, chunksize]) + + An equivalent of :func:`itertools.imap`. + + The *chunksize* argument is the same as the one used by the :meth:`.map` + method. For very long iterables using a large value for *chunksize* can + make make the job complete **much** faster than using the default value of + ``1``. + + Also if *chunksize* is ``1`` then the :meth:`next` method of the iterator + returned by the :meth:`imap` method has an optional *timeout* parameter: + ``next(timeout)`` will raise :exc:`multiprocessing.TimeoutError` if the + result cannot be returned within *timeout* seconds. + + .. method:: imap_unordered(func, iterable[, chunksize]) + + The same as :meth:`imap` except that the ordering of the results from the + returned iterator should be considered arbitrary. (Only when there is + only one worker process is the order guaranteed to be "correct".) + + .. method:: close() + + Prevents any more tasks from being submitted to the pool. Once all the + tasks have been completed the worker processes will exit. + + .. method:: terminate() + + Stops the worker processes immediately without completing outstanding + work. When the pool object is garbage collected :meth:`terminate` will be + called immediately. + + .. method:: join() + + Wait for the worker processes to exit. One must call :meth:`close` or + :meth:`terminate` before using :meth:`join`. + + +.. class:: AsyncResult + + The class of the result returned by :meth:`Pool.apply_async` and + :meth:`Pool.map_async`. + + .. method:: get([timeout) + + Return the result when it arrives. If *timeout* is not ``None`` and the + result does not arrive within *timeout* seconds then + :exc:`multiprocessing.TimeoutError` is raised. If the remote call raised + an exception then that exception will be reraised by :meth:`get`. + + .. method:: wait([timeout]) + + Wait until the result is available or until *timeout* seconds pass. + + .. method:: ready() + + Return whether the call has completed. + + .. method:: successful() + + Return whether the call completed without raising an exception. Will + raise :exc:`AssertionError` if the result is not ready. + +The following example demonstrates the use of a pool:: + + from multiprocessing import Pool + + def f(x): + return x*x + + if __name__ == '__main__': + pool = Pool(processes=4) # start 4 worker processes + + result = pool.applyAsync(f, (10,)) # evaluate "f(10)" asynchronously + print result.get(timeout=1) # prints "100" unless your computer is *very* slow + + print pool.map(f, range(10)) # prints "[0, 1, 4,..., 81]" + + it = pool.imap(f, range(10)) + print it.next() # prints "0" + print it.next() # prints "1" + print it.next(timeout=1) # prints "4" unless your computer is *very* slow + + import time + result = pool.applyAsync(time.sleep, (10,)) + print result.get(timeout=1) # raises TimeoutError + + +.. _multiprocessing-listeners-clients: + +Listeners and Clients +~~~~~~~~~~~~~~~~~~~~~ + +.. module:: multiprocessing.connection + :synopsis: API for dealing with sockets. + +Usually message passing between processes is done using queues or by using +:class:`Connection` objects returned by :func:`Pipe`. + +However, the :mod:`multiprocessing.connection` module allows some extra +flexibility. It basically gives a high level message oriented API for dealing +with sockets or Windows named pipes, and also has support for *digest +authentication* using the :mod:`hmac` module from the standard library. + + +.. function:: deliver_challenge(connection, authkey) + + Send a randomly generated message to the other end of the connection and wait + for a reply. + + If the reply matches the digest of the message using *authkey* as the key + then a welcome message is sent to the other end of the connection. Otherwise + :exc:`AuthenticationError` is raised. + +.. function:: answerChallenge(connection, authkey) + + Receive a message, calculate the digest of the message using *authkey* as the + key, and then send the digest back. + + If a welcome message is not received, then :exc:`AuthenticationError` is + raised. + +.. function:: Client(address[, family[, authenticate[, authkey]]]) + + Attempt to set up a connection to the listener which is using address + *address*, returning a :class:`Connection`. + + The type of the connection is determined by *family* argument, but this can + generally be omitted since it can usually be inferred from the format of + *address*. (See :ref:`multiprocessing-address-formats`) + + If *authentication* is ``True`` or *authkey* is a string then digest + authentication is used. The key used for authentication will be either + *authkey* or ``current_process().get_auth_key()`` if *authkey* is ``None``. + If authentication fails then :exc:`AuthenticationError` is raised. See + :ref:`multiprocessing-auth-keys`. + +.. class:: Listener([address[, family[, backlog[, authenticate[, authkey]]]]]) + + A wrapper for a bound socket or Windows named pipe which is 'listening' for + connections. + + *address* is the address to be used by the bound socket or named pipe of the + listener object. + + *family* is the type of socket (or named pipe) to use. This can be one of + the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix + domain socket) or ``'AF_PIPE'`` (for a Windows named pipe). Of these only + the first is guaranteed to be available. If *family* is ``None`` then the + family is inferred from the format of *address*. If *address* is also + ``None`` then a default is chosen. This default is the family which is + assumed to be the fastest available. See + :ref:`multiprocessing-address-formats`. Note that if *family* is + ``'AF_UNIX'`` and address is ``None`` then the socket will be created in a + private temporary directory created using :func:`tempfile.mkstemp`. + + If the listener object uses a socket then *backlog* (1 by default) is passed + to the :meth:`listen` method of the socket once it has been bound. + + If *authenticate* is ``True`` (``False`` by default) or *authkey* is not + ``None`` then digest authentication is used. + + If *authkey* is a string then it will be used as the authentication key; + otherwise it must be *None*. + + If *authkey* is ``None`` and *authenticate* is ``True`` then + ``current_process().get_auth_key()`` is used as the authentication key. If + *authkey* is ``None`` and *authentication* is ``False`` then no + authentication is done. If authentication fails then + :exc:`AuthenticationError` is raised. See :ref:`multiprocessing-auth-keys`. + + .. method:: accept() + + Accept a connection on the bound socket or named pipe of the listener + object and return a :class:`Connection` object. If authentication is + attempted and fails, then :exc:`AuthenticationError` is raised. + + .. method:: close() + + Close the bound socket or named pipe of the listener object. This is + called automatically when the listener is garbage collected. However it + is advisable to call it explicitly. + + Listener objects have the following read-only properties: + + .. attribute:: address + + The address which is being used by the Listener object. + + .. attribute:: last_accepted + + The address from which the last accepted connection came. If this is + unavailable then it is ``None``. + + +The module defines two exceptions: + +.. exception:: AuthenticationError + + Exception raised when there is an authentication error. + +.. exception:: BufferTooShort + + Exception raise by the :meth:`Connection.recv_bytes_into` method of a + connection object when the supplied buffer object is too small for the + message read. + + If *e* is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give + the message as a byte string. + + +**Examples** + +The following server code creates a listener which uses ``'secret password'`` as +an authentication key. It then waits for a connection and sends some data to +the client:: + + from multiprocessing.connection import Listener + from array import array + + address = ('localhost', 6000) # family is deduced to be 'AF_INET' + listener = Listener(address, authkey='secret password') + + conn = listener.accept() + print 'connection accepted from', listener.last_accepted + + conn.send([2.25, None, 'junk', float]) + + conn.send_bytes('hello') + + conn.send_bytes(array('i', [42, 1729])) + + conn.close() + listener.close() + +The following code connects to the server and receives some data from the +server:: + + from multiprocessing.connection import Client + from array import array + + address = ('localhost', 6000) + conn = Client(address, authkey='secret password') + + print conn.recv() # => [2.25, None, 'junk', float] + + print conn.recv_bytes() # => 'hello' + + arr = array('i', [0, 0, 0, 0, 0]) + print conn.recv_bytes_into(arr) # => 8 + print arr # => array('i', [42, 1729, 0, 0, 0]) + + conn.close() + + +.. _multiprocessing-address-formats: + +Address Formats +>>>>>>>>>>>>>>> + +* An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)``` where + *hostname* is a string and *port* is an integer. + +* An ``'AF_UNIX'``` address is a string representing a filename on the + filesystem. + +* An ``'AF_PIPE'`` address is a string of the form + ``r'\\\\.\\pipe\\PipeName'``. To use :func:`Client` to connect to a named + pipe on a remote computer called ServerName* one should use an address of the + form ``r'\\\\ServerName\\pipe\\PipeName'`` instead. + +Note that any string beginning with two backslashes is assumed by default to be +an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address. + + +.. _multiprocessing-auth-keys: + +Authentication keys +~~~~~~~~~~~~~~~~~~~ + +When one uses :meth:`Connection.recv`, the data received is automatically +unpickled. Unfortunately unpickling data from an untrusted source is a security +risk. Therefore :class:`Listener` and :func:`Client` use the :mod:`hmac` module +to provide digest authentication. + +An authentication key is a string which can be thought of as a password: once a +connection is established both ends will demand proof that the other knows the +authentication key. (Demonstrating that both ends are using the same key does +**not** involve sending the key over the connection.) + +If authentication is requested but do authentication key is specified then the +return value of ``current_process().get_auth_key`` is used (see +:class:`Process`). This value will automatically inherited by any +:class:`Process` object that the current process creates. This means that (by +default) all processes of a multi-process program will share a single +authentication key which can be used when setting up connections between the +themselves. + +Suitable authentication keys can also be generated by using :func:`os.urandom`. + + +Logging +~~~~~~~ + +Some support for logging is available. Note, however, that the :mod:`logging` +package does not use process shared locks so it is possible (depending on the +handler type) for messages from different processes to get mixed up. + +.. currentmodule:: multiprocessing +.. function:: get_logger() + + Returns the logger used by :mod:`multiprocessing`. If necessary, a new one + will be created. + + When first created the logger has level :data:`logging.NOTSET` and has a + handler which sends output to :data:`sys.stderr` using format + ``'[%(levelname)s/%(processName)s] %(message)s'``. (The logger allows use of + the non-standard ``'%(processName)s'`` format.) Message sent to this logger + will not by default propogate to the root logger. + + Note that on Windows child processes will only inherit the level of the + parent process's logger -- any other customization of the logger will not be + inherited. + +Below is an example session with logging turned on:: + + >>> import processing, logging + >>> logger = processing.getLogger() + >>> logger.setLevel(logging.INFO) + >>> logger.warning('doomed') + [WARNING/MainProcess] doomed + >>> m = processing.Manager() + [INFO/SyncManager-1] child process calling self.run() + [INFO/SyncManager-1] manager bound to '\\\\.\\pipe\\pyc-2776-0-lj0tfa' + >>> del m + [INFO/MainProcess] sending shutdown message to manager + [INFO/SyncManager-1] manager exiting with exitcode 0 + + +The :mod:`multiprocessing.dummy` module +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. module:: multiprocessing.dummy + :synopsis: Dumb wrapper around threading. + +:mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is +no more than a wrapper around the `threading` module. + + +.. _multiprocessing-programming: + +Programming guidelines +---------------------- + +There are certain guidelines and idioms which should be adhered to when using +:mod:`multiprocessing`. + + +All platforms +~~~~~~~~~~~~~ + +Avoid shared state + + As far as possible one should try to avoid shifting large amounts of data + between processes. + + It is probably best to stick to using queues or pipes for communication + between processes rather than using the lower level synchronization + primitives from the :mod:`threading` module. + +Picklability + + Ensure that the arguments to the methods of proxies are picklable. + +Thread safety of proxies + + Do not use a proxy object from more than one thread unless you protect it + with a lock. + + (There is never a problem with different processes using the *same* proxy.) + +Joining zombie processes + + On Unix when a process finishes but has not been joined it becomes a zombie. + There should never be very many because each time a new process starts (or + :func:`active_children` is called) all completed processes which have not + yet been joined will be joined. Also calling a finished process's + :meth:`Process.is_alive` will join the process. Even so it is probably good + practice to explicitly join all the processes that you start. + +Better to inherit than pickle/unpickle + + On Windows many of types from :mod:`multiprocessing` need to be picklable so + that child processes can use them. However, one should generally avoid + sending shared objects to other processes using pipes or queues. Instead + you should arrange the program so that a process which need access to a + shared resource created elsewhere can inherit it from an ancestor process. + +Avoid terminating processes + + Using the :meth:`Process.terminate` method to stop a process is liable to + cause any shared resources (such as locks, semaphores, pipes and queues) + currently being used by the process to become broken or unavailable to other + processes. + + Therefore it is probably best to only consider using + :meth:`Process.terminate()` on processes which never use any shared + resources. + +Joining processes that use queues + + Bear in mind that a process that has put items in a queue will wait before + terminating until all the buffered items are fed by the "feeder" thread to + the underlying pipe. (The child process can call the + :meth:`Queue.cancel_join` method of the queue to avoid this behaviour.) + + This means that whenever you use a queue you need to make sure that all + items which have been put on the queue will eventually be removed before the + process is joined. Otherwise you cannot be sure that processes which have + put items on the queue will terminate. Remember also that non-daemonic + processes will be automatically be joined. + + An example which will deadlock is the following:: + + from multiprocessing import Process, Queue + + def f(q): + q.put('X' * 1000000) + + if __name__ == '__main__': + queue = Queue() + p = Process(target=f, args=(queue,)) + p.start() + p.join() # this deadlocks + obj = queue.get() + + A fix here would be to swap the last two lines round (or simply remove the + ``p.join()`` line). + +Explicity pass resources to child processes + + On Unix a child process can make use of a shared resource created in a + parent process using a global resource. However, it is better to pass the + object as an argument to the constructor for the child process. + + Apart from making the code (potentially) compatible with Windows this also + ensures that as long as the child process is still alive the object will not + be garbage collected in the parent process. This might be important if some + resource is freed when the object is garbage collected in the parent + process. + + So for instance :: + + from multiprocessing import Process, Lock + + def f(): + ... do something using "lock" ... + + if __name__ == '__main__': + lock = Lock() + for i in range(10): + Process(target=f).start() + + should be rewritten as :: + + from multiprocessing import Process, Lock + + def f(l): + ... do something using "l" ... + + if __name__ == '__main__': + lock = Lock() + for i in range(10): + Process(target=f, args=(lock,)).start() + + +Windows +~~~~~~~ + +Since Windows lacks :func:`os.fork` it has a few extra restrictions: + +More picklability + + Ensure that all arguments to :meth:`Process.__init__` are picklable. This + means, in particular, that bound or unbound methods cannot be used directly + as the ``target`` argument on Windows --- just define a function and use + that instead. + + Also, if you subclass :class:`Process` then make sure that instances will be + picklable when the :meth:`Process.start` method is called. + +Global variables + + Bear in mind that if code run in a child process tries to access a global + variable, then the value it sees (if any) may not be the same as the value + in the parent process at the time that :meth:`Process.start` was called. + + However, global variables which are just module level constants cause no + problems. + +Safe importing of main module + + Make sure that the main module can be safely imported by a new Python + interpreter without causing unintended side effects (such a starting a new + process). + + For example, under Windows running the following module would fail with a + :exc:`RuntimeError`:: + + from multiprocessing import Process + + def foo(): + print 'hello' + + p = Process(target=foo) + p.start() + + Instead one should protect the "entry point" of the program by using ``if + __name__ == '__main__':`` as follows:: + + from multiprocessing import Process, freeze_support + + def foo(): + print 'hello' + + if __name__ == '__main__': + freeze_support() + p = Process(target=foo) + p.start() + + (The :func:`freeze_support()` line can be omitted if the program will be run + normally instead of frozen.) + + This allows the newly spawned Python interpreter to safely import the module + and then run the module's ``foo()`` function. + + Similar restrictions apply if a pool or manager is created in the main + module. + + +.. _multiprocessing-examples: + +Examples +-------- + +Demonstration of how to create and use customized managers and proxies: + +.. literalinclude:: ../includes/mp_newtype.py + + +Using :class:`Pool`: + +.. literalinclude:: ../includes/mp_pool.py + + +Synchronization types like locks, conditions and queues: + +.. literalinclude:: ../includes/mp_synchronize.py + + +An showing how to use queues to feed tasks to a collection of worker process and +collect the results: + +.. literalinclude:: ../includes/mp_workers.py + + +An example of how a pool of worker processes can each run a +:class:`SimpleHTTPServer.HttpServer` instance while sharing a single listening +socket. + +.. literalinclude:: ../includes/mp_webserver.py + + +Some simple benchmarks comparing :mod:`multiprocessing` with :mod:`threading`: + +.. literalinclude:: ../includes/mp_benchmarks.py + +An example/demo of how to use the :class:`managers.SyncManager`, :class:`Process` +and others to build a system which can distribute processes and work via a +distributed queue to a "cluster" of machines on a network, accessible via SSH. +You will need to have private key authentication for all hosts configured for +this to work. + +.. literalinclude:: ../includes/mp_distributing.py \ No newline at end of file Modified: python/trunk/Doc/library/someos.rst ============================================================================== --- python/trunk/Doc/library/someos.rst (original) +++ python/trunk/Doc/library/someos.rst Wed Jun 11 04:40:25 2008 @@ -18,6 +18,7 @@ threading.rst dummy_thread.rst dummy_threading.rst + multiprocessing.rst mmap.rst readline.rst rlcompleter.rst Added: python/trunk/Lib/multiprocessing/__init__.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/__init__.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,269 @@ +# +# Package analogous to 'threading.py' but using processes +# +# multiprocessing/__init__.py +# +# This package is intended to duplicate the functionality (and much of +# the API) of threading.py but uses processes instead of threads. A +# subpackage 'multiprocessing.dummy' has the same API but is a simple +# wrapper for 'threading'. +# +# Try calling `multiprocessing.doc.main()` to read the html +# documentation in in a webbrowser. +# +# +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of author nor the names of any contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# + +__version__ = '0.70a1' + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Manager', 'Pipe', 'cpu_count', 'log_to_stderr', 'get_logger', + 'allow_connection_pickling', 'BufferTooShort', 'TimeoutError', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'JoinableQueue', 'Pool', 'Value', 'Array', + 'RawValue', 'RawArray' + ] + +__author__ = 'R. Oudkerk (r.m.oudkerk at gmail.com)' + +# +# Imports +# + +import os +import sys + +import _multiprocessing +from multiprocessing.process import Process, current_process, active_children + +# +# Exceptions +# + +class ProcessError(Exception): + pass + +class BufferTooShort(ProcessError): + pass + +class TimeoutError(ProcessError): + pass + +class AuthenticationError(ProcessError): + pass + +# +# Definitions not depending on native semaphores +# + +def Manager(): + ''' + Returns a manager associated with a running server process + + The managers methods such as `Lock()`, `Condition()` and `Queue()` + can be used to create shared objects. + ''' + from multiprocessing.managers import SyncManager + m = SyncManager() + m.start() + return m + +def Pipe(duplex=True): + ''' + Returns two connection object connected by a pipe + ''' + from multiprocessing.connection import Pipe + return Pipe(duplex) + +def cpu_count(): + ''' + Returns the number of CPUs in the system + ''' + if sys.platform == 'win32': + try: + num = int(os.environ['NUMBER_OF_PROCESSORS']) + except (ValueError, KeyError): + num = 0 + elif sys.platform == 'darwin': + try: + num = int(os.popen('sysctl -n hw.ncpu').read()) + except ValueError: + num = 0 + else: + try: + num = os.sysconf('SC_NPROCESSORS_ONLN') + except (ValueError, OSError, AttributeError): + num = 0 + + if num >= 1: + return num + else: + raise NotImplementedError('cannot determine number of cpus') + +def freeze_support(): + ''' + Check whether this is a fake forked process in a frozen executable. + If so then run code specified by commandline and exit. + ''' + if sys.platform == 'win32' and getattr(sys, 'frozen', False): + from multiprocessing.forking import freeze_support + freeze_support() + +def get_logger(): + ''' + Return package logger -- if it does not already exist then it is created + ''' + from multiprocessing.util import get_logger + return get_logger() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + from multiprocessing.util import log_to_stderr + return log_to_stderr(level) + +def allow_connection_pickling(): + ''' + Install support for sending connections and sockets between processes + ''' + from multiprocessing import reduction + +# +# Definitions depending on native semaphores +# + +def Lock(): + ''' + Returns a non-recursive lock object + ''' + from multiprocessing.synchronize import Lock + return Lock() + +def RLock(): + ''' + Returns a recursive lock object + ''' + from multiprocessing.synchronize import RLock + return RLock() + +def Condition(lock=None): + ''' + Returns a condition object + ''' + from multiprocessing.synchronize import Condition + return Condition(lock) + +def Semaphore(value=1): + ''' + Returns a semaphore object + ''' + from multiprocessing.synchronize import Semaphore + return Semaphore(value) + +def BoundedSemaphore(value=1): + ''' + Returns a bounded semaphore object + ''' + from multiprocessing.synchronize import BoundedSemaphore + return BoundedSemaphore(value) + +def Event(): + ''' + Returns an event object + ''' + from multiprocessing.synchronize import Event + return Event() + +def Queue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import Queue + return Queue(maxsize) + +def JoinableQueue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import JoinableQueue + return JoinableQueue(maxsize) + +def Pool(processes=None, initializer=None, initargs=()): + ''' + Returns a process pool object + ''' + from multiprocessing.pool import Pool + return Pool(processes, initializer, initargs) + +def RawValue(typecode_or_type, *args): + ''' + Returns a shared object + ''' + from multiprocessing.sharedctypes import RawValue + return RawValue(typecode_or_type, *args) + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a shared array + ''' + from multiprocessing.sharedctypes import RawArray + return RawArray(typecode_or_type, size_or_initializer) + +def Value(typecode_or_type, *args, **kwds): + ''' + Returns a synchronized shared object + ''' + from multiprocessing.sharedctypes import Value + return Value(typecode_or_type, *args, **kwds) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Returns a synchronized shared array + ''' + from multiprocessing.sharedctypes import Array + return Array(typecode_or_type, size_or_initializer, **kwds) + +# +# +# + +if sys.platform == 'win32': + + def set_executable(executable): + ''' + Sets the path to a python.exe or pythonw.exe binary used to run + child processes on Windows instead of sys.executable. + Useful for people embedding Python. + ''' + from multiprocessing.forking import set_executable + set_executable(executable) + + __all__ += ['set_executable'] Added: python/trunk/Lib/multiprocessing/connection.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/connection.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,425 @@ +# +# A higher level module for using sockets (or Windows named pipes) +# +# multiprocessing/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +import os +import sys +import socket +import time +import tempfile +import itertools + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug +from multiprocessing.forking import duplicate, close + + +# +# +# + +BUFSIZE = 8192 + +_mmap_counter = itertools.count() + +default_family = 'AF_INET' +families = ['AF_INET'] + +if hasattr(socket, 'AF_UNIX'): + default_family = 'AF_UNIX' + families += ['AF_UNIX'] + +if sys.platform == 'win32': + default_family = 'AF_PIPE' + families += ['AF_PIPE'] + +# +# +# + +def arbitrary_address(family): + ''' + Return an arbitrary free address for the given family + ''' + if family == 'AF_INET': + return ('localhost', 0) + elif family == 'AF_UNIX': + return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) + elif family == 'AF_PIPE': + return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % + (os.getpid(), _mmap_counter.next())) + else: + raise ValueError('unrecognized family') + + +def address_type(address): + ''' + Return the types of the address + + This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' + ''' + if type(address) == tuple: + return 'AF_INET' + elif type(address) is str and address.startswith('\\\\'): + return 'AF_PIPE' + elif type(address) is str: + return 'AF_UNIX' + else: + raise ValueError('address type of %r unrecognized' % address) + +# +# Public functions +# + +class Listener(object): + ''' + Returns a listener object. + + This is a wrapper for a bound socket which is 'listening' for + connections, or for a Windows named pipe. + ''' + def __init__(self, address=None, family=None, backlog=1, authkey=None): + family = family or (address and address_type(address)) \ + or default_family + address = address or arbitrary_address(family) + + if family == 'AF_PIPE': + self._listener = PipeListener(address, backlog) + else: + self._listener = SocketListener(address, family, backlog) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + self._authkey = authkey + + def accept(self): + ''' + Accept a connection on the bound socket or named pipe of `self`. + + Returns a `Connection` object. + ''' + c = self._listener.accept() + if self._authkey: + deliver_challenge(c, self._authkey) + answer_challenge(c, self._authkey) + return c + + def close(self): + ''' + Close the bound socket or named pipe of `self`. + ''' + return self._listener.close() + + address = property(lambda self: self._listener._address) + last_accepted = property(lambda self: self._listener._last_accepted) + + +def Client(address, family=None, authkey=None): + ''' + Returns a connection to the address of a `Listener` + ''' + family = family or address_type(address) + if family == 'AF_PIPE': + c = PipeClient(address) + else: + c = SocketClient(address) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + if authkey is not None: + answer_challenge(c, authkey) + deliver_challenge(c, authkey) + + return c + + +if sys.platform != 'win32': + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + if duplex: + s1, s2 = socket.socketpair() + c1 = _multiprocessing.Connection(os.dup(s1.fileno())) + c2 = _multiprocessing.Connection(os.dup(s2.fileno())) + s1.close() + s2.close() + else: + fd1, fd2 = os.pipe() + c1 = _multiprocessing.Connection(fd1, writable=False) + c2 = _multiprocessing.Connection(fd2, readable=False) + + return c1, c2 + +else: + + from ._multiprocessing import win32 + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + address = arbitrary_address('AF_PIPE') + if duplex: + openmode = win32.PIPE_ACCESS_DUPLEX + access = win32.GENERIC_READ | win32.GENERIC_WRITE + obsize, ibsize = BUFSIZE, BUFSIZE + else: + openmode = win32.PIPE_ACCESS_INBOUND + access = win32.GENERIC_WRITE + obsize, ibsize = 0, BUFSIZE + + h1 = win32.CreateNamedPipe( + address, openmode, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + 1, obsize, ibsize, win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + h2 = win32.CreateFile( + address, access, 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + win32.SetNamedPipeHandleState( + h2, win32.PIPE_READMODE_MESSAGE, None, None + ) + + try: + win32.ConnectNamedPipe(h1, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + + c1 = _multiprocessing.PipeConnection(h1, writable=duplex) + c2 = _multiprocessing.PipeConnection(h2, readable=duplex) + + return c1, c2 + +# +# Definitions for connections based on sockets +# + +class SocketListener(object): + ''' + Represtation of a socket which is bound to an address and listening + ''' + def __init__(self, address, family, backlog=1): + self._socket = socket.socket(getattr(socket, family)) + self._socket.bind(address) + self._socket.listen(backlog) + address = self._socket.getsockname() + if type(address) is tuple: + address = (socket.getfqdn(address[0]),) + address[1:] + self._address = address + self._family = family + self._last_accepted = None + + sub_debug('listener bound to address %r', self._address) + + if family == 'AF_UNIX': + self._unlink = Finalize( + self, os.unlink, args=(self._address,), exitpriority=0 + ) + else: + self._unlink = None + + def accept(self): + s, self._last_accepted = self._socket.accept() + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + + def close(self): + self._socket.close() + if self._unlink is not None: + self._unlink() + + +def SocketClient(address): + ''' + Return a connection object connected to the socket given by `address` + ''' + family = address_type(address) + s = socket.socket( getattr(socket, family) ) + + while 1: + try: + s.connect(address) + except socket.error, e: + if e.args[0] != 10061: # 10061 => connection refused + debug('failed to connect to address %s', address) + raise + time.sleep(0.01) + else: + break + else: + raise + + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + +# +# Definitions for connections based on named pipes +# + +if sys.platform == 'win32': + + class PipeListener(object): + ''' + Representation of a named pipe + ''' + def __init__(self, address, backlog=None): + self._address = address + handle = win32.CreateNamedPipe( + address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue = [handle] + self._last_accepted = None + + sub_debug('listener created with address=%r', self._address) + + self.close = Finalize( + self, PipeListener._finalize_pipe_listener, + args=(self._handle_queue, self._address), exitpriority=0 + ) + + def accept(self): + newhandle = win32.CreateNamedPipe( + self._address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue.append(newhandle) + handle = self._handle_queue.pop(0) + try: + win32.ConnectNamedPipe(handle, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + return _multiprocessing.PipeConnection(handle) + + @staticmethod + def _finalize_pipe_listener(queue, address): + sub_debug('closing listener with address=%r', address) + for handle in queue: + close(handle) + + def PipeClient(address): + ''' + Return a connection object connected to the pipe given by `address` + ''' + while 1: + try: + win32.WaitNamedPipe(address, 1000) + h = win32.CreateFile( + address, win32.GENERIC_READ | win32.GENERIC_WRITE, + 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + except WindowsError, e: + if e.args[0] not in (win32.ERROR_SEM_TIMEOUT, + win32.ERROR_PIPE_BUSY): + raise + else: + break + else: + raise + + win32.SetNamedPipeHandleState( + h, win32.PIPE_READMODE_MESSAGE, None, None + ) + return _multiprocessing.PipeConnection(h) + +# +# Authentication stuff +# + +MESSAGE_LENGTH = 20 + +CHALLENGE = '#CHALLENGE#' +WELCOME = '#WELCOME#' +FAILURE = '#FAILURE#' + +if sys.version_info >= (3, 0): # XXX can use bytes literals in 2.6/3.0 + CHALLENGE = CHALLENGE.encode('ascii') + WELCOME = WELCOME.encode('ascii') + FAILURE = FAILURE.encode('ascii') + +def deliver_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = os.urandom(MESSAGE_LENGTH) + connection.send_bytes(CHALLENGE + message) + digest = hmac.new(authkey, message).digest() + response = connection.recv_bytes(256) # reject large message + if response == digest: + connection.send_bytes(WELCOME) + else: + connection.send_bytes(FAILURE) + raise AuthenticationError('digest received was wrong') + +def answer_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = connection.recv_bytes(256) # reject large message + assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message + message = message[len(CHALLENGE):] + digest = hmac.new(authkey, message).digest() + connection.send_bytes(digest) + response = connection.recv_bytes(256) # reject large message + if response != WELCOME: + raise AuthenticationError('digest sent was rejected') + +# +# Support for using xmlrpclib for serialization +# + +class ConnectionWrapper(object): + def __init__(self, conn, dumps, loads): + self._conn = conn + self._dumps = dumps + self._loads = loads + for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): + obj = getattr(conn, attr) + setattr(self, attr, obj) + def send(self, obj): + s = self._dumps(obj) + self._conn.send_bytes(s) + def recv(self): + s = self._conn.recv_bytes() + return self._loads(s) + +def _xml_dumps(obj): + return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') + +def _xml_loads(s): + (obj,), method = xmlrpclib.loads(s.decode('utf8')) + return obj + +class XmlListener(Listener): + def accept(self): + global xmlrpclib + import xmlrpclib + obj = Listener.accept(self) + return ConnectionWrapper(obj, _xml_dumps, _xml_loads) + +def XmlClient(*args, **kwds): + global xmlrpclib + import xmlrpclib + return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) Added: python/trunk/Lib/multiprocessing/dummy/__init__.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/dummy/__init__.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,143 @@ +# +# Support for the API of the multiprocessing package using threads +# +# multiprocessing/dummy/__init__.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' + ] + +# +# Imports +# + +import threading +import sys +import weakref +import array +import itertools + +from multiprocessing import TimeoutError, cpu_count +from multiprocessing.dummy.connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event +from Queue import Queue + +# +# +# + +class DummyProcess(threading.Thread): + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + threading.Thread.__init__(self, group, target, name, args, kwargs) + self._pid = None + self._children = weakref.WeakKeyDictionary() + self._start_called = False + self._parent = current_process() + + def start(self): + assert self._parent is current_process() + self._start_called = True + self._parent._children[self] = None + threading.Thread.start(self) + + def get_exitcode(self): + if self._start_called and not self.isAlive(): + return 0 + else: + return None + + # XXX + if sys.version_info < (3, 0): + is_alive = threading.Thread.isAlive.im_func + get_name = threading.Thread.getName.im_func + set_name = threading.Thread.setName.im_func + is_daemon = threading.Thread.isDaemon.im_func + set_daemon = threading.Thread.setDaemon.im_func + else: + is_alive = threading.Thread.isAlive + get_name = threading.Thread.getName + set_name = threading.Thread.setName + is_daemon = threading.Thread.isDaemon + set_daemon = threading.Thread.setDaemon + +# +# +# + +class Condition(threading._Condition): + # XXX + if sys.version_info < (3, 0): + notify_all = threading._Condition.notifyAll.im_func + else: + notify_all = threading._Condition.notifyAll + +# +# +# + +Process = DummyProcess +current_process = threading.currentThread +current_process()._children = weakref.WeakKeyDictionary() + +def active_children(): + children = current_process()._children + for p in list(children): + if not p.isAlive(): + children.pop(p, None) + return list(children) + +def freeze_support(): + pass + +# +# +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +dict = dict +list = list + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def _get(self): + return self._value + def _set(self, value): + self._value = value + value = property(_get, _set) + def __repr__(self): + return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value) + +def Manager(): + return sys.modules[__name__] + +def shutdown(): + pass + +def Pool(processes=None, initializer=None, initargs=()): + from multiprocessing.pool import ThreadPool + return ThreadPool(processes, initializer, initargs) + +JoinableQueue = Queue Added: python/trunk/Lib/multiprocessing/dummy/connection.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/dummy/connection.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,61 @@ +# +# Analogue of `multiprocessing.connection` which uses queues instead of sockets +# +# multiprocessing/dummy/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +from Queue import Queue + + +families = [None] + + +class Listener(object): + + def __init__(self, address=None, family=None, backlog=1): + self._backlog_queue = Queue(backlog) + + def accept(self): + return Connection(*self._backlog_queue.get()) + + def close(self): + self._backlog_queue = None + + address = property(lambda self: self._backlog_queue) + + +def Client(address): + _in, _out = Queue(), Queue() + address.put((_out, _in)) + return Connection(_in, _out) + + +def Pipe(duplex=True): + a, b = Queue(), Queue() + return Connection(a, b), Connection(b, a) + + +class Connection(object): + + def __init__(self, _in, _out): + self._out = _out + self._in = _in + self.send = self.send_bytes = _out.put + self.recv = self.recv_bytes = _in.get + + def poll(self, timeout=0.0): + if self._in.qsize() > 0: + return True + if timeout <= 0.0: + return False + self._in.not_empty.acquire() + self._in.not_empty.wait(timeout) + self._in.not_empty.release() + return self._in.qsize() > 0 + + def close(self): + pass Added: python/trunk/Lib/multiprocessing/forking.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/forking.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,429 @@ +# +# Module for starting a process object using os.fork() or CreateProcess() +# +# multiprocessing/forking.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import os +import sys +import signal + +from multiprocessing import util, process + +__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close'] + +# +# Check that the current thread is spawning a child process +# + +def assert_spawning(self): + if not Popen.thread_is_spawning(): + raise RuntimeError( + '%s objects should only be shared between processes' + ' through inheritance' % type(self).__name__ + ) + +# +# Unix +# + +if sys.platform != 'win32': + import time + + exit = os._exit + duplicate = os.dup + close = os.close + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + + def __init__(self, process_obj): + sys.stdout.flush() + sys.stderr.flush() + self.returncode = None + + self.pid = os.fork() + if self.pid == 0: + if 'random' in sys.modules: + import random + random.seed() + code = process_obj._bootstrap() + sys.stdout.flush() + sys.stderr.flush() + os._exit(code) + + def poll(self, flag=os.WNOHANG): + if self.returncode is None: + pid, sts = os.waitpid(self.pid, flag) + if pid == self.pid: + if os.WIFSIGNALED(sts): + self.returncode = -os.WTERMSIG(sts) + else: + assert os.WIFEXITED(sts) + self.returncode = os.WEXITSTATUS(sts) + return self.returncode + + def wait(self, timeout=None): + if timeout is None: + return self.poll(0) + deadline = time.time() + timeout + delay = 0.0005 + while 1: + res = self.poll() + if res is not None: + break + remaining = deadline - time.time() + if remaining <= 0: + break + delay = min(delay * 2, remaining, 0.05) + time.sleep(delay) + return res + + def terminate(self): + if self.returncode is None: + try: + os.kill(self.pid, signal.SIGTERM) + except OSError, e: + if self.wait(timeout=0.1) is None: + raise + + @staticmethod + def thread_is_spawning(): + return False + +# +# Windows +# + +else: + import thread + import msvcrt + import _subprocess + import copy_reg + import time + + from ._multiprocessing import win32, Connection, PipeConnection + from .util import Finalize + + try: + from cPickle import dump, load, HIGHEST_PROTOCOL + except ImportError: + from pickle import dump, load, HIGHEST_PROTOCOL + + # + # + # + + TERMINATE = 0x10000 + WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) + + exit = win32.ExitProcess + close = win32.CloseHandle + + # + # _python_exe is the assumed path to the python executable. + # People embedding Python want to modify it. + # + + if sys.executable.lower().endswith('pythonservice.exe'): + _python_exe = os.path.join(sys.exec_prefix, 'python.exe') + else: + _python_exe = sys.executable + + def set_executable(exe): + global _python_exe + _python_exe = exe + + # + # + # + + def duplicate(handle, target_process=None, inheritable=False): + if target_process is None: + target_process = _subprocess.GetCurrentProcess() + return _subprocess.DuplicateHandle( + _subprocess.GetCurrentProcess(), handle, target_process, + 0, inheritable, _subprocess.DUPLICATE_SAME_ACCESS + ).Detach() + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + ''' + Start a subprocess to run the code of a process object + ''' + _tls = thread._local() + + def __init__(self, process_obj): + # create pipe for communication with child + rfd, wfd = os.pipe() + + # get handle for read end of the pipe and make it inheritable + rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True) + os.close(rfd) + + # start process + cmd = get_command_line() + [rhandle] + cmd = ' '.join('"%s"' % x for x in cmd) + hp, ht, pid, tid = _subprocess.CreateProcess( + _python_exe, cmd, None, None, 1, 0, None, None, None + ) + ht.Close() + close(rhandle) + + # set attributes of self + self.pid = pid + self.returncode = None + self._handle = hp + + # send information to child + prep_data = get_preparation_data(process_obj._name) + to_child = os.fdopen(wfd, 'wb') + Popen._tls.process_handle = int(hp) + try: + dump(prep_data, to_child, HIGHEST_PROTOCOL) + dump(process_obj, to_child, HIGHEST_PROTOCOL) + finally: + del Popen._tls.process_handle + to_child.close() + + @staticmethod + def thread_is_spawning(): + return getattr(Popen._tls, 'process_handle', None) is not None + + @staticmethod + def duplicate_for_child(handle): + return duplicate(handle, Popen._tls.process_handle) + + def wait(self, timeout=None): + if self.returncode is None: + if timeout is None: + msecs = _subprocess.INFINITE + else: + msecs = max(0, int(timeout * 1000 + 0.5)) + + res = _subprocess.WaitForSingleObject(int(self._handle), msecs) + if res == _subprocess.WAIT_OBJECT_0: + code = _subprocess.GetExitCodeProcess(self._handle) + if code == TERMINATE: + code = -signal.SIGTERM + self.returncode = code + + return self.returncode + + def poll(self): + return self.wait(timeout=0) + + def terminate(self): + if self.returncode is None: + try: + _subprocess.TerminateProcess(int(self._handle), TERMINATE) + except WindowsError: + if self.wait(timeout=0.1) is None: + raise + + # + # + # + + def is_forking(argv): + ''' + Return whether commandline indicates we are forking + ''' + if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': + assert len(argv) == 3 + return True + else: + return False + + + def freeze_support(): + ''' + Run code for process object if this in not the main process + ''' + if is_forking(sys.argv): + main() + sys.exit() + + + def get_command_line(): + ''' + Returns prefix of command line used for spawning a child process + ''' + if process.current_process()._identity==() and is_forking(sys.argv): + raise RuntimeError(''' + Attempt to start a new process before the current process + has finished its bootstrapping phase. + + This probably means that you are on Windows and you have + forgotten to use the proper idiom in the main module: + + if __name__ == '__main__': + freeze_support() + ... + + The "freeze_support()" line can be omitted if the program + is not going to be frozen to produce a Windows executable.''') + + if getattr(sys, 'frozen', False): + return [sys.executable, '--multiprocessing-fork'] + else: + prog = 'from multiprocessing.forking import main; main()' + return [_python_exe, '-c', prog, '--multiprocessing-fork'] + + + def main(): + ''' + Run code specifed by data received over pipe + ''' + assert is_forking(sys.argv) + + handle = int(sys.argv[-1]) + fd = msvcrt.open_osfhandle(handle, os.O_RDONLY) + from_parent = os.fdopen(fd, 'rb') + + process.current_process()._inheriting = True + preparation_data = load(from_parent) + prepare(preparation_data) + self = load(from_parent) + process.current_process()._inheriting = False + + from_parent.close() + + exitcode = self._bootstrap() + exit(exitcode) + + + def get_preparation_data(name): + ''' + Return info about parent needed by child to unpickle process object + ''' + from .util import _logger, _log_to_stderr + + d = dict( + name=name, + sys_path=sys.path, + sys_argv=sys.argv, + log_to_stderr=_log_to_stderr, + orig_dir=process.ORIGINAL_DIR, + authkey=process.current_process().get_authkey(), + ) + + if _logger is not None: + d['log_level'] = _logger.getEffectiveLevel() + + if not WINEXE: + main_path = getattr(sys.modules['__main__'], '__file__', None) + if not main_path and sys.argv[0] not in ('', '-c'): + main_path = sys.argv[0] + if main_path is not None: + if not os.path.isabs(main_path) and \ + process.ORIGINAL_DIR is not None: + main_path = os.path.join(process.ORIGINAL_DIR, main_path) + d['main_path'] = os.path.normpath(main_path) + + return d + + # + # Make (Pipe)Connection picklable + # + + def reduce_connection(conn): + if not Popen.thread_is_spawning(): + raise RuntimeError( + 'By default %s objects can only be shared between processes\n' + 'using inheritance' % type(conn).__name__ + ) + return type(conn), (Popen.duplicate_for_child(conn.fileno()), + conn.readable, conn.writable) + + copy_reg.pickle(Connection, reduce_connection) + copy_reg.pickle(PipeConnection, reduce_connection) + + +# +# Prepare current process +# + +old_main_modules = [] + +def prepare(data): + ''' + Try to get current process ready to unpickle process object + ''' + old_main_modules.append(sys.modules['__main__']) + + if 'name' in data: + process.current_process().set_name(data['name']) + + if 'authkey' in data: + process.current_process()._authkey = data['authkey'] + + if 'log_to_stderr' in data and data['log_to_stderr']: + util.log_to_stderr() + + if 'log_level' in data: + util.get_logger().setLevel(data['log_level']) + + if 'sys_path' in data: + sys.path = data['sys_path'] + + if 'sys_argv' in data: + sys.argv = data['sys_argv'] + + if 'dir' in data: + os.chdir(data['dir']) + + if 'orig_dir' in data: + process.ORIGINAL_DIR = data['orig_dir'] + + if 'main_path' in data: + main_path = data['main_path'] + main_name = os.path.splitext(os.path.basename(main_path))[0] + if main_name == '__init__': + main_name = os.path.basename(os.path.dirname(main_path)) + + if main_name != 'ipython': + import imp + + if main_path is None: + dirs = None + elif os.path.basename(main_path).startswith('__init__.py'): + dirs = [os.path.dirname(os.path.dirname(main_path))] + else: + dirs = [os.path.dirname(main_path)] + + assert main_name not in sys.modules, main_name + file, path_name, etc = imp.find_module(main_name, dirs) + try: + # We would like to do "imp.load_module('__main__', ...)" + # here. However, that would cause 'if __name__ == + # "__main__"' clauses to be executed. + main_module = imp.load_module( + '__parents_main__', file, path_name, etc + ) + finally: + if file: + file.close() + + sys.modules['__main__'] = main_module + main_module.__name__ = '__main__' + + # Try to make the potentially picklable objects in + # sys.modules['__main__'] realize they are in the main + # module -- somewhat ugly. + for obj in main_module.__dict__.values(): + try: + if obj.__module__ == '__parents_main__': + obj.__module__ = '__main__' + except Exception: + pass Added: python/trunk/Lib/multiprocessing/heap.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/heap.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,201 @@ +# +# Module which supports allocation of memory from an mmap +# +# multiprocessing/heap.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import bisect +import mmap +import tempfile +import os +import sys +import threading +import itertools + +import _multiprocessing +from multiprocessing.util import Finalize, info +from multiprocessing.forking import assert_spawning + +__all__ = ['BufferWrapper'] + +# +# Inheirtable class which wraps an mmap, and from which blocks can be allocated +# + +if sys.platform == 'win32': + + from ._multiprocessing import win32 + + class Arena(object): + + _counter = itertools.count() + + def __init__(self, size): + self.size = size + self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == 0, 'tagname already in use' + self._state = (self.size, self.name) + + def __getstate__(self): + assert_spawning(self) + return self._state + + def __setstate__(self, state): + self.size, self.name = self._state = state + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS + +else: + + class Arena(object): + + def __init__(self, size): + self.buffer = mmap.mmap(-1, size) + self.size = size + self.name = None + +# +# Class allowing allocation of chunks of memory from arenas +# + +class Heap(object): + + _alignment = 8 + + def __init__(self, size=mmap.PAGESIZE): + self._lastpid = os.getpid() + self._lock = threading.Lock() + self._size = size + self._lengths = [] + self._len_to_seq = {} + self._start_to_block = {} + self._stop_to_block = {} + self._allocated_blocks = set() + self._arenas = [] + + @staticmethod + def _roundup(n, alignment): + # alignment must be a power of 2 + mask = alignment - 1 + return (n + mask) & ~mask + + def _malloc(self, size): + # returns a large enough block -- it might be much larger + i = bisect.bisect_left(self._lengths, size) + if i == len(self._lengths): + length = self._roundup(max(self._size, size), mmap.PAGESIZE) + self._size *= 2 + info('allocating a new mmap of length %d', length) + arena = Arena(length) + self._arenas.append(arena) + return (arena, 0, length) + else: + length = self._lengths[i] + seq = self._len_to_seq[length] + block = seq.pop() + if not seq: + del self._len_to_seq[length], self._lengths[i] + + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + return block + + def _free(self, block): + # free location and try to merge with neighbours + (arena, start, stop) = block + + try: + prev_block = self._stop_to_block[(arena, start)] + except KeyError: + pass + else: + start, _ = self._absorb(prev_block) + + try: + next_block = self._start_to_block[(arena, stop)] + except KeyError: + pass + else: + _, stop = self._absorb(next_block) + + block = (arena, start, stop) + length = stop - start + + try: + self._len_to_seq[length].append(block) + except KeyError: + self._len_to_seq[length] = [block] + bisect.insort(self._lengths, length) + + self._start_to_block[(arena, start)] = block + self._stop_to_block[(arena, stop)] = block + + def _absorb(self, block): + # deregister this block so it can be merged with a neighbour + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + + length = stop - start + seq = self._len_to_seq[length] + seq.remove(block) + if not seq: + del self._len_to_seq[length] + self._lengths.remove(length) + + return start, stop + + def free(self, block): + # free a block returned by malloc() + assert os.getpid() == self._lastpid + self._lock.acquire() + try: + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() + + def malloc(self, size): + # return a block of right size (possibly rounded up) + assert 0 <= size < sys.maxint + if os.getpid() != self._lastpid: + self.__init__() # reinitialize after fork + self._lock.acquire() + try: + size = self._roundup(max(size,1), self._alignment) + (arena, start, stop) = self._malloc(size) + new_stop = start + size + if new_stop < stop: + self._free((arena, new_stop, stop)) + block = (arena, start, new_stop) + self._allocated_blocks.add(block) + return block + finally: + self._lock.release() + +# +# Class representing a chunk of an mmap -- can be inherited +# + +class BufferWrapper(object): + + _heap = Heap() + + def __init__(self, size): + assert 0 <= size < sys.maxint + block = BufferWrapper._heap.malloc(size) + self._state = (block, size) + Finalize(self, BufferWrapper._heap.free, args=(block,)) + + def get_address(self): + (arena, start, stop), size = self._state + address, length = _multiprocessing.address_of_buffer(arena.buffer) + assert size <= length + return address + start + + def get_size(self): + return self._state[1] Added: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/managers.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,1092 @@ +# +# Module providing the `SyncManager` class for dealing +# with shared objects +# +# multiprocessing/managers.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] + +# +# Imports +# + +import os +import sys +import weakref +import threading +import array +import copy_reg +import Queue + +from traceback import format_exc +from multiprocessing import Process, current_process, active_children, Pool, util, connection +from multiprocessing.process import AuthenticationString +from multiprocessing.forking import exit, Popen, assert_spawning +from multiprocessing.util import Finalize, info + +try: + from cPickle import PicklingError +except ImportError: + from pickle import PicklingError + +# +# +# + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Register some things for pickling +# + +def reduce_array(a): + return array.array, (a.typecode, a.tostring()) +copy_reg.pickle(array.array, reduce_array) + +view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] +if view_types[0] is not list: # XXX only needed in Py3.0 + def rebuild_as_list(obj): + return list, (list(obj),) + for view_type in view_types: + copy_reg.pickle(view_type, rebuild_as_list) + +# +# Type for identifying shared objects +# + +class Token(object): + ''' + Type to uniquely indentify a shared object + ''' + __slots__ = ('typeid', 'address', 'id') + + def __init__(self, typeid, address, id): + (self.typeid, self.address, self.id) = (typeid, address, id) + + def __getstate__(self): + return (self.typeid, self.address, self.id) + + def __setstate__(self, state): + (self.typeid, self.address, self.id) = state + + def __repr__(self): + return 'Token(typeid=%r, address=%r, id=%r)' % \ + (self.typeid, self.address, self.id) + +# +# Function for communication with a manager's server process +# + +def dispatch(c, id, methodname, args=(), kwds={}): + ''' + Send a message to manager using connection `c` and return response + ''' + c.send((id, methodname, args, kwds)) + kind, result = c.recv() + if kind == '#RETURN': + return result + raise convert_to_error(kind, result) + +def convert_to_error(kind, result): + if kind == '#ERROR': + return result + elif kind == '#TRACEBACK': + assert type(result) is str + return RemoteError(result) + elif kind == '#UNSERIALIZABLE': + assert type(result) is str + return RemoteError('Unserializable message: %s\n' % result) + else: + return ValueError('Unrecognized message type') + +class RemoteError(Exception): + def __str__(self): + return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) + +# +# Functions for finding the method names of an object +# + +def all_methods(obj): + ''' + Return a list of names of methods of `obj` + ''' + temp = [] + for name in dir(obj): + func = getattr(obj, name) + if hasattr(func, '__call__'): + temp.append(name) + return temp + +def public_methods(obj): + ''' + Return a list of names of methods of `obj` which do not start with '_' + ''' + return [name for name in all_methods(obj) if name[0] != '_'] + +# +# Server which is run in a process controlled by a manager +# + +class Server(object): + ''' + Server class which runs in a process controlled by a manager object + ''' + public = ['shutdown', 'create', 'accept_connection', 'get_methods', + 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] + + def __init__(self, registry, address, authkey, serializer): + assert isinstance(authkey, bytes) + self.registry = registry + self.authkey = AuthenticationString(authkey) + Listener, Client = listener_client[serializer] + + # do authentication later + self.listener = Listener(address=address, backlog=5) + self.address = self.listener.address + + self.id_to_obj = {0: (None, ())} + self.id_to_refcount = {} + self.mutex = threading.RLock() + self.stop = 0 + + def serve_forever(self): + ''' + Run the server forever + ''' + current_process()._manager_server = self + try: + try: + while 1: + try: + c = self.listener.accept() + except (OSError, IOError): + continue + t = threading.Thread(target=self.handle_request, args=(c,)) + t.setDaemon(True) + t.start() + except (KeyboardInterrupt, SystemExit): + pass + finally: + self.stop = 999 + self.listener.close() + + def handle_request(self, c): + ''' + Handle a new connection + ''' + funcname = result = request = None + try: + connection.deliver_challenge(c, self.authkey) + connection.answer_challenge(c, self.authkey) + request = c.recv() + ignore, funcname, args, kwds = request + assert funcname in self.public, '%r unrecognized' % funcname + func = getattr(self, funcname) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + try: + result = func(c, *args, **kwds) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + msg = ('#RETURN', result) + try: + c.send(msg) + except Exception, e: + try: + c.send(('#TRACEBACK', format_exc())) + except Exception: + pass + util.info('Failure to send message: %r', msg) + util.info(' ... request was %r', request) + util.info(' ... exception was %r', e) + + c.close() + + def serve_client(self, conn): + ''' + Handle requests from the proxies in a particular process/thread + ''' + util.debug('starting server thread to service %r', + threading.currentThread().getName()) + + recv = conn.recv + send = conn.send + id_to_obj = self.id_to_obj + + while not self.stop: + + try: + methodname = obj = None + request = recv() + ident, methodname, args, kwds = request + obj, exposed, gettypeid = id_to_obj[ident] + + if methodname not in exposed: + raise AttributeError( + 'method %r of %r object is not in exposed=%r' % + (methodname, type(obj), exposed) + ) + + function = getattr(obj, methodname) + + try: + res = function(*args, **kwds) + except Exception, e: + msg = ('#ERROR', e) + else: + typeid = gettypeid and gettypeid.get(methodname, None) + if typeid: + rident, rexposed = self.create(conn, typeid, res) + token = Token(typeid, self.address, rident) + msg = ('#PROXY', (rexposed, token)) + else: + msg = ('#RETURN', res) + + except AttributeError: + if methodname is None: + msg = ('#TRACEBACK', format_exc()) + else: + try: + fallback_func = self.fallback_mapping[methodname] + result = fallback_func( + self, conn, ident, obj, *args, **kwds + ) + msg = ('#RETURN', result) + except Exception: + msg = ('#TRACEBACK', format_exc()) + + except EOFError: + util.debug('got EOF -- exiting thread serving %r', + threading.currentThread().getName()) + sys.exit(0) + + except Exception: + msg = ('#TRACEBACK', format_exc()) + + try: + try: + send(msg) + except Exception, e: + send(('#UNSERIALIZABLE', repr(msg))) + except Exception, e: + util.info('exception in thread serving %r', + threading.currentThread().getName()) + util.info(' ... message was %r', msg) + util.info(' ... exception was %r', e) + conn.close() + sys.exit(1) + + def fallback_getvalue(self, conn, ident, obj): + return obj + + def fallback_str(self, conn, ident, obj): + return str(obj) + + def fallback_repr(self, conn, ident, obj): + return repr(obj) + + fallback_mapping = { + '__str__':fallback_str, + '__repr__':fallback_repr, + '#GETVALUE':fallback_getvalue + } + + def dummy(self, c): + pass + + def debug_info(self, c): + ''' + Return some info --- useful to spot problems with refcounting + ''' + self.mutex.acquire() + try: + result = [] + keys = self.id_to_obj.keys() + keys.sort() + for ident in keys: + if ident != 0: + result.append(' %s: refcount=%s\n %s' % + (ident, self.id_to_refcount[ident], + str(self.id_to_obj[ident][0])[:75])) + return '\n'.join(result) + finally: + self.mutex.release() + + def number_of_objects(self, c): + ''' + Number of shared objects + ''' + return len(self.id_to_obj) - 1 # don't count ident=0 + + def shutdown(self, c): + ''' + Shutdown this process + ''' + try: + try: + util.debug('manager received shutdown message') + c.send(('#RETURN', None)) + + if sys.stdout != sys.__stdout__: + util.debug('resetting stdout, stderr') + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + + util._run_finalizers(0) + + for p in active_children(): + util.debug('terminating a child process of manager') + p.terminate() + + for p in active_children(): + util.debug('terminating a child process of manager') + p.join() + + util._run_finalizers() + util.info('manager exiting with exitcode 0') + except: + import traceback + traceback.print_exc() + finally: + exit(0) + + def create(self, c, typeid, *args, **kwds): + ''' + Create a new shared object and return its id + ''' + self.mutex.acquire() + try: + callable, exposed, method_to_typeid, proxytype = \ + self.registry[typeid] + + if callable is None: + assert len(args) == 1 and not kwds + obj = args[0] + else: + obj = callable(*args, **kwds) + + if exposed is None: + exposed = public_methods(obj) + if method_to_typeid is not None: + assert type(method_to_typeid) is dict + exposed = list(exposed) + list(method_to_typeid) + + ident = '%x' % id(obj) # convert to string because xmlrpclib + # only has 32 bit signed integers + util.debug('%r callable returned object with id %r', typeid, ident) + + self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) + if ident not in self.id_to_refcount: + self.id_to_refcount[ident] = None + return ident, tuple(exposed) + finally: + self.mutex.release() + + def get_methods(self, c, token): + ''' + Return the methods of the shared object indicated by token + ''' + return tuple(self.id_to_obj[token.id][1]) + + def accept_connection(self, c, name): + ''' + Spawn a new thread to serve this connection + ''' + threading.currentThread().setName(name) + c.send(('#RETURN', None)) + self.serve_client(c) + + def incref(self, c, ident): + self.mutex.acquire() + try: + try: + self.id_to_refcount[ident] += 1 + except TypeError: + assert self.id_to_refcount[ident] is None + self.id_to_refcount[ident] = 1 + finally: + self.mutex.release() + + def decref(self, c, ident): + self.mutex.acquire() + try: + assert self.id_to_refcount[ident] >= 1 + self.id_to_refcount[ident] -= 1 + if self.id_to_refcount[ident] == 0: + del self.id_to_obj[ident], self.id_to_refcount[ident] + util.debug('disposing of obj with id %d', ident) + finally: + self.mutex.release() + +# +# Class to represent state of a manager +# + +class State(object): + __slots__ = ['value'] + INITIAL = 0 + STARTED = 1 + SHUTDOWN = 2 + +# +# Mapping from serializer name to Listener and Client types +# + +listener_client = { + 'pickle' : (connection.Listener, connection.Client), + 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) + } + +# +# Definition of BaseManager +# + +class BaseManager(object): + ''' + Base class for managers + ''' + _registry = {} + _Server = Server + + def __init__(self, address=None, authkey=None, serializer='pickle'): + if authkey is None: + authkey = current_process().get_authkey() + self._address = address # XXX not final address if eg ('', 0) + self._authkey = AuthenticationString(authkey) + self._state = State() + self._state.value = State.INITIAL + self._serializer = serializer + self._Listener, self._Client = listener_client[serializer] + + def __reduce__(self): + return type(self).from_address, \ + (self._address, self._authkey, self._serializer) + + def get_server(self): + ''' + Return server object with serve_forever() method and address attribute + ''' + assert self._state.value == State.INITIAL + return Server(self._registry, self._address, + self._authkey, self._serializer) + + def connect(self): + ''' + Connect manager object to the server process + ''' + Listener, Client = listener_client[self._serializer] + conn = Client(self._address, authkey=self._authkey) + dispatch(conn, None, 'dummy') + self._state.value = State.STARTED + + def start(self): + ''' + Spawn a server process for this manager object + ''' + assert self._state.value == State.INITIAL + + # pipe over which we will retrieve address of server + reader, writer = connection.Pipe(duplex=False) + + # spawn process which runs a server + self._process = Process( + target=type(self)._run_server, + args=(self._registry, self._address, self._authkey, + self._serializer, writer), + ) + ident = ':'.join(str(i) for i in self._process._identity) + self._process.set_name(type(self).__name__ + '-' + ident) + self._process.start() + + # get address of server + writer.close() + self._address = reader.recv() + reader.close() + + # register a finalizer + self._state.value = State.STARTED + self.shutdown = util.Finalize( + self, type(self)._finalize_manager, + args=(self._process, self._address, self._authkey, + self._state, self._Client), + exitpriority=0 + ) + + @classmethod + def _run_server(cls, registry, address, authkey, serializer, writer): + ''' + Create a server, report its address and run it + ''' + # create server + server = cls._Server(registry, address, authkey, serializer) + + # inform parent process of the server's address + writer.send(server.address) + writer.close() + + # run the manager + util.info('manager serving at %r', server.address) + server.serve_forever() + + def _create(self, typeid, *args, **kwds): + ''' + Create a new shared object; return the token and exposed tuple + ''' + assert self._state.value == State.STARTED, 'server not yet started' + conn = self._Client(self._address, authkey=self._authkey) + try: + id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) + finally: + conn.close() + return Token(typeid, self._address, id), exposed + + def join(self, timeout=None): + ''' + Join the manager process (if it has been spawned) + ''' + self._process.join(timeout) + + def _debug_info(self): + ''' + Return some info about the servers shared objects and connections + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'debug_info') + finally: + conn.close() + + def _number_of_objects(self): + ''' + Return the number of shared objects + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'number_of_objects') + finally: + conn.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown() + + @staticmethod + def _finalize_manager(process, address, authkey, state, _Client): + ''' + Shutdown the manager process; will be registered as a finalizer + ''' + if process.is_alive(): + util.info('sending shutdown message to manager') + try: + conn = _Client(address, authkey=authkey) + try: + dispatch(conn, None, 'shutdown') + finally: + conn.close() + except Exception: + pass + + process.join(timeout=0.2) + if process.is_alive(): + util.info('manager still alive') + if hasattr(process, 'terminate'): + util.info('trying to `terminate()` manager process') + process.terminate() + process.join(timeout=0.1) + if process.is_alive(): + util.info('manager still alive after terminate') + + state.value = State.SHUTDOWN + try: + del BaseProxy._address_to_local[address] + except KeyError: + pass + + address = property(lambda self: self._address) + + @classmethod + def register(cls, typeid, callable=None, proxytype=None, exposed=None, + method_to_typeid=None, create_method=True): + ''' + Register a typeid with the manager type + ''' + if '_registry' not in cls.__dict__: + cls._registry = cls._registry.copy() + + if proxytype is None: + proxytype = AutoProxy + + exposed = exposed or getattr(proxytype, '_exposed_', None) + + method_to_typeid = method_to_typeid or \ + getattr(proxytype, '_method_to_typeid_', None) + + if method_to_typeid: + for key, value in method_to_typeid.items(): + assert type(key) is str, '%r is not a string' % key + assert type(value) is str, '%r is not a string' % value + + cls._registry[typeid] = ( + callable, exposed, method_to_typeid, proxytype + ) + + if create_method: + def temp(self, *args, **kwds): + util.debug('requesting creation of a shared %r object', typeid) + token, exp = self._create(typeid, *args, **kwds) + proxy = proxytype( + token, self._serializer, manager=self, + authkey=self._authkey, exposed=exp + ) + return proxy + temp.__name__ = typeid + setattr(cls, typeid, temp) + +# +# Subclass of set which get cleared after a fork +# + +class ProcessLocalSet(set): + def __init__(self): + util.register_after_fork(self, lambda obj: obj.clear()) + def __reduce__(self): + return type(self), () + +# +# Definition of BaseProxy +# + +class BaseProxy(object): + ''' + A base for proxies of shared objects + ''' + _address_to_local = {} + _mutex = util.ForkAwareThreadLock() + + def __init__(self, token, serializer, manager=None, + authkey=None, exposed=None, incref=True): + BaseProxy._mutex.acquire() + try: + tls_idset = BaseProxy._address_to_local.get(token.address, None) + if tls_idset is None: + tls_idset = util.ForkAwareLocal(), ProcessLocalSet() + BaseProxy._address_to_local[token.address] = tls_idset + finally: + BaseProxy._mutex.release() + + # self._tls is used to record the connection used by this + # thread to communicate with the manager at token.address + self._tls = tls_idset[0] + + # self._idset is used to record the identities of all shared + # objects for which the current process owns references and + # which are in the manager at token.address + self._idset = tls_idset[1] + + self._token = token + self._id = self._token.id + self._manager = manager + self._serializer = serializer + self._Client = listener_client[serializer][1] + + if authkey is not None: + self._authkey = AuthenticationString(authkey) + elif self._manager is not None: + self._authkey = self._manager._authkey + else: + self._authkey = current_process().get_authkey() + + if incref: + self._incref() + + util.register_after_fork(self, BaseProxy._after_fork) + + def _connect(self): + util.debug('making connection to manager') + name = current_process().get_name() + if threading.currentThread().getName() != 'MainThread': + name += '|' + threading.currentThread().getName() + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'accept_connection', (name,)) + self._tls.connection = conn + + def _callmethod(self, methodname, args=(), kwds={}): + ''' + Try to call a method of the referrent and return a copy of the result + ''' + try: + conn = self._tls.connection + except AttributeError: + util.debug('thread %r does not own a connection', + threading.currentThread().getName()) + self._connect() + conn = self._tls.connection + + conn.send((self._id, methodname, args, kwds)) + kind, result = conn.recv() + + if kind == '#RETURN': + return result + elif kind == '#PROXY': + exposed, token = result + proxytype = self._manager._registry[token.typeid][-1] + return proxytype( + token, self._serializer, manager=self._manager, + authkey=self._authkey, exposed=exposed + ) + raise convert_to_error(kind, result) + + def _getvalue(self): + ''' + Get a copy of the value of the referent + ''' + return self._callmethod('#GETVALUE') + + def _incref(self): + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'incref', (self._id,)) + util.debug('INCREF %r', self._token.id) + + self._idset.add(self._id) + + state = self._manager and self._manager._state + + self._close = util.Finalize( + self, BaseProxy._decref, + args=(self._token, self._authkey, state, + self._tls, self._idset, self._Client), + exitpriority=10 + ) + + @staticmethod + def _decref(token, authkey, state, tls, idset, _Client): + idset.discard(token.id) + + # check whether manager is still alive + if state is None or state.value == State.STARTED: + # tell manager this process no longer cares about referent + try: + util.debug('DECREF %r', token.id) + conn = _Client(token.address, authkey=authkey) + dispatch(conn, None, 'decref', (token.id,)) + except Exception, e: + util.debug('... decref failed %s', e) + + else: + util.debug('DECREF %r -- manager already shutdown', token.id) + + # check whether we can close this thread's connection because + # the process owns no more references to objects for this manager + if not idset and hasattr(tls, 'connection'): + util.debug('thread %r has no more proxies so closing conn', + threading.currentThread().getName()) + tls.connection.close() + del tls.connection + + def _after_fork(self): + self._manager = None + try: + self._incref() + except Exception, e: + # the proxy may just be for a manager which has shutdown + util.info('incref failed: %s' % e) + + def __reduce__(self): + kwds = {} + if Popen.thread_is_spawning(): + kwds['authkey'] = self._authkey + + if getattr(self, '_isauto', False): + kwds['exposed'] = self._exposed_ + return (RebuildProxy, + (AutoProxy, self._token, self._serializer, kwds)) + else: + return (RebuildProxy, + (type(self), self._token, self._serializer, kwds)) + + def __deepcopy__(self, memo): + return self._getvalue() + + def __repr__(self): + return '<%s object, typeid %r at %s>' % \ + (type(self).__name__, self._token.typeid, '0x%x' % id(self)) + + def __str__(self): + ''' + Return representation of the referent (or a fall-back if that fails) + ''' + try: + return self._callmethod('__repr__') + except Exception: + return repr(self)[:-1] + "; '__str__()' failed>" + +# +# Function used for unpickling +# + +def RebuildProxy(func, token, serializer, kwds): + ''' + Function used for unpickling proxy objects. + + If possible the shared object is returned, or otherwise a proxy for it. + ''' + server = getattr(current_process(), '_manager_server', None) + + if server and server.address == token.address: + return server.id_to_obj[token.id][0] + else: + incref = ( + kwds.pop('incref', True) and + not getattr(current_process(), '_inheriting', False) + ) + return func(token, serializer, incref=incref, **kwds) + +# +# Functions to create proxies and proxy types +# + +def MakeProxyType(name, exposed, _cache={}): + ''' + Return an proxy type whose methods are given by `exposed` + ''' + exposed = tuple(exposed) + try: + return _cache[(name, exposed)] + except KeyError: + pass + + dic = {} + + for meth in exposed: + exec '''def %s(self, *args, **kwds): + return self._callmethod(%r, args, kwds)''' % (meth, meth) in dic + + ProxyType = type(name, (BaseProxy,), dic) + ProxyType._exposed_ = exposed + _cache[(name, exposed)] = ProxyType + return ProxyType + + +def AutoProxy(token, serializer, manager=None, authkey=None, + exposed=None, incref=True): + ''' + Return an auto-proxy for `token` + ''' + _Client = listener_client[serializer][1] + + if exposed is None: + conn = _Client(token.address, authkey=authkey) + try: + exposed = dispatch(conn, None, 'get_methods', (token,)) + finally: + conn.close() + + if authkey is None and manager is not None: + authkey = manager._authkey + if authkey is None: + authkey = current_process().get_authkey() + + ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) + proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, + incref=incref) + proxy._isauto = True + return proxy + +# +# Types/callables which we will register with SyncManager +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def get(self): + return self._value + def set(self, value): + self._value = value + def __repr__(self): + return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) + value = property(get, set) + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +# +# Proxy types used by SyncManager +# + +class IteratorProxy(BaseProxy): + # XXX remove methods for Py3.0 and Py2.6 + _exposed_ = ('__next__', 'next', 'send', 'throw', 'close') + def __iter__(self): + return self + def __next__(self, *args): + return self._callmethod('__next__', args) + def next(self, *args): + return self._callmethod('next', args) + def send(self, *args): + return self._callmethod('send', args) + def throw(self, *args): + return self._callmethod('throw', args) + def close(self, *args): + return self._callmethod('close', args) + + +class AcquirerProxy(BaseProxy): + _exposed_ = ('acquire', 'release') + def acquire(self, blocking=True): + return self._callmethod('acquire', (blocking,)) + def release(self): + return self._callmethod('release') + def __enter__(self): + return self._callmethod('acquire') + def __exit__(self, exc_type, exc_val, exc_tb): + return self._callmethod('release') + + +class ConditionProxy(AcquirerProxy): + # XXX will Condition.notfyAll() name be available in Py3.0? + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notifyAll') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + def notify(self): + return self._callmethod('notify') + def notify_all(self): + return self._callmethod('notifyAll') + +class EventProxy(BaseProxy): + # XXX will Event.isSet name be available in Py3.0? + _exposed_ = ('isSet', 'set', 'clear', 'wait') + def is_set(self): + return self._callmethod('isSet') + def set(self): + return self._callmethod('set') + def clear(self): + return self._callmethod('clear') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + +class NamespaceProxy(BaseProxy): + _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') + def __getattr__(self, key): + if key[0] == '_': + return object.__getattribute__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__getattribute__', (key,)) + def __setattr__(self, key, value): + if key[0] == '_': + return object.__setattr__(self, key, value) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__setattr__', (key, value)) + def __delattr__(self, key): + if key[0] == '_': + return object.__delattr__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__delattr__', (key,)) + + +class ValueProxy(BaseProxy): + _exposed_ = ('get', 'set') + def get(self): + return self._callmethod('get') + def set(self, value): + return self._callmethod('set', (value,)) + value = property(get, set) + + +BaseListProxy = MakeProxyType('BaseListProxy', ( + '__add__', '__contains__', '__delitem__', '__delslice__', + '__getitem__', '__getslice__', '__len__', '__mul__', + '__reversed__', '__rmul__', '__setitem__', '__setslice__', + 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', + 'reverse', 'sort', '__imul__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 +class ListProxy(BaseListProxy): + def __iadd__(self, value): + self._callmethod('extend', (value,)) + return self + def __imul__(self, value): + self._callmethod('__imul__', (value,)) + return self + + +DictProxy = MakeProxyType('DictProxy', ( + '__contains__', '__delitem__', '__getitem__', '__len__', + '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', + 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' + )) + + +ArrayProxy = MakeProxyType('ArrayProxy', ( + '__len__', '__getitem__', '__setitem__', '__getslice__', '__setslice__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 + + +PoolProxy = MakeProxyType('PoolProxy', ( + 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', + 'map', 'map_async', 'terminate' + )) +PoolProxy._method_to_typeid_ = { + 'apply_async': 'AsyncResult', + 'map_async': 'AsyncResult', + 'imap': 'Iterator', + 'imap_unordered': 'Iterator' + } + +# +# Definition of SyncManager +# + +class SyncManager(BaseManager): + ''' + Subclass of `BaseManager` which supports a number of shared object types. + + The types registered are those intended for the synchronization + of threads, plus `dict`, `list` and `Namespace`. + + The `multiprocessing.Manager()` function creates started instances of + this class. + ''' + +SyncManager.register('Queue', Queue.Queue) +SyncManager.register('JoinableQueue', Queue.Queue) +SyncManager.register('Event', threading.Event, EventProxy) +SyncManager.register('Lock', threading.Lock, AcquirerProxy) +SyncManager.register('RLock', threading.RLock, AcquirerProxy) +SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) +SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, + AcquirerProxy) +SyncManager.register('Condition', threading.Condition, ConditionProxy) +SyncManager.register('Pool', Pool, PoolProxy) +SyncManager.register('list', list, ListProxy) +SyncManager.register('dict', dict, DictProxy) +SyncManager.register('Value', Value, ValueProxy) +SyncManager.register('Array', Array, ArrayProxy) +SyncManager.register('Namespace', Namespace, NamespaceProxy) + +# types returned by methods of PoolProxy +SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) +SyncManager.register('AsyncResult', create_method=False) Added: python/trunk/Lib/multiprocessing/pool.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/pool.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,596 @@ +# +# Module providing the `Pool` class for managing a process pool +# +# multiprocessing/pool.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Pool'] + +# +# Imports +# + +import threading +import Queue +import itertools +import collections +import time + +from multiprocessing import Process, cpu_count, TimeoutError +from multiprocessing.util import Finalize, debug + +# +# Constants representing the state of a pool +# + +RUN = 0 +CLOSE = 1 +TERMINATE = 2 + +# +# Miscellaneous +# + +job_counter = itertools.count() + +def mapstar(args): + return map(*args) + +# +# Code run by worker processes +# + +def worker(inqueue, outqueue, initializer=None, initargs=()): + put = outqueue.put + get = inqueue.get + if hasattr(inqueue, '_writer'): + inqueue._writer.close() + outqueue._reader.close() + + if initializer is not None: + initializer(*initargs) + + while 1: + try: + task = get() + except (EOFError, IOError): + debug('worker got EOFError or IOError -- exiting') + break + + if task is None: + debug('worker got sentinel -- exiting') + break + + job, i, func, args, kwds = task + try: + result = (True, func(*args, **kwds)) + except Exception, e: + result = (False, e) + put((job, i, result)) + +# +# Class representing a process pool +# + +class Pool(object): + ''' + Class which supports an async version of the `apply()` builtin + ''' + Process = Process + + def __init__(self, processes=None, initializer=None, initargs=()): + self._setup_queues() + self._taskqueue = Queue.Queue() + self._cache = {} + self._state = RUN + + if processes is None: + try: + processes = cpu_count() + except NotImplementedError: + processes = 1 + + self._pool = [] + for i in range(processes): + w = self.Process( + target=worker, + args=(self._inqueue, self._outqueue, initializer, initargs) + ) + self._pool.append(w) + w.set_name(w.get_name().replace('Process', 'PoolWorker')) + w.set_daemon(True) + w.start() + + self._task_handler = threading.Thread( + target=Pool._handle_tasks, + args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) + ) + self._task_handler.setDaemon(True) + self._task_handler._state = RUN + self._task_handler.start() + + self._result_handler = threading.Thread( + target=Pool._handle_results, + args=(self._outqueue, self._quick_get, self._cache) + ) + self._result_handler.setDaemon(True) + self._result_handler._state = RUN + self._result_handler.start() + + self._terminate = Finalize( + self, self._terminate_pool, + args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, + self._task_handler, self._result_handler, self._cache), + exitpriority=15 + ) + + def _setup_queues(self): + from .queues import SimpleQueue + self._inqueue = SimpleQueue() + self._outqueue = SimpleQueue() + self._quick_put = self._inqueue._writer.send + self._quick_get = self._outqueue._reader.recv + + def apply(self, func, args=(), kwds={}): + ''' + Equivalent of `apply()` builtin + ''' + assert self._state == RUN + return self.apply_async(func, args, kwds).get() + + def map(self, func, iterable, chunksize=None): + ''' + Equivalent of `map()` builtin + ''' + assert self._state == RUN + return self.map_async(func, iterable, chunksize).get() + + def imap(self, func, iterable, chunksize=1): + ''' + Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def imap_unordered(self, func, iterable, chunksize=1): + ''' + Like `imap()` method but ordering of results is arbitrary + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def apply_async(self, func, args=(), kwds={}, callback=None): + ''' + Asynchronous equivalent of `apply()` builtin + ''' + assert self._state == RUN + result = ApplyResult(self._cache, callback) + self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) + return result + + def map_async(self, func, iterable, chunksize=None, callback=None): + ''' + Asynchronous equivalent of `map()` builtin + ''' + assert self._state == RUN + if not hasattr(iterable, '__len__'): + iterable = list(iterable) + + if chunksize is None: + chunksize, extra = divmod(len(iterable), len(self._pool) * 4) + if extra: + chunksize += 1 + + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = MapResult(self._cache, chunksize, len(iterable), callback) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), None)) + return result + + @staticmethod + def _handle_tasks(taskqueue, put, outqueue, pool): + thread = threading.currentThread() + + for taskseq, set_length in iter(taskqueue.get, None): + i = -1 + for i, task in enumerate(taskseq): + if thread._state: + debug('task handler found thread._state != RUN') + break + try: + put(task) + except IOError: + debug('could not put task on queue') + break + else: + if set_length: + debug('doing set_length()') + set_length(i+1) + continue + break + else: + debug('task handler got sentinel') + + + try: + # tell result handler to finish when cache is empty + debug('task handler sending sentinel to result handler') + outqueue.put(None) + + # tell workers there is no more work + debug('task handler sending sentinel to workers') + for p in pool: + put(None) + except IOError: + debug('task handler got IOError when sending sentinels') + + debug('task handler exiting') + + @staticmethod + def _handle_results(outqueue, get, cache): + thread = threading.currentThread() + + while 1: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if thread._state: + assert thread._state == TERMINATE + debug('result handler found thread._state=TERMINATE') + break + + if task is None: + debug('result handler got sentinel') + break + + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + while cache and thread._state != TERMINATE: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if task is None: + debug('result handler ignoring extra sentinel') + continue + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + if hasattr(outqueue, '_reader'): + debug('ensuring that outqueue is not full') + # If we don't make room available in outqueue then + # attempts to add the sentinel (None) to outqueue may + # block. There is guaranteed to be no more than 2 sentinels. + try: + for i in range(10): + if not outqueue._reader.poll(): + break + get() + except (IOError, EOFError): + pass + + debug('result handler exiting: len(cache)=%s, thread._state=%s', + len(cache), thread._state) + + @staticmethod + def _get_tasks(func, it, size): + it = iter(it) + while 1: + x = tuple(itertools.islice(it, size)) + if not x: + return + yield (func, x) + + def __reduce__(self): + raise NotImplementedError( + 'pool objects cannot be passed between processes or pickled' + ) + + def close(self): + debug('closing pool') + if self._state == RUN: + self._state = CLOSE + self._taskqueue.put(None) + + def terminate(self): + debug('terminating pool') + self._state = TERMINATE + self._terminate() + + def join(self): + debug('joining pool') + assert self._state in (CLOSE, TERMINATE) + self._task_handler.join() + self._result_handler.join() + for p in self._pool: + p.join() + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # task_handler may be blocked trying to put items on inqueue + debug('removing tasks from inqueue until task handler finished') + inqueue._rlock.acquire() + while task_handler.isAlive() and inqueue._reader.poll(): + inqueue._reader.recv() + time.sleep(0) + + @classmethod + def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, + task_handler, result_handler, cache): + # this is guaranteed to only be called once + debug('finalizing pool') + + task_handler._state = TERMINATE + taskqueue.put(None) # sentinel + + debug('helping task handler/workers to finish') + cls._help_stuff_finish(inqueue, task_handler, len(pool)) + + assert result_handler.isAlive() or len(cache) == 0 + + result_handler._state = TERMINATE + outqueue.put(None) # sentinel + + if pool and hasattr(pool[0], 'terminate'): + debug('terminating workers') + for p in pool: + p.terminate() + + debug('joining task handler') + task_handler.join(1e100) + + debug('joining result handler') + result_handler.join(1e100) + + if pool and hasattr(pool[0], 'terminate'): + debug('joining pool workers') + for p in pool: + p.join() + +# +# Class whose instances are returned by `Pool.apply_async()` +# + +class ApplyResult(object): + + def __init__(self, cache, callback): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._ready = False + self._callback = callback + cache[self._job] = self + + def ready(self): + return self._ready + + def successful(self): + assert self._ready + return self._success + + def wait(self, timeout=None): + self._cond.acquire() + try: + if not self._ready: + self._cond.wait(timeout) + finally: + self._cond.release() + + def get(self, timeout=None): + self.wait(timeout) + if not self._ready: + raise TimeoutError + if self._success: + return self._value + else: + raise self._value + + def _set(self, i, obj): + self._success, self._value = obj + if self._callback and self._success: + self._callback(self._value) + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + del self._cache[self._job] + +# +# Class whose instances are returned by `Pool.map_async()` +# + +class MapResult(ApplyResult): + + def __init__(self, cache, chunksize, length, callback): + ApplyResult.__init__(self, cache, callback) + self._success = True + self._value = [None] * length + self._chunksize = chunksize + if chunksize <= 0: + self._number_left = 0 + self._ready = True + else: + self._number_left = length//chunksize + bool(length % chunksize) + + def _set(self, i, success_result): + success, result = success_result + if success: + self._value[i*self._chunksize:(i+1)*self._chunksize] = result + self._number_left -= 1 + if self._number_left == 0: + if self._callback: + self._callback(self._value) + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + + else: + self._success = False + self._value = result + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap()` +# + +class IMapIterator(object): + + def __init__(self, cache): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._items = collections.deque() + self._index = 0 + self._length = None + self._unsorted = {} + cache[self._job] = self + + def __iter__(self): + return self + + def next(self, timeout=None): + self._cond.acquire() + try: + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + self._cond.wait(timeout) + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + raise TimeoutError + finally: + self._cond.release() + + success, value = item + if success: + return value + raise value + + __next__ = next # XXX + + def _set(self, i, obj): + self._cond.acquire() + try: + if self._index == i: + self._items.append(obj) + self._index += 1 + while self._index in self._unsorted: + obj = self._unsorted.pop(self._index) + self._items.append(obj) + self._index += 1 + self._cond.notify() + else: + self._unsorted[i] = obj + + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + + def _set_length(self, length): + self._cond.acquire() + try: + self._length = length + if self._index == self._length: + self._cond.notify() + del self._cache[self._job] + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap_unordered()` +# + +class IMapUnorderedIterator(IMapIterator): + + def _set(self, i, obj): + self._cond.acquire() + try: + self._items.append(obj) + self._index += 1 + self._cond.notify() + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + +# +# +# + +class ThreadPool(Pool): + + from .dummy import Process + + def __init__(self, processes=None, initializer=None, initargs=()): + Pool.__init__(self, processes, initializer, initargs) + + def _setup_queues(self): + self._inqueue = Queue.Queue() + self._outqueue = Queue.Queue() + self._quick_put = self._inqueue.put + self._quick_get = self._outqueue.get + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # put sentinels at head of inqueue to make workers finish + inqueue.not_empty.acquire() + try: + inqueue.queue.clear() + inqueue.queue.extend([None] * size) + inqueue.not_empty.notifyAll() + finally: + inqueue.not_empty.release() Added: python/trunk/Lib/multiprocessing/process.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/process.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,302 @@ +# +# Module providing the `Process` class which emulates `threading.Thread` +# +# multiprocessing/process.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Process', 'current_process', 'active_children'] + +# +# Imports +# + +import os +import sys +import signal +import itertools + +# +# +# + +try: + ORIGINAL_DIR = os.path.abspath(os.getcwd()) +except OSError: + ORIGINAL_DIR = None + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Public functions +# + +def current_process(): + ''' + Return process object representing the current process + ''' + return _current_process + +def active_children(): + ''' + Return list of process objects corresponding to live child processes + ''' + _cleanup() + return list(_current_process._children) + +# +# +# + +def _cleanup(): + # check for processes which have finished + for p in list(_current_process._children): + if p._popen.poll() is not None: + _current_process._children.discard(p) + +# +# The `Process` class +# + +class Process(object): + ''' + Process objects represent activity that is run in a separate process + + The class is analagous to `threading.Thread` + ''' + _Popen = None + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + assert group is None, 'group argument must be None for now' + count = _current_process._counter.next() + self._identity = _current_process._identity + (count,) + self._authkey = _current_process._authkey + self._daemonic = _current_process._daemonic + self._tempdir = _current_process._tempdir + self._parent_pid = os.getpid() + self._popen = None + self._target = target + self._args = tuple(args) + self._kwargs = dict(kwargs) + self._name = name or type(self).__name__ + '-' + \ + ':'.join(str(i) for i in self._identity) + + def run(self): + ''' + Method to be run in sub-process; can be overridden in sub-class + ''' + if self._target: + self._target(*self._args, **self._kwargs) + + def start(self): + ''' + Start child process + ''' + assert self._popen is None, 'cannot start a process twice' + assert self._parent_pid == os.getpid(), \ + 'can only start a process object created by current process' + assert not _current_process._daemonic, \ + 'daemonic processes are not allowed to have children' + _cleanup() + if self._Popen is not None: + Popen = self._Popen + else: + from .forking import Popen + self._popen = Popen(self) + _current_process._children.add(self) + + def terminate(self): + ''' + Terminate process; sends SIGTERM signal or uses TerminateProcess() + ''' + self._popen.terminate() + + def join(self, timeout=None): + ''' + Wait until child process terminates + ''' + assert self._parent_pid == os.getpid(), 'can only join a child process' + assert self._popen is not None, 'can only join a started process' + res = self._popen.wait(timeout) + if res is not None: + _current_process._children.discard(self) + + def is_alive(self): + ''' + Return whether process is alive + ''' + if self is _current_process: + return True + assert self._parent_pid == os.getpid(), 'can only test a child process' + if self._popen is None: + return False + self._popen.poll() + return self._popen.returncode is None + + def get_name(self): + ''' + Return name of process + ''' + return self._name + + def set_name(self, name): + ''' + Set name of process + ''' + assert isinstance(name, str), 'name must be a string' + self._name = name + + def is_daemon(self): + ''' + Return whether process is a daemon + ''' + return self._daemonic + + def set_daemon(self, daemonic): + ''' + Set whether process is a daemon + ''' + assert self._popen is None, 'process has already started' + self._daemonic = daemonic + + def get_authkey(self): + ''' + Return authorization key of process + ''' + return self._authkey + + def set_authkey(self, authkey): + ''' + Set authorization key of process + ''' + self._authkey = AuthenticationString(authkey) + + def get_exitcode(self): + ''' + Return exit code of process or `None` if it has yet to stop + ''' + if self._popen is None: + return self._popen + return self._popen.poll() + + def get_ident(self): + ''' + Return indentifier (PID) of process or `None` if it has yet to start + ''' + if self is _current_process: + return os.getpid() + else: + return self._popen and self._popen.pid + + pid = property(get_ident) + + def __repr__(self): + if self is _current_process: + status = 'started' + elif self._parent_pid != os.getpid(): + status = 'unknown' + elif self._popen is None: + status = 'initial' + else: + if self._popen.poll() is not None: + status = self.get_exitcode() + else: + status = 'started' + + if type(status) is int: + if status == 0: + status = 'stopped' + else: + status = 'stopped[%s]' % _exitcode_to_name.get(status, status) + + return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, + status, self._daemonic and ' daemon' or '') + + ## + + def _bootstrap(self): + from . import util + global _current_process + + try: + self._children = set() + self._counter = itertools.count(1) + try: + os.close(sys.stdin.fileno()) + except (OSError, ValueError): + pass + _current_process = self + util._finalizer_registry.clear() + util._run_after_forkers() + util.info('child process calling self.run()') + try: + self.run() + exitcode = 0 + finally: + util._exit_function() + except SystemExit, e: + if not e.args: + exitcode = 1 + elif type(e.args[0]) is int: + exitcode = e.args[0] + else: + sys.stderr.write(e.args[0] + '\n') + sys.stderr.flush() + exitcode = 1 + except: + exitcode = 1 + import traceback + sys.stderr.write('Process %s:\n' % self.get_name()) + sys.stderr.flush() + traceback.print_exc() + + util.info('process exiting with exitcode %d' % exitcode) + return exitcode + +# +# We subclass bytes to avoid accidental transmission of auth keys over network +# + +class AuthenticationString(bytes): + def __reduce__(self): + from .forking import Popen + if not Popen.thread_is_spawning(): + raise TypeError( + 'Pickling an AuthenticationString object is ' + 'disallowed for security reasons' + ) + return AuthenticationString, (bytes(self),) + +# +# Create object representing the main process +# + +class _MainProcess(Process): + + def __init__(self): + self._identity = () + self._daemonic = False + self._name = 'MainProcess' + self._parent_pid = None + self._popen = None + self._counter = itertools.count(1) + self._children = set() + self._authkey = AuthenticationString(os.urandom(32)) + self._tempdir = None + +_current_process = _MainProcess() +del _MainProcess + +# +# Give names to some return codes +# + +_exitcode_to_name = {} + +for name, signum in signal.__dict__.items(): + if name[:3]=='SIG' and '_' not in name: + _exitcode_to_name[-signum] = name Added: python/trunk/Lib/multiprocessing/queues.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/queues.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,356 @@ +# +# Module implementing queues +# +# multiprocessing/queues.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Queue', 'SimpleQueue'] + +import sys +import os +import threading +import collections +import time +import atexit +import weakref + +from Queue import Empty, Full +import _multiprocessing +from multiprocessing import Pipe +from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition +from multiprocessing.util import debug, info, Finalize, register_after_fork +from multiprocessing.forking import assert_spawning + +# +# Queue type using a pipe, buffer and thread +# + +class Queue(object): + + def __init__(self, maxsize=0): + if maxsize <= 0: + maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX + self._maxsize = maxsize + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + self._opid = os.getpid() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._sem = BoundedSemaphore(maxsize) + + self._after_fork() + + if sys.platform != 'win32': + register_after_fork(self, Queue._after_fork) + + def __getstate__(self): + assert_spawning(self) + return (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) + + def __setstate__(self, state): + (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) = state + self._after_fork() + + def _after_fork(self): + debug('Queue._after_fork()') + self._notempty = threading.Condition(threading.Lock()) + self._buffer = collections.deque() + self._thread = None + self._jointhread = None + self._joincancelled = False + self._closed = False + self._close = None + self._send = self._writer.send + self._recv = self._reader.recv + self._poll = self._reader.poll + + def put(self, obj, block=True, timeout=None): + assert not self._closed + if not self._sem.acquire(block, timeout): + raise Full + + self._notempty.acquire() + try: + if self._thread is None: + self._start_thread() + self._buffer.append(obj) + self._notempty.notify() + finally: + self._notempty.release() + + def get(self, block=True, timeout=None): + if block and timeout is None: + self._rlock.acquire() + try: + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + else: + if block: + deadline = time.time() + timeout + if not self._rlock.acquire(block, timeout): + raise Empty + try: + if not self._poll(block and (deadline-time.time()) or 0.0): + raise Empty + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + def qsize(self): + # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + return self._maxsize - self._sem._semlock._get_value() + + def empty(self): + return not self._poll() + + def full(self): + return self._sem._semlock._is_zero() + + def get_nowait(self): + return self.get(False) + + def put_nowait(self, obj): + return self.put(obj, False) + + def close(self): + self._closed = True + self._reader.close() + if self._close: + self._close() + + def join_thread(self): + debug('Queue.join_thread()') + assert self._closed + if self._jointhread: + self._jointhread() + + def cancel_join_thread(self): + debug('Queue.cancel_join_thread()') + self._joincancelled = True + try: + self._jointhread.cancel() + except AttributeError: + pass + + def _start_thread(self): + debug('Queue._start_thread()') + + # Start thread which transfers data from buffer to pipe + self._buffer.clear() + self._thread = threading.Thread( + target=Queue._feed, + args=(self._buffer, self._notempty, self._send, + self._wlock, self._writer.close), + name='QueueFeederThread' + ) + self._thread.setDaemon(True) + + debug('doing self._thread.start()') + self._thread.start() + debug('... done self._thread.start()') + + # On process exit we will wait for data to be flushed to pipe. + # + # However, if this process created the queue then all + # processes which use the queue will be descendants of this + # process. Therefore waiting for the queue to be flushed + # is pointless once all the child processes have been joined. + created_by_this_process = (self._opid == os.getpid()) + if not self._joincancelled and not created_by_this_process: + self._jointhread = Finalize( + self._thread, Queue._finalize_join, + [weakref.ref(self._thread)], + exitpriority=-5 + ) + + # Send sentinel to the thread queue object when garbage collected + self._close = Finalize( + self, Queue._finalize_close, + [self._buffer, self._notempty], + exitpriority=10 + ) + + @staticmethod + def _finalize_join(twr): + debug('joining queue thread') + thread = twr() + if thread is not None: + thread.join() + debug('... queue thread joined') + else: + debug('... queue thread already dead') + + @staticmethod + def _finalize_close(buffer, notempty): + debug('telling queue thread to quit') + notempty.acquire() + try: + buffer.append(_sentinel) + notempty.notify() + finally: + notempty.release() + + @staticmethod + def _feed(buffer, notempty, send, writelock, close): + debug('starting thread to feed data to pipe') + from .util import is_exiting + + nacquire = notempty.acquire + nrelease = notempty.release + nwait = notempty.wait + bpopleft = buffer.popleft + sentinel = _sentinel + if sys.platform != 'win32': + wacquire = writelock.acquire + wrelease = writelock.release + else: + wacquire = None + + try: + while 1: + nacquire() + try: + if not buffer: + nwait() + finally: + nrelease() + try: + while 1: + obj = bpopleft() + if obj is sentinel: + debug('feeder thread got sentinel -- exiting') + close() + return + + if wacquire is None: + send(obj) + else: + wacquire() + try: + send(obj) + finally: + wrelease() + except IndexError: + pass + except Exception, e: + # Since this runs in a daemon thread the resources it uses + # may be become unusable while the process is cleaning up. + # We ignore errors which happen after the process has + # started to cleanup. + try: + if is_exiting(): + info('error in queue thread: %s', e) + else: + import traceback + traceback.print_exc() + except Exception: + pass + +_sentinel = object() + +# +# A queue type which also supports join() and task_done() methods +# +# Note that if you do not call task_done() for each finished task then +# eventually the counter's semaphore may overflow causing Bad Things +# to happen. +# + +class JoinableQueue(Queue): + + def __init__(self, maxsize=0): + Queue.__init__(self, maxsize) + self._unfinished_tasks = Semaphore(0) + self._cond = Condition() + + def __getstate__(self): + return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) + + def __setstate__(self, state): + Queue.__setstate__(self, state[:-2]) + self._cond, self._unfinished_tasks = state[-2:] + + def put(self, item, block=True, timeout=None): + Queue.put(self, item, block, timeout) + self._unfinished_tasks.release() + + def task_done(self): + self._cond.acquire() + try: + if not self._unfinished_tasks.acquire(False): + raise ValueError('task_done() called too many times') + if self._unfinished_tasks._semlock._is_zero(): + self._cond.notify_all() + finally: + self._cond.release() + + def join(self): + self._cond.acquire() + try: + if not self._unfinished_tasks._semlock._is_zero(): + self._cond.wait() + finally: + self._cond.release() + +# +# Simplified Queue type -- really just a locked pipe +# + +class SimpleQueue(object): + + def __init__(self): + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._make_methods() + + def empty(self): + return not self._reader.poll() + + def __getstate__(self): + assert_spawning(self) + return (self._reader, self._writer, self._rlock, self._wlock) + + def __setstate__(self, state): + (self._reader, self._writer, self._rlock, self._wlock) = state + self._make_methods() + + def _make_methods(self): + recv = self._reader.recv + racquire, rrelease = self._rlock.acquire, self._rlock.release + def get(): + racquire() + try: + return recv() + finally: + rrelease() + self.get = get + + if self._wlock is None: + # writes to a message oriented win32 pipe are atomic + self.put = self._writer.send + else: + send = self._writer.send + wacquire, wrelease = self._wlock.acquire, self._wlock.release + def put(obj): + wacquire() + try: + return send(obj) + finally: + wrelease() + self.put = put Added: python/trunk/Lib/multiprocessing/reduction.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/reduction.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,190 @@ +# +# Module to allow connection and socket objects to be transferred +# between processes +# +# multiprocessing/reduction.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [] + +import os +import sys +import socket +import threading +import copy_reg + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.forking import Popen, duplicate, close +from multiprocessing.util import register_after_fork, debug, sub_debug +from multiprocessing.connection import Client, Listener + + +# +# +# + +if not(sys.platform == 'win32' or hasattr(_multiprocessing, 'recvfd')): + raise ImportError('pickling of connections not supported') + +# +# Platform specific definitions +# + +if sys.platform == 'win32': + import _subprocess + from ._multiprocessing import win32 + + def send_handle(conn, handle, destination_pid): + process_handle = win32.OpenProcess( + win32.PROCESS_ALL_ACCESS, False, destination_pid + ) + try: + new_handle = duplicate(handle, process_handle) + conn.send(new_handle) + finally: + close(process_handle) + + def recv_handle(conn): + return conn.recv() + +else: + def send_handle(conn, handle, destination_pid): + _multiprocessing.sendfd(conn.fileno(), handle) + + def recv_handle(conn): + return _multiprocessing.recvfd(conn.fileno()) + +# +# Support for a per-process server thread which caches pickled handles +# + +_cache = set() + +def _reset(obj): + global _lock, _listener, _cache + for h in _cache: + close(h) + _cache.clear() + _lock = threading.Lock() + _listener = None + +_reset(None) +register_after_fork(_reset, _reset) + +def _get_listener(): + global _listener + + if _listener is None: + _lock.acquire() + try: + if _listener is None: + debug('starting listener and thread for sending handles') + _listener = Listener(authkey=current_process().get_authkey()) + t = threading.Thread(target=_serve) + t.setDaemon(True) + t.start() + finally: + _lock.release() + + return _listener + +def _serve(): + from .util import is_exiting, sub_warning + + while 1: + try: + conn = _listener.accept() + handle_wanted, destination_pid = conn.recv() + _cache.remove(handle_wanted) + send_handle(conn, handle_wanted, destination_pid) + close(handle_wanted) + conn.close() + except: + if not is_exiting(): + import traceback + sub_warning( + 'thread for sharing handles raised exception :\n' + + '-'*79 + '\n' + traceback.format_exc() + '-'*79 + ) + +# +# Functions to be used for pickling/unpickling objects with handles +# + +def reduce_handle(handle): + if Popen.thread_is_spawning(): + return (None, Popen.duplicate_for_child(handle), True) + dup_handle = duplicate(handle) + _cache.add(dup_handle) + sub_debug('reducing handle %d', handle) + return (_get_listener().address, dup_handle, False) + +def rebuild_handle(pickled_data): + address, handle, inherited = pickled_data + if inherited: + return handle + sub_debug('rebuilding handle %d', handle) + conn = Client(address, authkey=current_process().get_authkey()) + conn.send((handle, os.getpid())) + new_handle = recv_handle(conn) + conn.close() + return new_handle + +# +# Register `_multiprocessing.Connection` with `copy_reg` +# + +def reduce_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_connection, (rh, conn.readable, conn.writable) + +def rebuild_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.Connection( + handle, readable=readable, writable=writable + ) + +copy_reg.pickle(_multiprocessing.Connection, reduce_connection) + +# +# Register `socket.socket` with `copy_reg` +# + +def fromfd(fd, family, type_, proto=0): + s = socket.fromfd(fd, family, type_, proto) + if s.__class__ is not socket.socket: + s = socket.socket(_sock=s) + return s + +def reduce_socket(s): + reduced_handle = reduce_handle(s.fileno()) + return rebuild_socket, (reduced_handle, s.family, s.type, s.proto) + +def rebuild_socket(reduced_handle, family, type_, proto): + fd = rebuild_handle(reduced_handle) + _sock = fromfd(fd, family, type_, proto) + close(fd) + return _sock + +copy_reg.pickle(socket.socket, reduce_socket) + +# +# Register `_multiprocessing.PipeConnection` with `copy_reg` +# + +if sys.platform == 'win32': + + def reduce_pipe_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_pipe_connection, (rh, conn.readable, conn.writable) + + def rebuild_pipe_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.PipeConnection( + handle, readable=readable, writable=writable + ) + + copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) Added: python/trunk/Lib/multiprocessing/sharedctypes.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/sharedctypes.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,234 @@ +# +# Module which supports allocation of ctypes objects from shared memory +# +# multiprocessing/sharedctypes.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import sys +import ctypes +import weakref +import copy_reg + +from multiprocessing import heap, RLock +from multiprocessing.forking import assert_spawning + +__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] + +# +# +# + +typecode_to_type = { + 'c': ctypes.c_char, 'u': ctypes.c_wchar, + 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, + 'h': ctypes.c_short, 'H': ctypes.c_ushort, + 'i': ctypes.c_int, 'I': ctypes.c_uint, + 'l': ctypes.c_long, 'L': ctypes.c_ulong, + 'f': ctypes.c_float, 'd': ctypes.c_double + } + +# +# +# + +def _new_value(type_): + size = ctypes.sizeof(type_) + wrapper = heap.BufferWrapper(size) + return rebuild_ctype(type_, wrapper, None) + +def RawValue(typecode_or_type, *args): + ''' + Returns a ctypes object allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + obj = _new_value(type_) + ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) + obj.__init__(*args) + return obj + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a ctypes array allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + if isinstance(size_or_initializer, int): + type_ = type_ * size_or_initializer + return _new_value(type_) + else: + type_ = type_ * len(size_or_initializer) + result = _new_value(type_) + result.__init__(*size_or_initializer) + return result + +def Value(typecode_or_type, *args, **kwds): + ''' + Return a synchronization wrapper for a Value + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawValue(typecode_or_type, *args) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Return a synchronization wrapper for a RawArray + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawArray(typecode_or_type, size_or_initializer) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def copy(obj): + new_obj = _new_value(type(obj)) + ctypes.pointer(new_obj)[0] = obj + return new_obj + +def synchronized(obj, lock=None): + assert not isinstance(obj, SynchronizedBase), 'object already synchronized' + + if isinstance(obj, ctypes._SimpleCData): + return Synchronized(obj, lock) + elif isinstance(obj, ctypes.Array): + if obj._type_ is ctypes.c_char: + return SynchronizedString(obj, lock) + return SynchronizedArray(obj, lock) + else: + cls = type(obj) + try: + scls = class_cache[cls] + except KeyError: + names = [field[0] for field in cls._fields_] + d = dict((name, make_property(name)) for name in names) + classname = 'Synchronized' + cls.__name__ + scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) + return scls(obj, lock) + +# +# Functions for pickling/unpickling +# + +def reduce_ctype(obj): + assert_spawning(obj) + if isinstance(obj, ctypes.Array): + return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) + else: + return rebuild_ctype, (type(obj), obj._wrapper, None) + +def rebuild_ctype(type_, wrapper, length): + if length is not None: + type_ = type_ * length + if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table: + copy_reg.pickle(type_, reduce_ctype) + obj = type_.from_address(wrapper.get_address()) + obj._wrapper = wrapper + return obj + +# +# Function to create properties +# + +def make_property(name): + try: + return prop_cache[name] + except KeyError: + d = {} + exec template % ((name,)*7) in d + prop_cache[name] = d[name] + return d[name] + +template = ''' +def get%s(self): + self.acquire() + try: + return self._obj.%s + finally: + self.release() +def set%s(self, value): + self.acquire() + try: + self._obj.%s = value + finally: + self.release() +%s = property(get%s, set%s) +''' + +prop_cache = {} +class_cache = weakref.WeakKeyDictionary() + +# +# Synchronized wrappers +# + +class SynchronizedBase(object): + + def __init__(self, obj, lock=None): + self._obj = obj + self._lock = lock or RLock() + self.acquire = self._lock.acquire + self.release = self._lock.release + + def __reduce__(self): + assert_spawning(self) + return synchronized, (self._obj, self._lock) + + def get_obj(self): + return self._obj + + def get_lock(self): + return self._lock + + def __repr__(self): + return '<%s wrapper for %s>' % (type(self).__name__, self._obj) + + +class Synchronized(SynchronizedBase): + value = make_property('value') + + +class SynchronizedArray(SynchronizedBase): + + def __len__(self): + return len(self._obj) + + def __getitem__(self, i): + self.acquire() + try: + return self._obj[i] + finally: + self.release() + + def __setitem__(self, i, value): + self.acquire() + try: + self._obj[i] = value + finally: + self.release() + + def __getslice__(self, start, stop): + self.acquire() + try: + return self._obj[start:stop] + finally: + self.release() + + def __setslice__(self, start, stop, values): + self.acquire() + try: + self._obj[start:stop] = values + finally: + self.release() + + +class SynchronizedString(SynchronizedArray): + value = make_property('value') + raw = make_property('raw') Added: python/trunk/Lib/multiprocessing/synchronize.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/synchronize.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,294 @@ +# +# Module implementing synchronization primitives +# +# multiprocessing/synchronize.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' + ] + +import threading +import os +import sys + +from time import time as _time, sleep as _sleep + +import _multiprocessing +from multiprocessing.process import current_process +from multiprocessing.util import Finalize, register_after_fork, debug +from multiprocessing.forking import assert_spawning, Popen + +# +# Constants +# + +RECURSIVE_MUTEX, SEMAPHORE = range(2) +SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX + +# +# Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` +# + +class SemLock(object): + + def __init__(self, kind, value, maxvalue): + sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) + debug('created semlock with handle %s' % sl.handle) + self._make_methods() + + if sys.platform != 'win32': + def _after_fork(obj): + obj._semlock._after_fork() + register_after_fork(self, _after_fork) + + def _make_methods(self): + self.acquire = self._semlock.acquire + self.release = self._semlock.release + self.__enter__ = self._semlock.__enter__ + self.__exit__ = self._semlock.__exit__ + + def __getstate__(self): + assert_spawning(self) + sl = self._semlock + return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue) + + def __setstate__(self, state): + self._semlock = _multiprocessing.SemLock._rebuild(*state) + debug('recreated blocker with handle %r' % state[0]) + self._make_methods() + +# +# Semaphore +# + +class Semaphore(SemLock): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX) + + def get_value(self): + return self._semlock._get_value() + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % value + +# +# Bounded semaphore +# + +class BoundedSemaphore(Semaphore): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, value) + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % \ + (value, self._semlock.maxvalue) + +# +# Non-recursive lock +# + +class Lock(SemLock): + + def __init__(self): + SemLock.__init__(self, SEMAPHORE, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.currentThread().getName() != 'MainThread': + name += '|' + threading.currentThread().getName() + elif self._semlock._get_value() == 1: + name = 'None' + elif self._semlock._count() > 0: + name = 'SomeOtherThread' + else: + name = 'SomeOtherProcess' + except Exception: + name = 'unknown' + return '' % name + +# +# Recursive lock +# + +class RLock(SemLock): + + def __init__(self): + SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.currentThread().getName() != 'MainThread': + name += '|' + threading.currentThread().getName() + count = self._semlock._count() + elif self._semlock._get_value() == 1: + name, count = 'None', 0 + elif self._semlock._count() > 0: + name, count = 'SomeOtherThread', 'nonzero' + else: + name, count = 'SomeOtherProcess', 'nonzero' + except Exception: + name, count = 'unknown', 'unknown' + return '' % (name, count) + +# +# Condition variable +# + +class Condition(object): + + def __init__(self, lock=None): + self._lock = lock or RLock() + self._sleeping_count = Semaphore(0) + self._woken_count = Semaphore(0) + self._wait_semaphore = Semaphore(0) + self._make_methods() + + def __getstate__(self): + assert_spawning(self) + return (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) + + def __setstate__(self, state): + (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) = state + self._make_methods() + + def _make_methods(self): + self.acquire = self._lock.acquire + self.release = self._lock.release + self.__enter__ = self._lock.__enter__ + self.__exit__ = self._lock.__exit__ + + def __repr__(self): + try: + num_waiters = (self._sleeping_count._semlock._get_value() - + self._woken_count._semlock._get_value()) + except Exception: + num_waiters = 'unkown' + return '' % (self._lock, num_waiters) + + def wait(self, timeout=None): + assert self._lock._semlock._is_mine(), \ + 'must acquire() condition before using wait()' + + # indicate that this thread is going to sleep + self._sleeping_count.release() + + # release lock + count = self._lock._semlock._count() + for i in xrange(count): + self._lock.release() + + try: + # wait for notification or timeout + self._wait_semaphore.acquire(True, timeout) + finally: + # indicate that this thread has woken + self._woken_count.release() + + # reacquire lock + for i in xrange(count): + self._lock.acquire() + + def notify(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + if self._sleeping_count.acquire(False): # try grabbing a sleeper + self._wait_semaphore.release() # wake up one sleeper + self._woken_count.acquire() # wait for the sleeper to wake + + # rezero _wait_semaphore in case a timeout just happened + self._wait_semaphore.acquire(False) + + def notify_all(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify*() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + sleepers = 0 + while self._sleeping_count.acquire(False): + self._wait_semaphore.release() # wake up one sleeper + sleepers += 1 + + if sleepers: + for i in xrange(sleepers): + self._woken_count.acquire() # wait for a sleeper to wake + + # rezero wait_semaphore in case some timeouts just happened + while self._wait_semaphore.acquire(False): + pass + +# +# Event +# + +class Event(object): + + def __init__(self): + self._cond = Condition(Lock()) + self._flag = Semaphore(0) + + def is_set(self): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + return True + return False + finally: + self._cond.release() + + def set(self): + self._cond.acquire() + try: + self._flag.acquire(False) + self._flag.release() + self._cond.notify_all() + finally: + self._cond.release() + + def clear(self): + self._cond.acquire() + try: + self._flag.acquire(False) + finally: + self._cond.release() + + def wait(self, timeout=None): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + else: + self._cond.wait(timeout) + finally: + self._cond.release() Added: python/trunk/Lib/multiprocessing/util.py ============================================================================== --- (empty file) +++ python/trunk/Lib/multiprocessing/util.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,336 @@ +# +# Module providing various facilities to other parts of the package +# +# multiprocessing/util.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import itertools +import weakref +import copy_reg +import atexit +import threading # we want threading to install it's + # cleanup function before multiprocessing does + +from multiprocessing.process import current_process, active_children + +__all__ = [ + 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', + 'log_to_stderr', 'get_temp_dir', 'register_after_fork', + 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal' + ] + +# +# Logging +# + +NOTSET = 0 +SUBDEBUG = 5 +DEBUG = 10 +INFO = 20 +SUBWARNING = 25 + +LOGGER_NAME = 'multiprocessing' +DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' + +_logger = None +_log_to_stderr = False + +def sub_debug(msg, *args): + if _logger: + _logger.log(SUBDEBUG, msg, *args) + +def debug(msg, *args): + if _logger: + _logger.log(DEBUG, msg, *args) + +def info(msg, *args): + if _logger: + _logger.log(INFO, msg, *args) + +def sub_warning(msg, *args): + if _logger: + _logger.log(SUBWARNING, msg, *args) + +def get_logger(): + ''' + Returns logger used by multiprocessing + ''' + global _logger + + if not _logger: + import logging, atexit + + # XXX multiprocessing should cleanup before logging + if hasattr(atexit, 'unregister'): + atexit.unregister(_exit_function) + atexit.register(_exit_function) + else: + atexit._exithandlers.remove((_exit_function, (), {})) + atexit._exithandlers.append((_exit_function, (), {})) + + _check_logger_class() + _logger = logging.getLogger(LOGGER_NAME) + + return _logger + +def _check_logger_class(): + ''' + Make sure process name is recorded when loggers are used + ''' + # XXX This function is unnecessary once logging is patched + import logging + if hasattr(logging, 'multiprocessing'): + return + + logging._acquireLock() + try: + OldLoggerClass = logging.getLoggerClass() + if not getattr(OldLoggerClass, '_process_aware', False): + class ProcessAwareLogger(OldLoggerClass): + _process_aware = True + def makeRecord(self, *args, **kwds): + record = OldLoggerClass.makeRecord(self, *args, **kwds) + record.processName = current_process()._name + return record + logging.setLoggerClass(ProcessAwareLogger) + finally: + logging._releaseLock() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + global _log_to_stderr + import logging + logger = get_logger() + formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) + handler = logging.StreamHandler() + handler.setFormatter(formatter) + logger.addHandler(handler) + if level is not None: + logger.setLevel(level) + _log_to_stderr = True + +# +# Function returning a temp directory which will be removed on exit +# + +def get_temp_dir(): + # get name of a temp directory which will be automatically cleaned up + if current_process()._tempdir is None: + import shutil, tempfile + tempdir = tempfile.mkdtemp(prefix='pymp-') + info('created temp directory %s', tempdir) + Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) + current_process()._tempdir = tempdir + return current_process()._tempdir + +# +# Support for reinitialization of objects when bootstrapping a child process +# + +_afterfork_registry = weakref.WeakValueDictionary() +_afterfork_counter = itertools.count() + +def _run_after_forkers(): + items = list(_afterfork_registry.items()) + items.sort() + for (index, ident, func), obj in items: + try: + func(obj) + except Exception, e: + info('after forker raised exception %s', e) + +def register_after_fork(obj, func): + _afterfork_registry[(_afterfork_counter.next(), id(obj), func)] = obj + +# +# Finalization using weakrefs +# + +_finalizer_registry = {} +_finalizer_counter = itertools.count() + + +class Finalize(object): + ''' + Class which supports object finalization using weakrefs + ''' + def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): + assert exitpriority is None or type(exitpriority) is int + + if obj is not None: + self._weakref = weakref.ref(obj, self) + else: + assert exitpriority is not None + + self._callback = callback + self._args = args + self._kwargs = kwargs or {} + self._key = (exitpriority, _finalizer_counter.next()) + + _finalizer_registry[self._key] = self + + def __call__(self, wr=None): + ''' + Run the callback unless it has already been called or cancelled + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + sub_debug('finalizer no longer registered') + else: + sub_debug('finalizer calling %s with args %s and kwargs %s', + self._callback, self._args, self._kwargs) + res = self._callback(*self._args, **self._kwargs) + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + return res + + def cancel(self): + ''' + Cancel finalization of the object + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + pass + else: + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + + def still_active(self): + ''' + Return whether this finalizer is still waiting to invoke callback + ''' + return self._key in _finalizer_registry + + def __repr__(self): + try: + obj = self._weakref() + except (AttributeError, TypeError): + obj = None + + if obj is None: + return '' + + x = '' + + +def _run_finalizers(minpriority=None): + ''' + Run all finalizers whose exit priority is not None and at least minpriority + + Finalizers with highest priority are called first; finalizers with + the same priority will be called in reverse order of creation. + ''' + if minpriority is None: + f = lambda p : p[0][0] is not None + else: + f = lambda p : p[0][0] is not None and p[0][0] >= minpriority + + items = [x for x in _finalizer_registry.items() if f(x)] + items.sort(reverse=True) + + for key, finalizer in items: + sub_debug('calling %s', finalizer) + try: + finalizer() + except Exception: + import traceback + traceback.print_exc() + + if minpriority is None: + _finalizer_registry.clear() + +# +# Clean up on exit +# + +def is_exiting(): + ''' + Returns true if the process is shutting down + ''' + return _exiting or _exiting is None + +_exiting = False + +def _exit_function(): + global _exiting + + info('process shutting down') + debug('running all "atexit" finalizers with priority >= 0') + _run_finalizers(0) + + for p in active_children(): + if p._daemonic: + info('calling terminate() for daemon %s', p.get_name()) + p._popen.terminate() + + for p in active_children(): + info('calling join() for process %s', p.get_name()) + p.join() + + debug('running the remaining "atexit" finalizers') + _run_finalizers() + +atexit.register(_exit_function) + +# +# Some fork aware types +# + +class ForkAwareThreadLock(object): + def __init__(self): + self._lock = threading.Lock() + self.acquire = self._lock.acquire + self.release = self._lock.release + register_after_fork(self, ForkAwareThreadLock.__init__) + +class ForkAwareLocal(threading.local): + def __init__(self): + register_after_fork(self, lambda obj : obj.__dict__.clear()) + def __reduce__(self): + return type(self), () + +# +# Try making some callable types picklable +# + +def _reduce_method(m): + if m.im_self is None: + return getattr, (m.im_class, m.im_func.func_name) + else: + return getattr, (m.im_self, m.im_func.func_name) +copy_reg.pickle(type(Finalize.__init__), _reduce_method) + +def _reduce_method_descriptor(m): + return getattr, (m.__objclass__, m.__name__) +copy_reg.pickle(type(list.append), _reduce_method_descriptor) +copy_reg.pickle(type(int.__add__), _reduce_method_descriptor) + +def _reduce_builtin_function_or_method(m): + return getattr, (m.__self__, m.__name__) +copy_reg.pickle(type(list().append), _reduce_builtin_function_or_method) +copy_reg.pickle(type(int().__add__), _reduce_builtin_function_or_method) + +try: + from functools import partial +except ImportError: + pass +else: + def _reduce_partial(p): + return _rebuild_partial, (p.func, p.args, p.keywords or {}) + def _rebuild_partial(func, args, keywords): + return partial(func, *args, **keywords) + copy_reg.pickle(partial, _reduce_partial) Added: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- (empty file) +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jun 11 04:40:25 2008 @@ -0,0 +1,1791 @@ +# +# Unit tests for the multiprocessing package +# + +import unittest +import threading +import Queue +import time +import sys +import os +import gc +import signal +import array +import copy +import socket +import random +import logging + +import _multiprocessing +import multiprocessing.dummy +import multiprocessing.connection +import multiprocessing.managers +import multiprocessing.heap +import multiprocessing.managers +import multiprocessing.pool + +from multiprocessing import util + +# +# +# + +if sys.version_info >= (3, 0): + def latin(s): + return s.encode('latin') +else: + latin = str + +try: + bytes +except NameError: + bytes = str + def bytearray(seq): + return array.array('c', seq) + +# +# Constants +# + +LOG_LEVEL = util.SUBWARNING +#LOG_LEVEL = logging.WARNING + +DELTA = 0.1 +CHECK_TIMINGS = False # making true makes tests take a lot longer + # and can sometimes cause some non-serious + # failures because some calls block a bit + # longer than expected +if CHECK_TIMINGS: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.82, 0.35, 1.4 +else: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.1, 0.1, 0.1 + +HAVE_GETVALUE = not getattr(_multiprocessing, + 'HAVE_BROKEN_SEM_GETVALUE', False) + +# +# Creates a wrapper for a function which records the time it takes to finish +# + +class TimingWrapper(object): + + def __init__(self, func): + self.func = func + self.elapsed = None + + def __call__(self, *args, **kwds): + t = time.time() + try: + return self.func(*args, **kwds) + finally: + self.elapsed = time.time() - t + +# +# Base class for test cases +# + +class BaseTestCase(object): + + ALLOWED_TYPES = ('processes', 'manager', 'threads') + + def assertTimingAlmostEqual(self, a, b): + if CHECK_TIMINGS: + self.assertAlmostEqual(a, b, 1) + + def assertReturnsIfImplemented(self, value, func, *args): + try: + res = func(*args) + except NotImplementedError: + pass + else: + return self.assertEqual(value, res) + +# +# Return the value of a semaphore +# + +def get_value(self): + try: + return self.get_value() + except AttributeError: + try: + return self._Semaphore__value + except AttributeError: + try: + return self._value + except AttributeError: + raise NotImplementedError + +# +# Testcases +# + +class _TestProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def test_current(self): + if self.TYPE == 'threads': + return + + current = self.current_process() + authkey = current.get_authkey() + + self.assertTrue(current.is_alive()) + self.assertTrue(not current.is_daemon()) + self.assertTrue(isinstance(authkey, bytes)) + self.assertTrue(len(authkey) > 0) + self.assertEqual(current.get_ident(), os.getpid()) + self.assertEqual(current.get_exitcode(), None) + + def _test(self, q, *args, **kwds): + current = self.current_process() + q.put(args) + q.put(kwds) + q.put(current.get_name()) + if self.TYPE != 'threads': + q.put(bytes(current.get_authkey())) + q.put(current.pid) + + def test_process(self): + q = self.Queue(1) + e = self.Event() + args = (q, 1, 2) + kwargs = {'hello':23, 'bye':2.54} + name = 'SomeProcess' + p = self.Process( + target=self._test, args=args, kwargs=kwargs, name=name + ) + p.set_daemon(True) + current = self.current_process() + + if self.TYPE != 'threads': + self.assertEquals(p.get_authkey(), current.get_authkey()) + self.assertEquals(p.is_alive(), False) + self.assertEquals(p.is_daemon(), True) + self.assertTrue(p not in self.active_children()) + self.assertTrue(type(self.active_children()) is list) + self.assertEqual(p.get_exitcode(), None) + + p.start() + + self.assertEquals(p.get_exitcode(), None) + self.assertEquals(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + + self.assertEquals(q.get(), args[1:]) + self.assertEquals(q.get(), kwargs) + self.assertEquals(q.get(), p.get_name()) + if self.TYPE != 'threads': + self.assertEquals(q.get(), current.get_authkey()) + self.assertEquals(q.get(), p.pid) + + p.join() + + self.assertEquals(p.get_exitcode(), 0) + self.assertEquals(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + def _test_terminate(self): + time.sleep(1000) + + def test_terminate(self): + if self.TYPE == 'threads': + return + + p = self.Process(target=self._test_terminate) + p.set_daemon(True) + p.start() + + self.assertEqual(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + self.assertEqual(p.get_exitcode(), None) + + p.terminate() + + join = TimingWrapper(p.join) + self.assertEqual(join(), None) + self.assertTimingAlmostEqual(join.elapsed, 0.0) + + self.assertEqual(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + p.join() + + # XXX sometimes get p.get_exitcode() == 0 on Windows ... + #self.assertEqual(p.get_exitcode(), -signal.SIGTERM) + + def test_cpu_count(self): + try: + cpus = multiprocessing.cpu_count() + except NotImplementedError: + cpus = 1 + self.assertTrue(type(cpus) is int) + self.assertTrue(cpus >= 1) + + def test_active_children(self): + self.assertEqual(type(self.active_children()), list) + + p = self.Process(target=time.sleep, args=(DELTA,)) + self.assertTrue(p not in self.active_children()) + + p.start() + self.assertTrue(p in self.active_children()) + + p.join() + self.assertTrue(p not in self.active_children()) + + def _test_recursion(self, wconn, id): + from multiprocessing import forking + wconn.send(id) + if len(id) < 2: + for i in range(2): + p = self.Process( + target=self._test_recursion, args=(wconn, id+[i]) + ) + p.start() + p.join() + + def test_recursion(self): + rconn, wconn = self.Pipe(duplex=False) + self._test_recursion(wconn, []) + + time.sleep(DELTA) + result = [] + while rconn.poll(): + result.append(rconn.recv()) + + expected = [ + [], + [0], + [0, 0], + [0, 1], + [1], + [1, 0], + [1, 1] + ] + self.assertEqual(result, expected) + +# +# +# + +class _UpperCaser(multiprocessing.Process): + + def __init__(self): + multiprocessing.Process.__init__(self) + self.child_conn, self.parent_conn = multiprocessing.Pipe() + + def run(self): + self.parent_conn.close() + for s in iter(self.child_conn.recv, None): + self.child_conn.send(s.upper()) + self.child_conn.close() + + def submit(self, s): + assert type(s) is str + self.parent_conn.send(s) + return self.parent_conn.recv() + + def stop(self): + self.parent_conn.send(None) + self.parent_conn.close() + self.child_conn.close() + +class _TestSubclassingProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_subclassing(self): + uppercaser = _UpperCaser() + uppercaser.start() + self.assertEqual(uppercaser.submit('hello'), 'HELLO') + self.assertEqual(uppercaser.submit('world'), 'WORLD') + uppercaser.stop() + uppercaser.join() + +# +# +# + +def queue_empty(q): + if hasattr(q, 'empty'): + return q.empty() + else: + return q.qsize() == 0 + +def queue_full(q, maxsize): + if hasattr(q, 'full'): + return q.full() + else: + return q.qsize() == maxsize + + +class _TestQueue(BaseTestCase): + + + def _test_put(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + for i in range(6): + queue.get() + parent_can_continue.set() + + def test_put(self): + MAXSIZE = 6 + queue = self.Queue(maxsize=MAXSIZE) + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_put, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + queue.put(1) + queue.put(2, True) + queue.put(3, True, None) + queue.put(4, False) + queue.put(5, False, None) + queue.put_nowait(6) + + # the values may be in buffer but not yet in pipe so sleep a bit + time.sleep(DELTA) + + self.assertEqual(queue_empty(queue), False) + self.assertEqual(queue_full(queue, MAXSIZE), True) + + put = TimingWrapper(queue.put) + put_nowait = TimingWrapper(queue.put_nowait) + + self.assertRaises(Queue.Full, put, 7, False) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, False, None) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put_nowait, 7) + self.assertTimingAlmostEqual(put_nowait.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, TIMEOUT1) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Full, put, 7, False, TIMEOUT2) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT3) + + child_can_start.set() + parent_can_continue.wait() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + proc.join() + + def _test_get(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + queue.put(1) + queue.put(2) + queue.put(3) + queue.put(4) + queue.put(5) + parent_can_continue.set() + + def test_get(self): + queue = self.Queue() + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_get, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + + child_can_start.set() + parent_can_continue.wait() + + time.sleep(DELTA) + self.assertEqual(queue_empty(queue), False) + + self.assertEqual(queue.get(), 1) + self.assertEqual(queue.get(True, None), 2) + self.assertEqual(queue.get(True), 3) + self.assertEqual(queue.get(timeout=1), 4) + self.assertEqual(queue.get_nowait(), 5) + + self.assertEqual(queue_empty(queue), True) + + get = TimingWrapper(queue.get) + get_nowait = TimingWrapper(queue.get_nowait) + + self.assertRaises(Queue.Empty, get, False) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, False, None) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get_nowait) + self.assertTimingAlmostEqual(get_nowait.elapsed, 0) + + self.assertRaises(Queue.Empty, get, True, TIMEOUT1) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Empty, get, False, TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT3) + + proc.join() + + def _test_fork(self, queue): + for i in range(10, 20): + queue.put(i) + # note that at this point the items may only be buffered, so the + # process cannot shutdown until the feeder thread has finished + # pushing items onto the pipe. + + def test_fork(self): + # Old versions of Queue would fail to create a new feeder + # thread for a forked process if the original process had its + # own feeder thread. This test checks that this no longer + # happens. + + queue = self.Queue() + + # put items on queue so that main process starts a feeder thread + for i in range(10): + queue.put(i) + + # wait to make sure thread starts before we fork a new process + time.sleep(DELTA) + + # fork process + p = self.Process(target=self._test_fork, args=(queue,)) + p.start() + + # check that all expected items are in the queue + for i in range(20): + self.assertEqual(queue.get(), i) + self.assertRaises(Queue.Empty, queue.get, False) + + p.join() + + def test_qsize(self): + q = self.Queue() + try: + self.assertEqual(q.qsize(), 0) + except NotImplementedError: + return + q.put(1) + self.assertEqual(q.qsize(), 1) + q.put(5) + self.assertEqual(q.qsize(), 2) + q.get() + self.assertEqual(q.qsize(), 1) + q.get() + self.assertEqual(q.qsize(), 0) + + def _test_task_done(self, q): + for obj in iter(q.get, None): + time.sleep(DELTA) + q.task_done() + + def test_task_done(self): + queue = self.JoinableQueue() + + if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'): + return + + workers = [self.Process(target=self._test_task_done, args=(queue,)) + for i in xrange(4)] + + for p in workers: + p.start() + + for i in xrange(10): + queue.put(i) + + queue.join() + + for p in workers: + queue.put(None) + + for p in workers: + p.join() + +# +# +# + +class _TestLock(BaseTestCase): + + def test_lock(self): + lock = self.Lock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(False), False) + self.assertEqual(lock.release(), None) + self.assertRaises((ValueError, threading.ThreadError), lock.release) + + def test_rlock(self): + lock = self.RLock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertRaises((AssertionError, RuntimeError), lock.release) + + +class _TestSemaphore(BaseTestCase): + + def _test_semaphore(self, sem): + self.assertReturnsIfImplemented(2, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.acquire(False), False) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(2, get_value, sem) + + def test_semaphore(self): + sem = self.Semaphore(2) + self._test_semaphore(sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(3, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(4, get_value, sem) + + def test_bounded_semaphore(self): + sem = self.BoundedSemaphore(2) + self._test_semaphore(sem) + # Currently fails on OS/X + #if HAVE_GETVALUE: + # self.assertRaises(ValueError, sem.release) + # self.assertReturnsIfImplemented(2, get_value, sem) + + def test_timeout(self): + if self.TYPE != 'processes': + return + + sem = self.Semaphore(0) + acquire = TimingWrapper(sem.acquire) + + self.assertEqual(acquire(False), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, None), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, TIMEOUT1), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0) + + self.assertEqual(acquire(True, TIMEOUT2), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT2) + + self.assertEqual(acquire(timeout=TIMEOUT3), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT3) + + +class _TestCondition(BaseTestCase): + + def f(self, cond, sleeping, woken, timeout=None): + cond.acquire() + sleeping.release() + cond.wait(timeout) + woken.release() + cond.release() + + def check_invariant(self, cond): + # this is only supposed to succeed when there are no sleepers + if self.TYPE == 'processes': + try: + sleepers = (cond._sleeping_count.get_value() - + cond._woken_count.get_value()) + self.assertEqual(sleepers, 0) + self.assertEqual(cond._wait_semaphore.get_value(), 0) + except NotImplementedError: + pass + + def test_notify(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + p.setDaemon(True) + p.start() + + # wait for both children to start sleeping + sleeping.acquire() + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake up one process/thread + cond.acquire() + cond.notify() + cond.release() + + # check one process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(1, get_value, woken) + + # wake up another + cond.acquire() + cond.notify() + cond.release() + + # check other has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(2, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + p.join() + + def test_notify_all(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + # start some threads/processes which will timeout + for i in range(3): + p = self.Process(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + t.setDaemon(True) + t.start() + + # wait for them all to sleep + for i in xrange(6): + sleeping.acquire() + + # check they have all timed out + for i in xrange(6): + woken.acquire() + self.assertReturnsIfImplemented(0, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + # start some more threads/processes + for i in range(3): + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + t.setDaemon(True) + t.start() + + # wait for them to all sleep + for i in xrange(6): + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake them all up + cond.acquire() + cond.notify_all() + cond.release() + + # check they have all woken + time.sleep(DELTA) + self.assertReturnsIfImplemented(6, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + def test_timeout(self): + cond = self.Condition() + wait = TimingWrapper(cond.wait) + cond.acquire() + res = wait(TIMEOUT1) + cond.release() + self.assertEqual(res, None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + +class _TestEvent(BaseTestCase): + + def _test_event(self, event): + time.sleep(TIMEOUT2) + event.set() + + def test_event(self): + event = self.Event() + wait = TimingWrapper(event.wait) + + # Removed temporaily, due to API shear, this does not + # work with threading._Event objects. is_set == isSet + #self.assertEqual(event.is_set(), False) + + self.assertEqual(wait(0.0), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + event.set() + + # See note above on the API differences + # self.assertEqual(event.is_set(), True) + self.assertEqual(wait(), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + # self.assertEqual(event.is_set(), True) + + event.clear() + + #self.assertEqual(event.is_set(), False) + + self.Process(target=self._test_event, args=(event,)).start() + self.assertEqual(wait(), None) + +# +# +# + +class _TestValue(BaseTestCase): + + codes_values = [ + ('i', 4343, 24234), + ('d', 3.625, -4.25), + ('h', -232, 234), + ('c', latin('x'), latin('y')) + ] + + def _test(self, values): + for sv, cv in zip(values, self.codes_values): + sv.value = cv[2] + + + def test_value(self, raw=False): + if self.TYPE != 'processes': + return + + if raw: + values = [self.RawValue(code, value) + for code, value, _ in self.codes_values] + else: + values = [self.Value(code, value) + for code, value, _ in self.codes_values] + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[1]) + + proc = self.Process(target=self._test, args=(values,)) + proc.start() + proc.join() + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[2]) + + def test_rawvalue(self): + self.test_value(raw=True) + + def test_getobj_getlock(self): + if self.TYPE != 'processes': + return + + val1 = self.Value('i', 5) + lock1 = val1.get_lock() + obj1 = val1.get_obj() + + val2 = self.Value('i', 5, lock=None) + lock2 = val2.get_lock() + obj2 = val2.get_obj() + + lock = self.Lock() + val3 = self.Value('i', 5, lock=lock) + lock3 = val3.get_lock() + obj3 = val3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawValue('i', 5) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + + +class _TestArray(BaseTestCase): + + def f(self, seq): + for i in range(1, len(seq)): + seq[i] += seq[i-1] + + def test_array(self, raw=False): + if self.TYPE != 'processes': + return + + seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831] + if raw: + arr = self.RawArray('i', seq) + else: + arr = self.Array('i', seq) + + self.assertEqual(len(arr), len(seq)) + self.assertEqual(arr[3], seq[3]) + self.assertEqual(list(arr[2:7]), list(seq[2:7])) + + arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4]) + + self.assertEqual(list(arr[:]), seq) + + self.f(seq) + + p = self.Process(target=self.f, args=(arr,)) + p.start() + p.join() + + self.assertEqual(list(arr[:]), seq) + + def test_rawarray(self): + self.test_array(raw=True) + + def test_getobj_getlock_obj(self): + if self.TYPE != 'processes': + return + + arr1 = self.Array('i', range(10)) + lock1 = arr1.get_lock() + obj1 = arr1.get_obj() + + arr2 = self.Array('i', range(10), lock=None) + lock2 = arr2.get_lock() + obj2 = arr2.get_obj() + + lock = self.Lock() + arr3 = self.Array('i', range(10), lock=lock) + lock3 = arr3.get_lock() + obj3 = arr3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawArray('i', range(10)) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + +# +# +# + +class _TestContainers(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_list(self): + a = self.list(range(10)) + self.assertEqual(a[:], range(10)) + + b = self.list() + self.assertEqual(b[:], []) + + b.extend(range(5)) + self.assertEqual(b[:], range(5)) + + self.assertEqual(b[2], 2) + self.assertEqual(b[2:10], [2,3,4]) + + b *= 2 + self.assertEqual(b[:], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) + + self.assertEqual(b + [5, 6], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6]) + + self.assertEqual(a[:], range(10)) + + d = [a, b] + e = self.list(d) + self.assertEqual( + e[:], + [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]] + ) + + f = self.list([a]) + a.append('hello') + self.assertEqual(f[:], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello']]) + + def test_dict(self): + d = self.dict() + indices = range(65, 70) + for i in indices: + d[i] = chr(i) + self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices)) + self.assertEqual(sorted(d.keys()), indices) + self.assertEqual(sorted(d.values()), [chr(i) for i in indices]) + self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices]) + + def test_namespace(self): + n = self.Namespace() + n.name = 'Bob' + n.job = 'Builder' + n._hidden = 'hidden' + self.assertEqual((n.name, n.job), ('Bob', 'Builder')) + del n.job + self.assertEqual(str(n), "Namespace(name='Bob')") + self.assertTrue(hasattr(n, 'name')) + self.assertTrue(not hasattr(n, 'job')) + +# +# +# + +def sqr(x, wait=0.0): + time.sleep(wait) + return x*x + +class _TestPool(BaseTestCase): + + def test_apply(self): + papply = self.pool.apply + self.assertEqual(papply(sqr, (5,)), sqr(5)) + self.assertEqual(papply(sqr, (), {'x':3}), sqr(x=3)) + + def test_map(self): + pmap = self.pool.map + self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) + self.assertEqual(pmap(sqr, range(100), chunksize=20), + map(sqr, range(100))) + + def test_async(self): + res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) + get = TimingWrapper(res.get) + self.assertEqual(get(), 49) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + def test_async_timeout(self): + res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) + get = TimingWrapper(res.get) + self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) + + def test_imap(self): + it = self.pool.imap(sqr, range(10)) + self.assertEqual(list(it), map(sqr, range(10))) + + it = self.pool.imap(sqr, range(10)) + for i in range(10): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + it = self.pool.imap(sqr, range(1000), chunksize=100) + for i in range(1000): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + def test_imap_unordered(self): + it = self.pool.imap_unordered(sqr, range(1000)) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + it = self.pool.imap_unordered(sqr, range(1000), chunksize=53) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + def test_make_pool(self): + p = multiprocessing.Pool(3) + self.assertEqual(3, len(p._pool)) + p.close() + p.join() + + def test_terminate(self): + if self.TYPE == 'manager': + # On Unix a forked process increfs each shared object to + # which its parent process held a reference. If the + # forked process gets terminated then there is likely to + # be a reference leak. So to prevent + # _TestZZZNumberOfObjects from failing we skip this test + # when using a manager. + return + + result = self.pool.map_async( + time.sleep, [0.1 for i in range(10000)], chunksize=1 + ) + self.pool.terminate() + join = TimingWrapper(self.pool.join) + join() + self.assertTrue(join.elapsed < 0.2) + +# +# Test that manager has expected number of shared objects left +# + +class _TestZZZNumberOfObjects(BaseTestCase): + # Because test cases are sorted alphabetically, this one will get + # run after all the other tests for the manager. It tests that + # there have been no "reference leaks" for the manager's shared + # objects. Note the comment in _TestPool.test_terminate(). + ALLOWED_TYPES = ('manager',) + + def test_number_of_objects(self): + EXPECTED_NUMBER = 1 # the pool object is still alive + multiprocessing.active_children() # discard dead process objs + gc.collect() # do garbage collection + refs = self.manager._number_of_objects() + if refs != EXPECTED_NUMBER: + print self.manager._debugInfo() + + self.assertEqual(refs, EXPECTED_NUMBER) + +# +# Test of creating a customized manager class +# + +from multiprocessing.managers import BaseManager, BaseProxy, RemoteError + +class FooBar(object): + def f(self): + return 'f()' + def g(self): + raise ValueError + def _h(self): + return '_h()' + +def baz(): + for i in xrange(10): + yield i*i + +class IteratorProxy(BaseProxy): + _exposed_ = ('next', '__next__') + def __iter__(self): + return self + def next(self): + return self._callmethod('next') + def __next__(self): + return self._callmethod('__next__') + +class MyManager(BaseManager): + pass + +MyManager.register('Foo', callable=FooBar) +MyManager.register('Bar', callable=FooBar, exposed=('f', '_h')) +MyManager.register('baz', callable=baz, proxytype=IteratorProxy) + + +class _TestMyManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_mymanager(self): + manager = MyManager() + manager.start() + + foo = manager.Foo() + bar = manager.Bar() + baz = manager.baz() + + foo_methods = [name for name in ('f', 'g', '_h') if hasattr(foo, name)] + bar_methods = [name for name in ('f', 'g', '_h') if hasattr(bar, name)] + + self.assertEqual(foo_methods, ['f', 'g']) + self.assertEqual(bar_methods, ['f', '_h']) + + self.assertEqual(foo.f(), 'f()') + self.assertRaises(ValueError, foo.g) + self.assertEqual(foo._callmethod('f'), 'f()') + self.assertRaises(RemoteError, foo._callmethod, '_h') + + self.assertEqual(bar.f(), 'f()') + self.assertEqual(bar._h(), '_h()') + self.assertEqual(bar._callmethod('f'), 'f()') + self.assertEqual(bar._callmethod('_h'), '_h()') + + self.assertEqual(list(baz), [i*i for i in range(10)]) + + manager.shutdown() + +# +# Test of connecting to a remote server and using xmlrpclib for serialization +# + +_queue = Queue.Queue() +def get_queue(): + return _queue + +class QueueManager(BaseManager): + '''manager class used by server process''' +QueueManager.register('get_queue', callable=get_queue) + +class QueueManager2(BaseManager): + '''manager class which specifies the same interface as QueueManager''' +QueueManager2.register('get_queue') + + +SERIALIZER = 'xmlrpclib' + +class _TestRemoteManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def _putter(self, address, authkey): + manager = QueueManager2( + address=address, authkey=authkey, serializer=SERIALIZER + ) + manager.connect() + queue = manager.get_queue() + queue.put(('hello world', None, True, 2.25)) + + def test_remote(self): + authkey = os.urandom(32) + + manager = QueueManager( + address=('localhost', 0), authkey=authkey, serializer=SERIALIZER + ) + manager.start() + + p = self.Process(target=self._putter, args=(manager.address, authkey)) + p.start() + + manager2 = QueueManager2( + address=manager.address, authkey=authkey, serializer=SERIALIZER + ) + manager2.connect() + queue = manager2.get_queue() + + # Note that xmlrpclib will deserialize object as a list not a tuple + self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) + + # Because we are using xmlrpclib for serialization instead of + # pickle this will cause a serialization error. + self.assertRaises(Exception, queue.put, time.sleep) + + # Make queue finalizer run before the server is stopped + del queue + manager.shutdown() + +# +# +# + +SENTINEL = latin('') + +class _TestConnection(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _echo(self, conn): + for msg in iter(conn.recv_bytes, SENTINEL): + conn.send_bytes(msg) + conn.close() + + def test_connection(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.set_daemon(True) + p.start() + + seq = [1, 2.25, None] + msg = latin('hello world') + longmsg = msg * 10 + arr = array.array('i', range(4)) + + if self.TYPE == 'processes': + self.assertEqual(type(conn.fileno()), int) + + self.assertEqual(conn.send(seq), None) + self.assertEqual(conn.recv(), seq) + + self.assertEqual(conn.send_bytes(msg), None) + self.assertEqual(conn.recv_bytes(), msg) + + if self.TYPE == 'processes': + buffer = array.array('i', [0]*10) + expected = list(arr) + [0] * (10 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = array.array('i', [0]*10) + expected = [0] * 3 + list(arr) + [0] * (10 - 3 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer, 3 * buffer.itemsize), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = bytearray(latin(' ' * 40)) + self.assertEqual(conn.send_bytes(longmsg), None) + try: + res = conn.recv_bytes_into(buffer) + except multiprocessing.BufferTooShort, e: + self.assertEqual(e.args, (longmsg,)) + else: + self.fail('expected BufferTooShort, got %s' % res) + + poll = TimingWrapper(conn.poll) + + self.assertEqual(poll(), False) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(poll(TIMEOUT1), False) + self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1) + + conn.send(None) + + self.assertEqual(poll(TIMEOUT1), True) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(conn.recv(), None) + + really_big_msg = latin('X') * (1024 * 1024 * 16) # 16Mb + conn.send_bytes(really_big_msg) + self.assertEqual(conn.recv_bytes(), really_big_msg) + + conn.send_bytes(SENTINEL) # tell child to quit + child_conn.close() + + if self.TYPE == 'processes': + self.assertEqual(conn.readable, True) + self.assertEqual(conn.writable, True) + self.assertRaises(EOFError, conn.recv) + self.assertRaises(EOFError, conn.recv_bytes) + + p.join() + + def test_duplex_false(self): + reader, writer = self.Pipe(duplex=False) + self.assertEqual(writer.send(1), None) + self.assertEqual(reader.recv(), 1) + if self.TYPE == 'processes': + self.assertEqual(reader.readable, True) + self.assertEqual(reader.writable, False) + self.assertEqual(writer.readable, False) + self.assertEqual(writer.writable, True) + self.assertRaises(IOError, reader.send, 2) + self.assertRaises(IOError, writer.recv) + self.assertRaises(IOError, writer.poll) + + def test_spawn_close(self): + # We test that a pipe connection can be closed by parent + # process immediately after child is spawned. On Windows this + # would have sometimes failed on old versions because + # child_conn would be closed before the child got a chance to + # duplicate it. + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.start() + child_conn.close() # this might complete before child initializes + + msg = latin('hello') + conn.send_bytes(msg) + self.assertEqual(conn.recv_bytes(), msg) + + conn.send_bytes(SENTINEL) + conn.close() + p.join() + + def test_sendbytes(self): + if self.TYPE != 'processes': + return + + msg = latin('abcdefghijklmnopqrstuvwxyz') + a, b = self.Pipe() + + a.send_bytes(msg) + self.assertEqual(b.recv_bytes(), msg) + + a.send_bytes(msg, 5) + self.assertEqual(b.recv_bytes(), msg[5:]) + + a.send_bytes(msg, 7, 8) + self.assertEqual(b.recv_bytes(), msg[7:7+8]) + + a.send_bytes(msg, 26) + self.assertEqual(b.recv_bytes(), latin('')) + + a.send_bytes(msg, 26, 0) + self.assertEqual(b.recv_bytes(), latin('')) + + self.assertRaises(ValueError, a.send_bytes, msg, 27) + + self.assertRaises(ValueError, a.send_bytes, msg, 22, 5) + + self.assertRaises(ValueError, a.send_bytes, msg, 26, 1) + + self.assertRaises(ValueError, a.send_bytes, msg, -1) + + self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) + + +class _TestListenerClient(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _test(self, address): + conn = self.connection.Client(address) + conn.send('hello') + conn.close() + + def test_listener_client(self): + for family in self.connection.families: + l = self.connection.Listener(family=family) + p = self.Process(target=self._test, args=(l.address,)) + p.set_daemon(True) + p.start() + conn = l.accept() + self.assertEqual(conn.recv(), 'hello') + p.join() + l.close() + +# +# Test of sending connection and socket objects between processes +# + +class _TestPicklingConnections(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _listener(self, conn, families): + for fam in families: + l = self.connection.Listener(family=fam) + conn.send(l.address) + new_conn = l.accept() + conn.send(new_conn) + + if self.TYPE == 'processes': + l = socket.socket() + l.bind(('localhost', 0)) + conn.send(l.getsockname()) + l.listen(1) + new_conn, addr = l.accept() + conn.send(new_conn) + + conn.recv() + + def _remote(self, conn): + for (address, msg) in iter(conn.recv, None): + client = self.connection.Client(address) + client.send(msg.upper()) + client.close() + + if self.TYPE == 'processes': + address, msg = conn.recv() + client = socket.socket() + client.connect(address) + client.sendall(msg.upper()) + client.close() + + conn.close() + + def test_pickling(self): + try: + multiprocessing.allow_connection_pickling() + except ImportError: + return + + families = self.connection.families + + lconn, lconn0 = self.Pipe() + lp = self.Process(target=self._listener, args=(lconn0, families)) + lp.start() + lconn0.close() + + rconn, rconn0 = self.Pipe() + rp = self.Process(target=self._remote, args=(rconn0,)) + rp.start() + rconn0.close() + + for fam in families: + msg = ('This connection uses family %s' % fam).encode('ascii') + address = lconn.recv() + rconn.send((address, msg)) + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(), msg.upper()) + + rconn.send(None) + + if self.TYPE == 'processes': + msg = latin('This connection uses a normal socket') + address = lconn.recv() + rconn.send((address, msg)) + if hasattr(socket, 'fromfd'): + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(100), msg.upper()) + else: + # XXX On Windows with Py2.6 need to backport fromfd() + discard = lconn.recv_bytes() + + lconn.send(None) + + rconn.close() + lconn.close() + + lp.join() + rp.join() + +# +# +# + +class _TestHeap(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_heap(self): + iterations = 5000 + maxblocks = 50 + blocks = [] + + # create and destroy lots of blocks of different sizes + for i in xrange(iterations): + size = int(random.lognormvariate(0, 1) * 1000) + b = multiprocessing.heap.BufferWrapper(size) + blocks.append(b) + if len(blocks) > maxblocks: + i = random.randrange(maxblocks) + del blocks[i] + + # get the heap object + heap = multiprocessing.heap.BufferWrapper._heap + + # verify the state of the heap + all = [] + occupied = 0 + for L in heap._len_to_seq.values(): + for arena, start, stop in L: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'free')) + for arena, start, stop in heap._allocated_blocks: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'occupied')) + occupied += (stop-start) + + all.sort() + + for i in range(len(all)-1): + (arena, start, stop) = all[i][:3] + (narena, nstart, nstop) = all[i+1][:3] + self.assertTrue((arena != narena and nstart == 0) or + (stop == nstart)) + +# +# +# + +try: + from ctypes import Structure, Value, copy, c_int, c_double +except ImportError: + Structure = object + c_int = c_double = None + +class _Foo(Structure): + _fields_ = [ + ('x', c_int), + ('y', c_double) + ] + +class _TestSharedCTypes(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _double(self, x, y, foo, arr, string): + x.value *= 2 + y.value *= 2 + foo.x *= 2 + foo.y *= 2 + string.value *= 2 + for i in range(len(arr)): + arr[i] *= 2 + + def test_sharedctypes(self, lock=False): + if c_int is None: + return + + x = Value('i', 7, lock=lock) + y = Value(ctypes.c_double, 1.0/3.0, lock=lock) + foo = Value(_Foo, 3, 2, lock=lock) + arr = Array('d', range(10), lock=lock) + string = Array('c', 20, lock=lock) + string.value = 'hello' + + p = self.Process(target=self._double, args=(x, y, foo, arr, string)) + p.start() + p.join() + + self.assertEqual(x.value, 14) + self.assertAlmostEqual(y.value, 2.0/3.0) + self.assertEqual(foo.x, 6) + self.assertAlmostEqual(foo.y, 4.0) + for i in range(10): + self.assertAlmostEqual(arr[i], i*2) + self.assertEqual(string.value, latin('hellohello')) + + def test_synchronize(self): + self.test_sharedctypes(lock=True) + + def test_copy(self): + if c_int is None: + return + + foo = _Foo(2, 5.0) + bar = copy(foo) + foo.x = 0 + foo.y = 0 + self.assertEqual(bar.x, 2) + self.assertAlmostEqual(bar.y, 5.0) + +# +# +# + +class _TestFinalize(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _test_finalize(self, conn): + class Foo(object): + pass + + a = Foo() + util.Finalize(a, conn.send, args=('a',)) + del a # triggers callback for a + + b = Foo() + close_b = util.Finalize(b, conn.send, args=('b',)) + close_b() # triggers callback for b + close_b() # does nothing because callback has already been called + del b # does nothing because callback has already been called + + c = Foo() + util.Finalize(c, conn.send, args=('c',)) + + d10 = Foo() + util.Finalize(d10, conn.send, args=('d10',), exitpriority=1) + + d01 = Foo() + util.Finalize(d01, conn.send, args=('d01',), exitpriority=0) + d02 = Foo() + util.Finalize(d02, conn.send, args=('d02',), exitpriority=0) + d03 = Foo() + util.Finalize(d03, conn.send, args=('d03',), exitpriority=0) + + util.Finalize(None, conn.send, args=('e',), exitpriority=-10) + + util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100) + + # call mutliprocessing's cleanup function then exit process without + # garbage collecting locals + util._exit_function() + conn.close() + os._exit(0) + + def test_finalize(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._test_finalize, args=(child_conn,)) + p.start() + p.join() + + result = [obj for obj in iter(conn.recv, 'STOP')] + self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e']) + +# +# Test that from ... import * works for each module +# + +class _TestImportStar(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_import(self): + modules = ( + 'multiprocessing', 'multiprocessing.connection', + 'multiprocessing.heap', 'multiprocessing.managers', + 'multiprocessing.pool', 'multiprocessing.process', + 'multiprocessing.reduction', 'multiprocessing.sharedctypes', + 'multiprocessing.synchronize', 'multiprocessing.util' + ) + + for name in modules: + __import__(name) + mod = sys.modules[name] + + for attr in getattr(mod, '__all__', ()): + self.assertTrue( + hasattr(mod, attr), + '%r does not have attribute %r' % (mod, attr) + ) + +# +# Quick test that logging works -- does not test logging output +# + +class _TestLogging(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_enable_logging(self): + logger = multiprocessing.get_logger() + logger.setLevel(util.SUBWARNING) + self.assertTrue(logger is not None) + logger.debug('this will not be printed') + logger.info('nor will this') + logger.setLevel(LOG_LEVEL) + + def _test_level(self, conn): + logger = multiprocessing.get_logger() + conn.send(logger.getEffectiveLevel()) + + def test_level(self): + LEVEL1 = 32 + LEVEL2 = 37 + + logger = multiprocessing.get_logger() + root_logger = logging.getLogger() + root_level = root_logger.level + + reader, writer = multiprocessing.Pipe(duplex=False) + + logger.setLevel(LEVEL1) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL1, reader.recv()) + + logger.setLevel(logging.NOTSET) + root_logger.setLevel(LEVEL2) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL2, reader.recv()) + + root_logger.setLevel(root_level) + logger.setLevel(level=LOG_LEVEL) + +# +# Functions used to create test cases from the base ones in this module +# + +def get_attributes(Source, names): + d = {} + for name in names: + obj = getattr(Source, name) + if type(obj) == type(get_attributes): + obj = staticmethod(obj) + d[name] = obj + return d + +def create_test_cases(Mixin, type): + result = {} + glob = globals() + Type = type[0].upper() + type[1:] + + for name in glob.keys(): + if name.startswith('_Test'): + base = glob[name] + if type in base.ALLOWED_TYPES: + newname = 'With' + Type + name[1:] + class Temp(base, unittest.TestCase, Mixin): + pass + result[newname] = Temp + Temp.__name__ = newname + Temp.__module__ = Mixin.__module__ + return result + +# +# Create test cases +# + +class ProcessesMixin(object): + TYPE = 'processes' + Process = multiprocessing.Process + locals().update(get_attributes(multiprocessing, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'RawValue', + 'RawArray', 'current_process', 'active_children', 'Pipe', + 'connection', 'JoinableQueue' + ))) + +testcases_processes = create_test_cases(ProcessesMixin, type='processes') +globals().update(testcases_processes) + + +class ManagerMixin(object): + TYPE = 'manager' + Process = multiprocessing.Process + manager = object.__new__(multiprocessing.managers.SyncManager) + locals().update(get_attributes(manager, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'list', 'dict', + 'Namespace', 'JoinableQueue' + ))) + +testcases_manager = create_test_cases(ManagerMixin, type='manager') +globals().update(testcases_manager) + + +class ThreadsMixin(object): + TYPE = 'threads' + Process = multiprocessing.dummy.Process + locals().update(get_attributes(multiprocessing.dummy, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'current_process', + 'active_children', 'Pipe', 'connection', 'dict', 'list', + 'Namespace', 'JoinableQueue' + ))) + +testcases_threads = create_test_cases(ThreadsMixin, type='threads') +globals().update(testcases_threads) + +# +# +# + +def test_main(run=None): + if run is None: + from test.test_support import run_unittest as run + + util.get_temp_dir() # creates temp directory for use by all processes + + multiprocessing.get_logger().setLevel(LOG_LEVEL) + + ProcessesMixin.pool = multiprocessing.Pool(4) + ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + ManagerMixin.manager.__init__() + ManagerMixin.manager.start() + ManagerMixin.pool = ManagerMixin.manager.Pool(4) + + testcases = ( + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + + sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + ) + + loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase + suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) + run(suite) + + ThreadsMixin.pool.terminate() + ProcessesMixin.pool.terminate() + ManagerMixin.pool.terminate() + ManagerMixin.manager.shutdown() + + del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + +def main(): + test_main(unittest.TextTestRunner(verbosity=2).run) + +if __name__ == '__main__': + main() Added: python/trunk/Modules/_multiprocessing/connection.h ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/connection.h Wed Jun 11 04:40:25 2008 @@ -0,0 +1,515 @@ +/* + * Definition of a `Connection` type. + * Used by `socket_connection.c` and `pipe_connection.c`. + * + * connection.h + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#ifndef CONNECTION_H +#define CONNECTION_H + +/* + * Read/write flags + */ + +#define READABLE 1 +#define WRITABLE 2 + +#define CHECK_READABLE(self) \ + if (!(self->flags & READABLE)) { \ + PyErr_SetString(PyExc_IOError, "connection is write-only"); \ + return NULL; \ + } + +#define CHECK_WRITABLE(self) \ + if (!(self->flags & WRITABLE)) { \ + PyErr_SetString(PyExc_IOError, "connection is read-only"); \ + return NULL; \ + } + +/* + * Allocation and deallocation + */ + +static PyObject * +connection_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + ConnectionObject *self; + HANDLE handle; + BOOL readable = TRUE, writable = TRUE; + + static char *kwlist[] = {"handle", "readable", "writable", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, F_HANDLE "|ii", kwlist, + &handle, &readable, &writable)) + return NULL; + + if (handle == INVALID_HANDLE_VALUE || (Py_ssize_t)handle < 0) { + PyErr_Format(PyExc_IOError, "invalid handle %" + PY_FORMAT_SIZE_T "d", (Py_ssize_t)handle); + return NULL; + } + + if (!readable && !writable) { + PyErr_SetString(PyExc_ValueError, + "either readable or writable must be true"); + return NULL; + } + + self = PyObject_New(ConnectionObject, type); + if (self == NULL) + return NULL; + + self->weakreflist = NULL; + self->handle = handle; + self->flags = 0; + + if (readable) + self->flags |= READABLE; + if (writable) + self->flags |= WRITABLE; + assert(self->flags >= 1 && self->flags <= 3); + + return (PyObject*)self; +} + +static void +connection_dealloc(ConnectionObject* self) +{ + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject*)self); + + if (self->handle != INVALID_HANDLE_VALUE) { + Py_BEGIN_ALLOW_THREADS + CLOSE(self->handle); + Py_END_ALLOW_THREADS + } + PyObject_Del(self); +} + +/* + * Functions for transferring buffers + */ + +static PyObject * +connection_sendbytes(ConnectionObject *self, PyObject *args) +{ + char *buffer; + Py_ssize_t length, offset=0, size=PY_SSIZE_T_MIN; + int res; + + if (!PyArg_ParseTuple(args, F_RBUFFER "#|" F_PY_SSIZE_T F_PY_SSIZE_T, + &buffer, &length, &offset, &size)) + return NULL; + + CHECK_WRITABLE(self); + + if (offset < 0) { + PyErr_SetString(PyExc_ValueError, "offset is negative"); + return NULL; + } + if (length < offset) { + PyErr_SetString(PyExc_ValueError, "buffer length < offset"); + return NULL; + } + + if (size == PY_SSIZE_T_MIN) { + size = length - offset; + } else { + if (size < 0) { + PyErr_SetString(PyExc_ValueError, "size is negative"); + return NULL; + } + if (offset + size > length) { + PyErr_SetString(PyExc_ValueError, + "buffer length < offset + size"); + return NULL; + } + } + + Py_BEGIN_ALLOW_THREADS + res = conn_send_string(self, buffer + offset, size); + Py_END_ALLOW_THREADS + + if (res < 0) + return mp_SetError(PyExc_IOError, res); + + Py_RETURN_NONE; +} + +static PyObject * +connection_recvbytes(ConnectionObject *self, PyObject *args) +{ + char *freeme = NULL; + Py_ssize_t res, maxlength = PY_SSIZE_T_MAX; + PyObject *result = NULL; + + if (!PyArg_ParseTuple(args, "|" F_PY_SSIZE_T, &maxlength)) + return NULL; + + CHECK_READABLE(self); + + if (maxlength < 0) { + PyErr_SetString(PyExc_ValueError, "maxlength < 0"); + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + res = conn_recv_string(self, self->buffer, CONNECTION_BUFFER_SIZE, + &freeme, maxlength); + Py_END_ALLOW_THREADS + + if (res < 0) { + if (res == MP_BAD_MESSAGE_LENGTH) { + if ((self->flags & WRITABLE) == 0) { + Py_BEGIN_ALLOW_THREADS + CLOSE(self->handle); + Py_END_ALLOW_THREADS + self->handle = INVALID_HANDLE_VALUE; + } else { + self->flags = WRITABLE; + } + } + mp_SetError(PyExc_IOError, res); + } else { + if (freeme == NULL) { + result = PyString_FromStringAndSize(self->buffer, res); + } else { + result = PyString_FromStringAndSize(freeme, res); + PyMem_Free(freeme); + } + } + + return result; +} + +static PyObject * +connection_recvbytes_into(ConnectionObject *self, PyObject *args) +{ + char *freeme = NULL, *buffer = NULL; + Py_ssize_t res, length, offset = 0; + PyObject *result = NULL; + + if (!PyArg_ParseTuple(args, "w#|" F_PY_SSIZE_T, + &buffer, &length, &offset)) + return NULL; + + CHECK_READABLE(self); + + if (offset < 0) { + PyErr_SetString(PyExc_ValueError, "negative offset"); + return NULL; + } + + if (offset > length) { + PyErr_SetString(PyExc_ValueError, "offset too large"); + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + res = conn_recv_string(self, buffer+offset, length-offset, + &freeme, PY_SSIZE_T_MAX); + Py_END_ALLOW_THREADS + + if (res < 0) { + if (res == MP_BAD_MESSAGE_LENGTH) { + if ((self->flags & WRITABLE) == 0) { + Py_BEGIN_ALLOW_THREADS + CLOSE(self->handle); + Py_END_ALLOW_THREADS + self->handle = INVALID_HANDLE_VALUE; + } else { + self->flags = WRITABLE; + } + } + mp_SetError(PyExc_IOError, res); + } else { + if (freeme == NULL) { + result = PyInt_FromSsize_t(res); + } else { + result = PyObject_CallFunction(BufferTooShort, + F_RBUFFER "#", + freeme, res); + PyMem_Free(freeme); + if (result) { + PyErr_SetObject(BufferTooShort, result); + Py_DECREF(result); + } + return NULL; + } + } + + return result; +} + +/* + * Functions for transferring objects + */ + +static PyObject * +connection_send_obj(ConnectionObject *self, PyObject *obj) +{ + char *buffer; + int res; + Py_ssize_t length; + PyObject *pickled_string = NULL; + + CHECK_WRITABLE(self); + + pickled_string = PyObject_CallFunctionObjArgs(pickle_dumps, obj, + pickle_protocol, NULL); + if (!pickled_string) + goto failure; + + if (PyString_AsStringAndSize(pickled_string, &buffer, &length) < 0) + goto failure; + + Py_BEGIN_ALLOW_THREADS + res = conn_send_string(self, buffer, (int)length); + Py_END_ALLOW_THREADS + + if (res < 0) { + mp_SetError(PyExc_IOError, res); + goto failure; + } + + Py_XDECREF(pickled_string); + Py_RETURN_NONE; + + failure: + Py_XDECREF(pickled_string); + return NULL; +} + +static PyObject * +connection_recv_obj(ConnectionObject *self) +{ + char *freeme = NULL; + Py_ssize_t res; + PyObject *temp = NULL, *result = NULL; + + CHECK_READABLE(self); + + Py_BEGIN_ALLOW_THREADS + res = conn_recv_string(self, self->buffer, CONNECTION_BUFFER_SIZE, + &freeme, PY_SSIZE_T_MAX); + Py_END_ALLOW_THREADS + + if (res < 0) { + if (res == MP_BAD_MESSAGE_LENGTH) { + if ((self->flags & WRITABLE) == 0) { + Py_BEGIN_ALLOW_THREADS + CLOSE(self->handle); + Py_END_ALLOW_THREADS + self->handle = INVALID_HANDLE_VALUE; + } else { + self->flags = WRITABLE; + } + } + mp_SetError(PyExc_IOError, res); + } else { + if (freeme == NULL) { + temp = PyString_FromStringAndSize(self->buffer, res); + } else { + temp = PyString_FromStringAndSize(freeme, res); + PyMem_Free(freeme); + } + } + + if (temp) + result = PyObject_CallFunctionObjArgs(pickle_loads, + temp, NULL); + Py_XDECREF(temp); + return result; +} + +/* + * Other functions + */ + +static PyObject * +connection_poll(ConnectionObject *self, PyObject *args) +{ + PyObject *timeout_obj = NULL; + double timeout = 0.0; + int res; + + CHECK_READABLE(self); + + if (!PyArg_ParseTuple(args, "|O", &timeout_obj)) + return NULL; + + if (timeout_obj == NULL) { + timeout = 0.0; + } else if (timeout_obj == Py_None) { + timeout = -1.0; /* block forever */ + } else { + timeout = PyFloat_AsDouble(timeout_obj); + if (PyErr_Occurred()) + return NULL; + if (timeout < 0.0) + timeout = 0.0; + } + + Py_BEGIN_ALLOW_THREADS + res = conn_poll(self, timeout); + Py_END_ALLOW_THREADS + + switch (res) { + case TRUE: + Py_RETURN_TRUE; + case FALSE: + Py_RETURN_FALSE; + default: + return mp_SetError(PyExc_IOError, res); + } +} + +static PyObject * +connection_fileno(ConnectionObject* self) +{ + if (self->handle == INVALID_HANDLE_VALUE) { + PyErr_SetString(PyExc_IOError, "handle is invalid"); + return NULL; + } + return PyInt_FromLong((long)self->handle); +} + +static PyObject * +connection_close(ConnectionObject *self) +{ + if (self->handle != INVALID_HANDLE_VALUE) { + Py_BEGIN_ALLOW_THREADS + CLOSE(self->handle); + Py_END_ALLOW_THREADS + self->handle = INVALID_HANDLE_VALUE; + } + + Py_RETURN_NONE; +} + +static PyObject * +connection_repr(ConnectionObject *self) +{ + static char *conn_type[] = {"read-only", "write-only", "read-write"}; + + assert(self->flags >= 1 && self->flags <= 3); + return FROM_FORMAT("<%s %s, handle %" PY_FORMAT_SIZE_T "d>", + conn_type[self->flags - 1], + CONNECTION_NAME, (Py_ssize_t)self->handle); +} + +/* + * Getters and setters + */ + +static PyObject * +connection_closed(ConnectionObject *self, void *closure) +{ + return PyBool_FromLong((long)(self->handle == INVALID_HANDLE_VALUE)); +} + +static PyObject * +connection_readable(ConnectionObject *self, void *closure) +{ + return PyBool_FromLong((long)(self->flags & READABLE)); +} + +static PyObject * +connection_writable(ConnectionObject *self, void *closure) +{ + return PyBool_FromLong((long)(self->flags & WRITABLE)); +} + +/* + * Tables + */ + +static PyMethodDef connection_methods[] = { + {"send_bytes", (PyCFunction)connection_sendbytes, METH_VARARGS, + "send the byte data from a readable buffer-like object"}, + {"recv_bytes", (PyCFunction)connection_recvbytes, METH_VARARGS, + "receive byte data as a string"}, + {"recv_bytes_into",(PyCFunction)connection_recvbytes_into,METH_VARARGS, + "receive byte data into a writeable buffer-like object\n" + "returns the number of bytes read"}, + + {"send", (PyCFunction)connection_send_obj, METH_O, + "send a (picklable) object"}, + {"recv", (PyCFunction)connection_recv_obj, METH_NOARGS, + "receive a (picklable) object"}, + + {"poll", (PyCFunction)connection_poll, METH_VARARGS, + "whether there is any input available to be read"}, + {"fileno", (PyCFunction)connection_fileno, METH_NOARGS, + "file descriptor or handle of the connection"}, + {"close", (PyCFunction)connection_close, METH_NOARGS, + "close the connection"}, + + {NULL} /* Sentinel */ +}; + +static PyGetSetDef connection_getset[] = { + {"closed", (getter)connection_closed, NULL, + "True if the connection is closed", NULL}, + {"readable", (getter)connection_readable, NULL, + "True if the connection is readable", NULL}, + {"writable", (getter)connection_writable, NULL, + "True if the connection is writable", NULL}, + {NULL} +}; + +/* + * Connection type + */ + +PyDoc_STRVAR(connection_doc, + "Connection type whose constructor signature is\n\n" + " Connection(handle, readable=True, writable=True).\n\n" + "The constructor does *not* duplicate the handle."); + +PyTypeObject CONNECTION_TYPE = { + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "_multiprocessing." CONNECTION_NAME, + /* tp_basicsize */ sizeof(ConnectionObject), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)connection_dealloc, + /* tp_print */ 0, + /* tp_getattr */ 0, + /* tp_setattr */ 0, + /* tp_compare */ 0, + /* tp_repr */ (reprfunc)connection_repr, + /* 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 */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + Py_TPFLAGS_HAVE_WEAKREFS, + /* tp_doc */ connection_doc, + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ offsetof(ConnectionObject, weakreflist), + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ connection_methods, + /* tp_members */ 0, + /* tp_getset */ connection_getset, + /* 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 */ connection_new, +}; + +#endif /* CONNECTION_H */ Added: python/trunk/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/multiprocessing.c Wed Jun 11 04:40:25 2008 @@ -0,0 +1,308 @@ +/* + * Extension module used by mutliprocessing package + * + * multiprocessing.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +PyObject *create_win32_namespace(void); + +PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; +PyObject *ProcessError, *BufferTooShort; + +/* + * Function which raises exceptions based on error codes + */ + +PyObject * +mp_SetError(PyObject *Type, int num) +{ + switch (num) { +#ifdef MS_WINDOWS + case MP_STANDARD_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, 0); + break; + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); + break; +#else /* !MS_WINDOWS */ + case MP_STANDARD_ERROR: + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_OSError; + PyErr_SetFromErrno(Type); + break; +#endif /* !MS_WINDOWS */ + case MP_MEMORY_ERROR: + PyErr_NoMemory(); + break; + case MP_END_OF_FILE: + PyErr_SetNone(PyExc_EOFError); + break; + case MP_EARLY_END_OF_FILE: + PyErr_SetString(PyExc_IOError, + "got end of file during message"); + break; + case MP_BAD_MESSAGE_LENGTH: + PyErr_SetString(PyExc_IOError, "bad message length"); + break; + case MP_EXCEPTION_HAS_BEEN_SET: + break; + default: + PyErr_Format(PyExc_RuntimeError, + "unkown error number %d", num); + } + return NULL; +} + + +/* + * Windows only + */ + +#ifdef MS_WINDOWS + +/* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ + +HANDLE sigint_event = NULL; + +static BOOL WINAPI +ProcessingCtrlHandler(DWORD dwCtrlType) +{ + SetEvent(sigint_event); + return FALSE; +} + +/* + * Unix only + */ + +#else /* !MS_WINDOWS */ + +#if HAVE_FD_TRANSFER + +/* Functions for transferring file descriptors between processes. + Reimplements some of the functionality of the fdcred + module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ + +static PyObject * +multiprocessing_sendfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "ii", &conn, &fd)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + *(int*)CMSG_DATA(cmsg) = fd; + + Py_BEGIN_ALLOW_THREADS + res = sendmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + Py_RETURN_NONE; +} + +static PyObject * +multiprocessing_recvfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "i", &conn)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + + Py_BEGIN_ALLOW_THREADS + res = recvmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + + fd = *(int*)CMSG_DATA(cmsg); + return Py_BuildValue("i", fd); +} + +#endif /* HAVE_FD_TRANSFER */ + +#endif /* !MS_WINDOWS */ + + +/* + * All platforms + */ + +static PyObject* +multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) +{ + void *buffer; + Py_ssize_t buffer_len; + + if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) + return NULL; + + return Py_BuildValue("N" F_PY_SSIZE_T, + PyLong_FromVoidPtr(buffer), buffer_len); +} + + +/* + * Function table + */ + +static PyMethodDef module_methods[] = { + {"address_of_buffer", multiprocessing_address_of_buffer, METH_O, + "address_of_buffer(obj) -> int\n" + "Return address of obj assuming obj supports buffer inteface"}, +#if HAVE_FD_TRANSFER + {"sendfd", multiprocessing_sendfd, METH_VARARGS, + "sendfd(sockfd, fd) -> None\n" + "Send file descriptor given by fd over the unix domain socket\n" + "whose file decriptor is sockfd"}, + {"recvfd", multiprocessing_recvfd, METH_VARARGS, + "recvfd(sockfd) -> fd\n" + "Receive a file descriptor over a unix domain socket\n" + "whose file decriptor is sockfd"}, +#endif + {NULL} +}; + + +/* + * Initialize + */ + +PyMODINIT_FUNC +init_multiprocessing(void) +{ + PyObject *module, *temp; + + /* Initialize module */ + module = Py_InitModule("_multiprocessing", module_methods); + if (!module) + return; + + /* Get copy of objects from pickle */ + temp = PyImport_ImportModule(PICKLE_MODULE); + if (!temp) + return; + pickle_dumps = PyObject_GetAttrString(temp, "dumps"); + pickle_loads = PyObject_GetAttrString(temp, "loads"); + pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); + Py_XDECREF(temp); + + /* Get copy of BufferTooShort */ + temp = PyImport_ImportModule("multiprocessing"); + if (!temp) + return; + BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); + Py_XDECREF(temp); + + /* Add connection type to module */ + if (PyType_Ready(&ConnectionType) < 0) + return; + Py_INCREF(&ConnectionType); + PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); + +#if defined(MS_WINDOWS) || HAVE_SEM_OPEN + /* Add SemLock type to module */ + if (PyType_Ready(&SemLockType) < 0) + return; + Py_INCREF(&SemLockType); + PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", + Py_BuildValue("i", SEM_VALUE_MAX)); + PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); +#endif + +#ifdef MS_WINDOWS + /* Add PipeConnection to module */ + if (PyType_Ready(&PipeConnectionType) < 0) + return; + Py_INCREF(&PipeConnectionType); + PyModule_AddObject(module, "PipeConnection", + (PyObject*)&PipeConnectionType); + + /* Initialize win32 class and add to multiprocessing */ + temp = create_win32_namespace(); + if (!temp) + return; + PyModule_AddObject(module, "win32", temp); + + /* Initialize the event handle used to signal Ctrl-C */ + sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!sigint_event) { + PyErr_SetFromWindowsErr(0); + return; + } + if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) { + PyErr_SetFromWindowsErr(0); + return; + } +#endif + + /* Add configuration macros */ + temp = PyDict_New(); + if (!temp) + return; + if (PyModule_AddObject(module, "flags", temp) < 0) + return; + +#define ADD_FLAG(name) \ + if (PyDict_SetItemString(temp, #name, Py_BuildValue("i", name)) < 0) return + +#ifdef HAVE_SEM_OPEN + ADD_FLAG(HAVE_SEM_OPEN); +#endif +#ifdef HAVE_SEM_TIMEDWAIT + ADD_FLAG(HAVE_SEM_TIMEDWAIT); +#endif +#ifdef HAVE_FD_TRANSFER + ADD_FLAG(HAVE_FD_TRANSFER); +#endif +#ifdef HAVE_BROKEN_SEM_GETVALUE + ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE); +#endif +#ifdef HAVE_BROKEN_SEM_UNLINK + ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); +#endif +} Added: python/trunk/Modules/_multiprocessing/multiprocessing.h ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/multiprocessing.h Wed Jun 11 04:40:25 2008 @@ -0,0 +1,163 @@ +#ifndef MULTIPROCESSING_H +#define MULTIPROCESSING_H + +#define PY_SSIZE_T_CLEAN + +#include "Python.h" +#include "structmember.h" +#include "pythread.h" + +/* + * Platform includes and definitions + */ + +#ifdef MS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# include +# include +# include /* getpid() */ +# define SEM_HANDLE HANDLE +# define SEM_VALUE_MAX LONG_MAX +#else +# include /* O_CREAT and O_EXCL */ +# include +# include /* htonl() and ntohl() */ +# if HAVE_SEM_OPEN +# include + typedef sem_t *SEM_HANDLE; +# endif +# define HANDLE int +# define SOCKET int +# define BOOL int +# define UINT32 uint32_t +# define INT32 int32_t +# define TRUE 1 +# define FALSE 0 +# define INVALID_HANDLE_VALUE (-1) +#endif + +/* + * Make sure Py_ssize_t available + */ + +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) + typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +# define F_PY_SSIZE_T "i" +# define PY_FORMAT_SIZE_T "" +# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n) +#else +# define F_PY_SSIZE_T "n" +#endif + +/* + * Format codes + */ + +#if SIZEOF_VOID_P == SIZEOF_LONG +# define F_POINTER "k" +# define T_POINTER T_ULONG +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +# define F_POINTER "K" +# define T_POINTER T_ULONGLONG +#else +# error "can't find format code for unsigned integer of same size as void*" +#endif + +#ifdef MS_WINDOWS +# define F_HANDLE F_POINTER +# define T_HANDLE T_POINTER +# define F_SEM_HANDLE F_HANDLE +# define T_SEM_HANDLE T_HANDLE +# define F_DWORD "k" +# define T_DWORD T_ULONG +#else +# define F_HANDLE "i" +# define T_HANDLE T_INT +# define F_SEM_HANDLE F_POINTER +# define T_SEM_HANDLE T_POINTER +#endif + +#if PY_VERSION_HEX >= 0x03000000 +# define F_RBUFFER "y" +#else +# define F_RBUFFER "s" +#endif + +/* + * Error codes which can be returned by functions called without GIL + */ + +#define MP_SUCCESS (0) +#define MP_STANDARD_ERROR (-1) +#define MP_MEMORY_ERROR (-1001) +#define MP_END_OF_FILE (-1002) +#define MP_EARLY_END_OF_FILE (-1003) +#define MP_BAD_MESSAGE_LENGTH (-1004) +#define MP_SOCKET_ERROR (-1005) +#define MP_EXCEPTION_HAS_BEEN_SET (-1006) + +PyObject *mp_SetError(PyObject *Type, int num); + +/* + * Externs - not all will really exist on all platforms + */ + +extern PyObject *pickle_dumps; +extern PyObject *pickle_loads; +extern PyObject *pickle_protocol; +extern PyObject *BufferTooShort; +extern PyTypeObject SemLockType; +extern PyTypeObject ConnectionType; +extern PyTypeObject PipeConnectionType; +extern HANDLE sigint_event; + +/* + * Py3k compatibility + */ + +#if PY_VERSION_HEX >= 0x03000000 +# define PICKLE_MODULE "pickle" +# define FROM_FORMAT PyUnicode_FromFormat +# define PyInt_FromLong PyLong_FromLong +# define PyInt_FromSsize_t PyLong_FromSsize_t +#else +# define PICKLE_MODULE "cPickle" +# define FROM_FORMAT PyString_FromFormat +#endif + +#ifndef PyVarObject_HEAD_INIT +# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + +#ifndef Py_TPFLAGS_HAVE_WEAKREFS +# define Py_TPFLAGS_HAVE_WEAKREFS 0 +#endif + +/* + * Connection definition + */ + +#define CONNECTION_BUFFER_SIZE 1024 + +typedef struct { + PyObject_HEAD + HANDLE handle; + int flags; + PyObject *weakreflist; + char buffer[CONNECTION_BUFFER_SIZE]; +} ConnectionObject; + +/* + * Miscellaneous + */ + +#define MAX_MESSAGE_LENGTH 0x7fffffff + +#ifndef MIN +# define MIN(x, y) ((x) < (y) ? x : y) +# define MAX(x, y) ((x) > (y) ? x : y) +#endif + +#endif /* MULTIPROCESSING_H */ Added: python/trunk/Modules/_multiprocessing/pipe_connection.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/pipe_connection.c Wed Jun 11 04:40:25 2008 @@ -0,0 +1,136 @@ +/* + * A type which wraps a pipe handle in message oriented mode + * + * pipe_connection.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +#define CLOSE(h) CloseHandle(h) + +/* + * Send string to the pipe; assumes in message oriented mode + */ + +static Py_ssize_t +conn_send_string(ConnectionObject *conn, char *string, size_t length) +{ + DWORD amount_written; + + return WriteFile(conn->handle, string, length, &amount_written, NULL) + ? MP_SUCCESS : MP_STANDARD_ERROR; +} + +/* + * Attempts to read into buffer, or if buffer too small into *newbuffer. + * + * Returns number of bytes read. Assumes in message oriented mode. + */ + +static Py_ssize_t +conn_recv_string(ConnectionObject *conn, char *buffer, + size_t buflength, char **newbuffer, size_t maxlength) +{ + DWORD left, length, full_length, err; + + *newbuffer = NULL; + + if (ReadFile(conn->handle, buffer, MIN(buflength, maxlength), + &length, NULL)) + return length; + + err = GetLastError(); + if (err != ERROR_MORE_DATA) { + if (err == ERROR_BROKEN_PIPE) + return MP_END_OF_FILE; + return MP_STANDARD_ERROR; + } + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, NULL, &left)) + return MP_STANDARD_ERROR; + + full_length = length + left; + if (full_length > maxlength) + return MP_BAD_MESSAGE_LENGTH; + + *newbuffer = PyMem_Malloc(full_length); + if (*newbuffer == NULL) + return MP_MEMORY_ERROR; + + memcpy(*newbuffer, buffer, length); + + if (ReadFile(conn->handle, *newbuffer+length, left, &length, NULL)) { + assert(length == left); + return full_length; + } else { + PyMem_Free(*newbuffer); + return MP_STANDARD_ERROR; + } +} + +/* + * Check whether any data is available for reading + */ + +#define conn_poll(conn, timeout) conn_poll_save(conn, timeout, _save) + +static int +conn_poll_save(ConnectionObject *conn, double timeout, PyThreadState *_save) +{ + DWORD bytes, deadline, delay; + int difference, res; + BOOL block = FALSE; + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + + if (timeout == 0.0) + return bytes > 0; + + if (timeout < 0.0) + block = TRUE; + else + /* XXX does not check for overflow */ + deadline = GetTickCount() + (DWORD)(1000 * timeout + 0.5); + + Sleep(0); + + for (delay = 1 ; ; delay += 1) { + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + else if (bytes > 0) + return TRUE; + + if (!block) { + difference = deadline - GetTickCount(); + if (difference < 0) + return FALSE; + if ((int)delay > difference) + delay = difference; + } + + if (delay > 20) + delay = 20; + + Sleep(delay); + + /* check for signals */ + Py_BLOCK_THREADS + res = PyErr_CheckSignals(); + Py_UNBLOCK_THREADS + + if (res) + return MP_EXCEPTION_HAS_BEEN_SET; + } +} + +/* + * "connection.h" defines the PipeConnection type using the definitions above + */ + +#define CONNECTION_NAME "PipeConnection" +#define CONNECTION_TYPE PipeConnectionType + +#include "connection.h" Added: python/trunk/Modules/_multiprocessing/semaphore.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/semaphore.c Wed Jun 11 04:40:25 2008 @@ -0,0 +1,625 @@ +/* + * A type which wraps a semaphore + * + * semaphore.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +enum { RECURSIVE_MUTEX, SEMAPHORE }; + +typedef struct { + PyObject_HEAD + SEM_HANDLE handle; + long last_tid; + int count; + int maxvalue; + int kind; +} SemLockObject; + +#define ISMINE(o) (o->count > 0 && PyThread_get_thread_ident() == o->last_tid) + + +#ifdef MS_WINDOWS + +/* + * Windows definitions + */ + +#define SEM_FAILED NULL + +#define SEM_CLEAR_ERROR() SetLastError(0) +#define SEM_GET_LAST_ERROR() GetLastError() +#define SEM_CREATE(name, val, max) CreateSemaphore(NULL, val, max, NULL) +#define SEM_CLOSE(sem) (CloseHandle(sem) ? 0 : -1) +#define SEM_GETVALUE(sem, pval) _GetSemaphoreValue(sem, pval) +#define SEM_UNLINK(name) 0 + +static int +_GetSemaphoreValue(HANDLE handle, long *value) +{ + long previous; + + switch (WaitForSingleObject(handle, 0)) { + case WAIT_OBJECT_0: + if (!ReleaseSemaphore(handle, 1, &previous)) + return MP_STANDARD_ERROR; + *value = previous + 1; + return 0; + case WAIT_TIMEOUT: + *value = 0; + return 0; + default: + return MP_STANDARD_ERROR; + } +} + +static PyObject * +semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) +{ + int blocking = 1; + double timeout; + PyObject *timeout_obj = Py_None; + DWORD res, full_msecs, msecs, start, ticks; + + static char *kwlist[] = {"block", "timeout", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist, + &blocking, &timeout_obj)) + return NULL; + + /* calculate timeout */ + if (!blocking) { + full_msecs = 0; + } else if (timeout_obj == Py_None) { + full_msecs = INFINITE; + } else { + timeout = PyFloat_AsDouble(timeout_obj); + if (PyErr_Occurred()) + return NULL; + timeout *= 1000.0; /* convert to millisecs */ + if (timeout < 0.0) { + timeout = 0.0; + } else if (timeout >= 0.5 * INFINITE) { /* 25 days */ + PyErr_SetString(PyExc_OverflowError, + "timeout is too large"); + return NULL; + } + full_msecs = (DWORD)(timeout + 0.5); + } + + /* check whether we already own the lock */ + if (self->kind == RECURSIVE_MUTEX && ISMINE(self)) { + ++self->count; + Py_RETURN_TRUE; + } + + /* check whether we can acquire without blocking */ + if (WaitForSingleObject(self->handle, 0) == WAIT_OBJECT_0) { + self->last_tid = GetCurrentThreadId(); + ++self->count; + Py_RETURN_TRUE; + } + + msecs = full_msecs; + start = GetTickCount(); + + for ( ; ; ) { + HANDLE handles[2] = {self->handle, sigint_event}; + + /* do the wait */ + Py_BEGIN_ALLOW_THREADS + ResetEvent(sigint_event); + res = WaitForMultipleObjects(2, handles, FALSE, msecs); + Py_END_ALLOW_THREADS + + /* handle result */ + if (res != WAIT_OBJECT_0 + 1) + break; + + /* got SIGINT so give signal handler a chance to run */ + Sleep(1); + + /* if this is main thread let KeyboardInterrupt be raised */ + if (PyErr_CheckSignals()) + return NULL; + + /* recalculate timeout */ + if (msecs != INFINITE) { + ticks = GetTickCount(); + if ((DWORD)(ticks - start) >= full_msecs) + Py_RETURN_FALSE; + msecs = full_msecs - (ticks - start); + } + } + + /* handle result */ + switch (res) { + case WAIT_TIMEOUT: + Py_RETURN_FALSE; + case WAIT_OBJECT_0: + self->last_tid = GetCurrentThreadId(); + ++self->count; + Py_RETURN_TRUE; + case WAIT_FAILED: + return PyErr_SetFromWindowsErr(0); + default: + PyErr_Format(PyExc_RuntimeError, "WaitForSingleObject() or " + "WaitForMultipleObjects() gave unrecognized " + "value %d", res); + return NULL; + } +} + +static PyObject * +semlock_release(SemLockObject *self, PyObject *args) +{ + if (self->kind == RECURSIVE_MUTEX) { + if (!ISMINE(self)) { + PyErr_SetString(PyExc_AssertionError, "attempt to " + "release recursive lock not owned " + "by thread"); + return NULL; + } + if (self->count > 1) { + --self->count; + Py_RETURN_NONE; + } + assert(self->count == 1); + } + + if (!ReleaseSemaphore(self->handle, 1, NULL)) { + if (GetLastError() == ERROR_TOO_MANY_POSTS) { + PyErr_SetString(PyExc_ValueError, "semaphore or lock " + "released too many times"); + return NULL; + } else { + return PyErr_SetFromWindowsErr(0); + } + } + + --self->count; + Py_RETURN_NONE; +} + +#else /* !MS_WINDOWS */ + +/* + * Unix definitions + */ + +#define SEM_CLEAR_ERROR() +#define SEM_GET_LAST_ERROR() 0 +#define SEM_CREATE(name, val, max) sem_open(name, O_CREAT | O_EXCL, 0600, val) +#define SEM_CLOSE(sem) sem_close(sem) +#define SEM_GETVALUE(sem, pval) sem_getvalue(sem, pval) +#define SEM_UNLINK(name) sem_unlink(name) + +#if HAVE_BROKEN_SEM_UNLINK +# define sem_unlink(name) 0 +#endif + +#if !HAVE_SEM_TIMEDWAIT +# define sem_timedwait(sem,deadline) sem_timedwait_save(sem,deadline,_save) + +int +sem_timedwait_save(sem_t *sem, struct timespec *deadline, PyThreadState *_save) +{ + int res; + unsigned long delay, difference; + struct timeval now, tvdeadline, tvdelay; + + errno = 0; + tvdeadline.tv_sec = deadline->tv_sec; + tvdeadline.tv_usec = deadline->tv_nsec / 1000; + + for (delay = 0 ; ; delay += 1000) { + /* poll */ + if (sem_trywait(sem) == 0) + return 0; + else if (errno != EAGAIN) + return MP_STANDARD_ERROR; + + /* get current time */ + if (gettimeofday(&now, NULL) < 0) + return MP_STANDARD_ERROR; + + /* check for timeout */ + if (tvdeadline.tv_sec < now.tv_sec || + (tvdeadline.tv_sec == now.tv_sec && + tvdeadline.tv_usec <= now.tv_usec)) { + errno = ETIMEDOUT; + return MP_STANDARD_ERROR; + } + + /* calculate how much time is left */ + difference = (tvdeadline.tv_sec - now.tv_sec) * 1000000 + + (tvdeadline.tv_usec - now.tv_usec); + + /* check delay not too long -- maximum is 20 msecs */ + if (delay > 20000) + delay = 20000; + if (delay > difference) + delay = difference; + + /* sleep */ + tvdelay.tv_sec = delay / 1000000; + tvdelay.tv_usec = delay % 1000000; + if (select(0, NULL, NULL, NULL, &tvdelay) < 0) + return MP_STANDARD_ERROR; + + /* check for signals */ + Py_BLOCK_THREADS + res = PyErr_CheckSignals(); + Py_UNBLOCK_THREADS + + if (res) { + errno = EINTR; + return MP_EXCEPTION_HAS_BEEN_SET; + } + } +} + +#endif /* !HAVE_SEM_TIMEDWAIT */ + +static PyObject * +semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) +{ + int blocking = 1, res; + double timeout; + PyObject *timeout_obj = Py_None; + struct timespec deadline = {0}; + struct timeval now; + long sec, nsec; + + static char *kwlist[] = {"block", "timeout", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist, + &blocking, &timeout_obj)) + return NULL; + + if (self->kind == RECURSIVE_MUTEX && ISMINE(self)) { + ++self->count; + Py_RETURN_TRUE; + } + + if (timeout_obj != Py_None) { + timeout = PyFloat_AsDouble(timeout_obj); + if (PyErr_Occurred()) + return NULL; + if (timeout < 0.0) + timeout = 0.0; + + if (gettimeofday(&now, NULL) < 0) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } + sec = (long) timeout; + nsec = (long) (1e9 * (timeout - sec) + 0.5); + deadline.tv_sec = now.tv_sec + sec; + deadline.tv_nsec = now.tv_usec * 1000 + nsec; + deadline.tv_sec += (deadline.tv_nsec / 1000000000); + deadline.tv_nsec %= 1000000000; + } + + do { + Py_BEGIN_ALLOW_THREADS + if (blocking && timeout_obj == Py_None) + res = sem_wait(self->handle); + else if (!blocking) + res = sem_trywait(self->handle); + else + res = sem_timedwait(self->handle, &deadline); + Py_END_ALLOW_THREADS + if (res == MP_EXCEPTION_HAS_BEEN_SET) + break; + } while (res < 0 && errno == EINTR && !PyErr_CheckSignals()); + + if (res < 0) { + if (errno == EAGAIN || errno == ETIMEDOUT) + Py_RETURN_FALSE; + else if (errno == EINTR) + return NULL; + else + return PyErr_SetFromErrno(PyExc_OSError); + } + + ++self->count; + self->last_tid = PyThread_get_thread_ident(); + + Py_RETURN_TRUE; +} + +static PyObject * +semlock_release(SemLockObject *self, PyObject *args) +{ + if (self->kind == RECURSIVE_MUTEX) { + if (!ISMINE(self)) { + PyErr_SetString(PyExc_AssertionError, "attempt to " + "release recursive lock not owned " + "by thread"); + return NULL; + } + if (self->count > 1) { + --self->count; + Py_RETURN_NONE; + } + assert(self->count == 1); + } else { +#if HAVE_BROKEN_SEM_GETVALUE + /* We will only check properly the maxvalue == 1 case */ + if (self->maxvalue == 1) { + /* make sure that already locked */ + if (sem_trywait(self->handle) < 0) { + if (errno != EAGAIN) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } + /* it is already locked as expected */ + } else { + /* it was not locked so undo wait and raise */ + if (sem_post(self->handle) < 0) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } + PyErr_SetString(PyExc_ValueError, "semaphore " + "or lock released too many " + "times"); + return NULL; + } + } +#else + int sval; + + /* This check is not an absolute guarantee that the semaphore + does not rise above maxvalue. */ + if (sem_getvalue(self->handle, &sval) < 0) { + return PyErr_SetFromErrno(PyExc_OSError); + } else if (sval >= self->maxvalue) { + PyErr_SetString(PyExc_ValueError, "semaphore or lock " + "released too many times"); + return NULL; + } +#endif + } + + if (sem_post(self->handle) < 0) + return PyErr_SetFromErrno(PyExc_OSError); + + --self->count; + Py_RETURN_NONE; +} + +#endif /* !MS_WINDOWS */ + +/* + * All platforms + */ + +static PyObject * +newsemlockobject(PyTypeObject *type, SEM_HANDLE handle, int kind, int maxvalue) +{ + SemLockObject *self; + + self = PyObject_New(SemLockObject, type); + if (!self) + return NULL; + self->handle = handle; + self->kind = kind; + self->count = 0; + self->last_tid = 0; + self->maxvalue = maxvalue; + return (PyObject*)self; +} + +static PyObject * +semlock_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + char buffer[256]; + SEM_HANDLE handle = SEM_FAILED; + int kind, maxvalue, value; + PyObject *result; + static char *kwlist[] = {"kind", "value", "maxvalue", NULL}; + static int counter = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwlist, + &kind, &value, &maxvalue)) + return NULL; + + if (kind != RECURSIVE_MUTEX && kind != SEMAPHORE) { + PyErr_SetString(PyExc_ValueError, "unrecognized kind"); + return NULL; + } + + PyOS_snprintf(buffer, sizeof(buffer), "/mp%d-%d", getpid(), counter++); + + SEM_CLEAR_ERROR(); + handle = SEM_CREATE(buffer, value, maxvalue); + /* On Windows we should fail if GetLastError()==ERROR_ALREADY_EXISTS */ + if (handle == SEM_FAILED || SEM_GET_LAST_ERROR() != 0) + goto failure; + + if (SEM_UNLINK(buffer) < 0) + goto failure; + + result = newsemlockobject(type, handle, kind, maxvalue); + if (!result) + goto failure; + + return result; + + failure: + if (handle != SEM_FAILED) + SEM_CLOSE(handle); + mp_SetError(NULL, MP_STANDARD_ERROR); + return NULL; +} + +static PyObject * +semlock_rebuild(PyTypeObject *type, PyObject *args) +{ + SEM_HANDLE handle; + int kind, maxvalue; + + if (!PyArg_ParseTuple(args, F_SEM_HANDLE "ii", + &handle, &kind, &maxvalue)) + return NULL; + + return newsemlockobject(type, handle, kind, maxvalue); +} + +static void +semlock_dealloc(SemLockObject* self) +{ + if (self->handle != SEM_FAILED) + SEM_CLOSE(self->handle); + PyObject_Del(self); +} + +static PyObject * +semlock_count(SemLockObject *self) +{ + return PyInt_FromLong((long)self->count); +} + +static PyObject * +semlock_ismine(SemLockObject *self) +{ + /* only makes sense for a lock */ + return PyBool_FromLong(ISMINE(self)); +} + +static PyObject * +semlock_getvalue(SemLockObject *self) +{ +#if HAVE_BROKEN_SEM_GETVALUE + PyErr_SetNone(PyExc_NotImplementedError); + return NULL; +#else + int sval; + if (SEM_GETVALUE(self->handle, &sval) < 0) + return mp_SetError(NULL, MP_STANDARD_ERROR); + /* some posix implementations use negative numbers to indicate + the number of waiting threads */ + if (sval < 0) + sval = 0; + return PyInt_FromLong((long)sval); +#endif +} + +static PyObject * +semlock_iszero(SemLockObject *self) +{ + int sval; +#if HAVE_BROKEN_SEM_GETVALUE + if (sem_trywait(self->handle) < 0) { + if (errno == EAGAIN) + Py_RETURN_TRUE; + return mp_SetError(NULL, MP_STANDARD_ERROR); + } else { + if (sem_post(self->handle) < 0) + return mp_SetError(NULL, MP_STANDARD_ERROR); + Py_RETURN_FALSE; + } +#else + if (SEM_GETVALUE(self->handle, &sval) < 0) + return mp_SetError(NULL, MP_STANDARD_ERROR); + return PyBool_FromLong((long)sval == 0); +#endif +} + +static PyObject * +semlock_afterfork(SemLockObject *self) +{ + self->count = 0; + Py_RETURN_NONE; +} + +/* + * Semaphore methods + */ + +static PyMethodDef semlock_methods[] = { + {"acquire", (PyCFunction)semlock_acquire, METH_VARARGS | METH_KEYWORDS, + "acquire the semaphore/lock"}, + {"release", (PyCFunction)semlock_release, METH_NOARGS, + "release the semaphore/lock"}, + {"__enter__", (PyCFunction)semlock_acquire, METH_VARARGS, + "enter the semaphore/lock"}, + {"__exit__", (PyCFunction)semlock_release, METH_VARARGS, + "exit the semaphore/lock"}, + {"_count", (PyCFunction)semlock_count, METH_NOARGS, + "num of `acquire()`s minus num of `release()`s for this process"}, + {"_is_mine", (PyCFunction)semlock_ismine, METH_NOARGS, + "whether the lock is owned by this thread"}, + {"_get_value", (PyCFunction)semlock_getvalue, METH_NOARGS, + "get the value of the semaphore"}, + {"_is_zero", (PyCFunction)semlock_iszero, METH_NOARGS, + "returns whether semaphore has value zero"}, + {"_rebuild", (PyCFunction)semlock_rebuild, METH_VARARGS | METH_CLASS, + ""}, + {"_after_fork", (PyCFunction)semlock_afterfork, METH_NOARGS, + "rezero the net acquisition count after fork()"}, + {NULL} +}; + +/* + * Member table + */ + +static PyMemberDef semlock_members[] = { + {"handle", T_SEM_HANDLE, offsetof(SemLockObject, handle), READONLY, + ""}, + {"kind", T_INT, offsetof(SemLockObject, kind), READONLY, + ""}, + {"maxvalue", T_INT, offsetof(SemLockObject, maxvalue), READONLY, + ""}, + {NULL} +}; + +/* + * Semaphore type + */ + +PyTypeObject SemLockType = { + PyVarObject_HEAD_INIT(NULL, 0) + /* tp_name */ "_multiprocessing.SemLock", + /* tp_basicsize */ sizeof(SemLockObject), + /* tp_itemsize */ 0, + /* tp_dealloc */ (destructor)semlock_dealloc, + /* 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 */ 0, + /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + /* tp_doc */ "Semaphore/Mutex type", + /* tp_traverse */ 0, + /* tp_clear */ 0, + /* tp_richcompare */ 0, + /* tp_weaklistoffset */ 0, + /* tp_iter */ 0, + /* tp_iternext */ 0, + /* tp_methods */ semlock_methods, + /* tp_members */ semlock_members, + /* 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 */ semlock_new, +}; Added: python/trunk/Modules/_multiprocessing/socket_connection.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/socket_connection.c Wed Jun 11 04:40:25 2008 @@ -0,0 +1,180 @@ +/* + * A type which wraps a socket + * + * socket_connection.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +#ifdef MS_WINDOWS +# define WRITE(h, buffer, length) send((SOCKET)h, buffer, length, 0) +# define READ(h, buffer, length) recv((SOCKET)h, buffer, length, 0) +# define CLOSE(h) closesocket((SOCKET)h) +#else +# define WRITE(h, buffer, length) write(h, buffer, length) +# define READ(h, buffer, length) read(h, buffer, length) +# define CLOSE(h) close(h) +#endif + +/* + * Send string to file descriptor + */ + +static Py_ssize_t +_conn_sendall(HANDLE h, char *string, size_t length) +{ + char *p = string; + Py_ssize_t res; + + while (length > 0) { + res = WRITE(h, p, length); + if (res < 0) + return MP_SOCKET_ERROR; + length -= res; + p += res; + } + + return MP_SUCCESS; +} + +/* + * Receive string of exact length from file descriptor + */ + +static Py_ssize_t +_conn_recvall(HANDLE h, char *buffer, size_t length) +{ + size_t remaining = length; + Py_ssize_t temp; + char *p = buffer; + + while (remaining > 0) { + temp = READ(h, p, remaining); + if (temp <= 0) { + if (temp == 0) + return remaining == length ? + MP_END_OF_FILE : MP_EARLY_END_OF_FILE; + else + return temp; + } + remaining -= temp; + p += temp; + } + + return MP_SUCCESS; +} + +/* + * Send a string prepended by the string length in network byte order + */ + +static Py_ssize_t +conn_send_string(ConnectionObject *conn, char *string, size_t length) +{ + /* The "header" of the message is a 32 bit unsigned number (in + network order) which specifies the length of the "body". If + the message is shorter than about 16kb then it is quicker to + combine the "header" and the "body" of the message and send + them at once. */ + if (length < (16*1024)) { + char *message; + int res; + + message = PyMem_Malloc(length+4); + if (message == NULL) + return MP_MEMORY_ERROR; + + *(UINT32*)message = htonl((UINT32)length); + memcpy(message+4, string, length); + res = _conn_sendall(conn->handle, message, length+4); + PyMem_Free(message); + return res; + } else { + UINT32 lenbuff; + + if (length > MAX_MESSAGE_LENGTH) + return MP_BAD_MESSAGE_LENGTH; + + lenbuff = htonl((UINT32)length); + return _conn_sendall(conn->handle, (char*)&lenbuff, 4) || + _conn_sendall(conn->handle, string, length); + } +} + +/* + * Attempts to read into buffer, or failing that into *newbuffer + * + * Returns number of bytes read. + */ + +static Py_ssize_t +conn_recv_string(ConnectionObject *conn, char *buffer, + size_t buflength, char **newbuffer, size_t maxlength) +{ + int res; + UINT32 ulength; + + *newbuffer = NULL; + + res = _conn_recvall(conn->handle, (char*)&ulength, 4); + if (res < 0) + return res; + + ulength = ntohl(ulength); + if (ulength > maxlength) + return MP_BAD_MESSAGE_LENGTH; + + if (ulength <= buflength) { + res = _conn_recvall(conn->handle, buffer, (size_t)ulength); + return res < 0 ? res : ulength; + } else { + *newbuffer = PyMem_Malloc((size_t)ulength); + if (*newbuffer == NULL) + return MP_MEMORY_ERROR; + res = _conn_recvall(conn->handle, *newbuffer, (size_t)ulength); + return res < 0 ? (Py_ssize_t)res : (Py_ssize_t)ulength; + } +} + +/* + * Check whether any data is available for reading -- neg timeout blocks + */ + +static int +conn_poll(ConnectionObject *conn, double timeout) +{ + int res; + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET((SOCKET)conn->handle, &rfds); + + if (timeout < 0.0) { + res = select((int)conn->handle+1, &rfds, NULL, NULL, NULL); + } else { + struct timeval tv; + tv.tv_sec = (long)timeout; + tv.tv_usec = (long)((timeout - tv.tv_sec) * 1e6 + 0.5); + res = select((int)conn->handle+1, &rfds, NULL, NULL, &tv); + } + + if (res < 0) { + return MP_SOCKET_ERROR; + } else if (FD_ISSET(conn->handle, &rfds)) { + return TRUE; + } else { + assert(res == 0); + return FALSE; + } +} + +/* + * "connection.h" defines the Connection type using defs above + */ + +#define CONNECTION_NAME "Connection" +#define CONNECTION_TYPE ConnectionType + +#include "connection.h" Added: python/trunk/Modules/_multiprocessing/win32_functions.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_multiprocessing/win32_functions.c Wed Jun 11 04:40:25 2008 @@ -0,0 +1,260 @@ +/* + * Win32 functions used by multiprocessing package + * + * win32_functions.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + + +#define WIN32_FUNCTION(func) \ + {#func, (PyCFunction)win32_ ## func, METH_VARARGS | METH_STATIC, ""} + +#define WIN32_CONSTANT(fmt, con) \ + PyDict_SetItemString(Win32Type.tp_dict, #con, Py_BuildValue(fmt, con)) + + +static PyObject * +win32_CloseHandle(PyObject *self, PyObject *args) +{ + HANDLE hObject; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE, &hObject)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = CloseHandle(hObject); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_ConnectNamedPipe(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + LPOVERLAPPED lpOverlapped; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE F_POINTER, + &hNamedPipe, &lpOverlapped)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = ConnectNamedPipe(hNamedPipe, lpOverlapped); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_CreateFile(PyObject *self, PyObject *args) +{ + LPCTSTR lpFileName; + DWORD dwDesiredAccess; + DWORD dwShareMode; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + DWORD dwCreationDisposition; + DWORD dwFlagsAndAttributes; + HANDLE hTemplateFile; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_POINTER + F_DWORD F_DWORD F_HANDLE, + &lpFileName, &dwDesiredAccess, &dwShareMode, + &lpSecurityAttributes, &dwCreationDisposition, + &dwFlagsAndAttributes, &hTemplateFile)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateFile(lpFileName, dwDesiredAccess, + dwShareMode, lpSecurityAttributes, + dwCreationDisposition, + dwFlagsAndAttributes, hTemplateFile); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_CreateNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpName; + DWORD dwOpenMode; + DWORD dwPipeMode; + DWORD nMaxInstances; + DWORD nOutBufferSize; + DWORD nInBufferSize; + DWORD nDefaultTimeOut; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_DWORD + F_DWORD F_DWORD F_DWORD F_POINTER, + &lpName, &dwOpenMode, &dwPipeMode, + &nMaxInstances, &nOutBufferSize, + &nInBufferSize, &nDefaultTimeOut, + &lpSecurityAttributes)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateNamedPipe(lpName, dwOpenMode, dwPipeMode, + nMaxInstances, nOutBufferSize, + nInBufferSize, nDefaultTimeOut, + lpSecurityAttributes); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_ExitProcess(PyObject *self, PyObject *args) +{ + UINT uExitCode; + + if (!PyArg_ParseTuple(args, "I", &uExitCode)) + return NULL; + + ExitProcess(uExitCode); + + return NULL; +} + +static PyObject * +win32_GetLastError(PyObject *self, PyObject *args) +{ + return Py_BuildValue(F_DWORD, GetLastError()); +} + +static PyObject * +win32_OpenProcess(PyObject *self, PyObject *args) +{ + DWORD dwDesiredAccess; + BOOL bInheritHandle; + DWORD dwProcessId; + HANDLE handle; + + if (!PyArg_ParseTuple(args, F_DWORD "i" F_DWORD, + &dwDesiredAccess, &bInheritHandle, &dwProcessId)) + return NULL; + + handle = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId); + if (handle == NULL) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_SetNamedPipeHandleState(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + PyObject *oArgs[3]; + DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL}; + int i; + + if (!PyArg_ParseTuple(args, F_HANDLE "OOO", + &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2])) + return NULL; + + PyErr_Clear(); + + for (i = 0 ; i < 3 ; i++) { + if (oArgs[i] != Py_None) { + dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]); + if (PyErr_Occurred()) + return NULL; + pArgs[i] = &dwArgs[i]; + } + } + + if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2])) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_WaitNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpNamedPipeName; + DWORD nTimeOut; + BOOL success; + + if (!PyArg_ParseTuple(args, "s" F_DWORD, &lpNamedPipeName, &nTimeOut)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = WaitNamedPipe(lpNamedPipeName, nTimeOut); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyMethodDef win32_methods[] = { + WIN32_FUNCTION(CloseHandle), + WIN32_FUNCTION(GetLastError), + WIN32_FUNCTION(OpenProcess), + WIN32_FUNCTION(ExitProcess), + WIN32_FUNCTION(ConnectNamedPipe), + WIN32_FUNCTION(CreateFile), + WIN32_FUNCTION(CreateNamedPipe), + WIN32_FUNCTION(SetNamedPipeHandleState), + WIN32_FUNCTION(WaitNamedPipe), + {NULL} +}; + + +PyTypeObject Win32Type = { + PyVarObject_HEAD_INIT(NULL, 0) +}; + + +PyObject * +create_win32_namespace(void) +{ + Win32Type.tp_name = "_multiprocessing.win32"; + Win32Type.tp_methods = win32_methods; + if (PyType_Ready(&Win32Type) < 0) + return NULL; + Py_INCREF(&Win32Type); + + WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); + WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT); + WIN32_CONSTANT(F_DWORD, GENERIC_READ); + WIN32_CONSTANT(F_DWORD, GENERIC_WRITE); + WIN32_CONSTANT(F_DWORD, INFINITE); + WIN32_CONSTANT(F_DWORD, NMPWAIT_WAIT_FOREVER); + WIN32_CONSTANT(F_DWORD, OPEN_EXISTING); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_DUPLEX); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_INBOUND); + WIN32_CONSTANT(F_DWORD, PIPE_READMODE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_TYPE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_UNLIMITED_INSTANCES); + WIN32_CONSTANT(F_DWORD, PIPE_WAIT); + WIN32_CONSTANT(F_DWORD, PROCESS_ALL_ACCESS); + + WIN32_CONSTANT("i", NULL); + + return (PyObject*)&Win32Type; +} Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Wed Jun 11 04:40:25 2008 @@ -1236,6 +1236,58 @@ # Thomas Heller's _ctypes module self.detect_ctypes(inc_dirs, lib_dirs) + # Richard Oudkerk's multiprocessing module + if platform == 'win32': # Windows + macros = dict() + libraries = ['ws2_32'] + + elif platform == 'darwin': # Mac OSX + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + HAVE_BROKEN_SEM_GETVALUE=1 + ) + libraries = [] + + elif platform == 'cygwin': # Cygwin + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=1, + HAVE_FD_TRANSFER=0, + HAVE_BROKEN_SEM_UNLINK=1 + ) + libraries = [] + else: # Linux and other unices + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=1, + HAVE_FD_TRANSFER=1 + ) + libraries = ['rt'] + + if platform == 'win32': + multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', + '_multiprocessing/semaphore.c', + '_multiprocessing/pipe_connection.c', + '_multiprocessing/socket_connection.c', + '_multiprocessing/win32_functions.c' + ] + + else: + multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', + '_multiprocessing/socket_connection.c' + ] + + if macros.get('HAVE_SEM_OPEN', False): + multiprocessing_srcs.append('_multiprocessing/semaphore.c') + + exts.append ( Extension('_multiprocessing', multiprocessing_srcs, + define_macros=macros.items(), + include_dirs=["Modules/_multiprocessing"])) + # End multiprocessing + + # Platform-specific libraries if platform == 'linux2': # Linux-specific modules From buildbot at python.org Wed Jun 11 04:53:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 02:53:03 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080611025303.3FB841E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1562 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 05:01:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 03:01:13 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20080611030113.C9C8C1E4014@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/745 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 05:18:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 03:18:41 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080611031841.44B1C1E400E@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/3802 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 504, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 459, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 289, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/__init__.py", line 224, in Pool return Pool(processes, initializer, initargs) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 05:24:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 03:24:03 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080611032403.AA9071E4003@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/1003 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/__init__.py", line 224, in Pool return Pool(processes, initializer, initargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/pool.py", line 104, in __init__ w.start() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/process.py", line 104, in start _cleanup() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/process.py", line 58, in _cleanup if p._popen.poll() is not None: File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/util.py", line 248, in _run_finalizers finalizer() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/util.py", line 187, in __call__ res = self._callback(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/managers.py", line 589, in _finalize_manager if process.is_alive(): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/process.py", line 137, in is_alive self._popen.poll() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/util.py", line 275, in _exit_function for p in active_children(): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/process.py", line 48, in active_children _cleanup() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/process.py", line 58, in _cleanup if p._popen.poll() is not None: File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 05:40:10 2008 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 11 Jun 2008 05:40:10 +0200 (CEST) Subject: [Python-checkins] r64105 - in python/trunk/Include: bytesobject.h stringobject.h Message-ID: <20080611034010.EF5DF1E4003@bag.python.org> Author: gregory.p.smith Date: Wed Jun 11 05:40:10 2008 New Revision: 64105 Log: swap stringobject.h and bytesobject.h contents to make sense. PyString in stringobject and PyBytes defines in bytesobject. Modified: python/trunk/Include/bytesobject.h python/trunk/Include/stringobject.h Modified: python/trunk/Include/bytesobject.h ============================================================================== --- python/trunk/Include/bytesobject.h (original) +++ python/trunk/Include/bytesobject.h Wed Jun 11 05:40:10 2008 @@ -1,200 +1,33 @@ +#define PyBytesObject PyStringObject +#define PyBytes_Type PyString_Type -/* String (Bytes) object interface */ - -#ifndef Py_BYTESOBJECT_H -#define Py_BYTESOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* -Type PyStringObject represents a character string. An extra zero byte is -reserved at the end to ensure it is zero-terminated, but a size is -present so strings with null bytes in them can be represented. This -is an immutable object type. - -There are functions to create new string objects, to test -an object for string-ness, and to get the -string value. The latter function returns a null pointer -if the object is not of the proper type. -There is a variant that takes an explicit size as well as a -variant that assumes a zero-terminated string. Note that none of the -functions should be applied to nil objects. -*/ - -/* Caching the hash (ob_shash) saves recalculation of a string's hash value. - Interning strings (ob_sstate) tries to ensure that only one string - object with a given value exists, so equality tests can be one pointer - comparison. This is generally restricted to strings that "look like" - Python identifiers, although the intern() builtin can be used to force - interning of any string. - Together, these sped the interpreter by up to 20%. */ - -typedef struct { - PyObject_VAR_HEAD - long ob_shash; - int ob_sstate; - char ob_sval[1]; - - /* Invariants: - * ob_sval contains space for 'ob_size+1' elements. - * ob_sval[ob_size] == 0. - * ob_shash is the hash of the string or -1 if not computed yet. - * ob_sstate != 0 iff the string object is in stringobject.c's - * 'interned' dictionary; in this case the two references - * from 'interned' to this object are *not counted* in ob_refcnt. - */ -} PyStringObject; - -#define SSTATE_NOT_INTERNED 0 -#define SSTATE_INTERNED_MORTAL 1 -#define SSTATE_INTERNED_IMMORTAL 2 - -PyAPI_DATA(PyTypeObject) PyBaseString_Type; -PyAPI_DATA(PyTypeObject) PyString_Type; - -#define PyString_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) - -PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyString_FromString(const char *); -PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) - Py_GCC_ATTRIBUTE((format(printf, 1, 0))); -PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); -PyAPI_FUNC(char *) PyString_AsString(PyObject *); -PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); -PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); -PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); -PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); -PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, - int, char**, int*); -PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, - const char *, Py_ssize_t, - const char *); - -PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); -PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); - -/* Use only if you know it's a string */ -#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) - -/* Macro, trading safety for speed */ -#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) -#define PyString_GET_SIZE(op) Py_SIZE(op) - -/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, - x must be an iterable object. */ -PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); - -/* --- Generic Codecs ----------------------------------------------------- */ - -/* Create an object by decoding the encoded string s of the - given size. */ - -PyAPI_FUNC(PyObject*) PyString_Decode( - const char *s, /* encoded string */ - Py_ssize_t size, /* size of buffer */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a char buffer of the given size and returns a - Python object. */ - -PyAPI_FUNC(PyObject*) PyString_Encode( - const char *s, /* string char buffer */ - Py_ssize_t size, /* number of chars to encode */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsEncodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsDecodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Provides access to the internal data buffer and size of a string - object or the default encoded version of an Unicode object. Passing - NULL as *len parameter will force the string buffer to be - 0-terminated (passing a string with embedded NULL characters will - cause an exception). */ - -PyAPI_FUNC(int) PyString_AsStringAndSize( - register PyObject *obj, /* string or Unicode object */ - register char **s, /* pointer to buffer variable */ - register Py_ssize_t *len /* pointer to length variable or NULL - (only possible for 0-terminated - strings) */ - ); - -/* Using the current locale, insert the thousands grouping - into the string pointed to by buffer. For the argument descriptions, - see Objects/stringlib/localeutil.h */ - -PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, - Py_ssize_t len, - char *plast, - Py_ssize_t buf_size, - Py_ssize_t *count, - int append_zero_char); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BYTESOBJECT_H */ +#define PyBytes_Check PyString_Check +#define PyBytes_CheckExact PyString_CheckExact +#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS + +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_FromString PyString_FromString +#define PyBytes_FromFormatV PyString_FromFormatV +#define PyBytes_FromFormat PyString_FromFormat +#define PyBytes_Size PyString_Size +#define PyBytes_AsString PyString_AsString +#define PyBytes_Repr PyString_Repr +#define PyBytes_Concat PyString_Concat +#define PyBytes_ConcatAndDel PyString_ConcatAndDel +#define _PyBytes_Resize _PyString_Resize +#define _PyBytes_Eq _PyString_Eq +#define PyBytes_Format PyString_Format +#define _PyBytes_FormatLong _PyString_FormatLong +#define PyBytes_DecodeEscape PyString_DecodeEscape +#define _PyBytes_Join _PyString_Join +#define PyBytes_Decode PyString_Decode +#define PyBytes_Encode PyString_Encode +#define PyBytes_AsEncodedObject PyString_AsEncodedObject +#define PyBytes_AsEncodedString PyString_AsEncodedString +#define PyBytes_AsDecodedObject PyString_AsDecodedObject +#define PyBytes_AsDecodedString PyString_AsDecodedString +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping Modified: python/trunk/Include/stringobject.h ============================================================================== --- python/trunk/Include/stringobject.h (original) +++ python/trunk/Include/stringobject.h Wed Jun 11 05:40:10 2008 @@ -1,33 +1,200 @@ -#define PyBytesObject PyStringObject -#define PyBytes_Type PyString_Type -#define PyBytes_Check PyString_Check -#define PyBytes_CheckExact PyString_CheckExact -#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED -#define PyBytes_AS_STRING PyString_AS_STRING -#define PyBytes_GET_SIZE PyString_GET_SIZE -#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS - -#define PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PyBytes_FromString PyString_FromString -#define PyBytes_FromFormatV PyString_FromFormatV -#define PyBytes_FromFormat PyString_FromFormat -#define PyBytes_Size PyString_Size -#define PyBytes_AsString PyString_AsString -#define PyBytes_Repr PyString_Repr -#define PyBytes_Concat PyString_Concat -#define PyBytes_ConcatAndDel PyString_ConcatAndDel -#define _PyBytes_Resize _PyString_Resize -#define _PyBytes_Eq _PyString_Eq -#define PyBytes_Format PyString_Format -#define _PyBytes_FormatLong _PyString_FormatLong -#define PyBytes_DecodeEscape PyString_DecodeEscape -#define _PyBytes_Join _PyString_Join -#define PyBytes_Decode PyString_Decode -#define PyBytes_Encode PyString_Encode -#define PyBytes_AsEncodedObject PyString_AsEncodedObject -#define PyBytes_AsEncodedString PyString_AsEncodedString -#define PyBytes_AsDecodedObject PyString_AsDecodedObject -#define PyBytes_AsDecodedString PyString_AsDecodedString -#define PyBytes_AsStringAndSize PyString_AsStringAndSize -#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping +/* String (str/bytes) object interface */ + +#ifndef Py_STRINGOBJECT_H +#define Py_STRINGOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* +Type PyStringObject represents a character string. An extra zero byte is +reserved at the end to ensure it is zero-terminated, but a size is +present so strings with null bytes in them can be represented. This +is an immutable object type. + +There are functions to create new string objects, to test +an object for string-ness, and to get the +string value. The latter function returns a null pointer +if the object is not of the proper type. +There is a variant that takes an explicit size as well as a +variant that assumes a zero-terminated string. Note that none of the +functions should be applied to nil objects. +*/ + +/* Caching the hash (ob_shash) saves recalculation of a string's hash value. + Interning strings (ob_sstate) tries to ensure that only one string + object with a given value exists, so equality tests can be one pointer + comparison. This is generally restricted to strings that "look like" + Python identifiers, although the intern() builtin can be used to force + interning of any string. + Together, these sped the interpreter by up to 20%. */ + +typedef struct { + PyObject_VAR_HEAD + long ob_shash; + int ob_sstate; + char ob_sval[1]; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the string or -1 if not computed yet. + * ob_sstate != 0 iff the string object is in stringobject.c's + * 'interned' dictionary; in this case the two references + * from 'interned' to this object are *not counted* in ob_refcnt. + */ +} PyStringObject; + +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + +PyAPI_DATA(PyTypeObject) PyBaseString_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; + +#define PyString_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) + +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) + Py_GCC_ATTRIBUTE((format(printf, 1, 0))); +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, + int, char**, int*); +PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, + const char *, Py_ssize_t, + const char *); + +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); +PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); + +/* Use only if you know it's a string */ +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) + +/* Macro, trading safety for speed */ +#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) +#define PyString_GET_SIZE(op) Py_SIZE(op) + +/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, + x must be an iterable object. */ +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create an object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyString_Decode( + const char *s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a char buffer of the given size and returns a + Python object. */ + +PyAPI_FUNC(PyObject*) PyString_Encode( + const char *s, /* string char buffer */ + Py_ssize_t size, /* number of chars to encode */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsEncodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsDecodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Provides access to the internal data buffer and size of a string + object or the default encoded version of an Unicode object. Passing + NULL as *len parameter will force the string buffer to be + 0-terminated (passing a string with embedded NULL characters will + cause an exception). */ + +PyAPI_FUNC(int) PyString_AsStringAndSize( + register PyObject *obj, /* string or Unicode object */ + register char **s, /* pointer to buffer variable */ + register Py_ssize_t *len /* pointer to length variable or NULL + (only possible for 0-terminated + strings) */ + ); + +/* Using the current locale, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ + +PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, + Py_ssize_t len, + char *plast, + Py_ssize_t buf_size, + Py_ssize_t *count, + int append_zero_char); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRINGOBJECT_H */ From buildbot at python.org Wed Jun 11 05:56:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 03:56:35 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian trunk Message-ID: <20080611035635.A99A71E4003@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%20trunk/builds/1052 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/__init__.py", line 224, in Pool return Pool(processes, initializer, initargs) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 06:17:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 04:17:43 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD trunk Message-ID: <20080611041744.079701E4003@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%20trunk/builds/1169 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From guido at python.org Wed Jun 11 06:19:31 2008 From: guido at python.org (Guido van Rossum) Date: Tue, 10 Jun 2008 21:19:31 -0700 Subject: [Python-checkins] r64098 - python/trunk/Lib/numbers.py In-Reply-To: <20080611002529.750451E4003@bag.python.org> References: <20080611002529.750451E4003@bag.python.org> Message-ID: I expect we'll regret this at some point in the future. The section "Implementing the arithmetic operations" in PEP 3141 shows elaborate code for how to write binary operators carefully so as to allow the right operand to override the operation if the left operand inherits the operation from the ABC. The code here defeats that approach -- if the left operand inherits from the ABC (not using virtual inheritance) then it wins, regardless of what the right operand might have preferred. We don't need the full version of that section in the PEP (which worries about operations that are defined for Real and Complex too) but I expect at some point we'll want to put some of the subtlety back in. I'm okay if that happens post beta 1 though. --Guido On Tue, Jun 10, 2008 at 5:25 PM, raymond.hettinger wrote: > Author: raymond.hettinger > Date: Wed Jun 11 02:25:29 2008 > New Revision: 64098 > > Log: > Mini-PEP: Simplifying numbers.py > * Convert binary methods in Integral to mixin methods > * Remove three-arg __pow__ as a required method > * Make __int__ the root method instead of __long__. > > > > Modified: > python/trunk/Lib/numbers.py > > Modified: python/trunk/Lib/numbers.py > ============================================================================== > --- python/trunk/Lib/numbers.py (original) > +++ python/trunk/Lib/numbers.py Wed Jun 11 02:25:29 2008 > @@ -283,87 +283,54 @@ > > > class Integral(Rational): > - """Integral adds a conversion to long and the bit-string operations.""" > + """Integral adds a conversion to int and the bit-string operations.""" > > @abstractmethod > - def __long__(self): > - """long(self)""" > + def __int__(self): > + """int(self)""" > raise NotImplementedError > > def __index__(self): > """index(self)""" > - return long(self) > + return int(self) > > - @abstractmethod > - def __pow__(self, exponent, modulus=None): > - """self ** exponent % modulus, but maybe faster. > - > - Accept the modulus argument if you want to support the > - 3-argument version of pow(). Raise a TypeError if exponent < 0 > - or any argument isn't Integral. Otherwise, just implement the > - 2-argument version described in Complex. > - """ > - raise NotImplementedError > - > - @abstractmethod > def __lshift__(self, other): > - """self << other""" > - raise NotImplementedError > + return int(self) << int(other) > > - @abstractmethod > def __rlshift__(self, other): > - """other << self""" > - raise NotImplementedError > + return int(other) << int(self) > > - @abstractmethod > def __rshift__(self, other): > - """self >> other""" > - raise NotImplementedError > + return int(self) >> int(other) > > - @abstractmethod > def __rrshift__(self, other): > - """other >> self""" > - raise NotImplementedError > + return int(other) >> int(self) > > - @abstractmethod > def __and__(self, other): > - """self & other""" > - raise NotImplementedError > + return int(self) & int(other) > > - @abstractmethod > def __rand__(self, other): > - """other & self""" > - raise NotImplementedError > + return int(other) & int(self) > > - @abstractmethod > def __xor__(self, other): > - """self ^ other""" > - raise NotImplementedError > + return int(self) ^ int(other) > > - @abstractmethod > def __rxor__(self, other): > - """other ^ self""" > - raise NotImplementedError > + return int(other) ^ int(self) > > - @abstractmethod > def __or__(self, other): > - """self | other""" > - raise NotImplementedError > + return int(self) | int(other) > > - @abstractmethod > def __ror__(self, other): > - """other | self""" > - raise NotImplementedError > + return int(other) | int(self) > > - @abstractmethod > def __invert__(self): > - """~self""" > - raise NotImplementedError > + return ~int(self) > > # Concrete implementations of Rational and Real abstract methods. > def __float__(self): > - """float(self) == float(long(self))""" > - return float(long(self)) > + """float(self) == float(int(self))""" > + return float(int(self)) > > @property > def numerator(self): > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From buildbot at python.org Wed Jun 11 06:37:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 04:37:22 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080611043722.71AA01E4003@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/1564 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 BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/__init__.py", line 224, in Pool return Pool(processes, initializer, initargs) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 07:12:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 05:12:38 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080611051238.B47331E4009@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3531 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_timeout test_urllib2net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 08:38:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 06:38:57 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080611063857.D5AF01E4003@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/337 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_smtplib test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 09:10:44 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 09:10:44 +0200 (CEST) Subject: [Python-checkins] r64113 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611071044.13C7D1E4009@bag.python.org> Author: thomas.heller Date: Wed Jun 11 09:10:43 2008 New Revision: 64113 Log: Fix markup. Document the new 'offset' parameter for the 'ctypes.byref' function. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 09:10:43 2008 @@ -1406,10 +1406,9 @@ to request and change the ctypes private copy of the windows error code. -.. versionchanged:: 2.6 - -The `use_errno` and `use_last_error` parameters were added in Python -2.6. +.. versionadded:: 2.6 + The ``use_last_error`` and ``use_errno`` optional parameters + were added. .. data:: RTLD_GLOBAL :noindex: @@ -1572,22 +1571,23 @@ Assign a Python function or another callable to this attribute. The callable will be called with three or more arguments: + .. function:: callable(result, func, arguments) + :noindex: -.. function:: callable(result, func, arguments) - :noindex: - - ``result`` is what the foreign function returns, as specified by the - :attr:`restype` attribute. - - ``func`` is the foreign function object itself, this allows to reuse the same - callable object to check or post process the results of several functions. - - ``arguments`` is a tuple containing the parameters originally passed to the - function call, this allows to specialize the behavior on the arguments used. + ``result`` is what the foreign function returns, as specified + by the :attr:`restype` attribute. - The object that this function returns will be returned from the foreign - function call, but it can also check the result value and raise an exception - if the foreign function call failed. + ``func`` is the foreign function object itself, this allows + to reuse the same callable object to check or post process + the results of several functions. + + ``arguments`` is a tuple containing the parameters originally + passed to the function call, this allows to specialize the + behavior on the arguments used. + + The object that this function returns will be returned from the + foreign function call, but it can also check the result value + and raise an exception if the foreign function call failed. .. exception:: ArgumentError() @@ -1805,12 +1805,22 @@ ctypes type or instance. -.. function:: byref(obj) +.. function:: byref(obj[, offset]) - Returns a light-weight pointer to ``obj``, which must be an instance of a ctypes - type. The returned object can only be used as a foreign function call parameter. - It behaves similar to ``pointer(obj)``, but the construction is a lot faster. + Returns a light-weight pointer to ``obj``, which must be an + instance of a ctypes type. ``offset`` defaults to zero, it must be + an integer which is added to the internal pointer value. + ``byref(obj, offset)`` corresponds to this C code:: + + (((char *)&obj) + offset) + + The returned object can only be used as a foreign function call + parameter. It behaves similar to ``pointer(obj)``, but the + construction is a lot faster. + + .. versionadded:: 2.6 + The ``offset`` optional argument was added. .. function:: cast(obj, type) From python-checkins at python.org Wed Jun 11 09:41:17 2008 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 11 Jun 2008 09:41:17 +0200 (CEST) Subject: [Python-checkins] r64114 - in python/trunk: Include/pymem.h Include/pyport.h Lib/test/test_array.py Lib/test/test_struct.py Misc/NEWS Modules/_csv.c Modules/_struct.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/cPickle.c Modules/cStringIO.c Modules/cjkcodecs/multibytecodec.c Modules/datetimemodule.c Modules/md5.c Modules/stropmodule.c Objects/bufferobject.c Objects/listobject.c Objects/obmalloc.c Parser/node.c Python/asdl.c Python/ast.c Python/bltinmodule.c Python/compile.c Message-ID: <20080611074117.976361E4003@bag.python.org> Author: gregory.p.smith Date: Wed Jun 11 09:41:16 2008 New Revision: 64114 Log: Merge in release25-maint r60793: Added checks for integer overflows, contributed by Google. Some are only available if asserts are left in the code, in cases where they can't be triggered from Python code. Modified: python/trunk/Include/pymem.h python/trunk/Include/pyport.h python/trunk/Lib/test/test_array.py python/trunk/Lib/test/test_struct.py python/trunk/Misc/NEWS python/trunk/Modules/_csv.c python/trunk/Modules/_struct.c python/trunk/Modules/arraymodule.c python/trunk/Modules/audioop.c python/trunk/Modules/binascii.c python/trunk/Modules/cPickle.c python/trunk/Modules/cStringIO.c python/trunk/Modules/cjkcodecs/multibytecodec.c python/trunk/Modules/datetimemodule.c python/trunk/Modules/md5.c python/trunk/Modules/stropmodule.c python/trunk/Objects/bufferobject.c python/trunk/Objects/listobject.c python/trunk/Objects/obmalloc.c python/trunk/Parser/node.c python/trunk/Python/asdl.c python/trunk/Python/ast.c python/trunk/Python/bltinmodule.c python/trunk/Python/compile.c Modified: python/trunk/Include/pymem.h ============================================================================== --- python/trunk/Include/pymem.h (original) +++ python/trunk/Include/pymem.h Wed Jun 11 09:41:16 2008 @@ -85,14 +85,18 @@ */ #define PyMem_New(type, n) \ - ( (type *) PyMem_Malloc((n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) #define PyMem_NEW(type, n) \ - ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) #define PyMem_Resize(p, type, n) \ - ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) ) #define PyMem_RESIZE(p, type, n) \ - ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) ) /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. Modified: python/trunk/Include/pyport.h ============================================================================== --- python/trunk/Include/pyport.h (original) +++ python/trunk/Include/pyport.h Wed Jun 11 09:41:16 2008 @@ -117,6 +117,17 @@ # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif +/* Largest possible value of size_t. + SIZE_MAX is part of C99, so it might be defined on some + platforms. If it is not defined, (size_t)-1 is a portable + definition for C89, due to the way signed->unsigned + conversion is defined. */ +#ifdef SIZE_MAX +#define PY_SIZE_MAX SIZE_MAX +#else +#define PY_SIZE_MAX ((size_t)-1) +#endif + /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ Modified: python/trunk/Lib/test/test_array.py ============================================================================== --- python/trunk/Lib/test/test_array.py (original) +++ python/trunk/Lib/test/test_array.py Wed Jun 11 09:41:16 2008 @@ -1009,6 +1009,23 @@ class DoubleTest(FPTest): typecode = 'd' minitemsize = 8 + + def test_alloc_overflow(self): + a = array.array('d', [-1]*65536) + try: + a *= 65536 + except MemoryError: + pass + else: + self.fail("a *= 2**16 didn't raise MemoryError") + b = array.array('d', [ 2.71828183, 3.14159265, -1]) + try: + b * 1431655766 + except MemoryError: + pass + else: + self.fail("a * 1431655766 didn't raise MemoryError") + tests.append(DoubleTest) def test_main(verbose=None): Modified: python/trunk/Lib/test/test_struct.py ============================================================================== --- python/trunk/Lib/test/test_struct.py (original) +++ python/trunk/Lib/test/test_struct.py Wed Jun 11 09:41:16 2008 @@ -8,6 +8,7 @@ import sys ISBIGENDIAN = sys.byteorder == "big" +IS32BIT = sys.maxint == 0x7fffffff del sys try: @@ -568,6 +569,13 @@ for c in '\x01\x7f\xff\x0f\xf0': self.assertTrue(struct.unpack('>?', c)[0]) + def test_crasher(self): + if IS32BIT: + self.assertRaises(MemoryError, struct.pack, "357913941c", "a") + else: + print "%s test_crasher skipped on 64bit build." + + def test_main(): run_unittest(StructTest) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 09:41:16 2008 @@ -40,6 +40,11 @@ Exception (KeyboardInterrupt, and SystemExit) propagate instead of ignoring them. +- Added checks for integer overflows, contributed by Google. Some are + only available if asserts are left in the code, in cases where they + can't be triggered from Python code. + + Extension Modules ----------------- Modified: python/trunk/Modules/_csv.c ============================================================================== --- python/trunk/Modules/_csv.c (original) +++ python/trunk/Modules/_csv.c Wed Jun 11 09:41:16 2008 @@ -559,6 +559,10 @@ self->field = PyMem_Malloc(self->field_size); } else { + if (self->field_size > INT_MAX / 2) { + PyErr_NoMemory(); + return 0; + } self->field_size *= 2; self->field = PyMem_Realloc(self->field, self->field_size); } @@ -1053,6 +1057,12 @@ static int join_check_rec_size(WriterObj *self, int rec_len) { + + if (rec_len < 0 || rec_len > INT_MAX - MEM_INCR) { + PyErr_NoMemory(); + return 0; + } + if (rec_len > self->rec_size) { if (self->rec_size == 0) { self->rec_size = (rec_len / MEM_INCR + 1) * MEM_INCR; Modified: python/trunk/Modules/_struct.c ============================================================================== --- python/trunk/Modules/_struct.c (original) +++ python/trunk/Modules/_struct.c Wed Jun 11 09:41:16 2008 @@ -1385,6 +1385,12 @@ } } + /* check for overflow */ + if ((len + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) { + PyErr_NoMemory(); + return -1; + } + self->s_size = size; self->s_len = len; codes = PyMem_MALLOC((len + 1) * sizeof(formatcode)); Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Wed Jun 11 09:41:16 2008 @@ -652,6 +652,9 @@ PyErr_BadArgument(); return NULL; } + if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b)) { + return PyErr_NoMemory(); + } size = Py_SIZE(a) + Py_SIZE(b); np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); if (np == NULL) { @@ -674,6 +677,9 @@ Py_ssize_t nbytes; if (n < 0) n = 0; + if ((Py_SIZE(a) != 0) && (n > PY_SSIZE_T_MAX / Py_SIZE(a))) { + return PyErr_NoMemory(); + } size = Py_SIZE(a) * n; np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); if (np == NULL) @@ -818,6 +824,11 @@ "can only extend with array of same kind"); return -1; } + if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) || + ((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { + PyErr_NoMemory(); + return -1; + } size = Py_SIZE(self) + Py_SIZE(b); PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize); if (self->ob_item == NULL) { @@ -859,6 +870,10 @@ if (n < 0) n = 0; items = self->ob_item; + if ((self->ob_descr->itemsize != 0) && + (Py_SIZE(self) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { + return PyErr_NoMemory(); + } size = Py_SIZE(self) * self->ob_descr->itemsize; if (n == 0) { PyMem_FREE(items); @@ -867,6 +882,9 @@ self->allocated = 0; } else { + if (size > PY_SSIZE_T_MAX / n) { + return PyErr_NoMemory(); + } PyMem_Resize(items, char, n * size); if (items == NULL) return PyErr_NoMemory(); @@ -1148,6 +1166,10 @@ Py_INCREF(dict); } if (Py_SIZE(array) > 0) { + if (array->ob_descr->itemsize + > PY_SSIZE_T_MAX / array->ob_size) { + return PyErr_NoMemory(); + } result = Py_BuildValue("O(cs#)O", Py_TYPE(array), array->ob_descr->typecode, @@ -1330,6 +1352,9 @@ if ((*self->ob_descr->setitem)(self, Py_SIZE(self) - n + i, v) != 0) { Py_SIZE(self) -= n; + if (itemsize && (self->ob_size > PY_SSIZE_T_MAX / itemsize)) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, char, Py_SIZE(self) * itemsize); self->ob_item = item; @@ -1389,6 +1414,10 @@ n = n / itemsize; if (n > 0) { char *item = self->ob_item; + if ((n > PY_SSIZE_T_MAX - Py_SIZE(self)) || + ((Py_SIZE(self) + n) > PY_SSIZE_T_MAX / itemsize)) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize); if (item == NULL) { PyErr_NoMemory(); @@ -1414,8 +1443,12 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyString_FromStringAndSize(self->ob_item, + if (self->ob_size <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { + return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); + } else { + return PyErr_NoMemory(); + } } PyDoc_STRVAR(tostring_doc, @@ -1443,6 +1476,9 @@ } if (n > 0) { Py_UNICODE *item = (Py_UNICODE *) self->ob_item; + if (Py_SIZE(self) > PY_SSIZE_T_MAX - n) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, Py_UNICODE, Py_SIZE(self) + n); if (item == NULL) { PyErr_NoMemory(); Modified: python/trunk/Modules/audioop.c ============================================================================== --- python/trunk/Modules/audioop.c (original) +++ python/trunk/Modules/audioop.c Wed Jun 11 09:41:16 2008 @@ -829,7 +829,7 @@ audioop_tostereo(PyObject *self, PyObject *args) { signed char *cp, *ncp; - int len, size, val1, val2, val = 0; + int len, new_len, size, val1, val2, val = 0; double fac1, fac2, fval, maxval; PyObject *rv; int i; @@ -846,7 +846,14 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*2); + new_len = len*2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); @@ -1009,7 +1016,7 @@ { signed char *cp; unsigned char *ncp; - int len, size, size2, val = 0; + int len, new_len, size, size2, val = 0; PyObject *rv; int i, j; @@ -1023,7 +1030,13 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len/size)*size2); + new_len = (len/size)*size2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); @@ -1059,6 +1072,7 @@ int chan, d, *prev_i, *cur_i, cur_o; PyObject *state, *samps, *str, *rv = NULL; int bytes_per_frame; + size_t alloc_size; weightA = 1; weightB = 0; @@ -1101,8 +1115,14 @@ inrate /= d; outrate /= d; - prev_i = (int *) malloc(nchannels * sizeof(int)); - cur_i = (int *) malloc(nchannels * sizeof(int)); + alloc_size = sizeof(int) * (unsigned)nchannels; + if (alloc_size < nchannels) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + prev_i = (int *) malloc(alloc_size); + cur_i = (int *) malloc(alloc_size); if (prev_i == NULL || cur_i == NULL) { (void) PyErr_NoMemory(); goto exit; @@ -1276,7 +1296,7 @@ unsigned char *cp; unsigned char cval; signed char *ncp; - int len, size, val; + int len, new_len, size, val; PyObject *rv; int i; @@ -1289,12 +1309,18 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + new_len = len*size; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); - for ( i=0; i < len*size; i += size ) { + for ( i=0; i < new_len; i += size ) { cval = *cp++; val = st_ulaw2linear16(cval); @@ -1344,7 +1370,7 @@ unsigned char *cp; unsigned char cval; signed char *ncp; - int len, size, val; + int len, new_len, size, val; PyObject *rv; int i; @@ -1357,12 +1383,18 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + new_len = len*size; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); - for ( i=0; i < len*size; i += size ) { + for ( i=0; i < new_len; i += size ) { cval = *cp++; val = st_alaw2linear16(cval); @@ -1487,7 +1519,7 @@ { signed char *cp; signed char *ncp; - int len, size, valpred, step, delta, index, sign, vpdiff; + int len, new_len, size, valpred, step, delta, index, sign, vpdiff; PyObject *rv, *str, *state; int i, inputbuffer = 0, bufferstep; @@ -1509,7 +1541,13 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyString_FromStringAndSize(NULL, len*size*2); + new_len = len*size*2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + str = PyString_FromStringAndSize(NULL, new_len); if ( str == 0 ) return 0; ncp = (signed char *)PyString_AsString(str); @@ -1517,7 +1555,7 @@ step = stepsizeTable[index]; bufferstep = 0; - for ( i=0; i < len*size*2; i += size ) { + for ( i=0; i < new_len; i += size ) { /* Step 1 - get the delta value and compute next index */ if ( bufferstep ) { delta = inputbuffer & 0xf; Modified: python/trunk/Modules/binascii.c ============================================================================== --- python/trunk/Modules/binascii.c (original) +++ python/trunk/Modules/binascii.c Wed Jun 11 09:41:16 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) +#define BASE64_MAXBIN (PY_SSIZE_T_MAX/2 - sizeof(PyStringObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -198,6 +198,8 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; + assert(ascii_len >= 0); + /* First byte: binary data length (in bytes) */ bin_len = (*ascii_data++ - ' ') & 077; ascii_len--; @@ -351,6 +353,11 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; + assert(ascii_len >= 0); + + if (ascii_len > PY_SSIZE_T_MAX - 3) + return PyErr_NoMemory(); + bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ @@ -440,6 +447,9 @@ if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; + + assert(bin_len >= 0); + if ( bin_len > BASE64_MAXBIN ) { PyErr_SetString(Error, "Too much data for base64 line"); return NULL; @@ -495,6 +505,11 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX - 2) + return PyErr_NoMemory(); + /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ @@ -558,6 +573,11 @@ if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX / 2 - 2) + return PyErr_NoMemory(); + /* Worst case: output is twice as big as input (fixed later) */ if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; @@ -607,6 +627,11 @@ if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX / 2 - 2) + return PyErr_NoMemory(); + /* Allocate a buffer that is at least large enough */ if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; @@ -645,9 +670,13 @@ if ( !PyArg_ParseTuple(args, "s#:rledecode_hqx", &in_data, &in_len) ) return NULL; + assert(in_len >= 0); + /* Empty string is a special case */ if ( in_len == 0 ) return PyString_FromString(""); + else if (in_len > PY_SSIZE_T_MAX / 2) + return PyErr_NoMemory(); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; @@ -673,6 +702,7 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ + if ( out_len > PY_SSIZE_T_MAX / 2) return PyErr_NoMemory(); \ _PyString_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ out_data = (unsigned char *)PyString_AsString(rv) \ @@ -741,7 +771,7 @@ if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; - while(len--) { + while(len-- > 0) { crc=((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++]; } @@ -901,7 +931,7 @@ return NULL; crc = ~ crc; - while (len--) + while (len-- > 0) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffU] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ @@ -923,6 +953,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; + assert(arglen >= 0); + if (arglen > PY_SSIZE_T_MAX / 2) + return PyErr_NoMemory(); + retval = PyString_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; @@ -980,6 +1014,8 @@ if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen)) return NULL; + assert(arglen >= 0); + /* XXX What should we do about strings with an odd length? Should * we add an implicit leading zero, or a trailing zero? For now, * raise an exception. Modified: python/trunk/Modules/cPickle.c ============================================================================== --- python/trunk/Modules/cPickle.c (original) +++ python/trunk/Modules/cPickle.c Wed Jun 11 09:41:16 2008 @@ -3435,6 +3435,14 @@ if (self->read_func(self, &s, 4) < 0) return -1; l = calc_binint(s, 4); + if (l < 0) { + /* Corrupt or hostile pickle -- we never write one like + * this. + */ + PyErr_SetString(UnpicklingError, + "BINSTRING pickle has negative byte count"); + return -1; + } if (self->read_func(self, &s, l) < 0) return -1; @@ -3502,6 +3510,14 @@ if (self->read_func(self, &s, 4) < 0) return -1; l = calc_binint(s, 4); + if (l < 0) { + /* Corrupt or hostile pickle -- we never write one like + * this. + */ + PyErr_SetString(UnpicklingError, + "BINUNICODE pickle has negative byte count"); + return -1; + } if (self->read_func(self, &s, l) < 0) return -1; Modified: python/trunk/Modules/cStringIO.c ============================================================================== --- python/trunk/Modules/cStringIO.c (original) +++ python/trunk/Modules/cStringIO.c Wed Jun 11 09:41:16 2008 @@ -119,6 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; + assert(IOOOBJECT(self)->pos >= 0); return PyString_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,6 +138,7 @@ } else s=self->string_size; + assert(self->pos >= 0); return PyString_FromStringAndSize(self->buf, s); } @@ -157,6 +159,8 @@ Py_ssize_t l; if (!IO__opencheck(IOOOBJECT(self))) return -1; + assert(IOOOBJECT(self)->pos >= 0); + assert(IOOOBJECT(self)->string_size >= 0); l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos; if (n < 0 || n > l) { n = l; @@ -192,12 +196,17 @@ for (n = ((IOobject*)self)->buf + ((IOobject*)self)->pos, s = ((IOobject*)self)->buf + ((IOobject*)self)->string_size; n < s && *n != '\n'; n++); + if (n < s) n++; *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; l = n - ((IOobject*)self)->buf - ((IOobject*)self)->pos; - assert(((IOobject*)self)->pos + l < INT_MAX); - ((IOobject*)self)->pos += (int)l; + + assert(IOOOBJECT(self)->pos <= PY_SSIZE_T_MAX - l); + assert(IOOOBJECT(self)->pos >= 0); + assert(IOOOBJECT(self)->string_size >= 0); + + ((IOobject*)self)->pos += l; return (int)l; } @@ -215,6 +224,7 @@ n -= m; self->pos -= m; } + assert(IOOOBJECT(self)->pos >= 0); return PyString_FromStringAndSize(output, n); } @@ -277,6 +287,7 @@ if (!IO__opencheck(self)) return NULL; + assert(self->pos >= 0); return PyInt_FromSsize_t(self->pos); } Modified: python/trunk/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/trunk/Modules/cjkcodecs/multibytecodec.c (original) +++ python/trunk/Modules/cjkcodecs/multibytecodec.c Wed Jun 11 09:41:16 2008 @@ -163,13 +163,17 @@ static int expand_encodebuffer(MultibyteEncodeBuffer *buf, Py_ssize_t esize) { - Py_ssize_t orgpos, orgsize; + Py_ssize_t orgpos, orgsize, incsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - PyString_AS_STRING(buf->outobj)); orgsize = PyString_GET_SIZE(buf->outobj); - if (_PyString_Resize(&buf->outobj, orgsize + ( - esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) + incsize = (esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize); + + if (orgsize > PY_SSIZE_T_MAX - incsize) + return -1; + + if (_PyString_Resize(&buf->outobj, orgsize + incsize) == -1) return -1; buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; @@ -473,6 +477,12 @@ buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; + + if (datalen > (PY_SSIZE_T_MAX - 16) / 2) { + PyErr_NoMemory(); + goto errorexit; + } + buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; @@ -735,6 +745,11 @@ origpending = ctx->pendingsize; if (origpending > 0) { + if (datalen > PY_SSIZE_T_MAX - ctx->pendingsize) { + PyErr_NoMemory(); + /* inbuf_tmp == NULL */ + goto errorexit; + } inbuf_tmp = PyMem_New(Py_UNICODE, datalen + ctx->pendingsize); if (inbuf_tmp == NULL) goto errorexit; @@ -797,9 +812,10 @@ Py_ssize_t npendings; npendings = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - if (npendings + ctx->pendingsize > MAXDECPENDING) { - PyErr_SetString(PyExc_UnicodeError, "pending buffer overflow"); - return -1; + if (npendings + ctx->pendingsize > MAXDECPENDING || + npendings > PY_SSIZE_T_MAX - ctx->pendingsize) { + PyErr_SetString(PyExc_UnicodeError, "pending buffer overflow"); + return -1; } memcpy(ctx->pending + ctx->pendingsize, buf->inbuf, npendings); ctx->pendingsize += npendings; @@ -1001,7 +1017,7 @@ PyObject *args, PyObject *kwargs) { MultibyteDecodeBuffer buf; - char *data, *wdata; + char *data, *wdata = NULL; Py_ssize_t wsize, finalsize = 0, size, origpending; int final = 0; @@ -1017,6 +1033,10 @@ wdata = data; } else { + if (size > PY_SSIZE_T_MAX - self->pendingsize) { + PyErr_NoMemory(); + goto errorexit; + } wsize = size + self->pendingsize; wdata = PyMem_Malloc(wsize); if (wdata == NULL) @@ -1235,6 +1255,10 @@ PyObject *ctr; char *ctrdata; + if (PyString_GET_SIZE(cres) > PY_SSIZE_T_MAX - self->pendingsize) { + PyErr_NoMemory(); + goto errorexit; + } rsize = PyString_GET_SIZE(cres) + self->pendingsize; ctr = PyString_FromStringAndSize(NULL, rsize); if (ctr == NULL) Modified: python/trunk/Modules/datetimemodule.c ============================================================================== --- python/trunk/Modules/datetimemodule.c (original) +++ python/trunk/Modules/datetimemodule.c Wed Jun 11 09:41:16 2008 @@ -1115,6 +1115,8 @@ char sign; int none; + assert(buflen >= 1); + offset = call_utcoffset(tzinfo, tzinfoarg, &none); if (offset == -1 && PyErr_Occurred()) return -1; @@ -1206,6 +1208,11 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ + if (format_len > INT_MAX - 1) { + PyErr_NoMemory(); + goto Done; + } + totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ newfmt = PyString_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; Modified: python/trunk/Modules/md5.c ============================================================================== --- python/trunk/Modules/md5.c (original) +++ python/trunk/Modules/md5.c Wed Jun 11 09:41:16 2008 @@ -53,6 +53,7 @@ #include "md5.h" #include +#include #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN @@ -330,6 +331,18 @@ if (nbytes <= 0) return; + /* this special case is handled recursively */ + if (nbytes > INT_MAX - offset) { + int overlap; + + /* handle the append in two steps to prevent overflow */ + overlap = 64 - offset; + + md5_append(pms, data, overlap); + md5_append(pms, data + overlap, nbytes - overlap); + return; + } + /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; Modified: python/trunk/Modules/stropmodule.c ============================================================================== --- python/trunk/Modules/stropmodule.c (original) +++ python/trunk/Modules/stropmodule.c Wed Jun 11 09:41:16 2008 @@ -578,7 +578,7 @@ char* e; char* p; char* q; - Py_ssize_t i, j; + Py_ssize_t i, j, old_j; PyObject* out; char* string; Py_ssize_t stringlen; @@ -595,12 +595,18 @@ } /* First pass: determine size of output string */ - i = j = 0; /* j: current column; i: total of previous lines */ + i = j = old_j = 0; /* j: current column; i: total of previous lines */ e = string + stringlen; for (p = string; p < e; p++) { - if (*p == '\t') + if (*p == '\t') { j += tabsize - (j%tabsize); - else { + if (old_j > j) { + PyErr_SetString(PyExc_OverflowError, + "new string is too long"); + return NULL; + } + old_j = j; + } else { j++; if (*p == '\n') { i += j; @@ -609,6 +615,11 @@ } } + if ((i + j) < 0) { + PyErr_SetString(PyExc_OverflowError, "new string is too long"); + return NULL; + } + /* Second pass: create output string and fill it */ out = PyString_FromStringAndSize(NULL, i+j); if (out == NULL) Modified: python/trunk/Objects/bufferobject.c ============================================================================== --- python/trunk/Objects/bufferobject.c (original) +++ python/trunk/Objects/bufferobject.c Wed Jun 11 09:41:16 2008 @@ -207,7 +207,10 @@ "size must be zero or positive"); return NULL; } - /* XXX: check for overflow in multiply */ + if (sizeof(*b) > PY_SSIZE_T_MAX - size) { + /* unlikely */ + return PyErr_NoMemory(); + } /* Inline PyObject_New */ o = (PyObject *)PyObject_MALLOC(sizeof(*b) + size); if ( o == NULL ) @@ -401,6 +404,8 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; + assert(count <= PY_SIZE_MAX - size); + ob = PyString_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; Modified: python/trunk/Objects/listobject.c ============================================================================== --- python/trunk/Objects/listobject.c (original) +++ python/trunk/Objects/listobject.c Wed Jun 11 09:41:16 2008 @@ -45,7 +45,16 @@ * system realloc(). * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ - new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6) + newsize; + new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6); + + /* check for integer overflow */ + if (new_allocated > PY_SIZE_MAX - newsize) { + PyErr_NoMemory(); + return -1; + } else { + new_allocated += newsize; + } + if (newsize == 0) new_allocated = 0; items = self->ob_item; @@ -118,8 +127,9 @@ return NULL; } nbytes = size * sizeof(PyObject *); - /* Check for overflow */ - if (nbytes / sizeof(PyObject *) != (size_t)size) + /* Check for overflow without an actual overflow, + * which can cause compiler to optimise out */ + if (size > PY_SIZE_MAX / sizeof(PyObject *)) return PyErr_NoMemory(); if (numfree) { numfree--; @@ -1407,6 +1417,10 @@ * we don't care what's in the block. */ merge_freemem(ms); + if (need > PY_SSIZE_T_MAX / sizeof(PyObject*)) { + PyErr_NoMemory(); + return -1; + } ms->a = (PyObject **)PyMem_Malloc(need * sizeof(PyObject*)); if (ms->a) { ms->alloced = need; @@ -2589,6 +2603,8 @@ step = -step; } + assert(slicelength <= PY_SIZE_MAX / sizeof(PyObject*)); + garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); if (!garbage) { Modified: python/trunk/Objects/obmalloc.c ============================================================================== --- python/trunk/Objects/obmalloc.c (original) +++ python/trunk/Objects/obmalloc.c Wed Jun 11 09:41:16 2008 @@ -526,9 +526,9 @@ numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; if (numarenas <= maxarenas) return NULL; /* overflow */ - nbytes = numarenas * sizeof(*arenas); - if (nbytes / sizeof(*arenas) != numarenas) + if (numarenas > PY_SIZE_MAX / sizeof(*arenas)) return NULL; /* overflow */ + nbytes = numarenas * sizeof(*arenas); arenaobj = (struct arena_object *)realloc(arenas, nbytes); if (arenaobj == NULL) return NULL; Modified: python/trunk/Parser/node.c ============================================================================== --- python/trunk/Parser/node.c (original) +++ python/trunk/Parser/node.c Wed Jun 11 09:41:16 2008 @@ -91,6 +91,9 @@ if (current_capacity < 0 || required_capacity < 0) return E_OVERFLOW; if (current_capacity < required_capacity) { + if (required_capacity > PY_SIZE_MAX / sizeof(node)) { + return E_NOMEM; + } n = n1->n_child; n = (node *) PyObject_REALLOC(n, required_capacity * sizeof(node)); Modified: python/trunk/Python/asdl.c ============================================================================== --- python/trunk/Python/asdl.c (original) +++ python/trunk/Python/asdl.c Wed Jun 11 09:41:16 2008 @@ -5,8 +5,22 @@ asdl_seq_new(int size, PyArena *arena) { asdl_seq *seq = NULL; - size_t n = sizeof(asdl_seq) + - (size ? (sizeof(void *) * (size - 1)) : 0); + size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); + + /* check size is sane */ + if (size < 0 || size == INT_MIN || + (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + PyErr_NoMemory(); + return NULL; + } + + /* check if size can be added safely */ + if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + PyErr_NoMemory(); + return NULL; + } + + n += sizeof(asdl_seq); seq = (asdl_seq *)PyArena_Malloc(arena, n); if (!seq) { @@ -22,8 +36,22 @@ asdl_int_seq_new(int size, PyArena *arena) { asdl_int_seq *seq = NULL; - size_t n = sizeof(asdl_seq) + - (size ? (sizeof(int) * (size - 1)) : 0); + size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); + + /* check size is sane */ + if (size < 0 || size == INT_MIN || + (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + PyErr_NoMemory(); + return NULL; + } + + /* check if size can be added safely */ + if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + PyErr_NoMemory(); + return NULL; + } + + n += sizeof(asdl_seq); seq = (asdl_int_seq *)PyArena_Malloc(arena, n); if (!seq) { Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Wed Jun 11 09:41:16 2008 @@ -3200,6 +3200,9 @@ buf = (char *)s; u = NULL; } else { + /* check for integer overflow */ + if (len > PY_SIZE_MAX / 4) + return NULL; /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ u = PyString_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) Modified: python/trunk/Python/bltinmodule.c ============================================================================== --- python/trunk/Python/bltinmodule.c (original) +++ python/trunk/Python/bltinmodule.c Wed Jun 11 09:41:16 2008 @@ -2792,11 +2792,43 @@ PyString_AS_STRING(item)[0]; } else { /* do we need more space? */ - Py_ssize_t need = j + reslen + len-i-1; + Py_ssize_t need = j; + + /* calculate space requirements while checking for overflow */ + if (need > PY_SSIZE_T_MAX - reslen) { + Py_DECREF(item); + goto Fail_1; + } + + need += reslen; + + if (need > PY_SSIZE_T_MAX - len) { + Py_DECREF(item); + goto Fail_1; + } + + need += len; + + if (need <= i) { + Py_DECREF(item); + goto Fail_1; + } + + need = need - i - 1; + + assert(need >= 0); + assert(outlen >= 0); + if (need > outlen) { /* overallocate, to avoid reallocations */ - if (need<2*outlen) + if (outlen > PY_SSIZE_T_MAX / 2) { + Py_DECREF(item); + return NULL; + } + + if (need<2*outlen) { need = 2*outlen; + } if (_PyString_Resize(&result, need)) { Py_DECREF(item); return NULL; @@ -2888,11 +2920,31 @@ else { /* do we need more space? */ Py_ssize_t need = j + reslen + len - i - 1; + + /* check that didnt overflow */ + if ((j > PY_SSIZE_T_MAX - reslen) || + ((j + reslen) > PY_SSIZE_T_MAX - len) || + ((j + reslen + len) < i) || + ((j + reslen + len - i) <= 0)) { + Py_DECREF(item); + return NULL; + } + + assert(need >= 0); + assert(outlen >= 0); + if (need > outlen) { /* overallocate, to avoid reallocations */ - if (need < 2 * outlen) - need = 2 * outlen; + if (need < 2 * outlen) { + if (outlen > PY_SSIZE_T_MAX / 2) { + Py_DECREF(item); + return NULL; + } else { + need = 2 * outlen; + } + } + if (PyUnicode_Resize( &result, need) < 0) { Py_DECREF(item); Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Wed Jun 11 09:41:16 2008 @@ -216,6 +216,10 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); + + assert(1 <= PY_SSIZE_T_MAX - nlen); + assert(1 + nlen <= PY_SSIZE_T_MAX - plen); + ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; @@ -621,6 +625,12 @@ size_t oldsize, newsize; oldsize = b->b_ialloc * sizeof(struct instr); newsize = oldsize << 1; + + if (oldsize > (PY_SIZE_MAX >> 1)) { + PyErr_NoMemory(); + return -1; + } + if (newsize == 0) { PyErr_NoMemory(); return -1; @@ -3478,6 +3488,10 @@ a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; + if (nblocks > PY_SIZE_MAX / sizeof(basicblock *)) { + PyErr_NoMemory(); + return 0; + } a->a_postorder = (basicblock **)PyObject_Malloc( sizeof(basicblock *) * nblocks); if (!a->a_postorder) { @@ -3586,10 +3600,14 @@ nbytes = a->a_lnotab_off + 2 * ncodes; len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { - if (len * 2 < nbytes) + if ((len <= INT_MAX / 2) && (len * 2 < nbytes)) len = nbytes; - else + else if (len <= INT_MAX / 2) len *= 2; + else { + PyErr_NoMemory(); + return 0; + } if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } @@ -3608,10 +3626,14 @@ nbytes = a->a_lnotab_off + 2 * ncodes; len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { - if (len * 2 < nbytes) + if ((len <= INT_MAX / 2) && len * 2 < nbytes) len = nbytes; - else + else if (len <= INT_MAX / 2) len *= 2; + else { + PyErr_NoMemory(); + return 0; + } if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } @@ -3670,6 +3692,8 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { + if (len > PY_SSIZE_T_MAX / 2) + return 0; if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) return 0; } From buildbot at python.org Wed Jun 11 10:15:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 08:15:24 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080611081524.D8DAD1E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/991 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str 22 tests failed: test_bufio test_builtin test_deque test_distutils test_filecmp test_fileio test_gzip test_http_cookiejar test_httpservers test_io test_iter test_mailbox test_pkgutil test_pydoc test_set test_site test_univnewlines test_urllib test_urllib2 test_uu test_zipfile test_zipimport ====================================================================== ERROR: test_nullpat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_bufio.py", line 59, in test_nullpat self.drive_one(bytes(1000)) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_bufio.py", line 51, in drive_one self.try_one(teststring[:-1]) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(support.TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_maxlen (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_deque.py", line 80, in test_maxlen fo = open(support.TESTFN, "w") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_matching (test.test_filecmp.FileCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_filecmp.py", line 13, in setUp output = open(name, 'w') File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_gzip.py", line 48, in test_read self.test_write() File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\3.0.heller-windows\build\lib\gzip.py", line 91, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_magic (test.test_http_cookiejar.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_http_cookiejar.py", line 253, in test_bad_magic f = open(filename, "w") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_post (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_httpservers.py", line 325, in test_post res = self.request('/cgi-bin/file2.py', 'POST', params, headers) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_httpservers.py", line 63, in request return self.connection.getresponse() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\client.py", line 976, in getresponse response.begin() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\client.py", line 424, in begin self.msg = HTTPMessage(self.fp, 0) File "C:\buildbot\work\3.0.heller-windows\build\lib\mimetools.py", line 16, in __init__ rfc822.Message.__init__(self, fp, seekable) File "C:\buildbot\work\3.0.heller-windows\build\lib\rfc822.py", line 104, in __init__ self.readheaders() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\client.py", line 266, in readheaders line = str(self.fp.readline(), "iso-8859-1") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 510, in readline b = self.read(nreadahead()) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 577, in read n = self.readinto(b) File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 217, in readinto return self._sock.recv_into(b) socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host ====================================================================== FAIL: test_authorization (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_httpservers.py", line 339, in test_authorization (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== FAIL: test_headers_and_content (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_httpservers.py", line 320, in test_headers_and_content (res.read(), res.getheader('Content-type'), res.status)) AssertionError: (b'Hello World\n', 'text/html', 200) != (b'', None, 200) ====================================================================== ERROR: test_close_flushes (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_io.py", line 252, in test_close_flushes f = io.open(support.TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekingToo (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_io.py", line 908, in testSeekingToo f = io.open(support.TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testTelling (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_io.py", line 868, in testTelling f = io.open(support.TESTFN, "w+", encoding="utf8") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_builtin_list (test.test_iter.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_iter.py", line 254, in test_builtin_list f = open(TESTFN, "w") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 61, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 44, in _delete_recursively os.rmdir(target) WindowsError: [Error 145] The directory is not empty: '@test' ====================================================================== ERROR: test_values (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 61, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 44, in _delete_recursively os.rmdir(target) WindowsError: [Error 145] The directory is not empty: '@test' ====================================================================== ERROR: test_add (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_clear (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_close (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_contains (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_discard (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_flush (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_get (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_items (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_iter (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_keys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_labels (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_len (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_pop (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_remove (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_update (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== ERROR: test_values (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 56, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_mailbox.py", line 41, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\7' ====================================================================== FAIL: test_html_doc (test.test_pydoc.PyDocDocTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_pydoc.py", line 237, in test_html_doc self.fail("outputs are not equal, see diff above") AssertionError: outputs are not equal, see diff above ====================================================================== ERROR: test_print (test.test_set.TestBasicOpsSingleton) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_set.py", line 694, in test_print fo.close() UnboundLocalError: local variable 'fo' referenced before assignment ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_readline (test.test_univnewlines.TestCRNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_univnewlines.TestCRNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek (test.test_univnewlines.TestCRNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_univnewlines.TestLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_univnewlines.TestLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_univnewlines.TestLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek (test.test_univnewlines.TestLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_univnewlines.TestCRLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_univnewlines.TestCRLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_univnewlines.TestCRLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek (test.test_univnewlines.TestCRLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_tell (test.test_univnewlines.TestCRLFNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_univnewlines.TestMixedNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_univnewlines.TestMixedNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_univnewlines.TestMixedNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek (test.test_univnewlines.TestMixedNewlines) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_univnewlines.py", line 38, in setUp fp = open(support.TESTFN, self.WRITEMODE) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_urllib2.py", line 609, in test_file f = open(TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_decode (test.test_uu.UUFileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_uu.py", line 160, in test_decode uu.decode(f) File "C:\buildbot\work\3.0.heller-windows\build\lib\uu.py", line 112, in decode raise Error('Cannot overwrite existing file: %s' % out_file) uu.Error: Cannot overwrite existing file: @testo ====================================================================== ERROR: test_decodetwice (test.test_uu.UUFileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_uu.py", line 177, in test_decodetwice f = open(self.tmpin, 'rb') File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 2] No such file or directory: '@testi' ====================================================================== ERROR: testAppendToNonZipFile (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipfile.py", line 30, in setUp fp = open(TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testAppendToZipFile (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipfile.py", line 30, in setUp fp = open(TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testCloseErroneousFile (test.test_zipfile.OtherTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipfile.py", line 600, in testCloseErroneousFile fp = open(TESTFN, "w") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testGoodPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipfile.py", line 733, in setUp fp = open(TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testNoPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipfile.py", line 733, in setUp fp = open(TESTFN, "wb") File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 280, in __new__ return open(*args, **kwargs) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testGetData (test.test_zipimport.UncompressedZipImportTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\test\test_zipimport.py", line 265, in testGetData z = ZipFile(TEMP_ZIP, "w") File "C:\buildbot\work\3.0.heller-windows\build\lib\zipfile.py", line 616, in __init__ self.fp = io.open(file, modeDict[mode]) File "c:\buildbot\work\3.0.heller-windows\build\lib\io.py", line 219, in open closefd) IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\3.0.heller-windows\\build\\PCbuild\\junk95142.zip' Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 617, in do_GET f = self.send_head() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 849, in send_head return self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 3, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str Traceback (most recent call last): File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\buildbot\work\3.0.heller-windows\build\lib\socketserver.py", line 614, in __init__ self.handle() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 364, in handle self.handle_one_request() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 358, in handle_one_request method() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 842, in do_POST self.run_cgi() File "C:\buildbot\work\3.0.heller-windows\build\lib\http\server.py", line 1102, in run_cgi exec(open(scriptfile).read(), {"__name__": "__main__"}) File "", line 4, in File "C:\buildbot\work\3.0.heller-windows\build\lib\socket.py", line 222, in write return self._sock.send(b) TypeError: send() argument 1 must be bytes or read-only buffer, not str sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 10:25:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 08:25:15 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080611082515.9EB3A1E4003@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/1023 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 10:33:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 08:33:58 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080611083358.994521E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/475 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_builtin make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 10:48:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 08:48:30 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080611084830.C16611E4003@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1475 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith,thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 11:33:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 09:33:06 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080611093307.1B1051E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/971 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 12:30:54 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 12:30:54 +0200 (CEST) Subject: [Python-checkins] r64115 - in python/trunk: Doc/library/stdtypes.rst Lib/test/test_set.py Misc/NEWS Objects/setobject.c Message-ID: <20080611103054.9BC961E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 12:30:54 2008 New Revision: 64115 Log: Multi-arg form for set.difference() and set.difference_update(). Modified: python/trunk/Doc/library/stdtypes.rst python/trunk/Lib/test/test_set.py python/trunk/Misc/NEWS python/trunk/Objects/setobject.c Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Wed Jun 11 12:30:54 2008 @@ -1583,10 +1583,13 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: difference(other) - set - other + .. method:: difference(other, ...) + set - other - ... - Return a new set with elements in the set that are not in *other*. + Return a new set with elements in the set that are not in the others. + + .. versionchanged:: 2.6 + Accepts multiple input iterables. .. method:: symmetric_difference(other) set ^ other @@ -1650,10 +1653,13 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: difference_update(other) - set -= other + .. method:: difference_update(other, ...) + set -= other | ... - Update the set, removing elements found in *other*. + Update the set, removing elements found in others. + + .. versionchanged:: 2.6 + Accepts multiple input iterables. .. method:: symmetric_difference_update(other) set ^= other Modified: python/trunk/Lib/test/test_set.py ============================================================================== --- python/trunk/Lib/test/test_set.py (original) +++ python/trunk/Lib/test/test_set.py Wed Jun 11 12:30:54 2008 @@ -149,6 +149,8 @@ self.assertEqual(self.thetype('abcba').difference(C('efgfe')), set('abc')) self.assertEqual(self.thetype('abcba').difference(C('ccb')), set('a')) self.assertEqual(self.thetype('abcba').difference(C('ef')), set('abc')) + self.assertEqual(self.thetype('abcba').difference(), set('abc')) + self.assertEqual(self.thetype('abcba').difference(C('a'), C('b')), set('c')) def test_sub(self): i = self.s.difference(self.otherword) @@ -467,6 +469,18 @@ self.assertEqual(s.difference_update(C(p)), None) self.assertEqual(s, set(q)) + s = self.thetype('abcdefghih') + s.difference_update() + self.assertEqual(s, self.thetype('abcdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('aba')) + self.assertEqual(s, self.thetype('cdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('cdc'), C('aba')) + self.assertEqual(s, self.thetype('efghih')) + def test_isub(self): self.s -= set(self.otherword) for c in (self.word + self.otherword): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 12:30:54 2008 @@ -13,7 +13,7 @@ ----------------- - Several set methods now accept multiple arguments: update(), union(), - intersection() and intersection_update(). + intersection(), intersection_update(), difference(), and difference_update(). - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Wed Jun 11 12:30:54 2008 @@ -1495,11 +1495,16 @@ } static PyObject * -set_difference_update(PySetObject *so, PyObject *other) +set_difference_update(PySetObject *so, PyObject *args) { - if (set_difference_update_internal(so, other) != -1) - Py_RETURN_NONE; - return NULL; + Py_ssize_t i; + + for (i=0 ; i The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/748 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_site ====================================================================== ERROR: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_site.py", line 115, in test_s_option env=env) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 444, in call return Popen(*popenargs, **kwargs).wait() File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 13:22:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 11:22:59 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080611112259.C170D1E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1566 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 13:54:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 11:54:18 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080611115418.8B08F1E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3534 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 14:06:50 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 14:06:50 +0200 (CEST) Subject: [Python-checkins] r64116 - python/trunk/Modules/_heapqmodule.c Message-ID: <20080611120650.0ECAF1E400D@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 14:06:49 2008 New Revision: 64116 Log: Issue 3051: Let heapq work with either __lt__ or __le__. Modified: python/trunk/Modules/_heapqmodule.c Modified: python/trunk/Modules/_heapqmodule.c ============================================================================== --- python/trunk/Modules/_heapqmodule.c (original) +++ python/trunk/Modules/_heapqmodule.c Wed Jun 11 14:06:49 2008 @@ -17,13 +17,12 @@ cmp_lt(PyObject *x, PyObject *y) { int cmp; - cmp = PyObject_RichCompareBool(x, y, Py_LT); - if (cmp == -1 && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - cmp = PyObject_RichCompareBool(y, x, Py_LE); - if (cmp != -1) - cmp = 1 - cmp; - } + + if (PyObject_HasAttrString(x, "__lt__")) + return PyObject_RichCompareBool(x, y, Py_LT); + cmp = PyObject_RichCompareBool(y, x, Py_LE); + if (cmp != -1) + cmp = 1 - cmp; return cmp; } From python-checkins at python.org Wed Jun 11 14:26:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 14:26:31 +0200 (CEST) Subject: [Python-checkins] r64117 - in python/trunk/Lib: multiprocessing/__init__.py test/test_multiprocessing.py Message-ID: <20080611122631.EB4A61E4003@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 14:26:31 2008 New Revision: 64117 Log: fix import of multiprocessing by juggling imports Modified: python/trunk/Lib/multiprocessing/__init__.py python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/multiprocessing/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/__init__.py (original) +++ python/trunk/Lib/multiprocessing/__init__.py Wed Jun 11 14:26:31 2008 @@ -60,7 +60,6 @@ import os import sys -import _multiprocessing from multiprocessing.process import Process, current_process, active_children # @@ -79,6 +78,9 @@ class AuthenticationError(ProcessError): pass +# This is down here because _multiprocessing uses BufferTooShort +import _multiprocessing + # # Definitions not depending on native semaphores # Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jun 11 14:26:31 2008 @@ -16,13 +16,13 @@ import random import logging -import _multiprocessing import multiprocessing.dummy import multiprocessing.connection import multiprocessing.managers import multiprocessing.heap import multiprocessing.managers import multiprocessing.pool +import _multiprocessing from multiprocessing import util From python-checkins at python.org Wed Jun 11 14:39:10 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 14:39:10 +0200 (CEST) Subject: [Python-checkins] r64118 - python/trunk/Modules/_heapqmodule.c Message-ID: <20080611123910.288BB1E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 14:39:09 2008 New Revision: 64118 Log: Optimize previous checkin for heapq. Modified: python/trunk/Modules/_heapqmodule.c Modified: python/trunk/Modules/_heapqmodule.c ============================================================================== --- python/trunk/Modules/_heapqmodule.c (original) +++ python/trunk/Modules/_heapqmodule.c Wed Jun 11 14:39:09 2008 @@ -17,8 +17,14 @@ cmp_lt(PyObject *x, PyObject *y) { int cmp; + static PyObject *lt = NULL; - if (PyObject_HasAttrString(x, "__lt__")) + if (lt == NULL) { + lt = PyString_FromString("__lt__"); + if (lt == NULL) + return -1; + } + if (PyObject_HasAttr(x, lt)) return PyObject_RichCompareBool(x, y, Py_LT); cmp = PyObject_RichCompareBool(y, x, Py_LE); if (cmp != -1) From python-checkins at python.org Wed Jun 11 14:53:15 2008 From: python-checkins at python.org (andrew.kuchling) Date: Wed, 11 Jun 2008 14:53:15 +0200 (CEST) Subject: [Python-checkins] r64119 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080611125315.188711E4003@bag.python.org> Author: andrew.kuchling Date: Wed Jun 11 14:53:14 2008 New Revision: 64119 Log: Note PEP 371 section Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Wed Jun 11 14:53:14 2008 @@ -521,6 +521,21 @@ .. ====================================================================== +.. _pep-0371: + +PEP 371: The ``multiprocessing`` Package +===================================================== + +XXX write this. + +.. seealso:: + + :pep:`371` - Per-user ``site-packages`` Directory + PEP written by Jesse Noller and Richard Oudkerk; + implemented by Jesse Noller. + +.. ====================================================================== + .. _pep-3101: PEP 3101: Advanced String Formatting From python-checkins at python.org Wed Jun 11 15:14:51 2008 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 11 Jun 2008 15:14:51 +0200 (CEST) Subject: [Python-checkins] r64120 - python/trunk/Lib/test/test_heapq.py Message-ID: <20080611131451.4817E1E4003@bag.python.org> Author: raymond.hettinger Date: Wed Jun 11 15:14:50 2008 New Revision: 64120 Log: Add test for heapq using both __lt__ and __le__. Modified: python/trunk/Lib/test/test_heapq.py Modified: python/trunk/Lib/test/test_heapq.py ============================================================================== --- python/trunk/Lib/test/test_heapq.py (original) +++ python/trunk/Lib/test/test_heapq.py Wed Jun 11 15:14:50 2008 @@ -196,6 +196,27 @@ class TestHeapC(TestHeap): module = c_heapq + def test_comparison_operator(self): + # Issue 3501: Make sure heapq works with both __lt__ and __le__ + def hsort(data, comp): + data = map(comp, data) + self.module.heapify(data) + return [self.module.heappop(data).x for i in range(len(data))] + class LT: + def __init__(self, x): + self.x = x + def __lt__(self, other): + return self.x > other.x + class LE: + def __init__(self, x): + self.x = x + def __lt__(self, other): + return self.x >= other.x + data = [random.random() for i in range(100)] + target = sorted(data, reverse=True) + self.assertEqual(hsort(data, LT), target) + self.assertEqual(hsort(data, LE), target) + #============================================================================== From buildbot at python.org Wed Jun 11 16:01:29 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 14:01:29 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080611140129.851291E4024@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3536 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From ncoghlan at gmail.com Wed Jun 11 16:52:15 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 12 Jun 2008 00:52:15 +1000 Subject: [Python-checkins] r64120 - python/trunk/Lib/test/test_heapq.py In-Reply-To: <20080611131451.4817E1E4003@bag.python.org> References: <20080611131451.4817E1E4003@bag.python.org> Message-ID: <484FE69F.1020508@gmail.com> raymond.hettinger wrote: > + class LE: > + def __init__(self, x): > + self.x = x > + def __lt__(self, other): > + return self.x >= other.x Looks like a typo in the method name here. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Wed Jun 11 18:50:58 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 18:50:58 +0200 (CEST) Subject: [Python-checkins] r64123 - in python/trunk/PCbuild: _multiprocessing.vcproj pcbuild.sln Message-ID: <20080611165058.5111F1E4006@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 18:50:57 2008 New Revision: 64123 Log: fix Windows building for multiprocessing Added: python/trunk/PCbuild/_multiprocessing.vcproj Modified: python/trunk/PCbuild/pcbuild.sln Added: python/trunk/PCbuild/_multiprocessing.vcproj ============================================================================== --- (empty file) +++ python/trunk/PCbuild/_multiprocessing.vcproj Wed Jun 11 18:50:57 2008 @@ -0,0 +1,557 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild/pcbuild.sln ============================================================================== --- python/trunk/PCbuild/pcbuild.sln (original) +++ python/trunk/PCbuild/pcbuild.sln Wed Jun 11 18:50:57 2008 @@ -131,6 +131,11 @@ {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9e48b300-37d1-11dd-8c41-005056c00008}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}" EndProject Global @@ -553,6 +558,22 @@ {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|Win32.ActiveCfg = Debug|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|Win32.Build.0 = Debug|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|x64.ActiveCfg = Debug|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|x64.Build.0 = Debug|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.Release|Win32.ActiveCfg = Release|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.Release|Win32.Build.0 = Release|Win32 + {9e48b300-37d1-11dd-8c41-005056c00008}.Release|x64.ActiveCfg = Release|x64 + {9e48b300-37d1-11dd-8c41-005056c00008}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From buildbot at python.org Wed Jun 11 19:07:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 17:07:37 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080611170737.3C9F81E4005@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/629 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 test Excerpt from the test logfile: 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 601, in runtest_inner indirect_test() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/__init__.py", line 225, in Pool return Pool(processes, initializer, initargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/pool.py", line 104, in __init__ w.start() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 104, in start _cleanup() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 58, in _cleanup if p._popen.poll() is not None: File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 11 19:14:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 17:14:57 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080611171457.9D3941E4005@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1063 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 601, in runtest_inner indirect_test() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/__init__.py", line 225, in Pool return Pool(processes, initializer, initargs) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 19:27:51 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 19:27:51 +0200 (CEST) Subject: [Python-checkins] r64125 - in python/trunk: Doc/library/threading.rst Lib/Queue.py Lib/_threading_local.py Lib/logging/__init__.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/synchronize.py Lib/test/test_dummy_threading.py Lib/test/test_multiprocessing.py Lib/test/test_queue.py Lib/test/test_smtplib.py Lib/test/test_socket.py Lib/test/test_socketserver.py Lib/test/test_threading.py Lib/test/threaded_import_hangers.py Lib/threading.py Misc/NEWS Message-ID: <20080611172751.6267A1E4009@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 19:27:50 2008 New Revision: 64125 Log: give the threading API PEP 8 names Modified: python/trunk/Doc/library/threading.rst python/trunk/Lib/Queue.py python/trunk/Lib/_threading_local.py python/trunk/Lib/logging/__init__.py python/trunk/Lib/multiprocessing/dummy/__init__.py python/trunk/Lib/multiprocessing/managers.py python/trunk/Lib/multiprocessing/pool.py python/trunk/Lib/multiprocessing/queues.py python/trunk/Lib/multiprocessing/reduction.py python/trunk/Lib/multiprocessing/synchronize.py python/trunk/Lib/test/test_dummy_threading.py python/trunk/Lib/test/test_multiprocessing.py python/trunk/Lib/test/test_queue.py python/trunk/Lib/test/test_smtplib.py python/trunk/Lib/test/test_socket.py python/trunk/Lib/test/test_socketserver.py python/trunk/Lib/test/test_threading.py python/trunk/Lib/test/threaded_import_hangers.py python/trunk/Lib/threading.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/threading.rst ============================================================================== --- python/trunk/Doc/library/threading.rst (original) +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:27:50 2008 @@ -16,7 +16,7 @@ This module defines the following functions and objects: -.. function:: activeCount() +.. function:: active_count() Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`enumerate`. @@ -30,7 +30,7 @@ thread. -.. function:: currentThread() +.. function:: current_thread() Return the current :class:`Thread` object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the @@ -40,10 +40,10 @@ .. function:: enumerate() - Return a list of all :class:`Thread` objects currently alive. The list includes - daemonic threads, dummy thread objects created by :func:`currentThread`, and the - main thread. It excludes terminated threads and threads that have not yet been - started. + Return a list of all :class:`Thread` objects currently alive. The list + includes daemonic threads, dummy thread objects created by + :func:`current_thread`, and the main thread. It excludes terminated threads + and threads that have not yet been started. .. function:: Event() @@ -395,7 +395,7 @@ lock, its caller should. -.. method:: Condition.notifyAll() +.. method:: Condition.notify_all() Wake up all threads waiting on this condition. This method acts like :meth:`notify`, but wakes up all waiting threads instead of one. If the calling @@ -552,12 +552,12 @@ thread until the thread whose :meth:`join` method is called is terminated. A thread has a name. The name can be passed to the constructor, set with the -:meth:`setName` method, and retrieved with the :meth:`getName` method. +:meth:`set_name` method, and retrieved with the :meth:`get_name` method. A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with -the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method. +the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method. There is a "main thread" object; this corresponds to the initial thread of control in the Python program. It is not a daemon thread. @@ -637,12 +637,12 @@ raises the same exception. -.. method:: Thread.getName() +.. method:: Thread.get_name() Return the thread's name. -.. method:: Thread.setName(name) +.. method:: Thread.set_same(name) Set the thread's name. @@ -651,18 +651,18 @@ constructor. -.. method:: Thread.getIdent() +.. method:: Thread.get_ddent() Return the 'thread identifier' of this thread or None if the thread has not - been started. This is a nonzero integer. See the :mod:`thread` module's - :func:`get_ident()` function. Thread identifiers may be recycled when a - thread exits and another thread is created. The identifier is returned - even after the thread has exited. + been started. This is a nonzero integer. See the :func:`thread.get_ident()` + function. Thread identifiers may be recycled when a thread exits and another + thread is created. The identifier is returned even after the thread has + exited. .. versionadded:: 2.6 -.. method:: Thread.isAlive() +.. method:: Thread.is_alive() Return whether the thread is alive. @@ -671,12 +671,12 @@ returns a list of all alive threads. -.. method:: Thread.isDaemon() +.. method:: Thread.is_daemon() Return the thread's daemon flag. -.. method:: Thread.setDaemon(daemonic) +.. method:: Thread.set_daemon(daemonic) Set the thread's daemon flag to the Boolean value *daemonic*. This must be called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. Modified: python/trunk/Lib/Queue.py ============================================================================== --- python/trunk/Lib/Queue.py (original) +++ python/trunk/Lib/Queue.py Wed Jun 11 19:27:50 2008 @@ -62,7 +62,7 @@ if unfinished <= 0: if unfinished < 0: raise ValueError('task_done() called too many times') - self.all_tasks_done.notifyAll() + self.all_tasks_done.notify_all() self.unfinished_tasks = unfinished finally: self.all_tasks_done.release() Modified: python/trunk/Lib/_threading_local.py ============================================================================== --- python/trunk/Lib/_threading_local.py (original) +++ python/trunk/Lib/_threading_local.py Wed Jun 11 19:27:50 2008 @@ -162,16 +162,16 @@ # __init__ being called, to make sure we don't call it # again ourselves. dict = object.__getattribute__(self, '__dict__') - currentThread().__dict__[key] = dict + current_thread().__dict__[key] = dict return self def _patch(self): key = object.__getattribute__(self, '_local__key') - d = currentThread().__dict__.get(key) + d = current_thread().__dict__.get(key) if d is None: d = {} - currentThread().__dict__[key] = d + current_thread().__dict__[key] = d object.__setattr__(self, '__dict__', d) # we have a new instance dict, so call out __init__ if we have @@ -238,4 +238,4 @@ except KeyError: pass # didn't have anything in this thread -from threading import currentThread, RLock +from threading import current_thread, RLock Modified: python/trunk/Lib/logging/__init__.py ============================================================================== --- python/trunk/Lib/logging/__init__.py (original) +++ python/trunk/Lib/logging/__init__.py Wed Jun 11 19:27:50 2008 @@ -262,7 +262,7 @@ self.relativeCreated = (self.created - _startTime) * 1000 if logThreads and thread: self.thread = thread.get_ident() - self.threadName = threading.currentThread().getName() + self.threadName = threading.current_thread().get_name() else: self.thread = None self.threadName = None Modified: python/trunk/Lib/multiprocessing/dummy/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/dummy/__init__.py (original) +++ python/trunk/Lib/multiprocessing/dummy/__init__.py Wed Jun 11 19:27:50 2008 @@ -48,24 +48,24 @@ threading.Thread.start(self) def get_exitcode(self): - if self._start_called and not self.isAlive(): + if self._start_called and not self.is_alive(): return 0 else: return None # XXX if sys.version_info < (3, 0): - is_alive = threading.Thread.isAlive.im_func - get_name = threading.Thread.getName.im_func - set_name = threading.Thread.setName.im_func - is_daemon = threading.Thread.isDaemon.im_func - set_daemon = threading.Thread.setDaemon.im_func + is_alive = threading.Thread.is_alive.im_func + get_name = threading.Thread.get_name.im_func + set_name = threading.Thread.set_name.im_func + is_daemon = threading.Thread.is_daemon.im_func + set_daemon = threading.Thread.set_daemon.im_func else: - is_alive = threading.Thread.isAlive - get_name = threading.Thread.getName - set_name = threading.Thread.setName - is_daemon = threading.Thread.isDaemon - set_daemon = threading.Thread.setDaemon + is_alive = threading.Thread.is_alive + get_name = threading.Thread.get_name + set_name = threading.Thread.set_name + is_daemon = threading.Thread.is_daemon + set_daemon = threading.Thread.set_daemon # # @@ -74,22 +74,22 @@ class Condition(threading._Condition): # XXX if sys.version_info < (3, 0): - notify_all = threading._Condition.notifyAll.im_func + notify_all = threading._Condition.notify_all.im_func else: - notify_all = threading._Condition.notifyAll + notify_all = threading._Condition.notify_all # # # Process = DummyProcess -current_process = threading.currentThread +current_process = threading.current_thread current_process()._children = weakref.WeakKeyDictionary() def active_children(): children = current_process()._children for p in list(children): - if not p.isAlive(): + if not p.is_alive(): children.pop(p, None) return list(children) Modified: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- python/trunk/Lib/multiprocessing/managers.py (original) +++ python/trunk/Lib/multiprocessing/managers.py Wed Jun 11 19:27:50 2008 @@ -169,7 +169,7 @@ except (OSError, IOError): continue t = threading.Thread(target=self.handle_request, args=(c,)) - t.setDaemon(True) + t.set_daemon(True) t.start() except (KeyboardInterrupt, SystemExit): pass @@ -216,7 +216,7 @@ Handle requests from the proxies in a particular process/thread ''' util.debug('starting server thread to service %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) recv = conn.recv send = conn.send @@ -266,7 +266,7 @@ except EOFError: util.debug('got EOF -- exiting thread serving %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) sys.exit(0) except Exception: @@ -279,7 +279,7 @@ send(('#UNSERIALIZABLE', repr(msg))) except Exception, e: util.info('exception in thread serving %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) util.info(' ... message was %r', msg) util.info(' ... exception was %r', e) conn.close() @@ -401,7 +401,7 @@ ''' Spawn a new thread to serve this connection ''' - threading.currentThread().setName(name) + threading.current_thread().set_name(name) c.send(('#RETURN', None)) self.serve_client(c) @@ -715,8 +715,8 @@ def _connect(self): util.debug('making connection to manager') name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() conn = self._Client(self._token.address, authkey=self._authkey) dispatch(conn, None, 'accept_connection', (name,)) self._tls.connection = conn @@ -729,7 +729,7 @@ conn = self._tls.connection except AttributeError: util.debug('thread %r does not own a connection', - threading.currentThread().getName()) + threading.current_thread().get_name()) self._connect() conn = self._tls.connection @@ -790,7 +790,7 @@ # the process owns no more references to objects for this manager if not idset and hasattr(tls, 'connection'): util.debug('thread %r has no more proxies so closing conn', - threading.currentThread().getName()) + threading.current_thread().get_name()) tls.connection.close() del tls.connection @@ -969,13 +969,13 @@ class ConditionProxy(AcquirerProxy): # XXX will Condition.notfyAll() name be available in Py3.0? - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notifyAll') + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') def wait(self, timeout=None): return self._callmethod('wait', (timeout,)) def notify(self): return self._callmethod('notify') def notify_all(self): - return self._callmethod('notifyAll') + return self._callmethod('notify_all') class EventProxy(BaseProxy): # XXX will Event.isSet name be available in Py3.0? Modified: python/trunk/Lib/multiprocessing/pool.py ============================================================================== --- python/trunk/Lib/multiprocessing/pool.py (original) +++ python/trunk/Lib/multiprocessing/pool.py Wed Jun 11 19:27:50 2008 @@ -107,7 +107,7 @@ target=Pool._handle_tasks, args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) ) - self._task_handler.setDaemon(True) + self._task_handler.set_daemon(True) self._task_handler._state = RUN self._task_handler.start() @@ -115,7 +115,7 @@ target=Pool._handle_results, args=(self._outqueue, self._quick_get, self._cache) ) - self._result_handler.setDaemon(True) + self._result_handler.set_daemon(True) self._result_handler._state = RUN self._result_handler.start() @@ -213,7 +213,7 @@ @staticmethod def _handle_tasks(taskqueue, put, outqueue, pool): - thread = threading.currentThread() + thread = threading.current_thread() for taskseq, set_length in iter(taskqueue.get, None): i = -1 @@ -252,7 +252,7 @@ @staticmethod def _handle_results(outqueue, get, cache): - thread = threading.currentThread() + thread = threading.current_thread() while 1: try: @@ -346,7 +346,7 @@ # task_handler may be blocked trying to put items on inqueue debug('removing tasks from inqueue until task handler finished') inqueue._rlock.acquire() - while task_handler.isAlive() and inqueue._reader.poll(): + while task_handler.is_alive() and inqueue._reader.poll(): inqueue._reader.recv() time.sleep(0) @@ -362,7 +362,7 @@ debug('helping task handler/workers to finish') cls._help_stuff_finish(inqueue, task_handler, len(pool)) - assert result_handler.isAlive() or len(cache) == 0 + assert result_handler.is_alive() or len(cache) == 0 result_handler._state = TERMINATE outqueue.put(None) # sentinel @@ -591,6 +591,6 @@ try: inqueue.queue.clear() inqueue.queue.extend([None] * size) - inqueue.not_empty.notifyAll() + inqueue.not_empty.notify_all() finally: inqueue.not_empty.release() Modified: python/trunk/Lib/multiprocessing/queues.py ============================================================================== --- python/trunk/Lib/multiprocessing/queues.py (original) +++ python/trunk/Lib/multiprocessing/queues.py Wed Jun 11 19:27:50 2008 @@ -155,7 +155,7 @@ self._wlock, self._writer.close), name='QueueFeederThread' ) - self._thread.setDaemon(True) + self._thread.set_daemon(True) debug('doing self._thread.start()') self._thread.start() Modified: python/trunk/Lib/multiprocessing/reduction.py ============================================================================== --- python/trunk/Lib/multiprocessing/reduction.py (original) +++ python/trunk/Lib/multiprocessing/reduction.py Wed Jun 11 19:27:50 2008 @@ -84,7 +84,7 @@ debug('starting listener and thread for sending handles') _listener = Listener(authkey=current_process().get_authkey()) t = threading.Thread(target=_serve) - t.setDaemon(True) + t.set_daemon(True) t.start() finally: _lock.release() Modified: python/trunk/Lib/multiprocessing/synchronize.py ============================================================================== --- python/trunk/Lib/multiprocessing/synchronize.py (original) +++ python/trunk/Lib/multiprocessing/synchronize.py Wed Jun 11 19:27:50 2008 @@ -109,8 +109,8 @@ try: if self._semlock._is_mine(): name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() elif self._semlock._get_value() == 1: name = 'None' elif self._semlock._count() > 0: @@ -134,8 +134,8 @@ try: if self._semlock._is_mine(): name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() count = self._semlock._count() elif self._semlock._get_value() == 1: name, count = 'None', 0 Modified: python/trunk/Lib/test/test_dummy_threading.py ============================================================================== --- python/trunk/Lib/test/test_dummy_threading.py (original) +++ python/trunk/Lib/test/test_dummy_threading.py Wed Jun 11 19:27:50 2008 @@ -16,7 +16,7 @@ #delay = random.random() * 2 delay = 0 if test_support.verbose: - print 'task', self.getName(), 'will run for', delay, 'sec' + print 'task', self.get_name(), 'will run for', delay, 'sec' sema.acquire() mutex.acquire() running += 1 @@ -25,11 +25,11 @@ mutex.release() time.sleep(delay) if test_support.verbose: - print 'task', self.getName(), 'done' + print 'task', self.get_name(), 'done' mutex.acquire() running -= 1 if test_support.verbose: - print self.getName(), 'is finished.', running, 'tasks are running' + print self.get_name(), 'is finished.', running, 'tasks are running' mutex.release() sema.release() Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jun 11 19:27:50 2008 @@ -632,7 +632,7 @@ p.start() p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - p.setDaemon(True) + p.set_daemon(True) p.start() # wait for both children to start sleeping @@ -679,7 +679,7 @@ t = threading.Thread(target=self.f, args=(cond, sleeping, woken, TIMEOUT1)) - t.setDaemon(True) + t.set_daemon(True) t.start() # wait for them all to sleep @@ -701,7 +701,7 @@ p.start() t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - t.setDaemon(True) + t.set_daemon(True) t.start() # wait for them to all sleep Modified: python/trunk/Lib/test/test_queue.py ============================================================================== --- python/trunk/Lib/test/test_queue.py (original) +++ python/trunk/Lib/test/test_queue.py Wed Jun 11 19:27:50 2008 @@ -49,11 +49,11 @@ self.t.start() self.result = block_func(*block_args) # If block_func returned before our thread made the call, we failed! - if not self.t.startedEvent.isSet(): + if not self.t.startedEvent.is_set(): self.fail("blocking function '%r' appeared not to block" % block_func) self.t.join(10) # make sure the thread terminates - if self.t.isAlive(): + if self.t.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) return self.result @@ -73,10 +73,10 @@ expected_exception_class) finally: self.t.join(10) # make sure the thread terminates - if self.t.isAlive(): + if self.t.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) - if not self.t.startedEvent.isSet(): + if not self.t.startedEvent.is_set(): self.fail("trigger thread ended but event never set") Modified: python/trunk/Lib/test/test_smtplib.py ============================================================================== --- python/trunk/Lib/test/test_smtplib.py (original) +++ python/trunk/Lib/test/test_smtplib.py Wed Jun 11 19:27:50 2008 @@ -109,7 +109,7 @@ # when the client conversation is finished, it will # set client_evt, and it's then ok to kill the server - if client_evt.isSet(): + if client_evt.is_set(): serv.close() break @@ -118,7 +118,7 @@ except socket.timeout: pass finally: - if not client_evt.isSet(): + if not client_evt.is_set(): # allow some time for the client to read the result time.sleep(0.5) serv.close() Modified: python/trunk/Lib/test/test_socket.py ============================================================================== --- python/trunk/Lib/test/test_socket.py (original) +++ python/trunk/Lib/test/test_socket.py Wed Jun 11 19:27:50 2008 @@ -107,7 +107,7 @@ self.clientRun, (test_method,)) self.__setUp() - if not self.server_ready.isSet(): + if not self.server_ready.is_set(): self.server_ready.set() self.client_ready.wait() Modified: python/trunk/Lib/test/test_socketserver.py ============================================================================== --- python/trunk/Lib/test/test_socketserver.py (original) +++ python/trunk/Lib/test/test_socketserver.py Wed Jun 11 19:27:50 2008 @@ -139,7 +139,7 @@ # Time between requests is short enough that we won't wake # up spuriously too many times. kwargs={'poll_interval':0.01}) - t.setDaemon(True) # In case this function raises. + t.set_daemon(True) # In case this function raises. t.start() if verbose: print "server running" for i in range(3): Modified: python/trunk/Lib/test/test_threading.py ============================================================================== --- python/trunk/Lib/test/test_threading.py (original) +++ python/trunk/Lib/test/test_threading.py Wed Jun 11 19:27:50 2008 @@ -34,7 +34,7 @@ delay = random.random() / 10000.0 if verbose: print 'task %s will run for %.1f usec' % ( - self.getName(), delay * 1e6) + self.get_name(), delay * 1e6) with self.sema: with self.mutex: @@ -45,14 +45,14 @@ time.sleep(delay) if verbose: - print 'task', self.getName(), 'done' + print 'task', self.get_name(), 'done' with self.mutex: self.nrunning.dec() self.testcase.assert_(self.nrunning.get() >= 0) if verbose: print '%s is finished. %d tasks are running' % ( - self.getName(), self.nrunning.get()) + self.get_name(), self.nrunning.get()) class ThreadTests(unittest.TestCase): @@ -73,7 +73,7 @@ for i in range(NUMTASKS): t = TestThread(""%i, self, sema, mutex, numrunning) threads.append(t) - self.failUnlessEqual(t.getIdent(), None) + self.failUnlessEqual(t.get_ident(), None) self.assert_(re.match('', repr(t))) t.start() @@ -81,8 +81,8 @@ print 'waiting for all tasks to complete' for t in threads: t.join(NUMTASKS) - self.assert_(not t.isAlive()) - self.failIfEqual(t.getIdent(), 0) + self.assert_(not t.is_alive()) + self.failIfEqual(t.get_ident(), 0) self.assert_(re.match('', repr(t))) if verbose: print 'all tasks done' @@ -172,7 +172,7 @@ worker_saw_exception.set() t = Worker() - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown + t.set_daemon(True) # so if this fails, we don't hang Python at shutdown t.start() if verbose: print " started worker thread" @@ -258,12 +258,12 @@ print 'program blocked; aborting' os._exit(2) t = threading.Thread(target=killer) - t.setDaemon(True) + t.set_daemon(True) t.start() # This is the trace function def func(frame, event, arg): - threading.currentThread() + threading.current_thread() return func sys.settrace(func) @@ -348,8 +348,8 @@ self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint) def test_joining_current_thread(self): - currentThread = threading.currentThread() - self.assertRaises(RuntimeError, currentThread.join); + current_thread = threading.current_thread() + self.assertRaises(RuntimeError, current_thread.join); def test_joining_inactive_thread(self): thread = threading.Thread() @@ -358,7 +358,7 @@ def test_daemonize_active_thread(self): thread = threading.Thread() thread.start() - self.assertRaises(RuntimeError, thread.setDaemon, True) + self.assertRaises(RuntimeError, thread.set_daemon, True) def test_main(): Modified: python/trunk/Lib/test/threaded_import_hangers.py ============================================================================== --- python/trunk/Lib/test/threaded_import_hangers.py (original) +++ python/trunk/Lib/test/threaded_import_hangers.py Wed Jun 11 19:27:50 2008 @@ -38,5 +38,5 @@ t = Worker(func, args) t.start() t.join(TIMEOUT) - if t.isAlive(): + if t.is_alive(): errors.append("%s appeared to hang" % name) Modified: python/trunk/Lib/threading.py ============================================================================== --- python/trunk/Lib/threading.py (original) +++ python/trunk/Lib/threading.py Wed Jun 11 19:27:50 2008 @@ -14,7 +14,7 @@ from collections import deque # Rename some stuff so "from threading import *" is safe -__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', +__all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] @@ -52,7 +52,7 @@ if self.__verbose: format = format % args format = "%s: %s\n" % ( - currentThread().getName(), format) + current_thread().get_name(), format) _sys.stderr.write(format) else: @@ -95,11 +95,11 @@ owner = self.__owner return "<%s(%s, %d)>" % ( self.__class__.__name__, - owner and owner.getName(), + owner and owner.get_name(), self.__count) def acquire(self, blocking=1): - me = currentThread() + me = current_thread() if self.__owner is me: self.__count = self.__count + 1 if __debug__: @@ -119,7 +119,7 @@ __enter__ = acquire def release(self): - if self.__owner is not currentThread(): + if self.__owner is not current_thread(): raise RuntimeError("cannot release un-aquired lock") self.__count = count = self.__count - 1 if not count: @@ -154,7 +154,7 @@ return (count, owner) def _is_owned(self): - return self.__owner is currentThread() + return self.__owner is current_thread() def Condition(*args, **kwargs): @@ -203,7 +203,7 @@ self.__lock.acquire() # Ignore saved state def _is_owned(self): - # Return True if lock is owned by currentThread. + # Return True if lock is owned by current_thread. # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0): self.__lock.release() @@ -271,7 +271,7 @@ except ValueError: pass - def notifyAll(self): + def notify_all(self): self.notify(len(self.__waiters)) @@ -350,14 +350,14 @@ self.__cond = Condition(Lock()) self.__flag = False - def isSet(self): + def is_set(self): return self.__flag def set(self): self.__cond.acquire() try: self.__flag = True - self.__cond.notifyAll() + self.__cond.notify_all() finally: self.__cond.release() @@ -425,12 +425,12 @@ def _set_daemon(self): # Overridden in _MainThread and _DummyThread - return currentThread().isDaemon() + return current_thread().is_daemon() def __repr__(self): assert self.__initialized, "Thread.__init__() was not called" status = "initial" - if self.__started.isSet(): + if self.__started.is_set(): status = "started" if self.__stopped: status = "stopped" @@ -443,7 +443,7 @@ def start(self): if not self.__initialized: raise RuntimeError("thread.__init__() not called") - if self.__started.isSet(): + if self.__started.is_set(): raise RuntimeError("thread already started") if __debug__: self._note("%s.start(): starting thread", self) @@ -514,7 +514,7 @@ # self. if _sys: _sys.stderr.write("Exception in thread %s:\n%s\n" % - (self.getName(), _format_exc())) + (self.get_name(), _format_exc())) else: # Do the best job possible w/o a huge amt. of code to # approximate a traceback (code ideas from @@ -522,7 +522,7 @@ exc_type, exc_value, exc_tb = self.__exc_info() try: print>>self.__stderr, ( - "Exception in thread " + self.getName() + + "Exception in thread " + self.get_name() + " (most likely raised during interpreter shutdown):") print>>self.__stderr, ( "Traceback (most recent call last):") @@ -560,7 +560,7 @@ def __stop(self): self.__block.acquire() self.__stopped = True - self.__block.notifyAll() + self.__block.notify_all() self.__block.release() def __delete(self): @@ -593,7 +593,7 @@ # There must not be any python code between the previous line # and after the lock is released. Otherwise a tracing function # could try to acquire the lock again in the same thread, (in - # currentThread()), and would block. + # current_thread()), and would block. except KeyError: if 'dummy_threading' not in _sys.modules: raise @@ -601,9 +601,9 @@ def join(self, timeout=None): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") - if not self.__started.isSet(): + if not self.__started.is_set(): raise RuntimeError("cannot join thread before it is started") - if self is currentThread(): + if self is current_thread(): raise RuntimeError("cannot join current thread") if __debug__: @@ -631,30 +631,30 @@ finally: self.__block.release() - def getName(self): + def get_name(self): assert self.__initialized, "Thread.__init__() not called" return self.__name - def setName(self, name): + def set_name(self, name): assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) - def getIdent(self): + def get_ident(self): assert self.__initialized, "Thread.__init__() not called" return self.__ident - def isAlive(self): + def is_alive(self): assert self.__initialized, "Thread.__init__() not called" - return self.__started.isSet() and not self.__stopped + return self.__started.is_set() and not self.__stopped - def isDaemon(self): + def is_daemon(self): assert self.__initialized, "Thread.__init__() not called" return self.__daemonic - def setDaemon(self, daemonic): + def set_daemon(self, daemonic): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") - if self.__started.isSet(): + if self.__started.is_set(): raise RuntimeError("cannot set daemon status of active thread"); self.__daemonic = daemonic @@ -685,7 +685,7 @@ def run(self): self.finished.wait(self.interval) - if not self.finished.isSet(): + if not self.finished.is_set(): self.function(*self.args, **self.kwargs) self.finished.set() @@ -719,16 +719,16 @@ def _pickSomeNonDaemonThread(): for t in enumerate(): - if not t.isDaemon() and t.isAlive(): + if not t.is_daemon() and t.is_alive(): return t return None # Dummy thread class to represent threads not started here. # These aren't garbage collected when they die, nor can they be waited for. -# If they invoke anything in threading.py that calls currentThread(), they +# If they invoke anything in threading.py that calls current_thread(), they # leave an entry in the _active dict forever after. -# Their purpose is to return *something* from currentThread(). +# Their purpose is to return *something* from current_thread(). # They are marked as daemon threads so we won't wait for them # when we exit (conform previous semantics). @@ -756,14 +756,14 @@ # Global API functions -def currentThread(): +def current_thread(): try: return _active[_get_ident()] except KeyError: - ##print "currentThread(): no current thread for", _get_ident() + ##print "current_thread(): no current thread for", _get_ident() return _DummyThread() -def activeCount(): +def active_count(): _active_limbo_lock.acquire() count = len(_active) + len(_limbo) _active_limbo_lock.release() @@ -840,7 +840,7 @@ counter = 0 while counter < self.quota: counter = counter + 1 - self.queue.put("%s.%d" % (self.getName(), counter)) + self.queue.put("%s.%d" % (self.get_name(), counter)) _sleep(random() * 0.00001) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 19:27:50 2008 @@ -291,6 +291,7 @@ - The bundled OSX-specific copy of libbffi is now in sync with the version shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. + Build ----- From python at rcn.com Wed Jun 11 19:34:58 2008 From: python at rcn.com (Raymond Hettinger) Date: Wed, 11 Jun 2008 10:34:58 -0700 Subject: [Python-checkins] r64125 - in python/trunk:Doc/library/threading.rst Lib/Queue.pyLib/_threading_local.py Lib/logging/__init__.pyLib/multiprocessing/dummy/__init__.pyLib/multiprocessing/managers.py Lib/multiprocessing/pool.pyLib/multiprocessing/queues.p References: <20080611172751.6267A1E4009@bag.python.org> Message-ID: > -.. method:: Thread.setName(name) > +.. method:: Thread.set_same(name) Typo? > -.. method:: Thread.getIdent() > +.. method:: Thread.get_ddent() Typo? Raymond From guido at python.org Wed Jun 11 19:36:41 2008 From: guido at python.org (Guido van Rossum) Date: Wed, 11 Jun 2008 10:36:41 -0700 Subject: [Python-checkins] r64125 - in python/trunk: Doc/library/threading.rst Lib/Queue.py Lib/_threading_local.py Lib/logging/__init__.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessi Message-ID: Eek! Looks like this went too far: the old names were supposed to remain as backwards incompatible aliases! This will break all 3rd party code using threading that worked under 2.5. This is unacceptable. On Wed, Jun 11, 2008 at 10:27 AM, benjamin.peterson wrote: > Author: benjamin.peterson > Date: Wed Jun 11 19:27:50 2008 > New Revision: 64125 > > Log: > give the threading API PEP 8 names > > > Modified: > python/trunk/Doc/library/threading.rst > python/trunk/Lib/Queue.py > python/trunk/Lib/_threading_local.py > python/trunk/Lib/logging/__init__.py > python/trunk/Lib/multiprocessing/dummy/__init__.py > python/trunk/Lib/multiprocessing/managers.py > python/trunk/Lib/multiprocessing/pool.py > python/trunk/Lib/multiprocessing/queues.py > python/trunk/Lib/multiprocessing/reduction.py > python/trunk/Lib/multiprocessing/synchronize.py > python/trunk/Lib/test/test_dummy_threading.py > python/trunk/Lib/test/test_multiprocessing.py > python/trunk/Lib/test/test_queue.py > python/trunk/Lib/test/test_smtplib.py > python/trunk/Lib/test/test_socket.py > python/trunk/Lib/test/test_socketserver.py > python/trunk/Lib/test/test_threading.py > python/trunk/Lib/test/threaded_import_hangers.py > python/trunk/Lib/threading.py > python/trunk/Misc/NEWS > > Modified: python/trunk/Doc/library/threading.rst > ============================================================================== > --- python/trunk/Doc/library/threading.rst (original) > +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:27:50 2008 > @@ -16,7 +16,7 @@ > This module defines the following functions and objects: > > > -.. function:: activeCount() > +.. function:: active_count() > > Return the number of :class:`Thread` objects currently alive. The returned > count is equal to the length of the list returned by :func:`enumerate`. > @@ -30,7 +30,7 @@ > thread. > > > -.. function:: currentThread() > +.. function:: current_thread() > > Return the current :class:`Thread` object, corresponding to the caller's thread > of control. If the caller's thread of control was not created through the > @@ -40,10 +40,10 @@ > > .. function:: enumerate() > > - Return a list of all :class:`Thread` objects currently alive. The list includes > - daemonic threads, dummy thread objects created by :func:`currentThread`, and the > - main thread. It excludes terminated threads and threads that have not yet been > - started. > + Return a list of all :class:`Thread` objects currently alive. The list > + includes daemonic threads, dummy thread objects created by > + :func:`current_thread`, and the main thread. It excludes terminated threads > + and threads that have not yet been started. > > > .. function:: Event() > @@ -395,7 +395,7 @@ > lock, its caller should. > > > -.. method:: Condition.notifyAll() > +.. method:: Condition.notify_all() > > Wake up all threads waiting on this condition. This method acts like > :meth:`notify`, but wakes up all waiting threads instead of one. If the calling > @@ -552,12 +552,12 @@ > thread until the thread whose :meth:`join` method is called is terminated. > > A thread has a name. The name can be passed to the constructor, set with the > -:meth:`setName` method, and retrieved with the :meth:`getName` method. > +:meth:`set_name` method, and retrieved with the :meth:`get_name` method. > > A thread can be flagged as a "daemon thread". The significance of this flag is > that the entire Python program exits when only daemon threads are left. The > initial value is inherited from the creating thread. The flag can be set with > -the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method. > +the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method. > > There is a "main thread" object; this corresponds to the initial thread of > control in the Python program. It is not a daemon thread. > @@ -637,12 +637,12 @@ > raises the same exception. > > > -.. method:: Thread.getName() > +.. method:: Thread.get_name() > > Return the thread's name. > > > -.. method:: Thread.setName(name) > +.. method:: Thread.set_same(name) > > Set the thread's name. > > @@ -651,18 +651,18 @@ > constructor. > > > -.. method:: Thread.getIdent() > +.. method:: Thread.get_ddent() > > Return the 'thread identifier' of this thread or None if the thread has not > - been started. This is a nonzero integer. See the :mod:`thread` module's > - :func:`get_ident()` function. Thread identifiers may be recycled when a > - thread exits and another thread is created. The identifier is returned > - even after the thread has exited. > + been started. This is a nonzero integer. See the :func:`thread.get_ident()` > + function. Thread identifiers may be recycled when a thread exits and another > + thread is created. The identifier is returned even after the thread has > + exited. > > .. versionadded:: 2.6 > > > -.. method:: Thread.isAlive() > +.. method:: Thread.is_alive() > > Return whether the thread is alive. > > @@ -671,12 +671,12 @@ > returns a list of all alive threads. > > > -.. method:: Thread.isDaemon() > +.. method:: Thread.is_daemon() > > Return the thread's daemon flag. > > > -.. method:: Thread.setDaemon(daemonic) > +.. method:: Thread.set_daemon(daemonic) > > Set the thread's daemon flag to the Boolean value *daemonic*. This must be > called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. > > Modified: python/trunk/Lib/Queue.py > ============================================================================== > --- python/trunk/Lib/Queue.py (original) > +++ python/trunk/Lib/Queue.py Wed Jun 11 19:27:50 2008 > @@ -62,7 +62,7 @@ > if unfinished <= 0: > if unfinished < 0: > raise ValueError('task_done() called too many times') > - self.all_tasks_done.notifyAll() > + self.all_tasks_done.notify_all() > self.unfinished_tasks = unfinished > finally: > self.all_tasks_done.release() > > Modified: python/trunk/Lib/_threading_local.py > ============================================================================== > --- python/trunk/Lib/_threading_local.py (original) > +++ python/trunk/Lib/_threading_local.py Wed Jun 11 19:27:50 2008 > @@ -162,16 +162,16 @@ > # __init__ being called, to make sure we don't call it > # again ourselves. > dict = object.__getattribute__(self, '__dict__') > - currentThread().__dict__[key] = dict > + current_thread().__dict__[key] = dict > > return self > > def _patch(self): > key = object.__getattribute__(self, '_local__key') > - d = currentThread().__dict__.get(key) > + d = current_thread().__dict__.get(key) > if d is None: > d = {} > - currentThread().__dict__[key] = d > + current_thread().__dict__[key] = d > object.__setattr__(self, '__dict__', d) > > # we have a new instance dict, so call out __init__ if we have > @@ -238,4 +238,4 @@ > except KeyError: > pass # didn't have anything in this thread > > -from threading import currentThread, RLock > +from threading import current_thread, RLock > > Modified: python/trunk/Lib/logging/__init__.py > ============================================================================== > --- python/trunk/Lib/logging/__init__.py (original) > +++ python/trunk/Lib/logging/__init__.py Wed Jun 11 19:27:50 2008 > @@ -262,7 +262,7 @@ > self.relativeCreated = (self.created - _startTime) * 1000 > if logThreads and thread: > self.thread = thread.get_ident() > - self.threadName = threading.currentThread().getName() > + self.threadName = threading.current_thread().get_name() > else: > self.thread = None > self.threadName = None > > Modified: python/trunk/Lib/multiprocessing/dummy/__init__.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/dummy/__init__.py (original) > +++ python/trunk/Lib/multiprocessing/dummy/__init__.py Wed Jun 11 19:27:50 2008 > @@ -48,24 +48,24 @@ > threading.Thread.start(self) > > def get_exitcode(self): > - if self._start_called and not self.isAlive(): > + if self._start_called and not self.is_alive(): > return 0 > else: > return None > > # XXX > if sys.version_info < (3, 0): > - is_alive = threading.Thread.isAlive.im_func > - get_name = threading.Thread.getName.im_func > - set_name = threading.Thread.setName.im_func > - is_daemon = threading.Thread.isDaemon.im_func > - set_daemon = threading.Thread.setDaemon.im_func > + is_alive = threading.Thread.is_alive.im_func > + get_name = threading.Thread.get_name.im_func > + set_name = threading.Thread.set_name.im_func > + is_daemon = threading.Thread.is_daemon.im_func > + set_daemon = threading.Thread.set_daemon.im_func > else: > - is_alive = threading.Thread.isAlive > - get_name = threading.Thread.getName > - set_name = threading.Thread.setName > - is_daemon = threading.Thread.isDaemon > - set_daemon = threading.Thread.setDaemon > + is_alive = threading.Thread.is_alive > + get_name = threading.Thread.get_name > + set_name = threading.Thread.set_name > + is_daemon = threading.Thread.is_daemon > + set_daemon = threading.Thread.set_daemon > > # > # > @@ -74,22 +74,22 @@ > class Condition(threading._Condition): > # XXX > if sys.version_info < (3, 0): > - notify_all = threading._Condition.notifyAll.im_func > + notify_all = threading._Condition.notify_all.im_func > else: > - notify_all = threading._Condition.notifyAll > + notify_all = threading._Condition.notify_all > > # > # > # > > Process = DummyProcess > -current_process = threading.currentThread > +current_process = threading.current_thread > current_process()._children = weakref.WeakKeyDictionary() > > def active_children(): > children = current_process()._children > for p in list(children): > - if not p.isAlive(): > + if not p.is_alive(): > children.pop(p, None) > return list(children) > > > Modified: python/trunk/Lib/multiprocessing/managers.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/managers.py (original) > +++ python/trunk/Lib/multiprocessing/managers.py Wed Jun 11 19:27:50 2008 > @@ -169,7 +169,7 @@ > except (OSError, IOError): > continue > t = threading.Thread(target=self.handle_request, args=(c,)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > except (KeyboardInterrupt, SystemExit): > pass > @@ -216,7 +216,7 @@ > Handle requests from the proxies in a particular process/thread > ''' > util.debug('starting server thread to service %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > > recv = conn.recv > send = conn.send > @@ -266,7 +266,7 @@ > > except EOFError: > util.debug('got EOF -- exiting thread serving %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > sys.exit(0) > > except Exception: > @@ -279,7 +279,7 @@ > send(('#UNSERIALIZABLE', repr(msg))) > except Exception, e: > util.info('exception in thread serving %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > util.info(' ... message was %r', msg) > util.info(' ... exception was %r', e) > conn.close() > @@ -401,7 +401,7 @@ > ''' > Spawn a new thread to serve this connection > ''' > - threading.currentThread().setName(name) > + threading.current_thread().set_name(name) > c.send(('#RETURN', None)) > self.serve_client(c) > > @@ -715,8 +715,8 @@ > def _connect(self): > util.debug('making connection to manager') > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > conn = self._Client(self._token.address, authkey=self._authkey) > dispatch(conn, None, 'accept_connection', (name,)) > self._tls.connection = conn > @@ -729,7 +729,7 @@ > conn = self._tls.connection > except AttributeError: > util.debug('thread %r does not own a connection', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > self._connect() > conn = self._tls.connection > > @@ -790,7 +790,7 @@ > # the process owns no more references to objects for this manager > if not idset and hasattr(tls, 'connection'): > util.debug('thread %r has no more proxies so closing conn', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > tls.connection.close() > del tls.connection > > @@ -969,13 +969,13 @@ > > class ConditionProxy(AcquirerProxy): > # XXX will Condition.notfyAll() name be available in Py3.0? > - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notifyAll') > + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') > def wait(self, timeout=None): > return self._callmethod('wait', (timeout,)) > def notify(self): > return self._callmethod('notify') > def notify_all(self): > - return self._callmethod('notifyAll') > + return self._callmethod('notify_all') > > class EventProxy(BaseProxy): > # XXX will Event.isSet name be available in Py3.0? > > Modified: python/trunk/Lib/multiprocessing/pool.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/pool.py (original) > +++ python/trunk/Lib/multiprocessing/pool.py Wed Jun 11 19:27:50 2008 > @@ -107,7 +107,7 @@ > target=Pool._handle_tasks, > args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) > ) > - self._task_handler.setDaemon(True) > + self._task_handler.set_daemon(True) > self._task_handler._state = RUN > self._task_handler.start() > > @@ -115,7 +115,7 @@ > target=Pool._handle_results, > args=(self._outqueue, self._quick_get, self._cache) > ) > - self._result_handler.setDaemon(True) > + self._result_handler.set_daemon(True) > self._result_handler._state = RUN > self._result_handler.start() > > @@ -213,7 +213,7 @@ > > @staticmethod > def _handle_tasks(taskqueue, put, outqueue, pool): > - thread = threading.currentThread() > + thread = threading.current_thread() > > for taskseq, set_length in iter(taskqueue.get, None): > i = -1 > @@ -252,7 +252,7 @@ > > @staticmethod > def _handle_results(outqueue, get, cache): > - thread = threading.currentThread() > + thread = threading.current_thread() > > while 1: > try: > @@ -346,7 +346,7 @@ > # task_handler may be blocked trying to put items on inqueue > debug('removing tasks from inqueue until task handler finished') > inqueue._rlock.acquire() > - while task_handler.isAlive() and inqueue._reader.poll(): > + while task_handler.is_alive() and inqueue._reader.poll(): > inqueue._reader.recv() > time.sleep(0) > > @@ -362,7 +362,7 @@ > debug('helping task handler/workers to finish') > cls._help_stuff_finish(inqueue, task_handler, len(pool)) > > - assert result_handler.isAlive() or len(cache) == 0 > + assert result_handler.is_alive() or len(cache) == 0 > > result_handler._state = TERMINATE > outqueue.put(None) # sentinel > @@ -591,6 +591,6 @@ > try: > inqueue.queue.clear() > inqueue.queue.extend([None] * size) > - inqueue.not_empty.notifyAll() > + inqueue.not_empty.notify_all() > finally: > inqueue.not_empty.release() > > Modified: python/trunk/Lib/multiprocessing/queues.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/queues.py (original) > +++ python/trunk/Lib/multiprocessing/queues.py Wed Jun 11 19:27:50 2008 > @@ -155,7 +155,7 @@ > self._wlock, self._writer.close), > name='QueueFeederThread' > ) > - self._thread.setDaemon(True) > + self._thread.set_daemon(True) > > debug('doing self._thread.start()') > self._thread.start() > > Modified: python/trunk/Lib/multiprocessing/reduction.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/reduction.py (original) > +++ python/trunk/Lib/multiprocessing/reduction.py Wed Jun 11 19:27:50 2008 > @@ -84,7 +84,7 @@ > debug('starting listener and thread for sending handles') > _listener = Listener(authkey=current_process().get_authkey()) > t = threading.Thread(target=_serve) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > finally: > _lock.release() > > Modified: python/trunk/Lib/multiprocessing/synchronize.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/synchronize.py (original) > +++ python/trunk/Lib/multiprocessing/synchronize.py Wed Jun 11 19:27:50 2008 > @@ -109,8 +109,8 @@ > try: > if self._semlock._is_mine(): > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > elif self._semlock._get_value() == 1: > name = 'None' > elif self._semlock._count() > 0: > @@ -134,8 +134,8 @@ > try: > if self._semlock._is_mine(): > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > count = self._semlock._count() > elif self._semlock._get_value() == 1: > name, count = 'None', 0 > > Modified: python/trunk/Lib/test/test_dummy_threading.py > ============================================================================== > --- python/trunk/Lib/test/test_dummy_threading.py (original) > +++ python/trunk/Lib/test/test_dummy_threading.py Wed Jun 11 19:27:50 2008 > @@ -16,7 +16,7 @@ > #delay = random.random() * 2 > delay = 0 > if test_support.verbose: > - print 'task', self.getName(), 'will run for', delay, 'sec' > + print 'task', self.get_name(), 'will run for', delay, 'sec' > sema.acquire() > mutex.acquire() > running += 1 > @@ -25,11 +25,11 @@ > mutex.release() > time.sleep(delay) > if test_support.verbose: > - print 'task', self.getName(), 'done' > + print 'task', self.get_name(), 'done' > mutex.acquire() > running -= 1 > if test_support.verbose: > - print self.getName(), 'is finished.', running, 'tasks are running' > + print self.get_name(), 'is finished.', running, 'tasks are running' > mutex.release() > sema.release() > > > Modified: python/trunk/Lib/test/test_multiprocessing.py > ============================================================================== > --- python/trunk/Lib/test/test_multiprocessing.py (original) > +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jun 11 19:27:50 2008 > @@ -632,7 +632,7 @@ > p.start() > > p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) > - p.setDaemon(True) > + p.set_daemon(True) > p.start() > > # wait for both children to start sleeping > @@ -679,7 +679,7 @@ > > t = threading.Thread(target=self.f, > args=(cond, sleeping, woken, TIMEOUT1)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # wait for them all to sleep > @@ -701,7 +701,7 @@ > p.start() > > t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # wait for them to all sleep > > Modified: python/trunk/Lib/test/test_queue.py > ============================================================================== > --- python/trunk/Lib/test/test_queue.py (original) > +++ python/trunk/Lib/test/test_queue.py Wed Jun 11 19:27:50 2008 > @@ -49,11 +49,11 @@ > self.t.start() > self.result = block_func(*block_args) > # If block_func returned before our thread made the call, we failed! > - if not self.t.startedEvent.isSet(): > + if not self.t.startedEvent.is_set(): > self.fail("blocking function '%r' appeared not to block" % > block_func) > self.t.join(10) # make sure the thread terminates > - if self.t.isAlive(): > + if self.t.is_alive(): > self.fail("trigger function '%r' appeared to not return" % > trigger_func) > return self.result > @@ -73,10 +73,10 @@ > expected_exception_class) > finally: > self.t.join(10) # make sure the thread terminates > - if self.t.isAlive(): > + if self.t.is_alive(): > self.fail("trigger function '%r' appeared to not return" % > trigger_func) > - if not self.t.startedEvent.isSet(): > + if not self.t.startedEvent.is_set(): > self.fail("trigger thread ended but event never set") > > > > Modified: python/trunk/Lib/test/test_smtplib.py > ============================================================================== > --- python/trunk/Lib/test/test_smtplib.py (original) > +++ python/trunk/Lib/test/test_smtplib.py Wed Jun 11 19:27:50 2008 > @@ -109,7 +109,7 @@ > > # when the client conversation is finished, it will > # set client_evt, and it's then ok to kill the server > - if client_evt.isSet(): > + if client_evt.is_set(): > serv.close() > break > > @@ -118,7 +118,7 @@ > except socket.timeout: > pass > finally: > - if not client_evt.isSet(): > + if not client_evt.is_set(): > # allow some time for the client to read the result > time.sleep(0.5) > serv.close() > > Modified: python/trunk/Lib/test/test_socket.py > ============================================================================== > --- python/trunk/Lib/test/test_socket.py (original) > +++ python/trunk/Lib/test/test_socket.py Wed Jun 11 19:27:50 2008 > @@ -107,7 +107,7 @@ > self.clientRun, (test_method,)) > > self.__setUp() > - if not self.server_ready.isSet(): > + if not self.server_ready.is_set(): > self.server_ready.set() > self.client_ready.wait() > > > Modified: python/trunk/Lib/test/test_socketserver.py > ============================================================================== > --- python/trunk/Lib/test/test_socketserver.py (original) > +++ python/trunk/Lib/test/test_socketserver.py Wed Jun 11 19:27:50 2008 > @@ -139,7 +139,7 @@ > # Time between requests is short enough that we won't wake > # up spuriously too many times. > kwargs={'poll_interval':0.01}) > - t.setDaemon(True) # In case this function raises. > + t.set_daemon(True) # In case this function raises. > t.start() > if verbose: print "server running" > for i in range(3): > > Modified: python/trunk/Lib/test/test_threading.py > ============================================================================== > --- python/trunk/Lib/test/test_threading.py (original) > +++ python/trunk/Lib/test/test_threading.py Wed Jun 11 19:27:50 2008 > @@ -34,7 +34,7 @@ > delay = random.random() / 10000.0 > if verbose: > print 'task %s will run for %.1f usec' % ( > - self.getName(), delay * 1e6) > + self.get_name(), delay * 1e6) > > with self.sema: > with self.mutex: > @@ -45,14 +45,14 @@ > > time.sleep(delay) > if verbose: > - print 'task', self.getName(), 'done' > + print 'task', self.get_name(), 'done' > > with self.mutex: > self.nrunning.dec() > self.testcase.assert_(self.nrunning.get() >= 0) > if verbose: > print '%s is finished. %d tasks are running' % ( > - self.getName(), self.nrunning.get()) > + self.get_name(), self.nrunning.get()) > > class ThreadTests(unittest.TestCase): > > @@ -73,7 +73,7 @@ > for i in range(NUMTASKS): > t = TestThread(""%i, self, sema, mutex, numrunning) > threads.append(t) > - self.failUnlessEqual(t.getIdent(), None) > + self.failUnlessEqual(t.get_ident(), None) > self.assert_(re.match('', repr(t))) > t.start() > > @@ -81,8 +81,8 @@ > print 'waiting for all tasks to complete' > for t in threads: > t.join(NUMTASKS) > - self.assert_(not t.isAlive()) > - self.failIfEqual(t.getIdent(), 0) > + self.assert_(not t.is_alive()) > + self.failIfEqual(t.get_ident(), 0) > self.assert_(re.match('', repr(t))) > if verbose: > print 'all tasks done' > @@ -172,7 +172,7 @@ > worker_saw_exception.set() > > t = Worker() > - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown > + t.set_daemon(True) # so if this fails, we don't hang Python at shutdown > t.start() > if verbose: > print " started worker thread" > @@ -258,12 +258,12 @@ > print 'program blocked; aborting' > os._exit(2) > t = threading.Thread(target=killer) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # This is the trace function > def func(frame, event, arg): > - threading.currentThread() > + threading.current_thread() > return func > > sys.settrace(func) > @@ -348,8 +348,8 @@ > self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint) > > def test_joining_current_thread(self): > - currentThread = threading.currentThread() > - self.assertRaises(RuntimeError, currentThread.join); > + current_thread = threading.current_thread() > + self.assertRaises(RuntimeError, current_thread.join); > > def test_joining_inactive_thread(self): > thread = threading.Thread() > @@ -358,7 +358,7 @@ > def test_daemonize_active_thread(self): > thread = threading.Thread() > thread.start() > - self.assertRaises(RuntimeError, thread.setDaemon, True) > + self.assertRaises(RuntimeError, thread.set_daemon, True) > > > def test_main(): > > Modified: python/trunk/Lib/test/threaded_import_hangers.py > ============================================================================== > --- python/trunk/Lib/test/threaded_import_hangers.py (original) > +++ python/trunk/Lib/test/threaded_import_hangers.py Wed Jun 11 19:27:50 2008 > @@ -38,5 +38,5 @@ > t = Worker(func, args) > t.start() > t.join(TIMEOUT) > - if t.isAlive(): > + if t.is_alive(): > errors.append("%s appeared to hang" % name) > > Modified: python/trunk/Lib/threading.py > ============================================================================== > --- python/trunk/Lib/threading.py (original) > +++ python/trunk/Lib/threading.py Wed Jun 11 19:27:50 2008 > @@ -14,7 +14,7 @@ > from collections import deque > > # Rename some stuff so "from threading import *" is safe > -__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', > +__all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', > 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', > 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] > > @@ -52,7 +52,7 @@ > if self.__verbose: > format = format % args > format = "%s: %s\n" % ( > - currentThread().getName(), format) > + current_thread().get_name(), format) > _sys.stderr.write(format) > > else: > @@ -95,11 +95,11 @@ > owner = self.__owner > return "<%s(%s, %d)>" % ( > self.__class__.__name__, > - owner and owner.getName(), > + owner and owner.get_name(), > self.__count) > > def acquire(self, blocking=1): > - me = currentThread() > + me = current_thread() > if self.__owner is me: > self.__count = self.__count + 1 > if __debug__: > @@ -119,7 +119,7 @@ > __enter__ = acquire > > def release(self): > - if self.__owner is not currentThread(): > + if self.__owner is not current_thread(): > raise RuntimeError("cannot release un-aquired lock") > self.__count = count = self.__count - 1 > if not count: > @@ -154,7 +154,7 @@ > return (count, owner) > > def _is_owned(self): > - return self.__owner is currentThread() > + return self.__owner is current_thread() > > > def Condition(*args, **kwargs): > @@ -203,7 +203,7 @@ > self.__lock.acquire() # Ignore saved state > > def _is_owned(self): > - # Return True if lock is owned by currentThread. > + # Return True if lock is owned by current_thread. > # This method is called only if __lock doesn't have _is_owned(). > if self.__lock.acquire(0): > self.__lock.release() > @@ -271,7 +271,7 @@ > except ValueError: > pass > > - def notifyAll(self): > + def notify_all(self): > self.notify(len(self.__waiters)) > > > @@ -350,14 +350,14 @@ > self.__cond = Condition(Lock()) > self.__flag = False > > - def isSet(self): > + def is_set(self): > return self.__flag > > def set(self): > self.__cond.acquire() > try: > self.__flag = True > - self.__cond.notifyAll() > + self.__cond.notify_all() > finally: > self.__cond.release() > > @@ -425,12 +425,12 @@ > > def _set_daemon(self): > # Overridden in _MainThread and _DummyThread > - return currentThread().isDaemon() > + return current_thread().is_daemon() > > def __repr__(self): > assert self.__initialized, "Thread.__init__() was not called" > status = "initial" > - if self.__started.isSet(): > + if self.__started.is_set(): > status = "started" > if self.__stopped: > status = "stopped" > @@ -443,7 +443,7 @@ > def start(self): > if not self.__initialized: > raise RuntimeError("thread.__init__() not called") > - if self.__started.isSet(): > + if self.__started.is_set(): > raise RuntimeError("thread already started") > if __debug__: > self._note("%s.start(): starting thread", self) > @@ -514,7 +514,7 @@ > # self. > if _sys: > _sys.stderr.write("Exception in thread %s:\n%s\n" % > - (self.getName(), _format_exc())) > + (self.get_name(), _format_exc())) > else: > # Do the best job possible w/o a huge amt. of code to > # approximate a traceback (code ideas from > @@ -522,7 +522,7 @@ > exc_type, exc_value, exc_tb = self.__exc_info() > try: > print>>self.__stderr, ( > - "Exception in thread " + self.getName() + > + "Exception in thread " + self.get_name() + > " (most likely raised during interpreter shutdown):") > print>>self.__stderr, ( > "Traceback (most recent call last):") > @@ -560,7 +560,7 @@ > def __stop(self): > self.__block.acquire() > self.__stopped = True > - self.__block.notifyAll() > + self.__block.notify_all() > self.__block.release() > > def __delete(self): > @@ -593,7 +593,7 @@ > # There must not be any python code between the previous line > # and after the lock is released. Otherwise a tracing function > # could try to acquire the lock again in the same thread, (in > - # currentThread()), and would block. > + # current_thread()), and would block. > except KeyError: > if 'dummy_threading' not in _sys.modules: > raise > @@ -601,9 +601,9 @@ > def join(self, timeout=None): > if not self.__initialized: > raise RuntimeError("Thread.__init__() not called") > - if not self.__started.isSet(): > + if not self.__started.is_set(): > raise RuntimeError("cannot join thread before it is started") > - if self is currentThread(): > + if self is current_thread(): > raise RuntimeError("cannot join current thread") > > if __debug__: > @@ -631,30 +631,30 @@ > finally: > self.__block.release() > > - def getName(self): > + def get_name(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__name > > - def setName(self, name): > + def set_name(self, name): > assert self.__initialized, "Thread.__init__() not called" > self.__name = str(name) > > - def getIdent(self): > + def get_ident(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__ident > > - def isAlive(self): > + def is_alive(self): > assert self.__initialized, "Thread.__init__() not called" > - return self.__started.isSet() and not self.__stopped > + return self.__started.is_set() and not self.__stopped > > - def isDaemon(self): > + def is_daemon(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__daemonic > > - def setDaemon(self, daemonic): > + def set_daemon(self, daemonic): > if not self.__initialized: > raise RuntimeError("Thread.__init__() not called") > - if self.__started.isSet(): > + if self.__started.is_set(): > raise RuntimeError("cannot set daemon status of active thread"); > self.__daemonic = daemonic > > @@ -685,7 +685,7 @@ > > def run(self): > self.finished.wait(self.interval) > - if not self.finished.isSet(): > + if not self.finished.is_set(): > self.function(*self.args, **self.kwargs) > self.finished.set() > > @@ -719,16 +719,16 @@ > > def _pickSomeNonDaemonThread(): > for t in enumerate(): > - if not t.isDaemon() and t.isAlive(): > + if not t.is_daemon() and t.is_alive(): > return t > return None > > > # Dummy thread class to represent threads not started here. > # These aren't garbage collected when they die, nor can they be waited for. > -# If they invoke anything in threading.py that calls currentThread(), they > +# If they invoke anything in threading.py that calls current_thread(), they > # leave an entry in the _active dict forever after. > -# Their purpose is to return *something* from currentThread(). > +# Their purpose is to return *something* from current_thread(). > # They are marked as daemon threads so we won't wait for them > # when we exit (conform previous semantics). > > @@ -756,14 +756,14 @@ > > # Global API functions > > -def currentThread(): > +def current_thread(): > try: > return _active[_get_ident()] > except KeyError: > - ##print "currentThread(): no current thread for", _get_ident() > + ##print "current_thread(): no current thread for", _get_ident() > return _DummyThread() > > -def activeCount(): > +def active_count(): > _active_limbo_lock.acquire() > count = len(_active) + len(_limbo) > _active_limbo_lock.release() > @@ -840,7 +840,7 @@ > counter = 0 > while counter < self.quota: > counter = counter + 1 > - self.queue.put("%s.%d" % (self.getName(), counter)) > + self.queue.put("%s.%d" % (self.get_name(), counter)) > _sleep(random() * 0.00001) > > > > Modified: python/trunk/Misc/NEWS > ============================================================================== > --- python/trunk/Misc/NEWS (original) > +++ python/trunk/Misc/NEWS Wed Jun 11 19:27:50 2008 > @@ -291,6 +291,7 @@ > - The bundled OSX-specific copy of libbffi is now in sync with the version > shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. > > + > Build > ----- > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From guido at python.org Wed Jun 11 19:37:28 2008 From: guido at python.org (Guido van Rossum) Date: Wed, 11 Jun 2008 10:37:28 -0700 Subject: [Python-checkins] r64125 - in python/trunk: Doc/library/threading.rst Lib/Queue.py Lib/_threading_local.py Lib/logging/__init__.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessi Message-ID: Also looks like you didn't add actually anything to the NEWS file. Sloppy work! On Wed, Jun 11, 2008 at 10:27 AM, benjamin.peterson wrote: > Author: benjamin.peterson > Date: Wed Jun 11 19:27:50 2008 > New Revision: 64125 > > Log: > give the threading API PEP 8 names > > > Modified: > python/trunk/Doc/library/threading.rst > python/trunk/Lib/Queue.py > python/trunk/Lib/_threading_local.py > python/trunk/Lib/logging/__init__.py > python/trunk/Lib/multiprocessing/dummy/__init__.py > python/trunk/Lib/multiprocessing/managers.py > python/trunk/Lib/multiprocessing/pool.py > python/trunk/Lib/multiprocessing/queues.py > python/trunk/Lib/multiprocessing/reduction.py > python/trunk/Lib/multiprocessing/synchronize.py > python/trunk/Lib/test/test_dummy_threading.py > python/trunk/Lib/test/test_multiprocessing.py > python/trunk/Lib/test/test_queue.py > python/trunk/Lib/test/test_smtplib.py > python/trunk/Lib/test/test_socket.py > python/trunk/Lib/test/test_socketserver.py > python/trunk/Lib/test/test_threading.py > python/trunk/Lib/test/threaded_import_hangers.py > python/trunk/Lib/threading.py > python/trunk/Misc/NEWS > > Modified: python/trunk/Doc/library/threading.rst > ============================================================================== > --- python/trunk/Doc/library/threading.rst (original) > +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:27:50 2008 > @@ -16,7 +16,7 @@ > This module defines the following functions and objects: > > > -.. function:: activeCount() > +.. function:: active_count() > > Return the number of :class:`Thread` objects currently alive. The returned > count is equal to the length of the list returned by :func:`enumerate`. > @@ -30,7 +30,7 @@ > thread. > > > -.. function:: currentThread() > +.. function:: current_thread() > > Return the current :class:`Thread` object, corresponding to the caller's thread > of control. If the caller's thread of control was not created through the > @@ -40,10 +40,10 @@ > > .. function:: enumerate() > > - Return a list of all :class:`Thread` objects currently alive. The list includes > - daemonic threads, dummy thread objects created by :func:`currentThread`, and the > - main thread. It excludes terminated threads and threads that have not yet been > - started. > + Return a list of all :class:`Thread` objects currently alive. The list > + includes daemonic threads, dummy thread objects created by > + :func:`current_thread`, and the main thread. It excludes terminated threads > + and threads that have not yet been started. > > > .. function:: Event() > @@ -395,7 +395,7 @@ > lock, its caller should. > > > -.. method:: Condition.notifyAll() > +.. method:: Condition.notify_all() > > Wake up all threads waiting on this condition. This method acts like > :meth:`notify`, but wakes up all waiting threads instead of one. If the calling > @@ -552,12 +552,12 @@ > thread until the thread whose :meth:`join` method is called is terminated. > > A thread has a name. The name can be passed to the constructor, set with the > -:meth:`setName` method, and retrieved with the :meth:`getName` method. > +:meth:`set_name` method, and retrieved with the :meth:`get_name` method. > > A thread can be flagged as a "daemon thread". The significance of this flag is > that the entire Python program exits when only daemon threads are left. The > initial value is inherited from the creating thread. The flag can be set with > -the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method. > +the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method. > > There is a "main thread" object; this corresponds to the initial thread of > control in the Python program. It is not a daemon thread. > @@ -637,12 +637,12 @@ > raises the same exception. > > > -.. method:: Thread.getName() > +.. method:: Thread.get_name() > > Return the thread's name. > > > -.. method:: Thread.setName(name) > +.. method:: Thread.set_same(name) > > Set the thread's name. > > @@ -651,18 +651,18 @@ > constructor. > > > -.. method:: Thread.getIdent() > +.. method:: Thread.get_ddent() > > Return the 'thread identifier' of this thread or None if the thread has not > - been started. This is a nonzero integer. See the :mod:`thread` module's > - :func:`get_ident()` function. Thread identifiers may be recycled when a > - thread exits and another thread is created. The identifier is returned > - even after the thread has exited. > + been started. This is a nonzero integer. See the :func:`thread.get_ident()` > + function. Thread identifiers may be recycled when a thread exits and another > + thread is created. The identifier is returned even after the thread has > + exited. > > .. versionadded:: 2.6 > > > -.. method:: Thread.isAlive() > +.. method:: Thread.is_alive() > > Return whether the thread is alive. > > @@ -671,12 +671,12 @@ > returns a list of all alive threads. > > > -.. method:: Thread.isDaemon() > +.. method:: Thread.is_daemon() > > Return the thread's daemon flag. > > > -.. method:: Thread.setDaemon(daemonic) > +.. method:: Thread.set_daemon(daemonic) > > Set the thread's daemon flag to the Boolean value *daemonic*. This must be > called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. > > Modified: python/trunk/Lib/Queue.py > ============================================================================== > --- python/trunk/Lib/Queue.py (original) > +++ python/trunk/Lib/Queue.py Wed Jun 11 19:27:50 2008 > @@ -62,7 +62,7 @@ > if unfinished <= 0: > if unfinished < 0: > raise ValueError('task_done() called too many times') > - self.all_tasks_done.notifyAll() > + self.all_tasks_done.notify_all() > self.unfinished_tasks = unfinished > finally: > self.all_tasks_done.release() > > Modified: python/trunk/Lib/_threading_local.py > ============================================================================== > --- python/trunk/Lib/_threading_local.py (original) > +++ python/trunk/Lib/_threading_local.py Wed Jun 11 19:27:50 2008 > @@ -162,16 +162,16 @@ > # __init__ being called, to make sure we don't call it > # again ourselves. > dict = object.__getattribute__(self, '__dict__') > - currentThread().__dict__[key] = dict > + current_thread().__dict__[key] = dict > > return self > > def _patch(self): > key = object.__getattribute__(self, '_local__key') > - d = currentThread().__dict__.get(key) > + d = current_thread().__dict__.get(key) > if d is None: > d = {} > - currentThread().__dict__[key] = d > + current_thread().__dict__[key] = d > object.__setattr__(self, '__dict__', d) > > # we have a new instance dict, so call out __init__ if we have > @@ -238,4 +238,4 @@ > except KeyError: > pass # didn't have anything in this thread > > -from threading import currentThread, RLock > +from threading import current_thread, RLock > > Modified: python/trunk/Lib/logging/__init__.py > ============================================================================== > --- python/trunk/Lib/logging/__init__.py (original) > +++ python/trunk/Lib/logging/__init__.py Wed Jun 11 19:27:50 2008 > @@ -262,7 +262,7 @@ > self.relativeCreated = (self.created - _startTime) * 1000 > if logThreads and thread: > self.thread = thread.get_ident() > - self.threadName = threading.currentThread().getName() > + self.threadName = threading.current_thread().get_name() > else: > self.thread = None > self.threadName = None > > Modified: python/trunk/Lib/multiprocessing/dummy/__init__.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/dummy/__init__.py (original) > +++ python/trunk/Lib/multiprocessing/dummy/__init__.py Wed Jun 11 19:27:50 2008 > @@ -48,24 +48,24 @@ > threading.Thread.start(self) > > def get_exitcode(self): > - if self._start_called and not self.isAlive(): > + if self._start_called and not self.is_alive(): > return 0 > else: > return None > > # XXX > if sys.version_info < (3, 0): > - is_alive = threading.Thread.isAlive.im_func > - get_name = threading.Thread.getName.im_func > - set_name = threading.Thread.setName.im_func > - is_daemon = threading.Thread.isDaemon.im_func > - set_daemon = threading.Thread.setDaemon.im_func > + is_alive = threading.Thread.is_alive.im_func > + get_name = threading.Thread.get_name.im_func > + set_name = threading.Thread.set_name.im_func > + is_daemon = threading.Thread.is_daemon.im_func > + set_daemon = threading.Thread.set_daemon.im_func > else: > - is_alive = threading.Thread.isAlive > - get_name = threading.Thread.getName > - set_name = threading.Thread.setName > - is_daemon = threading.Thread.isDaemon > - set_daemon = threading.Thread.setDaemon > + is_alive = threading.Thread.is_alive > + get_name = threading.Thread.get_name > + set_name = threading.Thread.set_name > + is_daemon = threading.Thread.is_daemon > + set_daemon = threading.Thread.set_daemon > > # > # > @@ -74,22 +74,22 @@ > class Condition(threading._Condition): > # XXX > if sys.version_info < (3, 0): > - notify_all = threading._Condition.notifyAll.im_func > + notify_all = threading._Condition.notify_all.im_func > else: > - notify_all = threading._Condition.notifyAll > + notify_all = threading._Condition.notify_all > > # > # > # > > Process = DummyProcess > -current_process = threading.currentThread > +current_process = threading.current_thread > current_process()._children = weakref.WeakKeyDictionary() > > def active_children(): > children = current_process()._children > for p in list(children): > - if not p.isAlive(): > + if not p.is_alive(): > children.pop(p, None) > return list(children) > > > Modified: python/trunk/Lib/multiprocessing/managers.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/managers.py (original) > +++ python/trunk/Lib/multiprocessing/managers.py Wed Jun 11 19:27:50 2008 > @@ -169,7 +169,7 @@ > except (OSError, IOError): > continue > t = threading.Thread(target=self.handle_request, args=(c,)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > except (KeyboardInterrupt, SystemExit): > pass > @@ -216,7 +216,7 @@ > Handle requests from the proxies in a particular process/thread > ''' > util.debug('starting server thread to service %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > > recv = conn.recv > send = conn.send > @@ -266,7 +266,7 @@ > > except EOFError: > util.debug('got EOF -- exiting thread serving %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > sys.exit(0) > > except Exception: > @@ -279,7 +279,7 @@ > send(('#UNSERIALIZABLE', repr(msg))) > except Exception, e: > util.info('exception in thread serving %r', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > util.info(' ... message was %r', msg) > util.info(' ... exception was %r', e) > conn.close() > @@ -401,7 +401,7 @@ > ''' > Spawn a new thread to serve this connection > ''' > - threading.currentThread().setName(name) > + threading.current_thread().set_name(name) > c.send(('#RETURN', None)) > self.serve_client(c) > > @@ -715,8 +715,8 @@ > def _connect(self): > util.debug('making connection to manager') > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > conn = self._Client(self._token.address, authkey=self._authkey) > dispatch(conn, None, 'accept_connection', (name,)) > self._tls.connection = conn > @@ -729,7 +729,7 @@ > conn = self._tls.connection > except AttributeError: > util.debug('thread %r does not own a connection', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > self._connect() > conn = self._tls.connection > > @@ -790,7 +790,7 @@ > # the process owns no more references to objects for this manager > if not idset and hasattr(tls, 'connection'): > util.debug('thread %r has no more proxies so closing conn', > - threading.currentThread().getName()) > + threading.current_thread().get_name()) > tls.connection.close() > del tls.connection > > @@ -969,13 +969,13 @@ > > class ConditionProxy(AcquirerProxy): > # XXX will Condition.notfyAll() name be available in Py3.0? > - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notifyAll') > + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') > def wait(self, timeout=None): > return self._callmethod('wait', (timeout,)) > def notify(self): > return self._callmethod('notify') > def notify_all(self): > - return self._callmethod('notifyAll') > + return self._callmethod('notify_all') > > class EventProxy(BaseProxy): > # XXX will Event.isSet name be available in Py3.0? > > Modified: python/trunk/Lib/multiprocessing/pool.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/pool.py (original) > +++ python/trunk/Lib/multiprocessing/pool.py Wed Jun 11 19:27:50 2008 > @@ -107,7 +107,7 @@ > target=Pool._handle_tasks, > args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) > ) > - self._task_handler.setDaemon(True) > + self._task_handler.set_daemon(True) > self._task_handler._state = RUN > self._task_handler.start() > > @@ -115,7 +115,7 @@ > target=Pool._handle_results, > args=(self._outqueue, self._quick_get, self._cache) > ) > - self._result_handler.setDaemon(True) > + self._result_handler.set_daemon(True) > self._result_handler._state = RUN > self._result_handler.start() > > @@ -213,7 +213,7 @@ > > @staticmethod > def _handle_tasks(taskqueue, put, outqueue, pool): > - thread = threading.currentThread() > + thread = threading.current_thread() > > for taskseq, set_length in iter(taskqueue.get, None): > i = -1 > @@ -252,7 +252,7 @@ > > @staticmethod > def _handle_results(outqueue, get, cache): > - thread = threading.currentThread() > + thread = threading.current_thread() > > while 1: > try: > @@ -346,7 +346,7 @@ > # task_handler may be blocked trying to put items on inqueue > debug('removing tasks from inqueue until task handler finished') > inqueue._rlock.acquire() > - while task_handler.isAlive() and inqueue._reader.poll(): > + while task_handler.is_alive() and inqueue._reader.poll(): > inqueue._reader.recv() > time.sleep(0) > > @@ -362,7 +362,7 @@ > debug('helping task handler/workers to finish') > cls._help_stuff_finish(inqueue, task_handler, len(pool)) > > - assert result_handler.isAlive() or len(cache) == 0 > + assert result_handler.is_alive() or len(cache) == 0 > > result_handler._state = TERMINATE > outqueue.put(None) # sentinel > @@ -591,6 +591,6 @@ > try: > inqueue.queue.clear() > inqueue.queue.extend([None] * size) > - inqueue.not_empty.notifyAll() > + inqueue.not_empty.notify_all() > finally: > inqueue.not_empty.release() > > Modified: python/trunk/Lib/multiprocessing/queues.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/queues.py (original) > +++ python/trunk/Lib/multiprocessing/queues.py Wed Jun 11 19:27:50 2008 > @@ -155,7 +155,7 @@ > self._wlock, self._writer.close), > name='QueueFeederThread' > ) > - self._thread.setDaemon(True) > + self._thread.set_daemon(True) > > debug('doing self._thread.start()') > self._thread.start() > > Modified: python/trunk/Lib/multiprocessing/reduction.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/reduction.py (original) > +++ python/trunk/Lib/multiprocessing/reduction.py Wed Jun 11 19:27:50 2008 > @@ -84,7 +84,7 @@ > debug('starting listener and thread for sending handles') > _listener = Listener(authkey=current_process().get_authkey()) > t = threading.Thread(target=_serve) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > finally: > _lock.release() > > Modified: python/trunk/Lib/multiprocessing/synchronize.py > ============================================================================== > --- python/trunk/Lib/multiprocessing/synchronize.py (original) > +++ python/trunk/Lib/multiprocessing/synchronize.py Wed Jun 11 19:27:50 2008 > @@ -109,8 +109,8 @@ > try: > if self._semlock._is_mine(): > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > elif self._semlock._get_value() == 1: > name = 'None' > elif self._semlock._count() > 0: > @@ -134,8 +134,8 @@ > try: > if self._semlock._is_mine(): > name = current_process().get_name() > - if threading.currentThread().getName() != 'MainThread': > - name += '|' + threading.currentThread().getName() > + if threading.current_thread().get_name() != 'MainThread': > + name += '|' + threading.current_thread().get_name() > count = self._semlock._count() > elif self._semlock._get_value() == 1: > name, count = 'None', 0 > > Modified: python/trunk/Lib/test/test_dummy_threading.py > ============================================================================== > --- python/trunk/Lib/test/test_dummy_threading.py (original) > +++ python/trunk/Lib/test/test_dummy_threading.py Wed Jun 11 19:27:50 2008 > @@ -16,7 +16,7 @@ > #delay = random.random() * 2 > delay = 0 > if test_support.verbose: > - print 'task', self.getName(), 'will run for', delay, 'sec' > + print 'task', self.get_name(), 'will run for', delay, 'sec' > sema.acquire() > mutex.acquire() > running += 1 > @@ -25,11 +25,11 @@ > mutex.release() > time.sleep(delay) > if test_support.verbose: > - print 'task', self.getName(), 'done' > + print 'task', self.get_name(), 'done' > mutex.acquire() > running -= 1 > if test_support.verbose: > - print self.getName(), 'is finished.', running, 'tasks are running' > + print self.get_name(), 'is finished.', running, 'tasks are running' > mutex.release() > sema.release() > > > Modified: python/trunk/Lib/test/test_multiprocessing.py > ============================================================================== > --- python/trunk/Lib/test/test_multiprocessing.py (original) > +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jun 11 19:27:50 2008 > @@ -632,7 +632,7 @@ > p.start() > > p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) > - p.setDaemon(True) > + p.set_daemon(True) > p.start() > > # wait for both children to start sleeping > @@ -679,7 +679,7 @@ > > t = threading.Thread(target=self.f, > args=(cond, sleeping, woken, TIMEOUT1)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # wait for them all to sleep > @@ -701,7 +701,7 @@ > p.start() > > t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # wait for them to all sleep > > Modified: python/trunk/Lib/test/test_queue.py > ============================================================================== > --- python/trunk/Lib/test/test_queue.py (original) > +++ python/trunk/Lib/test/test_queue.py Wed Jun 11 19:27:50 2008 > @@ -49,11 +49,11 @@ > self.t.start() > self.result = block_func(*block_args) > # If block_func returned before our thread made the call, we failed! > - if not self.t.startedEvent.isSet(): > + if not self.t.startedEvent.is_set(): > self.fail("blocking function '%r' appeared not to block" % > block_func) > self.t.join(10) # make sure the thread terminates > - if self.t.isAlive(): > + if self.t.is_alive(): > self.fail("trigger function '%r' appeared to not return" % > trigger_func) > return self.result > @@ -73,10 +73,10 @@ > expected_exception_class) > finally: > self.t.join(10) # make sure the thread terminates > - if self.t.isAlive(): > + if self.t.is_alive(): > self.fail("trigger function '%r' appeared to not return" % > trigger_func) > - if not self.t.startedEvent.isSet(): > + if not self.t.startedEvent.is_set(): > self.fail("trigger thread ended but event never set") > > > > Modified: python/trunk/Lib/test/test_smtplib.py > ============================================================================== > --- python/trunk/Lib/test/test_smtplib.py (original) > +++ python/trunk/Lib/test/test_smtplib.py Wed Jun 11 19:27:50 2008 > @@ -109,7 +109,7 @@ > > # when the client conversation is finished, it will > # set client_evt, and it's then ok to kill the server > - if client_evt.isSet(): > + if client_evt.is_set(): > serv.close() > break > > @@ -118,7 +118,7 @@ > except socket.timeout: > pass > finally: > - if not client_evt.isSet(): > + if not client_evt.is_set(): > # allow some time for the client to read the result > time.sleep(0.5) > serv.close() > > Modified: python/trunk/Lib/test/test_socket.py > ============================================================================== > --- python/trunk/Lib/test/test_socket.py (original) > +++ python/trunk/Lib/test/test_socket.py Wed Jun 11 19:27:50 2008 > @@ -107,7 +107,7 @@ > self.clientRun, (test_method,)) > > self.__setUp() > - if not self.server_ready.isSet(): > + if not self.server_ready.is_set(): > self.server_ready.set() > self.client_ready.wait() > > > Modified: python/trunk/Lib/test/test_socketserver.py > ============================================================================== > --- python/trunk/Lib/test/test_socketserver.py (original) > +++ python/trunk/Lib/test/test_socketserver.py Wed Jun 11 19:27:50 2008 > @@ -139,7 +139,7 @@ > # Time between requests is short enough that we won't wake > # up spuriously too many times. > kwargs={'poll_interval':0.01}) > - t.setDaemon(True) # In case this function raises. > + t.set_daemon(True) # In case this function raises. > t.start() > if verbose: print "server running" > for i in range(3): > > Modified: python/trunk/Lib/test/test_threading.py > ============================================================================== > --- python/trunk/Lib/test/test_threading.py (original) > +++ python/trunk/Lib/test/test_threading.py Wed Jun 11 19:27:50 2008 > @@ -34,7 +34,7 @@ > delay = random.random() / 10000.0 > if verbose: > print 'task %s will run for %.1f usec' % ( > - self.getName(), delay * 1e6) > + self.get_name(), delay * 1e6) > > with self.sema: > with self.mutex: > @@ -45,14 +45,14 @@ > > time.sleep(delay) > if verbose: > - print 'task', self.getName(), 'done' > + print 'task', self.get_name(), 'done' > > with self.mutex: > self.nrunning.dec() > self.testcase.assert_(self.nrunning.get() >= 0) > if verbose: > print '%s is finished. %d tasks are running' % ( > - self.getName(), self.nrunning.get()) > + self.get_name(), self.nrunning.get()) > > class ThreadTests(unittest.TestCase): > > @@ -73,7 +73,7 @@ > for i in range(NUMTASKS): > t = TestThread(""%i, self, sema, mutex, numrunning) > threads.append(t) > - self.failUnlessEqual(t.getIdent(), None) > + self.failUnlessEqual(t.get_ident(), None) > self.assert_(re.match('', repr(t))) > t.start() > > @@ -81,8 +81,8 @@ > print 'waiting for all tasks to complete' > for t in threads: > t.join(NUMTASKS) > - self.assert_(not t.isAlive()) > - self.failIfEqual(t.getIdent(), 0) > + self.assert_(not t.is_alive()) > + self.failIfEqual(t.get_ident(), 0) > self.assert_(re.match('', repr(t))) > if verbose: > print 'all tasks done' > @@ -172,7 +172,7 @@ > worker_saw_exception.set() > > t = Worker() > - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown > + t.set_daemon(True) # so if this fails, we don't hang Python at shutdown > t.start() > if verbose: > print " started worker thread" > @@ -258,12 +258,12 @@ > print 'program blocked; aborting' > os._exit(2) > t = threading.Thread(target=killer) > - t.setDaemon(True) > + t.set_daemon(True) > t.start() > > # This is the trace function > def func(frame, event, arg): > - threading.currentThread() > + threading.current_thread() > return func > > sys.settrace(func) > @@ -348,8 +348,8 @@ > self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint) > > def test_joining_current_thread(self): > - currentThread = threading.currentThread() > - self.assertRaises(RuntimeError, currentThread.join); > + current_thread = threading.current_thread() > + self.assertRaises(RuntimeError, current_thread.join); > > def test_joining_inactive_thread(self): > thread = threading.Thread() > @@ -358,7 +358,7 @@ > def test_daemonize_active_thread(self): > thread = threading.Thread() > thread.start() > - self.assertRaises(RuntimeError, thread.setDaemon, True) > + self.assertRaises(RuntimeError, thread.set_daemon, True) > > > def test_main(): > > Modified: python/trunk/Lib/test/threaded_import_hangers.py > ============================================================================== > --- python/trunk/Lib/test/threaded_import_hangers.py (original) > +++ python/trunk/Lib/test/threaded_import_hangers.py Wed Jun 11 19:27:50 2008 > @@ -38,5 +38,5 @@ > t = Worker(func, args) > t.start() > t.join(TIMEOUT) > - if t.isAlive(): > + if t.is_alive(): > errors.append("%s appeared to hang" % name) > > Modified: python/trunk/Lib/threading.py > ============================================================================== > --- python/trunk/Lib/threading.py (original) > +++ python/trunk/Lib/threading.py Wed Jun 11 19:27:50 2008 > @@ -14,7 +14,7 @@ > from collections import deque > > # Rename some stuff so "from threading import *" is safe > -__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', > +__all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', > 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', > 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] > > @@ -52,7 +52,7 @@ > if self.__verbose: > format = format % args > format = "%s: %s\n" % ( > - currentThread().getName(), format) > + current_thread().get_name(), format) > _sys.stderr.write(format) > > else: > @@ -95,11 +95,11 @@ > owner = self.__owner > return "<%s(%s, %d)>" % ( > self.__class__.__name__, > - owner and owner.getName(), > + owner and owner.get_name(), > self.__count) > > def acquire(self, blocking=1): > - me = currentThread() > + me = current_thread() > if self.__owner is me: > self.__count = self.__count + 1 > if __debug__: > @@ -119,7 +119,7 @@ > __enter__ = acquire > > def release(self): > - if self.__owner is not currentThread(): > + if self.__owner is not current_thread(): > raise RuntimeError("cannot release un-aquired lock") > self.__count = count = self.__count - 1 > if not count: > @@ -154,7 +154,7 @@ > return (count, owner) > > def _is_owned(self): > - return self.__owner is currentThread() > + return self.__owner is current_thread() > > > def Condition(*args, **kwargs): > @@ -203,7 +203,7 @@ > self.__lock.acquire() # Ignore saved state > > def _is_owned(self): > - # Return True if lock is owned by currentThread. > + # Return True if lock is owned by current_thread. > # This method is called only if __lock doesn't have _is_owned(). > if self.__lock.acquire(0): > self.__lock.release() > @@ -271,7 +271,7 @@ > except ValueError: > pass > > - def notifyAll(self): > + def notify_all(self): > self.notify(len(self.__waiters)) > > > @@ -350,14 +350,14 @@ > self.__cond = Condition(Lock()) > self.__flag = False > > - def isSet(self): > + def is_set(self): > return self.__flag > > def set(self): > self.__cond.acquire() > try: > self.__flag = True > - self.__cond.notifyAll() > + self.__cond.notify_all() > finally: > self.__cond.release() > > @@ -425,12 +425,12 @@ > > def _set_daemon(self): > # Overridden in _MainThread and _DummyThread > - return currentThread().isDaemon() > + return current_thread().is_daemon() > > def __repr__(self): > assert self.__initialized, "Thread.__init__() was not called" > status = "initial" > - if self.__started.isSet(): > + if self.__started.is_set(): > status = "started" > if self.__stopped: > status = "stopped" > @@ -443,7 +443,7 @@ > def start(self): > if not self.__initialized: > raise RuntimeError("thread.__init__() not called") > - if self.__started.isSet(): > + if self.__started.is_set(): > raise RuntimeError("thread already started") > if __debug__: > self._note("%s.start(): starting thread", self) > @@ -514,7 +514,7 @@ > # self. > if _sys: > _sys.stderr.write("Exception in thread %s:\n%s\n" % > - (self.getName(), _format_exc())) > + (self.get_name(), _format_exc())) > else: > # Do the best job possible w/o a huge amt. of code to > # approximate a traceback (code ideas from > @@ -522,7 +522,7 @@ > exc_type, exc_value, exc_tb = self.__exc_info() > try: > print>>self.__stderr, ( > - "Exception in thread " + self.getName() + > + "Exception in thread " + self.get_name() + > " (most likely raised during interpreter shutdown):") > print>>self.__stderr, ( > "Traceback (most recent call last):") > @@ -560,7 +560,7 @@ > def __stop(self): > self.__block.acquire() > self.__stopped = True > - self.__block.notifyAll() > + self.__block.notify_all() > self.__block.release() > > def __delete(self): > @@ -593,7 +593,7 @@ > # There must not be any python code between the previous line > # and after the lock is released. Otherwise a tracing function > # could try to acquire the lock again in the same thread, (in > - # currentThread()), and would block. > + # current_thread()), and would block. > except KeyError: > if 'dummy_threading' not in _sys.modules: > raise > @@ -601,9 +601,9 @@ > def join(self, timeout=None): > if not self.__initialized: > raise RuntimeError("Thread.__init__() not called") > - if not self.__started.isSet(): > + if not self.__started.is_set(): > raise RuntimeError("cannot join thread before it is started") > - if self is currentThread(): > + if self is current_thread(): > raise RuntimeError("cannot join current thread") > > if __debug__: > @@ -631,30 +631,30 @@ > finally: > self.__block.release() > > - def getName(self): > + def get_name(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__name > > - def setName(self, name): > + def set_name(self, name): > assert self.__initialized, "Thread.__init__() not called" > self.__name = str(name) > > - def getIdent(self): > + def get_ident(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__ident > > - def isAlive(self): > + def is_alive(self): > assert self.__initialized, "Thread.__init__() not called" > - return self.__started.isSet() and not self.__stopped > + return self.__started.is_set() and not self.__stopped > > - def isDaemon(self): > + def is_daemon(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__daemonic > > - def setDaemon(self, daemonic): > + def set_daemon(self, daemonic): > if not self.__initialized: > raise RuntimeError("Thread.__init__() not called") > - if self.__started.isSet(): > + if self.__started.is_set(): > raise RuntimeError("cannot set daemon status of active thread"); > self.__daemonic = daemonic > > @@ -685,7 +685,7 @@ > > def run(self): > self.finished.wait(self.interval) > - if not self.finished.isSet(): > + if not self.finished.is_set(): > self.function(*self.args, **self.kwargs) > self.finished.set() > > @@ -719,16 +719,16 @@ > > def _pickSomeNonDaemonThread(): > for t in enumerate(): > - if not t.isDaemon() and t.isAlive(): > + if not t.is_daemon() and t.is_alive(): > return t > return None > > > # Dummy thread class to represent threads not started here. > # These aren't garbage collected when they die, nor can they be waited for. > -# If they invoke anything in threading.py that calls currentThread(), they > +# If they invoke anything in threading.py that calls current_thread(), they > # leave an entry in the _active dict forever after. > -# Their purpose is to return *something* from currentThread(). > +# Their purpose is to return *something* from current_thread(). > # They are marked as daemon threads so we won't wait for them > # when we exit (conform previous semantics). > > @@ -756,14 +756,14 @@ > > # Global API functions > > -def currentThread(): > +def current_thread(): > try: > return _active[_get_ident()] > except KeyError: > - ##print "currentThread(): no current thread for", _get_ident() > + ##print "current_thread(): no current thread for", _get_ident() > return _DummyThread() > > -def activeCount(): > +def active_count(): > _active_limbo_lock.acquire() > count = len(_active) + len(_limbo) > _active_limbo_lock.release() > @@ -840,7 +840,7 @@ > counter = 0 > while counter < self.quota: > counter = counter + 1 > - self.queue.put("%s.%d" % (self.getName(), counter)) > + self.queue.put("%s.%d" % (self.get_name(), counter)) > _sleep(random() * 0.00001) > > > > Modified: python/trunk/Misc/NEWS > ============================================================================== > --- python/trunk/Misc/NEWS (original) > +++ python/trunk/Misc/NEWS Wed Jun 11 19:27:50 2008 > @@ -291,6 +291,7 @@ > - The bundled OSX-specific copy of libbffi is now in sync with the version > shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. > > + > Build > ----- > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From buildbot at python.org Wed Jun 11 19:44:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 17:44:03 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080611174403.AE4BE1E4005@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/478 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 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_multiprocessing Traceback (most recent call last): File "./Lib/test/regrtest.py", line 601, in runtest_inner indirect_test() File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/__init__.py", line 225, in Pool return Pool(processes, initializer, initargs) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 11 19:50:00 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 19:50:00 +0200 (CEST) Subject: [Python-checkins] r64128 - in python/trunk: Doc/library/threading.rst Lib/threading.py Misc/NEWS Message-ID: <20080611175000.E7ED91E4005@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 19:50:00 2008 New Revision: 64128 Log: add aliases to threading module Modified: python/trunk/Doc/library/threading.rst python/trunk/Lib/threading.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/threading.rst ============================================================================== --- python/trunk/Doc/library/threading.rst (original) +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:50:00 2008 @@ -13,10 +13,16 @@ The :mod:`dummy_threading` module is provided for situations where :mod:`threading` cannot be used because :mod:`thread` is missing. +.. note:: + + In 3.x, names in camelCase have been renamed to their underscored + equivelents. Both names are availble in 2.6. + This module defines the following functions and objects: .. function:: active_count() + activeCount() Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`enumerate`. @@ -31,6 +37,7 @@ .. function:: current_thread() + currentThread() Return the current :class:`Thread` object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the @@ -396,6 +403,7 @@ .. method:: Condition.notify_all() + Condition.notifyAll() Wake up all threads waiting on this condition. This method acts like :meth:`notify`, but wakes up all waiting threads instead of one. If the calling @@ -498,7 +506,8 @@ The internal flag is initially false. -.. method:: Event.isSet() +.. method:: Event.is_set() + Event.isSet() Return true if and only if the internal flag is true. @@ -638,11 +647,13 @@ .. method:: Thread.get_name() + Thread.getName() Return the thread's name. -.. method:: Thread.set_same(name) +.. method:: Thread.set_name(name) + Thread.setName(name) Set the thread's name. @@ -651,7 +662,7 @@ constructor. -.. method:: Thread.get_ddent() +.. method:: Thread.get_ident() Return the 'thread identifier' of this thread or None if the thread has not been started. This is a nonzero integer. See the :func:`thread.get_ident()` @@ -663,6 +674,7 @@ .. method:: Thread.is_alive() + Thread.isAlive() Return whether the thread is alive. @@ -672,11 +684,13 @@ .. method:: Thread.is_daemon() + Thread.isDaemon() Return the thread's daemon flag. .. method:: Thread.set_daemon(daemonic) + Thread.setDaemon(daemonic) Set the thread's daemon flag to the Boolean value *daemonic*. This must be called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. Modified: python/trunk/Lib/threading.py ============================================================================== --- python/trunk/Lib/threading.py (original) +++ python/trunk/Lib/threading.py Wed Jun 11 19:50:00 2008 @@ -9,6 +9,8 @@ raise import warnings + +from functools import wraps from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque @@ -31,6 +33,18 @@ module='threading', message='sys.exc_clear') +def _old_api(callable, old_name): + if not _sys.py3kwarning: + return callable + @wraps(callable) + def old(*args, **kwargs): + warnings.warnpy3k("In 3.x, {0} is renamed to {1}." + .format(old_name, callable.__name__), + stacklevel=3) + return callable(*args, **kwargs) + old.__name__ = old_name + return old + # Debug support (adapted from ihooks.py). # All the major classes here derive from _Verbose. We force that to # be a new-style class so that all the major classes here are new-style. @@ -274,6 +288,8 @@ def notify_all(self): self.notify(len(self.__waiters)) + notifyAll = _old_api(notify_all, "notifyAll") + def Semaphore(*args, **kwargs): return _Semaphore(*args, **kwargs) @@ -353,6 +369,8 @@ def is_set(self): return self.__flag + isSet = _old_api(is_set, "isSet") + def set(self): self.__cond.acquire() try: @@ -635,10 +653,14 @@ assert self.__initialized, "Thread.__init__() not called" return self.__name + getName = _old_api(get_name, "getName") + def set_name(self, name): assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) + setName = _old_api(set_name, "setName") + def get_ident(self): assert self.__initialized, "Thread.__init__() not called" return self.__ident @@ -647,10 +669,14 @@ assert self.__initialized, "Thread.__init__() not called" return self.__started.is_set() and not self.__stopped + isAlive = _old_api(is_alive, "isAlive") + def is_daemon(self): assert self.__initialized, "Thread.__init__() not called" return self.__daemonic + isDaemon = _old_api(is_daemon, "isDaemon") + def set_daemon(self, daemonic): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") @@ -658,6 +684,8 @@ raise RuntimeError("cannot set daemon status of active thread"); self.__daemonic = daemonic + setDaemon = _old_api(set_daemon, "setDaemon") + # The timer class was contributed by Itamar Shtull-Trauring def Timer(*args, **kwargs): @@ -763,12 +791,16 @@ ##print "current_thread(): no current thread for", _get_ident() return _DummyThread() +currentThread = _old_api(current_thread, "currentThread") + def active_count(): _active_limbo_lock.acquire() count = len(_active) + len(_limbo) _active_limbo_lock.release() return count +activeCount = _old_api(active_count, "activeCount") + def enumerate(): _active_limbo_lock.acquire() active = _active.values() + _limbo.values() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 19:50:00 2008 @@ -291,6 +291,7 @@ - The bundled OSX-specific copy of libbffi is now in sync with the version shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. +- The threading module gained alias for names that are removed in 3.x. Build ----- From python-checkins at python.org Wed Jun 11 19:53:38 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 19:53:38 +0200 (CEST) Subject: [Python-checkins] r64129 - python/trunk/Doc/library/threading.rst Message-ID: <20080611175338.D0DBD1E4005@bag.python.org> Author: georg.brandl Date: Wed Jun 11 19:53:38 2008 New Revision: 64129 Log: Fix typos. Modified: python/trunk/Doc/library/threading.rst Modified: python/trunk/Doc/library/threading.rst ============================================================================== --- python/trunk/Doc/library/threading.rst (original) +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:53:38 2008 @@ -1,4 +1,3 @@ - :mod:`threading` --- Higher-level threading interface ===================================================== @@ -15,8 +14,8 @@ .. note:: - In 3.x, names in camelCase have been renamed to their underscored - equivelents. Both names are availble in 2.6. + In 3.x, names in ``camelCase`` have been renamed to their underscored + equivalents. Both names are available in 2.6. This module defines the following functions and objects: From guido at python.org Wed Jun 11 19:56:34 2008 From: guido at python.org (Guido van Rossum) Date: Wed, 11 Jun 2008 10:56:34 -0700 Subject: [Python-checkins] r64128 - in python/trunk: Doc/library/threading.rst Lib/threading.py Misc/NEWS In-Reply-To: <20080611175000.E7ED91E4005@bag.python.org> References: <20080611175000.E7ED91E4005@bag.python.org> Message-ID: Shouldn't the old APIs be added back to the __all__ variable? On Wed, Jun 11, 2008 at 10:50 AM, benjamin.peterson wrote: > Author: benjamin.peterson > Date: Wed Jun 11 19:50:00 2008 > New Revision: 64128 > > Log: > add aliases to threading module > > > Modified: > python/trunk/Doc/library/threading.rst > python/trunk/Lib/threading.py > python/trunk/Misc/NEWS > > Modified: python/trunk/Doc/library/threading.rst > ============================================================================== > --- python/trunk/Doc/library/threading.rst (original) > +++ python/trunk/Doc/library/threading.rst Wed Jun 11 19:50:00 2008 > @@ -13,10 +13,16 @@ > The :mod:`dummy_threading` module is provided for situations where > :mod:`threading` cannot be used because :mod:`thread` is missing. > > +.. note:: > + > + In 3.x, names in camelCase have been renamed to their underscored > + equivelents. Both names are availble in 2.6. > + > This module defines the following functions and objects: > > > .. function:: active_count() > + activeCount() > > Return the number of :class:`Thread` objects currently alive. The returned > count is equal to the length of the list returned by :func:`enumerate`. > @@ -31,6 +37,7 @@ > > > .. function:: current_thread() > + currentThread() > > Return the current :class:`Thread` object, corresponding to the caller's thread > of control. If the caller's thread of control was not created through the > @@ -396,6 +403,7 @@ > > > .. method:: Condition.notify_all() > + Condition.notifyAll() > > Wake up all threads waiting on this condition. This method acts like > :meth:`notify`, but wakes up all waiting threads instead of one. If the calling > @@ -498,7 +506,8 @@ > The internal flag is initially false. > > > -.. method:: Event.isSet() > +.. method:: Event.is_set() > + Event.isSet() > > Return true if and only if the internal flag is true. > > @@ -638,11 +647,13 @@ > > > .. method:: Thread.get_name() > + Thread.getName() > > Return the thread's name. > > > -.. method:: Thread.set_same(name) > +.. method:: Thread.set_name(name) > + Thread.setName(name) > > Set the thread's name. > > @@ -651,7 +662,7 @@ > constructor. > > > -.. method:: Thread.get_ddent() > +.. method:: Thread.get_ident() > > Return the 'thread identifier' of this thread or None if the thread has not > been started. This is a nonzero integer. See the :func:`thread.get_ident()` > @@ -663,6 +674,7 @@ > > > .. method:: Thread.is_alive() > + Thread.isAlive() > > Return whether the thread is alive. > > @@ -672,11 +684,13 @@ > > > .. method:: Thread.is_daemon() > + Thread.isDaemon() > > Return the thread's daemon flag. > > > .. method:: Thread.set_daemon(daemonic) > + Thread.setDaemon(daemonic) > > Set the thread's daemon flag to the Boolean value *daemonic*. This must be > called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. > > Modified: python/trunk/Lib/threading.py > ============================================================================== > --- python/trunk/Lib/threading.py (original) > +++ python/trunk/Lib/threading.py Wed Jun 11 19:50:00 2008 > @@ -9,6 +9,8 @@ > raise > > import warnings > + > +from functools import wraps > from time import time as _time, sleep as _sleep > from traceback import format_exc as _format_exc > from collections import deque > @@ -31,6 +33,18 @@ > module='threading', message='sys.exc_clear') > > > +def _old_api(callable, old_name): > + if not _sys.py3kwarning: > + return callable > + @wraps(callable) > + def old(*args, **kwargs): > + warnings.warnpy3k("In 3.x, {0} is renamed to {1}." > + .format(old_name, callable.__name__), > + stacklevel=3) > + return callable(*args, **kwargs) > + old.__name__ = old_name > + return old > + > # Debug support (adapted from ihooks.py). > # All the major classes here derive from _Verbose. We force that to > # be a new-style class so that all the major classes here are new-style. > @@ -274,6 +288,8 @@ > def notify_all(self): > self.notify(len(self.__waiters)) > > + notifyAll = _old_api(notify_all, "notifyAll") > + > > def Semaphore(*args, **kwargs): > return _Semaphore(*args, **kwargs) > @@ -353,6 +369,8 @@ > def is_set(self): > return self.__flag > > + isSet = _old_api(is_set, "isSet") > + > def set(self): > self.__cond.acquire() > try: > @@ -635,10 +653,14 @@ > assert self.__initialized, "Thread.__init__() not called" > return self.__name > > + getName = _old_api(get_name, "getName") > + > def set_name(self, name): > assert self.__initialized, "Thread.__init__() not called" > self.__name = str(name) > > + setName = _old_api(set_name, "setName") > + > def get_ident(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__ident > @@ -647,10 +669,14 @@ > assert self.__initialized, "Thread.__init__() not called" > return self.__started.is_set() and not self.__stopped > > + isAlive = _old_api(is_alive, "isAlive") > + > def is_daemon(self): > assert self.__initialized, "Thread.__init__() not called" > return self.__daemonic > > + isDaemon = _old_api(is_daemon, "isDaemon") > + > def set_daemon(self, daemonic): > if not self.__initialized: > raise RuntimeError("Thread.__init__() not called") > @@ -658,6 +684,8 @@ > raise RuntimeError("cannot set daemon status of active thread"); > self.__daemonic = daemonic > > + setDaemon = _old_api(set_daemon, "setDaemon") > + > # The timer class was contributed by Itamar Shtull-Trauring > > def Timer(*args, **kwargs): > @@ -763,12 +791,16 @@ > ##print "current_thread(): no current thread for", _get_ident() > return _DummyThread() > > +currentThread = _old_api(current_thread, "currentThread") > + > def active_count(): > _active_limbo_lock.acquire() > count = len(_active) + len(_limbo) > _active_limbo_lock.release() > return count > > +activeCount = _old_api(active_count, "activeCount") > + > def enumerate(): > _active_limbo_lock.acquire() > active = _active.values() + _limbo.values() > > Modified: python/trunk/Misc/NEWS > ============================================================================== > --- python/trunk/Misc/NEWS (original) > +++ python/trunk/Misc/NEWS Wed Jun 11 19:50:00 2008 > @@ -291,6 +291,7 @@ > - The bundled OSX-specific copy of libbffi is now in sync with the version > shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. > > +- The threading module gained alias for names that are removed in 3.x. > > Build > ----- > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) From python-checkins at python.org Wed Jun 11 19:57:45 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 19:57:45 +0200 (CEST) Subject: [Python-checkins] r64130 - python/trunk/Doc/using/cmdline.rst Message-ID: <20080611175745.1CC521E4005@bag.python.org> Author: georg.brandl Date: Wed Jun 11 19:57:44 2008 New Revision: 64130 Log: Clarify what ":errorhandler" refers to. Modified: python/trunk/Doc/using/cmdline.rst Modified: python/trunk/Doc/using/cmdline.rst ============================================================================== --- python/trunk/Doc/using/cmdline.rst (original) +++ python/trunk/Doc/using/cmdline.rst Wed Jun 11 19:57:44 2008 @@ -484,7 +484,8 @@ .. envvar:: PYTHONIOENCODING Overrides the encoding used for stdin/stdout/stderr, in the syntax - encodingname:errorhandler, with the :errors part being optional. + ``encodingname:errorhandler``. The ``:errorhandler`` part is optional and + has the same meaning as in :func:`str.encode`. .. versionadded:: 2.6 From python-checkins at python.org Wed Jun 11 19:58:20 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 19:58:20 +0200 (CEST) Subject: [Python-checkins] r64131 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611175820.3853F1E4005@bag.python.org> Author: thomas.heller Date: Wed Jun 11 19:58:19 2008 New Revision: 64131 Log: Markup fixes, spelling corrections, and better wordings. Hopefully. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 19:58:19 2008 @@ -42,7 +42,7 @@ convention, while *windll* libraries call functions using the ``stdcall`` calling convention. *oledll* also uses the ``stdcall`` calling convention, and assumes the functions return a Windows :class:`HRESULT` error code. The error -code is used to automatically raise :class:`WindowsError` Python exceptions when +code is used to automatically raise a :class:`WindowsError` exception when the function call fails. Here are some examples for Windows. Note that ``msvcrt`` is the MS standard C @@ -57,10 +57,10 @@ >>> libc = cdll.msvcrt # doctest: +WINDOWS >>> -Windows appends the usual '.dll' file suffix automatically. +Windows appends the usual ``.dll`` file suffix automatically. On Linux, it is required to specify the filename *including* the extension to -load a library, so attribute access does not work. Either the +load a library, so attribute access can not be used to load libraries. Either the :meth:`LoadLibrary` method of the dll loaders should be used, or you should load the library by creating an instance of CDLL by calling the constructor:: @@ -109,7 +109,7 @@ *windll* does not try to select one of them by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` -explicitly, and then call it with normal strings or unicode strings +explicitly, and then call it with strings or unicode strings respectively. Sometimes, dlls export functions with names which aren't valid Python @@ -424,9 +424,9 @@ in the :attr:`argtypes` sequence. The :meth:`from_param` class method receives the Python object passed to the function call, it should do a typecheck or whatever is needed to make sure this object is acceptable, and then return the -object itself, it's :attr:`_as_parameter_` attribute, or whatever you want to +object itself, its :attr:`_as_parameter_` attribute, or whatever you want to pass as the C function argument in this case. Again, the result should be an -integer, string, unicode, a ``ctypes`` instance, or something having the +integer, string, unicode, a ``ctypes`` instance, or an object with an :attr:`_as_parameter_` attribute. @@ -1617,9 +1617,8 @@ `use_last_error` does the same for the Windows error code. .. versionchanged:: 2.6 - - The optional `use_errno` and `use_last_error` parameters were added - in Python 2.6. + The optional `use_errno` and `use_last_error` parameters were + added. .. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) From python-checkins at python.org Wed Jun 11 20:00:52 2008 From: python-checkins at python.org (gregory.p.smith) Date: Wed, 11 Jun 2008 20:00:52 +0200 (CEST) Subject: [Python-checkins] r64132 - python/trunk/Include/Python.h Message-ID: <20080611180052.6F9321E4005@bag.python.org> Author: gregory.p.smith Date: Wed Jun 11 20:00:52 2008 New Revision: 64132 Log: Correct an incorrect comment about our #include of stddef.h. (see Doug Evans' comment on python-dev 2008-06-10) Modified: python/trunk/Include/Python.h Modified: python/trunk/Include/Python.h ============================================================================== --- python/trunk/Include/Python.h (original) +++ python/trunk/Include/Python.h Wed Jun 11 20:00:52 2008 @@ -44,7 +44,7 @@ #include #endif -/* For uintptr_t, intptr_t */ +/* For size_t? */ #ifdef HAVE_STDDEF_H #include #endif From musiccomposition at gmail.com Wed Jun 11 20:01:15 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Wed, 11 Jun 2008 13:01:15 -0500 Subject: [Python-checkins] r64128 - in python/trunk: Doc/library/threading.rst Lib/threading.py Misc/NEWS In-Reply-To: References: <20080611175000.E7ED91E4005@bag.python.org> Message-ID: <1afaf6160806111101k3a7bfbc2x4b9dac1e9f2bca69@mail.gmail.com> On Wed, Jun 11, 2008 at 12:56 PM, Guido van Rossum wrote: > Shouldn't the old APIs be added back to the __all__ variable? Yes, that was an oversight on my part. -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." From python-checkins at python.org Wed Jun 11 20:02:38 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 20:02:38 +0200 (CEST) Subject: [Python-checkins] r64133 - python/trunk/Lib/threading.py Message-ID: <20080611180238.65AB31E400A@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 20:02:31 2008 New Revision: 64133 Log: add old names back into __all__ Modified: python/trunk/Lib/threading.py Modified: python/trunk/Lib/threading.py ============================================================================== --- python/trunk/Lib/threading.py (original) +++ python/trunk/Lib/threading.py Wed Jun 11 20:02:31 2008 @@ -16,7 +16,8 @@ from collections import deque # Rename some stuff so "from threading import *" is safe -__all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', +__all__ = ['activeCount', 'active_count', 'Condition', 'currentThread', + 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] From python-checkins at python.org Wed Jun 11 20:10:44 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 20:10:44 +0200 (CEST) Subject: [Python-checkins] r64135 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611181044.9F85D1E4013@bag.python.org> Author: thomas.heller Date: Wed Jun 11 20:10:43 2008 New Revision: 64135 Log: More doc fixes. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 20:10:43 2008 @@ -721,6 +721,8 @@ c_long(99) >>> +.. XXX Document dereferencing pointers, and that it is preferred over the .contents attribute. + Pointer instances can also be indexed with integers:: >>> pi[0] @@ -767,7 +769,7 @@ >>> ``ctypes`` checks for ``NULL`` when dereferencing pointers (but dereferencing -non-\ ``NULL`` pointers would crash Python):: +invalid non-\ ``NULL`` pointers would crash Python):: >>> null_ptr[0] Traceback (most recent call last): @@ -813,9 +815,9 @@ >>> bar.values = None >>> -XXX list other conversions... +.. XXX list other conversions... -Sometimes you have instances of incompatible types. In ``C``, you can cast one +Sometimes you have instances of incompatible types. In C, you can cast one type into another type. ``ctypes`` provides a ``cast`` function which can be used in the same way. The ``Bar`` structure defined above accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its ``values`` field, @@ -1072,7 +1074,7 @@ Accessing values exported from dlls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Sometimes, a dll not only exports functions, it also exports variables. An +Some shared libraries not only export functions, they also export variables. An example in the Python library itself is the ``Py_OptimizeFlag``, an integer set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` flag given on startup. @@ -1248,17 +1250,6 @@ is already known, on a case by case basis. -.. _ctypes-bugs-todo-non-implemented-things: - -Bugs, ToDo and non-implemented things -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Enumeration types are not implemented. You can do it easily yourself, using -:class:`c_int` as the base class. - -``long double`` is not implemented. - - .. _ctypes-ctypes-reference: ctypes reference From theller at ctypes.org Wed Jun 11 20:13:34 2008 From: theller at ctypes.org (Thomas Heller) Date: Wed, 11 Jun 2008 20:13:34 +0200 Subject: [Python-checkins] r64128 - in python/trunk: Doc/library/threading.rst Lib/threading.py Misc/NEWS In-Reply-To: <20080611175000.E7ED91E4005@bag.python.org> References: <20080611175000.E7ED91E4005@bag.python.org> Message-ID: benjamin.peterson schrieb: > +.. note:: > + > + In 3.x, names in camelCase have been renamed to their underscored > + equivelents. Both names are availble in 2.6. > + In 3.x, names in camelCase have been renamed to their underscored equivalents. Both names are available in 2.6. ^ ^ From python-checkins at python.org Wed Jun 11 20:40:51 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 20:40:51 +0200 (CEST) Subject: [Python-checkins] r64139 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611184051.829501E4018@bag.python.org> Author: thomas.heller Date: Wed Jun 11 20:40:51 2008 New Revision: 64139 Log: Smaller doc fixes. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 20:40:51 2008 @@ -1706,16 +1706,14 @@ LPCSTR lpCaption, UINT uType); -Here is the wrapping with ``ctypes``: +Here is the wrapping with ``ctypes``:: - :: - - >>> from ctypes import c_int, WINFUNCTYPE, windll - >>> from ctypes.wintypes import HWND, LPCSTR, UINT - >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) - >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) - >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) - >>> + >>> from ctypes import c_int, WINFUNCTYPE, windll + >>> from ctypes.wintypes import HWND, LPCSTR, UINT + >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) + >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) + >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) + >>> The MessageBox foreign function can now be called in these ways:: @@ -1733,16 +1731,14 @@ HWND hWnd, LPRECT lpRect); -Here is the wrapping with ``ctypes``: - - :: +Here is the wrapping with ``ctypes``:: - >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError - >>> from ctypes.wintypes import BOOL, HWND, RECT - >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) - >>> paramflags = (1, "hwnd"), (2, "lprect") - >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) - >>> + >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError + >>> from ctypes.wintypes import BOOL, HWND, RECT + >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) + >>> paramflags = (1, "hwnd"), (2, "lprect") + >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) + >>> Functions with output parameters will automatically return the output parameter value if there is a single one, or a tuple containing the output parameter @@ -1758,6 +1754,7 @@ ... if not result: ... raise WinError() ... return args + ... >>> GetWindowRect.errcheck = errcheck >>> @@ -1772,7 +1769,7 @@ ... raise WinError() ... rc = args[1] ... return rc.left, rc.top, rc.bottom, rc.right - >>> + ... >>> GetWindowRect.errcheck = errcheck >>> From python-checkins at python.org Wed Jun 11 20:41:50 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 20:41:50 +0200 (CEST) Subject: [Python-checkins] r64140 - in peps/trunk: pep-0000.txt pep-3138.txt Message-ID: <20080611184150.2D0421E400B@bag.python.org> Author: georg.brandl Date: Wed Jun 11 20:41:49 2008 New Revision: 64140 Log: PEP 3138 is final. Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3138.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Wed Jun 11 20:41:49 2008 @@ -85,7 +85,6 @@ SA 3119 Introducing Abstract Base Classes GvR, Talin SA 3121 Extension Module Initialization & Finalization von L?wis SA 3137 Immutable Bytes and Mutable Buffer GvR - SA 3138 String representation in Python 3000 Ishimoto SA 3141 A Type Hierarchy for Numbers Yasskin Open PEPs (under consideration) @@ -181,6 +180,7 @@ SF 3129 Class Decorators Winter SF 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl + SF 3138 String representation in Python 3000 Ishimoto Deferred, Abandoned, Withdrawn, and Rejected PEPs @@ -520,7 +520,7 @@ S 3135 New Super Spealman, Delaney SR 3136 Labeled break and continue Chisholm SA 3137 Immutable Bytes and Mutable Buffer GvR - SA 3138 String representation in Python 3000 Ishimoto + SF 3138 String representation in Python 3000 Ishimoto SR 3139 Cleaning out sys and the "interpreter" module Peterson SR 3140 str(container) should call str(item), not repr(item) Broytmann, Jewett SA 3141 A Type Hierarchy for Numbers Yasskin Modified: peps/trunk/pep-3138.txt ============================================================================== --- peps/trunk/pep-3138.txt (original) +++ peps/trunk/pep-3138.txt Wed Jun 11 20:41:49 2008 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Atsuo Ishimoto -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 05-May-2008 @@ -268,10 +268,11 @@ redirecting to a file". -Reference Implementation -======================== +Implementation +============== -http://bugs.python.org/issue2630 +The author wrote a patch in http://bugs.python.org/issue2630; this was +committed to the Python 3.0 branch in revision 64138 on 06-11-2008. References From python-checkins at python.org Wed Jun 11 20:48:00 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 20:48:00 +0200 (CEST) Subject: [Python-checkins] r64141 - peps/trunk/pep-0361.txt Message-ID: <20080611184800.7E1681E4005@bag.python.org> Author: georg.brandl Date: Wed Jun 11 20:48:00 2008 New Revision: 64141 Log: PEP 361 update. Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed Jun 11 20:48:00 2008 @@ -79,11 +79,13 @@ - 370: Per user site-packages directory [#pep370] - 3112: Bytes literals in Python 3000 [#pep3112] - 3127: Integer Literal Support and Syntax [#pep3127] + - 371: Addition of the multiprocessing package [#pep371] New modules in the standard library: - json - new enhanced turtle module + - ast Deprecated modules and functions in the standard library: @@ -105,20 +107,26 @@ - rgbimg - macfs - Python 3.0 compatability: - - - warnings were added for the following builtins - which no longer exist in 3.0: + Warnings for features removed in Py3k: - apply, callable, coerce, dict.has_key, execfile, reduce, reload + - builtins: apply, callable, coerce, dict.has_key, execfile, + reduce, reload + - backticks and <> + - float args to xrange + - coerce and all its friends + - comparing by default comparison + - {}.has_key() + - file.xreadlines + - softspace removal for print() function + - removal of modules because of PEP 4/3100/3108 Other major features: - - with/as will be keywords - - a __dir__() special method to control dir() was added [1] - - AtheOS support stopped. - - warnings module implemented in C - - compile() takes an AST and can convert to byte code + - with/as will be keywords + - a __dir__() special method to control dir() was added [1] + - AtheOS support stopped. + - warnings module implemented in C + - compile() takes an AST and can convert to byte code Possible features for 2.6 @@ -127,9 +135,7 @@ any C modifications or behavioral changes. New features *must* be implemented prior to beta1 or will require Release Manager approval. - The following PEPs are being worked on for inclusion in 2.6: - - - PEP 371: Addition of the multiprocessing package [#pep371] + The following PEPs are being worked on for inclusion in 2.6: None. Each non-trivial feature listed here that is not a PEP must be discussed on python-dev. Other enhancements include: @@ -148,9 +154,6 @@ PJE's withdrawal from 2.5 for inclusion in 2.6: http://mail.python.org/pipermail/python-dev/2006-April/064145.html - - - ast - http://mail.python.org/pipermail/python-dev/2008-April/078950.html Modules to gain a DeprecationWarning (as specified for Python 2.6 or through negligence): @@ -163,24 +166,16 @@ - Convert Parser/*.c to use the C warnings module rather than printf - Add warnings for Py3k features removed: - * backticks and <> * __getslice__/__setslice__/__delslice__ * float args to PyArgs_ParseTuple - * float args to xrange - * coerce and all its friends - * comparing by default comparison * __cmp__? * other comparison changes? * int division? - * {}.has_key() * All PendingDeprecationWarnings (e.g. exceptions) * using zip() result as a list * the exec statement (use function syntax) - * file.xreadlines * function attributes that start with func_* (should use __*__) - * softspace removal for print() function * the L suffix for long literals - * removal of modules because of PEP 4/3100/3108 * renaming of __nonzero__ to __bool__ * multiple inheritance with classic classes? (MRO might change) * properties and classic classes? (instance attrs shadow property) From python-checkins at python.org Wed Jun 11 20:55:39 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 20:55:39 +0200 (CEST) Subject: [Python-checkins] r64142 - in python/trunk: Doc/library/future_builtins.rst Misc/NEWS Modules/future_builtins.c Message-ID: <20080611185539.3B71D1E4005@bag.python.org> Author: georg.brandl Date: Wed Jun 11 20:55:38 2008 New Revision: 64142 Log: Add future_builtins.ascii(). Modified: python/trunk/Doc/library/future_builtins.rst python/trunk/Misc/NEWS python/trunk/Modules/future_builtins.c Modified: python/trunk/Doc/library/future_builtins.rst ============================================================================== --- python/trunk/Doc/library/future_builtins.rst (original) +++ python/trunk/Doc/library/future_builtins.rst Wed Jun 11 20:55:38 2008 @@ -28,6 +28,14 @@ Available builtins are: +.. function:: ascii(object) + + Returns the same as :func:`repr`. In Python 3, :func:`repr` will return + printable Unicode characters unescaped, while :func:`ascii` will always + backslash-escape them. Using :func:`future_builtins.ascii` instead of + :func:`repr` in 2.6 code makes it clear that you need a pure ASCII return + value. + .. function:: filter(function, iterable) Works like :func:`itertools.ifilter`. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 20:55:38 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Add future_builtins.ascii(). + - Several set methods now accept multiple arguments: update(), union(), intersection(), intersection_update(), difference(), and difference_update(). Modified: python/trunk/Modules/future_builtins.c ============================================================================== --- python/trunk/Modules/future_builtins.c (original) +++ python/trunk/Modules/future_builtins.c Wed Jun 11 20:55:38 2008 @@ -45,11 +45,25 @@ Return the octal representation of an integer or long integer."); +static PyObject * +builtin_ascii(PyObject *self, PyObject *v) +{ + return PyObject_Repr(v); +} + +PyDoc_STRVAR(ascii_doc, +"ascii(object) -> string\n\ +\n\ +Return the same as repr(). In Python 3.x, the repr() result will\n\ +contain printable characters unescaped, while the ascii() result\n\ +will have such characters backslash-escaped."); + /* List of functions exported by this module */ static PyMethodDef module_functions[] = { {"hex", builtin_hex, METH_O, hex_doc}, {"oct", builtin_oct, METH_O, oct_doc}, + {"ascii", builtin_ascii, METH_O, ascii_doc}, {NULL, NULL} /* Sentinel */ }; From python-checkins at python.org Wed Jun 11 21:10:22 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 21:10:22 +0200 (CEST) Subject: [Python-checkins] r64143 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611191022.86EFA1E4012@bag.python.org> Author: thomas.heller Date: Wed Jun 11 21:10:22 2008 New Revision: 64143 Log: Add versionadded marker to ctypes.c_longdouble. Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 21:10:22 2008 @@ -2159,6 +2159,7 @@ optional float initializer. On platforms where ``sizeof(long double) == sizeof(double)`` it is an alias to :class:`c_double`. + .. versionadded:: 2.6 .. class:: c_float From python-checkins at python.org Wed Jun 11 21:58:23 2008 From: python-checkins at python.org (thomas.heller) Date: Wed, 11 Jun 2008 21:58:23 +0200 (CEST) Subject: [Python-checkins] r64146 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080611195823.301FE1E4005@bag.python.org> Author: thomas.heller Date: Wed Jun 11 21:58:22 2008 New Revision: 64146 Log: Markup fixes, thanks Georg for the help. Document ctypes.util.find_library() and ctypes.util.find_msvcrt(). Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Wed Jun 11 21:58:22 2008 @@ -1625,75 +1625,71 @@ The returned function prototype creates functions that use the Python calling convention. The function will *not* release the GIL during the call. -Function prototypes created by the factory functions can be instantiated in -different ways, depending on the type and number of the parameters in the call. +Function prototypes created by these factory functions can be instantiated in +different ways, depending on the type and number of the parameters in the call: -.. function:: prototype(address) - :noindex: + .. function:: prototype(address) + :noindex: + :module: - Returns a foreign function at the specified address. + Returns a foreign function at the specified address which must be an integer. -.. function:: prototype(callable) - :noindex: + .. function:: prototype(callable) + :noindex: + :module: - Create a C callable function (a callback function) from a Python ``callable``. + Create a C callable function (a callback function) from a Python ``callable``. -.. function:: prototype(func_spec[, paramflags]) - :noindex: + .. function:: prototype(func_spec[, paramflags]) + :noindex: + :module: - Returns a foreign function exported by a shared library. ``func_spec`` must be a - 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the - exported function as string, or the ordinal of the exported function as small - integer. The second item is the shared library instance. + Returns a foreign function exported by a shared library. ``func_spec`` must be a + 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the + exported function as string, or the ordinal of the exported function as small + integer. The second item is the shared library instance. -.. function:: prototype(vtbl_index, name[, paramflags[, iid]]) - :noindex: + .. function:: prototype(vtbl_index, name[, paramflags[, iid]]) + :noindex: + :module: - Returns a foreign function that will call a COM method. ``vtbl_index`` is the - index into the virtual function table, a small non-negative integer. *name* is - name of the COM method. *iid* is an optional pointer to the interface identifier - which is used in extended error reporting. + Returns a foreign function that will call a COM method. ``vtbl_index`` is the + index into the virtual function table, a small non-negative integer. *name* is + name of the COM method. *iid* is an optional pointer to the interface identifier + which is used in extended error reporting. - COM methods use a special calling convention: They require a pointer to the COM - interface as first argument, in addition to those parameters that are specified - in the :attr:`argtypes` tuple. + COM methods use a special calling convention: They require a pointer to the COM + interface as first argument, in addition to those parameters that are specified + in the :attr:`argtypes` tuple. -The optional *paramflags* parameter creates foreign function wrappers with much -more functionality than the features described above. + The optional *paramflags* parameter creates foreign function wrappers with much + more functionality than the features described above. -*paramflags* must be a tuple of the same length as :attr:`argtypes`. + *paramflags* must be a tuple of the same length as :attr:`argtypes`. -Each item in this tuple contains further information about a parameter, it must -be a tuple containing 1, 2, or 3 items. + Each item in this tuple contains further information about a parameter, it must + be a tuple containing one, two, or three items. -The first item is an integer containing flags for the parameter: + The first item is an integer containing a combination of direction + flags for the parameter: + 1 + Specifies an input parameter to the function. -.. data:: 1 - :noindex: + 2 + Output parameter. The foreign function fills in a value. - Specifies an input parameter to the function. + 4 + Input parameter which defaults to the integer zero. + The optional second item is the parameter name as string. If this is specified, + the foreign function can be called with named parameters. -.. data:: 2 - :noindex: - - Output parameter. The foreign function fills in a value. - - -.. data:: 4 - :noindex: - - Input parameter which defaults to the integer zero. - -The optional second item is the parameter name as string. If this is specified, -the foreign function can be called with named parameters. - -The optional third item is the default value for this parameter. + The optional third item is the default value for this parameter. This example demonstrates how to wrap the Windows ``MessageBoxA`` function so that it supports default parameters and named arguments. The C declaration from @@ -1865,6 +1861,33 @@ servers with ctypes. It is called from the DllGetClassObject function that the ``_ctypes`` extension dll exports. +.. function:: find_library(name) + :module: ctypes.util + + Try to find a library and return a pathname. `name` is the library name without + any prefix like `lib`, suffix like ``.so``, ``.dylib`` or version number (this + is the form used for the posix linker option :option:`-l`). If no library can + be found, returns ``None``. + + The exact functionality is system dependent. + + .. versionchanged:: 2.6 + Windows only: ``find_library("m")`` or + ``find_library("c")`` return the result of a call to + ``find_msvcrt()``. + +.. function:: find_msvcrt() + :module: ctypes.util + + Windows only: return the filename of the VC runtype library used + by Python, and by the extension modules. If the name of the + library cannot be determined, ``None`` is returned. + + If you need to free memory, for example, allocated by an extension + module with a call to the ``free(void *)``, it is important that you + use the function in the same library that allocated the memory. + + .. versionadded:: 2.6 .. function:: FormatError([code]) From python-checkins at python.org Wed Jun 11 22:04:30 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 11 Jun 2008 22:04:30 +0200 (CEST) Subject: [Python-checkins] r64147 - in python/trunk/Misc: ACKS NEWS Message-ID: <20080611200430.5BA941E4005@bag.python.org> Author: benjamin.peterson Date: Wed Jun 11 22:04:30 2008 New Revision: 64147 Log: update ACKS and NEWs for multiprocessing Modified: python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Wed Jun 11 22:04:30 2008 @@ -486,6 +486,7 @@ Gustavo Niemeyer Oscar Nierstrasz Hrvoje Niksic +Jesse Noller Bill Noon Stefan Norberg Tim Northover @@ -502,6 +503,7 @@ Douglas Orr Denis S. Otkidach Michael Otteneder +R. M. Oudkerk Russel Owen Ondrej Palkovsky Mike Pall Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 22:04:30 2008 @@ -90,6 +90,8 @@ - Added the ast module. +- Added the multiprocessing module, PEP 371 + - Factored out the indentation cleaning from inspect.getdoc() into inspect.cleandoc() to ease standalone use. From python-checkins at python.org Wed Jun 11 22:28:07 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 11 Jun 2008 22:28:07 +0200 (CEST) Subject: [Python-checkins] r64150 - python/trunk/Misc/NEWS Message-ID: <20080611202807.44F611E4005@bag.python.org> Author: georg.brandl Date: Wed Jun 11 22:28:06 2008 New Revision: 64150 Log: Can we agree to put dots at entry ends? Thanks. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 11 22:28:06 2008 @@ -90,7 +90,7 @@ - Added the ast module. -- Added the multiprocessing module, PEP 371 +- Added the multiprocessing module, PEP 371. - Factored out the indentation cleaning from inspect.getdoc() into inspect.cleandoc() to ease standalone use. @@ -98,7 +98,7 @@ - Issue #1798: Add ctypes calling convention that allows safe access to errno. -- Issue #2404: ctypes objects support the new pep3118 buffer interface +- Issue #2404: ctypes objects support the new pep3118 buffer interface. - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. @@ -306,7 +306,7 @@ - On MacOS X it is now possible to install the framework in 64-bit mode or even as a 4-way universal binary (that is, PPC, i386, - PPC64 and x86_64 support in one binary) + PPC64 and x86_64 support in one binary). This is controlled by the configure argument ``--with-universal-archs``: @@ -395,7 +395,7 @@ ending in) '.', '!' or '?'. - Add from_buffer() and from_buffer_copy() class methods to ctypes - data types + data types. - Issue #2682: ctypes callback functions no longer contain a cyclic reference to themselves. From buildbot at python.org Wed Jun 11 23:25:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 21:25:22 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080611212522.980C51E4010@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/975 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 01:04:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 11 Jun 2008 23:04:15 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080611230416.10B651E4005@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1108 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 02:12:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 00:12:20 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 3.0 Message-ID: <20080612001221.1688F1E4005@bag.python.org> The Buildbot has detected a new failure of amd64 XP 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%203.0/builds/1028 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti,benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 04:10:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 02:10:50 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20080612021050.E58D11E4005@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/109 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: sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 04:14:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 02:14:59 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080612021459.C517A1E4005@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/645 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 test Excerpt from the test logfile: 7 tests failed: test_bsddb3 test_datetime test_decimal test_multiprocessing test_pickle test_pickletools test_range ====================================================================== ERROR: test01_pickle_DBError (bsddb.test.test_pickle.pickleTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_pickle.py", line 63, in test01_pickle_DBError self._base_test_pickle_DBError(pickle=pickle) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_pickle.py", line 55, in _base_test_pickle_DBError raise Exception(rottenEgg, '!=', egg) Exception: (DBKeyExistError(4294936300, 'DB_KEYEXIST: Key/data pair already exists'), '!=', DBKeyExistError(-30996, 'DB_KEYEXIST: Key/data pair already exists')) ====================================================================== FAIL: test02 (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 109, in test02 self.assertEquals(len(values), 2) AssertionError: 3 != 2 ====================================================================== ERROR: test_pickling (test.test_datetime.TestDateTimeTZ) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 2479, in test_pickling derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== ERROR: test_pickling_subclass (test.test_datetime.TestTZInfo) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 116, in test_pickling_subclass derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== ERROR: test_pickling (test.test_datetime.TestTimeTZ) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 2252, in test_pickling derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== FAIL: test_pickle (test.test_decimal.ContextAPItests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_decimal.py", line 1429, in test_pickle self.assertEqual(v1, v2) AssertionError: -999999999 != 3294967297 Traceback (most recent call last): File "./Lib/test/regrtest.py", line 601, in runtest_inner indirect_test() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/__init__.py", line 225, in Pool return Pool(processes, initializer, initargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/pool.py", line 104, in __init__ w.start() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 104, in start _cleanup() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 58, in _cleanup if p._popen.poll() is not None: File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes ====================================================================== FAIL: test_ints (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 508, in test_ints self.assertEqual(expected, n2) AssertionError: -2147483647 != 2147483649 ====================================================================== FAIL: test_load_from_data1 (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 403, in test_load_from_data1 self.assertEqual(self._testdata, self.loads(DATA1)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab29bdd80>, <__main__.C object at 0x2aaab29bdd80>), ('abc', 'abc', <__main__.C object at 0x2aaab29bdd80>, <__main__.C object at 0x2aaab29bdd80>), 5] ====================================================================== FAIL: test_load_from_data2 (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 406, in test_load_from_data2 self.assertEqual(self._testdata, self.loads(DATA2)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab29bdd80>, <__main__.C object at 0x2aaab29bdd80>), ('abc', 'abc', <__main__.C object at 0x2aaab29bdd80>, <__main__.C object at 0x2aaab29bdd80>), 5] ====================================================================== FAIL: test_long (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 530, in test_long self.assertEqual(n, got) AssertionError: -1 != 4294967295 ====================================================================== FAIL: test_roundtrip_equality (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 397, in test_roundtrip_equality self.assertEqual(expected, got) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab248dc30>, <__main__.C object at 0x2aaab248dc30>), ('abc', 'abc', <__main__.C object at 0x2aaab248dc30>, <__main__.C object at 0x2aaab248dc30>), 5] ====================================================================== FAIL: test_ints (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 508, in test_ints self.assertEqual(expected, n2) AssertionError: -2147483647 != 2147483649 ====================================================================== FAIL: test_load_from_data1 (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 403, in test_load_from_data1 self.assertEqual(self._testdata, self.loads(DATA1)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab29bd530>, <__main__.C object at 0x2aaab29bd530>), ('abc', 'abc', <__main__.C object at 0x2aaab29bd530>, <__main__.C object at 0x2aaab29bd530>), 5] ====================================================================== FAIL: test_load_from_data2 (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 406, in test_load_from_data2 self.assertEqual(self._testdata, self.loads(DATA2)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab29bd4c0>, <__main__.C object at 0x2aaab29bd4c0>), ('abc', 'abc', <__main__.C object at 0x2aaab29bd4c0>, <__main__.C object at 0x2aaab29bd4c0>), 5] ====================================================================== FAIL: test_long (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 530, in test_long self.assertEqual(n, got) AssertionError: -1 != 4294967295 ====================================================================== FAIL: test_roundtrip_equality (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 397, in test_roundtrip_equality self.assertEqual(expected, got) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), ('abc', 'abc', <__main__.C object at 0x2aaab109b370>, <__main__.C object at 0x2aaab109b370>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab29bd990>, <__main__.C object at 0x2aaab29bd990>), ('abc', 'abc', <__main__.C object at 0x2aaab29bd990>, <__main__.C object at 0x2aaab29bd990>), 5] ====================================================================== FAIL: test_pickling (test.test_range.RangeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_range.py", line 72, in test_pickling list(r)) AssertionError: [] != [-22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 248, in _run_finalizers finalizer() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 187, in __call__ res = self._callback(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/managers.py", line 589, in _finalize_manager if process.is_alive(): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 137, in is_alive self._popen.poll() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 275, in _exit_function for p in active_children(): make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 04:37:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 02:37:35 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080612023735.4C98E1E4005@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/1019 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: The web-page 'force build' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Aborted (core dumped) sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 05:02:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 03:02:45 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080612030245.684C11E4005@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/647 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: 7 tests failed: test_bsddb3 test_datetime test_decimal test_multiprocessing test_pickle test_pickletools test_range ====================================================================== ERROR: test01_pickle_DBError (bsddb.test.test_pickle.pickleTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_pickle.py", line 63, in test01_pickle_DBError self._base_test_pickle_DBError(pickle=pickle) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_pickle.py", line 55, in _base_test_pickle_DBError raise Exception(rottenEgg, '!=', egg) Exception: (DBKeyExistError(4294936300, 'DB_KEYEXIST: Key/data pair already exists'), '!=', DBKeyExistError(-30996, 'DB_KEYEXIST: Key/data pair already exists')) ====================================================================== FAIL: test02 (bsddb.test.test_dbtables.TableDBTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_dbtables.py", line 109, in test02 self.assertEquals(len(values), 2) AssertionError: 3 != 2 ====================================================================== ERROR: test_pickling (test.test_datetime.TestDateTimeTZ) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 2479, in test_pickling derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== ERROR: test_pickling_subclass (test.test_datetime.TestTZInfo) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 116, in test_pickling_subclass derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== ERROR: test_pickling (test.test_datetime.TestTimeTZ) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_datetime.py", line 2252, in test_pickling derived = unpickler.loads(green) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/pickle.py", line 1331, in loads return Unpickler(file, encoding=encoding, errors=errors).load() OverflowError: ('normalized days too large to fit in a C int', , (4294967295, 68400, 0)) ====================================================================== FAIL: test_pickle (test.test_decimal.ContextAPItests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_decimal.py", line 1429, in test_pickle self.assertEqual(v1, v2) AssertionError: -999999999 != 3294967297 Traceback (most recent call last): File "./Lib/test/regrtest.py", line 601, in runtest_inner indirect_test() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/__init__.py", line 225, in Pool return Pool(processes, initializer, initargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/pool.py", line 104, in __init__ w.start() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 104, in start _cleanup() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 58, in _cleanup if p._popen.poll() is not None: File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes ====================================================================== FAIL: test_ints (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 508, in test_ints self.assertEqual(expected, n2) AssertionError: -2147483647 != 2147483649 ====================================================================== FAIL: test_load_from_data1 (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 403, in test_load_from_data1 self.assertEqual(self._testdata, self.loads(DATA1)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab52e23e0>, <__main__.C object at 0x2aaab52e23e0>), ('abc', 'abc', <__main__.C object at 0x2aaab52e23e0>, <__main__.C object at 0x2aaab52e23e0>), 5] ====================================================================== FAIL: test_load_from_data2 (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 406, in test_load_from_data2 self.assertEqual(self._testdata, self.loads(DATA2)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab52e23e0>, <__main__.C object at 0x2aaab52e23e0>), ('abc', 'abc', <__main__.C object at 0x2aaab52e23e0>, <__main__.C object at 0x2aaab52e23e0>), 5] ====================================================================== FAIL: test_long (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 530, in test_long self.assertEqual(n, got) AssertionError: -1 != 4294967295 ====================================================================== FAIL: test_roundtrip_equality (test.test_pickle.CPicklerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 397, in test_roundtrip_equality self.assertEqual(expected, got) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab4f77990>, <__main__.C object at 0x2aaab4f77990>), ('abc', 'abc', <__main__.C object at 0x2aaab4f77990>, <__main__.C object at 0x2aaab4f77990>), 5] ====================================================================== FAIL: test_ints (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 508, in test_ints self.assertEqual(expected, n2) AssertionError: -2147483647 != 2147483649 ====================================================================== FAIL: test_load_from_data1 (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 403, in test_load_from_data1 self.assertEqual(self._testdata, self.loads(DATA1)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab52e2c30>, <__main__.C object at 0x2aaab52e2c30>), ('abc', 'abc', <__main__.C object at 0x2aaab52e2c30>, <__main__.C object at 0x2aaab52e2c30>), 5] ====================================================================== FAIL: test_load_from_data2 (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 406, in test_load_from_data2 self.assertEqual(self._testdata, self.loads(DATA2)) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab52e2bc0>, <__main__.C object at 0x2aaab52e2bc0>), ('abc', 'abc', <__main__.C object at 0x2aaab52e2bc0>, <__main__.C object at 0x2aaab52e2bc0>), 5] ====================================================================== FAIL: test_long (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 530, in test_long self.assertEqual(n, got) AssertionError: -1 != 4294967295 ====================================================================== FAIL: test_roundtrip_equality (test.test_pickletools.OptimizedPickleTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/pickletester.py", line 397, in test_roundtrip_equality self.assertEqual(expected, got) AssertionError: [0, 1, 2.0, (3+0j), 1, -1, 255, -255, -256, 65535, -65535, -65536, 2147483647, -2147483647, -2147483648, ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), ('abc', 'abc', <__main__.C object at 0x2aaaafc83fb0>, <__main__.C object at 0x2aaaafc83fb0>), 5] != [0, 1, 2.0, (3+0j), 1, 4294967295, 255, 4294967041, 4294967040, 65535, 4294901761, 4294901760, 2147483647, 2147483649, 2147483648, ('abc', 'abc', <__main__.C object at 0x2aaab53051b0>, <__main__.C object at 0x2aaab53051b0>), ('abc', 'abc', <__main__.C object at 0x2aaab53051b0>, <__main__.C object at 0x2aaab53051b0>), 5] ====================================================================== FAIL: test_pickling (test.test_range.RangeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_range.py", line 72, in test_pickling list(r)) AssertionError: [] != [-22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 248, in _run_finalizers finalizer() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 187, in __call__ res = self._callback(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/managers.py", line 589, in _finalize_manager if process.is_alive(): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/process.py", line 137, in is_alive self._popen.poll() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/forking.py", line 63, in poll pid, sts = os.waitpid(self.pid, flag) OSError: [Errno 10] No child processes Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/multiprocessing/util.py", line 275, in _exit_function for p in active_children(): make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 05:05:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 03:05:23 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20080612030523.94E361E4005@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/111 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 05:10:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 03:10:24 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080612031024.6ADF71E4009@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/159 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: The web-page 'force build' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Aborted sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 05:32:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 03:32:40 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080612033240.CA1E71E4005@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/1576 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: The web-page 'force build' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_multiprocessing test_socket_ssl Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_multiprocessing.py", line 1764, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/__init__.py", line 226, in Pool return Pool(processes, initializer, initargs) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/pool.py", line 131, in _setup_queues self._inqueue = SimpleQueue() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/queues.py", line 315, in __init__ self._rlock = Lock() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 106, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/multiprocessing/synchronize.py", line 38, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) OSError: [Errno 38] Function not implemented make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 05:33:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 03:33:21 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080612033321.D18431E4005@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/982 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: barry.warsaw 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 Thu Jun 12 11:50:58 2008 From: python-checkins at python.org (armin.rigo) Date: Thu, 12 Jun 2008 11:50:58 +0200 (CEST) Subject: [Python-checkins] r64165 - python/trunk/Lib/test/crashers/loosing_mro_ref.py Message-ID: <20080612095058.D25461E401B@bag.python.org> Author: armin.rigo Date: Thu Jun 12 11:50:58 2008 New Revision: 64165 Log: Sounds obvious, but I didn't even realize that you can put non-string keys in type dictionaries without using this locals() hack. Modified: python/trunk/Lib/test/crashers/loosing_mro_ref.py Modified: python/trunk/Lib/test/crashers/loosing_mro_ref.py ============================================================================== --- python/trunk/Lib/test/crashers/loosing_mro_ref.py (original) +++ python/trunk/Lib/test/crashers/loosing_mro_ref.py Thu Jun 12 11:50:58 2008 @@ -27,10 +27,9 @@ class Base2(object): mykey = 'from Base2' -class X(Base): - # you can't add a non-string key to X.__dict__, but it can be - # there from the beginning :-) - locals()[MyKey()] = 5 +# you can't add a non-string key to X.__dict__, but it can be +# there from the beginning :-) +X = type('X', (Base,), {MyKey(): 5}) print X.mykey # I get a segfault, or a slightly wrong assertion error in a debug build. From buildbot at python.org Thu Jun 12 12:41:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 10:41:18 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080612104119.2C0C31E4006@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/448 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: armin.rigo,benjamin.peterson,georg.brandl,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 12 14:57:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 12:57:01 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080612125701.A94A01E4007@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1572 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: armin.rigo,benjamin.peterson,georg.brandl,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 25 tests failed: test_array test_bufio test_builtin test_bz2 test_codecmaps_jp test_cookielib test_ctypes test_deque test_file test_gzip test_hotshot test_io test_iter test_largefile test_mailbox test_marshal test_multibytecodec test_pkgutil test_plistlib test_site test_univnewlines test_urllib2 test_urllib2net test_uu test_zipfile ====================================================================== ERROR: test_tofromfile (test.test_array.UnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_array.py", line 167, in test_tofromfile f = open(test_support.TESTFN, 'wb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_nullpat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 59, in test_nullpat self.drive_one("\0" * 1000) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 51, in drive_one self.try_one(teststring[:-1]) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_primepat (test.test_bufio.BufferSizeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 56, in test_primepat self.drive_one("1234567890\00\01\02\03\04\05\06") File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 49, in drive_one self.try_one(teststring) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bufio.py", line 21, in try_one f = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' Traceback (most recent call last): File "../lib/test/regrtest.py", line 547, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_builtin.py", line 65, in class BuiltinTest(unittest.TestCase): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_builtin.py", line 416, in BuiltinTest f = open(TESTFN, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testBug1191043 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 264, in testBug1191043 f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testIterator (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 109, in testIterator self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testModeU (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 253, in testModeU self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testOpenDel (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 242, in testOpenDel self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRead (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 62, in testRead self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRead100 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 83, in testRead100 self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadChunk10 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 70, in testReadChunk10 self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadLine (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 90, in testReadLine self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 100, in testReadLines self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekBackwards (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 197, in testSeekBackwards self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekBackwardsFromEnd (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 206, in testSeekBackwardsFromEnd self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekForward (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 188, in testSeekForward self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPostEnd (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 214, in testSeekPostEnd self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPostEndTwice (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 223, in testSeekPostEndTwice self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPreStart (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 233, in testSeekPreStart self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testUniversalNewlinesCRLF (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 133, in testUniversalNewlinesCRLF self.createTempFile(crlf=1) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testUniversalNewlinesLF (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 125, in testUniversalNewlinesLF self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWrite (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 141, in testWrite bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteChunks10 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 151, in testWriteChunks10 bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 166, in testWriteLines bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteMethodsOnReadOnlyFile (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 178, in testWriteMethodsOnReadOnlyFile bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testXReadLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 117, in testXReadLines self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_magic (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 268, in test_bad_magic f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_lwp_valueless_cookie (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 243, in test_lwp_valueless_cookie c.save(filename, ignore_discard=True) File "C:\buildbot\work\trunk.heller-windows\build\lib\_LWPCookieJar.py", line 83, in save f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_mozilla (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 1580, in test_mozilla new_c = save_and_restore(c, True) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 1571, in save_and_restore cj.save(ignore_discard=ignore_discard) File "C:\buildbot\work\trunk.heller-windows\build\lib\_MozillaCookieJar.py", line 118, in save f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 19, in dumps return pickle.dumps(item) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_1) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 71, in dumps return pickle.dumps(item, 1) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "C:\buildbot\work\trunk.heller-windows\build\lib\ctypes\test\test_pickling.py", line 75, in dumps return pickle.dumps(item, 2) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "C:\buildbot\work\trunk.heller-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_maxlen (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 79, in test_maxlen fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 286, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_append (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 54, in test_append self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_many_append (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 65, in test_many_append f = gzip.open(self.filename, 'wb', 9) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 33, in open return GzipFile(filename, mode, compresslevel) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_mode (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 151, in test_mode self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 48, in test_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 85, in test_readline self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 98, in test_readlines self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 112, in test_seek_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_whence (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 132, in test_seek_whence self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 144, in test_seek_write f = gzip.GzipFile(self.filename, 'w') File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_addinfo (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 74, in test_addinfo profiler = self.new_profiler() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_sys_path (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 118, in test_bad_sys_path self.assertRaises(RuntimeError, coverage, test_support.TESTFN) File "C:\buildbot\work\trunk.heller-windows\build\lib\unittest.py", line 329, in failUnlessRaises callableObj(*args, **kwargs) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_line_numbers (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 98, in test_line_numbers self.run_test(g, events, self.new_profiler(lineevents=1)) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_start_stop (test.test_hotshot.HotShotTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 104, in test_start_stop profiler = self.new_profiler() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_hotshot.py", line 42, in new_profiler return hotshot.Profile(self.logfn, lineevents, linetimings) File "C:\buildbot\work\trunk.heller-windows\build\lib\hotshot\__init__.py", line 15, in __init__ logfn, self.lineevents, self.linetimings) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_buffered_file_io (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 165, in test_buffered_file_io f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_close_flushes (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 251, in test_close_flushes f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_destructor (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 245, in test_destructor f = MyFileIO(test_support.TESTFN, "w") IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_large_file_ops (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 211, in test_large_file_ops f = io.open(test_support.TESTFN, "w+b", 0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_raw_file_io (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 151, in test_raw_file_io f = io.open(test_support.TESTFN, "wb", buffering=0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_readline (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 179, in test_readline f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_with_open (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 221, in test_with_open with open(test_support.TESTFN, "wb", bufsize) as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testBasicIO (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 820, in testBasicIO f = io.open(test_support.TESTFN, "w+", encoding=enc) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: Test seek/tell using the StatefulIncrementalDecoder. ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 946, in testSeekAndTell testSeekAndTellWithData(input) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 926, in testSeekAndTellWithData decoded = f.read() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1668, in read decoder = self._decoder or self._get_decoder() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1457, in _get_decoder decoder = make_decoder(self._errors) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 523, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 62, in tearDown self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 45, in _delete_recursively os.rmdir(target) WindowsError: [Error 145] The directory is not empty: '@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_len (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_list_folders (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_pack (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_sequences (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_update (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_values (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_add (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_clear (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_close (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_contains (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_discard (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_flush (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_get (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_items (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\1' ====================================================================== ERROR: test_iter (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 2] The system cannot find the file specified: '@test\\1' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_keys (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_labels (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_len (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 5] Access is denied: '@test\\2' ====================================================================== ERROR: test_pop (test.test_mailbox.TestBabyl) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 57, in setUp self._delete_recursively(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 42, in _delete_recursively os.remove(os.path.join(path, name)) WindowsError: [Error 2] The system cannot find the file specified: '@test\\2' ====================================================================== ERROR: test_floats (test.test_marshal.FloatTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 70, in test_floats marshal.dump(f, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_buffer (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 135, in test_buffer marshal.dump(b, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_string (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 124, in test_string marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_unicode (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 113, in test_unicode marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_dict (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 164, in test_dict marshal.dump(self.d, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_list (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 173, in test_list marshal.dump(lst, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_sets (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 194, in test_sets marshal.dump(t, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_tuple (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 182, in test_tuple marshal.dump(t, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bug1728403 (test.test_multibytecodec.Test_StreamReader) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_multibytecodec.py", line 148, in test_bug1728403 os.unlink(TESTFN) WindowsError: [Error 5] Access is denied: '@test' ====================================================================== ERROR: test_io (test.test_plistlib.TestPlistlib) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_plistlib.py", line 126, in test_io plistlib.writePlist(pl, test_support.TESTFN) File "C:\buildbot\work\trunk.heller-windows\build\lib\plistlib.py", line 90, in writePlist pathOrFile = open(pathOrFile, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== FAIL: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_site.py", line 105, in test_s_option self.assertEqual(rc, 1) AssertionError: 0 != 1 ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_urllib2.py", line 614, in test_file f = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_urllib2net.py", line 116, in test_file f = open(TESTFN, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_decode (test.test_uu.UUFileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_uu.py", line 153, in test_decode uu.decode(f) File "C:\buildbot\work\trunk.heller-windows\build\lib\uu.py", line 111, in decode raise Error('Cannot overwrite existing file: %s' % out_file) Error: Cannot overwrite existing file: @testo ====================================================================== ERROR: test_decodetwice (test.test_uu.UUFileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_uu.py", line 170, in test_decodetwice f = open(self.tmpin, 'r') IOError: [Errno 13] Permission denied: '@testi' ====================================================================== ERROR: test_encode (test.test_uu.UUFileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_uu.py", line 118, in test_encode fin = open(self.tmpin, 'wb') IOError: [Errno 13] Permission denied: '@testi' sincerely, -The Buildbot From python-checkins at python.org Thu Jun 12 16:23:49 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jun 2008 16:23:49 +0200 (CEST) Subject: [Python-checkins] r64169 - in python/trunk: Doc/library/mimetools.rst Lib/mimetools.py Lib/test/test_mimetools.py Lib/test/test_py3kwarn.py Misc/NEWS Message-ID: <20080612142349.6CB7E1E4017@bag.python.org> Author: benjamin.peterson Date: Thu Jun 12 16:23:49 2008 New Revision: 64169 Log: deprecated mimetools Modified: python/trunk/Doc/library/mimetools.rst python/trunk/Lib/mimetools.py python/trunk/Lib/test/test_mimetools.py python/trunk/Lib/test/test_py3kwarn.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/mimetools.rst ============================================================================== --- python/trunk/Doc/library/mimetools.rst (original) +++ python/trunk/Doc/library/mimetools.rst Thu Jun 12 16:23:49 2008 @@ -9,7 +9,8 @@ .. deprecated:: 2.3 The :mod:`email` package should be used in preference to the :mod:`mimetools` - module. This module is present only to maintain backward compatibility. + module. This module is present only to maintain backward compatibility, and + it has been removed in 3.x. .. index:: module: rfc822 Modified: python/trunk/Lib/mimetools.py ============================================================================== --- python/trunk/Lib/mimetools.py (original) +++ python/trunk/Lib/mimetools.py Thu Jun 12 16:23:49 2008 @@ -5,6 +5,9 @@ import rfc822 import tempfile +from warnings import warnpy3k +warnpy3k("in 3.x, mimetools has been removed in favor of the email package") + __all__ = ["Message","choose_boundary","encode","decode","copyliteral", "copybinary"] Modified: python/trunk/Lib/test/test_mimetools.py ============================================================================== --- python/trunk/Lib/test/test_mimetools.py (original) +++ python/trunk/Lib/test/test_mimetools.py Thu Jun 12 16:23:49 2008 @@ -1,7 +1,10 @@ import unittest from test import test_support -import string, StringIO, mimetools +import string +import StringIO + +mimetools = test_support.import_module("mimetools", deprecated=True) msgtext1 = mimetools.Message(StringIO.StringIO( """Content-Type: text/plain; charset=iso-8859-1; format=flowed Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Thu Jun 12 16:23:49 2008 @@ -197,7 +197,7 @@ # test.testall not tested as it executes all unit tests as an # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', - 'Bastion', 'compiler', 'dircache', 'fpformat', + 'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 12 16:23:49 2008 @@ -84,6 +84,8 @@ Library ------- +- The mimetools module has been deprecated for removal in 3.0. + - The ctypes.byref function now takes an optional second parameter which allows to specify an offset in bytes for the constructed pointer-like object. From python-checkins at python.org Thu Jun 12 16:25:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jun 2008 16:25:41 +0200 (CEST) Subject: [Python-checkins] r64170 - peps/trunk/pep-3108.txt Message-ID: <20080612142541.3648A1E401D@bag.python.org> Author: benjamin.peterson Date: Thu Jun 12 16:25:40 2008 New Revision: 64170 Log: done with mimetools Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Thu Jun 12 16:25:40 2008 @@ -78,10 +78,7 @@ + Supplanted by the ``hashlib`` module. -* mimetools (TODO Need to update ``cgi``, ``httplib``, ``urllib``, ``urllib2``, - ``test_cookielib``, ``test_multifile``, ``test_urllib``, - ``test_urllib2``, ``test_urllib2net``, - ``test_urllib_localnet``, ``test_urllibnet``, ``test_xmlrpc``) +* mimetools (done: 2.6, 3.0) + Documented as obsolete in a previous version. + Supplanted by the ``email`` package. From buildbot at python.org Thu Jun 12 16:31:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 14:31:38 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20080612143138.EC3F41E4007@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/760 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Thu Jun 12 20:37:47 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 12 Jun 2008 20:37:47 +0200 (CEST) Subject: [Python-checkins] r64180 - svn:log Message-ID: <20080612183747.64DDF1E4006@bag.python.org> Author: alexandre.vassalotti Revision: 64180 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1,3 +1,3 @@ Restore _pickle module accelerator module. -Removed temporary Windows support. +Removed Windows support temporarily. 64bit bug with integer unpickling is now fixed. From python-checkins at python.org Thu Jun 12 20:38:24 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 12 Jun 2008 20:38:24 +0200 (CEST) Subject: [Python-checkins] r64184 - svn:log Message-ID: <20080612183824.890311E4006@bag.python.org> Author: alexandre.vassalotti Revision: 64184 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -2,6 +2,7 @@ For some yet unknown reason, MSVC's linker fails to resolve _stringio's module initializer (PyInit__stringio). This probably means -the module is not build correctly. Therefore, I am removing temporary -Windows support until I find how to add new modules properly for MSVC. +the module is not build correctly. Therefore, I am removing Windows +support temporarily until I find how to add new modules properly for +MSVC. From python-checkins at python.org Thu Jun 12 20:38:48 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 20:38:48 +0200 (CEST) Subject: [Python-checkins] r64185 - python/trunk/PCbuild/build_tkinter.py Message-ID: <20080612183848.41AAD1E4006@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 20:38:47 2008 New Revision: 64185 Log: Switch to Tcl/Tk 8.5.2. Modified: python/trunk/PCbuild/build_tkinter.py Modified: python/trunk/PCbuild/build_tkinter.py ============================================================================== --- python/trunk/PCbuild/build_tkinter.py (original) +++ python/trunk/PCbuild/build_tkinter.py Thu Jun 12 20:38:47 2008 @@ -11,14 +11,9 @@ here = os.path.abspath(os.path.dirname(__file__)) par = os.path.pardir -if 1: - TCL = "tcl8.4.16" - TK = "tk8.4.16" - TIX = "tix-8.4.0" -else: - TCL = "tcl8.5b3" - TK = "tcl8.5b3" - TIX = "Tix8.4.2" +TCL = "tcl8.5.2" +TK = "tk8.5.2" +TIX = "tix-8.4.0.x" ROOT = os.path.abspath(os.path.join(here, par, par)) # Windows 2000 compatibility: WINVER 0x0500 @@ -38,28 +33,28 @@ if platform == "Win32": dest = os.path.join(ROOT, "tcltk") machine = "X86" - elif platform == "x64": + elif platform == "AMD64": dest = os.path.join(ROOT, "tcltk64") - machine = "X64" + machine = "AMD64" else: raise ValueError(platform) # TCL tcldir = os.path.join(ROOT, TCL) - if 1: + if 0: os.chdir(os.path.join(tcldir, "win")) if clean: nmake("makefile.vc", "clean") - nmake("makefile.vc") - nmake("makefile.vc", "install", INSTALLDIR=dest) + nmake("makefile.vc", MACHINE=machine) + nmake("makefile.vc", "install", INSTALLDIR=dest, MACHINE=machine) # TK - if 1: + if 0: os.chdir(os.path.join(ROOT, TK, "win")) if clean: nmake("makefile.vc", "clean", TCLDIR=tcldir) - nmake("makefile.vc", TCLDIR=tcldir) - nmake("makefile.vc", "install", TCLDIR=tcldir, INSTALLDIR=dest) + nmake("makefile.vc", TCLDIR=tcldir, MACHINE=machine) + nmake("makefile.vc", "install", TCLDIR=tcldir, INSTALLDIR=dest, MACHINE=machine) # TIX if 1: @@ -67,12 +62,12 @@ os.chdir(os.path.join(ROOT, TIX, "win")) if clean: nmake("python9.mak", "clean") - nmake("python9.mak", MACHINE=machine) - nmake("python9.mak", "install") + nmake("python9.mak", MACHINE=machine, INSTALL_DIR=dest) + nmake("python9.mak", "install", INSTALL_DIR=dest) def main(): - if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"): - print("%s Win32|x64" % sys.argv[0]) + if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "AMD64"): + print("%s Win32|AMD64" % sys.argv[0]) sys.exit(1) if "-c" in sys.argv: From python-checkins at python.org Thu Jun 12 20:52:00 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 20:52:00 +0200 (CEST) Subject: [Python-checkins] r64189 - in python/trunk: Misc/NEWS PCbuild/pyproject.vsprops Tools/buildbot/external-amd64.bat Tools/buildbot/external-common.bat Tools/buildbot/external.bat Message-ID: <20080612185200.F061F1E4006@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 20:52:00 2008 New Revision: 64189 Log: Switch to Tcl/Tk 8.5. Modified: python/trunk/Misc/NEWS python/trunk/PCbuild/pyproject.vsprops python/trunk/Tools/buildbot/external-amd64.bat python/trunk/Tools/buildbot/external-common.bat python/trunk/Tools/buildbot/external.bat Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 12 20:52:00 2008 @@ -302,6 +302,8 @@ Build ----- +- The Windows installer now includes Tk 8.5. + - Patch #1722225: Support QNX 6. - ``Lib/lib-old`` is now added to sys.path. Modified: python/trunk/PCbuild/pyproject.vsprops ============================================================================== --- python/trunk/PCbuild/pyproject.vsprops (original) +++ python/trunk/PCbuild/pyproject.vsprops Thu Jun 12 20:52:00 2008 @@ -94,18 +94,18 @@ /> Modified: python/trunk/Tools/buildbot/external-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/external-amd64.bat (original) +++ python/trunk/Tools/buildbot/external-amd64.bat Thu Jun 12 20:52:00 2008 @@ -4,14 +4,14 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -if not exist tcltk64\bin\tcl84g.dll ( - cd tcl-8.4.18.2\win +if not exist tcltk64\bin\tcl85g.dll ( + cd tcl-8.5.2.1\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install cd ..\.. ) -if not exist tcltk64\bin\tk84g.dll ( - cd tk-8.4.18.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.4.18.2 clean all install +if not exist tcltk64\bin\tk85g.dll ( + cd tk-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean all install cd ..\.. ) Modified: python/trunk/Tools/buildbot/external-common.bat ============================================================================== --- python/trunk/Tools/buildbot/external-common.bat (original) +++ python/trunk/Tools/buildbot/external-common.bat Thu Jun 12 20:52:00 2008 @@ -27,8 +27,11 @@ if not exist openssl-0.9.8g svn export http://svn.python.org/projects/external/openssl-0.9.8g @rem tcl/tk -if not exist tcl-8.4.18.2 svn export http://svn.python.org/projects/external/tcl-8.4.18.2 -if not exist tk-8.4.18.1 svn export http://svn.python.org/projects/external/tk-8.4.18.1 +if not exist tcl-8.5.2.1 ( + rd /s/q tcltk tcltk64 + svn export http://svn.python.org/projects/external/tcl-8.5.2.1 +) +if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0 @rem sqlite3 if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 Modified: python/trunk/Tools/buildbot/external.bat ============================================================================== --- python/trunk/Tools/buildbot/external.bat (original) +++ python/trunk/Tools/buildbot/external.bat Thu Jun 12 20:52:00 2008 @@ -4,14 +4,14 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\vsvars32.bat" -if not exist tcltk\bin\tcl84g.dll ( - cd tcl-8.4.18.2\win +if not exist tcltk\bin\tcl85g.dll ( + cd tcl-8.5.2.1\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all install cd ..\.. ) -if not exist tcltk\bin\tk84g.dll ( - cd tk-8.4.18.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.4.18.2 clean all install +if not exist tcltk\bin\tk85g.dll ( + cd tk-8.5.2.0\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean all install cd ..\.. ) From python-checkins at python.org Thu Jun 12 21:00:14 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 21:00:14 +0200 (CEST) Subject: [Python-checkins] r64191 - python/trunk/PCbuild/build_tkinter.py Message-ID: <20080612190014.A30561E4006@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 21:00:14 2008 New Revision: 64191 Log: Revert bogus disabling of Tcl and Tk. Modified: python/trunk/PCbuild/build_tkinter.py Modified: python/trunk/PCbuild/build_tkinter.py ============================================================================== --- python/trunk/PCbuild/build_tkinter.py (original) +++ python/trunk/PCbuild/build_tkinter.py Thu Jun 12 21:00:14 2008 @@ -41,7 +41,7 @@ # TCL tcldir = os.path.join(ROOT, TCL) - if 0: + if 1: os.chdir(os.path.join(tcldir, "win")) if clean: nmake("makefile.vc", "clean") @@ -49,7 +49,7 @@ nmake("makefile.vc", "install", INSTALLDIR=dest, MACHINE=machine) # TK - if 0: + if 1: os.chdir(os.path.join(ROOT, TK, "win")) if clean: nmake("makefile.vc", "clean", TCLDIR=tcldir) From buildbot at python.org Thu Jun 12 21:19:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 19:19:23 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20080612191923.8E67E1E4006@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/762 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Thu Jun 12 21:46:40 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 21:46:40 +0200 (CEST) Subject: [Python-checkins] r64192 - doctools/trunk/sphinx/latexwriter.py Message-ID: <20080612194640.8BE571E4013@bag.python.org> Author: georg.brandl Date: Thu Jun 12 21:46:40 2008 New Revision: 64192 Log: Fix line block rendering. Modified: doctools/trunk/sphinx/latexwriter.py Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Thu Jun 12 21:46:40 2008 @@ -874,7 +874,7 @@ def visit_line(self, node): pass def depart_line(self, node): - pass + self.body.append('~\\\\\n') def visit_block_quote(self, node): # If the block quote contains a single object and that object From python-checkins at python.org Thu Jun 12 21:47:06 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 21:47:06 +0200 (CEST) Subject: [Python-checkins] r64193 - doctools/trunk/sphinx/highlighting.py Message-ID: <20080612194706.51ACC1E4022@bag.python.org> Author: georg.brandl Date: Thu Jun 12 21:47:06 2008 New Revision: 64193 Log: Add a commandprefix to the latex formatter to override Pygments 0.9's awkward 'C' default. Modified: doctools/trunk/sphinx/highlighting.py Modified: doctools/trunk/sphinx/highlighting.py ============================================================================== --- doctools/trunk/sphinx/highlighting.py (original) +++ doctools/trunk/sphinx/highlighting.py Thu Jun 12 21:47:06 2008 @@ -94,8 +94,9 @@ style = get_style_by_name(stylename) self.hfmter = {False: HtmlFormatter(style=style), True: HtmlFormatter(style=style, linenos=True)} - self.lfmter = {False: LatexFormatter(style=style), - True: LatexFormatter(style=style, linenos=True)} + self.lfmter = {False: LatexFormatter(style=style, commandprefix='PYG'), + True: LatexFormatter(style=style, linenos=True, + commandprefix='PYG')} def highlight_block(self, source, lang, linenos=False): def unhighlighted(): From python-checkins at python.org Thu Jun 12 21:51:59 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 21:51:59 +0200 (CEST) Subject: [Python-checkins] r64194 - python/trunk/Tools/buildbot/external.bat Message-ID: <20080612195159.D83561E4006@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 21:51:59 2008 New Revision: 64194 Log: Split Tcl make targets into separate ones. Modified: python/trunk/Tools/buildbot/external.bat Modified: python/trunk/Tools/buildbot/external.bat ============================================================================== --- python/trunk/Tools/buildbot/external.bat (original) +++ python/trunk/Tools/buildbot/external.bat Thu Jun 12 21:51:59 2008 @@ -4,14 +4,18 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\vsvars32.bat" -if not exist tcltk\bin\tcl85g.dll ( +if not exist tcltk\bin\tcl85.dll ( + @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install cd tcl-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all + nmake -f makefile.vc DEBUG=1 INSTALLDIR=..\..\tcltk install cd ..\.. ) -if not exist tcltk\bin\tk85g.dll ( +if not exist tcltk\bin\tk85.dll ( cd tk-8.5.2.0\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean all install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install cd ..\.. ) From python-checkins at python.org Thu Jun 12 22:06:18 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 22:06:18 +0200 (CEST) Subject: [Python-checkins] r64195 - python/trunk/Tools/msi/msilib.py Message-ID: <20080612200618.7ACDE1E4006@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 22:06:18 2008 New Revision: 64195 Log: Support file names which include '+' (for Tk 8.5). Modified: python/trunk/Tools/msi/msilib.py Modified: python/trunk/Tools/msi/msilib.py ============================================================================== --- python/trunk/Tools/msi/msilib.py (original) +++ python/trunk/Tools/msi/msilib.py Thu Jun 12 22:06:18 2008 @@ -333,6 +333,7 @@ #str = str.replace(".", "_") # colons are allowed str = str.replace(" ", "_") str = str.replace("-", "_") + str = str.replace("+", "_") if str[0] in string.digits: str = "_"+str assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str @@ -477,6 +478,7 @@ [(feature.id, component)]) def make_short(self, file): + file = re.sub(r'[\?|><:/*"+,;=\[\]]', '_', file) # restrictions on short names parts = file.split(".") if len(parts)>1: suffix = parts[-1].upper() @@ -505,7 +507,6 @@ if pos in (10, 100, 1000): prefix = prefix[:-1] self.short_names.add(file) - assert not re.search(r'[\?|><:/*"+,;=\[\]]', file) # restrictions on short names return file def add_file(self, file, src=None, version=None, language=None): From python-checkins at python.org Thu Jun 12 22:07:54 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 12 Jun 2008 22:07:54 +0200 (CEST) Subject: [Python-checkins] r64196 - python/trunk/Tools/msi/msi.py Message-ID: <20080612200754.44DB91E4007@bag.python.org> Author: martin.v.loewis Date: Thu Jun 12 22:07:53 2008 New Revision: 64196 Log: Fix Tcl/Tk license file in tcl8*/tk8*, include Tix license. Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Thu Jun 12 22:07:53 2008 @@ -848,17 +848,18 @@ import shutil, glob out = open("LICENSE.txt", "w") shutil.copyfileobj(open(os.path.join(srcdir, "LICENSE")), out) - for dir, file in (("bzip2","LICENSE"), - ("db", "LICENSE"), - ("openssl", "LICENSE"), - ("tcl", "license.terms"), - ("tk", "license.terms")): - out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % dir) - dirs = glob.glob(srcdir+"/../"+dir+"-*") + for name, pat, file in (("bzip2","bzip2-*", "LICENSE"), + ("Berkeley DB", "db-*", "LICENSE"), + ("openssl", "openssl-*", "LICENSE"), + ("Tcl", "tcl8*", "license.terms"), + ("Tk", "tk8*", "license.terms"), + ("Tix", "tix-*", "license.terms")): + out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % name) + dirs = glob.glob(srcdir+"/../"+pat) if not dirs: - raise ValueError, "Could not find "+srcdir+"/../"+dir+"-*" + raise ValueError, "Could not find "+srcdir+"/../"+pat if len(dirs) > 2: - raise ValueError, "Multiple copies of "+dir + raise ValueError, "Multiple copies of "+pat dir = dirs[0] shutil.copyfileobj(open(os.path.join(dir, file)), out) out.close() From buildbot at python.org Thu Jun 12 22:21:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 20:21:34 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080612202135.38A1E1E4006@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/450 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Thu Jun 12 22:27:42 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 12 Jun 2008 22:27:42 +0200 (CEST) Subject: [Python-checkins] r64197 - python/trunk/PCbuild/pcbuild.sln Message-ID: <20080612202742.6BB061E4006@bag.python.org> Author: amaury.forgeotdarc Date: Thu Jun 12 22:27:42 2008 New Revision: 64197 Log: It seems that my VS2008 Express does not include a project in the build configuration, if its UUID has lowercase letters. Modified: python/trunk/PCbuild/pcbuild.sln Modified: python/trunk/PCbuild/pcbuild.sln ============================================================================== --- python/trunk/PCbuild/pcbuild.sln (original) +++ python/trunk/PCbuild/pcbuild.sln Thu Jun 12 22:27:42 2008 @@ -131,7 +131,7 @@ {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9e48b300-37d1-11dd-8c41-005056c00008}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" ProjectSection(ProjectDependencies) = postProject {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection @@ -542,6 +542,22 @@ {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32 {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64 {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.ActiveCfg = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.Build.0 = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.ActiveCfg = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.Build.0 = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.ActiveCfg = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64 @@ -558,22 +574,6 @@ {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|Win32.ActiveCfg = Debug|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|Win32.Build.0 = Debug|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|x64.ActiveCfg = Debug|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.Debug|x64.Build.0 = Debug|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.Release|Win32.ActiveCfg = Release|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.Release|Win32.Build.0 = Release|Win32 - {9e48b300-37d1-11dd-8c41-005056c00008}.Release|x64.ActiveCfg = Release|x64 - {9e48b300-37d1-11dd-8c41-005056c00008}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From python-checkins at python.org Thu Jun 12 23:08:33 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 23:08:33 +0200 (CEST) Subject: [Python-checkins] r64198 - doctools/trunk/sphinx/static/default.css Message-ID: <20080612210833.EAE651E4006@bag.python.org> Author: georg.brandl Date: Thu Jun 12 23:08:33 2008 New Revision: 64198 Log: Fix style nit. Modified: doctools/trunk/sphinx/static/default.css Modified: doctools/trunk/sphinx/static/default.css ============================================================================== --- doctools/trunk/sphinx/static/default.css (original) +++ doctools/trunk/sphinx/static/default.css Thu Jun 12 23:08:33 2008 @@ -556,6 +556,10 @@ line-height: 130%; } +div.body p.caption { + text-align: inherit; +} + div.body td { text-align: left; } From python-checkins at python.org Thu Jun 12 23:48:27 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 23:48:27 +0200 (CEST) Subject: [Python-checkins] r64199 - doctools/trunk/sphinx/environment.py Message-ID: <20080612214827.664041E4002@bag.python.org> Author: georg.brandl Date: Thu Jun 12 23:48:27 2008 New Revision: 64199 Log: Factor out toctree resolution and add an option to ignore sublevel document headings. Modified: doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Thu Jun 12 23:48:27 2008 @@ -703,6 +703,7 @@ stream=RedirStream(self._warnfunc)) return doctree + def get_and_resolve_doctree(self, docname, builder, doctree=None, prune_toctrees=True): """Read the doctree from the pickle, resolve cross-references and @@ -714,7 +715,41 @@ self.resolve_references(doctree, docname, builder) # now, resolve all toctree nodes - def _entries_from_toctree(toctreenode, separate=False): + for toctreenode in doctree.traverse(addnodes.toctree): + result = self.resolve_toctree(docname, builder, toctreenode, + prune=prune_toctrees) + if result is None: + toctreenode.replace_self([]) + else: + toctreenode.replace_self(result) + + return doctree + + def resolve_toctree(self, docname, builder, toctree, prune=True, maxdepth=0, + titles_only=False): + """ + Resolve a *toctree* node into individual bullet lists with titles + as items, returning None (if no containing titles are found) or + a new node. + + If *prune* is True, the tree is pruned to *maxdepth*, or if that is 0, + to the value of the *maxdepth* option on the *toctree* node. + If *titles_only* is True, only toplevel document titles will be in the + resulting tree. + """ + + def _walk_depth(node, depth, maxdepth, titleoverrides): + """Utility: Cut a TOC at a specified depth.""" + for subnode in node.children[:]: + if isinstance(subnode, (addnodes.compact_paragraph, nodes.list_item)): + _walk_depth(subnode, depth, maxdepth, titleoverrides) + elif isinstance(subnode, nodes.bullet_list): + if depth > maxdepth: + subnode.parent.replace(subnode, []) + else: + _walk_depth(subnode, depth+1, maxdepth, titleoverrides) + + def _entries_from_toctree(toctreenode, separate=False): """Return TOC entries for a toctree node.""" includefiles = map(str, toctreenode['includefiles']) @@ -727,6 +762,15 @@ self.warn(docname, 'toctree contains ref to nonexisting ' 'file %r' % includefile) else: + # if titles_only is given, only keep the main title and + # sub-toctrees + if titles_only: + # delete everything but the toplevel title(s) and toctrees + for toplevel in toc: + # nodes with length 1 don't have any children anyway + if len(toplevel) > 1: + subtoctrees = toplevel.traverse(addnodes.toctree) + toplevel[1][:] = subtoctrees # resolve all sub-toctrees for toctreenode in toc.traverse(addnodes.toctree): i = toctreenode.parent.index(toctreenode) + 1 @@ -740,49 +784,28 @@ entries.extend(toc.children) return entries - def _walk_depth(node, depth, maxdepth, titleoverrides): - """Utility: Cut a TOC at a specified depth.""" - for subnode in node.children[:]: - if isinstance(subnode, (addnodes.compact_paragraph, nodes.list_item)): - _walk_depth(subnode, depth, maxdepth, titleoverrides) - elif isinstance(subnode, nodes.bullet_list): - if depth > maxdepth: - subnode.parent.replace(subnode, []) - else: - _walk_depth(subnode, depth+1, maxdepth, titleoverrides) - - for toctreenode in doctree.traverse(addnodes.toctree): - maxdepth = toctreenode.get('maxdepth', -1) - titleoverrides = toctreenode.get('includetitles', {}) - tocentries = _entries_from_toctree(toctreenode, separate=True) - if tocentries: - newnode = addnodes.compact_paragraph('', '', *tocentries) - newnode['toctree'] = True - # prune the tree to maxdepth and replace titles - if maxdepth > 0 and prune_toctrees: - _walk_depth(newnode, 1, maxdepth, titleoverrides) - # replace titles, if needed - if titleoverrides: - for refnode in newnode.traverse(nodes.reference): - if refnode.get('anchorname', None): - continue - if refnode['refuri'] in titleoverrides: - newtitle = titleoverrides[refnode['refuri']] - refnode.children = [nodes.Text(newtitle)] - toctreenode.replace_self(newnode) - else: - toctreenode.replace_self([]) - - # set the target paths in the toctrees (they are not known - # at TOC generation time) - for node in doctree.traverse(nodes.reference): - if node.hasattr('anchorname'): - # a TOC reference - node['refuri'] = builder.get_relative_uri( - docname, node['refuri']) + node['anchorname'] - - return doctree + maxdepth = maxdepth or toctree.get('maxdepth', -1) + titleoverrides = toctree.get('includetitles', {}) + tocentries = _entries_from_toctree(toctree, separate=True) + if not tocentries: + return None + + newnode = addnodes.compact_paragraph('', '', *tocentries) + newnode['toctree'] = True + # prune the tree to maxdepth and replace titles + if maxdepth > 0 and prune: + _walk_depth(newnode, 1, maxdepth, titleoverrides) + # replace titles, if needed, and set the target paths in the + # toctrees (they are not known at TOC generation time) + for refnode in newnode.traverse(nodes.reference): + refnode['refuri'] = builder.get_relative_uri( + docname, refnode['refuri']) + refnode['anchorname'] + if titleoverrides and not refnode['anchorname'] \ + and refnode['refuri'] in titleoverrides: + newtitle = titleoverrides[refnode['refuri']] + refnode.children = [nodes.Text(newtitle)] + return newnode descroles = frozenset(('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'cfunc', 'cdata', 'ctype', 'cmacro')) From python-checkins at python.org Thu Jun 12 23:56:06 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 23:56:06 +0200 (CEST) Subject: [Python-checkins] r64200 - in doctools/trunk: CHANGES doc/changes.rst doc/markup/misc.rst sphinx/environment.py Message-ID: <20080612215606.D5FBB1E4002@bag.python.org> Author: georg.brandl Date: Thu Jun 12 23:56:06 2008 New Revision: 64200 Log: Add maxdepth for TOCs. Modified: doctools/trunk/CHANGES doctools/trunk/doc/changes.rst doctools/trunk/doc/markup/misc.rst doctools/trunk/sphinx/environment.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Thu Jun 12 23:56:06 2008 @@ -38,6 +38,9 @@ * Added TextBuilder to create plain-text output. +* ``tocdepth`` can be given as a file-wide metadata entry, and specifies + the maximum depth of a TOC of this file. + Bugs fixed ---------- Modified: doctools/trunk/doc/changes.rst ============================================================================== --- doctools/trunk/doc/changes.rst (original) +++ doctools/trunk/doc/changes.rst Thu Jun 12 23:56:06 2008 @@ -1,3 +1,5 @@ +:tocdepth: 2 + .. _changes: Changes in Sphinx Modified: doctools/trunk/doc/markup/misc.rst ============================================================================== --- doctools/trunk/doc/markup/misc.rst (original) +++ doctools/trunk/doc/markup/misc.rst Thu Jun 12 23:56:06 2008 @@ -16,7 +16,12 @@ other metadata. In Sphinx, the docinfo is used as metadata, too, but not displayed in the output. -At the moment, only one metadata field is recognized: +At the moment, these metadata fields are recognized: + +``tocdepth`` + The maximum depth for a table of contents of this file. + + .. versionadded:: 0.4 ``nocomments`` If set, the web application won't display a comment form for a page generated Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Thu Jun 12 23:56:06 2008 @@ -605,7 +605,12 @@ """Build a TOC from the doctree and store it in the inventory.""" numentries = [0] # nonlocal again... - def build_toc(node): + try: + maxdepth = int(self.metadata[docname].get('tocdepth', 0)) + except ValueError: + maxdepth = 0 + + def build_toc(node, depth=1): entries = [] for subnode in node: if isinstance(subnode, addnodes.toctree): @@ -636,7 +641,8 @@ *nodetext) para = addnodes.compact_paragraph('', '', reference) item = nodes.list_item('', para) - item += build_toc(subnode) + if maxdepth == 0 or depth < maxdepth: + item += build_toc(subnode, depth+1) entries.append(item) if entries: return nodes.bullet_list('', *entries) @@ -749,7 +755,7 @@ else: _walk_depth(subnode, depth+1, maxdepth, titleoverrides) - def _entries_from_toctree(toctreenode, separate=False): + def _entries_from_toctree(toctreenode, separate=False): """Return TOC entries for a toctree node.""" includefiles = map(str, toctreenode['includefiles']) From python-checkins at python.org Thu Jun 12 23:57:31 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 12 Jun 2008 23:57:31 +0200 (CEST) Subject: [Python-checkins] r64201 - doctools/trunk/sphinx/environment.py Message-ID: <20080612215731.A7B7D1E4002@bag.python.org> Author: georg.brandl Date: Thu Jun 12 23:57:31 2008 New Revision: 64201 Log: #3096: sort "unused" warnings by docname. Modified: doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Thu Jun 12 23:57:31 2008 @@ -1076,7 +1076,7 @@ def check_consistency(self): """Do consistency checks.""" - for docname in self.all_docs: + for docname in sorted(self.all_docs): if docname not in self.files_to_rebuild: if docname == self.config.master_doc: # the master file is not included anywhere ;) From python-checkins at python.org Thu Jun 12 23:58:20 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 12 Jun 2008 23:58:20 +0200 (CEST) Subject: [Python-checkins] r64202 - in python/trunk: PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/kill_python.c PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyproject.vsprops PC/VS8.0/python.vcproj PC/VS8.0/sqlite3.vcproj PCbuild/_elementtree.vcproj PCbuild/make_versioninfo.vcproj PCbuild/python.vcproj PCbuild/vs9to8.py Message-ID: <20080612215820.D18A51E4002@bag.python.org> Author: amaury.forgeotdarc Date: Thu Jun 12 23:58:20 2008 New Revision: 64202 Log: Update VS8.0 build files, using the script vs9to8.py. Also remove references to odbc libraries, which are not shipped with vs2003 express. (and certainly not useful) Added: python/trunk/PC/VS8.0/kill_python.c - copied unchanged from r64196, /python/trunk/PCbuild/kill_python.c Modified: python/trunk/PC/VS8.0/_bsddb.vcproj python/trunk/PC/VS8.0/_bsddb44.vcproj python/trunk/PC/VS8.0/_elementtree.vcproj python/trunk/PC/VS8.0/_sqlite3.vcproj python/trunk/PC/VS8.0/make_versioninfo.vcproj python/trunk/PC/VS8.0/pcbuild.sln python/trunk/PC/VS8.0/pyproject.vsprops python/trunk/PC/VS8.0/python.vcproj python/trunk/PC/VS8.0/sqlite3.vcproj python/trunk/PCbuild/_elementtree.vcproj python/trunk/PCbuild/make_versioninfo.vcproj python/trunk/PCbuild/python.vcproj python/trunk/PCbuild/vs9to8.py Modified: python/trunk/PC/VS8.0/_bsddb.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_bsddb.vcproj (original) +++ python/trunk/PC/VS8.0/_bsddb.vcproj Thu Jun 12 23:58:20 2008 @@ -42,7 +42,7 @@ /> Modified: python/trunk/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_elementtree.vcproj (original) +++ python/trunk/PC/VS8.0/_elementtree.vcproj Thu Jun 12 23:58:20 2008 @@ -56,7 +56,6 @@ /> @@ -437,7 +431,6 @@ /> Modified: python/trunk/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_sqlite3.vcproj (original) +++ python/trunk/PC/VS8.0/_sqlite3.vcproj Thu Jun 12 23:58:20 2008 @@ -42,7 +42,7 @@ /> Modified: python/trunk/PC/VS8.0/python.vcproj ============================================================================== --- python/trunk/PC/VS8.0/python.vcproj (original) +++ python/trunk/PC/VS8.0/python.vcproj Thu Jun 12 23:58:20 2008 @@ -62,7 +62,6 @@ /> @@ -573,167 +573,167 @@ Name="Source Files" > Modified: python/trunk/PCbuild/_elementtree.vcproj ============================================================================== --- python/trunk/PCbuild/_elementtree.vcproj (original) +++ python/trunk/PCbuild/_elementtree.vcproj Thu Jun 12 23:58:20 2008 @@ -56,7 +56,6 @@ /> @@ -437,7 +431,6 @@ /> Modified: python/trunk/PCbuild/make_versioninfo.vcproj ============================================================================== --- python/trunk/PCbuild/make_versioninfo.vcproj (original) +++ python/trunk/PCbuild/make_versioninfo.vcproj Thu Jun 12 23:58:20 2008 @@ -67,7 +67,6 @@ /> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3214 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpH9hFah/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 00:33:07 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 00:33:07 +0200 (CEST) Subject: [Python-checkins] r64206 - in python/trunk: Doc/library/rfc822.rst Lib/rfc822.py Lib/test/test_py3kwarn.py Lib/test/test_rfc822.py Misc/NEWS Message-ID: <20080612223307.8301B1E4002@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 00:33:06 2008 New Revision: 64206 Log: add py3k warnings to rfc822 Modified: python/trunk/Doc/library/rfc822.rst python/trunk/Lib/rfc822.py python/trunk/Lib/test/test_py3kwarn.py python/trunk/Lib/test/test_rfc822.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/rfc822.rst ============================================================================== --- python/trunk/Doc/library/rfc822.rst (original) +++ python/trunk/Doc/library/rfc822.rst Fri Jun 13 00:33:06 2008 @@ -9,7 +9,8 @@ .. deprecated:: 2.3 The :mod:`email` package should be used in preference to the :mod:`rfc822` - module. This module is present only to maintain backward compatibility. + module. This module is present only to maintain backward compatibility, and + has been removed in 3.0. This module defines a class, :class:`Message`, which represents an "email message" as defined by the Internet standard :rfc:`2822`. [#]_ Such messages Modified: python/trunk/Lib/rfc822.py ============================================================================== --- python/trunk/Lib/rfc822.py (original) +++ python/trunk/Lib/rfc822.py Fri Jun 13 00:33:06 2008 @@ -73,6 +73,9 @@ import time +from warnings import warnpy3k +warnpy3k("in 3.x, rfc822 has been removed in favor of the email package") + __all__ = ["Message","AddressList","parsedate","parsedate_tz","mktime_tz"] _blanklines = ('\r\n', '\n') # Optimization for islast() Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Fri Jun 13 00:33:06 2008 @@ -198,7 +198,7 @@ # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', 'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', - 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') + 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib', 'rfc822') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', Modified: python/trunk/Lib/test/test_rfc822.py ============================================================================== --- python/trunk/Lib/test/test_rfc822.py (original) +++ python/trunk/Lib/test/test_rfc822.py Fri Jun 13 00:33:06 2008 @@ -1,7 +1,8 @@ -import rfc822 import unittest from test import test_support +rfc822 = test_support.import_module("rfc822", deprecated=True) + try: from cStringIO import StringIO except ImportError: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 13 00:33:06 2008 @@ -84,6 +84,8 @@ Library ------- +- The rfc822 module has been deprecated for removal in 3.0. + - The mimetools module has been deprecated for removal in 3.0. - The ctypes.byref function now takes an optional second parameter From buildbot at python.org Fri Jun 13 01:15:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 23:15:53 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080612231554.15FDA1E4002@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/454 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 01:17:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 12 Jun 2008 23:17:11 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080612231711.B768D1E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3545 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket_ssl Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 498, in __bootstrap self.__bootstrap_inner() make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 01:39:54 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 01:39:54 +0200 (CEST) Subject: [Python-checkins] r64211 - peps/trunk/pep-3108.txt Message-ID: <20080612233954.6AC471E4011@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 01:39:54 2008 New Revision: 64211 Log: finished with rfc822 Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Fri Jun 13 01:39:54 2008 @@ -78,7 +78,7 @@ + Supplanted by the ``hashlib`` module. -* mimetools (done: 2.6, 3.0) +* mimetools [done: 2.6, 3.0] + Documented as obsolete in a previous version. + Supplanted by the ``email`` package. @@ -99,7 +99,7 @@ + Locking is better done by ``fcntl.lockf()``. -* rfc822 (TODO Remove usage from ``cgi``, ``test_urllib2``) +* rfc822 [done: 2.6, 3.0] + Supplanted by the ``email`` package. From python-checkins at python.org Fri Jun 13 02:09:47 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 02:09:47 +0200 (CEST) Subject: [Python-checkins] r64212 - in python/trunk: Include/pythread.h Modules/signalmodule.c Parser/intrcheck.c Python/thread.c Message-ID: <20080613000947.CA85A1E4002@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 02:09:47 2008 New Revision: 64212 Log: #1683 prevent forking from interfering in threading storage This should prevent some test_multiprocessing failures Modified: python/trunk/Include/pythread.h python/trunk/Modules/signalmodule.c python/trunk/Parser/intrcheck.c python/trunk/Python/thread.c Modified: python/trunk/Include/pythread.h ============================================================================== --- python/trunk/Include/pythread.h (original) +++ python/trunk/Include/pythread.h Fri Jun 13 02:09:47 2008 @@ -40,6 +40,9 @@ PyAPI_FUNC(void *) PyThread_get_key_value(int); PyAPI_FUNC(void) PyThread_delete_key_value(int key); +/* Cleanup after a fork */ +PyAPI_FUNC(void) PyThread_ReInitTLS(void); + #ifdef __cplusplus } #endif Modified: python/trunk/Modules/signalmodule.c ============================================================================== --- python/trunk/Modules/signalmodule.c (original) +++ python/trunk/Modules/signalmodule.c Fri Jun 13 02:09:47 2008 @@ -925,5 +925,6 @@ main_thread = PyThread_get_thread_ident(); main_pid = getpid(); _PyImport_ReInitLock(); + PyThread_ReInitTLS(); #endif } Modified: python/trunk/Parser/intrcheck.c ============================================================================== --- python/trunk/Parser/intrcheck.c (original) +++ python/trunk/Parser/intrcheck.c Fri Jun 13 02:09:47 2008 @@ -2,6 +2,7 @@ /* Check for interrupts */ #include "Python.h" +#include "pythread.h" #ifdef QUICKWIN @@ -172,5 +173,6 @@ { #ifdef WITH_THREAD PyEval_ReInitThreads(); + PyThread_ReInitTLS(); #endif } Modified: python/trunk/Python/thread.c ============================================================================== --- python/trunk/Python/thread.c (original) +++ python/trunk/Python/thread.c Fri Jun 13 02:09:47 2008 @@ -381,4 +381,35 @@ PyThread_release_lock(keymutex); } +/* Forget everything not associated with the current thread id. + * This function is called from PyOS_AfterFork(). It is necessary + * because other thread ids which were in use at the time of the fork + * may be reused for new threads created in the forked process. + */ +void +PyThread_ReInitTLS(void) +{ + long id = PyThread_get_thread_ident(); + struct key *p, **q; + + if (!keymutex) + return; + + /* As with interpreter_lock in PyEval_ReInitThreads() + we just create a new lock without freeing the old one */ + keymutex = PyThread_allocate_lock(); + + /* Delete all keys which do not match the current thread id */ + q = &keyhead; + while ((p = *q) != NULL) { + if (p->id != id) { + *q = p->next; + free((void *)p); + /* NB This does *not* free p->value! */ + } + else + q = &p->next; + } +} + #endif /* Py_HAVE_NATIVE_TLS */ From buildbot at python.org Fri Jun 13 02:19:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 00:19:40 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080613001940.CD6431E4002@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/367 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 02:42:22 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jun 2008 02:42:22 +0200 (CEST) Subject: [Python-checkins] r64214 - in python/trunk: Include/pythonrun.h Modules/errnomodule.c Modules/socketmodule.c Modules/socketmodule.h PC/VC6/_socket.dsp PC/VC6/pythoncore.dsp PC/msvcrtmodule.c PC/pyconfig.h Message-ID: <20080613004222.D00A91E4002@bag.python.org> Author: amaury.forgeotdarc Date: Fri Jun 13 02:42:22 2008 New Revision: 64214 Log: Restore support for Microsoft VC6 compiler. Some functions in the msvcrt module are skipped, and socket.ioctl is enabled only when using a more recent Platform SDK. (and yes, there are still companies that use a 10-years old compiler) Modified: python/trunk/Include/pythonrun.h python/trunk/Modules/errnomodule.c python/trunk/Modules/socketmodule.c python/trunk/Modules/socketmodule.h python/trunk/PC/VC6/_socket.dsp python/trunk/PC/VC6/pythoncore.dsp python/trunk/PC/msvcrtmodule.c python/trunk/PC/pyconfig.h Modified: python/trunk/Include/pythonrun.h ============================================================================== --- python/trunk/Include/pythonrun.h (original) +++ python/trunk/Include/pythonrun.h Fri Jun 13 02:42:22 2008 @@ -153,7 +153,7 @@ to a 8k margin. */ #define PYOS_STACK_MARGIN 2048 -#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) +#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif Modified: python/trunk/Modules/errnomodule.c ============================================================================== --- python/trunk/Modules/errnomodule.c (original) +++ python/trunk/Modules/errnomodule.c Fri Jun 13 02:42:22 2008 @@ -5,7 +5,7 @@ /* Windows socket errors (WSA*) */ #ifdef MS_WINDOWS -#include +#include #endif /* Modified: python/trunk/Modules/socketmodule.c ============================================================================== --- python/trunk/Modules/socketmodule.c (original) +++ python/trunk/Modules/socketmodule.c Fri Jun 13 02:42:22 2008 @@ -2805,7 +2805,7 @@ Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\ of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR)."); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) static PyObject* sock_ioctl(PySocketSockObject *s, PyObject *arg) { @@ -2858,7 +2858,7 @@ METH_NOARGS, getsockname_doc}, {"getsockopt", (PyCFunction)sock_getsockopt, METH_VARARGS, getsockopt_doc}, -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) {"ioctl", (PyCFunction)sock_ioctl, METH_VARARGS, sock_ioctl_doc}, #endif Modified: python/trunk/Modules/socketmodule.h ============================================================================== --- python/trunk/Modules/socketmodule.h (original) +++ python/trunk/Modules/socketmodule.h Fri Jun 13 02:42:22 2008 @@ -13,19 +13,23 @@ # endif #else /* MS_WINDOWS */ -#if _MSC_VER >= 1300 # include # include -# include /* for SIO_RCVALL */ -# define HAVE_ADDRINFO -# define HAVE_SOCKADDR_STORAGE -# define HAVE_GETADDRINFO -# define HAVE_GETNAMEINFO -# define ENABLE_IPV6 -#else -# include -#endif -#endif +/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h + * Separate SDKs have all the functions we want, but older ones don't have + * any version information. I use IPPROTO_IPV6 to detect a decent SDK. + */ +# ifdef IPPROTO_IPV6 +# include /* for SIO_RCVALL */ +# define HAVE_ADDRINFO +# define HAVE_SOCKADDR_STORAGE +# define HAVE_GETADDRINFO +# define HAVE_GETNAMEINFO +# define ENABLE_IPV6 +# else +typedef int socklen_t; +# endif /* IPPROTO_IPV6 */ +#endif /* MS_WINDOWS */ #ifdef HAVE_SYS_UN_H # include Modified: python/trunk/PC/VC6/_socket.dsp ============================================================================== --- python/trunk/PC/VC6/_socket.dsp (original) +++ python/trunk/PC/VC6/_socket.dsp Fri Jun 13 02:42:22 2008 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd" +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_socket - Win32 Debug" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/trunk/PC/VC6/pythoncore.dsp ============================================================================== --- python/trunk/PC/VC6/pythoncore.dsp (original) +++ python/trunk/PC/VC6/pythoncore.dsp Fri Jun 13 02:42:22 2008 @@ -97,6 +97,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\cjkcodecs\_codecs_cn.c # End Source File # Begin Source File Modified: python/trunk/PC/msvcrtmodule.c ============================================================================== --- python/trunk/PC/msvcrtmodule.c (original) +++ python/trunk/PC/msvcrtmodule.c Fri Jun 13 02:42:22 2008 @@ -143,6 +143,7 @@ return PyString_FromStringAndSize(s, 1); } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_getwch(PyObject *self, PyObject *args) { @@ -158,6 +159,7 @@ u[0] = ch; return PyUnicode_FromUnicode(u, 1); } +#endif static PyObject * msvcrt_getche(PyObject *self, PyObject *args) @@ -175,6 +177,7 @@ return PyString_FromStringAndSize(s, 1); } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_getwche(PyObject *self, PyObject *args) { @@ -190,6 +193,7 @@ s[0] = ch; return PyUnicode_FromUnicode(s, 1); } +#endif static PyObject * msvcrt_putch(PyObject *self, PyObject *args) @@ -204,7 +208,7 @@ return Py_None; } - +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_putwch(PyObject *self, PyObject *args) { @@ -223,6 +227,7 @@ Py_RETURN_NONE; } +#endif static PyObject * msvcrt_ungetch(PyObject *self, PyObject *args) @@ -238,6 +243,7 @@ return Py_None; } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_ungetwch(PyObject *self, PyObject *args) { @@ -251,6 +257,7 @@ Py_INCREF(Py_None); return Py_None; } +#endif static void insertint(PyObject *d, char *name, int value) @@ -279,11 +286,12 @@ {"getche", msvcrt_getche, METH_VARARGS}, {"putch", msvcrt_putch, METH_VARARGS}, {"ungetch", msvcrt_ungetch, METH_VARARGS}, +#ifdef _WCONIO_DEFINED {"getwch", msvcrt_getwch, METH_VARARGS}, {"getwche", msvcrt_getwche, METH_VARARGS}, {"putwch", msvcrt_putwch, METH_VARARGS}, {"ungetwch", msvcrt_ungetwch, METH_VARARGS}, - +#endif {NULL, NULL} }; Modified: python/trunk/PC/pyconfig.h ============================================================================== --- python/trunk/PC/pyconfig.h (original) +++ python/trunk/PC/pyconfig.h Fri Jun 13 02:42:22 2008 @@ -467,13 +467,6 @@ /* Define to `unsigned' if doesn't define. */ /* #undef size_t */ -/* Define to `int' if doesn't define. */ -#if _MSC_VER + 0 >= 1300 -/* VC.NET typedefs socklen_t in ws2tcpip.h. */ -#else -#define socklen_t int -#endif - /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 From buildbot at python.org Fri Jun 13 04:14:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 02:14:18 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080613021419.15BF01E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3217 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From emcourses at trilifecom.com Thu Jun 12 12:31:00 2008 From: emcourses at trilifecom.com (Professional Communications Training) Date: Thu, 12 Jun 2008 18:31:00 +0800 Subject: [Python-checkins] Communicating Effectively 26 and 27 June Message-ID: <20080612103100328.3B3E300E433F3C25@C34342-49909> If you can't read this, please visit our website at: http://www.trilifecom.com. Should you wish to enquire about our courses, change your email address or unsubscribe, please email us at courses at trilifecom.com. We apologise if you have unsubscribed and are still receiving emails from us. We need the exact email address to unsubscribe. Thanks. Like it or not, all action and work needs to be carried out through communication with other human beings, yet many of us lack the communication skills to communicate successfully. This often results in miscommunication and misunderstandings at work, which lead to unnecessary errors being made and low morale. In turn these contribute to lower productivity and loss of profits. There is a way to rectify such costly effects - by training in communication skills. You learn how to communicate effectively in our 2-day course. You learn how to listen, to be genuine, relate to others and build rapport, which results in higher morale and fewer errors made. You fill out an online questionnaire, before the course starts. A report is generated from the results of the questionnaire. This report is referred to during the course, to identify communication areas to improve on. Sign up for our course today and develop more satisfying relationships at work and in personal and social situations The fee for the course is $488/- plus an additional $140 for the proprietary report and materials used. SDF provides some funding for the course. For full course, registration and SDF funding details, please visit our website at: http://www.trilifecom.com. Please also visit our website for information on our other courses. We look forward with great pleasure to welcoming you to our course. Yours sincerely Merle Celine Magness (Ms) TriLife Communications, Singapore Tel: 6581-0970 Email: courses at trilifecom.com website: http://www.trilifecom.com This is a genuine advertisement. Should you wish to enquire about our courses, change your email address or unsubscribe, please email us at courses at trilifecom.com. We apologise if you have unsubscribed and are still receiving emails from us. We need the exact email address to unsubscribe. -------------- next part -------------- An HTML attachment was scrubbed... URL: From buildbot at python.org Fri Jun 13 05:01:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 03:01:47 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080613030148.2657B1E4006@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1012 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 08:00:46 2008 From: python-checkins at python.org (neal.norwitz) Date: Fri, 13 Jun 2008 08:00:46 +0200 (CEST) Subject: [Python-checkins] r64219 - python/trunk/Modules/_ctypes/callproc.c Message-ID: <20080613060046.779051E4006@bag.python.org> Author: neal.norwitz Date: Fri Jun 13 08:00:46 2008 New Revision: 64219 Log: Check for memory alloc failure Modified: python/trunk/Modules/_ctypes/callproc.c Modified: python/trunk/Modules/_ctypes/callproc.c ============================================================================== --- python/trunk/Modules/_ctypes/callproc.c (original) +++ python/trunk/Modules/_ctypes/callproc.c Fri Jun 13 08:00:46 2008 @@ -1849,6 +1849,8 @@ return NULL; } shape = PyTuple_New(dict->ndim); + if (shape == NULL) + return NULL; for (i = 0; i < (int)dict->ndim; ++i) PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i])); From python-checkins at python.org Fri Jun 13 08:02:26 2008 From: python-checkins at python.org (neal.norwitz) Date: Fri, 13 Jun 2008 08:02:26 +0200 (CEST) Subject: [Python-checkins] r64220 - python/trunk/Modules/arraymodule.c Message-ID: <20080613060226.5BC4D1E4006@bag.python.org> Author: neal.norwitz Date: Fri Jun 13 08:02:26 2008 New Revision: 64220 Log: Fix some memory dealloc problems when exceptions occur. It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest. Modified: python/trunk/Modules/arraymodule.c Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Fri Jun 13 08:02:26 2008 @@ -432,6 +432,9 @@ if (op == NULL) { return NULL; } + op->ob_descr = descr; + op->allocated = size; + op->weakreflist = NULL; Py_SIZE(op) = size; if (size <= 0) { op->ob_item = NULL; @@ -439,13 +442,10 @@ else { op->ob_item = PyMem_NEW(char, nbytes); if (op->ob_item == NULL) { - PyObject_Del(op); + Py_DECREF(op); return PyErr_NoMemory(); } } - op->ob_descr = descr; - op->allocated = size; - op->weakreflist = NULL; return (PyObject *) op; } @@ -826,14 +826,13 @@ } if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) || ((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { - PyErr_NoMemory(); - return -1; + PyErr_NoMemory(); + return -1; } size = Py_SIZE(self) + Py_SIZE(b); PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize); if (self->ob_item == NULL) { - PyObject_Del(self); - PyErr_NoMemory(); + PyErr_NoMemory(); return -1; } memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize, From python-checkins at python.org Fri Jun 13 08:03:26 2008 From: python-checkins at python.org (neal.norwitz) Date: Fri, 13 Jun 2008 08:03:26 +0200 (CEST) Subject: [Python-checkins] r64221 - python/trunk/Lib/test/test_heapq.py Message-ID: <20080613060326.4023C1E4006@bag.python.org> Author: neal.norwitz Date: Fri Jun 13 08:03:25 2008 New Revision: 64221 Log: Fix typo in method name. The LT class implemented less than. The LE class should implement less than or equal to (as the code does). Modified: python/trunk/Lib/test/test_heapq.py Modified: python/trunk/Lib/test/test_heapq.py ============================================================================== --- python/trunk/Lib/test/test_heapq.py (original) +++ python/trunk/Lib/test/test_heapq.py Fri Jun 13 08:03:25 2008 @@ -210,7 +210,7 @@ class LE: def __init__(self, x): self.x = x - def __lt__(self, other): + def __le__(self, other): return self.x >= other.x data = [random.random() for i in range(100)] target = sorted(data, reverse=True) From buildbot at python.org Fri Jun 13 08:14:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 06:14:57 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080613061457.B82D21E4006@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/457 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: neal.norwitz BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 08:50:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 06:50:53 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080613065053.62A051E4006@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/1032 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: neal.norwitz BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 08:56:50 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jun 2008 08:56:50 +0200 (CEST) Subject: [Python-checkins] r64223 - python/trunk/Modules/_multiprocessing/multiprocessing.c Message-ID: <20080613065650.AFC4E1E4006@bag.python.org> Author: georg.brandl Date: Fri Jun 13 08:56:50 2008 New Revision: 64223 Log: #3095: don't leak values from Py_BuildValue. Modified: python/trunk/Modules/_multiprocessing/multiprocessing.c Modified: python/trunk/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- python/trunk/Modules/_multiprocessing/multiprocessing.c (original) +++ python/trunk/Modules/_multiprocessing/multiprocessing.c Fri Jun 13 08:56:50 2008 @@ -215,7 +215,7 @@ PyMODINIT_FUNC init_multiprocessing(void) { - PyObject *module, *temp; + PyObject *module, *temp, *value; /* Initialize module */ module = Py_InitModule("_multiprocessing", module_methods); @@ -284,11 +284,12 @@ temp = PyDict_New(); if (!temp) return; - if (PyModule_AddObject(module, "flags", temp) < 0) - return; - -#define ADD_FLAG(name) \ - if (PyDict_SetItemString(temp, #name, Py_BuildValue("i", name)) < 0) return +#define ADD_FLAG(name) \ + value = Py_BuildValue("i", name); \ + if (value == NULL) { Py_DECREF(temp); return; } \ + if (PyDict_SetItemString(temp, #name, value) < 0) { \ + Py_DECREF(temp); Py_DECREF(value); return; } \ + Py_DECREF(value) #ifdef HAVE_SEM_OPEN ADD_FLAG(HAVE_SEM_OPEN); @@ -305,4 +306,6 @@ #ifdef HAVE_BROKEN_SEM_UNLINK ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); #endif + if (PyModule_AddObject(module, "flags", temp) < 0) + return; } From python-checkins at python.org Fri Jun 13 09:08:48 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jun 2008 09:08:48 +0200 (CEST) Subject: [Python-checkins] r64224 - python/trunk/Modules/_multiprocessing/multiprocessing.c Message-ID: <20080613070848.DD7841E4006@bag.python.org> Author: georg.brandl Date: Fri Jun 13 09:08:48 2008 New Revision: 64224 Log: Typo. Modified: python/trunk/Modules/_multiprocessing/multiprocessing.c Modified: python/trunk/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- python/trunk/Modules/_multiprocessing/multiprocessing.c (original) +++ python/trunk/Modules/_multiprocessing/multiprocessing.c Fri Jun 13 09:08:48 2008 @@ -1,5 +1,5 @@ /* - * Extension module used by mutliprocessing package + * Extension module used by multiprocessing package * * multiprocessing.c * From python-checkins at python.org Fri Jun 13 09:47:48 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 09:47:48 +0200 (CEST) Subject: [Python-checkins] r64226 - in python/trunk: Modules/_collectionsmodule.c Modules/_localemodule.c Modules/_tkinter.c Modules/arraymodule.c Modules/unicodedata_db.h Tools/unicode/makeunicodedata.py Message-ID: <20080613074748.1CC931E401D@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 09:47:47 2008 New Revision: 64226 Log: Make more symbols static. Modified: python/trunk/Modules/_collectionsmodule.c python/trunk/Modules/_localemodule.c python/trunk/Modules/_tkinter.c python/trunk/Modules/arraymodule.c python/trunk/Modules/unicodedata_db.h python/trunk/Tools/unicode/makeunicodedata.py Modified: python/trunk/Modules/_collectionsmodule.c ============================================================================== --- python/trunk/Modules/_collectionsmodule.c (original) +++ python/trunk/Modules/_collectionsmodule.c Fri Jun 13 09:47:47 2008 @@ -85,7 +85,7 @@ return b; } -void +static void freeblock(block *b) { if (numfreeblocks < MAXFREEBLOCKS) { @@ -957,7 +957,7 @@ int counter; /* number of items remaining for iteration */ } dequeiterobject; -PyTypeObject dequeiter_type; +static PyTypeObject dequeiter_type; static PyObject * deque_iter(dequeobject *deque) @@ -1024,7 +1024,7 @@ {NULL, NULL} /* sentinel */ }; -PyTypeObject dequeiter_type = { +static PyTypeObject dequeiter_type = { PyVarObject_HEAD_INIT(NULL, 0) "deque_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ @@ -1059,7 +1059,7 @@ /*********************** Deque Reverse Iterator **************************/ -PyTypeObject dequereviter_type; +static PyTypeObject dequereviter_type; static PyObject * deque_reviter(dequeobject *deque) @@ -1106,7 +1106,7 @@ return item; } -PyTypeObject dequereviter_type = { +static PyTypeObject dequereviter_type = { PyVarObject_HEAD_INIT(NULL, 0) "deque_reverse_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ Modified: python/trunk/Modules/_localemodule.c ============================================================================== --- python/trunk/Modules/_localemodule.c (original) +++ python/trunk/Modules/_localemodule.c Fri Jun 13 09:47:47 2008 @@ -444,7 +444,7 @@ #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} -struct langinfo_constant{ +static struct langinfo_constant{ char* name; int value; } langinfo_constants[] = Modified: python/trunk/Modules/_tkinter.c ============================================================================== --- python/trunk/Modules/_tkinter.c (original) +++ python/trunk/Modules/_tkinter.c Fri Jun 13 09:47:47 2008 @@ -490,7 +490,7 @@ lists. SplitObj walks through a nested tuple, finding string objects that need to be split. */ -PyObject * +static PyObject * SplitObj(PyObject *arg) { if (PyTuple_Check(arg)) { @@ -1523,7 +1523,7 @@ return 0; } -void +static void var_perform(VarEvent *ev) { *(ev->res) = ev->func(ev->self, ev->args, ev->flags); Modified: python/trunk/Modules/arraymodule.c ============================================================================== --- python/trunk/Modules/arraymodule.c (original) +++ python/trunk/Modules/arraymodule.c Fri Jun 13 09:47:47 2008 @@ -1546,7 +1546,7 @@ {NULL} }; -PyMethodDef array_methods[] = { +static PyMethodDef array_methods[] = { {"append", (PyCFunction)array_append, METH_O, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, METH_NOARGS, Modified: python/trunk/Modules/unicodedata_db.h ============================================================================== --- python/trunk/Modules/unicodedata_db.h (original) +++ python/trunk/Modules/unicodedata_db.h Fri Jun 13 09:47:47 2008 @@ -228,7 +228,7 @@ #define TOTAL_FIRST 356 #define TOTAL_LAST 53 struct reindex{int start;short count,index;}; -struct reindex nfc_first[] = { +static struct reindex nfc_first[] = { { 60, 2, 0}, { 65, 15, 3}, { 82, 8, 19}, @@ -425,7 +425,7 @@ {0,0,0} }; -struct reindex nfc_last[] = { +static struct reindex nfc_last[] = { { 768, 4, 0}, { 774, 6, 5}, { 783, 0, 12}, Modified: python/trunk/Tools/unicode/makeunicodedata.py ============================================================================== --- python/trunk/Tools/unicode/makeunicodedata.py (original) +++ python/trunk/Tools/unicode/makeunicodedata.py Fri Jun 13 09:47:47 2008 @@ -229,12 +229,12 @@ print >>fp, "#define TOTAL_FIRST",total_first print >>fp, "#define TOTAL_LAST",total_last print >>fp, "struct reindex{int start;short count,index;};" - print >>fp, "struct reindex nfc_first[] = {" + print >>fp, "static struct reindex nfc_first[] = {" for start,end in comp_first_ranges: print >>fp," { %d, %d, %d}," % (start,end-start,comp_first[start]) print >>fp," {0,0,0}" print >>fp,"};\n" - print >>fp, "struct reindex nfc_last[] = {" + print >>fp, "static struct reindex nfc_last[] = {" for start,end in comp_last_ranges: print >>fp," { %d, %d, %d}," % (start,end-start,comp_last[start]) print >>fp," {0,0,0}" From buildbot at python.org Fri Jun 13 10:10:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 08:10:17 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080613081017.7EBA61E401A@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/667 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: martin.v.loewis BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 10:23:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 08:23:19 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080613082320.0E1EE1E4014@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/459 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 11:11:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 09:11:36 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080613091136.8E2F81E4020@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/374 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 11:37:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 09:37:53 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080613093753.B22DC1E4006@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/997 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net ====================================================================== ERROR: test_current_time (test.test_xmlrpc_net.CurrentTimeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_xmlrpc_net.py", line 18, in test_current_time t0 = server.currentTime.getCurrentTime() File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1095, in __call__ return self.__send(self.__name, args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1353, in __request verbose=self.__verbose File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1136, in request return self._parse_response(resp, None) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 1246, in _parse_response p.feed(response) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/xmlrpc/client.py", line 516, in feed self._parser.Parse(data, 0) xml.parsers.expat.ExpatError: mismatched tag: line 10, column 7 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 11:44:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 09:44:25 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080613094425.8E8E11E4006@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1128 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 14:26:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 12:26:37 +0000 Subject: [Python-checkins] buildbot failure in 2.6.msi Message-ID: <20080613122637.2EE841E4024@bag.python.org> The Buildbot has detected a new failure of 2.6.msi. Full details are available at: http://www.python.org/dev/buildbot/all/2.6.msi/builds/289 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: The Nightly scheduler named '2.6.msi' triggered this build Build Source Stamp: HEAD Blamelist: BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 15:26:55 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jun 2008 15:26:55 +0200 (CEST) Subject: [Python-checkins] r64229 - python/trunk/Doc/library/optparse.rst Message-ID: <20080613132655.3F49F1E4006@bag.python.org> Author: georg.brandl Date: Fri Jun 13 15:26:54 2008 New Revision: 64229 Log: Clarification. Modified: python/trunk/Doc/library/optparse.rst Modified: python/trunk/Doc/library/optparse.rst ============================================================================== --- python/trunk/Doc/library/optparse.rst (original) +++ python/trunk/Doc/library/optparse.rst Fri Jun 13 15:26:54 2008 @@ -641,9 +641,9 @@ option involved in the error; be sure to do the same when calling ``parser.error()`` from your application code. -If :mod:`optparse`'s default error-handling behaviour does not suite your needs, -you'll need to subclass OptionParser and override ``exit()`` and/or -:meth:`error`. +If :mod:`optparse`'s default error-handling behaviour does not suit your needs, +you'll need to subclass OptionParser and override its :meth:`exit` and/or +:meth:`error` methods. .. _optparse-putting-it-all-together: From python-checkins at python.org Fri Jun 13 15:29:37 2008 From: python-checkins at python.org (robert.schuppenies) Date: Fri, 13 Jun 2008 15:29:37 +0200 (CEST) Subject: [Python-checkins] r64230 - in python/trunk: Lib/test/test_sys.py Objects/tupleobject.c Message-ID: <20080613132937.7D4431E4006@bag.python.org> Author: robert.schuppenies Date: Fri Jun 13 15:29:37 2008 New Revision: 64230 Log: Fixed: sys.getsizeof does not take the actual length of the tuples into account. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Objects/tupleobject.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Fri Jun 13 15:29:37 2008 @@ -567,6 +567,9 @@ # string self.check_sizeof('', h + l + self.align(i + 1)) self.check_sizeof('abc', h + l + self.align(i + 1) + 3) + # tuple + self.check_sizeof((), h) + self.check_sizeof((1,2,3), h + 3*p) def test_main(): Modified: python/trunk/Objects/tupleobject.c ============================================================================== --- python/trunk/Objects/tupleobject.c (original) +++ python/trunk/Objects/tupleobject.c Fri Jun 13 15:29:37 2008 @@ -708,13 +708,25 @@ } +static PyObject * +tuple_sizeof(PyTupleObject *self) +{ + Py_ssize_t res; + + res = PyTuple_Type.tp_basicsize + Py_SIZE(self) * sizeof(PyObject *); + return PyInt_FromSsize_t(res); +} + PyDoc_STRVAR(index_doc, "T.index(value, [start, [stop]]) -> integer -- return first index of value"); PyDoc_STRVAR(count_doc, "T.count(value) -> integer -- return number of occurrences of value"); +PyDoc_STRVAR(sizeof_doc, +"T.__sizeof__() -- size of T in memory, in bytes"); static PyMethodDef tuple_methods[] = { {"__getnewargs__", (PyCFunction)tuple_getnewargs, METH_NOARGS}, + {"__sizeof__", (PyCFunction)tuple_sizeof, METH_NOARGS, sizeof_doc}, {"index", (PyCFunction)tupleindex, METH_VARARGS, index_doc}, {"count", (PyCFunction)tuplecount, METH_O, count_doc}, {NULL, NULL} /* sentinel */ From buildbot at python.org Fri Jun 13 15:36:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 13:36:54 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080613133654.681191E400D@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/461 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: georg.brandl,robert.schuppenies BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 16:10:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 14:10:05 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080613141005.B894A1E4006@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/1036 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,robert.schuppenies BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Fri Jun 13 16:39:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 14:39:48 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080613143948.C0F011E401B@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1017 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 16:43:16 2008 From: python-checkins at python.org (thomas.lee) Date: Fri, 13 Jun 2008 16:43:16 +0200 (CEST) Subject: [Python-checkins] r64232 - in python/branches/tlee-ast-optimize: Doc/includes/mp_benchmarks.py Doc/includes/mp_distributing.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/library/ast.rst Doc/library/ctypes.rst Doc/library/multiprocessing.rst Doc/library/numbers.rst Doc/library/someos.rst Doc/library/stdtypes.rst Doc/whatsnew/2.6.rst Include/bytesobject.h Include/pymem.h Include/pyport.h Include/stringobject.h Lib/asyncore.py Lib/multiprocessing Lib/numbers.py Lib/test/test_array.py Lib/test/test_asyncore.py Lib/test/test_heapq.py Lib/test/test_multiprocessing.py Lib/test/test_platform.py Lib/test/test_pydoc.py Lib/test/test_set.py Lib/test/test_struct.py Makefile.pre.in Misc/NEWS Modules/_csv.c Modules/_heapqmodule.c Modules/_multiprocessing Modules/_struct.c Modules/arraymodule.c Modules/audioop.c Modules/binascii.c Modules/cPickle.c Modules/cStringIO.c Modules/cjkcodecs/multibytecodec.c Modules/datetimemodule.c Modules/md5.c Modules/stropmodule.c Objects/bufferobject.c Objects/bytesobject.c Objects/fileobject.c Objects/listobject.c Objects/obmalloc.c Objects/setobject.c Objects/stringobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PCbuild/pythoncore.vcproj Parser/node.c Python/asdl.c Python/ast.c Python/bltinmodule.c Python/compile.c setup.py Message-ID: <20080613144316.85EC21E400B@bag.python.org> Author: thomas.lee Date: Fri Jun 13 16:43:12 2008 New Revision: 64232 Log: Merged revisions 64073-64120 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64080 | josiah.carlson | 2008-06-11 01:58:19 +1000 (Wed, 11 Jun 2008) | 3 lines Fixed test to reflect new filedispatcher semantics, as well as two NameErrors pointed out by Giampaolo. ........ r64086 | gregory.p.smith | 2008-06-11 03:42:36 +1000 (Wed, 11 Jun 2008) | 5 lines More reverting of r63675 per the mailing list discussions. This restores occurances of PyBytes_ in the code to their original PyString_ names. The bytesobject.c file will be renamed back to stringobject.c in a future checkin. ........ r64089 | armin.ronacher | 2008-06-11 06:37:02 +1000 (Wed, 11 Jun 2008) | 3 lines Fix a formatting error in the ast documentation. ........ r64090 | armin.ronacher | 2008-06-11 06:52:19 +1000 (Wed, 11 Jun 2008) | 3 lines Documented the new AST constructor. ........ r64093 | gregory.p.smith | 2008-06-11 07:23:22 +1000 (Wed, 11 Jun 2008) | 3 lines Rename bytesobject.c back to stringobject.c to keep with the PyString theme. Part of reverting most of r63675 per the mailing list discussion. ........ r64095 | amaury.forgeotdarc | 2008-06-11 07:37:15 +1000 (Wed, 11 Jun 2008) | 3 lines Correct test_pydoc for win32 platforms, to account for normalized URLs: C:\temp => file:///C|temp/ ........ r64097 | benjamin.peterson | 2008-06-11 08:39:25 +1000 (Wed, 11 Jun 2008) | 2 lines backport of 64096 ........ r64098 | raymond.hettinger | 2008-06-11 10:25:29 +1000 (Wed, 11 Jun 2008) | 6 lines Mini-PEP: Simplifying numbers.py * Convert binary methods in Integral to mixin methods * Remove three-arg __pow__ as a required method * Make __int__ the root method instead of __long__. ........ r64100 | raymond.hettinger | 2008-06-11 10:28:51 +1000 (Wed, 11 Jun 2008) | 1 line Update numbers doc for the Integral simplification. ........ r64101 | raymond.hettinger | 2008-06-11 10:44:47 +1000 (Wed, 11 Jun 2008) | 3 lines Handle the case with zero arguments. ........ r64102 | benjamin.peterson | 2008-06-11 11:31:28 +1000 (Wed, 11 Jun 2008) | 4 lines convert test_struct to a unittest thanks to Giampaolo Rodola I had to disable one test because it was functioning incorrectly, see #1530559 I also removed the debugging prints ........ r64104 | benjamin.peterson | 2008-06-11 12:40:25 +1000 (Wed, 11 Jun 2008) | 2 lines add the multiprocessing package to fulfill PEP 371 ........ r64105 | gregory.p.smith | 2008-06-11 13:40:10 +1000 (Wed, 11 Jun 2008) | 3 lines swap stringobject.h and bytesobject.h contents to make sense. PyString in stringobject and PyBytes defines in bytesobject. ........ r64113 | thomas.heller | 2008-06-11 17:10:43 +1000 (Wed, 11 Jun 2008) | 2 lines Fix markup. Document the new 'offset' parameter for the 'ctypes.byref' function. ........ r64114 | gregory.p.smith | 2008-06-11 17:41:16 +1000 (Wed, 11 Jun 2008) | 6 lines Merge in release25-maint r60793: Added checks for integer overflows, contributed by Google. Some are only available if asserts are left in the code, in cases where they can't be triggered from Python code. ........ r64115 | raymond.hettinger | 2008-06-11 20:30:54 +1000 (Wed, 11 Jun 2008) | 1 line Multi-arg form for set.difference() and set.difference_update(). ........ r64116 | raymond.hettinger | 2008-06-11 22:06:49 +1000 (Wed, 11 Jun 2008) | 1 line Issue 3051: Let heapq work with either __lt__ or __le__. ........ r64117 | benjamin.peterson | 2008-06-11 22:26:31 +1000 (Wed, 11 Jun 2008) | 2 lines fix import of multiprocessing by juggling imports ........ r64118 | raymond.hettinger | 2008-06-11 22:39:09 +1000 (Wed, 11 Jun 2008) | 1 line Optimize previous checkin for heapq. ........ r64119 | andrew.kuchling | 2008-06-11 22:53:14 +1000 (Wed, 11 Jun 2008) | 1 line Note PEP 371 section ........ r64120 | raymond.hettinger | 2008-06-11 23:14:50 +1000 (Wed, 11 Jun 2008) | 1 line Add test for heapq using both __lt__ and __le__. ........ Added: python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_benchmarks.py python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_distributing.py python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_newtype.py python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_pool.py python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_synchronize.py python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_webserver.py python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py - copied unchanged from r64120, /python/trunk/Doc/includes/mp_workers.py python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst - copied unchanged from r64120, /python/trunk/Doc/library/multiprocessing.rst python/branches/tlee-ast-optimize/Lib/multiprocessing/ - copied from r64120, /python/trunk/Lib/multiprocessing/ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py - copied unchanged from r64120, /python/trunk/Lib/test/test_multiprocessing.py python/branches/tlee-ast-optimize/Modules/_multiprocessing/ - copied from r64120, /python/trunk/Modules/_multiprocessing/ python/branches/tlee-ast-optimize/Objects/stringobject.c - copied unchanged from r64120, /python/trunk/Objects/stringobject.c Removed: python/branches/tlee-ast-optimize/Objects/bytesobject.c Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/library/ast.rst python/branches/tlee-ast-optimize/Doc/library/ctypes.rst python/branches/tlee-ast-optimize/Doc/library/numbers.rst python/branches/tlee-ast-optimize/Doc/library/someos.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Include/bytesobject.h python/branches/tlee-ast-optimize/Include/pymem.h python/branches/tlee-ast-optimize/Include/pyport.h python/branches/tlee-ast-optimize/Include/stringobject.h python/branches/tlee-ast-optimize/Lib/asyncore.py python/branches/tlee-ast-optimize/Lib/numbers.py python/branches/tlee-ast-optimize/Lib/test/test_array.py python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py python/branches/tlee-ast-optimize/Lib/test/test_heapq.py python/branches/tlee-ast-optimize/Lib/test/test_platform.py python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py python/branches/tlee-ast-optimize/Lib/test/test_set.py python/branches/tlee-ast-optimize/Lib/test/test_struct.py python/branches/tlee-ast-optimize/Makefile.pre.in python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_csv.c python/branches/tlee-ast-optimize/Modules/_heapqmodule.c python/branches/tlee-ast-optimize/Modules/_struct.c python/branches/tlee-ast-optimize/Modules/arraymodule.c python/branches/tlee-ast-optimize/Modules/audioop.c python/branches/tlee-ast-optimize/Modules/binascii.c python/branches/tlee-ast-optimize/Modules/cPickle.c python/branches/tlee-ast-optimize/Modules/cStringIO.c python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c python/branches/tlee-ast-optimize/Modules/datetimemodule.c python/branches/tlee-ast-optimize/Modules/md5.c python/branches/tlee-ast-optimize/Modules/stropmodule.c python/branches/tlee-ast-optimize/Objects/bufferobject.c python/branches/tlee-ast-optimize/Objects/fileobject.c python/branches/tlee-ast-optimize/Objects/listobject.c python/branches/tlee-ast-optimize/Objects/obmalloc.c python/branches/tlee-ast-optimize/Objects/setobject.c python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp python/branches/tlee-ast-optimize/PC/VS7.1/pythoncore.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj python/branches/tlee-ast-optimize/Parser/node.c python/branches/tlee-ast-optimize/Python/asdl.c python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/bltinmodule.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Doc/library/ast.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ast.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ast.rst Fri Jun 13 16:43:12 2008 @@ -96,6 +96,11 @@ node = ast.UnaryOp(ast.USub(), ast.Num(5, lineno=0, col_offset=0), lineno=0, col_offset=0) + .. versionadded:: 2.6 + The constructor as explained above was added. In Python 2.5 nodes had + to be created by calling the class constructor without arguments and + setting the attributes afterwards. + .. _abstract-grammar: @@ -135,7 +140,7 @@ from untrusted sources without the need to parse the values oneself. -.. function:: get_docstring(node, clean=True): +.. function:: get_docstring(node, clean=True) Return the docstring of the given *node* (which must be a :class:`FunctionDef`, :class:`ClassDef` or :class:`Module` node), or ``None`` Modified: python/branches/tlee-ast-optimize/Doc/library/ctypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ctypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ctypes.rst Fri Jun 13 16:43:12 2008 @@ -1406,10 +1406,9 @@ to request and change the ctypes private copy of the windows error code. -.. versionchanged:: 2.6 - -The `use_errno` and `use_last_error` parameters were added in Python -2.6. +.. versionadded:: 2.6 + The ``use_last_error`` and ``use_errno`` optional parameters + were added. .. data:: RTLD_GLOBAL :noindex: @@ -1572,22 +1571,23 @@ Assign a Python function or another callable to this attribute. The callable will be called with three or more arguments: + .. function:: callable(result, func, arguments) + :noindex: -.. function:: callable(result, func, arguments) - :noindex: - - ``result`` is what the foreign function returns, as specified by the - :attr:`restype` attribute. - - ``func`` is the foreign function object itself, this allows to reuse the same - callable object to check or post process the results of several functions. - - ``arguments`` is a tuple containing the parameters originally passed to the - function call, this allows to specialize the behavior on the arguments used. + ``result`` is what the foreign function returns, as specified + by the :attr:`restype` attribute. - The object that this function returns will be returned from the foreign - function call, but it can also check the result value and raise an exception - if the foreign function call failed. + ``func`` is the foreign function object itself, this allows + to reuse the same callable object to check or post process + the results of several functions. + + ``arguments`` is a tuple containing the parameters originally + passed to the function call, this allows to specialize the + behavior on the arguments used. + + The object that this function returns will be returned from the + foreign function call, but it can also check the result value + and raise an exception if the foreign function call failed. .. exception:: ArgumentError() @@ -1805,12 +1805,22 @@ ctypes type or instance. -.. function:: byref(obj) +.. function:: byref(obj[, offset]) - Returns a light-weight pointer to ``obj``, which must be an instance of a ctypes - type. The returned object can only be used as a foreign function call parameter. - It behaves similar to ``pointer(obj)``, but the construction is a lot faster. + Returns a light-weight pointer to ``obj``, which must be an + instance of a ctypes type. ``offset`` defaults to zero, it must be + an integer which is added to the internal pointer value. + ``byref(obj, offset)`` corresponds to this C code:: + + (((char *)&obj) + offset) + + The returned object can only be used as a foreign function call + parameter. It behaves similar to ``pointer(obj)``, but the + construction is a lot faster. + + .. versionadded:: 2.6 + The ``offset`` optional argument was added. .. function:: cast(obj, type) Modified: python/branches/tlee-ast-optimize/Doc/library/numbers.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/numbers.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/numbers.rst Fri Jun 13 16:43:12 2008 @@ -73,10 +73,10 @@ .. class:: Integral - Subtypes :class:`Rational` and adds a conversion to :class:`long`, the - 3-argument form of :func:`pow`, and the bit-string operations: ``<<``, - ``>>``, ``&``, ``^``, ``|``, ``~``. Provides defaults for :func:`float`, - :attr:`Rational.numerator`, and :attr:`Rational.denominator`. + Subtypes :class:`Rational` and adds a conversion to :class:`int`. + Provides defaults for :func:`float`, :attr:`Rational.numerator`, and + :attr:`Rational.denominator`, and bit-string operations: ``<<``, + ``>>``, ``&``, ``^``, ``|``, ``~``. Notes for type implementors Modified: python/branches/tlee-ast-optimize/Doc/library/someos.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/someos.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/someos.rst Fri Jun 13 16:43:12 2008 @@ -18,6 +18,7 @@ threading.rst dummy_thread.rst dummy_threading.rst + multiprocessing.rst mmap.rst readline.rst rlcompleter.rst Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Fri Jun 13 16:43:12 2008 @@ -1583,10 +1583,13 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: difference(other) - set - other + .. method:: difference(other, ...) + set - other - ... - Return a new set with elements in the set that are not in *other*. + Return a new set with elements in the set that are not in the others. + + .. versionchanged:: 2.6 + Accepts multiple input iterables. .. method:: symmetric_difference(other) set ^ other @@ -1650,10 +1653,13 @@ .. versionchanged:: 2.6 Accepts multiple input iterables. - .. method:: difference_update(other) - set -= other + .. method:: difference_update(other, ...) + set -= other | ... - Update the set, removing elements found in *other*. + Update the set, removing elements found in others. + + .. versionchanged:: 2.6 + Accepts multiple input iterables. .. method:: symmetric_difference_update(other) set ^= other Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Fri Jun 13 16:43:12 2008 @@ -521,6 +521,21 @@ .. ====================================================================== +.. _pep-0371: + +PEP 371: The ``multiprocessing`` Package +===================================================== + +XXX write this. + +.. seealso:: + + :pep:`371` - Per-user ``site-packages`` Directory + PEP written by Jesse Noller and Richard Oudkerk; + implemented by Jesse Noller. + +.. ====================================================================== + .. _pep-3101: PEP 3101: Advanced String Formatting Modified: python/branches/tlee-ast-optimize/Include/bytesobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/bytesobject.h (original) +++ python/branches/tlee-ast-optimize/Include/bytesobject.h Fri Jun 13 16:43:12 2008 @@ -1,200 +1,33 @@ +#define PyBytesObject PyStringObject +#define PyBytes_Type PyString_Type -/* String (Bytes) object interface */ - -#ifndef Py_BYTESOBJECT_H -#define Py_BYTESOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* -Type PyStringObject represents a character string. An extra zero byte is -reserved at the end to ensure it is zero-terminated, but a size is -present so strings with null bytes in them can be represented. This -is an immutable object type. - -There are functions to create new string objects, to test -an object for string-ness, and to get the -string value. The latter function returns a null pointer -if the object is not of the proper type. -There is a variant that takes an explicit size as well as a -variant that assumes a zero-terminated string. Note that none of the -functions should be applied to nil objects. -*/ - -/* Caching the hash (ob_shash) saves recalculation of a string's hash value. - Interning strings (ob_sstate) tries to ensure that only one string - object with a given value exists, so equality tests can be one pointer - comparison. This is generally restricted to strings that "look like" - Python identifiers, although the intern() builtin can be used to force - interning of any string. - Together, these sped the interpreter by up to 20%. */ - -typedef struct { - PyObject_VAR_HEAD - long ob_shash; - int ob_sstate; - char ob_sval[1]; - - /* Invariants: - * ob_sval contains space for 'ob_size+1' elements. - * ob_sval[ob_size] == 0. - * ob_shash is the hash of the string or -1 if not computed yet. - * ob_sstate != 0 iff the string object is in stringobject.c's - * 'interned' dictionary; in this case the two references - * from 'interned' to this object are *not counted* in ob_refcnt. - */ -} PyStringObject; - -#define SSTATE_NOT_INTERNED 0 -#define SSTATE_INTERNED_MORTAL 1 -#define SSTATE_INTERNED_IMMORTAL 2 - -PyAPI_DATA(PyTypeObject) PyBaseString_Type; -PyAPI_DATA(PyTypeObject) PyString_Type; - -#define PyString_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) - -PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyString_FromString(const char *); -PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) - Py_GCC_ATTRIBUTE((format(printf, 1, 0))); -PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); -PyAPI_FUNC(char *) PyString_AsString(PyObject *); -PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); -PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); -PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); -PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); -PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, - int, char**, int*); -PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, - const char *, Py_ssize_t, - const char *); - -PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); -PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); - -/* Use only if you know it's a string */ -#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) - -/* Macro, trading safety for speed */ -#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) -#define PyString_GET_SIZE(op) Py_SIZE(op) - -/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, - x must be an iterable object. */ -PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); - -/* --- Generic Codecs ----------------------------------------------------- */ - -/* Create an object by decoding the encoded string s of the - given size. */ - -PyAPI_FUNC(PyObject*) PyString_Decode( - const char *s, /* encoded string */ - Py_ssize_t size, /* size of buffer */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a char buffer of the given size and returns a - Python object. */ - -PyAPI_FUNC(PyObject*) PyString_Encode( - const char *s, /* string char buffer */ - Py_ssize_t size, /* number of chars to encode */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsEncodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsDecodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Provides access to the internal data buffer and size of a string - object or the default encoded version of an Unicode object. Passing - NULL as *len parameter will force the string buffer to be - 0-terminated (passing a string with embedded NULL characters will - cause an exception). */ - -PyAPI_FUNC(int) PyString_AsStringAndSize( - register PyObject *obj, /* string or Unicode object */ - register char **s, /* pointer to buffer variable */ - register Py_ssize_t *len /* pointer to length variable or NULL - (only possible for 0-terminated - strings) */ - ); - -/* Using the current locale, insert the thousands grouping - into the string pointed to by buffer. For the argument descriptions, - see Objects/stringlib/localeutil.h */ - -PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, - Py_ssize_t len, - char *plast, - Py_ssize_t buf_size, - Py_ssize_t *count, - int append_zero_char); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BYTESOBJECT_H */ +#define PyBytes_Check PyString_Check +#define PyBytes_CheckExact PyString_CheckExact +#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS + +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_FromString PyString_FromString +#define PyBytes_FromFormatV PyString_FromFormatV +#define PyBytes_FromFormat PyString_FromFormat +#define PyBytes_Size PyString_Size +#define PyBytes_AsString PyString_AsString +#define PyBytes_Repr PyString_Repr +#define PyBytes_Concat PyString_Concat +#define PyBytes_ConcatAndDel PyString_ConcatAndDel +#define _PyBytes_Resize _PyString_Resize +#define _PyBytes_Eq _PyString_Eq +#define PyBytes_Format PyString_Format +#define _PyBytes_FormatLong _PyString_FormatLong +#define PyBytes_DecodeEscape PyString_DecodeEscape +#define _PyBytes_Join _PyString_Join +#define PyBytes_Decode PyString_Decode +#define PyBytes_Encode PyString_Encode +#define PyBytes_AsEncodedObject PyString_AsEncodedObject +#define PyBytes_AsEncodedString PyString_AsEncodedString +#define PyBytes_AsDecodedObject PyString_AsDecodedObject +#define PyBytes_AsDecodedString PyString_AsDecodedString +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping Modified: python/branches/tlee-ast-optimize/Include/pymem.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pymem.h (original) +++ python/branches/tlee-ast-optimize/Include/pymem.h Fri Jun 13 16:43:12 2008 @@ -85,14 +85,18 @@ */ #define PyMem_New(type, n) \ - ( (type *) PyMem_Malloc((n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) #define PyMem_NEW(type, n) \ - ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) #define PyMem_Resize(p, type, n) \ - ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (p) = (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) ) #define PyMem_RESIZE(p, type, n) \ - ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) + ( assert((n) <= PY_SIZE_MAX / sizeof(type)) , \ + ( (p) = (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) ) /* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. Modified: python/branches/tlee-ast-optimize/Include/pyport.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pyport.h (original) +++ python/branches/tlee-ast-optimize/Include/pyport.h Fri Jun 13 16:43:12 2008 @@ -117,6 +117,17 @@ # error "Python needs a typedef for Py_ssize_t in pyport.h." #endif +/* Largest possible value of size_t. + SIZE_MAX is part of C99, so it might be defined on some + platforms. If it is not defined, (size_t)-1 is a portable + definition for C89, due to the way signed->unsigned + conversion is defined. */ +#ifdef SIZE_MAX +#define PY_SIZE_MAX SIZE_MAX +#else +#define PY_SIZE_MAX ((size_t)-1) +#endif + /* Largest positive value of type Py_ssize_t. */ #define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) /* Smallest negative value of type Py_ssize_t. */ Modified: python/branches/tlee-ast-optimize/Include/stringobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/stringobject.h (original) +++ python/branches/tlee-ast-optimize/Include/stringobject.h Fri Jun 13 16:43:12 2008 @@ -1,33 +1,200 @@ -#define PyBytesObject PyStringObject -#define PyBytes_Type PyString_Type -#define PyBytes_Check PyString_Check -#define PyBytes_CheckExact PyString_CheckExact -#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED -#define PyBytes_AS_STRING PyString_AS_STRING -#define PyBytes_GET_SIZE PyString_GET_SIZE -#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS - -#define PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PyBytes_FromString PyString_FromString -#define PyBytes_FromFormatV PyString_FromFormatV -#define PyBytes_FromFormat PyString_FromFormat -#define PyBytes_Size PyString_Size -#define PyBytes_AsString PyString_AsString -#define PyBytes_Repr PyString_Repr -#define PyBytes_Concat PyString_Concat -#define PyBytes_ConcatAndDel PyString_ConcatAndDel -#define _PyBytes_Resize _PyString_Resize -#define _PyBytes_Eq _PyString_Eq -#define PyBytes_Format PyString_Format -#define _PyBytes_FormatLong _PyString_FormatLong -#define PyBytes_DecodeEscape PyString_DecodeEscape -#define _PyBytes_Join _PyString_Join -#define PyBytes_Decode PyString_Decode -#define PyBytes_Encode PyString_Encode -#define PyBytes_AsEncodedObject PyString_AsEncodedObject -#define PyBytes_AsEncodedString PyString_AsEncodedString -#define PyBytes_AsDecodedObject PyString_AsDecodedObject -#define PyBytes_AsDecodedString PyString_AsDecodedString -#define PyBytes_AsStringAndSize PyString_AsStringAndSize -#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping +/* String (str/bytes) object interface */ + +#ifndef Py_STRINGOBJECT_H +#define Py_STRINGOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* +Type PyStringObject represents a character string. An extra zero byte is +reserved at the end to ensure it is zero-terminated, but a size is +present so strings with null bytes in them can be represented. This +is an immutable object type. + +There are functions to create new string objects, to test +an object for string-ness, and to get the +string value. The latter function returns a null pointer +if the object is not of the proper type. +There is a variant that takes an explicit size as well as a +variant that assumes a zero-terminated string. Note that none of the +functions should be applied to nil objects. +*/ + +/* Caching the hash (ob_shash) saves recalculation of a string's hash value. + Interning strings (ob_sstate) tries to ensure that only one string + object with a given value exists, so equality tests can be one pointer + comparison. This is generally restricted to strings that "look like" + Python identifiers, although the intern() builtin can be used to force + interning of any string. + Together, these sped the interpreter by up to 20%. */ + +typedef struct { + PyObject_VAR_HEAD + long ob_shash; + int ob_sstate; + char ob_sval[1]; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the string or -1 if not computed yet. + * ob_sstate != 0 iff the string object is in stringobject.c's + * 'interned' dictionary; in this case the two references + * from 'interned' to this object are *not counted* in ob_refcnt. + */ +} PyStringObject; + +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + +PyAPI_DATA(PyTypeObject) PyBaseString_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; + +#define PyString_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) + +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) + Py_GCC_ATTRIBUTE((format(printf, 1, 0))); +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, + int, char**, int*); +PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, + const char *, Py_ssize_t, + const char *); + +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); +PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); + +/* Use only if you know it's a string */ +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) + +/* Macro, trading safety for speed */ +#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) +#define PyString_GET_SIZE(op) Py_SIZE(op) + +/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, + x must be an iterable object. */ +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create an object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyString_Decode( + const char *s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a char buffer of the given size and returns a + Python object. */ + +PyAPI_FUNC(PyObject*) PyString_Encode( + const char *s, /* string char buffer */ + Py_ssize_t size, /* number of chars to encode */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsEncodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsDecodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Provides access to the internal data buffer and size of a string + object or the default encoded version of an Unicode object. Passing + NULL as *len parameter will force the string buffer to be + 0-terminated (passing a string with embedded NULL characters will + cause an exception). */ + +PyAPI_FUNC(int) PyString_AsStringAndSize( + register PyObject *obj, /* string or Unicode object */ + register char **s, /* pointer to buffer variable */ + register Py_ssize_t *len /* pointer to length variable or NULL + (only possible for 0-terminated + strings) */ + ); + +/* Using the current locale, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ + +PyAPI_FUNC(int) _PyString_InsertThousandsGrouping(char *buffer, + Py_ssize_t len, + char *plast, + Py_ssize_t buf_size, + Py_ssize_t *count, + int append_zero_char); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRINGOBJECT_H */ Modified: python/branches/tlee-ast-optimize/Lib/asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/asyncore.py Fri Jun 13 16:43:12 2008 @@ -228,7 +228,7 @@ # passed be connected. try: self.addr = sock.getpeername() - except socket.error: + except socket.error, err: if err[0] == ENOTCONN: # To handle the case where we got an unconnected # socket. @@ -424,7 +424,7 @@ #check for errors err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: - raise socket.error(err, strerror(err)) + raise socket.error(err, _strerror(err)) self.handle_connect_event() self.handle_write() Modified: python/branches/tlee-ast-optimize/Lib/numbers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/numbers.py (original) +++ python/branches/tlee-ast-optimize/Lib/numbers.py Fri Jun 13 16:43:12 2008 @@ -283,87 +283,54 @@ class Integral(Rational): - """Integral adds a conversion to long and the bit-string operations.""" + """Integral adds a conversion to int and the bit-string operations.""" @abstractmethod - def __long__(self): - """long(self)""" + def __int__(self): + """int(self)""" raise NotImplementedError def __index__(self): """index(self)""" - return long(self) + return int(self) - @abstractmethod - def __pow__(self, exponent, modulus=None): - """self ** exponent % modulus, but maybe faster. - - Accept the modulus argument if you want to support the - 3-argument version of pow(). Raise a TypeError if exponent < 0 - or any argument isn't Integral. Otherwise, just implement the - 2-argument version described in Complex. - """ - raise NotImplementedError - - @abstractmethod def __lshift__(self, other): - """self << other""" - raise NotImplementedError + return int(self) << int(other) - @abstractmethod def __rlshift__(self, other): - """other << self""" - raise NotImplementedError + return int(other) << int(self) - @abstractmethod def __rshift__(self, other): - """self >> other""" - raise NotImplementedError + return int(self) >> int(other) - @abstractmethod def __rrshift__(self, other): - """other >> self""" - raise NotImplementedError + return int(other) >> int(self) - @abstractmethod def __and__(self, other): - """self & other""" - raise NotImplementedError + return int(self) & int(other) - @abstractmethod def __rand__(self, other): - """other & self""" - raise NotImplementedError + return int(other) & int(self) - @abstractmethod def __xor__(self, other): - """self ^ other""" - raise NotImplementedError + return int(self) ^ int(other) - @abstractmethod def __rxor__(self, other): - """other ^ self""" - raise NotImplementedError + return int(other) ^ int(self) - @abstractmethod def __or__(self, other): - """self | other""" - raise NotImplementedError + return int(self) | int(other) - @abstractmethod def __ror__(self, other): - """other | self""" - raise NotImplementedError + return int(other) | int(self) - @abstractmethod def __invert__(self): - """~self""" - raise NotImplementedError + return ~int(self) # Concrete implementations of Rational and Real abstract methods. def __float__(self): - """float(self) == float(long(self))""" - return float(long(self)) + """float(self) == float(int(self))""" + return float(int(self)) @property def numerator(self): Modified: python/branches/tlee-ast-optimize/Lib/test/test_array.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_array.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_array.py Fri Jun 13 16:43:12 2008 @@ -1009,6 +1009,23 @@ class DoubleTest(FPTest): typecode = 'd' minitemsize = 8 + + def test_alloc_overflow(self): + a = array.array('d', [-1]*65536) + try: + a *= 65536 + except MemoryError: + pass + else: + self.fail("a *= 2**16 didn't raise MemoryError") + b = array.array('d', [ 2.71828183, 3.14159265, -1]) + try: + b * 1431655766 + except MemoryError: + pass + else: + self.fail("a * 1431655766 didn't raise MemoryError") + tests.append(DoubleTest) def test_main(verbose=None): Modified: python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py Fri Jun 13 16:43:12 2008 @@ -384,8 +384,8 @@ fd = os.open(TESTFN, os.O_RDONLY) w = asyncore.file_wrapper(fd) - self.assertEqual(w.fd, fd) - self.assertEqual(w.fileno(), fd) + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) self.assertEqual(w.recv(13), "It's not dead") self.assertEqual(w.read(6), ", it's") w.close() Modified: python/branches/tlee-ast-optimize/Lib/test/test_heapq.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_heapq.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_heapq.py Fri Jun 13 16:43:12 2008 @@ -196,6 +196,27 @@ class TestHeapC(TestHeap): module = c_heapq + def test_comparison_operator(self): + # Issue 3501: Make sure heapq works with both __lt__ and __le__ + def hsort(data, comp): + data = map(comp, data) + self.module.heapify(data) + return [self.module.heappop(data).x for i in range(len(data))] + class LT: + def __init__(self, x): + self.x = x + def __lt__(self, other): + return self.x > other.x + class LE: + def __init__(self, x): + self.x = x + def __lt__(self, other): + return self.x >= other.x + data = [random.random() for i in range(100)] + target = sorted(data, reverse=True) + self.assertEqual(hsort(data, LT), target) + self.assertEqual(hsort(data, LE), target) + #============================================================================== Modified: python/branches/tlee-ast-optimize/Lib/test/test_platform.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_platform.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_platform.py Fri Jun 13 16:43:12 2008 @@ -72,7 +72,7 @@ else: have_toolbox_glue = True - if have_toolbox_glue and os.uname()[0] == 'Darwin': + if have_toolbox_glue and platform.uname()[0] == 'Darwin': # We're on a MacOSX system, check that # the right version information is returned fd = os.popen('sw_vers', 'r') Modified: python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py Fri Jun 13 16:43:12 2008 @@ -214,7 +214,12 @@ def test_html_doc(self): result, doc_loc = get_pydoc_html(pydoc_mod) mod_file = inspect.getabsfile(pydoc_mod) - expected_html = expected_html_pattern % (mod_file, mod_file, doc_loc) + if sys.platform == 'win32': + import nturl2path + mod_url = nturl2path.pathname2url(mod_file) + else: + mod_url = mod_file + expected_html = expected_html_pattern % (mod_url, mod_file, doc_loc) if result != expected_html: print_diffs(expected_html, result) self.fail("outputs are not equal, see diff above") Modified: python/branches/tlee-ast-optimize/Lib/test/test_set.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_set.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_set.py Fri Jun 13 16:43:12 2008 @@ -104,6 +104,12 @@ self.assertEqual(self.thetype('abcba').intersection(C('ccb')), set('bc')) self.assertEqual(self.thetype('abcba').intersection(C('ef')), set('')) self.assertEqual(self.thetype('abcba').intersection(C('cbcf'), C('bag')), set('b')) + s = self.thetype('abcba') + z = s.intersection() + if self.thetype == frozenset(): + self.assertEqual(id(s), id(z)) + else: + self.assertNotEqual(id(s), id(z)) def test_isdisjoint(self): def f(s1, s2): @@ -143,6 +149,8 @@ self.assertEqual(self.thetype('abcba').difference(C('efgfe')), set('abc')) self.assertEqual(self.thetype('abcba').difference(C('ccb')), set('a')) self.assertEqual(self.thetype('abcba').difference(C('ef')), set('abc')) + self.assertEqual(self.thetype('abcba').difference(), set('abc')) + self.assertEqual(self.thetype('abcba').difference(C('a'), C('b')), set('c')) def test_sub(self): i = self.s.difference(self.otherword) @@ -461,6 +469,18 @@ self.assertEqual(s.difference_update(C(p)), None) self.assertEqual(s, set(q)) + s = self.thetype('abcdefghih') + s.difference_update() + self.assertEqual(s, self.thetype('abcdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('aba')) + self.assertEqual(s, self.thetype('cdefghih')) + + s = self.thetype('abcdefghih') + s.difference_update(C('cdc'), C('aba')) + self.assertEqual(s, self.thetype('efghih')) + def test_isub(self): self.s -= set(self.otherword) for c in (self.word + self.otherword): Modified: python/branches/tlee-ast-optimize/Lib/test/test_struct.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_struct.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_struct.py Fri Jun 13 16:43:12 2008 @@ -1,14 +1,15 @@ -from test.test_support import TestFailed, verbose, verify, vereq -import test.test_support -import struct import array +import unittest +import struct import warnings +from functools import wraps +from test.test_support import TestFailed, verbose, run_unittest, catch_warning + import sys ISBIGENDIAN = sys.byteorder == "big" +IS32BIT = sys.maxint == 0x7fffffff del sys -verify((struct.pack('=i', 1)[0] == chr(0)) == ISBIGENDIAN, - "bigendian determination appears wrong") try: import _struct @@ -30,39 +31,21 @@ else: return string_reverse(value) -def simple_err(func, *args): - try: - func(*args) - except struct.error: - pass - else: - raise TestFailed, "%s%s did not raise struct.error" % ( - func.__name__, args) - -def any_err(func, *args): - try: - func(*args) - except (struct.error, TypeError): - pass - else: - raise TestFailed, "%s%s did not raise error" % ( - func.__name__, args) - def with_warning_restore(func): - def _with_warning_restore(*args, **kw): - with test.test_support.catch_warning(): + @wraps(func) + def decorator(*args, **kw): + with catch_warning(): # Grrr, we need this function to warn every time. Without removing # the warningregistry, running test_tarfile then test_struct would fail # on 64-bit platforms. globals = func.func_globals if '__warningregistry__' in globals: del globals['__warningregistry__'] - warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning) - warnings.filterwarnings("error", r""".*format requires.*""", - DeprecationWarning) + warnings.filterwarnings("error", category=DeprecationWarning) return func(*args, **kw) - return _with_warning_restore + return decorator + at with_warning_restore def deprecated_err(func, *args): try: func(*args) @@ -75,602 +58,527 @@ else: raise TestFailed, "%s%s did not raise error" % ( func.__name__, args) -deprecated_err = with_warning_restore(deprecated_err) - -simple_err(struct.calcsize, 'Z') -sz = struct.calcsize('i') -if sz * 3 != struct.calcsize('iii'): - raise TestFailed, 'inconsistent sizes' - -fmt = 'cbxxxxxxhhhhiillffd?' -fmt3 = '3c3b18x12h6i6l6f3d3?' -sz = struct.calcsize(fmt) -sz3 = struct.calcsize(fmt3) -if sz * 3 != sz3: - raise TestFailed, 'inconsistent sizes (3*%r -> 3*%d = %d, %r -> %d)' % ( - fmt, sz, 3*sz, fmt3, sz3) - -simple_err(struct.pack, 'iii', 3) -simple_err(struct.pack, 'i', 3, 3, 3) -simple_err(struct.pack, 'i', 'foo') -simple_err(struct.pack, 'P', 'foo') -simple_err(struct.unpack, 'd', 'flap') -s = struct.pack('ii', 1, 2) -simple_err(struct.unpack, 'iii', s) -simple_err(struct.unpack, 'i', s) - -c = 'a' -b = 1 -h = 255 -i = 65535 -l = 65536 -f = 3.1415 -d = 3.1415 -t = True - -for prefix in ('', '@', '<', '>', '=', '!'): - for format in ('xcbhilfd?', 'xcBHILfd?'): - format = prefix + format - if verbose: - print "trying:", format - s = struct.pack(format, c, b, h, i, l, f, d, t) - cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) - if (cp != c or bp != b or hp != h or ip != i or lp != l or - int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d) or - tp != t): - # ^^^ calculate only to two decimal places - raise TestFailed, "unpack/pack not transitive (%s, %s)" % ( - str(format), str((cp, bp, hp, ip, lp, fp, dp, tp))) - -# Test some of the new features in detail - -# (format, argument, big-endian result, little-endian result, asymmetric) -tests = [ - ('c', 'a', 'a', 'a', 0), - ('xc', 'a', '\0a', '\0a', 0), - ('cx', 'a', 'a\0', 'a\0', 0), - ('s', 'a', 'a', 'a', 0), - ('0s', 'helloworld', '', '', 1), - ('1s', 'helloworld', 'h', 'h', 1), - ('9s', 'helloworld', 'helloworl', 'helloworl', 1), - ('10s', 'helloworld', 'helloworld', 'helloworld', 0), - ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), - ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), - ('b', 7, '\7', '\7', 0), - ('b', -7, '\371', '\371', 0), - ('B', 7, '\7', '\7', 0), - ('B', 249, '\371', '\371', 0), - ('h', 700, '\002\274', '\274\002', 0), - ('h', -700, '\375D', 'D\375', 0), - ('H', 700, '\002\274', '\274\002', 0), - ('H', 0x10000-700, '\375D', 'D\375', 0), - ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), - ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), - ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), - ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), - ('d', 2.0, '@\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000@', 0), - ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), - ('d', -2.0, '\300\000\000\000\000\000\000\000', - '\000\000\000\000\000\000\000\300', 0), - ('?', 0, '\0', '\0', 0), - ('?', 3, '\1', '\1', 1), - ('?', True, '\1', '\1', 0), - ('?', [], '\0', '\0', 1), - ('?', (1,), '\1', '\1', 1), -] - -for fmt, arg, big, lil, asy in tests: - if verbose: - print "%r %r %r %r" % (fmt, arg, big, lil) - for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), - ('='+fmt, ISBIGENDIAN and big or lil)]: - res = struct.pack(xfmt, arg) - if res != exp: - raise TestFailed, "pack(%r, %r) -> %r # expected %r" % ( - fmt, arg, res, exp) - n = struct.calcsize(xfmt) - if n != len(res): - raise TestFailed, "calcsize(%r) -> %d # expected %d" % ( - xfmt, n, len(res)) - rev = struct.unpack(xfmt, res)[0] - if rev != arg and not asy: - raise TestFailed, "unpack(%r, %r) -> (%r,) # expected (%r,)" % ( - fmt, res, rev, arg) - -########################################################################### -# Simple native q/Q tests. - -has_native_qQ = 1 -try: - struct.pack("q", 5) -except struct.error: - has_native_qQ = 0 - -if verbose: - print "Platform has native q/Q?", has_native_qQ and "Yes." or "No." - -any_err(struct.pack, "Q", -1) # can't pack -1 as unsigned regardless -simple_err(struct.pack, "q", "a") # can't pack string as 'q' regardless -simple_err(struct.pack, "Q", "a") # ditto, but 'Q' - -def test_native_qQ(): - bytes = struct.calcsize('q') - # The expected values here are in big-endian format, primarily because - # I'm on a little-endian machine and so this is the clearest way (for - # me) to force the code to get exercised. - for format, input, expected in ( - ('q', -1, '\xff' * bytes), - ('q', 0, '\x00' * bytes), - ('Q', 0, '\x00' * bytes), - ('q', 1L, '\x00' * (bytes-1) + '\x01'), - ('Q', (1L << (8*bytes))-1, '\xff' * bytes), - ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): - got = struct.pack(format, input) - native_expected = bigendian_to_native(expected) - verify(got == native_expected, - "%r-pack of %r gave %r, not %r" % - (format, input, got, native_expected)) - retrieved = struct.unpack(format, got)[0] - verify(retrieved == input, - "%r-unpack of %r gave %r, not %r" % - (format, got, retrieved, input)) - -if has_native_qQ: - test_native_qQ() - -########################################################################### -# Standard integer tests (bBhHiIlLqQ). - -import binascii - -class IntTester: - - # XXX Most std integer modes fail to test for out-of-range. - # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but - # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C - # reported by Mark Favas). - BUGGY_RANGE_CHECK = "bBhHiIlL" - - def __init__(self, formatpair, bytesize): - assert len(formatpair) == 2 - self.formatpair = formatpair - for direction in "<>!=": - for code in formatpair: - format = direction + code - verify(struct.calcsize(format) == bytesize) - self.bytesize = bytesize - self.bitsize = bytesize * 8 - self.signed_code, self.unsigned_code = formatpair - self.unsigned_min = 0 - self.unsigned_max = 2L**self.bitsize - 1 - self.signed_min = -(2L**(self.bitsize-1)) - self.signed_max = 2L**(self.bitsize-1) - 1 - - def test_one(self, x, pack=struct.pack, - unpack=struct.unpack, - unhexlify=binascii.unhexlify): - if verbose: - print "trying std", self.formatpair, "on", x, "==", hex(x) - - # Try signed. - code = self.signed_code - if self.signed_min <= x <= self.signed_max: - # Try big-endian. - expected = long(x) - if x < 0: - expected += 1L << self.bitsize - assert expected > 0 - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - format = ">" + code - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) +class StructTest(unittest.TestCase): + @with_warning_restore + def check_float_coerce(self, format, number): + # SF bug 1530559. struct.pack raises TypeError where it used to convert. + if PY_STRUCT_FLOAT_COERCE == 2: + # Test for pre-2.5 struct module + packed = struct.pack(format, number) + floored = struct.unpack(format, packed)[0] + self.assertEqual(floored, int(number), + "did not correcly coerce float to int") + return + try: + struct.pack(format, number) + except (struct.error, TypeError): + if PY_STRUCT_FLOAT_COERCE: + self.fail("expected DeprecationWarning for float coerce") + except DeprecationWarning: + if not PY_STRUCT_FLOAT_COERCE: + self.fail("expected to raise struct.error for float coerce") else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - # Much the same for unsigned. - code = self.unsigned_code - if self.unsigned_min <= x <= self.unsigned_max: - # Try big-endian. - format = ">" + code - expected = long(x) - expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' - if len(expected) & 1: - expected = "0" + expected - expected = unhexlify(expected) - expected = "\x00" * (self.bytesize - len(expected)) + expected - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) - - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) - - # Try little-endian. - format = "<" + code - expected = string_reverse(expected) - - # Pack work? - got = pack(format, x) - verify(got == expected, - "'%s'-pack of %r gave %r, not %r" % - (format, x, got, expected)) - - # Unpack work? - retrieved = unpack(format, got)[0] - verify(x == retrieved, - "'%s'-unpack of %r gave %r, not %r" % - (format, got, retrieved, x)) + self.fail("did not raise error for float coerce") + + def test_isbigendian(self): + self.assertEqual((struct.pack('=i', 1)[0] == chr(0)), ISBIGENDIAN) - # Adding any byte should cause a "too big" error. - any_err(unpack, format, '\x01' + got) + def test_consistence(self): + self.assertRaises(struct.error, struct.calcsize, 'Z') + sz = struct.calcsize('i') + self.assertEqual(sz * 3, struct.calcsize('iii')) + + fmt = 'cbxxxxxxhhhhiillffd?' + fmt3 = '3c3b18x12h6i6l6f3d3?' + sz = struct.calcsize(fmt) + sz3 = struct.calcsize(fmt3) + self.assertEqual(sz * 3, sz3) + + self.assertRaises(struct.error, struct.pack, 'iii', 3) + self.assertRaises(struct.error, struct.pack, 'i', 3, 3, 3) + self.assertRaises(struct.error, struct.pack, 'i', 'foo') + self.assertRaises(struct.error, struct.pack, 'P', 'foo') + self.assertRaises(struct.error, struct.unpack, 'd', 'flap') + s = struct.pack('ii', 1, 2) + self.assertRaises(struct.error, struct.unpack, 'iii', s) + self.assertRaises(struct.error, struct.unpack, 'i', s) + + def test_transitiveness(self): + c = 'a' + b = 1 + h = 255 + i = 65535 + l = 65536 + f = 3.1415 + d = 3.1415 + t = True + + for prefix in ('', '@', '<', '>', '=', '!'): + for format in ('xcbhilfd?', 'xcBHILfd?'): + format = prefix + format + s = struct.pack(format, c, b, h, i, l, f, d, t) + cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) + self.assertEqual(cp, c) + self.assertEqual(bp, b) + self.assertEqual(hp, h) + self.assertEqual(ip, i) + self.assertEqual(lp, l) + self.assertEqual(int(100 * fp), int(100 * f)) + self.assertEqual(int(100 * dp), int(100 * d)) + self.assertEqual(tp, t) + + def test_new_features(self): + # Test some of the new features in detail + # (format, argument, big-endian result, little-endian result, asymmetric) + tests = [ + ('c', 'a', 'a', 'a', 0), + ('xc', 'a', '\0a', '\0a', 0), + ('cx', 'a', 'a\0', 'a\0', 0), + ('s', 'a', 'a', 'a', 0), + ('0s', 'helloworld', '', '', 1), + ('1s', 'helloworld', 'h', 'h', 1), + ('9s', 'helloworld', 'helloworl', 'helloworl', 1), + ('10s', 'helloworld', 'helloworld', 'helloworld', 0), + ('11s', 'helloworld', 'helloworld\0', 'helloworld\0', 1), + ('20s', 'helloworld', 'helloworld'+10*'\0', 'helloworld'+10*'\0', 1), + ('b', 7, '\7', '\7', 0), + ('b', -7, '\371', '\371', 0), + ('B', 7, '\7', '\7', 0), + ('B', 249, '\371', '\371', 0), + ('h', 700, '\002\274', '\274\002', 0), + ('h', -700, '\375D', 'D\375', 0), + ('H', 700, '\002\274', '\274\002', 0), + ('H', 0x10000-700, '\375D', 'D\375', 0), + ('i', 70000000, '\004,\035\200', '\200\035,\004', 0), + ('i', -70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('I', 70000000L, '\004,\035\200', '\200\035,\004', 0), + ('I', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('l', 70000000, '\004,\035\200', '\200\035,\004', 0), + ('l', -70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('L', 70000000L, '\004,\035\200', '\200\035,\004', 0), + ('L', 0x100000000L-70000000, '\373\323\342\200', '\200\342\323\373', 0), + ('f', 2.0, '@\000\000\000', '\000\000\000@', 0), + ('d', 2.0, '@\000\000\000\000\000\000\000', + '\000\000\000\000\000\000\000@', 0), + ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), + ('d', -2.0, '\300\000\000\000\000\000\000\000', + '\000\000\000\000\000\000\000\300', 0), + ('?', 0, '\0', '\0', 0), + ('?', 3, '\1', '\1', 1), + ('?', True, '\1', '\1', 0), + ('?', [], '\0', '\0', 1), + ('?', (1,), '\1', '\1', 1), + ] + + for fmt, arg, big, lil, asy in tests: + for (xfmt, exp) in [('>'+fmt, big), ('!'+fmt, big), ('<'+fmt, lil), + ('='+fmt, ISBIGENDIAN and big or lil)]: + res = struct.pack(xfmt, arg) + self.assertEqual(res, exp) + self.assertEqual(struct.calcsize(xfmt), len(res)) + rev = struct.unpack(xfmt, res)[0] + if rev != arg: + self.assert_(asy) + + def test_native_qQ(self): + # can't pack -1 as unsigned regardless + self.assertRaises((struct.error, TypeError), struct.pack, "Q", -1) + # can't pack string as 'q' regardless + self.assertRaises(struct.error, struct.pack, "q", "a") + # ditto, but 'Q' + self.assertRaises(struct.error, struct.pack, "Q", "a") + + try: + struct.pack("q", 5) + except struct.error: + # does not have native q/Q + pass else: - # x is out of range -- verify pack realizes that. - if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: - if verbose: - print "Skipping buggy range check for code", code - else: - deprecated_err(pack, ">" + code, x) - deprecated_err(pack, "<" + code, x) - - def run(self): - from random import randrange - - # Create all interesting powers of 2. - values = [] - for exp in range(self.bitsize + 3): - values.append(1L << exp) - - # Add some random values. - for i in range(self.bitsize): - val = 0L - for j in range(self.bytesize): - val = (val << 8) | randrange(256) - values.append(val) - - # Try all those, and their negations, and +-1 from them. Note - # that this tests all power-of-2 boundaries in range, and a few out - # of range, plus +-(2**n +- 1). - for base in values: - for val in -base, base: - for incr in -1, 0, 1: - x = val + incr - try: - x = int(x) - except OverflowError: - pass - self.test_one(x) - - # Some error cases. - for direction in "<>": - for code in self.formatpair: - for badobject in "a string", 3+42j, randrange: - any_err(struct.pack, direction + code, badobject) - -for args in [("bB", 1), - ("hH", 2), - ("iI", 4), - ("lL", 4), - ("qQ", 8)]: - t = IntTester(*args) - t.run() - - -########################################################################### -# The p ("Pascal string") code. - -def test_p_code(): - for code, input, expected, expectedback in [ - ('p','abc', '\x00', ''), - ('1p', 'abc', '\x00', ''), - ('2p', 'abc', '\x01a', 'a'), - ('3p', 'abc', '\x02ab', 'ab'), - ('4p', 'abc', '\x03abc', 'abc'), - ('5p', 'abc', '\x03abc\x00', 'abc'), - ('6p', 'abc', '\x03abc\x00\x00', 'abc'), - ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: - got = struct.pack(code, input) - if got != expected: - raise TestFailed("pack(%r, %r) == %r but expected %r" % - (code, input, got, expected)) - (got,) = struct.unpack(code, got) - if got != expectedback: - raise TestFailed("unpack(%r, %r) == %r but expected %r" % - (code, input, got, expectedback)) - -test_p_code() - - -########################################################################### -# SF bug 705836. "f" had a severe rounding bug, where a carry -# from the low-order discarded bits could propagate into the exponent -# field, causing the result to be wrong by a factor of 2. - -def test_705836(): - import math - - for base in range(1, 33): - # smaller <- largest representable float less than base. - delta = 0.5 - while base - delta / 2.0 != base: - delta /= 2.0 - smaller = base - delta - # Packing this rounds away a solid string of trailing 1 bits. - packed = struct.pack("f", smaller) - verify(bigpacked == string_reverse(packed), - ">f pack should be byte-reversal of f", bigpacked)[0] - verify(base == unpacked) - - # Largest finite IEEE single. - big = (1 << 24) - 1 - big = math.ldexp(big, 127 - 23) - packed = struct.pack(">f", big) - unpacked = struct.unpack(">f", packed)[0] - verify(big == unpacked) - - # The same, but tack on a 1 bit so it rounds up to infinity. - big = (1 << 25) - 1 - big = math.ldexp(big, 127 - 24) - try: + bytes = struct.calcsize('q') + # The expected values here are in big-endian format, primarily + # because I'm on a little-endian machine and so this is the + # clearest way (for me) to force the code to get exercised. + for format, input, expected in ( + ('q', -1, '\xff' * bytes), + ('q', 0, '\x00' * bytes), + ('Q', 0, '\x00' * bytes), + ('q', 1L, '\x00' * (bytes-1) + '\x01'), + ('Q', (1L << (8*bytes))-1, '\xff' * bytes), + ('q', (1L << (8*bytes-1))-1, '\x7f' + '\xff' * (bytes - 1))): + got = struct.pack(format, input) + native_expected = bigendian_to_native(expected) + self.assertEqual(got, native_expected) + retrieved = struct.unpack(format, got)[0] + self.assertEqual(retrieved, input) + + def test_standard_integers(self): + # Standard integer tests (bBhHiIlLqQ). + import binascii + + class IntTester(unittest.TestCase): + + # XXX Most std integer modes fail to test for out-of-range. + # The "i" and "l" codes appear to range-check OK on 32-bit boxes, but + # fail to check correctly on some 64-bit ones (Tru64 Unix + Compaq C + # reported by Mark Favas). + BUGGY_RANGE_CHECK = "bBhHiIlL" + + def __init__(self, formatpair, bytesize): + self.assertEqual(len(formatpair), 2) + self.formatpair = formatpair + for direction in "<>!=": + for code in formatpair: + format = direction + code + self.assertEqual(struct.calcsize(format), bytesize) + self.bytesize = bytesize + self.bitsize = bytesize * 8 + self.signed_code, self.unsigned_code = formatpair + self.unsigned_min = 0 + self.unsigned_max = 2L**self.bitsize - 1 + self.signed_min = -(2L**(self.bitsize-1)) + self.signed_max = 2L**(self.bitsize-1) - 1 + + def test_one(self, x, pack=struct.pack, + unpack=struct.unpack, + unhexlify=binascii.unhexlify): + # Try signed. + code = self.signed_code + if self.signed_min <= x <= self.signed_max: + # Try big-endian. + expected = long(x) + if x < 0: + expected += 1L << self.bitsize + self.assert_(expected > 0) + expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' + if len(expected) & 1: + expected = "0" + expected + expected = unhexlify(expected) + expected = "\x00" * (self.bytesize - len(expected)) + expected + + # Pack work? + format = ">" + code + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + # Try little-endian. + format = "<" + code + expected = string_reverse(expected) + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + else: + # x is out of range -- verify pack realizes that. + if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: + if verbose: + print "Skipping buggy range check for code", code + else: + deprecated_err(pack, ">" + code, x) + deprecated_err(pack, "<" + code, x) + + # Much the same for unsigned. + code = self.unsigned_code + if self.unsigned_min <= x <= self.unsigned_max: + # Try big-endian. + format = ">" + code + expected = long(x) + expected = hex(expected)[2:-1] # chop "0x" and trailing 'L' + if len(expected) & 1: + expected = "0" + expected + expected = unhexlify(expected) + expected = "\x00" * (self.bytesize - len(expected)) + expected + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + # Try little-endian. + format = "<" + code + expected = string_reverse(expected) + + # Pack work? + got = pack(format, x) + self.assertEqual(got, expected) + + # Unpack work? + retrieved = unpack(format, got)[0] + self.assertEqual(x, retrieved) + + # Adding any byte should cause a "too big" error. + self.assertRaises((struct.error, TypeError), unpack, format, + '\x01' + got) + + else: + # x is out of range -- verify pack realizes that. + if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: + if verbose: + print "Skipping buggy range check for code", code + else: + deprecated_err(pack, ">" + code, x) + deprecated_err(pack, "<" + code, x) + + def run(self): + from random import randrange + + # Create all interesting powers of 2. + values = [] + for exp in range(self.bitsize + 3): + values.append(1L << exp) + + # Add some random values. + for i in range(self.bitsize): + val = 0L + for j in range(self.bytesize): + val = (val << 8) | randrange(256) + values.append(val) + + # Try all those, and their negations, and +-1 from them. Note + # that this tests all power-of-2 boundaries in range, and a few out + # of range, plus +-(2**n +- 1). + for base in values: + for val in -base, base: + for incr in -1, 0, 1: + x = val + incr + try: + x = int(x) + except OverflowError: + pass + self.test_one(x) + + # Some error cases. + for direction in "<>": + for code in self.formatpair: + for badobject in "a string", 3+42j, randrange: + self.assertRaises((struct.error, TypeError), + struct.pack, direction + code, + badobject) + + for args in [("bB", 1), + ("hH", 2), + ("iI", 4), + ("lL", 4), + ("qQ", 8)]: + t = IntTester(*args) + t.run() + + def test_p_code(self): + # Test p ("Pascal string") code. + for code, input, expected, expectedback in [ + ('p','abc', '\x00', ''), + ('1p', 'abc', '\x00', ''), + ('2p', 'abc', '\x01a', 'a'), + ('3p', 'abc', '\x02ab', 'ab'), + ('4p', 'abc', '\x03abc', 'abc'), + ('5p', 'abc', '\x03abc\x00', 'abc'), + ('6p', 'abc', '\x03abc\x00\x00', 'abc'), + ('1000p', 'x'*1000, '\xff' + 'x'*999, 'x'*255)]: + got = struct.pack(code, input) + self.assertEqual(got, expected) + (got,) = struct.unpack(code, got) + self.assertEqual(got, expectedback) + + def test_705836(self): + # SF bug 705836. "f" had a severe rounding bug, where a carry + # from the low-order discarded bits could propagate into the exponent + # field, causing the result to be wrong by a factor of 2. + import math + + for base in range(1, 33): + # smaller <- largest representable float less than base. + delta = 0.5 + while base - delta / 2.0 != base: + delta /= 2.0 + smaller = base - delta + # Packing this rounds away a solid string of trailing 1 bits. + packed = struct.pack("f", smaller) + self.assertEqual(bigpacked, string_reverse(packed)) + unpacked = struct.unpack(">f", bigpacked)[0] + self.assertEqual(base, unpacked) + + # Largest finite IEEE single. + big = (1 << 24) - 1 + big = math.ldexp(big, 127 - 23) packed = struct.pack(">f", big) - except OverflowError: - pass - else: - raise TestFailed("expected OverflowError") - -test_705836() - -########################################################################### -# SF bug 1229380. No struct.pack exception for some out of range integers + unpacked = struct.unpack(">f", packed)[0] + self.assertEqual(big, unpacked) -def test_1229380(): - import sys - for endian in ('', '>', '<'): - for cls in (int, long): - for fmt in ('B', 'H', 'I', 'L'): - deprecated_err(struct.pack, endian + fmt, cls(-1)) - - deprecated_err(struct.pack, endian + 'B', cls(300)) - deprecated_err(struct.pack, endian + 'H', cls(70000)) - - deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L) - deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L) - -if PY_STRUCT_RANGE_CHECKING: - test_1229380() - -########################################################################### -# SF bug 1530559. struct.pack raises TypeError where it used to convert. - -def check_float_coerce(format, number): - if PY_STRUCT_FLOAT_COERCE == 2: - # Test for pre-2.5 struct module - packed = struct.pack(format, number) - floored = struct.unpack(format, packed)[0] - if floored != int(number): - raise TestFailed("did not correcly coerce float to int") - return - try: - func(*args) - except (struct.error, TypeError): - if PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected DeprecationWarning for float coerce") - except DeprecationWarning: - if not PY_STRUCT_FLOAT_COERCE: - raise TestFailed("expected to raise struct.error for float coerce") - else: - raise TestFailed("did not raise error for float coerce") - -check_float_coerce = with_warning_restore(deprecated_err) - -def test_1530559(): - for endian in ('', '>', '<'): - for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'): - check_float_coerce(endian + fmt, 1.0) - check_float_coerce(endian + fmt, 1.5) - -test_1530559() + # The same, but tack on a 1 bit so it rounds up to infinity. + big = (1 << 25) - 1 + big = math.ldexp(big, 127 - 24) + self.assertRaises(OverflowError, struct.pack, ">f", big) + + if PY_STRUCT_RANGE_CHECKING: + def test_1229380(self): + # SF bug 1229380. No struct.pack exception for some out of + # range integers + import sys + for endian in ('', '>', '<'): + for cls in (int, long): + for fmt in ('B', 'H', 'I', 'L'): + deprecated_err(struct.pack, endian + fmt, cls(-1)) + + deprecated_err(struct.pack, endian + 'B', cls(300)) + deprecated_err(struct.pack, endian + 'H', cls(70000)) + + deprecated_err(struct.pack, endian + 'I', sys.maxint * 4L) + deprecated_err(struct.pack, endian + 'L', sys.maxint * 4L) + + def XXXtest_1530559(self): + # XXX This is broken: see the bug report + # SF bug 1530559. struct.pack raises TypeError where it used to convert. + for endian in ('', '>', '<'): + for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'): + self.check_float_coerce(endian + fmt, 1.0) + self.check_float_coerce(endian + fmt, 1.5) + + def test_unpack_from(self): + test_string = 'abcd01234' + fmt = '4s' + s = struct.Struct(fmt) + for cls in (str, buffer): + data = cls(test_string) + self.assertEqual(s.unpack_from(data), ('abcd',)) + self.assertEqual(s.unpack_from(data, 2), ('cd01',)) + self.assertEqual(s.unpack_from(data, 4), ('0123',)) + for i in xrange(6): + self.assertEqual(s.unpack_from(data, i), (data[i:i+4],)) + for i in xrange(6, len(test_string) + 1): + self.assertRaises(struct.error, s.unpack_from, data, i) + for cls in (str, buffer): + data = cls(test_string) + self.assertEqual(struct.unpack_from(fmt, data), ('abcd',)) + self.assertEqual(struct.unpack_from(fmt, data, 2), ('cd01',)) + self.assertEqual(struct.unpack_from(fmt, data, 4), ('0123',)) + for i in xrange(6): + self.assertEqual(struct.unpack_from(fmt, data, i), (data[i:i+4],)) + for i in xrange(6, len(test_string) + 1): + self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + + def test_pack_into(self): + test_string = 'Reykjavik rocks, eow!' + writable_buf = array.array('c', ' '*100) + fmt = '21s' + s = struct.Struct(fmt) + + # Test without offset + s.pack_into(writable_buf, 0, test_string) + from_buf = writable_buf.tostring()[:len(test_string)] + self.assertEqual(from_buf, test_string) + + # Test with offset. + s.pack_into(writable_buf, 10, test_string) + from_buf = writable_buf.tostring()[:len(test_string)+10] + self.assertEqual(from_buf, test_string[:10] + test_string) + + # Go beyond boundaries. + small_buf = array.array('c', ' '*10) + self.assertRaises(struct.error, s.pack_into, small_buf, 0, test_string) + self.assertRaises(struct.error, s.pack_into, small_buf, 2, test_string) + + def test_pack_into_fn(self): + test_string = 'Reykjavik rocks, eow!' + writable_buf = array.array('c', ' '*100) + fmt = '21s' + pack_into = lambda *args: struct.pack_into(fmt, *args) + + # Test without offset. + pack_into(writable_buf, 0, test_string) + from_buf = writable_buf.tostring()[:len(test_string)] + self.assertEqual(from_buf, test_string) + + # Test with offset. + pack_into(writable_buf, 10, test_string) + from_buf = writable_buf.tostring()[:len(test_string)+10] + self.assertEqual(from_buf, test_string[:10] + test_string) + + # Go beyond boundaries. + small_buf = array.array('c', ' '*10) + self.assertRaises(struct.error, pack_into, small_buf, 0, test_string) + self.assertRaises(struct.error, pack_into, small_buf, 2, test_string) + + def test_unpack_with_buffer(self): + # SF bug 1563759: struct.unpack doens't support buffer protocol objects + data1 = array.array('B', '\x12\x34\x56\x78') + data2 = buffer('......\x12\x34\x56\x78......', 6, 4) + for data in [data1, data2]: + value, = struct.unpack('>I', data) + self.assertEqual(value, 0x12345678) + + def test_bool(self): + for prefix in tuple("<>!=")+('',): + false = (), [], [], '', 0 + true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 + + falseFormat = prefix + '?' * len(false) + packedFalse = struct.pack(falseFormat, *false) + unpackedFalse = struct.unpack(falseFormat, packedFalse) + + trueFormat = prefix + '?' * len(true) + packedTrue = struct.pack(trueFormat, *true) + unpackedTrue = struct.unpack(trueFormat, packedTrue) + + self.assertEqual(len(true), len(unpackedTrue)) + self.assertEqual(len(false), len(unpackedFalse)) + + for t in unpackedFalse: + self.assertFalse(t) + for t in unpackedTrue: + self.assertTrue(t) + + packed = struct.pack(prefix+'?', 1) + + self.assertEqual(len(packed), struct.calcsize(prefix+'?')) + + if len(packed) != 1: + self.assertFalse(prefix, msg='encoded bool is not one byte: %r' + %packed) + + for c in '\x01\x7f\xff\x0f\xf0': + self.assertTrue(struct.unpack('>?', c)[0]) + + def test_crasher(self): + if IS32BIT: + self.assertRaises(MemoryError, struct.pack, "357913941c", "a") + else: + print "%s test_crasher skipped on 64bit build." -########################################################################### -# Packing and unpacking to/from buffers. -# Copied and modified from unittest. -def assertRaises(excClass, callableObj, *args, **kwargs): - try: - callableObj(*args, **kwargs) - except excClass: - return - else: - raise TestFailed("%s not raised." % excClass) -def test_unpack_from(): - test_string = 'abcd01234' - fmt = '4s' - s = struct.Struct(fmt) - for cls in (str, buffer): - data = cls(test_string) - vereq(s.unpack_from(data), ('abcd',)) - vereq(s.unpack_from(data, 2), ('cd01',)) - vereq(s.unpack_from(data, 4), ('0123',)) - for i in xrange(6): - vereq(s.unpack_from(data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(s.unpack_from, data, i) - for cls in (str, buffer): - data = cls(test_string) - vereq(struct.unpack_from(fmt, data), ('abcd',)) - vereq(struct.unpack_from(fmt, data, 2), ('cd01',)) - vereq(struct.unpack_from(fmt, data, 4), ('0123',)) - for i in xrange(6): - vereq(struct.unpack_from(fmt, data, i), (data[i:i+4],)) - for i in xrange(6, len(test_string) + 1): - simple_err(struct.unpack_from, fmt, data, i) - -def test_pack_into(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - s = struct.Struct(fmt) - - # Test without offset - s.pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - s.pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, s.pack_into, small_buf, 0, test_string) - assertRaises(struct.error, s.pack_into, small_buf, 2, test_string) - -def test_pack_into_fn(): - test_string = 'Reykjavik rocks, eow!' - writable_buf = array.array('c', ' '*100) - fmt = '21s' - pack_into = lambda *args: struct.pack_into(fmt, *args) - - # Test without offset. - pack_into(writable_buf, 0, test_string) - from_buf = writable_buf.tostring()[:len(test_string)] - vereq(from_buf, test_string) - - # Test with offset. - pack_into(writable_buf, 10, test_string) - from_buf = writable_buf.tostring()[:len(test_string)+10] - vereq(from_buf, test_string[:10] + test_string) - - # Go beyond boundaries. - small_buf = array.array('c', ' '*10) - assertRaises(struct.error, pack_into, small_buf, 0, test_string) - assertRaises(struct.error, pack_into, small_buf, 2, test_string) - -def test_unpack_with_buffer(): - # SF bug 1563759: struct.unpack doens't support buffer protocol objects - data1 = array.array('B', '\x12\x34\x56\x78') - data2 = buffer('......\x12\x34\x56\x78......', 6, 4) - for data in [data1, data2]: - value, = struct.unpack('>I', data) - vereq(value, 0x12345678) - -# Test methods to pack and unpack from buffers rather than strings. -test_unpack_from() -test_pack_into() -test_pack_into_fn() -test_unpack_with_buffer() - -def test_bool(): - for prefix in tuple("<>!=")+('',): - false = (), [], [], '', 0 - true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 - - falseFormat = prefix + '?' * len(false) - if verbose: - print 'trying bool pack/unpack on', false, 'using format', falseFormat - packedFalse = struct.pack(falseFormat, *false) - unpackedFalse = struct.unpack(falseFormat, packedFalse) - - trueFormat = prefix + '?' * len(true) - if verbose: - print 'trying bool pack/unpack on', true, 'using format', trueFormat - packedTrue = struct.pack(trueFormat, *true) - unpackedTrue = struct.unpack(trueFormat, packedTrue) - - if len(true) != len(unpackedTrue): - raise TestFailed('unpacked true array is not of same size as input') - if len(false) != len(unpackedFalse): - raise TestFailed('unpacked false array is not of same size as input') - - for t in unpackedFalse: - if t is not False: - raise TestFailed('%r did not unpack as False' % t) - for t in unpackedTrue: - if t is not True: - raise TestFailed('%r did not unpack as false' % t) - - if prefix and verbose: - print 'trying size of bool with format %r' % (prefix+'?') - packed = struct.pack(prefix+'?', 1) - - if len(packed) != struct.calcsize(prefix+'?'): - raise TestFailed('packed length is not equal to calculated size') - - if len(packed) != 1 and prefix: - raise TestFailed('encoded bool is not one byte: %r' % packed) - elif not prefix and verbose: - print 'size of bool in native format is %i' % (len(packed)) - - for c in '\x01\x7f\xff\x0f\xf0': - if struct.unpack('>?', c)[0] is not True: - raise TestFailed('%c did not unpack as True' % c) +def test_main(): + run_unittest(StructTest) -test_bool() +if __name__ == '__main__': + test_main() Modified: python/branches/tlee-ast-optimize/Makefile.pre.in ============================================================================== --- python/branches/tlee-ast-optimize/Makefile.pre.in (original) +++ python/branches/tlee-ast-optimize/Makefile.pre.in Fri Jun 13 16:43:12 2008 @@ -304,7 +304,6 @@ Objects/bufferobject.o \ Objects/bytes_methods.o \ Objects/bytearrayobject.o \ - Objects/bytesobject.o \ Objects/cellobject.o \ Objects/classobject.o \ Objects/cobject.o \ @@ -328,8 +327,9 @@ Objects/object.o \ Objects/obmalloc.o \ Objects/rangeobject.o \ - Objects/setobject.o \ + Objects/setobject.o \ Objects/sliceobject.o \ + Objects/stringobject.o \ Objects/structseq.o \ Objects/tupleobject.o \ Objects/typeobject.o \ @@ -564,8 +564,6 @@ Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \ $(STRINGLIB_HEADERS) -Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c \ - $(STRINGLIB_HEADERS) Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \ $(STRINGLIB_HEADERS) Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Fri Jun 13 16:43:12 2008 @@ -13,7 +13,7 @@ ----------------- - Several set methods now accept multiple arguments: update(), union(), - intersection() and intersection_update(). + intersection(), intersection_update(), difference(), and difference_update(). - Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. @@ -40,6 +40,11 @@ Exception (KeyboardInterrupt, and SystemExit) propagate instead of ignoring them. +- Added checks for integer overflows, contributed by Google. Some are + only available if asserts are left in the code, in cases where they + can't be triggered from Python code. + + Extension Modules ----------------- Modified: python/branches/tlee-ast-optimize/Modules/_csv.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_csv.c (original) +++ python/branches/tlee-ast-optimize/Modules/_csv.c Fri Jun 13 16:43:12 2008 @@ -559,6 +559,10 @@ self->field = PyMem_Malloc(self->field_size); } else { + if (self->field_size > INT_MAX / 2) { + PyErr_NoMemory(); + return 0; + } self->field_size *= 2; self->field = PyMem_Realloc(self->field, self->field_size); } @@ -1053,6 +1057,12 @@ static int join_check_rec_size(WriterObj *self, int rec_len) { + + if (rec_len < 0 || rec_len > INT_MAX - MEM_INCR) { + PyErr_NoMemory(); + return 0; + } + if (rec_len > self->rec_size) { if (self->rec_size == 0) { self->rec_size = (rec_len / MEM_INCR + 1) * MEM_INCR; Modified: python/branches/tlee-ast-optimize/Modules/_heapqmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_heapqmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_heapqmodule.c Fri Jun 13 16:43:12 2008 @@ -17,13 +17,18 @@ cmp_lt(PyObject *x, PyObject *y) { int cmp; - cmp = PyObject_RichCompareBool(x, y, Py_LT); - if (cmp == -1 && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - cmp = PyObject_RichCompareBool(y, x, Py_LE); - if (cmp != -1) - cmp = 1 - cmp; + static PyObject *lt = NULL; + + if (lt == NULL) { + lt = PyString_FromString("__lt__"); + if (lt == NULL) + return -1; } + if (PyObject_HasAttr(x, lt)) + return PyObject_RichCompareBool(x, y, Py_LT); + cmp = PyObject_RichCompareBool(y, x, Py_LE); + if (cmp != -1) + cmp = 1 - cmp; return cmp; } Modified: python/branches/tlee-ast-optimize/Modules/_struct.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_struct.c (original) +++ python/branches/tlee-ast-optimize/Modules/_struct.c Fri Jun 13 16:43:12 2008 @@ -1385,6 +1385,12 @@ } } + /* check for overflow */ + if ((len + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) { + PyErr_NoMemory(); + return -1; + } + self->s_size = size; self->s_len = len; codes = PyMem_MALLOC((len + 1) * sizeof(formatcode)); Modified: python/branches/tlee-ast-optimize/Modules/arraymodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/arraymodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/arraymodule.c Fri Jun 13 16:43:12 2008 @@ -652,6 +652,9 @@ PyErr_BadArgument(); return NULL; } + if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b)) { + return PyErr_NoMemory(); + } size = Py_SIZE(a) + Py_SIZE(b); np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); if (np == NULL) { @@ -674,6 +677,9 @@ Py_ssize_t nbytes; if (n < 0) n = 0; + if ((Py_SIZE(a) != 0) && (n > PY_SSIZE_T_MAX / Py_SIZE(a))) { + return PyErr_NoMemory(); + } size = Py_SIZE(a) * n; np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); if (np == NULL) @@ -818,6 +824,11 @@ "can only extend with array of same kind"); return -1; } + if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) || + ((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { + PyErr_NoMemory(); + return -1; + } size = Py_SIZE(self) + Py_SIZE(b); PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize); if (self->ob_item == NULL) { @@ -859,6 +870,10 @@ if (n < 0) n = 0; items = self->ob_item; + if ((self->ob_descr->itemsize != 0) && + (Py_SIZE(self) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { + return PyErr_NoMemory(); + } size = Py_SIZE(self) * self->ob_descr->itemsize; if (n == 0) { PyMem_FREE(items); @@ -867,6 +882,9 @@ self->allocated = 0; } else { + if (size > PY_SSIZE_T_MAX / n) { + return PyErr_NoMemory(); + } PyMem_Resize(items, char, n * size); if (items == NULL) return PyErr_NoMemory(); @@ -1148,6 +1166,10 @@ Py_INCREF(dict); } if (Py_SIZE(array) > 0) { + if (array->ob_descr->itemsize + > PY_SSIZE_T_MAX / array->ob_size) { + return PyErr_NoMemory(); + } result = Py_BuildValue("O(cs#)O", Py_TYPE(array), array->ob_descr->typecode, @@ -1330,6 +1352,9 @@ if ((*self->ob_descr->setitem)(self, Py_SIZE(self) - n + i, v) != 0) { Py_SIZE(self) -= n; + if (itemsize && (self->ob_size > PY_SSIZE_T_MAX / itemsize)) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, char, Py_SIZE(self) * itemsize); self->ob_item = item; @@ -1389,6 +1414,10 @@ n = n / itemsize; if (n > 0) { char *item = self->ob_item; + if ((n > PY_SSIZE_T_MAX - Py_SIZE(self)) || + ((Py_SIZE(self) + n) > PY_SSIZE_T_MAX / itemsize)) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize); if (item == NULL) { PyErr_NoMemory(); @@ -1414,8 +1443,12 @@ static PyObject * array_tostring(arrayobject *self, PyObject *unused) { - return PyString_FromStringAndSize(self->ob_item, + if (self->ob_size <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { + return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); + } else { + return PyErr_NoMemory(); + } } PyDoc_STRVAR(tostring_doc, @@ -1443,6 +1476,9 @@ } if (n > 0) { Py_UNICODE *item = (Py_UNICODE *) self->ob_item; + if (Py_SIZE(self) > PY_SSIZE_T_MAX - n) { + return PyErr_NoMemory(); + } PyMem_RESIZE(item, Py_UNICODE, Py_SIZE(self) + n); if (item == NULL) { PyErr_NoMemory(); Modified: python/branches/tlee-ast-optimize/Modules/audioop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/audioop.c (original) +++ python/branches/tlee-ast-optimize/Modules/audioop.c Fri Jun 13 16:43:12 2008 @@ -829,7 +829,7 @@ audioop_tostereo(PyObject *self, PyObject *args) { signed char *cp, *ncp; - int len, size, val1, val2, val = 0; + int len, new_len, size, val1, val2, val = 0; double fac1, fac2, fval, maxval; PyObject *rv; int i; @@ -846,7 +846,14 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*2); + new_len = len*2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); @@ -1009,7 +1016,7 @@ { signed char *cp; unsigned char *ncp; - int len, size, size2, val = 0; + int len, new_len, size, size2, val = 0; PyObject *rv; int i, j; @@ -1023,7 +1030,13 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, (len/size)*size2); + new_len = (len/size)*size2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); @@ -1059,6 +1072,7 @@ int chan, d, *prev_i, *cur_i, cur_o; PyObject *state, *samps, *str, *rv = NULL; int bytes_per_frame; + size_t alloc_size; weightA = 1; weightB = 0; @@ -1101,8 +1115,14 @@ inrate /= d; outrate /= d; - prev_i = (int *) malloc(nchannels * sizeof(int)); - cur_i = (int *) malloc(nchannels * sizeof(int)); + alloc_size = sizeof(int) * (unsigned)nchannels; + if (alloc_size < nchannels) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + prev_i = (int *) malloc(alloc_size); + cur_i = (int *) malloc(alloc_size); if (prev_i == NULL || cur_i == NULL) { (void) PyErr_NoMemory(); goto exit; @@ -1276,7 +1296,7 @@ unsigned char *cp; unsigned char cval; signed char *ncp; - int len, size, val; + int len, new_len, size, val; PyObject *rv; int i; @@ -1289,12 +1309,18 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + new_len = len*size; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); - for ( i=0; i < len*size; i += size ) { + for ( i=0; i < new_len; i += size ) { cval = *cp++; val = st_ulaw2linear16(cval); @@ -1344,7 +1370,7 @@ unsigned char *cp; unsigned char cval; signed char *ncp; - int len, size, val; + int len, new_len, size, val; PyObject *rv; int i; @@ -1357,12 +1383,18 @@ return 0; } - rv = PyString_FromStringAndSize(NULL, len*size); + new_len = len*size; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + rv = PyString_FromStringAndSize(NULL, new_len); if ( rv == 0 ) return 0; ncp = (signed char *)PyString_AsString(rv); - for ( i=0; i < len*size; i += size ) { + for ( i=0; i < new_len; i += size ) { cval = *cp++; val = st_alaw2linear16(cval); @@ -1487,7 +1519,7 @@ { signed char *cp; signed char *ncp; - int len, size, valpred, step, delta, index, sign, vpdiff; + int len, new_len, size, valpred, step, delta, index, sign, vpdiff; PyObject *rv, *str, *state; int i, inputbuffer = 0, bufferstep; @@ -1509,7 +1541,13 @@ } else if ( !PyArg_ParseTuple(state, "ii", &valpred, &index) ) return 0; - str = PyString_FromStringAndSize(NULL, len*size*2); + new_len = len*size*2; + if (new_len < 0) { + PyErr_SetString(PyExc_MemoryError, + "not enough memory for output buffer"); + return 0; + } + str = PyString_FromStringAndSize(NULL, new_len); if ( str == 0 ) return 0; ncp = (signed char *)PyString_AsString(str); @@ -1517,7 +1555,7 @@ step = stepsizeTable[index]; bufferstep = 0; - for ( i=0; i < len*size*2; i += size ) { + for ( i=0; i < new_len; i += size ) { /* Step 1 - get the delta value and compute next index */ if ( bufferstep ) { delta = inputbuffer & 0xf; Modified: python/branches/tlee-ast-optimize/Modules/binascii.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/binascii.c (original) +++ python/branches/tlee-ast-optimize/Modules/binascii.c Fri Jun 13 16:43:12 2008 @@ -141,7 +141,7 @@ #define BASE64_PAD '=' /* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (INT_MAX/2 - sizeof(PyStringObject) - 3) +#define BASE64_MAXBIN (PY_SSIZE_T_MAX/2 - sizeof(PyStringObject) - 3) static unsigned char table_b2a_base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -198,6 +198,8 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) return NULL; + assert(ascii_len >= 0); + /* First byte: binary data length (in bytes) */ bin_len = (*ascii_data++ - ' ') & 077; ascii_len--; @@ -351,6 +353,11 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) return NULL; + assert(ascii_len >= 0); + + if (ascii_len > PY_SSIZE_T_MAX - 3) + return PyErr_NoMemory(); + bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ /* Allocate the buffer */ @@ -440,6 +447,9 @@ if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) return NULL; + + assert(bin_len >= 0); + if ( bin_len > BASE64_MAXBIN ) { PyErr_SetString(Error, "Too much data for base64 line"); return NULL; @@ -495,6 +505,11 @@ if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX - 2) + return PyErr_NoMemory(); + /* Allocate a string that is too big (fixed later) Add two to the initial length to prevent interning which would preclude subsequent resizing. */ @@ -558,6 +573,11 @@ if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX / 2 - 2) + return PyErr_NoMemory(); + /* Worst case: output is twice as big as input (fixed later) */ if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; @@ -607,6 +627,11 @@ if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) ) return NULL; + assert(len >= 0); + + if (len > PY_SSIZE_T_MAX / 2 - 2) + return PyErr_NoMemory(); + /* Allocate a buffer that is at least large enough */ if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) return NULL; @@ -645,9 +670,13 @@ if ( !PyArg_ParseTuple(args, "s#:rledecode_hqx", &in_data, &in_len) ) return NULL; + assert(in_len >= 0); + /* Empty string is a special case */ if ( in_len == 0 ) return PyString_FromString(""); + else if (in_len > PY_SSIZE_T_MAX / 2) + return PyErr_NoMemory(); /* Allocate a buffer of reasonable size. Resized when needed */ out_len = in_len*2; @@ -673,6 +702,7 @@ #define OUTBYTE(b) \ do { \ if ( --out_len_left < 0 ) { \ + if ( out_len > PY_SSIZE_T_MAX / 2) return PyErr_NoMemory(); \ _PyString_Resize(&rv, 2*out_len); \ if ( rv == NULL ) return NULL; \ out_data = (unsigned char *)PyString_AsString(rv) \ @@ -741,7 +771,7 @@ if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) return NULL; - while(len--) { + while(len-- > 0) { crc=((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++]; } @@ -901,7 +931,7 @@ return NULL; crc = ~ crc; - while (len--) + while (len-- > 0) crc = crc_32_tab[(crc ^ *bin_data++) & 0xffU] ^ (crc >> 8); /* Note: (crc >> 8) MUST zero fill on left */ @@ -923,6 +953,10 @@ if (!PyArg_ParseTuple(args, "s#:b2a_hex", &argbuf, &arglen)) return NULL; + assert(arglen >= 0); + if (arglen > PY_SSIZE_T_MAX / 2) + return PyErr_NoMemory(); + retval = PyString_FromStringAndSize(NULL, arglen*2); if (!retval) return NULL; @@ -980,6 +1014,8 @@ if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen)) return NULL; + assert(arglen >= 0); + /* XXX What should we do about strings with an odd length? Should * we add an implicit leading zero, or a trailing zero? For now, * raise an exception. Modified: python/branches/tlee-ast-optimize/Modules/cPickle.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cPickle.c (original) +++ python/branches/tlee-ast-optimize/Modules/cPickle.c Fri Jun 13 16:43:12 2008 @@ -3435,6 +3435,14 @@ if (self->read_func(self, &s, 4) < 0) return -1; l = calc_binint(s, 4); + if (l < 0) { + /* Corrupt or hostile pickle -- we never write one like + * this. + */ + PyErr_SetString(UnpicklingError, + "BINSTRING pickle has negative byte count"); + return -1; + } if (self->read_func(self, &s, l) < 0) return -1; @@ -3502,6 +3510,14 @@ if (self->read_func(self, &s, 4) < 0) return -1; l = calc_binint(s, 4); + if (l < 0) { + /* Corrupt or hostile pickle -- we never write one like + * this. + */ + PyErr_SetString(UnpicklingError, + "BINUNICODE pickle has negative byte count"); + return -1; + } if (self->read_func(self, &s, l) < 0) return -1; Modified: python/branches/tlee-ast-optimize/Modules/cStringIO.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cStringIO.c (original) +++ python/branches/tlee-ast-optimize/Modules/cStringIO.c Fri Jun 13 16:43:12 2008 @@ -119,6 +119,7 @@ static PyObject * IO_cgetval(PyObject *self) { if (!IO__opencheck(IOOOBJECT(self))) return NULL; + assert(IOOOBJECT(self)->pos >= 0); return PyString_FromStringAndSize(((IOobject*)self)->buf, ((IOobject*)self)->pos); } @@ -137,6 +138,7 @@ } else s=self->string_size; + assert(self->pos >= 0); return PyString_FromStringAndSize(self->buf, s); } @@ -157,6 +159,8 @@ Py_ssize_t l; if (!IO__opencheck(IOOOBJECT(self))) return -1; + assert(IOOOBJECT(self)->pos >= 0); + assert(IOOOBJECT(self)->string_size >= 0); l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos; if (n < 0 || n > l) { n = l; @@ -192,12 +196,17 @@ for (n = ((IOobject*)self)->buf + ((IOobject*)self)->pos, s = ((IOobject*)self)->buf + ((IOobject*)self)->string_size; n < s && *n != '\n'; n++); + if (n < s) n++; *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; l = n - ((IOobject*)self)->buf - ((IOobject*)self)->pos; - assert(((IOobject*)self)->pos + l < INT_MAX); - ((IOobject*)self)->pos += (int)l; + + assert(IOOOBJECT(self)->pos <= PY_SSIZE_T_MAX - l); + assert(IOOOBJECT(self)->pos >= 0); + assert(IOOOBJECT(self)->string_size >= 0); + + ((IOobject*)self)->pos += l; return (int)l; } @@ -215,6 +224,7 @@ n -= m; self->pos -= m; } + assert(IOOOBJECT(self)->pos >= 0); return PyString_FromStringAndSize(output, n); } @@ -277,6 +287,7 @@ if (!IO__opencheck(self)) return NULL; + assert(self->pos >= 0); return PyInt_FromSsize_t(self->pos); } Modified: python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c (original) +++ python/branches/tlee-ast-optimize/Modules/cjkcodecs/multibytecodec.c Fri Jun 13 16:43:12 2008 @@ -163,13 +163,17 @@ static int expand_encodebuffer(MultibyteEncodeBuffer *buf, Py_ssize_t esize) { - Py_ssize_t orgpos, orgsize; + Py_ssize_t orgpos, orgsize, incsize; orgpos = (Py_ssize_t)((char *)buf->outbuf - PyString_AS_STRING(buf->outobj)); orgsize = PyString_GET_SIZE(buf->outobj); - if (_PyString_Resize(&buf->outobj, orgsize + ( - esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) + incsize = (esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize); + + if (orgsize > PY_SSIZE_T_MAX - incsize) + return -1; + + if (_PyString_Resize(&buf->outobj, orgsize + incsize) == -1) return -1; buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; @@ -473,6 +477,12 @@ buf.excobj = NULL; buf.inbuf = buf.inbuf_top = *data; buf.inbuf_end = buf.inbuf_top + datalen; + + if (datalen > (PY_SSIZE_T_MAX - 16) / 2) { + PyErr_NoMemory(); + goto errorexit; + } + buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); if (buf.outobj == NULL) goto errorexit; @@ -735,6 +745,11 @@ origpending = ctx->pendingsize; if (origpending > 0) { + if (datalen > PY_SSIZE_T_MAX - ctx->pendingsize) { + PyErr_NoMemory(); + /* inbuf_tmp == NULL */ + goto errorexit; + } inbuf_tmp = PyMem_New(Py_UNICODE, datalen + ctx->pendingsize); if (inbuf_tmp == NULL) goto errorexit; @@ -797,9 +812,10 @@ Py_ssize_t npendings; npendings = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - if (npendings + ctx->pendingsize > MAXDECPENDING) { - PyErr_SetString(PyExc_UnicodeError, "pending buffer overflow"); - return -1; + if (npendings + ctx->pendingsize > MAXDECPENDING || + npendings > PY_SSIZE_T_MAX - ctx->pendingsize) { + PyErr_SetString(PyExc_UnicodeError, "pending buffer overflow"); + return -1; } memcpy(ctx->pending + ctx->pendingsize, buf->inbuf, npendings); ctx->pendingsize += npendings; @@ -1001,7 +1017,7 @@ PyObject *args, PyObject *kwargs) { MultibyteDecodeBuffer buf; - char *data, *wdata; + char *data, *wdata = NULL; Py_ssize_t wsize, finalsize = 0, size, origpending; int final = 0; @@ -1017,6 +1033,10 @@ wdata = data; } else { + if (size > PY_SSIZE_T_MAX - self->pendingsize) { + PyErr_NoMemory(); + goto errorexit; + } wsize = size + self->pendingsize; wdata = PyMem_Malloc(wsize); if (wdata == NULL) @@ -1235,6 +1255,10 @@ PyObject *ctr; char *ctrdata; + if (PyString_GET_SIZE(cres) > PY_SSIZE_T_MAX - self->pendingsize) { + PyErr_NoMemory(); + goto errorexit; + } rsize = PyString_GET_SIZE(cres) + self->pendingsize; ctr = PyString_FromStringAndSize(NULL, rsize); if (ctr == NULL) Modified: python/branches/tlee-ast-optimize/Modules/datetimemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/datetimemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/datetimemodule.c Fri Jun 13 16:43:12 2008 @@ -1115,6 +1115,8 @@ char sign; int none; + assert(buflen >= 1); + offset = call_utcoffset(tzinfo, tzinfoarg, &none); if (offset == -1 && PyErr_Occurred()) return -1; @@ -1206,10 +1208,15 @@ * a new format. Since computing the replacements for those codes * is expensive, don't unless they're actually used. */ + if (format_len > INT_MAX - 1) { + PyErr_NoMemory(); + goto Done; + } + totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ - newfmt = PyBytes_FromStringAndSize(NULL, totalnew); + newfmt = PyString_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; - pnew = PyBytes_AsString(newfmt); + pnew = PyString_AsString(newfmt); usednew = 0; pin = format; Modified: python/branches/tlee-ast-optimize/Modules/md5.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/md5.c (original) +++ python/branches/tlee-ast-optimize/Modules/md5.c Fri Jun 13 16:43:12 2008 @@ -53,6 +53,7 @@ #include "md5.h" #include +#include #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN @@ -330,6 +331,18 @@ if (nbytes <= 0) return; + /* this special case is handled recursively */ + if (nbytes > INT_MAX - offset) { + int overlap; + + /* handle the append in two steps to prevent overflow */ + overlap = 64 - offset; + + md5_append(pms, data, overlap); + md5_append(pms, data + overlap, nbytes - overlap); + return; + } + /* Update the message length. */ pms->count[1] += nbytes >> 29; pms->count[0] += nbits; Modified: python/branches/tlee-ast-optimize/Modules/stropmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/stropmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/stropmodule.c Fri Jun 13 16:43:12 2008 @@ -578,7 +578,7 @@ char* e; char* p; char* q; - Py_ssize_t i, j; + Py_ssize_t i, j, old_j; PyObject* out; char* string; Py_ssize_t stringlen; @@ -595,12 +595,18 @@ } /* First pass: determine size of output string */ - i = j = 0; /* j: current column; i: total of previous lines */ + i = j = old_j = 0; /* j: current column; i: total of previous lines */ e = string + stringlen; for (p = string; p < e; p++) { - if (*p == '\t') + if (*p == '\t') { j += tabsize - (j%tabsize); - else { + if (old_j > j) { + PyErr_SetString(PyExc_OverflowError, + "new string is too long"); + return NULL; + } + old_j = j; + } else { j++; if (*p == '\n') { i += j; @@ -609,6 +615,11 @@ } } + if ((i + j) < 0) { + PyErr_SetString(PyExc_OverflowError, "new string is too long"); + return NULL; + } + /* Second pass: create output string and fill it */ out = PyString_FromStringAndSize(NULL, i+j); if (out == NULL) Modified: python/branches/tlee-ast-optimize/Objects/bufferobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bufferobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bufferobject.c Fri Jun 13 16:43:12 2008 @@ -207,7 +207,10 @@ "size must be zero or positive"); return NULL; } - /* XXX: check for overflow in multiply */ + if (sizeof(*b) > PY_SSIZE_T_MAX - size) { + /* unlikely */ + return PyErr_NoMemory(); + } /* Inline PyObject_New */ o = (PyObject *)PyObject_MALLOC(sizeof(*b) + size); if ( o == NULL ) @@ -401,6 +404,8 @@ if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) return NULL; + assert(count <= PY_SIZE_MAX - size); + ob = PyString_FromStringAndSize(NULL, size + count); if ( ob == NULL ) return NULL; Deleted: python/branches/tlee-ast-optimize/Objects/bytesobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytesobject.c Fri Jun 13 16:43:12 2008 +++ (empty file) @@ -1,5215 +0,0 @@ -/* String object implementation */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include - -#ifdef COUNT_ALLOCS -int null_strings, one_strings; -#endif - -static PyBytesObject *characters[UCHAR_MAX + 1]; -static PyBytesObject *nullstring; - -/* This dictionary holds all interned strings. Note that references to - strings in this dictionary are *not* counted in the string's ob_refcnt. - When the interned string reaches a refcnt of 0 the string deallocation - function will delete the reference from this dictionary. - - Another way to look at this is that to say that the actual reference - count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) -*/ -static PyObject *interned; - -/* - For both PyBytes_FromString() and PyBytes_FromStringAndSize(), the - parameter `size' denotes number of characters to allocate, not counting any - null terminating character. - - For PyBytes_FromString(), the parameter `str' points to a null-terminated - string containing exactly `size' bytes. - - For PyBytes_FromStringAndSize(), the parameter the parameter `str' is - either NULL or else points to a string containing at least `size' bytes. - For PyBytes_FromStringAndSize(), the string in the `str' parameter does - not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyBytes_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyBytes_FromStringAndSize() will allocate `size+1' - bytes (setting the last byte to the null terminating character) and you can - fill in the data yourself. If `str' is non-NULL then the resulting - PyString object must be treated as immutable and you must not fill in nor - alter the data yourself, since the strings may be shared. - - The PyObject member `op->ob_size', which denotes the number of "extra - items" in a variable-size object, will contain the number of bytes - allocated for string data, not counting the null terminating character. It - is therefore equal to the equal to the `size' parameter (for - PyBytes_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyBytes_FromString()). -*/ -PyObject * -PyBytes_FromStringAndSize(const char *str, Py_ssize_t size) -{ - register PyBytesObject *op; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyBytes_FromStringAndSize"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && str != NULL && - (op = characters[*str & UCHAR_MAX]) != NULL) - { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - if (str != NULL) - Py_MEMCPY(op->ob_sval, str, size); - op->ob_sval[size] = '\0'; - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyBytesObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1 && str != NULL) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyBytesObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyBytes_FromString(const char *str) -{ - register size_t size; - register PyBytesObject *op; - - assert(str != NULL); - size = strlen(str); - if (size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string is too long for a Python string"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, str, size+1); - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyBytesObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyBytesObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyBytes_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t n = 0; - const char* f; - char *s; - PyObject* string; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f; - while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*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. */ - n += 20; - break; - case 's': - s = va_arg(count, char*); - n += strlen(s); - 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: - /* step 2: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyBytes_FromStringAndSize(NULL, n); - if (!string) - return NULL; - - s = PyBytes_AsString(string); - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - Py_ssize_t i; - int longflag = 0; - int size_tflag = 0; - /* parse the width.precision part (we're only - interested in the precision value, if any) */ - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - if (*f == '.') { - f++; - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - } - while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - f++; - /* 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': - if (longflag) - sprintf(s, "%ld", va_arg(vargs, long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "d", - va_arg(vargs, Py_ssize_t)); - else - sprintf(s, "%d", va_arg(vargs, int)); - s += strlen(s); - break; - case 'u': - if (longflag) - sprintf(s, "%lu", - va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "u", - va_arg(vargs, size_t)); - else - sprintf(s, "%u", - va_arg(vargs, unsigned int)); - s += strlen(s); - break; - case 'i': - sprintf(s, "%i", va_arg(vargs, int)); - s += strlen(s); - break; - case 'x': - sprintf(s, "%x", va_arg(vargs, int)); - s += strlen(s); - break; - case 's': - p = va_arg(vargs, char*); - i = strlen(p); - if (n > 0 && i > n) - i = n; - Py_MEMCPY(s, p, i); - s += i; - break; - case 'p': - sprintf(s, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (s[1] == 'X') - s[1] = 'x'; - else if (s[1] != 'x') { - memmove(s+2, s, strlen(s)+1); - s[0] = '0'; - s[1] = 'x'; - } - s += strlen(s); - break; - case '%': - *s++ = '%'; - break; - default: - strcpy(s, p); - s += strlen(s); - goto end; - } - } else - *s++ = *f; - } - - end: - _PyBytes_Resize(&string, s - PyBytes_AS_STRING(string)); - return string; -} - -PyObject * -PyBytes_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyBytes_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - - -PyObject *PyBytes_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyBytes_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyBytes_AsDecodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyBytes_AsDecodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyBytes_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Decode via the codec registry */ - v = PyCodec_Decode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyBytes_AsDecodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyBytes_AsDecodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyBytes_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -PyObject *PyBytes_Encode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyBytes_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyBytes_AsEncodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyBytes_AsEncodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyBytes_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyBytes_AsEncodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyBytes_AsEncodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyBytes_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -static void -string_dealloc(PyObject *op) -{ - switch (PyBytes_CHECK_INTERNED(op)) { - case SSTATE_NOT_INTERNED: - break; - - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(op) = 3; - if (PyDict_DelItem(interned, op) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; - - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); - - default: - Py_FatalError("Inconsistent interned string state."); - } - Py_TYPE(op)->tp_free(op); -} - -/* Unescape a backslash-escaped string. If unicode is non-zero, - the string is a u-literal. If recode_encoding is non-zero, - the string is UTF-8 encoded and should be re-encoded in the - specified encoding. */ - -PyObject *PyBytes_DecodeEscape(const char *s, - Py_ssize_t len, - const char *errors, - Py_ssize_t unicode, - const char *recode_encoding) -{ - int c; - char *p, *buf; - const char *end; - PyObject *v; - Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyBytes_FromStringAndSize((char *)NULL, newlen); - if (v == NULL) - return NULL; - p = buf = PyBytes_AsString(v); - end = s + len; - while (s < end) { - if (*s != '\\') { - non_esc: -#ifdef Py_USING_UNICODE - if (recode_encoding && (*s & 0x80)) { - PyObject *u, *w; - char *r; - const char* t; - Py_ssize_t rn; - t = s; - /* Decode non-ASCII bytes as UTF-8. */ - while (t < end && (*t & 0x80)) t++; - u = PyUnicode_DecodeUTF8(s, t - s, errors); - if(!u) goto failed; - - /* Recode them in target encoding. */ - w = PyUnicode_AsEncodedString( - u, recode_encoding, errors); - Py_DECREF(u); - if (!w) goto failed; - - /* Append bytes to output buffer. */ - assert(PyBytes_Check(w)); - r = PyBytes_AS_STRING(w); - rn = PyBytes_GET_SIZE(w); - Py_MEMCPY(p, r, rn); - p += rn; - Py_DECREF(w); - s = t; - } else { - *p++ = *s++; - } -#else - *p++ = *s++; -#endif - continue; - } - s++; - if (s==end) { - PyErr_SetString(PyExc_ValueError, - "Trailing \\ in string"); - goto failed; - } - switch (*s++) { - /* XXX This assumes ASCII! */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - c = (c<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - c = (c<<3) + *s++ - '0'; - } - *p++ = c; - break; - case 'x': - if (s+1 < end && - isxdigit(Py_CHARMASK(s[0])) && - isxdigit(Py_CHARMASK(s[1]))) - { - unsigned int x = 0; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x = c - '0'; - else if (islower(c)) - x = 10 + c - 'a'; - else - x = 10 + c - 'A'; - x = x << 4; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x += c - '0'; - else if (islower(c)) - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - *p++ = x; - break; - } - if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); - goto failed; - } - if (strcmp(errors, "replace") == 0) { - *p++ = '?'; - } else if (strcmp(errors, "ignore") == 0) - /* do nothing */; - else { - PyErr_Format(PyExc_ValueError, - "decoding error; " - "unknown error handling code: %.400s", - errors); - goto failed; - } -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif - default: - *p++ = '\\'; - s--; - goto non_esc; /* an arbitry number of unescaped - UTF-8 bytes may follow. */ - } - } - if (p-buf < newlen) - _PyBytes_Resize(&v, p - buf); - return v; - failed: - Py_DECREF(v); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* object api */ - -static Py_ssize_t -string_getsize(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyBytes_AsStringAndSize(op, &s, &len)) - return -1; - return len; -} - -static /*const*/ char * -string_getbuffer(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyBytes_AsStringAndSize(op, &s, &len)) - return NULL; - return s; -} - -Py_ssize_t -PyBytes_Size(register PyObject *op) -{ - if (!PyBytes_Check(op)) - return string_getsize(op); - return Py_SIZE(op); -} - -/*const*/ char * -PyBytes_AsString(register PyObject *op) -{ - if (!PyBytes_Check(op)) - return string_getbuffer(op); - return ((PyBytesObject *)op) -> ob_sval; -} - -int -PyBytes_AsStringAndSize(register PyObject *obj, - register char **s, - register Py_ssize_t *len) -{ - if (s == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (!PyBytes_Check(obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(obj)) { - obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); - if (obj == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " - "%.200s found", Py_TYPE(obj)->tp_name); - return -1; - } - } - - *s = PyBytes_AS_STRING(obj); - if (len != NULL) - *len = PyBytes_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyBytes_GET_SIZE(obj)) { - PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); - return -1; - } - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#include "stringlib/stringdefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" - -#define _Py_InsertThousandsGrouping _PyBytes_InsertThousandsGrouping -#include "stringlib/localeutil.h" - - - -static int -string_print(PyBytesObject *op, FILE *fp, int flags) -{ - Py_ssize_t i, str_len; - char c; - int quote; - - /* XXX Ought to check for interrupts when writing long strings */ - if (! PyBytes_CheckExact(op)) { - int ret; - /* A str subclass may have its own __str__ method. */ - op = (PyBytesObject *) PyObject_Str((PyObject *)op); - if (op == NULL) - return -1; - ret = string_print(op, fp, flags); - Py_DECREF(op); - return ret; - } - if (flags & Py_PRINT_RAW) { - char *data = op->ob_sval; - Py_ssize_t size = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - while (size > INT_MAX) { - /* Very long strings cannot be written atomically. - * But don't write exactly INT_MAX bytes at a time - * to avoid memory aligment issues. - */ - const int chunk_size = INT_MAX & ~0x3FFF; - fwrite(data, 1, chunk_size, fp); - data += chunk_size; - size -= chunk_size; - } -#ifdef __VMS - if (size) fwrite(data, (int)size, 1, fp); -#else - fwrite(data, 1, (int)size, fp); -#endif - Py_END_ALLOW_THREADS - return 0; - } - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - str_len = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - fputc(quote, fp); - for (i = 0; i < str_len; i++) { - /* Since strings are immutable and the caller should have a - reference, accessing the interal buffer should not be an issue - with the GIL released. */ - c = op->ob_sval[i]; - if (c == quote || c == '\\') - fprintf(fp, "\\%c", c); - else if (c == '\t') - fprintf(fp, "\\t"); - else if (c == '\n') - fprintf(fp, "\\n"); - else if (c == '\r') - fprintf(fp, "\\r"); - else if (c < ' ' || c >= 0x7f) - fprintf(fp, "\\x%02x", c & 0xff); - else - fputc(c, fp); - } - fputc(quote, fp); - Py_END_ALLOW_THREADS - return 0; -} - -PyObject * -PyBytes_Repr(PyObject *obj, int smartquotes) -{ - register PyBytesObject* op = (PyBytesObject*) obj; - size_t newsize = 2 + 4 * Py_SIZE(op); - PyObject *v; - if (newsize > PY_SSIZE_T_MAX || newsize / 4 != Py_SIZE(op)) { - PyErr_SetString(PyExc_OverflowError, - "string is too large to make repr"); - return NULL; - } - v = PyBytes_FromStringAndSize((char *)NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (smartquotes && - memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - p = PyBytes_AS_STRING(v); - *p++ = quote; - for (i = 0; i < Py_SIZE(op); i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyBytes_AS_STRING(v)) >= 5); - c = op->ob_sval[i]; - if (c == quote || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c < ' ' || c >= 0x7f) { - /* For performance, we don't want to call - PyOS_snprintf here (extra layers of - function call). */ - sprintf(p, "\\x%02x", c & 0xff); - p += 4; - } - else - *p++ = c; - } - assert(newsize - (p - PyBytes_AS_STRING(v)) >= 1); - *p++ = quote; - *p = '\0'; - _PyBytes_Resize( - &v, (p - PyBytes_AS_STRING(v))); - return v; - } -} - -static PyObject * -string_repr(PyObject *op) -{ - return PyBytes_Repr(op, 1); -} - -static PyObject * -string_str(PyObject *s) -{ - assert(PyBytes_Check(s)); - if (PyBytes_CheckExact(s)) { - Py_INCREF(s); - return s; - } - else { - /* Subtype -- return genuine string with the same value. */ - PyBytesObject *t = (PyBytesObject *) s; - return PyBytes_FromStringAndSize(t->ob_sval, Py_SIZE(t)); - } -} - -static Py_ssize_t -string_length(PyBytesObject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -string_concat(register PyBytesObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register PyBytesObject *op; - if (!PyBytes_Check(bb)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(bb)) - return PyUnicode_Concat((PyObject *)a, bb); -#endif - if (PyByteArray_Check(bb)) - return PyByteArray_Concat((PyObject *)a, bb); - PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str' and '%.200s' objects", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyBytesObject *)bb) - /* Optimize cases with empty left or right operand */ - if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyBytes_CheckExact(a) && PyBytes_CheckExact(b)) { - if (Py_SIZE(a) == 0) { - Py_INCREF(bb); - return bb; - } - Py_INCREF(a); - return (PyObject *)a; - } - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - /* Inline PyObject_NewVar */ - op = (PyBytesObject *)PyObject_MALLOC(sizeof(PyBytesObject) + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - Py_MEMCPY(op->ob_sval + Py_SIZE(a), b->ob_sval, Py_SIZE(b)); - op->ob_sval[size] = '\0'; - return (PyObject *) op; -#undef b -} - -static PyObject * -string_repeat(register PyBytesObject *a, register Py_ssize_t n) -{ - register Py_ssize_t i; - register Py_ssize_t j; - register Py_ssize_t size; - register PyBytesObject *op; - size_t nbytes; - if (n < 0) - n = 0; - /* watch out for overflows: the size can overflow int, - * and the # of bytes needed can overflow size_t - */ - size = Py_SIZE(a) * n; - if (n && size / n != Py_SIZE(a)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - if (size == Py_SIZE(a) && PyBytes_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - nbytes = (size_t)size; - if (nbytes + sizeof(PyBytesObject) <= nbytes) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - op = (PyBytesObject *) - PyObject_MALLOC(sizeof(PyBytesObject) + nbytes); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyBytes_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - op->ob_sval[size] = '\0'; - if (Py_SIZE(a) == 1 && n > 0) { - memset(op->ob_sval, a->ob_sval[0] , n); - return (PyObject *) op; - } - i = 0; - if (i < size) { - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - i = Py_SIZE(a); - } - while (i < size) { - j = (i <= size-i) ? i : size-i; - Py_MEMCPY(op->ob_sval+i, op->ob_sval, j); - i += j; - } - return (PyObject *) op; -} - -/* String slice a[i:j] consists of characters a[i] ... a[j-1] */ - -static PyObject * -string_slice(register PyBytesObject *a, register Py_ssize_t i, - register Py_ssize_t j) - /* j -- may be negative! */ -{ - if (i < 0) - i = 0; - if (j < 0) - j = 0; /* Avoid signed/unsigned bug in next line */ - if (j > Py_SIZE(a)) - j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyBytes_CheckExact(a)) { - /* It's the same as a */ - Py_INCREF(a); - return (PyObject *)a; - } - if (j < i) - j = i; - return PyBytes_FromStringAndSize(a->ob_sval + i, j-i); -} - -static int -string_contains(PyObject *str_obj, PyObject *sub_obj) -{ - if (!PyBytes_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(sub_obj)) - return PyUnicode_Contains(str_obj, sub_obj); -#endif - if (!PyBytes_Check(sub_obj)) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, " - "not %.200s", Py_TYPE(sub_obj)->tp_name); - return -1; - } - } - - return stringlib_contains_obj(str_obj, sub_obj); -} - -static PyObject * -string_item(PyBytesObject *a, register Py_ssize_t i) -{ - char pchar; - PyObject *v; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - pchar = a->ob_sval[i]; - v = (PyObject *)characters[pchar & UCHAR_MAX]; - if (v == NULL) - v = PyBytes_FromStringAndSize(&pchar, 1); - else { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(v); - } - return v; -} - -static PyObject* -string_richcompare(PyBytesObject *a, PyBytesObject *b, int op) -{ - int c; - Py_ssize_t len_a, len_b; - Py_ssize_t min_len; - PyObject *result; - - /* Make sure both arguments are strings. */ - if (!(PyBytes_Check(a) && PyBytes_Check(b))) { - result = Py_NotImplemented; - goto out; - } - if (a == b) { - switch (op) { - case Py_EQ:case Py_LE:case Py_GE: - result = Py_True; - goto out; - case Py_NE:case Py_LT:case Py_GT: - result = Py_False; - goto out; - } - } - if (op == Py_EQ) { - /* Supporting Py_NE here as well does not save - much time, since Py_NE is rarely used. */ - if (Py_SIZE(a) == Py_SIZE(b) - && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0)) { - result = Py_True; - } else { - result = Py_False; - } - goto out; - } - len_a = Py_SIZE(a); len_b = Py_SIZE(b); - min_len = (len_a < len_b) ? len_a : len_b; - if (min_len > 0) { - c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); - if (c==0) - c = memcmp(a->ob_sval, b->ob_sval, min_len); - } else - c = 0; - if (c == 0) - c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: assert(0); break; /* unreachable */ - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - out: - Py_INCREF(result); - return result; -} - -int -_PyBytes_Eq(PyObject *o1, PyObject *o2) -{ - PyBytesObject *a = (PyBytesObject*) o1; - PyBytesObject *b = (PyBytesObject*) o2; - return Py_SIZE(a) == Py_SIZE(b) - && *a->ob_sval == *b->ob_sval - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; -} - -static long -string_hash(PyBytesObject *a) -{ - register Py_ssize_t len; - register unsigned char *p; - register long x; - - if (a->ob_shash != -1) - return a->ob_shash; - len = Py_SIZE(a); - p = (unsigned char *) a->ob_sval; - x = *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= Py_SIZE(a); - if (x == -1) - x = -2; - a->ob_shash = x; - return x; -} - -static PyObject* -string_subscript(PyBytesObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyBytes_GET_SIZE(self); - return string_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - char* source_buf; - char* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyBytes_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyBytes_FromStringAndSize("", 0); - } - else if (start == 0 && step == 1 && - slicelength == PyBytes_GET_SIZE(self) && - PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else if (step == 1) { - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self) + start, - slicelength); - } - else { - source_buf = PyBytes_AsString((PyObject*)self); - result_buf = (char *)PyMem_Malloc(slicelength); - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyBytes_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "string indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static Py_ssize_t -string_buffer_getreadbuf(PyBytesObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = (void *)self->ob_sval; - return Py_SIZE(self); -} - -static Py_ssize_t -string_buffer_getwritebuf(PyBytesObject *self, Py_ssize_t index, const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "Cannot use string as modifiable buffer"); - return -1; -} - -static Py_ssize_t -string_buffer_getsegcount(PyBytesObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -string_buffer_getcharbuf(PyBytesObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = self->ob_sval; - return Py_SIZE(self); -} - -static int -string_buffer_getbuffer(PyBytesObject *self, Py_buffer *view, int flags) -{ - return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self), - 0, flags); -} - -static PySequenceMethods string_as_sequence = { - (lenfunc)string_length, /*sq_length*/ - (binaryfunc)string_concat, /*sq_concat*/ - (ssizeargfunc)string_repeat, /*sq_repeat*/ - (ssizeargfunc)string_item, /*sq_item*/ - (ssizessizeargfunc)string_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - (objobjproc)string_contains /*sq_contains*/ -}; - -static PyMappingMethods string_as_mapping = { - (lenfunc)string_length, - (binaryfunc)string_subscript, - 0, -}; - -static PyBufferProcs string_as_buffer = { - (readbufferproc)string_buffer_getreadbuf, - (writebufferproc)string_buffer_getwritebuf, - (segcountproc)string_buffer_getsegcount, - (charbufferproc)string_buffer_getcharbuf, - (getbufferproc)string_buffer_getbuffer, - 0, /* XXX */ -}; - - - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - - -/* Don't call if length < 2 */ -#define Py_STRING_MATCH(target, offset, pattern, length) \ - (target[offset] == pattern[0] && \ - target[offset+length-1] == pattern[length-1] && \ - !memcmp(target+offset+1, pattern+1, length-2) ) - - -/* Overallocate the initial list to reduce the number of reallocs for small - split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three - resizes, to sizes 4, 8, then 16. Most observed string splits are for human - text (roughly 11 words per line) and field delimited data (usually 1-10 - fields). For large strings the split algorithms are bandwidth limited - so increasing the preallocation likely will not improve things.*/ - -#define MAX_PREALLOC 12 - -/* 5 splits gives 6 elements */ -#define PREALLOC_SIZE(maxsplit) \ - (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) - -#define SPLIT_APPEND(data, left, right) \ - str = PyBytes_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); - -#define SPLIT_ADD(data, left, right) { \ - str = PyBytes_FromStringAndSize((data) + (left), \ - (right) - (left)); \ - if (str == NULL) \ - goto onError; \ - if (count < MAX_PREALLOC) { \ - PyList_SET_ITEM(list, count, str); \ - } else { \ - if (PyList_Append(list, str)) { \ - Py_DECREF(str); \ - goto onError; \ - } \ - else \ - Py_DECREF(str); \ - } \ - count++; } - -/* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SIZE(list) = count - -#define SKIP_SPACE(s, i, len) { while (i=0 && isspace(Py_CHARMASK(s[i]))) i--; } -#define RSKIP_NONSPACE(s, i) { while (i>=0 && !isspace(Py_CHARMASK(s[i]))) i--; } - -Py_LOCAL_INLINE(PyObject *) -split_whitespace(PyBytesObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyBytes_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = 0; - - while (maxsplit-- > 0) { - SKIP_SPACE(s, i, len); - if (i==len) break; - j = i; i++; - SKIP_NONSPACE(s, i, len); - if (j == 0 && i == len && PyBytes_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, j, i); - } - - if (i < len) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to end of string */ - SKIP_SPACE(s, i, len); - if (i != len) - SPLIT_ADD(s, i, len); - } - FIX_PREALLOC_SIZE(list); - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -split_char(PyBytesObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyBytes_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = 0; - while ((j < len) && (maxcount-- > 0)) { - for(; j list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are removed\n\ -from the result."); - -static PyObject * -string_split(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s = PyBytes_AS_STRING(self), *sub; - PyObject *list, *str, *subobj = Py_None; -#ifdef USE_FAST - Py_ssize_t pos; -#endif - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return split_whitespace(self, len, maxsplit); - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - n = PyBytes_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return split_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - -#ifdef USE_FAST - i = j = 0; - while (maxsplit-- > 0) { - pos = fastsearch(s+i, len-i, sub, n, FAST_SEARCH); - if (pos < 0) - break; - j = i+pos; - SPLIT_ADD(s, i, j); - i = j + n; - } -#else - i = j = 0; - while ((j+n <= len) && (maxsplit-- > 0)) { - for (; j+n <= len; j++) { - if (Py_STRING_MATCH(s, j, sub, n)) { - SPLIT_ADD(s, i, j); - i = j = j + n; - break; - } - } - } -#endif - SPLIT_ADD(s, i, len); - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in S, and returns the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, returns S and two empty strings."); - -static PyObject * -string_partition(PyBytesObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyBytes_Check(sep_obj)) { - sep = PyBytes_AS_STRING(sep_obj); - sep_len = PyBytes_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_partition( - (PyObject*) self, - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (tail, sep, head)\n\ -\n\ -Searches for the separator sep in S, starting at the end of S, and returns\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, returns two empty strings and S."); - -static PyObject * -string_rpartition(PyBytesObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyBytes_Check(sep_obj)) { - sep = PyBytes_AS_STRING(sep_obj); - sep_len = PyBytes_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_rpartition( - (PyObject*) self, - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_whitespace(PyBytesObject *self, Py_ssize_t len, Py_ssize_t maxsplit) -{ - const char *s = PyBytes_AS_STRING(self); - Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxsplit)); - - if (list == NULL) - return NULL; - - i = j = len-1; - - while (maxsplit-- > 0) { - RSKIP_SPACE(s, i); - if (i<0) break; - j = i; i--; - RSKIP_NONSPACE(s, i); - if (j == len-1 && i < 0 && PyBytes_CheckExact(self)) { - /* No whitespace in self, so just use it as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - break; - } - SPLIT_ADD(s, i + 1, j + 1); - } - if (i >= 0) { - /* Only occurs when maxsplit was reached */ - /* Skip any remaining whitespace and copy to beginning of string */ - RSKIP_SPACE(s, i); - if (i >= 0) - SPLIT_ADD(s, 0, i + 1); - - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -rsplit_char(PyBytesObject *self, Py_ssize_t len, char ch, Py_ssize_t maxcount) -{ - const char *s = PyBytes_AS_STRING(self); - register Py_ssize_t i, j, count=0; - PyObject *str; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - - if (list == NULL) - return NULL; - - i = j = len - 1; - while ((i >= 0) && (maxcount-- > 0)) { - for (; i >= 0; i--) { - if (s[i] == ch) { - SPLIT_ADD(s, i + 1, j + 1); - j = i = i - 1; - break; - } - } - } - if (i < 0 && count == 0 && PyBytes_CheckExact(self)) { - /* ch not in self, so just use self as list[0] */ - Py_INCREF(self); - PyList_SET_ITEM(list, 0, (PyObject *)self); - count++; - } - else if (j >= -1) { - SPLIT_ADD(s, 0, j + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string, starting at the end of the string and working\n\ -to the front. If maxsplit is given, at most maxsplit splits are\n\ -done. If sep is not specified or is None, any whitespace string\n\ -is a separator."); - -static PyObject * -string_rsplit(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t len = PyBytes_GET_SIZE(self), n, i, j; - Py_ssize_t maxsplit = -1, count=0; - const char *s, *sub; - PyObject *list, *str, *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return rsplit_whitespace(self, len, maxsplit); - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - n = PyBytes_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (n == 1) - return rsplit_char(self, len, sub[0], maxsplit); - - list = PyList_New(PREALLOC_SIZE(maxsplit)); - if (list == NULL) - return NULL; - - j = len; - i = j - n; - - s = PyBytes_AS_STRING(self); - while ( (i >= 0) && (maxsplit-- > 0) ) { - for (; i>=0; i--) { - if (Py_STRING_MATCH(s, i, sub, n)) { - SPLIT_ADD(s, i + n, j); - j = i; - i -= n; - break; - } - } - } - SPLIT_ADD(s, 0, j); - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - -onError: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(join__doc__, -"S.join(sequence) -> string\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -sequence. The separator between elements is S."); - -static PyObject * -string_join(PyBytesObject *self, PyObject *orig) -{ - char *sep = PyBytes_AS_STRING(self); - const Py_ssize_t seplen = PyBytes_GET_SIZE(self); - PyObject *res = NULL; - char *p; - Py_ssize_t seqlen = 0; - size_t sz = 0; - Py_ssize_t i; - PyObject *seq, *item; - - seq = PySequence_Fast(orig, ""); - if (seq == NULL) { - return NULL; - } - - seqlen = PySequence_Size(seq); - if (seqlen == 0) { - Py_DECREF(seq); - return PyBytes_FromString(""); - } - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyBytes_CheckExact(item) || PyUnicode_CheckExact(item)) { - Py_INCREF(item); - Py_DECREF(seq); - return item; - } - } - - /* There are at least two things to join, or else we have a subclass - * of the builtin types in the sequence. - * Do a pre-pass to figure out the total amount of space we'll - * need (sz), see whether any argument is absurd, and defer to - * the Unicode join if appropriate. - */ - for (i = 0; i < seqlen; i++) { - const size_t old_sz = sz; - item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyBytes_Check(item)){ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(item)) { - /* Defer to Unicode join. - * CAUTION: There's no gurantee that the - * original sequence can be iterated over - * again, so we must pass seq here. - */ - PyObject *result; - result = PyUnicode_Join((PyObject *)self, seq); - Py_DECREF(seq); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string," - " %.80s found", - i, Py_TYPE(item)->tp_name); - Py_DECREF(seq); - return NULL; - } - sz += PyBytes_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"); - Py_DECREF(seq); - return NULL; - } - } - - /* Allocate result space. */ - res = PyBytes_FromStringAndSize((char*)NULL, sz); - if (res == NULL) { - Py_DECREF(seq); - return NULL; - } - - /* Catenate everything. */ - p = PyBytes_AS_STRING(res); - for (i = 0; i < seqlen; ++i) { - size_t n; - item = PySequence_Fast_GET_ITEM(seq, i); - n = PyBytes_GET_SIZE(item); - Py_MEMCPY(p, PyBytes_AS_STRING(item), n); - p += n; - if (i < seqlen - 1) { - Py_MEMCPY(p, sep, seplen); - p += seplen; - } - } - - Py_DECREF(seq); - return res; -} - -PyObject * -_PyBytes_Join(PyObject *sep, PyObject *x) -{ - assert(sep != NULL && PyBytes_Check(sep)); - assert(x != NULL); - return string_join((PyBytesObject *)sep, x); -} - -Py_LOCAL_INLINE(void) -string_adjust_indices(Py_ssize_t *start, Py_ssize_t *end, Py_ssize_t len) -{ - if (*end > len) - *end = len; - else if (*end < 0) - *end += len; - if (*end < 0) - *end = 0; - if (*start < 0) - *start += len; - if (*start < 0) - *start = 0; -} - -Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyBytesObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - const char *sub; - Py_ssize_t sub_len; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - PyObject *obj_start=Py_None, *obj_end=Py_None; - - if (!PyArg_ParseTuple(args, "O|OO:find/rfind/index/rindex", &subobj, - &obj_start, &obj_end)) - return -2; - /* To support None in "start" and "end" arguments, meaning - the same as if they were not passed. - */ - if (obj_start != Py_None) - if (!_PyEval_SliceIndex(obj_start, &start)) - return -2; - if (obj_end != Py_None) - if (!_PyEval_SliceIndex(obj_end, &end)) - return -2; - - if (PyBytes_Check(subobj)) { - sub = PyBytes_AS_STRING(subobj); - sub_len = PyBytes_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Find( - (PyObject *)self, subobj, start, end, dir); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) - /* XXX - the "expected a character buffer object" is pretty - confusing for a non-expert. remap to something else ? */ - return -2; - - if (dir > 0) - return stringlib_find_slice( - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), - sub, sub_len, start, end); - else - return stringlib_rfind_slice( - PyBytes_AS_STRING(self), PyBytes_GET_SIZE(self), - sub, sub_len, start, end); -} - - -PyDoc_STRVAR(find__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_find(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(index__doc__, -"S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -string_index(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"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\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_rfind(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -string_rindex(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyBytesObject *self, int striptype, PyObject *sepobj) -{ - char *s = PyBytes_AS_STRING(self); - Py_ssize_t len = PyBytes_GET_SIZE(self); - char *sep = PyBytes_AS_STRING(sepobj); - Py_ssize_t seplen = PyBytes_GET_SIZE(sepobj); - Py_ssize_t i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); - j++; - } - - if (i == 0 && j == len && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyBytes_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_strip(PyBytesObject *self, int striptype) -{ - char *s = PyBytes_AS_STRING(self); - Py_ssize_t len = PyBytes_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyBytes_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyBytesObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyBytes_Check(sep)) - return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep)) { - PyObject *uniself = PyUnicode_FromObject((PyObject *)self); - PyObject *res; - if (uniself==NULL) - return NULL; - res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, - striptype, sep); - Py_DECREF(uniself); - return res; - } -#endif - PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else - "%s arg must be None or str", -#endif - STRIPNAME(striptype)); - return NULL; - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_strip(PyBytesObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_lstrip(PyBytesObject *self, PyObject *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]) -> string or unicode\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.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_rstrip(PyBytesObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -PyDoc_STRVAR(lower__doc__, -"S.lower() -> string\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */ -#ifndef _tolower -#define _tolower tolower -#endif - -static PyObject * -string_lower(PyBytesObject *self) -{ - char *s; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); - PyObject *newobj; - - newobj = PyBytes_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyBytes_AS_STRING(newobj); - - Py_MEMCPY(s, PyBytes_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (isupper(c)) - s[i] = _tolower(c); - } - - return newobj; -} - -PyDoc_STRVAR(upper__doc__, -"S.upper() -> string\n\ -\n\ -Return a copy of the string S converted to uppercase."); - -#ifndef _toupper -#define _toupper toupper -#endif - -static PyObject * -string_upper(PyBytesObject *self) -{ - char *s; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); - PyObject *newobj; - - newobj = PyBytes_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyBytes_AS_STRING(newobj); - - Py_MEMCPY(s, PyBytes_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (islower(c)) - s[i] = _toupper(c); - } - - return newobj; -} - -PyDoc_STRVAR(title__doc__, -"S.title() -> string\n\ -\n\ -Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -static PyObject* -string_title(PyBytesObject *self) -{ - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); - int previous_is_cased = 0; - PyObject *newobj; - - newobj = PyBytes_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyBytes_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - if (!previous_is_cased) - c = toupper(c); - previous_is_cased = 1; - } else if (isupper(c)) { - if (previous_is_cased) - c = tolower(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *s_new++ = c; - } - return newobj; -} - -PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> string\n\ -\n\ -Return a copy of the string S with only its first character\n\ -capitalized."); - -static PyObject * -string_capitalize(PyBytesObject *self) -{ - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); - PyObject *newobj; - - newobj = PyBytes_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyBytes_AsString(newobj); - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) - *s_new = toupper(c); - else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) - *s_new = tolower(c); - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(count__doc__, -"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 interpreted\n\ -as in slice notation."); - -static PyObject * -string_count(PyBytesObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyBytes_AS_STRING(self), *sub; - Py_ssize_t sub_len; - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - - if (!PyArg_ParseTuple(args, "O|O&O&:count", &sub_obj, - _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end)) - return NULL; - - if (PyBytes_Check(sub_obj)) { - sub = PyBytes_AS_STRING(sub_obj); - sub_len = PyBytes_GET_SIZE(sub_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sub_obj)) { - Py_ssize_t count; - count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); - if (count == -1) - return NULL; - else - return PyInt_FromSsize_t(count); - } -#endif - else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) - return NULL; - - string_adjust_indices(&start, &end, PyBytes_GET_SIZE(self)); - - return PyInt_FromSsize_t( - stringlib_count(str + start, end - start, sub, sub_len) - ); -} - -PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> string\n\ -\n\ -Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."); - -static PyObject * -string_swapcase(PyBytesObject *self) -{ - char *s = PyBytes_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyBytes_GET_SIZE(self); - PyObject *newobj; - - newobj = PyBytes_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyBytes_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - *s_new = toupper(c); - } - else if (isupper(c)) { - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(translate__doc__, -"S.translate(table [,deletechars]) -> string\n\ -\n\ -Return a copy of the string S, where all characters occurring\n\ -in the optional argument deletechars are removed, and the\n\ -remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256."); - -static PyObject * -string_translate(PyBytesObject *self, PyObject *args) -{ - register char *input, *output; - const char *table; - register Py_ssize_t i, c, changed = 0; - PyObject *input_obj = (PyObject*)self; - const char *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - PyObject *tableobj, *delobj = NULL; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (PyBytes_Check(tableobj)) { - table = PyBytes_AS_STRING(tableobj); - tablen = PyBytes_GET_SIZE(tableobj); - } - else if (tableobj == Py_None) { - table = NULL; - tablen = 256; - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(tableobj)) { - /* Unicode .translate() does not support the deletechars - parameter; instead a mapping to None will cause characters - to be deleted. */ - if (delobj != NULL) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } - return PyUnicode_Translate((PyObject *)self, tableobj, NULL); - } -#endif - else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) - return NULL; - - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - if (delobj != NULL) { - if (PyBytes_Check(delobj)) { - del_table = PyBytes_AS_STRING(delobj); - dellen = PyBytes_GET_SIZE(delobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(delobj)) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } -#endif - else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) - return NULL; - } - else { - del_table = NULL; - dellen = 0; - } - - inlen = PyBytes_GET_SIZE(input_obj); - result = PyBytes_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyBytes_AsString(result); - input = PyBytes_AS_STRING(input_obj); - - if (dellen == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed || !PyBytes_CheckExact(input_obj)) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed && PyBytes_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - _PyBytes_Resize(&result, output - output_start); - return result; -} - - -#define FORWARD 1 -#define REVERSE -1 - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - -/* String ops must return a string. */ -/* If the object is subclass of string, create a copy */ -Py_LOCAL(PyBytesObject *) -return_self(PyBytesObject *self) -{ - if (PyBytes_CheckExact(self)) { - Py_INCREF(self); - return self; - } - return (PyBytesObject *)PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, int target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - -Py_LOCAL(Py_ssize_t) -findstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings always match at the first attempt */ - if (pattern_len == 0) - return (direction > 0) ? start : end; - - end -= pattern_len; - - if (direction < 0) { - for (; end >= start; end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) - return end; - } else { - for (; start <= end; start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) - return start; - } - return -1; -} - -Py_LOCAL_INLINE(Py_ssize_t) -countstring(const char *target, Py_ssize_t target_len, - const char *pattern, Py_ssize_t pattern_len, - Py_ssize_t start, - Py_ssize_t end, - int direction, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - - if (start < 0) { - start += target_len; - if (start < 0) - start = 0; - } - if (end > target_len) { - end = target_len; - } else if (end < 0) { - end += target_len; - if (end < 0) - end = 0; - } - - /* zero-length substrings match everywhere */ - if (pattern_len == 0 || maxcount == 0) { - if (target_len+1 < maxcount) - return target_len+1; - return maxcount; - } - - end -= pattern_len; - if (direction < 0) { - for (; (end >= start); end--) - if (Py_STRING_MATCH(target, end, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) break; - end -= pattern_len-1; - } - } else { - for (; (start <= end); start++) - if (Py_STRING_MATCH(target, start, pattern, pattern_len)) { - count++; - if (--maxcount <= 0) - break; - start += pattern_len-1; - } - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_interleave(PyBytesObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyBytesObject *result; - - self_len = PyBytes_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyBytes_AS_STRING(self); - result_s = PyBytes_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_delete_single_character(PyBytesObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyBytesObject *result; - - self_len = PyBytes_GET_SIZE(self); - self_s = PyBytes_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyBytes_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyBytesObject *) -replace_delete_substring(PyBytesObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyBytesObject *result; - - self_len = PyBytes_GET_SIZE(self); - self_s = PyBytes_AS_STRING(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, 1, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyBytes_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_single_character_in_place(PyBytesObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyBytesObject *result; - - /* The result string will be the same size */ - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyBytesObject *) PyBytes_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyBytes_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_substring_in_place(PyBytesObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyBytesObject *result; - - /* The result string will be the same size */ - - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); - - offset = findstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD); - if (offset == -1) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyBytesObject *) PyBytes_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyBytes_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_single_character(PyBytesObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyBytesObject *result; - - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyBytes_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyBytesObject *) -replace_substring(PyBytesObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyBytesObject *result; - - self_s = PyBytes_AS_STRING(self); - self_len = PyBytes_GET_SIZE(self); - - count = countstring(self_s, self_len, - from_s, from_len, - 0, self_len, FORWARD, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyBytesObject *) - PyBytes_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyBytes_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = findstring(start, end-start, - from_s, from_len, - 0, end-start, FORWARD); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyBytesObject *) -replace(PyBytesObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyBytes_GET_SIZE(self) == 0) { - /* nothing to do; return the original string */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original string */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' string everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self string to generate a non-empty string */ - /* Special case so the remaining code always gets a non-empty string */ - if (PyBytes_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' string */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both strings have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - -PyDoc_STRVAR(replace__doc__, -"S.replace (old, new[, count]) -> string\n\ -\n\ -Return a copy of string S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -string_replace(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to; - const char *from_s, *to_s; - Py_ssize_t from_len, to_len; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (PyBytes_Check(from)) { - from_s = PyBytes_AS_STRING(from); - from_len = PyBytes_GET_SIZE(from); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(from)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) - return NULL; - - if (PyBytes_Check(to)) { - to_s = PyBytes_AS_STRING(to); - to_len = PyBytes_GET_SIZE(to); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(to)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) - return NULL; - - return (PyObject *)replace((PyBytesObject *) self, - from_s, from_len, - to_s, to_len, count); -} - -/** End DALKE **/ - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_string_tailmatch(PyBytesObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyBytes_GET_SIZE(self); - Py_ssize_t slen; - const char* sub; - const char* str; - - if (PyBytes_Check(substr)) { - sub = PyBytes_AS_STRING(substr); - slen = PyBytes_GET_SIZE(substr); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(substr)) - return PyUnicode_Tailmatch((PyObject *)self, - substr, start, end, direction); -#endif - else if (PyObject_AsCharBuffer(substr, &sub, &slen)) - return -1; - str = PyBytes_AS_STRING(self); - - string_adjust_indices(&start, &end, len); - - if (direction < 0) { - /* startswith */ - if (start+slen > len) - return 0; - } else { - /* endswith */ - if (end-start < slen || start > len) - return 0; - - if (end-slen > start) - start = end - slen; - } - if (end-start >= slen) - return ! memcmp(str+start, sub, slen); - return 0; -} - - -PyDoc_STRVAR(startswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -string_startswith(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:startswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, -1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, -"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\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -string_endswith(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!PyArg_ParseTuple(args, "O|O&O&:endswith", &subobj, - _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++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, +1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[,errors]]) -> object\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeEncodeErrors."); - -static PyObject * -string_encode(PyBytesObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) - return NULL; - v = PyBytes_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyBytes_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(decode__doc__, -"S.decode([encoding[,errors]]) -> object\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registerd with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -string_decode(PyBytesObject *self, PyObject *args) -{ - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) - return NULL; - v = PyBytes_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyBytes_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> string\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."); - -static PyObject* -string_expandtabs(PyBytesObject *self, PyObject *args) -{ - const char *e, *p, *qe; - char *q; - Py_ssize_t i, j, incr; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyBytes_AS_STRING(self) + PyBytes_GET_SIZE(self); /* end of input */ - for (p = PyBytes_AS_STRING(self); p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = PyBytes_FromStringAndSize(NULL, i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = PyBytes_AS_STRING(u); /* next output char */ - qe = PyBytes_AS_STRING(u) + PyBytes_GET_SIZE(u); /* end of output */ - - for (p = PyBytes_AS_STRING(self); 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; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - - return u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyBytesObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - - u = PyBytes_FromStringAndSize(NULL, - left + PyBytes_GET_SIZE(self) + right); - if (u) { - if (left) - memset(PyBytes_AS_STRING(u), fill, left); - Py_MEMCPY(PyBytes_AS_STRING(u) + left, - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self)); - if (right) - memset(PyBytes_AS_STRING(u) + left + PyBytes_GET_SIZE(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> string\n" -"\n" -"Return S left justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -string_ljust(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, 0, width - PyBytes_GET_SIZE(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> string\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)"); - -static PyObject * -string_rjust(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, width - PyBytes_GET_SIZE(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> string\n" -"\n" -"Return S centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_center(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (PyBytes_GET_SIZE(self) >= width && PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - PyBytes_GET_SIZE(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> string\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."); - -static PyObject * -string_zfill(PyBytesObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (PyBytes_GET_SIZE(self) >= width) { - if (PyBytes_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self), - PyBytes_GET_SIZE(self) - ); - } - - fill = width - PyBytes_GET_SIZE(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = PyBytes_AS_STRING(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} - -PyDoc_STRVAR(isspace__doc__, -"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."); - -static PyObject* -string_isspace(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && - isspace(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - for (; p < e; p++) { - if (!isspace(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalpha__doc__, -"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."); - -static PyObject* -string_isalpha(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && - isalpha(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - for (; p < e; p++) { - if (!isalpha(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalnum__doc__, -"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."); - -static PyObject* -string_isalnum(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && - isalnum(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - for (; p < e; p++) { - if (!isalnum(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isdigit__doc__, -"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."); - -static PyObject* -string_isdigit(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1 && - isdigit(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - for (; p < e; p++) { - if (!isdigit(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(islower__doc__, -"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."); - -static PyObject* -string_islower(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) - return PyBool_FromLong(islower(*p) != 0); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (isupper(*p)) - return PyBool_FromLong(0); - else if (!cased && islower(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(isupper__doc__, -"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."); - -static PyObject* -string_isupper(PyBytesObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (islower(*p)) - return PyBool_FromLong(0); - else if (!cased && isupper(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(istitle__doc__, -"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. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -static PyObject* -string_istitle(PyBytesObject *self, PyObject *uncased) -{ - register const unsigned char *p - = (unsigned char *) PyBytes_AS_STRING(self); - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyBytes_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyBytes_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyBytes_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (isupper(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (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(splitlines__doc__, -"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\ -is given and true."); - -static PyObject* -string_splitlines(PyBytesObject *self, PyObject *args) -{ - register Py_ssize_t i; - register Py_ssize_t j; - Py_ssize_t len; - int keepends = 0; - PyObject *list; - PyObject *str; - char *data; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - data = PyBytes_AS_STRING(self); - len = PyBytes_GET_SIZE(self); - - /* This does not use the preallocated list because splitlines is - usually run with hundreds of newlines. The overhead of - switching between PyList_SET_ITEM and append causes about a - 2-3% slowdown for that common case. A smarter implementation - could move the if check out, so the SET_ITEMs are done first - and the appends only done when the prealloc buffer is full. - That's too much work for little gain.*/ - - list = PyList_New(0); - if (!list) - goto onError; - - for (i = j = 0; i < len; ) { - Py_ssize_t eol; - - /* Find a line and append it */ - while (i < len && data[i] != '\n' && data[i] != '\r') - 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); - } - - return list; - - onError: - Py_XDECREF(list); - return NULL; -} - -PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in memory, in bytes"); - -static PyObject * -string_sizeof(PyBytesObject *v) -{ - Py_ssize_t res; - res = sizeof(PyBytesObject) + v->ob_size * v->ob_type->tp_itemsize; - return PyInt_FromSsize_t(res); -} - -#undef SPLIT_APPEND -#undef SPLIT_ADD -#undef MAX_PREALLOC -#undef PREALLOC_SIZE - -static PyObject * -string_getnewargs(PyBytesObject *v) -{ - return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); -} - - -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> unicode\n\ -\n\ -"); - -static PyObject * -string__format__(PyObject* self, PyObject* args) -{ - PyObject *format_spec; - PyObject *result = NULL; - PyObject *tmp = NULL; - - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyBytes_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = PyObject_Str(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; - - result = _PyBytes_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); -done: - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> unicode\n\ -\n\ -"); - - -static PyMethodDef -string_methods[] = { - /* Counterparts of the obsolete stropmodule functions; except - string.maketrans(). */ - {"join", (PyCFunction)string_join, METH_O, join__doc__}, - {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, - {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, - {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, - {"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__}, - {"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__}, - {"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__}, - {"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__}, - {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, - {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, - capitalize__doc__}, - {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, - {"endswith", (PyCFunction)string_endswith, METH_VARARGS, - endswith__doc__}, - {"partition", (PyCFunction)string_partition, METH_O, partition__doc__}, - {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, - {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, - {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, - {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, - {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, - {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction)string_rpartition, METH_O, - rpartition__doc__}, - {"startswith", (PyCFunction)string_startswith, METH_VARARGS, - startswith__doc__}, - {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, - swapcase__doc__}, - {"translate", (PyCFunction)string_translate, METH_VARARGS, - translate__doc__}, - {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, - {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, - {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, - {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, - {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) string__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"encode", (PyCFunction)string_encode, METH_VARARGS, encode__doc__}, - {"decode", (PyCFunction)string_decode, METH_VARARGS, decode__doc__}, - {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, - splitlines__doc__}, - {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, - sizeof__doc__}, - {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"object", 0}; - - if (type != &PyBytes_Type) - return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) - return NULL; - if (x == NULL) - return PyBytes_FromString(""); - return PyObject_Str(x); -} - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyBytes_Type)); - tmp = string_new(&PyBytes_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyBytes_CheckExact(tmp)); - n = PyBytes_GET_SIZE(tmp); - pnew = type->tp_alloc(type, n); - if (pnew != NULL) { - Py_MEMCPY(PyBytes_AS_STRING(pnew), PyBytes_AS_STRING(tmp), n+1); - ((PyBytesObject *)pnew)->ob_shash = - ((PyBytesObject *)tmp)->ob_shash; - ((PyBytesObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; - } - Py_DECREF(tmp); - return pnew; -} - -static PyObject * -basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, - "The basestring type cannot be instantiated"); - return NULL; -} - -static PyObject * -string_mod(PyObject *v, PyObject *w) -{ - if (!PyBytes_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyBytes_Format(v, w); -} - -PyDoc_STRVAR(basestring_doc, -"Type basestring cannot be instantiated; it is the base for str and unicode."); - -static PyNumberMethods string_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - string_mod, /*nb_remainder*/ -}; - - -PyTypeObject PyBaseString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "basestring", - 0, - 0, - 0, /* 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 | Py_TPFLAGS_BASETYPE, /* tp_flags */ - basestring_doc, /* 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 */ - 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 */ - basestring_new, /* tp_new */ - 0, /* tp_free */ -}; - -PyDoc_STRVAR(string_doc, -"str(object) -> string\n\ -\n\ -Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."); - -PyTypeObject PyBytes_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", - sizeof(PyBytesObject), - sizeof(char), - string_dealloc, /* tp_dealloc */ - (printfunc)string_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - string_repr, /* tp_repr */ - &string_as_number, /* tp_as_number */ - &string_as_sequence, /* tp_as_sequence */ - &string_as_mapping, /* tp_as_mapping */ - (hashfunc)string_hash, /* tp_hash */ - 0, /* tp_call */ - string_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - string_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)string_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - string_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - string_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -void -PyBytes_Concat(register PyObject **pv, register PyObject *w) -{ - register PyObject *v; - if (*pv == NULL) - return; - if (w == NULL || !PyBytes_Check(*pv)) { - Py_DECREF(*pv); - *pv = NULL; - return; - } - v = string_concat((PyBytesObject *) *pv, w); - Py_DECREF(*pv); - *pv = v; -} - -void -PyBytes_ConcatAndDel(register PyObject **pv, register PyObject *w) -{ - PyBytes_Concat(pv, w); - Py_XDECREF(w); -} - - -/* The following function breaks the notion that strings are immutable: - it changes the size of a string. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new string object and destroying the old one, only - more efficiently. In any case, don't use this if the string may - already be known to some other part of the code... - Note that if there's not enough memory to resize the string, the original - string object at *pv is deallocated, *pv is set to NULL, an "out of - memory" exception is set, and -1 is returned. Else (on success) 0 is - returned, and the value in *pv may or may not be the same as on input. - As always, an extra byte is allocated for a trailing \0 byte (newsize - does *not* include that), and a trailing \0 byte is stored. -*/ - -int -_PyBytes_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyObject *v; - register PyBytesObject *sv; - v = *pv; - if (!PyBytes_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyBytes_CHECK_INTERNED(v)) { - *pv = 0; - Py_DECREF(v); - PyErr_BadInternalCall(); - return -1; - } - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference(v); - *pv = (PyObject *) - PyObject_REALLOC((char *)v, sizeof(PyBytesObject) + newsize); - if (*pv == NULL) { - PyObject_Del(v); - PyErr_NoMemory(); - return -1; - } - _Py_NewReference(*pv); - sv = (PyBytesObject *) *pv; - Py_SIZE(sv) = newsize; - sv->ob_sval[newsize] = '\0'; - sv->ob_shash = -1; /* invalidate cached hash value */ - return 0; -} - -/* Helpers for formatstring */ - -Py_LOCAL_INLINE(PyObject *) -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -Py_LOCAL_INLINE(int) -formatfloat(char *buf, 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)*/ - char fmt[20]; - double x; - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "float argument required, " - "not %.200s", Py_TYPE(v)->tp_name); - return -1; - } - if (prec < 0) - prec = 6; - if (type == 'f' && fabs(x)/1e25 >= 1e25) - 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 - - 'f' formats: - 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; - } - PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c", - (flags&F_ALT) ? "#" : "", - prec, type); - PyOS_ascii_formatd(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -/* _PyBytes_FormatLong emulates the format codes d, u, o, x and X, and - * the F_ALT flag, for Python's long (unbounded) ints. It's not used for - * Python's regular ints. - * Return value: a new PyString*, or NULL if error. - * . *pbuf is set to point into it, - * *plen set to the # of chars following that. - * Caller must decref it when done using pbuf. - * The string starting at *pbuf is of the form - * "-"? ("0x" | "0X")? digit+ - * "0x"/"0X" are present only for x and X conversions, with F_ALT - * set in flags. The case of hex digits will be correct, - * There will be at least prec digits, zero-filled on the left if - * necessary to get that many. - * val object to be converted - * flags bitmask of format flags; only F_ALT is looked at - * prec minimum number of digits; 0-fill on left if needed - * type a character in [duoxX]; u acts the same as d - * - * CAUTION: o, x and X conversions on regular ints can never - * produce a '-' sign, but can for Python's unbounded ints. - */ -PyObject* -_PyBytes_FormatLong(PyObject *val, int flags, int prec, int type, - char **pbuf, int *plen) -{ - PyObject *result = NULL; - char *buf; - Py_ssize_t i; - int sign; /* 1 if '-', else 0 */ - int len; /* number of characters */ - Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; - - switch (type) { - case 'd': - case 'u': - result = Py_TYPE(val)->tp_str(val); - break; - case 'o': - result = Py_TYPE(val)->tp_as_number->nb_oct(val); - break; - case 'x': - case 'X': - numnondigits = 2; - result = Py_TYPE(val)->tp_as_number->nb_hex(val); - break; - default: - assert(!"'type' not in [duoxX]"); - } - if (!result) - return NULL; - - buf = PyBytes_AsString(result); - if (!buf) { - Py_DECREF(result); - return NULL; - } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyBytes_Size(result); - if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyBytes_FormatLong"); - return NULL; - } - len = (int)llen; - if (buf[len-1] == 'L') { - --len; - buf[len] = '\0'; - } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); - skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); - } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyBytes_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); - return NULL; - } - b1 = PyBytes_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; - for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyBytes_AS_STRING(result); - len = numnondigits + prec; - } - - /* Fix up case for hex conversions. */ - if (type == 'X') { - /* Need to convert all lower case letters to upper case. - and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') - buf[i] -= 'a'-'A'; - } - *pbuf = buf; - *plen = len; - return result; -} - -Py_LOCAL_INLINE(int) -formatint(char *buf, 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) - + 1 + 1 = 24 */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", - Py_TYPE(v)->tp_name); - return -1; - } - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - 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 - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in unicodeobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - if (sign[0]) - PyOS_snprintf(buf, buflen, fmt, -x); - else - PyOS_snprintf(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -Py_LOCAL_INLINE(int) -formatchar(char *buf, size_t buflen, PyObject *v) -{ - /* presume that the buffer is at least 2 characters long */ - if (PyBytes_Check(v)) { - if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) - return -1; - } - else { - if (!PyArg_Parse(v, "b;%c requires int or char", &buf[0])) - return -1; - } - buf[1] = '\0'; - return 1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the floats, ints, & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject * -PyBytes_Format(PyObject *format, PyObject *args) -{ - char *fmt, *res; - Py_ssize_t arglen, argidx; - Py_ssize_t reslen, rescnt, fmtcnt; - int args_owned = 0; - PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE - PyObject *v, *w; -#endif - PyObject *dict = NULL; - if (format == NULL || !PyBytes_Check(format) || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - orig_args = args; - fmt = PyBytes_AS_STRING(format); - fmtcnt = PyBytes_GET_SIZE(format); - reslen = rescnt = fmtcnt + 100; - result = PyBytes_FromStringAndSize((char *)NULL, reslen); - if (result == NULL) - return NULL; - res = PyBytes_AsString(result); - if (PyTuple_Check(args)) { - arglen = PyTuple_GET_SIZE(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && - !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyBytes_Resize(&result, reslen) < 0) - return NULL; - res = PyBytes_AS_STRING(result) - + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - int c = '\0'; - int fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; - int sign; - Py_ssize_t len; - char formatbuf[FORMATBUFLEN]; - /* For format{float,int,char}() */ -#ifdef Py_USING_UNICODE - char *fmt_start = fmt; - Py_ssize_t argidx_start = argidx; -#endif - - fmt++; - if (*fmt == '(') { - char *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto error; - } - ++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 error; - } - key = PyBytes_FromStringAndSize(keystart, - keylen); - if (key == NULL) - goto error; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto error; - } - width = PyInt_AsLong(v); - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - width = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((width*10) / 10 != width) { - PyErr_SetString( - PyExc_ValueError, - "width too big"); - goto error; - } - 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 error; - if (!PyInt_Check(v)) { - PyErr_SetString( - PyExc_TypeError, - "* wants int"); - goto error; - } - prec = PyInt_AsLong(v); - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if ((prec*10) / 10 != prec) { - PyErr_SetString( - PyExc_ValueError, - "prec too big"); - goto error; - } - 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 error; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - } - sign = 0; - fill = ' '; - switch (c) { - case '%': - pbuf = "%"; - len = 1; - break; - case 's': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE - if (temp != NULL && PyUnicode_Check(temp)) { - Py_DECREF(temp); - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - /* Fall through */ - case 'r': - if (c == 'r') - temp = PyObject_Repr(v); - if (temp == NULL) - goto error; - if (!PyBytes_Check(temp)) { - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - Py_DECREF(temp); - goto error; - } - pbuf = PyBytes_AS_STRING(temp); - len = PyBytes_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 (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, - sizeof(formatbuf), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto error; - sign = 1; - } - else if (PyLong_Check(iobj)) { - int ilen; - - isnumok = 1; - temp = _PyBytes_FormatLong(iobj, flags, - prec, c, &pbuf, &ilen); - Py_DECREF(iobj); - len = ilen; - if (!temp) - goto error; - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", c, Py_TYPE(v)->tp_name); - goto error; - } - 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), - flags, prec, c, v); - if (len < 0) - goto error; - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - case 'c': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf), v); - if (len < 0) - goto error; - break; - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - c, c, - (Py_ssize_t)(fmt - 1 - - PyBytes_AsString(format))); - goto error; - } - 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_DECREF(result); - Py_XDECREF(temp); - return PyErr_NoMemory(); - } - if (_PyBytes_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - return NULL; - } - res = PyBytes_AS_STRING(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - 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')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_MEMCPY(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 error; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto error; - } - if (args_owned) { - Py_DECREF(args); - } - _PyBytes_Resize(&result, reslen - rescnt); - return result; - -#ifdef Py_USING_UNICODE - unicode: - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - /* Fiddle args right (remove the first argidx arguments) */ - if (PyTuple_Check(orig_args) && argidx > 0) { - PyObject *v; - Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx; - v = PyTuple_New(n); - if (v == NULL) - goto error; - while (--n >= 0) { - PyObject *w = PyTuple_GET_ITEM(orig_args, n + argidx); - Py_INCREF(w); - PyTuple_SET_ITEM(v, n, w); - } - args = v; - } else { - Py_INCREF(orig_args); - args = orig_args; - } - args_owned = 1; - /* Take what we have of the result and let the Unicode formatting - function format the rest of the input. */ - rescnt = res - PyBytes_AS_STRING(result); - if (_PyBytes_Resize(&result, rescnt)) - goto error; - fmtcnt = PyBytes_GET_SIZE(format) - \ - (fmt - PyBytes_AS_STRING(format)); - format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); - if (format == NULL) - goto error; - v = PyUnicode_Format(format, args); - Py_DECREF(format); - if (v == NULL) - goto error; - /* Paste what we have (result) to what the Unicode formatting - function returned (v) and return the result (or error) */ - w = PyUnicode_Concat(result, v); - Py_DECREF(result); - Py_DECREF(v); - Py_DECREF(args); - return w; -#endif /* Py_USING_UNICODE */ - - error: - Py_DECREF(result); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -void -PyString_InternInPlace(PyObject **p) -{ - register PyBytesObject *s = (PyBytesObject *)(*p); - PyObject *t; - if (s == NULL || !PyBytes_Check(s)) - Py_FatalError("PyString_InternInPlace: strings only please!"); - /* If it's a string subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyBytes_CheckExact(s)) - return; - if (PyBytes_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - t = PyDict_GetItem(interned, (PyObject *)s); - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - return; - } - /* The two references in interned are not counted by refcnt. - The string deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyBytes_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; -} - -void -PyString_InternImmortal(PyObject **p) -{ - PyString_InternInPlace(p); - if (PyBytes_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyBytes_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } -} - - -PyObject * -PyString_InternFromString(const char *cp) -{ - PyObject *s = PyBytes_FromString(cp); - if (s == NULL) - return NULL; - PyString_InternInPlace(&s); - return s; -} - -void -PyString_Fini(void) -{ - int i; - for (i = 0; i < UCHAR_MAX + 1; i++) { - Py_XDECREF(characters[i]); - characters[i] = NULL; - } - Py_XDECREF(nullstring); - nullstring = NULL; -} - -void _Py_ReleaseInternedStrings(void) -{ - PyObject *keys; - PyBytesObject *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_ReleaseInternedStrings() is intended to help a leak - detector, interned 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 = (PyBytesObject *) PyList_GET_ITEM(keys, i); - switch (s->ob_sstate) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += Py_SIZE(s); - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += Py_SIZE(s); - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->ob_sstate = 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; -} Modified: python/branches/tlee-ast-optimize/Objects/fileobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/fileobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/fileobject.c Fri Jun 13 16:43:12 2008 @@ -453,7 +453,7 @@ PyObject *str, *oerrors; assert(PyFile_Check(f)); - str = PyBytes_FromString(enc); + str = PyString_FromString(enc); if (!str) return 0; if (errors) { @@ -2321,9 +2321,9 @@ #ifdef Py_USING_UNICODE if ((flags & Py_PRINT_RAW) && PyUnicode_Check(v) && enc != Py_None) { - char *cenc = PyBytes_AS_STRING(enc); + char *cenc = PyString_AS_STRING(enc); char *errors = fobj->f_errors == Py_None ? - "strict" : PyBytes_AS_STRING(fobj->f_errors); + "strict" : PyString_AS_STRING(fobj->f_errors); value = PyUnicode_AsEncodedString(v, cenc, errors); if (value == NULL) return -1; Modified: python/branches/tlee-ast-optimize/Objects/listobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/listobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/listobject.c Fri Jun 13 16:43:12 2008 @@ -45,7 +45,16 @@ * system realloc(). * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... */ - new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6) + newsize; + new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6); + + /* check for integer overflow */ + if (new_allocated > PY_SIZE_MAX - newsize) { + PyErr_NoMemory(); + return -1; + } else { + new_allocated += newsize; + } + if (newsize == 0) new_allocated = 0; items = self->ob_item; @@ -118,8 +127,9 @@ return NULL; } nbytes = size * sizeof(PyObject *); - /* Check for overflow */ - if (nbytes / sizeof(PyObject *) != (size_t)size) + /* Check for overflow without an actual overflow, + * which can cause compiler to optimise out */ + if (size > PY_SIZE_MAX / sizeof(PyObject *)) return PyErr_NoMemory(); if (numfree) { numfree--; @@ -1407,6 +1417,10 @@ * we don't care what's in the block. */ merge_freemem(ms); + if (need > PY_SSIZE_T_MAX / sizeof(PyObject*)) { + PyErr_NoMemory(); + return -1; + } ms->a = (PyObject **)PyMem_Malloc(need * sizeof(PyObject*)); if (ms->a) { ms->alloced = need; @@ -2589,6 +2603,8 @@ step = -step; } + assert(slicelength <= PY_SIZE_MAX / sizeof(PyObject*)); + garbage = (PyObject**) PyMem_MALLOC(slicelength*sizeof(PyObject*)); if (!garbage) { Modified: python/branches/tlee-ast-optimize/Objects/obmalloc.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/obmalloc.c (original) +++ python/branches/tlee-ast-optimize/Objects/obmalloc.c Fri Jun 13 16:43:12 2008 @@ -526,9 +526,9 @@ numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; if (numarenas <= maxarenas) return NULL; /* overflow */ - nbytes = numarenas * sizeof(*arenas); - if (nbytes / sizeof(*arenas) != numarenas) + if (numarenas > PY_SIZE_MAX / sizeof(*arenas)) return NULL; /* overflow */ + nbytes = numarenas * sizeof(*arenas); arenaobj = (struct arena_object *)realloc(arenas, nbytes); if (arenaobj == NULL) return NULL; Modified: python/branches/tlee-ast-optimize/Objects/setobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/setobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/setobject.c Fri Jun 13 16:43:12 2008 @@ -1312,6 +1312,9 @@ Py_ssize_t i; PyObject *result = (PyObject *)so; + if (PyTuple_GET_SIZE(args) == 0) + return set_copy(so); + Py_INCREF(so); for (i=0 ; i + RelativePath="..\..\Objects\stringobject.c"> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj Fri Jun 13 16:43:12 2008 @@ -1379,7 +1379,7 @@ > PY_SIZE_MAX / sizeof(node)) { + return E_NOMEM; + } n = n1->n_child; n = (node *) PyObject_REALLOC(n, required_capacity * sizeof(node)); Modified: python/branches/tlee-ast-optimize/Python/asdl.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/asdl.c (original) +++ python/branches/tlee-ast-optimize/Python/asdl.c Fri Jun 13 16:43:12 2008 @@ -5,8 +5,22 @@ asdl_seq_new(int size, PyArena *arena) { asdl_seq *seq = NULL; - size_t n = sizeof(asdl_seq) + - (size ? (sizeof(void *) * (size - 1)) : 0); + size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); + + /* check size is sane */ + if (size < 0 || size == INT_MIN || + (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + PyErr_NoMemory(); + return NULL; + } + + /* check if size can be added safely */ + if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + PyErr_NoMemory(); + return NULL; + } + + n += sizeof(asdl_seq); seq = (asdl_seq *)PyArena_Malloc(arena, n); if (!seq) { @@ -22,8 +36,22 @@ asdl_int_seq_new(int size, PyArena *arena) { asdl_int_seq *seq = NULL; - size_t n = sizeof(asdl_seq) + - (size ? (sizeof(int) * (size - 1)) : 0); + size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); + + /* check size is sane */ + if (size < 0 || size == INT_MIN || + (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + PyErr_NoMemory(); + return NULL; + } + + /* check if size can be added safely */ + if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + PyErr_NoMemory(); + return NULL; + } + + n += sizeof(asdl_seq); seq = (asdl_int_seq *)PyArena_Malloc(arena, n); if (!seq) { Modified: python/branches/tlee-ast-optimize/Python/ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ast.c (original) +++ python/branches/tlee-ast-optimize/Python/ast.c Fri Jun 13 16:43:12 2008 @@ -3200,6 +3200,9 @@ buf = (char *)s; u = NULL; } else { + /* check for integer overflow */ + if (len > PY_SIZE_MAX / 4) + return NULL; /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ u = PyString_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) Modified: python/branches/tlee-ast-optimize/Python/bltinmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/bltinmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/bltinmodule.c Fri Jun 13 16:43:12 2008 @@ -2835,11 +2835,43 @@ PyString_AS_STRING(item)[0]; } else { /* do we need more space? */ - Py_ssize_t need = j + reslen + len-i-1; + Py_ssize_t need = j; + + /* calculate space requirements while checking for overflow */ + if (need > PY_SSIZE_T_MAX - reslen) { + Py_DECREF(item); + goto Fail_1; + } + + need += reslen; + + if (need > PY_SSIZE_T_MAX - len) { + Py_DECREF(item); + goto Fail_1; + } + + need += len; + + if (need <= i) { + Py_DECREF(item); + goto Fail_1; + } + + need = need - i - 1; + + assert(need >= 0); + assert(outlen >= 0); + if (need > outlen) { /* overallocate, to avoid reallocations */ - if (need<2*outlen) + if (outlen > PY_SSIZE_T_MAX / 2) { + Py_DECREF(item); + return NULL; + } + + if (need<2*outlen) { need = 2*outlen; + } if (_PyString_Resize(&result, need)) { Py_DECREF(item); return NULL; @@ -2931,11 +2963,31 @@ else { /* do we need more space? */ Py_ssize_t need = j + reslen + len - i - 1; + + /* check that didnt overflow */ + if ((j > PY_SSIZE_T_MAX - reslen) || + ((j + reslen) > PY_SSIZE_T_MAX - len) || + ((j + reslen + len) < i) || + ((j + reslen + len - i) <= 0)) { + Py_DECREF(item); + return NULL; + } + + assert(need >= 0); + assert(outlen >= 0); + if (need > outlen) { /* overallocate, to avoid reallocations */ - if (need < 2 * outlen) - need = 2 * outlen; + if (need < 2 * outlen) { + if (outlen > PY_SSIZE_T_MAX / 2) { + Py_DECREF(item); + return NULL; + } else { + need = 2 * outlen; + } + } + if (PyUnicode_Resize( &result, need) < 0) { Py_DECREF(item); Modified: python/branches/tlee-ast-optimize/Python/compile.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/compile.c (original) +++ python/branches/tlee-ast-optimize/Python/compile.c Fri Jun 13 16:43:12 2008 @@ -217,6 +217,10 @@ return ident; /* Don't mangle if class is just underscores */ } plen = strlen(p); + + assert(1 <= PY_SSIZE_T_MAX - nlen); + assert(1 + nlen <= PY_SSIZE_T_MAX - plen); + ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident) return 0; @@ -667,6 +671,12 @@ size_t oldsize, newsize; oldsize = b->b_ialloc * sizeof(struct instr); newsize = oldsize << 1; + + if (oldsize > (PY_SIZE_MAX >> 1)) { + PyErr_NoMemory(); + return -1; + } + if (newsize == 0) { PyErr_NoMemory(); return -1; @@ -3527,6 +3537,10 @@ a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; + if (nblocks > PY_SIZE_MAX / sizeof(basicblock *)) { + PyErr_NoMemory(); + return 0; + } a->a_postorder = (basicblock **)PyObject_Malloc( sizeof(basicblock *) * nblocks); if (!a->a_postorder) { @@ -3638,10 +3652,14 @@ nbytes = a->a_lnotab_off + 2 * ncodes; len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { - if (len * 2 < nbytes) + if ((len <= INT_MAX / 2) && (len * 2 < nbytes)) len = nbytes; - else + else if (len <= INT_MAX / 2) len *= 2; + else { + PyErr_NoMemory(); + return 0; + } if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } @@ -3660,10 +3678,14 @@ nbytes = a->a_lnotab_off + 2 * ncodes; len = PyString_GET_SIZE(a->a_lnotab); if (nbytes >= len) { - if (len * 2 < nbytes) + if ((len <= INT_MAX / 2) && len * 2 < nbytes) len = nbytes; - else + else if (len <= INT_MAX / 2) len *= 2; + else { + PyErr_NoMemory(); + return 0; + } if (_PyString_Resize(&a->a_lnotab, len) < 0) return 0; } @@ -3722,6 +3744,8 @@ if (i->i_lineno && !assemble_lnotab(a, i)) return 0; if (a->a_offset + size >= len) { + if (len > PY_SSIZE_T_MAX / 2) + return 0; if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) return 0; } Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Fri Jun 13 16:43:12 2008 @@ -1236,6 +1236,58 @@ # Thomas Heller's _ctypes module self.detect_ctypes(inc_dirs, lib_dirs) + # Richard Oudkerk's multiprocessing module + if platform == 'win32': # Windows + macros = dict() + libraries = ['ws2_32'] + + elif platform == 'darwin': # Mac OSX + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + HAVE_BROKEN_SEM_GETVALUE=1 + ) + libraries = [] + + elif platform == 'cygwin': # Cygwin + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=1, + HAVE_FD_TRANSFER=0, + HAVE_BROKEN_SEM_UNLINK=1 + ) + libraries = [] + else: # Linux and other unices + macros = dict( + HAVE_SEM_OPEN=1, + HAVE_SEM_TIMEDWAIT=1, + HAVE_FD_TRANSFER=1 + ) + libraries = ['rt'] + + if platform == 'win32': + multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', + '_multiprocessing/semaphore.c', + '_multiprocessing/pipe_connection.c', + '_multiprocessing/socket_connection.c', + '_multiprocessing/win32_functions.c' + ] + + else: + multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', + '_multiprocessing/socket_connection.c' + ] + + if macros.get('HAVE_SEM_OPEN', False): + multiprocessing_srcs.append('_multiprocessing/semaphore.c') + + exts.append ( Extension('_multiprocessing', multiprocessing_srcs, + define_macros=macros.items(), + include_dirs=["Modules/_multiprocessing"])) + # End multiprocessing + + # Platform-specific libraries if platform == 'linux2': # Linux-specific modules From python-checkins at python.org Fri Jun 13 17:11:50 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 17:11:50 +0200 (CEST) Subject: [Python-checkins] r64233 - in python/trunk: Lib/platform.py Misc/ACKS Misc/NEWS Message-ID: <20080613151150.72A531E400E@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 17:11:50 2008 New Revision: 64233 Log: platform.uname now tries to fill empty values even when os.uname is present Modified: python/trunk/Lib/platform.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Lib/platform.py ============================================================================== --- python/trunk/Lib/platform.py (original) +++ python/trunk/Lib/platform.py Fri Jun 13 17:11:50 2008 @@ -1090,23 +1090,30 @@ """ global _uname_cache + no_os_uname = 0 if _uname_cache is not None: return _uname_cache + processor = '' + # Get some infos from the builtin os.uname API... try: system,node,release,version,machine = os.uname() - except AttributeError: - # Hmm, no uname... we'll have to poke around the system then. - system = sys.platform - release = '' - version = '' - node = _node() - machine = '' - processor = '' - use_syscmd_ver = 1 + no_os_uname = 1 + + if no_os_uname or not filter(None, (system, node, release, version, machine)): + # Hmm, no there is either no uname or uname has returned + #'unknowns'... we'll have to poke around the system then. + if no_os_uname: + system = sys.platform + release = '' + version = '' + node = _node() + machine = '' + + use_syscmd_ver = 01 # Try win32_ver() on win32 platforms if system == 'win32': @@ -1117,8 +1124,10 @@ # available on Win XP and later; see # http://support.microsoft.com/kb/888731 and # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM - machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') - processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) + if not machine: + machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') + if not processor: + processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) # Try the 'ver' system command available on some # platforms @@ -1160,30 +1169,28 @@ release,(version,stage,nonrel),machine = mac_ver() system = 'MacOS' - else: - # System specific extensions - if system == 'OpenVMS': - # OpenVMS seems to have release and version mixed up - if not release or release == '0': - release = version - version = '' - # Get processor information - try: - import vms_lib - except ImportError: - pass - else: - csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) - if (cpu_number >= 128): - processor = 'Alpha' - else: - processor = 'VAX' + # System specific extensions + if system == 'OpenVMS': + # OpenVMS seems to have release and version mixed up + if not release or release == '0': + release = version + version = '' + # Get processor information + try: + import vms_lib + except ImportError: + pass else: - # Get processor information from the uname system command - processor = _syscmd_uname('-p','') + csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) + if (cpu_number >= 128): + processor = 'Alpha' + else: + processor = 'VAX' + if not processor: + # Get processor information from the uname system command + processor = _syscmd_uname('-p','') - # 'unknown' is not really any useful as information; we'll convert - # it to '' which is more portable + #If any unknowns still exist, replace them with ''s, which are more portable if system == 'unknown': system = '' if node == 'unknown': Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Fri Jun 13 17:11:50 2008 @@ -675,6 +675,7 @@ Monty Taylor Amy Taylor Tobias Thelen +James Thomas Robin Thomas Eric Tiedemann Tracy Tims Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 13 17:11:50 2008 @@ -84,6 +84,9 @@ Library ------- +- Issue #2912: platform.uname now tries to determine unknown information even if + os.uname exists. + - The rfc822 module has been deprecated for removal in 3.0. - The mimetools module has been deprecated for removal in 3.0. From buildbot at python.org Fri Jun 13 17:38:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 15:38:10 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080613153810.415C11E4006@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3222 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpiKjYb_/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 17:41:09 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 17:41:09 +0200 (CEST) Subject: [Python-checkins] r64235 - python/trunk/Lib/multiprocessing Message-ID: <20080613154109.992B81E4006@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 17:41:09 2008 New Revision: 64235 Log: set svn:ignore on multiprocessing Modified: python/trunk/Lib/multiprocessing/ (props changed) From python-checkins at python.org Fri Jun 13 19:13:19 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 19:13:19 +0200 (CEST) Subject: [Python-checkins] r64236 - in projects/external: bzip2-1.0.5 bzip2-1.0.5/CHANGES bzip2-1.0.5/LICENSE bzip2-1.0.5/Makefile bzip2-1.0.5/Makefile-libbz2_so bzip2-1.0.5/README bzip2-1.0.5/README.COMPILATION.PROBLEMS bzip2-1.0.5/README.XML.STUFF bzip2-1.0.5/blocksort.c bzip2-1.0.5/bz-common.xsl bzip2-1.0.5/bz-fo.xsl bzip2-1.0.5/bz-html.xsl bzip2-1.0.5/bzdiff bzip2-1.0.5/bzdiff.1 bzip2-1.0.5/bzgrep bzip2-1.0.5/bzgrep.1 bzip2-1.0.5/bzip.css bzip2-1.0.5/bzip2.1 bzip2-1.0.5/bzip2.1.preformatted bzip2-1.0.5/bzip2.c bzip2-1.0.5/bzip2.txt bzip2-1.0.5/bzip2recover.c bzip2-1.0.5/bzlib.c bzip2-1.0.5/bzlib.h bzip2-1.0.5/bzlib_private.h bzip2-1.0.5/bzmore bzip2-1.0.5/bzmore.1 bzip2-1.0.5/compress.c bzip2-1.0.5/crctable.c bzip2-1.0.5/decompress.c bzip2-1.0.5/dlltest.c bzip2-1.0.5/dlltest.dsp bzip2-1.0.5/entities.xml bzip2-1.0.5/format.pl bzip2-1.0.5/huffman.c bzip2-1.0.5/libbz2.def bzip2-1.0.5/libbz2.dsp bzip2-1.0.5/makefile.msc bzip2-1.0.5/manual.html bzip2-1.0.5/manual.pdf bzip2-1.0.5/manual.ps bzip2-1.0.5/manual.xml bzip2-1.0.5/mk251.c bzip2-1.0.5/randtable.c bzip2-1.0.5/sample1.bz2 bzip2-1.0.5/sample1.ref bzip2-1.0.5/sample2.bz2 bzip2-1.0.5/sample2.ref bzip2-1.0.5/sample3.bz2 bzip2-1.0.5/sample3.ref bzip2-1.0.5/spewG.c bzip2-1.0.5/unzcrash.c bzip2-1.0.5/words0 bzip2-1.0.5/words1 bzip2-1.0.5/words2 bzip2-1.0.5/words3 bzip2-1.0.5/xmlproc.sh Message-ID: <20080613171319.31EAD1E4006@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 19:13:07 2008 New Revision: 64236 Log: Import bzip2 1.0.5. Added: projects/external/ projects/external/bzip2-1.0.5/ projects/external/bzip2-1.0.5/CHANGES projects/external/bzip2-1.0.5/LICENSE projects/external/bzip2-1.0.5/Makefile projects/external/bzip2-1.0.5/Makefile-libbz2_so projects/external/bzip2-1.0.5/README projects/external/bzip2-1.0.5/README.COMPILATION.PROBLEMS projects/external/bzip2-1.0.5/README.XML.STUFF projects/external/bzip2-1.0.5/blocksort.c projects/external/bzip2-1.0.5/bz-common.xsl projects/external/bzip2-1.0.5/bz-fo.xsl projects/external/bzip2-1.0.5/bz-html.xsl projects/external/bzip2-1.0.5/bzdiff projects/external/bzip2-1.0.5/bzdiff.1 projects/external/bzip2-1.0.5/bzgrep projects/external/bzip2-1.0.5/bzgrep.1 projects/external/bzip2-1.0.5/bzip.css projects/external/bzip2-1.0.5/bzip2.1 projects/external/bzip2-1.0.5/bzip2.1.preformatted projects/external/bzip2-1.0.5/bzip2.c projects/external/bzip2-1.0.5/bzip2.txt projects/external/bzip2-1.0.5/bzip2recover.c projects/external/bzip2-1.0.5/bzlib.c projects/external/bzip2-1.0.5/bzlib.h projects/external/bzip2-1.0.5/bzlib_private.h projects/external/bzip2-1.0.5/bzmore projects/external/bzip2-1.0.5/bzmore.1 projects/external/bzip2-1.0.5/compress.c projects/external/bzip2-1.0.5/crctable.c projects/external/bzip2-1.0.5/decompress.c projects/external/bzip2-1.0.5/dlltest.c projects/external/bzip2-1.0.5/dlltest.dsp projects/external/bzip2-1.0.5/entities.xml projects/external/bzip2-1.0.5/format.pl (contents, props changed) projects/external/bzip2-1.0.5/huffman.c projects/external/bzip2-1.0.5/libbz2.def projects/external/bzip2-1.0.5/libbz2.dsp projects/external/bzip2-1.0.5/makefile.msc projects/external/bzip2-1.0.5/manual.html projects/external/bzip2-1.0.5/manual.pdf projects/external/bzip2-1.0.5/manual.ps projects/external/bzip2-1.0.5/manual.xml projects/external/bzip2-1.0.5/mk251.c projects/external/bzip2-1.0.5/randtable.c projects/external/bzip2-1.0.5/sample1.bz2 (contents, props changed) projects/external/bzip2-1.0.5/sample1.ref (contents, props changed) projects/external/bzip2-1.0.5/sample2.bz2 (contents, props changed) projects/external/bzip2-1.0.5/sample2.ref (contents, props changed) projects/external/bzip2-1.0.5/sample3.bz2 (contents, props changed) projects/external/bzip2-1.0.5/sample3.ref projects/external/bzip2-1.0.5/spewG.c projects/external/bzip2-1.0.5/unzcrash.c projects/external/bzip2-1.0.5/words0 projects/external/bzip2-1.0.5/words1 projects/external/bzip2-1.0.5/words2 projects/external/bzip2-1.0.5/words3 projects/external/bzip2-1.0.5/xmlproc.sh (contents, props changed) Added: projects/external/bzip2-1.0.5/CHANGES ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/CHANGES Fri Jun 13 19:13:07 2008 @@ -0,0 +1,319 @@ + ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ + + +0.9.0 +~~~~~ +First version. + + +0.9.0a +~~~~~~ +Removed 'ranlib' from Makefile, since most modern Unix-es +don't need it, or even know about it. + + +0.9.0b +~~~~~~ +Fixed a problem with error reporting in bzip2.c. This does not effect +the library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the +program proper) compress and decompress correctly, but give misleading +error messages (internal panics) when an I/O error occurs, instead of +reporting the problem correctly. This shouldn't give any data loss +(as far as I can see), but is confusing. + +Made the inline declarations disappear for non-GCC compilers. + + +0.9.0c +~~~~~~ +Fixed some problems in the library pertaining to some boundary cases. +This makes the library behave more correctly in those situations. The +fixes apply only to features (calls and parameters) not used by +bzip2.c, so the non-fixedness of them in previous versions has no +effect on reliability of bzip2.c. + +In bzlib.c: + * made zero-length BZ_FLUSH work correctly in bzCompress(). + * fixed bzWrite/bzRead to ignore zero-length requests. + * fixed bzread to correctly handle read requests after EOF. + * wrong parameter order in call to bzDecompressInit in + bzBuffToBuffDecompress. Fixed. + +In compress.c: + * changed setting of nGroups in sendMTFValues() so as to + do a bit better on small files. This _does_ effect + bzip2.c. + + +0.9.5a +~~~~~~ +Major change: add a fallback sorting algorithm (blocksort.c) +to give reasonable behaviour even for very repetitive inputs. +Nuked --repetitive-best and --repetitive-fast since they are +no longer useful. + +Minor changes: mostly a whole bunch of small changes/ +bugfixes in the driver (bzip2.c). Changes pertaining to the +user interface are: + + allow decompression of symlink'd files to stdout + decompress/test files even without .bz2 extension + give more accurate error messages for I/O errors + when compressing/decompressing to stdout, don't catch control-C + read flags from BZIP2 and BZIP environment variables + decline to break hard links to a file unless forced with -f + allow -c flag even with no filenames + preserve file ownerships as far as possible + make -s -1 give the expected block size (100k) + add a flag -q --quiet to suppress nonessential warnings + stop decoding flags after --, so files beginning in - can be handled + resolved inconsistent naming: bzcat or bz2cat ? + bzip2 --help now returns 0 + +Programming-level changes are: + + fixed syntax error in GET_LL4 for Borland C++ 5.02 + let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC} + fix overshoot of mode-string end in bzopen_or_bzdopen + wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... } + close file handles under all error conditions + added minor mods so it compiles with DJGPP out of the box + fixed Makefile so it doesn't give problems with BSD make + fix uninitialised memory reads in dlltest.c + +0.9.5b +~~~~~~ +Open stdin/stdout in binary mode for DJGPP. + +0.9.5c +~~~~~~ +Changed BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1 +version could cause the sorted order to be wrong in some extremely +obscure cases. Also changed setting of quadrant in blocksort.c. + +0.9.5d +~~~~~~ +The only functional change is to make bzlibVersion() in the library +return the correct string. This has no effect whatsoever on the +functioning of the bzip2 program or library. Added a couple of casts +so the library compiles without warnings at level 3 in MS Visual +Studio 6.0. Included a Y2K statement in the file Y2K_INFO. All other +changes are minor documentation changes. + +1.0 +~~~ +Several minor bugfixes and enhancements: + +* Large file support. The library uses 64-bit counters to + count the volume of data passing through it. bzip2.c + is now compiled with -D_FILE_OFFSET_BITS=64 to get large + file support from the C library. -v correctly prints out + file sizes greater than 4 gigabytes. All these changes have + been made without assuming a 64-bit platform or a C compiler + which supports 64-bit ints, so, except for the C library + aspect, they are fully portable. + +* Decompression robustness. The library/program should be + robust to any corruption of compressed data, detecting and + handling _all_ corruption, instead of merely relying on + the CRCs. What this means is that the program should + never crash, given corrupted data, and the library should + always return BZ_DATA_ERROR. + +* Fixed an obscure race-condition bug only ever observed on + Solaris, in which, if you were very unlucky and issued + control-C at exactly the wrong time, both input and output + files would be deleted. + +* Don't run out of file handles on test/decompression when + large numbers of files have invalid magic numbers. + +* Avoid library namespace pollution. Prefix all exported + symbols with BZ2_. + +* Minor sorting enhancements from my DCC2000 paper. + +* Advance the version number to 1.0, so as to counteract the + (false-in-this-case) impression some people have that programs + with version numbers less than 1.0 are in some way, experimental, + pre-release versions. + +* Create an initial Makefile-libbz2_so to build a shared library. + Yes, I know I should really use libtool et al ... + +* Make the program exit with 2 instead of 0 when decompression + fails due to a bad magic number (ie, an invalid bzip2 header). + Also exit with 1 (as the manual claims :-) whenever a diagnostic + message would have been printed AND the corresponding operation + is aborted, for example + bzip2: Output file xx already exists. + When a diagnostic message is printed but the operation is not + aborted, for example + bzip2: Can't guess original name for wurble -- using wurble.out + then the exit value 0 is returned, unless some other problem is + also detected. + + I think it corresponds more closely to what the manual claims now. + + +1.0.1 +~~~~~ +* Modified dlltest.c so it uses the new BZ2_ naming scheme. +* Modified makefile-msc to fix minor build probs on Win2k. +* Updated README.COMPILATION.PROBLEMS. + +There are no functionality changes or bug fixes relative to version +1.0.0. This is just a documentation update + a fix for minor Win32 +build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is +utterly pointless. Don't bother. + + +1.0.2 +~~~~~ +A bug fix release, addressing various minor issues which have appeared +in the 18 or so months since 1.0.1 was released. Most of the fixes +are to do with file-handling or documentation bugs. To the best of my +knowledge, there have been no data-loss-causing bugs reported in the +compression/decompression engine of 1.0.0 or 1.0.1. + +Note that this release does not improve the rather crude build system +for Unix platforms. The general plan here is to autoconfiscate/ +libtoolise 1.0.2 soon after release, and release the result as 1.1.0 +or perhaps 1.2.0. That, however, is still just a plan at this point. + +Here are the changes in 1.0.2. Bug-reporters and/or patch-senders in +parentheses. + +* Fix an infinite segfault loop in 1.0.1 when a directory is + encountered in -f (force) mode. + (Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt) + +* Avoid double fclose() of output file on certain I/O error paths. + (Solar Designer) + +* Don't fail with internal error 1007 when fed a long stream (> 48MB) + of byte 251. Also print useful message suggesting that 1007s may be + caused by bad memory. + (noticed by Juan Pedro Vallejo, fixed by me) + +* Fix uninitialised variable silly bug in demo prog dlltest.c. + (Jorj Bauer) + +* Remove 512-MB limitation on recovered file size for bzip2recover + on selected platforms which support 64-bit ints. At the moment + all GCC supported platforms, and Win32. + (me, Alson van der Meulen) + +* Hard-code header byte values, to give correct operation on platforms + using EBCDIC as their native character set (IBM's OS/390). + (Leland Lucius) + +* Copy file access times correctly. + (Marty Leisner) + +* Add distclean and check targets to Makefile. + (Michael Carmack) + +* Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS). + (Rich Ireland, Bo Thorsen) + +* Pass -p (create parent dirs as needed) to mkdir during make install. + (Jeremy Fusco) + +* Dereference symlinks when copying file permissions in -f mode. + (Volker Schmidt) + +* Majorly simplify implementation of uInt64_qrm10. + (Bo Lindbergh) + +* Check the input file still exists before deleting the output one, + when aborting in cleanUpAndFail(). + (Joerg Prante, Robert Linden, Matthias Krings) + +Also a bunch of patches courtesy of Philippe Troin, the Debian maintainer +of bzip2: + +* Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore. + +* Spelling changes and minor enhancements in bzip2.1. + +* Avoid race condition between creating the output file and setting its + interim permissions safely, by using fopen_output_safely(). + No changes to bzip2recover since there is no issue with file + permissions there. + +* do not print senseless report with -v when compressing an empty + file. + +* bzcat -f works on non-bzip2 files. + +* do not try to escape shell meta-characters on unix (the shell takes + care of these). + +* added --fast and --best aliases for -1 -9 for gzip compatibility. + + +1.0.3 (15 Feb 05) +~~~~~~~~~~~~~~~~~ +Fixes some minor bugs since the last version, 1.0.2. + +* Further robustification against corrupted compressed data. + There are currently no known bitstreams which can cause the + decompressor to crash, loop or access memory which does not + belong to it. If you are using bzip2 or the library to + decompress bitstreams from untrusted sources, an upgrade + to 1.0.3 is recommended. This fixes CAN-2005-1260. + +* The documentation has been converted to XML, from which html + and pdf can be derived. + +* Various minor bugs in the documentation have been fixed. + +* Fixes for various compilation warnings with newer versions of + gcc, and on 64-bit platforms. + +* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2. + This has been fixed. + + +1.0.4 (20 Dec 06) +~~~~~~~~~~~~~~~~~ +Fixes some minor bugs since the last version, 1.0.3. + +* Fix file permissions race problem (CAN-2005-0953). + +* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD + scan. + +* 'const'/prototype cleanups in the C code. + +* Change default install location to /usr/local, and handle multiple + 'make install's without error. + +* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758 + to the extent that applies to bzgrep. + +* Use 'mktemp' rather than 'tempfile' in bzdiff. + +* Tighten up a couple of assertions in blocksort.c following automated + analysis. + +* Fix minor doc/comment bugs. + + +1.0.5 (10 Dec 07) +~~~~~~~~~~~~~~~~~ +Security fix only. Fixes CERT-FI 20469 as it applies to bzip2. + Added: projects/external/bzip2-1.0.5/LICENSE ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/LICENSE Fri Jun 13 19:13:07 2008 @@ -0,0 +1,42 @@ + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2007 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward at bzip.org +bzip2/libbzip2 version 1.0.5 of 10 December 2007 + +-------------------------------------------------------------------------- Added: projects/external/bzip2-1.0.5/Makefile ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/Makefile Fri Jun 13 19:13:07 2008 @@ -0,0 +1,217 @@ +# ------------------------------------------------------------------ +# This file is part of bzip2/libbzip2, a program and library for +# lossless, block-sorting data compression. +# +# bzip2/libbzip2 version 1.0.5 of 10 December 2007 +# Copyright (C) 1996-2007 Julian Seward +# +# Please read the WARNING, DISCLAIMER and PATENTS sections in the +# README file. +# +# This program is released under the terms of the license contained +# in the file LICENSE. +# ------------------------------------------------------------------ + +SHELL=/bin/sh + +# To assist in cross-compiling +CC=gcc +AR=ar +RANLIB=ranlib +LDFLAGS= + +BIGFILES=-D_FILE_OFFSET_BITS=64 +CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) + +# Where you want it installed when you do 'make install' +PREFIX=/usr/local + + +OBJS= blocksort.o \ + huffman.o \ + crctable.o \ + randtable.o \ + compress.o \ + decompress.o \ + bzlib.o + +all: libbz2.a bzip2 bzip2recover test + +bzip2: libbz2.a bzip2.o + $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 + +bzip2recover: bzip2recover.o + $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o + +libbz2.a: $(OBJS) + rm -f libbz2.a + $(AR) cq libbz2.a $(OBJS) + @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ + -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ + echo $(RANLIB) libbz2.a ; \ + $(RANLIB) libbz2.a ; \ + fi + +check: test +test: bzip2 + @cat words1 + ./bzip2 -1 < sample1.ref > sample1.rb2 + ./bzip2 -2 < sample2.ref > sample2.rb2 + ./bzip2 -3 < sample3.ref > sample3.rb2 + ./bzip2 -d < sample1.bz2 > sample1.tst + ./bzip2 -d < sample2.bz2 > sample2.tst + ./bzip2 -ds < sample3.bz2 > sample3.tst + cmp sample1.bz2 sample1.rb2 + cmp sample2.bz2 sample2.rb2 + cmp sample3.bz2 sample3.rb2 + cmp sample1.tst sample1.ref + cmp sample2.tst sample2.ref + cmp sample3.tst sample3.ref + @cat words3 + +install: bzip2 bzip2recover + if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi + if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi + if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi + if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi + if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi + cp -f bzip2 $(PREFIX)/bin/bzip2 + cp -f bzip2 $(PREFIX)/bin/bunzip2 + cp -f bzip2 $(PREFIX)/bin/bzcat + cp -f bzip2recover $(PREFIX)/bin/bzip2recover + chmod a+x $(PREFIX)/bin/bzip2 + chmod a+x $(PREFIX)/bin/bunzip2 + chmod a+x $(PREFIX)/bin/bzcat + chmod a+x $(PREFIX)/bin/bzip2recover + cp -f bzip2.1 $(PREFIX)/man/man1 + chmod a+r $(PREFIX)/man/man1/bzip2.1 + cp -f bzlib.h $(PREFIX)/include + chmod a+r $(PREFIX)/include/bzlib.h + cp -f libbz2.a $(PREFIX)/lib + chmod a+r $(PREFIX)/lib/libbz2.a + cp -f bzgrep $(PREFIX)/bin/bzgrep + ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep + ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep + chmod a+x $(PREFIX)/bin/bzgrep + cp -f bzmore $(PREFIX)/bin/bzmore + ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless + chmod a+x $(PREFIX)/bin/bzmore + cp -f bzdiff $(PREFIX)/bin/bzdiff + ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp + chmod a+x $(PREFIX)/bin/bzdiff + cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 + chmod a+r $(PREFIX)/man/man1/bzgrep.1 + chmod a+r $(PREFIX)/man/man1/bzmore.1 + chmod a+r $(PREFIX)/man/man1/bzdiff.1 + echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1 + echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1 + echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1 + echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 + +clean: + rm -f *.o libbz2.a bzip2 bzip2recover \ + sample1.rb2 sample2.rb2 sample3.rb2 \ + sample1.tst sample2.tst sample3.tst + +blocksort.o: blocksort.c + @cat words0 + $(CC) $(CFLAGS) -c blocksort.c +huffman.o: huffman.c + $(CC) $(CFLAGS) -c huffman.c +crctable.o: crctable.c + $(CC) $(CFLAGS) -c crctable.c +randtable.o: randtable.c + $(CC) $(CFLAGS) -c randtable.c +compress.o: compress.c + $(CC) $(CFLAGS) -c compress.c +decompress.o: decompress.c + $(CC) $(CFLAGS) -c decompress.c +bzlib.o: bzlib.c + $(CC) $(CFLAGS) -c bzlib.c +bzip2.o: bzip2.c + $(CC) $(CFLAGS) -c bzip2.c +bzip2recover.o: bzip2recover.c + $(CC) $(CFLAGS) -c bzip2recover.c + + +distclean: clean + rm -f manual.ps manual.html manual.pdf + +DISTNAME=bzip2-1.0.5 +dist: check manual + rm -f $(DISTNAME) + ln -s -f . $(DISTNAME) + tar cvf $(DISTNAME).tar \ + $(DISTNAME)/blocksort.c \ + $(DISTNAME)/huffman.c \ + $(DISTNAME)/crctable.c \ + $(DISTNAME)/randtable.c \ + $(DISTNAME)/compress.c \ + $(DISTNAME)/decompress.c \ + $(DISTNAME)/bzlib.c \ + $(DISTNAME)/bzip2.c \ + $(DISTNAME)/bzip2recover.c \ + $(DISTNAME)/bzlib.h \ + $(DISTNAME)/bzlib_private.h \ + $(DISTNAME)/Makefile \ + $(DISTNAME)/LICENSE \ + $(DISTNAME)/bzip2.1 \ + $(DISTNAME)/bzip2.1.preformatted \ + $(DISTNAME)/bzip2.txt \ + $(DISTNAME)/words0 \ + $(DISTNAME)/words1 \ + $(DISTNAME)/words2 \ + $(DISTNAME)/words3 \ + $(DISTNAME)/sample1.ref \ + $(DISTNAME)/sample2.ref \ + $(DISTNAME)/sample3.ref \ + $(DISTNAME)/sample1.bz2 \ + $(DISTNAME)/sample2.bz2 \ + $(DISTNAME)/sample3.bz2 \ + $(DISTNAME)/dlltest.c \ + $(DISTNAME)/manual.html \ + $(DISTNAME)/manual.pdf \ + $(DISTNAME)/manual.ps \ + $(DISTNAME)/README \ + $(DISTNAME)/README.COMPILATION.PROBLEMS \ + $(DISTNAME)/README.XML.STUFF \ + $(DISTNAME)/CHANGES \ + $(DISTNAME)/libbz2.def \ + $(DISTNAME)/libbz2.dsp \ + $(DISTNAME)/dlltest.dsp \ + $(DISTNAME)/makefile.msc \ + $(DISTNAME)/unzcrash.c \ + $(DISTNAME)/spewG.c \ + $(DISTNAME)/mk251.c \ + $(DISTNAME)/bzdiff \ + $(DISTNAME)/bzdiff.1 \ + $(DISTNAME)/bzmore \ + $(DISTNAME)/bzmore.1 \ + $(DISTNAME)/bzgrep \ + $(DISTNAME)/bzgrep.1 \ + $(DISTNAME)/Makefile-libbz2_so \ + $(DISTNAME)/bz-common.xsl \ + $(DISTNAME)/bz-fo.xsl \ + $(DISTNAME)/bz-html.xsl \ + $(DISTNAME)/bzip.css \ + $(DISTNAME)/entities.xml \ + $(DISTNAME)/manual.xml \ + $(DISTNAME)/format.pl \ + $(DISTNAME)/xmlproc.sh + gzip -v $(DISTNAME).tar + +# For rebuilding the manual from sources on my SuSE 9.1 box + +MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \ + entities.xml manual.xml + +manual: manual.html manual.ps manual.pdf + +manual.ps: $(MANUAL_SRCS) + ./xmlproc.sh -ps manual.xml + +manual.pdf: $(MANUAL_SRCS) + ./xmlproc.sh -pdf manual.xml + +manual.html: $(MANUAL_SRCS) + ./xmlproc.sh -html manual.xml Added: projects/external/bzip2-1.0.5/Makefile-libbz2_so ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/Makefile-libbz2_so Fri Jun 13 19:13:07 2008 @@ -0,0 +1,59 @@ + +# This Makefile builds a shared version of the library, +# libbz2.so.1.0.4, with soname libbz2.so.1.0, +# at least on x86-Linux (RedHat 7.2), +# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). +# Please see the README file for some important info +# about building the library like this. + +# ------------------------------------------------------------------ +# This file is part of bzip2/libbzip2, a program and library for +# lossless, block-sorting data compression. +# +# bzip2/libbzip2 version 1.0.5 of 10 December 2007 +# Copyright (C) 1996-2007 Julian Seward +# +# Please read the WARNING, DISCLAIMER and PATENTS sections in the +# README file. +# +# This program is released under the terms of the license contained +# in the file LICENSE. +# ------------------------------------------------------------------ + + +SHELL=/bin/sh +CC=gcc +BIGFILES=-D_FILE_OFFSET_BITS=64 +CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) + +OBJS= blocksort.o \ + huffman.o \ + crctable.o \ + randtable.o \ + compress.o \ + decompress.o \ + bzlib.o + +all: $(OBJS) + $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS) + $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4 + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.4 libbz2.so.1.0 + +clean: + rm -f $(OBJS) bzip2.o libbz2.so.1.0.4 libbz2.so.1.0 bzip2-shared + +blocksort.o: blocksort.c + $(CC) $(CFLAGS) -c blocksort.c +huffman.o: huffman.c + $(CC) $(CFLAGS) -c huffman.c +crctable.o: crctable.c + $(CC) $(CFLAGS) -c crctable.c +randtable.o: randtable.c + $(CC) $(CFLAGS) -c randtable.c +compress.o: compress.c + $(CC) $(CFLAGS) -c compress.c +decompress.o: decompress.c + $(CC) $(CFLAGS) -c decompress.c +bzlib.o: bzlib.c + $(CC) $(CFLAGS) -c bzlib.c Added: projects/external/bzip2-1.0.5/README ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/README Fri Jun 13 19:13:07 2008 @@ -0,0 +1,210 @@ + +This is the README for bzip2/libzip2. +This version is fully compatible with the previous public releases. + +------------------------------------------------------------------ +This file is part of bzip2/libbzip2, a program and library for +lossless, block-sorting data compression. + +bzip2/libbzip2 version 1.0.5 of 10 December 2007 +Copyright (C) 1996-2007 Julian Seward + +Please read the WARNING, DISCLAIMER and PATENTS sections in this file. + +This program is released under the terms of the license contained +in the file LICENSE. +------------------------------------------------------------------ + +Complete documentation is available in Postscript form (manual.ps), +PDF (manual.pdf) or html (manual.html). A plain-text version of the +manual page is available as bzip2.txt. + + +HOW TO BUILD -- UNIX + +Type 'make'. This builds the library libbz2.a and then the programs +bzip2 and bzip2recover. Six self-tests are run. If the self-tests +complete ok, carry on to installation: + +To install in /usr/local/bin, /usr/local/lib, /usr/local/man and +/usr/local/include, type + + make install + +To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type + + make install PREFIX=/xxx/yyy + +If you are (justifiably) paranoid and want to see what 'make install' +is going to do, you can first do + + make -n install or + make -n install PREFIX=/xxx/yyy respectively. + +The -n instructs make to show the commands it would execute, but not +actually execute them. + + +HOW TO BUILD -- UNIX, shared library libbz2.so. + +Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for +Linux-ELF (RedHat 7.2 on an x86 box), with gcc. I make no claims +that it works for any other platform, though I suspect it probably +will work for most platforms employing both ELF and gcc. + +bzip2-shared, a client of the shared library, is also built, but not +self-tested. So I suggest you also build using the normal Makefile, +since that conducts a self-test. A second reason to prefer the +version statically linked to the library is that, on x86 platforms, +building shared objects makes a valuable register (%ebx) unavailable +to gcc, resulting in a slowdown of 10%-20%, at least for bzip2. + +Important note for people upgrading .so's from 0.9.0/0.9.5 to version +1.0.X. All the functions in the library have been renamed, from (eg) +bzCompress to BZ2_bzCompress, to avoid namespace pollution. +Unfortunately this means that the libbz2.so created by +Makefile-libbz2_so will not work with any program which used an older +version of the library. I do encourage library clients to make the +effort to upgrade to use version 1.0, since it is both faster and more +robust than previous versions. + + +HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. + +It's difficult for me to support compilation on all these platforms. +My approach is to collect binaries for these platforms, and put them +on the master web site (http://www.bzip.org). Look there. However +(FWIW), bzip2-1.0.X is very standard ANSI C and should compile +unmodified with MS Visual C. If you have difficulties building, you +might want to read README.COMPILATION.PROBLEMS. + +At least using MS Visual C++ 6, you can build from the unmodified +sources by issuing, in a command shell: + + nmake -f makefile.msc + +(you may need to first run the MSVC-provided script VCVARS32.BAT + so as to set up paths to the MSVC tools correctly). + + +VALIDATION + +Correct operation, in the sense that a compressed file can always be +decompressed to reproduce the original, is obviously of paramount +importance. To validate bzip2, I used a modified version of Mark +Nelson's churn program. Churn is an automated test driver which +recursively traverses a directory structure, using bzip2 to compress +and then decompress each file it encounters, and checking that the +decompressed data is the same as the original. + + + +Please read and be aware of the following: + +WARNING: + + This program and library (attempts to) compress data by + performing several non-trivial transformations on it. + Unless you are 100% familiar with *all* the algorithms + contained herein, and with the consequences of modifying them, + you should NOT meddle with the compression or decompression + machinery. Incorrect changes can and very likely *will* + lead to disastrous loss of data. + + +DISCLAIMER: + + I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE + USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED. + + Every compression of a file implies an assumption that the + compressed file can be decompressed to reproduce the original. + Great efforts in design, coding and testing have been made to + ensure that this program works correctly. However, the complexity + of the algorithms, and, in particular, the presence of various + special cases in the code which occur with very low but non-zero + probability make it impossible to rule out the possibility of bugs + remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS + PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER + SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. + + That is not to say this program is inherently unreliable. + Indeed, I very much hope the opposite is true. bzip2/libbzip2 + has been carefully constructed and extensively tested. + + +PATENTS: + + To the best of my knowledge, bzip2/libbzip2 does not use any + patented algorithms. However, I do not have the resources + to carry out a patent search. Therefore I cannot give any + guarantee of the above statement. + + + +WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ? + + * Approx 10% faster compression, 30% faster decompression + * -t (test mode) is a lot quicker + * Can decompress concatenated compressed files + * Programming interface, so programs can directly read/write .bz2 files + * Less restrictive (BSD-style) licensing + * Flag handling more compatible with GNU gzip + * Much more documentation, i.e., a proper user manual + * Hopefully, improved portability (at least of the library) + +WHAT'S NEW IN 0.9.5 ? + + * Compression speed is much less sensitive to the input + data than in previous versions. Specifically, the very + slow performance caused by repetitive data is fixed. + * Many small improvements in file and flag handling. + * A Y2K statement. + +WHAT'S NEW IN 1.0.0 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.2 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.3 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.4 ? + + See the CHANGES file. + +WHAT'S NEW IN 1.0.5 ? + + See the CHANGES file. + + +I hope you find bzip2 useful. Feel free to contact me at + jseward at bzip.org +if you have any suggestions or queries. Many people mailed me with +comments, suggestions and patches after the releases of bzip-0.15, +bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, +1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this +feedback. I thank you for your comments. + +bzip2's "home" is http://www.bzip.org/ + +Julian Seward +jseward at bzip.org +Cambridge, UK. + +18 July 1996 (version 0.15) +25 August 1996 (version 0.21) + 7 August 1997 (bzip2, version 0.1) +29 August 1997 (bzip2, version 0.1pl2) +23 August 1998 (bzip2, version 0.9.0) + 8 June 1999 (bzip2, version 0.9.5) + 4 Sept 1999 (bzip2, version 0.9.5d) + 5 May 2000 (bzip2, version 1.0pre8) +30 December 2001 (bzip2, version 1.0.2pre1) +15 February 2005 (bzip2, version 1.0.3) +20 December 2006 (bzip2, version 1.0.4) +10 December 2007 (bzip2, version 1.0.5) Added: projects/external/bzip2-1.0.5/README.COMPILATION.PROBLEMS ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/README.COMPILATION.PROBLEMS Fri Jun 13 19:13:07 2008 @@ -0,0 +1,58 @@ +------------------------------------------------------------------ +This file is part of bzip2/libbzip2, a program and library for +lossless, block-sorting data compression. + +bzip2/libbzip2 version 1.0.5 of 10 December 2007 +Copyright (C) 1996-2007 Julian Seward + +Please read the WARNING, DISCLAIMER and PATENTS sections in the +README file. + +This program is released under the terms of the license contained +in the file LICENSE. +------------------------------------------------------------------ + +bzip2-1.0.5 should compile without problems on the vast majority of +platforms. Using the supplied Makefile, I've built and tested it +myself for x86-linux and amd64-linux. With makefile.msc, Visual C++ +6.0 and nmake, you can build a native Win32 version too. Large file +support seems to work correctly on at least on amd64-linux. + +When I say "large file" I mean a file of size 2,147,483,648 (2^31) +bytes or above. Many older OSs can't handle files above this size, +but many newer ones can. Large files are pretty huge -- most files +you'll encounter are not Large Files. + +Early versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide variety +of platforms without difficulty, and I hope this version will continue +in that tradition. However, in order to support large files, I've had +to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. This +can cause problems. + +The technique of adding -D_FILE_OFFSET_BITS=64 to get large file +support is, as far as I know, the Recommended Way to get correct large +file support. For more details, see the Large File Support +Specification, published by the Large File Summit, at + + http://ftp.sas.com/standards/large.file + +As a general comment, if you get compilation errors which you think +are related to large file support, try removing the above define from +the Makefile, ie, delete the line + + BIGFILES=-D_FILE_OFFSET_BITS=64 + +from the Makefile, and do 'make clean ; make'. This will give you a +version of bzip2 without large file support, which, for most +applications, is probably not a problem. + +Alternatively, try some of the platform-specific hints listed below. + +You can use the spewG.c program to generate huge files to test bzip2's +large file support, if you are feeling paranoid. Be aware though that +any compilation problems which affect bzip2 will also affect spewG.c, +alas. + +AIX: I have reports that for large file support, you need to specify +-D_LARGE_FILES rather than -D_FILE_OFFSET_BITS=64. I have not tested +this myself. Added: projects/external/bzip2-1.0.5/README.XML.STUFF ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/README.XML.STUFF Fri Jun 13 19:13:07 2008 @@ -0,0 +1,45 @@ + ---------------------------------------------------------------- + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ---------------------------------------------------------------- + +The script xmlproc.sh takes an xml file as input, +and processes it to create .pdf, .html or .ps output. +It uses format.pl, a perl script to format

 blocks nicely,
+ and add CDATA tags so writers do not have to use eg. < 
+
+The file "entities.xml" must be edited to reflect current
+version, year, etc.
+
+
+Usage:
+
+  ./xmlproc.sh -v manual.xml
+  Validates an xml file to ensure no dtd-compliance errors
+
+  ./xmlproc.sh -html manual.xml
+  Output: manual.html
+
+  ./xmlproc.sh -pdf manual.xml
+  Output: manual.pdf
+
+  ./xmlproc.sh -ps manual.xml
+  Output: manual.ps
+
+
+Notum bene: 
+- pdfxmltex barfs if given a filename with an underscore in it
+
+- xmltex won't work yet - there's a bug in passivetex
+    which we are all waiting for Sebastian to fix.
+  So we are going the xml -> pdf -> ps route for the time being,
+    using pdfxmltex.

Added: projects/external/bzip2-1.0.5/blocksort.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/blocksort.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,1094 @@
+
+/*-------------------------------------------------------------*/
+/*--- Block sorting machinery                               ---*/
+/*---                                           blocksort.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#include "bzlib_private.h"
+
+/*---------------------------------------------*/
+/*--- Fallback O(N log(N)^2) sorting        ---*/
+/*--- algorithm, for repetitive blocks      ---*/
+/*---------------------------------------------*/
+
+/*---------------------------------------------*/
+static 
+__inline__
+void fallbackSimpleSort ( UInt32* fmap, 
+                          UInt32* eclass, 
+                          Int32   lo, 
+                          Int32   hi )
+{
+   Int32 i, j, tmp;
+   UInt32 ec_tmp;
+
+   if (lo == hi) return;
+
+   if (hi - lo > 3) {
+      for ( i = hi-4; i >= lo; i-- ) {
+         tmp = fmap[i];
+         ec_tmp = eclass[tmp];
+         for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 )
+            fmap[j-4] = fmap[j];
+         fmap[j-4] = tmp;
+      }
+   }
+
+   for ( i = hi-1; i >= lo; i-- ) {
+      tmp = fmap[i];
+      ec_tmp = eclass[tmp];
+      for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ )
+         fmap[j-1] = fmap[j];
+      fmap[j-1] = tmp;
+   }
+}
+
+
+/*---------------------------------------------*/
+#define fswap(zz1, zz2) \
+   { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
+
+#define fvswap(zzp1, zzp2, zzn)       \
+{                                     \
+   Int32 yyp1 = (zzp1);               \
+   Int32 yyp2 = (zzp2);               \
+   Int32 yyn  = (zzn);                \
+   while (yyn > 0) {                  \
+      fswap(fmap[yyp1], fmap[yyp2]);  \
+      yyp1++; yyp2++; yyn--;          \
+   }                                  \
+}
+
+
+#define fmin(a,b) ((a) < (b)) ? (a) : (b)
+
+#define fpush(lz,hz) { stackLo[sp] = lz; \
+                       stackHi[sp] = hz; \
+                       sp++; }
+
+#define fpop(lz,hz) { sp--;              \
+                      lz = stackLo[sp];  \
+                      hz = stackHi[sp]; }
+
+#define FALLBACK_QSORT_SMALL_THRESH 10
+#define FALLBACK_QSORT_STACK_SIZE   100
+
+
+static
+void fallbackQSort3 ( UInt32* fmap, 
+                      UInt32* eclass,
+                      Int32   loSt, 
+                      Int32   hiSt )
+{
+   Int32 unLo, unHi, ltLo, gtHi, n, m;
+   Int32 sp, lo, hi;
+   UInt32 med, r, r3;
+   Int32 stackLo[FALLBACK_QSORT_STACK_SIZE];
+   Int32 stackHi[FALLBACK_QSORT_STACK_SIZE];
+
+   r = 0;
+
+   sp = 0;
+   fpush ( loSt, hiSt );
+
+   while (sp > 0) {
+
+      AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 );
+
+      fpop ( lo, hi );
+      if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
+         fallbackSimpleSort ( fmap, eclass, lo, hi );
+         continue;
+      }
+
+      /* Random partitioning.  Median of 3 sometimes fails to
+         avoid bad cases.  Median of 9 seems to help but 
+         looks rather expensive.  This too seems to work but
+         is cheaper.  Guidance for the magic constants 
+         7621 and 32768 is taken from Sedgewick's algorithms
+         book, chapter 35.
+      */
+      r = ((r * 7621) + 1) % 32768;
+      r3 = r % 3;
+      if (r3 == 0) med = eclass[fmap[lo]]; else
+      if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else
+                   med = eclass[fmap[hi]];
+
+      unLo = ltLo = lo;
+      unHi = gtHi = hi;
+
+      while (1) {
+         while (1) {
+            if (unLo > unHi) break;
+            n = (Int32)eclass[fmap[unLo]] - (Int32)med;
+            if (n == 0) { 
+               fswap(fmap[unLo], fmap[ltLo]); 
+               ltLo++; unLo++; 
+               continue; 
+            };
+            if (n > 0) break;
+            unLo++;
+         }
+         while (1) {
+            if (unLo > unHi) break;
+            n = (Int32)eclass[fmap[unHi]] - (Int32)med;
+            if (n == 0) { 
+               fswap(fmap[unHi], fmap[gtHi]); 
+               gtHi--; unHi--; 
+               continue; 
+            };
+            if (n < 0) break;
+            unHi--;
+         }
+         if (unLo > unHi) break;
+         fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--;
+      }
+
+      AssertD ( unHi == unLo-1, "fallbackQSort3(2)" );
+
+      if (gtHi < ltLo) continue;
+
+      n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n);
+      m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m);
+
+      n = lo + unLo - ltLo - 1;
+      m = hi - (gtHi - unHi) + 1;
+
+      if (n - lo > hi - m) {
+         fpush ( lo, n );
+         fpush ( m, hi );
+      } else {
+         fpush ( m, hi );
+         fpush ( lo, n );
+      }
+   }
+}
+
+#undef fmin
+#undef fpush
+#undef fpop
+#undef fswap
+#undef fvswap
+#undef FALLBACK_QSORT_SMALL_THRESH
+#undef FALLBACK_QSORT_STACK_SIZE
+
+
+/*---------------------------------------------*/
+/* Pre:
+      nblock > 0
+      eclass exists for [0 .. nblock-1]
+      ((UChar*)eclass) [0 .. nblock-1] holds block
+      ptr exists for [0 .. nblock-1]
+
+   Post:
+      ((UChar*)eclass) [0 .. nblock-1] holds block
+      All other areas of eclass destroyed
+      fmap [0 .. nblock-1] holds sorted order
+      bhtab [ 0 .. 2+(nblock/32) ] destroyed
+*/
+
+#define       SET_BH(zz)  bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
+#define     CLEAR_BH(zz)  bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
+#define     ISSET_BH(zz)  (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
+#define      WORD_BH(zz)  bhtab[(zz) >> 5]
+#define UNALIGNED_BH(zz)  ((zz) & 0x01f)
+
+static
+void fallbackSort ( UInt32* fmap, 
+                    UInt32* eclass, 
+                    UInt32* bhtab,
+                    Int32   nblock,
+                    Int32   verb )
+{
+   Int32 ftab[257];
+   Int32 ftabCopy[256];
+   Int32 H, i, j, k, l, r, cc, cc1;
+   Int32 nNotDone;
+   Int32 nBhtab;
+   UChar* eclass8 = (UChar*)eclass;
+
+   /*--
+      Initial 1-char radix sort to generate
+      initial fmap and initial BH bits.
+   --*/
+   if (verb >= 4)
+      VPrintf0 ( "        bucket sorting ...\n" );
+   for (i = 0; i < 257;    i++) ftab[i] = 0;
+   for (i = 0; i < nblock; i++) ftab[eclass8[i]]++;
+   for (i = 0; i < 256;    i++) ftabCopy[i] = ftab[i];
+   for (i = 1; i < 257;    i++) ftab[i] += ftab[i-1];
+
+   for (i = 0; i < nblock; i++) {
+      j = eclass8[i];
+      k = ftab[j] - 1;
+      ftab[j] = k;
+      fmap[k] = i;
+   }
+
+   nBhtab = 2 + (nblock / 32);
+   for (i = 0; i < nBhtab; i++) bhtab[i] = 0;
+   for (i = 0; i < 256; i++) SET_BH(ftab[i]);
+
+   /*--
+      Inductively refine the buckets.  Kind-of an
+      "exponential radix sort" (!), inspired by the
+      Manber-Myers suffix array construction algorithm.
+   --*/
+
+   /*-- set sentinel bits for block-end detection --*/
+   for (i = 0; i < 32; i++) { 
+      SET_BH(nblock + 2*i);
+      CLEAR_BH(nblock + 2*i + 1);
+   }
+
+   /*-- the log(N) loop --*/
+   H = 1;
+   while (1) {
+
+      if (verb >= 4) 
+         VPrintf1 ( "        depth %6d has ", H );
+
+      j = 0;
+      for (i = 0; i < nblock; i++) {
+         if (ISSET_BH(i)) j = i;
+         k = fmap[i] - H; if (k < 0) k += nblock;
+         eclass[k] = j;
+      }
+
+      nNotDone = 0;
+      r = -1;
+      while (1) {
+
+	 /*-- find the next non-singleton bucket --*/
+         k = r + 1;
+         while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
+         if (ISSET_BH(k)) {
+            while (WORD_BH(k) == 0xffffffff) k += 32;
+            while (ISSET_BH(k)) k++;
+         }
+         l = k - 1;
+         if (l >= nblock) break;
+         while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++;
+         if (!ISSET_BH(k)) {
+            while (WORD_BH(k) == 0x00000000) k += 32;
+            while (!ISSET_BH(k)) k++;
+         }
+         r = k - 1;
+         if (r >= nblock) break;
+
+         /*-- now [l, r] bracket current bucket --*/
+         if (r > l) {
+            nNotDone += (r - l + 1);
+            fallbackQSort3 ( fmap, eclass, l, r );
+
+            /*-- scan bucket and generate header bits-- */
+            cc = -1;
+            for (i = l; i <= r; i++) {
+               cc1 = eclass[fmap[i]];
+               if (cc != cc1) { SET_BH(i); cc = cc1; };
+            }
+         }
+      }
+
+      if (verb >= 4) 
+         VPrintf1 ( "%6d unresolved strings\n", nNotDone );
+
+      H *= 2;
+      if (H > nblock || nNotDone == 0) break;
+   }
+
+   /*-- 
+      Reconstruct the original block in
+      eclass8 [0 .. nblock-1], since the
+      previous phase destroyed it.
+   --*/
+   if (verb >= 4)
+      VPrintf0 ( "        reconstructing block ...\n" );
+   j = 0;
+   for (i = 0; i < nblock; i++) {
+      while (ftabCopy[j] == 0) j++;
+      ftabCopy[j]--;
+      eclass8[fmap[i]] = (UChar)j;
+   }
+   AssertH ( j < 256, 1005 );
+}
+
+#undef       SET_BH
+#undef     CLEAR_BH
+#undef     ISSET_BH
+#undef      WORD_BH
+#undef UNALIGNED_BH
+
+
+/*---------------------------------------------*/
+/*--- The main, O(N^2 log(N)) sorting       ---*/
+/*--- algorithm.  Faster for "normal"       ---*/
+/*--- non-repetitive blocks.                ---*/
+/*---------------------------------------------*/
+
+/*---------------------------------------------*/
+static
+__inline__
+Bool mainGtU ( UInt32  i1, 
+               UInt32  i2,
+               UChar*  block, 
+               UInt16* quadrant,
+               UInt32  nblock,
+               Int32*  budget )
+{
+   Int32  k;
+   UChar  c1, c2;
+   UInt16 s1, s2;
+
+   AssertD ( i1 != i2, "mainGtU" );
+   /* 1 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 2 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 3 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 4 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 5 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 6 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 7 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 8 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 9 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 10 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 11 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+   /* 12 */
+   c1 = block[i1]; c2 = block[i2];
+   if (c1 != c2) return (c1 > c2);
+   i1++; i2++;
+
+   k = nblock + 8;
+
+   do {
+      /* 1 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 2 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 3 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 4 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 5 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 6 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 7 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+      /* 8 */
+      c1 = block[i1]; c2 = block[i2];
+      if (c1 != c2) return (c1 > c2);
+      s1 = quadrant[i1]; s2 = quadrant[i2];
+      if (s1 != s2) return (s1 > s2);
+      i1++; i2++;
+
+      if (i1 >= nblock) i1 -= nblock;
+      if (i2 >= nblock) i2 -= nblock;
+
+      k -= 8;
+      (*budget)--;
+   }
+      while (k >= 0);
+
+   return False;
+}
+
+
+/*---------------------------------------------*/
+/*--
+   Knuth's increments seem to work better
+   than Incerpi-Sedgewick here.  Possibly
+   because the number of elems to sort is
+   usually small, typically <= 20.
+--*/
+static
+Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280,
+                   9841, 29524, 88573, 265720,
+                   797161, 2391484 };
+
+static
+void mainSimpleSort ( UInt32* ptr,
+                      UChar*  block,
+                      UInt16* quadrant,
+                      Int32   nblock,
+                      Int32   lo, 
+                      Int32   hi, 
+                      Int32   d,
+                      Int32*  budget )
+{
+   Int32 i, j, h, bigN, hp;
+   UInt32 v;
+
+   bigN = hi - lo + 1;
+   if (bigN < 2) return;
+
+   hp = 0;
+   while (incs[hp] < bigN) hp++;
+   hp--;
+
+   for (; hp >= 0; hp--) {
+      h = incs[hp];
+
+      i = lo + h;
+      while (True) {
+
+         /*-- copy 1 --*/
+         if (i > hi) break;
+         v = ptr[i];
+         j = i;
+         while ( mainGtU ( 
+                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
+                 ) ) {
+            ptr[j] = ptr[j-h];
+            j = j - h;
+            if (j <= (lo + h - 1)) break;
+         }
+         ptr[j] = v;
+         i++;
+
+         /*-- copy 2 --*/
+         if (i > hi) break;
+         v = ptr[i];
+         j = i;
+         while ( mainGtU ( 
+                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
+                 ) ) {
+            ptr[j] = ptr[j-h];
+            j = j - h;
+            if (j <= (lo + h - 1)) break;
+         }
+         ptr[j] = v;
+         i++;
+
+         /*-- copy 3 --*/
+         if (i > hi) break;
+         v = ptr[i];
+         j = i;
+         while ( mainGtU ( 
+                    ptr[j-h]+d, v+d, block, quadrant, nblock, budget 
+                 ) ) {
+            ptr[j] = ptr[j-h];
+            j = j - h;
+            if (j <= (lo + h - 1)) break;
+         }
+         ptr[j] = v;
+         i++;
+
+         if (*budget < 0) return;
+      }
+   }
+}
+
+
+/*---------------------------------------------*/
+/*--
+   The following is an implementation of
+   an elegant 3-way quicksort for strings,
+   described in a paper "Fast Algorithms for
+   Sorting and Searching Strings", by Robert
+   Sedgewick and Jon L. Bentley.
+--*/
+
+#define mswap(zz1, zz2) \
+   { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; }
+
+#define mvswap(zzp1, zzp2, zzn)       \
+{                                     \
+   Int32 yyp1 = (zzp1);               \
+   Int32 yyp2 = (zzp2);               \
+   Int32 yyn  = (zzn);                \
+   while (yyn > 0) {                  \
+      mswap(ptr[yyp1], ptr[yyp2]);    \
+      yyp1++; yyp2++; yyn--;          \
+   }                                  \
+}
+
+static 
+__inline__
+UChar mmed3 ( UChar a, UChar b, UChar c )
+{
+   UChar t;
+   if (a > b) { t = a; a = b; b = t; };
+   if (b > c) { 
+      b = c;
+      if (a > b) b = a;
+   }
+   return b;
+}
+
+#define mmin(a,b) ((a) < (b)) ? (a) : (b)
+
+#define mpush(lz,hz,dz) { stackLo[sp] = lz; \
+                          stackHi[sp] = hz; \
+                          stackD [sp] = dz; \
+                          sp++; }
+
+#define mpop(lz,hz,dz) { sp--;             \
+                         lz = stackLo[sp]; \
+                         hz = stackHi[sp]; \
+                         dz = stackD [sp]; }
+
+
+#define mnextsize(az) (nextHi[az]-nextLo[az])
+
+#define mnextswap(az,bz)                                        \
+   { Int32 tz;                                                  \
+     tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \
+     tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \
+     tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; }
+
+
+#define MAIN_QSORT_SMALL_THRESH 20
+#define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT)
+#define MAIN_QSORT_STACK_SIZE 100
+
+static
+void mainQSort3 ( UInt32* ptr,
+                  UChar*  block,
+                  UInt16* quadrant,
+                  Int32   nblock,
+                  Int32   loSt, 
+                  Int32   hiSt, 
+                  Int32   dSt,
+                  Int32*  budget )
+{
+   Int32 unLo, unHi, ltLo, gtHi, n, m, med;
+   Int32 sp, lo, hi, d;
+
+   Int32 stackLo[MAIN_QSORT_STACK_SIZE];
+   Int32 stackHi[MAIN_QSORT_STACK_SIZE];
+   Int32 stackD [MAIN_QSORT_STACK_SIZE];
+
+   Int32 nextLo[3];
+   Int32 nextHi[3];
+   Int32 nextD [3];
+
+   sp = 0;
+   mpush ( loSt, hiSt, dSt );
+
+   while (sp > 0) {
+
+      AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 );
+
+      mpop ( lo, hi, d );
+      if (hi - lo < MAIN_QSORT_SMALL_THRESH || 
+          d > MAIN_QSORT_DEPTH_THRESH) {
+         mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget );
+         if (*budget < 0) return;
+         continue;
+      }
+
+      med = (Int32) 
+            mmed3 ( block[ptr[ lo         ]+d],
+                    block[ptr[ hi         ]+d],
+                    block[ptr[ (lo+hi)>>1 ]+d] );
+
+      unLo = ltLo = lo;
+      unHi = gtHi = hi;
+
+      while (True) {
+         while (True) {
+            if (unLo > unHi) break;
+            n = ((Int32)block[ptr[unLo]+d]) - med;
+            if (n == 0) { 
+               mswap(ptr[unLo], ptr[ltLo]); 
+               ltLo++; unLo++; continue; 
+            };
+            if (n >  0) break;
+            unLo++;
+         }
+         while (True) {
+            if (unLo > unHi) break;
+            n = ((Int32)block[ptr[unHi]+d]) - med;
+            if (n == 0) { 
+               mswap(ptr[unHi], ptr[gtHi]); 
+               gtHi--; unHi--; continue; 
+            };
+            if (n <  0) break;
+            unHi--;
+         }
+         if (unLo > unHi) break;
+         mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--;
+      }
+
+      AssertD ( unHi == unLo-1, "mainQSort3(2)" );
+
+      if (gtHi < ltLo) {
+         mpush(lo, hi, d+1 );
+         continue;
+      }
+
+      n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n);
+      m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m);
+
+      n = lo + unLo - ltLo - 1;
+      m = hi - (gtHi - unHi) + 1;
+
+      nextLo[0] = lo;  nextHi[0] = n;   nextD[0] = d;
+      nextLo[1] = m;   nextHi[1] = hi;  nextD[1] = d;
+      nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1;
+
+      if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
+      if (mnextsize(1) < mnextsize(2)) mnextswap(1,2);
+      if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
+
+      AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" );
+      AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" );
+
+      mpush (nextLo[0], nextHi[0], nextD[0]);
+      mpush (nextLo[1], nextHi[1], nextD[1]);
+      mpush (nextLo[2], nextHi[2], nextD[2]);
+   }
+}
+
+#undef mswap
+#undef mvswap
+#undef mpush
+#undef mpop
+#undef mmin
+#undef mnextsize
+#undef mnextswap
+#undef MAIN_QSORT_SMALL_THRESH
+#undef MAIN_QSORT_DEPTH_THRESH
+#undef MAIN_QSORT_STACK_SIZE
+
+
+/*---------------------------------------------*/
+/* Pre:
+      nblock > N_OVERSHOOT
+      block32 exists for [0 .. nblock-1 +N_OVERSHOOT]
+      ((UChar*)block32) [0 .. nblock-1] holds block
+      ptr exists for [0 .. nblock-1]
+
+   Post:
+      ((UChar*)block32) [0 .. nblock-1] holds block
+      All other areas of block32 destroyed
+      ftab [0 .. 65536 ] destroyed
+      ptr [0 .. nblock-1] holds sorted order
+      if (*budget < 0), sorting was abandoned
+*/
+
+#define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8])
+#define SETMASK (1 << 21)
+#define CLEARMASK (~(SETMASK))
+
+static
+void mainSort ( UInt32* ptr, 
+                UChar*  block,
+                UInt16* quadrant, 
+                UInt32* ftab,
+                Int32   nblock,
+                Int32   verb,
+                Int32*  budget )
+{
+   Int32  i, j, k, ss, sb;
+   Int32  runningOrder[256];
+   Bool   bigDone[256];
+   Int32  copyStart[256];
+   Int32  copyEnd  [256];
+   UChar  c1;
+   Int32  numQSorted;
+   UInt16 s;
+   if (verb >= 4) VPrintf0 ( "        main sort initialise ...\n" );
+
+   /*-- set up the 2-byte frequency table --*/
+   for (i = 65536; i >= 0; i--) ftab[i] = 0;
+
+   j = block[0] << 8;
+   i = nblock-1;
+   for (; i >= 3; i -= 4) {
+      quadrant[i] = 0;
+      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
+      ftab[j]++;
+      quadrant[i-1] = 0;
+      j = (j >> 8) | ( ((UInt16)block[i-1]) << 8);
+      ftab[j]++;
+      quadrant[i-2] = 0;
+      j = (j >> 8) | ( ((UInt16)block[i-2]) << 8);
+      ftab[j]++;
+      quadrant[i-3] = 0;
+      j = (j >> 8) | ( ((UInt16)block[i-3]) << 8);
+      ftab[j]++;
+   }
+   for (; i >= 0; i--) {
+      quadrant[i] = 0;
+      j = (j >> 8) | ( ((UInt16)block[i]) << 8);
+      ftab[j]++;
+   }
+
+   /*-- (emphasises close relationship of block & quadrant) --*/
+   for (i = 0; i < BZ_N_OVERSHOOT; i++) {
+      block   [nblock+i] = block[i];
+      quadrant[nblock+i] = 0;
+   }
+
+   if (verb >= 4) VPrintf0 ( "        bucket sorting ...\n" );
+
+   /*-- Complete the initial radix sort --*/
+   for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];
+
+   s = block[0] << 8;
+   i = nblock-1;
+   for (; i >= 3; i -= 4) {
+      s = (s >> 8) | (block[i] << 8);
+      j = ftab[s] -1;
+      ftab[s] = j;
+      ptr[j] = i;
+      s = (s >> 8) | (block[i-1] << 8);
+      j = ftab[s] -1;
+      ftab[s] = j;
+      ptr[j] = i-1;
+      s = (s >> 8) | (block[i-2] << 8);
+      j = ftab[s] -1;
+      ftab[s] = j;
+      ptr[j] = i-2;
+      s = (s >> 8) | (block[i-3] << 8);
+      j = ftab[s] -1;
+      ftab[s] = j;
+      ptr[j] = i-3;
+   }
+   for (; i >= 0; i--) {
+      s = (s >> 8) | (block[i] << 8);
+      j = ftab[s] -1;
+      ftab[s] = j;
+      ptr[j] = i;
+   }
+
+   /*--
+      Now ftab contains the first loc of every small bucket.
+      Calculate the running order, from smallest to largest
+      big bucket.
+   --*/
+   for (i = 0; i <= 255; i++) {
+      bigDone     [i] = False;
+      runningOrder[i] = i;
+   }
+
+   {
+      Int32 vv;
+      Int32 h = 1;
+      do h = 3 * h + 1; while (h <= 256);
+      do {
+         h = h / 3;
+         for (i = h; i <= 255; i++) {
+            vv = runningOrder[i];
+            j = i;
+            while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) {
+               runningOrder[j] = runningOrder[j-h];
+               j = j - h;
+               if (j <= (h - 1)) goto zero;
+            }
+            zero:
+            runningOrder[j] = vv;
+         }
+      } while (h != 1);
+   }
+
+   /*--
+      The main sorting loop.
+   --*/
+
+   numQSorted = 0;
+
+   for (i = 0; i <= 255; i++) {
+
+      /*--
+         Process big buckets, starting with the least full.
+         Basically this is a 3-step process in which we call
+         mainQSort3 to sort the small buckets [ss, j], but
+         also make a big effort to avoid the calls if we can.
+      --*/
+      ss = runningOrder[i];
+
+      /*--
+         Step 1:
+         Complete the big bucket [ss] by quicksorting
+         any unsorted small buckets [ss, j], for j != ss.  
+         Hopefully previous pointer-scanning phases have already
+         completed many of the small buckets [ss, j], so
+         we don't have to sort them at all.
+      --*/
+      for (j = 0; j <= 255; j++) {
+         if (j != ss) {
+            sb = (ss << 8) + j;
+            if ( ! (ftab[sb] & SETMASK) ) {
+               Int32 lo = ftab[sb]   & CLEARMASK;
+               Int32 hi = (ftab[sb+1] & CLEARMASK) - 1;
+               if (hi > lo) {
+                  if (verb >= 4)
+                     VPrintf4 ( "        qsort [0x%x, 0x%x]   "
+                                "done %d   this %d\n",
+                                ss, j, numQSorted, hi - lo + 1 );
+                  mainQSort3 ( 
+                     ptr, block, quadrant, nblock, 
+                     lo, hi, BZ_N_RADIX, budget 
+                  );   
+                  numQSorted += (hi - lo + 1);
+                  if (*budget < 0) return;
+               }
+            }
+            ftab[sb] |= SETMASK;
+         }
+      }
+
+      AssertH ( !bigDone[ss], 1006 );
+
+      /*--
+         Step 2:
+         Now scan this big bucket [ss] so as to synthesise the
+         sorted order for small buckets [t, ss] for all t,
+         including, magically, the bucket [ss,ss] too.
+         This will avoid doing Real Work in subsequent Step 1's.
+      --*/
+      {
+         for (j = 0; j <= 255; j++) {
+            copyStart[j] =  ftab[(j << 8) + ss]     & CLEARMASK;
+            copyEnd  [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1;
+         }
+         for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) {
+            k = ptr[j]-1; if (k < 0) k += nblock;
+            c1 = block[k];
+            if (!bigDone[c1])
+               ptr[ copyStart[c1]++ ] = k;
+         }
+         for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
+            k = ptr[j]-1; if (k < 0) k += nblock;
+            c1 = block[k];
+            if (!bigDone[c1]) 
+               ptr[ copyEnd[c1]-- ] = k;
+         }
+      }
+
+      AssertH ( (copyStart[ss]-1 == copyEnd[ss])
+                || 
+                /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1.
+                   Necessity for this case is demonstrated by compressing 
+                   a sequence of approximately 48.5 million of character 
+                   251; 1.0.0/1.0.1 will then die here. */
+                (copyStart[ss] == 0 && copyEnd[ss] == nblock-1),
+                1007 )
+
+      for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK;
+
+      /*--
+         Step 3:
+         The [ss] big bucket is now done.  Record this fact,
+         and update the quadrant descriptors.  Remember to
+         update quadrants in the overshoot area too, if
+         necessary.  The "if (i < 255)" test merely skips
+         this updating for the last bucket processed, since
+         updating for the last bucket is pointless.
+
+         The quadrant array provides a way to incrementally
+         cache sort orderings, as they appear, so as to 
+         make subsequent comparisons in fullGtU() complete
+         faster.  For repetitive blocks this makes a big
+         difference (but not big enough to be able to avoid
+         the fallback sorting mechanism, exponential radix sort).
+
+         The precise meaning is: at all times:
+
+            for 0 <= i < nblock and 0 <= j <= nblock
+
+            if block[i] != block[j], 
+
+               then the relative values of quadrant[i] and 
+                    quadrant[j] are meaningless.
+
+               else {
+                  if quadrant[i] < quadrant[j]
+                     then the string starting at i lexicographically
+                     precedes the string starting at j
+
+                  else if quadrant[i] > quadrant[j]
+                     then the string starting at j lexicographically
+                     precedes the string starting at i
+
+                  else
+                     the relative ordering of the strings starting
+                     at i and j has not yet been determined.
+               }
+      --*/
+      bigDone[ss] = True;
+
+      if (i < 255) {
+         Int32 bbStart  = ftab[ss << 8] & CLEARMASK;
+         Int32 bbSize   = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart;
+         Int32 shifts   = 0;
+
+         while ((bbSize >> shifts) > 65534) shifts++;
+
+         for (j = bbSize-1; j >= 0; j--) {
+            Int32 a2update     = ptr[bbStart + j];
+            UInt16 qVal        = (UInt16)(j >> shifts);
+            quadrant[a2update] = qVal;
+            if (a2update < BZ_N_OVERSHOOT)
+               quadrant[a2update + nblock] = qVal;
+         }
+         AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 );
+      }
+
+   }
+
+   if (verb >= 4)
+      VPrintf3 ( "        %d pointers, %d sorted, %d scanned\n",
+                 nblock, numQSorted, nblock - numQSorted );
+}
+
+#undef BIGFREQ
+#undef SETMASK
+#undef CLEARMASK
+
+
+/*---------------------------------------------*/
+/* Pre:
+      nblock > 0
+      arr2 exists for [0 .. nblock-1 +N_OVERSHOOT]
+      ((UChar*)arr2)  [0 .. nblock-1] holds block
+      arr1 exists for [0 .. nblock-1]
+
+   Post:
+      ((UChar*)arr2) [0 .. nblock-1] holds block
+      All other areas of block destroyed
+      ftab [ 0 .. 65536 ] destroyed
+      arr1 [0 .. nblock-1] holds sorted order
+*/
+void BZ2_blockSort ( EState* s )
+{
+   UInt32* ptr    = s->ptr; 
+   UChar*  block  = s->block;
+   UInt32* ftab   = s->ftab;
+   Int32   nblock = s->nblock;
+   Int32   verb   = s->verbosity;
+   Int32   wfact  = s->workFactor;
+   UInt16* quadrant;
+   Int32   budget;
+   Int32   budgetInit;
+   Int32   i;
+
+   if (nblock < 10000) {
+      fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
+   } else {
+      /* Calculate the location for quadrant, remembering to get
+         the alignment right.  Assumes that &(block[0]) is at least
+         2-byte aligned -- this should be ok since block is really
+         the first section of arr2.
+      */
+      i = nblock+BZ_N_OVERSHOOT;
+      if (i & 1) i++;
+      quadrant = (UInt16*)(&(block[i]));
+
+      /* (wfact-1) / 3 puts the default-factor-30
+         transition point at very roughly the same place as 
+         with v0.1 and v0.9.0.  
+         Not that it particularly matters any more, since the
+         resulting compressed stream is now the same regardless
+         of whether or not we use the main sort or fallback sort.
+      */
+      if (wfact < 1  ) wfact = 1;
+      if (wfact > 100) wfact = 100;
+      budgetInit = nblock * ((wfact-1) / 3);
+      budget = budgetInit;
+
+      mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget );
+      if (verb >= 3) 
+         VPrintf3 ( "      %d work, %d block, ratio %5.2f\n",
+                    budgetInit - budget,
+                    nblock, 
+                    (float)(budgetInit - budget) /
+                    (float)(nblock==0 ? 1 : nblock) ); 
+      if (budget < 0) {
+         if (verb >= 2) 
+            VPrintf0 ( "    too repetitive; using fallback"
+                       " sorting algorithm\n" );
+         fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );
+      }
+   }
+
+   s->origPtr = -1;
+   for (i = 0; i < s->nblock; i++)
+      if (ptr[i] == 0)
+         { s->origPtr = i; break; };
+
+   AssertH( s->origPtr != -1, 1003 );
+}
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                       blocksort.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bz-common.xsl
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bz-common.xsl	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,39 @@
+ 
+
+
+
+ 
+
+
+
+ 
+ 
+   
+    
+      
+     
+  
+
+
+
+
+set       toc,title
+book      toc,title,figure,table,example,equation
+chapter   toc,title
+section   toc
+sect1     toc
+sect2     toc
+sect3     toc
+sect4     nop
+sect5     nop
+qandaset  toc
+qandadiv  nop
+appendix  toc,title
+article/appendix  nop
+article   toc,title
+preface   toc,title
+reference toc,title
+
+
+

Added: projects/external/bzip2-1.0.5/bz-fo.xsl
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bz-fo.xsl	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,276 @@
+ 
+
+
+
+
+
+
+
+
+
+
+
+
+      
+     
+   
+
+
+
+
+ 
+
+
+
+
+
+
+  
+
+
+
+
+  blue
+
+
+
+
+  
+    
+  
+
+
+
+  
+    
+  
+
+
+
+
+  
+  
+  
+    
+      
+    
+  
+  
+    
+      
+        
+          
+          
+          
+        
+      
+    
+    
+          
+    
+  
+  
+    
+      
+        
+      
+    
+    
+      
+        
+      
+    
+  
+
+
+
+
+  
+  
+  
+    
+      
+        
+      
+    
+    
+          
+    
+  
+  
+    
+      
+        
+      
+    
+    
+      
+        
+      
+    
+  
+
+
+
+
+
+  
+    
+  
+    
+  
+  
+    
+      
+    
+  
+
+
+
+
+
+  
+  
+  
+  
+    
+      0pt
+    
+  
+  
+    
+      
+      
+      
+        
+          
+            baseline
+             
+               
+            
+          
+          
+            baseline
+            
+              
+                
+                
+                
+                
+              
+            
+          
+        
+      
+    
+  
+  
+  
+    
+      
+    
+    
+      
+    
+    
+      
+    
+  
+
+
+
+
+
+  
+  
+  
+  
+    
+      0pt
+    
+  
+  
+    
+      
+        
+        
+        
+      
+      
+      
+      
+        
+          
+            baseline
+            
+               
+            
+          
+          
+            baseline
+            
+              
+                
+                
+                
+                
+              
+            
+          
+        
+      
+    
+  
+  
+  
+    
+      
+    
+    
+      
+    
+    
+      
+    
+  
+
+
+
+
+
+
+  always
+  
+    
+  
+  
+    
+    pt
+  
+  
+    
+    pt
+  
+  false
+
+
+
+

Added: projects/external/bzip2-1.0.5/bz-html.xsl
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bz-html.xsl	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,20 @@
+ 
+ ]>
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+
+

Added: projects/external/bzip2-1.0.5/bzdiff
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzdiff	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,76 @@
+#!/bin/sh
+# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
+
+# Bzcmp/diff wrapped for bzip2, 
+# adapted from zdiff by Philippe Troin  for Debian GNU/Linux.
+
+# Bzcmp and bzdiff are used to invoke the cmp or the  diff  pro-
+# gram  on compressed files.  All options specified are passed
+# directly to cmp or diff.  If only 1 file is specified,  then
+# the  files  compared  are file1 and an uncompressed file1.gz.
+# If two files are specified, then they are  uncompressed  (if
+# necessary) and fed to cmp or diff.  The exit status from cmp
+# or diff is preserved.
+
+PATH="/usr/bin:/bin:$PATH"; export PATH
+prog=`echo $0 | sed 's|.*/||'`
+case "$prog" in
+  *cmp) comp=${CMP-cmp}   ;;
+  *)    comp=${DIFF-diff} ;;
+esac
+
+OPTIONS=
+FILES=
+for ARG
+do
+    case "$ARG" in
+    -*)	OPTIONS="$OPTIONS $ARG";;
+     *)	if test -f "$ARG"; then
+            FILES="$FILES $ARG"
+        else
+            echo "${prog}: $ARG not found or not a regular file"
+	    exit 1
+        fi ;;
+    esac
+done
+if test -z "$FILES"; then
+	echo "Usage: $prog [${comp}_options] file [file]"
+	exit 1
+fi
+tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
+      echo 'cannot create a temporary file' >&2
+      exit 1
+}
+set $FILES
+if test $# -eq 1; then
+	FILE=`echo "$1" | sed 's/.bz2$//'`
+	bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
+	STAT="$?"
+
+elif test $# -eq 2; then
+	case "$1" in
+        *.bz2)
+                case "$2" in
+	        *.bz2)
+			F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
+                        bzip2 -cdfq "$2" > $tmp
+                        bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
+                        STAT="$?"
+			/bin/rm -f $tmp;;
+
+                *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
+                        STAT="$?";;
+                esac;;
+        *)      case "$2" in
+	        *.bz2)
+                        bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
+                        STAT="$?";;
+                *)      $comp $OPTIONS "$1" "$2"
+                        STAT="$?";;
+                esac;;
+	esac
+        exit "$STAT"
+else
+	echo "Usage: $prog [${comp}_options] file [file]"
+	exit 1
+fi

Added: projects/external/bzip2-1.0.5/bzdiff.1
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzdiff.1	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,47 @@
+\"Shamelessly copied from zmore.1 by Philippe Troin 
+\"for Debian GNU/Linux
+.TH BZDIFF 1
+.SH NAME
+bzcmp, bzdiff \- compare bzip2 compressed files
+.SH SYNOPSIS
+.B bzcmp
+[ cmp_options ] file1
+[ file2 ]
+.br
+.B bzdiff
+[ diff_options ] file1
+[ file2 ]
+.SH DESCRIPTION
+.I  Bzcmp
+and 
+.I bzdiff
+are used to invoke the
+.I cmp
+or the
+.I diff
+program on bzip2 compressed files.  All options specified are passed
+directly to
+.I cmp
+or
+.IR diff "."
+If only 1 file is specified, then the files compared are
+.I file1
+and an uncompressed
+.IR file1 ".bz2."
+If two files are specified, then they are uncompressed if necessary and fed to
+.I cmp
+or
+.IR diff "."
+The exit status from 
+.I cmp
+or
+.I diff
+is preserved.
+.SH "SEE ALSO"
+cmp(1), diff(1), bzmore(1), bzless(1), bzgrep(1), bzip2(1)
+.SH BUGS
+Messages from the
+.I cmp
+or
+.I diff
+programs refer to temporary filenames instead of those specified.

Added: projects/external/bzip2-1.0.5/bzgrep
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzgrep	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# Bzgrep wrapped for bzip2, 
+# adapted from zgrep by Philippe Troin  for Debian GNU/Linux.
+## zgrep notice:
+## zgrep -- a wrapper around a grep program that decompresses files as needed
+## Adapted from a version sent by Charles Levert 
+
+PATH="/usr/bin:$PATH"; export PATH
+
+prog=`echo $0 | sed 's|.*/||'`
+case "$prog" in
+	*egrep)	grep=${EGREP-egrep}	;;
+	*fgrep)	grep=${FGREP-fgrep}	;;
+	*)	grep=${GREP-grep}	;;
+esac
+pat=""
+while test $# -ne 0; do
+  case "$1" in
+  -e | -f) opt="$opt $1"; shift; pat="$1"
+           if test "$grep" = grep; then  # grep is buggy with -e on SVR4
+             grep=egrep
+           fi;;
+  -A | -B) opt="$opt $1 $2"; shift;;
+  -*)	   opt="$opt $1";;
+   *)      if test -z "$pat"; then
+	     pat="$1"
+	   else
+	     break;
+           fi;;
+  esac
+  shift
+done
+
+if test -z "$pat"; then
+  echo "grep through bzip2 files"
+  echo "usage: $prog [grep_options] pattern [files]"
+  exit 1
+fi
+
+list=0
+silent=0
+op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
+case "$op" in
+  *l*) list=1
+esac
+case "$op" in
+  *h*) silent=1
+esac
+
+if test $# -eq 0; then
+  bzip2 -cdfq | $grep $opt "$pat"
+  exit $?
+fi
+
+res=0
+for i do
+  if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
+  if test $list -eq 1; then
+    bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
+    r=$?
+  elif test $# -eq 1 -o $silent -eq 1; then
+    bzip2 -cdfq "$i" | $grep $opt "$pat"
+    r=$?
+  else
+    j=${i//\\/\\\\}
+    j=${j//|/\\|}
+    j=${j//&/\\&}
+    j=`printf "%s" "$j" | tr '\n' ' '`
+    bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
+    r=$?
+  fi
+  test "$r" -ne 0 && res="$r"
+done
+exit $res

Added: projects/external/bzip2-1.0.5/bzgrep.1
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzgrep.1	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,56 @@
+\"Shamelessly copied from zmore.1 by Philippe Troin 
+\"for Debian GNU/Linux
+.TH BZGREP 1
+.SH NAME
+bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression
+.SH SYNOPSIS
+.B bzgrep
+[ grep_options ]
+.BI  [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B bzegrep
+[ egrep_options ]
+.BI  [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.br
+.B bzfgrep
+[ fgrep_options ]
+.BI  [\ -e\ ] " pattern"
+.IR filename ".\|.\|."
+.SH DESCRIPTION
+.IR  Bzgrep
+is used to invoke the
+.I grep
+on bzip2-compressed files. All options specified are passed directly to
+.I grep.
+If no file is specified, then the standard input is decompressed
+if necessary and fed to grep.
+Otherwise the given files are uncompressed if necessary and fed to
+.I grep.
+.PP
+If
+.I bzgrep
+is invoked as
+.I bzegrep
+or
+.I bzfgrep
+then
+.I egrep
+or
+.I fgrep
+is used instead of
+.I grep.
+If the GREP environment variable is set,
+.I bzgrep
+uses it as the
+.I grep
+program to be invoked. For example:
+
+    for sh:  GREP=fgrep  bzgrep string files
+    for csh: (setenv GREP fgrep; bzgrep string files)
+.SH AUTHOR
+Charles Levert (charles at comm.polymtl.ca). Adapted to bzip2 by Philippe
+Troin  for Debian GNU/Linux.
+.SH "SEE ALSO"
+grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1)

Added: projects/external/bzip2-1.0.5/bzip.css
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip.css	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,74 @@
+/* Colours:
+#74240f  dark brown      h1, h2, h3, h4
+#336699  medium blue     links
+#339999  turquoise       link hover colour
+#202020  almost black    general text
+#761596  purple          md5sum text
+#626262  dark gray       pre border
+#eeeeee  very light gray pre background
+#f2f2f9  very light blue nav table background
+#3366cc  medium blue     nav table border
+*/
+
+a, a:link, a:visited, a:active { color: #336699; }
+a:hover { color: #339999; }
+
+body { font: 80%/126% sans-serif; }
+h1, h2, h3, h4 { color: #74240f; }
+
+dt { color: #336699; font-weight: bold }
+dd { 
+ margin-left: 1.5em; 
+ padding-bottom: 0.8em;
+}
+
+/* -- ruler -- */
+div.hr_blue { 
+  height:  3px; 
+  background:#ffffff url("/images/hr_blue.png") repeat-x; }
+div.hr_blue hr { display:none; }
+
+/* release styles */
+#release p { margin-top: 0.4em; }
+#release .md5sum { color: #761596; }
+
+
+/* ------ styles for docs|manuals|howto ------ */
+/* -- lists -- */
+ul  { 
+ margin:     0px 4px 16px 16px;
+ padding:    0px;
+ list-style: url("/images/li-blue.png"); 
+}
+ul li { 
+ margin-bottom: 10px;
+}
+ul ul	{ 
+ list-style-type:  none; 
+ list-style-image: none; 
+ margin-left:      0px; 
+}
+
+/* header / footer nav tables */
+table.nav {
+ border:     solid 1px #3366cc;
+ background: #f2f2f9;
+ background-color: #f2f2f9;
+ margin-bottom: 0.5em;
+}
+/* don't have underlined links in chunked nav menus */
+table.nav a { text-decoration: none; }
+table.nav a:hover { text-decoration: underline; }
+table.nav td { font-size: 85%; }
+
+code, tt, pre { font-size: 120%; }
+code, tt { color: #761596; }
+
+div.literallayout, pre.programlisting, pre.screen {
+ color:      #000000;
+ padding:    0.5em;
+ background: #eeeeee;
+ border:     1px solid #626262;
+ background-color: #eeeeee;
+ margin: 4px 0px 4px 0px; 
+}

Added: projects/external/bzip2-1.0.5/bzip2.1
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip2.1	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,454 @@
+.PU
+.TH bzip2 1
+.SH NAME
+bzip2, bunzip2 \- a block-sorting file compressor, v1.0.4
+.br
+bzcat \- decompresses files to stdout
+.br
+bzip2recover \- recovers data from damaged bzip2 files
+
+.SH SYNOPSIS
+.ll +8
+.B bzip2
+.RB [ " \-cdfkqstvzVL123456789 " ]
+[
+.I "filenames \&..."
+]
+.ll -8
+.br
+.B bunzip2
+.RB [ " \-fkvsVL " ]
+[ 
+.I "filenames \&..."
+]
+.br
+.B bzcat
+.RB [ " \-s " ]
+[ 
+.I "filenames \&..."
+]
+.br
+.B bzip2recover
+.I "filename"
+
+.SH DESCRIPTION
+.I bzip2
+compresses files using the Burrows-Wheeler block sorting
+text compression algorithm, and Huffman coding.  Compression is
+generally considerably better than that achieved by more conventional
+LZ77/LZ78-based compressors, and approaches the performance of the PPM
+family of statistical compressors.
+
+The command-line options are deliberately very similar to 
+those of 
+.I GNU gzip, 
+but they are not identical.
+
+.I bzip2
+expects a list of file names to accompany the
+command-line flags.  Each file is replaced by a compressed version of
+itself, with the name "original_name.bz2".  
+Each compressed file
+has the same modification date, permissions, and, when possible,
+ownership as the corresponding original, so that these properties can
+be correctly restored at decompression time.  File name handling is
+naive in the sense that there is no mechanism for preserving original
+file names, permissions, ownerships or dates in filesystems which lack
+these concepts, or have serious file name length restrictions, such as
+MS-DOS.
+
+.I bzip2
+and
+.I bunzip2
+will by default not overwrite existing
+files.  If you want this to happen, specify the \-f flag.
+
+If no file names are specified,
+.I bzip2
+compresses from standard
+input to standard output.  In this case,
+.I bzip2
+will decline to
+write compressed output to a terminal, as this would be entirely
+incomprehensible and therefore pointless.
+
+.I bunzip2
+(or
+.I bzip2 \-d) 
+decompresses all
+specified files.  Files which were not created by 
+.I bzip2
+will be detected and ignored, and a warning issued.  
+.I bzip2
+attempts to guess the filename for the decompressed file 
+from that of the compressed file as follows:
+
+       filename.bz2    becomes   filename
+       filename.bz     becomes   filename
+       filename.tbz2   becomes   filename.tar
+       filename.tbz    becomes   filename.tar
+       anyothername    becomes   anyothername.out
+
+If the file does not end in one of the recognised endings, 
+.I .bz2, 
+.I .bz, 
+.I .tbz2
+or
+.I .tbz, 
+.I bzip2 
+complains that it cannot
+guess the name of the original file, and uses the original name
+with
+.I .out
+appended.
+
+As with compression, supplying no
+filenames causes decompression from 
+standard input to standard output.
+
+.I bunzip2 
+will correctly decompress a file which is the
+concatenation of two or more compressed files.  The result is the
+concatenation of the corresponding uncompressed files.  Integrity
+testing (\-t) 
+of concatenated 
+compressed files is also supported.
+
+You can also compress or decompress files to the standard output by
+giving the \-c flag.  Multiple files may be compressed and
+decompressed like this.  The resulting outputs are fed sequentially to
+stdout.  Compression of multiple files 
+in this manner generates a stream
+containing multiple compressed file representations.  Such a stream
+can be decompressed correctly only by
+.I bzip2 
+version 0.9.0 or
+later.  Earlier versions of
+.I bzip2
+will stop after decompressing
+the first file in the stream.
+
+.I bzcat
+(or
+.I bzip2 -dc) 
+decompresses all specified files to
+the standard output.
+
+.I bzip2
+will read arguments from the environment variables
+.I BZIP2
+and
+.I BZIP,
+in that order, and will process them
+before any arguments read from the command line.  This gives a 
+convenient way to supply default arguments.
+
+Compression is always performed, even if the compressed 
+file is slightly
+larger than the original.  Files of less than about one hundred bytes
+tend to get larger, since the compression mechanism has a constant
+overhead in the region of 50 bytes.  Random data (including the output
+of most file compressors) is coded at about 8.05 bits per byte, giving
+an expansion of around 0.5%.
+
+As a self-check for your protection, 
+.I 
+bzip2
+uses 32-bit CRCs to
+make sure that the decompressed version of a file is identical to the
+original.  This guards against corruption of the compressed data, and
+against undetected bugs in
+.I bzip2
+(hopefully very unlikely).  The
+chances of data corruption going undetected is microscopic, about one
+chance in four billion for each file processed.  Be aware, though, that
+the check occurs upon decompression, so it can only tell you that
+something is wrong.  It can't help you 
+recover the original uncompressed
+data.  You can use 
+.I bzip2recover
+to try to recover data from
+damaged files.
+
+Return values: 0 for a normal exit, 1 for environmental problems (file
+not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
+compressed file, 3 for an internal consistency error (eg, bug) which
+caused
+.I bzip2
+to panic.
+
+.SH OPTIONS
+.TP
+.B \-c --stdout
+Compress or decompress to standard output.
+.TP
+.B \-d --decompress
+Force decompression.  
+.I bzip2, 
+.I bunzip2 
+and
+.I bzcat 
+are
+really the same program, and the decision about what actions to take is
+done on the basis of which name is used.  This flag overrides that
+mechanism, and forces 
+.I bzip2
+to decompress.
+.TP
+.B \-z --compress
+The complement to \-d: forces compression, regardless of the
+invocation name.
+.TP
+.B \-t --test
+Check integrity of the specified file(s), but don't decompress them.
+This really performs a trial decompression and throws away the result.
+.TP
+.B \-f --force
+Force overwrite of output files.  Normally,
+.I bzip2 
+will not overwrite
+existing output files.  Also forces 
+.I bzip2 
+to break hard links
+to files, which it otherwise wouldn't do.
+
+bzip2 normally declines to decompress files which don't have the
+correct magic header bytes.  If forced (-f), however, it will pass
+such files through unmodified.  This is how GNU gzip behaves.
+.TP
+.B \-k --keep
+Keep (don't delete) input files during compression
+or decompression.
+.TP
+.B \-s --small
+Reduce memory usage, for compression, decompression and testing.  Files
+are decompressed and tested using a modified algorithm which only
+requires 2.5 bytes per block byte.  This means any file can be
+decompressed in 2300k of memory, albeit at about half the normal speed.
+
+During compression, \-s selects a block size of 200k, which limits
+memory use to around the same figure, at the expense of your compression
+ratio.  In short, if your machine is low on memory (8 megabytes or
+less), use \-s for everything.  See MEMORY MANAGEMENT below.
+.TP
+.B \-q --quiet
+Suppress non-essential warning messages.  Messages pertaining to
+I/O errors and other critical events will not be suppressed.
+.TP
+.B \-v --verbose
+Verbose mode -- show the compression ratio for each file processed.
+Further \-v's increase the verbosity level, spewing out lots of
+information which is primarily of interest for diagnostic purposes.
+.TP
+.B \-L --license -V --version
+Display the software version, license terms and conditions.
+.TP
+.B \-1 (or \-\-fast) to \-9 (or \-\-best)
+Set the block size to 100 k, 200 k ..  900 k when compressing.  Has no
+effect when decompressing.  See MEMORY MANAGEMENT below.
+The \-\-fast and \-\-best aliases are primarily for GNU gzip 
+compatibility.  In particular, \-\-fast doesn't make things
+significantly faster.  
+And \-\-best merely selects the default behaviour.
+.TP
+.B \--
+Treats all subsequent arguments as file names, even if they start
+with a dash.  This is so you can handle files with names beginning
+with a dash, for example: bzip2 \-- \-myfilename.
+.TP
+.B \--repetitive-fast --repetitive-best
+These flags are redundant in versions 0.9.5 and above.  They provided
+some coarse control over the behaviour of the sorting algorithm in
+earlier versions, which was sometimes useful.  0.9.5 and above have an
+improved algorithm which renders these flags irrelevant.
+
+.SH MEMORY MANAGEMENT
+.I bzip2 
+compresses large files in blocks.  The block size affects
+both the compression ratio achieved, and the amount of memory needed for
+compression and decompression.  The flags \-1 through \-9
+specify the block size to be 100,000 bytes through 900,000 bytes (the
+default) respectively.  At decompression time, the block size used for
+compression is read from the header of the compressed file, and
+.I bunzip2
+then allocates itself just enough memory to decompress
+the file.  Since block sizes are stored in compressed files, it follows
+that the flags \-1 to \-9 are irrelevant to and so ignored
+during decompression.
+
+Compression and decompression requirements, 
+in bytes, can be estimated as:
+
+       Compression:   400k + ( 8 x block size )
+
+       Decompression: 100k + ( 4 x block size ), or
+                      100k + ( 2.5 x block size )
+
+Larger block sizes give rapidly diminishing marginal returns.  Most of
+the compression comes from the first two or three hundred k of block
+size, a fact worth bearing in mind when using
+.I bzip2
+on small machines.
+It is also important to appreciate that the decompression memory
+requirement is set at compression time by the choice of block size.
+
+For files compressed with the default 900k block size,
+.I bunzip2
+will require about 3700 kbytes to decompress.  To support decompression
+of any file on a 4 megabyte machine, 
+.I bunzip2
+has an option to
+decompress using approximately half this amount of memory, about 2300
+kbytes.  Decompression speed is also halved, so you should use this
+option only where necessary.  The relevant flag is -s.
+
+In general, try and use the largest block size memory constraints allow,
+since that maximises the compression achieved.  Compression and
+decompression speed are virtually unaffected by block size.
+
+Another significant point applies to files which fit in a single block
+-- that means most files you'd encounter using a large block size.  The
+amount of real memory touched is proportional to the size of the file,
+since the file is smaller than a block.  For example, compressing a file
+20,000 bytes long with the flag -9 will cause the compressor to
+allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
+kbytes of it.  Similarly, the decompressor will allocate 3700k but only
+touch 100k + 20000 * 4 = 180 kbytes.
+
+Here is a table which summarises the maximum memory usage for different
+block sizes.  Also recorded is the total compressed size for 14 files of
+the Calgary Text Compression Corpus totalling 3,141,622 bytes.  This
+column gives some feel for how compression varies with block size.
+These figures tend to understate the advantage of larger block sizes for
+larger files, since the Corpus is dominated by smaller files.
+
+           Compress   Decompress   Decompress   Corpus
+    Flag     usage      usage       -s usage     Size
+
+     -1      1200k       500k         350k      914704
+     -2      2000k       900k         600k      877703
+     -3      2800k      1300k         850k      860338
+     -4      3600k      1700k        1100k      846899
+     -5      4400k      2100k        1350k      845160
+     -6      5200k      2500k        1600k      838626
+     -7      6100k      2900k        1850k      834096
+     -8      6800k      3300k        2100k      828642
+     -9      7600k      3700k        2350k      828642
+
+.SH RECOVERING DATA FROM DAMAGED FILES
+.I bzip2
+compresses files in blocks, usually 900kbytes long.  Each
+block is handled independently.  If a media or transmission error causes
+a multi-block .bz2
+file to become damaged, it may be possible to
+recover data from the undamaged blocks in the file.
+
+The compressed representation of each block is delimited by a 48-bit
+pattern, which makes it possible to find the block boundaries with
+reasonable certainty.  Each block also carries its own 32-bit CRC, so
+damaged blocks can be distinguished from undamaged ones.
+
+.I bzip2recover
+is a simple program whose purpose is to search for
+blocks in .bz2 files, and write each block out into its own .bz2 
+file.  You can then use
+.I bzip2 
+\-t
+to test the
+integrity of the resulting files, and decompress those which are
+undamaged.
+
+.I bzip2recover
+takes a single argument, the name of the damaged file, 
+and writes a number of files "rec00001file.bz2",
+"rec00002file.bz2", etc, containing the  extracted  blocks.
+The  output  filenames  are  designed  so  that the use of
+wildcards in subsequent processing -- for example,  
+"bzip2 -dc  rec*file.bz2 > recovered_data" -- processes the files in
+the correct order.
+
+.I bzip2recover
+should be of most use dealing with large .bz2
+files,  as  these will contain many blocks.  It is clearly
+futile to use it on damaged single-block  files,  since  a
+damaged  block  cannot  be recovered.  If you wish to minimise 
+any potential data loss through media  or  transmission errors, 
+you might consider compressing with a smaller
+block size.
+
+.SH PERFORMANCE NOTES
+The sorting phase of compression gathers together similar strings in the
+file.  Because of this, files containing very long runs of repeated
+symbols, like "aabaabaabaab ..."  (repeated several hundred times) may
+compress more slowly than normal.  Versions 0.9.5 and above fare much
+better than previous versions in this respect.  The ratio between
+worst-case and average-case compression time is in the region of 10:1.
+For previous versions, this figure was more like 100:1.  You can use the
+\-vvvv option to monitor progress in great detail, if you want.
+
+Decompression speed is unaffected by these phenomena.
+
+.I bzip2
+usually allocates several megabytes of memory to operate
+in, and then charges all over it in a fairly random fashion.  This means
+that performance, both for compressing and decompressing, is largely
+determined by the speed at which your machine can service cache misses.
+Because of this, small changes to the code to reduce the miss rate have
+been observed to give disproportionately large performance improvements.
+I imagine 
+.I bzip2
+will perform best on machines with very large caches.
+
+.SH CAVEATS
+I/O error messages are not as helpful as they could be.
+.I bzip2
+tries hard to detect I/O errors and exit cleanly, but the details of
+what the problem is sometimes seem rather misleading.
+
+This manual page pertains to version 1.0.4 of
+.I bzip2.  
+Compressed data created by this version is entirely forwards and
+backwards compatible with the previous public releases, versions
+0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, but with the following
+exception: 0.9.0 and above can correctly decompress multiple
+concatenated compressed files.  0.1pl2 cannot do this; it will stop
+after decompressing just the first file in the stream.
+
+.I bzip2recover
+versions prior to 1.0.2 used 32-bit integers to represent
+bit positions in compressed files, so they could not handle compressed
+files more than 512 megabytes long.  Versions 1.0.2 and above use
+64-bit ints on some platforms which support them (GNU supported
+targets, and Windows).  To establish whether or not bzip2recover was
+built with such a limitation, run it without arguments.  In any event
+you can build yourself an unlimited version if you can recompile it
+with MaybeUInt64 set to be an unsigned 64-bit integer.
+
+
+
+.SH AUTHOR
+Julian Seward, jsewardbzip.org.
+
+http://www.bzip.org
+
+The ideas embodied in
+.I bzip2
+are due to (at least) the following
+people: Michael Burrows and David Wheeler (for the block sorting
+transformation), David Wheeler (again, for the Huffman coder), Peter
+Fenwick (for the structured coding model in the original
+.I bzip,
+and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
+(for the arithmetic coder in the original
+.I bzip).  
+I am much
+indebted for their help, support and advice.  See the manual in the
+source distribution for pointers to sources of documentation.  Christian
+von Roques encouraged me to look for faster sorting algorithms, so as to
+speed up compression.  Bela Lubkin encouraged me to improve the
+worst-case compression performance.  
+Donna Robinson XMLised the documentation.
+The bz* scripts are derived from those of GNU gzip.
+Many people sent patches, helped
+with portability problems, lent machines, gave advice and were generally
+helpful.

Added: projects/external/bzip2-1.0.5/bzip2.1.preformatted
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip2.1.preformatted	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,399 @@
+bzip2(1)                                                 bzip2(1)
+
+
+
+NNAAMMEE
+       bzip2, bunzip2 ??? a block???sorting file compressor, v1.0.4
+       bzcat ??? decompresses files to stdout
+       bzip2recover ??? recovers data from damaged bzip2 files
+
+
+SSYYNNOOPPSSIISS
+       bbzziipp22 [ ??????ccddffkkqqssttvvzzVVLL112233445566778899 ] [ _f_i_l_e_n_a_m_e_s _._._.  ]
+       bbuunnzziipp22 [ ??????ffkkvvssVVLL ] [ _f_i_l_e_n_a_m_e_s _._._.  ]
+       bbzzccaatt [ ??????ss ] [ _f_i_l_e_n_a_m_e_s _._._.  ]
+       bbzziipp22rreeccoovveerr _f_i_l_e_n_a_m_e
+
+
+DDEESSCCRRIIPPTTIIOONN
+       _b_z_i_p_2  compresses  files  using  the Burrows???Wheeler block
+       sorting text compression algorithm,  and  Huffman  coding.
+       Compression  is  generally  considerably  better than that
+       achieved by more conventional LZ77/LZ78???based compressors,
+       and  approaches  the performance of the PPM family of sta??
+       tistical compressors.
+
+       The command???line options are deliberately very similar  to
+       those of _G_N_U _g_z_i_p_, but they are not identical.
+
+       _b_z_i_p_2  expects  a list of file names to accompany the com??
+       mand???line flags.  Each file is replaced  by  a  compressed
+       version  of  itself,  with  the  name "original_name.bz2".
+       Each compressed file has the same modification date,  per??
+       missions, and, when possible, ownership as the correspond??
+       ing original, so that these properties  can  be  correctly
+       restored  at  decompression  time.   File name handling is
+       naive in the sense that there is no mechanism for preserv??
+       ing  original file names, permissions, ownerships or dates
+       in filesystems which lack these concepts, or have  serious
+       file name length restrictions, such as MS???DOS.
+
+       _b_z_i_p_2  and  _b_u_n_z_i_p_2 will by default not overwrite existing
+       files.  If you want this to happen, specify the ???f flag.
+
+       If no file names  are  specified,  _b_z_i_p_2  compresses  from
+       standard  input  to  standard output.  In this case, _b_z_i_p_2
+       will decline to write compressed output to a terminal,  as
+       this  would  be  entirely  incomprehensible  and therefore
+       pointless.
+
+       _b_u_n_z_i_p_2 (or _b_z_i_p_2 _???_d_) decompresses  all  specified  files.
+       Files which were not created by _b_z_i_p_2 will be detected and
+       ignored, and a warning issued.  _b_z_i_p_2  attempts  to  guess
+       the  filename  for  the decompressed file from that of the
+       compressed file as follows:
+
+              filename.bz2    becomes   filename
+              filename.bz     becomes   filename
+              filename.tbz2   becomes   filename.tar
+              filename.tbz    becomes   filename.tar
+              anyothername    becomes   anyothername.out
+
+       If the file does not end in one of the recognised endings,
+       _._b_z_2_,  _._b_z_,  _._t_b_z_2 or _._t_b_z_, _b_z_i_p_2 complains that it cannot
+       guess the name of the original file, and uses the original
+       name with _._o_u_t appended.
+
+       As  with compression, supplying no filenames causes decom??
+       pression from standard input to standard output.
+
+       _b_u_n_z_i_p_2 will correctly decompress a file which is the con??
+       catenation of two or more compressed files.  The result is
+       the concatenation of the corresponding uncompressed files.
+       Integrity testing (???t) of concatenated compressed files is
+       also supported.
+
+       You can also compress or decompress files to the  standard
+       output  by giving the ???c flag.  Multiple files may be com??
+       pressed and decompressed like this.  The resulting outputs
+       are  fed  sequentially to stdout.  Compression of multiple
+       files in this manner generates a stream containing  multi??
+       ple compressed file representations.  Such a stream can be
+       decompressed correctly only  by  _b_z_i_p_2  version  0.9.0  or
+       later.   Earlier  versions of _b_z_i_p_2 will stop after decom??
+       pressing the first file in the stream.
+
+       _b_z_c_a_t (or _b_z_i_p_2 _???_d_c_) decompresses all specified  files  to
+       the standard output.
+
+       _b_z_i_p_2  will  read arguments from the environment variables
+       _B_Z_I_P_2 and _B_Z_I_P_, in  that  order,  and  will  process  them
+       before  any  arguments  read  from the command line.  This
+       gives a convenient way to supply default arguments.
+
+       Compression is always performed, even  if  the  compressed
+       file  is slightly larger than the original.  Files of less
+       than about one hundred bytes tend to get larger, since the
+       compression  mechanism  has  a  constant  overhead  in the
+       region of 50 bytes.  Random data (including the output  of
+       most  file  compressors)  is  coded at about 8.05 bits per
+       byte, giving an expansion of around 0.5%.
+
+       As a self???check for your  protection,  _b_z_i_p_2  uses  32???bit
+       CRCs  to make sure that the decompressed version of a file
+       is identical to the original.  This guards against corrup??
+       tion  of  the compressed data, and against undetected bugs
+       in _b_z_i_p_2 (hopefully very unlikely).  The chances  of  data
+       corruption  going  undetected  is  microscopic,  about one
+       chance in four billion for each file processed.  Be aware,
+       though,  that  the  check occurs upon decompression, so it
+       can only tell you that something is wrong.  It can???t  help
+       you  recover  the original uncompressed data.  You can use
+       _b_z_i_p_2_r_e_c_o_v_e_r to try to recover data from damaged files.
+
+       Return values: 0 for a normal exit,  1  for  environmental
+       problems  (file not found, invalid flags, I/O errors, &c),
+       2 to indicate a corrupt compressed file, 3 for an internal
+       consistency error (eg, bug) which caused _b_z_i_p_2 to panic.
+
+
+OOPPTTIIOONNSS
+       ??????cc ????????????ssttddoouutt
+              Compress or decompress to standard output.
+
+       ??????dd ????????????ddeeccoommpprreessss
+              Force  decompression.  _b_z_i_p_2_, _b_u_n_z_i_p_2 and _b_z_c_a_t are
+              really the same program,  and  the  decision  about
+              what  actions to take is done on the basis of which
+              name is used.  This flag overrides that  mechanism,
+              and forces _b_z_i_p_2 to decompress.
+
+       ??????zz ????????????ccoommpprreessss
+              The   complement   to   ???d:   forces   compression,
+              regardless of the invocation name.
+
+       ??????tt ????????????tteesstt
+              Check integrity of the specified file(s), but don???t
+              decompress  them.   This  really  performs  a trial
+              decompression and throws away the result.
+
+       ??????ff ????????????ffoorrccee
+              Force overwrite of output files.   Normally,  _b_z_i_p_2
+              will  not  overwrite  existing  output files.  Also
+              forces _b_z_i_p_2 to break hard links to files, which it
+              otherwise wouldn???t do.
+
+              bzip2  normally  declines to decompress files which
+              don???t have the  correct  magic  header  bytes.   If
+              forced  (???f),  however,  it  will  pass  such files
+              through unmodified.  This is how GNU gzip  behaves.
+
+       ??????kk ????????????kkeeeepp
+              Keep  (don???t delete) input files during compression
+              or decompression.
+
+       ??????ss ????????????ssmmaallll
+              Reduce memory usage, for compression, decompression
+              and  testing.   Files  are  decompressed and tested
+              using a modified algorithm which only requires  2.5
+              bytes  per  block byte.  This means any file can be
+              decompressed in 2300k of memory,  albeit  at  about
+              half the normal speed.
+
+              During  compression,  ???s  selects  a  block size of
+              200k, which limits memory use to  around  the  same
+              figure,  at  the expense of your compression ratio.
+              In short, if your  machine  is  low  on  memory  (8
+              megabytes  or  less),  use  ???s for everything.  See
+              MEMORY MANAGEMENT below.
+
+       ??????qq ????????????qquuiieett
+              Suppress non???essential warning messages.   Messages
+              pertaining  to I/O errors and other critical events
+              will not be suppressed.
+
+       ??????vv ????????????vveerrbboossee
+              Verbose mode ?????? show the compression ratio for each
+              file  processed.   Further  ???v???s  increase the ver??
+              bosity level, spewing out lots of information which
+              is primarily of interest for diagnostic purposes.
+
+       ??????LL ????????????lliicceennssee ??????VV ????????????vveerrssiioonn
+              Display  the  software  version,  license terms and
+              conditions.
+
+       ??????11 ((oorr ????????????ffaasstt)) ttoo ??????99 ((oorr ????????????bbeesstt))
+              Set the block size to 100 k, 200 k ..  900  k  when
+              compressing.   Has  no  effect  when decompressing.
+              See MEMORY MANAGEMENT below.  The ??????fast and ??????best
+              aliases  are  primarily for GNU gzip compatibility.
+              In particular, ??????fast doesn???t make things  signifi??
+              cantly  faster.   And  ??????best  merely  selects  the
+              default behaviour.
+
+       ????????????     Treats all subsequent arguments as file names, even
+              if they start with a dash.  This is so you can han??
+              dle files with names beginning  with  a  dash,  for
+              example: bzip2 ?????? ???myfilename.
+
+       ????????????rreeppeettiittiivvee??????ffaasstt ????????????rreeppeettiittiivvee??????bbeesstt
+              These  flags  are  redundant  in versions 0.9.5 and
+              above.  They provided some coarse control over  the
+              behaviour  of the sorting algorithm in earlier ver??
+              sions, which was sometimes useful.  0.9.5 and above
+              have  an  improved  algorithm  which  renders these
+              flags irrelevant.
+
+
+MMEEMMOORRYY MMAANNAAGGEEMMEENNTT
+       _b_z_i_p_2 compresses large files in blocks.   The  block  size
+       affects  both  the  compression  ratio  achieved,  and the
+       amount of memory needed for compression and decompression.
+       The  flags  ???1  through  ???9  specify  the block size to be
+       100,000 bytes through 900,000 bytes (the default)  respec??
+       tively.   At  decompression  time, the block size used for
+       compression is read from  the  header  of  the  compressed
+       file, and _b_u_n_z_i_p_2 then allocates itself just enough memory
+       to decompress the file.  Since block sizes are  stored  in
+       compressed  files,  it follows that the flags ???1 to ???9 are
+       irrelevant to and so ignored during decompression.
+
+       Compression and decompression requirements, in bytes,  can
+       be estimated as:
+
+              Compression:   400k + ( 8 x block size )
+
+              Decompression: 100k + ( 4 x block size ), or
+                             100k + ( 2.5 x block size )
+
+       Larger  block  sizes  give  rapidly  diminishing  marginal
+       returns.  Most of the compression comes from the first two
+       or  three hundred k of block size, a fact worth bearing in
+       mind when using _b_z_i_p_2  on  small  machines.   It  is  also
+       important  to  appreciate  that  the  decompression memory
+       requirement is set at compression time by  the  choice  of
+       block size.
+
+       For  files  compressed  with  the default 900k block size,
+       _b_u_n_z_i_p_2 will require about 3700 kbytes to decompress.   To
+       support decompression of any file on a 4 megabyte machine,
+       _b_u_n_z_i_p_2 has an option to  decompress  using  approximately
+       half this amount of memory, about 2300 kbytes.  Decompres??
+       sion speed is also halved, so you should use  this  option
+       only where necessary.  The relevant flag is ???s.
+
+       In general, try and use the largest block size memory con??
+       straints  allow,  since  that  maximises  the  compression
+       achieved.   Compression and decompression speed are virtu??
+       ally unaffected by block size.
+
+       Another significant point applies to files which fit in  a
+       single  block  ??????  that  means  most files you???d encounter
+       using a large block  size.   The  amount  of  real  memory
+       touched is proportional to the size of the file, since the
+       file is smaller than a block.  For example, compressing  a
+       file  20,000  bytes  long  with the flag ???9 will cause the
+       compressor to allocate around 7600k of  memory,  but  only
+       touch 400k + 20000 * 8 = 560 kbytes of it.  Similarly, the
+       decompressor will allocate 3700k but  only  touch  100k  +
+       20000 * 4 = 180 kbytes.
+
+       Here  is a table which summarises the maximum memory usage
+       for different block sizes.  Also  recorded  is  the  total
+       compressed  size for 14 files of the Calgary Text Compres??
+       sion Corpus totalling 3,141,622 bytes.  This column  gives
+       some  feel  for  how  compression  varies with block size.
+       These figures tend to understate the advantage  of  larger
+       block  sizes  for  larger files, since the Corpus is domi??
+       nated by smaller files.
+
+                  Compress   Decompress   Decompress   Corpus
+           Flag     usage      usage       ???s usage     Size
+
+            ???1      1200k       500k         350k      914704
+            ???2      2000k       900k         600k      877703
+            ???3      2800k      1300k         850k      860338
+            ???4      3600k      1700k        1100k      846899
+            ???5      4400k      2100k        1350k      845160
+            ???6      5200k      2500k        1600k      838626
+            ???7      6100k      2900k        1850k      834096
+            ???8      6800k      3300k        2100k      828642
+            ???9      7600k      3700k        2350k      828642
+
+
+RREECCOOVVEERRIINNGG DDAATTAA FFRROOMM DDAAMMAAGGEEDD FFIILLEESS
+       _b_z_i_p_2 compresses files in blocks, usually 900kbytes  long.
+       Each block is handled independently.  If a media or trans??
+       mission error causes a multi???block  .bz2  file  to  become
+       damaged,  it  may  be  possible  to  recover data from the
+       undamaged blocks in the file.
+
+       The compressed representation of each block  is  delimited
+       by  a  48???bit pattern, which makes it possible to find the
+       block boundaries with reasonable  certainty.   Each  block
+       also  carries its own 32???bit CRC, so damaged blocks can be
+       distinguished from undamaged ones.
+
+       _b_z_i_p_2_r_e_c_o_v_e_r is a  simple  program  whose  purpose  is  to
+       search  for blocks in .bz2 files, and write each block out
+       into its own .bz2 file.  You can then use _b_z_i_p_2 ???t to test
+       the integrity of the resulting files, and decompress those
+       which are undamaged.
+
+       _b_z_i_p_2_r_e_c_o_v_e_r takes a single argument, the name of the dam??
+       aged    file,    and    writes    a    number   of   files
+       "rec00001file.bz2",  "rec00002file.bz2",  etc,  containing
+       the   extracted   blocks.   The   output   filenames   are
+       designed  so  that the use of wildcards in subsequent pro??
+       cessing  ?????? for example, "bzip2 ???dc  rec*file.bz2 > recov??
+       ered_data" ?????? processes the files in the correct order.
+
+       _b_z_i_p_2_r_e_c_o_v_e_r should be of most use dealing with large .bz2
+       files,  as  these will contain many blocks.  It is clearly
+       futile to use it on damaged single???block  files,  since  a
+       damaged  block  cannot  be recovered.  If you wish to min??
+       imise any potential data loss through media  or  transmis??
+       sion errors, you might consider compressing with a smaller
+       block size.
+
+
+PPEERRFFOORRMMAANNCCEE NNOOTTEESS
+       The sorting phase of compression gathers together  similar
+       strings  in  the  file.  Because of this, files containing
+       very long runs of  repeated  symbols,  like  "aabaabaabaab
+       ..."   (repeated  several hundred times) may compress more
+       slowly than normal.  Versions 0.9.5 and  above  fare  much
+       better  than previous versions in this respect.  The ratio
+       between worst???case and average???case compression time is in
+       the  region  of  10:1.  For previous versions, this figure
+       was more like 100:1.  You can use the ???vvvv option to mon??
+       itor progress in great detail, if you want.
+
+       Decompression speed is unaffected by these phenomena.
+
+       _b_z_i_p_2  usually  allocates  several  megabytes of memory to
+       operate in, and then charges all over it in a fairly  ran??
+       dom  fashion.   This means that performance, both for com??
+       pressing and decompressing, is largely determined  by  the
+       speed  at  which  your  machine  can service cache misses.
+       Because of this, small changes to the code to  reduce  the
+       miss  rate  have  been observed to give disproportionately
+       large performance improvements.  I imagine _b_z_i_p_2 will per??
+       form best on machines with very large caches.
+
+
+CCAAVVEEAATTSS
+       I/O  error  messages  are not as helpful as they could be.
+       _b_z_i_p_2 tries hard to detect I/O errors  and  exit  cleanly,
+       but  the  details  of  what  the problem is sometimes seem
+       rather misleading.
+
+       This manual page pertains to version 1.0.4 of _b_z_i_p_2_.  Com??
+       pressed  data created by this version is entirely forwards
+       and  backwards  compatible  with   the   previous   public
+       releases,  versions  0.1pl2,  0.9.0,  0.9.5, 1.0.0, 1.0.1, 
+       1.0.2 and 1.0.3, but with the  following  exception: 0.9.0
+       and above can  correctly decompress  multiple concatenated
+       compressed files.  0.1pl2  cannot do this;  it  will  stop 
+       after  decompressing just the first file in the stream.
+
+       _b_z_i_p_2_r_e_c_o_v_e_r  versions prior to 1.0.2 used 32???bit integers
+       to represent bit positions in compressed  files,  so  they
+       could  not handle compressed files more than 512 megabytes
+       long.  Versions 1.0.2 and above use 64???bit  ints  on  some
+       platforms  which  support them (GNU supported targets, and
+       Windows).  To establish whether or  not  bzip2recover  was
+       built  with  such  a limitation, run it without arguments.
+       In any event you can build yourself an  unlimited  version
+       if  you  can  recompile  it  with MaybeUInt64 set to be an
+       unsigned 64???bit integer.
+
+
+
+
+AAUUTTHHOORR
+       Julian Seward, jsewardbzip.org.
+
+       http://www.bzip.org
+
+       The ideas embodied in _b_z_i_p_2 are due to (at least) the fol??
+       lowing  people: Michael Burrows and David Wheeler (for the
+       block sorting transformation), David Wheeler  (again,  for
+       the Huffman coder), Peter Fenwick (for the structured cod??
+       ing model in the original _b_z_i_p_, and many refinements), and
+       Alistair  Moffat,  Radford  Neal  and  Ian Witten (for the
+       arithmetic  coder  in  the  original  _b_z_i_p_)_.   I  am  much
+       indebted for their help, support and advice.  See the man??
+       ual in the source distribution for pointers to sources  of
+       documentation.  Christian von Roques encouraged me to look
+       for faster sorting algorithms, so as to speed up  compres??
+       sion.  Bela Lubkin encouraged me to improve the worst???case
+       compression performance.  Donna Robinson XMLised the docu??
+       mentation.   The bz* scripts are derived from those of GNU
+       gzip.  Many people sent patches, helped  with  portability
+       problems,  lent  machines,  gave advice and were generally
+       helpful.
+
+
+
+                                                         bzip2(1)

Added: projects/external/bzip2-1.0.5/bzip2.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip2.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,2034 @@
+
+/*-----------------------------------------------------------*/
+/*--- A block-sorting, lossless compressor        bzip2.c ---*/
+/*-----------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+/* Place a 1 beside your platform, and 0 elsewhere.
+   Generic 32-bit Unix.
+   Also works on 64-bit Unix boxes.
+   This is the default.
+*/
+#define BZ_UNIX      1
+
+/*--
+  Win32, as seen by Jacob Navia's excellent
+  port of (Chris Fraser & David Hanson)'s excellent
+  lcc compiler.  Or with MS Visual C.
+  This is selected automatically if compiled by a compiler which
+  defines _WIN32, not including the Cygwin GCC.
+--*/
+#define BZ_LCCWIN32  0
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#undef  BZ_LCCWIN32
+#define BZ_LCCWIN32 1
+#undef  BZ_UNIX
+#define BZ_UNIX 0
+#endif
+
+
+/*---------------------------------------------*/
+/*--
+  Some stuff for all platforms.
+--*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "bzlib.h"
+
+#define ERROR_IF_EOF(i)       { if ((i) == EOF)  ioError(); }
+#define ERROR_IF_NOT_ZERO(i)  { if ((i) != 0)    ioError(); }
+#define ERROR_IF_MINUS_ONE(i) { if ((i) == (-1)) ioError(); }
+
+
+/*---------------------------------------------*/
+/*--
+   Platform-specific stuff.
+--*/
+
+#if BZ_UNIX
+#   include 
+#   include 
+#   include 
+#   include 
+#   include 
+#   include 
+
+#   define PATH_SEP    '/'
+#   define MY_LSTAT    lstat
+#   define MY_STAT     stat
+#   define MY_S_ISREG  S_ISREG
+#   define MY_S_ISDIR  S_ISDIR
+
+#   define APPEND_FILESPEC(root, name) \
+      root=snocString((root), (name))
+
+#   define APPEND_FLAG(root, name) \
+      root=snocString((root), (name))
+
+#   define SET_BINARY_MODE(fd) /**/
+
+#   ifdef __GNUC__
+#      define NORETURN __attribute__ ((noreturn))
+#   else
+#      define NORETURN /**/
+#   endif
+
+#   ifdef __DJGPP__
+#     include 
+#     include 
+#     undef MY_LSTAT
+#     undef MY_STAT
+#     define MY_LSTAT stat
+#     define MY_STAT stat
+#     undef SET_BINARY_MODE
+#     define SET_BINARY_MODE(fd)                        \
+        do {                                            \
+           int retVal = setmode ( fileno ( fd ),        \
+                                  O_BINARY );           \
+           ERROR_IF_MINUS_ONE ( retVal );               \
+        } while ( 0 )
+#   endif
+
+#   ifdef __CYGWIN__
+#     include 
+#     include 
+#     undef SET_BINARY_MODE
+#     define SET_BINARY_MODE(fd)                        \
+        do {                                            \
+           int retVal = setmode ( fileno ( fd ),        \
+                                  O_BINARY );           \
+           ERROR_IF_MINUS_ONE ( retVal );               \
+        } while ( 0 )
+#   endif
+#endif /* BZ_UNIX */
+
+
+
+#if BZ_LCCWIN32
+#   include 
+#   include 
+#   include 
+
+#   define NORETURN       /**/
+#   define PATH_SEP       '\\'
+#   define MY_LSTAT       _stat
+#   define MY_STAT        _stat
+#   define MY_S_ISREG(x)  ((x) & _S_IFREG)
+#   define MY_S_ISDIR(x)  ((x) & _S_IFDIR)
+
+#   define APPEND_FLAG(root, name) \
+      root=snocString((root), (name))
+
+#   define APPEND_FILESPEC(root, name)                \
+      root = snocString ((root), (name))
+
+#   define SET_BINARY_MODE(fd)                        \
+      do {                                            \
+         int retVal = setmode ( fileno ( fd ),        \
+                                O_BINARY );           \
+         ERROR_IF_MINUS_ONE ( retVal );               \
+      } while ( 0 )
+
+#endif /* BZ_LCCWIN32 */
+
+
+/*---------------------------------------------*/
+/*--
+  Some more stuff for all platforms :-)
+--*/
+
+typedef char            Char;
+typedef unsigned char   Bool;
+typedef unsigned char   UChar;
+typedef int             Int32;
+typedef unsigned int    UInt32;
+typedef short           Int16;
+typedef unsigned short  UInt16;
+                                       
+#define True  ((Bool)1)
+#define False ((Bool)0)
+
+/*--
+  IntNative is your platform's `native' int size.
+  Only here to avoid probs with 64-bit platforms.
+--*/
+typedef int IntNative;
+
+
+/*---------------------------------------------------*/
+/*--- Misc (file handling) data decls             ---*/
+/*---------------------------------------------------*/
+
+Int32   verbosity;
+Bool    keepInputFiles, smallMode, deleteOutputOnInterrupt;
+Bool    forceOverwrite, testFailsExist, unzFailsExist, noisy;
+Int32   numFileNames, numFilesProcessed, blockSize100k;
+Int32   exitValue;
+
+/*-- source modes; F==file, I==stdin, O==stdout --*/
+#define SM_I2O           1
+#define SM_F2O           2
+#define SM_F2F           3
+
+/*-- operation modes --*/
+#define OM_Z             1
+#define OM_UNZ           2
+#define OM_TEST          3
+
+Int32   opMode;
+Int32   srcMode;
+
+#define FILE_NAME_LEN 1034
+
+Int32   longestFileName;
+Char    inName [FILE_NAME_LEN];
+Char    outName[FILE_NAME_LEN];
+Char    tmpName[FILE_NAME_LEN];
+Char    *progName;
+Char    progNameReally[FILE_NAME_LEN];
+FILE    *outputHandleJustInCase;
+Int32   workFactor;
+
+static void    panic                 ( const Char* ) NORETURN;
+static void    ioError               ( void )        NORETURN;
+static void    outOfMemory           ( void )        NORETURN;
+static void    configError           ( void )        NORETURN;
+static void    crcError              ( void )        NORETURN;
+static void    cleanUpAndFail        ( Int32 )       NORETURN;
+static void    compressedStreamEOF   ( void )        NORETURN;
+
+static void    copyFileName ( Char*, Char* );
+static void*   myMalloc     ( Int32 );
+static void    applySavedFileAttrToOutputFile ( IntNative fd );
+
+
+
+/*---------------------------------------------------*/
+/*--- An implementation of 64-bit ints.  Sigh.    ---*/
+/*--- Roll on widespread deployment of ANSI C9X ! ---*/
+/*---------------------------------------------------*/
+
+typedef
+   struct { UChar b[8]; } 
+   UInt64;
+
+
+static
+void uInt64_from_UInt32s ( UInt64* n, UInt32 lo32, UInt32 hi32 )
+{
+   n->b[7] = (UChar)((hi32 >> 24) & 0xFF);
+   n->b[6] = (UChar)((hi32 >> 16) & 0xFF);
+   n->b[5] = (UChar)((hi32 >> 8)  & 0xFF);
+   n->b[4] = (UChar) (hi32        & 0xFF);
+   n->b[3] = (UChar)((lo32 >> 24) & 0xFF);
+   n->b[2] = (UChar)((lo32 >> 16) & 0xFF);
+   n->b[1] = (UChar)((lo32 >> 8)  & 0xFF);
+   n->b[0] = (UChar) (lo32        & 0xFF);
+}
+
+
+static
+double uInt64_to_double ( UInt64* n )
+{
+   Int32  i;
+   double base = 1.0;
+   double sum  = 0.0;
+   for (i = 0; i < 8; i++) {
+      sum  += base * (double)(n->b[i]);
+      base *= 256.0;
+   }
+   return sum;
+}
+
+
+static
+Bool uInt64_isZero ( UInt64* n )
+{
+   Int32 i;
+   for (i = 0; i < 8; i++)
+      if (n->b[i] != 0) return 0;
+   return 1;
+}
+
+
+/* Divide *n by 10, and return the remainder.  */
+static 
+Int32 uInt64_qrm10 ( UInt64* n )
+{
+   UInt32 rem, tmp;
+   Int32  i;
+   rem = 0;
+   for (i = 7; i >= 0; i--) {
+      tmp = rem * 256 + n->b[i];
+      n->b[i] = tmp / 10;
+      rem = tmp % 10;
+   }
+   return rem;
+}
+
+
+/* ... and the Whole Entire Point of all this UInt64 stuff is
+   so that we can supply the following function.
+*/
+static
+void uInt64_toAscii ( char* outbuf, UInt64* n )
+{
+   Int32  i, q;
+   UChar  buf[32];
+   Int32  nBuf   = 0;
+   UInt64 n_copy = *n;
+   do {
+      q = uInt64_qrm10 ( &n_copy );
+      buf[nBuf] = q + '0';
+      nBuf++;
+   } while (!uInt64_isZero(&n_copy));
+   outbuf[nBuf] = 0;
+   for (i = 0; i < nBuf; i++) 
+      outbuf[i] = buf[nBuf-i-1];
+}
+
+
+/*---------------------------------------------------*/
+/*--- Processing of complete files and streams    ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static 
+Bool myfeof ( FILE* f )
+{
+   Int32 c = fgetc ( f );
+   if (c == EOF) return True;
+   ungetc ( c, f );
+   return False;
+}
+
+
+/*---------------------------------------------*/
+static 
+void compressStream ( FILE *stream, FILE *zStream )
+{
+   BZFILE* bzf = NULL;
+   UChar   ibuf[5000];
+   Int32   nIbuf;
+   UInt32  nbytes_in_lo32, nbytes_in_hi32;
+   UInt32  nbytes_out_lo32, nbytes_out_hi32;
+   Int32   bzerr, bzerr_dummy, ret;
+
+   SET_BINARY_MODE(stream);
+   SET_BINARY_MODE(zStream);
+
+   if (ferror(stream)) goto errhandler_io;
+   if (ferror(zStream)) goto errhandler_io;
+
+   bzf = BZ2_bzWriteOpen ( &bzerr, zStream, 
+                           blockSize100k, verbosity, workFactor );   
+   if (bzerr != BZ_OK) goto errhandler;
+
+   if (verbosity >= 2) fprintf ( stderr, "\n" );
+
+   while (True) {
+
+      if (myfeof(stream)) break;
+      nIbuf = fread ( ibuf, sizeof(UChar), 5000, stream );
+      if (ferror(stream)) goto errhandler_io;
+      if (nIbuf > 0) BZ2_bzWrite ( &bzerr, bzf, (void*)ibuf, nIbuf );
+      if (bzerr != BZ_OK) goto errhandler;
+
+   }
+
+   BZ2_bzWriteClose64 ( &bzerr, bzf, 0, 
+                        &nbytes_in_lo32, &nbytes_in_hi32,
+                        &nbytes_out_lo32, &nbytes_out_hi32 );
+   if (bzerr != BZ_OK) goto errhandler;
+
+   if (ferror(zStream)) goto errhandler_io;
+   ret = fflush ( zStream );
+   if (ret == EOF) goto errhandler_io;
+   if (zStream != stdout) {
+      Int32 fd = fileno ( zStream );
+      if (fd < 0) goto errhandler_io;
+      applySavedFileAttrToOutputFile ( fd );
+      ret = fclose ( zStream );
+      outputHandleJustInCase = NULL;
+      if (ret == EOF) goto errhandler_io;
+   }
+   outputHandleJustInCase = NULL;
+   if (ferror(stream)) goto errhandler_io;
+   ret = fclose ( stream );
+   if (ret == EOF) goto errhandler_io;
+
+   if (verbosity >= 1) {
+      if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) {
+	 fprintf ( stderr, " no data compressed.\n");
+      } else {
+	 Char   buf_nin[32], buf_nout[32];
+	 UInt64 nbytes_in,   nbytes_out;
+	 double nbytes_in_d, nbytes_out_d;
+	 uInt64_from_UInt32s ( &nbytes_in, 
+			       nbytes_in_lo32, nbytes_in_hi32 );
+	 uInt64_from_UInt32s ( &nbytes_out, 
+			       nbytes_out_lo32, nbytes_out_hi32 );
+	 nbytes_in_d  = uInt64_to_double ( &nbytes_in );
+	 nbytes_out_d = uInt64_to_double ( &nbytes_out );
+	 uInt64_toAscii ( buf_nin, &nbytes_in );
+	 uInt64_toAscii ( buf_nout, &nbytes_out );
+	 fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, "
+		   "%5.2f%% saved, %s in, %s out.\n",
+		   nbytes_in_d / nbytes_out_d,
+		   (8.0 * nbytes_out_d) / nbytes_in_d,
+		   100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
+		   buf_nin,
+		   buf_nout
+		 );
+      }
+   }
+
+   return;
+
+   errhandler:
+   BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, 
+                        &nbytes_in_lo32, &nbytes_in_hi32,
+                        &nbytes_out_lo32, &nbytes_out_hi32 );
+   switch (bzerr) {
+      case BZ_CONFIG_ERROR:
+         configError(); break;
+      case BZ_MEM_ERROR:
+         outOfMemory (); break;
+      case BZ_IO_ERROR:
+         errhandler_io:
+         ioError(); break;
+      default:
+         panic ( "compress:unexpected error" );
+   }
+
+   panic ( "compress:end" );
+   /*notreached*/
+}
+
+
+
+/*---------------------------------------------*/
+static 
+Bool uncompressStream ( FILE *zStream, FILE *stream )
+{
+   BZFILE* bzf = NULL;
+   Int32   bzerr, bzerr_dummy, ret, nread, streamNo, i;
+   UChar   obuf[5000];
+   UChar   unused[BZ_MAX_UNUSED];
+   Int32   nUnused;
+   void*   unusedTmpV;
+   UChar*  unusedTmp;
+
+   nUnused = 0;
+   streamNo = 0;
+
+   SET_BINARY_MODE(stream);
+   SET_BINARY_MODE(zStream);
+
+   if (ferror(stream)) goto errhandler_io;
+   if (ferror(zStream)) goto errhandler_io;
+
+   while (True) {
+
+      bzf = BZ2_bzReadOpen ( 
+               &bzerr, zStream, verbosity, 
+               (int)smallMode, unused, nUnused
+            );
+      if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
+      streamNo++;
+
+      while (bzerr == BZ_OK) {
+         nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
+         if (bzerr == BZ_DATA_ERROR_MAGIC) goto trycat;
+         if ((bzerr == BZ_OK || bzerr == BZ_STREAM_END) && nread > 0)
+            fwrite ( obuf, sizeof(UChar), nread, stream );
+         if (ferror(stream)) goto errhandler_io;
+      }
+      if (bzerr != BZ_STREAM_END) goto errhandler;
+
+      BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
+      if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
+
+      unusedTmp = (UChar*)unusedTmpV;
+      for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
+
+      BZ2_bzReadClose ( &bzerr, bzf );
+      if (bzerr != BZ_OK) panic ( "decompress:bzReadGetUnused" );
+
+      if (nUnused == 0 && myfeof(zStream)) break;
+   }
+
+   closeok:
+   if (ferror(zStream)) goto errhandler_io;
+   if (stream != stdout) {
+      Int32 fd = fileno ( stream );
+      if (fd < 0) goto errhandler_io;
+      applySavedFileAttrToOutputFile ( fd );
+   }
+   ret = fclose ( zStream );
+   if (ret == EOF) goto errhandler_io;
+
+   if (ferror(stream)) goto errhandler_io;
+   ret = fflush ( stream );
+   if (ret != 0) goto errhandler_io;
+   if (stream != stdout) {
+      ret = fclose ( stream );
+      outputHandleJustInCase = NULL;
+      if (ret == EOF) goto errhandler_io;
+   }
+   outputHandleJustInCase = NULL;
+   if (verbosity >= 2) fprintf ( stderr, "\n    " );
+   return True;
+
+   trycat: 
+   if (forceOverwrite) {
+      rewind(zStream);
+      while (True) {
+      	 if (myfeof(zStream)) break;
+      	 nread = fread ( obuf, sizeof(UChar), 5000, zStream );
+      	 if (ferror(zStream)) goto errhandler_io;
+      	 if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream );
+      	 if (ferror(stream)) goto errhandler_io;
+      }
+      goto closeok;
+   }
+  
+   errhandler:
+   BZ2_bzReadClose ( &bzerr_dummy, bzf );
+   switch (bzerr) {
+      case BZ_CONFIG_ERROR:
+         configError(); break;
+      case BZ_IO_ERROR:
+         errhandler_io:
+         ioError(); break;
+      case BZ_DATA_ERROR:
+         crcError();
+      case BZ_MEM_ERROR:
+         outOfMemory();
+      case BZ_UNEXPECTED_EOF:
+         compressedStreamEOF();
+      case BZ_DATA_ERROR_MAGIC:
+         if (zStream != stdin) fclose(zStream);
+         if (stream != stdout) fclose(stream);
+         if (streamNo == 1) {
+            return False;
+         } else {
+            if (noisy)
+            fprintf ( stderr, 
+                      "\n%s: %s: trailing garbage after EOF ignored\n",
+                      progName, inName );
+            return True;       
+         }
+      default:
+         panic ( "decompress:unexpected error" );
+   }
+
+   panic ( "decompress:end" );
+   return True; /*notreached*/
+}
+
+
+/*---------------------------------------------*/
+static 
+Bool testStream ( FILE *zStream )
+{
+   BZFILE* bzf = NULL;
+   Int32   bzerr, bzerr_dummy, ret, nread, streamNo, i;
+   UChar   obuf[5000];
+   UChar   unused[BZ_MAX_UNUSED];
+   Int32   nUnused;
+   void*   unusedTmpV;
+   UChar*  unusedTmp;
+
+   nUnused = 0;
+   streamNo = 0;
+
+   SET_BINARY_MODE(zStream);
+   if (ferror(zStream)) goto errhandler_io;
+
+   while (True) {
+
+      bzf = BZ2_bzReadOpen ( 
+               &bzerr, zStream, verbosity, 
+               (int)smallMode, unused, nUnused
+            );
+      if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
+      streamNo++;
+
+      while (bzerr == BZ_OK) {
+         nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
+         if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler;
+      }
+      if (bzerr != BZ_STREAM_END) goto errhandler;
+
+      BZ2_bzReadGetUnused ( &bzerr, bzf, &unusedTmpV, &nUnused );
+      if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
+
+      unusedTmp = (UChar*)unusedTmpV;
+      for (i = 0; i < nUnused; i++) unused[i] = unusedTmp[i];
+
+      BZ2_bzReadClose ( &bzerr, bzf );
+      if (bzerr != BZ_OK) panic ( "test:bzReadGetUnused" );
+      if (nUnused == 0 && myfeof(zStream)) break;
+
+   }
+
+   if (ferror(zStream)) goto errhandler_io;
+   ret = fclose ( zStream );
+   if (ret == EOF) goto errhandler_io;
+
+   if (verbosity >= 2) fprintf ( stderr, "\n    " );
+   return True;
+
+   errhandler:
+   BZ2_bzReadClose ( &bzerr_dummy, bzf );
+   if (verbosity == 0) 
+      fprintf ( stderr, "%s: %s: ", progName, inName );
+   switch (bzerr) {
+      case BZ_CONFIG_ERROR:
+         configError(); break;
+      case BZ_IO_ERROR:
+         errhandler_io:
+         ioError(); break;
+      case BZ_DATA_ERROR:
+         fprintf ( stderr,
+                   "data integrity (CRC) error in data\n" );
+         return False;
+      case BZ_MEM_ERROR:
+         outOfMemory();
+      case BZ_UNEXPECTED_EOF:
+         fprintf ( stderr,
+                   "file ends unexpectedly\n" );
+         return False;
+      case BZ_DATA_ERROR_MAGIC:
+         if (zStream != stdin) fclose(zStream);
+         if (streamNo == 1) {
+          fprintf ( stderr, 
+                    "bad magic number (file not created by bzip2)\n" );
+            return False;
+         } else {
+            if (noisy)
+            fprintf ( stderr, 
+                      "trailing garbage after EOF ignored\n" );
+            return True;       
+         }
+      default:
+         panic ( "test:unexpected error" );
+   }
+
+   panic ( "test:end" );
+   return True; /*notreached*/
+}
+
+
+/*---------------------------------------------------*/
+/*--- Error [non-] handling grunge                ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static
+void setExit ( Int32 v )
+{
+   if (v > exitValue) exitValue = v;
+}
+
+
+/*---------------------------------------------*/
+static 
+void cadvise ( void )
+{
+   if (noisy)
+   fprintf (
+      stderr,
+      "\nIt is possible that the compressed file(s) have become corrupted.\n"
+        "You can use the -tvv option to test integrity of such files.\n\n"
+        "You can use the `bzip2recover' program to attempt to recover\n"
+        "data from undamaged sections of corrupted files.\n\n"
+    );
+}
+
+
+/*---------------------------------------------*/
+static 
+void showFileNames ( void )
+{
+   if (noisy)
+   fprintf (
+      stderr,
+      "\tInput file = %s, output file = %s\n",
+      inName, outName 
+   );
+}
+
+
+/*---------------------------------------------*/
+static 
+void cleanUpAndFail ( Int32 ec )
+{
+   IntNative      retVal;
+   struct MY_STAT statBuf;
+
+   if ( srcMode == SM_F2F 
+        && opMode != OM_TEST
+        && deleteOutputOnInterrupt ) {
+
+      /* Check whether input file still exists.  Delete output file
+         only if input exists to avoid loss of data.  Joerg Prante, 5
+         January 2002.  (JRS 06-Jan-2002: other changes in 1.0.2 mean
+         this is less likely to happen.  But to be ultra-paranoid, we
+         do the check anyway.)  */
+      retVal = MY_STAT ( inName, &statBuf );
+      if (retVal == 0) {
+         if (noisy)
+            fprintf ( stderr, 
+                      "%s: Deleting output file %s, if it exists.\n",
+                      progName, outName );
+         if (outputHandleJustInCase != NULL)
+            fclose ( outputHandleJustInCase );
+         retVal = remove ( outName );
+         if (retVal != 0)
+            fprintf ( stderr,
+                      "%s: WARNING: deletion of output file "
+                      "(apparently) failed.\n",
+                      progName );
+      } else {
+         fprintf ( stderr,
+                   "%s: WARNING: deletion of output file suppressed\n",
+                    progName );
+         fprintf ( stderr,
+                   "%s:    since input file no longer exists.  Output file\n",
+                   progName );
+         fprintf ( stderr,
+                   "%s:    `%s' may be incomplete.\n",
+                   progName, outName );
+         fprintf ( stderr, 
+                   "%s:    I suggest doing an integrity test (bzip2 -tv)"
+                   " of it.\n",
+                   progName );
+      }
+   }
+
+   if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) {
+      fprintf ( stderr, 
+                "%s: WARNING: some files have not been processed:\n"
+                "%s:    %d specified on command line, %d not processed yet.\n\n",
+                progName, progName,
+                numFileNames, numFileNames - numFilesProcessed );
+   }
+   setExit(ec);
+   exit(exitValue);
+}
+
+
+/*---------------------------------------------*/
+static 
+void panic ( const Char* s )
+{
+   fprintf ( stderr,
+             "\n%s: PANIC -- internal consistency error:\n"
+             "\t%s\n"
+             "\tThis is a BUG.  Please report it to me at:\n"
+             "\tjseward at bzip.org\n",
+             progName, s );
+   showFileNames();
+   cleanUpAndFail( 3 );
+}
+
+
+/*---------------------------------------------*/
+static 
+void crcError ( void )
+{
+   fprintf ( stderr,
+             "\n%s: Data integrity error when decompressing.\n",
+             progName );
+   showFileNames();
+   cadvise();
+   cleanUpAndFail( 2 );
+}
+
+
+/*---------------------------------------------*/
+static 
+void compressedStreamEOF ( void )
+{
+  if (noisy) {
+    fprintf ( stderr,
+	      "\n%s: Compressed file ends unexpectedly;\n\t"
+	      "perhaps it is corrupted?  *Possible* reason follows.\n",
+	      progName );
+    perror ( progName );
+    showFileNames();
+    cadvise();
+  }
+  cleanUpAndFail( 2 );
+}
+
+
+/*---------------------------------------------*/
+static 
+void ioError ( void )
+{
+   fprintf ( stderr,
+             "\n%s: I/O or other error, bailing out.  "
+             "Possible reason follows.\n",
+             progName );
+   perror ( progName );
+   showFileNames();
+   cleanUpAndFail( 1 );
+}
+
+
+/*---------------------------------------------*/
+static 
+void mySignalCatcher ( IntNative n )
+{
+   fprintf ( stderr,
+             "\n%s: Control-C or similar caught, quitting.\n",
+             progName );
+   cleanUpAndFail(1);
+}
+
+
+/*---------------------------------------------*/
+static 
+void mySIGSEGVorSIGBUScatcher ( IntNative n )
+{
+   if (opMode == OM_Z)
+      fprintf ( 
+      stderr,
+      "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
+      "\n"
+      "   Possible causes are (most likely first):\n"
+      "   (1) This computer has unreliable memory or cache hardware\n"
+      "       (a surprisingly common problem; try a different machine.)\n"
+      "   (2) A bug in the compiler used to create this executable\n"
+      "       (unlikely, if you didn't compile bzip2 yourself.)\n"
+      "   (3) A real bug in bzip2 -- I hope this should never be the case.\n"
+      "   The user's manual, Section 4.3, has more info on (1) and (2).\n"
+      "   \n"
+      "   If you suspect this is a bug in bzip2, or are unsure about (1)\n"
+      "   or (2), feel free to report it to me at: jseward at bzip.org.\n"
+      "   Section 4.3 of the user's manual describes the info a useful\n"
+      "   bug report should have.  If the manual is available on your\n"
+      "   system, please try and read it before mailing me.  If you don't\n"
+      "   have the manual or can't be bothered to read it, mail me anyway.\n"
+      "\n",
+      progName );
+      else
+      fprintf ( 
+      stderr,
+      "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
+      "\n"
+      "   Possible causes are (most likely first):\n"
+      "   (1) The compressed data is corrupted, and bzip2's usual checks\n"
+      "       failed to detect this.  Try bzip2 -tvv my_file.bz2.\n"
+      "   (2) This computer has unreliable memory or cache hardware\n"
+      "       (a surprisingly common problem; try a different machine.)\n"
+      "   (3) A bug in the compiler used to create this executable\n"
+      "       (unlikely, if you didn't compile bzip2 yourself.)\n"
+      "   (4) A real bug in bzip2 -- I hope this should never be the case.\n"
+      "   The user's manual, Section 4.3, has more info on (2) and (3).\n"
+      "   \n"
+      "   If you suspect this is a bug in bzip2, or are unsure about (2)\n"
+      "   or (3), feel free to report it to me at: jseward at bzip.org.\n"
+      "   Section 4.3 of the user's manual describes the info a useful\n"
+      "   bug report should have.  If the manual is available on your\n"
+      "   system, please try and read it before mailing me.  If you don't\n"
+      "   have the manual or can't be bothered to read it, mail me anyway.\n"
+      "\n",
+      progName );
+
+   showFileNames();
+   if (opMode == OM_Z)
+      cleanUpAndFail( 3 ); else
+      { cadvise(); cleanUpAndFail( 2 ); }
+}
+
+
+/*---------------------------------------------*/
+static 
+void outOfMemory ( void )
+{
+   fprintf ( stderr,
+             "\n%s: couldn't allocate enough memory\n",
+             progName );
+   showFileNames();
+   cleanUpAndFail(1);
+}
+
+
+/*---------------------------------------------*/
+static 
+void configError ( void )
+{
+   fprintf ( stderr,
+             "bzip2: I'm not configured correctly for this platform!\n"
+             "\tI require Int32, Int16 and Char to have sizes\n"
+             "\tof 4, 2 and 1 bytes to run properly, and they don't.\n"
+             "\tProbably you can fix this by defining them correctly,\n"
+             "\tand recompiling.  Bye!\n" );
+   setExit(3);
+   exit(exitValue);
+}
+
+
+/*---------------------------------------------------*/
+/*--- The main driver machinery                   ---*/
+/*---------------------------------------------------*/
+
+/* All rather crufty.  The main problem is that input files
+   are stat()d multiple times before use.  This should be
+   cleaned up. 
+*/
+
+/*---------------------------------------------*/
+static 
+void pad ( Char *s )
+{
+   Int32 i;
+   if ( (Int32)strlen(s) >= longestFileName ) return;
+   for (i = 1; i <= longestFileName - (Int32)strlen(s); i++)
+      fprintf ( stderr, " " );
+}
+
+
+/*---------------------------------------------*/
+static 
+void copyFileName ( Char* to, Char* from ) 
+{
+   if ( strlen(from) > FILE_NAME_LEN-10 )  {
+      fprintf (
+         stderr,
+         "bzip2: file name\n`%s'\n"
+         "is suspiciously (more than %d chars) long.\n"
+         "Try using a reasonable file name instead.  Sorry! :-)\n",
+         from, FILE_NAME_LEN-10
+      );
+      setExit(1);
+      exit(exitValue);
+   }
+
+  strncpy(to,from,FILE_NAME_LEN-10);
+  to[FILE_NAME_LEN-10]='\0';
+}
+
+
+/*---------------------------------------------*/
+static 
+Bool fileExists ( Char* name )
+{
+   FILE *tmp   = fopen ( name, "rb" );
+   Bool exists = (tmp != NULL);
+   if (tmp != NULL) fclose ( tmp );
+   return exists;
+}
+
+
+/*---------------------------------------------*/
+/* Open an output file safely with O_EXCL and good permissions.
+   This avoids a race condition in versions < 1.0.2, in which
+   the file was first opened and then had its interim permissions
+   set safely.  We instead use open() to create the file with
+   the interim permissions required. (--- --- rw-).
+
+   For non-Unix platforms, if we are not worrying about
+   security issues, simple this simply behaves like fopen.
+*/
+static
+FILE* fopen_output_safely ( Char* name, const char* mode )
+{
+#  if BZ_UNIX
+   FILE*     fp;
+   IntNative fh;
+   fh = open(name, O_WRONLY|O_CREAT|O_EXCL, S_IWUSR|S_IRUSR);
+   if (fh == -1) return NULL;
+   fp = fdopen(fh, mode);
+   if (fp == NULL) close(fh);
+   return fp;
+#  else
+   return fopen(name, mode);
+#  endif
+}
+
+
+/*---------------------------------------------*/
+/*--
+  if in doubt, return True
+--*/
+static 
+Bool notAStandardFile ( Char* name )
+{
+   IntNative      i;
+   struct MY_STAT statBuf;
+
+   i = MY_LSTAT ( name, &statBuf );
+   if (i != 0) return True;
+   if (MY_S_ISREG(statBuf.st_mode)) return False;
+   return True;
+}
+
+
+/*---------------------------------------------*/
+/*--
+  rac 11/21/98 see if file has hard links to it
+--*/
+static 
+Int32 countHardLinks ( Char* name )
+{  
+   IntNative      i;
+   struct MY_STAT statBuf;
+
+   i = MY_LSTAT ( name, &statBuf );
+   if (i != 0) return 0;
+   return (statBuf.st_nlink - 1);
+}
+
+
+/*---------------------------------------------*/
+/* Copy modification date, access date, permissions and owner from the
+   source to destination file.  We have to copy this meta-info off
+   into fileMetaInfo before starting to compress / decompress it,
+   because doing it afterwards means we get the wrong access time.
+
+   To complicate matters, in compress() and decompress() below, the
+   sequence of tests preceding the call to saveInputFileMetaInfo()
+   involves calling fileExists(), which in turn establishes its result
+   by attempting to fopen() the file, and if successful, immediately
+   fclose()ing it again.  So we have to assume that the fopen() call
+   does not cause the access time field to be updated.
+
+   Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems
+   to imply that merely doing open() will not affect the access time.
+   Therefore we merely need to hope that the C library only does
+   open() as a result of fopen(), and not any kind of read()-ahead
+   cleverness.
+
+   It sounds pretty fragile to me.  Whether this carries across
+   robustly to arbitrary Unix-like platforms (or even works robustly
+   on this one, RedHat 7.2) is unknown to me.  Nevertheless ...  
+*/
+#if BZ_UNIX
+static 
+struct MY_STAT fileMetaInfo;
+#endif
+
+static 
+void saveInputFileMetaInfo ( Char *srcName )
+{
+#  if BZ_UNIX
+   IntNative retVal;
+   /* Note use of stat here, not lstat. */
+   retVal = MY_STAT( srcName, &fileMetaInfo );
+   ERROR_IF_NOT_ZERO ( retVal );
+#  endif
+}
+
+
+static 
+void applySavedTimeInfoToOutputFile ( Char *dstName )
+{
+#  if BZ_UNIX
+   IntNative      retVal;
+   struct utimbuf uTimBuf;
+
+   uTimBuf.actime = fileMetaInfo.st_atime;
+   uTimBuf.modtime = fileMetaInfo.st_mtime;
+
+   retVal = utime ( dstName, &uTimBuf );
+   ERROR_IF_NOT_ZERO ( retVal );
+#  endif
+}
+
+static 
+void applySavedFileAttrToOutputFile ( IntNative fd )
+{
+#  if BZ_UNIX
+   IntNative retVal;
+
+   retVal = fchmod ( fd, fileMetaInfo.st_mode );
+   ERROR_IF_NOT_ZERO ( retVal );
+
+   (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
+   /* chown() will in many cases return with EPERM, which can
+      be safely ignored.
+   */
+#  endif
+}
+
+
+/*---------------------------------------------*/
+static 
+Bool containsDubiousChars ( Char* name )
+{
+#  if BZ_UNIX
+   /* On unix, files can contain any characters and the file expansion
+    * is performed by the shell.
+    */
+   return False;
+#  else /* ! BZ_UNIX */
+   /* On non-unix (Win* platforms), wildcard characters are not allowed in 
+    * filenames.
+    */
+   for (; *name != '\0'; name++)
+      if (*name == '?' || *name == '*') return True;
+   return False;
+#  endif /* BZ_UNIX */
+}
+
+
+/*---------------------------------------------*/
+#define BZ_N_SUFFIX_PAIRS 4
+
+const Char* zSuffix[BZ_N_SUFFIX_PAIRS] 
+   = { ".bz2", ".bz", ".tbz2", ".tbz" };
+const Char* unzSuffix[BZ_N_SUFFIX_PAIRS] 
+   = { "", "", ".tar", ".tar" };
+
+static 
+Bool hasSuffix ( Char* s, const Char* suffix )
+{
+   Int32 ns = strlen(s);
+   Int32 nx = strlen(suffix);
+   if (ns < nx) return False;
+   if (strcmp(s + ns - nx, suffix) == 0) return True;
+   return False;
+}
+
+static 
+Bool mapSuffix ( Char* name, 
+                 const Char* oldSuffix, 
+                 const Char* newSuffix )
+{
+   if (!hasSuffix(name,oldSuffix)) return False;
+   name[strlen(name)-strlen(oldSuffix)] = 0;
+   strcat ( name, newSuffix );
+   return True;
+}
+
+
+/*---------------------------------------------*/
+static 
+void compress ( Char *name )
+{
+   FILE  *inStr;
+   FILE  *outStr;
+   Int32 n, i;
+   struct MY_STAT statBuf;
+
+   deleteOutputOnInterrupt = False;
+
+   if (name == NULL && srcMode != SM_I2O)
+      panic ( "compress: bad modes\n" );
+
+   switch (srcMode) {
+      case SM_I2O: 
+         copyFileName ( inName, (Char*)"(stdin)" );
+         copyFileName ( outName, (Char*)"(stdout)" ); 
+         break;
+      case SM_F2F: 
+         copyFileName ( inName, name );
+         copyFileName ( outName, name );
+         strcat ( outName, ".bz2" ); 
+         break;
+      case SM_F2O: 
+         copyFileName ( inName, name );
+         copyFileName ( outName, (Char*)"(stdout)" ); 
+         break;
+   }
+
+   if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+      if (noisy)
+      fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+                progName, inName );
+      setExit(1);
+      return;
+   }
+   if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+      fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+                progName, inName, strerror(errno) );
+      setExit(1);
+      return;
+   }
+   for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) {
+      if (hasSuffix(inName, zSuffix[i])) {
+         if (noisy)
+         fprintf ( stderr, 
+                   "%s: Input file %s already has %s suffix.\n",
+                   progName, inName, zSuffix[i] );
+         setExit(1);
+         return;
+      }
+   }
+   if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
+      MY_STAT(inName, &statBuf);
+      if ( MY_S_ISDIR(statBuf.st_mode) ) {
+         fprintf( stderr,
+                  "%s: Input file %s is a directory.\n",
+                  progName,inName);
+         setExit(1);
+         return;
+      }
+   }
+   if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
+      if (noisy)
+      fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
+                progName, inName );
+      setExit(1);
+      return;
+   }
+   if ( srcMode == SM_F2F && fileExists ( outName ) ) {
+      if (forceOverwrite) {
+	 remove(outName);
+      } else {
+	 fprintf ( stderr, "%s: Output file %s already exists.\n",
+		   progName, outName );
+	 setExit(1);
+	 return;
+      }
+   }
+   if ( srcMode == SM_F2F && !forceOverwrite &&
+        (n=countHardLinks ( inName )) > 0) {
+      fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
+                progName, inName, n, n > 1 ? "s" : "" );
+      setExit(1);
+      return;
+   }
+
+   if ( srcMode == SM_F2F ) {
+      /* Save the file's meta-info before we open it.  Doing it later
+         means we mess up the access times. */
+      saveInputFileMetaInfo ( inName );
+   }
+
+   switch ( srcMode ) {
+
+      case SM_I2O:
+         inStr = stdin;
+         outStr = stdout;
+         if ( isatty ( fileno ( stdout ) ) ) {
+            fprintf ( stderr,
+                      "%s: I won't write compressed data to a terminal.\n",
+                      progName );
+            fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+                              progName, progName );
+            setExit(1);
+            return;
+         };
+         break;
+
+      case SM_F2O:
+         inStr = fopen ( inName, "rb" );
+         outStr = stdout;
+         if ( isatty ( fileno ( stdout ) ) ) {
+            fprintf ( stderr,
+                      "%s: I won't write compressed data to a terminal.\n",
+                      progName );
+            fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+                              progName, progName );
+            if ( inStr != NULL ) fclose ( inStr );
+            setExit(1);
+            return;
+         };
+         if ( inStr == NULL ) {
+            fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+                      progName, inName, strerror(errno) );
+            setExit(1);
+            return;
+         };
+         break;
+
+      case SM_F2F:
+         inStr = fopen ( inName, "rb" );
+         outStr = fopen_output_safely ( outName, "wb" );
+         if ( outStr == NULL) {
+            fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
+                      progName, outName, strerror(errno) );
+            if ( inStr != NULL ) fclose ( inStr );
+            setExit(1);
+            return;
+         }
+         if ( inStr == NULL ) {
+            fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+                      progName, inName, strerror(errno) );
+            if ( outStr != NULL ) fclose ( outStr );
+            setExit(1);
+            return;
+         };
+         break;
+
+      default:
+         panic ( "compress: bad srcMode" );
+         break;
+   }
+
+   if (verbosity >= 1) {
+      fprintf ( stderr,  "  %s: ", inName );
+      pad ( inName );
+      fflush ( stderr );
+   }
+
+   /*--- Now the input and output handles are sane.  Do the Biz. ---*/
+   outputHandleJustInCase = outStr;
+   deleteOutputOnInterrupt = True;
+   compressStream ( inStr, outStr );
+   outputHandleJustInCase = NULL;
+
+   /*--- If there was an I/O error, we won't get here. ---*/
+   if ( srcMode == SM_F2F ) {
+      applySavedTimeInfoToOutputFile ( outName );
+      deleteOutputOnInterrupt = False;
+      if ( !keepInputFiles ) {
+         IntNative retVal = remove ( inName );
+         ERROR_IF_NOT_ZERO ( retVal );
+      }
+   }
+
+   deleteOutputOnInterrupt = False;
+}
+
+
+/*---------------------------------------------*/
+static 
+void uncompress ( Char *name )
+{
+   FILE  *inStr;
+   FILE  *outStr;
+   Int32 n, i;
+   Bool  magicNumberOK;
+   Bool  cantGuess;
+   struct MY_STAT statBuf;
+
+   deleteOutputOnInterrupt = False;
+
+   if (name == NULL && srcMode != SM_I2O)
+      panic ( "uncompress: bad modes\n" );
+
+   cantGuess = False;
+   switch (srcMode) {
+      case SM_I2O: 
+         copyFileName ( inName, (Char*)"(stdin)" );
+         copyFileName ( outName, (Char*)"(stdout)" ); 
+         break;
+      case SM_F2F: 
+         copyFileName ( inName, name );
+         copyFileName ( outName, name );
+         for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
+            if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
+               goto zzz; 
+         cantGuess = True;
+         strcat ( outName, ".out" );
+         break;
+      case SM_F2O: 
+         copyFileName ( inName, name );
+         copyFileName ( outName, (Char*)"(stdout)" ); 
+         break;
+   }
+
+   zzz:
+   if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+      if (noisy)
+      fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+                progName, inName );
+      setExit(1);
+      return;
+   }
+   if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+      fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+                progName, inName, strerror(errno) );
+      setExit(1);
+      return;
+   }
+   if ( srcMode == SM_F2F || srcMode == SM_F2O ) {
+      MY_STAT(inName, &statBuf);
+      if ( MY_S_ISDIR(statBuf.st_mode) ) {
+         fprintf( stderr,
+                  "%s: Input file %s is a directory.\n",
+                  progName,inName);
+         setExit(1);
+         return;
+      }
+   }
+   if ( srcMode == SM_F2F && !forceOverwrite && notAStandardFile ( inName )) {
+      if (noisy)
+      fprintf ( stderr, "%s: Input file %s is not a normal file.\n",
+                progName, inName );
+      setExit(1);
+      return;
+   }
+   if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
+      if (noisy)
+      fprintf ( stderr, 
+                "%s: Can't guess original name for %s -- using %s\n",
+                progName, inName, outName );
+      /* just a warning, no return */
+   }   
+   if ( srcMode == SM_F2F && fileExists ( outName ) ) {
+      if (forceOverwrite) {
+	remove(outName);
+      } else {
+        fprintf ( stderr, "%s: Output file %s already exists.\n",
+                  progName, outName );
+        setExit(1);
+        return;
+      }
+   }
+   if ( srcMode == SM_F2F && !forceOverwrite &&
+        (n=countHardLinks ( inName ) ) > 0) {
+      fprintf ( stderr, "%s: Input file %s has %d other link%s.\n",
+                progName, inName, n, n > 1 ? "s" : "" );
+      setExit(1);
+      return;
+   }
+
+   if ( srcMode == SM_F2F ) {
+      /* Save the file's meta-info before we open it.  Doing it later
+         means we mess up the access times. */
+      saveInputFileMetaInfo ( inName );
+   }
+
+   switch ( srcMode ) {
+
+      case SM_I2O:
+         inStr = stdin;
+         outStr = stdout;
+         if ( isatty ( fileno ( stdin ) ) ) {
+            fprintf ( stderr,
+                      "%s: I won't read compressed data from a terminal.\n",
+                      progName );
+            fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+                              progName, progName );
+            setExit(1);
+            return;
+         };
+         break;
+
+      case SM_F2O:
+         inStr = fopen ( inName, "rb" );
+         outStr = stdout;
+         if ( inStr == NULL ) {
+            fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
+                      progName, inName, strerror(errno) );
+            if ( inStr != NULL ) fclose ( inStr );
+            setExit(1);
+            return;
+         };
+         break;
+
+      case SM_F2F:
+         inStr = fopen ( inName, "rb" );
+         outStr = fopen_output_safely ( outName, "wb" );
+         if ( outStr == NULL) {
+            fprintf ( stderr, "%s: Can't create output file %s: %s.\n",
+                      progName, outName, strerror(errno) );
+            if ( inStr != NULL ) fclose ( inStr );
+            setExit(1);
+            return;
+         }
+         if ( inStr == NULL ) {
+            fprintf ( stderr, "%s: Can't open input file %s: %s.\n",
+                      progName, inName, strerror(errno) );
+            if ( outStr != NULL ) fclose ( outStr );
+            setExit(1);
+            return;
+         };
+         break;
+
+      default:
+         panic ( "uncompress: bad srcMode" );
+         break;
+   }
+
+   if (verbosity >= 1) {
+      fprintf ( stderr, "  %s: ", inName );
+      pad ( inName );
+      fflush ( stderr );
+   }
+
+   /*--- Now the input and output handles are sane.  Do the Biz. ---*/
+   outputHandleJustInCase = outStr;
+   deleteOutputOnInterrupt = True;
+   magicNumberOK = uncompressStream ( inStr, outStr );
+   outputHandleJustInCase = NULL;
+
+   /*--- If there was an I/O error, we won't get here. ---*/
+   if ( magicNumberOK ) {
+      if ( srcMode == SM_F2F ) {
+         applySavedTimeInfoToOutputFile ( outName );
+         deleteOutputOnInterrupt = False;
+         if ( !keepInputFiles ) {
+            IntNative retVal = remove ( inName );
+            ERROR_IF_NOT_ZERO ( retVal );
+         }
+      }
+   } else {
+      unzFailsExist = True;
+      deleteOutputOnInterrupt = False;
+      if ( srcMode == SM_F2F ) {
+         IntNative retVal = remove ( outName );
+         ERROR_IF_NOT_ZERO ( retVal );
+      }
+   }
+   deleteOutputOnInterrupt = False;
+
+   if ( magicNumberOK ) {
+      if (verbosity >= 1)
+         fprintf ( stderr, "done\n" );
+   } else {
+      setExit(2);
+      if (verbosity >= 1)
+         fprintf ( stderr, "not a bzip2 file.\n" ); else
+         fprintf ( stderr,
+                   "%s: %s is not a bzip2 file.\n",
+                   progName, inName );
+   }
+
+}
+
+
+/*---------------------------------------------*/
+static 
+void testf ( Char *name )
+{
+   FILE *inStr;
+   Bool allOK;
+   struct MY_STAT statBuf;
+
+   deleteOutputOnInterrupt = False;
+
+   if (name == NULL && srcMode != SM_I2O)
+      panic ( "testf: bad modes\n" );
+
+   copyFileName ( outName, (Char*)"(none)" );
+   switch (srcMode) {
+      case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break;
+      case SM_F2F: copyFileName ( inName, name ); break;
+      case SM_F2O: copyFileName ( inName, name ); break;
+   }
+
+   if ( srcMode != SM_I2O && containsDubiousChars ( inName ) ) {
+      if (noisy)
+      fprintf ( stderr, "%s: There are no files matching `%s'.\n",
+                progName, inName );
+      setExit(1);
+      return;
+   }
+   if ( srcMode != SM_I2O && !fileExists ( inName ) ) {
+      fprintf ( stderr, "%s: Can't open input %s: %s.\n",
+                progName, inName, strerror(errno) );
+      setExit(1);
+      return;
+   }
+   if ( srcMode != SM_I2O ) {
+      MY_STAT(inName, &statBuf);
+      if ( MY_S_ISDIR(statBuf.st_mode) ) {
+         fprintf( stderr,
+                  "%s: Input file %s is a directory.\n",
+                  progName,inName);
+         setExit(1);
+         return;
+      }
+   }
+
+   switch ( srcMode ) {
+
+      case SM_I2O:
+         if ( isatty ( fileno ( stdin ) ) ) {
+            fprintf ( stderr,
+                      "%s: I won't read compressed data from a terminal.\n",
+                      progName );
+            fprintf ( stderr, "%s: For help, type: `%s --help'.\n",
+                              progName, progName );
+            setExit(1);
+            return;
+         };
+         inStr = stdin;
+         break;
+
+      case SM_F2O: case SM_F2F:
+         inStr = fopen ( inName, "rb" );
+         if ( inStr == NULL ) {
+            fprintf ( stderr, "%s: Can't open input file %s:%s.\n",
+                      progName, inName, strerror(errno) );
+            setExit(1);
+            return;
+         };
+         break;
+
+      default:
+         panic ( "testf: bad srcMode" );
+         break;
+   }
+
+   if (verbosity >= 1) {
+      fprintf ( stderr, "  %s: ", inName );
+      pad ( inName );
+      fflush ( stderr );
+   }
+
+   /*--- Now the input handle is sane.  Do the Biz. ---*/
+   outputHandleJustInCase = NULL;
+   allOK = testStream ( inStr );
+
+   if (allOK && verbosity >= 1) fprintf ( stderr, "ok\n" );
+   if (!allOK) testFailsExist = True;
+}
+
+
+/*---------------------------------------------*/
+static 
+void license ( void )
+{
+   fprintf ( stderr,
+
+    "bzip2, a block-sorting file compressor.  "
+    "Version %s.\n"
+    "   \n"
+    "   Copyright (C) 1996-2007 by Julian Seward.\n"
+    "   \n"
+    "   This program is free software; you can redistribute it and/or modify\n"
+    "   it under the terms set out in the LICENSE file, which is included\n"
+    "   in the bzip2-1.0.5 source distribution.\n"
+    "   \n"
+    "   This program is distributed in the hope that it will be useful,\n"
+    "   but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+    "   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
+    "   LICENSE file for more details.\n"
+    "   \n",
+    BZ2_bzlibVersion()
+   );
+}
+
+
+/*---------------------------------------------*/
+static 
+void usage ( Char *fullProgName )
+{
+   fprintf (
+      stderr,
+      "bzip2, a block-sorting file compressor.  "
+      "Version %s.\n"
+      "\n   usage: %s [flags and input files in any order]\n"
+      "\n"
+      "   -h --help           print this message\n"
+      "   -d --decompress     force decompression\n"
+      "   -z --compress       force compression\n"
+      "   -k --keep           keep (don't delete) input files\n"
+      "   -f --force          overwrite existing output files\n"
+      "   -t --test           test compressed file integrity\n"
+      "   -c --stdout         output to standard out\n"
+      "   -q --quiet          suppress noncritical error messages\n"
+      "   -v --verbose        be verbose (a 2nd -v gives more)\n"
+      "   -L --license        display software version & license\n"
+      "   -V --version        display software version & license\n"
+      "   -s --small          use less memory (at most 2500k)\n"
+      "   -1 .. -9            set block size to 100k .. 900k\n"
+      "   --fast              alias for -1\n"
+      "   --best              alias for -9\n"
+      "\n"
+      "   If invoked as `bzip2', default action is to compress.\n"
+      "              as `bunzip2',  default action is to decompress.\n"
+      "              as `bzcat', default action is to decompress to stdout.\n"
+      "\n"
+      "   If no file names are given, bzip2 compresses or decompresses\n"
+      "   from standard input to standard output.  You can combine\n"
+      "   short flags, so `-v -4' means the same as -v4 or -4v, &c.\n"
+#     if BZ_UNIX
+      "\n"
+#     endif
+      ,
+
+      BZ2_bzlibVersion(),
+      fullProgName
+   );
+}
+
+
+/*---------------------------------------------*/
+static 
+void redundant ( Char* flag )
+{
+   fprintf ( 
+      stderr, 
+      "%s: %s is redundant in versions 0.9.5 and above\n",
+      progName, flag );
+}
+
+
+/*---------------------------------------------*/
+/*--
+  All the garbage from here to main() is purely to
+  implement a linked list of command-line arguments,
+  into which main() copies argv[1 .. argc-1].
+
+  The purpose of this exercise is to facilitate 
+  the expansion of wildcard characters * and ? in 
+  filenames for OSs which don't know how to do it
+  themselves, like MSDOS, Windows 95 and NT.
+
+  The actual Dirty Work is done by the platform-
+  specific macro APPEND_FILESPEC.
+--*/
+
+typedef
+   struct zzzz {
+      Char        *name;
+      struct zzzz *link;
+   }
+   Cell;
+
+
+/*---------------------------------------------*/
+static 
+void *myMalloc ( Int32 n )
+{
+   void* p;
+
+   p = malloc ( (size_t)n );
+   if (p == NULL) outOfMemory ();
+   return p;
+}
+
+
+/*---------------------------------------------*/
+static 
+Cell *mkCell ( void )
+{
+   Cell *c;
+
+   c = (Cell*) myMalloc ( sizeof ( Cell ) );
+   c->name = NULL;
+   c->link = NULL;
+   return c;
+}
+
+
+/*---------------------------------------------*/
+static 
+Cell *snocString ( Cell *root, Char *name )
+{
+   if (root == NULL) {
+      Cell *tmp = mkCell();
+      tmp->name = (Char*) myMalloc ( 5 + strlen(name) );
+      strcpy ( tmp->name, name );
+      return tmp;
+   } else {
+      Cell *tmp = root;
+      while (tmp->link != NULL) tmp = tmp->link;
+      tmp->link = snocString ( tmp->link, name );
+      return root;
+   }
+}
+
+
+/*---------------------------------------------*/
+static 
+void addFlagsFromEnvVar ( Cell** argList, Char* varName ) 
+{
+   Int32 i, j, k;
+   Char *envbase, *p;
+
+   envbase = getenv(varName);
+   if (envbase != NULL) {
+      p = envbase;
+      i = 0;
+      while (True) {
+         if (p[i] == 0) break;
+         p += i;
+         i = 0;
+         while (isspace((Int32)(p[0]))) p++;
+         while (p[i] != 0 && !isspace((Int32)(p[i]))) i++;
+         if (i > 0) {
+            k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10;
+            for (j = 0; j < k; j++) tmpName[j] = p[j];
+            tmpName[k] = 0;
+            APPEND_FLAG(*argList, tmpName);
+         }
+      }
+   }
+}
+
+
+/*---------------------------------------------*/
+#define ISFLAG(s) (strcmp(aa->name, (s))==0)
+
+IntNative main ( IntNative argc, Char *argv[] )
+{
+   Int32  i, j;
+   Char   *tmp;
+   Cell   *argList;
+   Cell   *aa;
+   Bool   decode;
+
+   /*-- Be really really really paranoid :-) --*/
+   if (sizeof(Int32) != 4 || sizeof(UInt32) != 4  ||
+       sizeof(Int16) != 2 || sizeof(UInt16) != 2  ||
+       sizeof(Char)  != 1 || sizeof(UChar)  != 1)
+      configError();
+
+   /*-- Initialise --*/
+   outputHandleJustInCase  = NULL;
+   smallMode               = False;
+   keepInputFiles          = False;
+   forceOverwrite          = False;
+   noisy                   = True;
+   verbosity               = 0;
+   blockSize100k           = 9;
+   testFailsExist          = False;
+   unzFailsExist           = False;
+   numFileNames            = 0;
+   numFilesProcessed       = 0;
+   workFactor              = 30;
+   deleteOutputOnInterrupt = False;
+   exitValue               = 0;
+   i = j = 0; /* avoid bogus warning from egcs-1.1.X */
+
+   /*-- Set up signal handlers for mem access errors --*/
+   signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
+#  if BZ_UNIX
+#  ifndef __DJGPP__
+   signal (SIGBUS,  mySIGSEGVorSIGBUScatcher);
+#  endif
+#  endif
+
+   copyFileName ( inName,  (Char*)"(none)" );
+   copyFileName ( outName, (Char*)"(none)" );
+
+   copyFileName ( progNameReally, argv[0] );
+   progName = &progNameReally[0];
+   for (tmp = &progNameReally[0]; *tmp != '\0'; tmp++)
+      if (*tmp == PATH_SEP) progName = tmp + 1;
+
+
+   /*-- Copy flags from env var BZIP2, and 
+        expand filename wildcards in arg list.
+   --*/
+   argList = NULL;
+   addFlagsFromEnvVar ( &argList,  (Char*)"BZIP2" );
+   addFlagsFromEnvVar ( &argList,  (Char*)"BZIP" );
+   for (i = 1; i <= argc-1; i++)
+      APPEND_FILESPEC(argList, argv[i]);
+
+
+   /*-- Find the length of the longest filename --*/
+   longestFileName = 7;
+   numFileNames    = 0;
+   decode          = True;
+   for (aa = argList; aa != NULL; aa = aa->link) {
+      if (ISFLAG("--")) { decode = False; continue; }
+      if (aa->name[0] == '-' && decode) continue;
+      numFileNames++;
+      if (longestFileName < (Int32)strlen(aa->name) )
+         longestFileName = (Int32)strlen(aa->name);
+   }
+
+
+   /*-- Determine source modes; flag handling may change this too. --*/
+   if (numFileNames == 0)
+      srcMode = SM_I2O; else srcMode = SM_F2F;
+
+
+   /*-- Determine what to do (compress/uncompress/test/cat). --*/
+   /*-- Note that subsequent flag handling may change this. --*/
+   opMode = OM_Z;
+
+   if ( (strstr ( progName, "unzip" ) != 0) ||
+        (strstr ( progName, "UNZIP" ) != 0) )
+      opMode = OM_UNZ;
+
+   if ( (strstr ( progName, "z2cat" ) != 0) ||
+        (strstr ( progName, "Z2CAT" ) != 0) ||
+        (strstr ( progName, "zcat" ) != 0)  ||
+        (strstr ( progName, "ZCAT" ) != 0) )  {
+      opMode = OM_UNZ;
+      srcMode = (numFileNames == 0) ? SM_I2O : SM_F2O;
+   }
+
+
+   /*-- Look at the flags. --*/
+   for (aa = argList; aa != NULL; aa = aa->link) {
+      if (ISFLAG("--")) break;
+      if (aa->name[0] == '-' && aa->name[1] != '-') {
+         for (j = 1; aa->name[j] != '\0'; j++) {
+            switch (aa->name[j]) {
+               case 'c': srcMode          = SM_F2O; break;
+               case 'd': opMode           = OM_UNZ; break;
+               case 'z': opMode           = OM_Z; break;
+               case 'f': forceOverwrite   = True; break;
+               case 't': opMode           = OM_TEST; break;
+               case 'k': keepInputFiles   = True; break;
+               case 's': smallMode        = True; break;
+               case 'q': noisy            = False; break;
+               case '1': blockSize100k    = 1; break;
+               case '2': blockSize100k    = 2; break;
+               case '3': blockSize100k    = 3; break;
+               case '4': blockSize100k    = 4; break;
+               case '5': blockSize100k    = 5; break;
+               case '6': blockSize100k    = 6; break;
+               case '7': blockSize100k    = 7; break;
+               case '8': blockSize100k    = 8; break;
+               case '9': blockSize100k    = 9; break;
+               case 'V':
+               case 'L': license();            break;
+               case 'v': verbosity++; break;
+               case 'h': usage ( progName );
+                         exit ( 0 );
+                         break;
+               default:  fprintf ( stderr, "%s: Bad flag `%s'\n",
+                                   progName, aa->name );
+                         usage ( progName );
+                         exit ( 1 );
+                         break;
+            }
+         }
+      }
+   }
+   
+   /*-- And again ... --*/
+   for (aa = argList; aa != NULL; aa = aa->link) {
+      if (ISFLAG("--")) break;
+      if (ISFLAG("--stdout"))            srcMode          = SM_F2O;  else
+      if (ISFLAG("--decompress"))        opMode           = OM_UNZ;  else
+      if (ISFLAG("--compress"))          opMode           = OM_Z;    else
+      if (ISFLAG("--force"))             forceOverwrite   = True;    else
+      if (ISFLAG("--test"))              opMode           = OM_TEST; else
+      if (ISFLAG("--keep"))              keepInputFiles   = True;    else
+      if (ISFLAG("--small"))             smallMode        = True;    else
+      if (ISFLAG("--quiet"))             noisy            = False;   else
+      if (ISFLAG("--version"))           license();                  else
+      if (ISFLAG("--license"))           license();                  else
+      if (ISFLAG("--exponential"))       workFactor = 1;             else 
+      if (ISFLAG("--repetitive-best"))   redundant(aa->name);        else
+      if (ISFLAG("--repetitive-fast"))   redundant(aa->name);        else
+      if (ISFLAG("--fast"))              blockSize100k = 1;          else
+      if (ISFLAG("--best"))              blockSize100k = 9;          else
+      if (ISFLAG("--verbose"))           verbosity++;                else
+      if (ISFLAG("--help"))              { usage ( progName ); exit ( 0 ); }
+         else
+         if (strncmp ( aa->name, "--", 2) == 0) {
+            fprintf ( stderr, "%s: Bad flag `%s'\n", progName, aa->name );
+            usage ( progName );
+            exit ( 1 );
+         }
+   }
+
+   if (verbosity > 4) verbosity = 4;
+   if (opMode == OM_Z && smallMode && blockSize100k > 2) 
+      blockSize100k = 2;
+
+   if (opMode == OM_TEST && srcMode == SM_F2O) {
+      fprintf ( stderr, "%s: -c and -t cannot be used together.\n",
+                progName );
+      exit ( 1 );
+   }
+
+   if (srcMode == SM_F2O && numFileNames == 0)
+      srcMode = SM_I2O;
+
+   if (opMode != OM_Z) blockSize100k = 0;
+
+   if (srcMode == SM_F2F) {
+      signal (SIGINT,  mySignalCatcher);
+      signal (SIGTERM, mySignalCatcher);
+#     if BZ_UNIX
+      signal (SIGHUP,  mySignalCatcher);
+#     endif
+   }
+
+   if (opMode == OM_Z) {
+     if (srcMode == SM_I2O) {
+        compress ( NULL );
+     } else {
+        decode = True;
+        for (aa = argList; aa != NULL; aa = aa->link) {
+           if (ISFLAG("--")) { decode = False; continue; }
+           if (aa->name[0] == '-' && decode) continue;
+           numFilesProcessed++;
+           compress ( aa->name );
+        }
+     }
+   } 
+   else
+
+   if (opMode == OM_UNZ) {
+      unzFailsExist = False;
+      if (srcMode == SM_I2O) {
+         uncompress ( NULL );
+      } else {
+         decode = True;
+         for (aa = argList; aa != NULL; aa = aa->link) {
+            if (ISFLAG("--")) { decode = False; continue; }
+            if (aa->name[0] == '-' && decode) continue;
+            numFilesProcessed++;
+            uncompress ( aa->name );
+         }      
+      }
+      if (unzFailsExist) { 
+         setExit(2); 
+         exit(exitValue);
+      }
+   } 
+
+   else {
+      testFailsExist = False;
+      if (srcMode == SM_I2O) {
+         testf ( NULL );
+      } else {
+         decode = True;
+         for (aa = argList; aa != NULL; aa = aa->link) {
+	    if (ISFLAG("--")) { decode = False; continue; }
+            if (aa->name[0] == '-' && decode) continue;
+            numFilesProcessed++;
+            testf ( aa->name );
+	 }
+      }
+      if (testFailsExist && noisy) {
+         fprintf ( stderr,
+           "\n"
+           "You can use the `bzip2recover' program to attempt to recover\n"
+           "data from undamaged sections of corrupted files.\n\n"
+         );
+         setExit(2);
+         exit(exitValue);
+      }
+   }
+
+   /* Free the argument list memory to mollify leak detectors 
+      (eg) Purify, Checker.  Serves no other useful purpose.
+   */
+   aa = argList;
+   while (aa != NULL) {
+      Cell* aa2 = aa->link;
+      if (aa->name != NULL) free(aa->name);
+      free(aa);
+      aa = aa2;
+   }
+
+   return exitValue;
+}
+
+
+/*-----------------------------------------------------------*/
+/*--- end                                         bzip2.c ---*/
+/*-----------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bzip2.txt
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip2.txt	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,391 @@
+
+NAME
+       bzip2, bunzip2 - a block-sorting file compressor, v1.0.4
+       bzcat - decompresses files to stdout
+       bzip2recover - recovers data from damaged bzip2 files
+
+
+SYNOPSIS
+       bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
+       bunzip2 [ -fkvsVL ] [ filenames ...  ]
+       bzcat [ -s ] [ filenames ...  ]
+       bzip2recover filename
+
+
+DESCRIPTION
+       bzip2  compresses  files  using  the Burrows-Wheeler block
+       sorting text compression algorithm,  and  Huffman  coding.
+       Compression  is  generally  considerably  better than that
+       achieved by more conventional LZ77/LZ78-based compressors,
+       and  approaches  the performance of the PPM family of sta-
+       tistical compressors.
+
+       The command-line options are deliberately very similar  to
+       those of GNU gzip, but they are not identical.
+
+       bzip2  expects  a list of file names to accompany the com-
+       mand-line flags.  Each file is replaced  by  a  compressed
+       version  of  itself,  with  the  name "original_name.bz2".
+       Each compressed file has the same modification date,  per-
+       missions, and, when possible, ownership as the correspond-
+       ing original, so that these properties  can  be  correctly
+       restored  at  decompression  time.   File name handling is
+       naive in the sense that there is no mechanism for preserv-
+       ing  original file names, permissions, ownerships or dates
+       in filesystems which lack these concepts, or have  serious
+       file name length restrictions, such as MS-DOS.
+
+       bzip2  and  bunzip2 will by default not overwrite existing
+       files.  If you want this to happen, specify the -f flag.
+
+       If no file names  are  specified,  bzip2  compresses  from
+       standard  input  to  standard output.  In this case, bzip2
+       will decline to write compressed output to a terminal,  as
+       this  would  be  entirely  incomprehensible  and therefore
+       pointless.
+
+       bunzip2 (or bzip2 -d) decompresses  all  specified  files.
+       Files which were not created by bzip2 will be detected and
+       ignored, and a warning issued.  bzip2  attempts  to  guess
+       the  filename  for  the decompressed file from that of the
+       compressed file as follows:
+
+              filename.bz2    becomes   filename
+              filename.bz     becomes   filename
+              filename.tbz2   becomes   filename.tar
+              filename.tbz    becomes   filename.tar
+              anyothername    becomes   anyothername.out
+
+       If the file does not end in one of the recognised endings,
+       .bz2,  .bz,  .tbz2 or .tbz, bzip2 complains that it cannot
+       guess the name of the original file, and uses the original
+       name with .out appended.
+
+       As  with compression, supplying no filenames causes decom-
+       pression from standard input to standard output.
+
+       bunzip2 will correctly decompress a file which is the con-
+       catenation of two or more compressed files.  The result is
+       the concatenation of the corresponding uncompressed files.
+       Integrity testing (-t) of concatenated compressed files is
+       also supported.
+
+       You can also compress or decompress files to the  standard
+       output  by giving the -c flag.  Multiple files may be com-
+       pressed and decompressed like this.  The resulting outputs
+       are  fed  sequentially to stdout.  Compression of multiple
+       files in this manner generates a stream containing  multi-
+       ple compressed file representations.  Such a stream can be
+       decompressed correctly only  by  bzip2  version  0.9.0  or
+       later.   Earlier  versions of bzip2 will stop after decom-
+       pressing the first file in the stream.
+
+       bzcat (or bzip2 -dc) decompresses all specified  files  to
+       the standard output.
+
+       bzip2  will  read arguments from the environment variables
+       BZIP2 and BZIP, in  that  order,  and  will  process  them
+       before  any  arguments  read  from the command line.  This
+       gives a convenient way to supply default arguments.
+
+       Compression is always performed, even  if  the  compressed
+       file  is slightly larger than the original.  Files of less
+       than about one hundred bytes tend to get larger, since the
+       compression  mechanism  has  a  constant  overhead  in the
+       region of 50 bytes.  Random data (including the output  of
+       most  file  compressors)  is  coded at about 8.05 bits per
+       byte, giving an expansion of around 0.5%.
+
+       As a self-check for your  protection,  bzip2  uses  32-bit
+       CRCs  to make sure that the decompressed version of a file
+       is identical to the original.  This guards against corrup-
+       tion  of  the compressed data, and against undetected bugs
+       in bzip2 (hopefully very unlikely).  The chances  of  data
+       corruption  going  undetected  is  microscopic,  about one
+       chance in four billion for each file processed.  Be aware,
+       though,  that  the  check occurs upon decompression, so it
+       can only tell you that something is wrong.  It can't  help
+       you  recover  the original uncompressed data.  You can use
+       bzip2recover to try to recover data from damaged files.
+
+       Return values: 0 for a normal exit,  1  for  environmental
+       problems  (file not found, invalid flags, I/O errors, &c),
+       2 to indicate a corrupt compressed file, 3 for an internal
+       consistency error (eg, bug) which caused bzip2 to panic.
+
+
+OPTIONS
+       -c --stdout
+              Compress or decompress to standard output.
+
+       -d --decompress
+              Force  decompression.  bzip2, bunzip2 and bzcat are
+              really the same program,  and  the  decision  about
+              what  actions to take is done on the basis of which
+              name is used.  This flag overrides that  mechanism,
+              and forces bzip2 to decompress.
+
+       -z --compress
+              The   complement   to   -d:   forces   compression,
+              regardless of the invocation name.
+
+       -t --test
+              Check integrity of the specified file(s), but don't
+              decompress  them.   This  really  performs  a trial
+              decompression and throws away the result.
+
+       -f --force
+              Force overwrite of output files.   Normally,  bzip2
+              will  not  overwrite  existing  output files.  Also
+              forces bzip2 to break hard links to files, which it
+              otherwise wouldn't do.
+
+              bzip2  normally  declines to decompress files which
+              don't have the  correct  magic  header  bytes.   If
+              forced  (-f),  however,  it  will  pass  such files
+              through unmodified.  This is how GNU gzip  behaves.
+
+       -k --keep
+              Keep  (don't delete) input files during compression
+              or decompression.
+
+       -s --small
+              Reduce memory usage, for compression, decompression
+              and  testing.   Files  are  decompressed and tested
+              using a modified algorithm which only requires  2.5
+              bytes  per  block byte.  This means any file can be
+              decompressed in 2300k of memory,  albeit  at  about
+              half the normal speed.
+
+              During  compression,  -s  selects  a  block size of
+              200k, which limits memory use to  around  the  same
+              figure,  at  the expense of your compression ratio.
+              In short, if your  machine  is  low  on  memory  (8
+              megabytes  or  less),  use  -s for everything.  See
+              MEMORY MANAGEMENT below.
+
+       -q --quiet
+              Suppress non-essential warning messages.   Messages
+              pertaining  to I/O errors and other critical events
+              will not be suppressed.
+
+       -v --verbose
+              Verbose mode -- show the compression ratio for each
+              file  processed.   Further  -v's  increase the ver-
+              bosity level, spewing out lots of information which
+              is primarily of interest for diagnostic purposes.
+
+       -L --license -V --version
+              Display  the  software  version,  license terms and
+              conditions.
+
+       -1 (or --fast) to -9 (or --best)
+              Set the block size to 100 k, 200 k ..  900  k  when
+              compressing.   Has  no  effect  when decompressing.
+              See MEMORY MANAGEMENT below.  The --fast and --best
+              aliases  are  primarily for GNU gzip compatibility.
+              In particular, --fast doesn't make things  signifi-
+              cantly  faster.   And  --best  merely  selects  the
+              default behaviour.
+
+       --     Treats all subsequent arguments as file names, even
+              if they start with a dash.  This is so you can han-
+              dle files with names beginning  with  a  dash,  for
+              example: bzip2 -- -myfilename.
+
+       --repetitive-fast --repetitive-best
+              These  flags  are  redundant  in versions 0.9.5 and
+              above.  They provided some coarse control over  the
+              behaviour  of the sorting algorithm in earlier ver-
+              sions, which was sometimes useful.  0.9.5 and above
+              have  an  improved  algorithm  which  renders these
+              flags irrelevant.
+
+
+MEMORY MANAGEMENT
+       bzip2 compresses large files in blocks.   The  block  size
+       affects  both  the  compression  ratio  achieved,  and the
+       amount of memory needed for compression and decompression.
+       The  flags  -1  through  -9  specify  the block size to be
+       100,000 bytes through 900,000 bytes (the default)  respec-
+       tively.   At  decompression  time, the block size used for
+       compression is read from  the  header  of  the  compressed
+       file, and bunzip2 then allocates itself just enough memory
+       to decompress the file.  Since block sizes are  stored  in
+       compressed  files,  it follows that the flags -1 to -9 are
+       irrelevant to and so ignored during decompression.
+
+       Compression and decompression requirements, in bytes,  can
+       be estimated as:
+
+              Compression:   400k + ( 8 x block size )
+
+              Decompression: 100k + ( 4 x block size ), or
+                             100k + ( 2.5 x block size )
+
+       Larger  block  sizes  give  rapidly  diminishing  marginal
+       returns.  Most of the compression comes from the first two
+       or  three hundred k of block size, a fact worth bearing in
+       mind when using bzip2  on  small  machines.   It  is  also
+       important  to  appreciate  that  the  decompression memory
+       requirement is set at compression time by  the  choice  of
+       block size.
+
+       For  files  compressed  with  the default 900k block size,
+       bunzip2 will require about 3700 kbytes to decompress.   To
+       support decompression of any file on a 4 megabyte machine,
+       bunzip2 has an option to  decompress  using  approximately
+       half this amount of memory, about 2300 kbytes.  Decompres-
+       sion speed is also halved, so you should use  this  option
+       only where necessary.  The relevant flag is -s.
+
+       In general, try and use the largest block size memory con-
+       straints  allow,  since  that  maximises  the  compression
+       achieved.   Compression and decompression speed are virtu-
+       ally unaffected by block size.
+
+       Another significant point applies to files which fit in  a
+       single  block  --  that  means  most files you'd encounter
+       using a large block  size.   The  amount  of  real  memory
+       touched is proportional to the size of the file, since the
+       file is smaller than a block.  For example, compressing  a
+       file  20,000  bytes  long  with the flag -9 will cause the
+       compressor to allocate around 7600k of  memory,  but  only
+       touch 400k + 20000 * 8 = 560 kbytes of it.  Similarly, the
+       decompressor will allocate 3700k but  only  touch  100k  +
+       20000 * 4 = 180 kbytes.
+
+       Here  is a table which summarises the maximum memory usage
+       for different block sizes.  Also  recorded  is  the  total
+       compressed  size for 14 files of the Calgary Text Compres-
+       sion Corpus totalling 3,141,622 bytes.  This column  gives
+       some  feel  for  how  compression  varies with block size.
+       These figures tend to understate the advantage  of  larger
+       block  sizes  for  larger files, since the Corpus is domi-
+       nated by smaller files.
+
+                  Compress   Decompress   Decompress   Corpus
+           Flag     usage      usage       -s usage     Size
+
+            -1      1200k       500k         350k      914704
+            -2      2000k       900k         600k      877703
+            -3      2800k      1300k         850k      860338
+            -4      3600k      1700k        1100k      846899
+            -5      4400k      2100k        1350k      845160
+            -6      5200k      2500k        1600k      838626
+            -7      6100k      2900k        1850k      834096
+            -8      6800k      3300k        2100k      828642
+            -9      7600k      3700k        2350k      828642
+
+
+RECOVERING DATA FROM DAMAGED FILES
+       bzip2 compresses files in blocks, usually 900kbytes  long.
+       Each block is handled independently.  If a media or trans-
+       mission error causes a multi-block  .bz2  file  to  become
+       damaged,  it  may  be  possible  to  recover data from the
+       undamaged blocks in the file.
+
+       The compressed representation of each block  is  delimited
+       by  a  48-bit pattern, which makes it possible to find the
+       block boundaries with reasonable  certainty.   Each  block
+       also  carries its own 32-bit CRC, so damaged blocks can be
+       distinguished from undamaged ones.
+
+       bzip2recover is a  simple  program  whose  purpose  is  to
+       search  for blocks in .bz2 files, and write each block out
+       into its own .bz2 file.  You can then use bzip2 -t to test
+       the integrity of the resulting files, and decompress those
+       which are undamaged.
+
+       bzip2recover takes a single argument, the name of the dam-
+       aged    file,    and    writes    a    number   of   files
+       "rec00001file.bz2",  "rec00002file.bz2",  etc,  containing
+       the   extracted   blocks.   The   output   filenames   are
+       designed  so  that the use of wildcards in subsequent pro-
+       cessing  -- for example, "bzip2 -dc  rec*file.bz2 > recov-
+       ered_data" -- processes the files in the correct order.
+
+       bzip2recover should be of most use dealing with large .bz2
+       files,  as  these will contain many blocks.  It is clearly
+       futile to use it on damaged single-block  files,  since  a
+       damaged  block  cannot  be recovered.  If you wish to min-
+       imise any potential data loss through media  or  transmis-
+       sion errors, you might consider compressing with a smaller
+       block size.
+
+
+PERFORMANCE NOTES
+       The sorting phase of compression gathers together  similar
+       strings  in  the  file.  Because of this, files containing
+       very long runs of  repeated  symbols,  like  "aabaabaabaab
+       ..."   (repeated  several hundred times) may compress more
+       slowly than normal.  Versions 0.9.5 and  above  fare  much
+       better  than previous versions in this respect.  The ratio
+       between worst-case and average-case compression time is in
+       the  region  of  10:1.  For previous versions, this figure
+       was more like 100:1.  You can use the -vvvv option to mon-
+       itor progress in great detail, if you want.
+
+       Decompression speed is unaffected by these phenomena.
+
+       bzip2  usually  allocates  several  megabytes of memory to
+       operate in, and then charges all over it in a fairly  ran-
+       dom  fashion.   This means that performance, both for com-
+       pressing and decompressing, is largely determined  by  the
+       speed  at  which  your  machine  can service cache misses.
+       Because of this, small changes to the code to  reduce  the
+       miss  rate  have  been observed to give disproportionately
+       large performance improvements.  I imagine bzip2 will per-
+       form best on machines with very large caches.
+
+
+CAVEATS
+       I/O  error  messages  are not as helpful as they could be.
+       bzip2 tries hard to detect I/O errors  and  exit  cleanly,
+       but  the  details  of  what  the problem is sometimes seem
+       rather misleading.
+
+       This manual page pertains to version 1.0.4 of bzip2.  Com-
+       pressed  data created by this version is entirely forwards
+       and  backwards  compatible  with   the   previous   public
+       releases,  versions  0.1pl2,  0.9.0,  0.9.5, 1.0.0, 1.0.1,
+       1.0.2 and 1.0.3, but with the  following  exception: 0.9.0
+       and above can  correctly decompress  multiple concatenated
+       compressed files.  0.1pl2  cannot do this;  it  will  stop
+       after  decompressing just the first file in the stream.
+
+       bzip2recover  versions prior to 1.0.2 used 32-bit integers
+       to represent bit positions in compressed  files,  so  they
+       could  not handle compressed files more than 512 megabytes
+       long.  Versions 1.0.2 and above use 64-bit  ints  on  some
+       platforms  which  support them (GNU supported targets, and
+       Windows).  To establish whether or  not  bzip2recover  was
+       built  with  such  a limitation, run it without arguments.
+       In any event you can build yourself an  unlimited  version
+       if  you  can  recompile  it  with MaybeUInt64 set to be an
+       unsigned 64-bit integer.
+
+
+AUTHOR
+       Julian Seward, jsewardbzip.org.
+
+       http://www.bzip.org
+
+       The ideas embodied in bzip2 are due to (at least) the fol-
+       lowing  people: Michael Burrows and David Wheeler (for the
+       block sorting transformation), David Wheeler  (again,  for
+       the Huffman coder), Peter Fenwick (for the structured cod-
+       ing model in the original bzip, and many refinements), and
+       Alistair  Moffat,  Radford  Neal  and  Ian Witten (for the
+       arithmetic  coder  in  the  original  bzip).   I  am  much
+       indebted for their help, support and advice.  See the man-
+       ual in the source distribution for pointers to sources  of
+       documentation.  Christian von Roques encouraged me to look
+       for faster sorting algorithms, so as to speed up  compres-
+       sion.  Bela Lubkin encouraged me to improve the worst-case
+       compression performance.  Donna Robinson XMLised the docu-
+       mentation.   The bz* scripts are derived from those of GNU
+       gzip.  Many people sent patches, helped  with  portability
+       problems,  lent  machines,  gave advice and were generally
+       helpful.
+

Added: projects/external/bzip2-1.0.5/bzip2recover.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzip2recover.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,514 @@
+/*-----------------------------------------------------------*/
+/*--- Block recoverer program for bzip2                   ---*/
+/*---                                      bzip2recover.c ---*/
+/*-----------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+/* This program is a complete hack and should be rewritten properly.
+	 It isn't very complicated. */
+
+#include 
+#include 
+#include 
+#include 
+
+
+/* This program records bit locations in the file to be recovered.
+   That means that if 64-bit ints are not supported, we will not
+   be able to recover .bz2 files over 512MB (2^32 bits) long.
+   On GNU supported platforms, we take advantage of the 64-bit
+   int support to circumvent this problem.  Ditto MSVC.
+
+   This change occurred in version 1.0.2; all prior versions have
+   the 512MB limitation.
+*/
+#ifdef __GNUC__
+   typedef  unsigned long long int  MaybeUInt64;
+#  define MaybeUInt64_FMT "%Lu"
+#else
+#ifdef _MSC_VER
+   typedef  unsigned __int64  MaybeUInt64;
+#  define MaybeUInt64_FMT "%I64u"
+#else
+   typedef  unsigned int   MaybeUInt64;
+#  define MaybeUInt64_FMT "%u"
+#endif
+#endif
+
+typedef  unsigned int   UInt32;
+typedef  int            Int32;
+typedef  unsigned char  UChar;
+typedef  char           Char;
+typedef  unsigned char  Bool;
+#define True    ((Bool)1)
+#define False   ((Bool)0)
+
+
+#define BZ_MAX_FILENAME 2000
+
+Char inFileName[BZ_MAX_FILENAME];
+Char outFileName[BZ_MAX_FILENAME];
+Char progName[BZ_MAX_FILENAME];
+
+MaybeUInt64 bytesOut = 0;
+MaybeUInt64 bytesIn  = 0;
+
+
+/*---------------------------------------------------*/
+/*--- Header bytes                                ---*/
+/*---------------------------------------------------*/
+
+#define BZ_HDR_B 0x42                         /* 'B' */
+#define BZ_HDR_Z 0x5a                         /* 'Z' */
+#define BZ_HDR_h 0x68                         /* 'h' */
+#define BZ_HDR_0 0x30                         /* '0' */
+ 
+
+/*---------------------------------------------------*/
+/*--- I/O errors                                  ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------*/
+static void readError ( void )
+{
+   fprintf ( stderr,
+             "%s: I/O error reading `%s', possible reason follows.\n",
+            progName, inFileName );
+   perror ( progName );
+   fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+             progName );
+   exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void writeError ( void )
+{
+   fprintf ( stderr,
+             "%s: I/O error reading `%s', possible reason follows.\n",
+            progName, inFileName );
+   perror ( progName );
+   fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+             progName );
+   exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void mallocFail ( Int32 n )
+{
+   fprintf ( stderr,
+             "%s: malloc failed on request for %d bytes.\n",
+            progName, n );
+   fprintf ( stderr, "%s: warning: output file(s) may be incomplete.\n",
+             progName );
+   exit ( 1 );
+}
+
+
+/*---------------------------------------------*/
+static void tooManyBlocks ( Int32 max_handled_blocks )
+{
+   fprintf ( stderr,
+             "%s: `%s' appears to contain more than %d blocks\n",
+            progName, inFileName, max_handled_blocks );
+   fprintf ( stderr,
+             "%s: and cannot be handled.  To fix, increase\n",
+             progName );
+   fprintf ( stderr, 
+             "%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n",
+             progName );
+   exit ( 1 );
+}
+
+
+
+/*---------------------------------------------------*/
+/*--- Bit stream I/O                              ---*/
+/*---------------------------------------------------*/
+
+typedef
+   struct {
+      FILE*  handle;
+      Int32  buffer;
+      Int32  buffLive;
+      Char   mode;
+   }
+   BitStream;
+
+
+/*---------------------------------------------*/
+static BitStream* bsOpenReadStream ( FILE* stream )
+{
+   BitStream *bs = malloc ( sizeof(BitStream) );
+   if (bs == NULL) mallocFail ( sizeof(BitStream) );
+   bs->handle = stream;
+   bs->buffer = 0;
+   bs->buffLive = 0;
+   bs->mode = 'r';
+   return bs;
+}
+
+
+/*---------------------------------------------*/
+static BitStream* bsOpenWriteStream ( FILE* stream )
+{
+   BitStream *bs = malloc ( sizeof(BitStream) );
+   if (bs == NULL) mallocFail ( sizeof(BitStream) );
+   bs->handle = stream;
+   bs->buffer = 0;
+   bs->buffLive = 0;
+   bs->mode = 'w';
+   return bs;
+}
+
+
+/*---------------------------------------------*/
+static void bsPutBit ( BitStream* bs, Int32 bit )
+{
+   if (bs->buffLive == 8) {
+      Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
+      if (retVal == EOF) writeError();
+      bytesOut++;
+      bs->buffLive = 1;
+      bs->buffer = bit & 0x1;
+   } else {
+      bs->buffer = ( (bs->buffer << 1) | (bit & 0x1) );
+      bs->buffLive++;
+   };
+}
+
+
+/*---------------------------------------------*/
+/*--
+   Returns 0 or 1, or 2 to indicate EOF.
+--*/
+static Int32 bsGetBit ( BitStream* bs )
+{
+   if (bs->buffLive > 0) {
+      bs->buffLive --;
+      return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
+   } else {
+      Int32 retVal = getc ( bs->handle );
+      if ( retVal == EOF ) {
+         if (errno != 0) readError();
+         return 2;
+      }
+      bs->buffLive = 7;
+      bs->buffer = retVal;
+      return ( ((bs->buffer) >> 7) & 0x1 );
+   }
+}
+
+
+/*---------------------------------------------*/
+static void bsClose ( BitStream* bs )
+{
+   Int32 retVal;
+
+   if ( bs->mode == 'w' ) {
+      while ( bs->buffLive < 8 ) {
+         bs->buffLive++;
+         bs->buffer <<= 1;
+      };
+      retVal = putc ( (UChar) (bs->buffer), bs->handle );
+      if (retVal == EOF) writeError();
+      bytesOut++;
+      retVal = fflush ( bs->handle );
+      if (retVal == EOF) writeError();
+   }
+   retVal = fclose ( bs->handle );
+   if (retVal == EOF) {
+      if (bs->mode == 'w') writeError(); else readError();
+   }
+   free ( bs );
+}
+
+
+/*---------------------------------------------*/
+static void bsPutUChar ( BitStream* bs, UChar c )
+{
+   Int32 i;
+   for (i = 7; i >= 0; i--)
+      bsPutBit ( bs, (((UInt32) c) >> i) & 0x1 );
+}
+
+
+/*---------------------------------------------*/
+static void bsPutUInt32 ( BitStream* bs, UInt32 c )
+{
+   Int32 i;
+
+   for (i = 31; i >= 0; i--)
+      bsPutBit ( bs, (c >> i) & 0x1 );
+}
+
+
+/*---------------------------------------------*/
+static Bool endsInBz2 ( Char* name )
+{
+   Int32 n = strlen ( name );
+   if (n <= 4) return False;
+   return
+      (name[n-4] == '.' &&
+       name[n-3] == 'b' &&
+       name[n-2] == 'z' &&
+       name[n-1] == '2');
+}
+
+
+/*---------------------------------------------------*/
+/*---                                             ---*/
+/*---------------------------------------------------*/
+
+/* This logic isn't really right when it comes to Cygwin. */
+#ifdef _WIN32
+#  define  BZ_SPLIT_SYM  '\\'  /* path splitter on Windows platform */
+#else
+#  define  BZ_SPLIT_SYM  '/'   /* path splitter on Unix platform */
+#endif
+
+#define BLOCK_HEADER_HI  0x00003141UL
+#define BLOCK_HEADER_LO  0x59265359UL
+
+#define BLOCK_ENDMARK_HI 0x00001772UL
+#define BLOCK_ENDMARK_LO 0x45385090UL
+
+/* Increase if necessary.  However, a .bz2 file with > 50000 blocks
+   would have an uncompressed size of at least 40GB, so the chances
+   are low you'll need to up this.
+*/
+#define BZ_MAX_HANDLED_BLOCKS 50000
+
+MaybeUInt64 bStart [BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 bEnd   [BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 rbStart[BZ_MAX_HANDLED_BLOCKS];
+MaybeUInt64 rbEnd  [BZ_MAX_HANDLED_BLOCKS];
+
+Int32 main ( Int32 argc, Char** argv )
+{
+   FILE*       inFile;
+   FILE*       outFile;
+   BitStream*  bsIn, *bsWr;
+   Int32       b, wrBlock, currBlock, rbCtr;
+   MaybeUInt64 bitsRead;
+
+   UInt32      buffHi, buffLo, blockCRC;
+   Char*       p;
+
+   strcpy ( progName, argv[0] );
+   inFileName[0] = outFileName[0] = 0;
+
+   fprintf ( stderr, 
+             "bzip2recover 1.0.5: extracts blocks from damaged .bz2 files.\n" );
+
+   if (argc != 2) {
+      fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
+                        progName, progName );
+      switch (sizeof(MaybeUInt64)) {
+         case 8:
+            fprintf(stderr, 
+                    "\trestrictions on size of recovered file: None\n");
+            break;
+         case 4:
+            fprintf(stderr, 
+                    "\trestrictions on size of recovered file: 512 MB\n");
+            fprintf(stderr, 
+                    "\tto circumvent, recompile with MaybeUInt64 as an\n"
+                    "\tunsigned 64-bit int.\n");
+            break;
+         default:
+            fprintf(stderr, 
+                    "\tsizeof(MaybeUInt64) is not 4 or 8 -- "
+                    "configuration error.\n");
+            break;
+      }
+      exit(1);
+   }
+
+   if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) {
+      fprintf ( stderr, 
+                "%s: supplied filename is suspiciously (>= %d chars) long.  Bye!\n",
+                progName, (int)strlen(argv[1]) );
+      exit(1);
+   }
+
+   strcpy ( inFileName, argv[1] );
+
+   inFile = fopen ( inFileName, "rb" );
+   if (inFile == NULL) {
+      fprintf ( stderr, "%s: can't read `%s'\n", progName, inFileName );
+      exit(1);
+   }
+
+   bsIn = bsOpenReadStream ( inFile );
+   fprintf ( stderr, "%s: searching for block boundaries ...\n", progName );
+
+   bitsRead = 0;
+   buffHi = buffLo = 0;
+   currBlock = 0;
+   bStart[currBlock] = 0;
+
+   rbCtr = 0;
+
+   while (True) {
+      b = bsGetBit ( bsIn );
+      bitsRead++;
+      if (b == 2) {
+         if (bitsRead >= bStart[currBlock] &&
+            (bitsRead - bStart[currBlock]) >= 40) {
+            bEnd[currBlock] = bitsRead-1;
+            if (currBlock > 0)
+               fprintf ( stderr, "   block %d runs from " MaybeUInt64_FMT 
+                                 " to " MaybeUInt64_FMT " (incomplete)\n",
+                         currBlock,  bStart[currBlock], bEnd[currBlock] );
+         } else
+            currBlock--;
+         break;
+      }
+      buffHi = (buffHi << 1) | (buffLo >> 31);
+      buffLo = (buffLo << 1) | (b & 1);
+      if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI 
+             && buffLo == BLOCK_HEADER_LO)
+           || 
+           ( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI 
+             && buffLo == BLOCK_ENDMARK_LO)
+         ) {
+         if (bitsRead > 49) {
+            bEnd[currBlock] = bitsRead-49;
+         } else {
+            bEnd[currBlock] = 0;
+         }
+         if (currBlock > 0 &&
+	     (bEnd[currBlock] - bStart[currBlock]) >= 130) {
+            fprintf ( stderr, "   block %d runs from " MaybeUInt64_FMT 
+                              " to " MaybeUInt64_FMT "\n",
+                      rbCtr+1,  bStart[currBlock], bEnd[currBlock] );
+            rbStart[rbCtr] = bStart[currBlock];
+            rbEnd[rbCtr] = bEnd[currBlock];
+            rbCtr++;
+         }
+         if (currBlock >= BZ_MAX_HANDLED_BLOCKS)
+            tooManyBlocks(BZ_MAX_HANDLED_BLOCKS);
+         currBlock++;
+
+         bStart[currBlock] = bitsRead;
+      }
+   }
+
+   bsClose ( bsIn );
+
+   /*-- identified blocks run from 1 to rbCtr inclusive. --*/
+
+   if (rbCtr < 1) {
+      fprintf ( stderr,
+                "%s: sorry, I couldn't find any block boundaries.\n",
+                progName );
+      exit(1);
+   };
+
+   fprintf ( stderr, "%s: splitting into blocks\n", progName );
+
+   inFile = fopen ( inFileName, "rb" );
+   if (inFile == NULL) {
+      fprintf ( stderr, "%s: can't open `%s'\n", progName, inFileName );
+      exit(1);
+   }
+   bsIn = bsOpenReadStream ( inFile );
+
+   /*-- placate gcc's dataflow analyser --*/
+   blockCRC = 0; bsWr = 0;
+
+   bitsRead = 0;
+   outFile = NULL;
+   wrBlock = 0;
+   while (True) {
+      b = bsGetBit(bsIn);
+      if (b == 2) break;
+      buffHi = (buffHi << 1) | (buffLo >> 31);
+      buffLo = (buffLo << 1) | (b & 1);
+      if (bitsRead == 47+rbStart[wrBlock]) 
+         blockCRC = (buffHi << 16) | (buffLo >> 16);
+
+      if (outFile != NULL && bitsRead >= rbStart[wrBlock]
+                          && bitsRead <= rbEnd[wrBlock]) {
+         bsPutBit ( bsWr, b );
+      }
+
+      bitsRead++;
+
+      if (bitsRead == rbEnd[wrBlock]+1) {
+         if (outFile != NULL) {
+            bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 );
+            bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 );
+            bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
+            bsPutUInt32 ( bsWr, blockCRC );
+            bsClose ( bsWr );
+         }
+         if (wrBlock >= rbCtr) break;
+         wrBlock++;
+      } else
+      if (bitsRead == rbStart[wrBlock]) {
+         /* Create the output file name, correctly handling leading paths. 
+            (31.10.2001 by Sergey E. Kusikov) */
+         Char* split;
+         Int32 ofs, k;
+         for (k = 0; k < BZ_MAX_FILENAME; k++) 
+            outFileName[k] = 0;
+         strcpy (outFileName, inFileName);
+         split = strrchr (outFileName, BZ_SPLIT_SYM);
+         if (split == NULL) {
+            split = outFileName;
+         } else {
+            ++split;
+	 }
+	 /* Now split points to the start of the basename. */
+         ofs  = split - outFileName;
+         sprintf (split, "rec%5d", wrBlock+1);
+         for (p = split; *p != 0; p++) if (*p == ' ') *p = '0';
+         strcat (outFileName, inFileName + ofs);
+
+         if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2" );
+
+         fprintf ( stderr, "   writing block %d to `%s' ...\n",
+                           wrBlock+1, outFileName );
+
+         outFile = fopen ( outFileName, "wb" );
+         if (outFile == NULL) {
+            fprintf ( stderr, "%s: can't write `%s'\n",
+                      progName, outFileName );
+            exit(1);
+         }
+         bsWr = bsOpenWriteStream ( outFile );
+         bsPutUChar ( bsWr, BZ_HDR_B );    
+         bsPutUChar ( bsWr, BZ_HDR_Z );    
+         bsPutUChar ( bsWr, BZ_HDR_h );    
+         bsPutUChar ( bsWr, BZ_HDR_0 + 9 );
+         bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 );
+         bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 );
+         bsPutUChar ( bsWr, 0x53 ); bsPutUChar ( bsWr, 0x59 );
+      }
+   }
+
+   fprintf ( stderr, "%s: finished\n", progName );
+   return 0;
+}
+
+
+
+/*-----------------------------------------------------------*/
+/*--- end                                  bzip2recover.c ---*/
+/*-----------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bzlib.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzlib.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,1572 @@
+
+/*-------------------------------------------------------------*/
+/*--- Library top-level functions.                          ---*/
+/*---                                               bzlib.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+/* CHANGES
+   0.9.0    -- original version.
+   0.9.0a/b -- no changes in this file.
+   0.9.0c   -- made zero-length BZ_FLUSH work correctly in bzCompress().
+     fixed bzWrite/bzRead to ignore zero-length requests.
+     fixed bzread to correctly handle read requests after EOF.
+     wrong parameter order in call to bzDecompressInit in
+     bzBuffToBuffDecompress.  Fixed.
+*/
+
+#include "bzlib_private.h"
+
+
+/*---------------------------------------------------*/
+/*--- Compression stuff                           ---*/
+/*---------------------------------------------------*/
+
+
+/*---------------------------------------------------*/
+#ifndef BZ_NO_STDIO
+void BZ2_bz__AssertH__fail ( int errcode )
+{
+   fprintf(stderr, 
+      "\n\nbzip2/libbzip2: internal error number %d.\n"
+      "This is a bug in bzip2/libbzip2, %s.\n"
+      "Please report it to me at: jseward at bzip.org.  If this happened\n"
+      "when you were using some program which uses libbzip2 as a\n"
+      "component, you should also report this bug to the author(s)\n"
+      "of that program.  Please make an effort to report this bug;\n"
+      "timely and accurate bug reports eventually lead to higher\n"
+      "quality software.  Thanks.  Julian Seward, 10 December 2007.\n\n",
+      errcode,
+      BZ2_bzlibVersion()
+   );
+
+   if (errcode == 1007) {
+   fprintf(stderr,
+      "\n*** A special note about internal error number 1007 ***\n"
+      "\n"
+      "Experience suggests that a common cause of i.e. 1007\n"
+      "is unreliable memory or other hardware.  The 1007 assertion\n"
+      "just happens to cross-check the results of huge numbers of\n"
+      "memory reads/writes, and so acts (unintendedly) as a stress\n"
+      "test of your memory system.\n"
+      "\n"
+      "I suggest the following: try compressing the file again,\n"
+      "possibly monitoring progress in detail with the -vv flag.\n"
+      "\n"
+      "* If the error cannot be reproduced, and/or happens at different\n"
+      "  points in compression, you may have a flaky memory system.\n"
+      "  Try a memory-test program.  I have used Memtest86\n"
+      "  (www.memtest86.com).  At the time of writing it is free (GPLd).\n"
+      "  Memtest86 tests memory much more thorougly than your BIOSs\n"
+      "  power-on test, and may find failures that the BIOS doesn't.\n"
+      "\n"
+      "* If the error can be repeatably reproduced, this is a bug in\n"
+      "  bzip2, and I would very much like to hear about it.  Please\n"
+      "  let me know, and, ideally, save a copy of the file causing the\n"
+      "  problem -- without which I will be unable to investigate it.\n"
+      "\n"
+   );
+   }
+
+   exit(3);
+}
+#endif
+
+
+/*---------------------------------------------------*/
+static
+int bz_config_ok ( void )
+{
+   if (sizeof(int)   != 4) return 0;
+   if (sizeof(short) != 2) return 0;
+   if (sizeof(char)  != 1) return 0;
+   return 1;
+}
+
+
+/*---------------------------------------------------*/
+static
+void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
+{
+   void* v = malloc ( items * size );
+   return v;
+}
+
+static
+void default_bzfree ( void* opaque, void* addr )
+{
+   if (addr != NULL) free ( addr );
+}
+
+
+/*---------------------------------------------------*/
+static
+void prepare_new_block ( EState* s )
+{
+   Int32 i;
+   s->nblock = 0;
+   s->numZ = 0;
+   s->state_out_pos = 0;
+   BZ_INITIALISE_CRC ( s->blockCRC );
+   for (i = 0; i < 256; i++) s->inUse[i] = False;
+   s->blockNo++;
+}
+
+
+/*---------------------------------------------------*/
+static
+void init_RL ( EState* s )
+{
+   s->state_in_ch  = 256;
+   s->state_in_len = 0;
+}
+
+
+static
+Bool isempty_RL ( EState* s )
+{
+   if (s->state_in_ch < 256 && s->state_in_len > 0)
+      return False; else
+      return True;
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzCompressInit) 
+                    ( bz_stream* strm, 
+                     int        blockSize100k,
+                     int        verbosity,
+                     int        workFactor )
+{
+   Int32   n;
+   EState* s;
+
+   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
+
+   if (strm == NULL || 
+       blockSize100k < 1 || blockSize100k > 9 ||
+       workFactor < 0 || workFactor > 250)
+     return BZ_PARAM_ERROR;
+
+   if (workFactor == 0) workFactor = 30;
+   if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
+   if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
+
+   s = BZALLOC( sizeof(EState) );
+   if (s == NULL) return BZ_MEM_ERROR;
+   s->strm = strm;
+
+   s->arr1 = NULL;
+   s->arr2 = NULL;
+   s->ftab = NULL;
+
+   n       = 100000 * blockSize100k;
+   s->arr1 = BZALLOC( n                  * sizeof(UInt32) );
+   s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
+   s->ftab = BZALLOC( 65537              * sizeof(UInt32) );
+
+   if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
+      if (s->arr1 != NULL) BZFREE(s->arr1);
+      if (s->arr2 != NULL) BZFREE(s->arr2);
+      if (s->ftab != NULL) BZFREE(s->ftab);
+      if (s       != NULL) BZFREE(s);
+      return BZ_MEM_ERROR;
+   }
+
+   s->blockNo           = 0;
+   s->state             = BZ_S_INPUT;
+   s->mode              = BZ_M_RUNNING;
+   s->combinedCRC       = 0;
+   s->blockSize100k     = blockSize100k;
+   s->nblockMAX         = 100000 * blockSize100k - 19;
+   s->verbosity         = verbosity;
+   s->workFactor        = workFactor;
+
+   s->block             = (UChar*)s->arr2;
+   s->mtfv              = (UInt16*)s->arr1;
+   s->zbits             = NULL;
+   s->ptr               = (UInt32*)s->arr1;
+
+   strm->state          = s;
+   strm->total_in_lo32  = 0;
+   strm->total_in_hi32  = 0;
+   strm->total_out_lo32 = 0;
+   strm->total_out_hi32 = 0;
+   init_RL ( s );
+   prepare_new_block ( s );
+   return BZ_OK;
+}
+
+
+/*---------------------------------------------------*/
+static
+void add_pair_to_block ( EState* s )
+{
+   Int32 i;
+   UChar ch = (UChar)(s->state_in_ch);
+   for (i = 0; i < s->state_in_len; i++) {
+      BZ_UPDATE_CRC( s->blockCRC, ch );
+   }
+   s->inUse[s->state_in_ch] = True;
+   switch (s->state_in_len) {
+      case 1:
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         break;
+      case 2:
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         break;
+      case 3:
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         break;
+      default:
+         s->inUse[s->state_in_len-4] = True;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = (UChar)ch; s->nblock++;
+         s->block[s->nblock] = ((UChar)(s->state_in_len-4));
+         s->nblock++;
+         break;
+   }
+}
+
+
+/*---------------------------------------------------*/
+static
+void flush_RL ( EState* s )
+{
+   if (s->state_in_ch < 256) add_pair_to_block ( s );
+   init_RL ( s );
+}
+
+
+/*---------------------------------------------------*/
+#define ADD_CHAR_TO_BLOCK(zs,zchh0)               \
+{                                                 \
+   UInt32 zchh = (UInt32)(zchh0);                 \
+   /*-- fast track the common case --*/           \
+   if (zchh != zs->state_in_ch &&                 \
+       zs->state_in_len == 1) {                   \
+      UChar ch = (UChar)(zs->state_in_ch);        \
+      BZ_UPDATE_CRC( zs->blockCRC, ch );          \
+      zs->inUse[zs->state_in_ch] = True;          \
+      zs->block[zs->nblock] = (UChar)ch;          \
+      zs->nblock++;                               \
+      zs->state_in_ch = zchh;                     \
+   }                                              \
+   else                                           \
+   /*-- general, uncommon cases --*/              \
+   if (zchh != zs->state_in_ch ||                 \
+      zs->state_in_len == 255) {                  \
+      if (zs->state_in_ch < 256)                  \
+         add_pair_to_block ( zs );                \
+      zs->state_in_ch = zchh;                     \
+      zs->state_in_len = 1;                       \
+   } else {                                       \
+      zs->state_in_len++;                         \
+   }                                              \
+}
+
+
+/*---------------------------------------------------*/
+static
+Bool copy_input_until_stop ( EState* s )
+{
+   Bool progress_in = False;
+
+   if (s->mode == BZ_M_RUNNING) {
+
+      /*-- fast track the common case --*/
+      while (True) {
+         /*-- block full? --*/
+         if (s->nblock >= s->nblockMAX) break;
+         /*-- no input? --*/
+         if (s->strm->avail_in == 0) break;
+         progress_in = True;
+         ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); 
+         s->strm->next_in++;
+         s->strm->avail_in--;
+         s->strm->total_in_lo32++;
+         if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
+      }
+
+   } else {
+
+      /*-- general, uncommon case --*/
+      while (True) {
+         /*-- block full? --*/
+         if (s->nblock >= s->nblockMAX) break;
+         /*-- no input? --*/
+         if (s->strm->avail_in == 0) break;
+         /*-- flush/finish end? --*/
+         if (s->avail_in_expect == 0) break;
+         progress_in = True;
+         ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); 
+         s->strm->next_in++;
+         s->strm->avail_in--;
+         s->strm->total_in_lo32++;
+         if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
+         s->avail_in_expect--;
+      }
+   }
+   return progress_in;
+}
+
+
+/*---------------------------------------------------*/
+static
+Bool copy_output_until_stop ( EState* s )
+{
+   Bool progress_out = False;
+
+   while (True) {
+
+      /*-- no output space? --*/
+      if (s->strm->avail_out == 0) break;
+
+      /*-- block done? --*/
+      if (s->state_out_pos >= s->numZ) break;
+
+      progress_out = True;
+      *(s->strm->next_out) = s->zbits[s->state_out_pos];
+      s->state_out_pos++;
+      s->strm->avail_out--;
+      s->strm->next_out++;
+      s->strm->total_out_lo32++;
+      if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
+   }
+
+   return progress_out;
+}
+
+
+/*---------------------------------------------------*/
+static
+Bool handle_compress ( bz_stream* strm )
+{
+   Bool progress_in  = False;
+   Bool progress_out = False;
+   EState* s = strm->state;
+   
+   while (True) {
+
+      if (s->state == BZ_S_OUTPUT) {
+         progress_out |= copy_output_until_stop ( s );
+         if (s->state_out_pos < s->numZ) break;
+         if (s->mode == BZ_M_FINISHING && 
+             s->avail_in_expect == 0 &&
+             isempty_RL(s)) break;
+         prepare_new_block ( s );
+         s->state = BZ_S_INPUT;
+         if (s->mode == BZ_M_FLUSHING && 
+             s->avail_in_expect == 0 &&
+             isempty_RL(s)) break;
+      }
+
+      if (s->state == BZ_S_INPUT) {
+         progress_in |= copy_input_until_stop ( s );
+         if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
+            flush_RL ( s );
+            BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) );
+            s->state = BZ_S_OUTPUT;
+         }
+         else
+         if (s->nblock >= s->nblockMAX) {
+            BZ2_compressBlock ( s, False );
+            s->state = BZ_S_OUTPUT;
+         }
+         else
+         if (s->strm->avail_in == 0) {
+            break;
+         }
+      }
+
+   }
+
+   return progress_in || progress_out;
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
+{
+   Bool progress;
+   EState* s;
+   if (strm == NULL) return BZ_PARAM_ERROR;
+   s = strm->state;
+   if (s == NULL) return BZ_PARAM_ERROR;
+   if (s->strm != strm) return BZ_PARAM_ERROR;
+
+   preswitch:
+   switch (s->mode) {
+
+      case BZ_M_IDLE:
+         return BZ_SEQUENCE_ERROR;
+
+      case BZ_M_RUNNING:
+         if (action == BZ_RUN) {
+            progress = handle_compress ( strm );
+            return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
+         } 
+         else
+	 if (action == BZ_FLUSH) {
+            s->avail_in_expect = strm->avail_in;
+            s->mode = BZ_M_FLUSHING;
+            goto preswitch;
+         }
+         else
+         if (action == BZ_FINISH) {
+            s->avail_in_expect = strm->avail_in;
+            s->mode = BZ_M_FINISHING;
+            goto preswitch;
+         }
+         else 
+            return BZ_PARAM_ERROR;
+
+      case BZ_M_FLUSHING:
+         if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
+         if (s->avail_in_expect != s->strm->avail_in) 
+            return BZ_SEQUENCE_ERROR;
+         progress = handle_compress ( strm );
+         if (s->avail_in_expect > 0 || !isempty_RL(s) ||
+             s->state_out_pos < s->numZ) return BZ_FLUSH_OK;
+         s->mode = BZ_M_RUNNING;
+         return BZ_RUN_OK;
+
+      case BZ_M_FINISHING:
+         if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
+         if (s->avail_in_expect != s->strm->avail_in) 
+            return BZ_SEQUENCE_ERROR;
+         progress = handle_compress ( strm );
+         if (!progress) return BZ_SEQUENCE_ERROR;
+         if (s->avail_in_expect > 0 || !isempty_RL(s) ||
+             s->state_out_pos < s->numZ) return BZ_FINISH_OK;
+         s->mode = BZ_M_IDLE;
+         return BZ_STREAM_END;
+   }
+   return BZ_OK; /*--not reached--*/
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzCompressEnd)  ( bz_stream *strm )
+{
+   EState* s;
+   if (strm == NULL) return BZ_PARAM_ERROR;
+   s = strm->state;
+   if (s == NULL) return BZ_PARAM_ERROR;
+   if (s->strm != strm) return BZ_PARAM_ERROR;
+
+   if (s->arr1 != NULL) BZFREE(s->arr1);
+   if (s->arr2 != NULL) BZFREE(s->arr2);
+   if (s->ftab != NULL) BZFREE(s->ftab);
+   BZFREE(strm->state);
+
+   strm->state = NULL;   
+
+   return BZ_OK;
+}
+
+
+/*---------------------------------------------------*/
+/*--- Decompression stuff                         ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzDecompressInit) 
+                     ( bz_stream* strm, 
+                       int        verbosity,
+                       int        small )
+{
+   DState* s;
+
+   if (!bz_config_ok()) return BZ_CONFIG_ERROR;
+
+   if (strm == NULL) return BZ_PARAM_ERROR;
+   if (small != 0 && small != 1) return BZ_PARAM_ERROR;
+   if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
+
+   if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
+   if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
+
+   s = BZALLOC( sizeof(DState) );
+   if (s == NULL) return BZ_MEM_ERROR;
+   s->strm                  = strm;
+   strm->state              = s;
+   s->state                 = BZ_X_MAGIC_1;
+   s->bsLive                = 0;
+   s->bsBuff                = 0;
+   s->calculatedCombinedCRC = 0;
+   strm->total_in_lo32      = 0;
+   strm->total_in_hi32      = 0;
+   strm->total_out_lo32     = 0;
+   strm->total_out_hi32     = 0;
+   s->smallDecompress       = (Bool)small;
+   s->ll4                   = NULL;
+   s->ll16                  = NULL;
+   s->tt                    = NULL;
+   s->currBlockNo           = 0;
+   s->verbosity             = verbosity;
+
+   return BZ_OK;
+}
+
+
+/*---------------------------------------------------*/
+/* Return  True iff data corruption is discovered.
+   Returns False if there is no problem.
+*/
+static
+Bool unRLE_obuf_to_output_FAST ( DState* s )
+{
+   UChar k1;
+
+   if (s->blockRandomised) {
+
+      while (True) {
+         /* try to finish existing run */
+         while (True) {
+            if (s->strm->avail_out == 0) return False;
+            if (s->state_out_len == 0) break;
+            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
+            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
+            s->state_out_len--;
+            s->strm->next_out++;
+            s->strm->avail_out--;
+            s->strm->total_out_lo32++;
+            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
+         }
+
+         /* can a new run be started? */
+         if (s->nblock_used == s->save_nblock+1) return False;
+               
+         /* Only caused by corrupt data stream? */
+         if (s->nblock_used > s->save_nblock+1)
+            return True;
+   
+         s->state_out_len = 1;
+         s->state_out_ch = s->k0;
+         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 2;
+         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 3;
+         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         s->state_out_len = ((Int32)k1) + 4;
+         BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; 
+         s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
+      }
+
+   } else {
+
+      /* restore */
+      UInt32        c_calculatedBlockCRC = s->calculatedBlockCRC;
+      UChar         c_state_out_ch       = s->state_out_ch;
+      Int32         c_state_out_len      = s->state_out_len;
+      Int32         c_nblock_used        = s->nblock_used;
+      Int32         c_k0                 = s->k0;
+      UInt32*       c_tt                 = s->tt;
+      UInt32        c_tPos               = s->tPos;
+      char*         cs_next_out          = s->strm->next_out;
+      unsigned int  cs_avail_out         = s->strm->avail_out;
+      Int32         ro_blockSize100k     = s->blockSize100k;
+      /* end restore */
+
+      UInt32       avail_out_INIT = cs_avail_out;
+      Int32        s_save_nblockPP = s->save_nblock+1;
+      unsigned int total_out_lo32_old;
+
+      while (True) {
+
+         /* try to finish existing run */
+         if (c_state_out_len > 0) {
+            while (True) {
+               if (cs_avail_out == 0) goto return_notr;
+               if (c_state_out_len == 1) break;
+               *( (UChar*)(cs_next_out) ) = c_state_out_ch;
+               BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
+               c_state_out_len--;
+               cs_next_out++;
+               cs_avail_out--;
+            }
+            s_state_out_len_eq_one:
+            {
+               if (cs_avail_out == 0) { 
+                  c_state_out_len = 1; goto return_notr;
+               };
+               *( (UChar*)(cs_next_out) ) = c_state_out_ch;
+               BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch );
+               cs_next_out++;
+               cs_avail_out--;
+            }
+         }   
+         /* Only caused by corrupt data stream? */
+         if (c_nblock_used > s_save_nblockPP)
+            return True;
+
+         /* can a new run be started? */
+         if (c_nblock_used == s_save_nblockPP) {
+            c_state_out_len = 0; goto return_notr;
+         };   
+         c_state_out_ch = c_k0;
+         BZ_GET_FAST_C(k1); c_nblock_used++;
+         if (k1 != c_k0) { 
+            c_k0 = k1; goto s_state_out_len_eq_one; 
+         };
+         if (c_nblock_used == s_save_nblockPP) 
+            goto s_state_out_len_eq_one;
+   
+         c_state_out_len = 2;
+         BZ_GET_FAST_C(k1); c_nblock_used++;
+         if (c_nblock_used == s_save_nblockPP) continue;
+         if (k1 != c_k0) { c_k0 = k1; continue; };
+   
+         c_state_out_len = 3;
+         BZ_GET_FAST_C(k1); c_nblock_used++;
+         if (c_nblock_used == s_save_nblockPP) continue;
+         if (k1 != c_k0) { c_k0 = k1; continue; };
+   
+         BZ_GET_FAST_C(k1); c_nblock_used++;
+         c_state_out_len = ((Int32)k1) + 4;
+         BZ_GET_FAST_C(c_k0); c_nblock_used++;
+      }
+
+      return_notr:
+      total_out_lo32_old = s->strm->total_out_lo32;
+      s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
+      if (s->strm->total_out_lo32 < total_out_lo32_old)
+         s->strm->total_out_hi32++;
+
+      /* save */
+      s->calculatedBlockCRC = c_calculatedBlockCRC;
+      s->state_out_ch       = c_state_out_ch;
+      s->state_out_len      = c_state_out_len;
+      s->nblock_used        = c_nblock_used;
+      s->k0                 = c_k0;
+      s->tt                 = c_tt;
+      s->tPos               = c_tPos;
+      s->strm->next_out     = cs_next_out;
+      s->strm->avail_out    = cs_avail_out;
+      /* end save */
+   }
+   return False;
+}
+
+
+
+/*---------------------------------------------------*/
+__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
+{
+   Int32 nb, na, mid;
+   nb = 0;
+   na = 256;
+   do {
+      mid = (nb + na) >> 1;
+      if (indx >= cftab[mid]) nb = mid; else na = mid;
+   }
+   while (na - nb != 1);
+   return nb;
+}
+
+
+/*---------------------------------------------------*/
+/* Return  True iff data corruption is discovered.
+   Returns False if there is no problem.
+*/
+static
+Bool unRLE_obuf_to_output_SMALL ( DState* s )
+{
+   UChar k1;
+
+   if (s->blockRandomised) {
+
+      while (True) {
+         /* try to finish existing run */
+         while (True) {
+            if (s->strm->avail_out == 0) return False;
+            if (s->state_out_len == 0) break;
+            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
+            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
+            s->state_out_len--;
+            s->strm->next_out++;
+            s->strm->avail_out--;
+            s->strm->total_out_lo32++;
+            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
+         }
+   
+         /* can a new run be started? */
+         if (s->nblock_used == s->save_nblock+1) return False;
+
+         /* Only caused by corrupt data stream? */
+         if (s->nblock_used > s->save_nblock+1)
+            return True;
+   
+         s->state_out_len = 1;
+         s->state_out_ch = s->k0;
+         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 2;
+         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 3;
+         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; 
+         k1 ^= BZ_RAND_MASK; s->nblock_used++;
+         s->state_out_len = ((Int32)k1) + 4;
+         BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; 
+         s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
+      }
+
+   } else {
+
+      while (True) {
+         /* try to finish existing run */
+         while (True) {
+            if (s->strm->avail_out == 0) return False;
+            if (s->state_out_len == 0) break;
+            *( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
+            BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch );
+            s->state_out_len--;
+            s->strm->next_out++;
+            s->strm->avail_out--;
+            s->strm->total_out_lo32++;
+            if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
+         }
+   
+         /* can a new run be started? */
+         if (s->nblock_used == s->save_nblock+1) return False;
+
+         /* Only caused by corrupt data stream? */
+         if (s->nblock_used > s->save_nblock+1)
+            return True;
+   
+         s->state_out_len = 1;
+         s->state_out_ch = s->k0;
+         BZ_GET_SMALL(k1); s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 2;
+         BZ_GET_SMALL(k1); s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         s->state_out_len = 3;
+         BZ_GET_SMALL(k1); s->nblock_used++;
+         if (s->nblock_used == s->save_nblock+1) continue;
+         if (k1 != s->k0) { s->k0 = k1; continue; };
+   
+         BZ_GET_SMALL(k1); s->nblock_used++;
+         s->state_out_len = ((Int32)k1) + 4;
+         BZ_GET_SMALL(s->k0); s->nblock_used++;
+      }
+
+   }
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
+{
+   Bool    corrupt;
+   DState* s;
+   if (strm == NULL) return BZ_PARAM_ERROR;
+   s = strm->state;
+   if (s == NULL) return BZ_PARAM_ERROR;
+   if (s->strm != strm) return BZ_PARAM_ERROR;
+
+   while (True) {
+      if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
+      if (s->state == BZ_X_OUTPUT) {
+         if (s->smallDecompress)
+            corrupt = unRLE_obuf_to_output_SMALL ( s ); else
+            corrupt = unRLE_obuf_to_output_FAST  ( s );
+         if (corrupt) return BZ_DATA_ERROR;
+         if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
+            BZ_FINALISE_CRC ( s->calculatedBlockCRC );
+            if (s->verbosity >= 3) 
+               VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, 
+                          s->calculatedBlockCRC );
+            if (s->verbosity >= 2) VPrintf0 ( "]" );
+            if (s->calculatedBlockCRC != s->storedBlockCRC)
+               return BZ_DATA_ERROR;
+            s->calculatedCombinedCRC 
+               = (s->calculatedCombinedCRC << 1) | 
+                    (s->calculatedCombinedCRC >> 31);
+            s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
+            s->state = BZ_X_BLKHDR_1;
+         } else {
+            return BZ_OK;
+         }
+      }
+      if (s->state >= BZ_X_MAGIC_1) {
+         Int32 r = BZ2_decompress ( s );
+         if (r == BZ_STREAM_END) {
+            if (s->verbosity >= 3)
+               VPrintf2 ( "\n    combined CRCs: stored = 0x%08x, computed = 0x%08x", 
+                          s->storedCombinedCRC, s->calculatedCombinedCRC );
+            if (s->calculatedCombinedCRC != s->storedCombinedCRC)
+               return BZ_DATA_ERROR;
+            return r;
+         }
+         if (s->state != BZ_X_OUTPUT) return r;
+      }
+   }
+
+   AssertH ( 0, 6001 );
+
+   return 0;  /*NOTREACHED*/
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzDecompressEnd)  ( bz_stream *strm )
+{
+   DState* s;
+   if (strm == NULL) return BZ_PARAM_ERROR;
+   s = strm->state;
+   if (s == NULL) return BZ_PARAM_ERROR;
+   if (s->strm != strm) return BZ_PARAM_ERROR;
+
+   if (s->tt   != NULL) BZFREE(s->tt);
+   if (s->ll16 != NULL) BZFREE(s->ll16);
+   if (s->ll4  != NULL) BZFREE(s->ll4);
+
+   BZFREE(strm->state);
+   strm->state = NULL;
+
+   return BZ_OK;
+}
+
+
+#ifndef BZ_NO_STDIO
+/*---------------------------------------------------*/
+/*--- File I/O stuff                              ---*/
+/*---------------------------------------------------*/
+
+#define BZ_SETERR(eee)                    \
+{                                         \
+   if (bzerror != NULL) *bzerror = eee;   \
+   if (bzf != NULL) bzf->lastErr = eee;   \
+}
+
+typedef 
+   struct {
+      FILE*     handle;
+      Char      buf[BZ_MAX_UNUSED];
+      Int32     bufN;
+      Bool      writing;
+      bz_stream strm;
+      Int32     lastErr;
+      Bool      initialisedOk;
+   }
+   bzFile;
+
+
+/*---------------------------------------------*/
+static Bool myfeof ( FILE* f )
+{
+   Int32 c = fgetc ( f );
+   if (c == EOF) return True;
+   ungetc ( c, f );
+   return False;
+}
+
+
+/*---------------------------------------------------*/
+BZFILE* BZ_API(BZ2_bzWriteOpen) 
+                    ( int*  bzerror,      
+                      FILE* f, 
+                      int   blockSize100k, 
+                      int   verbosity,
+                      int   workFactor )
+{
+   Int32   ret;
+   bzFile* bzf = NULL;
+
+   BZ_SETERR(BZ_OK);
+
+   if (f == NULL ||
+       (blockSize100k < 1 || blockSize100k > 9) ||
+       (workFactor < 0 || workFactor > 250) ||
+       (verbosity < 0 || verbosity > 4))
+      { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
+
+   if (ferror(f))
+      { BZ_SETERR(BZ_IO_ERROR); return NULL; };
+
+   bzf = malloc ( sizeof(bzFile) );
+   if (bzf == NULL)
+      { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
+
+   BZ_SETERR(BZ_OK);
+   bzf->initialisedOk = False;
+   bzf->bufN          = 0;
+   bzf->handle        = f;
+   bzf->writing       = True;
+   bzf->strm.bzalloc  = NULL;
+   bzf->strm.bzfree   = NULL;
+   bzf->strm.opaque   = NULL;
+
+   if (workFactor == 0) workFactor = 30;
+   ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, 
+                              verbosity, workFactor );
+   if (ret != BZ_OK)
+      { BZ_SETERR(ret); free(bzf); return NULL; };
+
+   bzf->strm.avail_in = 0;
+   bzf->initialisedOk = True;
+   return bzf;   
+}
+
+
+
+/*---------------------------------------------------*/
+void BZ_API(BZ2_bzWrite)
+             ( int*    bzerror, 
+               BZFILE* b, 
+               void*   buf, 
+               int     len )
+{
+   Int32 n, n2, ret;
+   bzFile* bzf = (bzFile*)b;
+
+   BZ_SETERR(BZ_OK);
+   if (bzf == NULL || buf == NULL || len < 0)
+      { BZ_SETERR(BZ_PARAM_ERROR); return; };
+   if (!(bzf->writing))
+      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
+   if (ferror(bzf->handle))
+      { BZ_SETERR(BZ_IO_ERROR); return; };
+
+   if (len == 0)
+      { BZ_SETERR(BZ_OK); return; };
+
+   bzf->strm.avail_in = len;
+   bzf->strm.next_in  = buf;
+
+   while (True) {
+      bzf->strm.avail_out = BZ_MAX_UNUSED;
+      bzf->strm.next_out = bzf->buf;
+      ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN );
+      if (ret != BZ_RUN_OK)
+         { BZ_SETERR(ret); return; };
+
+      if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
+         n = BZ_MAX_UNUSED - bzf->strm.avail_out;
+         n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), 
+                       n, bzf->handle );
+         if (n != n2 || ferror(bzf->handle))
+            { BZ_SETERR(BZ_IO_ERROR); return; };
+      }
+
+      if (bzf->strm.avail_in == 0)
+         { BZ_SETERR(BZ_OK); return; };
+   }
+}
+
+
+/*---------------------------------------------------*/
+void BZ_API(BZ2_bzWriteClose)
+                  ( int*          bzerror, 
+                    BZFILE*       b, 
+                    int           abandon,
+                    unsigned int* nbytes_in,
+                    unsigned int* nbytes_out )
+{
+   BZ2_bzWriteClose64 ( bzerror, b, abandon, 
+                        nbytes_in, NULL, nbytes_out, NULL );
+}
+
+
+void BZ_API(BZ2_bzWriteClose64)
+                  ( int*          bzerror, 
+                    BZFILE*       b, 
+                    int           abandon,
+                    unsigned int* nbytes_in_lo32,
+                    unsigned int* nbytes_in_hi32,
+                    unsigned int* nbytes_out_lo32,
+                    unsigned int* nbytes_out_hi32 )
+{
+   Int32   n, n2, ret;
+   bzFile* bzf = (bzFile*)b;
+
+   if (bzf == NULL)
+      { BZ_SETERR(BZ_OK); return; };
+   if (!(bzf->writing))
+      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
+   if (ferror(bzf->handle))
+      { BZ_SETERR(BZ_IO_ERROR); return; };
+
+   if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0;
+   if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0;
+   if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0;
+   if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0;
+
+   if ((!abandon) && bzf->lastErr == BZ_OK) {
+      while (True) {
+         bzf->strm.avail_out = BZ_MAX_UNUSED;
+         bzf->strm.next_out = bzf->buf;
+         ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH );
+         if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END)
+            { BZ_SETERR(ret); return; };
+
+         if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
+            n = BZ_MAX_UNUSED - bzf->strm.avail_out;
+            n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), 
+                          n, bzf->handle );
+            if (n != n2 || ferror(bzf->handle))
+               { BZ_SETERR(BZ_IO_ERROR); return; };
+         }
+
+         if (ret == BZ_STREAM_END) break;
+      }
+   }
+
+   if ( !abandon && !ferror ( bzf->handle ) ) {
+      fflush ( bzf->handle );
+      if (ferror(bzf->handle))
+         { BZ_SETERR(BZ_IO_ERROR); return; };
+   }
+
+   if (nbytes_in_lo32 != NULL)
+      *nbytes_in_lo32 = bzf->strm.total_in_lo32;
+   if (nbytes_in_hi32 != NULL)
+      *nbytes_in_hi32 = bzf->strm.total_in_hi32;
+   if (nbytes_out_lo32 != NULL)
+      *nbytes_out_lo32 = bzf->strm.total_out_lo32;
+   if (nbytes_out_hi32 != NULL)
+      *nbytes_out_hi32 = bzf->strm.total_out_hi32;
+
+   BZ_SETERR(BZ_OK);
+   BZ2_bzCompressEnd ( &(bzf->strm) );
+   free ( bzf );
+}
+
+
+/*---------------------------------------------------*/
+BZFILE* BZ_API(BZ2_bzReadOpen) 
+                   ( int*  bzerror, 
+                     FILE* f, 
+                     int   verbosity,
+                     int   small,
+                     void* unused,
+                     int   nUnused )
+{
+   bzFile* bzf = NULL;
+   int     ret;
+
+   BZ_SETERR(BZ_OK);
+
+   if (f == NULL || 
+       (small != 0 && small != 1) ||
+       (verbosity < 0 || verbosity > 4) ||
+       (unused == NULL && nUnused != 0) ||
+       (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED)))
+      { BZ_SETERR(BZ_PARAM_ERROR); return NULL; };
+
+   if (ferror(f))
+      { BZ_SETERR(BZ_IO_ERROR); return NULL; };
+
+   bzf = malloc ( sizeof(bzFile) );
+   if (bzf == NULL) 
+      { BZ_SETERR(BZ_MEM_ERROR); return NULL; };
+
+   BZ_SETERR(BZ_OK);
+
+   bzf->initialisedOk = False;
+   bzf->handle        = f;
+   bzf->bufN          = 0;
+   bzf->writing       = False;
+   bzf->strm.bzalloc  = NULL;
+   bzf->strm.bzfree   = NULL;
+   bzf->strm.opaque   = NULL;
+   
+   while (nUnused > 0) {
+      bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
+      unused = ((void*)( 1 + ((UChar*)(unused))  ));
+      nUnused--;
+   }
+
+   ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
+   if (ret != BZ_OK)
+      { BZ_SETERR(ret); free(bzf); return NULL; };
+
+   bzf->strm.avail_in = bzf->bufN;
+   bzf->strm.next_in  = bzf->buf;
+
+   bzf->initialisedOk = True;
+   return bzf;   
+}
+
+
+/*---------------------------------------------------*/
+void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
+{
+   bzFile* bzf = (bzFile*)b;
+
+   BZ_SETERR(BZ_OK);
+   if (bzf == NULL)
+      { BZ_SETERR(BZ_OK); return; };
+
+   if (bzf->writing)
+      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
+
+   if (bzf->initialisedOk)
+      (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
+   free ( bzf );
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzRead) 
+           ( int*    bzerror, 
+             BZFILE* b, 
+             void*   buf, 
+             int     len )
+{
+   Int32   n, ret;
+   bzFile* bzf = (bzFile*)b;
+
+   BZ_SETERR(BZ_OK);
+
+   if (bzf == NULL || buf == NULL || len < 0)
+      { BZ_SETERR(BZ_PARAM_ERROR); return 0; };
+
+   if (bzf->writing)
+      { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; };
+
+   if (len == 0)
+      { BZ_SETERR(BZ_OK); return 0; };
+
+   bzf->strm.avail_out = len;
+   bzf->strm.next_out = buf;
+
+   while (True) {
+
+      if (ferror(bzf->handle)) 
+         { BZ_SETERR(BZ_IO_ERROR); return 0; };
+
+      if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
+         n = fread ( bzf->buf, sizeof(UChar), 
+                     BZ_MAX_UNUSED, bzf->handle );
+         if (ferror(bzf->handle))
+            { BZ_SETERR(BZ_IO_ERROR); return 0; };
+         bzf->bufN = n;
+         bzf->strm.avail_in = bzf->bufN;
+         bzf->strm.next_in = bzf->buf;
+      }
+
+      ret = BZ2_bzDecompress ( &(bzf->strm) );
+
+      if (ret != BZ_OK && ret != BZ_STREAM_END)
+         { BZ_SETERR(ret); return 0; };
+
+      if (ret == BZ_OK && myfeof(bzf->handle) && 
+          bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
+         { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
+
+      if (ret == BZ_STREAM_END)
+         { BZ_SETERR(BZ_STREAM_END);
+           return len - bzf->strm.avail_out; };
+      if (bzf->strm.avail_out == 0)
+         { BZ_SETERR(BZ_OK); return len; };
+      
+   }
+
+   return 0; /*not reached*/
+}
+
+
+/*---------------------------------------------------*/
+void BZ_API(BZ2_bzReadGetUnused) 
+                     ( int*    bzerror, 
+                       BZFILE* b, 
+                       void**  unused, 
+                       int*    nUnused )
+{
+   bzFile* bzf = (bzFile*)b;
+   if (bzf == NULL)
+      { BZ_SETERR(BZ_PARAM_ERROR); return; };
+   if (bzf->lastErr != BZ_STREAM_END)
+      { BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
+   if (unused == NULL || nUnused == NULL)
+      { BZ_SETERR(BZ_PARAM_ERROR); return; };
+
+   BZ_SETERR(BZ_OK);
+   *nUnused = bzf->strm.avail_in;
+   *unused = bzf->strm.next_in;
+}
+#endif
+
+
+/*---------------------------------------------------*/
+/*--- Misc convenience stuff                      ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzBuffToBuffCompress) 
+                         ( char*         dest, 
+                           unsigned int* destLen,
+                           char*         source, 
+                           unsigned int  sourceLen,
+                           int           blockSize100k, 
+                           int           verbosity, 
+                           int           workFactor )
+{
+   bz_stream strm;
+   int ret;
+
+   if (dest == NULL || destLen == NULL || 
+       source == NULL ||
+       blockSize100k < 1 || blockSize100k > 9 ||
+       verbosity < 0 || verbosity > 4 ||
+       workFactor < 0 || workFactor > 250) 
+      return BZ_PARAM_ERROR;
+
+   if (workFactor == 0) workFactor = 30;
+   strm.bzalloc = NULL;
+   strm.bzfree = NULL;
+   strm.opaque = NULL;
+   ret = BZ2_bzCompressInit ( &strm, blockSize100k, 
+                              verbosity, workFactor );
+   if (ret != BZ_OK) return ret;
+
+   strm.next_in = source;
+   strm.next_out = dest;
+   strm.avail_in = sourceLen;
+   strm.avail_out = *destLen;
+
+   ret = BZ2_bzCompress ( &strm, BZ_FINISH );
+   if (ret == BZ_FINISH_OK) goto output_overflow;
+   if (ret != BZ_STREAM_END) goto errhandler;
+
+   /* normal termination */
+   *destLen -= strm.avail_out;   
+   BZ2_bzCompressEnd ( &strm );
+   return BZ_OK;
+
+   output_overflow:
+   BZ2_bzCompressEnd ( &strm );
+   return BZ_OUTBUFF_FULL;
+
+   errhandler:
+   BZ2_bzCompressEnd ( &strm );
+   return ret;
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzBuffToBuffDecompress) 
+                           ( char*         dest, 
+                             unsigned int* destLen,
+                             char*         source, 
+                             unsigned int  sourceLen,
+                             int           small,
+                             int           verbosity )
+{
+   bz_stream strm;
+   int ret;
+
+   if (dest == NULL || destLen == NULL || 
+       source == NULL ||
+       (small != 0 && small != 1) ||
+       verbosity < 0 || verbosity > 4) 
+          return BZ_PARAM_ERROR;
+
+   strm.bzalloc = NULL;
+   strm.bzfree = NULL;
+   strm.opaque = NULL;
+   ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
+   if (ret != BZ_OK) return ret;
+
+   strm.next_in = source;
+   strm.next_out = dest;
+   strm.avail_in = sourceLen;
+   strm.avail_out = *destLen;
+
+   ret = BZ2_bzDecompress ( &strm );
+   if (ret == BZ_OK) goto output_overflow_or_eof;
+   if (ret != BZ_STREAM_END) goto errhandler;
+
+   /* normal termination */
+   *destLen -= strm.avail_out;
+   BZ2_bzDecompressEnd ( &strm );
+   return BZ_OK;
+
+   output_overflow_or_eof:
+   if (strm.avail_out > 0) {
+      BZ2_bzDecompressEnd ( &strm );
+      return BZ_UNEXPECTED_EOF;
+   } else {
+      BZ2_bzDecompressEnd ( &strm );
+      return BZ_OUTBUFF_FULL;
+   };      
+
+   errhandler:
+   BZ2_bzDecompressEnd ( &strm );
+   return ret; 
+}
+
+
+/*---------------------------------------------------*/
+/*--
+   Code contributed by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
+   to support better zlib compatibility.
+   This code is not _officially_ part of libbzip2 (yet);
+   I haven't tested it, documented it, or considered the
+   threading-safeness of it.
+   If this code breaks, please contact both Yoshioka and me.
+--*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------------*/
+/*--
+   return version like "0.9.5d, 4-Sept-1999".
+--*/
+const char * BZ_API(BZ2_bzlibVersion)(void)
+{
+   return BZ_VERSION;
+}
+
+
+#ifndef BZ_NO_STDIO
+/*---------------------------------------------------*/
+
+#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
+#   include 
+#   include 
+#   define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY)
+#else
+#   define SET_BINARY_MODE(file)
+#endif
+static
+BZFILE * bzopen_or_bzdopen
+               ( const char *path,   /* no use when bzdopen */
+                 int fd,             /* no use when bzdopen */
+                 const char *mode,
+                 int open_mode)      /* bzopen: 0, bzdopen:1 */
+{
+   int    bzerr;
+   char   unused[BZ_MAX_UNUSED];
+   int    blockSize100k = 9;
+   int    writing       = 0;
+   char   mode2[10]     = "";
+   FILE   *fp           = NULL;
+   BZFILE *bzfp         = NULL;
+   int    verbosity     = 0;
+   int    workFactor    = 30;
+   int    smallMode     = 0;
+   int    nUnused       = 0; 
+
+   if (mode == NULL) return NULL;
+   while (*mode) {
+      switch (*mode) {
+      case 'r':
+         writing = 0; break;
+      case 'w':
+         writing = 1; break;
+      case 's':
+         smallMode = 1; break;
+      default:
+         if (isdigit((int)(*mode))) {
+            blockSize100k = *mode-BZ_HDR_0;
+         }
+      }
+      mode++;
+   }
+   strcat(mode2, writing ? "w" : "r" );
+   strcat(mode2,"b");   /* binary mode */
+
+   if (open_mode==0) {
+      if (path==NULL || strcmp(path,"")==0) {
+        fp = (writing ? stdout : stdin);
+        SET_BINARY_MODE(fp);
+      } else {
+        fp = fopen(path,mode2);
+      }
+   } else {
+#ifdef BZ_STRICT_ANSI
+      fp = NULL;
+#else
+      fp = fdopen(fd,mode2);
+#endif
+   }
+   if (fp == NULL) return NULL;
+
+   if (writing) {
+      /* Guard against total chaos and anarchy -- JRS */
+      if (blockSize100k < 1) blockSize100k = 1;
+      if (blockSize100k > 9) blockSize100k = 9; 
+      bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
+                             verbosity,workFactor);
+   } else {
+      bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
+                            unused,nUnused);
+   }
+   if (bzfp == NULL) {
+      if (fp != stdin && fp != stdout) fclose(fp);
+      return NULL;
+   }
+   return bzfp;
+}
+
+
+/*---------------------------------------------------*/
+/*--
+   open file for read or write.
+      ex) bzopen("file","w9")
+      case path="" or NULL => use stdin or stdout.
+--*/
+BZFILE * BZ_API(BZ2_bzopen)
+               ( const char *path,
+                 const char *mode )
+{
+   return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0);
+}
+
+
+/*---------------------------------------------------*/
+BZFILE * BZ_API(BZ2_bzdopen)
+               ( int fd,
+                 const char *mode )
+{
+   return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1);
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
+{
+   int bzerr, nread;
+   if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
+   nread = BZ2_bzRead(&bzerr,b,buf,len);
+   if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) {
+      return nread;
+   } else {
+      return -1;
+   }
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
+{
+   int bzerr;
+
+   BZ2_bzWrite(&bzerr,b,buf,len);
+   if(bzerr == BZ_OK){
+      return len;
+   }else{
+      return -1;
+   }
+}
+
+
+/*---------------------------------------------------*/
+int BZ_API(BZ2_bzflush) (BZFILE *b)
+{
+   /* do nothing now... */
+   return 0;
+}
+
+
+/*---------------------------------------------------*/
+void BZ_API(BZ2_bzclose) (BZFILE* b)
+{
+   int bzerr;
+   FILE *fp;
+   
+   if (b==NULL) {return;}
+   fp = ((bzFile *)b)->handle;
+   if(((bzFile*)b)->writing){
+      BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
+      if(bzerr != BZ_OK){
+         BZ2_bzWriteClose(NULL,b,1,NULL,NULL);
+      }
+   }else{
+      BZ2_bzReadClose(&bzerr,b);
+   }
+   if(fp!=stdin && fp!=stdout){
+      fclose(fp);
+   }
+}
+
+
+/*---------------------------------------------------*/
+/*--
+   return last error code 
+--*/
+static const char *bzerrorstrings[] = {
+       "OK"
+      ,"SEQUENCE_ERROR"
+      ,"PARAM_ERROR"
+      ,"MEM_ERROR"
+      ,"DATA_ERROR"
+      ,"DATA_ERROR_MAGIC"
+      ,"IO_ERROR"
+      ,"UNEXPECTED_EOF"
+      ,"OUTBUFF_FULL"
+      ,"CONFIG_ERROR"
+      ,"???"   /* for future */
+      ,"???"   /* for future */
+      ,"???"   /* for future */
+      ,"???"   /* for future */
+      ,"???"   /* for future */
+      ,"???"   /* for future */
+};
+
+
+const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
+{
+   int err = ((bzFile *)b)->lastErr;
+
+   if(err>0) err = 0;
+   *errnum = err;
+   return bzerrorstrings[err*-1];
+}
+#endif
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                           bzlib.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bzlib.h
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzlib.h	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,282 @@
+
+/*-------------------------------------------------------------*/
+/*--- Public header file for the library.                   ---*/
+/*---                                               bzlib.h ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#ifndef _BZLIB_H
+#define _BZLIB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define BZ_RUN               0
+#define BZ_FLUSH             1
+#define BZ_FINISH            2
+
+#define BZ_OK                0
+#define BZ_RUN_OK            1
+#define BZ_FLUSH_OK          2
+#define BZ_FINISH_OK         3
+#define BZ_STREAM_END        4
+#define BZ_SEQUENCE_ERROR    (-1)
+#define BZ_PARAM_ERROR       (-2)
+#define BZ_MEM_ERROR         (-3)
+#define BZ_DATA_ERROR        (-4)
+#define BZ_DATA_ERROR_MAGIC  (-5)
+#define BZ_IO_ERROR          (-6)
+#define BZ_UNEXPECTED_EOF    (-7)
+#define BZ_OUTBUFF_FULL      (-8)
+#define BZ_CONFIG_ERROR      (-9)
+
+typedef 
+   struct {
+      char *next_in;
+      unsigned int avail_in;
+      unsigned int total_in_lo32;
+      unsigned int total_in_hi32;
+
+      char *next_out;
+      unsigned int avail_out;
+      unsigned int total_out_lo32;
+      unsigned int total_out_hi32;
+
+      void *state;
+
+      void *(*bzalloc)(void *,int,int);
+      void (*bzfree)(void *,void *);
+      void *opaque;
+   } 
+   bz_stream;
+
+
+#ifndef BZ_IMPORT
+#define BZ_EXPORT
+#endif
+
+#ifndef BZ_NO_STDIO
+/* Need a definitition for FILE */
+#include 
+#endif
+
+#ifdef _WIN32
+#   include 
+#   ifdef small
+      /* windows.h define small to char */
+#      undef small
+#   endif
+#   ifdef BZ_EXPORT
+#   define BZ_API(func) WINAPI func
+#   define BZ_EXTERN extern
+#   else
+   /* import windows dll dynamically */
+#   define BZ_API(func) (WINAPI * func)
+#   define BZ_EXTERN
+#   endif
+#else
+#   define BZ_API(func) func
+#   define BZ_EXTERN extern
+#endif
+
+
+/*-- Core (low-level) library functions --*/
+
+BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( 
+      bz_stream* strm, 
+      int        blockSize100k, 
+      int        verbosity, 
+      int        workFactor 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzCompress) ( 
+      bz_stream* strm, 
+      int action 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( 
+      bz_stream* strm 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( 
+      bz_stream *strm, 
+      int       verbosity, 
+      int       small
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( 
+      bz_stream* strm 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( 
+      bz_stream *strm 
+   );
+
+
+
+/*-- High(er) level library functions --*/
+
+#ifndef BZ_NO_STDIO
+#define BZ_MAX_UNUSED 5000
+
+typedef void BZFILE;
+
+BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( 
+      int*  bzerror,   
+      FILE* f, 
+      int   verbosity, 
+      int   small,
+      void* unused,    
+      int   nUnused 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( 
+      int*    bzerror, 
+      BZFILE* b 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void**  unused,  
+      int*    nUnused 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzRead) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( 
+      int*  bzerror,      
+      FILE* f, 
+      int   blockSize100k, 
+      int   verbosity, 
+      int   workFactor 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWrite) ( 
+      int*    bzerror, 
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( 
+      int*          bzerror, 
+      BZFILE*       b, 
+      int           abandon, 
+      unsigned int* nbytes_in, 
+      unsigned int* nbytes_out 
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( 
+      int*          bzerror, 
+      BZFILE*       b, 
+      int           abandon, 
+      unsigned int* nbytes_in_lo32, 
+      unsigned int* nbytes_in_hi32, 
+      unsigned int* nbytes_out_lo32, 
+      unsigned int* nbytes_out_hi32
+   );
+#endif
+
+
+/*-- Utility functions --*/
+
+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( 
+      char*         dest, 
+      unsigned int* destLen,
+      char*         source, 
+      unsigned int  sourceLen,
+      int           blockSize100k, 
+      int           verbosity, 
+      int           workFactor 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( 
+      char*         dest, 
+      unsigned int* destLen,
+      char*         source, 
+      unsigned int  sourceLen,
+      int           small, 
+      int           verbosity 
+   );
+
+
+/*--
+   Code contributed by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
+   to support better zlib compatibility.
+   This code is not _officially_ part of libbzip2 (yet);
+   I haven't tested it, documented it, or considered the
+   threading-safeness of it.
+   If this code breaks, please contact both Yoshioka and me.
+--*/
+
+BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
+      void
+   );
+
+#ifndef BZ_NO_STDIO
+BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
+      const char *path,
+      const char *mode
+   );
+
+BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
+      int        fd,
+      const char *mode
+   );
+         
+BZ_EXTERN int BZ_API(BZ2_bzread) (
+      BZFILE* b, 
+      void* buf, 
+      int len 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzwrite) (
+      BZFILE* b, 
+      void*   buf, 
+      int     len 
+   );
+
+BZ_EXTERN int BZ_API(BZ2_bzflush) (
+      BZFILE* b
+   );
+
+BZ_EXTERN void BZ_API(BZ2_bzclose) (
+      BZFILE* b
+   );
+
+BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
+      BZFILE *b, 
+      int    *errnum
+   );
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*-------------------------------------------------------------*/
+/*--- end                                           bzlib.h ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bzlib_private.h
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzlib_private.h	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,509 @@
+
+/*-------------------------------------------------------------*/
+/*--- Private header file for the library.                  ---*/
+/*---                                       bzlib_private.h ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#ifndef _BZLIB_PRIVATE_H
+#define _BZLIB_PRIVATE_H
+
+#include 
+
+#ifndef BZ_NO_STDIO
+#include 
+#include 
+#include 
+#endif
+
+#include "bzlib.h"
+
+
+
+/*-- General stuff. --*/
+
+#define BZ_VERSION  "1.0.5, 10-Dec-2007"
+
+typedef char            Char;
+typedef unsigned char   Bool;
+typedef unsigned char   UChar;
+typedef int             Int32;
+typedef unsigned int    UInt32;
+typedef short           Int16;
+typedef unsigned short  UInt16;
+
+#define True  ((Bool)1)
+#define False ((Bool)0)
+
+#ifndef __GNUC__
+#define __inline__  /* */
+#endif 
+
+#ifndef BZ_NO_STDIO
+
+extern void BZ2_bz__AssertH__fail ( int errcode );
+#define AssertH(cond,errcode) \
+   { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
+
+#if BZ_DEBUG
+#define AssertD(cond,msg) \
+   { if (!(cond)) {       \
+      fprintf ( stderr,   \
+        "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
+      exit(1); \
+   }}
+#else
+#define AssertD(cond,msg) /* */
+#endif
+
+#define VPrintf0(zf) \
+   fprintf(stderr,zf)
+#define VPrintf1(zf,za1) \
+   fprintf(stderr,zf,za1)
+#define VPrintf2(zf,za1,za2) \
+   fprintf(stderr,zf,za1,za2)
+#define VPrintf3(zf,za1,za2,za3) \
+   fprintf(stderr,zf,za1,za2,za3)
+#define VPrintf4(zf,za1,za2,za3,za4) \
+   fprintf(stderr,zf,za1,za2,za3,za4)
+#define VPrintf5(zf,za1,za2,za3,za4,za5) \
+   fprintf(stderr,zf,za1,za2,za3,za4,za5)
+
+#else
+
+extern void bz_internal_error ( int errcode );
+#define AssertH(cond,errcode) \
+   { if (!(cond)) bz_internal_error ( errcode ); }
+#define AssertD(cond,msg)                do { } while (0)
+#define VPrintf0(zf)                     do { } while (0)
+#define VPrintf1(zf,za1)                 do { } while (0)
+#define VPrintf2(zf,za1,za2)             do { } while (0)
+#define VPrintf3(zf,za1,za2,za3)         do { } while (0)
+#define VPrintf4(zf,za1,za2,za3,za4)     do { } while (0)
+#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0)
+
+#endif
+
+
+#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1)
+#define BZFREE(ppp)  (strm->bzfree)(strm->opaque,(ppp))
+
+
+/*-- Header bytes. --*/
+
+#define BZ_HDR_B 0x42   /* 'B' */
+#define BZ_HDR_Z 0x5a   /* 'Z' */
+#define BZ_HDR_h 0x68   /* 'h' */
+#define BZ_HDR_0 0x30   /* '0' */
+  
+/*-- Constants for the back end. --*/
+
+#define BZ_MAX_ALPHA_SIZE 258
+#define BZ_MAX_CODE_LEN    23
+
+#define BZ_RUNA 0
+#define BZ_RUNB 1
+
+#define BZ_N_GROUPS 6
+#define BZ_G_SIZE   50
+#define BZ_N_ITERS  4
+
+#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))
+
+
+
+/*-- Stuff for randomising repetitive blocks. --*/
+
+extern Int32 BZ2_rNums[512];
+
+#define BZ_RAND_DECLS                          \
+   Int32 rNToGo;                               \
+   Int32 rTPos                                 \
+
+#define BZ_RAND_INIT_MASK                      \
+   s->rNToGo = 0;                              \
+   s->rTPos  = 0                               \
+
+#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0)
+
+#define BZ_RAND_UPD_MASK                       \
+   if (s->rNToGo == 0) {                       \
+      s->rNToGo = BZ2_rNums[s->rTPos];         \
+      s->rTPos++;                              \
+      if (s->rTPos == 512) s->rTPos = 0;       \
+   }                                           \
+   s->rNToGo--;
+
+
+
+/*-- Stuff for doing CRCs. --*/
+
+extern UInt32 BZ2_crc32Table[256];
+
+#define BZ_INITIALISE_CRC(crcVar)              \
+{                                              \
+   crcVar = 0xffffffffL;                       \
+}
+
+#define BZ_FINALISE_CRC(crcVar)                \
+{                                              \
+   crcVar = ~(crcVar);                         \
+}
+
+#define BZ_UPDATE_CRC(crcVar,cha)              \
+{                                              \
+   crcVar = (crcVar << 8) ^                    \
+            BZ2_crc32Table[(crcVar >> 24) ^    \
+                           ((UChar)cha)];      \
+}
+
+
+
+/*-- States and modes for compression. --*/
+
+#define BZ_M_IDLE      1
+#define BZ_M_RUNNING   2
+#define BZ_M_FLUSHING  3
+#define BZ_M_FINISHING 4
+
+#define BZ_S_OUTPUT    1
+#define BZ_S_INPUT     2
+
+#define BZ_N_RADIX 2
+#define BZ_N_QSORT 12
+#define BZ_N_SHELL 18
+#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
+
+
+
+
+/*-- Structure holding all the compression-side stuff. --*/
+
+typedef
+   struct {
+      /* pointer back to the struct bz_stream */
+      bz_stream* strm;
+
+      /* mode this stream is in, and whether inputting */
+      /* or outputting data */
+      Int32    mode;
+      Int32    state;
+
+      /* remembers avail_in when flush/finish requested */
+      UInt32   avail_in_expect;
+
+      /* for doing the block sorting */
+      UInt32*  arr1;
+      UInt32*  arr2;
+      UInt32*  ftab;
+      Int32    origPtr;
+
+      /* aliases for arr1 and arr2 */
+      UInt32*  ptr;
+      UChar*   block;
+      UInt16*  mtfv;
+      UChar*   zbits;
+
+      /* for deciding when to use the fallback sorting algorithm */
+      Int32    workFactor;
+
+      /* run-length-encoding of the input */
+      UInt32   state_in_ch;
+      Int32    state_in_len;
+      BZ_RAND_DECLS;
+
+      /* input and output limits and current posns */
+      Int32    nblock;
+      Int32    nblockMAX;
+      Int32    numZ;
+      Int32    state_out_pos;
+
+      /* map of bytes used in block */
+      Int32    nInUse;
+      Bool     inUse[256];
+      UChar    unseqToSeq[256];
+
+      /* the buffer for bit stream creation */
+      UInt32   bsBuff;
+      Int32    bsLive;
+
+      /* block and combined CRCs */
+      UInt32   blockCRC;
+      UInt32   combinedCRC;
+
+      /* misc administratium */
+      Int32    verbosity;
+      Int32    blockNo;
+      Int32    blockSize100k;
+
+      /* stuff for coding the MTF values */
+      Int32    nMTF;
+      Int32    mtfFreq    [BZ_MAX_ALPHA_SIZE];
+      UChar    selector   [BZ_MAX_SELECTORS];
+      UChar    selectorMtf[BZ_MAX_SELECTORS];
+
+      UChar    len     [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      Int32    code    [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      Int32    rfreq   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      /* second dimension: only 3 needed; 4 makes index calculations faster */
+      UInt32   len_pack[BZ_MAX_ALPHA_SIZE][4];
+
+   }
+   EState;
+
+
+
+/*-- externs for compression. --*/
+
+extern void 
+BZ2_blockSort ( EState* );
+
+extern void 
+BZ2_compressBlock ( EState*, Bool );
+
+extern void 
+BZ2_bsInitWrite ( EState* );
+
+extern void 
+BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
+
+extern void 
+BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
+
+
+
+/*-- states for decompression. --*/
+
+#define BZ_X_IDLE        1
+#define BZ_X_OUTPUT      2
+
+#define BZ_X_MAGIC_1     10
+#define BZ_X_MAGIC_2     11
+#define BZ_X_MAGIC_3     12
+#define BZ_X_MAGIC_4     13
+#define BZ_X_BLKHDR_1    14
+#define BZ_X_BLKHDR_2    15
+#define BZ_X_BLKHDR_3    16
+#define BZ_X_BLKHDR_4    17
+#define BZ_X_BLKHDR_5    18
+#define BZ_X_BLKHDR_6    19
+#define BZ_X_BCRC_1      20
+#define BZ_X_BCRC_2      21
+#define BZ_X_BCRC_3      22
+#define BZ_X_BCRC_4      23
+#define BZ_X_RANDBIT     24
+#define BZ_X_ORIGPTR_1   25
+#define BZ_X_ORIGPTR_2   26
+#define BZ_X_ORIGPTR_3   27
+#define BZ_X_MAPPING_1   28
+#define BZ_X_MAPPING_2   29
+#define BZ_X_SELECTOR_1  30
+#define BZ_X_SELECTOR_2  31
+#define BZ_X_SELECTOR_3  32
+#define BZ_X_CODING_1    33
+#define BZ_X_CODING_2    34
+#define BZ_X_CODING_3    35
+#define BZ_X_MTF_1       36
+#define BZ_X_MTF_2       37
+#define BZ_X_MTF_3       38
+#define BZ_X_MTF_4       39
+#define BZ_X_MTF_5       40
+#define BZ_X_MTF_6       41
+#define BZ_X_ENDHDR_2    42
+#define BZ_X_ENDHDR_3    43
+#define BZ_X_ENDHDR_4    44
+#define BZ_X_ENDHDR_5    45
+#define BZ_X_ENDHDR_6    46
+#define BZ_X_CCRC_1      47
+#define BZ_X_CCRC_2      48
+#define BZ_X_CCRC_3      49
+#define BZ_X_CCRC_4      50
+
+
+
+/*-- Constants for the fast MTF decoder. --*/
+
+#define MTFA_SIZE 4096
+#define MTFL_SIZE 16
+
+
+
+/*-- Structure holding all the decompression-side stuff. --*/
+
+typedef
+   struct {
+      /* pointer back to the struct bz_stream */
+      bz_stream* strm;
+
+      /* state indicator for this stream */
+      Int32    state;
+
+      /* for doing the final run-length decoding */
+      UChar    state_out_ch;
+      Int32    state_out_len;
+      Bool     blockRandomised;
+      BZ_RAND_DECLS;
+
+      /* the buffer for bit stream reading */
+      UInt32   bsBuff;
+      Int32    bsLive;
+
+      /* misc administratium */
+      Int32    blockSize100k;
+      Bool     smallDecompress;
+      Int32    currBlockNo;
+      Int32    verbosity;
+
+      /* for undoing the Burrows-Wheeler transform */
+      Int32    origPtr;
+      UInt32   tPos;
+      Int32    k0;
+      Int32    unzftab[256];
+      Int32    nblock_used;
+      Int32    cftab[257];
+      Int32    cftabCopy[257];
+
+      /* for undoing the Burrows-Wheeler transform (FAST) */
+      UInt32   *tt;
+
+      /* for undoing the Burrows-Wheeler transform (SMALL) */
+      UInt16   *ll16;
+      UChar    *ll4;
+
+      /* stored and calculated CRCs */
+      UInt32   storedBlockCRC;
+      UInt32   storedCombinedCRC;
+      UInt32   calculatedBlockCRC;
+      UInt32   calculatedCombinedCRC;
+
+      /* map of bytes used in block */
+      Int32    nInUse;
+      Bool     inUse[256];
+      Bool     inUse16[16];
+      UChar    seqToUnseq[256];
+
+      /* for decoding the MTF values */
+      UChar    mtfa   [MTFA_SIZE];
+      Int32    mtfbase[256 / MTFL_SIZE];
+      UChar    selector   [BZ_MAX_SELECTORS];
+      UChar    selectorMtf[BZ_MAX_SELECTORS];
+      UChar    len  [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+
+      Int32    limit  [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      Int32    base   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      Int32    perm   [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+      Int32    minLens[BZ_N_GROUPS];
+
+      /* save area for scalars in the main decompress code */
+      Int32    save_i;
+      Int32    save_j;
+      Int32    save_t;
+      Int32    save_alphaSize;
+      Int32    save_nGroups;
+      Int32    save_nSelectors;
+      Int32    save_EOB;
+      Int32    save_groupNo;
+      Int32    save_groupPos;
+      Int32    save_nextSym;
+      Int32    save_nblockMAX;
+      Int32    save_nblock;
+      Int32    save_es;
+      Int32    save_N;
+      Int32    save_curr;
+      Int32    save_zt;
+      Int32    save_zn; 
+      Int32    save_zvec;
+      Int32    save_zj;
+      Int32    save_gSel;
+      Int32    save_gMinlen;
+      Int32*   save_gLimit;
+      Int32*   save_gBase;
+      Int32*   save_gPerm;
+
+   }
+   DState;
+
+
+
+/*-- Macros for decompression. --*/
+
+#define BZ_GET_FAST(cccc)                     \
+    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
+    if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
+    s->tPos = s->tt[s->tPos];                 \
+    cccc = (UChar)(s->tPos & 0xff);           \
+    s->tPos >>= 8;
+
+#define BZ_GET_FAST_C(cccc)                   \
+    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
+    if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \
+    c_tPos = c_tt[c_tPos];                    \
+    cccc = (UChar)(c_tPos & 0xff);            \
+    c_tPos >>= 8;
+
+#define SET_LL4(i,n)                                          \
+   { if (((i) & 0x1) == 0)                                    \
+        s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else    \
+        s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4);  \
+   }
+
+#define GET_LL4(i)                             \
+   ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
+
+#define SET_LL(i,n)                          \
+   { s->ll16[i] = (UInt16)(n & 0x0000ffff);  \
+     SET_LL4(i, n >> 16);                    \
+   }
+
+#define GET_LL(i) \
+   (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
+
+#define BZ_GET_SMALL(cccc)                            \
+    /* c_tPos is unsigned, hence test < 0 is pointless. */ \
+    if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
+    cccc = BZ2_indexIntoF ( s->tPos, s->cftab );    \
+    s->tPos = GET_LL(s->tPos);
+
+
+/*-- externs for decompression. --*/
+
+extern Int32 
+BZ2_indexIntoF ( Int32, Int32* );
+
+extern Int32 
+BZ2_decompress ( DState* );
+
+extern void 
+BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
+                           Int32,  Int32, Int32 );
+
+
+#endif
+
+
+/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
+
+#ifdef BZ_NO_STDIO
+#ifndef NULL
+#define NULL 0
+#endif
+#endif
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                   bzlib_private.h ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/bzmore
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzmore	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Bzmore wrapped for bzip2, 
+# adapted from zmore by Philippe Troin  for Debian GNU/Linux.
+
+PATH="/usr/bin:$PATH"; export PATH
+
+prog=`echo $0 | sed 's|.*/||'`
+case "$prog" in
+	*less)	more=less	;;
+	*)	more=more       ;;
+esac
+
+if test "`echo -n a`" = "-n a"; then
+  # looks like a SysV system:
+  n1=''; n2='\c'
+else
+  n1='-n'; n2=''
+fi
+oldtty=`stty -g 2>/dev/null`
+if stty -cbreak 2>/dev/null; then
+  cb='cbreak'; ncb='-cbreak'
+else
+  # 'stty min 1' resets eof to ^a on both SunOS and SysV!
+  cb='min 1 -icanon'; ncb='icanon eof ^d'
+fi
+if test $? -eq 0 -a -n "$oldtty"; then
+   trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
+else
+   trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
+fi
+
+if test $# = 0; then
+    if test -t 0; then
+	echo usage: $prog files...
+    else
+	bzip2 -cdfq | eval $more
+    fi
+else
+    FIRST=1
+    for FILE
+    do
+	if test $FIRST -eq 0; then
+		echo $n1 "--More--(Next file: $FILE)$n2"
+		stty $cb -echo 2>/dev/null
+		ANS=`dd bs=1 count=1 2>/dev/null` 
+		stty $ncb echo 2>/dev/null
+		echo " "
+		if test "$ANS" = 'e' -o "$ANS" = 'q'; then
+			exit
+		fi
+	fi
+	if test "$ANS" != 's'; then
+		echo "------> $FILE <------"
+		bzip2 -cdfq "$FILE" | eval $more
+	fi
+	if test -t; then
+		FIRST=0
+	fi
+    done
+fi

Added: projects/external/bzip2-1.0.5/bzmore.1
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/bzmore.1	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,152 @@
+.\"Shamelessly copied from zmore.1 by Philippe Troin 
+.\"for Debian GNU/Linux
+.TH BZMORE 1
+.SH NAME
+bzmore, bzless \- file perusal filter for crt viewing of bzip2 compressed text
+.SH SYNOPSIS
+.B bzmore
+[ name ...  ]
+.br
+.B bzless
+[ name ...  ]
+.SH NOTE
+In the following description,
+.I bzless
+and
+.I less
+can be used interchangeably with
+.I bzmore
+and
+.I more.
+.SH DESCRIPTION
+.I  Bzmore
+is a filter which allows examination of compressed or plain text files
+one screenful at a time on a soft-copy terminal.
+.I bzmore
+works on files compressed with
+.I bzip2
+and also on uncompressed files.
+If a file does not exist,
+.I bzmore
+looks for a file of the same name with the addition of a .bz2 suffix.
+.PP
+.I Bzmore
+normally pauses after each screenful, printing --More--
+at the bottom of the screen.
+If the user then types a carriage return, one more line is displayed.
+If the user hits a space,
+another screenful is displayed.  Other possibilities are enumerated later.
+.PP
+.I Bzmore
+looks in the file
+.I /etc/termcap
+to determine terminal characteristics,
+and to determine the default window size.
+On a terminal capable of displaying 24 lines,
+the default window size is 22 lines.
+Other sequences which may be typed when
+.I bzmore
+pauses, and their effects, are as follows (\fIi\fP is an optional integer
+argument, defaulting to 1) :
+.PP
+.IP \fIi\|\fP
+display
+.I i
+more lines, (or another screenful if no argument is given)
+.PP
+.IP ^D
+display 11 more lines (a ``scroll'').
+If
+.I i
+is given, then the scroll size is set to \fIi\|\fP.
+.PP
+.IP d
+same as ^D (control-D)
+.PP
+.IP \fIi\|\fPz
+same as typing a space except that \fIi\|\fP, if present, becomes the new
+window size.  Note that the window size reverts back to the default at the
+end of the current file.
+.PP
+.IP \fIi\|\fPs
+skip \fIi\|\fP lines and print a screenful of lines
+.PP
+.IP \fIi\|\fPf
+skip \fIi\fP screenfuls and print a screenful of lines
+.PP
+.IP "q or Q"
+quit reading the current file; go on to the next (if any)
+.PP
+.IP "e or q"
+When the prompt --More--(Next file: 
+.IR file )
+is printed, this command causes bzmore to exit.
+.PP
+.IP s
+When the prompt --More--(Next file: 
+.IR file )
+is printed, this command causes bzmore to skip the next file and continue.
+.PP 
+.IP =
+Display the current line number.
+.PP
+.IP \fIi\|\fP/expr
+search for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
+If the pattern is not found,
+.I bzmore
+goes on to the next file (if any).
+Otherwise, a screenful is displayed, starting two lines before the place
+where the expression was found.
+The user's erase and kill characters may be used to edit the regular
+expression.
+Erasing back past the first column cancels the search command.
+.PP
+.IP \fIi\|\fPn
+search for the \fIi\|\fP-th occurrence of the last regular expression entered.
+.PP
+.IP !command
+invoke a shell with \fIcommand\|\fP. 
+The character `!' in "command" are replaced with the
+previous shell command.  The sequence "\\!" is replaced by "!".
+.PP
+.IP ":q or :Q"
+quit reading the current file; go on to the next (if any)
+(same as q or Q).
+.PP
+.IP .
+(dot) repeat the previous command.
+.PP
+The commands take effect immediately, i.e., it is not necessary to
+type a carriage return.
+Up to the time when the command character itself is given,
+the user may hit the line kill character to cancel the numerical
+argument being formed.
+In addition, the user may hit the erase character to redisplay the
+--More-- message.
+.PP
+At any time when output is being sent to the terminal, the user can
+hit the quit key (normally control\-\\).
+.I Bzmore
+will stop sending output, and will display the usual --More--
+prompt.
+The user may then enter one of the above commands in the normal manner.
+Unfortunately, some output is lost when this is done, due to the
+fact that any characters waiting in the terminal's output queue
+are flushed when the quit signal occurs.
+.PP
+The terminal is set to
+.I noecho
+mode by this program so that the output can be continuous.
+What you type will thus not show on your terminal, except for the / and !
+commands.
+.PP
+If the standard output is not a teletype, then
+.I bzmore
+acts just like
+.I bzcat,
+except that a header is printed before each file.
+.SH FILES
+.DT
+/etc/termcap		Terminal data base
+.SH "SEE ALSO"
+more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1)

Added: projects/external/bzip2-1.0.5/compress.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/compress.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,672 @@
+
+/*-------------------------------------------------------------*/
+/*--- Compression machinery (not incl block sorting)        ---*/
+/*---                                            compress.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+/* CHANGES
+    0.9.0    -- original version.
+    0.9.0a/b -- no changes in this file.
+    0.9.0c   -- changed setting of nGroups in sendMTFValues() 
+                so as to do a bit better on small files
+*/
+
+#include "bzlib_private.h"
+
+
+/*---------------------------------------------------*/
+/*--- Bit stream I/O                              ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------------*/
+void BZ2_bsInitWrite ( EState* s )
+{
+   s->bsLive = 0;
+   s->bsBuff = 0;
+}
+
+
+/*---------------------------------------------------*/
+static
+void bsFinishWrite ( EState* s )
+{
+   while (s->bsLive > 0) {
+      s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
+      s->numZ++;
+      s->bsBuff <<= 8;
+      s->bsLive -= 8;
+   }
+}
+
+
+/*---------------------------------------------------*/
+#define bsNEEDW(nz)                           \
+{                                             \
+   while (s->bsLive >= 8) {                   \
+      s->zbits[s->numZ]                       \
+         = (UChar)(s->bsBuff >> 24);          \
+      s->numZ++;                              \
+      s->bsBuff <<= 8;                        \
+      s->bsLive -= 8;                         \
+   }                                          \
+}
+
+
+/*---------------------------------------------------*/
+static
+__inline__
+void bsW ( EState* s, Int32 n, UInt32 v )
+{
+   bsNEEDW ( n );
+   s->bsBuff |= (v << (32 - s->bsLive - n));
+   s->bsLive += n;
+}
+
+
+/*---------------------------------------------------*/
+static
+void bsPutUInt32 ( EState* s, UInt32 u )
+{
+   bsW ( s, 8, (u >> 24) & 0xffL );
+   bsW ( s, 8, (u >> 16) & 0xffL );
+   bsW ( s, 8, (u >>  8) & 0xffL );
+   bsW ( s, 8,  u        & 0xffL );
+}
+
+
+/*---------------------------------------------------*/
+static
+void bsPutUChar ( EState* s, UChar c )
+{
+   bsW( s, 8, (UInt32)c );
+}
+
+
+/*---------------------------------------------------*/
+/*--- The back end proper                         ---*/
+/*---------------------------------------------------*/
+
+/*---------------------------------------------------*/
+static
+void makeMaps_e ( EState* s )
+{
+   Int32 i;
+   s->nInUse = 0;
+   for (i = 0; i < 256; i++)
+      if (s->inUse[i]) {
+         s->unseqToSeq[i] = s->nInUse;
+         s->nInUse++;
+      }
+}
+
+
+/*---------------------------------------------------*/
+static
+void generateMTFValues ( EState* s )
+{
+   UChar   yy[256];
+   Int32   i, j;
+   Int32   zPend;
+   Int32   wr;
+   Int32   EOB;
+
+   /* 
+      After sorting (eg, here),
+         s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
+         and
+         ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] 
+         holds the original block data.
+
+      The first thing to do is generate the MTF values,
+      and put them in
+         ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ].
+      Because there are strictly fewer or equal MTF values
+      than block values, ptr values in this area are overwritten
+      with MTF values only when they are no longer needed.
+
+      The final compressed bitstream is generated into the
+      area starting at
+         (UChar*) (&((UChar*)s->arr2)[s->nblock])
+
+      These storage aliases are set up in bzCompressInit(),
+      except for the last one, which is arranged in 
+      compressBlock().
+   */
+   UInt32* ptr   = s->ptr;
+   UChar* block  = s->block;
+   UInt16* mtfv  = s->mtfv;
+
+   makeMaps_e ( s );
+   EOB = s->nInUse+1;
+
+   for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0;
+
+   wr = 0;
+   zPend = 0;
+   for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i;
+
+   for (i = 0; i < s->nblock; i++) {
+      UChar ll_i;
+      AssertD ( wr <= i, "generateMTFValues(1)" );
+      j = ptr[i]-1; if (j < 0) j += s->nblock;
+      ll_i = s->unseqToSeq[block[j]];
+      AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
+
+      if (yy[0] == ll_i) { 
+         zPend++;
+      } else {
+
+         if (zPend > 0) {
+            zPend--;
+            while (True) {
+               if (zPend & 1) {
+                  mtfv[wr] = BZ_RUNB; wr++; 
+                  s->mtfFreq[BZ_RUNB]++; 
+               } else {
+                  mtfv[wr] = BZ_RUNA; wr++; 
+                  s->mtfFreq[BZ_RUNA]++; 
+               }
+               if (zPend < 2) break;
+               zPend = (zPend - 2) / 2;
+            };
+            zPend = 0;
+         }
+         {
+            register UChar  rtmp;
+            register UChar* ryy_j;
+            register UChar  rll_i;
+            rtmp  = yy[1];
+            yy[1] = yy[0];
+            ryy_j = &(yy[1]);
+            rll_i = ll_i;
+            while ( rll_i != rtmp ) {
+               register UChar rtmp2;
+               ryy_j++;
+               rtmp2  = rtmp;
+               rtmp   = *ryy_j;
+               *ryy_j = rtmp2;
+            };
+            yy[0] = rtmp;
+            j = ryy_j - &(yy[0]);
+            mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
+         }
+
+      }
+   }
+
+   if (zPend > 0) {
+      zPend--;
+      while (True) {
+         if (zPend & 1) {
+            mtfv[wr] = BZ_RUNB; wr++; 
+            s->mtfFreq[BZ_RUNB]++; 
+         } else {
+            mtfv[wr] = BZ_RUNA; wr++; 
+            s->mtfFreq[BZ_RUNA]++; 
+         }
+         if (zPend < 2) break;
+         zPend = (zPend - 2) / 2;
+      };
+      zPend = 0;
+   }
+
+   mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++;
+
+   s->nMTF = wr;
+}
+
+
+/*---------------------------------------------------*/
+#define BZ_LESSER_ICOST  0
+#define BZ_GREATER_ICOST 15
+
+static
+void sendMTFValues ( EState* s )
+{
+   Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
+   Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
+   Int32 nGroups, nBytes;
+
+   /*--
+   UChar  len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+   is a global since the decoder also needs it.
+
+   Int32  code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+   Int32  rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
+   are also globals only used in this proc.
+   Made global to keep stack frame size small.
+   --*/
+
+
+   UInt16 cost[BZ_N_GROUPS];
+   Int32  fave[BZ_N_GROUPS];
+
+   UInt16* mtfv = s->mtfv;
+
+   if (s->verbosity >= 3)
+      VPrintf3( "      %d in block, %d after MTF & 1-2 coding, "
+                "%d+2 syms in use\n", 
+                s->nblock, s->nMTF, s->nInUse );
+
+   alphaSize = s->nInUse+2;
+   for (t = 0; t < BZ_N_GROUPS; t++)
+      for (v = 0; v < alphaSize; v++)
+         s->len[t][v] = BZ_GREATER_ICOST;
+
+   /*--- Decide how many coding tables to use ---*/
+   AssertH ( s->nMTF > 0, 3001 );
+   if (s->nMTF < 200)  nGroups = 2; else
+   if (s->nMTF < 600)  nGroups = 3; else
+   if (s->nMTF < 1200) nGroups = 4; else
+   if (s->nMTF < 2400) nGroups = 5; else
+                       nGroups = 6;
+
+   /*--- Generate an initial set of coding tables ---*/
+   { 
+      Int32 nPart, remF, tFreq, aFreq;
+
+      nPart = nGroups;
+      remF  = s->nMTF;
+      gs = 0;
+      while (nPart > 0) {
+         tFreq = remF / nPart;
+         ge = gs-1;
+         aFreq = 0;
+         while (aFreq < tFreq && ge < alphaSize-1) {
+            ge++;
+            aFreq += s->mtfFreq[ge];
+         }
+
+         if (ge > gs 
+             && nPart != nGroups && nPart != 1 
+             && ((nGroups-nPart) % 2 == 1)) {
+            aFreq -= s->mtfFreq[ge];
+            ge--;
+         }
+
+         if (s->verbosity >= 3)
+            VPrintf5( "      initial group %d, [%d .. %d], "
+                      "has %d syms (%4.1f%%)\n",
+                      nPart, gs, ge, aFreq, 
+                      (100.0 * (float)aFreq) / (float)(s->nMTF) );
+ 
+         for (v = 0; v < alphaSize; v++)
+            if (v >= gs && v <= ge) 
+               s->len[nPart-1][v] = BZ_LESSER_ICOST; else
+               s->len[nPart-1][v] = BZ_GREATER_ICOST;
+ 
+         nPart--;
+         gs = ge+1;
+         remF -= aFreq;
+      }
+   }
+
+   /*--- 
+      Iterate up to BZ_N_ITERS times to improve the tables.
+   ---*/
+   for (iter = 0; iter < BZ_N_ITERS; iter++) {
+
+      for (t = 0; t < nGroups; t++) fave[t] = 0;
+
+      for (t = 0; t < nGroups; t++)
+         for (v = 0; v < alphaSize; v++)
+            s->rfreq[t][v] = 0;
+
+      /*---
+        Set up an auxiliary length table which is used to fast-track
+	the common case (nGroups == 6). 
+      ---*/
+      if (nGroups == 6) {
+         for (v = 0; v < alphaSize; v++) {
+            s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
+            s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
+            s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
+	 }
+      }
+
+      nSelectors = 0;
+      totc = 0;
+      gs = 0;
+      while (True) {
+
+         /*--- Set group start & end marks. --*/
+         if (gs >= s->nMTF) break;
+         ge = gs + BZ_G_SIZE - 1; 
+         if (ge >= s->nMTF) ge = s->nMTF-1;
+
+         /*-- 
+            Calculate the cost of this group as coded
+            by each of the coding tables.
+         --*/
+         for (t = 0; t < nGroups; t++) cost[t] = 0;
+
+         if (nGroups == 6 && 50 == ge-gs+1) {
+            /*--- fast track the common case ---*/
+            register UInt32 cost01, cost23, cost45;
+            register UInt16 icv;
+            cost01 = cost23 = cost45 = 0;
+
+#           define BZ_ITER(nn)                \
+               icv = mtfv[gs+(nn)];           \
+               cost01 += s->len_pack[icv][0]; \
+               cost23 += s->len_pack[icv][1]; \
+               cost45 += s->len_pack[icv][2]; \
+
+            BZ_ITER(0);  BZ_ITER(1);  BZ_ITER(2);  BZ_ITER(3);  BZ_ITER(4);
+            BZ_ITER(5);  BZ_ITER(6);  BZ_ITER(7);  BZ_ITER(8);  BZ_ITER(9);
+            BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14);
+            BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19);
+            BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24);
+            BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29);
+            BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34);
+            BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39);
+            BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44);
+            BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49);
+
+#           undef BZ_ITER
+
+            cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
+            cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
+            cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
+
+         } else {
+	    /*--- slow version which correctly handles all situations ---*/
+            for (i = gs; i <= ge; i++) { 
+               UInt16 icv = mtfv[i];
+               for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
+            }
+         }
+ 
+         /*-- 
+            Find the coding table which is best for this group,
+            and record its identity in the selector table.
+         --*/
+         bc = 999999999; bt = -1;
+         for (t = 0; t < nGroups; t++)
+            if (cost[t] < bc) { bc = cost[t]; bt = t; };
+         totc += bc;
+         fave[bt]++;
+         s->selector[nSelectors] = bt;
+         nSelectors++;
+
+         /*-- 
+            Increment the symbol frequencies for the selected table.
+          --*/
+         if (nGroups == 6 && 50 == ge-gs+1) {
+            /*--- fast track the common case ---*/
+
+#           define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++
+
+            BZ_ITUR(0);  BZ_ITUR(1);  BZ_ITUR(2);  BZ_ITUR(3);  BZ_ITUR(4);
+            BZ_ITUR(5);  BZ_ITUR(6);  BZ_ITUR(7);  BZ_ITUR(8);  BZ_ITUR(9);
+            BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14);
+            BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19);
+            BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24);
+            BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29);
+            BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34);
+            BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39);
+            BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44);
+            BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49);
+
+#           undef BZ_ITUR
+
+         } else {
+	    /*--- slow version which correctly handles all situations ---*/
+            for (i = gs; i <= ge; i++)
+               s->rfreq[bt][ mtfv[i] ]++;
+         }
+
+         gs = ge+1;
+      }
+      if (s->verbosity >= 3) {
+         VPrintf2 ( "      pass %d: size is %d, grp uses are ", 
+                   iter+1, totc/8 );
+         for (t = 0; t < nGroups; t++)
+            VPrintf1 ( "%d ", fave[t] );
+         VPrintf0 ( "\n" );
+      }
+
+      /*--
+        Recompute the tables based on the accumulated frequencies.
+      --*/
+      /* maxLen was changed from 20 to 17 in bzip2-1.0.3.  See 
+         comment in huffman.c for details. */
+      for (t = 0; t < nGroups; t++)
+         BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), 
+                                 alphaSize, 17 /*20*/ );
+   }
+
+
+   AssertH( nGroups < 8, 3002 );
+   AssertH( nSelectors < 32768 &&
+            nSelectors <= (2 + (900000 / BZ_G_SIZE)),
+            3003 );
+
+
+   /*--- Compute MTF values for the selectors. ---*/
+   {
+      UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp;
+      for (i = 0; i < nGroups; i++) pos[i] = i;
+      for (i = 0; i < nSelectors; i++) {
+         ll_i = s->selector[i];
+         j = 0;
+         tmp = pos[j];
+         while ( ll_i != tmp ) {
+            j++;
+            tmp2 = tmp;
+            tmp = pos[j];
+            pos[j] = tmp2;
+         };
+         pos[0] = tmp;
+         s->selectorMtf[i] = j;
+      }
+   };
+
+   /*--- Assign actual codes for the tables. --*/
+   for (t = 0; t < nGroups; t++) {
+      minLen = 32;
+      maxLen = 0;
+      for (i = 0; i < alphaSize; i++) {
+         if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
+         if (s->len[t][i] < minLen) minLen = s->len[t][i];
+      }
+      AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
+      AssertH ( !(minLen < 1),  3005 );
+      BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), 
+                          minLen, maxLen, alphaSize );
+   }
+
+   /*--- Transmit the mapping table. ---*/
+   { 
+      Bool inUse16[16];
+      for (i = 0; i < 16; i++) {
+          inUse16[i] = False;
+          for (j = 0; j < 16; j++)
+             if (s->inUse[i * 16 + j]) inUse16[i] = True;
+      }
+     
+      nBytes = s->numZ;
+      for (i = 0; i < 16; i++)
+         if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
+
+      for (i = 0; i < 16; i++)
+         if (inUse16[i])
+            for (j = 0; j < 16; j++) {
+               if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
+            }
+
+      if (s->verbosity >= 3) 
+         VPrintf1( "      bytes: mapping %d, ", s->numZ-nBytes );
+   }
+
+   /*--- Now the selectors. ---*/
+   nBytes = s->numZ;
+   bsW ( s, 3, nGroups );
+   bsW ( s, 15, nSelectors );
+   for (i = 0; i < nSelectors; i++) { 
+      for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
+      bsW(s,1,0);
+   }
+   if (s->verbosity >= 3)
+      VPrintf1( "selectors %d, ", s->numZ-nBytes );
+
+   /*--- Now the coding tables. ---*/
+   nBytes = s->numZ;
+
+   for (t = 0; t < nGroups; t++) {
+      Int32 curr = s->len[t][0];
+      bsW ( s, 5, curr );
+      for (i = 0; i < alphaSize; i++) {
+         while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ };
+         while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ };
+         bsW ( s, 1, 0 );
+      }
+   }
+
+   if (s->verbosity >= 3)
+      VPrintf1 ( "code lengths %d, ", s->numZ-nBytes );
+
+   /*--- And finally, the block data proper ---*/
+   nBytes = s->numZ;
+   selCtr = 0;
+   gs = 0;
+   while (True) {
+      if (gs >= s->nMTF) break;
+      ge = gs + BZ_G_SIZE - 1; 
+      if (ge >= s->nMTF) ge = s->nMTF-1;
+      AssertH ( s->selector[selCtr] < nGroups, 3006 );
+
+      if (nGroups == 6 && 50 == ge-gs+1) {
+            /*--- fast track the common case ---*/
+            UInt16 mtfv_i;
+            UChar* s_len_sel_selCtr 
+               = &(s->len[s->selector[selCtr]][0]);
+            Int32* s_code_sel_selCtr
+               = &(s->code[s->selector[selCtr]][0]);
+
+#           define BZ_ITAH(nn)                      \
+               mtfv_i = mtfv[gs+(nn)];              \
+               bsW ( s,                             \
+                     s_len_sel_selCtr[mtfv_i],      \
+                     s_code_sel_selCtr[mtfv_i] )
+
+            BZ_ITAH(0);  BZ_ITAH(1);  BZ_ITAH(2);  BZ_ITAH(3);  BZ_ITAH(4);
+            BZ_ITAH(5);  BZ_ITAH(6);  BZ_ITAH(7);  BZ_ITAH(8);  BZ_ITAH(9);
+            BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14);
+            BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19);
+            BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24);
+            BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29);
+            BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34);
+            BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39);
+            BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44);
+            BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49);
+
+#           undef BZ_ITAH
+
+      } else {
+	 /*--- slow version which correctly handles all situations ---*/
+         for (i = gs; i <= ge; i++) {
+            bsW ( s, 
+                  s->len  [s->selector[selCtr]] [mtfv[i]],
+                  s->code [s->selector[selCtr]] [mtfv[i]] );
+         }
+      }
+
+
+      gs = ge+1;
+      selCtr++;
+   }
+   AssertH( selCtr == nSelectors, 3007 );
+
+   if (s->verbosity >= 3)
+      VPrintf1( "codes %d\n", s->numZ-nBytes );
+}
+
+
+/*---------------------------------------------------*/
+void BZ2_compressBlock ( EState* s, Bool is_last_block )
+{
+   if (s->nblock > 0) {
+
+      BZ_FINALISE_CRC ( s->blockCRC );
+      s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
+      s->combinedCRC ^= s->blockCRC;
+      if (s->blockNo > 1) s->numZ = 0;
+
+      if (s->verbosity >= 2)
+         VPrintf4( "    block %d: crc = 0x%08x, "
+                   "combined CRC = 0x%08x, size = %d\n",
+                   s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
+
+      BZ2_blockSort ( s );
+   }
+
+   s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
+
+   /*-- If this is the first block, create the stream header. --*/
+   if (s->blockNo == 1) {
+      BZ2_bsInitWrite ( s );
+      bsPutUChar ( s, BZ_HDR_B );
+      bsPutUChar ( s, BZ_HDR_Z );
+      bsPutUChar ( s, BZ_HDR_h );
+      bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) );
+   }
+
+   if (s->nblock > 0) {
+
+      bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
+      bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
+      bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
+
+      /*-- Now the block's CRC, so it is in a known place. --*/
+      bsPutUInt32 ( s, s->blockCRC );
+
+      /*-- 
+         Now a single bit indicating (non-)randomisation. 
+         As of version 0.9.5, we use a better sorting algorithm
+         which makes randomisation unnecessary.  So always set
+         the randomised bit to 'no'.  Of course, the decoder
+         still needs to be able to handle randomised blocks
+         so as to maintain backwards compatibility with
+         older versions of bzip2.
+      --*/
+      bsW(s,1,0);
+
+      bsW ( s, 24, s->origPtr );
+      generateMTFValues ( s );
+      sendMTFValues ( s );
+   }
+
+
+   /*-- If this is the last block, add the stream trailer. --*/
+   if (is_last_block) {
+
+      bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
+      bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
+      bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
+      bsPutUInt32 ( s, s->combinedCRC );
+      if (s->verbosity >= 2)
+         VPrintf1( "    final combined CRC = 0x%08x\n   ", s->combinedCRC );
+      bsFinishWrite ( s );
+   }
+}
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                        compress.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/crctable.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/crctable.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,104 @@
+
+/*-------------------------------------------------------------*/
+/*--- Table for doing CRCs                                  ---*/
+/*---                                            crctable.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#include "bzlib_private.h"
+
+/*--
+  I think this is an implementation of the AUTODIN-II,
+  Ethernet & FDDI 32-bit CRC standard.  Vaguely derived
+  from code by Rob Warnock, in Section 51 of the
+  comp.compression FAQ.
+--*/
+
+UInt32 BZ2_crc32Table[256] = {
+
+   /*-- Ugly, innit? --*/
+
+   0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
+   0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
+   0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
+   0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
+   0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
+   0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
+   0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
+   0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
+   0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
+   0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
+   0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
+   0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
+   0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
+   0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
+   0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
+   0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
+   0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
+   0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
+   0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
+   0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
+   0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
+   0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
+   0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
+   0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
+   0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
+   0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
+   0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
+   0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
+   0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
+   0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
+   0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
+   0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
+   0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
+   0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
+   0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
+   0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
+   0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
+   0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
+   0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
+   0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
+   0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
+   0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
+   0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
+   0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
+   0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
+   0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
+   0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
+   0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
+   0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
+   0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
+   0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
+   0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
+   0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
+   0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
+   0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
+   0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
+   0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
+   0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
+   0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
+   0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
+   0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
+   0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
+   0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
+   0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
+};
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                        crctable.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/decompress.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/decompress.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,626 @@
+
+/*-------------------------------------------------------------*/
+/*--- Decompression machinery                               ---*/
+/*---                                          decompress.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#include "bzlib_private.h"
+
+
+/*---------------------------------------------------*/
+static
+void makeMaps_d ( DState* s )
+{
+   Int32 i;
+   s->nInUse = 0;
+   for (i = 0; i < 256; i++)
+      if (s->inUse[i]) {
+         s->seqToUnseq[s->nInUse] = i;
+         s->nInUse++;
+      }
+}
+
+
+/*---------------------------------------------------*/
+#define RETURN(rrr)                               \
+   { retVal = rrr; goto save_state_and_return; };
+
+#define GET_BITS(lll,vvv,nnn)                     \
+   case lll: s->state = lll;                      \
+   while (True) {                                 \
+      if (s->bsLive >= nnn) {                     \
+         UInt32 v;                                \
+         v = (s->bsBuff >>                        \
+             (s->bsLive-nnn)) & ((1 << nnn)-1);   \
+         s->bsLive -= nnn;                        \
+         vvv = v;                                 \
+         break;                                   \
+      }                                           \
+      if (s->strm->avail_in == 0) RETURN(BZ_OK);  \
+      s->bsBuff                                   \
+         = (s->bsBuff << 8) |                     \
+           ((UInt32)                              \
+              (*((UChar*)(s->strm->next_in))));   \
+      s->bsLive += 8;                             \
+      s->strm->next_in++;                         \
+      s->strm->avail_in--;                        \
+      s->strm->total_in_lo32++;                   \
+      if (s->strm->total_in_lo32 == 0)            \
+         s->strm->total_in_hi32++;                \
+   }
+
+#define GET_UCHAR(lll,uuu)                        \
+   GET_BITS(lll,uuu,8)
+
+#define GET_BIT(lll,uuu)                          \
+   GET_BITS(lll,uuu,1)
+
+/*---------------------------------------------------*/
+#define GET_MTF_VAL(label1,label2,lval)           \
+{                                                 \
+   if (groupPos == 0) {                           \
+      groupNo++;                                  \
+      if (groupNo >= nSelectors)                  \
+         RETURN(BZ_DATA_ERROR);                   \
+      groupPos = BZ_G_SIZE;                       \
+      gSel = s->selector[groupNo];                \
+      gMinlen = s->minLens[gSel];                 \
+      gLimit = &(s->limit[gSel][0]);              \
+      gPerm = &(s->perm[gSel][0]);                \
+      gBase = &(s->base[gSel][0]);                \
+   }                                              \
+   groupPos--;                                    \
+   zn = gMinlen;                                  \
+   GET_BITS(label1, zvec, zn);                    \
+   while (1) {                                    \
+      if (zn > 20 /* the longest code */)         \
+         RETURN(BZ_DATA_ERROR);                   \
+      if (zvec <= gLimit[zn]) break;              \
+      zn++;                                       \
+      GET_BIT(label2, zj);                        \
+      zvec = (zvec << 1) | zj;                    \
+   };                                             \
+   if (zvec - gBase[zn] < 0                       \
+       || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE)  \
+      RETURN(BZ_DATA_ERROR);                      \
+   lval = gPerm[zvec - gBase[zn]];                \
+}
+
+
+/*---------------------------------------------------*/
+Int32 BZ2_decompress ( DState* s )
+{
+   UChar      uc;
+   Int32      retVal;
+   Int32      minLen, maxLen;
+   bz_stream* strm = s->strm;
+
+   /* stuff that needs to be saved/restored */
+   Int32  i;
+   Int32  j;
+   Int32  t;
+   Int32  alphaSize;
+   Int32  nGroups;
+   Int32  nSelectors;
+   Int32  EOB;
+   Int32  groupNo;
+   Int32  groupPos;
+   Int32  nextSym;
+   Int32  nblockMAX;
+   Int32  nblock;
+   Int32  es;
+   Int32  N;
+   Int32  curr;
+   Int32  zt;
+   Int32  zn; 
+   Int32  zvec;
+   Int32  zj;
+   Int32  gSel;
+   Int32  gMinlen;
+   Int32* gLimit;
+   Int32* gBase;
+   Int32* gPerm;
+
+   if (s->state == BZ_X_MAGIC_1) {
+      /*initialise the save area*/
+      s->save_i           = 0;
+      s->save_j           = 0;
+      s->save_t           = 0;
+      s->save_alphaSize   = 0;
+      s->save_nGroups     = 0;
+      s->save_nSelectors  = 0;
+      s->save_EOB         = 0;
+      s->save_groupNo     = 0;
+      s->save_groupPos    = 0;
+      s->save_nextSym     = 0;
+      s->save_nblockMAX   = 0;
+      s->save_nblock      = 0;
+      s->save_es          = 0;
+      s->save_N           = 0;
+      s->save_curr        = 0;
+      s->save_zt          = 0;
+      s->save_zn          = 0;
+      s->save_zvec        = 0;
+      s->save_zj          = 0;
+      s->save_gSel        = 0;
+      s->save_gMinlen     = 0;
+      s->save_gLimit      = NULL;
+      s->save_gBase       = NULL;
+      s->save_gPerm       = NULL;
+   }
+
+   /*restore from the save area*/
+   i           = s->save_i;
+   j           = s->save_j;
+   t           = s->save_t;
+   alphaSize   = s->save_alphaSize;
+   nGroups     = s->save_nGroups;
+   nSelectors  = s->save_nSelectors;
+   EOB         = s->save_EOB;
+   groupNo     = s->save_groupNo;
+   groupPos    = s->save_groupPos;
+   nextSym     = s->save_nextSym;
+   nblockMAX   = s->save_nblockMAX;
+   nblock      = s->save_nblock;
+   es          = s->save_es;
+   N           = s->save_N;
+   curr        = s->save_curr;
+   zt          = s->save_zt;
+   zn          = s->save_zn; 
+   zvec        = s->save_zvec;
+   zj          = s->save_zj;
+   gSel        = s->save_gSel;
+   gMinlen     = s->save_gMinlen;
+   gLimit      = s->save_gLimit;
+   gBase       = s->save_gBase;
+   gPerm       = s->save_gPerm;
+
+   retVal = BZ_OK;
+
+   switch (s->state) {
+
+      GET_UCHAR(BZ_X_MAGIC_1, uc);
+      if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC);
+
+      GET_UCHAR(BZ_X_MAGIC_2, uc);
+      if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC);
+
+      GET_UCHAR(BZ_X_MAGIC_3, uc)
+      if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
+
+      GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
+      if (s->blockSize100k < (BZ_HDR_0 + 1) || 
+          s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
+      s->blockSize100k -= BZ_HDR_0;
+
+      if (s->smallDecompress) {
+         s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
+         s->ll4  = BZALLOC( 
+                      ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) 
+                   );
+         if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
+      } else {
+         s->tt  = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );
+         if (s->tt == NULL) RETURN(BZ_MEM_ERROR);
+      }
+
+      GET_UCHAR(BZ_X_BLKHDR_1, uc);
+
+      if (uc == 0x17) goto endhdr_2;
+      if (uc != 0x31) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_BLKHDR_2, uc);
+      if (uc != 0x41) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_BLKHDR_3, uc);
+      if (uc != 0x59) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_BLKHDR_4, uc);
+      if (uc != 0x26) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_BLKHDR_5, uc);
+      if (uc != 0x53) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_BLKHDR_6, uc);
+      if (uc != 0x59) RETURN(BZ_DATA_ERROR);
+
+      s->currBlockNo++;
+      if (s->verbosity >= 2)
+         VPrintf1 ( "\n    [%d: huff+mtf ", s->currBlockNo );
+ 
+      s->storedBlockCRC = 0;
+      GET_UCHAR(BZ_X_BCRC_1, uc);
+      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_BCRC_2, uc);
+      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_BCRC_3, uc);
+      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_BCRC_4, uc);
+      s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
+
+      GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1);
+
+      s->origPtr = 0;
+      GET_UCHAR(BZ_X_ORIGPTR_1, uc);
+      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
+      GET_UCHAR(BZ_X_ORIGPTR_2, uc);
+      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
+      GET_UCHAR(BZ_X_ORIGPTR_3, uc);
+      s->origPtr = (s->origPtr << 8) | ((Int32)uc);
+
+      if (s->origPtr < 0)
+         RETURN(BZ_DATA_ERROR);
+      if (s->origPtr > 10 + 100000*s->blockSize100k) 
+         RETURN(BZ_DATA_ERROR);
+
+      /*--- Receive the mapping table ---*/
+      for (i = 0; i < 16; i++) {
+         GET_BIT(BZ_X_MAPPING_1, uc);
+         if (uc == 1) 
+            s->inUse16[i] = True; else 
+            s->inUse16[i] = False;
+      }
+
+      for (i = 0; i < 256; i++) s->inUse[i] = False;
+
+      for (i = 0; i < 16; i++)
+         if (s->inUse16[i])
+            for (j = 0; j < 16; j++) {
+               GET_BIT(BZ_X_MAPPING_2, uc);
+               if (uc == 1) s->inUse[i * 16 + j] = True;
+            }
+      makeMaps_d ( s );
+      if (s->nInUse == 0) RETURN(BZ_DATA_ERROR);
+      alphaSize = s->nInUse+2;
+
+      /*--- Now the selectors ---*/
+      GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
+      if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
+      GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
+      if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
+      for (i = 0; i < nSelectors; i++) {
+         j = 0;
+         while (True) {
+            GET_BIT(BZ_X_SELECTOR_3, uc);
+            if (uc == 0) break;
+            j++;
+            if (j >= nGroups) RETURN(BZ_DATA_ERROR);
+         }
+         s->selectorMtf[i] = j;
+      }
+
+      /*--- Undo the MTF values for the selectors. ---*/
+      {
+         UChar pos[BZ_N_GROUPS], tmp, v;
+         for (v = 0; v < nGroups; v++) pos[v] = v;
+   
+         for (i = 0; i < nSelectors; i++) {
+            v = s->selectorMtf[i];
+            tmp = pos[v];
+            while (v > 0) { pos[v] = pos[v-1]; v--; }
+            pos[0] = tmp;
+            s->selector[i] = tmp;
+         }
+      }
+
+      /*--- Now the coding tables ---*/
+      for (t = 0; t < nGroups; t++) {
+         GET_BITS(BZ_X_CODING_1, curr, 5);
+         for (i = 0; i < alphaSize; i++) {
+            while (True) {
+               if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR);
+               GET_BIT(BZ_X_CODING_2, uc);
+               if (uc == 0) break;
+               GET_BIT(BZ_X_CODING_3, uc);
+               if (uc == 0) curr++; else curr--;
+            }
+            s->len[t][i] = curr;
+         }
+      }
+
+      /*--- Create the Huffman decoding tables ---*/
+      for (t = 0; t < nGroups; t++) {
+         minLen = 32;
+         maxLen = 0;
+         for (i = 0; i < alphaSize; i++) {
+            if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
+            if (s->len[t][i] < minLen) minLen = s->len[t][i];
+         }
+         BZ2_hbCreateDecodeTables ( 
+            &(s->limit[t][0]), 
+            &(s->base[t][0]), 
+            &(s->perm[t][0]), 
+            &(s->len[t][0]),
+            minLen, maxLen, alphaSize
+         );
+         s->minLens[t] = minLen;
+      }
+
+      /*--- Now the MTF values ---*/
+
+      EOB      = s->nInUse+1;
+      nblockMAX = 100000 * s->blockSize100k;
+      groupNo  = -1;
+      groupPos = 0;
+
+      for (i = 0; i <= 255; i++) s->unzftab[i] = 0;
+
+      /*-- MTF init --*/
+      {
+         Int32 ii, jj, kk;
+         kk = MTFA_SIZE-1;
+         for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) {
+            for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
+               s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj);
+               kk--;
+            }
+            s->mtfbase[ii] = kk + 1;
+         }
+      }
+      /*-- end MTF init --*/
+
+      nblock = 0;
+      GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym);
+
+      while (True) {
+
+         if (nextSym == EOB) break;
+
+         if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
+
+            es = -1;
+            N = 1;
+            do {
+               if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
+               if (nextSym == BZ_RUNB) es = es + (1+1) * N;
+               N = N * 2;
+               GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym);
+            }
+               while (nextSym == BZ_RUNA || nextSym == BZ_RUNB);
+
+            es++;
+            uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ];
+            s->unzftab[uc] += es;
+
+            if (s->smallDecompress)
+               while (es > 0) {
+                  if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
+                  s->ll16[nblock] = (UInt16)uc;
+                  nblock++;
+                  es--;
+               }
+            else
+               while (es > 0) {
+                  if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
+                  s->tt[nblock] = (UInt32)uc;
+                  nblock++;
+                  es--;
+               };
+
+            continue;
+
+         } else {
+
+            if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
+
+            /*-- uc = MTF ( nextSym-1 ) --*/
+            {
+               Int32 ii, jj, kk, pp, lno, off;
+               UInt32 nn;
+               nn = (UInt32)(nextSym - 1);
+
+               if (nn < MTFL_SIZE) {
+                  /* avoid general-case expense */
+                  pp = s->mtfbase[0];
+                  uc = s->mtfa[pp+nn];
+                  while (nn > 3) {
+                     Int32 z = pp+nn;
+                     s->mtfa[(z)  ] = s->mtfa[(z)-1];
+                     s->mtfa[(z)-1] = s->mtfa[(z)-2];
+                     s->mtfa[(z)-2] = s->mtfa[(z)-3];
+                     s->mtfa[(z)-3] = s->mtfa[(z)-4];
+                     nn -= 4;
+                  }
+                  while (nn > 0) { 
+                     s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; 
+                  };
+                  s->mtfa[pp] = uc;
+               } else { 
+                  /* general case */
+                  lno = nn / MTFL_SIZE;
+                  off = nn % MTFL_SIZE;
+                  pp = s->mtfbase[lno] + off;
+                  uc = s->mtfa[pp];
+                  while (pp > s->mtfbase[lno]) { 
+                     s->mtfa[pp] = s->mtfa[pp-1]; pp--; 
+                  };
+                  s->mtfbase[lno]++;
+                  while (lno > 0) {
+                     s->mtfbase[lno]--;
+                     s->mtfa[s->mtfbase[lno]] 
+                        = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
+                     lno--;
+                  }
+                  s->mtfbase[0]--;
+                  s->mtfa[s->mtfbase[0]] = uc;
+                  if (s->mtfbase[0] == 0) {
+                     kk = MTFA_SIZE-1;
+                     for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
+                        for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
+                           s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
+                           kk--;
+                        }
+                        s->mtfbase[ii] = kk + 1;
+                     }
+                  }
+               }
+            }
+            /*-- end uc = MTF ( nextSym-1 ) --*/
+
+            s->unzftab[s->seqToUnseq[uc]]++;
+            if (s->smallDecompress)
+               s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else
+               s->tt[nblock]   = (UInt32)(s->seqToUnseq[uc]);
+            nblock++;
+
+            GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym);
+            continue;
+         }
+      }
+
+      /* Now we know what nblock is, we can do a better sanity
+         check on s->origPtr.
+      */
+      if (s->origPtr < 0 || s->origPtr >= nblock)
+         RETURN(BZ_DATA_ERROR);
+
+      /*-- Set up cftab to facilitate generation of T^(-1) --*/
+      s->cftab[0] = 0;
+      for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
+      for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
+      for (i = 0; i <= 256; i++) {
+         if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
+            /* s->cftab[i] can legitimately be == nblock */
+            RETURN(BZ_DATA_ERROR);
+         }
+      }
+
+      s->state_out_len = 0;
+      s->state_out_ch  = 0;
+      BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
+      s->state = BZ_X_OUTPUT;
+      if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
+
+      if (s->smallDecompress) {
+
+         /*-- Make a copy of cftab, used in generation of T --*/
+         for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i];
+
+         /*-- compute the T vector --*/
+         for (i = 0; i < nblock; i++) {
+            uc = (UChar)(s->ll16[i]);
+            SET_LL(i, s->cftabCopy[uc]);
+            s->cftabCopy[uc]++;
+         }
+
+         /*-- Compute T^(-1) by pointer reversal on T --*/
+         i = s->origPtr;
+         j = GET_LL(i);
+         do {
+            Int32 tmp = GET_LL(j);
+            SET_LL(j, i);
+            i = j;
+            j = tmp;
+         }
+            while (i != s->origPtr);
+
+         s->tPos = s->origPtr;
+         s->nblock_used = 0;
+         if (s->blockRandomised) {
+            BZ_RAND_INIT_MASK;
+            BZ_GET_SMALL(s->k0); s->nblock_used++;
+            BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; 
+         } else {
+            BZ_GET_SMALL(s->k0); s->nblock_used++;
+         }
+
+      } else {
+
+         /*-- compute the T^(-1) vector --*/
+         for (i = 0; i < nblock; i++) {
+            uc = (UChar)(s->tt[i] & 0xff);
+            s->tt[s->cftab[uc]] |= (i << 8);
+            s->cftab[uc]++;
+         }
+
+         s->tPos = s->tt[s->origPtr] >> 8;
+         s->nblock_used = 0;
+         if (s->blockRandomised) {
+            BZ_RAND_INIT_MASK;
+            BZ_GET_FAST(s->k0); s->nblock_used++;
+            BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; 
+         } else {
+            BZ_GET_FAST(s->k0); s->nblock_used++;
+         }
+
+      }
+
+      RETURN(BZ_OK);
+
+
+
+    endhdr_2:
+
+      GET_UCHAR(BZ_X_ENDHDR_2, uc);
+      if (uc != 0x72) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_ENDHDR_3, uc);
+      if (uc != 0x45) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_ENDHDR_4, uc);
+      if (uc != 0x38) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_ENDHDR_5, uc);
+      if (uc != 0x50) RETURN(BZ_DATA_ERROR);
+      GET_UCHAR(BZ_X_ENDHDR_6, uc);
+      if (uc != 0x90) RETURN(BZ_DATA_ERROR);
+
+      s->storedCombinedCRC = 0;
+      GET_UCHAR(BZ_X_CCRC_1, uc);
+      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_CCRC_2, uc);
+      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_CCRC_3, uc);
+      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
+      GET_UCHAR(BZ_X_CCRC_4, uc);
+      s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
+
+      s->state = BZ_X_IDLE;
+      RETURN(BZ_STREAM_END);
+
+      default: AssertH ( False, 4001 );
+   }
+
+   AssertH ( False, 4002 );
+
+   save_state_and_return:
+
+   s->save_i           = i;
+   s->save_j           = j;
+   s->save_t           = t;
+   s->save_alphaSize   = alphaSize;
+   s->save_nGroups     = nGroups;
+   s->save_nSelectors  = nSelectors;
+   s->save_EOB         = EOB;
+   s->save_groupNo     = groupNo;
+   s->save_groupPos    = groupPos;
+   s->save_nextSym     = nextSym;
+   s->save_nblockMAX   = nblockMAX;
+   s->save_nblock      = nblock;
+   s->save_es          = es;
+   s->save_N           = N;
+   s->save_curr        = curr;
+   s->save_zt          = zt;
+   s->save_zn          = zn;
+   s->save_zvec        = zvec;
+   s->save_zj          = zj;
+   s->save_gSel        = gSel;
+   s->save_gMinlen     = gMinlen;
+   s->save_gLimit      = gLimit;
+   s->save_gBase       = gBase;
+   s->save_gPerm       = gPerm;
+
+   return retVal;   
+}
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                      decompress.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/dlltest.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/dlltest.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,175 @@
+/*
+   minibz2
+      libbz2.dll test program.
+      by Yoshioka Tsuneo (tsuneo at rr.iij4u.or.jp)
+      This file is Public Domain.  Welcome any email to me.
+
+   usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]
+*/
+
+#define BZ_IMPORT
+#include 
+#include 
+#include "bzlib.h"
+#ifdef _WIN32
+#include 
+#endif
+
+
+#ifdef _WIN32
+
+#define BZ2_LIBNAME "libbz2-1.0.2.DLL" 
+
+#include 
+static int BZ2DLLLoaded = 0;
+static HINSTANCE BZ2DLLhLib;
+int BZ2DLLLoadLibrary(void)
+{
+   HINSTANCE hLib;
+
+   if(BZ2DLLLoaded==1){return 0;}
+   hLib=LoadLibrary(BZ2_LIBNAME);
+   if(hLib == NULL){
+      fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME);
+      return -1;
+   }
+   BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion");
+   BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen");
+   BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen");
+   BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread");
+   BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite");
+   BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush");
+   BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose");
+   BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror");
+
+   if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen
+       || !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush
+       || !BZ2_bzclose || !BZ2_bzerror) {
+      fprintf(stderr,"GetProcAddress failed.\n");
+      return -1;
+   }
+   BZ2DLLLoaded=1;
+   BZ2DLLhLib=hLib;
+   return 0;
+
+}
+int BZ2DLLFreeLibrary(void)
+{
+   if(BZ2DLLLoaded==0){return 0;}
+   FreeLibrary(BZ2DLLhLib);
+   BZ2DLLLoaded=0;
+}
+#endif /* WIN32 */
+
+void usage(void)
+{
+   puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]");
+}
+
+int main(int argc,char *argv[])
+{
+   int decompress = 0;
+   int level = 9;
+   char *fn_r = NULL;
+   char *fn_w = NULL;
+
+#ifdef _WIN32
+   if(BZ2DLLLoadLibrary()<0){
+      fprintf(stderr,"Loading of %s failed.  Giving up.\n", BZ2_LIBNAME);
+      exit(1);
+   }
+   printf("Loading of %s succeeded.  Library version is %s.\n",
+          BZ2_LIBNAME, BZ2_bzlibVersion() );
+#endif
+   while(++argv,--argc){
+      if(**argv =='-' || **argv=='/'){
+         char *p;
+
+         for(p=*argv+1;*p;p++){
+            if(*p=='d'){
+               decompress = 1;
+            }else if('1'<=*p && *p<='9'){
+               level = *p - '0';
+            }else{
+               usage();
+               exit(1);
+            }
+         }
+      }else{
+         break;
+      }
+   }
+   if(argc>=1){
+      fn_r = *argv;
+      argc--;argv++;
+   }else{
+      fn_r = NULL;
+   }
+   if(argc>=1){
+      fn_w = *argv;
+      argc--;argv++;
+   }else{
+      fn_w = NULL;
+   }
+   {
+      int len;
+      char buff[0x1000];
+      char mode[10];
+
+      if(decompress){
+         BZFILE *BZ2fp_r = NULL;
+         FILE *fp_w = NULL;
+
+         if(fn_w){
+            if((fp_w = fopen(fn_w,"wb"))==NULL){
+               printf("can't open [%s]\n",fn_w);
+               perror("reason:");
+               exit(1);
+            }
+         }else{
+            fp_w = stdout;
+         }
+         if((fn_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL)
+            || (fn_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){
+            printf("can't bz2openstream\n");
+            exit(1);
+         }
+         while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){
+            fwrite(buff,1,len,fp_w);
+         }
+         BZ2_bzclose(BZ2fp_r);
+         if(fp_w != stdout) fclose(fp_w);
+      }else{
+         BZFILE *BZ2fp_w = NULL;
+         FILE *fp_r = NULL;
+
+         if(fn_r){
+            if((fp_r = fopen(fn_r,"rb"))==NULL){
+               printf("can't open [%s]\n",fn_r);
+               perror("reason:");
+               exit(1);
+            }
+         }else{
+            fp_r = stdin;
+         }
+         mode[0]='w';
+         mode[1] = '0' + level;
+         mode[2] = '\0';
+
+         if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL)
+            || (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){
+            printf("can't bz2openstream\n");
+            exit(1);
+         }
+         while((len=fread(buff,1,0x1000,fp_r))>0){
+            BZ2_bzwrite(BZ2fp_w,buff,len);
+         }
+         BZ2_bzclose(BZ2fp_w);
+         if(fp_r!=stdin)fclose(fp_r);
+      }
+   }
+#ifdef _WIN32
+   BZ2DLLFreeLibrary();
+#endif
+   return 0;
+}

Added: projects/external/bzip2-1.0.5/dlltest.dsp
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/dlltest.dsp	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,93 @@
+# Microsoft Developer Studio Project File - Name="dlltest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** ???W???????????????? **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=dlltest - Win32 Debug
+!MESSAGE ???????L??????????????????????????B ??????????????????????????????? NMAKE ???g?p?????????????B
+!MESSAGE [????????????????] ????????g?p???????s????????????
+!MESSAGE 
+!MESSAGE NMAKE /f "dlltest.mak".
+!MESSAGE 
+!MESSAGE NMAKE ?????s?????\?????w??????????
+!MESSAGE ????? ?????????????????????`???????B??:
+!MESSAGE 
+!MESSAGE NMAKE /f "dlltest.mak" CFG="dlltest - Win32 Debug"
+!MESSAGE 
+!MESSAGE ?I?????\??????? ????:
+!MESSAGE 
+!MESSAGE "dlltest - Win32 Release" ("Win32 (x86) Console Application" ?p)
+!MESSAGE "dlltest - Win32 Debug" ("Win32 (x86) Console Application" ?p)
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "dlltest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"minibz2.exe"
+
+!ELSEIF  "$(CFG)" == "dlltest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "dlltest_"
+# PROP BASE Intermediate_Dir "dlltest_"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "dlltest_"
+# PROP Intermediate_Dir "dlltest_"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"minibz2.exe" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "dlltest - Win32 Release"
+# Name "dlltest - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\bzlib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\dlltest.c
+# End Source File
+# End Target
+# End Project

Added: projects/external/bzip2-1.0.5/entities.xml
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/entities.xml	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+

Added: projects/external/bzip2-1.0.5/format.pl
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/format.pl	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,68 @@
+#!/usr/bin/perl -w
+#
+# ------------------------------------------------------------------
+# This file is part of bzip2/libbzip2, a program and library for
+# lossless, block-sorting data compression.
+#
+# bzip2/libbzip2 version 1.0.5 of 10 December 2007
+# Copyright (C) 1996-2007 Julian Seward 
+#
+# Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+# README file.
+#
+# This program is released under the terms of the license contained
+# in the file LICENSE.
+# ------------------------------------------------------------------
+#
+use strict;
+
+# get command line values:
+if ( $#ARGV !=1 ) {
+    die "Usage:  $0 xml_infile xml_outfile\n";
+}
+
+my $infile = shift;
+# check infile exists
+die "Can't find file \"$infile\""
+  unless -f $infile;
+# check we can read infile
+if (! -r $infile) {
+    die "Can't read input $infile\n";
+}
+# check we can open infile
+open( INFILE,"<$infile" ) or 
+    die "Can't input $infile $!";
+
+#my $outfile = 'fmt-manual.xml';
+my $outfile = shift;
+#print "Infile: $infile, Outfile: $outfile\n";
+# check we can write to outfile
+open( OUTFILE,">$outfile" ) or 
+    die "Can't output $outfile $! for writing";
+
+my ($prev, $curr, $str);
+$prev = ''; $curr = '';
+while (  ) {
+
+		print OUTFILE $prev;
+    $prev = $curr;
+    $curr = $_;
+    $str = '';
+
+    if ( $prev =~ /$|$/ ) {
+        chomp $prev;
+        $curr = join( '', $prev, "|<\/screen>/ ) {
+        chomp $prev;
+        $curr = join( '', $prev, "]]>", $curr );
+				$prev = '';
+        next;
+    }
+}
+print OUTFILE $curr;
+close INFILE;
+close OUTFILE;
+exit;

Added: projects/external/bzip2-1.0.5/huffman.c
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/huffman.c	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,205 @@
+
+/*-------------------------------------------------------------*/
+/*--- Huffman coding low-level stuff                        ---*/
+/*---                                             huffman.c ---*/
+/*-------------------------------------------------------------*/
+
+/* ------------------------------------------------------------------
+   This file is part of bzip2/libbzip2, a program and library for
+   lossless, block-sorting data compression.
+
+   bzip2/libbzip2 version 1.0.5 of 10 December 2007
+   Copyright (C) 1996-2007 Julian Seward 
+
+   Please read the WARNING, DISCLAIMER and PATENTS sections in the 
+   README file.
+
+   This program is released under the terms of the license contained
+   in the file LICENSE.
+   ------------------------------------------------------------------ */
+
+
+#include "bzlib_private.h"
+
+/*---------------------------------------------------*/
+#define WEIGHTOF(zz0)  ((zz0) & 0xffffff00)
+#define DEPTHOF(zz1)   ((zz1) & 0x000000ff)
+#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
+
+#define ADDWEIGHTS(zw1,zw2)                           \
+   (WEIGHTOF(zw1)+WEIGHTOF(zw2)) |                    \
+   (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
+
+#define UPHEAP(z)                                     \
+{                                                     \
+   Int32 zz, tmp;                                     \
+   zz = z; tmp = heap[zz];                            \
+   while (weight[tmp] < weight[heap[zz >> 1]]) {      \
+      heap[zz] = heap[zz >> 1];                       \
+      zz >>= 1;                                       \
+   }                                                  \
+   heap[zz] = tmp;                                    \
+}
+
+#define DOWNHEAP(z)                                   \
+{                                                     \
+   Int32 zz, yy, tmp;                                 \
+   zz = z; tmp = heap[zz];                            \
+   while (True) {                                     \
+      yy = zz << 1;                                   \
+      if (yy > nHeap) break;                          \
+      if (yy < nHeap &&                               \
+          weight[heap[yy+1]] < weight[heap[yy]])      \
+         yy++;                                        \
+      if (weight[tmp] < weight[heap[yy]]) break;      \
+      heap[zz] = heap[yy];                            \
+      zz = yy;                                        \
+   }                                                  \
+   heap[zz] = tmp;                                    \
+}
+
+
+/*---------------------------------------------------*/
+void BZ2_hbMakeCodeLengths ( UChar *len, 
+                             Int32 *freq,
+                             Int32 alphaSize,
+                             Int32 maxLen )
+{
+   /*--
+      Nodes and heap entries run from 1.  Entry 0
+      for both the heap and nodes is a sentinel.
+   --*/
+   Int32 nNodes, nHeap, n1, n2, i, j, k;
+   Bool  tooLong;
+
+   Int32 heap   [ BZ_MAX_ALPHA_SIZE + 2 ];
+   Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
+   Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; 
+
+   for (i = 0; i < alphaSize; i++)
+      weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
+
+   while (True) {
+
+      nNodes = alphaSize;
+      nHeap = 0;
+
+      heap[0] = 0;
+      weight[0] = 0;
+      parent[0] = -2;
+
+      for (i = 1; i <= alphaSize; i++) {
+         parent[i] = -1;
+         nHeap++;
+         heap[nHeap] = i;
+         UPHEAP(nHeap);
+      }
+
+      AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
+   
+      while (nHeap > 1) {
+         n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
+         n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
+         nNodes++;
+         parent[n1] = parent[n2] = nNodes;
+         weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
+         parent[nNodes] = -1;
+         nHeap++;
+         heap[nHeap] = nNodes;
+         UPHEAP(nHeap);
+      }
+
+      AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
+
+      tooLong = False;
+      for (i = 1; i <= alphaSize; i++) {
+         j = 0;
+         k = i;
+         while (parent[k] >= 0) { k = parent[k]; j++; }
+         len[i-1] = j;
+         if (j > maxLen) tooLong = True;
+      }
+      
+      if (! tooLong) break;
+
+      /* 17 Oct 04: keep-going condition for the following loop used
+         to be 'i < alphaSize', which missed the last element,
+         theoretically leading to the possibility of the compressor
+         looping.  However, this count-scaling step is only needed if
+         one of the generated Huffman code words is longer than
+         maxLen, which up to and including version 1.0.2 was 20 bits,
+         which is extremely unlikely.  In version 1.0.3 maxLen was
+         changed to 17 bits, which has minimal effect on compression
+         ratio, but does mean this scaling step is used from time to
+         time, enough to verify that it works.
+
+         This means that bzip2-1.0.3 and later will only produce
+         Huffman codes with a maximum length of 17 bits.  However, in
+         order to preserve backwards compatibility with bitstreams
+         produced by versions pre-1.0.3, the decompressor must still
+         handle lengths of up to 20. */
+
+      for (i = 1; i <= alphaSize; i++) {
+         j = weight[i] >> 8;
+         j = 1 + (j / 2);
+         weight[i] = j << 8;
+      }
+   }
+}
+
+
+/*---------------------------------------------------*/
+void BZ2_hbAssignCodes ( Int32 *code,
+                         UChar *length,
+                         Int32 minLen,
+                         Int32 maxLen,
+                         Int32 alphaSize )
+{
+   Int32 n, vec, i;
+
+   vec = 0;
+   for (n = minLen; n <= maxLen; n++) {
+      for (i = 0; i < alphaSize; i++)
+         if (length[i] == n) { code[i] = vec; vec++; };
+      vec <<= 1;
+   }
+}
+
+
+/*---------------------------------------------------*/
+void BZ2_hbCreateDecodeTables ( Int32 *limit,
+                                Int32 *base,
+                                Int32 *perm,
+                                UChar *length,
+                                Int32 minLen,
+                                Int32 maxLen,
+                                Int32 alphaSize )
+{
+   Int32 pp, i, j, vec;
+
+   pp = 0;
+   for (i = minLen; i <= maxLen; i++)
+      for (j = 0; j < alphaSize; j++)
+         if (length[j] == i) { perm[pp] = j; pp++; };
+
+   for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
+   for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
+
+   for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
+
+   for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
+   vec = 0;
+
+   for (i = minLen; i <= maxLen; i++) {
+      vec += (base[i+1] - base[i]);
+      limit[i] = vec-1;
+      vec <<= 1;
+   }
+   for (i = minLen + 1; i <= maxLen; i++)
+      base[i] = ((limit[i-1] + 1) << 1) - base[i];
+}
+
+
+/*-------------------------------------------------------------*/
+/*--- end                                         huffman.c ---*/
+/*-------------------------------------------------------------*/

Added: projects/external/bzip2-1.0.5/libbz2.def
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/libbz2.def	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,27 @@
+LIBRARY			LIBBZ2
+DESCRIPTION		"libbzip2: library for data compression"
+EXPORTS
+	BZ2_bzCompressInit
+	BZ2_bzCompress
+	BZ2_bzCompressEnd
+	BZ2_bzDecompressInit
+	BZ2_bzDecompress
+	BZ2_bzDecompressEnd
+	BZ2_bzReadOpen
+	BZ2_bzReadClose
+	BZ2_bzReadGetUnused
+	BZ2_bzRead
+	BZ2_bzWriteOpen
+	BZ2_bzWrite
+	BZ2_bzWriteClose
+	BZ2_bzWriteClose64
+	BZ2_bzBuffToBuffCompress
+	BZ2_bzBuffToBuffDecompress
+	BZ2_bzlibVersion
+	BZ2_bzopen
+	BZ2_bzdopen
+	BZ2_bzread
+	BZ2_bzwrite
+	BZ2_bzflush
+	BZ2_bzclose
+	BZ2_bzerror

Added: projects/external/bzip2-1.0.5/libbz2.dsp
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/libbz2.dsp	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,130 @@
+# Microsoft Developer Studio Project File - Name="libbz2" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** ???W???????????????? **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libbz2 - Win32 Debug
+!MESSAGE ???????L??????????????????????????B ??????????????????????????????? NMAKE ???g?p?????????????B
+!MESSAGE [????????????????] ????????g?p???????s????????????
+!MESSAGE 
+!MESSAGE NMAKE /f "libbz2.mak".
+!MESSAGE 
+!MESSAGE NMAKE ?????s?????\?????w??????????
+!MESSAGE ????? ?????????????????????`???????B??:
+!MESSAGE 
+!MESSAGE NMAKE /f "libbz2.mak" CFG="libbz2 - Win32 Debug"
+!MESSAGE 
+!MESSAGE ?I?????\??????? ????:
+!MESSAGE 
+!MESSAGE "libbz2 - Win32 Release" ("Win32 (x86) Dynamic-Link Library" ?p)
+!MESSAGE "libbz2 - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" ?p)
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "libbz2 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE RSC /l 0x411 /d "NDEBUG"
+# ADD RSC /l 0x411 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /out:"libbz2.dll"
+
+!ELSEIF  "$(CFG)" == "libbz2 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
+# ADD BASE RSC /l 0x411 /d "_DEBUG"
+# ADD RSC /l 0x411 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"libbz2.dll" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "libbz2 - Win32 Release"
+# Name "libbz2 - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\blocksort.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bzlib.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bzlib.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\bzlib_private.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\compress.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\crctable.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\decompress.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\huffman.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\libbz2.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\randtable.c
+# End Source File
+# End Target
+# End Project

Added: projects/external/bzip2-1.0.5/makefile.msc
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/makefile.msc	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,63 @@
+# Makefile for Microsoft Visual C++ 6.0
+# usage: nmake -f makefile.msc
+# K.M. Syring (syring at gsf.de)
+# Fixed up by JRS for bzip2-0.9.5d release.
+
+CC=cl
+CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
+
+OBJS= blocksort.obj  \
+      huffman.obj    \
+      crctable.obj   \
+      randtable.obj  \
+      compress.obj   \
+      decompress.obj \
+      bzlib.obj
+
+all: lib bzip2 test
+
+bzip2: lib
+	$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
+	$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
+
+lib: $(OBJS)
+	lib /out:libbz2.lib $(OBJS)
+
+test: bzip2
+	type words1
+	.\\bzip2 -1  < sample1.ref > sample1.rb2
+	.\\bzip2 -2  < sample2.ref > sample2.rb2
+	.\\bzip2 -3  < sample3.ref > sample3.rb2
+	.\\bzip2 -d  < sample1.bz2 > sample1.tst
+	.\\bzip2 -d  < sample2.bz2 > sample2.tst
+	.\\bzip2 -ds < sample3.bz2 > sample3.tst
+	@echo All six of the fc's should find no differences.
+	@echo If fc finds an error on sample3.bz2, this could be
+	@echo because WinZip's 'TAR file smart CR/LF conversion'
+	@echo is too clever for its own good.  Disable this option.
+	@echo The correct size for sample3.ref is 120,244.  If it
+	@echo is 150,251, WinZip has messed it up.
+	fc sample1.bz2 sample1.rb2 
+	fc sample2.bz2 sample2.rb2
+	fc sample3.bz2 sample3.rb2
+	fc sample1.tst sample1.ref
+	fc sample2.tst sample2.ref
+	fc sample3.tst sample3.ref
+
+
+
+clean: 
+	del *.obj
+	del libbz2.lib 
+	del bzip2.exe
+	del bzip2recover.exe
+	del sample1.rb2 
+	del sample2.rb2 
+	del sample3.rb2
+	del sample1.tst 
+	del sample2.tst
+	del sample3.tst
+
+.c.obj: 
+	$(CC) $(CFLAGS) -c $*.c -o $*.obj
+

Added: projects/external/bzip2-1.0.5/manual.html
==============================================================================
--- (empty file)
+++ projects/external/bzip2-1.0.5/manual.html	Fri Jun 13 19:13:07 2008
@@ -0,0 +1,2540 @@
+
+
+
+bzip2 and libbzip2, version 1.0.5
+
+
+
+
+
+
+

+bzip2 and libbzip2, version 1.0.5

+

A program and library for data compression

+
+

+Julian Seward +

+
http://www.bzip.org
+
+

Version 1.0.5 of 10 December 2007

+
+
+

This program, bzip2, the + associated library libbzip2, and + all documentation, are copyright ? 1996-2007 Julian Seward. + All rights reserved.

+

Redistribution and use in source and binary forms, with + or without modification, are permitted provided that the + following conditions are met:

+
    +
  • Redistributions of source code must retain the + above copyright notice, this list of conditions and the + following disclaimer.

  • +
  • The origin of this software must not be + misrepresented; you must not claim that you wrote the original + software. If you use this software in a product, an + acknowledgment in the product documentation would be + appreciated but is not required.

  • +
  • Altered source versions must be plainly marked + as such, and must not be misrepresented as being the original + software.

  • +
  • The name of the author may not be used to + endorse or promote products derived from this software without + specific prior written permission.

  • +
+

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE.

+

PATENTS: To the best of my knowledge, + bzip2 and + libbzip2 do not use any patented + algorithms. However, I do not have the resources to carry + out a patent search. Therefore I cannot give any guarantee of + the above statement. +

+
+
+
+
+ +
+

+1.?Introduction

+

bzip2 compresses files +using the Burrows-Wheeler block-sorting text compression +algorithm, and Huffman coding. Compression is generally +considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of +the PPM family of statistical compressors.

+

bzip2 is built on top of +libbzip2, a flexible library for +handling compressed data in the +bzip2 format. This manual +describes both how to use the program and how to work with the +library interface. Most of the manual is devoted to this +library, not the program, which is good news if your interest is +only in the program.

+
    +
  • How to use bzip2 describes how to use + bzip2; this is the only part + you need to read if you just want to know how to operate the + program.

  • +
  • Programming with libbzip2 describes the + programming interfaces in detail, and

  • +
  • Miscellanea records some + miscellaneous notes which I thought ought to be recorded + somewhere.

  • +
+
+
+

+2.?How to use bzip2

+ +

This chapter contains a copy of the +bzip2 man page, and nothing +else.

+
+

+2.1.?NAME

+
    +
  • bzip2, + bunzip2 - a block-sorting file + compressor, v1.0.4

  • +
  • bzcat - + decompresses files to stdout

  • +
  • bzip2recover - + recovers data from damaged bzip2 files

  • +
+
+
+

+2.2.?SYNOPSIS

+
    +
  • bzip2 [ + -cdfkqstvzVL123456789 ] [ filenames ... ]

  • +
  • bunzip2 [ + -fkvsVL ] [ filenames ... ]

  • +
  • bzcat [ -s ] [ + filenames ... ]

  • +
  • bzip2recover + filename

  • +
+
+
+

+2.3.?DESCRIPTION

+

bzip2 compresses files +using the Burrows-Wheeler block sorting text compression +algorithm, and Huffman coding. Compression is generally +considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of +the PPM family of statistical compressors.

+

The command-line options are deliberately very similar to +those of GNU gzip, but they are +not identical.

+

bzip2 expects a list of +file names to accompany the command-line flags. Each file is +replaced by a compressed version of itself, with the name +original_name.bz2. Each +compressed file has the same modification date, permissions, and, +when possible, ownership as the corresponding original, so that +these properties can be correctly restored at decompression time. +File name handling is naive in the sense that there is no +mechanism for preserving original file names, permissions, +ownerships or dates in filesystems which lack these concepts, or +have serious file name length restrictions, such as +MS-DOS.

+

bzip2 and +bunzip2 will by default not +overwrite existing files. If you want this to happen, specify +the -f flag.

+

If no file names are specified, +bzip2 compresses from standard +input to standard output. In this case, +bzip2 will decline to write +compressed output to a terminal, as this would be entirely +incomprehensible and therefore pointless.

+

bunzip2 (or +bzip2 -d) decompresses all +specified files. Files which were not created by +bzip2 will be detected and +ignored, and a warning issued. +bzip2 attempts to guess the +filename for the decompressed file from that of the compressed +file as follows:

+
    +
  • filename.bz2 + becomes + filename

  • +
  • filename.bz + becomes + filename

  • +
  • filename.tbz2 + becomes + filename.tar

  • +
  • filename.tbz + becomes + filename.tar

  • +
  • anyothername + becomes + anyothername.out

  • +
+

If the file does not end in one of the recognised endings, +.bz2, +.bz, +.tbz2 or +.tbz, +bzip2 complains that it cannot +guess the name of the original file, and uses the original name +with .out appended.

+

As with compression, supplying no filenames causes +decompression from standard input to standard output.

+

bunzip2 will correctly +decompress a file which is the concatenation of two or more +compressed files. The result is the concatenation of the +corresponding uncompressed files. Integrity testing +(-t) of concatenated compressed +files is also supported.

+

You can also compress or decompress files to the standard +output by giving the -c flag. +Multiple files may be compressed and decompressed like this. The +resulting outputs are fed sequentially to stdout. Compression of +multiple files in this manner generates a stream containing +multiple compressed file representations. Such a stream can be +decompressed correctly only by +bzip2 version 0.9.0 or later. +Earlier versions of bzip2 will +stop after decompressing the first file in the stream.

+

bzcat (or +bzip2 -dc) decompresses all +specified files to the standard output.

+

bzip2 will read arguments +from the environment variables +BZIP2 and +BZIP, in that order, and will +process them before any arguments read from the command line. +This gives a convenient way to supply default arguments.

+

Compression is always performed, even if the compressed +file is slightly larger than the original. Files of less than +about one hundred bytes tend to get larger, since the compression +mechanism has a constant overhead in the region of 50 bytes. +Random data (including the output of most file compressors) is +coded at about 8.05 bits per byte, giving an expansion of around +0.5%.

+

As a self-check for your protection, +bzip2 uses 32-bit CRCs to make +sure that the decompressed version of a file is identical to the +original. This guards against corruption of the compressed data, +and against undetected bugs in +bzip2 (hopefully very unlikely). +The chances of data corruption going undetected is microscopic, +about one chance in four billion for each file processed. Be +aware, though, that the check occurs upon decompression, so it +can only tell you that something is wrong. It can't help you +recover the original uncompressed data. You can use +bzip2recover to try to recover +data from damaged files.

+

Return values: 0 for a normal exit, 1 for environmental +problems (file not found, invalid flags, I/O errors, etc.), 2 +to indicate a corrupt compressed file, 3 for an internal +consistency error (eg, bug) which caused +bzip2 to panic.

+
+
+

+2.4.?OPTIONS

+
+
-c --stdout
+

Compress or decompress to standard + output.

+
-d --decompress
+

Force decompression. + bzip2, + bunzip2 and + bzcat are really the same + program, and the decision about what actions to take is done on + the basis of which name is used. This flag overrides that + mechanism, and forces bzip2 to decompress.

+
-z --compress
+

The complement to + -d: forces compression, + regardless of the invokation name.

+
-t --test
+

Check integrity of the specified file(s), but + don't decompress them. This really performs a trial + decompression and throws away the result.

+
-f --force
+
+

Force overwrite of output files. Normally, + bzip2 will not overwrite + existing output files. Also forces + bzip2 to break hard links to + files, which it otherwise wouldn't do.

+

bzip2 normally declines + to decompress files which don't have the correct magic header + bytes. If forced (-f), + however, it will pass such files through unmodified. This is + how GNU gzip behaves.

+
+
-k --keep
+

Keep (don't delete) input files during + compression or decompression.

+
-s --small
+
+

Reduce memory usage, for compression, + decompression and testing. Files are decompressed and tested + using a modified algorithm which only requires 2.5 bytes per + block byte. This means any file can be decompressed in 2300k + of memory, albeit at about half the normal speed.

+

During compression, -s + selects a block size of 200k, which limits memory use to around + the same figure, at the expense of your compression ratio. In + short, if your machine is low on memory (8 megabytes or less), + use -s for everything. See + MEMORY MANAGEMENT below.

+
+
-q --quiet
+

Suppress non-essential warning messages. + Messages pertaining to I/O errors and other critical events + will not be suppressed.

+
-v --verbose
+

Verbose mode -- show the compression ratio for + each file processed. Further + -v's increase the verbosity + level, spewing out lots of information which is primarily of + interest for diagnostic purposes.

+
-L --license -V --version
+

Display the software version, license terms and + conditions.

+
-1 (or + --fast) to + -9 (or + -best)
+

Set the block size to 100 k, 200 k ... 900 k + when compressing. Has no effect when decompressing. See MEMORY MANAGEMENT below. The + --fast and + --best aliases are primarily + for GNU gzip compatibility. + In particular, --fast doesn't + make things significantly faster. And + --best merely selects the + default behaviour.

+
--
+

Treats all subsequent arguments as file names, + even if they start with a dash. This is so you can handle + files with names beginning with a dash, for example: + bzip2 -- + -myfilename.

+
+--repetitive-fast, --repetitive-best +
+

These flags are redundant in versions 0.9.5 and + above. They provided some coarse control over the behaviour of + the sorting algorithm in earlier versions, which was sometimes + useful. 0.9.5 and above have an improved algorithm which + renders these flags irrelevant.

+
+
+
+

+2.5.?MEMORY MANAGEMENT

+

bzip2 compresses large +files in blocks. The block size affects both the compression +ratio achieved, and the amount of memory needed for compression +and decompression. The flags -1 +through -9 specify the block +size to be 100,000 bytes through 900,000 bytes (the default) +respectively. At decompression time, the block size used for +compression is read from the header of the compressed file, and +bunzip2 then allocates itself +just enough memory to decompress the file. Since block sizes are +stored in compressed files, it follows that the flags +-1 to +-9 are irrelevant to and so +ignored during decompression.

+

Compression and decompression requirements, in bytes, can be +estimated as:

+
Compression:   400k + ( 8 x block size )
+
+Decompression: 100k + ( 4 x block size ), or
+               100k + ( 2.5 x block size )
+

Larger block sizes give rapidly diminishing marginal +returns. Most of the compression comes from the first two or +three hundred k of block size, a fact worth bearing in mind when +using bzip2 on small machines. +It is also important to appreciate that the decompression memory +requirement is set at compression time by the choice of block +size.

+

For files compressed with the default 900k block size, +bunzip2 will require about 3700 +kbytes to decompress. To support decompression of any file on a +4 megabyte machine, bunzip2 has +an option to decompress using approximately half this amount of +memory, about 2300 kbytes. Decompression speed is also halved, +so you should use this option only where necessary. The relevant +flag is -s.

+

In general, try and use the largest block size memory +constraints allow, since that maximises the compression achieved. +Compression and decompression speed are virtually unaffected by +block size.

+

Another significant point applies to files which fit in a +single block -- that means most files you'd encounter using a +large block size. The amount of real memory touched is +proportional to the size of the file, since the file is smaller +than a block. For example, compressing a file 20,000 bytes long +with the flag -9 will cause the +compressor to allocate around 7600k of memory, but only touch +400k + 20000 * 8 = 560 kbytes of it. Similarly, the decompressor +will allocate 3700k but only touch 100k + 20000 * 4 = 180 +kbytes.

+

Here is a table which summarises the maximum memory usage +for different block sizes. Also recorded is the total compressed +size for 14 files of the Calgary Text Compression Corpus +totalling 3,141,622 bytes. This column gives some feel for how +compression varies with block size. These figures tend to +understate the advantage of larger block sizes for larger files, +since the Corpus is dominated by smaller files.

+
        Compress   Decompress   Decompress   Corpus
+Flag     usage      usage       -s usage     Size
+
+ -1      1200k       500k         350k      914704
+ -2      2000k       900k         600k      877703
+ -3      2800k      1300k         850k      860338
+ -4      3600k      1700k        1100k      846899
+ -5      4400k      2100k        1350k      845160
+ -6      5200k      2500k        1600k      838626
+ -7      6100k      2900k        1850k      834096
+ -8      6800k      3300k        2100k      828642
+ -9      7600k      3700k        2350k      828642
+
+
+

+2.6.?RECOVERING DATA FROM DAMAGED FILES

+

bzip2 compresses files in +blocks, usually 900kbytes long. Each block is handled +independently. If a media or transmission error causes a +multi-block .bz2 file to become +damaged, it may be possible to recover data from the undamaged +blocks in the file.

+

The compressed representation of each block is delimited by +a 48-bit pattern, which makes it possible to find the block +boundaries with reasonable certainty. Each block also carries +its own 32-bit CRC, so damaged blocks can be distinguished from +undamaged ones.

+

bzip2recover is a simple +program whose purpose is to search for blocks in +.bz2 files, and write each block +out into its own .bz2 file. You +can then use bzip2 -t to test +the integrity of the resulting files, and decompress those which +are undamaged.

+

bzip2recover takes a +single argument, the name of the damaged file, and writes a +number of files rec0001file.bz2, +rec0002file.bz2, etc, containing +the extracted blocks. The output filenames are designed so that +the use of wildcards in subsequent processing -- for example, +bzip2 -dc rec*file.bz2 > +recovered_data -- lists the files in the correct +order.

+

bzip2recover should be of +most use dealing with large .bz2 +files, as these will contain many blocks. It is clearly futile +to use it on damaged single-block files, since a damaged block +cannot be recovered. If you wish to minimise any potential data +loss through media or transmission errors, you might consider +compressing with a smaller block size.

+
+
+

+2.7.?PERFORMANCE NOTES

+

The sorting phase of compression gathers together similar +strings in the file. Because of this, files containing very long +runs of repeated symbols, like "aabaabaabaab ..." (repeated +several hundred times) may compress more slowly than normal. +Versions 0.9.5 and above fare much better than previous versions +in this respect. The ratio between worst-case and average-case +compression time is in the region of 10:1. For previous +versions, this figure was more like 100:1. You can use the +-vvvv option to monitor progress +in great detail, if you want.

+

Decompression speed is unaffected by these +phenomena.

+

bzip2 usually allocates +several megabytes of memory to operate in, and then charges all +over it in a fairly random fashion. This means that performance, +both for compressing and decompressing, is largely determined by +the speed at which your machine can service cache misses. +Because of this, small changes to the code to reduce the miss +rate have been observed to give disproportionately large +performance improvements. I imagine +bzip2 will perform best on +machines with very large caches.

+
+
+

+2.8.?CAVEATS

+

I/O error messages are not as helpful as they could be. +bzip2 tries hard to detect I/O +errors and exit cleanly, but the details of what the problem is +sometimes seem rather misleading.

+

This manual page pertains to version 1.0.5 of +bzip2. Compressed data created by +this version is entirely forwards and backwards compatible with the +previous public releases, versions 0.1pl2, 0.9.0 and 0.9.5, 1.0.0, +1.0.1, 1.0.2 and 1.0.3, but with the following exception: 0.9.0 and +above can correctly decompress multiple concatenated compressed files. +0.1pl2 cannot do this; it will stop after decompressing just the first +file in the stream.

+

bzip2recover versions +prior to 1.0.2 used 32-bit integers to represent bit positions in +compressed files, so it could not handle compressed files more +than 512 megabytes long. Versions 1.0.2 and above use 64-bit ints +on some platforms which support them (GNU supported targets, and +Windows). To establish whether or not +bzip2recover was built with such +a limitation, run it without arguments. In any event you can +build yourself an unlimited version if you can recompile it with +MaybeUInt64 set to be an +unsigned 64-bit integer.

+
+
+

+2.9.?AUTHOR

+

Julian Seward, +jseward at bzip.org

+

The ideas embodied in +bzip2 are due to (at least) the +following people: Michael Burrows and David Wheeler (for the +block sorting transformation), David Wheeler (again, for the +Huffman coder), Peter Fenwick (for the structured coding model in +the original bzip, and many +refinements), and Alistair Moffat, Radford Neal and Ian Witten +(for the arithmetic coder in the original +bzip). I am much indebted for +their help, support and advice. See the manual in the source +distribution for pointers to sources of documentation. Christian +von Roques encouraged me to look for faster sorting algorithms, +so as to speed up compression. Bela Lubkin encouraged me to +improve the worst-case compression performance. +Donna Robinson XMLised the documentation. +Many people sent +patches, helped with portability problems, lent machines, gave +advice and were generally helpful.

+
+
+
+

+3.? +Programming with libbzip2 +

+ +

This chapter describes the programming interface to +libbzip2.

+

For general background information, particularly about +memory use and performance aspects, you'd be well advised to read +How to use bzip2 as well.

+
+

+3.1.?Top-level structure

+

libbzip2 is a flexible +library for compressing and decompressing data in the +bzip2 data format. Although +packaged as a single entity, it helps to regard the library as +three separate parts: the low level interface, and the high level +interface, and some utility functions.

+

The structure of +libbzip2's interfaces is similar +to that of Jean-loup Gailly's and Mark Adler's excellent +zlib library.

+

All externally visible symbols have names beginning +BZ2_. This is new in version +1.0. The intention is to minimise pollution of the namespaces of +library clients.

+

To use any part of the library, you need to +#include <bzlib.h> +into your sources.

+
+

+3.1.1.?Low-level summary

+

This interface provides services for compressing and +decompressing data in memory. There's no provision for dealing +with files, streams or any other I/O mechanisms, just straight +memory-to-memory work. In fact, this part of the library can be +compiled without inclusion of +stdio.h, which may be helpful +for embedded applications.

+

The low-level part of the library has no global variables +and is therefore thread-safe.

+

Six routines make up the low level interface: +BZ2_bzCompressInit, +BZ2_bzCompress, and +BZ2_bzCompressEnd for +compression, and a corresponding trio +BZ2_bzDecompressInit, +BZ2_bzDecompress and +BZ2_bzDecompressEnd for +decompression. The *Init +functions allocate memory for compression/decompression and do +other initialisations, whilst the +*End functions close down +operations and release memory.

+

The real work is done by +BZ2_bzCompress and +BZ2_bzDecompress. These +compress and decompress data from a user-supplied input buffer to +a user-supplied output buffer. These buffers can be any size; +arbitrary quantities of data are handled by making repeated calls +to these functions. This is a flexible mechanism allowing a +consumer-pull style of activity, or producer-push, or a mixture +of both.

+
+
+

+3.1.2.?High-level summary

+

This interface provides some handy wrappers around the +low-level interface to facilitate reading and writing +bzip2 format files +(.bz2 files). The routines +provide hooks to facilitate reading files in which the +bzip2 data stream is embedded +within some larger-scale file structure, or where there are +multiple bzip2 data streams +concatenated end-to-end.

+

For reading files, +BZ2_bzReadOpen, +BZ2_bzRead, +BZ2_bzReadClose and +BZ2_bzReadGetUnused are +supplied. For writing files, +BZ2_bzWriteOpen, +BZ2_bzWrite and +BZ2_bzWriteFinish are +available.

+

As with the low-level library, no global variables are used +so the library is per se thread-safe. However, if I/O errors +occur whilst reading or writing the underlying compressed files, +you may have to consult errno to +determine the cause of the error. In that case, you'd need a C +library which correctly supports +errno in a multithreaded +environment.

+

To make the library a little simpler and more portable, +BZ2_bzReadOpen and +BZ2_bzWriteOpen require you to +pass them file handles (FILE*s) +which have previously been opened for reading or writing +respectively. That avoids portability problems associated with +file operations and file attributes, whilst not being much of an +imposition on the programmer.

+
+
+

+3.1.3.?Utility functions summary

+

For very simple needs, +BZ2_bzBuffToBuffCompress and +BZ2_bzBuffToBuffDecompress are +provided. These compress data in memory from one buffer to +another buffer in a single function call. You should assess +whether these functions fulfill your memory-to-memory +compression/decompression requirements before investing effort in +understanding the more general but more complex low-level +interface.

+

Yoshioka Tsuneo +(tsuneo at rr.iij4u.or.jp) has +contributed some functions to give better +zlib compatibility. These +functions are BZ2_bzopen, +BZ2_bzread, +BZ2_bzwrite, +BZ2_bzflush, +BZ2_bzclose, +BZ2_bzerror and +BZ2_bzlibVersion. You may find +these functions more convenient for simple file reading and +writing, than those in the high-level interface. These functions +are not (yet) officially part of the library, and are minimally +documented here. If they break, you get to keep all the pieces. +I hope to document them properly when time permits.

+

Yoshioka also contributed modifications to allow the +library to be built as a Windows DLL.

+
+
+
+

+3.2.?Error handling

+

The library is designed to recover cleanly in all +situations, including the worst-case situation of decompressing +random data. I'm not 100% sure that it can always do this, so +you might want to add a signal handler to catch segmentation +violations during decompression if you are feeling especially +paranoid. I would be interested in hearing more about the +robustness of the library to corrupted compressed data.

+

Version 1.0.3 more robust in this respect than any +previous version. Investigations with Valgrind (a tool for detecting +problems with memory management) indicate +that, at least for the few files I tested, all single-bit errors +in the decompressed data are caught properly, with no +segmentation faults, no uses of uninitialised data, no out of +range reads or writes, and no infinite looping in the decompressor. +So it's certainly pretty robust, although +I wouldn't claim it to be totally bombproof.

+

The file bzlib.h contains +all definitions needed to use the library. In particular, you +should definitely not include +bzlib_private.h.

+

In bzlib.h, the various +return values are defined. The following list is not intended as +an exhaustive description of the circumstances in which a given +value may be returned -- those descriptions are given later. +Rather, it is intended to convey the rough meaning of each return +value. The first five actions are normal and not intended to +denote an error situation.

+
+
BZ_OK
+

The requested action was completed + successfully.

+
BZ_RUN_OK, BZ_FLUSH_OK, + BZ_FINISH_OK
+

In + BZ2_bzCompress, the requested + flush/finish/nothing-special action was completed + successfully.

+
BZ_STREAM_END
+

Compression of data was completed, or the + logical stream end was detected during + decompression.

+
+

The following return values indicate an error of some +kind.

+
+
BZ_CONFIG_ERROR
+

Indicates that the library has been improperly + compiled on your platform -- a major configuration error. + Specifically, it means that + sizeof(char), + sizeof(short) and + sizeof(int) are not 1, 2 and + 4 respectively, as they should be. Note that the library + should still work properly on 64-bit platforms which follow + the LP64 programming model -- that is, where + sizeof(long) and + sizeof(void*) are 8. Under + LP64, sizeof(int) is still 4, + so libbzip2, which doesn't + use the long type, is + OK.

+
BZ_SEQUENCE_ERROR
+

When using the library, it is important to call + the functions in the correct sequence and with data structures + (buffers etc) in the correct states. + libbzip2 checks as much as it + can to ensure this is happening, and returns + BZ_SEQUENCE_ERROR if not. + Code which complies precisely with the function semantics, as + detailed below, should never receive this value; such an event + denotes buggy code which you should + investigate.

+
BZ_PARAM_ERROR
+

Returned when a parameter to a function call is + out of range or otherwise manifestly incorrect. As with + BZ_SEQUENCE_ERROR, this + denotes a bug in the client code. The distinction between + BZ_PARAM_ERROR and + BZ_SEQUENCE_ERROR is a bit + hazy, but still worth making.

+
BZ_MEM_ERROR
+

Returned when a request to allocate memory + failed. Note that the quantity of memory needed to decompress + a stream cannot be determined until the stream's header has + been read. So + BZ2_bzDecompress and + BZ2_bzRead may return + BZ_MEM_ERROR even though some + of the compressed data has been read. The same is not true + for compression; once + BZ2_bzCompressInit or + BZ2_bzWriteOpen have + successfully completed, + BZ_MEM_ERROR cannot + occur.

+
BZ_DATA_ERROR
+

Returned when a data integrity error is + detected during decompression. Most importantly, this means + when stored and computed CRCs for the data do not match. This + value is also returned upon detection of any other anomaly in + the compressed data.

+
BZ_DATA_ERROR_MAGIC
+

As a special case of + BZ_DATA_ERROR, it is + sometimes useful to know when the compressed stream does not + start with the correct magic bytes ('B' 'Z' + 'h').

+
BZ_IO_ERROR
+

Returned by + BZ2_bzRead and + BZ2_bzWrite when there is an + error reading or writing in the compressed file, and by + BZ2_bzReadOpen and + BZ2_bzWriteOpen for attempts + to use a file for which the error indicator (viz, + ferror(f)) is set. On + receipt of BZ_IO_ERROR, the + caller should consult errno + and/or perror to acquire + operating-system specific information about the + problem.

+
BZ_UNEXPECTED_EOF
+

Returned by + BZ2_bzRead when the + compressed file finishes before the logical end of stream is + detected.

+
BZ_OUTBUFF_FULL
+

Returned by + BZ2_bzBuffToBuffCompress and + BZ2_bzBuffToBuffDecompress to + indicate that the output data will not fit into the output + buffer provided.

+
+
+
+

+3.3.?Low-level interface

+
+

+3.3.1.?BZ2_bzCompressInit

+
typedef struct {
+  char *next_in;
+  unsigned int avail_in;
+  unsigned int total_in_lo32;
+  unsigned int total_in_hi32;
+
+  char *next_out;
+  unsigned int avail_out;
+  unsigned int total_out_lo32;
+  unsigned int total_out_hi32;
+
+  void *state;
+
+  void *(*bzalloc)(void *,int,int);
+  void (*bzfree)(void *,void *);
+  void *opaque;
+} bz_stream;
+
+int BZ2_bzCompressInit ( bz_stream *strm, 
+                         int blockSize100k, 
+                         int verbosity,
+                         int workFactor );
+

Prepares for compression. The +bz_stream structure holds all +data pertaining to the compression activity. A +bz_stream structure should be +allocated and initialised prior to the call. The fields of +bz_stream comprise the entirety +of the user-visible data. state +is a pointer to the private data structures required for +compression.

+

Custom memory allocators are supported, via fields +bzalloc, +bzfree, and +opaque. The value +opaque is passed to as the first +argument to all calls to bzalloc +and bzfree, but is otherwise +ignored by the library. The call bzalloc ( +opaque, n, m ) is expected to return a pointer +p to n * +m bytes of memory, and bzfree ( +opaque, p ) should free that memory.

+

If you don't want to use a custom memory allocator, set +bzalloc, +bzfree and +opaque to +NULL, and the library will then +use the standard malloc / +free routines.

+

Before calling +BZ2_bzCompressInit, fields +bzalloc, +bzfree and +opaque should be filled +appropriately, as just described. Upon return, the internal +state will have been allocated and initialised, and +total_in_lo32, +total_in_hi32, +total_out_lo32 and +total_out_hi32 will have been +set to zero. These four fields are used by the library to inform +the caller of the total amount of data passed into and out of the +library, respectively. You should not try to change them. As of +version 1.0, 64-bit counts are maintained, even on 32-bit +platforms, using the _hi32 +fields to store the upper 32 bits of the count. So, for example, +the total amount of data in is (total_in_hi32 +<< 32) + total_in_lo32.

+

Parameter blockSize100k +specifies the block size to be used for compression. It should +be a value between 1 and 9 inclusive, and the actual block size +used is 100000 x this figure. 9 gives the best compression but +takes most memory.

+

Parameter verbosity should +be set to a number between 0 and 4 inclusive. 0 is silent, and +greater numbers give increasingly verbose monitoring/debugging +output. If the library has been compiled with +-DBZ_NO_STDIO, no such output +will appear for any verbosity setting.

+

Parameter workFactor +controls how the compression phase behaves when presented with +worst case, highly repetitive, input data. If compression runs +into difficulties caused by repetitive data, the library switches +from the standard sorting algorithm to a fallback algorithm. The +fallback is slower than the standard algorithm by perhaps a +factor of three, but always behaves reasonably, no matter how bad +the input.

+

Lower values of workFactor +reduce the amount of effort the standard algorithm will expend +before resorting to the fallback. You should set this parameter +carefully; too low, and many inputs will be handled by the +fallback algorithm and so compress rather slowly, too high, and +your average-to-worst case compression times can become very +large. The default value of 30 gives reasonable behaviour over a +wide range of circumstances.

+

Allowable values range from 0 to 250 inclusive. 0 is a +special case, equivalent to using the default value of 30.

+

Note that the compressed output generated is the same +regardless of whether or not the fallback algorithm is +used.

+

Be aware also that this parameter may disappear entirely in +future versions of the library. In principle it should be +possible to devise a good way to automatically choose which +algorithm to use. Such a mechanism would render the parameter +obsolete.

+

Possible return values:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if strm is NULL 
+  or blockSize < 1 or blockSize > 9
+  or verbosity < 0 or verbosity > 4
+  or workFactor < 0 or workFactor > 250
+BZ_MEM_ERROR 
+  if not enough memory is available
+BZ_OK 
+  otherwise
+

Allowable next actions:

+
BZ2_bzCompress
+  if BZ_OK is returned
+  no specific action needed in case of error
+
+
+

+3.3.2.?BZ2_bzCompress

+
int BZ2_bzCompress ( bz_stream *strm, int action );
+

Provides more input and/or output buffer space for the +library. The caller maintains input and output buffers, and +calls BZ2_bzCompress to transfer +data between them.

+

Before each call to +BZ2_bzCompress, +next_in should point at the data +to be compressed, and avail_in +should indicate how many bytes the library may read. +BZ2_bzCompress updates +next_in, +avail_in and +total_in to reflect the number +of bytes it has read.

+

Similarly, next_out should +point to a buffer in which the compressed data is to be placed, +with avail_out indicating how +much output space is available. +BZ2_bzCompress updates +next_out, +avail_out and +total_out to reflect the number +of bytes output.

+

You may provide and remove as little or as much data as you +like on each call of +BZ2_bzCompress. In the limit, +it is acceptable to supply and remove data one byte at a time, +although this would be terribly inefficient. You should always +ensure that at least one byte of output space is available at +each call.

+

A second purpose of +BZ2_bzCompress is to request a +change of mode of the compressed stream.

+

Conceptually, a compressed stream can be in one of four +states: IDLE, RUNNING, FLUSHING and FINISHING. Before +initialisation +(BZ2_bzCompressInit) and after +termination (BZ2_bzCompressEnd), +a stream is regarded as IDLE.

+

Upon initialisation +(BZ2_bzCompressInit), the stream +is placed in the RUNNING state. Subsequent calls to +BZ2_bzCompress should pass +BZ_RUN as the requested action; +other actions are illegal and will result in +BZ_SEQUENCE_ERROR.

+

At some point, the calling program will have provided all +the input data it wants to. It will then want to finish up -- in +effect, asking the library to process any data it might have +buffered internally. In this state, +BZ2_bzCompress will no longer +attempt to read data from +next_in, but it will want to +write data to next_out. Because +the output buffer supplied by the user can be arbitrarily small, +the finishing-up operation cannot necessarily be done with a +single call of +BZ2_bzCompress.

+

Instead, the calling program passes +BZ_FINISH as an action to +BZ2_bzCompress. This changes +the stream's state to FINISHING. Any remaining input (ie, +next_in[0 .. avail_in-1]) is +compressed and transferred to the output buffer. To do this, +BZ2_bzCompress must be called +repeatedly until all the output has been consumed. At that +point, BZ2_bzCompress returns +BZ_STREAM_END, and the stream's +state is set back to IDLE. +BZ2_bzCompressEnd should then be +called.

+

Just to make sure the calling program does not cheat, the +library makes a note of avail_in +at the time of the first call to +BZ2_bzCompress which has +BZ_FINISH as an action (ie, at +the time the program has announced its intention to not supply +any more input). By comparing this value with that of +avail_in over subsequent calls +to BZ2_bzCompress, the library +can detect any attempts to slip in more data to compress. Any +calls for which this is detected will return +BZ_SEQUENCE_ERROR. This +indicates a programming mistake which should be corrected.

+

Instead of asking to finish, the calling program may ask +BZ2_bzCompress to take all the +remaining input, compress it and terminate the current +(Burrows-Wheeler) compression block. This could be useful for +error control purposes. The mechanism is analogous to that for +finishing: call BZ2_bzCompress +with an action of BZ_FLUSH, +remove output data, and persist with the +BZ_FLUSH action until the value +BZ_RUN is returned. As with +finishing, BZ2_bzCompress +detects any attempt to provide more input data once the flush has +begun.

+

Once the flush is complete, the stream returns to the +normal RUNNING state.

+

This all sounds pretty complex, but isn't really. Here's a +table which shows which actions are allowable in each state, what +action will be taken, what the next state is, and what the +non-error return values are. Note that you can't explicitly ask +what state the stream is in, but nor do you need to -- it can be +inferred from the values returned by +BZ2_bzCompress.

+
IDLE/any
+  Illegal.  IDLE state only exists after BZ2_bzCompressEnd or
+  before BZ2_bzCompressInit.
+  Return value = BZ_SEQUENCE_ERROR
+
+RUNNING/BZ_RUN
+  Compress from next_in to next_out as much as possible.
+  Next state = RUNNING
+  Return value = BZ_RUN_OK
+
+RUNNING/BZ_FLUSH
+  Remember current value of next_in. Compress from next_in
+  to next_out as much as possible, but do not accept any more input.
+  Next state = FLUSHING
+  Return value = BZ_FLUSH_OK
+
+RUNNING/BZ_FINISH
+  Remember current value of next_in. Compress from next_in
+  to next_out as much as possible, but do not accept any more input.
+  Next state = FINISHING
+  Return value = BZ_FINISH_OK
+
+FLUSHING/BZ_FLUSH
+  Compress from next_in to next_out as much as possible, 
+  but do not accept any more input.
+  If all the existing input has been used up and all compressed
+  output has been removed
+    Next state = RUNNING; Return value = BZ_RUN_OK
+  else
+    Next state = FLUSHING; Return value = BZ_FLUSH_OK
+
+FLUSHING/other     
+  Illegal.
+  Return value = BZ_SEQUENCE_ERROR
+
+FINISHING/BZ_FINISH
+  Compress from next_in to next_out as much as possible,
+  but to not accept any more input.  
+  If all the existing input has been used up and all compressed
+  output has been removed
+    Next state = IDLE; Return value = BZ_STREAM_END
+  else
+    Next state = FINISHING; Return value = BZ_FINISH_OK
+
+FINISHING/other
+  Illegal.
+  Return value = BZ_SEQUENCE_ERROR
+

That still looks complicated? Well, fair enough. The +usual sequence of calls for compressing a load of data is:

+
    +
  1. Get started with + BZ2_bzCompressInit.

  2. +
  3. Shovel data in and shlurp out its compressed form + using zero or more calls of + BZ2_bzCompress with action = + BZ_RUN.

  4. +
  5. Finish up. Repeatedly call + BZ2_bzCompress with action = + BZ_FINISH, copying out the + compressed output, until + BZ_STREAM_END is + returned.

  6. +
  7. Close up and go home. Call + BZ2_bzCompressEnd.

  8. +
+

If the data you want to compress fits into your input +buffer all at once, you can skip the calls of +BZ2_bzCompress ( ..., BZ_RUN ) +and just do the BZ2_bzCompress ( ..., BZ_FINISH +) calls.

+

All required memory is allocated by +BZ2_bzCompressInit. The +compression library can accept any data at all (obviously). So +you shouldn't get any error return values from the +BZ2_bzCompress calls. If you +do, they will be +BZ_SEQUENCE_ERROR, and indicate +a bug in your programming.

+

Trivial other possible return values:

+
BZ_PARAM_ERROR
+  if strm is NULL, or strm->s is NULL
+
+
+

+3.3.3.?BZ2_bzCompressEnd

+
int BZ2_bzCompressEnd ( bz_stream *strm );
+

Releases all memory associated with a compression +stream.

+

Possible return values:

+
BZ_PARAM_ERROR  if strm is NULL or strm->s is NULL
+BZ_OK           otherwise
+
+
+

+3.3.4.?BZ2_bzDecompressInit

+
int BZ2_bzDecompressInit ( bz_stream *strm, int verbosity, int small );
+

Prepares for decompression. As with +BZ2_bzCompressInit, a +bz_stream record should be +allocated and initialised before the call. Fields +bzalloc, +bzfree and +opaque should be set if a custom +memory allocator is required, or made +NULL for the normal +malloc / +free routines. Upon return, the +internal state will have been initialised, and +total_in and +total_out will be zero.

+

For the meaning of parameter +verbosity, see +BZ2_bzCompressInit.

+

If small is nonzero, the +library will use an alternative decompression algorithm which +uses less memory but at the cost of decompressing more slowly +(roughly speaking, half the speed, but the maximum memory +requirement drops to around 2300k). See How to use bzip2 +for more information on memory management.

+

Note that the amount of memory needed to decompress a +stream cannot be determined until the stream's header has been +read, so even if +BZ2_bzDecompressInit succeeds, a +subsequent BZ2_bzDecompress +could fail with +BZ_MEM_ERROR.

+

Possible return values:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if ( small != 0 && small != 1 )
+  or (verbosity <; 0 || verbosity > 4)
+BZ_MEM_ERROR
+  if insufficient memory is available
+

Allowable next actions:

+
BZ2_bzDecompress
+  if BZ_OK was returned
+  no specific action required in case of error
+
+
+

+3.3.5.?BZ2_bzDecompress

+
int BZ2_bzDecompress ( bz_stream *strm );
+

Provides more input and/out output buffer space for the +library. The caller maintains input and output buffers, and uses +BZ2_bzDecompress to transfer +data between them.

+

Before each call to +BZ2_bzDecompress, +next_in should point at the +compressed data, and avail_in +should indicate how many bytes the library may read. +BZ2_bzDecompress updates +next_in, +avail_in and +total_in to reflect the number +of bytes it has read.

+

Similarly, next_out should +point to a buffer in which the uncompressed output is to be +placed, with avail_out +indicating how much output space is available. +BZ2_bzCompress updates +next_out, +avail_out and +total_out to reflect the number +of bytes output.

+

You may provide and remove as little or as much data as you +like on each call of +BZ2_bzDecompress. In the limit, +it is acceptable to supply and remove data one byte at a time, +although this would be terribly inefficient. You should always +ensure that at least one byte of output space is available at +each call.

+

Use of BZ2_bzDecompress is +simpler than +BZ2_bzCompress.

+

You should provide input and remove output as described +above, and repeatedly call +BZ2_bzDecompress until +BZ_STREAM_END is returned. +Appearance of BZ_STREAM_END +denotes that BZ2_bzDecompress +has detected the logical end of the compressed stream. +BZ2_bzDecompress will not +produce BZ_STREAM_END until all +output data has been placed into the output buffer, so once +BZ_STREAM_END appears, you are +guaranteed to have available all the decompressed output, and +BZ2_bzDecompressEnd can safely +be called.

+

If case of an error return value, you should call +BZ2_bzDecompressEnd to clean up +and release memory.

+

Possible return values:

+
BZ_PARAM_ERROR
+  if strm is NULL or strm->s is NULL
+  or strm->avail_out < 1
+BZ_DATA_ERROR
+  if a data integrity error is detected in the compressed stream
+BZ_DATA_ERROR_MAGIC
+  if the compressed stream doesn't begin with the right magic bytes
+BZ_MEM_ERROR
+  if there wasn't enough memory available
+BZ_STREAM_END
+  if the logical end of the data stream was detected and all
+  output in has been consumed, eg s-->avail_out > 0
+BZ_OK
+  otherwise
+

Allowable next actions:

+
BZ2_bzDecompress
+  if BZ_OK was returned
+BZ2_bzDecompressEnd
+  otherwise
+
+
+

+3.3.6.?BZ2_bzDecompressEnd

+
int BZ2_bzDecompressEnd ( bz_stream *strm );
+

Releases all memory associated with a decompression +stream.

+

Possible return values:

+
BZ_PARAM_ERROR
+  if strm is NULL or strm->s is NULL
+BZ_OK
+  otherwise
+

Allowable next actions:

+
  None.
+
+
+
+

+3.4.?High-level interface

+

This interface provides functions for reading and writing +bzip2 format files. First, some +general points.

+
    +
  • All of the functions take an + int* first argument, + bzerror. After each call, + bzerror should be consulted + first to determine the outcome of the call. If + bzerror is + BZ_OK, the call completed + successfully, and only then should the return value of the + function (if any) be consulted. If + bzerror is + BZ_IO_ERROR, there was an + error reading/writing the underlying compressed file, and you + should then consult errno / + perror to determine the cause + of the difficulty. bzerror + may also be set to various other values; precise details are + given on a per-function basis below.

  • +
  • If bzerror indicates + an error (ie, anything except + BZ_OK and + BZ_STREAM_END), you should + immediately call + BZ2_bzReadClose (or + BZ2_bzWriteClose, depending on + whether you are attempting to read or to write) to free up all + resources associated with the stream. Once an error has been + indicated, behaviour of all calls except + BZ2_bzReadClose + (BZ2_bzWriteClose) is + undefined. The implication is that (1) + bzerror should be checked + after each call, and (2) if + bzerror indicates an error, + BZ2_bzReadClose + (BZ2_bzWriteClose) should then + be called to clean up.

  • +
  • The FILE* arguments + passed to BZ2_bzReadOpen / + BZ2_bzWriteOpen should be set + to binary mode. Most Unix systems will do this by default, but + other platforms, including Windows and Mac, will not. If you + omit this, you may encounter problems when moving code to new + platforms.

  • +
  • Memory allocation requests are handled by + malloc / + free. At present there is no + facility for user-defined memory allocators in the file I/O + functions (could easily be added, though).

  • +
+
+

+3.4.1.?BZ2_bzReadOpen

+
typedef void BZFILE;
+
+BZFILE *BZ2_bzReadOpen( int *bzerror, FILE *f, 
+                        int verbosity, int small,
+                        void *unused, int nUnused );
+

Prepare to read compressed data from file handle +f. +f should refer to a file which +has been opened for reading, and for which the error indicator +(ferror(f))is not set. If +small is 1, the library will try +to decompress using less memory, at the expense of speed.

+

For reasons explained below, +BZ2_bzRead will decompress the +nUnused bytes starting at +unused, before starting to read +from the file f. At most +BZ_MAX_UNUSED bytes may be +supplied like this. If this facility is not required, you should +pass NULL and +0 for +unused and +nUnused respectively.

+

For the meaning of parameters +small and +verbosity, see +BZ2_bzDecompressInit.

+

The amount of memory needed to decompress a file cannot be +determined until the file's header has been read. So it is +possible that BZ2_bzReadOpen +returns BZ_OK but a subsequent +call of BZ2_bzRead will return +BZ_MEM_ERROR.

+

Possible assignments to +bzerror:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if f is NULL
+  or small is neither 0 nor 1
+  or ( unused == NULL && nUnused != 0 )
+  or ( unused != NULL && !(0 <= nUnused <= BZ_MAX_UNUSED) )
+BZ_IO_ERROR
+  if ferror(f) is nonzero
+BZ_MEM_ERROR
+  if insufficient memory is available
+BZ_OK
+  otherwise.
+

Possible return values:

+
Pointer to an abstract BZFILE
+  if bzerror is BZ_OK
+NULL
+  otherwise
+

Allowable next actions:

+
BZ2_bzRead
+  if bzerror is BZ_OK
+BZ2_bzClose
+  otherwise
+
+
+

+3.4.2.?BZ2_bzRead

+
int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len );
+

Reads up to len +(uncompressed) bytes from the compressed file +b into the buffer +buf. If the read was +successful, bzerror is set to +BZ_OK and the number of bytes +read is returned. If the logical end-of-stream was detected, +bzerror will be set to +BZ_STREAM_END, and the number of +bytes read is returned. All other +bzerror values denote an +error.

+

BZ2_bzRead will supply +len bytes, unless the logical +stream end is detected or an error occurs. Because of this, it +is possible to detect the stream end by observing when the number +of bytes returned is less than the number requested. +Nevertheless, this is regarded as inadvisable; you should instead +check bzerror after every call +and watch out for +BZ_STREAM_END.

+

Internally, BZ2_bzRead +copies data from the compressed file in chunks of size +BZ_MAX_UNUSED bytes before +decompressing it. If the file contains more bytes than strictly +needed to reach the logical end-of-stream, +BZ2_bzRead will almost certainly +read some of the trailing data before signalling +BZ_SEQUENCE_END. To collect the +read but unused data once +BZ_SEQUENCE_END has appeared, +call BZ2_bzReadGetUnused +immediately before +BZ2_bzReadClose.

+

Possible assignments to +bzerror:

+
BZ_PARAM_ERROR
+  if b is NULL or buf is NULL or len < 0
+BZ_SEQUENCE_ERROR
+  if b was opened with BZ2_bzWriteOpen
+BZ_IO_ERROR
+  if there is an error reading from the compressed file
+BZ_UNEXPECTED_EOF
+  if the compressed file ended before 
+  the logical end-of-stream was detected
+BZ_DATA_ERROR
+  if a data integrity error was detected in the compressed stream
+BZ_DATA_ERROR_MAGIC
+  if the stream does not begin with the requisite header bytes 
+  (ie, is not a bzip2 data file).  This is really 
+  a special case of BZ_DATA_ERROR.
+BZ_MEM_ERROR
+  if insufficient memory was available
+BZ_STREAM_END
+  if the logical end of stream was detected.
+BZ_OK
+  otherwise.
+

Possible return values:

+
number of bytes read
+  if bzerror is BZ_OK or BZ_STREAM_END
+undefined
+  otherwise
+

Allowable next actions:

+
collect data from buf, then BZ2_bzRead or BZ2_bzReadClose
+  if bzerror is BZ_OK
+collect data from buf, then BZ2_bzReadClose or BZ2_bzReadGetUnused
+  if bzerror is BZ_SEQUENCE_END
+BZ2_bzReadClose
+  otherwise
+
+
+

+3.4.3.?BZ2_bzReadGetUnused

+
void BZ2_bzReadGetUnused( int* bzerror, BZFILE *b, 
+                          void** unused, int* nUnused );
+

Returns data which was read from the compressed file but +was not needed to get to the logical end-of-stream. +*unused is set to the address of +the data, and *nUnused to the +number of bytes. *nUnused will +be set to a value between 0 and +BZ_MAX_UNUSED inclusive.

+

This function may only be called once +BZ2_bzRead has signalled +BZ_STREAM_END but before +BZ2_bzReadClose.

+

Possible assignments to +bzerror:

+
BZ_PARAM_ERROR
+  if b is NULL
+  or unused is NULL or nUnused is NULL
+BZ_SEQUENCE_ERROR
+  if BZ_STREAM_END has not been signalled
+  or if b was opened with BZ2_bzWriteOpen
+BZ_OK
+  otherwise
+

Allowable next actions:

+
BZ2_bzReadClose
+
+
+

+3.4.4.?BZ2_bzReadClose

+
void BZ2_bzReadClose ( int *bzerror, BZFILE *b );
+

Releases all memory pertaining to the compressed file +b. +BZ2_bzReadClose does not call +fclose on the underlying file +handle, so you should do that yourself if appropriate. +BZ2_bzReadClose should be called +to clean up after all error situations.

+

Possible assignments to +bzerror:

+
BZ_SEQUENCE_ERROR
+  if b was opened with BZ2_bzOpenWrite
+BZ_OK
+  otherwise
+

Allowable next actions:

+
none
+
+
+

+3.4.5.?BZ2_bzWriteOpen

+
BZFILE *BZ2_bzWriteOpen( int *bzerror, FILE *f, 
+                         int blockSize100k, int verbosity,
+                         int workFactor );
+

Prepare to write compressed data to file handle +f. +f should refer to a file which +has been opened for writing, and for which the error indicator +(ferror(f))is not set.

+

For the meaning of parameters +blockSize100k, +verbosity and +workFactor, see +BZ2_bzCompressInit.

+

All required memory is allocated at this stage, so if the +call completes successfully, +BZ_MEM_ERROR cannot be signalled +by a subsequent call to +BZ2_bzWrite.

+

Possible assignments to +bzerror:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if f is NULL
+  or blockSize100k < 1 or blockSize100k > 9
+BZ_IO_ERROR
+  if ferror(f) is nonzero
+BZ_MEM_ERROR
+  if insufficient memory is available
+BZ_OK
+  otherwise
+

Possible return values:

+
Pointer to an abstract BZFILE
+  if bzerror is BZ_OK
+NULL
+  otherwise
+

Allowable next actions:

+
BZ2_bzWrite
+  if bzerror is BZ_OK
+  (you could go directly to BZ2_bzWriteClose, but this would be pretty pointless)
+BZ2_bzWriteClose
+  otherwise
+
+
+

+3.4.6.?BZ2_bzWrite

+
void BZ2_bzWrite ( int *bzerror, BZFILE *b, void *buf, int len );
+

Absorbs len bytes from the +buffer buf, eventually to be +compressed and written to the file.

+

Possible assignments to +bzerror:

+
BZ_PARAM_ERROR
+  if b is NULL or buf is NULL or len < 0
+BZ_SEQUENCE_ERROR
+  if b was opened with BZ2_bzReadOpen
+BZ_IO_ERROR
+  if there is an error writing the compressed file.
+BZ_OK
+  otherwise
+
+
+

+3.4.7.?BZ2_bzWriteClose

+
void BZ2_bzWriteClose( int *bzerror, BZFILE* f,
+                       int abandon,
+                       unsigned int* nbytes_in,
+                       unsigned int* nbytes_out );
+
+void BZ2_bzWriteClose64( int *bzerror, BZFILE* f,
+                         int abandon,
+                         unsigned int* nbytes_in_lo32,
+                         unsigned int* nbytes_in_hi32,
+                         unsigned int* nbytes_out_lo32,
+                         unsigned int* nbytes_out_hi32 );
+

Compresses and flushes to the compressed file all data so +far supplied by BZ2_bzWrite. +The logical end-of-stream markers are also written, so subsequent +calls to BZ2_bzWrite are +illegal. All memory associated with the compressed file +b is released. +fflush is called on the +compressed file, but it is not +fclose'd.

+

If BZ2_bzWriteClose is +called to clean up after an error, the only action is to release +the memory. The library records the error codes issued by +previous calls, so this situation will be detected automatically. +There is no attempt to complete the compression operation, nor to +fflush the compressed file. You +can force this behaviour to happen even in the case of no error, +by passing a nonzero value to +abandon.

+

If nbytes_in is non-null, +*nbytes_in will be set to be the +total volume of uncompressed data handled. Similarly, +nbytes_out will be set to the +total volume of compressed data written. For compatibility with +older versions of the library, +BZ2_bzWriteClose only yields the +lower 32 bits of these counts. Use +BZ2_bzWriteClose64 if you want +the full 64 bit counts. These two functions are otherwise +absolutely identical.

+

Possible assignments to +bzerror:

+
BZ_SEQUENCE_ERROR
+  if b was opened with BZ2_bzReadOpen
+BZ_IO_ERROR
+  if there is an error writing the compressed file
+BZ_OK
+  otherwise
+
+
+

+3.4.8.?Handling embedded compressed data streams

+

The high-level library facilitates use of +bzip2 data streams which form +some part of a surrounding, larger data stream.

+
    +
  • For writing, the library takes an open file handle, + writes compressed data to it, + fflushes it but does not + fclose it. The calling + application can write its own data before and after the + compressed data stream, using that same file handle.

  • +
  • Reading is more complex, and the facilities are not as + general as they could be since generality is hard to reconcile + with efficiency. BZ2_bzRead + reads from the compressed file in blocks of size + BZ_MAX_UNUSED bytes, and in + doing so probably will overshoot the logical end of compressed + stream. To recover this data once decompression has ended, + call BZ2_bzReadGetUnused after + the last call of BZ2_bzRead + (the one returning + BZ_STREAM_END) but before + calling + BZ2_bzReadClose.

  • +
+

This mechanism makes it easy to decompress multiple +bzip2 streams placed end-to-end. +As the end of one stream, when +BZ2_bzRead returns +BZ_STREAM_END, call +BZ2_bzReadGetUnused to collect +the unused data (copy it into your own buffer somewhere). That +data forms the start of the next compressed stream. To start +uncompressing that next stream, call +BZ2_bzReadOpen again, feeding in +the unused data via the unused / +nUnused parameters. Keep doing +this until BZ_STREAM_END return +coincides with the physical end of file +(feof(f)). In this situation +BZ2_bzReadGetUnused will of +course return no data.

+

This should give some feel for how the high-level interface +can be used. If you require extra flexibility, you'll have to +bite the bullet and get to grips with the low-level +interface.

+
+
+

+3.4.9.?Standard file-reading/writing code

+

Here's how you'd write data to a compressed file:

+
FILE*   f;
+BZFILE* b;
+int     nBuf;
+char    buf[ /* whatever size you like */ ];
+int     bzerror;
+int     nWritten;
+
+f = fopen ( "myfile.bz2", "w" );
+if ( !f ) {
+ /* handle error */
+}
+b = BZ2_bzWriteOpen( &bzerror, f, 9 );
+if (bzerror != BZ_OK) {
+ BZ2_bzWriteClose ( b );
+ /* handle error */
+}
+
+while ( /* condition */ ) {
+ /* get data to write into buf, and set nBuf appropriately */
+ nWritten = BZ2_bzWrite ( &bzerror, b, buf, nBuf );
+ if (bzerror == BZ_IO_ERROR) { 
+   BZ2_bzWriteClose ( &bzerror, b );
+   /* handle error */
+ }
+}
+
+BZ2_bzWriteClose( &bzerror, b );
+if (bzerror == BZ_IO_ERROR) {
+ /* handle error */
+}
+

And to read from a compressed file:

+
FILE*   f;
+BZFILE* b;
+int     nBuf;
+char    buf[ /* whatever size you like */ ];
+int     bzerror;
+int     nWritten;
+
+f = fopen ( "myfile.bz2", "r" );
+if ( !f ) {
+  /* handle error */
+}
+b = BZ2_bzReadOpen ( &bzerror, f, 0, NULL, 0 );
+if ( bzerror != BZ_OK ) {
+  BZ2_bzReadClose ( &bzerror, b );
+  /* handle error */
+}
+
+bzerror = BZ_OK;
+while ( bzerror == BZ_OK && /* arbitrary other conditions */) {
+  nBuf = BZ2_bzRead ( &bzerror, b, buf, /* size of buf */ );
+  if ( bzerror == BZ_OK ) {
+    /* do something with buf[0 .. nBuf-1] */
+  }
+}
+if ( bzerror != BZ_STREAM_END ) {
+   BZ2_bzReadClose ( &bzerror, b );
+   /* handle error */
+} else {
+   BZ2_bzReadClose ( &bzerror, b );
+}
+
+
+
+

+3.5.?Utility functions

+
+

+3.5.1.?BZ2_bzBuffToBuffCompress

+
int BZ2_bzBuffToBuffCompress( char*         dest,
+                              unsigned int* destLen,
+                              char*         source,
+                              unsigned int  sourceLen,
+                              int           blockSize100k,
+                              int           verbosity,
+                              int           workFactor );
+

Attempts to compress the data in source[0 +.. sourceLen-1] into the destination buffer, +dest[0 .. *destLen-1]. If the +destination buffer is big enough, +*destLen is set to the size of +the compressed data, and BZ_OK +is returned. If the compressed data won't fit, +*destLen is unchanged, and +BZ_OUTBUFF_FULL is +returned.

+

Compression in this manner is a one-shot event, done with a +single call to this function. The resulting compressed data is a +complete bzip2 format data +stream. There is no mechanism for making additional calls to +provide extra input data. If you want that kind of mechanism, +use the low-level interface.

+

For the meaning of parameters +blockSize100k, +verbosity and +workFactor, see +BZ2_bzCompressInit.

+

To guarantee that the compressed data will fit in its +buffer, allocate an output buffer of size 1% larger than the +uncompressed data, plus six hundred extra bytes.

+

BZ2_bzBuffToBuffDecompress +will not write data at or beyond +dest[*destLen], even in case of +buffer overflow.

+

Possible return values:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if dest is NULL or destLen is NULL
+  or blockSize100k < 1 or blockSize100k > 9
+  or verbosity < 0 or verbosity > 4
+  or workFactor < 0 or workFactor > 250
+BZ_MEM_ERROR
+  if insufficient memory is available 
+BZ_OUTBUFF_FULL
+  if the size of the compressed data exceeds *destLen
+BZ_OK
+  otherwise
+
+
+

+3.5.2.?BZ2_bzBuffToBuffDecompress

+
int BZ2_bzBuffToBuffDecompress( char*         dest,
+                                unsigned int* destLen,
+                                char*         source,
+                                unsigned int  sourceLen,
+                                int           small,
+                                int           verbosity );
+

Attempts to decompress the data in source[0 +.. sourceLen-1] into the destination buffer, +dest[0 .. *destLen-1]. If the +destination buffer is big enough, +*destLen is set to the size of +the uncompressed data, and BZ_OK +is returned. If the compressed data won't fit, +*destLen is unchanged, and +BZ_OUTBUFF_FULL is +returned.

+

source is assumed to hold +a complete bzip2 format data +stream. +BZ2_bzBuffToBuffDecompress tries +to decompress the entirety of the stream into the output +buffer.

+

For the meaning of parameters +small and +verbosity, see +BZ2_bzDecompressInit.

+

Because the compression ratio of the compressed data cannot +be known in advance, there is no easy way to guarantee that the +output buffer will be big enough. You may of course make +arrangements in your code to record the size of the uncompressed +data, but such a mechanism is beyond the scope of this +library.

+

BZ2_bzBuffToBuffDecompress +will not write data at or beyond +dest[*destLen], even in case of +buffer overflow.

+

Possible return values:

+
BZ_CONFIG_ERROR
+  if the library has been mis-compiled
+BZ_PARAM_ERROR
+  if dest is NULL or destLen is NULL
+  or small != 0 && small != 1
+  or verbosity < 0 or verbosity > 4
+BZ_MEM_ERROR
+  if insufficient memory is available 
+BZ_OUTBUFF_FULL
+  if the size of the compressed data exceeds *destLen
+BZ_DATA_ERROR
+  if a data integrity error was detected in the compressed data
+BZ_DATA_ERROR_MAGIC
+  if the compressed data doesn't begin with the right magic bytes
+BZ_UNEXPECTED_EOF
+  if the compressed data ends unexpectedly
+BZ_OK
+  otherwise
+
+
+
+

+3.6.?zlib compatibility functions

+

Yoshioka Tsuneo has contributed some functions to give +better zlib compatibility. +These functions are BZ2_bzopen, +BZ2_bzread, +BZ2_bzwrite, +BZ2_bzflush, +BZ2_bzclose, +BZ2_bzerror and +BZ2_bzlibVersion. These +functions are not (yet) officially part of the library. If they +break, you get to keep all the pieces. Nevertheless, I think +they work ok.

+
typedef void BZFILE;
+
+const char * BZ2_bzlibVersion ( void );
+

Returns a string indicating the library version.

+
BZFILE * BZ2_bzopen  ( const char *path, const char *mode );
+BZFILE * BZ2_bzdopen ( int        fd,    const char *mode );
+

Opens a .bz2 file for +reading or writing, using either its name or a pre-existing file +descriptor. Analogous to fopen +and fdopen.

+
int BZ2_bzread  ( BZFILE* b, void* buf, int len );
+int BZ2_bzwrite ( BZFILE* b, void* buf, int len );
+

Reads/writes data from/to a previously opened +BZFILE. Analogous to +fread and +fwrite.

+
int  BZ2_bzflush ( BZFILE* b );
+void BZ2_bzclose ( BZFILE* b );
+

Flushes/closes a BZFILE. +BZ2_bzflush doesn't actually do +anything. Analogous to fflush +and fclose.

+
const char * BZ2_bzerror ( BZFILE *b, int *errnum )
+

Returns a string describing the more recent error status of +b, and also sets +*errnum to its numerical +value.

+
+
+

+3.7.?Using the library in a stdio-free environment

+
+

+3.7.1.?Getting rid of stdio

+

In a deeply embedded application, you might want to use +just the memory-to-memory functions. You can do this +conveniently by compiling the library with preprocessor symbol +BZ_NO_STDIO defined. Doing this +gives you a library containing only the following eight +functions:

+

BZ2_bzCompressInit, +BZ2_bzCompress, +BZ2_bzCompressEnd +BZ2_bzDecompressInit, +BZ2_bzDecompress, +BZ2_bzDecompressEnd +BZ2_bzBuffToBuffCompress, +BZ2_bzBuffToBuffDecompress

+

When compiled like this, all functions will ignore +verbosity settings.

+
+
+

+3.7.2.?Critical error handling

+

libbzip2 contains a number +of internal assertion checks which should, needless to say, never +be activated. Nevertheless, if an assertion should fail, +behaviour depends on whether or not the library was compiled with +BZ_NO_STDIO set.

+

For a normal compile, an assertion failure yields the +message:

+
+

bzip2/libbzip2: internal error number N.

+

This is a bug in bzip2/libbzip2, 1.0.5 of 10 December 2007. +Please report it to me at: jseward at bzip.org. If this happened +when you were using some program which uses libbzip2 as a +component, you should also report this bug to the author(s) +of that program. Please make an effort to report this bug; +timely and accurate bug reports eventually lead to higher +quality software. Thanks. Julian Seward, 10 December 2007. +

+
+

where N is some error code +number. If N == 1007, it also +prints some extra text advising the reader that unreliable memory +is often associated with internal error 1007. (This is a +frequently-observed-phenomenon with versions 1.0.0/1.0.1).

+

exit(3) is then +called.

+

For a stdio-free library, +assertion failures result in a call to a function declared +as:

+
extern void bz_internal_error ( int errcode );
+

The relevant code is passed as a parameter. You should +supply such a function.

+

In either case, once an assertion failure has occurred, any +bz_stream records involved can +be regarded as invalid. You should not attempt to resume normal +operation with them.

+

You may, of course, change critical error handling to suit +your needs. As I said above, critical errors indicate bugs in +the library and should not occur. All "normal" error situations +are indicated via error return codes from functions, and can be +recovered from.

+
+
+
+

+3.8.?Making a Windows DLL

+

Everything related to Windows has been contributed by +Yoshioka Tsuneo +(tsuneo at rr.iij4u.or.jp), so +you should send your queries to him (but perhaps Cc: me, +jseward at bzip.org).

+

My vague understanding of what to do is: using Visual C++ +5.0, open the project file +libbz2.dsp, and build. That's +all.

+

If you can't open the project file for some reason, make a +new one, naming these files: +blocksort.c, +bzlib.c, +compress.c, +crctable.c, +decompress.c, +huffman.c, +randtable.c and +libbz2.def. You will also need +to name the header files bzlib.h +and bzlib_private.h.

+

If you don't use VC++, you may need to define the +proprocessor symbol +_WIN32.

+

Finally, dlltest.c is a +sample program using the DLL. It has a project file, +dlltest.dsp.

+

If you just want a makefile for Visual C, have a look at +makefile.msc.

+

Be aware that if you compile +bzip2 itself on Win32, you must +set BZ_UNIX to 0 and +BZ_LCCWIN32 to 1, in the file +bzip2.c, before compiling. +Otherwise the resulting binary won't work correctly.

+

I haven't tried any of this stuff myself, but it all looks +plausible.

+
+
+
+

+4.?Miscellanea

+ +

These are just some random thoughts of mine. Your mileage +may vary.

+
+

+4.1.?Limitations of the compressed file format

+

bzip2-1.0.X, +0.9.5 and +0.9.0 use exactly the same file +format as the original version, +bzip2-0.1. This decision was +made in the interests of stability. Creating yet another +incompatible compressed file format would create further +confusion and disruption for users.

+

Nevertheless, this is not a painless decision. Development +work since the release of +bzip2-0.1 in August 1997 has +shown complexities in the file format which slow down +decompression and, in retrospect, are unnecessary. These +are:

+
    +
  • The run-length encoder, which is the first of the + compression transformations, is entirely irrelevant. The + original purpose was to protect the sorting algorithm from the + very worst case input: a string of repeated symbols. But + algorithm steps Q6a and Q6b in the original Burrows-Wheeler + technical report (SRC-124) show how repeats can be handled + without difficulty in block sorting.

  • +
  • +

    The randomisation mechanism doesn't really need to be + there. Udi Manber and Gene Myers published a suffix array + construction algorithm a few years back, which can be employed + to sort any block, no matter how repetitive, in O(N log N) + time. Subsequent work by Kunihiko Sadakane has produced a + derivative O(N (log N)^2) algorithm which usually outperforms + the Manber-Myers algorithm.

    +

    I could have changed to Sadakane's algorithm, but I find + it to be slower than bzip2's + existing algorithm for most inputs, and the randomisation + mechanism protects adequately against bad cases. I didn't + think it was a good tradeoff to make. Partly this is due to + the fact that I was not flooded with email complaints about + bzip2-0.1's performance on + repetitive data, so perhaps it isn't a problem for real + inputs.

    +

    Probably the best long-term solution, and the one I have + incorporated into 0.9.5 and above, is to use the existing + sorting algorithm initially, and fall back to a O(N (log N)^2) + algorithm if the standard algorithm gets into + difficulties.

    +
  • +
  • The compressed file format was never designed to be + handled by a library, and I have had to jump though some hoops + to produce an efficient implementation of decompression. It's + a bit hairy. Try passing + decompress.c through the C + preprocessor and you'll see what I mean. Much of this + complexity could have been avoided if the compressed size of + each block of data was recorded in the data stream.

  • +
  • An Adler-32 checksum, rather than a CRC32 checksum, + would be faster to compute.

  • +
+

It would be fair to say that the +bzip2 format was frozen before I +properly and fully understood the performance consequences of +doing so.

+

Improvements which I was able to incorporate into 0.9.0, +despite using the same file format, are:

+
    +
  • Single array implementation of the inverse BWT. This + significantly speeds up decompression, presumably because it + reduces the number of cache misses.

  • +
  • Faster inverse MTF transform for large MTF values. + The new implementation is based on the notion of sliding blocks + of values.

  • +
  • bzip2-0.9.0 now reads + and writes files with fread + and fwrite; version 0.1 used + putc and + getc. Duh! Well, you live + and learn.

  • +
+

Further ahead, it would be nice to be able to do random +access into files. This will require some careful design of +compressed file formats.

+
+
+

+4.2.?Portability issues

+

After some consideration, I have decided not to use GNU +autoconf to configure 0.9.5 or +1.0.

+

autoconf, admirable and +wonderful though it is, mainly assists with portability problems +between Unix-like platforms. But +bzip2 doesn't have much in the +way of portability problems on Unix; most of the difficulties +appear when porting to the Mac, or to Microsoft's operating +systems. autoconf doesn't help +in those cases, and brings in a whole load of new +complexity.

+

Most people should be able to compile the library and +program under Unix straight out-of-the-box, so to speak, +especially if you have a version of GNU C available.

+

There are a couple of +__inline__ directives in the +code. GNU C (gcc) should be +able to handle them. If you're not using GNU C, your C compiler +shouldn't see them at all. If your compiler does, for some +reason, see them and doesn't like them, just +#define +__inline__ to be +/* */. One easy way to do this +is to compile with the flag +-D__inline__=, which should be +understood by most Unix compilers.

+

If you still have difficulties, try compiling with the +macro BZ_STRICT_ANSI defined. +This should enable you to build the library in a strictly ANSI +compliant environment. Building the program itself like this is +dangerous and not supported, since you remove +bzip2's checks against +compressing directories, symbolic links, devices, and other +not-really-a-file entities. This could cause filesystem +corruption!

+

One other thing: if you create a +bzip2 binary for public distribution, +please consider linking it statically (gcc +-static). This avoids all sorts of library-version +issues that others may encounter later on.

+

If you build bzip2 on +Win32, you must set BZ_UNIX to 0 +and BZ_LCCWIN32 to 1, in the +file bzip2.c, before compiling. +Otherwise the resulting binary won't work correctly.

+
+
+

+4.3.?Reporting bugs

+

I tried pretty hard to make sure +bzip2 is bug free, both by +design and by testing. Hopefully you'll never need to read this +section for real.

+

Nevertheless, if bzip2 dies +with a segmentation fault, a bus error or an internal assertion +failure, it will ask you to email me a bug report. Experience from +years of feedback of bzip2 users indicates that almost all these +problems can be traced to either compiler bugs or hardware +problems.

+
    +
  • +

    Recompile the program with no optimisation, and + see if it works. And/or try a different compiler. I heard all + sorts of stories about various flavours of GNU C (and other + compilers) generating bad code for + bzip2, and I've run across two + such examples myself.

    +

    2.7.X versions of GNU C are known to generate bad code + from time to time, at high optimisation levels. If you get + problems, try using the flags + -O2 + -fomit-frame-pointer + -fno-strength-reduce. You + should specifically not use + -funroll-loops.

    +

    You may notice that the Makefile runs six tests as part + of the build process. If the program passes all of these, it's + a pretty good (but not 100%) indication that the compiler has + done its job correctly.

    +
  • +
  • +

    If bzip2 + crashes randomly, and the crashes are not repeatable, you may + have a flaky memory subsystem. + bzip2 really hammers your + memory hierarchy, and if it's a bit marginal, you may get these + problems. Ditto if your disk or I/O subsystem is slowly + failing. Yup, this really does happen.

    +

    Try using a different machine of the same type, and see + if you can repeat the problem.

    +
  • +
  • This isn't really a bug, but ... If + bzip2 tells you your file is + corrupted on decompression, and you obtained the file via FTP, + there is a possibility that you forgot to tell FTP to do a + binary mode transfer. That absolutely will cause the file to + be non-decompressible. You'll have to transfer it + again.

  • +
+

If you've incorporated +libbzip2 into your own program +and are getting problems, please, please, please, check that the +parameters you are passing in calls to the library, are correct, +and in accordance with what the documentation says is allowable. +I have tried to make the library robust against such problems, +but I'm sure I haven't succeeded.

+

Finally, if the above comments don't help, you'll have to +send me a bug report. Now, it's just amazing how many people +will send me a bug report saying something like:

+
bzip2 crashed with segmentation fault on my machine
+

and absolutely nothing else. Needless to say, a such a +report is totally, utterly, completely and +comprehensively 100% useless; a waste of your time, my time, and +net bandwidth. With no details at all, there's no way +I can possibly begin to figure out what the problem is.

+

The rules of the game are: facts, facts, facts. Don't omit +them because "oh, they won't be relevant". At the bare +minimum:

+
Machine type.  Operating system version.  
+Exact version of bzip2 (do bzip2 -V).  
+Exact version of the compiler used.  
+Flags passed to the compiler.
+

However, the most important single thing that will help me +is the file that you were trying to compress or decompress at the +time the problem happened. Without that, my ability to do +anything more than speculate about the cause, is limited.

+
+
+

+4.4.?Did you get the right package?

+

bzip2 is a resource hog. +It soaks up large amounts of CPU cycles and memory. Also, it +gives very large latencies. In the worst case, you can feed many +megabytes of uncompressed data into the library before getting +any compressed output, so this probably rules out applications +requiring interactive behaviour.

+

These aren't faults of my implementation, I hope, but more +an intrinsic property of the Burrows-Wheeler transform +(unfortunately). Maybe this isn't what you want.

+

If you want a compressor and/or library which is faster, +uses less memory but gets pretty good compression, and has +minimal latency, consider Jean-loup Gailly's and Mark Adler's +work, zlib-1.2.1 and +gzip-1.2.4. Look for them at +http://www.zlib.org and +http://www.gzip.org +respectively.

+

For something faster and lighter still, you might try Markus F +X J Oberhumer's LZO real-time +compression/decompression library, at +http://www.oberhumer.com/opensource.

+
+
+

+4.5.?Further Reading

+

bzip2 is not research +work, in the sense that it doesn't present any new ideas. +Rather, it's an engineering exercise based on existing +ideas.

+

Four documents describe essentially all the ideas behind +bzip2:

+

Michael?Burrows?and?D.?J.?Wheeler:
+??"A?block-sorting?lossless?data?compression?algorithm"
+???10th?May?1994.?
+???Digital?SRC?Research?Report?124.
+???ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz
+???If?you?have?trouble?finding?it,?try?searching?at?the
+???New?Zealand?Digital?Library,?http://www.nzdl.org.
+
+Daniel?S.?Hirschberg?and?Debra?A.?LeLewer
+??"Efficient?Decoding?of?Prefix?Codes"
+???Communications?of?the?ACM,?April?1990,?Vol?33,?Number?4.
+???You?might?be?able?to?get?an?electronic?copy?of?this
+???from?the?ACM?Digital?Library.
+
+David?J.?Wheeler
+???Program?bred3.c?and?accompanying?document?bred3.ps.
+???This?contains?the?idea?behind?the?multi-table?Huffman?coding?scheme.
+???ftp://ftp.cl.cam.ac.uk/users/djw3/
+
+Jon?L.?Bentley?and?Robert?Sedgewick
+??"Fast?Algorithms?for?Sorting?and?Searching?Strings"
+???Available?from?Sedgewick's?web?page,
+???www.cs.princeton.edu/~rs
+

+

The following paper gives valuable additional insights into +the algorithm, but is not immediately the basis of any code used +in bzip2.

+

Peter?Fenwick:
+???Block?Sorting?Text?Compression
+???Proceedings?of?the?19th?Australasian?Computer?Science?Conference,
+?????Melbourne,?Australia.??Jan?31?-?Feb?2,?1996.
+???ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps

+

Kunihiko Sadakane's sorting algorithm, mentioned above, is +available from:

+

http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz
+

+

The Manber-Myers suffix array construction algorithm is +described in a paper available from:

+

http://www.cs.arizona.edu/people/gene/PAPERS/suffix.ps
+

+

Finally, the following papers document some +investigations I made into the performance of sorting +and decompression algorithms:

+

Julian?Seward
+???On?the?Performance?of?BWT?Sorting?Algorithms
+???Proceedings?of?the?IEEE?Data?Compression?Conference?2000
+?????Snowbird,?Utah.??28-30?March?2000.
+
+Julian?Seward
+???Space-time?Tradeoffs?in?the?Inverse?B-W?Transform
+???Proceedings?of?the?IEEE?Data?Compression?Conference?2001
+?????Snowbird,?Utah.??27-29?March?2001.
+

+
+
+
+ Added: projects/external/bzip2-1.0.5/manual.pdf ============================================================================== Binary files (empty file) and projects/external/bzip2-1.0.5/manual.pdf Fri Jun 13 19:13:07 2008 differ Added: projects/external/bzip2-1.0.5/manual.ps ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/manual.ps Fri Jun 13 19:13:07 2008 @@ -0,0 +1,82900 @@ +%!PS-Adobe-3.0 +%%Creator: xpdf/pdftops 3.01 +%%LanguageLevel: 2 +%%DocumentSuppliedResources: (atend) +%%DocumentMedia: plain 612 792 0 () () +%%BoundingBox: 0 0 612 792 +%%Pages: 38 +%%EndComments +%%BeginDefaults +%%PageMedia: plain +%%EndDefaults +%%BeginProlog +%%BeginResource: procset xpdf 3.01 0 +/xpdf 75 dict def xpdf begin +% PDF special state +/pdfDictSize 15 def +/pdfSetup { + 3 1 roll 2 array astore + /setpagedevice where { + pop 3 dict begin + /PageSize exch def + /ImagingBBox null def + /Policies 1 dict dup begin /PageSize 3 def end def + { /Duplex true def } if + currentdict end setpagedevice + } { + pop pop + } ifelse +} def +/pdfStartPage { + pdfDictSize dict begin + /pdfFillCS [] def + /pdfFillXform {} def + /pdfStrokeCS [] def + /pdfStrokeXform {} def + /pdfFill [0] def + /pdfStroke [0] def + /pdfFillOP false def + /pdfStrokeOP false def + /pdfLastFill false def + /pdfLastStroke false def + /pdfTextMat [1 0 0 1 0 0] def + /pdfFontSize 0 def + /pdfCharSpacing 0 def + /pdfTextRender 0 def + /pdfTextRise 0 def + /pdfWordSpacing 0 def + /pdfHorizScaling 1 def + /pdfTextClipPath [] def +} def +/pdfEndPage { end } def +% PDF color state +/cs { /pdfFillXform exch def dup /pdfFillCS exch def + setcolorspace } def +/CS { /pdfStrokeXform exch def dup /pdfStrokeCS exch def + setcolorspace } def +/sc { pdfLastFill not { pdfFillCS setcolorspace } if + dup /pdfFill exch def aload pop pdfFillXform setcolor + /pdfLastFill true def /pdfLastStroke false def } def +/SC { pdfLastStroke not { pdfStrokeCS setcolorspace } if + dup /pdfStroke exch def aload pop pdfStrokeXform setcolor + /pdfLastStroke true def /pdfLastFill false def } def +/op { /pdfFillOP exch def + pdfLastFill { pdfFillOP setoverprint } if } def +/OP { /pdfStrokeOP exch def + pdfLastStroke { pdfStrokeOP setoverprint } if } def +/fCol { + pdfLastFill not { + pdfFillCS setcolorspace + pdfFill aload pop pdfFillXform setcolor + pdfFillOP setoverprint + /pdfLastFill true def /pdfLastStroke false def + } if +} def +/sCol { + pdfLastStroke not { + pdfStrokeCS setcolorspace + pdfStroke aload pop pdfStrokeXform setcolor + pdfStrokeOP setoverprint + /pdfLastStroke true def /pdfLastFill false def + } if +} def +% build a font +/pdfMakeFont { + 4 3 roll findfont + 4 2 roll matrix scale makefont + dup length dict begin + { 1 index /FID ne { def } { pop pop } ifelse } forall + /Encoding exch def + currentdict + end + definefont pop +} def +/pdfMakeFont16 { + exch findfont + dup length dict begin + { 1 index /FID ne { def } { pop pop } ifelse } forall + /WMode exch def + currentdict + end + definefont pop +} def +% graphics state operators +/q { gsave pdfDictSize dict begin } def +/Q { + end grestore + /pdfLastFill where { + pop + pdfLastFill { + pdfFillOP setoverprint + } { + pdfStrokeOP setoverprint + } ifelse + } if +} def +/cm { concat } def +/d { setdash } def +/i { setflat } def +/j { setlinejoin } def +/J { setlinecap } def +/M { setmiterlimit } def +/w { setlinewidth } def +% path segment operators +/m { moveto } def +/l { lineto } def +/c { curveto } def +/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath } def +/h { closepath } def +% path painting operators +/S { sCol stroke } def +/Sf { fCol stroke } def +/f { fCol fill } def +/f* { fCol eofill } def +% clipping operators +/W { clip newpath } def +/W* { eoclip newpath } def +% text state operators +/Tc { /pdfCharSpacing exch def } def +/Tf { dup /pdfFontSize exch def + dup pdfHorizScaling mul exch matrix scale + pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put + exch findfont exch makefont setfont } def +/Tr { /pdfTextRender exch def } def +/Ts { /pdfTextRise exch def } def +/Tw { /pdfWordSpacing exch def } def +/Tz { /pdfHorizScaling exch def } def +% text positioning operators +/Td { pdfTextMat transform moveto } def +/Tm { /pdfTextMat exch def } def +% text string operators +/cshow where { + pop + /cshow2 { + dup { + pop pop + 1 string dup 0 3 index put 3 index exec + } exch cshow + pop pop + } def +}{ + /cshow2 { + currentfont /FontType get 0 eq { + 0 2 2 index length 1 sub { + 2 copy get exch 1 add 2 index exch get + 2 copy exch 256 mul add + 2 string dup 0 6 5 roll put dup 1 5 4 roll put + 3 index exec + } for + } { + dup { + 1 string dup 0 3 index put 3 index exec + } forall + } ifelse + pop pop + } def +} ifelse +/awcp { + exch { + false charpath + 5 index 5 index rmoveto + 6 index eq { 7 index 7 index rmoveto } if + } exch cshow2 + 6 {pop} repeat +} def +/Tj { + fCol + 1 index stringwidth pdfTextMat idtransform pop + sub 1 index length dup 0 ne { div } { pop pop 0 } ifelse + pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing pdfHorizScaling mul add 0 + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj16 { + fCol + 2 index stringwidth pdfTextMat idtransform pop + sub exch div + pdfWordSpacing pdfHorizScaling mul 0 pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing pdfHorizScaling mul add 0 + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj16V { + fCol + 2 index stringwidth pdfTextMat idtransform exch pop + sub exch div + 0 pdfWordSpacing pdfTextMat dtransform 32 + 4 3 roll pdfCharSpacing add 0 exch + pdfTextMat dtransform + 6 5 roll Tj1 +} def +/Tj1 { + 0 pdfTextRise pdfTextMat dtransform rmoveto + currentpoint 8 2 roll + pdfTextRender 1 and 0 eq { + 6 copy awidthshow + } if + pdfTextRender 3 and dup 1 eq exch 2 eq or { + 7 index 7 index moveto + 6 copy + currentfont /FontType get 3 eq { fCol } { sCol } ifelse + false awcp currentpoint stroke moveto + } if + pdfTextRender 4 and 0 ne { + 8 6 roll moveto + false awcp + /pdfTextClipPath [ pdfTextClipPath aload pop + {/moveto cvx} + {/lineto cvx} + {/curveto cvx} + {/closepath cvx} + pathforall ] def + currentpoint newpath moveto + } { + 8 {pop} repeat + } ifelse + 0 pdfTextRise neg pdfTextMat dtransform rmoveto +} def +/TJm { pdfFontSize 0.001 mul mul neg 0 + pdfTextMat dtransform rmoveto } def +/TJmV { pdfFontSize 0.001 mul mul neg 0 exch + pdfTextMat dtransform rmoveto } def +/Tclip { pdfTextClipPath cvx exec clip newpath + /pdfTextClipPath [] def } def +% Level 2 image operators +/pdfImBuf 100 string def +/pdfIm { + image + { currentfile pdfImBuf readline + not { pop exit } if + (%-EOD-) eq { exit } if } loop +} def +/pdfImM { + fCol imagemask + { currentfile pdfImBuf readline + not { pop exit } if + (%-EOD-) eq { exit } if } loop +} def +/pdfImClip { + gsave + 0 2 4 index length 1 sub { + dup 4 index exch 2 copy + get 5 index div put + 1 add 3 index exch 2 copy + get 3 index div put + } for + pop pop rectclip +} def +/pdfImClipEnd { grestore } def +% shading operators +/colordelta { + false 0 1 3 index length 1 sub { + dup 4 index exch get 3 index 3 2 roll get sub abs 0.004 gt { + pop true + } if + } for + exch pop exch pop +} def +/funcCol { func n array astore } def +/funcSH { + dup 0 eq { + true + } { + dup 6 eq { + false + } { + 4 index 4 index funcCol dup + 6 index 4 index funcCol dup + 3 1 roll colordelta 3 1 roll + 5 index 5 index funcCol dup + 3 1 roll colordelta 3 1 roll + 6 index 8 index funcCol dup + 3 1 roll colordelta 3 1 roll + colordelta or or or + } ifelse + } ifelse + { + 1 add + 4 index 3 index add 0.5 mul exch 4 index 3 index add 0.5 mul exch + 6 index 6 index 4 index 4 index 4 index funcSH + 2 index 6 index 6 index 4 index 4 index funcSH + 6 index 2 index 4 index 6 index 4 index funcSH + 5 3 roll 3 2 roll funcSH pop pop + } { + pop 3 index 2 index add 0.5 mul 3 index 2 index add 0.5 mul + funcCol sc + dup 4 index exch mat transform m + 3 index 3 index mat transform l + 1 index 3 index mat transform l + mat transform l pop pop h f* + } ifelse +} def +/axialCol { + dup 0 lt { + pop t0 + } { + dup 1 gt { + pop t1 + } { + dt mul t0 add + } ifelse + } ifelse + func n array astore +} def +/axialSH { + dup 0 eq { + true + } { + dup 8 eq { + false + } { + 2 index axialCol 2 index axialCol colordelta + } ifelse + } ifelse + { + 1 add 3 1 roll 2 copy add 0.5 mul + dup 4 3 roll exch 4 index axialSH + exch 3 2 roll axialSH + } { + pop 2 copy add 0.5 mul axialCol sc + exch dup dx mul x0 add exch dy mul y0 add + 3 2 roll dup dx mul x0 add exch dy mul y0 add + dx abs dy abs ge { + 2 copy yMin sub dy mul dx div add yMin m + yMax sub dy mul dx div add yMax l + 2 copy yMax sub dy mul dx div add yMax l + yMin sub dy mul dx div add yMin l + h f* + } { + exch 2 copy xMin sub dx mul dy div add xMin exch m + xMax sub dx mul dy div add xMax exch l + exch 2 copy xMax sub dx mul dy div add xMax exch l + xMin sub dx mul dy div add xMin exch l + h f* + } ifelse + } ifelse +} def +/radialCol { + dup t0 lt { + pop t0 + } { + dup t1 gt { + pop t1 + } if + } ifelse + func n array astore +} def +/radialSH { + dup 0 eq { + true + } { + dup 8 eq { + false + } { + 2 index dt mul t0 add radialCol + 2 index dt mul t0 add radialCol colordelta + } ifelse + } ifelse + { + 1 add 3 1 roll 2 copy add 0.5 mul + dup 4 3 roll exch 4 index radialSH + exch 3 2 roll radialSH + } { + pop 2 copy add 0.5 mul dt mul t0 add axialCol sc + exch dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add + 0 360 arc h + dup dx mul x0 add exch dup dy mul y0 add exch dr mul r0 add + 0 360 arc h f* + } ifelse +} def +end +%%EndResource +%%EndProlog +%%BeginSetup +xpdf begin +%%BeginResource: font DTUUHP+NimbusSanL-Bold +%!PS-AdobeFont-1.0: NimbusSanL-Bold 1.05 +%%CreationDate: Wed Dec 22 1999 +% Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development +% (URW)++,Copyright 1999 by (URW)++ Design & Development +% See the file COPYING (GNU General Public License) for license conditions. +% As a special exception, permission is granted to include this font +% program in a Postscript or PDF file that consists of a document that +% contains text to be displayed or printed using this font, regardless +% of the conditions or license applying to the document itself. +12 dict begin +/FontInfo 10 dict dup begin +/version (1.05) readonly def +/Notice ((URW)++,Copyright 1999 by (URW)++ Design & Development. See the file COPYING (GNU General Public License) for license conditions. As a special exception, permission is granted to include this font program in a Postscript or PDF file that consists of a document that contains text to be displayed or printed using this font, regardless of the conditions or license applying to the document itself.) readonly def +/Copyright (Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development) readonly def +/FullName (Nimbus Sans L Bold) readonly def +/FamilyName (Nimbus Sans L) readonly def +/Weight (Bold) readonly def +/ItalicAngle 0.0 def +/isFixedPitch false def +/UnderlinePosition -155 def +/UnderlineThickness 69 def +end readonly def +/FontName /DTUUHP+NimbusSanL-Bold def +/PaintType 0 def +/WMode 0 def +/FontBBox {-173 -307 1003 949} readonly def +/FontType 1 def +/FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0] readonly def +/Encoding StandardEncoding def +currentdict end +currentfile eexec +d9d66f633b846a989b9974b0179fc6cc445bc2c03103c68570a7b354a4a280ae +6fbf7f9888e039ab60fcaf852eb4ce3afeb979d5ea70fde44a2ae5c8c0166c27 +bf9665eea11c7d2329c1a211dd26bb372be5822f5ea70d99eb578c7befd44cdf +045a363056e5e1cc51525ea6fc061dcebb337208eff729802376a2801424f670 +0e7e6397b28f15bc10b40012b0a3eaeb2693e8f7f627c4c9c7c6c5bff105c1e4 +1b2b9e8f09253b76040d268b80719e1b3f5a55ab7b8d62a63193c4ae94c086c1 +552833ddd8f116b5df33205ae709b3aa63da7bebb165b67281827b48fb5edbed +02a1a5c0784fc57d3487daa59520bada1be3fb9795669924321ce4f466cd8e3f +7e8ec2494aee80e2dd7a48a6861af5b9f0ccaa4a2fe2b03498eacacd6b9c39c6 +a8f2e39e06bbb061cf2ec380a32efad0b790974bb5cc3daf0992471456967362 +77de34813f27abe99302f86bb4d293a37f84667e7f3dfee4cfe9d1a676a5728c +aeb5222ff50da97e74b2cdebf725fbca7015a188891c8a376b9dd8a642c4b184 +b1bbf3f376a6d6e31ef1c8354ddf8039cb20faabcb34d4749b3c8c8d6972ceb1 +06b8a5aae3ae40a91f1f2b1155681a9cc933f87528c99a2b0268b43a3e829e7f +3bd863cb52950773bd9b0731dc4992541d7de7a055ca65ddd2317f1705c20d1f +93291bcc254cbaba425c032b3b15050d41da14ffe1b3d684eea428095a01e931 +98d4f849b239ad9d79f4502f0271affb0c297f2f347bfb9c137782646f648f77 +0076b85f5a929fcdea2703333f6918b8f125627f8b505c688e30f258ded1aecf +2c86edcd88c29249a8081731737195fab7adbb54743bd66511194dee2516959b +a20701e2d97342248297425491f6c9471ec9a98e630d734dac19721f0b324432 +c8d7a0b751453f89f7008ba37bc48e0831ee3ecbd8a0a292d63cfc890b28f695 +9e29ac3b4ddb78a6883b9272ce34a012a82adec0b6b641e3940a438a098ccfbf +c50544b94facfd9d7ae09ad0632015f81d2f77fc6d80a42ec11d67d8a91c376c +13c8e3444cdfde4d2a1ed021410f4d6a4e97804ae949bd913094d23108c9d384 +56f11025e2d24939114b6bcf579a0315c52f3ca1bcc2860fc1a0b9fb8a37ae2f +c20c0fd44d215fc2af737fd0339b070d54e664021240071c665de4170dfa182d +4e385685fb41a2d85888b1149e9a766cb4f309b4e2baa28cf1f8cc12c4b19e33 +f046ce97b53deb549fea96cf6ce66357c4904b7932f5b1ce03cfe3a10c976b9c +c9ad11d7a02816f8e11666ca8b3ee1411df2ca94172659bad929e3e3e5248f48 +0690cec6d8f7061608cf2672f65abdc96b4fca84d5c847440cf9523d3bf23f6b +d4365582e4b187b6a1a0282ed323bf221edd0a4ce11ce7eda738d1af48b2e19f +eb3da1664de99c447c35dfd45069fded1fcd70b4a6855e91ffbd7146efe88012 +0bff1d6d1acb53d5e07fb5795f561a4a3e953bba7c03a9762adae18e58dce6b3 +b1a703122ef3b16963ac7cb9682ce60e17947e7e675d19901c7e8272ce4c9fdf +536abdffa429b820a82aee9a73d7dcf77dde4d8e251cb3b3a5b0a91c0fcd7fbb +ead7a812ff194fd049f28b82f4c2d73e41cc73c1c9f668931a2c7eba5400a1b9 +0902efe6792f207136e1e16b41794e6cbf7316889a602d35c37ef36dec95af26 +e9bb0900456f2ebf2705ecce7b2ed90343d23e006ecb282d4b3629bb0c3892f3 +ff9c17fe6c5fab68358e1cd44aff021948ac9fb8410a3de22e0a01e367c52470 +2a8cfd284cf9e8f505d5dbd7bbe242fe071fea0094a55ed1cd7c9be6b7c56c98 +16ad1985fb7624f5e48cf6c0c2ed85b466f64c52f017b20cdabb85d24452e086 +3942362e764a2bda0f6c1b24426e302ddc4403a087efb2850cf3275c7b24275a +ae270f212831f4c4a5d95deab61923ca126e587e8f5ed4f2d5738f06e8c4f911 +b346b8ecdac481dedd2f546305a7cd63cb67d40093c618fbbdf498c8d7ead8c7 +1f5f022d0bbcfaa8670e3b3b999a1697c947af38d7e1a360e3f0825a9aa77840 +d7a9dfd575ce2f04d308f7c553ebf569ac84f2c12aa0869ce107c713a3cce624 +5059bfb3f5aa27d10e337086144ab09286be3825a3482c5422454c6a9cbbf205 +833316780eb88302796fc427a0fb9e53a7bf24577feb3fa5d85cb6344f908007 +183522d3c760c11fc7da8d14bb5dd800576a6b4d1b991c1bf3db0f9ca2ac5d22 +91079a199f2f6e6dc68213d33ea893b74f6aff30ed1b51f8b53a015ffd4d2076 +b71f73225b151cfcf11e2a2917cf1b3f60e2b4d442307c394e1625f7e60eb12a +f2eb9ca7b17b082f1664d09cb7a3f38aea99a13f659089426126f47fad5b6dc7 +64101cd437da3c22bc43e7a8de07253eb371470ee1e4e42a5d1fa2c4db5565ad +79d6271ae28e8fde5d4cb24064c145de44ed486a1e7df2df921f2b1be5fdb120 +d8b781c3655ea72dc22a2a2d37579f0af60b42320ab25c8d769124352448a154 +7a381b388a4d9a54e82f199ba35f1a3981823ab698e3f87d38d32addd4f13832 +77fcc9acee7fbd3285f689a85b76d0feb9e70f09bad0ce144770a6cc203ce40e +15912de0e3465dbc7918e3ea49ade57ee8c48c75937f5d25498c45170693067e +6902937c9b43ab6080111663d5dc6d88f72a39c5e7bad677229498323a3e7a22 +2fe2552b00cb91ce2848a1a53538b7af2503a3671903e10df0e9641dbb70577a +e828dd3cae98fa9e1a74f4377f908d3cd79461408ed29832bc4c9865550ccb00 +45359282255057a4bd4859915cf1e45ecdb7329f90bbf63e0a22a54b05c5acd1 +9c7c4dfc25482a27a20c7ab908546c3577e87ade93ea46436314a0a7c524b892 +4b012239e77cd65ae2949bbf7e46a5a2269b7ffb1cf8a5bc7eea1944d2b0bf37 +bfc36adad9a599fa133f77935f24ef518819d054345df144731dd2332b0f7f5e +84c46af486941cf1293e86ee719c9bab6263470c7009c3933f1857b0a863e36c +288d37e6ac85e6a1b4e6e91c0a9fe367bec427ea3713e8d1f0523ecff6067717 +244ca21c177968583815f023420a660f7aa4cdc8bf25ac3b3e429942b9f5123d +84234c186d9226487c76dfef5d26165771c0e75f0ace7e3882e49de831b46c12 +e30dc37395241d7619c05abc40f5a36f8042b461fb6c3a5181f77b14e9e6d978 +37356b4b31fac3850df1869063724316104c799b6a2f42c361a375e4d29eba7f +850fe29efbc2cef627a25db549a4d4c48f9fc9a2f32fa50c1ce6b5a545a95f7e +bf2e9ed710ae91ace1281a44e49aee4133ccc04926a6dba24b721c21188c89a5 +2a49745501cfaa4364cf49e3ec2a59d9ee46f33362634f9758827b199fd07dba +939bd7387124656831862f70a97c5a05959572c74865f5902e95093fecdbea3b +bba9b47dace807262de0c7ef04843259f58a323471237cd573298c5d0a0650ad +2acabd71cb44c63675192845e3d01b3b28af871f347d4a460cc28d9e94409443 +30e893d27b06132063ab727a38f447a2a4633d29adac01bdccc7634e64dfdc55 +9141f69e1202c4a0fd48479b0ed95a7605c94901373e1100a6cbfc113fcce445 +e0317cc94a8507dd637c37676954b9d34c6727aacf17285876db16dd0e11384c +2b996e85e82fd8fd2b8f9b83bccb398b997364f0ddb71e60ccc50cdd5d122eec +c36b86a89fbbb5bfb227fba3a7b7de7c907e58780fc276c24ff066982691a97a +50d14362d27d790375a47162decc53c5c11e8a7499788dfd86aefffe7e674aed +26706e2d079e9a571c6a32accc8c0dcf23508f58477d05f9a1fc679c0da64254 +27ae33293d02c9eca01daf2d0a1b07e5515d36e18caa3ab1b6c5736dfdefe384 +dbcd244f0c11087a873c4501c6de2a5a57e346fd3f92a0451e63fff6b99c6dfc +64ed8673dc54ef6509d0d043925bce39072fc64ddf2c49b8602d1a51ee822f19 +d7b2135aa84626bfe3ff321a6bec3a003ad97e7699cfa34bf41f9c2b38df4794 +cb5ae36c95f42b44212de67a96ca9d047587998636673a031c4eb03cf1a55326 +f5d94dde75086b44f095ede0068fb6b9d256759041cda04ecacbd8d7784159af +ae31a9c637d9a5c0c6840dd9e30eacc66d4d6fd6f12a603aa2db3e9866693070 +0d69cddc416d4b76cf6b835c7bebf914816b87edcd5a24e346eba2dded30f5a0 +dc033e93b040a6ee7f8ab3c44c61017c758c11c2e2fe3c4f18996287a48fa9f8 +fd068c42d0d3384ff27c5a88ef630125562663ee95a66b7b588b417b20d3ae84 +6ecf2693940d4733f9e70b0455b6097e73553eed34df8da712c29d76326670b7 +13f19d4b5ada1833d46fd6cfb92b85eb946cc74252718cc5e605cd6c3c5a46e8 +51536cddcc3cb244c78e629fab784fd76372ca9417fa67f292a7e780b78186d7 +f391cd91b6222e88c0bcff66208814965511967b2ed0d075c77b57701608b647 +b4e462d3e56e06c0403f858582a754dcbf8841fe81d39359d8c5a77c8ae6b795 +c11b84f702de09f22498a189a4c69d726a63260784066562a50544e5d07aebb5 +8265c1c6607bfc6008f2edfc9d0de71646548e59bb374996a4412ac22ab47dc8 +357153c7c9061e95952a729a80fb45f3650fb0c84a07c1956dcc0856d7b0fa71 +3f09c1b995b0c48c57c9367c0601a46cdaefd0460735682d5aafe8545cba587b +ca6e8144ff14a25b2fce9b23d8ebf715c5a544bd646d5460d2f8cbd44b6d8203 +54e4b7377db351ff26b7b9336a7dca3a610d3a92541054c544064447ac6d1a15 +cf1d1a3797cfe85fb55b56ac01fbb6f47e9c8e5c2929bdc7ee14f6d868464493 +df4759cc80405ef270a816607f248c5c1d5c56035a8ffc1fc1b5f69aabe2f964 +cba4c0ed5416a20f102c82bdfe59ddb4a16140c85d55af2aa52c92ee85c37881 +9c95865704b3cc39da6270dfaca8c3611edbb6da767bb50a03d6a06ed9890104 +da2a575ea45e16da2e1fdcd603c91af6beb934ea33023152c25c27c3c771b553 +1a9aa1ae684e1539e549972c97321fa0710759b6d4b9e55ef1b41bda01d77786 +87c22cb79310a9000bade74a8ac97b3eb2ff024bfd60c0ad7fdedb23c805f64e +fd139e015e0d1d3591be5930c356e6b8c1a4f0ad9af94eded4ee9aaa436d4cf9 +58c5897d06b7c97cdec22745c46e7b37695a8c66140f7f8421138892f4851c3f +d355b1de1d32145d39243d0590a90f1c4ec2c246d3f3779b319c38d4221576be +fd17d8bc8819cf8ec30075305f8637d1ddf0f7255ad456cc290f10ec39ddc2f5 +290092718e7d268531aaeb377701dafa933b94ce763c1954ef0cce19d77c9208 +157c38b279c578c56b7e523afccc91fe6819483de18ceebbe74b81844ddb84c6 +22d4f29661e89e5417ce43c28028e9e1c54063afd716088b6e8fe0cd1702c2c3 +31273573f5c3d760c8a2c7cbb362ed650ea8ff54f19e097f14af9739885af15b +46ed31cdef73db671b22efd41ff3f6bbd29625fae7571f9542fc06c77e28d2f6 +3ba2c9cf89da564de3a6fb3f0ff981c5c482a1e1de730041b7f1c890c4528bf1 +8e79f2fa4ed8a738f09a68a5b53edf6cbcf8861003917a89989146af7ab2e5a2 +836279643900c27a90463679a22f0ca5077728f6ae8a28324f9adcc19fa493b5 +e2465c6d98cb608f8dc52cdd6c52bad1a1502779b638df9336e12f035b3c310c +b92b3add047365f2d25b0ec7e05cc46f31c0575eaf4ebea0b660aa20d9e7edf9 +0aa077e3000e25176038ccc92d4f9fdbae6b05aa2e17ad004e13308464a20cdd +0271ed0f964e73cb11f18c2b795dba31c3ffd5648c63dab395238ba7c0cc7db6 +b206e6179c6ad7c2534c46a2b9c1d7fe6bc693df35118b708933677ab3a76cee +9ac0303c2c0967d718a1691f6a922abb6b37625fc01908c10242731b79a1a82c +fce9efbd1c6bd483fd867bc2938609ee52c0271a7ed1fde1b8667b98e22fd450 +86f515fd2ac2c11c50fce95f3e506ac6518dd4e532ddb100d87a9240bdcdafc2 +0c8bec467d76261165e9d8bdac9197ec798c81cfe80e3619f432674cadf44ff4 +3f61089abeb13d665e7901f4a1ba84115333210009d55e051b692aebee9d9bf3 +d0219c290191c17f7317aaf402b88ba353c25f126e2d32bef73d528c65af0840 +3ed4086daff574762531794fdbf637b765273911297b75338691e9ef4d2ad452 +22454c6a9cbbf205039d6d35c09a0ce284e9a776773a98e09e6a816dd71d80c3 +d80abcb006353b4b7c48c76bd9c1ed9db78bf62e9ad2222e5bee9fde0281f0e6 +11fd6f899938cee729a184be7cbdb0b84fc9c380d6c69cdd6e0f3f6780af684b +cec6361673853b400f47e00177ff1ee7f9eb8c285a49e137e08d5d7663df71ab +71ca71adc0857055686a04777a2e1408ce629e018c97524af5588991be92e4fa +4a27745aa950a72d479c48d6f8c30d4258a882f199b4359f92a963fc650230c5 +79edf743f2cfe86a197296dd675bf05f25ed969de77bfdd0b518cbb5c30b4e42 +27c5117f235b34f7fc32413a980a38968ff9b8151280a0259214790e421d0f39 +eeebe98adba820401c2d47d4132cc68cae0f59b049d7489f62259bfc55091c81 +89e2480dcb77f689965151b7f6706af675a871370d2195b07457af8809f7abfe +7d3672d76a74f55ec749ef40f755a3eed96cce000644ca0c497afaab7294afdc +13c3239f54f3eeee809bcd936ff447277d2f3613936e7b39e683f25b60505f2b +f4343ed0902badeb62495cef53789b9e74baf866be33efe66c1c5faa95f60ac9 +156a26bb9f72cb73e891ee4b905f72845b3ae05e025879f07a7b91fd06204148 +60832d64b6bd5abe0472aa7aff07fa05d23a01238b6f624ae8db25bb71ddd893 +1fc6003f23292a428a5a99df5861e0ae858c398d66d027a32a71d6e62d62b6a1 +a1db86b1ea3005a201618f22899cb1e7d70f65fdcfbf7962ee0d0d15412d006c +cfebd0e0892888f26238bd1f7f090de03c41ee4ba53548f469fda2d94f6b3da8 +a606fcc3554e3f261b8490a3b8cde3ee846542668ce3b371318f9864c45a4223 +fa2a86e12034bba867c4abeb461c609c8d47e184703bd6c891f39076ee06bfd3 +bffa679de07d8c8eed9b4b24ff74c6db2cf84108f28e4f0fdb78e0e726a9bd3f +2a1b94daee18fd20f2c902cbeba13c1b281d0a11a96b20800e4cf939dd32bda8 +25aa63d9f86f380af4dd379d80441dc4fbc0719a69ebc16e1617940a19eb0b44 +96581982d45b08e512000e3915490a1a79b908e1e63ae129750fa45dd33c0e9e +2e767a89c6f11e33f193da18dc6c820dbed8d370492c19ad9d6407e50cb62446 +d3ab009d9e8f3c51eac2139ab64ffa19b70405813652fbbe33fbe5bc95d40b5f +9ef833a4b1b51e56065abfef1036eeab8e04f096aac0d2813c2e721e0db97368 +c17f0cc971c9ca18a2db11745f67d42ce5148e2e8b2c0e13e4bb16a2789f0c4c +e7b65be454ea623212bb2ce5afc6b5b3ad5bfed65063354becbc1531389977e4 +6599896d9ddbdf3ad6fdd8a44b14ec8cc9f131d73cba91e28cb54b37655e4b44 +db0457ae7bfd3c6b73bacf09861a7fe4b664928230fa03cb99ebb763703ff8d2 +68877c3a3b1cf915891578aec60c1f7d1e447fc777d8eb3573ba2a9ce47c99ca +a9d52f2f12b101fe48658edc7543ef85dfe01b72dc4dda597951ea4298fd444a +ee33b14ff2f91b7297922daa7e346493080868f56aaa2176c9f2c1284e4b2672 +a3b75face39df1c8b7a825a3a5c25871d190e48574e1d03a5fb094d418c47ac1 +687e8347036cc44fed3d84fe5d4b84a61fac9968b8d004c28539a3681476ac45 +56538901ff2764c1c46f5ffe048cd3a7eafc6a9fe98ff9b3cfdf3ac035a9d3f6 +8d75440d43a1842cc1e8b6b9b6d49a9bd093620735c9c7c11c21652a5262a86f +c10413a373a9e02a488bd9a16a51fb51b027b2c5cde35cb1aed91ce58703e1e9 +ebdc1a161d754ee437412182f7d532426841e2455add22c031a2171426881bbe +4090d1cbfc498ef46749308b73ebf4dc5a06adde6f83bfb368388bf7c2d900cf +57932ba4c9db0f15faff7cbd701050a1db98bdc9a5f9f428980ecfb1e999f460 +231e59b5c62c7879278f10f6a61f79cc9da24d35a2d26996d8a4a106e081b8c8 +3fcc015b775acb00f78953a834018c146c65cd715bfb5f90c03feac01839c6ba +156e327c97350d2851dd77e8263b967742472dc1e3b8f0e980de9f1815007cea +51619d84375b777d5cf32a144affd8ef0f4fee2df1f839b2a5d900ec8e76363d +c829f1d03d211175ab982226616b19c51800e4b5d4b28aba82980eaac6131940 +026e3c2297e197fb8f130fb15d2c4098b97c84074d4e50b5c6606bb0f3230931 +52b39a58964b4ca44caf45f63af49b330ab3dd863f5ebfa8ab0db6cc37838a64 +72c601c215037e94ac89420fea13d52174ed5c933e8c8525f88e6ce482661861 +58b904ba7fdb864cfe04bd7ce6070fc5ef576b1de985a8c4eeca7fe32b90d320 +9091d8931bc21c6f969288b1cab44bc53755d8d8f257466803dfd5725dbb5830 +4be6c784fb6f8c5e66802028759c0597246fc103eb63b58f361b144668713570 +8c6be071b51fde425a0aa5724986ca67e87eacb8f517fb3103e52595ba002e02 +82e54cb82b04c993d991d70b5eaac7a639213ec0f82a1d7750f3f6e94d8ac7a0 +8a586b816a9fbe78ff96bf1e3cd52798089f279a0a0d93e0314883988bba0f78 +7ce5745f8b07eb3b750c1d0a13fa4b0338346220ff9ff10cfe04f29e2c24aef0 +f77f6748b63b0c6d53461536034450820c73116cc66feb9c7f7d08e0a47d4c92 +ec61c5342099c27d93a79d9c9f278142ba03b51d6e1e03944abe063baac32629 +1b5dc30de8512f0cb3a973cc43afc2be532ed012c3eb58266cbeebf611f91aa1 +489d0174e713b976f3a0b36c575df597a3d8b12d4c5441e3a478f0933eb129ea +e44484e084bdde7d2d9ba23a6bf1bbdd51d96ba4a5207af1044e917186b7e66d +accde1295b615f37f1395827e29e3a1711fb2b6c50374df468be421cc531eae4 +b3cd2473c979d11c11beaf14aa9b6cce4acc8208f22f9fbb6713bb8306e5b5a4 +d46d11e604114d9a5a4be0615a843d10de54ad62d582302fffcfab7f785b11c4 +83081286cfa04302f7b92f64dbb42f3f97cde0c047662be6a3e58986c54b7c3e +2ac1b0d19bc1490311150931aed3497abaa74303d3f0a3f3af8667c4b0b91385 +cdc9bd2ae98ac32a2d943e0583a0f3c74fcb803559fea211098b48385d3d8d32 +9e2cda61d7589e5383fa32abfcac50355549f1e819eb31531dadc47f5e759790 +d355444f1efa6b1dfc7713d446008225808fffbdc81a3b1b374c7f2901e27e2c +41c477de0e52e9005288b7175117b32c326b3ad2b9f9342865d0bdd0ba6044ac +395c2c69bf82a7aa9b77842a3bc7b4a675b0c32a4e4504d2a9fe8762170f54c3 +4dc3620cdea9d1877f274559ac6d37aa83f90346130472775858c18746db4558 +4f2fa7698926c4fb2eef0951579dae63c2d3c7b9e1fc811ee5dda4dc5b5e61fd +c0ed21724902532087dbef11b1fd0d71eca9f271a3d1bf8ded5df19db6761547 +97d0a12f94147d64bade52704f880d0fcb89f4958547c6839c9e111892797f29 +4e65f7a54e14ea3d3f50712979f84852e57b9c1d70474a3593d53f21603e00e0 +e79ff355914f9a3d4ab1e14410eac9926928e714248535b178d6fe9e0e84ce99 +59f66fb52f37a4e3dfa5488b76d9ae2f62d4495bca11cc148dc20e29a694fabd +e65c7629ebc40ff0c0fa109631655d3ef9848e16aa7c73cfd4aed02f8f125ab5 +0d628ce52fcae577c7ef0ab688a2f4fa9a0e2a9b10b93130f0b357f4679c1f7c +9bd270f34f0bfd86459b402c74224a621dfad6ed316d05e15d31707fae7a9b62 +f8f75537326742f1e9d0c7483489f4f4fa38e0f327f24fbfb26307ead2720bd9 +678f45875eb05036341ba38660630b7d005304d4388ff7eb3be9c2635c21af0a +02d12fd19a4e52181a9c7f2356b2a16eae4e8ed5b1ea0c01565c26856787fdfc +2aaaf11958ff3414ab62ca19e947db6b78030e2c528f3d1c0215cadbb0c34f72 +6751da03c604bae7b97f379864bb54be9799bd387e88d6c7053f83dbae1cfb04 +f2ac87d12dcbe17a5183780fab4589e8b0d70934e856f11629a91e6d13da7704 +73cc80e0b80bdd42a71eee5f43a4dab994ee7cfeff83d08169aa298c98a85477 +dfc729ed6db098b4ae47a25b8ae7587b8cb2d59cc0989c06129fc201e7c9b763 +f8b3f651a5c735edc975cec4ce461e81ac9d5e3b08a708fc536b46b9566a58c3 +0402aafd2b6018dd063877b880f85e09895dd4c9d89b5f264ad72cbea438c153 +054e1a5ece2091e1d4105f46b047b75ff3be86491e694c1e2e03bff36812d148 +d9923f5d89a28fbc4f45fbc3db74cc37bf3cf41b070d72a4cd571524fa6df788 +3153e77818641287ae22b1c72331fbff019ccecbc1709615ad749dc77cb6b331 +30ca3d0fa05cc47447c17d96cf6ded782ff6b505193915aebe31f1f7b95dc9fd +91a124f9551224117174ae1e05754dedcec813a8aa4934b73de1b20d7c10a20d +83a8b085cc2d431b87397e5f8286c0a80704101475ec9845b2bf7ecb9ae457fd +abad09e4e8ee411d4a20518597b08d5dd66afebba03f632ff2ed520270893f00 +35cf0716f4a092faf8a0c2a3f73ca46afd2a825eee041bbc2b649330fe821807 +707a06ed91847b434d34742844947d54e80422f5b5b56f6dbda934089c32ad12 +375b31af9aa91329c253fafd3cff4858c39ae5efbed4d590819d2f5963b7e08a +99e157ca1c18b20c62a8f7bd278f560e871b6126d9cdcec52c6839417bc70dd2 +49fa373ca6dd557540906729f2fc5476c38595d958ab2b6c14629f9e16a2a9ce +9f6e2dd760e55a38a3432e74126135364cec00a7b6dbf0cd48555df9f31e71aa +9d573bb077085030aa3146d0693fe683884ab380f052c38b31b0e3483d122c4d +d15a6a93eafec3523f4b2744935de9d1660fb4d8a76d82045862b59ea2183961 +f9868bf03e4a71db61e03fae93bea1092ac5ec83d71dad123d5663149d4bd0be +e643435aabc919942bbc60d4ab56ecdecad30d270589775a3ff718cef0e2ea46 +b8c75fa911752ef13410185e5cea25aee6fae74489355d3328e0cbe8d4c55d46 +4114b4a4c85309dff4f2a5c2b14fc4f4779f4e3a8bd29076baec35cd59ecadca +09e93d8dd4786052d970484ea3cb45b37c4a6f74249e9f5eb7583b018dcdabfe +67259769ae1a904f20b3ef352cd191bbed998f4b2c06465d7355e82ffa718e08 +9dfa5c8fdaac95d8e05cf8b5a899b8484c5ea104eef3e5b21436ed396662222c +8cfd00b5a854ba9338da205f16e5c0f451bc1c6cf34f0da069af5ccfb460cccb +b6f393a99f6138e0ece299e0c0f7f1d0c83e0b936cac2dc38f08292245e7afdc +6538c4fecc7d712ef83997088f73ae6ff0ab83d0ae76a7811cc07b41a57d1d34 +04681526d327b489094dd961f2f60a0c6c275f09f0a171e88056f58735d2f502 +65a167d12ff3395df58c3b901a68f0d96f8ef54ac5548086229adac495fbc256 +afe832991f1839aeddf1a87abc217835e58af4199823165fb9899fc831b47bfe +4c3c1f5a2696e9a5f310afb8138eea06fda0688e0d0d7cd1ceff93a72c57289d +332525c3bc60e51ab25526a4876affb2c64657caf14b34fca46a78e41b0c1955 +01fa1a0c0d77d5f7026234af489b316872e64b4d449efc540fb0da553063a71b +d8ee44b0f9a20adb9f60b99803f1760c0cde357784e87042133aa085e9a37a5b +b5685e73354ca0e9a48d886fd12841674bc0713d43301883f1c2f6190b47a4b9 +996c0e528b6572c96232ecbc57c57073463ae36b5b2974163cff75828a20c47f +926e99faab51f19fdbe0f89bb71ffba9eb95a82b3a712b54578f665a89edf193 +d575ed95bb883f9d6797029ff0cc8a75459fac0cca4530e17d93c9834a8d9c9b +376d3e40f3e44e6e895f25c90a803cf8b0f3056037809e3ed618475c199f43cb +a7eeff84d38f49aafa4e469aa78cddb87ea76a87da1b888c38e225499d1bb089 +32d599918227c97b1e4de521460f1a175ff2fc500bb95574d9eac64cd00896f6 +27589fe5351f46a46d1fe8ae16fdc945decb08c0b7d841c5516535ab65b84724 +04796bd7b7083a606977316dffaeec0e8681c10df4deef6335403e5b08889558 +48bfb1b8708a5c41c5147fbed3942ac26ce66357c4904b79147dca55f039b648 +ae18d0d6d330a621301e3c1d6e478fc6fcee4c3382d463491a167596ff51f17d +1afdd4ee7ab8f1b27b4ef2b665cb6818637b5e982447f6d7ab2806f769d254f9 +f5981812a9458a39f51366773a8980c7c6dced448d878af3bc088237815d2727 +40093cb7c3a4e6e86ec6cd61fa8ad13b20e270f97ee5be1799f2966a0ca2a7c9 +32de08bb021adf9466f1b88ffef315b818954057877d3d59f173c1b1874fffdd +e3749a0dba7d62d70483b1a7c7720c1e95c59faeed0c8be1913177c6dbaa6905 +a6bd1a153906aa1b6919ebd1befb9a54d9b84cd9d548b1abe83933670ea719b8 +6337d01283b95306db92fe059da52d107ec47819bd163b3830c989df4052614a +9866b057aeaed455fc9864df1960e97806cf95011394e2052861152024969836 +77be8008c246f14aea1c26e620fb331f96cd32a23b1c87d534d678181a198758 +4bffe069fb5a0c6b63ca8a9cfb6c3fd6ecf07c5bc59712ec7d02a5b988c3fbbf +695fc7068a644d8885ccd88987532539e5cefc64fb97ec1376ef0a97970db510 +4c19b7a64a1b4f7eedfec2515996238dadbbfa8afd8004f12867de20912c2774 +1ceca6f2956b340ccb5e30f2b1f5f6376e6d3a272be05c29125f6d74bbee7879 +8836ee673971ab724dc89867d5a939da0cb41678fbb8d8ed35efa28de86728f7 +953c9c5896b867e4b7df3322563aff8a31cca8901b5542af2c7254547c7c09d0 +15baa7cbdc7352960ac650a543f05e290341d245ddd331a556ac7fc0ee7eb246 +718b71073b9a32776f6215fd8fa2297a2e9be23728cbb24c53ea10a4544ddfb5 +7d6292640840c77bf03728c3e5d2665ed7db7410c9ecb32c249a45664f72f8f4 +2e81a2e086b535f6473b1a3319d134317edbd1864cba7b79f89ef99d16c8871a +28fbc4cb45f982bac6de81ef637a7e1022a5579f73867e40e31ec8903632e33f +b24abe53b1f3a3097779b977bbeb41c21857909d3e25f7bc88e6d3fe6f183da0 +0133a99ae39080012df8498b9ce322ea9b76343c2e8be3676f08602470da2761 +ed9de407fba38be82de624e1552be40a0e10b55ad74367b91c80b8bc5cf59f64 +b79072369d9e492ee6b9f9df0b91ae608a44020ed6874038974ccc9afa88d6b7 +8114af4de09e77e4b0a1a1fb27e226a62385b969bbebb657ea927fd86e050ff1 +3ebd001a022333f8caca13c54f9b345cd5b6553c90b4f7fb949d7d65d9bf9fd9 +46a3c7c531f6a6479aab0d5a7015b56959777892feea7990edbd2b423f6e9ce4 +583caac124c268628a9cb703dd96aacd35b1031e08a741d02adfd579267df790 +5ef26af14b2bbdc22a1eb33b58719a1e8463f28784f4c15cb3c25cfb2e20a508 +7854a53f4ab398b02177de500a049d6c9faa13fd40c19178e878f1cc26221c59 +b40545f5f4442abba06656ead5afd938adeb3ea50c699862d48e767c223c1f22 +246e58c5694d1e23511710817a9fd18a1620cc651345e6d3302d85139f7a5734 +7e423be145e165baf46019fe831f97602ec87b3cdfb8fea12869c98f115d1b66 +5aa588fa82484acded7ca2c13a17bda305f63ee226ee1f37cf247f1aea9ff92e +2fa4c1e0448a5dde45294699a9490a5ea94cf81c53491fc19e2ade5af005c300 +a5fc99b893ed1d469788e94de823006f8848dc9d021f19b934278d44e8c73da9 +3728f389563e10ae6017c5caf3b4b340be1d7d2b7f24a8cfcc1ed1eb920cd366 +6fa12f35e45673fb12b45a6ed7e84937576e5327c82d7f27f6c0255f75ef4b02 +cd492b23ec1f346bdf8e007042a82ab730ab2805569d7b978a4b114577514548 +0d426dc4a8ad86de85b23ab5aa8a50a30bbdd8ef5e9ff8e7954a69987fb5401e +a9d039d5e05ef245e3c70a85236969f32bd1e5d29d71a2013493945e803838dc +7241a73c4c1f14548eaadcba64aebc29fd2253fa59b6b039bb2edc9e4a7c8e83 +317ec39a07b8c8297e4b08d4e6f01a53e3d690f1d1db49f19640c16441be6ae8 +d1cbdf853394cf665f741938733fbc700e8d82c4cf1d72456008a0fe55c8b677 +a4f3e197aac9b976343923dd4c5a181454319fc509d499bf14740ef1387f354d +d71c3bc5b9d4d2d9e0e7a3bc60c79c8e6d344bebeb3b2dc2c3605fdf1002f061 +d52f718b57d1f6c1406b1fdf2ce37ee45693ba72284c5652b2d88b29ad55d9bd +78032a76ae6427c19749ca1503fdfa6eda4861f0b0c72684589efe6c01d9c964 +1201b79c5ce03520510e13bc5461fa3d2897e2b7c65ebb571e2d0ce319248d4a +fcde6d70c38d25f6bbf0c09b64553c3fdadc64c293deda6e2ed8c191d7f432ac +5bcc1ac3183c92d545abbd4da7e768140b9f5a5077b08dc8eae64727eade3e5c +05e07036b08c31ba5ae366c642f816b5fa60e148795d3d4ce050f09c443d6fe0 +d44f8859d43da39643d4fb8c5e2e34f1b32142ddef07b1c02c09f4cc9509eabe +99350ccd3a9d2d6fb809016dbe0c1a29fd1d25cc83125ba7d0143e09203f9e34 +99c6d07cc78bfdb82f72c577aff1045cd2ce2e3de0300283ae5ac540d498e467 +0e3718e3dac6dcdf1c7ab2d5f75c5b6e56bc32d8ddace4ce7f9272aae188f3b7 +d6d31b380592cfc0de45eabdd87cfaa15143cce738ede40bd9a06db0b3d5f570 +be5b21b328b3ac4ff46abb190ec17e73d31af389dc8e887280f84caf7b317c27 +38593005aa586b3c4918fa95a9435e45db40bb52d2f6034686463c87280b8085 +877297a871dd11fa1d782568fe813cbdab6daba828c1c264c3db809cb9da6635 +640c3e991dc41cb1841ea1556b7560d47526bdc012a8f1dacb30f38ed0f4721b +b98b107526258d66804fb0dd4c52d827850d8f0a764a53cd81f66269a8cc114c +06482a5b2b752416707d28e88291bca02b7746161794437f61e7e3353ecc92c4 +151af9a2f0b0e0e7b8be3106fa8b455e60d1b8e7a30a45922fe00f7ac9031be3 +b9e1dcae83017ffa27f196e1b8da6cff1bc25c0d776dbf675838c24c57a3078c +d2f6dad8722aa8997078f22bfab7e8f995538174d577c28d1660e5484270e63b +90ff29111a71bcfdda204034ad6df026ba9fe61c02bc99e0553cae82fc1f84a6 +f8c744cf34a92b3fa239b23fa2aa469c5765c02abeea272fc928d24714c14ea1 +2dc6871a82973f1b57a2063379dc471f0dd0684ab5ce9ab8088512b548c0e96c +59f314ee81f9ba0a793072325d5b2a478eca04739746 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F122_0 /DTUUHP+NimbusSanL-Bold 1 1 +[ /.notdef/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash + /ogonek/ring/.notdef/breve/minus/.notdef/Zcaron/zcaron + /caron/dotlessi/dotlessj/ff/ffi/ffl/notequal/infinity + /lessequal/greaterequal/partialdiff/summation/product/pi/grave/quotesingle + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /Euro/integral/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl + /circumflex/perthousand/Scaron/guilsinglleft/OE/Omega/radical/approxequal + /.notdef/.notdef/.notdef/quotedblleft/quotedblright/bullet/endash/emdash + /tilde/trademark/scaron/guilsinglright/oe/Delta/lozenge/Ydieresis + /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown + /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls + /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis] +pdfMakeFont +%%BeginResource: font VXAMRV+NimbusRomNo9L-Regu +%!PS-AdobeFont-1.0: NimbusRomNo9L-Regu 1.05 +%%CreationDate: Wed Dec 22 1999 +% Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development +% (URW)++,Copyright 1999 by (URW)++ Design & Development +% See the file COPYING (GNU General Public License) for license conditions. +% As a special exception, permission is granted to include this font +% program in a Postscript or PDF file that consists of a document that +% contains text to be displayed or printed using this font, regardless +% of the conditions or license applying to the document itself. +12 dict begin +/FontInfo 10 dict dup begin +/version (1.05) readonly def +/Notice ((URW)++,Copyright 1999 by (URW)++ Design & Development. See the file COPYING (GNU General Public License) for license conditions. As a special exception, permission is granted to include this font program in a Postscript or PDF file that consists of a document that contains text to be displayed or printed using this font, regardless of the conditions or license applying to the document itself.) readonly def +/Copyright (Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development) readonly def +/FullName (Nimbus Roman No9 L Regular) readonly def +/FamilyName (Nimbus Roman No9 L) readonly def +/Weight (Regular) readonly def +/ItalicAngle 0.0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/FontName /VXAMRV+NimbusRomNo9L-Regu def +/PaintType 0 def +/WMode 0 def +/FontBBox {-168 -281 1000 924} readonly def +/FontType 1 def +/FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0] readonly def +/Encoding StandardEncoding def +currentdict end +currentfile eexec +d9d66f633b846a989b9974b0179fc6cc445bc2c03103c68570a7b354a4a280ae +6fbf7f9888e039ab60fcaf852eb4ce3afeb979d5ea70fde44a2ae5c8c0166c27 +bf9665eea11c7d2329c1a211dd26bb372be5822f5ea70d99eb578c7befd44cdf +045a363056e5e1cc51525ea6fc061dcebb337208eff729802376a2801424f670 +0e7e6397b28f15bc10b40012b0a3eaeb2693e8f7f627c4c9c7c6c5bff105c1e4 +1b2b9e8f09253b76040d268b80719e1b3f5a55ab7b8e152a40e590419249f2e4 +c36159f8e54b532468e36965a38646781ab0b7f6a3e851fd10caa49adfc1e546 +2fd2ec6150dc6e19523050f6148348a561ad8d2e2721eff8a570cb33460a745b +926c889304c09753c2d78fb0ca95dc6de5b8c524752c83601e7e9f73df660674 +f05ad83a166da9be89f22feabd4b2665960f6fb5bc32928e1230c212e5d69cee +0b3311a1738a11747ae263106916d8e95f25b25b4bc6afb03b79abb95dda518b +41a49458111d2a1433c043627ef9460d324ffe22935f4f6da88b8b91ae95b34e +08408a34ec8eac3f65b6ae3e3e2524867ee9d29068f81e4372f4470beeb4d6be +ee4df956becc0cb77f8490117b22b2fb75c938ed0a5e208d88bc38b2ab8b9cfb +f1d53084b6f43df336481eca0aa2d5317bc83fc0e1d4db01d0b7707eef217e94 +a7f985102ded27d8e8b009f7ef6db91b91e78bfae7bd688e10b3dc9ac77cdee8 +47aa4dc8ec78241e593d26ec7a60696151a2ae5325d736e99e01bdcbde69579f +92eeec224b6757eedc64a75455bb665df42a0e4ce7b99bf3e7d66f8ffc8c13f9 +d7a1ff7a9d5ff7ac43396779f11c9b008c33a2043d48b61b88b03104b1425f09 +675b559ca4302c001ee80d2b739cc0fd1023bf4f1ff9c01e892e59cca7c26011 +b8e0b6d29cc29fc72792fda5e7d5d88ef98f9dba960c96534c399c54865eab86 +0fa2e0d6c7c44b553eac1574d55e7970744d4792fffbdce6fb4365bdbc2965bb +2e9edad9e0ebf0b620db415ad98297f5ae83d9c710436657e74d26e83957c745 +89834337035a7501803947f6880b70e56a3a404c62d57b849d28804cbe0f5884 +435a0e12dcc9ba414abb732bfbae237001f557dea5e972ba0838a3c7c9eb75aa +4a050da0a529bdffbf9011c360564fd17a02c18860af6b86efd4e2c125686c9a +5e114e95c71fc89a5de9c589bfe5ac0480cff716345265d2435edae67cfc4801 +5bc08e7a48d683acdb91e05f469c0c8919d73a5d07a1ccb173e30e76680acb09 +02a40a3e11916198bd69f1a26e88330f50692d0d5917e99e7a01b327413e24aa +e98ea484e45897e6ae4d6997b6e8bbf61c9406e916d56985cb2bd297e8acfc6e +cf2d2281ad84696b7c6cb584bd85cc20ba14add3bc3e25db91124c0acf22e902 +3cfbf04cc40de331991e9075d22ab5ee0e849b340050e6c417c664a782d05549 +db2ef572f193b1c12b4635c2b358747046de5858ec32b3b2e79d42750657977f +acdd2ee5a7c9320d907438dba63aa05ed410fc7000f53549091be71be45da4ab +a315f95b724a60f17c70833e889cfe7ea206a7abc4393cb6ef47be3700ba5638 +6831391809ef8384aea8c22735e8062a9f9101add125a321fb65399cbcd9c9e6 +0f46fbf271b2b1ec80832cc054bab5ca80d4561da0a380d56d5cb3d90ae89a19 +48cd824eb1e7ac6127a6dba3e8ea40f00add89749d77ec0eebe26fd6ea5d8cce +f7239681b3d94898236ae92ff3912e0afe84b6c7e08134c158b640b4aecab5f2 +a90028e67d33df31b461a2846f83d90979bb22618e2a17c5d159fb59d5177e12 +edf1320f596e7a4c379329adb367f92bf2869a9a97398e0c20f5f017ca9db7ba +b3bab72b87a7b6bf4febd03132f9075c271f2054078396df8403dc91461325f6 +12cf1421f3099ccd799c2c099492c4f071336d985c0c360b2f5a5877fd00b6f9 +2e5911dddfb31d17a60124ee8da6cbda94196d7ed42804610e4f730daf2f2d5a +b767c320c62543e26534314facae006ba2064623902c8ac479eeebb609e8c3e4 +1516ce412cb410bd026231e22a9cd0f664d769e4e45cbb75b7341f06d8e37285 +beaa9ab71aabe3cbfe5a348681aa246047ca29ca6b442feade254c7582d32d3c +71b5e645c82e92f057eb5f859bee23daa95c575edaaf9896d6c10980a09db34e +084c8a754e31b618c6991baa856cb86877044e10c2f189b284e3195a2db6b910 +2574e2461d2fae65b7321c0093a2a34996c0b77123503e9edc623dd02c44fb76 +3c550840bdf969582d226510ebf89944e59684eb2e2c463e69702266fbcf8d1d +4c0be400495e227b9cb21c8086f328782ca7294dcf3ecdc1a62714143a4c1b98 +e5de1dd554fba60571188a58f0354a6b9ef580689b78a0c8515ca05a35832616 +7e0a90f68f3c306ab60aab20872fb167673f41e8e87ff0111f579cbd0da68b56 +3e35d2ebf9f28b104082e36187373efc7a33f62d3fe4a390b63a76e9b2531871 +6bd59861f51b561dcc115192a6fc22d15a5af03ba09cdfa66b660cf4288e9d79 +26e797256659b0ff64bb5d900990c3cb588e1e18810bcb009a91e5f4f8d9db1a +f2a063bdabd9c3332f4bdb701bb94b4fd24570b440ae74b8d924e48e7c2defb0 +53a19e5b4df39abf4f6fc6160b5fcca00608422a3091cd03e726b1ea1d203b3f +c44173460b490498eda3121881ebd21cb5b571d21a6228cc0a1b035ebe97f26b +0b58179bd22ac950ec3a98458051a874297cd6bfe731c5b413819503111f1f6e +ebfb5628c955f5fcaed76f2402ce351f77e471d1c9821dad627ff25131590577 +5ff9335dd28d85a11bf155765632b34a3aa1df9c01134bd8fe927e0064319951 +e2c1d374c9acfc30932712a5c3e0fe3c7e355e3356e9135a143f1b4e2738e208 +8f44633dd9300bafc770625a64b2bd20d4f672701310e5d1d5b2dd502802539a +65344601924c473b7618f9b87bf6eb49474fe62891097b9b381dfc9dd22f6ceb +340efd950b74e614a2908eea7b0d395e15943d0a9072e2c0e6c91d9141c84281 +6a59f02111333723db78c2c287675d73152ee3c63397f5ea6203c707568137e0 +12438b86ead16d71a0a56d00e6ace9d80aff646b05d829dcf08dce2fed1a17d3 +83a7c9e7c2a5caeb38bda802e6696bab17a5d1e5d6c51b6371c642d5588a2945 +1f3c8b0cd56806531579f7c0d10a9fbe254ea910522d955c86ddd693b8660bbd +17b2b23fea57af15b1720e42c6de537074c071c50c114ac54c45ba2fee00d13a +2573bb9243648a1be2569cf68ff78e4cacacdb34dad918a30005c31f17781633 +6b74af8b9931bec0c1892780020c1a92470e3ad7f1bb6ef26c835f13a9c56ded +51df4a7847c993b88b9fda9a8955d8bdbf6ba773d06645e292ce26d9df4bbd4f +3d20f52161853827837c837f33425990818b958adcc3ae79b5791ff04daa32fe +54050aa9d34606f16c7763de770cc33c9acb60e5354d5a27a687ca6e0fd74a4b +5cffeadf6ad0ba87b906c09201ff65ce6c3f620bbfaaccbe54da884b87e906b5 +f5285d3841ecf78f0a1ee4a80724da3a4fd49ffbaa66be3402a2480a6f8fc164 +343a369e2b8947fd5f58a4697234c742685421ce3d57398c5ed6f6b049fdf39f +6870236751d9ef2210e680b4d8a6daab758bd7fa7da9680604e5bf85d1826611 +2ca08e8922a1d46ac853f4bdca37f7fe80d2d27854012e4a8f70bd854ea4c189 +ea6939096b56168aeb971aaafe1bca667137a76761cba2fbffceafe3e98d5590 +db3dbc44b3f9d4ef0419cae23086898bb25a222eea19c1a760389672933ea7c2 +8b31025619bd108b79d51d54e23f401f42165f0d513bb2409ce66ba3e83fc000 +4372873eb8b4405a8f5bd88cc2f21d2d60fa4024707869c5fd40d94028ed13b2 +5762cc7924d100d3ce0dd32cfca124ec1fce4cce8c137070a18f05cd73809449 +bcdeb0ac24dcf63679d46aa8b3a4a5d0dbfa9342716619cd3683dfa7a9d6683e +5a7a03ddb47833fdff8935f2f004f58ede6447adce4fda1b734c75c52d16c406 +9428cdf68855946014584f7fe49b03f896e0054cffff5da4728bf4ce1d892052 +701b48b81f58f5ea344e8ebfe13baa70cb43ce4a979d8225ed78417648672e61 +07eb7b31f81cf52b4136288200e640654e83534eadf05301faf2f3a859772c3a +545fc20429119ff00c259aa582af4e3cde1c99769f4e433d9b178edcecf142ad +ffaa6da004a90f53e70048aa8d15a26bfcf7b02ed70bc262d165e99f87ca7424 +0eb98f3d7fc0d4926ae43c8d322bb9eca24a4c45f7dbb0feaa9a900e3521d6b3 +87b52a30acb29c914b06793f19a1efbe3be7d0b8e20cad99d292c315b12376d5 +655121189a833132715762ca7118685814f71aaa08b89e466c7468bca01bd98b +63ec7cc3ac41dd06c5bbda86227afcc1f7796b5f878946c135bfa75a98db1b57 +0f38c49770ae23986ffaedbf6644df58a252c29ac821f4584b96b5ddafa9b3a1 +aa0ef6d17fc1e75916753bc8c799497e1279ec783ea86df307cd54b58c2b3ebb +fd722006d127834b089670e5f1e7ba8bc4a0f6181bb4efbb8f99e4475181449f +2fcb255da4233f7ab097ef0108ba3fc12cda0618870eacb9fe4195dfab182242 +bae0956d09e388d10da2f940186e25c9926886e9806c70105dc75259fb1e5da2 +675e4e114f84862e6b822a10a9d364b1cd13dca3d385b83499c715ecd7598766 +b215910f002358d592fc36d0bd482ee9cc338378ea1566839526a5783f250818 +078b97d73b1d62a1aad3d5a9753bfef23f7b3e6d5bd318c463aa04490b9063a0 +e83e3e68109b182720d2b1c13b498f8f495661c0f4e6455b96a6a92ff806f1cb +3b1c6eac82d9a687b83c572c42df22beae31d1239719186f14ef637fe4e7c7b1 +fe8f4f1bd8367d76d467be95c394a818198d922bcaeeee371fe17e396b27cec5 +f0554778587fc7d78acdf317a8efdfc82c2f57b6411b3ab68f96e3e7cd321a6d +4783435056ab5a0095726435be6885bf2784fb2cbeffc0f8248dcd594d34b21c +98e67de50b6876c3d6d4d4ca7ce0b9013ebe754b104dcfc0719a10cdd9985e19 +2cdf4e88876c2dd4e79e23afa70ab5b4758af32ee87b8415b881ac15c5c3e1bc +d17a5b961efb3a8dc987deded6f28a240d66f004ad05ce1c551e29b45668db2b +305c9b1af5cd5388a0802d80f18e0f4bc8065baf393ffab9a4d674312c2033d2 +7c78b5e9461fb09b9b2caaab70ceb3afa574c89bc620328211c85656f63a8ddd +97c827297327b7980c2fe0acb1c34866aa3c5d7408e257eba3c53de8338bdf96 +cb7ba55fe31bddbf7807148c0a132bdbbe8a2c21a23e11889da13e429914f7f5 +7132936359a0cc65e5993caf52902f76f75d6cb46dd20a3c0be80d45f2c746bf +236733462080fbdc8c5c1dbe9781f45aba74af8033a6ef2bdb16f7b0930d6b6e +7ca7fac8cfb2dfab8c063d961077585d24e8fbb5e0b0bee9c4509b23361dd06a +dd25767833b9a770780b311f608cae7adde000297a2672211f0de8cf7f5fbc62 +78faba25d035fe3a7cc3a4743c0efe1c4a5e9cadf1e05bc7982648d5c9fb2992 +4a9ee1570ba2ab068cce168552299361d62a2bc2c0da48ee94d1cedf1e2d29bb +43864ab5b770a14c98a432ab76c17998904f052a50ef845100533ba5cfb24c84 +da53581ec4f2201ca9fdae76ef365515188ace4cfc939ad6d193413ca7ee225b +0137f4637f09952213be725cc7aec579b2fe85f7c6af18d70c4fda0557567e64 +d430f09aca7bf28984977ba0f5849a5a86729d5640bbe4c30b17ab03262a02bd +8ee077ead7fdaefd37af16007d83714aca07fcf882adc4792583aabb279579df +6741f637cdf8598fb5827528771444b0aa82dd5e00e70edefa7405a1d8a7797b +ef021a53ba68c7ff6780c94f1393d1745ab1fd7c728c6112766a3c2e21dff002 +9e45a5c5668f8b084f22cd6a6cfb056cf0f402a73b2c02118259352eff6d680b +877ce3024c37d532c186f3d4a97603704cc0ddb25cac00aeb4cf601f6fb45655 +8939ab962cb9e16a2400938d226056535ebe5707cf0a8678b54e6e3a103b2eff +0bb7306d7c7c3f523b2aec267a5f1e3f99208d8ec9ab27d658c26f635c2984ab +5a4d214768c6dc775bcc616838159aa10d5bd93cfc8b2d836eae5ed480fb6ddb +24253a62a1b798bfa51b068b6888b76d2233b6fb11794f166254cb3ac8cfb650 +429866dbeb8d09e6d03889899a4e8bfc9a855ea4660f928d0aae8247eec1668c +8e798398d53e52a5684caa59c47cb38c8f1009a8aa12a269a587593874c2dc78 +0ba989078910f3d70211147751e9f7264d6e64f1b05410ed3427bb7d0704443e +f2baeb0fb9e3f1c1c14b178e716feb4644240447a3f02211350e36e1a586a042 +9ab336c6b44c0d2977294e704e8695b6daf079bca033b6bd3485eb7a78582fb9 +373716136c63eadbab3a2577738f553f81135829f9118f4bfe20cd51190bd7c5 +17035ebe97f26b0b58973ea9b5e0d111d9eacf2fa54b223c4f40c139ab891a41 +c7d5ba5338bfd58090ea727c3fd9d0c0217c05798787881d07cefe019518ccdd +a7ad72305f06a98717cda80c5daaafc50e3c6d78d2b5d851beec46731a6c29ed +ddcb9089de5cc2ddb696d3b7de3b67f066527ae22cc1ae6285dd1ad42e0809ee +65812268d28e7105859262e9368a3aa7fd0207d47de5ea5591927f5e568386d3 +a61fcbe872945a272c75384be1e85b26aa094704715f1957de37a2fde2577ba3 +85000d0708fc918d52360cda828cedd17cb7d625155ceb6931a29025b44ec8fc +3678fa08027b20fb9649d07f01484f2fd2e1746f290e32434fcd4d15acf0708b +ee3fe9948d3ae141749b47810558d71d592735c1c86ee375be7413b2cf462660 +0b115cd043ede5612ab895cee0909da8d165408cd5c4c34114ee4d7fab4c37b6 +a31cb829c4bab2dd04b1a7097dec24c6429c13482667116522f94edc99de551c +a693362be4d277e12829bc466e13d09841b5d9af504be4ea59e9c2459eea5ac2 +c678e3fa30cdfc5ab855d56c1ad8374f9769a6b575a1dee5aaaab4f716dcebe0 +0fab8b0b5522294ce3164f8446679fcc7aff5bf49062cea58f5c661a895ae753 +8891536066f8416ff5e357fc34cc34d6b68abe2fb2c540a7123bbf90d2671f65 +90515b96cdd1bd2c1396bc15503caa4ccd3ce28e0361801bdc5da98887b2c39d +b84a0a4de7859c7da394acc497641ece12ad8a7d62ac5f8e6bda0577fe64d581 +35390a37a1570cb25b23b747b236f3f2606a3ff6e487a78069a068e7af13a8e9 +315016ebb2552f644065408a69f1bb6fed50486b2a05d403cd56ec5d3671c9ce +091995d384491b65eeaf33078529238342c32a4b81788c31e62ba0614bafcf9c +3c1cd422c605740a8939487e26bb9233d4cde68afe7a0cadc3aecd739c9c425d +09cb50b4b4be28115ba7fc59b541513cd6fd08039cf40a1f5b90a8bd1263806f +ec35aaa4100ecc05416ece2f061cfdbc321cf3324f1eda91976cabb8d2d9acc9 +b93c575c363fa691e18215311431841de8187a20d6664348c7a8adb06e867d02 +07bd48fe8067168c4412fc80cdba62f8b9209f5407670a26db1f7f5d67c4d227 +90bcd0f1e8640e5f9288c410487290808b88f9421d506386ac95cd959fd1ed07 +778de2f62958ff409d37332aa4ba88c735f2a56e4e746ee98b9667072874b21a +5f98225aeecabf5cc818f3fa54edde178b40a1b1d6e2f900365e2b503346b213 +ddb43a269c5a973d303dbf615ac3caabfc39fe2144681e7cd633056bc77d95a9 +16f54291575aff7a3a4c13eca61a8d261b3a74307aac38b50c0e55222626e717 +db6e122547b3b8a766fb877deeea52ece2e74ba02ca7676f0e037cffaf287340 +c19bbfd9378d8e898225eda3fbf814ad51f976241a7285dbcc62610fe998ebc9 +7dc5961af9d70a6786e8922e7932a539f1606101440c6855f2284eb34a895cae +44637b6a0b1c6386c21f11f2e7ee2adf012ea6ff35314981226505bd4b0ea25d +371be9fb6fc0425d8f374cc51fcb15600ff7a49a4104bc29a369c8336438bd4a +45b7c8fd52577a49acdb394cbbc16c844ad99f85b5af1e8018900d50862d7c7b +045ee4bf7972eb05aa5696a004f3ec9be95c4c14180c7c8098a3a0443c0dfaad +91e9c3a37509b29066af112db77107b9daf2e45e72dcd78660d5d56018cdf1e4 +ca787593c31a2d6ef925e37e4ee77e687e149bf506664975ccbf5fdc20b5c306 +984208ffb9ec2f79e76a7a029cf5981fd2d07176083d7fa0d9fa7b1e6c6da9fe +423bf29011478ba39fbdc7e77ba230ee7b89728c9312602dda359f1ee65ba362 +d1f36657943255d62f0c84fe8a630204a8e64d8f940e9ddaf3c2ddc16fd131c7 +f302a2f9fb65ecccad4616977b2ec724fc6a4c39417962e0de1dcfa69aec8a02 +07179266935b655d20af3d45228ac3796fd2b7b6e0580904a27fe0c8023f4fa0 +fd70e469e5f309690c6ab737e9e0dd1db57fb312362b64ff1955401395b42086 +07e7f9449a8953149f324b4d5785c2a0a4c28eb487fd0bfd65462a1a4a741be1 +b1876330912edefcace1dfacea7628d16a4716d3989e1b31830cbc2bf9fce144 +9f0e80bdcbcfcf477a2c30a72ec227b20a0af16fcb8356bc205f18c6088c1d6d +c579f1dcd23ffa147d72821b7a63fc011d5718fed41b16ea1d83ecd8d2ade289 +54eaa105f82f777b6635c160d0e3d67fbff2080db2a99d489a070d865c39ac9d +2a88ab5fbce010919edc0ab213a09038fac6d3c81a4972e3c5683f49480fa5fe +b8cd3279398028dab63ef7e8e1df85a63f93273f187f8f8619c14ab824c97c3c +70d06fbc0a1b4be1b2b7f11ef469adef71617b304b51c462ab3c6c0e831c9ad3 +cb80c5e0d0fafd079d7f4f245d542ea892c6fe3c3d6d1ac2c92371b7a33aab5a +ab8375b4cae9661c9d314999093b2a04ea1cb671c9f07ecefba615e023cb0f72 +b6eed231ad31b1f4d03e807e56c1e1663986eed65e3ee47a2dd11c1211236973 +4b4607a6570f534debc72ac06dbb2149f9efb793a917b3b604271fb764fab871 +f7aa5a5fcc54533951454fe7afa29cddef96e951aaa9b8eeb3f9b418bd132974 +c601b6fa29471dc34814fc81a1e1a5155951c12022aadce5826302220b18dfc3 +d30b2277d08e7cc7a87bf1b8ec4507b43cefb117119d86de3be51bf870390ea3 +d8daa3f74ccd3712d1c00261e853dc3078dd411189872a50d85d58cee8fffb1f +0288029490412f3e58f83dada08fa695b18efd0a4f289705385a411fcb2d7a47 +ffe38977fce18188c0043c448d27e160ee752be0d44d0f83b6bf642c694aa530 +e223aefa3fdb17ee7aeaba75b9a86d7cb0f50ad4d5ce68d4ed48cb0c188f9dc4 +34548b48403078f63079bce8529f910ab280ebcae7df9f824dca756f9d647dc4 +d42da412230a6231307e7495424f98c9f129cc4a326a3dd8e476e18d666f94fe +53edc87e47f6d84abb643ff3b4084437da26b4a298f819f4b6823eddac11bc85 +b9f5c5d0aa1e7b0ddca82c8e01944b3ea48978c1b8f4ff47779a5523f600d33b +896b659c31f4f6f7decbae0fe1f83dde18f77f53db140a36b0f6f4b883ebcbb2 +b6d353bf2ca6102173b6dfba0f452d011f6cf7d661a470c3c5dd189c1e83fc4b +9372ed67ef4ed9a5b98f85c8d73d490133b7362ab976a385cec705a2eb89d7f3 +2fbd60c08b86a30219aa2988f79e6386062be839c1f9d30affde82cade3494ee +13041755e76cc07ccb3a4a701461290b5b79728eddfc63b2ed5cd4bbe0c4c365 +75488d590258ce2084f898d7c58b3f65b09dea2f8d4f71e80b2a2f8f31d5fcef +7a7744b64d7baa701e473b85c65814b0a93e3ffbd7b2af85e00ffbfab9bb7766 +f444709a47902c919bd2a4becdce07b64053aea1058e26024b46153d6bb92c0b +59861b2ddaf3d38dbea5bfedcc49938eb98188a3c4dceefa1f308559f7712ccf +288219c6a3d4eefb81a2c5f154990fd8f09713a0531017d74b47e1f97aa6f0f3 +92ce5bb7475c676247d57bb14ff676f11a4b5b564ac26bfa9d85c9cb0414fafb +c35b46eacf74dd964fbddab28fd7bb304b9bf4e12cd15b3bbb163dd66e89f24e +6485c6ea63365d29907f6ba96d313f9b2ab7d175d549f4235653ef979a5c63cb +6ee50cc333387a0ed88d30d9fd2197d31a0894ed0a47b15d92dca463a8c84b3a +986d396e6530b2e9ba127bb5662ca948a8f0c563b9c868644b8d01064db6aa72 +090dda0521e6d778192a8c6d4d4639e80e309194cb76fc5d4615f396dd85b06f +71dfc7f39a259e322c5e7d28646310eac92e5f6afdd6071b21e6664e1cdd3848 +c864ce0e380fdc48b251d52b5094ead64d380b6818e2c8b1a4eb8f9c18adde6d +6e4ce1def2ae8f2649f1e5aaa05720a358a74e181568a10b536f68b7a0292787 +12c34acfa5bbafc4aa3eaa4d8ebb26e20bb00d228b4eac4a163e0b72899874a3 +f85e82c396d9e2891d8e0d6e5571d4ef116879cd2f5485dde4b9d40f638a3a95 +de5ddd14adbe72f5bbadf0d9950a195f64fd3209c6d47b46b7708f855da96cb5 +e9e1260f6699d945a611a7ea348db3c86be4b32fc2687f15c4c86957018d428d +f6244a1fb6a99122bf89d7add01c80f2b2bb2c7168b02c400bfc98d65394948d +c736741f9e0244fe096571f087c5d6d7d022c726a4cecf37cf2ddeb1e9d77098 +60c5d43121bc2e4b72a2d895a5ad2f449196aefe8c01784323de3804363b88c9 +1c86124f431e6dd0744c3d073fff4bbc2b98bdef713bdefc2da4e0e22eda76d0 +34424ce13529bc04c078dfbf8b3efd96cf662c4e151f15d4f8ea52641689d4a0 +5f7c9ec4efa5119db9e3a61e4a669c29348a1e71382c093499cd35d7d1227a5f +5bc3db96823c167100074c70040a55142148196567c20c7eecbb25ed6e31f563 +9add24d52aceea4b88114eb6dba9461c2e5262fb9529e9f6f0bde20d3e209a8f +0c9fd81b99b00d268f764593baa894f7ae50634766c922f751ed183aacaec03d +b7d96d012cd0d111904245be9537edb0f8769ad1a8abbd8d1cbbe5e79c53c00d +983c69d8865e93b6495a2f15ad9ab1da7503bd5b85ebe27aba01f71e56482be9 +d4342ac2562d8e6d1e4146447561ef5068d17306d66a52fa41644897a9b161c8 +5dd4161aa3d956e7961aa8020467e76a833e01c974e32aa2b8cf27d62fc81ee4 +d74649bf9530306481f430a539a95dcc2502f712947f6a68dda00589ef404132 +1dbc8b94afd827bbd5f77820353fddec5d98fdd256e858581054789781ab090a +816e65ad3dc4a68b4ef2356e7cd2f906a859dad680d649457bae159f91805d52 +fb6dcfa5d0ac6373fa8325a817563bc9ed89a17d8cdee9b7516f38908e426f05 +1517eec7941cbadb22390e3e2e17d62ca67f37d01377c5a1e09bef5b795b4446 +54b383193351e05ed8bbd8b0b138cf62a428c78744582eec90a41c3bd44a4e73 +c9b32ea4936c211269ba5f883d45b16681f8afa0646a4031ef69cf4936305336 +5758f50534e6974342f4d232b5024dba0eb297e3aa3e9ef0935bd47998370420 +ead844c7e336288356715ceb8cb8492ecdc8fd8f1183360fa32850051442f4d7 +c0250d658c633de21048f4676a1875df6a8a61f0fc7c25dd5acd0220798ca70e +f09a72b19595172afb9085b9a5971ad1b9a3a2508884a3bce88c984f58389620 +95584866c59f89120c7f491cde35b9d179f11db0d3c30370138852050cf14b18 +c06dadc218335bb465dd88304f1c1cd11062ca72649491fdc62d571c082cc816 +261444906d399760159f6b1e6df4b42a7a84750aa61c034b11a6e7eddcdeb54d +e1f5151042a8e9f6a23a81a235fbc3908a85a6b05d8162bbdf3a672715b6fcce +554e98df1f4583e03e456469890f07f83bc0a8954fc5edc7898f21f6917d30fa +36faee98f622ef313cc8431931d83d271cef880dba07b832a01384994e964233 +f2e29de305c3863191f877dfba44214da68bdbfbde1e3b8b9659d7800df5bd19 +28bb1425a51abc317efdda09d29e04ec8b17bd3b78085595120b58fb421916c6 +af4b92776ef8a8211cc376a37566422bf2e2a840be57a357ab9b9adaa20600d5 +c49f228d2f7bb606fcfa867342884fcd426a72ca4c5d09612bbe26a2d9d3c8fe +15a55e095b6705f2a2f2a00c9f1cbae16b91e13798b96d5ae66b5a8d1cd751cc +9747bd951a55ec3fcc11f58f8afb40913166ab60a01b697507fe0753d085e5a8 +8153cfcbb70e29b7073ab33f7be2b6bd070ed974d0cfe4d41f7f57f05cef38c4 +251aa826e4a1d37459212c1b411b6b51faa564da0ff48ee6402b3c9fb77d502f +61feeb32602da2b5fa880c537f60e1394571392c3fba4d110ff47a42d923c153 +f7a83bc1ffe67cd11ff1a763950f2d7b6d9575f45562c3a9de6d4ebf59482d7a +716f39eca97fd68be71aa73987d570ce2ddf953c6ec97cbb76b147ceb8973564 +7ee159434e3af6588f47ff9722b7e90f4d9fd0c5b9e9f3a14f9bfba60ca6556b +0473dc073a961731d322161500e15ada373d503552c0b76fc6576088e630cf29 +b9b0c82cb348259edd482520a84965a53cd673138aa57c32e41fcf50fe24a447 +4ed23401f43f5206de7fb3b6d1750223115919d85b54eae8298a19212e5c66e0 +c05c6dd7d7f8dd877123205b7e391a189e11fc30fdc6532fca87770985b357a4 +fbf9c5d261a4c998e2fe8eb96e27dac9daf1d3f0ec7422a85d9c7b241857209c +f372c03c1100d8ebf3ce4ab3c0efc1f979c5999bac6d4abb6abab1d059c53f7e +34f972f56df329bdb8485e39cc98cbf20ccb70a2a3cfdad4deb3267578b02f0b +0340f42bac749465951198d2ea2bf7995852a50b5876597e55e1a1977b9e2f0b +8a8fb0f03839dcf6bd5542827208d443ed4b9c0145e4522274a02e4420f738e7 +962c6d9fee17520ecf6d6772e5e77d6ed395304699dd65d7a610d793e38ce3dc +e461843d5af1e27bed5652bb84d5e85622b48bec72e1622ab11506ade702cb2e +8ca3ffb8add5c2470207bed74f2b34faf8cb61dd5e0bf54f2b8e1c7ea1fee81e +0e0a16747443630b04990ee1be9db5764a580222b27332072e74a60ab7b789da +aee741eb538e3ac7e38b333c7f6dadcad5b9383ab433359862dcb30ba53a413b +5e9947eb637e78eedc4b8b17cec6b82f4cb8d2d71a37921e69d428723823ec95 +0f683a6bfb55d22dfb161e1d6b6db49dacece6e43ad2c51a70e6342a85169fde +f8060d7da7e20b4db176bb862c29749077d7104bcb313e5c886a01cb16f11f62 +984c5f853516c1419df929d29eaf4490a3aebd24358eac006a594afcb839778f +d0925e2daabe74c7ddcce9a4f454633b52b445fea99105fb0699485956fc737f +25625d53dcf0b9e2386bbf0900e0e011e8adfe162d5876a850a6507512690d2d +d1f00992f4dbbca2c63cd70b16dce15d1c128b9d6881f3f7ffeb68d7174ae769 +3b6f5e02523c7f046de294e18255b689d2ef529e6dfe489956afc909284a4d43 +b0ca1d9f8b9be4e4da535522cd9b6e64841c81138ee358ef6768e7f78af8033a +6885457da6ba42cb4bdd4f35233b8e5ac02b7d8fbf2092bb8ce890decb6e99ca +152d2aa56c5ab4179ba7936c74dd6c342a392131fb96c14c3b24d9f0e4d8b1cb +862ea5e7b13e204c914bf95f55ff32e4308fe5b2949fa454560e8dec474ef52b +65bbbed017d5eaed0d89a3c86fc63bf01d3a6a10a5fe389b1af013ebcbff2a17 +7f6e854dfec5dbf19d4e977a07a42287a2dbd42a78e589a002cca47eb865bd5e +601a98bb3a8572f20ef1c0a2b3500f615b1b8f9b04215f91acec454312ec1dce +08f413b9e2ddddcfd2bd85125dc5a043a45c0b9d3c86ac30b21f34cae2d347a1 +e93586eb95fdd3d1db7157b21b7ed1702d31876a1cfce58d619a66df8ccc3116 +319854a57965fe23d2d2d7e02f4d95d810e8a13d29872274fa6f48b7333b743c +7af418c1fdaf467acd5483a47c5e99a7bd81e18ef98763ecc08820176a109145 +af183870faf171a3c24f603654896e2d1b0ac6224cfc765bf747e194cd18c740 +6c61fd10b6b7dce9c0a6577a87ae840e88f99cbf1c1d6cc83623d2fe80bd710c +ec79256f89f26b45f75281d3de9636a134f63e244df4a623c63a895fe66e1464 +1959655f235bd056d65e3a50f55a041447594422eeffacce6af7cc9768f72158 +18ed408e47358ad45fce20e4848cc38f70943755e9233ac711e663f2c7d77b46 +c878e70669ad30ed18b6f832e4d7f54a23c837ed440ae97883348a0b5fe95232 +779187e429b6f855ed7cffccc8d6784d8bcd92548e3257ac87231c36f119ddfb +f28ab8dc8b253a1fa09f016887fc29b6659b40bf3dd9db6ead8c8c3e504b10f8 +37dac82a816e06722397867df32fa25da0713e92ede9e4d41577ef58ac70b402 +a4427a7c86f7c1d7f378b62db43ca4bc3a8669f6e924d719f18799d1a9e5969d +76bde4fc976074f2d623721d38e3f5c73428d6824049dea9416a450be02dcb55 +908e37faf4a56a36519311ddb3d1cb66837c2964a2dd0d34a23dde43eb30c88d +b6ea541956b904db911d009f0b209bfdc139f48878c811ec38a21692f9b866c0 +a59d9d736d429de0db4b0526463d0348157019a262b2c3e0bf54095d06110593 +3646fcd24134d6b3a2a906a891187692967e93f69a54ff3ab8050418585ed1f5 +9822b134f8841589fe146d05ab00c8e22651c43723216c053851a5d1f9bdfaf8 +59c55523acf1e394d27500a1cdd551c773c9a6d7b3882f31f29c281fb6c6250d +8a1c3c8dd110c1910014da6fd1d57b8ae102b261fb65a3019bd75e81ccebde3f +3e23764e9a5dbe640ca98585da2a4af9de5a5045598a905ee7b82bbaabdd0d92 +bb5351d3a0b3071e8666fce45202af6000790c1c1d0a5bf0c4623b9815b8d3b7 +7c39970a509db6a4a0fface38a60e2dccab7f5b7ad1c0f42a74da16147589a2d +3dadde9bb1a63a4047ea20dde1109f8856bb81184f4256994b5005d654e49086 +7bb8396fc8d807ebdefbb74e9894bf0ec793699f0e68263885581a17c87d7082 +371d3d4884b50e1295c517fc56b91ebb6b4c23b150d542cd0768924232a5ac00 +8a98f5ce9adc8dd3e65f085b35640919767237d0f9703cbd691a987a0aa0444a +5ea0d887837482a7248865cd78b6f665301cb67cceb1f689198821227c1acd81 +3d0a50674832bd33b2672756d5186c89528180e190d1525c3e806caddc1e4157 +46055910cee4f60f40b1065f435be8a39eb454d88f5bc45ba818e5b006e5a38d +29974f68ee1962448f7a9fd83c7f107c7788eb8975dedee759a2bbca40c811b9 +d857cf8e510376d48abd60567f307d6ec471f99b03cc7b5e8140dc0450af3832 +242a353515b5b347774f32b8b6c033adc43b2bf7185480e47c868308f3906bee +e44131b11b2b14e77f33686307842337cd1f9695491bbbdf271b5345c44d6a75 +58c59d6d5bf8b24af38248368644e331a88cf73d0eba9dfa6f80f11af0293bb8 +40d9755540afd18fb03e0b26b6432277434166123d80044808f6f1115ca55b87 +60f82520eb81166f8363b150bac7f45983d1f4ea0b503fa8d041261e2fd14caa +c7db8e5b1bdb04a65cbb660526d8b21eeff68105486474803acc96e7b882bc9f +5a1d5f1e333b2b2aacf4272a05a41aea04b2c18a82b1c66a40753a3690aef089 +b9fe83dd0d86fb7b7045f041b690928b7b2b67162a1f5564117652fa7899a444 +bccc231189c60ceb72abb4038d7d0ab5a027bea7ee75542416b12a16ee00900c +db94b2c89b2345d209cd68307e101cd06dbb79e76c725dc7180becca0eab9f8c +ae1714c57bee7e7f54c84e7a2ab9a2b1ddd4d160cb4825b69c1bf5ee26b18391 +acd6fab3f890d8cbff5ba3666b8d7853652da2bd5db79ad8de358e55a5e02270 +e1a2d09adfed75088a71593ff0f54d5c527518cc767584e4380b8fce58b04ca2 +05a69ee280da655169029a16a3df3b86fc4ab635300397767c7d9ec3b3fbd60a +bbf51ad4a3cb348539fb9b7eb072ece9afb2b3c00e2b91bb40a82d2ddfa58e9d +f40699038c9a7bf930a83996afe9580c5338405108ac04fd713bb22ca2024475 +f540fe14290ab1818d9bb19483aba2f39a958ea417ec73792233ab538cb70e0a +455c6b7e0bc86eab1df73eec1e16a6f95cd23b8f695fd2b919dd282bd1129baa +93fb68080d90c29776bf27fa42dc0721e380ecf88286484417664e41c5b257ca +bd4835c1d64318507de5dc2f1060644b2b125f17aff1b95a37b9b667906d48c0 +9fa7d875d59cb6f7fef2e37ec418540f8f13c2d70cbe9566299dfb80c06df99e +b045dd3baefd87b24316700fa1c9f72157b927052cda3fd2b480df750298d645 +7c412ca39f6325d66c77be38bd8e491d8f710c5f91f432e13f89056940029532 +db065329782579b79d9f6ba60552dbd6a302e628f75e0d3582d25eb03e7deb33 +54790b02521553eb0c286cb415cde225b5d65cb79db060d13afe862d5885b567 +2430481620475f50546ac782370e3ea1c95600a524d288b5d4028be7cfbea855 +528953e607721b7488f7d7f9dd5ad14332b32bbef72240036a3e1646fe5418a7 +1fd206ad3fc75b7dcd9813caf5d29ddbb12d7ff94e37bccd72ba1086dc431b5b +713ed14ab7e9f1bff7dddfa9bf22624e4caf3cc0d4194f0b6a36b1c67e43f117 +4bb23054ed01209d28bc55224028648a4a3073d56835afa9e004fb999372f29a +d76db663c2a29b5638567058904a4933be88e75ca1f365739a65c27bdc195e7e +09cfb2426fa829ca3859306b556d1bfadb5d9493c66e34dd7f63583e4532a075 +532cee2d8976f785d7909093787e8aa5fc7912ca8fa89d346634ef71f98c9fa3 +cdfd931ccc699caa314c402ebcd6bbcfcd3ef7ede19e6c8b5ea9bbe73ae35b72 +e214974b2bbb26a115750327d20732b6f6795c25e4c0b1a63b5054383d428d2b +85ac1f719ce35a18de6f4753cb615aec6212a272d89b3750863536fcf5f791db +3b7b39a66ebbe9fb1876bb089ec2cba092d291aac88f09c720aac4dd8fdc22d6 +4367c4c5330d4e0ed7d454728af2b4801618edada4fa3e5357fb91458dc13288 +7650401bbca16d73bea8cd5127797f92c8b5314663e02cefabd1edd89e4486ba +4d371138ea6a07ce358d31bc9ecae64f409546e9101fff7ec710b45f910510aa +b51eb2374992009a28262a370d42109a0aa5ebbc16d2ec5d58e0a5e7e6f80a02 +5cf8a581f3bbf98752edf64feba585fbeb56b27a79384a22c868693c05084423 +f7cd396cb48e68f76bab6512f76da2772f3d137881ebaf1d3ca6e1c98d54732a +fc24bfe29efcd703c489dd8dcc69da4b86b5650788bfeab8bf66c5c1df7697af +ab33d0c14caf16b9810ea74c32ccb5bbac2613c6a3d946436ccf934a20b81cfe +5e712765d1983bd77cc45612a31c893a5583238c944f91f2d6d1069386621108 +108b0e65b4f6d76bfd0e1158005e8ba53ab48e865e9f6d07835d4e9e124b01b6 +41baaa6cff413e7ef8eed73f1cccaef55a87d71afb309ba162d3e15dda6f04da +2de8db583beabac1e5680df43bc063095de043b2ad4c8600ef63a8090b64785e +5288892b63a87d8c805d1000b6524109a41e05e517e07f0a76466125650b3d97 +008057de3d3380b0c352e70ac04fcc21108e619a707fbf7f59869cc9a2d571c9 +f77114250c1c41dcd527323edb2fb883dabf371dccf42389a260fbf53464bd24 +d5ae5be48163f142733b205e110d77de5cc07117d7d6d347cc8b035fa387b249 +fde3beeeac843c89bbb871114f5313437a784c051e021da4f80adb2d5e392f0e +46068df67f46afeca052378d97597f21c39db6a2ca7c10c57421499da8d5bdec +128109432f86a0ce63ca2be7fd64e29e8392bdd0013d4990884f7cf49e7b88ad +846af39a3aa1ec3c85f21db07952d1b45cfc20d6848536b63d2572f44ff718ad +c2cfacaf395cc64b34290bf19a19d756b38142c6a7471ab436c6b81abed86fbf +8553dd8d5a052f4d53d6124ea4ddf235f4a792f8aa485fb068d39c682eda37c3 +2fcc58da51f74c24bac8db5cf825407f88daba78f41d8ba078fceb0236c2deff +e61cc0abbdbec3bfa099b49cd1218dbff85cc705730ea545cdff4421ee5a5355 +9ccea2cf6257b757e4c6b853a476f0c97ece80a41fee4994b05eec575f87bba6 +9066eceb28ac92e1f4483f8744ede06a05ea038565096458785453b2462d103f +300aff3783f7a2ee1a27cb223e7145b6b74fb5a95a5445b5800d0b7e4451be83 +8a7679e3a29c9bd79be0ce900f8cede4f5fbfcf46b6354268087bb020914f246 +fe06d18cc7e9cb1003bc96fb5961043d919c9298e61dc5c7cb39886e65939fc9 +037e0484b62d1ee35842b3ddb879a7fe175f07451c4456361bb646e5dd87ad6d +ded8388fa78806f8c993bf16f539a4526503d8baf83d1f0a594db7fb1a11e7da +d2f9db98c5d8206ea4a44ed134d784b05ac0ca245b2a5adbd93efa4a566e93c4 +84fac7ef0ad46254101b308dc4e39c549942af85c96a5dd31e5d9a99149f49ff +99cfc5783d2cf9c320640a5029bbd61c86d4a6ae9fee690c5ac5e92d6b07aea0 +31c6110df41e63bd7039d6ba8ea9ef33beb3cdb415f4497245606963da60194a +8383663ba3f3be2d6e0b4865ddddb484f625beb57eadfc694125ee35480efadd +70248037bf40187f54cb53a51fd0a916d0b1a54311f43cb39856b5e4e17ddf0e +54466ad34cdbed8fee17c87f00bfe4832eea2acaf9e93aa5091b62febfba9b01 +5960618d7135ad546cf4d00c8c725c6da697406891b75361c81cfc2d13a03836 +8f2bc045495a1d24628606990f351b6f6f197ec7b52169495bc0047335c4a3d6 +1a7aaa63fba1aca730ba1fa90ca04a0fab27b145b2dd0b4c03f01c79bb77758b +fa630d02a5200c48499964fdac705d1f6b0aaddc58b47a35077f5ee2fbcab957 +919e5bf614a1468207592bfc36bdd62ea9389142350d0835243f485c99a49ee0 +b6fce33e9f1ca586f704d27c59621206abe70ac31608ca67a512dd60f07510cc +e0ab7715f3a662f824a011ec47e60f84664e474a255712aad0bbb1c7c1488a49 +0a75447e9feaba451fcd1106d7da535ad82757494620a195b2f0b1622c62351d +89b62f4f9bb812fed256952928d864147176ff0e03bdd2ba75977cbd0b5ec371 +4478c47d97601280566d937243a0c8b0b33450773897ed5535bea6d7eafd5413 +5c4a4976ee0153f4eb913aed8a1497b743e5e1ace625936b3da74119b49bb536 +1a6fefc0eb959394bd745cea919b1e62c8cac77754c59b725a26c606a7c5b3c1 +45fa3e24e5fd96e230497a0178f21cdd53c733a6bf29605879f61cd4b7ad1117 +1412b03ef42e4f8261df1544138958b3e96ac45e3a45c1bbd0a6d3f1fc4df057 +d0013bd3dea861453e54eb4721124ee277fa0eed1bdb6ca37e30dff04e91b88f +308edd43cb7dd7e9722e57dcc7f3633209505409a1f98a133874895e00b32c01 +85baefdb0b4e97f75488ea0f76424d9196a2437fc9f67fe2933ff34232768eac +722a84a7fc52fdf3ad248c69fd7d4c45fc33ffc6a04b562ce367d96b03c0ff8d +75174dbdc09bdb35a9f4840a6adc555f42d20bf5e2d3da34a991f63648ebe86f +3e155514afb82c1b3e37fcdcf8c594acf65fdfcf5965f42cb35543ffb1a1e40f +622e6ed20b4979a37835cf08e40b8bcb015db8eb1a044dced8f6bf6360d0fa20 +e656d90efbf461da451852f58439db9281f60edf5de4af016f8715eee83eb666 +d48784d39764e33008e5d9195ef62439f3af1b989bd952fe0a0d30a85708bb1b +a353efd6594a3ca201115b3659dc1a80619f155c6649f944dfa3e543971f8dd2 +b0a30afe77658ab82e630bcd4fcc33af8810da1360730055255aacc77fbe09dd +9b13d44a41e0a1d3789d94bd78494a33ae60b9ad7290e4d1ed6924820140e2a8 +ae5137fe7c2570af124263b99d11ece45cf80a6e11f56dc6d77e50fab50608fa +09eb1520f22ec16571e92a193f1699f81e352bcd9e0c838a8c1d5bfe80d76957 +7129c9c46fda7235dcc34f604171a75f069f9e00adf56e84ab1f74f093bb6995 +743f9e027fc4d9e6bcd647b2ec7f0d7af2e2efd2dbbb68c83ceb1c760fa71ed5 +0394d38963fdcbf3891934a4cbdab80107778a63f1101017becd233ba0c2e602 +e9075c5e509f2ace7b7d5c346dfb58d0ba3e005e38ea7428dfd0100b7e1fddb2 +7fe8cca96b04f9b349693acba904d44e143e03e82d16158beb36dfa21f57a039 +d6bb9bdd1a787fb9df968004388f8655e9d8b6f435117836bc910697aa1737d0 +55c73fcf23f8b56b58b09195b7cbff574a2418b1ab9f74dc607066fcb798b880 +5fb0d761cd5cca51f9ff0d2e67cabdb026f2a9b292fa472b97ab89af60cba974 +71fdef1417b14e6ff5440867aced2ff9837c1cd1e1aea23bc3cf3444e35f7cb5 +97c2f8d5576ffeaa83e06a9e6383e9225ffe0db4b1575e1f87f28b373716b668 +4f3e9e694d6d56495d21673d165cfae5c6ca112d16a40247216da4debabb7e8d +34fcb858707d82cb8868dcd8e956d1ddf8bbf6cd57c293f8e3427f14c99e910d +a7bef26c09e31ca66550496574c0c8f70e7efc9f74bb45fb1ff13b31d8982b44 +038c1218b874ac95ab907d01bca78f00fdec53773064be453a82efa3ce336c46 +69345e172763413f021d75570ddb0a16c806e444d8b9895af997ee7425d2ae29 +1d57d9aa91a5d9e992a7275381ac332a2396900e4d821f69a349d48a5197f98f +3534ab2a47926edacfc5281c09ea8ddff7ccbdec5b95857c9b2d82829376bec9 +79a6ed53c42f6be0c80a9fe6b90c06624a29adc0e268241e145b18dea609cf8e +e79720d031691f5912c7b4c1fd4358a6ed07abe23973f5b296ea3e36d8081d64 +50835e84fe95a56764117785baf8b08ac40dcf7453f4c67100445ea6a77ab755 +e3b4882dd0a9d74332f72322d36ab9dbf2199028eb6c6d0f43e79065e0fa47a7 +68bfe8609fe6ad82e7a1fadbe827d86ab6f3db8d0650c31e80c7b5ae24c703da +104ebb4cbf0d63b0248ac1c47a8ef14a095d902bb390c48760ba7da6fe56fb44 +df02ee166b522a550efab2006e814f4053d0f21f3ee790ca6d17e8ea5ae31083 +5889c2ca6b3fcd267131d33f3f71bbaa5d414479fd6c9e84ae481defa4eacf99 +93a6fe4ff57f5e09fb99b8fce71b958080971e61bf0ccbdd2a86448782aa9871 +0cb686013548fb3f691436501545d2ddb46a3424b643590da9b3069d76eefeda +946b6ae4a531f7d8b3bf98ab35d37ca5b36729548c06d230b597ab2cfd12dd01 +7fd2398830db4b4f2dd298e945659a564470b22656e28a2defb63714b5dcec1a +5cca4f9f3a07077c87c06bcc145edea8424d9f44ef8e73fa98fd216cf3fd8408 +52ec5988a7749f0d6923f6c0ef50e9b2a7a61c006316b49c51a0127004566d81 +066e7f1ed02f5f570cef07df070ee98d836ad6048fa77c8888dadea64b72d4ef +1404634b59cb590e5113d384e43ddcea459dec60c3f1cbec10e33100bc7eb8bc +7e339177105ad6a478ed9e096477601347e97c3916a3981920b16bf4d64d8fb8 +694341db499b9ca3cf34e140d7db4d6c5c291f100c2d419752e89ba7fac3e8f7 +5b4a63616197bcacae3e0170b7467670f67acd1acab2e0502f02f416b851a5cf +6f83c3cd9992dc925b388cf75b423edf1d5d234a341adf12cff88bec1da95ad5 +dcff92b3cca7418cc86ab1f1969ea85824d243bc5cf4fafd8f426556dd9017ee +0242046f909acaed3ff2a91564303d13c8df20ff52e25e60cb7168902daac679 +b794ef58e0ec9a5b5a97a1143b09157c97f9946d98077de28e8908b84f73a018 +e0c3bc6f4a6ee088edde6f1e0f568799d86765d843965381467a99c8b91632e5 +eed53fdeb8673bd6c9b3757773febbf86ee428d4b386985e810db8124f5bf974 +df99afad632f03e338642c9312787ac47a9d2f4a10fc5399b6ae9029a0336d89 +2aabb090e581b749473ff20815277881f985146a028f6dfb0acd19954a0bdbb8 +b4ed1a65d3b9866dac29c6aa8aed39d956433ba649f283aaea848f6cf8f96268 +cc669613981e4705d9220970608e67028de79d0b3668b4a3db70f61c9fc01078 +37ec51eab70d92a017d96cd8893eccbe23081dafeaf81ca2c9d45d38cf554c84 +99a6b479ebfbd96be8f7f4599b10dd45b4ac860ea6aa410f161df2b33c08586d +87218a790509800164b41e3cd0a7d30d9584813c42fe3935ee56c6f22cde9fd4 +05615ab2abac9dfcac550140c4540d6dff9ed67f530570744d0be3e56041e1d8 +ceb5a6925b3bc52c206f6dd87f2c4de70ec19487d2ddaf20ef6b26fcd60631ba +b1677d0ab695dd68b2a3b27a70b0b48fcc872991bd0b9688a966e72239b58d3b +2e58862eb4db390e169100e539c238299449bda356a0968c866ba0e0bf3b88f7 +6cfd39fe10ae30eb6ca7149b41e412cf556969b4c816a1945c0878e2a79e7ece +7e52754c8dfa755d79fb15e5576a8846307527460b6d9182154e23b84ea9d443 +7fcbb470e9833d2f3f90aa88d0e44b175a9358ad0d846ae6744c4b69a5e24692 +eb37b5b9678729be88cb9f84d2773ba99b29ad2056420328116840ccb475ab76 +27bc7efd2dbe6dcdf596e94c09aa959f2d43d48a80ce2faa7c30be324d18b8f8 +70f77be72199e931d5d5f3acf48ff8060e168b48d066b2354fea58713c1a5367 +330c9491fdb6fe9654a8fd66803fdb1990bcf5bf2d8665980d162f1be17663f6 +857563371b1056144cf54ad30f1fae5707f7bbe87fae41d2c683e8a02931de24 +29e66f35188ff3594f37f7ec5021e8ccf00248be459f80ef9a46d0344e153789 +69729194731a49135ae771aac663c0037db67200c9677bf1f39abbbc54802741 +23d36a35f128c1c35dfac1a29a9c1a488f6d7df23933488c858667bfe24948db +86bd0087f94b0c6325a403de4a434bf767c137f248c85257a72e39b51351d401 +8b530913ea8be8bfbeb039233bc3432db0b61aa281a0ce2f01b0399b066fde7e +abcafdd46c4d6bcf2924de2ed3972c01ae0213dc1553928895c2b541b1b254e7 +a1ae46069a110c55de12f66358815cfb07cf0de59865be85f1a8f2b61d0ebae2 +7d341bdc37eab342af148a05d0fa415b86cda706746c75e0fb71a610e455a64a +d8515705ec8d265f3e4ed9c0203744c86a1fe55ff52b6c8f4ba71e0a26651cd5 +fc38d93b2370b1e38c29343c96dd9b3d4a39b78f7bc7f2eed735f46bb46f96b1 +becbcaa7cd99ef23d16bcb3f38a605dbb908b28b1039d2ea1fc5d7afc11f1aa3 +798b407ec236421ccca18fc1f27a12d7e0b253039827104461c51ccb2283c9e2 +6fcb819b656a1aaf1b29821bcecc50b911d1a05330c43a0c6025ec90dc134042 +77ad9424c2d2e642a1223dc74ff16f70b54c0ff578157f0c701279facaeb2563 +cb3855872d3933c0a7be7b633e7e3ef053e1213e4cd7e1c57804eccd8026e581 +beb4c2fc59cacb4c1e7696d165316d7f3391ede443873c7ac48277e47eebc64e +3023d06ffccb05a1a71b64b7da4ce1b6256c4970b179c91e1b5d6ade81c151d4 +dc3cccff1d6ebd118285d56ff7631f2c7e2b89cd70b2ef7a3894366fd177c06a +39e3971747f671898a0109008e3190b0aef909597ffe91d7c7c2069b5680298e +eee7c04e58cd328c1bafac2a8bcb63f6d9a6a56f29f3551ce1d2512b5885d1b7 +8397e464b5f81f4803eebfc0cc632fb653f52fc7ebe2f64ab5ce16e840bd0577 +cdfa24a928e2888ef6171e43aedaf88616344cd64b3a2c0873dbbf8eb1fdc08c +cd86f324775672bc550241d139bdeca9e6ee36d49fbb117eb5eb456d99258067 +94ba27cc50585d2544b2f1f16c19ba41b0cb308c4f50039a843e66b20e04db1e +b0e99faa3556d8e95f4526f0a105d4b761df415148051c604077ce2025732152 +e6db72d810bb8d81c733ba78c0deb8799abaa20d3d77152b2dd109d70efb2bdd +7f17c1b79bcecf6b30cf0f852ac61197e0f601d2602205bc37708fb4306a782b +1f2a39bb03554a1d10100221f99ccb45b538bf2a94ddf8c4e0b10c62f4af712c +a44387b0038bf2474dbd2242c735db0d79246d73a43137d535eee525502ee440 +9021ae2414e9f443740cdacdaabcfaa0084a60ac34303dd559269eb088e2925c +632bdaae44dae0ae57f3080be448c56aa549b620d1729b6cc2974e571a5697b0 +4ff3e6f6542c4fcb2abc9261d97d6e6e60538d69b36c8189491a978a7d00b9b6 +3e62a1f51d6002e12d0604d53af0188e565ceec8ba572bfde122249dacc9d9d7 +75047c69ef0485adf9f0dcec0f0c926ab91b551ebd9b8f4aa03817c25ca92395 +518304be94b5d56bbdb833cee92c32b792c6a31f37448b319880e4cac35d2edf +dff530d0f7773e5148d41ae56e02633781cb2abb15ec2d94ae52d3c8fcfd3097 +45d95f67b560165f57393a42fc7474b5284c7cc0b893f84f8733768264ffa8dd +0bed83d99c035bd1a83597f0d614797c583ec8c5b96b9739f304edfe1e00ab42 +38f353a82e7c71d74877d8519add9b8c78f611174599512f11c22c10cb360307 +b262f1f78c7f9a85f1fd21e94d72abd413650ea6a69b057e021ada9787d06185 +c57c0947f9a2a81822054e855f802160649e25ddc82969d94c052c289f35bb57 +c77de5dfc63716c5b0a87bc7ed859663c457f080089e3d729b9bb1299050788a +79ada19db21011b01a47b278615be5359e71ecec7c06a67c4943e6106e152824 +ccb1fd39c485e90efebb1b2192d93c8bc52e356e51e5fc805cd7e43543e9c500 +d0ac85b7230350f9f403340a16bbdbbc3bdf0f7a571aaec4d6fdbecb288c210f +b7c244f1908305a0b1632a8123001175e36124b543ff92c16576d373b9bdece7 +67889128ffa3497ff846f8befaf5de3b7c339f049adc9116c9a7bb8bae435798 +08dca2d9c151d9329c345919930e8437054501bba38c2bd5102a20e4291203f6 +eece2f70bff3df08aeb8ddf1806e9657ee4a5e3fd5a8fd979d90d45734f14f71 +5d339ac91b7fa18a17be81583c08544a8a32729c17975014d629b139c0b3c236 +bc9a99231ffb339b7761a2586eac564be734ef37992cec6c06c2c93de2b340fb +3a27a52dabe69d9178d9a544430cff229335edd6f817bc52c690917fbf322852 +d4a7a709a593704568cf142b45eff164d817880cc93782c223247c65fa99aca3 +5c66a26093f9ffbc25ca9b3cf6b8ba478695c68212e80e3868a0db1a1c84bcdc +df05fe054733a1b794ed1cc483a57b97ca2e97fcb1ceb9cc2ae7d5e0e064cc8e +01cc628180359749622ac1cfbb57d51b25974ecb15dc83f99dbfba2d779adaf9 +6a9307bf3faef5d2ba5135a15d13c4215570e772376a4a4a3a5ec4028ef11004 +b93acaf38128de94531c23f114fec41cb2e2027e8ee138aef6ad017f5d97a600 +1063be706b65da0eda2234e7e9a9c27c084c4564b362ffa93ec9127cbc9366ce +7b74805943c9961be5a5b5ec87675b02f756af1b70074d03374ae931cff31757 +4145af416a9098bba84ed2d3ed44019257c0f34e7f94dbd10fd04fd15ffd1b64 +f65b2c02e581175436150a074de43f8e11fbc56e806486665cedbcf387504d6f +0687a13d668c69dddbc37adf91ad0091a770ee23850ae2fcbd6b9de9d8a8c8b8 +eccde66b7122c7b9602dbd0f6b7f7e4890933451c7a3904382d7801bcd992f76 +4cd41d74bc8723eba2647db7f813b465d11052e0f4ef593049942915c614ede3 +4f8f2b77bedec635eb3461d66cbfd4be1689a839b1feaa41c0f0fa23669806bb +52fea1fa5ab524a447ef3cfea4583a7790baa418ff8917388daadc5a3d1a9fcc +7f4a826c912eba5d4b82d4c29b639d56532b37ee9aed6bf06137a3af899c70a1 +ce4c9940e6ea87b6e274696c4a15d6aa3c17f9334aa84fcf1edb48e306640e57 +892b25e67c6f87e4e4cdf1a9cf12f69c0028b5fb768e839e1b8f75f3ab2d9763 +6e1be8c5a73bfa8675853695ee32887dd6df5f03f88e637d45f752d22f6c76b3 +71b9a514078c3200ddd2e998f33f1ae5c0a5fdc932f7c4727512caec232a681f +bbdec1a919bddaebf5efbd06869bcfe0637b72cefaac13f915f25cd3a926c0a5 +4875435ee6a413e2554fe4ecfcb96c1b5d8719e84dd34939dfd7795eedecbceb +786df32b6360bffed553a74b444a35e0ab0517cf7aa9c4e420e5bea4a5aac950 +54cfb55d1a1e57b58b8fb382e8ea2acbfb9b43d1ab67e0c1450ed3091758c1b3 +8155fd6996500a55fa5d134f17e55978d930425e0c03748364c46d3bef68a390 +649e09e48c2fab92108eef8603c70a977a388d4d24971296aaabcb932bc96033 +f648a6ada265aca938a6512f456fdc194f7186808deb3c16769d3faa850f78fb +58610c776c2ef3f208404def2940e484a801cdc45aeac88fa9852d1319159340 +3478b1b7f204ff297b67bddf1d38e256f864d3a83d6919ca7db1bbb1f5b8f6e7 +8ba272d1fb28d760618dac6f5633b9481645c9b8eb3a3384518103cc68aceb05 +5a91dd8def04b49d363b0c6daf63aef5d85b1e79504c23b3bb50a4b7194838d6 +b417b0ccbcd95a46834f9bbb2ac30fb2d9b9c31cf4b608e1379399a95f8dfa94 +53998a743c5a5bf33ed1e10177dc4a2a347f5fa4d09470cb5d71b07bf459c800 +0119a2164b143f03fce36c19384a01cec5b9080491b82b9ff115f795d969f480 +b7232d0375a9d46faff31fecc9351b42923e9ab6207d2723915d7843db279505 +280d70d9c80a1821a257aec764b7e85a1e8da7c40d42a0f77385ea66a7643435 +e20af708470f645046bbeac12d840fe3260ce75e20563014d9e2ebdaa57ef06c +0ddb55fdf6ec3e064312d13e25299b153169788e8a4decc095eb37eaf8e8ce2c +cd7174f44ee8f3875c5a3de3c7ce22296e99c44628f52cd3d18eb9215c34e563 +0ba85b5fcf3a211021a19945510c7e39ab56d977f74fd50ba8a70def82fa6777 +6930390700b4636330a998b535126d610e8a1cb63f618d69896fb47576857f5f +8926ddb4833966695a26402aecc48bbcadc04c2833afcedeee14254a9e77603a +5bb7b9de3c97007901143a7901c00b77a13e72940a6507a76164989e71d91eb2 +3080c585be2f8734909fa1efa7fc6a2464d95e4c5051fb8d6065a7d9a453cbdd +033626544b72108e4c4c087b4e4dd972893371ba7b8e8291ea4f98d03c61ce6d +d56734f17a66697f2260af9b3f8b9a36717b490e1ce649d839a66133da7742d2 +dbcaa22ff915fcadffa0383cf34c2290fa42fe23128e29e7bb1c59e55b7ac347 +fe66481f485d7bd09f55cb51d208d0765a510d5f6958fcd3ff5a5ed27d06a02a +f7ecadce4b4ac5f1d0210c5637f07382193d77945e249d2c4973aa43dea41dc0 +51cd72643bda4f749dd5846a9d3a7346d39f78eaad738d2d255df0f0cab5fb10 +96a0ac86bb013980dedfc84ddfef081700fc3c66b6d5a125c9e83df17d92658c +10d79a8aaa222004c20aaae6128132c64f96a7a7c869489a63860c15d53f958b +d6fb81cd165bf253d996c15295f7c2fc52c13b51aded1c774cb35a0ab258bca3 +ab438786ff7e648f42ab568fdd9cd598c52b5748b0c44458d4e0b8080ad19cbc +55d8aa1a78cafed7bd41a864488d8ab0bc12f6689027c65c70a2b26bd2590026 +3e80ba6189672adfe377e9fb516cc6bbb0f2e341dc9e2f34a8bb00b4079ea28f +7c8138c415306e00bdd8e71176faf06fac92e38e8e15dc6ec6cdb389d1a15310 +ca67408a9686f21bf6fbbfa7ce032974e2b860a3a72561508bcf22ede4122185 +b83532444134af2bac5ced1932c9cc06b70160d0cefc8f76ed1108b629e81060 +ce6c30e0bc9ac232fef7ab1c99e21792921bddc20f2afd3b083dba29641458a1 +1ba80613610b01543d336ebc45ae15c276c9ff18fecdc0cde3be18e044497217 +b9a812d926538fc42871f439282c1717833170bdbffbd7e2034d794eee9177ed +28045b2dc45959426e35d30fde +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F130_0 /VXAMRV+NimbusRomNo9L-Regu 1 1 +[ /.notdef/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash + /ogonek/ring/.notdef/breve/minus/.notdef/Zcaron/zcaron + /caron/dotlessi/dotlessj/ff/ffi/ffl/notequal/infinity + /lessequal/greaterequal/partialdiff/summation/product/pi/grave/quotesingle + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /Euro/integral/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl + /circumflex/perthousand/Scaron/guilsinglleft/OE/Omega/radical/approxequal + /.notdef/.notdef/.notdef/quotedblleft/quotedblright/bullet/endash/emdash + /tilde/trademark/scaron/guilsinglright/oe/Delta/lozenge/Ydieresis + /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown + /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls + /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis] +pdfMakeFont +%%BeginResource: font MFECUR+NimbusMonL-Regu +%!PS-AdobeFont-1.0: NimbusMonL-Regu 1.05 +%%CreationDate: Wed Dec 22 1999 +% Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development +% (URW)++,Copyright 1999 by (URW)++ Design & Development +% See the file COPYING (GNU General Public License) for license conditions. +% As a special exception, permission is granted to include this font +% program in a Postscript or PDF file that consists of a document that +% contains text to be displayed or printed using this font, regardless +% of the conditions or license applying to the document itself. +12 dict begin +/FontInfo 10 dict dup begin +/version (1.05) readonly def +/Notice ((URW)++,Copyright 1999 by (URW)++ Design & Development. See the file COPYING (GNU General Public License) for license conditions. As a special exception, permission is granted to include this font program in a Postscript or PDF file that consists of a document that contains text to be displayed or printed using this font, regardless of the conditions or license applying to the document itself.) readonly def +/Copyright (Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development) readonly def +/FullName (Nimbus Mono L Regular) readonly def +/FamilyName (Nimbus Mono L) readonly def +/Weight (Regular) readonly def +/ItalicAngle 0.0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/FontName /MFECUR+NimbusMonL-Regu def +/PaintType 0 def +/WMode 0 def +/FontBBox {-12 -237 650 811} readonly def +/FontType 1 def +/FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0] readonly def +/Encoding StandardEncoding def +currentdict end +currentfile eexec +d9d66f633b846a989b9974b0179fc6cc445bc2c03103c68570a7b354a4a280ae +6fbf7f9888e039ab60fcaf852eb4ce3afeb979d5ea70fde44a2ae5c8c0166c27 +bf9665eea11c7d2329c1a211dd26bb372be5822f5ea70d99eb578c7befd44cdf +045a363056e5e1cc51525ea6fc061dcebb337208eff729802376a2801424f670 +0e7e6397b28f15bc10b40012b0a3eaeb2693e8f7f627c4c9c7c6c5bff105c1e4 +1b2b9e8f09253b76040d268b80719e1b3f5a55ab7b89290699b50c1bf1baeffe +1f57be7b5ea025241a248a6d4cfa5067a1da6eba4cfc940599ba3f3c934d7248 +b8e4ac5816f0d2ce8b3c4193ce39d19fffdb75254573173cb51ccd83c2f2d06b +2483cf9b07b21ec6f502f028c273887bb06dae2afac10e9fd3c7cf51bca7b277 +b706e425302dc78975ac0e43b87073257a5cd7424b6865fca89d886e8f95c4f6 +d457623dbbc0d16bafeb4c649f5d72b09b18502eeab687e915e9b536a361b4f1 +44c3cd4cc683b5f05a4ecb4823a5eb5179bb7eee8b76c21b2491a97808f6318b +585b0bad98f42fb4a755bcb74cd354f794c8bea5b90fb9681bd5849d45247e39 +930c882490230e1662d39cca875bffeac3e79a78de6e1298abe9817ae98675c4 +16220ad0d3a36580ee2f2a17aaa1246c416d58a4c52fbb26aaf3b6f75833af8e +3aa996218dafa571fbc7cad90ece9c883c813d8f168c5e86bbfa0f0a5cb36e35 +2de4caa0f8d3227f72c5056bfb5bca6bf9c60e037a0e44670a8d3cbc9a19f379 +ca8db30b711f518a8c7569211ac70c46eed2af62a37f238bd0bd12d60332e673 +c6e784b3eba3f2e71e9993b97e8a38f85048937e958f1cd8fc6e661048546135 +56b810fa1ff611b96495081c04542df7fef085dec619dc8c84cc57683d212813 +9d14728aa32723e1d15f2af8f03422cfafd8ea4c92dabfe00e6110bca39fc555 +bc066ef848e437b50688daf26d001aed7e74605ddf9c0ed36be45455aef92689 +8cf32baf2418e02118593f54fe1857807bfa0b93b5cdccd81d28bede22cda6ee +2e32422c1e8da8866e526300f9059e85ca54122ecbffdc011460913e0d28f7f5 +fbc9d7f9f6934b3d8efc1a91cba4128f6bbc5eb55e5e7b73647bff70662bafbb +145cfa65df3db858bc3fc577b1bd8bc74fb8a61bfa71b8304aeeb36d8efe12fa +6f5eee0eae0830e5177dc745250fc362f78231fc3ac9864559dba92dda2feb96 +2629293435bf4a89f913fd15702cf325981ca3a08b327f7ee35794a9e88326e0 +24559b547fc6da61b7a3b9357f72c767baa9c79c4e7b77f70ec01ac0b8596425 +5f7346dc8cedc702d3d57b09ef89cdd33756619af59acb9d17a3abeaa6c65218 +6d6855348a1095746b34af15df313091c59e5bf9e79b156cd7903c1c42e115e9 +c5203037c808bd295195e074fc4a46fbb1ff01c814878f0c177f552bdc9bb698 +349d73aec17997374ec90b69293a064442141a44c6fe8e3c283c02a4655c579b +f21b53d1fd37996c682745600785c7b52c4eeb47fa5fd640739e1f09d5c5dd2b +b7515a4cce0a21281d315563895972bee88bbc7401be9e20cb160b6bc81ed469 +6d66169bdc648aaae8a9495b072911cc814c19d53b95de0071e3a439d3c09c3c +1cd422c605740a8939487e26bb9233d4cdefcca49bbeb1b913570a51b2f96d30 +2ef8913c6bb60b54f7ea4b8ca16ad3b4194dcba28439eb31a9443caf061c4d88 +c22cec8d9d8d85d7aa225fd64bfae7376abd40f822ba1ecc9339e09403195752 +fc03a5c4742ad93064d975906ed63acb495aae324403d3bca118179e10256543 +1bc84d47e0c016234eec0c52255ae783417941cc884efadb63f8269876f00a8e +1e1f19eafffa00453203a0752750f8c876aaf87826baf77b81d336ffc29249c9 +a6a44f40381294447840632ee59a3c4530391f35da45c16a001f793782be488b +5e01d7f75dbd53fb31f956f16202d3d94a300866814ba44c79764cc25acb57f2 +333dfcf3d97a98fca949b1da71ab27885183d8baafc9bc743143f2f1002ad752 +1e55d207de23e97d1760cd918a55148e37e05f6347e8cc299eed28d7319abcdf +a4a279d5f64cc2151f91a0be9e8382a35b535a6b5f41f3708169881c243391c6 +67d9121ba21f6bb22be1ec9933d9af1dde9693d7704c1141ce2b977ff5181299 +6a57f7806814440a28b1dfb62c4dedb82f0ebaabef3367bebcd43246d54d8eb6 +7af07b164374998f06a0b7e271ad6ea974698a806002374d270c6dd5c9dfd5db +e056fe1b3d58482a0cc98d4d5603c59ec2e13b446023692b9ac2dd7cf767d2dc +a7c62bb3578847085cab79f139bd312cb07ce13e38c3fb8f695bcf4021c282b0 +9b20ba67f378cbb8832751b8f3eed370a572139431b9187893b592529fb1b6c5 +19f51798bce9e56ca50185d42fbd85819c3a1153d65997511b19acf87e69c07d +2ca1a7401c2b23f99c19f95da0df136472f9fb574b21aebbf0c2f892b9260001 +9a9173f108e72c3eb4a93719293e8be026b833cd709c7c05c1a2e7250cad2586 +ca70fb7d927e36a2e4a6f34e754c8dd8ea2571cd82054700d386cdf3420f37bc +b6a70b9a92e46cebee13f6641c67bc40979f9b86e052164612d3dce7be67fa71 +b26ee9f425b54b3577cb4acf3dad02f2e55d2986dea88a5a1955b78c0cd5decd +213c55c9c57183a7dd5832d49ee81724a19abb7da0779f1aa6a77d5d31434a09 +c6f53b7e27123dac042f58dc27653d940358bb8100b416b920aee20672559f62 +8b20c687d77ff83cca449e94fcf4f06614fc539802340619e3a791a18581ffb6 +9bb5961d1e70e55615cce5c9e1466d77435e486f15175cf87fff65e58127b5c3 +024b93c1c296aab24f29483aeba00736ed30be5bb5284d7afc43294b927bec1b +86814a5ac25a3b9cd1f25c813cae791f937375e013159624a360955a58e8fa94 +e49593a97150702c71dd8dbfc3774094df930414ffc68cbd4b4a25041cb3b657 +a54c9bf780142d2586eb5dd9ecc1eb5ea69245d5d9c2af868974ae5d46e3a544 +74e96780ae66023778659d9a45853c24da18dd5ca0489ccceff253b009c06cf5 +826adbd0e8fcf23edd75c3d3de8a4c789a895e06d20606e4f8e3c1bd77976e71 +de409203ef1342bdbf2c11bbab4af5a709f0462aa8fa3a02cbed6f23fb4d5e3d +1751acbd41eecd8571518a9e13889c221ba5568cadf730f9da026fb38e30a25e +87ef6a13484d6ee31c174bfa4b80cc38134d7b18c85c83b4f14d3c7b0a0b7069 +7baa1a397252ac47b67306e45d64061535d05540c86b9599df909e105bb55100 +3a0271c25bc5d596da2a446e35c019b5dead7b289614bd5085d49ecd0464b494 +cd1ab564a93ac9cbf438fa558bbef71c2fe003573a03979a10fe8bd54a053724 +a529f46ffe55cec8d6bbaf1f57d16185595c82a1ef42e3c81cbc55bf50587630 +404b2090df6d9d25468c1eb7a4b2b3da7f5b718157ef8b5f23af088301e46411 +b51e6e0d464096ce22bbc2028488d9af49792b4a17cbbba8ace8fc51e1de01b0 +97e6db05466bf66978305642b6790c08e59a7055f9442cc2cfc23095df2c27ea +decc1ba54d6b81ecc873a9c71796a1ece75765b878d12e4da9e19d026ac44dfa +2dc7e540506546aac70e7b82ae7fa98bf36549f4d540fffd53abaf7ed9044ca5 +6b4e9044a2b23c3e7c70152e96f4e64f6b1918946789d4f703675f3dd6e8e5a8 +f0add5f7e442c35cc782c92db2007596ec1a76d2d22ca5b00f7f9aa9819327a4 +db8d0b03369a05de96b8c4eaec254cba0f39ef6ca005c53afd0ec32f1c092367 +efd9f773bd00b95a60523bc0392b050b15ad70f7cb42f6d36587144cae2447ab +aa4b4d9377a7e86ac489685833e1c14c3e17638b00884a46c1efa2b158f6239b +1bbed6fc68ff606278fd4216c2a6d7888f0f0e5dfc9950962d4964901a47d6cc +2e3243e1dde9ce7f435a7dfb19349a3017ce44b87dc6baec18354a2042c87ed6 +c1e3a1a505cc679e32789f75780f84082cc653a010d14dba84da0191a510359c +1d24d700c58e54718f1d85396e7c5d3a365637085b6f79c061df17bfcd260ea0 +6b8416c9042c2831eb041346a22bc54f9d7ba43f8c4487fc240baec20ad4aaa8 +c03f180b614c59db6e5ec1531aefc908c46b93419b9f5b2d4eba0a67ba43d685 +1ad44d4b43b7796de5c9a11f726a90fb1a389a342143f98f49237fb451c43eb5 +981562d923d684923dcaee71b52ab4ce6269169a35f545e74584fa440c41eb82 +41ab194c78a5b980d021b3eb7994846d963b78eb6e149cca7713c12f77023002 +b8a797c9ccd0c2bd70dbe44f81f9d274a5ff3824ee34cb4317fa4971d67d90a2 +f3d1b1b84960f0fbee40e6341c5271b5b945b9098f3095986ab7db2e0714cca0 +301f6b8378559d86f0b0d95c2dfe94ac8e10df0c8c16dba12505a0d467dccb84 +16bfeb18784bdc10624f15da1a880ffbcbafbed0e1c7360962478006db59c78b +ddcee524b6f9b15a8849ee19aa00fa3f71a3c2c96e68dd0248a94ecc43a60ac3 +88e49e005250706880485df109ce1506c0a4edc40f5ae5fe347d52ff63b26c7c +185a698e171244aa1095620494949d526276175a7e120340d3247cbca4e3df53 +641d6d392abc61c85a22e06cdbc89cf37bffdf8a79361c6dd69e6774772f699b +92f7a7184a00fdd7f36fb8a08ccde5bbcab3731366c3b74072044d3ef2ebc1cb +33118b8c09c04174baef8df1bb4a1e1f848c1a5178ec58ea621f6f8a63d0fcf3 +13db79f885ac659c881ab7e40798a4339e6a78ba27cd9e6803c3d4df196c462b +d08555bed51d7cf5821204728356cf813f554517ac5e28e6c4047c0100610635 +7d25c33330758f71bd1043365bda5d1d9214c8b159d0f8fb69e40e6fb4ef4668 +a228938436dd209dda5925597151f8633297862799152b0317bf21f9572f503b +b10826aa7f8d15f5d780ea27f1b8ca0ba3dd732d3e3effcfad6e6ad8769db6c1 +df22ace8467481d16e8af6f56032c90c8f2500ce66afb94d378d893e84208048 +ec0cf900507f02e40da3e99386f939e05d9737b0b11b7dfae473496d056be5e0 +7f1cd25454f4b290cc43d936450c3d675ceef5da533db25ec07addc7e8355d8b +8abb095ddd61c91da2dbeac0574e9ec9d316ed13df03c997d7a4a9c7a6a3a165 +ec1ce316e820e13291132ae91660d5d1812146abfa137726e8700395b4274502 +7d53b1e5cba817beb577bddcb956e89aa2d1ab24128b9ae8e06d9f0a6dab93bd +f7ee8e2ff918255c3722a8b0e8520dd02ba7c92aba13ebad9ce0ad0f16f728d0 +ad49bcb12b429811d8ca1b5ae29b7d5393401eb5802db4d4497cad43ead218ec +c674f42143bc174c525bd736b77dc28bfc7e107366eb9091eeda60664a771782 +cb41506406dfd29c974c5a18da88b473ae58a2f1fbe5680a40138a9d2fb7955b +3fdda23b2cbe7e27c1dc4aea3069b1e7e25068c9051672b8c9a3a37d6e6fdb24 +3bc20d303198f9b8ad8154b3f4a4f2acb17c31a0489c1366eb8a13012c6b8cca +4d416b911de781563e26c08538e038dd8ef92435a054348add815687ddb99dda +88f1e2c5887707cd4be47f71ab81a3d6cc3e039bd09697734840f8bd0b88aac6 +191c6db089943f99ee4174e5fab3baf3a8429e273c4d1a5140e0073f86105402 +3f60df69e65809b7a1a5a8aee4d25bdde9fd6d05a3fcf4be5f253e41fc49e121 +df89f259ba981d2617209b53ebd92e430a69668995961177b159933501771905 +08f625b26b5085c04b325e7fb6bb45eebe3bc9f5c5114eb37f19937635d71a72 +39a0039003764d10cb403b58c61bf411aa8f5d717bcff23fb338da58d13ca81f +acb3316d2b5b675e86a95cfb525199a21af248a1245c92ee37688c6e76a95187 +3b411697a1ea6694e6ccaddef3d57114cfde70609de67972edd1db95d923e077 +4bce7cc77605f9ba5226fb792829b1b8eaa15361ff78f190a0563fd61aac4452 +ee1b0d293e695416c667735dd886d10e4467b613dd9bb899f2bd75f2f13193f0 +481fcd3b4e2aaec6cf2829b1521dd4b6471ba31aa0aa4d63a6456203896a111b +89c106f1ea85bfe0c0104b1292a1f8d49334578375b55deae2d7381f5cfcc023 +5ddfb3d8546054a0e6d5d81e4254383385ba593a7d3a8e0beb34285dd95d97ca +3eb598b643834644b611e6db4b8b4360c847120038768e218031e097ba0bdea7 +732f7e460155a496b91b3241c74f9ee0c99ec7adf6a87b701a0ceb07fef5fa44 +44e127de3e777c23a8d938f9879df1dabb7adb31247a53174f919a2a5a4f920c +9415f3976a8f4b739e114b2c49d67bcedc1852686cb041e3ee94ef94d9f2096e +76f1c558f40812444c6f0f4dac3a4bd22b82e32d8bbf1504f8232ef00dd2f3ff +5c4b8349a9d1becb8c59a9f4763f2566a7a513a6c11f54d1fdc1867ab741f3c6 +e2b44aa95479e4e9813350473bc7897b9ec592f01f97697a17967d344a4bc9a5 +62786f28f87e3639d091922f4994671b22efd41ff3f6b8a651117d0a2a97ccfc +80a69c974fb2ccb36dd6a4897bf88ebc67bfd892e35e6940e94893e1cdfd2799 +8cfcf2b3737a6232e4783eb4a8ae56b83ed7661377b30225a75a1b90b73079e2 +6aa33fd37b81f7d60de62931b6be9d16367a5fab1d14d281d3e8d09dc525f549 +ed03a449df4655802bc3265010f286df86602740d8a86aaa228b9c47e3e78c0b +22d2600d5cd55a3116058daa7e34174144f78a8f72e0dcb8cc64addcc52df0df +3f8c21d9cc04e187be53f8fed4f33633ba03afa178fa5ce769a7eb0e1b9bf5bd +de0ea74dc99598a66696bf6d5071da995a30b8144acdea116cfc447255a99cce +4ec01bc8a0b355c0881f6e9eb48725d61ee0b245e0f7cc35b9e76fe11f681017 +f794ed8d4c4c7a02e17bd16a02347f28318ccaafe0575734058121e3ad8064ec +a0086a58f216020a2dca29376981a2595bfac2a0394d448949b52ffb47e5c5e0 +d6371cb4a417ac834d6c9fa0018c5efb16e39e32c85088b266d74af5630b2544 +d4cf403482c490f86d35f81cc44b34200400c10c6dff035423e725d41d2b5ee0 +c3f03a603a161713216af97036ed38ff8d9b09f189ad191a0d03369c3fcd5a3a +f88a57338971d7bcb5f3fbf8735ad8459524d93a92eac1c2bf5f0e6e1cf675f1 +6d72b35ceaf34d8fac178a1dd823ca0448ee1fa2f616b803c38b89238aaa1ae7 +cb057ecdbad28147da46a34b8a1f1d389e082cc3e8eb1a7e5c0c932341824c21 +570e003d8c11c87d7082371d3d4804da32fde118c6c5b5b08828e5783200c6ea +0a7ab73343f5fd681a3116fd818c7054a5199212eb0f3a9a0d87bc364670ee2f +7a5081a1e48a58748d297e014dd5db7faaf7a27459f115741bf4facfa1b395e3 +e97452bdaff906af9c52c5908748f1e13cc85d165bc893c1eba728458b708f8a +9e8990a6f258bda0989aad0959e7326d1d6bccb50c4fab15a6ea3cbe94724fc2 +8f174df93fbff41adbb9d4fac0124d33151d06753d4d879ac4f15aec5d1cc0b7 +a9e861f790a16eb0821b2a7b7b42d6f3e389c51a1d7c652859ffbe66646d4199 +a62ed28a30c8932dc4d2855e7e6311d79cedba8beefe2cd529f4b45382f3e6e6 +a7659da9b786fe7bc2e431ee3f11873ab2709200b715343cc25c5365d06be9ac +829458ff77f4d509d9c3917237d759da6775e09c2eaf4ce966a14157ea2780bc +e3249446573c82b33ec5ca150022a83301f00f41eea3694059b14b2a9abcea30 +65cfd06b9dce3823477bf80938d355427666a8287a65e231a2357aed80d27a61 +58140c2cdb1f44caefd6b629fa661440c361dde7817154052436a36bbc1bf382 +e30285979c4568b180417740a17150952e3eb4091f583083d75a05a2d91009de +46da396794dbb5288e2a2e6191d3f22e335f0275f33e9af2154cddbcc99b149c +6d7aad7fdedb23c805f09725b60b5ec77e8ac9953a3578b23c6023a196f35333 +a36fab2ca195e397fc82318434e9f2844d17bbdc177989fd8af61ddb46512d2c +f5d7821941b18b7c1f1be16df6e6bed4a1655edcaf6300fa8765e903b03a95a7 +0a7e6d55457f451a8177e0e9c9f3aec8d174843e3a99ed698689019e96cb4683 +bb24c71e22f4895656acc67ecd671963abeffef53724a645b98e5d2680297fe5 +2d43ddfdfd5536f7c239a5092076512a2a9821f12338e388bd5115ff4f4d2c01 +d741f821874380838988c17bd975fc388a253c8c006c67963ce3c4404baa0750 +c56760e367b566ed129911eb056bee42f12bec9980177f1b3713068073cf34c3 +70d6ee202c49b42809afd1f8786e14a6c63794eb2ddf49d5a06f34de23356260 +96ea26d57b94a928e5312147ecc40bbc6a204c4b3ee9d4f4361f8df9e1c1ae68 +ef60fbeb99339842e652479362b19d33de080f9625b5c167bf2b11775929b12c +fa9e9a89cf84f249a1078f5584425e2ad8ac82adc298867ebea1ec6c0428fdc5 +01dccde39e5fc147959ea254217153c0b550ef96c229664c22286a7827ebbf15 +c7fcdc57dbb5914bb0460b6e0c0f58c98b264925d9996d9e0d31fb70e66eb9e4 +d928015f2c12acdb7d77a66408f2767c05f93292fae45492e5dcea337cbab346 +da82c905ddb016bba5d31e740b813c3d709d78d7ac50326f90d2e4af4c1dd893 +e26f9767db437b52a758d6237e52c4a2a71624d2b1f79dbe83b6b7839deb413b +f34b91b3dfbc88b7b0b78ab579594ac3d57471074f78e59a64d75b4e6ed3cf22 +33f6ebc86e289402dea3907b0a2406188246e8e44054f81854dae0fedaef8952 +c05c8f5c4591673102a0f24f7deea7e19e27863a27c00b510690b331413df839 +5ae5a37f8c6b25082073bcede7c8ecdbbba2c09467afcebb48f4a4e25cb069c2 +b7acc265f988955a79ba95b3f4d8c6cf94164941723601923409e9d81ba8aeea +64e8f1f09794779a1262020bc301b1966a789fa2f37d7521db536c0c8da36b7d +906398a8a41230cda975088fa5a6070d88882dd8dee7af696ef5ba2c5a525d61 +d35a6834907c4846cfc69b17edf77c58e501a0600a04ab4b36d9007ac54ccfb5 +14a47193ed01d4fd5e3c8cf04b3e38c4895de3eee14dfbe6351bbbea6530046f +89e913d022c0cafe528a33c4e84d465fe6fb031b48d904c5120d452a6c1fdfb9 +08e242a05d015a9ab2536dbadf0ffd0190d355edcd3174cfdda0974e2a33cbfb +2a3d557ed2f6f284cb3c990c3071b7efc678a5d27518ec1912cbaa890dd6bbc8 +824eb1e7ac6127a67e68428ffd67e650fd44c9ec448a309056ce45e4a4a2b769 +8183ac418981f617dc469a566e713aedce2bbc7cdddf1f7affc6d11e94757130 +c4ec7b55dba7356b21e5267c5ed99f427a19daf476e48993e856c852d35ca1bb +b32d59ce688ed184fa9ea1622c306cd788d6372c5b4a94b001f198e33209bb59 +46af1ef7b066d049825bb78318a38ca23ec9a93bc4b4b12806c1a0e5be179e3d +0c0e5bda654e506e74e0ef1a8b12c18bc3f041d5e61a8f03436f146e4daae3b9 +6b8c7ae139f42e8dcf772cb5742104aaf776f3dd19bad920df77b42aac654d32 +2de3779c42639b50059d13b81c3904df76a0ab47046a0132378f9201359f71c8 +12eb4837bcbf3f1498bf8c7b2298e6b2e528f9898ddfaf75b5358a73a67e6307 +707fb13b2360ffdc5659ed8e70ecbab711d89f8c6558622d67737b1108ad5139 +b126a6c7be8b25709fa7cc2a625a0796b7d08b11f098edb80f8aa08a5668ae91 +4ff1c470dbcc7775a73fbd857cdb9a5d0c122d4765caa8d9d35514390c9b339a +c04a78342e186e5c49dba4cd9ab165b4c139e76b88c807cc4b5db7b5063c2f81 +16721670497a0183c643c5a70ab2405d5d8b6773a4a2d39b3cd0d763c12ec296 +9b3c3ab916656fcca5d715e7dac796937b2b6d4adb251fb79b183e6eab23796a +0bd0bf5bcab03529467a265781716b0186573b862b2a2057c427d85d7b547c7a +9e7fdf7a674587df709ffd0a63d0852ea0d02c13e8038762de82362739de9ede +0db4296421d462d8286e2152aa67298c9ff511e8de1a26089d383bdbbf27066b +f322738cd2cf198bdefe566ced1808dafc015c8ae972117776594e9c506a3223 +d4ced495d6229c9bec17c47071415f80482f9ecaaeba6a135d2173254dde6be3 +f0ce9a7a81ec2e9af4add855b08309d34e780adf0f7c9029d2ce0d5f807ef0ee +531217450c82b7f3643456772549acc2ba6a5938c517fd775114ed44ec69a45f +d9110c969edd9e6f8b4bfb953aed79a1daf47c7238871e4d537100c4d8981d82 +a2344eb7df5baebad28e34870d52d97a66dfc75740cda6b403c1964c0feb034d +d3e5c8b4a37acb9f5718f7b6a3d267694df8baaabd38154d16c162ebe43b473f +ec1f060846ee8402d67942ee080dac9b18eb8b09d384ac24f85d287ea3e2c59a +0f2c1d6bad36e262e031acd399a2b9a7940908d65f142fb209416e891a6abeeb +389e2df002436d43fa1161b71382d1842788af1a9e6f39ed56e8bf63991fa790 +a52ce312aaede90df1be57e3c1151dd0350ffe7e476cac5f34cf8505bcbd25f3 +29aeed3a52bfe1f10366dfc4a15fe212b1cc9da76c8272d7ce85c2930d797b82 +4a67de55c50d45cb3640db2a79ecb647a2fd2d948114eea9bad6312319f8db5a +a29d60b22439d45760751904f5de5d8c5c9d0211ac9d30b9459dd05eeea240f0 +97f0c239068c514b8213609014e6bc50633d0ecf774c210aee7c75a5bac24e62 +813181e4d040ad1bd4bd4ec7b99b8a37abd694cb67483d1c5dd5c17f54ea7f20 +50d0ea8ce1cbfa5395e62e10c5d17a423ac76bfba25a38fd474b5b4117ccfccd +30a2ffa484af429168b1b5679b67542755e989b39387fcd9b1d8f8ba313a758c +58641f34ccbc8f2556ad1b17c33f601ea76ac75ee6b681aef12c0712a14e7b8e +a8a5bd316223d5142e8b53a6f81a8a608a3dc32f20c5e417a6aff0f725dd7867 +429fdcdc16a22ef6112fdfc5282c61a1aa9b134c1b420de7b359be8373cf3716 +d7b3ae832ec15e305ff6c8e9d4197f8b0150b30e1b9e7f15275b4b7a65dfc611 +97c0e5f91561f3e6203950edfd6cea20d0649071442b2916ebce5f4d3da73914 +5a2bfe6d055580af134b7dddbb9baf9477454eee8abc7b33eea500102e395212 +78d08c08ae455bc0fc5bf5a0a577e5f5fc71490add5a623ccca134b62c19d3a6 +4019415ecee0168621be2b4856ef3b3944c0db9aef7d3e933a034184934bfd4e +3fe21d4d2625e6464e9ff9cc25e793eb7b8701d3fa07ff9a3020f76d668d083f +59c6f6751179d60eb17b9c4e35f3815aa5ed3793a2030d317f1610215fa920a5 +5ff29a67e8e6f186f00b5ce164677eb1961eeee35b5a7891d4296967a9d096bc +76b0d072eabab7ea758da89fbdc25b8261d9fa08099b6e84494fe034c3edd5f0 +c45e67ffe588b2532efb3dd1c34be9ce299712eac0e4c4cbee6f30e958c9dea0 +15c5c4fef7cd440ea982f91c07928463807fe07f27ef61a5deefa47879847835 +d4e50aa1dd0ad2b3d01069cc7b4741b3f680131f7d5cafc6b3978c3c1d608ac9 +d24342092746628cb71fa01e3c675f14463f9edd4c339ada41ba4b6a0faa5117 +204463bc7b94d01edc1b3d5781898c85516617f29b4dce2d32c2686ddbfdb838 +f67b097be600f6aeefb6eca5f729b45be307232f92731c10c3330672c9584141 +7192e62a0ebae828fadd77bfc2ecdc1e562daf5660354e0edd5b7177bd8e9d24 +f77e526e649044cfd49633d48cea64de714e59438ad980e0b1ffd51ee19692ed +665e2ff332bb54bdbf75316c4b1a39c538312fd649e8c462994dc8f14bf056ff +0804de76474d0ee084e363c8b7081b1c08e252e05e49679e6c7ac81f42e9372d +e5af64f59c4fb62f3e2e7b16ff53bbbc006e3d9b0f29434db5a63210944053da +ab56b1075a0c3832220752d104fa1770d3acfbc31704a1b7852c077058f616e0 +a4373c1c92c7b60566691573502e9a92d583a3163bf31fc100c92e6405ee4d54 +09d23a83225bf6d1de2c7bead011ad64547d6835ac9a7378033c85592a0c3497 +a03c16190ebdabb792ca0bf803dcbc3bdf0f7a571aae00f596ee01eb476bad97 +3a27a219aafcc0fa245c6731a2e8e561c63b7bc3147b9433a8203fddb7138b0c +1611c7e62375f2a114f7bfab36cb1a94b9e10ca63833ab245af595217779bc7f +d12e68a65919eca4fae72f755669580ab0009452bf086ea835f91a0d5b384b40 +82bd515f006865bbee2c50db43b4457a793693806b86f68a2b2419fc3e937a72 +c6f414de148d2a62a71ee9fcab710d6dc08ad6c4ac443365e7a78843f80cd769 +c56efecc2d63487b5fcead1aaaf9481a7361723388f5b51c2d9cea90486cb9f9 +79f6f5ee718d4a49ed91cb091adcbd0e7b3ad963368c9cde877666a742cf5073 +aaf79428b3095f989fc1fa6f5ab1d724d92c33c1325c05a39423b8a83bba9359 +97793fda280740aeb6be3193be5f4feeca2a8f28efa9c8e016f0fc87c8f3392d +5715b9b9a7aa3c61ac84461e2c3220372568aaed851f1cc40481e326197ecab1 +f3cd792fbeb27a58a5f889a5f6321473148c6d311ca89be96039ac9423700d87 +ab0d7e8b89717d1a62ca14e01f51bd77832bb6dbf76b201a04d222852050cc5c +c6a4996789a0bfd6ce364592300282f102e66f4ae9e50d60d886cacb099df960 +c42e2213017c567f27326e677bbd04a239631950b566eb39e4f675d2e989f56f +74da3a0469d988ea0122ecc3670d458ad82bcf7ad04bf3ca9b00d76ee569f98b +a375285a1abbff253b8f179f71f496286330e364049c72ecad4d82a933af0189 +03de5e4abcfc637803167e56911f826735a7c41e7936f4bea148397bcfb18cda +fb03182ed7c511aa9de0c6e6c80b24cb535f03ee16bbcb514d65ca9ac2ef15c1 +aa1825759fc4ecafc7c0d9401f139b3f20ee915955268578a933b184a86f2017 +03cbf4db79be18c09c8cb07d85739b8653ad37b8c0b647161e5cac746b3c0b94 +2ae2a0540f38dbee122cad0cf739ef1b49b6dbbd5d08c97c04dca33030f18718 +583337a015395e1fa932df0328c7ddd9546b7812ba06d82a35f8110d55fa377d +fa6880f52645890d58478e4ee3b72f08b2d7113b2453729b37e4fffad13c5f62 +06b3c767a45c80bd479d1e24df660e46c83c48166fccec13b9cc4e62a6aaa813 +7c424885f83d7647b80849c0a77bed562f134034cda9fd6e8d7dec9e43f0c018 +9287de759676f20005556cedc67c31509a8bf56a5c972b5d247f21d8b6a58953 +7d92101841166d7781d4d80cdc35ca382d8c2dac3ea3a34f93dce0ff8c76ef12 +390d5d57d88f3bc00d46513f0358c43a22c413d9a6ba6b3e13913474b9e53bf5 +31136a5edf9192965aca98e06316c05fd3d6e88fe09cc08e327ed027b81eb146 +63e3073ea5d1d59b74149c5f5242d3cb253c36a84cc837d76b2ba36104aef0d8 +f9f4404d63c42f3d635dc9195ea582b589cb5b54ab01af9ae53f3ec95992c09f +a5bfe86e6ef6948bc387730a9cff0cdd365650aeaa5e1d52d8f88dd49d36e6f0 +786c7f4ef8c2a5a242e84cfd4dc50adfea0c2ac27839699b92fa8feb6436f2aa +d02710777083723ca7e481f83b637f19ffb7511de223a0a261324189edb38d88 +6ff5cb1356e8d567afe76f96cb72f88016e39e99af6aad499ac60c8a3205f253 +82c0312e1f2b6ee7b37d178bd4e67550276a7421b4f514fd293ad32bb1121234 +bff93d2297dd32dfdd7e7ba91c0544f79dfea965f4f67494f3ddd97d7881fcfb +20ed71f6b5cd27b12d04098a9293e273148590fbb65f6fba63e7bcf14dfe6f0b +51f870be20174f991329a5ef3d3c9fce206799a01ca102ee7999c2a97a19e796 +bb5f88922b76f922d302dd833ec532022b13ec573b375cf75e49718b2278f2b2 +4ce9865f20902d6358440efc9eab6e0e069ac7c193c88a044cf33f6a39388f6a +296f42c637533cc503adfc71c5f898c408a7e5479868ebd29c9ed02939ffd49a +2812baa355be429858e0c6aac60817d684778b71fb9a73e7ac4fcb078bb1a75a +b425ea09ad8585ab3fad79429321a8f96e2e1f02ad70e2fdbeee625bb434b0be +f8eb957f817c5699c7293e47daa4ead6d47f00fbb6c8674ef1f7729cdb19749a +ca9cd399a4abcf28ff71edececb2a955ffbe9ebf4bdab56256e7cd66304ed4ab +1b3fddf6431296aa641a8795a4006a049fd3b35074a865c901636b70619ec26d +aaaa8c8c9060938337144209f3e3de01e92293ca89583cbb4c2edec074bb4c05 +15130c3ebfd78dc687f0ad0981c0d27fcaeb28f470193ca13d98277dbfcfbf38 +f8353dbd04380abef7176b0b4199d7319ebfd88ece219ba6edec59fd158987e8 +9adc035b8fb2141be0e0f25d56e077e5992e4f95640abca7aeac3d929be02d40 +9a86dbcc043637c5e0f1a5a12579e57b042b386be96c9a8b3c4e79c8dd28a52b +a1159728785a75f2e579b8669a36a9f9e7807ff9d5aa0d8652609a47264a2003 +fd202bc8fe9cf80e2ef05ea5e5fbae676a77bbdc4308ab92eb0dd9a960f4865b +8305eef47abc2353287f52c766ea1c1b86fdacf0986e56a87462ac820e61051e +7f22cd8ea7dcc7838a45a08ea3fec105d80fe5ee5e87732bfc2e9d664a7ab43b +05321557d69ceed6b679797a67a0c38b9d101bbe870d746568325c52d4ca255b +b23f9672ce2b4e3fe944f5dbc388e575abd897d969ac2a81915e3fec3d7409ed +14de1e4cf7737b6e46f6c71142db06a799a7208539c649244ce73a58f2247e81 +4f241aba74d6ae593d47c227137ccddcf1f523a730a234c91ac3ae8a456cad1e +91a9480c438b047be40bb2e4038f8ebc34ecc3a8037454b7342c317871fc1d97 +42f26e3d956da7679a072cab96b27fb2ddf480d2f40ed88b2e5b0b82892c8314 +cec9bdc12433159714891b8591a051cf2cce7580af74d5096f53a65347488bcb +948fb028f310575d3429123ebecd9b09d83f30ab8c8ab65d49d691fac27e3612 +66ea08634f4c7d3a648ec068c2cf31f116951934864dca2755daacb6d22803f0 +9488117ef66e9b12663da9d00a3eb0280ba412e4b6f6397ee7800f250fbfa023 +3162addcca4dc23190a52397cda3285291842a2b269c4e07f17a0035fcbe785b +6a570e4b75692658ed47b6dbf297adf1b3b164740d1e851f08deca9c05a263a8 +3364c544cece706e77a32f6d5d10f8d4170d5246d92c2c9fae457e0f5e4ecd4d +08b4edfd42a1791cca41078d5e520807817206193d8a649eb39b64c80e126feb +240e1784da3c66378196828104c49e5fb86475a80c21de71e0aa36ac5e529ade +427c03c2236db0deca99c7c486ff463a72723efb519263916e73c25da625d0fb +e45258ad2abf3445b72cbf3e7e64d507198f666edec002e233cc0af6a8c1095c +3cd232e2ec50b2ede3e09b61e25996b4a64c0eec9d55025b1f47e53e0b128bef +a34646b4e2c13699d112c958590058e6b606cbd978cbb0ef69eee350bbf71ff1 +8213a42d135e77e2c53a8121aa3dd1e903dc0e961810d103bd70a2b448f29ec5 +c3d907d7243d76c6ae04c22a8fbc6c1a05f9b9ec97cbb0e76928f4aa26c913e0 +3f8c371efb61f370751eea6af25a3df4ab3da3e4aa263c2477343e4b19915219 +c4c52cf43dbf373c316b80619f479d9b531e62f26ef9fc6da13e9cf0bce74d13 +c2832f1c9d9432437d253dccf73cd699342521a3cfe8f85ccdcd23e9b240c961 +fce15ef77fad8438674b55da638df2492b29fc1a003859f382a776260ae5067f +93dd176181c10c4a45e8f237c5c9781e01d2e1e0890e1a6e75e2bbfda4d29613 +efdcdfb21317d770fa6c1ac3800f328bdb82b48b7320ddcf64add23374971af1 +50470fd002c01ef412c5bb4984737840da5c9e0e4d4b2b7747056a3865af6db4 +f4b9cd84d27dd2e45aa0d9f32d0cf58a5f1baa374359223cfdd07c18017660a2 +9227404eef0abbd0e29bd8698752e85448a5c3cf596dc805a87ff903ff890e48 +b7971764fcd8f921eefcc55b2d20cd5908a6fa35d56bea96a39ab521d985c50c +4e0213b30325d295a00d32d97e95646867122dbef37a3c866fd72e2f29ed8758 +a362a4f17875cba8be23d04a35714d4c27c4417039fc8bcd25365c8a4bb41815 +ce1f74949d6b6aa58fef0c4cbb8d54ce92d65d0a65f13ac6063de4a55ba5561d +509f2fec155b2181a169ecf14f1fab587569f260c0cacded8021ed8d7cae5ad1 +332f1061e166686b41277495597c16e728d6a8ff49f824df503a63322b442182 +665a12900dd48d1361342575fdd5c9d9ddd7bc73a937b2ac6257255414029a65 +9001199e9e1f16cf3cf876bee000302935493ae997e3f112420d7d3f06739b79 +eddc1bf7ecfc5316549d2ff228a4e28b522d6cfaae3148bea2755a45bc27dfc5 +128a9a38777cd3b07f91edacedba2565b55218d7891da863243cf68e7800b82f +0341740a1f5dc6dcf0125cda844867fe4945326f13a954430753a28ea8491bdd +c545e71e4d52cabc3f05dce434101d36a62328c5fe6b5df3864f9f5aec22f399 +43f72fed081d3724306477a06eb9b6fcc9faeb77e62ee4e20cc51600b1bb081a +1c5a00e064d5755838b251807ae57c85675cf04b69a66bef0c19c364969d3547 +55efcf31f8ae346582462e986e3a1d653c205e5d58d21de4553832c885e543bd +11eea2d3c08f883000966c99281251fbc2920917700037278d4934f3441dd535 +bdd3c52111ed0b282ca23cfa97ab25c8726acb13d50599245e532432572c35ac +b9391685d9e1deed1f95fcb151594cd63e79691b5972ba2c3a0c0a2ffaf3c9fa +5ac47d9177a691742e4634db6631c8696d0a30bce1d86a4fb737ab85296ea479 +fe90c51cce54d64087bfc80ae56abb5d04f5516bffb681e6b39f480767f2120e +97d1e8488f1f540e2ebf63eb74596670f5892f4c327971f697c7530778c3676f +2792289cb12486935c447d4eaf4afec65fe6c6962306449e33fb19fb9806f87a +8b91874ddf3e3138481fdc711f0954d73f11fba39efdeb55ed13b16b932525e9 +9f3c86ae60f9096efd4968759def8d629ff2838decbe4c68833ba0d64d1d3330 +b84cfe8ceb23f4b5d55aa5a9b51ee595aee0cd668b20c687d77ff83c803ab994 +c743b43d9882837c42a58cf704490fddcb5646d48cfd2e30464d710c1440513f +4417dfd66d39e0fa6c596e17d07964ebf2caecd0a9fd78e003541ba53468e719 +b7dac2685ccb9b7d857aff1d4432a72f61829010924781f5d15ffcf8d504e361 +6f86c6638469db4ad281d8ec365848b6f7ae1047114a2cd3cf3d1e46e0b4f40e +1a8d3e1df1c1b677702d7fbd5a5924f91c726de2e37b436250eb71610dd82cd5 +5c049fd044b4407784fd83387eb6a788103430fab4f682294b287dac43f3061e +d99c74309ae973bb998bbb2a691402843a1a28ee62ae8e8baf4d645d156b94ab +34680095425ad8b4dc27289e3c6818d6032f91535459d7595b2b9bfc2f44e782 +30f0af49c0a2223e1cee9e1289f682ed5e8ea7db99663a234719667bcffa8077 +e0118b0b9702538421dfada01d97d7a8f232464b9fc209cf278bd5fef80c14be +011a9f6fc78dd20ab012a30780db2507f4d5e1e493f30814ab1c70cda75ce959 +b5d515b2ee8640dd4bcda6710703a9e5670abadae856b86ef8e4143a5f03fc16 +a6c57ac7c3a96c50e45191b0b1c4f6acd622c400cd0f2ae9e9d51236f1b945d3 +71adc5feab8aa8422a28755b63978aaff787158a68c26fd29ab6e849b076b852 +2190caef1a86663f4e12cdf25ba7bf882ef2e0e21c77c14fdf940792d7bb28f8 +892a9ca0bbabe1c70c152f30f366bc86b5bb1eb3b54425617682a5463238c999 +aba3a7bf788a297d2a555dbb218b19ce501aac43d94a0bb6ae290628821efb0c +84ceecb30c140917a458db6fd011f3cbfb4a1cb5ea019db628c106e2a55f1c13 +448edd4a9a159ebb369d509da296da724f729fc7560c00c41f4309e32ea6fb71 +16f62325a5af317f106a8d8c2c01ecce6775d45fdbefdf6925e9a44604dda13b +27cc9a960a21eea2af9bdf6b3cd357d6097ad40df7403005746a30833e814eac +8db72c383fa42ba9fd007a263ce3b74c1356bd522d2611e4e960c9ff5204d46f +ee332f9f134e75c791a6d20923ece8d4dfedcf96ab45dfd751739dbd47b4863a +f0fda172848cd279afd9fac3cc5744c1fa8a5fb4955c6c1c952f56da06430aee +084507664f93c71d881b63041cdec58306100a0e8c77421d75679ce33e2a0a63 +ac2f813006cea69e00352ffd5f5914b63dbad5905a590ce0903ed9b9679779e2 +d9da62f478768776a173832a8f3cd66b6b62484d190baf2d834241000b0eec79 +f1e53b42a74b159bf781ee4415ab6acff86c5b0593cf463bf95d8fa82293a548 +84bb226f40f24591e5ad463ae4b672905e7a4222edf976e8ad889e71986b3818 +bd3eeb6a0c96787c6fdf3a4faed94f0ba0269fd082ac451531e3b0c01f996090 +3f821dcd64642868f07aa0feada34088a85e6644ef07f4402b4b293073e9d308 +bb298b0e44be36bdda218259b4f48f1b638f5007d3aa8ece802b485e7e9075d2 +6ec881fbdecb3cf58c8a3afe0d9835e7b468c648e52b2eddb81dcba4e9678bf4 +b173541dbec382423e80877ba2df94a605bbc2cdca2b76f74d2eb425d8191958 +804617f21172f397bb762aa7dfd0485cd020397a5d3e9fc9405ec7edccbcbdf4 +295a0057b7684a701bb7ea01e8978fb3367ecd089be19aab2828f6825d275d3f +60662c1e2ec5e98ecb99a96d6fe379e2fd158a7106b2190902f0ed71969b6daf +3f9e460f16f1b40cc2aa08330b9fc2e24802bed034b71de445a14bb33f642989 +4f76319eddee328319ee9577740fc803b81714a99bf0a5722981427ba0858546 +c0f77f3919070060704c3bd991d94909d2012146b88c0d35fba7c2de864e35b7 +caf0099c4630443625be3769b01526f3f0c8c821da9d546bc258c004a4d2b46b +886f1ef916f50d3f5fd139e0570b4151dd41f1f1b5dab0db7787105c77b86901 +73c562d3eef6ef741078659467f333450d7d80c67c91a26ba8c77adcee6f4c56 +c7f248dd92520db35768e703f7bd171f9e663b9daebeb9611cf48425b6b35c1e +8bc7a0b45441ad3854ac9b37061839f578256a8e41766d1a6b29a99a0195620f +a090d0ef4120667902b0587946206f294b78775d60ebec668f6e4fb9ca897e85 +76151b245aff8232a90f97a5a93e935c88579dc0f2e9da7cbd02426b3b15ed50 +30acf50107f7b4d4e2c32dd75d6d8c4539176a2244e761ebf1ffbf97d336fdd6 +ef9cf138326e10bdb57638235348eef8ffd33c84b426ec1c81fd8d4a3907d52d +1ba7e9b64dd56b8fbc2362e30f2451b69b0d7cbea1f3101afcd44242d3ff5b66 +89a7c05449b281035e983c6b8c68859734b232a73996a19d116ac4a94f7b482e +1f984371e7e9919c312250c35f6f7fee25ec23e562dcc25cb29ea79dff0e7c8c +fa19280288c26dd5c32f4aeb98c85afda533191809267f0555498da5688b7c20 +219a058efaa597125535871922ff9b20cfbf4c4b35bdfa4bde73ca8ce6abf14c +510ed2072a01c8adfada0064777509d4f97bd2baf66e7151ade76e407066efdd +2e08a15790c81d545b340019bd350c7b90b36adc8658c1848020a77f918e1527 +b3974710af503a79d7947dce93bd81161cd7e0b1125d2fe0edaeb91baf1279e7 +312fbed646472b352310fdfbefdcc4c20ccfed0d6626083b0261d7c47d966984 +8dca4298b9ddb58fe21bb391c7d45d9b562d38c4dc23acb5aa87e3ddf59ee238 +c91318db2491a24110af90539a16940141d1efdf4a13d202f9b9401bc89d7297 +5269cd5515f9a6186a6ef866cfa03730f726d7a4075e0bc6f094e9584a84cf1e +78489bb68dc09ee3f1356f4e45b8621e06078a6727eb72c36fca805213c1675d +4365255d90164f33ce6b2231113f64fdcf5a789cd61002b2a38d2ca5bf1f5361 +c9ae0f4efb51337e344fb7ce15f8edbdc9ec82a9435175f59b6c19ae2dd0b10a +944565e4b14bd1dcda02d42be27fb9f0330636091228e3b89709c8148932a5f8 +c5ba5bfecfef6de83eb414adc613d8534c4e4528d934c37e768d08e103b8ed2a +e1e49bb1b3e6cbcdc3ff63dac7994b8c09203d82a99710449277c20a34e01538 +67c5d5e6abebba650c441d3fe56de997e928193682e5f1faa93a5bc800862132 +ed3b6c005cc0e604231e3e61d17214ca38148c875c268a861a14b54e659dd932 +cbe6ea7109b273975d6ceed351f0b0876a0b647946d29097dd98b5f6bda7b43a +e6481f17743fda503b34a120c8c06f4798c1fcd4e521a30d76f2340df562b63d +dd4b27da8b583547d285f3848bb9fddb60d0ed22a4cb27a2784e8d7662e84ffa +eea50afc03b0815b72bbe9558c8959d0ccc00a8c8c9f740f95b671a66dfdfc68 +77fac12c1995d977495c9ccacd924e45a66f8739de156ee6962c7930f8aac374 +894f8bc396ff69f2249392c7c4248f9cf9ffff9eaf635e66a34511f39a066b88 +4866e776b8d6eca0319f23ca604ead742bb6f6f3b046454a1c0fc242551112b5 +c745e9b8f12723867b2b895c0f93c99df1d542b86c1c9db47390f2d6c3b57ecc +66b1a6ab514a47fd9aa6240b46c54a92fdf80fc44eeed4b8a136fb88b1fa5b9c +a2fe682cca4d0c5a3e994cfebdc270f48e3af91ae6bc9172bd9c73053a761364 +6ef9e68ef58c718a478e7d81e57f34a791c26269819c78574d7cc12632684219 +a1f8e1c5ce8b358d6fbf23984e59d9533ad310d158ab5baa9feda08717a7f5e0 +57684c455a7e3d833f82b4e13e9a92b0b8fba5cdd72a7e46709074ddc82e449a +c906474441066fdd9cb7f341f3a2ee9f2fbf5e4e1a350a45fcad6b2e05825b6c +89077d742619cf1f8434a3b5cc44998176667cfd5c5f4ee51326d1ee3e449915 +00bdaf57c88a107ac49c14cebf18d010c5b3206ec88fd06e3c5114581ee5a5e8 +c4ee5a5c3d48653fb23d28f26862c433ed083af01ed3df8e147548f9cdd882f8 +ca3088106b9c73b9e28786ffa643c343a940bf850f312666e635b8db95c6f70b +83d645fd947f6df322d26f8f9081cae71ba8b9d0de67d535b61146c956801d6b +ff9a69365bda9bc97d8d93142d4c367d5255587ada25e4fb061f8e430f73d2a9 +7142d9e4c17435b78805946e4fde624ea5d9b5c511c9afe2cfaf447cf08235b8 +575ddab8af93588e0c8206f08f883170ed4463da31a53cef67f01aab8f645acc +c2c764f24bf831dcf005833ccd1296025368b3d51a04efd095fd1355e93de563 +e71dd047ef49f5bf8c17b01b2884872257d743ac6fdd8f54e27a241d7c75b387 +a8841d8cede676e35d4f01acba2acebd8b22113bfbef80d5eab1e8cf56f649a4 +516ec097872a597e83519fc1397c7d4a4f6db7daf044835b17d085578f5a3776 +fd5ed9235c018354e801fac338aa7ee581e97d91df0196ea4bcb09f0e6f2e2bf +b5470827f1b6bb0b7133c19bf43bbe824ebdaf9526ab15ff8ae8848bf0decb3f +cfa7d3f5ed71191894c705a27cd9aa30fd384ce6a5f0bc51c5651dd2510a3481 +d086aa87595f885c4c0afcb02b1837cedf85c5e64d440e36581874a117043b75 +78da94a069cf2bd57ae70c230e8d1a0d4637223d14a9868835d8923feb404323 +43c22d0f0e8201c20247c78abf9267915069d6471862c2a0c51ee3ce3153e305 +4a4ec6ea52dcb55df358d1a0d8aafa79fe08ebe4d22e9ecb9d2e50a7f367cded +7169f84285c482fc1effbde6feea424ecdda2494127c7b896dd05f5e62f5fd1c +031de960d6ec59954e8405081601df741edd97f227fd426e0998ca7b9b498beb +4cda9a16715cb699c46d1386469958079ddf5ff174d70338206208f0b9ade386 +03e8dcf31e09f44976c1ad762896a615d9bfe54978b7c3914458c8af4d33dc62 +9f9af5171df3b9e548b24011ec5f02e31dc379582e16f3c999f047b82e7f27f0 +4bfdd827c9a1d19e4230695d4ec499afdb6147146cb6f5a8a26efbd6d0c5f205 +34cb9c37fa4c4b6122f55bacb756173282abd6a2e5219c25b86a5181021f0bac +6f17f89f3b8f74c281aeea7c1d4ffac602c2364c9e1ec8b0a623bd3541765cf7 +aa5febbb6e857810a564850259ac4ce6d641f7b765dd46584c43c8113c8583f9 +e7763d3f4f83649e12e15557f48dcb0a637140b2f7479f78f1f64bcf8a07acc0 +43b9d9ac1f8b2c3b00c36b46d8e514c998fcd47354b364e8c2434e774ac7098b +24c3bfadbaab5bdb8ab0a6b9773aea4175615241249a2a58222df8c53c32d01d +6adc5fb4a933605fff98c7d011266380b305403a79867936156240a5c555105b +95cec3873530fa6d37e8cfc286118a9618c60d6282412d0ccc5a8e3af47a42ec +29cee0176d1c4802144619a5bf1cdf9ec5b8d6f87c379c476ab941da24420a86 +04a0b1ad7884b5e05136139afccf0b7101cae4b8f0bfdbe276aad1b95e2c0d57 +3902bfdee651a202b99189cada176a22facd053bbc73af1c90cbda10635798e9 +8de05c338e90b3dc4afb8d29010590b641db4a9ab707294e55e44c97e275b52f +b88f52a6c7e545cdc73de46da699c8c3d895880368aa035a137fa8686ef4f64e +09167b9e523312b175a166de5e1297c60db361d9505c12b48c1780a00be2a9a1 +43bc6362c731eb26a61097c62c28d2cc8d75ba3c63e31a49b9cb5b8b7fe1fbbb +6153bc87b4538ef5cd4919811329ae933d86ef556883323ed5a6db5c98c11b2c +cc04c4f937289590e5f7ee8d57940f21373a81b8b92eb7ca978c1a07af7b1065 +3e6498a6e2fa734269d61cf0dedd647eddbbe395e1e8190552f9a4332082bee0 +87f28fd6bb19e48de8ad662f41b4a5de657511f2329fe6b541f50ec43be24d5e +e7336712535ece6a590426e10422d130f4fd8b0fe314c9fe068c6a45835994ae +7bfda8ae49fab23905e4d8b374fc654f336b36b2080df61abc288b26b9ca7b42 +68e46f120b82cdcb74715e6d09aac096fd117ace3383beaca52aa248cfe307ca +8930a34b7062fb153d968c93169dd223449ca68765480cfdc5df39be45055d37 +8ba14daa5a4745a9f7b76ab664ef3d5b2fba29c60a06d1a088c05eec6d95c080 +1974ec344b24dfd892db7874e3e9df0fd61ef8f59b525f92f2b374999f923f34 +668e55cc90ff2890107a7528853f44177fa52a071f0ce997ae94b590289411e4 +c0669c936d4b885de8427b60b2f8820bc9d6781bf275a95921d8cf4f55cc8cc7 +73ff7d001f4fc5c41ea1c755ee48c5550677755aee061a3ac85bc0d9c1e5b410 +f38ddb877fef4ad4142c87c42b6fead87f1daa99ee0fbe7e7eee948672373a3f +7ace2444607921c61cefa7360f3194685acf836165e19395c2b2c9cb5778d9a2 +6f35f91d61e5e4838aa23909b46a899a1e02e27ebfb5368f1080272f6ae9adc5 +44f512191bf17dba3eb22d98b9b934f359fc86c9e451d2d4194632a7db5b1270 +6a58cea47392fa8cc24f6b4ec5d172e9e5601617d8e22e837c0b35b4281364e5 +81757e2fccb98fa88879d7ccc568fa9b183504b491329320c968b5611eb1f337 +a6e50d6faac591da994aa47761865ab84651c328bf259be59bd752f110f89081 +7553823cc67e36721e95f1c4e2e372e020f2b2ffb045aa70ca4dd6d55d88e32d +c8a17492ef28a44d4a536fca8bd75b3dc392fc296377b2c4743897c32eb65283 +e776e8f8fd97c661c67c3f0d97343af141bf6b77499a13af4605e36d3f4c3fab +12bc5daa5db1d12dfe5915acf14409e9302b1bbc8c5861948eae329ea31132df +8494560e564bc16073c7a777fefb30cac6f4b8943c70195289946a60f06d4306 +4536c2740995b7247451c9e1619f7e277af4bcbfff6b68553ae23eef7b179c16 +cab6aae7b6f5fc72e0d7cac34611d1353716580948ba69dc534a3fa592984244 +c1bbd0a6d3f1fc4d9c8ff48e770f5c65be3b5a961e2ab8931e73c8222e6eb481 +86e92906bf2b44fef5a59b460bc88ad1837730515d82c337c349cd087329ffff +0718e22bd3f09fede7042992a191575008890c5966f1230ab186f019f1794671 +8e619ce8706fd94bf0fb1d6ec22513150c1b9496742a94e048df079bde5d7bf3 +9db82668e5f5453962990f4e3e0245cd2e767c5cf3754c1371bb37bb7e14db75 +a90fcd5de1a7d75748289177ebe65a397762b5b1dbd468e7cbb3fec66a6b3f2e +8e9a1802bb2cc4506b3ad1632d674f1d54a0c1c08787f274b48d60e9111d8035 +be3af44a3a12e16175ebbafdee5cfce2a9a26cb9826c86207f8ea895e5c2fd66 +216be83f81fa47f39dbaff3789865b1bef63bae463b7d166dfba5e3e9967697d +f6c91c7dbb765bdb91f4ee5920567a94199416484e75cb6b1c0d1bdd62e831f2 +4b6d7b1009bea14c78ca6b8f1020cb05c9bfd13076d5f335d0b8ae417fa26c75 +d04a28a778d8858e64736fa0a5ba789b58b4d05540ecdf28ee044ea18704076f +c3c92090d119bc67594021aaa4e89a063ac0e64f2198c5cdb3951c7681ababbf +6e96666f467a0fdc729efcd2f1d94e193d8fd56802063840696f3eca394c2841 +6b7e6bd4759aaceebdf82bb473d49256e653943469db71794ae96b3d130bf97d +752a9b3bc4449bb756039609a4f9fcc63c637d8672f2f24dbd49a5f9f5139c54 +23c4a1cba345784f28b7933dd3d2c9938b35e63678b045ec314fd9e9188f1b18 +ca034a26f5d7e2e779cfe4d16560ed2e4f3ac2bf1b5324c6b342e29b5ba3c9e0 +7bf1bff519f91bd9cbd4c198f0b98431d83d7309d0a4b62bcd450d62649e5b41 +335d87c297d288942a637999c2dbdaaaeda4f68d166265a37df001b1a4a5f561 +64a9a7af810851d98af3e01b0e4bbcdf33d3035b98118b48c6452da0caecca10 +228a308a0a3844d57628b2dfd7189f1fd252ea1ce3cbbab7e71329b886cc36ef +b40f642aa54698e87f4ce8b310f0ee29968ae04de003fbaff84d866e4220b607 +3b3c5fdfef88354a54d4318dd852ffeb9be81630c673e425fd3bb6ddec9f298f +a9982f8a5859b983bcc09b989f4a71ee4a54d38a220c3ce7491e7d996d8b0e11 +b085acb8f217be35f3eb7fa08bd8ea8c66df8ad00e329ae732ce12801aa8b1a9 +40db1a7b303967c185b90229a1188eeda3a1565dad1c08181fb35ba03667d513 +9f2b6a71dd27e11c7db9a7eced6404cb09250fa0ae2f0fe7fa61147039cb8685 +e7a1566e25b40b1f23ffda5515c107e3487ede0a148f2d8500f102b4f517c956 +87b2e0399387f4a9067ecc725bcb327ba5e98d5c68fb54ac99834146bbd7e91c +b04d9576bb16e39608c14c25aae446d250b388610b2714757631c18feb700057 +c0022456c9ea28140a150dc6fea0333ecf9c291d95505de3c053c1f957f76a06 +a5e96f792200eb5f1811e86d70c9bf1e0d28da28b8c6042555a27ddd0aa168b0 +0f3c113217d990f6ead0a6ecc4ff4c92c577121d2b1dcbff547c03184360a6b6 +3788919d20302f0c35541b48cb6e926be087b1f7308041dc8cb8f161d8a8bd32 +ecc861efd6ebe16568dd47b82fd1a02200733fef4176a7477185d79e44c128fd +c54f4f28cee76dcded7399bcfebbfa620a6f5e4df5350fe6005f84541a6e77cd +97ddcf704455f96435edb3666d9cb57521f35e258eeb2163944c90cbdb3d4a70 +c94b9d3905fff429f16560c6bc44aa27bb481e24d03f29f135eef38d973d12e9 +c251de1d9b976d4d7bb7b4f62dc7a6093d186d240db797432dfb5e71f8fa09d1 +b9b6cbde7b4674bb3f38967091b8b375c0e7dfddc0a206b0d8908707521254a3 +35be48528674c8597822a0a9e9ca84f0b3d2a44ec9deca0db51fa2ef3db16851 +7939ebef52b5af799ff6fe86b0cc459be94187af479e95651233f2515e01ccc9 +57130b01e6e97df375396f8499535a1fcc0dae920db25db41477263a847b578e +8ac94e59fcb69b97a1ebf8d84e2fab6925bd16077d5a58403539acb40adbb89a +55623d7e09a8481e71b47416751f01881ece4d94ea9cff6dabb3546ff2cde4cf +1ba77ecadcd4499637e26c5064a342d71cf50d725c40286ad352bf97e0da521d +58055ff97c68768b4435db372f0b3d23845d7709ac47b2a965327f62573a8fe9 +e9c5c435ddf12478bcdfde41c0e4303b03949446ec9291c553eebd9add6bfb9a +45165ce3820af4264dd3b54ac41e4b2df6ede1286973660e37281c7540beb69d +16a86ae03b8c5ce7ac142585f72a0cba8cfa3c71a54db60d1305790ffbaeee1f +f31774926a1da96a37574c9a5b66daad0a68adf9f104123941ac4d3342c13bac +b9b124ec9db917032e3f495107f3cab93d57751e88a5369e27358ecf4f9348ea +543fb55c0492862ce28cfb1f28e0e5ffaa32df8fdca241db555619583fad76d5 +04ef599f233c424359768f6e8f0cea95774901577277dfd8f90418598e +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F134_0 /MFECUR+NimbusMonL-Regu 1 1 +[ /.notdef/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash + /ogonek/ring/.notdef/breve/minus/.notdef/Zcaron/zcaron + /caron/dotlessi/dotlessj/ff/ffi/ffl/notequal/infinity + /lessequal/greaterequal/partialdiff/summation/product/pi/grave/quotesingle + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /Euro/integral/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl + /circumflex/perthousand/Scaron/guilsinglleft/OE/Omega/radical/approxequal + /.notdef/.notdef/.notdef/quotedblleft/quotedblright/bullet/endash/emdash + /tilde/trademark/scaron/guilsinglright/oe/Delta/lozenge/Ydieresis + /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown + /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls + /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis] +pdfMakeFont +%%BeginResource: font ZOVMRD+CMMI10 +%!PS-AdobeFont-1.1: CMMI10 1.100 +%%CreationDate: 1996 Jul 23 07:53:57 +% Copyright (C) 1997 American Mathematical Society. All Rights Reserved. +11 dict begin +/FontInfo 7 dict dup begin +/version (1.100) readonly def +/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def +/FullName (CMMI10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle -14.04 def +/isFixedPitch false def +end readonly def +/FontName /ZOVMRD+CMMI10 def +/PaintType 0 def +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0] readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 45 /arrowhookright put +dup 58 /period put +readonly def +/FontBBox{-32 -250 1048 750}readonly def +currentdict end +currentfile eexec +d9d66f633b846a97b686a97e45a3d0aa0529731c99a784ccbe85b4993b2eebde +3b12d472b7cf54651ef21185116a69ab1096ed4bad2f646635e019b6417cc77b +532f85d811c70d1429a19a5307ef63eb5c5e02c89fc6c20f6d9d89e7d91fe470 +b72befda23f5df76be05af4ce93137a219ed8a04a9d7d6fdf37e6b7fcde0d90b +986423e5960a5d9fbb4c956556e8df90cbfaec476fa36fd9a5c8175c9af513fe +d919c2ddd26bdc0d99398b9f4d03d5993dfc0930297866e1cd0a319b6b1fd958 +9e394a533a081c36d456a09920001a3d2199583eb9b84b4dee08e3d12939e321 +990cd249827d9648574955f61baaa11263a91b6c3d47a5190165b0c25abf6d3e +6ec187e4b05182126bb0d0323d943170b795255260f9fd25f2248d04f45dfbfb +def7ff8b19bfef637b210018ae02572b389b3f76282beb29cc301905d388c721 +59616893e774413f48de0b408bc66dce3fe17cb9f84d205839d58014d6a88823 +d9320ae93af96d97a02c4d5a2bb2b8c7925c4578003959c46e3ce1a2f0eac4bf +8b9b325e46435bde60bc54d72bc8acb5c0a34413ac87045dc7b84646a324b808 +6fd8e34217213e131c3b1510415ce45420688ed9c1d27890ec68bd7c1235faf9 +1dab3a369dd2fc3be5cf9655c7b7eda7361d7e05e5831b6b8e2eec542a7b38ee +03be4bac6079d038acb3c7c916279764547c2d51976baba94ba9866d79f13909 +95aa39b0f03103a07cbdf441b8c5669f729020af284b7ff52a29c6255fcaacf1 +74109050fba2602e72593fbcbfc26e726ee4aef97b7632bc4f5f353b5c67fed2 +3ea752a4a57b8f7feff1d7341d895f0a3a0be1d8e3391970457a967eff84f6d8 +47750b1145b8cc5bd96ee7aa99ddc9e06939e383bda41175233d58ad263ebf19 +afc0e2f840512d321166547b306c592b8a01e1fa2564b9a26dac14256414e4c8 +42616728d918c74d13c349f4186ec7b9708b86467425a6fdb3a396562f7ee4d8 +40b43621744cf8a23a6e532649b66c2a0002dd04f8f39618e4f572819dd34837 +b5a08e643fdca1505af6a1fa3ddfd1fa758013caed8acddbbb334d664dff5b53 +95601766777978d01677b8d19e1b10a078432d2884bb42d1f224976325883657 +05acb022d1e9cb556e37af91917c78e98229e3a4dbf03ae741998542977ad6df +1760fc1f1a479464922afda2cba7961e9da696b71205e19c542c97f25419c43c +fa1a042ba0cf5622ffbd3e775d0d564135d99b9ffba011eebc4066b003ce2f88 +825936d7393d05d3804601cee9d123120fdf73624a9d4e361a28e998acec53f8 +7a62a0aee33be2e96542534a8af24497d1c377cd7f723767b44857d94c6cda7a +c3d6f0087fa36655dd2b81eaecb31fe4f4a2fb1ea9fbe8b83d35826ac93fbb4f +2bee014f41f8f276510cf5ce35c3954e8cafc521d0c3ab80ea8c7fc29427a1d4 +42d6f6c1800919e58de9ae12304d718ad80febbb412da54153469cd51a288628 +ad109baa77981525b3d9b0efe593537fcbb8520d38cccbd5db171a0385a432c1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F147_0 /ZOVMRD+CMMI10 1 1 +[ /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/arrowhookright/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/period/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef] +pdfMakeFont +%%BeginResource: font ERVBFT+NimbusMonL-Bold +%!PS-AdobeFont-1.0: NimbusMonL-Bold 1.05 +%%CreationDate: Wed Dec 22 1999 +% Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development +% (URW)++,Copyright 1999 by (URW)++ Design & Development +% See the file COPYING (GNU General Public License) for license conditions. +% As a special exception, permission is granted to include this font +% program in a Postscript or PDF file that consists of a document that +% contains text to be displayed or printed using this font, regardless +% of the conditions or license applying to the document itself. +12 dict begin +/FontInfo 10 dict dup begin +/version (1.05) readonly def +/Notice ((URW)++,Copyright 1999 by (URW)++ Design & Development. See the file COPYING (GNU General Public License) for license conditions. As a special exception, permission is granted to include this font program in a Postscript or PDF file that consists of a document that contains text to be displayed or printed using this font, regardless of the conditions or license applying to the document itself.) readonly def +/Copyright (Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development) readonly def +/FullName (Nimbus Mono L Bold) readonly def +/FamilyName (Nimbus Mono L) readonly def +/Weight (Bold) readonly def +/ItalicAngle 0.0 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/FontName /ERVBFT+NimbusMonL-Bold def +/PaintType 0 def +/WMode 0 def +/FontBBox {-43 -278 681 871} readonly def +/FontType 1 def +/FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0] readonly def +/Encoding StandardEncoding def +currentdict end +currentfile eexec +d9d66f633b846a989b9974b0179fc6cc445bc2c03103c68570a7b354a4a280ae +6fbf7f9888e039ab60fcaf852eb4ce3afeb979d5ea70fde44a2ae5c8c0166c27 +bf9665eea11c7d2329c1a211dd26bb372be5822f5ea70d99eb578c7befd44cdf +045a363056e5e1cc51525ea6fc061dcebb337208eff729802376a2801424f670 +0e7e6397b28f15bc10b40012b0a3eaeb2693e8f7f627c4c9c7c6c5bff105c1e4 +1b2b9e8f09253b76040d268b80719e1b3f5a55ab7b892ad5e69acacc6c1640eb +3067bfc64938f41636db8831883bddabc6777dee17f2e84f1d530bc76f51c621 +75ec6b727a82c193d1c0801ac492bbe281b46626bd21f2adbbfd144793ef754a +ea5f1cda3310e83d78a098160c66d6b0c68d4976898d9dc1a08d01740ac3e7f6 +8d3ce0a7e109104248cb86318400bd82ef894efd9c9456e97055286c144d3efc +d2625110f1ae76241079bec19939ac962e0ba813359c15b07c74d5e9868e2167 +ea1199d21ca8827cddf1be8357261bd32e79fea6bc475577c5f6848345bce58d +f5435281572ae6b33b53607ebee6f862d4c752aee43c00cdbfd258c7765b1358 +5d6165ee034e5815de79cc26c4a720607bafa6049710ee3782bc2cd84fe2473f +1335d20a3b6e9e8355af36673cdbe63c27d4f0e183fedab10031b1ee33b9573a +2e1961b7c6baa41f7c3ee707fe86071ede5756a00d7b3bf0a21b7c3cf41093cd +66eccccc22f4534912cb900b08e69574b07f246305dcbc238780278aeb8c9e55 +3d096a944ec7aa9f697f354aa137df90a9547efec1cbd568cb999979f5aec6af +a84edaee1564d178541cf4631081781608fd38964257cf89b1c8e0120b3f6af0 +793597ad553cee5cccd5c4f09cb0b4e998e6e76243191af7e93833d067833f0e +53670d7e996ed67cfe6699a6e3815932ad272af4829c2ee08a30d3938c928d1c +e89af71192ec1247ca233093aafa54ffa58f4aaf3fe9c62302e598f4ff8cc32c +4d318391f7a36d0d8b416dd36d776b301425cbaf82d520141238781111a14cce +7927e2af21ef837558002539aaeb170fa7e7e37efd447c37db455d2f08533155 +53f3c5c3be4817680efd0ba3a114db6aaba6c4d0d57b09ef8baad463996718c1 +9d155a62d7ae82eae4c82760c594a6ba3c7ee4290f0d898bb3e404ccaa91fea4 +eaa2146ac6a23f6c5a8aae834a0587d990024bbe8de485c71b916ad96dd66792 +a732a188e6a57c459ebbd7756cfd54770e2a8d81bd4618d916a30ec7084b2492 +5f77ab14169547eedfefb6f03c7d5365cef512df194628d5fbea6cf56d0f5346 +b6b6c1da1dd8d8321b88807b579bb6a0c8f69cd919e311b6ade903b470f4e0a3 +dd5015c6432452ecec048dcd14814e47def4a53c5ca6fa9e91d8a28c719f9348 +509c0e17d632f8cb3f7468bb0e7f7f6525c086dc7efb997a60e059d3d4938489 +23e60f7c67fa6aa8062594f122a48c54aa7c049859928a3dfc72752acad074aa +416c667fcd176da4d7d31a9f6be6f146d4a9dc78f419fab7c9e6c74d40ea659c +24098088bea26bf5a725fe56025d1fcf8465ed7103702aef74973f6fb697e645 +e902d65354a44bb3489007c555a6a08bb057eca27c93bfcee9de42e2782fed4d +664ad7f2d238b7eda1ca4ad473bb9559e11a9f214e258ce1a2a60512975b112b +336864238a36732c3adacbfd52c85a0dc809ff955f9c81401f72107f3d263999 +a69836d76d228ab4f954b00da07bc4a4e165f2dc5ecd8138cc408ac22217b15d +8baf04408d4b47e55129b0e596c93d10cd42372292e1ff483868e8510076f7f1 +ed8ead1bdee2b49533f87ddbef2abdcbca432307f7ad0b3c3d4721f3e67e609b +b06f8b7e66af7c843aa1f71bdadf0f4fb6baac84815c8154a0023cfb68282b4c +8e24e478f81f8d26ef82d6d0e1da4a65478f4a1f65a7dfb4d1700207850c33f8 +148158a784b452ac6874080039e2259431c05c4522f1d67522e273b443ae9820 +adb5303cd0d839ffd17eb1fc6957159a569f64873b4b3bf99349c486a3af2b20 +b6b9c41263300ab0844d24daf780b4f324eda854d4e210daedc0e34f4b67fca2 +1265ea3764f8f755007b62e9e18e80bd30f3b96124065198c0a5985ba2172550 +8c8eabe77b26df4451f5068956fce111041a7d23f681ff2c1b93344fe688708b +61a47674c318d078fc4bf79217659987dcd1bda1e1b74068960036c472906152 +cafe4a8a702d271a02c790ea3e440e4f415556ec703a23b7aaf7bc50c5a32f7f +fee6426433e945c28be038cbe5ee0e7933945f052757d480c58d4d7dc4ab924f +985e054fd553d1c037beaba29b14e823a4091b08ed602a69d1c3eb0fd63faa93 +36db22e6588d3d2fa727916163030958cc89b3ce99ddeda6190f97e039f9821d +ab4e4d9a15cb5094041790b995d8950412bbf049bd1d8afeb8bddafc6aef748a +f2523b8313e13f90f966c134e39d52e10b63e30aadca42bbac5962e4e3f71337 +bc2fd40679beb44e111250352f04cb0404158bad9f74416c94003bd12c88d9e9 +5cac3a3eb575733eb44a3c32946dacdb3405f5b4a2513fdf9e6bb2e6e21c5385 +6c527ccc120eaf95d400847dfc9e6a40806330442e1895b53a6188e57c65b466 +da203785fc322efd64f2e6f66f996bf7ca035bb2117648a8857f1b10469aee10 +dd22d785de27f01f1d725b56b380917004a06afc0046335f97a2ff20ea44f794 +c1dfd6b107549e39247a5cb3f9c37af849e9c5f06214a570113d91ad4e14d9cb +aadf8ef93a933795c0cbfb7204dc605b4b3b95b9fed0372d8df634f7293298a3 +6aa4abd1f212ecd5d4ac49d467567385f80e163b9464f6554e48ff78d45aa402 +b5ee093a8f96da45504e41bfb1a72f579031efa801690a32f4e248a5f773027d +da3f3721d4fb481fd1b8e81054aa4a700e9964a87871e01f03fe80ac4215cdf2 +7a4944cf89a893638730631261114f8aab967fe29e280124fa8d51fc94b1c552 +db58e038097172d5f634ceafb877d7caca03436cf6bf40afe4dc99ce08d3605a +78e2c90ffe766fd3ac0e8b2ab247c3f689a55e350cbe80a9a452bf8666d5710a +6fbbc45e4690afc625bb7a8a29bc17aa582b6e200bd5123e26b2d445992a3a5f +7aa128c3f6230588c41c6c456655961b823e65d7471ad16f9aea07c2b3d39c45 +726f023ea4780719a3656ae18670daa3bc084e60fdf2ba1ff0204f285d72d9a8 +269430e406cd36741bb227a1aa28cedf9484689a78dd5495337bde66b5a790fe +4af761c0b505ff974e4c7f67348eb1887b5b9315a7b3455d3677bc77b61d48ec +f5ebdc73b25eeaf12a6c896a54b499ba5f2897b7da9465c34561b23e0e740eec +fc7adf944329e003f5266b94a425f3864b167a34d0b9d259fcd8d741c9dc0fb5 +bffb8c8cef470f923d7962cb5806c67763358a9f6ccf78220f28e45a84b0ff35 +c585c18b19c61b51cbe58007fb852e0a92ed6d704f15ff0f863528db72ea3dd4 +3ea0af466fa5b60ac4490aa5db18a649c442a60b4f824e914915376a127dbe30 +85a3c56ef4233579b756eb62e04fea0a55503f88bfdf011436d9d5088e027c26 +daa8165842a4ddd43fc3ab8dadbb4d53c5ba9a5b51f33d505fe3ed168109f1f3 +9ac5c3357e48cd9e3adccf2daaad831000e27307d6cb2aa6ecf5f92cff39b266 +73b1d3587e029313101a9075ab35de260f23f3d3bab5f7a6134fd07c076dcd99 +7bf2e7c40ff0c0fa1096312b791d638b0038138ed5c578e51309444691c1b182 +8b346fe0286e13e3907beda13044177c788b4948a4dd398aa9fc317665b250a1 +3570a783821db58159b825b14c2a639f62995a049eeeb8904226a8f8e14a7959 +731a74dc4b215d7ec095ebe86a3bf07080cdb0dce6d06fcc2e3a57bb04944f90 +8f395bd65117984c1596303c2781e3997bbfb6ab9f354ebcea7404785d8dfb04 +b19a3a6792807fe5debd6eeec1ba9ba9a37473d6c435bdefd5b2ea9c21d9ec79 +0043b5ad1b0a50f9a24594d00f8fd155681c33df8f0c0b3cd5a4fc275da65dfc +6c65ed8713956bb94b6281a4f39c8ef72b932adf3f6ecfa697ff7d84f93e7a29 +8fab7b48172e32ba7b3135f4a2501961f4a1c50403fc38c715743b55095ecc1a +38f11f1475521fa00f950776279e8a377fb4ca4870c8daa4fc67efe4db8e37c0 +d56ad93cd334ebe18dd6d92a3ea48b29e7e76eec5e8aa0db20ad690869053422 +8567c4b72be2093426677988f8ac9f7fcde0dac8bae175066a485f3b1d0c2129 +9e38a93996a0eb7a3357ee43bcdf8749bcfd7e7e0a23c7d9e118c4da7fff5661 +07454fc1ab28a875af7e512b2432256c401ea462d9aeb0a2f97270cf2aa8ec53 +1e5248ad52b1b74a376faaf7772e948f433cea2f0ed4dabec00855a394fedb83 +1daff1d977e9b816ebd27801505dcaa51f9ab531e6c1358b275d3a6ba38f4f4c +528f2dceea3a404a6362e3cfef9d904b573571a4e634d4852f3b922495af19c3 +c63c736d1e8a5b15cfc4da58f26f22be233b4579377227110f8fe5b0df57b495 +2c14d2011b6215b855c36d901f001e24261089f5edd39f7e5bbb2bf90c6f5c5e +7ba8928434f52689365ed48123414ead2e00f8860e60afb5f59d2715c4ee2b3b +2b10399ca1c3f70259c63762f64a5a1cb6b1995030a7d775a04cd77a95436e4b +c3b1f3d1959ded9f35fdd7fcde9b051245446dcac11fb3d0228ce4c012a2f201 +81ec3dd2aa1bd66ec02c93e4784268f754c9f0eba42d27b755bc58ad00e09e04 +e05fd21ed0c160353d2f5467b5903b4e1d1b8666acce06ada99c063c684d8738 +3d338c579595d1e2ab301c4236183cf2c3be0320ee83cde4ea050160b58787f2 +bad8154825c9b29cc14682e15db5f53aba109799c10f25fa2e54560fdafe6c91 +c246ae56edebe0aa30e152b61fa64e517f6cc41ac7b3c25ecada33e3f6d6ee5f +562542e0e66d9c07aa9889505d51452cc2ee73e3683e3fabe26f003b87d9fbdc +a376e85ad9547c23e463fa073429d32ca0e58326385a89106d5b72cde3c00c11 +c5f40d1e8b61e6cb1cc6416e28afa6caa469682ec8365081a21d77a8b1df7167 +6344226bb9a7533c0fdfe153878a3af3088e520b94933d0099c2ff89974bf795 +d871b9e5d40cd7aac72a99f351d824f86d33cc89bd70dd41f1a866657bac3a58 +a4eedf997eb49f8d967e148f381e753d5e67080d2843d44a3585e078615bea47 +6c882773d995f4154fdb773a7d9e29fe46e464e602cd206063c96fc51c30ffed +cecdfa28a951dd5211acd684ed3efd9feaa5aa98b091aece8681999d7c8ce708 +1c64f09e18e64198b841d7824e03de11101493975ecb1b7d556714725a14bdb4 +5d9237ecf693202198964c1554a04ab3485bbf9ff863441da3511d8fe6363e32 +a38a11f4dc6a1ee18bfa3a1c2c93a90675b0c21959054b17b1af4d533c87ac69 +08d0c344fe817d6817a74fdb46f35d3b48b9128784f43a68d809425c6570c600 +9a76199111e88a1c9802de558332000dbb9d1211929d509af5915b7ae8ea1c3d +d2598f5007de8e7383f7453fc6a9c0b91c80e9b1742bf6418dca69450785fb73 +12dd228889cfbc3f6711a26022b29f9295ee1ca8459305fbf2b93cb3fff5b6e7 +2b5c1d2c4d453f0b9a53b6f361136b1048b30e7c90e0de8edda423e55ccb2e2e +ee7b502af2baf30a92af542869b8f26ee28509dc01492095e0c27ccaa30e0db6 +3f02f11dc0ce8a94b8a8a7ef735e4fab04830ef077a8d788b224c184339274fd +5f7b547b77f81bad985c73b05a79d3c8661a9c2b71c7313d8b9cb50ae03aee95 +2dbf1afc9ddfc00d59e6f99021dffbb66acddaedf48df5462fc528dfdafa5e5b +a039d6bb9bdd1a78e47684a3c53ca307abd566093c2a4f6b9f0be52d4f1f2758 +ec48370eab4e1e6ab393a23358bae52fed3b270124639dd0a56ca6afce77494b +34f46433cac90eb63e7e0d25de6c8a0670b14e83d08a531cf2148002f9a6df19 +7f87c989b831c509df23057b3ec569eb5f5f530edd047a53b5b59f483703bdcf +b578fdc44ca7487e3d39479ca4760457e7018af01116b29bbdf7c3e0f5c07a8f +7f502c15059d9635b7ce630194962e4183c3838d9401260a743d8ebae1665ce8 +73bcfe5d090a8984e98030fe6b21dbcb49398b6905ec04ed310e37cd069a85d3 +7cd9e3a02dd8e036b2a79192ec036cf7e10653e08928cb8bf4911122d27e195f +48d3dfaa34122ef2df8e023c9ea1f246af2879f5df632719bf7a91f266d823aa +caefce067bf74ee0d625cf128c3930ab83521380e0ceb5daa2384da4ab23c34d +0db8a4acce1a33b6deea3581efe521279147ac1b36e4f6b2c08df2b2dbab051d +264a250a06ed06aa906c2682ad2ecdccbfd880941bd824d021f086560bfbb359 +e2519a2708a4976f42913465e18872a93cda809a85730a4930ef1e3e733292c8 +06c80c8865645c6a69b128b1333c3ac8c616d3e3a0163aba54c7a51a063fbce1 +4018cabe1b1ebdafaefc27d2b22afc96449cd515cced671baa88d51c5c778bfe +00208127f1fc35db9c6afe4fc91dd0bb1277181508d7b9868a055025c65394e9 +ab7a95494118d20fbdd7ce0b5f11492df5e8c54c1ce1ecd2e7279e07fe6a62d5 +63d7ffd38f04ba75057cf190319634f57aa246f03f5f904ff952d7b1006d43bc +ce88d89ade52e861aefad538b644942b6b97e778000de2f2ac2b2280d85a823a +176d8387ca420a441980d3e866604325917f78572ec9ba14a0944e37480ad3ff +9c10590c0705840d09c8bb076a5aae81b5e315ca901e262b773143a554360fda +3dc799fd07482666f47c17d8a5bad6efa53f20707869c5fd40d940a885310cd6 +d5ca9c351731fa69fdf0bfb148e17ac26ff43bfbb38c101867ed95d789ed2b0f +61820249b398fac0c5eee32032984302eb1804b82bad515d721213732ad43b95 +d4a02e17b22159ca29e300042804b75807782b9bda49255cccf4e35c461ff59b +65e36f6c6345dbb2e8c2f5445031999c2d8f0444cf4198ac17db48199c3b3fec +02a130d230aba456406e1070178bdaafc422343ed9edbf471c965d2b891586db +a34bb2d66f98f716e605799f3800c68000941a52d691640583cce11b94cb5599 +29fd0d5e8a9307831fe15fcd232eb361721d0da9e7ce111ff1ebc256a407372a +253180e51f1800ffb0313c2c3f3c4fcddd59f824dcd0eaa1e59837487288b558 +7f8e6d27954208fb815ed1d54a36476a95c660751a2ce7d475c72ff1784c363f +a641595eb92e65d9e7bfe18eeffeddfe82d9f6f0cee37e6a9e60b44939263272 +4816df40ed24551f0d07d813aba49a80bd3560188e5d0170385fd15c34b45465 +3d5d59bf7624ab116452ac28dc9217b11c75a08d68e55b10e9567a9d3d8d5da8 +89116318aff25efab611da69e132ba2ff888d68c84c056544c0fe9137faa8344 +4008487c34ff2c2376558ce20108f76582965fb06c2129e607a0e60889d97fac +2c71a026299b071ea7f9995a542b7e31efede8a4d341210a37f7b4bb96aa7c31 +c873cc0c3edff7b23d8a22e7e601ffbbab0f671b02ba487cf6b588ebecd26f9b +b7e8de0cbda870662bcca90716c0ff768a9c7c69c1dcb4086f1e881c6dd5b3f5 +0ac517ca096f28b1c7ac9195f99e44d444017a3bd54a68f4588f0a7562553053 +8bfaf7788a7243c30446213bc987e3383913f24b36b33e4b082e507cae63358c +9675599f6d746305a417fe8848f37bf85f4535e28ddbc5868dd6dbd3148cdc1f +2c2d224f00c3af4c1ddbfd88bf79eec76e45ef546cae548825a0bca6bf93b0b1 +373af60a7b24a75079d6645d0908a9f55ed0fe7397100a730a6f4e55678714bd +90c887e46a2c7703b13b1dda74a819b97abfe6275a24e73901540168737a8b32 +ca1902b7577b8761b3c4a6b60dfad490e35d71c5f35d8ef382fe66433336951d +e4ee981f980168853438755f135c333b8723d5778e2e3067dc73b7fd99aafbe1 +d5a2d1cf443905fb45730ce8fff14674abded9f94b45756a646b4cb1f789c7e8 +0748f3641a22c01b10adbdc77760c0e2a0b9055c4f9107d935f5c2fb2fdd2845 +6d6d2d2096e4baf14bcc8d716adf053bfe40845f02c0d18fccc453f3f8e45458 +69f802f506ca21d0fab24d7f3d6d6c219637a2dcbc58614c1456a9c6b0b0f57d +09cce675fff4f626b1b68c0a63fb9a16145d58176cf27ff5d3513dbec6014f3a +2b5de7ce69c8ac2fc184bad23950b28cf0414801764967ff97022cd4865d994e +585ff2c992d480de31f549f26a18e4721133f3d88316976bdae41431d44ec8d7 +4eacb29aeb132ff49e3c646ef025eb541dcc54f38b8aeb562887ed6cdd07ffa6 +cf3b2f89e4b0fbb5226702068b8043b6e2f284e4350c97a7498e6440bc3c8d2d +27d8aa1eac980e960613180ae4224624b2c6f92ed4666e391ae5e159c0ce207a +7433e462cd92aeb67eb89fdcd20e46f17f3d15ee679c064176a2db0ad5c38eed +7595cf6ab9750fca76e8e5ea2443b9d13da375ca2a2dc87fbd3d81ed58e366ef +94952cbd918134ea08f90516854207a2fd92799c410ed1fb6a9c36877d0b777e +ef59b03f19bc6b8fda91ab8ae21c89d117825a1595466da10f20b86d6d223cdb +6976312c7fb7bffb58feadfcd019bacedce96ec239b5a799005e94bdefb9ec40 +e717a597326b5330f38fbf708d002c9eb8d8ea0834241a35e3a07a58a030e678 +5812bb5de1cb511426cf49ff39647db65d8a7f2f87ca5e903eb1478984abcc17 +c7ee0b1f7d1e9e3b81c663abcce77a90f1cff1b01f116d2995e65cba0b3f1a3e +80079ece2fc25e0f5cf24507c99e5b6e87a417cdf29a1a8c58aa747afa962c25 +14671fbe467e22931a723a236aedff5676acde6ee71dc9eec11301af96927274 +a732813a49a473edb7e9886b6c45605681a563f32745d60cb4a26a7064406756 +c9add724e9b400097377258e81cfe085b1abdb3a00354353b50c9bd11a6e655a +d264a203708f739a46e4322a1a8204e32ae385d4f7694d6ad63f975986ffd869 +355b7ea9c0feef8f6d7bcce3128a0e45853de0a5f442bb805166c7906c9f1023 +df70bca683907a0bbc11249670f81c522441aa6fc4e7889a38d15ead8cad4ccf +e95ff5438d0edc450e6399f0228ea318dc2979e7e5a36eb76f9d81061ec8c615 +217d9dc7a1d0924dd953ad2b741e48357953d43186da75f340c58b7d2a6c7eaa +3038fa4b66b0ccea51af9610e5558d82bf79a301d73d57b6feaef32d6f19e801 +e37a3c1ea341bee088e322faf9ab5ab1934b70f894853984abd5f34c4d3fea05 +5ab4fc70179cc9f1379f98b3d1f529f3c2aa4ae63b8d2bfd46afdbcda8ea11be +f32c93eb4d435fc37486a1cbaadc3c98de581ebad18f35175d7b3e67c9194d5b +bb3cd1918e86daacb86055a548fab07ce7c933bd984eb713405d2b3f48124432 +a88e10b97f7be3a270405594d3e06c17b47719e2678f0f069ff1abfe7d3672d7 +6a748a9e277ffdd25f5477d0c9d60d7e8da9e0ef30e5fd6c70d47d31637bc0cd +4d67f5ed2b103889a61fd11075aabce9f2517ec9b53d7db5b27790d9bb1e19c3 +d7c3a7e1b95516ee38062d4ea759151e4de0449e6aae79500c42b4efe4936d0d +000fb3391330c035d9d6b9e25671f9ac599a40c37b2439c06fdfd988abcbaf77 +0e42d324e8ca78613f35ea64aa88c3c43e51cebe8ed1067cad94ea0387783e03 +e76af474f739b9249d1e95eef85ab528e8cd2da99e33c7ef0ee9df694db43f3d +fe467e6fd1b5291ecbf6b1ac7a25c002dee8be0727ec5439715bfd8f854843ea +1d080677f64889d70165f1bad110a8baf3885629f8ddbc3d3b09c57dea28b4f6 +7a3c042ce64d636d0bdef920ab5ef9544f52ad533837867c4930fd4dd3213e18 +ae2ca622e0e218b1bd54bd60e01d4cddfc2e9b64c6c99e79ab2c3e52cbefa598 +434213d475b6292190b89be95b3c6660133e1b498bd7ff2fd14aab2aca0dffaf +62d9df30c19ca0e949007dcf8453e70e60a519674d305523d33bfc3119037236 +19cc4ab1707db2c4984c6d4fb4310932e9ede7808cfc7d343a7fda08068966d4 +7877d7de7c0f5ffbfaae5666be3bdb48de31c5ab6bcfa7d35816e5862bc4a13c +ecf2355935040fac37141f7bef7e58f7b025e187df3950edfd6cea20d0649071 +442b2916ebce5f4d3ce055efdabf1c2dc348ac0ae6777f679e2f62a0a3ee9124 +7fc855bfc6f0c337a74c44ea1f5dd32ce6183a4c80a6b967861f6101c28b72da +d6aa1128f196627e24179c18f384e27cf7f81f43138381d177f93f8082cc9d56 +1b3c99f1bea073a1a81f8bcea131e3587b397937c4029d486fe6842a709558f7 +43cd16c8f0a5e4fbb3e522663b82e2544a6fecefd3d8a2b222301fd4988c0136 +859e86087fad63292bc4187412731a966710ca9ccb86329560d64be31ca4b526 +82245c1a487046ad21dd9a270e3fae72fecdcf9608784f649a25474034ac744d +44e14e72d02ff17b2252aa5273de3ba3cd71a95070a9fed0dff80653b3d346c7 +56119529e5bcb6011d341e368827cddf22d4f99f1781829df808507e2b4ceb13 +211b08f55444e75a005639a20c33706f8985f3308c08f77e72dbfbe049ae8177 +c2da2e62eb58f0fbb369f5bab0fff49f9d4765f931fe66f8aa107d8116becdfb +466d282527bab6fa29721678837cb46d60148a7fd9cae63d6aa634d23ee21161 +ef9e834520f367903a65bef7996ab77d37ba97aeb2a7a8c3502aac988e7a0430 +9d67a06db4a90714fd1a933402df0830026920bf1f71cb0379bda8714415c9bc +e7795fa4ebc37e819b3d8ee65375bfdd6b36bda41b7791864389e9b589919ee6 +2872bac2e221b28150d3024a984033899e5372ab474b9b4494f7bb4331b6213e +7953565f35d2ea6da212956dab01571cbeeef86293c58a259860e294f69730e6 +f141680cf75d40e829f9679e98341fd1e0817cb8e40cd6c4fa691ac691fb59df +b78e87add951eac41ad1b4f4fa45d2e346e0fa73157a7d2b2df89ea56a80e885 +9e0d0331d216db4f1b95d662bad40e472f21bbe05576ce4a2d27af01880f438a +30c17bc65fb460ac1b3e01aa43aa3677ba05a437fcca3ce4c2864d99c701d79e +3a199dbc7e2f00be8d4347f96b61ba0f88e90b49d412d0ed162e82715ea04c27 +af3feb0a7b3e4dd17c875a51e9bbed3c9e10eaabeec0f029d94fa90d60605b52 +2dcff539fbc323e7f0e1cbfc1a192a44345efc070bd5d5939d9f4383897704f0 +e785126abd9f582f1afe88a727784afdac3dca49892c6beb52cb1adee18034e8 +e88a441890175575951fd87594b63751e69165496d566bd23c8db4b9239bbaa9 +ef5058f5b51c74cf70632f88f1a05e1b40078c183ea8433427f63a5f68a1b81c +bd46625b8ba2cf713c001cca4c74a186f93aaa3869a517dd64f1e81c71823239 +1934faea604cf4d9ddf974fb09c5786bde05978bb25209b5c7648602dd62c32c +61ec4b5ce1177185354dd5cdf15540121b6d82457ff3111db1aab1889fb0e3c8 +38cbc7a671ba16a4bc567d9cdd427205e8f4de7edc64c00bb6080071130b43d3 +6e7919a5b7c29c68ac505ff107d1e2ab66a3417612ba2f461548f1e72c702a19 +7a6311dae649e46768d85d759281429b97a35379b84c763d35cfd434a4e3bbb8 +4c6e5ee8dff3a7449bec14c785bce1d4c617217ee6315fda000f0c54d1054e80 +c8f9f452daaa465f633ffc3eeda9c76e7a77024eaf39bd5bc9562fa44f3da9ae +7e665a33bd22aae6dbc1d9efab63741e30775eeffb819ff933342c8e6b978f8a +2aa20c2f2810072c4f2437e7cc13861002ab6d5ee84a6f80549683a34da3cec9 +e3471d112332ea260153836fa24e22eec0cdb0a5b3b0773cfd237daa67c55aa4 +cbf1cc30f43183a93bf7d7068ead32ac8064bb1f0a8bb61cf5472bcab360cf71 +b61c3443eae4f1ec7fc0d883559f8a2ff2522dcd7dad5f395e9ab2454cca6dad +07bb58bdeb1e54f75816dabea8d170974909b2fad53f9a69d97eb11ff20c6aef +eb6d76e9fa93c317115602db90359be638da383d9e01f6bdacb5ac5bd7c77d42 +d80646ace9f2384774610f63f97d70c4e81a2871be0a5b028c88afd82a3b6376 +5d5064a6786a829a6e6320120395b1541bfd6e3ec182d50982d7bec4140f146a +06890a79b85a6f20f9bf616f5f56e02752c5d177a48aa2f8ecb67e42e2314850 +d2109c0965a55d1e0f470371443991f9b8859ac70bd6f049dbf57ccc8e2e3c67 +eb8d1b4f36c660746008460ebc0f7284c802925206b968477a503dfa6879794e +7ed82fcc58443fa1d95fd561bc9d3a2ccb2bfa19916d8a88e6f7eff0ce0a7d4d +90c77f63bc75f3368f7a97dea9d9392e3f499ae4b8e53602636cd53ebdb42213 +c2668a3c618a76f6f5a96fc33c0e41ef620a63e3c52512c66b59f810c6b85923 +d81ff8618f42ee19b10d4d088bd6b784e4f9bd6bffe083161181b2f79b374fd4 +b846650d4b95b6c3e58449d8f0a201aec72d87588c54fbb3112045040109a3d2 +d98c778ed3fe07f54010773b628baf29ad3b91072fbdef7cde0b969d0b695bf2 +5d386c6b8647bfd55c169374c57d5bd8fb29af5c5a6718d7cee318a06ad35d96 +fbf879929e28bd43b583aff2769688e087b00ea95b28629a71c6ea847f988357 +da9e23422fe2ebc4c33f183679233e0d1d8150ec58ca6ca0bda2a529e6f6d146 +92010b1eda6360aac940ed23410455209383b68c3a1fd68a0ef92d16cd4deda9 +9dbedb1ce18a79817fb3d043f919f1b98c62ecc70dc27886b258428ae2d1075e +ef8c1225f96be5ee3c1b4e127d26bc2abc6d457333a0d5cce99dff00f3f41e0b +a9fd7bac9e96691cd316abe913a6edf95c6c5d37086cf3cb960b82684ce473ed +574fd8c6ca059bd679441c22e6c39376d3a33c8011361c834bbd7b87c345a9f0 +c6cc1328b5af926f763bebc13be92238da171124de119a097d65e5d623cbf157 +a4e93e250a6bc34bc54feb2889da3f5993eff0bf38ef6e440d0bdb405746aa70 +4e5de570b0347d52b25ae9e0ffd758b8d6da1a57e47289a26d0ed30e31474273 +c2315c74a39e6b26f558dec140d384cd3bbd7246bf46a0f7becce45fe0c343ce +78016204e814dccc58061d48ffc808423452985b12d28c94eaba89eda793f7b2 +8d9fde11f30434bdf73c48484a814ebe541f4e6eb817de43146ae4e04fa7129a +ec0e4b92ae22a1d2344375f68314d839aade59c4ac1d556538fd7a9f7ee9a139 +f3620952c6c45f7181a6448a807a1bf62cb59f440199297cbc8a360d0168c153 +7c6b3ba56dd0f7f104271138846a6f305f2c8a7536512c54a1c46232606a6649 +81a8083d59a4b5e8ca2cd0b70dd0b44bef1c2ae9ebcbaeecbc7c4bfb2ce309f7 +830ba06f3c8e79fddf737451a67d8c4425c51e11f832d99198c16dee864b4c9a +e48863f5a3cd0e6f3c5b31a6bff527bce260aefbc40b1d8065d2f88f97dd9ff4 +8b21d069ae8cebaa511f0d00c1da76207821859bb191d5f9261adff3e6417788 +5b493db49420f472496a8207d3f2d64fa3304de0e78d6259a626d8fdf81c51d0 +f81ef8c619507f0544ebd3aa8d1f200a5ce240a1171441438d6bbb19c0850bdf +4a0147baf4787513752e4e052a09d6b94bec96107e64f6b2692bedf2a38863e1 +15ac2564c0eb10fb923ef3d505f750bfb6407856406cc92e9b2a3a810fb49ef8 +e8f445c2e32b30d352fba6fe345c8af241307e76c13ed376554b857b23f2b10e +9f4f1d6b25ee850d744332fb73349790426bc3adf811998f84f4721247ed9dc2 +cb33d343ed9fcbdd001d97708408a4885ef05908333546167859788124f50eaf +7f9cd5b7a9f4a77b2337f51569fe3fb45e41dc50394ec963851fef76ed67592c +bac68e378043d77137974cb61772228d63d46d92821662203dcc0dd1db375bd6 +95c9153c7226202ee545aa36b0bfba49bba59e918e3bcad377cb461d52442b9c +d159764090efaa0a887a12b0c9884d4eb0cbae8b2b5fe1d68b8b13abcde73223 +234063907a8012134dc42337f131ce012a98e582fcc50c9507c1f87b83d62dfc +bb951dd48c3fb078aaebfa25ae1908f87d97915d86bea53e23c2c4fd426210cb +a517ee3681183d327a5ab42c02977c3221213e76ed5f986ad6bcc14f50651367 +f142a4dc6379213974fb90a7be +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F392_0 /ERVBFT+NimbusMonL-Bold 1 1 +[ /.notdef/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash + /ogonek/ring/.notdef/breve/minus/.notdef/Zcaron/zcaron + /caron/dotlessi/dotlessj/ff/ffi/ffl/notequal/infinity + /lessequal/greaterequal/partialdiff/summation/product/pi/grave/quotesingle + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /Euro/integral/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl + /circumflex/perthousand/Scaron/guilsinglleft/OE/Omega/radical/approxequal + /.notdef/.notdef/.notdef/quotedblleft/quotedblright/bullet/endash/emdash + /tilde/trademark/scaron/guilsinglright/oe/Delta/lozenge/Ydieresis + /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown + /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls + /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis] +pdfMakeFont +%%BeginResource: font BZXIEB+CMSY10 +%!PS-AdobeFont-1.1: CMSY10 1.0 +%%CreationDate: 1991 Aug 15 07:20:57 +% Copyright (C) 1997 American Mathematical Society. All Rights Reserved. +11 dict begin +/FontInfo 7 dict dup begin +/version (1.0) readonly def +/Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def +/FullName (CMSY10) readonly def +/FamilyName (Computer Modern) readonly def +/Weight (Medium) readonly def +/ItalicAngle -14.035 def +/isFixedPitch false def +end readonly def +/FontName /BZXIEB+CMSY10 def +/PaintType 0 def +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0] readonly def +/Encoding 256 array +0 1 255 {1 index exch /.notdef put} for +dup 32 /arrowleft put +readonly def +/FontBBox{-29 -960 1116 775}readonly def +currentdict end +currentfile eexec +d9d66f633b846a97b686a97e45a3d0aa052f09f9c8ade9d907c058b87e9b6964 +7d53359e51216774a4eaa1e2b58ec3176bd1184a633b951372b4198d4e8c5ef4 +a213acb58aa0a658908035bf2ed8531779838a960dfe2b27ea49c37156989c85 +e21b3abf72e39a89232cd9f4237fc80c9e64e8425aa3bef7ded60b122a52922a +221a37d9a807dd01161779dde7d31ff2b87f97c73d63eecdda4c49501773468a +27d1663e0b62f461f6e40a5d6676d1d12b51e641c1d4e8e2771864fc104f8cbf +5b78ec1d88228725f1c453a678f58a7e1b7bd7ca700717d288eb8da1f57c4f09 +0abf1d42c5ddd0c384c7e22f8f8047be1d4c1cc8e33368fb1ac82b4e96146730 +de3302b2e6b819cb6ae455b1af3187ffe8071aa57ef8a6616b9cb7941d44ec7a +71a7bb3df755178d7d2e4bb69859efa4bbc30bd6bb1531133fd4d9438ff99f09 +4ecc068a324d75b5f696b8688eeb2f17e5ed34ccd6d047a4e3806d000c199d7c +515db70a8d4f6146fe068dc1e5de8bc5703711da090312ba3fc00a08c453c609 +c627a8bd98d9e826f964721e92bbdc978e88eea0a9c14802ebcc41f810428fa8 +b9972032a01769a7c72d1a65276f414deedaf1d22be23f4705bf5ef31b6a3b69 +0c896320f09e9875b50220a5bdbbd57c041b5ea97f421685a7256b0d9755edbe +d05190dabf1c3dbf558258163c8231d89167a816bba55fb1f14ad04320ae381d +f783a9eacee8ae5c1838775fe2380bdd1f3afcccc96d2a2dfc999b52a6689c51 +af82b8d63205b339103134dac7e3c45e6693940276041bb07ebdb9b729e8ef0d +ee8bf450fa42551be65217fea902e28decc09580b504f0f52f1e8fc5ce7ac28d +c4e47f908fdaeba23827a97a0aa741aa7708f7bbfec6fa69cc4f7c3bd4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F564_0 /BZXIEB+CMSY10 1 1 +[ /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /arrowleft/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef + /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef] +pdfMakeFont +%%BeginResource: font WWWUTU+NimbusRomNo9L-ReguItal +%!PS-AdobeFont-1.0: NimbusRomNo9L-ReguItal 1.05 +%%CreationDate: Wed Dec 22 1999 +% Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development +% (URW)++,Copyright 1999 by (URW)++ Design & Development +% See the file COPYING (GNU General Public License) for license conditions. +% As a special exception, permission is granted to include this font +% program in a Postscript or PDF file that consists of a document that +% contains text to be displayed or printed using this font, regardless +% of the conditions or license applying to the document itself. +12 dict begin +/FontInfo 10 dict dup begin +/version (1.05) readonly def +/Notice ((URW)++,Copyright 1999 by (URW)++ Design & Development. See the file COPYING (GNU General Public License) for license conditions. As a special exception, permission is granted to include this font program in a Postscript or PDF file that consists of a document that contains text to be displayed or printed using this font, regardless of the conditions or license applying to the document itself.) readonly def +/Copyright (Copyright (URW)++,Copyright 1999 by (URW)++ Design & Development) readonly def +/FullName (Nimbus Roman No9 L Regular Italic) readonly def +/FamilyName (Nimbus Roman No9 L) readonly def +/Weight (Regular) readonly def +/ItalicAngle -15.5 def +/isFixedPitch false def +/UnderlinePosition -100 def +/UnderlineThickness 50 def +end readonly def +/FontName /WWWUTU+NimbusRomNo9L-ReguItal def +/PaintType 0 def +/WMode 0 def +/FontBBox {-169 -270 1010 924} readonly def +/FontType 1 def +/FontMatrix [0.001 0.0 0.0 0.001 0.0 0.0] readonly def +/Encoding StandardEncoding def +currentdict end +currentfile eexec +d9d66f633b846a989b9974b0179fc6cc445bc2c03103c68570a7b354a4a280ae +6fbf7f9888e039ab60fcaf852eb4ce3afeb979d5ea70fde44a2ae5c8c0166c27 +bf9665eea11c7d2329c1a211dd26bb372be5822f5ea70d99eb578c7befd44cdf +045a363056e5e1cc51525ea6fc061dcebb337208eff729802376a2801424f670 +0e7e6397b28f15bc10b40012b0a3eaeb2693e8f7f627c4c9c7c6c5bff105c1e4 +1b2b9e8f09253b76040d268b80719e1b3f5a55ab7b8e134d4cb5abced39ac635 +da001e9934c198a7f9b9ed0028a85e9ae00421dfd8eaa3bb3b4b4ce45d209303 +237bd51809fe4d880900b1eeb236aca87b9ff6ebe6b994a60af5d67ccc42bd56 +77295c346eb4c62bdc1ef22ee07daad928dfb73455f091f32408ed6430b97417 +683af27a03718a156e3f6e7b6e4f2e8177503cd82ddbf4557a3ccff4c858ae7a +f7efed6cc521a28342436b953e4650b5792be85ea2f989eb6d986905a61fa38b +96e1bbc830b74469150fb0b598a794fd80d10870084a877273a9502c3456e5ef +74350e6e3be5863e8ba185eb59fb87b36566af71200b6ed389d1287d4e925e33 +b2383ed05d87d48586e698fbc5d562ed9d8a09ec3eaa1b1f300224af20c23f26 +a2eadc74562571da84b3914d1d80b127c6ff4706c7046bbb372a0013e0ab94f0 +c27946583871d272bf4f20fa84e89d745de7bba885cc09ba72e0f530ed4ef7d1 +864b3c67007ed98800284235372f0a70c912e21e851afbf812165b8df912cd1a +013e271f0b347967876c68ae4c4107ef8ad1f170916210034c66394a9d971b68 +fbfc1131e37fc178eb97c1b2a0f573add9d7c0bf944e6529734df8a7ef54485b +a3375cc30e9e328943733cbd352bc15b06c85bfb4a96994291c72a0eae84fb01 +0f1b24d0125fb8c16d60561df8bb7aa7ddfe9549afb70c1e89424214609fde41 +9a142892e30f02754fd234ceb3c59a2a04c06bab7ae40e8fdec50559b8347684 +391c750987802d5452c47c1e0b5f222de9a0eeafee19d796ff375a1e1ef0aeed +1bcac4f485fcaee18aec585d1a9d80f41871dda45fef1eae82c5893118987beb +4d9e345c27c7419fe65e4853b40537d822e34ff1e0bd2819d21ef607981259e8 +9f1040a2d708d7463858aa5381759ac49df4dddeb209a278fe60bd2508aca0f4 +6a249a05b652e4c7bf1b676943cdc4602910fa3ea7636985a10f637832a5abab +9c7a580d605929d6d7154506217252a755beb8462d30a798ffa9b26e500eab24 +7e9fd612c776ae60423995dc1852686cb041e66357a9acd4b6a4e9846b1dc803 +23dab6b7765205d82b50cc6394e725c19df00f7db427341d514047e4bc594efb +a262eb2c414e43d8acc9cb195d12f3b2a9748f38edb3ac3447d27d20d1e62bbe +22f6378e508f0cd6f17ef1c500407f6d442e92ef2e00b8de78660d87fd1c7209 +ea67cdb37076e1eaaed128814a948e27e1f2fa81fe54be6c57ef8c2b2e460f08 +6ff1bb529c9100b1d878dc9a077d21805e89d8b0fbc2a074e4b55a869c96fca7 +8117347b9cfa480ff4a37b34b040a99fba99942bd86ce4b46ff5c69babca7a3a +f5018da05556bff71ecc844b2b718598f0825cda3d19d714fb66472621113ad7 +bb240de7dfbd1f17ffd8f2ef4b85a8eb6e1bfdf26c7f98168197c02c4aa535c2 +0f9ef9b7cb7f1d174b2e94953f541c3b84d43366e0e00a028b98f990b4d01515 +3ccc2e1853473bb9b25857e4b8f9d6695ef332bd3baa9ee551a4b142defb7f03 +97cd075ef9cd41082ccbf63e849c48835e105923e725d41d2b5ee0c3f03a603a +161713216af97bd21aa87e3a80d75383603152011530b8abd2294d041e90a040 +f61baf86be97f8daa8326eb1a2b4511425785f35f75835683515af6cd0e73194 +2b25d5fa8c7e12ccde33aa193d61a35eba7f7e101843e35dfdf3e07a1442b0eb +f2a9084634736a21128843df49c84b1061d0826777a754076c4c3d0a68b32dba +ed4b5c0746ddecdd79fbcc7a4425eddaa7f49257148f05ff52ff6bac71cb65ca +8ad5869cc9fd7c4c194ae8d5d20a730a035234d8f9a6363e7a49fc22bbd34d08 +eb7fd43a678be52b95eccf029a6b18a512d30ceb0b6adf80ff1232dfda1a5752 +b5222edd9012b45cf0df0644b2e713afef21255a08232efbd5d5f7506bfd050a +f0daf55b5db595d29361f8253c26c37e09b4f87056edd8c90e0df4fc74072541 +8ad8ccea562e4ce72acc8e9f39284fca274c572ffec24ba30ef9db07054965bd +2205d717c9b3b0723061cd74ec688b915ab6689904d5762629c891f2fc0cdfb1 +8d8a4d2260dc93d7ac1107b197d7e8418bbacfc660d888697296b7cc6581024c +e583b0114ffe3b3a960d601ff23c0f633e2b85300042f717c4718c0547fd9b19 +e74d0e18f6908e4528065888c136dc8767b74025ef5faf470a272f57f548d738 +c5d2ff6def4366c1c08e0b09855e04ec3bbd8cb6b770f638ac7d852b7b2250f6 +cfbb5669c9112fbf73546a9c1e968a1e1a06128efee6422e41df1519c7346635 +31fea419bba8067c6d0e964143a0906762197b8de95502ae9bb54ced17de5ce8 +9d628716bf1e306aad09bd7f8cb2b7dae5bfa9ef53e716d5aa2ca014eae837c6 +c0f2d5f535ae93682e855b1bdd6ce955627284a4712f67c1d6de9f80d4dda43a +9fe34fe4fab544459a1dfa0d1383c50bb3e6c3df078acb88db37ecb38aaabbb3 +cc59d3fbe6a84f1f9521b6e05d0a0b2e0fceae8eeea4f41976945501f32bb383 +455467d21777796688e57ae9b7b392d167b63bfdc1102565649b53694f1eb3e8 +5ec2f094ab06d427b5e1e7412b3369336c766a7fc778190dd5aeebef9b6a034e +133314cb512667f1a4eef90a1251ca9e8aaf7966ec96004c09c4dfacbb0d4c45 +60d8df4183d3598fb9584a4433c9131f8602474f27e4916b43de80ed1d02f6e4 +d208b014c0a44d94ef709930eca646b2f07d8358d48d0a768b6f13492e3cb877 +fe38c58a7f5468af52ffc11b8c02bd91484cdc022abe678a7f2e298a7fad967a +2ea7dc427e6ac154766ca4ae15fd414a76064823f3145724184e30ec4f1494c8 +78f7f63edea60daf2448de8a79801ecfd86a06ef122451dd2380bb1a4256a7ea +806d131e66d5a6e3079f7c2d7c143e2879f5316ffebb1bfa166a088b8fa9cb7f +4a5f0875a8ff5d378e9e8205c6155ea85756475ca5149eb72643b4ae1f907c0c +fc8f63150cdc6209b1951af23ff68188360939501770eac39ed55dadc4dfb1c5 +b2ef39c93d0326a804f62e8f187a224444098835ff670ad55b49f3cd0aba2901 +293ae04427916ee14c81f4044a05d9c8ad14ad4b5567e8e0147780a0bd294c5a +10a50a5cc7656f901588419108d2570e804a5e590004008776c8cf20b56d5ef1 +fa32538c480bcc1955321f954008871ba180177dea952fefec536f6522582647 +bc205dd139a18d2a41956baa4b002169cf042ab2ebf91ff203dc2e2559171910 +2119e94673a275d73f3909d0834b170e2b62beedcca27afb44a35ac51dcb5719 +82706f101b216b4af3523974378a05c327702b132335ff288adf62578f30cdcc +cf826898361bd49238f368ae2182fbb631e375e903ed9efb911a047119b40830 +a39909494e86aee21694223df1a57ac8e5b4f0465d0868939ac77ccb448d3f58 +36631cebdc06bf2865c58437568cd734efbfa870214853232ccb48cc57c8c32e +97cdeb89cf5e0c032e81de377b368f7d57187f0828675a52382d41de6cd9fb52 +2a1ccfde3192c650fcd7d1f86db03c401e6eebd0d40bf23c10e021ed66bc5b7c +ae57d0905bd24925c8573f069139883bbde13df3ae05bec1771eddb9b003555f +9d69657ac718c065a32ef7ca8a1ff5880fc66196e8123050a47ebe4dd5c1a4a7 +40ce1cf340bf08021fceef8172d9cdeb063f4e4c2205ae4503c71aec1836f9bf +96ccd0a712e33407446ceab96221d7b3f4342fc74aafa802481acecee7243807 +390b2d12c844193560738e576d27b0f5a90b25e1b5a27de8a2c74b3303526191 +5ee0251065475f26bf0bbca5549f13e1357797a5728b46ba9570c095d938112c +b3ba212c26cd6bb569ea276e1d8397569f8d4c78528490187a172d2e30dd0228 +d69fdaa25fbdb477c88d52f0ba137280d68656036c17b8852b03c21621d0b21c +6c016f18cacfa9a998e972f40eda07278da54fe5119babf0145d6824f051cd63 +91bc93472f780f00e261dc74d6673da37d8d9291e25af279829f8d47bb524c19 +8b598ce1c576ac8542b5ead99b039ac2996a6d791a22a5d5bb0fa3eb65d1fa01 +401d5c7d44a9cfe082e9314ada6f4ac8ecea5be8e5a1cb6a1dba1c615e69ec9b +0f231b64ac31c545859f0195bb9b403121df7be1ea1488b413825d8e1d7afbfc +e5a8e1e52d9c3ea6de3ce75d013cb7396e825bac3a50d0bffd2d30c6f1c5dc0d +83c1b68dd8b6042382285812093db4c5d7f6eaa8a4acbeba794f63610456a641 +42fdfd0c4c5f0c4486a6170b7701ca64cd1408f686fbd2afb56ba307722b2bba +c542123f766171b43aae5ac053094a04ac4faa3cbdadcec81ab5aaac58d3a7b7 +1dbedcfe63d062b11dbcacefea89c6f8916389d3f7d93da89ebd8c37414c7db6 +d6512a4e8c76145ac170faf136a023b3c31cbae9775e436d6cb2835b77b56458 +6905d558a3cfab0f1f3426557a66bf775292df056cfaaca8c087b4c0bcc2aae1 +fa49f346602384f743be6b1aa26134ba2872366c17f1dd356221838a40be3a4d +0b8502a964d360ea9bc58e4ffbf283c8294679197faf5d23aad1c89c3da84902 +c95619fa0ab76ca0c7ae725a1c5d9c40e84cc84eba8fc95361f3a738ddbcb593 +b3110db2f69ecf9da21d788d36a1bf986e2dd78c9e62f643e6677f80991f90a0 +8bd35484fc4aef3243bc3b460f57bf6f0a503b57f84723738e1b94c3029520c1 +f8d787f99305ef87fe64293b5fbf0a378306459c022f4127f2e2207ba818aac4 +1c860b70833b92cb7228ab2c8f68d03b6ecb67d4f83cb160c170298e1bff339f +306505ea4fe86929f115b3c55c7fbdb7f09eb38f7c8ca86c9c89d9b92dae37a9 +5839a181e6e55835da3e81c8846980ec5c16646a31bbffe54a8505e005c9200c +cb2b476083d7e55e63648146e8e615d349ed779b787232605beb38346e3578bf +d043797edc00f6df91c9a02958ea01f55f00d576c8a8d236e81b59eaf96bdfe3 +4de4125a3893acea97aa8d6373b736d4cc0166095bbb75b7341f06d8e3fb732a +5539fa8a27abc1d82f1a86a76870450fdebbe889dd048cbf2f184dcca5377649 +9ca0053aa9a88ab4d6f279f8a3ba704ed057dc2a361d07e5af6c9c8ce4b08c05 +d06635afce1cd7fb1288df9ca1f9a556d1a120691297d8134214da14db45cdbf +5545abb75134d45257b1e373eaf23fb600370cf8e7de02e7211639b11f8fa0d5 +6627c5718f554ca3351ac95c04dbe894e20692065af2c7a9e239449df4a65917 +2e0fa2bd3ebffbffd9093569851a31db46c8c30c1fb8339a7f742a2c89212831 +15459844298972b8b06e2c699d6acaaf331a023047e5b2041fc39d830b0851a5 +8ef1e329b688034f9c91927cbaae2ec2c84f8502127055ade448d6dd7eea3aae +392dce03347141b3b85f3018b3396b9fb1e4a59c50d9e8b82610088575eec663 +5686e7234e72e4690ce386fcf9d16b54c9c692e9324427dee7e096b6d4c45501 +da2d0eda66a1f29e90c00fd2c62ae43a97f611794c4704d179ce0bd63ffc4f50 +ab3ca7086bf942283fb0d175888a13e5278aaaa25a26e3df4fbf13e64519ad94 +44af171207f3f89b369ccd6162c0ba1320d30d3a596d9f58976f94434c1fb773 +e70be87528a9bd5fb7e494e6cdba0a3cabab8dc2073ea7f5b956bf5d5ca1b258 +25a73e0824ce8d00f4c945c0afdc4b57f7c0162a14b30154b61ab030a73679af +d43e322a04fc7b3c814f3b2d07585eae6a5254b43bc836c6000bf23a56fbfbfe +8478f1cd00150ee39f0aad2c7ae3313b8d619b84ddd8cd3878a4b306950873da +9a592f520b7d7e0cf9b9c97d35139eef9c329763869e64d89a52fed016e1cd40 +4497359d9d4d6bb70222418282cd9ed7f12c16cc1aa6b3eea9c812b7c3910209 +2831b0f05e644f58e878c1eaa3d587c89b26db8b9952e0bead12c7db6aa5a042 +9e33012db0551fe6a589baa800905a7cb35d220efbb675a96444edd18ad89dbc +ebc4087162e977b4cc680a0e3490bfaf28a556c3bb9299935097e3e048679849 +a85ce906f55bdf564f3cca2b0a70b404d02520b77614e577231cb2310dde1ba5 +cea1ef926ad191c98a21ed76ebb8f407ea2ae2ff56014216abb118c0218590f5 +f3284f9a187a85b3f5091f05b21d747f6fe7384a27ae6a8ddb923df4f61900e9 +adb8be5d338613e1486d710e892b5b733061951d164ae233023a69e02457e90d +dfb6d8a53ea0a57f3c9e27614633ace3c6cf57dc8c81d0c079642c4a0745d281 +2bc6ac4587a56e65d6955e50f4380d94f9628c130102e2a3325d694865a0dd90 +01ab118f393fd86d01aedb5612fcb49e8b81fa6fadf7b69650fcef45a0a724d9 +ecf8ced5cf56913fb68a39c71350acd855433cc25b25ade198cda46bfccf1fac +f1c841a1e6058a73e26e580cb46384885c417799d92822689c2f58bc1e0a040a +9d7d3d73de3c18688d62581d54a0eadf9deffb3db34a9f052bce33d5fe8e8ae9 +78e4b0bdcc2a8ffdcaa5b4c0f4a0256d94364e70e1749dbc2b147d69ec539b47 +ef868ac4807f7ac1f01c93b3361942915581efc754453f221f4a70bb903ec310 +62cca7ac392f6f70b61f49822cfd65c668070babc1102322e4cf224902f0cc6e +26bb2c119c3c66434f4a85164c49ed51084a1f0795eb631f6d38123619cc5ced +c8c6908f380a4a3f7939d0b03187e448fa44333ed8d8c2504c3fce0235795d86 +f7a7bb423d1a7ca81b27b4f81c93ac95ba336a0d8e6bb90c96ae775ee34c07da +5cd019a73b7944424d242dd7d96ea0349307ed426fe0c7fb8b5cbe3d295a3069 +b975fafbe78109cab35ac2fa5154f66af9b9ea522cd4847408d1ce24cf7fc770 +4f222fedc962ff21d09aa2ae6cc1b14cfbcab5d0016607362d3c8f6347f7a54e +821327ddd475396b465b1bf5894703c6de1e9947e64867e68efb2620c7f46367 +c0c345f294b781943f0c96500688a08347b0272c60e5d6a7810a44c4e5654d09 +05931a57e1fe6ff7edd1e77a1e1c39070b49e4d72a62f06340f9a76d0553905b +35e5711434d25cc3b14557bbaf66a82a6ef543bbfd14c314ddee0ee99090482f +c1dd06eecf203ec9511a3ad6ccecdd1139ccf31dc72e407853d159c1622131df +f560bd84c30c58439b06aef79bf53ffaa90ab3727e59f164271a69c5bf36f0d8 +3f9c0099933b6bdfc2f613d4f3565dfbd0c85e8723491ead13697f8945f63a6a +612990613b54bb7a19c1d3a13c14f19694e3b1293293a51c64ebe436738eb61e +2ccef09ca77eeb35c7bf10db2a9b1eabbe4fb88ccefeae6359bf5e136ee974ea +a1a5c7152d54de8dfab89422943ad50e5884f330ad4078763ea071c6265e555d +a610d246133435db11c37e786302e3e8889ece1d9ec3670d82babfed7be2fb7e +fdb78e1b6e1c682b930f48bf0a28301b463a5ca77c368f7d57187f0828675a52 +382d41de6cd9fb522cf52d8792796fccac48d9528d6ba65cca775eea0d9e272c +084f8017bb4ff779b615a46518b256b2c43b27e28b988bf6b60d783d56905a5d +7794904c0cb95e2aa83512f47d2c393b778b7611053d31bbc4670c6ffe45ff25 +2b7064e4740e8895169607d57c89956b526a664b28a2a9f7c42d6a40c4a95aa6 +6be98967f52a855db02c498f141fd6afffc0a69b14bbd009a0c0f023d4d6706c +cc05401aa96d550b6ce0190281ba4cebf16acfa4fd94730cd977d6c120c124ba +ef8489e22a13c30552196e99046201ccff11cb3aff92a63e47a10a3a6433bfc0 +e77047453b71527f209c939d8516182ca5f0966ccbf971fede25e3fefd92cf8b +fd11ac59dff36c25aaa8c771a83d9cbb7dccb37f4f7572f11f702bc27ea9510b +a2d4baa94f5953beb927aaf2426421f0093c603bd63827e28f17d57cef476577 +c1f13eb8beeada42a1eb221cac3dccd5d84a6f74fa2b289c3cab6e2fc94dd92b +d96a015b218ca7facbe18f9c7a580610905847a649e4477773b87686f7f28b33 +24148f4213ccaac483b43be2a9763fdbbdbbd50a0f9d59fc31f5b7b2ac0f915a +89abd64d84faa62a4c3167fbbf651a6236ead6ad931c11435921cbdc4ed66f67 +fe83bc059fa0c625001ad5b3bf638293646d33076f3afafa8b8fd7307da5c53b +5845999c1624e9ed30cd48483403f9afdabbcbe80fa5025bea2cbc081e2b32c7 +42685421ce3d574a414b340075cb02e80d7427d4cc503ee02f5b33e509d76e0b +21b5d5a252757c4b7893dd9870f9371eca57ae78ac688ee28c31d597bc018496 +3fa54a8e160a77dc8b0627d7319885fb2ae0e2e2c9fbcde4b5a7acb04bf1e611 +b73b0dee3ac8f44c4ca15dbeca20c35a7a8805f3c22e6fba8e9b22722dd25ae3 +ba2dec2a0c9a13509f4c9fd3dba03ef6e49a632bf7de5ec45b64a1f4e3a36976 +1b7a9c7b95bd29b09b930b0d82f2c39f9bc3c24d99c58a664d4adedf7b74e13e +6d85e03e615a60a2aee9f790c6d0a2e6e82e6840e51b38c4579fb95337423fba +437d97ab42bafb1097b2e2952e86c88e94ba7020e83163b5d810de8f57625819 +d86d7ae834d7135e30f2e21dd061ff15f22de6c9243d2caaa5abf67abee3a6f5 +306273037adcd10e8f00818ee88ad2ea98d6b7f1ee7e3d1db49a57fa350664d6 +021078ee1ebfbdbe5aee9efab2acd9809ccfb180f8017a84ba6bfc1ba5940eca +3076c863f8d9df3e4afb32361acab13bacd3e465d094b64bece987be66fa501d +5deba893368ea3fdd3b3a4201d3bd68b3464ead10c6f0ddf513a630e0133fec8 +08630e4b3c8b0aad1bbeed508e7e03d41b3d060a92b1958407843e4cabd78d79 +ff72fc0e92f4903cfd05856f457dd15b1aab99c1d29804d2f3134c9817f45fd2 +efebb92545f056f4ca76ea74ad464cd041b7cbb8892f2dba833118b83e20c039 +99939ffc6cc50503bb871565797ec537e26eb622fd30303273748af2afd97e07 +a9c2a96f4ef8754dc3ea8f3348cb30d76bdaa84d2e933c94c99d13e74f19970f +5d2bd19712926e230dd02aeae6461edd83ac935ec2f420649f82d4160a072700 +10141602c3a6572740d8e97fd08e56b987062bb57237bbb3056a36e97e399a7a +cf9653743a9984ef36254d60772a0eedca800923461a3e4443a5ef469aefceec +aa1831e56b0d8ea6ccb76bb9dbb6ab7584ee268bdd0f5f0d57eddba9b97d74a2 +910f178f388a50fa32aad7b87b3235efcabd4b5009190d12e8c770f6e70dbe10 +e747e1984a1c41d701e6220b001fe25b9a677c996f8fd91bd40fa7e07f57e8bd +5d2381442b337924e56de4d18cdc352314caebf065f610b00b50302bae3ad612 +dad9059a3d7f3bd63827e28f17d57cef4a8cb8af1f080a993c3c74871e4b7bdb +2602d07587aed02aa783d80234b6eecc77d163847e63d3c9aa412d10acea7a5c +5ece5b893bb3031facee72701acd225d6b6a752cb2f84de3ceab2b97b606a0bf +c6874869a86e3a55a4e1d7abd94719f604ea68b1108ebb5bebc3ef465bdd2cdb +864ecfe0d6959d5114eaaf1612c970caa2c94729178e6af130a1df211a3795a9 +b5fb934e47f6c48155a19acce788036b4867f90d40c1e4ff7460399f1f08f98a +0aa3e0d8e354195a2563759dfe0183c8d67b449516ed8f5cf3288f7298d62092 +922f07027352bc7c9612cfca46f1cf2ed1417ab863c2615f2d26ee13d7a04a18 +8336ec9961e76af2f506e3db3d67a2a4fb2dbbb0ca34be6db9789a1cda607d9b +35f0eac47f488bbe74f8f04b49dc492ec8f096e6710ad59d248a0c98497541d8 +5f9134d5215b0a05fc29db1aa71e432a2c0b00106bf3124df0b72c144375a280 +9cc5ed8335b3e970eaad9178f43011b55d7f3e11d89be1058361893016254440 +353b88162a4e7913721092e05573497ed693f3120176dc08253d2356559041d8 +741a6b9c41f8eb695369633632ffc35a1e2e4ed6258f0a8eef0bf6bb028efed8 +a679be4bc197cc868255f748ca953312eef556d8fdae4e9706c3116e76140587 +db18492730a14e96c211fcd0aeb0d4324b1b4abd0150637c6c135fcca1823fde +20482dbbab536f87e1d3f0ac4b5154e33bfaade3ac4af8b8d2082658d35a251e +a0d718f702ed8d957555331c9593abbf64b2194dac9f098773ef4313cd8a48e7 +4d60513d6ee1c132e59ebf5dce2359b61efd16fb4cce810172abb3939e874792 +a862462c72895461ed4dd265abbf52c11c50e607fd3bebeff0397398f656066c +5f64fc4e67cf5f984fe818c9500cb10beadc1ac513c0c8e60701144b949ce67d +08cec1adeb70fb01f48abfea22412f4b07b710a8d774228ae156bfdd556c0f49 +bda072c0926a08150f77ee338b3b4303bd2186da21b89df804cd531c499ef953 +9b1ed325e5ef952af05cf67a9fe64b1af975c18348809161ad382debfde45495 +5b32472edf5098b6d1f8fc8807f81ee5be3659bd0f47542ee81e20cbaef168dd +4b991069cda2f850b1faa40e74fad79ed5f74a0fde1c060996a2280e9c9d21f5 +d23174d3ef4d9eb6e337d443cfccaeab8b0015e6427f9439c8473a1364faf782 +f58bd8bd775899092844ba570c427dff47b8cc4859fd9042ce78aa27ffea8b5a +c52be0d97cd01c7250a6eda489b5a17e23167239e0d7fd8f3429529ef02548e9 +b7bc1dcfc729600ff98d9f9b33ecdd10ff78baa313b7e35c51dfe8c6a17568fd +bfbd434860a8ef3821b336783fa328279c05b05aba37f8d26da43391c9cfbd71 +6b240148995a005448afbe45ef2c2853aa3c1cf3ba6434ec79e8dbacef443569 +8e6ef17bdf960e9a37f0b34f4aa39641492bcce95afe55d168e510f934288da7 +c61eb3e1a42f18abc608995cd8c9afcc591751bcd9759387d3924751b1a2c79a +0cf18b53d3ed8096e2c559dd001e8bf6824b3eedafedd8b89fa23f4aeed14435 +a7d05da7b0607edf2aab0816e866f6791e834bff5f5c6699edb97df199549d54 +3d039671a481d094352ec76d2f7e5119887ee3ad1117f749a85b3b6f37e3d25f +25397d1d019da9c5c6fbbfbaeb4fdf0a423f6394968f2eabc560f76e75b07b54 +a6d87328604fc86be37a1e8e5790eb845cca88bbc2e01eab28a6d6615229658b +7554a85064aacf698949e4f56f2bd61bd5af31bd6012ef0c1bb627cbeec71b52 +e99af95f699617a8462e14e144424a64e4c1cda80a13cf7b20929041b2df6686 +15c2f77a73f9cdbca33cd11188a9a608b240b27e7cfc5234fdad6db5d6565787 +d99f45709674690ee704de4ce6accc37343eaac02dd8ca368221d607c4ea24dc +05aaa5162120301a8fb4c3166ef0e813aab536200a8d54d3e0679cbad59cae0d +d9c251016336c63243b42f4a439af0f1b4d4cc3ee9c24dae5ec87c10b4b046eb +3877eae636101c3231319957690cf7cd562fb48e44abd46bfd8640de5348a01d +8389dbe26165729c3ea1023b354cc6b6928922cffb2df9ea60d853a74067b442 +a7d4938296e2ffdeee8b33dae2ecf5be2451fbe3829f9c1d45820c9849176a43 +22694f059367670d68ad12080a84603821f867ca37dc727c3c5254103af21cd9 +034f679aea5d4bc81366245725fa46cd671ac9251817e8abbe9f06f182b738e9 +05769b0d6a504170334d09bb7b809c249ca9678658b36fef98a0f8936cc9167f +31837fb2e92319b8e4df5168494fe90a12a88b93bae098fac2f3af2c087759cf +0fdc3d901e921222a19e53c654d13e52a6f272bd65e3deee14e3e59c6dd9b794 +dbd476ccd4deb50e94d207123a5bb6276e40177c13adee9227e283b51bdc8e50 +2af8d9f3d4cdf61a9bffdb5047aa305f7c61fbb49440b70993c9620020fadf15 +4b5248e8e2a6fd5638a447a593b320039eb53a709e992a481c0de5f19640c17f +cdcfacfbf7b5252c0274c53f6de78a11db640076e01a11be6a63c3a8be0e3fb0 +f0c1f40b379b80399771b0b23aa0fb934ee3184f0c18d5cb40285510a4eb92f1 +6f089ce3cf32b52add23b0f6a436637a17a71f90e8c91adeaff7eb97220a17b7 +354ea80c678e158c1ecd586f0e2e6d7ab5a179500d404e19a65db6c9568b0799 +330d69b254d29e704196964553817ab428be257c5d51aac61ee9cffcd3ec4615 +1d6e9992ad91a791d1c2465df24757dcbc64f3788b15868b905e53ccd04625c7 +f04fa267d68a6aeb59443ead9bc171f845b2b0d7ac7e788c21411a1d4b3935d6 +ef2093333ce092da5d06fcf6c1f1afc68db00cc1d0090f21046b54694f5162cc +cb07ac6e81a3b657871db0692cd70edcfb645c335167e08eb15caa6cbf6419b0 +1cb28d3beb8c5ab6c8f77663a2c258177a1feb9abb560e903b45a1d14644a08d +778a0db918b36ed5a2d6d409adf41a21b13211679094cf290c4652633d861e1e +2cf20b69ccdcf17ac7d4bc15febe037998b98c176369d225995e578f62f6e548 +049da929686caf8b58bf1baf99bfd7196c8084419d381078ad0bc6bffbe163de +15a4d0e6fb53208aff06f08967882b17c0696f060218ae037682036cb39365b7 +33d8c2b0f2414f3c919473a6abc8d419f70b541a62082602990c3c35a55217d5 +96fea82048181950779a3fc5f67bdad8df84e5433fa67bccd05ec886d857b789 +18ffbf083fa0b9f98cf5cfc9ae29d607d2ed11fa02131fd7c258431b20f7b113 +c316b7163644fdef029d33366200e9c4b5727940490a81aa139dddf9493f6b32 +0ee84950a6a549460032d0ba7fb3b2ded2e4028bd3ef456005bfc1456c681f25 +82dad6da15127a1ef14550d9557b86c2bc37440d538ee5146f320c9db07aed68 +70f6fa748a5b87fde0e3ef4cf1567e743eea26076ba668b46f3f7ad99f4df367 +fd40d87cca35267a09a3a33f8212655b747323e9d5f184cde766906f6f85ef2b +3ad0dc0edcd150e589dae9c0e19d464ad618c32e14a5dbcaa6ecbcd990cc49ad +c6de19129debd2de99b506adf4dbdea4ff1364e300447c9c0deda2cdf1d3648b +1a83bd4be46e1797fb5b6216077a54f12c7ace9c28320026a19492e58193d082 +c0b5473a5a603ce22ea377511b725ad9c23b1a1b906b465fa02d0fb620e23074 +66c9d077730916850cd2abcc2412a364f4a0efde3fb741dea91fbba138e74dcb +809627282be317d8f1dbb22220c9696bf39a27fc38aff90eaf458151a00a8a88 +9d4f5d933b1eee63054c65798ad32079ce573d53c620b6a0f81fd931b5a24707 +ebb30cf01b0c63b55ee8c08b805a9a45aea8aacf49982ce6d3e8726c6a122437 +1b9b116a56de605482449dabbb83d353ebdf355fcb8cde5658c699b8a55718a8 +6e051b42221dda48257e9f56d09f31a77630930abb0fce0d49ec9cb27c6ce480 +4c3b36d45ec195e7f78dc930370ed66cd4b6763085ec4c626693e69b39e993b1 +70b2289f29dcf94d5d2763a8211a92c40442371aa2f4297c9958c833421ee693 +a74b256e425979afe86b286bbda0983e14194250d9fecd03a8ba1fe615e93ae1 +d60d43f6858ea9cd47ddf88a1bfb5e90b60a28cdb269d9e1e43b0cf470a95b48 +aa5299e7159e7ccb18200914b93c3b0df79f181789fdfd6693613d0d42778883 +88847927f59d40f0cb5334f62eafe4f380076cfb7720174eceab1eb5050ea12c +e4293db115c4f9bd4d21910a69d566a706f5c0e1bcb344203503855e6643b125 +17b6db03c41f13a347ad39e47a46d626f8a31a163bda6d23264657b412bdec99 +c87a103d26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +cleartomark +%%EndResource +/F637_0 /WWWUTU+NimbusRomNo9L-ReguItal 1 1 +[ /.notdef/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash + /ogonek/ring/.notdef/breve/minus/.notdef/Zcaron/zcaron + /caron/dotlessi/dotlessj/ff/ffi/ffl/notequal/infinity + /lessequal/greaterequal/partialdiff/summation/product/pi/grave/quotesingle + /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright + /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash + /zero/one/two/three/four/five/six/seven + /eight/nine/colon/semicolon/less/equal/greater/question + /at/A/B/C/D/E/F/G + /H/I/J/K/L/M/N/O + /P/Q/R/S/T/U/V/W + /X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore + /quoteleft/a/b/c/d/e/f/g + /h/i/j/k/l/m/n/o + /p/q/r/s/t/u/v/w + /x/y/z/braceleft/bar/braceright/asciitilde/.notdef + /Euro/integral/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl + /circumflex/perthousand/Scaron/guilsinglleft/OE/Omega/radical/approxequal + /.notdef/.notdef/.notdef/quotedblleft/quotedblright/bullet/endash/emdash + /tilde/trademark/scaron/guilsinglright/oe/Delta/lozenge/Ydieresis + /.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section + /dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron + /degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered + /cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown + /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla + /Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis + /Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply + /Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls + /agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla + /egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis + /eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide + /oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis] +pdfMakeFont +612 792 false pdfSetup +%%EndSetup +%%Page: 1 1 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 756] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 463.019 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -36] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +117.436 701.916 Td +/F122_0 24.7902 Tf +(bzip2) 63.3638 Tj +-278 TJm +(and) 44.077 Tj +-278 TJm +(libbzip2,) 99.1856 Tj +-278 TJm +(ver) 37.2101 Tj +15 TJm +(sion) 50.9687 Tj +-278 TJm +(1.0.5) 55.1334 Tj +[1 0 0 1 72 696.784] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -15.4939] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -681.29] cm +[1 0 0 1 0 0] Tm +0 0 Td +90.4929 661.631 Td +/F122_0 20.6585 Tf +(A) 14.9154 Tj +-278 TJm +(pr) 20.6585 Tj +20 TJm +(ogram) 63.1324 Tj +-278 TJm +(and) 36.7308 Tj +-278 TJm +(librar) 51.6669 Tj +-10 TJm +(y) 11.4861 Tj +-278 TJm +(f) 6.87928 Tj +20 TJm +(or) 20.6585 Tj +-278 TJm +(data) 42.4739 Tj +-278 TJm +(compression) 128.579 Tj +[1 0 0 1 72 657.035] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -144] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -513.035] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.676 503.285 Td +/F122_0 11.9552 Tf +(J) 6.64709 Tj +20 TJm +(ulian) 27.9034 Tj +-278 TJm +(Se) 14.6212 Tj +15 TJm +(war) 20.5988 Tj +20 TJm +(d,) 10.6282 Tj +-278 TJm +(http://www) 61.103 Tj +40 TJm +(.bzip.or) 42.5127 Tj +15 TJm +(g) 7.30463 Tj +[1 0 0 1 72 500.625] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -435.826] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 463.019 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 2 2 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 709.534 Td +/F122_0 14.3462 Tf +(bzip2) 36.6689 Tj +-489 TJm +(and) 25.5075 Tj +-488 TJm +(libbzip2,) 57.3991 Tj +-542 TJm +(ver) 21.5336 Tj +15 TJm +(sion) 29.4958 Tj +-488 TJm +(1.0.5:) 36.6832 Tj +-766 TJm +(A) 10.358 Tj +-488 TJm +(pr) 14.3462 Tj +20 TJm +(ogram) 43.842 Tj +-489 TJm +(and) 25.5075 Tj +-489 TJm +(librar) 35.8798 Tj +-10 TJm +(y) 7.97649 Tj +-488 TJm +(f) 4.77728 Tj +20 TJm +(or) 14.3462 Tj +-489 TJm +(data) 29.4958 Tj +72 692.319 Td +(compression) 89.2907 Tj +[1 0 0 1 72 689.349] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -689.349] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 680.364 Td +/F130_0 9.9626 Tf +(by) 9.9626 Tj +-250 TJm +(Julian) 23.8007 Tj +-250 TJm +(Se) 9.9626 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(ard) 12.7222 Tj +[1 0 0 1 72 678.207] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -678.207] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 668.409 Td +/F130_0 9.9626 Tf +(Cop) 16.6077 Tj +10 TJm +(yright) 23.8007 Tj +[1 0 0 1 114.799 668.409] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -114.799 -668.409] cm +[1 0 0 1 0 0] Tm +0 0 Td +114.799 668.409 Td +/F130_0 9.9626 Tf +(\251) 7.57158 Tj +[1 0 0 1 122.371 668.409] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -122.371 -668.409] cm +[1 0 0 1 0 0] Tm +0 0 Td +124.861 668.409 Td +/F130_0 9.9626 Tf +(1996-2007) 43.1679 Tj +-250 TJm +(Julian) 23.8007 Tj +-250 TJm +(Se) 9.9626 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(ard) 12.7222 Tj +[1 0 0 1 72 666.252] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -7.9701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -658.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 650.875 Td +/F130_0 7.9701 Tf +(This) 14.1708 Tj +-250 TJm +(program,) 28.9952 Tj +[1 0 0 1 119.151 650.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.151 -650.875] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.151 650.875 Td +/F134_0 7.9701 Tf +(bzip2) 23.9103 Tj +[1 0 0 1 143.061 650.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.061 -650.875] cm +[1 0 0 1 0 0] Tm +0 0 Td +143.061 650.875 Td +/F130_0 7.9701 Tf +(,) 1.99253 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(associated) 32.7571 Tj +-250 TJm +(library) 21.2483 Tj +[1 0 0 1 216.768 650.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.768 -650.875] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.768 650.875 Td +/F134_0 7.9701 Tf +(libbzip2) 38.2565 Tj +[1 0 0 1 255.024 650.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -255.024 -650.875] cm +[1 0 0 1 0 0] Tm +0 0 Td +255.024 650.875 Td +/F130_0 7.9701 Tf +(,) 1.99253 Tj +-250 TJm +(and) 11.5088 Tj +-250 TJm +(all) 7.9701 Tj +-250 TJm +(documentation,) 49.3668 Tj +-250 TJm +(are) 9.73149 Tj +-250 TJm +(cop) 11.5088 Tj +10 TJm +(yright) 19.0406 Tj +-250 TJm +(\251) 6.05728 Tj +-250 TJm +(1996-2007) 34.5344 Tj +-250 TJm +(Julian) 19.0406 Tj +-250 TJm +(Se) 7.9701 Tj +25 TJm +(w) 5.75441 Tj +10 TJm +(ard.) 12.1703 Tj +-310 TJm +(All) 10.1858 Tj +-250 TJm +(rights) 18.1559 Tj +-250 TJm +(reserv) 19.471 Tj +15 TJm +(ed.) 9.5163 Tj +[1 0 0 1 72 649.149] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -7.9701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -641.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 633.34 Td +/F130_0 7.9701 Tf +(Redistrib) 29.2264 Tj +20 TJm +(ution) 16.3865 Tj +-250 TJm +(and) 11.5088 Tj +-250 TJm +(use) 10.6241 Tj +-250 TJm +(in) 6.20074 Tj +-250 TJm +(source) 20.802 Tj +-250 TJm +(and) 11.5088 Tj +-250 TJm +(binary) 20.3636 Tj +-250 TJm +(forms,) 20.5868 Tj +-250 TJm +(with) 14.1708 Tj +-250 TJm +(or) 6.63909 Tj +-250 TJm +(without) 24.3566 Tj +-250 TJm +(modi\002cation,) 42.2894 Tj +-250 TJm +(are) 9.73149 Tj +-250 TJm +(permitted) 30.5494 Tj +-250 TJm +(pro) 10.6241 Tj +15 TJm +(vided) 17.7096 Tj +-250 TJm +(that) 11.9551 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(follo) 15.0555 Tj +25 TJm +(wing) 15.9402 Tj +-250 TJm +(conditions) 33.2114 Tj +-250 TJm +(are) 9.73149 Tj +-250 TJm +(met:) 14.1708 Tj +[1 0 0 1 72 631.615] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -23.7789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 5.5791 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -77.5791 -607.836] cm +[1 0 0 1 0 0] Tm +0 0 Td +77.5791 607.836 Td +/F130_0 7.9701 Tf +(\225) 2.78954 Tj +[1 0 0 1 80.3686 607.836] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9926 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.594 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.9552 -607.836] cm +[1 0 0 1 0 0] Tm +0 0 Td +83.9552 607.836 Td +/F130_0 7.9701 Tf +(Redistrib) 29.2264 Tj +20 TJm +(utions) 19.4869 Tj +-250 TJm +(of) 6.63909 Tj +-250 TJm +(source) 20.802 Tj +-250 TJm +(code) 15.0475 Tj +-250 TJm +(must) 15.5018 Tj +-250 TJm +(retain) 18.1479 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(abo) 11.5088 Tj +15 TJm +(v) 3.98505 Tj +15 TJm +(e) 3.53872 Tj +-250 TJm +(cop) 11.5088 Tj +10 TJm +(yright) 19.0406 Tj +-250 TJm +(notice,) 21.4714 Tj +-250 TJm +(this) 11.5168 Tj +-250 TJm +(list) 9.74743 Tj +-250 TJm +(of) 6.63909 Tj +-250 TJm +(conditions) 33.2114 Tj +-250 TJm +(and) 11.5088 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(follo) 15.0555 Tj +25 TJm +(wing) 15.9402 Tj +-250 TJm +(disclaimer) 33.2034 Tj +55 TJm +(.) 1.99253 Tj +[1 0 0 1 470.908 607.836] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -398.908 -17.5343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 5.5791 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -77.5791 -590.302] cm +[1 0 0 1 0 0] Tm +0 0 Td +77.5791 590.302 Td +/F130_0 7.9701 Tf +(\225) 2.78954 Tj +[1 0 0 1 80.3686 590.302] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9926 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.594 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.9552 -590.302] cm +[1 0 0 1 0 0] Tm +0 0 Td +83.9552 590.302 Td +/F130_0 7.9701 Tf +(The) 12.3935 Tj +-270 TJm +(origin) 19.0406 Tj +-270 TJm +(of) 6.63909 Tj +-270 TJm +(this) 11.5168 Tj +-270 TJm +(softw) 17.7096 Tj +10 TJm +(are) 9.73149 Tj +-270 TJm +(must) 15.5018 Tj +-270 TJm +(not) 10.1858 Tj +-270 TJm +(be) 7.52377 Tj +-270 TJm +(misrepresented;) 50.4667 Tj +-279 TJm +(you) 11.9551 Tj +-270 TJm +(must) 15.5018 Tj +-270 TJm +(not) 10.1858 Tj +-270 TJm +(claim) 17.7096 Tj +-270 TJm +(that) 11.9551 Tj +-270 TJm +(you) 11.9551 Tj +-270 TJm +(wrote) 18.1479 Tj +-270 TJm +(the) 9.73946 Tj +-270 TJm +(original) 24.795 Tj +-270 TJm +(softw) 17.7096 Tj +10 TJm +(are.) 11.724 Tj +-740 TJm +(If) 5.30809 Tj +-270 TJm +(you) 11.9551 Tj +-270 TJm +(use) 10.6241 Tj +-270 TJm +(this) 11.5168 Tj +-270 TJm +(softw) 17.7096 Tj +10 TJm +(are) 9.73149 Tj +-270 TJm +(in) 6.20074 Tj +-269 TJm +(a) 3.53872 Tj +83.9552 580.737 Td +(product,) 26.3412 Tj +-250 TJm +(an) 7.52377 Tj +-250 TJm +(ackno) 19.0326 Tj +25 TJm +(wledgment) 35.4191 Tj +-250 TJm +(in) 6.20074 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(product) 24.3487 Tj +-250 TJm +(documentation) 47.3743 Tj +-250 TJm +(w) 5.75441 Tj +10 TJm +(ould) 14.1708 Tj +-250 TJm +(be) 7.52377 Tj +-250 TJm +(appreciated) 36.7342 Tj +-250 TJm +(b) 3.98505 Tj +20 TJm +(ut) 6.20074 Tj +-250 TJm +(is) 5.31606 Tj +-250 TJm +(not) 10.1858 Tj +-250 TJm +(required.) 28.5489 Tj +[1 0 0 1 403.817 580.737] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.817 -17.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 5.5791 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -77.5791 -563.203] cm +[1 0 0 1 0 0] Tm +0 0 Td +77.5791 563.203 Td +/F130_0 7.9701 Tf +(\225) 2.78954 Tj +[1 0 0 1 80.3686 563.203] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9926 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.594 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.9552 -563.203] cm +[1 0 0 1 0 0] Tm +0 0 Td +83.9552 563.203 Td +/F130_0 7.9701 Tf +(Altered) 23.9023 Tj +-250 TJm +(source) 20.802 Tj +-250 TJm +(v) 3.98505 Tj +15 TJm +(ersions) 22.5793 Tj +-250 TJm +(must) 15.5018 Tj +-250 TJm +(be) 7.52377 Tj +-250 TJm +(plainly) 22.1409 Tj +-250 TJm +(mark) 16.3786 Tj +10 TJm +(ed) 7.52377 Tj +-250 TJm +(as) 6.63909 Tj +-250 TJm +(such,) 16.6017 Tj +-250 TJm +(and) 11.5088 Tj +-250 TJm +(must) 15.5018 Tj +-250 TJm +(not) 10.1858 Tj +-250 TJm +(be) 7.52377 Tj +-250 TJm +(misrepresented) 48.251 Tj +-250 TJm +(as) 6.63909 Tj +-250 TJm +(being) 17.7096 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(original) 24.795 Tj +-250 TJm +(softw) 17.7096 Tj +10 TJm +(are.) 11.724 Tj +[1 0 0 1 464.405 563.203] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.405 -17.5343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 5.5791 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -77.5791 -545.669] cm +[1 0 0 1 0 0] Tm +0 0 Td +77.5791 545.669 Td +/F130_0 7.9701 Tf +(\225) 2.78954 Tj +[1 0 0 1 80.3686 545.669] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9926 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.594 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.9552 -545.669] cm +[1 0 0 1 0 0] Tm +0 0 Td +83.9552 545.669 Td +/F130_0 7.9701 Tf +(The) 12.3935 Tj +-250 TJm +(name) 17.2632 Tj +-250 TJm +(of) 6.63909 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(author) 20.3636 Tj +-250 TJm +(may) 13.7245 Tj +-250 TJm +(not) 10.1858 Tj +-250 TJm +(be) 7.52377 Tj +-250 TJm +(used) 14.6092 Tj +-250 TJm +(to) 6.20074 Tj +-250 TJm +(endorse) 24.787 Tj +-250 TJm +(or) 6.63909 Tj +-250 TJm +(promote) 26.5643 Tj +-250 TJm +(products) 27.449 Tj +-250 TJm +(deri) 12.3935 Tj +25 TJm +(v) 3.98505 Tj +15 TJm +(ed) 7.52377 Tj +-250 TJm +(from) 15.4939 Tj +-250 TJm +(this) 11.5168 Tj +-250 TJm +(softw) 17.7096 Tj +10 TJm +(are) 9.73149 Tj +-250 TJm +(without) 24.3566 Tj +-250 TJm +(speci\002c) 24.3487 Tj +-250 TJm +(prior) 15.4939 Tj +-250 TJm +(written) 22.5793 Tj +-250 TJm +(permission.) 36.9733 Tj +[1 0 0 1 533.577 545.669] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -461.577 -9.6956] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -535.973] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 528.135 Td +/F130_0 7.9701 Tf +(THIS) 17.7096 Tj +-401 TJm +(SOFTW) 27.0107 Tj +120 TJm +(ARE) 15.9402 Tj +-401 TJm +(IS) 7.08542 Tj +-400 TJm +(PR) 9.74743 Tj +40 TJm +(O) 5.75441 Tj +50 TJm +(VIDED) 24.787 Tj +-401 TJm +(BY) 11.0705 Tj +-401 TJm +(THE) 15.4939 Tj +-401 TJm +(A) 5.75441 Tj +55 TJm +(UTHOR) 27.449 Tj +-401 TJm +("AS) 13.4376 Tj +-401 TJm +(IS") 10.3372 Tj +-401 TJm +(AND) 17.2632 Tj +-400 TJm +(ANY) 17.2632 Tj +-401 TJm +(EXPRESS) 34.1041 Tj +-401 TJm +(OR) 11.0705 Tj +-401 TJm +(IMPLIED) 32.3188 Tj +-401 TJm +(W) 7.52377 Tj +120 TJm +(ARRANTIES,) 46.7128 Tj +-401 TJm +(INCLUDING,) 46.2585 Tj +-400 TJm +(B) 5.31606 Tj +10 TJm +(UT) 10.6241 Tj +72 518.571 Td +(NO) 11.5088 Tj +40 TJm +(T) 4.86973 Tj +-304 TJm +(LIMITED) 32.7571 Tj +-304 TJm +(T) 4.86973 Tj +18 TJm +(O,) 7.74694 Tj +-305 TJm +(THE) 15.4939 Tj +-304 TJm +(IMPLIED) 32.3188 Tj +-304 TJm +(W) 7.52377 Tj +120 TJm +(ARRANTIES) 44.7202 Tj +-304 TJm +(OF) 10.1858 Tj +-304 TJm +(MERCHANT) 44.7202 Tj +93 TJm +(ABILITY) 31.8724 Tj +-304 TJm +(AND) 17.2632 Tj +-305 TJm +(FITNESS) 31.442 Tj +-304 TJm +(FOR) 15.5018 Tj +-304 TJm +(A) 5.75441 Tj +-304 TJm +(P) 4.43138 Tj +92 TJm +(AR) 11.0705 Tj +60 TJm +(TICULAR) 34.5344 Tj +-304 TJm +(PURPOSE) 34.9887 Tj +-304 TJm +(ARE) 15.9402 Tj +-305 TJm +(DI) 8.40846 Tj +1 TJm +(S-) 7.08542 Tj +72 509.006 Td +(CLAIMED.) 38.2963 Tj +-576 TJm +(IN) 8.40846 Tj +-287 TJm +(NO) 11.5088 Tj +-288 TJm +(EVENT) 26.118 Tj +-288 TJm +(SHALL) 25.6797 Tj +-288 TJm +(THE) 15.4939 Tj +-287 TJm +(A) 5.75441 Tj +55 TJm +(UTHOR) 27.449 Tj +-288 TJm +(BE) 10.1858 Tj +-288 TJm +(LIABLE) 28.3337 Tj +-288 TJm +(FOR) 15.5018 Tj +-288 TJm +(ANY) 17.2632 Tj +-287 TJm +(DIRECT) 28.78 Tj +74 TJm +(,) 1.99253 Tj +-288 TJm +(INDIRECT) 37.1885 Tj +74 TJm +(,) 1.99253 Tj +-288 TJm +(INCIDENT) 37.6268 Tj +93 TJm +(AL,) 12.6167 Tj +-288 TJm +(SPECIAL,) 34.3193 Tj +-288 TJm +(EXEMPLAR) 42.9509 Tj +65 TJm +(Y) 5.75441 Tj +129 TJm +(,) 1.99253 Tj +72 499.442 Td +(OR) 11.0705 Tj +-299 TJm +(CONSEQ) 31.8804 Tj +10 TJm +(UENTIAL) 34.5265 Tj +-300 TJm +(D) 5.75441 Tj +40 TJm +(AMA) 18.5942 Tj +40 TJm +(GES) 15.0555 Tj +-299 TJm +(\(INCLUDING,) 48.9125 Tj +-299 TJm +(B) 5.31606 Tj +10 TJm +(UT) 10.6241 Tj +-299 TJm +(NO) 11.5088 Tj +40 TJm +(T) 4.86973 Tj +-300 TJm +(LIMITED) 32.7571 Tj +-299 TJm +(T) 4.86973 Tj +18 TJm +(O,) 7.74694 Tj +-299 TJm +(PR) 9.74743 Tj +40 TJm +(OCUREMENT) 49.59 Tj +-299 TJm +(OF) 10.1858 Tj +-300 TJm +(SUBSTITUTE) 47.8206 Tj +-299 TJm +(GOODS) 27.449 Tj +-299 TJm +(OR) 11.0705 Tj +-300 TJm +(SER) 14.6172 Tj +80 TJm +(VICES) 23.0256 Tj +1 TJm +(;) 2.21569 Tj +72 489.878 Td +(LOSS) 19.4869 Tj +-360 TJm +(OF) 10.1858 Tj +-360 TJm +(USE,) 17.048 Tj +-360 TJm +(D) 5.75441 Tj +40 TJm +(A) 5.75441 Tj +111 TJm +(T) 4.86973 Tj +93 TJm +(A,) 7.74694 Tj +-360 TJm +(OR) 11.0705 Tj +-359 TJm +(PR) 9.74743 Tj +40 TJm +(OFITS;) 24.3566 Tj +-360 TJm +(OR) 11.0705 Tj +-360 TJm +(B) 5.31606 Tj +10 TJm +(USINESS) 32.3267 Tj +-360 TJm +(INTERR) 28.78 Tj +40 TJm +(UPTION\)) 31.8724 Tj +-360 TJm +(HO) 11.5088 Tj +35 TJm +(WEVER) 28.3337 Tj +-360 TJm +(CA) 11.0705 Tj +55 TJm +(USED) 20.8099 Tj +-359 TJm +(AND) 17.2632 Tj +-360 TJm +(ON) 11.5088 Tj +-360 TJm +(ANY) 17.2632 Tj +-360 TJm +(THEOR) 26.5643 Tj +65 TJm +(Y) 5.75441 Tj +-360 TJm +(OF) 10.1858 Tj +-360 TJm +(LIAB) 18.5942 Tj +1 TJm +(ILITY) 20.802 Tj +128 TJm +(,) 1.99253 Tj +72 480.314 Td +(WHETHER) 38.9578 Tj +-247 TJm +(IN) 8.40846 Tj +-247 TJm +(CONTRA) 32.7651 Tj +40 TJm +(CT) 10.1858 Tj +74 TJm +(,) 1.99253 Tj +-247 TJm +(STRICT) 27.457 Tj +-247 TJm +(LIABILITY) 39.3962 Tj +129 TJm +(,) 1.99253 Tj +-246 TJm +(OR) 11.0705 Tj +-247 TJm +(T) 4.86973 Tj +18 TJm +(OR) 11.0705 Tj +60 TJm +(T) 4.86973 Tj +-247 TJm +(\(INCLUDING) 46.92 Tj +-247 TJm +(NEGLIGENCE) 50.4667 Tj +-247 TJm +(OR) 11.0705 Tj +-247 TJm +(O) 5.75441 Tj +40 TJm +(THER) 20.8099 Tj +55 TJm +(WISE\)) 22.133 Tj +-247 TJm +(ARISING) 32.3188 Tj +-247 TJm +(IN) 8.40846 Tj +-247 TJm +(ANY) 17.2632 Tj +-247 TJm +(W) 7.52377 Tj +120 TJm +(A) 5.75441 Tj +105 TJm +(Y) 5.75441 Tj +-247 TJm +(OUT) 16.3786 Tj +72 470.75 Td +(OF) 10.1858 Tj +-250 TJm +(THE) 15.4939 Tj +-250 TJm +(USE) 15.0555 Tj +-250 TJm +(OF) 10.1858 Tj +-250 TJm +(THIS) 17.7096 Tj +-250 TJm +(SOFTW) 27.0107 Tj +120 TJm +(ARE,) 17.9327 Tj +-250 TJm +(EVEN) 21.2483 Tj +-250 TJm +(IF) 7.08542 Tj +-250 TJm +(AD) 11.5088 Tj +40 TJm +(VISED) 23.464 Tj +-250 TJm +(OF) 10.1858 Tj +-250 TJm +(THE) 15.4939 Tj +-250 TJm +(POSSIBILITY) 47.8206 Tj +-250 TJm +(OF) 10.1858 Tj +-250 TJm +(SUCH) 21.2563 Tj +-250 TJm +(D) 5.75441 Tj +40 TJm +(AMA) 18.5942 Tj +40 TJm +(GE.) 12.6167 Tj +[1 0 0 1 72 469.598] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -7.9701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -461.628] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 453.216 Td +/F130_0 7.9701 Tf +(P) 4.43138 Tj +92 TJm +(A) 5.75441 Tj +111 TJm +(TENTS:) 27.0107 Tj +-296 TJm +(T) 4.86973 Tj +80 TJm +(o) 3.98505 Tj +-295 TJm +(the) 9.73946 Tj +-296 TJm +(best) 12.8398 Tj +-295 TJm +(of) 6.63909 Tj +-296 TJm +(my) 10.1858 Tj +-295 TJm +(kno) 11.9551 Tj +25 TJm +(wledge,) 25.0102 Tj +[1 0 0 1 208.544 453.216] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -208.544 -453.216] cm +[1 0 0 1 0 0] Tm +0 0 Td +208.544 453.216 Td +/F134_0 7.9701 Tf +(bzip2) 23.9103 Tj +[1 0 0 1 232.454 453.216] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -232.454 -453.216] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.81 453.216 Td +/F130_0 7.9701 Tf +(and) 11.5088 Tj +[1 0 0 1 248.674 453.216] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -248.674 -453.216] cm +[1 0 0 1 0 0] Tm +0 0 Td +248.674 453.216 Td +/F134_0 7.9701 Tf +(libbzip2) 38.2565 Tj +[1 0 0 1 286.931 453.216] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -286.931 -453.216] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.286 453.216 Td +/F130_0 7.9701 Tf +(do) 7.9701 Tj +-296 TJm +(not) 10.1858 Tj +-295 TJm +(use) 10.6241 Tj +-296 TJm +(an) 7.52377 Tj +15 TJm +(y) 3.98505 Tj +-295 TJm +(patented) 27.0027 Tj +-296 TJm +(algorithms.) 36.0886 Tj +-893 TJm +(Ho) 9.73946 Tj +25 TJm +(we) 9.29314 Tj +25 TJm +(v) 3.98505 Tj +15 TJm +(er) 6.19277 Tj +40 TJm +(,) 1.99253 Tj +-307 TJm +(I) 2.65404 Tj +-295 TJm +(do) 7.9701 Tj +-296 TJm +(not) 10.1858 Tj +-295 TJm +(ha) 7.52377 Tj +20 TJm +(v) 3.98505 Tj +15 TJm +(e) 3.53872 Tj +-296 TJm +(the) 9.73946 Tj +-295 TJm +(resources) 30.0951 Tj +-296 TJm +(to) 6.20074 Tj +72 443.652 Td +(carry) 16.3706 Tj +-250 TJm +(out) 10.1858 Tj +-250 TJm +(a) 3.53872 Tj +-250 TJm +(patent) 19.4789 Tj +-250 TJm +(search.) 22.3482 Tj +-620 TJm +(Therefore) 31.4181 Tj +-250 TJm +(I) 2.65404 Tj +-250 TJm +(cannot) 21.2483 Tj +-250 TJm +(gi) 6.20074 Tj +25 TJm +(v) 3.98505 Tj +15 TJm +(e) 3.53872 Tj +-250 TJm +(an) 7.52377 Tj +15 TJm +(y) 3.98505 Tj +-250 TJm +(guarantee) 30.9798 Tj +-250 TJm +(of) 6.63909 Tj +-250 TJm +(the) 9.73946 Tj +-250 TJm +(abo) 11.5088 Tj +15 TJm +(v) 3.98505 Tj +15 TJm +(e) 3.53872 Tj +-250 TJm +(statement.) 32.5419 Tj +[1 0 0 1 72 441.926] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -391.074] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 46.7993 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -46.7993 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5986 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 3 3 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 707.441 Td +/F122_0 17.2154 Tf +(T) 10.5186 Tj +80 TJm +(ab) 20.0904 Tj +10 TJm +(le) 14.3576 Tj +-278 TJm +(of) 16.2513 Tj +-278 TJm +(Contents) 74.5943 Tj +[1 0 0 1 72 698.619] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.7401] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -686.879] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 686.879 Td +/F130_0 9.9626 Tf +(1.) 7.47195 Tj +-310 TJm +(Introduction) 49.2551 Tj +[1 0 0 1 131.815 686.879] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -136.796 -686.879] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.733 686.879 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 686.879] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -686.879] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 686.879 Td +/F130_0 9.9626 Tf +(1) 4.9813 Tj +[1 0 0 1 516.09 686.879] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -674.923] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 674.923 Td +/F130_0 9.9626 Tf +(2.) 7.47195 Tj +-310 TJm +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 152.318 674.923] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -157.3 -674.923] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.054 674.923 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 674.923] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -674.923] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 674.923 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 516.09 674.923] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -662.968] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 662.968 Td +/F130_0 9.9626 Tf +(2.1.) 14.9439 Tj +-310 TJm +(N) 7.193 Tj +35 TJm +(AME) 22.1369 Tj +[1 0 0 1 119.014 662.968] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -123.995 -662.968] cm +[1 0 0 1 0 0] Tm +0 0 Td +132.691 662.968 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 662.968] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -662.968] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 662.968 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 516.09 662.968] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -651.013] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 651.013 Td +/F130_0 9.9626 Tf +(2.2.) 14.9439 Tj +-310 TJm +(SYNOPSIS) 47.0534 Tj +[1 0 0 1 137.085 651.013] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -142.067 -651.013] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.582 651.013 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 651.013] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -651.013] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 651.013 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 516.09 651.013] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -639.058] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 639.058 Td +/F130_0 9.9626 Tf +(2.3.) 14.9439 Tj +-310 TJm +(DESCRIPTION) 64.7569 Tj +[1 0 0 1 154.789 639.058] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.77 -639.058] cm +[1 0 0 1 0 0] Tm +0 0 Td +168.29 639.058 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 639.058] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -639.058] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 639.058 Td +/F130_0 9.9626 Tf +(3) 4.9813 Tj +[1 0 0 1 516.09 639.058] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -627.103] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 627.103 Td +/F130_0 9.9626 Tf +(2.4.) 14.9439 Tj +-310 TJm +(OPTIONS) 42.0621 Tj +[1 0 0 1 132.094 627.103] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.076 -627.103] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.873 627.103 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 627.103] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -627.103] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 627.103 Td +/F130_0 9.9626 Tf +(4) 4.9813 Tj +[1 0 0 1 516.09 627.103] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -615.147] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 615.147 Td +/F130_0 9.9626 Tf +(2.5.) 14.9439 Tj +-310 TJm +(MEMOR) 37.6387 Tj +65 TJm +(Y) 7.193 Tj +-250 TJm +(MAN) 23.2427 Tj +35 TJm +(A) 7.193 Tj +40 TJm +(GEMENT) 41.5042 Tj +[1 0 0 1 207.9 615.147] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -212.881 -615.147] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.412 615.147 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 615.147] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -615.147] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 615.147 Td +/F130_0 9.9626 Tf +(5) 4.9813 Tj +[1 0 0 1 516.09 615.147] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -603.192] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 603.192 Td +/F130_0 9.9626 Tf +(2.6.) 14.9439 Tj +-310 TJm +(RECO) 26.5703 Tj +50 TJm +(VERING) 37.6287 Tj +-250 TJm +(D) 7.193 Tj +40 TJm +(A) 7.193 Tj +111 TJm +(T) 6.08715 Tj +93 TJm +(A) 7.193 Tj +-250 TJm +(FR) 12.1843 Tj +40 TJm +(OM) 16.0497 Tj +-250 TJm +(D) 7.193 Tj +40 TJm +(AMA) 23.2427 Tj +40 TJm +(GED) 20.4731 Tj +-250 TJm +(FILES) 26.5703 Tj +[1 0 0 1 293.449 603.192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -298.43 -603.192] cm +[1 0 0 1 0 0] Tm +0 0 Td +308.464 603.192 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 603.192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -603.192] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 603.192 Td +/F130_0 9.9626 Tf +(6) 4.9813 Tj +[1 0 0 1 516.09 603.192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -591.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 591.237 Td +/F130_0 9.9626 Tf +(2.7.) 14.9439 Tj +-310 TJm +(PERFORMANCE) 73.6236 Tj +-250 TJm +(NO) 14.386 Tj +40 TJm +(TES) 17.7135 Tj +[1 0 0 1 197.847 591.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.829 -591.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +211.958 591.237 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 591.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -591.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 591.237 Td +/F130_0 9.9626 Tf +(6) 4.9813 Tj +[1 0 0 1 516.09 591.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -579.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 579.282 Td +/F130_0 9.9626 Tf +(2.8.) 14.9439 Tj +-310 TJm +(CA) 13.8381 Tj +135 TJm +(VEA) 20.4731 Tj +111 TJm +(TS) 11.6264 Tj +[1 0 0 1 133.519 579.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -138.5 -579.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +148.799 579.282 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 579.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -579.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 579.282 Td +/F130_0 9.9626 Tf +(7) 4.9813 Tj +[1 0 0 1 516.09 579.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -567.327] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 567.327 Td +/F130_0 9.9626 Tf +(2.9.) 14.9439 Tj +-310 TJm +(A) 7.193 Tj +55 TJm +(UTHOR) 34.3112 Tj +[1 0 0 1 130.989 567.327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -135.97 -567.327] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.32 567.327 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 567.327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -567.327] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 567.327 Td +/F130_0 9.9626 Tf +(7) 4.9813 Tj +[1 0 0 1 516.09 567.327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.2192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.736] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -555.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 555.372 Td +/F130_0 9.9626 Tf +(3.) 7.47195 Tj +-310 TJm +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 160.049 555.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -160.049 -555.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +160.049 555.372 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 207.87 555.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -215.342 -555.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.856 555.372 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 555.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -555.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 555.372 Td +/F130_0 9.9626 Tf +(8) 4.9813 Tj +[1 0 0 1 516.09 555.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -543.416] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 543.416 Td +/F130_0 9.9626 Tf +(3.1.) 14.9439 Tj +-310 TJm +(T) 6.08715 Tj +80 TJm +(op-le) 20.4731 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(structure) 34.8591 Tj +[1 0 0 1 164.921 543.416] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.902 -543.416] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.997 543.416 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 543.416] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -543.416] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 543.416 Td +/F130_0 9.9626 Tf +(8) 4.9813 Tj +[1 0 0 1 516.09 543.416] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -531.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 531.461 Td +/F130_0 9.9626 Tf +(3.1.1.) 22.4159 Tj +-310 TJm +(Lo) 11.0684 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 177.374 531.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -182.355 -531.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.866 531.461 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 531.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -531.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 531.461 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 531.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -519.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 519.506 Td +/F130_0 9.9626 Tf +(3.1.2.) 22.4159 Tj +-310 TJm +(High-le) 30.4357 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 179.287 519.506] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -184.268 -519.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.822 519.506 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 519.506] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -519.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 519.506 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 519.506] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -507.551] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 507.551 Td +/F130_0 9.9626 Tf +(3.1.3.) 22.4159 Tj +-310 TJm +(Utility) 26.0223 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 202.669 507.551] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -207.65 -507.551] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.582 507.551 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 507.551] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -507.551] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 507.551 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 507.551] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -495.596] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 495.596 Td +/F130_0 9.9626 Tf +(3.2.) 14.9439 Tj +-310 TJm +(Error) 21.0211 Tj +-250 TJm +(handling) 34.8691 Tj +[1 0 0 1 148.413 495.596] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -153.394 -495.596] cm +[1 0 0 1 0 0] Tm +0 0 Td +162.611 495.596 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 495.596] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -495.596] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 495.596 Td +/F130_0 9.9626 Tf +(10) 9.9626 Tj +[1 0 0 1 516.09 495.596] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -483.641] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 483.641 Td +/F130_0 9.9626 Tf +(3.3.) 14.9439 Tj +-310 TJm +(Lo) 11.0684 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +[1 0 0 1 167.571 483.641] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -172.552 -483.641] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.045 483.641 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 483.641] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -483.641] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 483.641 Td +/F130_0 9.9626 Tf +(11) 9.9626 Tj +[1 0 0 1 516.09 483.641] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -471.685] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 471.685 Td +/F130_0 9.9626 Tf +(3.3.1.) 22.4159 Tj +[1 0 0 1 97.5043 471.685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -471.685] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 471.685 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 205.101 471.685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.082 -471.685] cm +[1 0 0 1 0 0] Tm +0 0 Td +219.736 471.685 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 471.685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -471.685] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 471.685 Td +/F130_0 9.9626 Tf +(11) 9.9626 Tj +[1 0 0 1 516.09 471.685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -459.73] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 459.73 Td +/F130_0 9.9626 Tf +(3.3.2.) 22.4159 Tj +[1 0 0 1 97.5043 459.73] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -459.73] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 459.73 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 181.19 459.73] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -186.172 -459.73] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.497 459.73 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 459.73] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -459.73] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 459.73 Td +/F130_0 9.9626 Tf +(13) 9.9626 Tj +[1 0 0 1 516.09 459.73] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -447.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 447.775 Td +/F130_0 9.9626 Tf +(3.3.3.) 22.4159 Tj +[1 0 0 1 97.5043 447.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -447.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 447.775 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 199.123 447.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.105 -447.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +214.533 447.775 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 447.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -447.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 447.775 Td +/F130_0 9.9626 Tf +(16) 9.9626 Tj +[1 0 0 1 516.09 447.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -435.82] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 435.82 Td +/F130_0 9.9626 Tf +(3.3.4.) 22.4159 Tj +[1 0 0 1 97.5043 435.82] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -435.82] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 435.82 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 217.056 435.82] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -222.037 -435.82] cm +[1 0 0 1 0 0] Tm +0 0 Td +232.355 435.82 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 435.82] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -435.82] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 435.82 Td +/F130_0 9.9626 Tf +(16) 9.9626 Tj +[1 0 0 1 516.09 435.82] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -423.865] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 423.865 Td +/F130_0 9.9626 Tf +(3.3.5.) 22.4159 Tj +[1 0 0 1 97.5043 423.865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -423.865] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 423.865 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 193.146 423.865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.127 -423.865] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.116 423.865 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 423.865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -423.865] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 423.865 Td +/F130_0 9.9626 Tf +(17) 9.9626 Tj +[1 0 0 1 516.09 423.865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -411.91] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 411.91 Td +/F130_0 9.9626 Tf +(3.3.6.) 22.4159 Tj +[1 0 0 1 97.5043 411.91] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -411.91] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 411.91 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 211.078 411.91] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.06 -411.91] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.938 411.91 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 411.91] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -411.91] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 411.91 Td +/F130_0 9.9626 Tf +(18) 9.9626 Tj +[1 0 0 1 516.09 411.91] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -399.954] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 399.954 Td +/F130_0 9.9626 Tf +(3.4.) 14.9439 Tj +-310 TJm +(High-le) 30.4357 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +[1 0 0 1 169.483 399.954] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -174.465 -399.954] cm +[1 0 0 1 0 0] Tm +0 0 Td +184.216 399.954 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 399.954] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -399.954] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 399.954 Td +/F130_0 9.9626 Tf +(18) 9.9626 Tj +[1 0 0 1 516.09 399.954] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -387.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 387.999 Td +/F130_0 9.9626 Tf +(3.4.1.) 22.4159 Tj +[1 0 0 1 97.5043 387.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -387.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 387.999 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 181.19 387.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -186.172 -387.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.497 387.999 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 387.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -387.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 387.999 Td +/F130_0 9.9626 Tf +(19) 9.9626 Tj +[1 0 0 1 516.09 387.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -376.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 376.044 Td +/F130_0 9.9626 Tf +(3.4.2.) 22.4159 Tj +[1 0 0 1 97.5043 376.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -376.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 376.044 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 157.28 376.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -162.261 -376.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +171.472 376.044 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 376.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -376.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 376.044 Td +/F130_0 9.9626 Tf +(20) 9.9626 Tj +[1 0 0 1 516.09 376.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -364.089] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 364.089 Td +/F130_0 9.9626 Tf +(3.4.3.) 22.4159 Tj +[1 0 0 1 97.5043 364.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -364.089] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 364.089 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 211.078 364.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.06 -364.089] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.938 364.089 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 364.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -364.089] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 364.089 Td +/F130_0 9.9626 Tf +(21) 9.9626 Tj +[1 0 0 1 516.09 364.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -352.134] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 352.134 Td +/F130_0 9.9626 Tf +(3.4.4.) 22.4159 Tj +[1 0 0 1 97.5043 352.134] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -352.134] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 352.134 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 187.168 352.134] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.149 -352.134] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.914 352.134 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 352.134] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -352.134] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 352.134 Td +/F130_0 9.9626 Tf +(22) 9.9626 Tj +[1 0 0 1 516.09 352.134] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6451] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -340.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 340.179 Td +/F130_0 9.9626 Tf +(3.4.5.) 22.4159 Tj +[1 0 0 1 97.5043 340.179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -340.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 340.179 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 187.168 340.179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.149 -340.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.914 340.179 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 340.179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -340.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 340.179 Td +/F130_0 9.9626 Tf +(22) 9.9626 Tj +[1 0 0 1 516.09 340.179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -328.223] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 328.223 Td +/F130_0 9.9626 Tf +(3.4.6.) 22.4159 Tj +[1 0 0 1 97.5043 328.223] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -328.223] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 328.223 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 163.258 328.223] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -168.239 -328.223] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.675 328.223 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 328.223] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -328.223] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 328.223 Td +/F130_0 9.9626 Tf +(23) 9.9626 Tj +[1 0 0 1 516.09 328.223] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -316.268] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 316.268 Td +/F130_0 9.9626 Tf +(3.4.7.) 22.4159 Tj +[1 0 0 1 97.5043 316.268] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -316.268] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 316.268 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 193.146 316.268] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.127 -316.268] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.116 316.268 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 316.268] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -316.268] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 316.268 Td +/F130_0 9.9626 Tf +(23) 9.9626 Tj +[1 0 0 1 516.09 316.268] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6451] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -304.313] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 304.313 Td +/F130_0 9.9626 Tf +(3.4.8.) 22.4159 Tj +-310 TJm +(Handling) 37.0808 Tj +-250 TJm +(embedded) 40.9463 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(streams) 30.4357 Tj +[1 0 0 1 279.56 304.313] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -284.541 -304.313] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.601 304.313 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 304.313] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -304.313] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 304.313 Td +/F130_0 9.9626 Tf +(24) 9.9626 Tj +[1 0 0 1 516.09 304.313] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -292.358] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 292.358 Td +/F130_0 9.9626 Tf +(3.4.9.) 22.4159 Tj +-310 TJm +(Standard) 35.417 Tj +-250 TJm +(\002le-reading/writing) 77.4791 Tj +-250 TJm +(code) 18.8094 Tj +[1 0 0 1 234.19 292.358] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -239.172 -292.358] cm +[1 0 0 1 0 0] Tm +0 0 Td +247.564 292.358 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 292.358] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -292.358] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 292.358 Td +/F130_0 9.9626 Tf +(25) 9.9626 Tj +[1 0 0 1 516.09 292.358] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -280.403] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 280.403 Td +/F130_0 9.9626 Tf +(3.5.) 14.9439 Tj +-310 TJm +(Utility) 26.0223 Tj +-250 TJm +(functions) 37.0808 Tj +[1 0 0 1 155.625 280.403] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -160.607 -280.403] cm +[1 0 0 1 0 0] Tm +0 0 Td +170.645 280.403 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 280.403] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -280.403] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 280.403 Td +/F130_0 9.9626 Tf +(26) 9.9626 Tj +[1 0 0 1 516.09 280.403] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -268.448] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 268.448 Td +/F130_0 9.9626 Tf +(3.5.1.) 22.4159 Tj +[1 0 0 1 97.5043 268.448] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -268.448] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 268.448 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffCompress) 143.461 Tj +[1 0 0 1 240.966 268.448] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.948 -268.448] cm +[1 0 0 1 0 0] Tm +0 0 Td +255.38 268.448 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 268.448] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -268.448] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 268.448 Td +/F130_0 9.9626 Tf +(26) 9.9626 Tj +[1 0 0 1 516.09 268.448] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -256.492] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 256.492 Td +/F130_0 9.9626 Tf +(3.5.2.) 22.4159 Tj +[1 0 0 1 97.5043 256.492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -256.492] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 256.492 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 252.922 256.492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -257.903 -256.492] cm +[1 0 0 1 0 0] Tm +0 0 Td +267.999 256.492 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 256.492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -256.492] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 256.492 Td +/F130_0 9.9626 Tf +(27) 9.9626 Tj +[1 0 0 1 516.09 256.492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -244.537] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 244.537 Td +/F130_0 9.9626 Tf +(3.6.) 14.9439 Tj +[1 0 0 1 90.0324 244.537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90.0324 -244.537] cm +[1 0 0 1 0 0] Tm +0 0 Td +90.0324 244.537 Td +/F134_0 9.9626 Tf +(zlib) 23.9102 Tj +[1 0 0 1 113.943 244.537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.943 -244.537] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.433 244.537 Td +/F130_0 9.9626 Tf +(compatibility) 53.1405 Tj +-250 TJm +(functions) 37.0808 Tj +[1 0 0 1 209.144 244.537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -214.126 -244.537] cm +[1 0 0 1 0 0] Tm +0 0 Td +223.971 244.537 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 244.537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -244.537] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 244.537 Td +/F130_0 9.9626 Tf +(28) 9.9626 Tj +[1 0 0 1 516.09 244.537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -232.582] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 232.582 Td +/F130_0 9.9626 Tf +(3.7.) 14.9439 Tj +-310 TJm +(Using) 23.8007 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +[1 0 0 1 177.195 232.582] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.195 -232.582] cm +[1 0 0 1 0 0] Tm +0 0 Td +177.195 232.582 Td +/F134_0 9.9626 Tf +(stdio) 29.8878 Tj +[1 0 0 1 207.083 232.582] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -207.083 -232.582] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.083 232.582 Td +/F130_0 9.9626 Tf +(-free) 18.7994 Tj +-250 TJm +(en) 9.40469 Tj +40 TJm +(vironment) 40.9562 Tj +[1 0 0 1 278.335 232.582] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -283.316 -232.582] cm +[1 0 0 1 0 0] Tm +0 0 Td +291.775 232.582 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 232.582] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -232.582] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 232.582 Td +/F130_0 9.9626 Tf +(28) 9.9626 Tj +[1 0 0 1 516.09 232.582] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -220.627] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 220.627 Td +/F130_0 9.9626 Tf +(3.7.1.) 22.4159 Tj +-310 TJm +(Getting) 29.8878 Tj +-250 TJm +(rid) 11.0684 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 154.231 220.627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -154.231 -220.627] cm +[1 0 0 1 0 0] Tm +0 0 Td +154.231 220.627 Td +/F134_0 9.9626 Tf +(stdio) 29.8878 Tj +[1 0 0 1 184.119 220.627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -189.1 -220.627] cm +[1 0 0 1 0 0] Tm +0 0 Td +198.175 220.627 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 220.627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -220.627] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 220.627 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 220.627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -208.672] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 208.672 Td +/F130_0 9.9626 Tf +(3.7.2.) 22.4159 Tj +-310 TJm +(Critical) 29.8878 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(handling) 34.8691 Tj +[1 0 0 1 186.599 208.672] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -191.58 -208.672] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.629 208.672 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 208.672] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -208.672] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 208.672 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 208.672] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -196.717] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 196.717 Td +/F130_0 9.9626 Tf +(3.8.) 14.9439 Tj +-310 TJm +(Making) 30.9936 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws) 11.0684 Tj +-250 TJm +(DLL) 19.3673 Tj +[1 0 0 1 189.828 196.717] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -194.809 -196.717] cm +[1 0 0 1 0 0] Tm +0 0 Td +203.243 196.717 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 196.717] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -196.717] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 196.717 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 196.717] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -184.761] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 184.761 Td +/F130_0 9.9626 Tf +(4.) 7.47195 Tj +-310 TJm +(Miscellanea) 48.1393 Tj +[1 0 0 1 130.699 184.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -135.68 -184.761] cm +[1 0 0 1 0 0] Tm +0 0 Td +144.898 184.761 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 184.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -184.761] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 184.761 Td +/F130_0 9.9626 Tf +(31) 9.9626 Tj +[1 0 0 1 516.09 184.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -172.806] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 172.806 Td +/F130_0 9.9626 Tf +(4.1.) 14.9439 Tj +-310 TJm +(Limitations) 45.9475 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(format) 26.5603 Tj +[1 0 0 1 255.231 172.806] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -260.212 -172.806] cm +[1 0 0 1 0 0] Tm +0 0 Td +269.154 172.806 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 172.806] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -172.806] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 172.806 Td +/F130_0 9.9626 Tf +(31) 9.9626 Tj +[1 0 0 1 516.09 172.806] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -160.851] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 160.851 Td +/F130_0 9.9626 Tf +(4.2.) 14.9439 Tj +-310 TJm +(Portability) 42.0721 Tj +-250 TJm +(issues) 23.8007 Tj +[1 0 0 1 158.395 160.851] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -163.376 -160.851] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.03 160.851 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 160.851] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -160.851] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 160.851 Td +/F130_0 9.9626 Tf +(32) 9.9626 Tj +[1 0 0 1 516.09 160.851] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -148.896] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 148.896 Td +/F130_0 9.9626 Tf +(4.3.) 14.9439 Tj +-310 TJm +(Reporting) 39.8504 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ugs) 13.8381 Tj +[1 0 0 1 150.993 148.896] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.975 -148.896] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.115 148.896 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 148.896] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -148.896] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 148.896 Td +/F130_0 9.9626 Tf +(32) 9.9626 Tj +[1 0 0 1 516.09 148.896] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -136.941] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 136.941 Td +/F130_0 9.9626 Tf +(4.4.) 14.9439 Tj +-310 TJm +(Did) 14.9439 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(get) 12.1743 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(right) 18.8194 Tj +-250 TJm +(package?) 37.0609 Tj +[1 0 0 1 212.602 136.941] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -218.778 -136.941] cm +[1 0 0 1 0 0] Tm +0 0 Td +229.109 136.941 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 136.941] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -136.941] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 136.941 Td +/F130_0 9.9626 Tf +(33) 9.9626 Tj +[1 0 0 1 516.09 136.941] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -124.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 124.986 Td +/F130_0 9.9626 Tf +(4.5.) 14.9439 Tj +-310 TJm +(Further) 29.3299 Tj +-250 TJm +(Reading) 33.2053 Tj +[1 0 0 1 155.058 124.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -160.039 -124.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +170.361 124.986 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 124.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -124.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 124.986 Td +/F130_0 9.9626 Tf +(34) 9.9626 Tj +[1 0 0 1 516.09 124.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -62.0143] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 41.3997 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -494.668 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +536.068 50.8518 Td +/F130_0 9.9626 Tf +(iii) 8.30881 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 4 4 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 701.916 Td +/F122_0 24.7902 Tf +(1.) 20.675 Tj +-278 TJm +(Intr) 39.937 Tj +20 TJm +(oduction) 104.664 Tj +[1 0 0 1 72 701.606] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -691.643] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 679.998 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 679.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -679.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.507 679.998 Td +/F130_0 9.9626 Tf +(compresses) 45.9276 Tj +-263 TJm +(\002les) 16.6077 Tj +-263 TJm +(using) 21.589 Tj +-263 TJm +(the) 12.1743 Tj +-262 TJm +(Burro) 23.2427 Tj +25 TJm +(ws-Wheeler) 48.1293 Tj +-263 TJm +(block-sorting) 53.1305 Tj +-263 TJm +(te) 7.193 Tj +15 TJm +(xt) 7.7509 Tj +-263 TJm +(compression) 50.3609 Tj +-263 TJm +(algorithm,) 41.2352 Tj +-266 TJm +(and) 14.386 Tj +-263 TJm +(Huf) 15.4918 Tj +25 TJm +(fman) 20.4731 Tj +-263 TJm +(coding.) 29.6088 Tj +72 668.043 Td +(Compression) 52.5826 Tj +-203 TJm +(is) 6.64505 Tj +-204 TJm +(generally) 37.0708 Tj +-203 TJm +(considerably) 50.9089 Tj +-203 TJm +(better) 22.6848 Tj +-204 TJm +(t) 2.7696 Tj +1 TJm +(han) 14.386 Tj +-204 TJm +(that) 14.9439 Tj +-203 TJm +(achie) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ed) 9.40469 Tj +-203 TJm +(by) 9.9626 Tj +-204 TJm +(more) 20.4731 Tj +-203 TJm +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(entional) 32.0995 Tj +-203 TJm +(LZ77/LZ78-based) 73.0458 Tj +-204 TJm +(compressors,) 52.2937 Tj +72 656.087 Td +(and) 14.386 Tj +-250 TJm +(approaches) 44.8118 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(performance) 50.341 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(PPM) 19.9352 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(amily) 22.6948 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(statistical) 37.6387 Tj +-250 TJm +(compressors.) 52.2937 Tj +[1 0 0 1 72 653.931] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -643.968] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 634.17 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 634.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -634.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +105.073 634.17 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-320 TJm +(b) 4.9813 Tj +20 TJm +(uilt) 13.2901 Tj +-319 TJm +(on) 9.9626 Tj +-320 TJm +(top) 12.7322 Tj +-320 TJm +(of) 8.29885 Tj +[1 0 0 1 176.712 634.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.712 -634.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.712 634.17 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 224.533 634.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -224.533 -634.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.533 634.17 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-337 TJm +(a) 4.42339 Tj +-320 TJm +(\003e) 9.9626 Tj +15 TJm +(xible) 19.9252 Tj +-320 TJm +(library) 26.5603 Tj +-319 TJm +(for) 11.6164 Tj +-320 TJm +(handling) 34.8691 Tj +-320 TJm +(compressed) 47.0334 Tj +-320 TJm +(data) 16.5977 Tj +-319 TJm +(in) 7.7509 Tj +-320 TJm +(the) 12.1743 Tj +[1 0 0 1 449.816 634.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -449.816 -634.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +449.816 634.17 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 479.704 634.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -479.704 -634.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +482.889 634.17 Td +/F130_0 9.9626 Tf +(format.) 29.0509 Tj +-1039 TJm +(This) 17.7135 Tj +72 622.214 Td +(manual) 29.3299 Tj +-316 TJm +(describes) 37.0708 Tj +-316 TJm +(both) 17.7135 Tj +-317 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-316 TJm +(to) 7.7509 Tj +-316 TJm +(use) 13.2801 Tj +-316 TJm +(the) 12.1743 Tj +-316 TJm +(program) 33.7533 Tj +-316 TJm +(and) 14.386 Tj +-317 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-316 TJm +(to) 7.7509 Tj +-316 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-316 TJm +(with) 17.7135 Tj +-316 TJm +(the) 12.1743 Tj +-317 TJm +(library) 26.5603 Tj +-316 TJm +(interf) 21.579 Tj +10 TJm +(ace.) 15.7608 Tj +-1017 TJm +(Most) 20.4831 Tj +-316 TJm +(of) 8.29885 Tj +-316 TJm +(the) 12.1743 Tj +-317 TJm +(manual) 29.3299 Tj +-316 TJm +(is) 6.64505 Tj +72 610.259 Td +(de) 9.40469 Tj +25 TJm +(v) 4.9813 Tj +20 TJm +(oted) 17.1556 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(program,) 36.2439 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(good) 19.9252 Tj +-250 TJm +(ne) 9.40469 Tj +25 TJm +(ws) 11.0684 Tj +-250 TJm +(if) 6.08715 Tj +-250 TJm +(your) 18.2614 Tj +-250 TJm +(interest) 29.3299 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(only) 17.7135 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(program.) 36.2439 Tj +[1 0 0 1 72 608.102] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -29.7236] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 578.379 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 578.379] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4907 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -86.944 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 578.379 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-259 TJm +(to) 7.7509 Tj +-260 TJm +(use) 13.2801 Tj +-259 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 156.985 578.379] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -156.985 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.57 578.379 Td +/F130_0 9.9626 Tf +([2]) 11.6164 Tj +[1 0 0 1 171.186 578.379] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -171.186 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +173.771 578.379 Td +/F130_0 9.9626 Tf +(describes) 37.0708 Tj +-259 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-260 TJm +(to) 7.7509 Tj +-259 TJm +(use) 13.2801 Tj +[1 0 0 1 259.119 578.379] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -259.119 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +259.119 578.379 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 289.007 578.379] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -289.007 -578.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.007 578.379 Td +/F130_0 9.9626 Tf +(;) 2.7696 Tj +-264 TJm +(this) 14.396 Tj +-260 TJm +(is) 6.64505 Tj +-259 TJm +(the) 12.1743 Tj +-260 TJm +(only) 17.7135 Tj +-259 TJm +(part) 15.4918 Tj +-259 TJm +(you) 14.9439 Tj +-260 TJm +(need) 18.8094 Tj +-259 TJm +(to) 7.7509 Tj +-260 TJm +(read) 17.1456 Tj +-259 TJm +(if) 6.08715 Tj +-260 TJm +(you) 14.9439 Tj +-259 TJm +(just) 14.396 Tj +-260 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-259 TJm +(to) 7.7509 Tj +-260 TJm +(kno) 14.9439 Tj +25 TJm +(w) 7.193 Tj +86.944 566.424 Td +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(operate) 29.3199 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(program.) 36.2439 Tj +[1 0 0 1 199.302 566.424] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -127.302 -21.9178] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -544.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 544.506 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 544.506] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4907 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -86.944 -544.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 544.506 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(libbzip2) 32.6574 Tj +[1 0 0 1 197.09 544.506] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -197.09 -544.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +199.58 544.506 Td +/F130_0 9.9626 Tf +([8]) 11.6164 Tj +[1 0 0 1 211.197 544.506] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -211.197 -544.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +213.687 544.506 Td +/F130_0 9.9626 Tf +(describes) 37.0708 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(programming) 54.2364 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(aces) 17.1456 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(detail,) 24.6275 Tj +-250 TJm +(and) 14.386 Tj +[1 0 0 1 417.501 544.506] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -345.501 -21.9178] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -522.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 522.588 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 522.588] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 2.4907 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -86.944 -522.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 522.588 Td +/F130_0 9.9626 Tf +(Miscellanea) 48.1393 Tj +[1 0 0 1 135.083 522.588] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -135.083 -522.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +137.573 522.588 Td +/F130_0 9.9626 Tf +([31]) 16.5977 Tj +[1 0 0 1 154.171 522.588] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -154.171 -522.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +156.662 522.588 Td +/F130_0 9.9626 Tf +(records) 29.3199 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(miscellaneous) 56.4481 Tj +-250 TJm +(notes) 21.031 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(I) 3.31755 Tj +-250 TJm +(thought) 30.4457 Tj +-250 TJm +(ought) 22.6948 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(recorded) 34.8492 Tj +-250 TJm +(some) 21.031 Tj +25 TJm +(where.) 26.8293 Tj +[1 0 0 1 492.31 522.588] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -420.31 -471.736] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.8518 Td +/F130_0 9.9626 Tf +(1) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 5 5 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 701.916 Td +/F122_0 24.7902 Tf +(2.) 20.675 Tj +-278 TJm +(Ho) 33.0453 Tj +15 TJm +(w) 19.2868 Tj +-278 TJm +(to) 23.4019 Tj +-278 TJm +(use) 42.7135 Tj +-278 TJm +(bzip2) 63.3638 Tj +[1 0 0 1 72 696.784] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -14.944] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -671.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 656.35 Td +/F122_0 17.2154 Tf +(T) 10.5186 Tj +80 TJm +(ab) 20.0904 Tj +10 TJm +(le) 14.3576 Tj +-278 TJm +(of) 16.2513 Tj +-278 TJm +(Contents) 74.5943 Tj +[1 0 0 1 72 647.528] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.7401] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 635.788 Td +/F130_0 9.9626 Tf +(2.1.) 14.9439 Tj +-310 TJm +(N) 7.193 Tj +35 TJm +(AME) 22.1369 Tj +[1 0 0 1 119.014 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -123.995 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +132.691 635.788 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 635.788 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 516.09 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 623.832 Td +/F130_0 9.9626 Tf +(2.2.) 14.9439 Tj +-310 TJm +(SYNOPSIS) 47.0534 Tj +[1 0 0 1 137.085 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -142.067 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.582 623.832 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 623.832 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 516.09 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 611.877 Td +/F130_0 9.9626 Tf +(2.3.) 14.9439 Tj +-310 TJm +(DESCRIPTION) 64.7569 Tj +[1 0 0 1 154.789 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.77 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +168.29 611.877 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 611.877 Td +/F130_0 9.9626 Tf +(3) 4.9813 Tj +[1 0 0 1 516.09 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 599.922 Td +/F130_0 9.9626 Tf +(2.4.) 14.9439 Tj +-310 TJm +(OPTIONS) 42.0621 Tj +[1 0 0 1 132.094 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.076 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.873 599.922 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 599.922 Td +/F130_0 9.9626 Tf +(4) 4.9813 Tj +[1 0 0 1 516.09 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 587.967 Td +/F130_0 9.9626 Tf +(2.5.) 14.9439 Tj +-310 TJm +(MEMOR) 37.6387 Tj +65 TJm +(Y) 7.193 Tj +-250 TJm +(MAN) 23.2427 Tj +35 TJm +(A) 7.193 Tj +40 TJm +(GEMENT) 41.5042 Tj +[1 0 0 1 207.9 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -212.881 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.412 587.967 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 587.967 Td +/F130_0 9.9626 Tf +(5) 4.9813 Tj +[1 0 0 1 516.09 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 576.012 Td +/F130_0 9.9626 Tf +(2.6.) 14.9439 Tj +-310 TJm +(RECO) 26.5703 Tj +50 TJm +(VERING) 37.6287 Tj +-250 TJm +(D) 7.193 Tj +40 TJm +(A) 7.193 Tj +111 TJm +(T) 6.08715 Tj +93 TJm +(A) 7.193 Tj +-250 TJm +(FR) 12.1843 Tj +40 TJm +(OM) 16.0497 Tj +-250 TJm +(D) 7.193 Tj +40 TJm +(AMA) 23.2427 Tj +40 TJm +(GED) 20.4731 Tj +-250 TJm +(FILES) 26.5703 Tj +[1 0 0 1 293.449 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -298.43 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +308.464 576.012 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 576.012 Td +/F130_0 9.9626 Tf +(6) 4.9813 Tj +[1 0 0 1 516.09 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 564.056 Td +/F130_0 9.9626 Tf +(2.7.) 14.9439 Tj +-310 TJm +(PERFORMANCE) 73.6236 Tj +-250 TJm +(NO) 14.386 Tj +40 TJm +(TES) 17.7135 Tj +[1 0 0 1 197.847 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.829 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +211.958 564.056 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 564.056 Td +/F130_0 9.9626 Tf +(6) 4.9813 Tj +[1 0 0 1 516.09 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 552.101 Td +/F130_0 9.9626 Tf +(2.8.) 14.9439 Tj +-310 TJm +(CA) 13.8381 Tj +135 TJm +(VEA) 20.4731 Tj +111 TJm +(TS) 11.6264 Tj +[1 0 0 1 133.519 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -138.5 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +148.799 552.101 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 552.101 Td +/F130_0 9.9626 Tf +(7) 4.9813 Tj +[1 0 0 1 516.09 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8556] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 540.146 Td +/F130_0 9.9626 Tf +(2.9.) 14.9439 Tj +-310 TJm +(A) 7.193 Tj +55 TJm +(UTHOR) 34.3112 Tj +[1 0 0 1 130.989 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -135.97 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.32 540.146 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 540.146 Td +/F130_0 9.9626 Tf +(7) 4.9813 Tj +[1 0 0 1 516.09 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.2191] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -520.002] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 508.266 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-250 TJm +(chapter) 29.3199 Tj +-250 TJm +(contains) 33.2053 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(cop) 14.386 Tj +10 TJm +(y) 4.9813 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +[1 0 0 1 213.837 508.266] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -213.837 -508.266] cm +[1 0 0 1 0 0] Tm +0 0 Td +213.837 508.266 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 243.725 508.266] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.725 -508.266] cm +[1 0 0 1 0 0] Tm +0 0 Td +246.215 508.266 Td +/F130_0 9.9626 Tf +(man) 17.1556 Tj +-250 TJm +(page,) 21.3 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(nothing) 30.4457 Tj +-250 TJm +(else.) 17.9825 Tj +[1 0 0 1 72 506.109] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -496.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 473.513 Td +/F122_0 20.6585 Tf +(2.1.) 34.4584 Tj +-278 TJm +(NAME) 60.8186 Tj +[1 0 0 1 72 473.513] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -31.8804] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -441.632] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 441.632 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 441.632] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -441.632] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 441.632 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 116.832 441.632] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.832 -441.632] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.832 441.632 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 121.813 441.632] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -121.813 -441.632] cm +[1 0 0 1 0 0] Tm +0 0 Td +121.813 441.632 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 163.656 441.632] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -163.656 -441.632] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.147 441.632 Td +/F130_0 9.9626 Tf +(-) 3.31755 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(block-sorting) 53.1305 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(compressor) 45.9276 Tj +40 TJm +(,) 2.49065 Tj +-250 TJm +(v1.0.4) 24.9065 Tj +[1 0 0 1 325.129 441.632] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.129 -21.9179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -419.715] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 419.715 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 419.715] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -419.715] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 419.715 Td +/F134_0 9.9626 Tf +(bzcat) 29.8878 Tj +[1 0 0 1 116.832 419.715] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.832 -419.715] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.322 419.715 Td +/F130_0 9.9626 Tf +(-) 3.31755 Tj +-250 TJm +(decompresses) 55.3323 Tj +-250 TJm +(\002les) 16.6077 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(stdout) 24.3586 Tj +[1 0 0 1 236.651 419.715] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.651 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -397.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 397.797 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 397.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -397.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 397.797 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 158.675 397.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.675 -397.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.166 397.797 Td +/F130_0 9.9626 Tf +(-) 3.31755 Tj +-250 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ers) 11.6164 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(damaged) 35.965 Tj +-250 TJm +(bzip2) 22.1369 Tj +-250 TJm +(\002les) 16.6077 Tj +[1 0 0 1 323.545 397.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -251.545 -12.1195] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -375.715] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 353.081 Td +/F122_0 20.6585 Tf +(2.2.) 34.4584 Tj +-278 TJm +(SYNOPSIS) 105.627 Tj +[1 0 0 1 72 352.823] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -31.6223] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -321.201] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 321.201 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 321.201] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -321.201] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 321.201 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 116.832 321.201] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.832 -321.201] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.322 321.201 Td +/F130_0 9.9626 Tf +([) 3.31755 Tj +-250 TJm +(-cdfkqstvzVL123456789) 100.164 Tj +-250 TJm +(]) 3.31755 Tj +-250 TJm +([) 3.31755 Tj +-250 TJm +(\002lenames) 38.1866 Tj +-250 TJm +(...) 7.47195 Tj +-620 TJm +(]) 3.31755 Tj +[1 0 0 1 297.045 321.201] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -225.045 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -299.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 299.283 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 299.283] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -299.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 299.283 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 128.787 299.283] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -128.787 -299.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +131.278 299.283 Td +/F130_0 9.9626 Tf +([) 3.31755 Tj +-250 TJm +(-fkvsVL) 33.7533 Tj +-250 TJm +(]) 3.31755 Tj +-250 TJm +([) 3.31755 Tj +-250 TJm +(\002lenames) 38.1866 Tj +-250 TJm +(...) 7.47195 Tj +-620 TJm +(]) 3.31755 Tj +[1 0 0 1 242.589 299.283] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -170.589 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -277.365] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 277.365 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 277.365] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -277.365] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 277.365 Td +/F134_0 9.9626 Tf +(bzcat) 29.8878 Tj +[1 0 0 1 116.832 277.365] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.832 -277.365] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.322 277.365 Td +/F130_0 9.9626 Tf +([) 3.31755 Tj +-250 TJm +(-s) 7.193 Tj +-250 TJm +(]) 3.31755 Tj +-250 TJm +([) 3.31755 Tj +-250 TJm +(\002lenames) 38.1866 Tj +-250 TJm +(...) 7.47195 Tj +-620 TJm +(]) 3.31755 Tj +[1 0 0 1 204.074 277.365] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -132.074 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -255.447] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 255.447 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 255.447] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -255.447] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 255.447 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 158.675 255.447] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.675 -255.447] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.166 255.447 Td +/F130_0 9.9626 Tf +(\002lename) 34.3112 Tj +[1 0 0 1 195.476 255.447] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -123.477 -204.596] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.8519] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.8519 Td +/F130_0 9.9626 Tf +(2) 4.9813 Tj +[1 0 0 1 453.269 50.8519] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 6 6 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 105.519 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -371.59 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.109 749.245 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 266.071 747.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 704.93 Td +/F122_0 20.6585 Tf +(2.3.) 34.4584 Tj +-278 TJm +(DESCRIPTION) 141.18 Tj +[1 0 0 1 72 704.672] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -694.709] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 683.012 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 683.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -683.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.56 683.012 Td +/F130_0 9.9626 Tf +(compresses) 45.9276 Tj +-268 TJm +(\002les) 16.6077 Tj +-268 TJm +(using) 21.589 Tj +-268 TJm +(the) 12.1743 Tj +-269 TJm +(Burro) 23.2427 Tj +25 TJm +(ws-Wheeler) 48.1293 Tj +-268 TJm +(block) 22.1369 Tj +-268 TJm +(sorting) 27.6761 Tj +-268 TJm +(te) 7.193 Tj +15 TJm +(xt) 7.7509 Tj +-268 TJm +(compression) 50.3609 Tj +-268 TJm +(algorithm,) 41.2352 Tj +-273 TJm +(and) 14.386 Tj +-268 TJm +(Huf) 15.4918 Tj +25 TJm +(fman) 20.4731 Tj +-269 TJm +(c) 4.42339 Tj +1 TJm +(od) 9.9626 Tj +-1 TJm +(i) 2.7696 Tj +1 TJm +(ng.) 12.4533 Tj +72 671.057 Td +(Compression) 52.5826 Tj +-203 TJm +(is) 6.64505 Tj +-204 TJm +(generally) 37.0708 Tj +-203 TJm +(considerably) 50.9089 Tj +-203 TJm +(better) 22.6848 Tj +-204 TJm +(t) 2.7696 Tj +1 TJm +(han) 14.386 Tj +-204 TJm +(that) 14.9439 Tj +-203 TJm +(achie) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ed) 9.40469 Tj +-203 TJm +(by) 9.9626 Tj +-204 TJm +(more) 20.4731 Tj +-203 TJm +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(entional) 32.0995 Tj +-203 TJm +(LZ77/LZ78-based) 73.0458 Tj +-204 TJm +(compressors,) 52.2937 Tj +72 659.101 Td +(and) 14.386 Tj +-250 TJm +(approaches) 44.8118 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(performance) 50.341 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(PPM) 19.9352 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(amily) 22.6948 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(statistical) 37.6387 Tj +-250 TJm +(compressors.) 52.2937 Tj +[1 0 0 1 72 656.945] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -646.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 637.184 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(command-line) 57.5539 Tj +-250 TJm +(options) 29.3399 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(deliberately) 47.0334 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-250 TJm +(similar) 27.6761 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(those) 21.031 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(GNU) 21.579 Tj +[1 0 0 1 364.869 637.184] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -364.869 -637.184] cm +[1 0 0 1 0 0] Tm +0 0 Td +364.869 637.184 Td +/F134_0 9.9626 Tf +(gzip) 23.9102 Tj +[1 0 0 1 388.779 637.184] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -388.779 -637.184] cm +[1 0 0 1 0 0] Tm +0 0 Td +388.779 637.184 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(identical.) 36.8018 Tj +[1 0 0 1 72 635.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -625.064] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 615.266 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 615.266] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -615.266] cm +[1 0 0 1 0 0] Tm +0 0 Td +105.175 615.266 Td +/F130_0 9.9626 Tf +(e) 4.42339 Tj +15 TJm +(xpects) 25.4544 Tj +-330 TJm +(a) 4.42339 Tj +-330 TJm +(list) 12.1843 Tj +-330 TJm +(of) 8.29885 Tj +-330 TJm +(\002le) 12.7322 Tj +-329 TJm +(names) 25.4544 Tj +-330 TJm +(to) 7.7509 Tj +-330 TJm +(accompan) 40.3884 Tj +15 TJm +(y) 4.9813 Tj +-330 TJm +(the) 12.1743 Tj +-330 TJm +(command-line) 57.5539 Tj +-330 TJm +(\003ags.) 21.31 Tj +-1099 TJm +(Each) 19.9152 Tj +-330 TJm +(\002le) 12.7322 Tj +-330 TJm +(is) 6.64505 Tj +-330 TJm +(replaced) 33.7433 Tj +-330 TJm +(by) 9.9626 Tj +-330 TJm +(a) 4.42339 Tj +-330 TJm +(compressed) 47.0334 Tj +72 603.311 Td +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-349 TJm +(of) 8.29885 Tj +-348 TJm +(itself,) 22.4159 Tj +-373 TJm +(with) 17.7135 Tj +-349 TJm +(the) 12.1743 Tj +-349 TJm +(name) 21.579 Tj +[1 0 0 1 204.444 603.311] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.444 -603.311] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.444 603.311 Td +/F134_0 9.9626 Tf +(original_name.bz2) 101.619 Tj +[1 0 0 1 306.063 603.311] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -306.063 -603.311] cm +[1 0 0 1 0 0] Tm +0 0 Td +306.063 603.311 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1212 TJm +(Each) 19.9152 Tj +-348 TJm +(compressed) 47.0334 Tj +-349 TJm +(\002le) 12.7322 Tj +-348 TJm +(has) 13.2801 Tj +-349 TJm +(the) 12.1743 Tj +-348 TJm +(same) 20.4731 Tj +-349 TJm +(modi\002cation) 50.3709 Tj +-349 TJm +(date,) 19.0883 Tj +72 591.356 Td +(permissions,) 50.092 Tj +-344 TJm +(and,) 16.8766 Tj +-344 TJm +(when) 21.579 Tj +-325 TJm +(possible,) 35.1481 Tj +-344 TJm +(o) 4.9813 Tj +25 TJm +(wnership) 36.5229 Tj +-325 TJm +(as) 8.29885 Tj +-325 TJm +(the) 12.1743 Tj +-326 TJm +(corresponding) 56.996 Tj +-325 TJm +(original,) 33.4843 Tj +-344 TJm +(so) 8.85675 Tj +-325 TJm +(that) 14.9439 Tj +-325 TJm +(these) 20.4731 Tj +-325 TJm +(properties) 39.8404 Tj +-325 TJm +(can) 13.8281 Tj +-326 TJm +(be) 9.40469 Tj +-325 TJm +(correctly) 35.4071 Tj +72 579.4 Td +(restored) 32.0895 Tj +-308 TJm +(at) 7.193 Tj +-308 TJm +(decompression) 59.7656 Tj +-307 TJm +(time.) 20.2042 Tj +-484 TJm +(File) 15.5018 Tj +-308 TJm +(name) 21.579 Tj +-308 TJm +(handling) 34.8691 Tj +-308 TJm +(is) 6.64505 Tj +-307 TJm +(nai) 12.1743 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-308 TJm +(in) 7.7509 Tj +-308 TJm +(the) 12.1743 Tj +-308 TJm +(sense) 21.579 Tj +-308 TJm +(that) 14.9439 Tj +-308 TJm +(there) 19.9152 Tj +-307 TJm +(is) 6.64505 Tj +-308 TJm +(no) 9.9626 Tj +-308 TJm +(mechanism) 45.3796 Tj +-308 TJm +(for) 11.6164 Tj +-308 TJm +(preserving) 42.0521 Tj +72 567.445 Td +(original) 30.9936 Tj +-334 TJm +(\002le) 12.7322 Tj +-333 TJm +(names,) 27.9451 Tj +-355 TJm +(permissions,) 50.092 Tj +-355 TJm +(o) 4.9813 Tj +25 TJm +(wnerships) 40.3983 Tj +-333 TJm +(or) 8.29885 Tj +-334 TJm +(dates) 20.4731 Tj +-334 TJm +(in) 7.7509 Tj +-333 TJm +(\002lesystems) 44.2838 Tj +-334 TJm +(which) 24.3486 Tj +-334 TJm +(lack) 16.5977 Tj +-333 TJm +(these) 20.4731 Tj +-334 TJm +(concepts,) 37.3498 Tj +-355 TJm +(or) 8.29885 Tj +-333 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-334 TJm +(serious) 28.224 Tj +-334 TJm +(\002le) 12.7322 Tj +72 555.49 Td +(name) 21.579 Tj +-250 TJm +(length) 24.9065 Tj +-250 TJm +(restrictions,) 46.7644 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(as) 8.29885 Tj +-250 TJm +(MS-DOS.) 40.1294 Tj +[1 0 0 1 72 553.333] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -543.371] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 533.572 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 533.572] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -533.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.379 533.572 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 121.255 533.572] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -121.255 -533.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +121.255 533.572 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 163.098 533.572] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -163.098 -533.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +165.589 533.572 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(erwrite) 28.2141 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xisting) 27.1282 Tj +-250 TJm +(\002les.) 19.0983 Tj +-620 TJm +(If) 6.63509 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(happen,) 31.2626 Tj +-250 TJm +(specify) 28.772 Tj +-250 TJm +(the) 12.1743 Tj +[1 0 0 1 495.977 533.572] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -495.977 -533.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +495.977 533.572 Td +/F134_0 9.9626 Tf +(-f) 11.9551 Tj +[1 0 0 1 507.932 533.572] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -507.932 -533.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +510.423 533.572 Td +/F130_0 9.9626 Tf +(\003ag.) 17.4346 Tj +[1 0 0 1 72 531.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -521.453] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 511.654 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-284 TJm +(no) 9.9626 Tj +-285 TJm +(\002le) 12.7322 Tj +-284 TJm +(names) 25.4544 Tj +-284 TJm +(are) 12.1643 Tj +-284 TJm +(speci\002ed,) 37.9077 Tj +[1 0 0 1 193.935 511.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -193.935 -511.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.935 511.654 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 223.823 511.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -223.823 -511.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +226.655 511.654 Td +/F130_0 9.9626 Tf +(compresses) 45.9276 Tj +-284 TJm +(from) 19.3673 Tj +-285 TJm +(standard) 33.7533 Tj +-284 TJm +(input) 20.4831 Tj +-284 TJm +(to) 7.7509 Tj +-284 TJm +(standard) 33.7533 Tj +-285 TJm +(output.) 27.9551 Tj +-825 TJm +(In) 8.29885 Tj +-285 TJm +(this) 14.396 Tj +-284 TJm +(case,) 19.6363 Tj +[1 0 0 1 491.778 511.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -491.778 -511.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +491.778 511.654 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 521.666 511.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -521.666 -511.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +524.499 511.654 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +72 499.699 Td +(decline) 28.772 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(write) 20.4731 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(terminal,) 35.696 Tj +-250 TJm +(as) 8.29885 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(entirely) 30.4357 Tj +-250 TJm +(incomprehensible) 70.8341 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(therefore) 35.955 Tj +-250 TJm +(pointless.) 37.9177 Tj +[1 0 0 1 72 497.542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -487.58] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 477.781 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 113.843 477.781] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -477.781] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.176 477.781 Td +/F130_0 9.9626 Tf +(\(or) 11.6164 Tj +[1 0 0 1 130.125 477.781] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -130.125 -477.781] cm +[1 0 0 1 0 0] Tm +0 0 Td +130.125 477.781 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-600 TJm +(-d) 11.9551 Tj +[1 0 0 1 177.946 477.781] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.946 -477.781] cm +[1 0 0 1 0 0] Tm +0 0 Td +177.946 477.781 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-234 TJm +(decompresses) 55.3323 Tj +-234 TJm +(all) 9.9626 Tj +-234 TJm +(speci\002ed) 35.417 Tj +-235 TJm +(\002les.) 19.0983 Tj +-609 TJm +(Files) 19.3773 Tj +-234 TJm +(which) 24.3486 Tj +-234 TJm +(were) 19.3573 Tj +-234 TJm +(not) 12.7322 Tj +-235 TJm +(created) 28.762 Tj +-234 TJm +(by) 9.9626 Tj +[1 0 0 1 445.012 477.781] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -445.012 -477.781] cm +[1 0 0 1 0 0] Tm +0 0 Td +445.012 477.781 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 474.9 477.781] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -474.9 -477.781] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.233 477.781 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-234 TJm +(be) 9.40469 Tj +-234 TJm +(detected) 33.1954 Tj +72 465.826 Td +(and) 14.386 Tj +-280 TJm +(i) 2.7696 Tj +1 TJm +(gnored,) 30.1568 Tj +-287 TJm +(and) 14.386 Tj +-280 TJm +(a) 4.42339 Tj +-279 TJm +(w) 7.193 Tj +10 TJm +(arning) 25.4544 Tj +-280 TJm +(issued.) 27.3972 Tj +[1 0 0 1 216.033 465.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.033 -465.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.033 465.826 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 245.921 465.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.921 -465.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +248.705 465.826 Td +/F130_0 9.9626 Tf +(attempts) 33.7633 Tj +-279 TJm +(to) 7.7509 Tj +-280 TJm +(guess) 22.1369 Tj +-279 TJm +(the) 12.1743 Tj +-280 TJm +(\002lename) 34.3112 Tj +-279 TJm +(for) 11.6164 Tj +-280 TJm +(the) 12.1743 Tj +-279 TJm +(decompressed) 56.4381 Tj +-280 TJm +(\002le) 12.7322 Tj +-279 TJm +(from) 19.3673 Tj +-280 TJm +(that) 14.9439 Tj +-279 TJm +(of) 8.29885 Tj +-280 TJm +(the) 12.1743 Tj +72 453.871 Td +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(as) 8.29885 Tj +-250 TJm +(follo) 18.8194 Tj +25 TJm +(ws:) 13.8381 Tj +[1 0 0 1 72 451.714] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.7236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -421.991] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 421.991 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 421.991] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -421.991] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 421.991 Td +/F134_0 9.9626 Tf +(filename.bz2) 71.7307 Tj +[1 0 0 1 164.653 421.991] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.653 -421.991] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.143 421.991 Td +/F130_0 9.9626 Tf +(becomes) 34.8591 Tj +[1 0 0 1 204.493 421.991] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.493 -421.991] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.493 421.991 Td +/F134_0 9.9626 Tf +(filename) 47.8205 Tj +[1 0 0 1 252.313 421.991] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -180.313 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -400.073] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 400.073 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 400.073] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -400.073] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 400.073 Td +/F134_0 9.9626 Tf +(filename.bz) 65.7532 Tj +[1 0 0 1 158.675 400.073] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.675 -400.073] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.166 400.073 Td +/F130_0 9.9626 Tf +(becomes) 34.8591 Tj +[1 0 0 1 198.515 400.073] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.515 -400.073] cm +[1 0 0 1 0 0] Tm +0 0 Td +198.515 400.073 Td +/F134_0 9.9626 Tf +(filename) 47.8205 Tj +[1 0 0 1 246.336 400.073] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -174.336 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -378.155] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 378.155 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 378.155] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -378.155] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 378.155 Td +/F134_0 9.9626 Tf +(filename.tbz2) 77.7083 Tj +[1 0 0 1 164.653 378.155] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.653 -378.155] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.143 378.155 Td +/F130_0 9.9626 Tf +(becomes) 34.8591 Tj +[1 0 0 1 204.493 378.155] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.493 -378.155] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.493 378.155 Td +/F134_0 9.9626 Tf +(filename.tar) 71.7307 Tj +[1 0 0 1 276.224 378.155] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.224 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -356.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 356.237 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 356.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -356.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 356.237 Td +/F134_0 9.9626 Tf +(filename.tbz) 71.7307 Tj +[1 0 0 1 164.653 356.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.653 -356.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.143 356.237 Td +/F130_0 9.9626 Tf +(becomes) 34.8591 Tj +[1 0 0 1 204.493 356.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.493 -356.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.493 356.237 Td +/F134_0 9.9626 Tf +(filename.tar) 71.7307 Tj +[1 0 0 1 276.224 356.237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.224 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -334.319] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 334.319 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 334.319] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -334.319] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 334.319 Td +/F134_0 9.9626 Tf +(anyothername) 71.7307 Tj +[1 0 0 1 164.653 334.319] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.653 -334.319] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.143 334.319 Td +/F130_0 9.9626 Tf +(becomes) 34.8591 Tj +[1 0 0 1 204.493 334.319] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.493 -334.319] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.493 334.319 Td +/F134_0 9.9626 Tf +(anyothername.out) 95.641 Tj +[1 0 0 1 300.134 334.319] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -228.134 -11.4968] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -322.823] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 312.402 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-342 TJm +(the) 12.1743 Tj +-342 TJm +(\002le) 12.7322 Tj +-342 TJm +(does) 18.2614 Tj +-342 TJm +(not) 12.7322 Tj +-343 TJm +(end) 14.386 Tj +-342 TJm +(in) 7.7509 Tj +-342 TJm +(one) 14.386 Tj +-342 TJm +(of) 8.29885 Tj +-342 TJm +(the) 12.1743 Tj +-342 TJm +(recognised) 43.158 Tj +-342 TJm +(endings,) 33.4843 Tj +[1 0 0 1 309.305 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -309.305 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +309.305 312.402 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 333.215 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -333.215 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +333.215 312.402 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 339.344 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -339.344 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +339.344 312.402 Td +/F134_0 9.9626 Tf +(.bz) 17.9327 Tj +[1 0 0 1 357.276 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -357.276 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +357.276 312.402 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 363.405 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -363.405 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.405 312.402 Td +/F134_0 9.9626 Tf +(.tbz2) 29.8878 Tj +[1 0 0 1 393.293 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -393.293 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +396.701 312.402 Td +/F130_0 9.9626 Tf +(or) 8.29885 Tj +[1 0 0 1 408.409 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -408.409 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +408.409 312.402 Td +/F134_0 9.9626 Tf +(.tbz) 23.9102 Tj +[1 0 0 1 432.319 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -432.319 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +432.319 312.402 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 438.448 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -438.448 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +438.448 312.402 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 468.336 312.402] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468.336 -312.402] cm +[1 0 0 1 0 0] Tm +0 0 Td +471.744 312.402 Td +/F130_0 9.9626 Tf +(complains) 40.9562 Tj +-342 TJm +(that) 14.9439 Tj +-342 TJm +(it) 5.53921 Tj +72 300.446 Td +(cannot) 26.5603 Tj +-250 TJm +(guess) 22.1369 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(name) 21.579 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(original) 30.9936 Tj +-250 TJm +(\002le,) 15.2229 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(uses) 17.1556 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(original) 30.9936 Tj +-250 TJm +(name) 21.579 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 370.009 300.446] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -370.009 -300.446] cm +[1 0 0 1 0 0] Tm +0 0 Td +370.009 300.446 Td +/F134_0 9.9626 Tf +(.out) 23.9102 Tj +[1 0 0 1 393.92 300.446] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -393.92 -300.446] cm +[1 0 0 1 0 0] Tm +0 0 Td +396.41 300.446 Td +/F130_0 9.9626 Tf +(appended.) 40.6673 Tj +[1 0 0 1 72 298.29] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -288.327] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 278.529 Td +/F130_0 9.9626 Tf +(As) 11.0684 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(compression,) 52.8516 Tj +-250 TJm +(supplying) 39.3025 Tj +-250 TJm +(no) 9.9626 Tj +-250 TJm +(\002lenames) 38.1866 Tj +-250 TJm +(causes) 26.0024 Tj +-250 TJm +(decompression) 59.7656 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(standard) 33.7533 Tj +-250 TJm +(input) 20.4831 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(standard) 33.7533 Tj +-250 TJm +(output.) 27.9551 Tj +[1 0 0 1 72 276.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -266.409] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 256.611 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 113.843 256.611] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -256.611] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.409 256.611 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-257 TJm +(correctly) 35.4071 Tj +-258 TJm +(decompress) 47.0334 Tj +-257 TJm +(a) 4.42339 Tj +-258 TJm +(\002le) 12.7322 Tj +-257 TJm +(which) 24.3486 Tj +-258 TJm +(is) 6.64505 Tj +-258 TJm +(the) 12.1743 Tj +-257 TJm +(concatenation) 55.3323 Tj +-258 TJm +(of) 8.29885 Tj +-257 TJm +(tw) 9.9626 Tj +10 TJm +(o) 4.9813 Tj +-258 TJm +(or) 8.29885 Tj +-257 TJm +(more) 20.4731 Tj +-258 TJm +(compressed) 47.0334 Tj +-257 TJm +(\002les.) 19.0983 Tj +-665 TJm +(The) 15.4918 Tj +-258 TJm +(result) 22.1369 Tj +-257 TJm +(is) 6.64505 Tj +72 244.656 Td +(the) 12.1743 Tj +-239 TJm +(concatenation) 55.3323 Tj +-238 TJm +(of) 8.29885 Tj +-239 TJm +(the) 12.1743 Tj +-239 TJm +(corresponding) 56.996 Tj +-239 TJm +(uncompressed) 56.996 Tj +-238 TJm +(\002les.) 19.0983 Tj +-613 TJm +(Inte) 15.4918 Tj +15 TJm +(grity) 18.8194 Tj +-238 TJm +(testing) 26.5703 Tj +-239 TJm +(\() 3.31755 Tj +[1 0 0 1 382.247 244.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.247 -244.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +382.247 244.656 Td +/F134_0 9.9626 Tf +(-t) 11.9551 Tj +[1 0 0 1 394.202 244.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -394.202 -244.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +394.202 244.656 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-239 TJm +(of) 8.29885 Tj +-238 TJm +(concatenated) 52.0048 Tj +-239 TJm +(compressed) 47.0334 Tj +-239 TJm +(\002les) 16.6077 Tj +-239 TJm +(is) 6.64505 Tj +72 232.7 Td +(also) 16.0497 Tj +-250 TJm +(supported.) 41.7831 Tj +[1 0 0 1 72 230.544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -220.581] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 210.783 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-399 TJm +(can) 13.8281 Tj +-399 TJm +(also) 16.0497 Tj +-399 TJm +(compress) 37.6287 Tj +-400 TJm +(or) 8.29885 Tj +-399 TJm +(decompress) 47.0334 Tj +-399 TJm +(\002les) 16.6077 Tj +-399 TJm +(to) 7.7509 Tj +-399 TJm +(the) 12.1743 Tj +-399 TJm +(standard) 33.7533 Tj +-399 TJm +(output) 25.4644 Tj +-399 TJm +(by) 9.9626 Tj +-400 TJm +(gi) 7.7509 Tj +25 TJm +(ving) 17.7135 Tj +-399 TJm +(the) 12.1743 Tj +[1 0 0 1 409.67 210.783] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -409.67 -210.783] cm +[1 0 0 1 0 0] Tm +0 0 Td +409.67 210.783 Td +/F134_0 9.9626 Tf +(-c) 11.9551 Tj +[1 0 0 1 421.625 210.783] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -421.625 -210.783] cm +[1 0 0 1 0 0] Tm +0 0 Td +425.602 210.783 Td +/F130_0 9.9626 Tf +(\003ag.) 17.4346 Tj +-757 TJm +(Multiple) 34.3212 Tj +-400 TJm +(\002l) 8.30881 Tj +1 TJm +(es) 8.29885 Tj +-400 TJm +(may) 17.1556 Tj +-399 TJm +(be) 9.40469 Tj +72 198.828 Td +(compressed) 47.0334 Tj +-367 TJm +(and) 14.386 Tj +-367 TJm +(decompressed) 56.4381 Tj +-367 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-367 TJm +(this.) 16.8866 Tj +-1321 TJm +(The) 15.4918 Tj +-367 TJm +(resulting) 34.8691 Tj +-367 TJm +(outputs) 29.3399 Tj +-367 TJm +(are) 12.1643 Tj +-367 TJm +(fed) 12.7222 Tj +-367 TJm +(sequentially) 48.1492 Tj +-366 TJm +(to) 7.7509 Tj +-367 TJm +(stdout.) 26.8492 Tj +-1322 TJm +(Compression) 52.5826 Tj +-367 TJm +(of) 8.29885 Tj +72 186.872 Td +(multiple) 33.2153 Tj +-289 TJm +(\002les) 16.6077 Tj +-289 TJm +(in) 7.7509 Tj +-289 TJm +(this) 14.396 Tj +-289 TJm +(manner) 29.8778 Tj +-288 TJm +(generates) 37.6188 Tj +-289 TJm +(a) 4.42339 Tj +-289 TJm +(stream) 26.5603 Tj +-289 TJm +(containing) 42.0621 Tj +-289 TJm +(multiple) 33.2153 Tj +-289 TJm +(compressed) 47.0334 Tj +-289 TJm +(\002le) 12.7322 Tj +-289 TJm +(representations.) 62.8042 Tj +-853 TJm +(Such) 19.9252 Tj +-289 TJm +(a) 4.42339 Tj +-289 TJm +(stream) 26.5603 Tj +72 174.917 Td +(can) 13.8281 Tj +-391 TJm +(be) 9.40469 Tj +-391 TJm +(decompressed) 56.4381 Tj +-390 TJm +(correctly) 35.4071 Tj +-391 TJm +(only) 17.7135 Tj +-391 TJm +(by) 9.9626 Tj +[1 0 0 1 238.116 174.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -238.116 -174.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +238.116 174.917 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 268.004 174.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -268.004 -174.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +271.897 174.917 Td +/F130_0 9.9626 Tf +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-391 TJm +(0.9.0) 19.9252 Tj +-391 TJm +(or) 8.29885 Tj +-391 TJm +(l) 2.7696 Tj +1 TJm +(ater) 14.9339 Tj +55 TJm +(.) 2.49065 Tj +-733 TJm +(Earlier) 27.1082 Tj +-391 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-391 TJm +(of) 8.29885 Tj +[1 0 0 1 448.071 174.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -448.071 -174.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +448.071 174.917 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 477.958 174.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -477.958 -174.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +481.852 174.917 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-391 TJm +(stop) 16.6077 Tj +-391 TJm +(after) 18.2515 Tj +72 162.962 Td +(decompressing) 59.7656 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002rst) 15.5018 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 160.805] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -150.843] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 141.044 Td +/F134_0 9.9626 Tf +(bzcat) 29.8878 Tj +[1 0 0 1 101.888 141.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -141.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.379 141.044 Td +/F130_0 9.9626 Tf +(\(or) 11.6164 Tj +[1 0 0 1 118.486 141.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -118.486 -141.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +118.486 141.044 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-600 TJm +(-dc) 17.9327 Tj +[1 0 0 1 172.284 141.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -172.284 -141.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.284 141.044 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-250 TJm +(decompresses) 55.3323 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(speci\002ed) 35.417 Tj +-250 TJm +(\002les) 16.6077 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(standard) 33.7533 Tj +-250 TJm +(output.) 27.9551 Tj +[1 0 0 1 72 138.887] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -128.925] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 119.126 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 119.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -119.126] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.866 119.126 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-299 TJm +(read) 17.1456 Tj +-299 TJm +(ar) 7.74094 Tj +18 TJm +(guments) 33.7633 Tj +-299 TJm +(from) 19.3673 Tj +-299 TJm +(the) 12.1743 Tj +-299 TJm +(en) 9.40469 Tj +40 TJm +(vironment) 40.9562 Tj +-298 TJm +(v) 4.9813 Tj +25 TJm +(ariables) 30.9837 Tj +[1 0 0 1 316.903 119.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -316.903 -119.126] cm +[1 0 0 1 0 0] Tm +0 0 Td +316.903 119.126 Td +/F134_0 9.9626 Tf +(BZIP2) 29.8878 Tj +[1 0 0 1 346.791 119.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -346.791 -119.126] cm +[1 0 0 1 0 0] Tm +0 0 Td +349.769 119.126 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 367.133 119.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -367.133 -119.126] cm +[1 0 0 1 0 0] Tm +0 0 Td +367.133 119.126 Td +/F134_0 9.9626 Tf +(BZIP) 23.9102 Tj +[1 0 0 1 391.043 119.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -391.043 -119.126] cm +[1 0 0 1 0 0] Tm +0 0 Td +391.043 119.126 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-299 TJm +(in) 7.7509 Tj +-299 TJm +(that) 14.9439 Tj +-299 TJm +(order) 21.0211 Tj +40 TJm +(,) 2.49065 Tj +-311 TJm +(and) 14.386 Tj +-299 TJm +(will) 15.5018 Tj +-299 TJm +(process) 29.8778 Tj +-299 TJm +(them) 19.9252 Tj +72 107.171 Td +(before) 25.4445 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(ar) 7.74094 Tj +18 TJm +(guments) 33.7633 Tj +-250 TJm +(read) 17.1456 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(command) 39.2925 Tj +-250 TJm +(line.) 17.4346 Tj +-310 TJm +(This) 17.7135 Tj +-250 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(enient) 24.3486 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(supply) 26.5703 Tj +-250 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-250 TJm +(ar) 7.74094 Tj +18 TJm +(guments.) 36.2539 Tj +[1 0 0 1 72 105.014] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -95.0517] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 85.2534 Td +/F130_0 9.9626 Tf +(Compression) 52.5826 Tj +-294 TJm +(is) 6.64505 Tj +-294 TJm +(al) 7.193 Tj +10 TJm +(w) 7.193 Tj +10 TJm +(ays) 13.2801 Tj +-294 TJm +(performed,) 43.9849 Tj +-305 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-294 TJm +(if) 6.08715 Tj +-294 TJm +(the) 12.1743 Tj +-294 TJm +(compressed) 47.0334 Tj +-294 TJm +(\002le) 12.7322 Tj +-293 TJm +(is) 6.64505 Tj +-294 TJm +(slightly) 29.8978 Tj +-294 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +-294 TJm +(than) 17.1556 Tj +-294 TJm +(the) 12.1743 Tj +-294 TJm +(original.) 33.4843 Tj +-884 TJm +(Files) 19.3773 Tj +-294 TJm +(of) 8.29885 Tj +-294 TJm +(less) 14.9439 Tj +-294 TJm +(than) 17.1556 Tj +72 73.2982 Td +(about) 22.1369 Tj +-246 TJm +(one) 14.386 Tj +-246 TJm +(hundred) 32.6474 Tj +-245 TJm +(bytes) 21.031 Tj +-246 TJm +(tend) 17.1556 Tj +-246 TJm +(to) 7.7509 Tj +-246 TJm +(get) 12.1743 Tj +-246 TJm +(l) 2.7696 Tj +1 TJm +(ar) 7.74094 Tj +18 TJm +(ger) 12.7222 Tj +40 TJm +(,) 2.49065 Tj +-247 TJm +(since) 20.4731 Tj +-246 TJm +(the) 12.1743 Tj +-246 TJm +(compression) 50.3609 Tj +-245 TJm +(mechanism) 45.3796 Tj +-246 TJm +(has) 13.2801 Tj +-246 TJm +(a) 4.42339 Tj +-246 TJm +(constant) 33.2053 Tj +-246 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(erhead) 26.5503 Tj +-245 TJm +(in) 7.7509 Tj +-246 TJm +(the) 12.1743 Tj +-246 TJm +(re) 7.74094 Tj +15 TJm +(gion) 17.7135 Tj +-246 TJm +(of) 8.29885 Tj +[1 0 0 1 72 50.8518] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.9514 Td +/F130_0 9.9626 Tf +(3) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 7 7 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 105.519 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -371.59 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.109 749.245 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 266.071 747.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(50) 9.9626 Tj +-264 TJm +(bytes.) 23.5217 Tj +-351 TJm +(Random) 33.7633 Tj +-264 TJm +(dat) 12.1743 Tj +1 TJm +(a) 4.42339 Tj +-264 TJm +(\(including) 40.9562 Tj +-264 TJm +(the) 12.1743 Tj +-264 TJm +(output) 25.4644 Tj +-263 TJm +(of) 8.29885 Tj +-264 TJm +(most) 19.3773 Tj +-264 TJm +(\002le) 12.7322 Tj +-263 TJm +(compressors\)) 53.1206 Tj +-264 TJm +(is) 6.64505 Tj +-264 TJm +(coded) 23.7907 Tj +-263 TJm +(at) 7.193 Tj +-264 TJm +(about) 22.1369 Tj +-264 TJm +(8.05) 17.4346 Tj +-263 TJm +(bits) 14.396 Tj +-264 TJm +(per) 12.7222 Tj +-264 TJm +(byte,) 19.6462 Tj +-267 TJm +(gi) 7.7509 Tj +25 TJm +(ving) 17.7135 Tj +-264 TJm +(an) 9.40469 Tj +72 698.082 Td +(e) 4.42339 Tj +15 TJm +(xpansion) 35.9749 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(around) 27.6661 Tj +-250 TJm +(0.5%.) 23.2427 Tj +[1 0 0 1 72 695.925] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -686.081] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 676.283 Td +/F130_0 9.9626 Tf +(As) 11.0684 Tj +-268 TJm +(a) 4.42339 Tj +-268 TJm +(self-check) 40.9363 Tj +-269 TJm +(for) 11.6164 Tj +-268 TJm +(your) 18.2614 Tj +-268 TJm +(protection,) 42.889 Tj +[1 0 0 1 217.273 676.283] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -217.273 -676.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +217.273 676.283 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 247.161 676.283] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -247.161 -676.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +249.833 676.283 Td +/F130_0 9.9626 Tf +(uses) 17.1556 Tj +-268 TJm +(32-bit) 23.8007 Tj +-268 TJm +(CRCs) 23.8106 Tj +-269 TJm +(to) 7.7509 Tj +-268 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-268 TJm +(sure) 16.5977 Tj +-268 TJm +(that) 14.9439 Tj +-268 TJm +(the) 12.1743 Tj +-269 TJm +(decompressed) 56.4381 Tj +-268 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-268 TJm +(of) 8.29885 Tj +-268 TJm +(a) 4.42339 Tj +-268 TJm +(\002le) 12.7322 Tj +-269 TJm +(is) 6.64505 Tj +72 664.328 Td +(identical) 34.3112 Tj +-200 TJm +(to) 7.7509 Tj +-199 TJm +(the) 12.1743 Tj +-200 TJm +(original.) 33.4843 Tj +-586 TJm +(This) 17.7135 Tj +-200 TJm +(guards) 26.5603 Tj +-199 TJm +(ag) 9.40469 Tj +5 TJm +(ainst) 18.8194 Tj +-200 TJm +(corruption) 41.5042 Tj +-199 TJm +(of) 8.29885 Tj +-200 TJm +(the) 12.1743 Tj +-200 TJm +(compressed) 47.0334 Tj +-199 TJm +(data,) 19.0883 Tj +-210 TJm +(and) 14.386 Tj +-199 TJm +(ag) 9.40469 Tj +5 TJm +(ainst) 18.8194 Tj +-200 TJm +(undetected) 43.158 Tj +-200 TJm +(b) 4.9813 Tj +20 TJm +(ugs) 13.8381 Tj +-199 TJm +(in) 7.7509 Tj +[1 0 0 1 510.112 664.328] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -510.112 -664.328] cm +[1 0 0 1 0 0] Tm +0 0 Td +510.112 664.328 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 540 664.328] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -664.328] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 652.373 Td +/F130_0 9.9626 Tf +(\(hopefully) 41.5042 Tj +-275 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-274 TJm +(unlik) 20.4831 Tj +10 TJm +(ely\).) 17.9825 Tj +-384 TJm +(The) 15.4918 Tj +-275 TJm +(chances) 31.5316 Tj +-275 TJm +(of) 8.29885 Tj +-275 TJm +(data) 16.5977 Tj +-274 TJm +(corruption) 41.5042 Tj +-275 TJm +(going) 22.6948 Tj +-275 TJm +(undetected) 43.158 Tj +-274 TJm +(is) 6.64505 Tj +-275 TJm +(microscopic,) 51.1878 Tj +-281 TJm +(about) 22.1369 Tj +-275 TJm +(one) 14.386 Tj +-274 TJm +(chance) 27.6562 Tj +-275 TJm +(in) 7.7509 Tj +-275 TJm +(four) 16.5977 Tj +72 640.417 Td +(billion) 26.0223 Tj +-279 TJm +(for) 11.6164 Tj +-279 TJm +(each) 18.2515 Tj +-279 TJm +(\002le) 12.7322 Tj +-280 TJm +(processed.) 41.7732 Tj +-795 TJm +(Be) 11.0684 Tj +-279 TJm +(a) 4.42339 Tj +15 TJm +(w) 7.193 Tj +10 TJm +(are,) 14.655 Tj +-286 TJm +(though,) 30.1668 Tj +-287 TJm +(that) 14.9439 Tj +-279 TJm +(the) 12.1743 Tj +-279 TJm +(check) 23.2328 Tj +-279 TJm +(occurs) 26.0024 Tj +-279 TJm +(upon) 19.9252 Tj +-279 TJm +(decompression,) 62.2563 Tj +-287 TJm +(so) 8.85675 Tj +-279 TJm +(it) 5.53921 Tj +-279 TJm +(can) 13.8281 Tj +-279 TJm +(only) 17.7135 Tj +-280 TJm +(tell) 12.7322 Tj +-279 TJm +(you) 14.9439 Tj +72 628.462 Td +(that) 14.9439 Tj +-237 TJm +(something) 41.5142 Tj +-236 TJm +(is) 6.64505 Tj +-237 TJm +(wrong.) 27.9451 Tj +-611 TJm +(It) 6.08715 Tj +-237 TJm +(can') 17.1456 Tj +18 TJm +(t) 2.7696 Tj +-237 TJm +(help) 17.1556 Tj +-237 TJm +(you) 14.9439 Tj +-236 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-237 TJm +(the) 12.1743 Tj +-237 TJm +(original) 30.9936 Tj +-237 TJm +(uncompressed) 56.996 Tj +-236 TJm +(data.) 19.0883 Tj +-612 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-236 TJm +(can) 13.8281 Tj +-237 TJm +(use) 13.2801 Tj +[1 0 0 1 458.159 628.462] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -458.159 -628.462] cm +[1 0 0 1 0 0] Tm +0 0 Td +458.159 628.462 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 529.89 628.462] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -529.89 -628.462] cm +[1 0 0 1 0 0] Tm +0 0 Td +532.249 628.462 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +72 616.507 Td +(try) 11.0684 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(damaged) 35.965 Tj +-250 TJm +(\002les.) 19.0983 Tj +[1 0 0 1 72 614.35] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -604.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 594.708 Td +/F130_0 9.9626 Tf +(Return) 27.1182 Tj +-298 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +-406 TJm +(0) 4.9813 Tj +-298 TJm +(for) 11.6164 Tj +-298 TJm +(a) 4.42339 Tj +-298 TJm +(normal) 28.224 Tj +-298 TJm +(e) 4.42339 Tj +15 TJm +(xit,) 13.0112 Tj +-310 TJm +(1) 4.9813 Tj +-298 TJm +(for) 11.6164 Tj +-297 TJm +(en) 9.40469 Tj +40 TJm +(vironmental) 48.1492 Tj +-298 TJm +(problems) 37.0808 Tj +-298 TJm +(\(\002le) 16.0497 Tj +-298 TJm +(not) 12.7322 Tj +-298 TJm +(found,) 25.7334 Tj +-310 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +25 TJm +(alid) 14.9439 Tj +-298 TJm +(\003ags,) 21.31 Tj +-310 TJm +(I/O) 13.2801 Tj +-298 TJm +(errors,) 25.7234 Tj +-310 TJm +(etc.\),) 19.9152 Tj +-310 TJm +(2) 4.9813 Tj +-298 TJm +(to) 7.7509 Tj +72 582.753 Td +(indicate) 31.5416 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(corrupt) 28.772 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le,) 15.2229 Tj +-250 TJm +(3) 4.9813 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(internal) 30.4357 Tj +-250 TJm +(consistenc) 41.5042 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(\(e) 7.74094 Tj +15 TJm +(g,) 7.47195 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ug\)) 13.2801 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(caused) 27.1082 Tj +[1 0 0 1 443.065 582.753] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -443.065 -582.753] cm +[1 0 0 1 0 0] Tm +0 0 Td +443.065 582.753 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 472.953 582.753] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.953 -582.753] cm +[1 0 0 1 0 0] Tm +0 0 Td +475.444 582.753 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(panic.) 24.0696 Tj +[1 0 0 1 72 580.596] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -570.752] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 548.118 Td +/F122_0 20.6585 Tf +(2.4.) 34.4584 Tj +-278 TJm +(OPTIONS) 92.9839 Tj +[1 0 0 1 72 547.86] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -528.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 516.475 Td +/F134_0 9.9626 Tf +(-c) 11.9551 Tj +-600 TJm +(--stdout) 47.8205 Tj +[1 0 0 1 137.753 516.475] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -68.2441 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -516.32] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 504.52 Td +/F130_0 9.9626 Tf +(Compress) 39.8504 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(decompress) 47.0334 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(standard) 33.7533 Tj +-250 TJm +(output.) 27.9551 Tj +[1 0 0 1 72 502.363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -488.652] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 478.854 Td +/F134_0 9.9626 Tf +(-d) 11.9551 Tj +-600 TJm +(--decompress) 71.7307 Tj +[1 0 0 1 161.664 478.854] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -92.1544 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -477.32] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 466.899 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(orce) 17.1456 Tj +-296 TJm +(decompression.) 62.2563 Tj +[1 0 0 1 200.214 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -200.214 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +200.214 466.899 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 230.102 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -230.102 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.102 466.899 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 235.659 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -235.659 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +235.659 466.899 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 277.502 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -277.502 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +280.454 466.899 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 297.791 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -297.791 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +297.791 466.899 Td +/F134_0 9.9626 Tf +(bzcat) 29.8878 Tj +[1 0 0 1 327.679 466.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -327.679 -466.899] cm +[1 0 0 1 0 0] Tm +0 0 Td +330.631 466.899 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-296 TJm +(really) 22.6848 Tj +-296 TJm +(the) 12.1743 Tj +-297 TJm +(same) 20.4731 Tj +-296 TJm +(program,) 36.2439 Tj +-308 TJm +(and) 14.386 Tj +-296 TJm +(the) 12.1743 Tj +-296 TJm +(decision) 33.2053 Tj +-297 TJm +(about) 22.1369 Tj +108 454.944 Td +(what) 19.3673 Tj +-303 TJm +(actions) 28.224 Tj +-303 TJm +(to) 7.7509 Tj +-303 TJm +(tak) 12.1743 Tj +10 TJm +(e) 4.42339 Tj +-303 TJm +(is) 6.64505 Tj +-303 TJm +(done) 19.3673 Tj +-303 TJm +(on) 9.9626 Tj +-304 TJm +(the) 12.1743 Tj +-303 TJm +(basis) 19.9252 Tj +-303 TJm +(of) 8.29885 Tj +-303 TJm +(which) 24.3486 Tj +-303 TJm +(name) 21.579 Tj +-303 TJm +(is) 6.64505 Tj +-303 TJm +(used.) 20.7521 Tj +-939 TJm +(This) 17.7135 Tj +-303 TJm +(\003ag) 14.9439 Tj +-303 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(errides) 27.1082 Tj +-303 TJm +(that) 14.9439 Tj +-303 TJm +(mechanism,) 47.8703 Tj +-316 TJm +(and) 14.386 Tj +108 442.988 Td +(forces) 24.3386 Tj +-250 TJm +(bzip2) 22.1369 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(decompress.) 49.5241 Tj +[1 0 0 1 72 440.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -427.121] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 417.323 Td +/F134_0 9.9626 Tf +(-z) 11.9551 Tj +-600 TJm +(--compress) 59.7756 Tj +[1 0 0 1 149.709 417.323] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -80.1993 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -415.789] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 405.368 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(complement) 49.2551 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 187.969 405.368] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -187.969 -405.368] cm +[1 0 0 1 0 0] Tm +0 0 Td +187.969 405.368 Td +/F134_0 9.9626 Tf +(-d) 11.9551 Tj +[1 0 0 1 199.924 405.368] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -199.924 -405.368] cm +[1 0 0 1 0 0] Tm +0 0 Td +199.924 405.368 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +-310 TJm +(forces) 24.3386 Tj +-250 TJm +(compression,) 52.8516 Tj +-250 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(ardless) 27.6661 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +20 TJm +(okation) 29.8878 Tj +-250 TJm +(name.) 24.0696 Tj +[1 0 0 1 72 403.211] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -389.5] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 379.702 Td +/F134_0 9.9626 Tf +(-t) 11.9551 Tj +-600 TJm +(--test) 35.8654 Tj +[1 0 0 1 125.798 379.702] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -56.2889 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -379.548] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 367.747 Td +/F130_0 9.9626 Tf +(Check) 25.4544 Tj +-270 TJm +(inte) 14.9439 Tj +15 TJm +(grity) 18.8194 Tj +-271 TJm +(of) 8.29885 Tj +-270 TJm +(the) 12.1743 Tj +-271 TJm +(speci\002ed) 35.417 Tj +-270 TJm +(\002le\(s\),) 25.7334 Tj +-276 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-270 TJm +(don') 18.2614 Tj +18 TJm +(t) 2.7696 Tj +-270 TJm +(decompress) 47.0334 Tj +-271 TJm +(them.) 22.4159 Tj +-742 TJm +(This) 17.7135 Tj +-271 TJm +(really) 22.6848 Tj +-270 TJm +(performs) 35.965 Tj +-270 TJm +(a) 4.42339 Tj +-271 TJm +(trial) 16.0497 Tj +-270 TJm +(decompres-) 46.4755 Tj +108 355.791 Td +(sion) 16.6077 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(thro) 16.0497 Tj +25 TJm +(ws) 11.0684 Tj +-250 TJm +(a) 4.42339 Tj +15 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(result.) 24.6275 Tj +[1 0 0 1 72 353.635] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -339.924] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 330.126 Td +/F134_0 9.9626 Tf +(-f) 11.9551 Tj +-600 TJm +(--force) 41.8429 Tj +[1 0 0 1 131.776 330.126] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -62.2665 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -329.971] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 318.171 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(orce) 17.1456 Tj +-338 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(erwrite) 28.2141 Tj +-339 TJm +(of) 8.29885 Tj +-338 TJm +(output) 25.4644 Tj +-338 TJm +(\002les.) 19.0983 Tj +-1150 TJm +(Normally) 38.1866 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 289.831 318.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -289.831 -318.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.831 318.171 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 319.719 318.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -319.719 -318.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +323.089 318.171 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-338 TJm +(not) 12.7322 Tj +-339 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(erwrite) 28.2141 Tj +-338 TJm +(e) 4.42339 Tj +15 TJm +(xisting) 27.1282 Tj +-338 TJm +(output) 25.4644 Tj +-338 TJm +(\002les.) 19.0983 Tj +-1150 TJm +(Also) 18.8194 Tj +-339 TJm +(forces) 24.3386 Tj +[1 0 0 1 108 306.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -108 -306.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 306.215 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 137.888 306.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.888 -306.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +140.379 306.215 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(break) 22.1269 Tj +-250 TJm +(hard) 17.7035 Tj +-250 TJm +(links) 19.3773 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(\002les,) 19.0983 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(otherwise) 38.7346 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ouldn') 26.0123 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(do.) 12.4533 Tj +[1 0 0 1 72 304.681] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -294.837] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 284.416 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 137.888 284.416] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.888 -284.416] cm +[1 0 0 1 0 0] Tm +0 0 Td +141.211 284.416 Td +/F130_0 9.9626 Tf +(normally) 35.9749 Tj +-334 TJm +(declines) 32.6474 Tj +-333 TJm +(to) 7.7509 Tj +-334 TJm +(decompress) 47.0334 Tj +-333 TJm +(\002les) 16.6077 Tj +-334 TJm +(which) 24.3486 Tj +-333 TJm +(don') 18.2614 Tj +18 TJm +(t) 2.7696 Tj +-334 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-333 TJm +(the) 12.1743 Tj +-334 TJm +(correct) 27.6562 Tj +-333 TJm +(magic) 24.3486 Tj +-334 TJm +(header) 26.5503 Tj +-333 TJm +(bytes.) 23.5217 Tj +-561 TJm +(If) 6.63509 Tj +-334 TJm +(forced) 25.4445 Tj +108 272.461 Td +(\() 3.31755 Tj +[1 0 0 1 111.318 272.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -111.318 -272.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +111.318 272.461 Td +/F134_0 9.9626 Tf +(-f) 11.9551 Tj +[1 0 0 1 123.273 272.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -123.273 -272.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +123.273 272.461 Td +/F130_0 9.9626 Tf +(\),) 5.8082 Tj +-250 TJm +(ho) 9.9626 Tj +25 TJm +(we) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +40 TJm +(,) 2.49065 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(pass) 17.1556 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(\002les) 16.6077 Tj +-250 TJm +(through) 30.9936 Tj +-250 TJm +(unmodi\002ed.) 47.8803 Tj +-310 TJm +(This) 17.7135 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(GNU) 21.579 Tj +[1 0 0 1 412.585 272.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -412.585 -272.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +412.585 272.461 Td +/F134_0 9.9626 Tf +(gzip) 23.9102 Tj +[1 0 0 1 436.496 272.461] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -436.496 -272.461] cm +[1 0 0 1 0 0] Tm +0 0 Td +438.986 272.461 Td +/F130_0 9.9626 Tf +(beha) 18.8094 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(es.) 10.7895 Tj +[1 0 0 1 72 270.304] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -256.594] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 246.795 Td +/F134_0 9.9626 Tf +(-k) 11.9551 Tj +-600 TJm +(--keep) 35.8654 Tj +[1 0 0 1 125.798 246.795] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -56.2889 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -245.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 234.84 Td +/F130_0 9.9626 Tf +(K) 7.193 Tj +25 TJm +(eep) 13.8281 Tj +-250 TJm +(\(don') 21.579 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(delete\)) 27.1082 Tj +-250 TJm +(input) 20.4831 Tj +-250 TJm +(\002les) 16.6077 Tj +-250 TJm +(during) 26.0123 Tj +-250 TJm +(compression) 50.3609 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(decompression.) 62.2563 Tj +[1 0 0 1 72 232.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -218.973] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 209.174 Td +/F134_0 9.9626 Tf +(-s) 11.9551 Tj +-600 TJm +(--small) 41.8429 Tj +[1 0 0 1 131.776 209.174] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -62.2665 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -209.02] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 197.219 Td +/F130_0 9.9626 Tf +(Reduce) 29.8778 Tj +-347 TJm +(memory) 33.2053 Tj +-347 TJm +(usage,) 25.1755 Tj +-371 TJm +(for) 11.6164 Tj +-346 TJm +(compression,) 52.8516 Tj +-371 TJm +(decompression) 59.7656 Tj +-347 TJm +(and) 14.386 Tj +-347 TJm +(testing.) 29.0609 Tj +-1201 TJm +(Files) 19.3773 Tj +-347 TJm +(are) 12.1643 Tj +-347 TJm +(decompressed) 56.4381 Tj +-346 TJm +(and) 14.386 Tj +-347 TJm +(tested) 23.2427 Tj +108 185.264 Td +(using) 21.589 Tj +-388 TJm +(a) 4.42339 Tj +-388 TJm +(modi\002ed) 35.427 Tj +-388 TJm +(algorithm) 38.7446 Tj +-389 TJm +(which) 24.3486 Tj +-388 TJm +(only) 17.7135 Tj +-388 TJm +(requires) 32.0895 Tj +-388 TJm +(2.5) 12.4533 Tj +-388 TJm +(bytes) 21.031 Tj +-388 TJm +(per) 12.7222 Tj +-388 TJm +(block) 22.1369 Tj +-389 TJm +(byte.) 19.6462 Tj +-1448 TJm +(This) 17.7135 Tj +-389 TJm +(means) 25.4544 Tj +-388 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-388 TJm +(\002le) 12.7322 Tj +-388 TJm +(can) 13.8281 Tj +-388 TJm +(be) 9.40469 Tj +108 173.309 Td +(decompressed) 56.4381 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(2300k) 24.9065 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(memory) 33.2053 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(albeit) 22.1369 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(about) 22.1369 Tj +-250 TJm +(half) 15.4918 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(normal) 28.224 Tj +-250 TJm +(speed.) 25.1755 Tj +[1 0 0 1 72 171.152] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -161.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 151.51 Td +/F130_0 9.9626 Tf +(During) 28.224 Tj +-252 TJm +(compr) 25.4544 Tj +1 TJm +(ession,) 27.3972 Tj +[1 0 0 1 194.09 151.51] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -194.09 -151.51] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.09 151.51 Td +/F134_0 9.9626 Tf +(-s) 11.9551 Tj +[1 0 0 1 206.046 151.51] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -206.046 -151.51] cm +[1 0 0 1 0 0] Tm +0 0 Td +208.551 151.51 Td +/F130_0 9.9626 Tf +(selects) 26.5603 Tj +-251 TJm +(a) 4.42339 Tj +-252 TJm +(block) 22.1369 Tj +-251 TJm +(size) 15.4918 Tj +-252 TJm +(of) 8.29885 Tj +-252 TJm +(200k,) 22.4159 Tj +-251 TJm +(which) 24.3486 Tj +-252 TJm +(limits) 22.7048 Tj +-251 TJm +(memory) 33.2053 Tj +-252 TJm +(use) 13.2801 Tj +-251 TJm +(to) 7.7509 Tj +-252 TJm +(around) 27.6661 Tj +-251 TJm +(the) 12.1743 Tj +-252 TJm +(same) 20.4731 Tj +-251 TJm +(\002gure,) 25.7334 Tj +-252 TJm +(at) 7.193 Tj +108 139.554 Td +(the) 12.1743 Tj +-287 TJm +(e) 4.42339 Tj +15 TJm +(xpense) 27.6661 Tj +-287 TJm +(of) 8.29885 Tj +-288 TJm +(your) 18.2614 Tj +-287 TJm +(compression) 50.3609 Tj +-287 TJm +(ratio.) 20.7521 Tj +-843 TJm +(In) 8.29885 Tj +-287 TJm +(short,) 22.4159 Tj +-297 TJm +(if) 6.08715 Tj +-287 TJm +(your) 18.2614 Tj +-287 TJm +(machine) 33.7533 Tj +-287 TJm +(is) 6.64505 Tj +-287 TJm +(lo) 7.7509 Tj +25 TJm +(w) 7.193 Tj +-287 TJm +(on) 9.9626 Tj +-288 TJm +(memory) 33.2053 Tj +-287 TJm +(\(8) 8.29885 Tj +-287 TJm +(me) 12.1743 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(abytes) 25.4544 Tj +-287 TJm +(or) 8.29885 Tj +-287 TJm +(less\),) 20.7521 Tj +108 127.599 Td +(use) 13.2801 Tj +[1 0 0 1 123.771 127.599] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -123.771 -127.599] cm +[1 0 0 1 0 0] Tm +0 0 Td +123.771 127.599 Td +/F134_0 9.9626 Tf +(-s) 11.9551 Tj +[1 0 0 1 135.726 127.599] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -135.726 -127.599] cm +[1 0 0 1 0 0] Tm +0 0 Td +138.216 127.599 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-250 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(erything.) 35.696 Tj +-620 TJm +(See) 14.386 Tj +[1 0 0 1 220.079 127.599] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -220.079 -127.599] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.079 127.599 Td +/F130_0 9.9626 Tf +(MEMOR) 37.6387 Tj +65 TJm +(Y) 7.193 Tj +-250 TJm +(MAN) 23.2427 Tj +35 TJm +(A) 7.193 Tj +40 TJm +(GEMENT) 41.5042 Tj +[1 0 0 1 337.946 127.599] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -337.946 -127.599] cm +[1 0 0 1 0 0] Tm +0 0 Td +340.437 127.599 Td +/F130_0 9.9626 Tf +([5]) 11.6164 Tj +[1 0 0 1 352.053 127.599] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -352.053 -127.599] cm +[1 0 0 1 0 0] Tm +0 0 Td +354.544 127.599 Td +/F130_0 9.9626 Tf +(belo) 17.1556 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 125.443] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -111.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 101.934 Td +/F134_0 9.9626 Tf +(-q) 11.9551 Tj +-600 TJm +(--quiet) 41.8429 Tj +[1 0 0 1 131.776 101.934] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -62.2665 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -100.399] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 89.9784 Td +/F130_0 9.9626 Tf +(Suppress) 35.9749 Tj +-221 TJm +(non-essential) 52.5726 Tj +-220 TJm +(w) 7.193 Tj +10 TJm +(arning) 25.4544 Tj +-221 TJm +(messages.) 40.1194 Tj +-300 TJm +(Messages) 38.7346 Tj +-221 TJm +(pertaining) 40.3983 Tj +-221 TJm +(to) 7.7509 Tj +-220 TJm +(I/O) 13.2801 Tj +-221 TJm +(errors) 23.2328 Tj +-221 TJm +(and) 14.386 Tj +-220 TJm +(other) 20.4731 Tj +-221 TJm +(critical) 27.6661 Tj +-221 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ents) 16.0497 Tj +-221 TJm +(wi) 9.9626 Tj +1 TJm +(ll) 5.53921 Tj +-221 TJm +(not) 12.7322 Tj +108 78.0232 Td +(be) 9.40469 Tj +-250 TJm +(suppressed.) 46.2065 Tj +[1 0 0 1 72 75.8664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.8664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.1482] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.8518 Td +/F130_0 9.9626 Tf +(4) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 8 8 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 105.519 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -371.59 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.109 749.245 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 266.071 747.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F134_0 9.9626 Tf +(-v) 11.9551 Tj +-600 TJm +(--verbose) 53.798 Tj +[1 0 0 1 143.731 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -74.2217 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -709.883] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 698.082 Td +/F130_0 9.9626 Tf +(V) 7.193 Tj +111 TJm +(erbose) 26.0024 Tj +-323 TJm +(mode) 22.1369 Tj +-322 TJm +(--) 6.63509 Tj +-323 TJm +(sho) 13.8381 Tj +25 TJm +(w) 7.193 Tj +-322 TJm +(the) 12.1743 Tj +-323 TJm +(compression) 50.3609 Tj +-323 TJm +(ratio) 18.2614 Tj +-322 TJm +(for) 11.6164 Tj +-323 TJm +(each) 18.2515 Tj +-322 TJm +(\002le) 12.7322 Tj +-323 TJm +(processed.) 41.7732 Tj +-1056 TJm +(Further) 29.3299 Tj +[1 0 0 1 430.015 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -430.015 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +430.015 698.082 Td +/F134_0 9.9626 Tf +(-v) 11.9551 Tj +[1 0 0 1 441.97 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -441.97 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +441.97 698.082 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +55 TJm +(s) 3.87545 Tj +-323 TJm +(increase) 32.6375 Tj +-322 TJm +(the) 12.1743 Tj +-323 TJm +(v) 4.9813 Tj +15 TJm +(erbosity) 32.0995 Tj +108 686.127 Td +(le) 7.193 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el,) 9.68365 Tj +-250 TJm +(spe) 13.2801 Tj +25 TJm +(wing) 19.9252 Tj +-250 TJm +(out) 12.7322 Tj +-250 TJm +(lots) 14.396 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(information) 47.0434 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(primarily) 37.0808 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(interest) 29.3299 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(diagnostic) 40.9562 Tj +-250 TJm +(purposes.) 37.9077 Tj +[1 0 0 1 72 683.97] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -670.023] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 660.224 Td +/F134_0 9.9626 Tf +(-L) 11.9551 Tj +-600 TJm +(--license) 53.798 Tj +-600 TJm +(-V) 11.9551 Tj +-600 TJm +(--version) 53.798 Tj +[1 0 0 1 221.44 660.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -151.93 -0.1544] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -660.07] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 648.269 Td +/F130_0 9.9626 Tf +(Display) 30.9936 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(softw) 22.1369 Tj +10 TJm +(are) 12.1643 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ersion,) 26.8392 Tj +-250 TJm +(license) 27.6661 Tj +-250 TJm +(terms) 22.1369 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(conditions.) 44.0048 Tj +[1 0 0 1 72 646.112] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -632.165] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 622.366 Td +/F134_0 9.9626 Tf +(-1) 11.9551 Tj +[1 0 0 1 83.9552 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.9552 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.4458 622.366 Td +/F130_0 9.9626 Tf +(\(or) 11.6164 Tj +[1 0 0 1 100.553 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -100.553 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +100.553 622.366 Td +/F134_0 9.9626 Tf +(--fast) 35.8654 Tj +[1 0 0 1 136.418 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -136.418 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +136.418 622.366 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 152.468 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -152.468 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +152.468 622.366 Td +/F134_0 9.9626 Tf +(-9) 11.9551 Tj +[1 0 0 1 164.423 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.423 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.914 622.366 Td +/F130_0 9.9626 Tf +(\(or) 11.6164 Tj +[1 0 0 1 181.021 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -181.021 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.021 622.366 Td +/F134_0 9.9626 Tf +(-best) 29.8878 Tj +[1 0 0 1 210.909 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.909 -622.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.909 622.366 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +[1 0 0 1 214.226 622.366] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -142.226 -1.7832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -620.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 610.411 Td +/F130_0 9.9626 Tf +(Set) 12.7322 Tj +-288 TJm +(the) 12.1743 Tj +-289 TJm +(block) 22.1369 Tj +-288 TJm +(size) 15.4918 Tj +-288 TJm +(to) 7.7509 Tj +-288 TJm +(100) 14.9439 Tj +-289 TJm +(k,) 7.47195 Tj +-298 TJm +(200) 14.9439 Tj +-288 TJm +(k) 4.9813 Tj +-288 TJm +(...) 7.47195 Tj +-850 TJm +(900) 14.9439 Tj +-288 TJm +(k) 4.9813 Tj +-288 TJm +(when) 21.579 Tj +-289 TJm +(compressing.) 52.8516 Tj +-849 TJm +(Has) 15.4918 Tj +-289 TJm +(no) 9.9626 Tj +-288 TJm +(ef) 7.74094 Tj +25 TJm +(fect) 14.9339 Tj +-288 TJm +(when) 21.579 Tj +-288 TJm +(decompressing.) 62.2563 Tj +-850 TJm +(See) 14.386 Tj +[1 0 0 1 108 598.456] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -108 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 598.456 Td +/F130_0 9.9626 Tf +(MEMOR) 37.6387 Tj +65 TJm +(Y) 7.193 Tj +-297 TJm +(MAN) 23.2427 Tj +35 TJm +(A) 7.193 Tj +40 TJm +(GEMENT) 41.5042 Tj +[1 0 0 1 226.338 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -226.338 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +229.3 598.456 Td +/F130_0 9.9626 Tf +([5]) 11.6164 Tj +[1 0 0 1 240.916 598.456] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.916 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +243.878 598.456 Td +/F130_0 9.9626 Tf +(belo) 17.1556 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(.) 2.49065 Tj +-904 TJm +(The) 15.4918 Tj +[1 0 0 1 297.278 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -297.278 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +297.278 598.456 Td +/F134_0 9.9626 Tf +(--fast) 35.8654 Tj +[1 0 0 1 333.144 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -333.144 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +336.106 598.456 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 353.454 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -353.454 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +353.454 598.456 Td +/F134_0 9.9626 Tf +(--best) 35.8654 Tj +[1 0 0 1 389.319 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -389.319 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.281 598.456 Td +/F130_0 9.9626 Tf +(aliases) 26.5603 Tj +-297 TJm +(are) 12.1643 Tj +-298 TJm +(primarily) 37.0808 Tj +-297 TJm +(for) 11.6164 Tj +-297 TJm +(GNU) 21.579 Tj +[1 0 0 1 516.09 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -516.09 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +516.09 598.456 Td +/F134_0 9.9626 Tf +(gzip) 23.9102 Tj +[1 0 0 1 540 598.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -598.456] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 586.501 Td +/F130_0 9.9626 Tf +(compatibility) 53.1405 Tj +65 TJm +(.) 2.49065 Tj +-356 TJm +(In) 8.29885 Tj +-265 TJm +(particular) 38.1767 Tj +40 TJm +(,) 2.49065 Tj +[1 0 0 1 220.423 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -220.423 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.423 586.501 Td +/F134_0 9.9626 Tf +(--fast) 35.8654 Tj +[1 0 0 1 256.288 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -256.288 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +258.932 586.501 Td +/F130_0 9.9626 Tf +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-265 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-266 TJm +(things) 24.3586 Tj +-265 TJm +(signi\002cantly) 49.2651 Tj +-265 TJm +(f) 3.31755 Tj +10 TJm +(aster) 18.8094 Tj +55 TJm +(.) 2.49065 Tj +-712 TJm +(And) 17.1556 Tj +[1 0 0 1 444.622 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.622 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +444.622 586.501 Td +/F134_0 9.9626 Tf +(--best) 35.8654 Tj +[1 0 0 1 480.487 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -480.487 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +483.131 586.501 Td +/F130_0 9.9626 Tf +(merely) 27.6661 Tj +-265 TJm +(selects) 26.5603 Tj +108 574.546 Td +(the) 12.1743 Tj +-250 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-250 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 574.446] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -560.498] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 548.643 Td +/F134_0 9.9626 Tf +(--) 11.9551 Tj +[1 0 0 1 83.9552 548.643] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -14.4458 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -548.643] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 536.688 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +35 TJm +(reats) 18.8094 Tj +-261 TJm +(all) 9.9626 Tj +-261 TJm +(subsequent) 44.2738 Tj +-260 TJm +(ar) 7.74094 Tj +18 TJm +(guments) 33.7633 Tj +-261 TJm +(as) 8.29885 Tj +-261 TJm +(\002le) 12.7322 Tj +-261 TJm +(names,) 27.9451 Tj +-263 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-261 TJm +(if) 6.08715 Tj +-261 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-260 TJm +(start) 17.1556 Tj +-261 TJm +(with) 17.7135 Tj +-261 TJm +(a) 4.42339 Tj +-261 TJm +(dash.) 20.7521 Tj +-685 TJm +(This) 17.7135 Tj +-260 TJm +(is) 6.64505 Tj +-261 TJm +(so) 8.85675 Tj +-261 TJm +(you) 14.9439 Tj +-261 TJm +(can) 13.8281 Tj +-260 TJm +(handle) 26.5603 Tj +-261 TJm +(\002les) 16.6077 Tj +108 524.732 Td +(with) 17.7135 Tj +-250 TJm +(names) 25.4544 Tj +-250 TJm +(be) 9.40469 Tj +15 TJm +(ginning) 30.4457 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(dash,) 20.7521 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xample:) 32.0995 Tj +[1 0 0 1 302.27 524.732] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -302.27 -524.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +302.27 524.732 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-600 TJm +(--) 11.9551 Tj +-600 TJm +(-myfilename) 65.7532 Tj +[1 0 0 1 421.821 524.732] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -421.821 -524.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +421.821 524.732 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 522.576] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -508.628] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 498.83 Td +/F134_0 9.9626 Tf +(--repetitive-fast) 101.619 Tj +[1 0 0 1 173.619 498.83] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -173.619 -498.83] cm +[1 0 0 1 0 0] Tm +0 0 Td +173.619 498.83 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 178.6 498.83] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.582 -498.83] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.582 498.83 Td +/F134_0 9.9626 Tf +(--repetitive-best) 101.619 Tj +[1 0 0 1 285.2 498.83] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -215.691 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -497.295] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 486.874 Td +/F130_0 9.9626 Tf +(These) 23.7907 Tj +-207 TJm +(\003ags) 18.8194 Tj +-206 TJm +(are) 12.1643 Tj +-207 TJm +(redundant) 39.8404 Tj +-207 TJm +(in) 7.7509 Tj +-206 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-207 TJm +(0.9.5) 19.9252 Tj +-207 TJm +(and) 14.386 Tj +-206 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e.) 6.91404 Tj +-591 TJm +(The) 15.4918 Tj +15 TJm +(y) 4.9813 Tj +-207 TJm +(pro) 13.2801 Tj +15 TJm +(vided) 22.1369 Tj +-207 TJm +(some) 21.031 Tj +-207 TJm +(c) 4.42339 Tj +1 TJm +(o) 4.9813 Tj +-1 TJm +(a) 4.42339 Tj +1 TJm +(rse) 11.6164 Tj +-207 TJm +(control) 28.224 Tj +-207 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-207 TJm +(the) 12.1743 Tj +-206 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +108 474.919 Td +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-251 TJm +(sorting) 27.6761 Tj +-250 TJm +(algorithm) 38.7446 Tj +-250 TJm +(in) 7.7509 Tj +-251 TJm +(earlier) 25.4445 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ersions,) 30.7147 Tj +-250 TJm +(which) 24.3486 Tj +-251 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(sometimes) 42.62 Tj +-250 TJm +(useful.) 26.8392 Tj +-622 TJm +(0.9.5) 19.9252 Tj +-251 TJm +(and) 14.386 Tj +-250 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-251 TJm +(an) 9.40469 Tj +-250 TJm +(impro) 23.8007 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ed) 9.40469 Tj +108 462.964 Td +(algorithm) 38.7446 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(renders) 29.3199 Tj +-250 TJm +(these) 20.4731 Tj +-250 TJm +(\003ags) 18.8194 Tj +-250 TJm +(irrele) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant.) 14.6649 Tj +[1 0 0 1 72 460.807] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -436.897] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 414.264 Td +/F122_0 20.6585 Tf +(2.5.) 34.4584 Tj +-278 TJm +(MEMOR) 79.184 Tj +50 TJm +(Y) 13.7792 Tj +-278 TJm +(MANA) 61.9548 Tj +50 TJm +(GEMENT) 88.3771 Tj +[1 0 0 1 72 414.005] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -404.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 392.346 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 392.346] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -392.346] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.454 392.346 Td +/F130_0 9.9626 Tf +(compresses) 45.9276 Tj +-258 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-257 TJm +(\002les) 16.6077 Tj +-258 TJm +(in) 7.7509 Tj +-257 TJm +(blocks.) 28.503 Tj +-666 TJm +(The) 15.4918 Tj +-257 TJm +(block) 22.1369 Tj +-258 TJm +(size) 15.4918 Tj +-258 TJm +(af) 7.74094 Tj +25 TJm +(fects) 18.8094 Tj +-257 TJm +(both) 17.7135 Tj +-258 TJm +(the) 12.1743 Tj +-257 TJm +(compression) 50.3609 Tj +-258 TJm +(ratio) 18.2614 Tj +-257 TJm +(achie) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ed,) 11.8953 Tj +-260 TJm +(and) 14.386 Tj +-258 TJm +(the) 12.1743 Tj +-257 TJm +(amount) 29.8878 Tj +72 380.391 Td +(of) 8.29885 Tj +-215 TJm +(memory) 33.2053 Tj +-215 TJm +(needed) 28.2141 Tj +-215 TJm +(for) 11.6164 Tj +-215 TJm +(compression) 50.3609 Tj +-214 TJm +(and) 14.386 Tj +-215 TJm +(decompression.) 62.2563 Tj +-597 TJm +(The) 15.4918 Tj +-215 TJm +(\003ags) 18.8194 Tj +[1 0 0 1 337.719 380.391] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -337.719 -380.391] cm +[1 0 0 1 0 0] Tm +0 0 Td +337.719 380.391 Td +/F134_0 9.9626 Tf +(-1) 11.9551 Tj +[1 0 0 1 349.674 380.391] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -349.674 -380.391] cm +[1 0 0 1 0 0] Tm +0 0 Td +351.815 380.391 Td +/F130_0 9.9626 Tf +(through) 30.9936 Tj +[1 0 0 1 384.95 380.391] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -384.95 -380.391] cm +[1 0 0 1 0 0] Tm +0 0 Td +384.95 380.391 Td +/F134_0 9.9626 Tf +(-9) 11.9551 Tj +[1 0 0 1 396.905 380.391] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -396.905 -380.391] cm +[1 0 0 1 0 0] Tm +0 0 Td +399.046 380.391 Td +/F130_0 9.9626 Tf +(specify) 28.772 Tj +-215 TJm +(the) 12.1743 Tj +-215 TJm +(block) 22.1369 Tj +-215 TJm +(size) 15.4918 Tj +-215 TJm +(to) 7.7509 Tj +-214 TJm +(be) 9.40469 Tj +-215 TJm +(100,000) 32.3785 Tj +72 368.435 Td +(bytes) 21.031 Tj +-278 TJm +(through) 30.9936 Tj +-277 TJm +(900,000) 32.3785 Tj +-278 TJm +(bytes) 21.031 Tj +-278 TJm +(\(the) 15.4918 Tj +-277 TJm +(def) 12.7222 Tj +10 TJm +(ault\)) 18.2614 Tj +-278 TJm +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(.) 2.49065 Tj +-786 TJm +(At) 9.9626 Tj +-278 TJm +(decompression) 59.7656 Tj +-278 TJm +(time,) 20.2042 Tj +-284 TJm +(the) 12.1743 Tj +-278 TJm +(block) 22.1369 Tj +-278 TJm +(size) 15.4918 Tj +-277 TJm +(used) 18.2614 Tj +-278 TJm +(for) 11.6164 Tj +-278 TJm +(compression) 50.3609 Tj +72 356.48 Td +(is) 6.64505 Tj +-243 TJm +(read) 17.1456 Tj +-242 TJm +(from) 19.3673 Tj +-243 TJm +(the) 12.1743 Tj +-242 TJm +(header) 26.5503 Tj +-243 TJm +(of) 8.29885 Tj +-242 TJm +(the) 12.1743 Tj +-243 TJm +(compressed) 47.0334 Tj +-242 TJm +(\002le,) 15.2229 Tj +-244 TJm +(and) 14.386 Tj +[1 0 0 1 275.174 356.48] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -275.174 -356.48] cm +[1 0 0 1 0 0] Tm +0 0 Td +275.174 356.48 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 317.017 356.48] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -317.017 -356.48] cm +[1 0 0 1 0 0] Tm +0 0 Td +319.433 356.48 Td +/F130_0 9.9626 Tf +(then) 17.1556 Tj +-243 TJm +(all) 9.9626 Tj +1 TJm +(o) 4.9813 Tj +-1 TJm +(c) 4.42339 Tj +1 TJm +(ates) 15.4918 Tj +-243 TJm +(itself) 19.9252 Tj +-242 TJm +(just) 14.396 Tj +-243 TJm +(enough) 29.3299 Tj +-243 TJm +(memory) 33.2053 Tj +-242 TJm +(to) 7.7509 Tj +-243 TJm +(decompress) 47.0334 Tj +72 344.525 Td +(the) 12.1743 Tj +-303 TJm +(\002le.) 15.2229 Tj +-940 TJm +(Since) 22.1369 Tj +-304 TJm +(block) 22.1369 Tj +-303 TJm +(sizes) 19.3673 Tj +-303 TJm +(are) 12.1643 Tj +-303 TJm +(stored) 24.3486 Tj +-304 TJm +(in) 7.7509 Tj +-303 TJm +(compressed) 47.0334 Tj +-303 TJm +(\002les,) 19.0983 Tj +-317 TJm +(it) 5.53921 Tj +-303 TJm +(follo) 18.8194 Tj +25 TJm +(ws) 11.0684 Tj +-304 TJm +(that) 14.9439 Tj +-303 TJm +(the) 12.1743 Tj +-303 TJm +(\003ags) 18.8194 Tj +[1 0 0 1 406.35 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -406.35 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +406.35 344.525 Td +/F134_0 9.9626 Tf +(-1) 11.9551 Tj +[1 0 0 1 418.305 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -418.305 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +421.327 344.525 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +[1 0 0 1 432.1 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -432.1 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +432.1 344.525 Td +/F134_0 9.9626 Tf +(-9) 11.9551 Tj +[1 0 0 1 444.055 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.055 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +447.077 344.525 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-303 TJm +(irrele) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant) 12.1743 Tj +-304 TJm +(to) 7.7509 Tj +-303 TJm +(and) 14.386 Tj +-303 TJm +(so) 8.85675 Tj +72 332.57 Td +(ignored) 30.4357 Tj +-250 TJm +(during) 26.0123 Tj +-250 TJm +(decompression.) 62.2563 Tj +[1 0 0 1 72 330.413] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -320.45] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 310.652 Td +/F130_0 9.9626 Tf +(Compression) 52.5826 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(decompression) 59.7656 Tj +-250 TJm +(requirements,) 54.5054 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(bytes,) 23.5217 Tj +-250 TJm +(can) 13.8281 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(estimated) 38.1866 Tj +-250 TJm +(as:) 11.0684 Tj +[1 0 0 1 72 308.495] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -299.13] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 299.13 Td +/F134_0 9.9626 Tf +(Compression:) 71.7307 Tj +-1278 TJm +(400k) 23.9102 Tj +-426 TJm +(+) 5.97756 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(8) 5.97756 Tj +-426 TJm +(x) 5.97756 Tj +-426 TJm +(block) 29.8878 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(\)) 5.97756 Tj +90 275.22 Td +(Decompression:) 83.6858 Tj +-426 TJm +(100k) 23.9102 Tj +-426 TJm +(+) 5.97756 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(4) 5.97756 Tj +-426 TJm +(x) 5.97756 Tj +-426 TJm +(block) 29.8878 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(\),) 11.9551 Tj +-426 TJm +(or) 11.9551 Tj +153.66 263.265 Td +(100k) 23.9102 Tj +-426 TJm +(+) 5.97756 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(2.5) 17.9327 Tj +-426 TJm +(x) 5.97756 Tj +-426 TJm +(block) 29.8878 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(\)) 5.97756 Tj +[1 0 0 1 72 247.723] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -237.761] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 225.805 Td +/F130_0 9.9626 Tf +(Lar) 13.8281 Tj +18 TJm +(ger) 12.7222 Tj +-292 TJm +(block) 22.1369 Tj +-292 TJm +(sizes) 19.3673 Tj +-291 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-292 TJm +(rapidly) 28.224 Tj +-292 TJm +(diminishing) 47.6113 Tj +-292 TJm +(mar) 15.4918 Tj +18 TJm +(ginal) 19.9252 Tj +-291 TJm +(returns.) 30.1568 Tj +-871 TJm +(Most) 20.4831 Tj +-292 TJm +(of) 8.29885 Tj +-291 TJm +(the) 12.1743 Tj +-292 TJm +(compression) 50.3609 Tj +-292 TJm +(comes) 25.4544 Tj +-292 TJm +(from) 19.3673 Tj +-291 TJm +(the) 12.1743 Tj +-292 TJm +(\002rst) 15.5018 Tj +-292 TJm +(tw) 9.9626 Tj +10 TJm +(o) 4.9813 Tj +-292 TJm +(or) 8.29885 Tj +72 213.85 Td +(three) 19.9152 Tj +-232 TJm +(hundred) 32.6474 Tj +-232 TJm +(k) 4.9813 Tj +-232 TJm +(of) 8.29885 Tj +-232 TJm +(block) 22.1369 Tj +-232 TJm +(size,) 17.9825 Tj +-235 TJm +(a) 4.42339 Tj +-232 TJm +(f) 3.31755 Tj +10 TJm +(act) 11.6164 Tj +-232 TJm +(w) 7.193 Tj +10 TJm +(orth) 16.0497 Tj +-232 TJm +(bearing) 29.8778 Tj +-232 TJm +(in) 7.7509 Tj +-232 TJm +(mind) 20.4831 Tj +-232 TJm +(when) 21.579 Tj +-231 TJm +(using) 21.589 Tj +[1 0 0 1 354.025 213.85] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -354.025 -213.85] cm +[1 0 0 1 0 0] Tm +0 0 Td +354.025 213.85 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 383.913 213.85] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -383.913 -213.85] cm +[1 0 0 1 0 0] Tm +0 0 Td +386.223 213.85 Td +/F130_0 9.9626 Tf +(on) 9.9626 Tj +-232 TJm +(small) 21.589 Tj +-232 TJm +(machines.) 40.1194 Tj +-304 TJm +(It) 6.08715 Tj +-232 TJm +(is) 6.64505 Tj +-232 TJm +(also) 16.0497 Tj +-231 TJm +(important) 38.7446 Tj +72 201.895 Td +(to) 7.7509 Tj +-250 TJm +(appreciate) 40.9363 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(decompression) 59.7656 Tj +-250 TJm +(memory) 33.2053 Tj +-250 TJm +(requirement) 48.1393 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(set) 11.0684 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(compression) 50.3609 Tj +-250 TJm +(time) 17.7135 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(choice) 26.0024 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(block) 22.1369 Tj +-250 TJm +(size.) 17.9825 Tj +[1 0 0 1 72 199.738] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -189.776] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 179.977 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-388 TJm +(\002les) 16.6077 Tj +-389 TJm +(compressed) 47.0334 Tj +-388 TJm +(with) 17.7135 Tj +-389 TJm +(the) 12.1743 Tj +-388 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-389 TJm +(900k) 19.9252 Tj +-388 TJm +(block) 22.1369 Tj +-389 TJm +(size,) 17.9825 Tj +[1 0 0 1 302.002 179.977] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -302.002 -179.977] cm +[1 0 0 1 0 0] Tm +0 0 Td +302.002 179.977 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 343.846 179.977] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -343.846 -179.977] cm +[1 0 0 1 0 0] Tm +0 0 Td +347.715 179.977 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-388 TJm +(require) 28.2141 Tj +-389 TJm +(about) 22.1369 Tj +-388 TJm +(3700) 19.9252 Tj +-389 TJm +(kbytes) 26.0123 Tj +-388 TJm +(to) 7.7509 Tj +-389 TJm +(decompress.) 49.5241 Tj +72 168.022 Td +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-424 TJm +(support) 29.8878 Tj +-425 TJm +(decompression) 59.7656 Tj +-424 TJm +(of) 8.29885 Tj +-424 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-425 TJm +(\002l) 8.30881 Tj +1 TJm +(e) 4.42339 Tj +-425 TJm +(on) 9.9626 Tj +-424 TJm +(a) 4.42339 Tj +-424 TJm +(4) 4.9813 Tj +-425 TJm +(me) 12.1743 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(abyte) 21.579 Tj +-424 TJm +(machine,) 36.2439 Tj +[1 0 0 1 348.272 168.022] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -348.272 -168.022] cm +[1 0 0 1 0 0] Tm +0 0 Td +348.272 168.022 Td +/F134_0 9.9626 Tf +(bunzip2) 41.8429 Tj +[1 0 0 1 390.115 168.022] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -390.115 -168.022] cm +[1 0 0 1 0 0] Tm +0 0 Td +394.342 168.022 Td +/F130_0 9.9626 Tf +(has) 13.2801 Tj +-424 TJm +(an) 9.40469 Tj +-425 TJm +(option) 25.4644 Tj +-424 TJm +(to) 7.7509 Tj +-424 TJm +(decompress) 47.0334 Tj +-424 TJm +(using) 21.589 Tj +72 156.067 Td +(approximately) 57.5539 Tj +-281 TJm +(half) 15.4918 Tj +-281 TJm +(this) 14.396 Tj +-280 TJm +(amount) 29.8878 Tj +-281 TJm +(of) 8.29885 Tj +-281 TJm +(memory) 33.2053 Tj +65 TJm +(,) 2.49065 Tj +-288 TJm +(about) 22.1369 Tj +-281 TJm +(2300) 19.9252 Tj +-281 TJm +(kbytes.) 28.503 Tj +-805 TJm +(Decompression) 61.9773 Tj +-280 TJm +(speed) 22.6848 Tj +-281 TJm +(is) 6.64505 Tj +-281 TJm +(also) 16.0497 Tj +-281 TJm +(halv) 17.1556 Tj +15 TJm +(ed,) 11.8953 Tj +-288 TJm +(so) 8.85675 Tj +-281 TJm +(you) 14.9439 Tj +-281 TJm +(should) 26.5703 Tj +72 144.112 Td +(use) 13.2801 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(option) 25.4644 Tj +-250 TJm +(only) 17.7135 Tj +-250 TJm +(where) 24.3386 Tj +-250 TJm +(necessary) 38.7246 Tj +65 TJm +(.) 2.49065 Tj +-620 TJm +(The) 15.4918 Tj +-250 TJm +(rele) 14.9339 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant) 12.1743 Tj +-250 TJm +(\003ag) 14.9439 Tj +-250 TJm +(is) 6.64505 Tj +[1 0 0 1 305.024 144.112] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -305.024 -144.112] cm +[1 0 0 1 0 0] Tm +0 0 Td +305.024 144.112 Td +/F134_0 9.9626 Tf +(-s) 11.9551 Tj +[1 0 0 1 316.979 144.112] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -316.979 -144.112] cm +[1 0 0 1 0 0] Tm +0 0 Td +316.979 144.112 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 141.955] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -131.992] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 122.194 Td +/F130_0 9.9626 Tf +(In) 8.29885 Tj +-204 TJm +(general,) 31.8106 Tj +-214 TJm +(try) 11.0684 Tj +-204 TJm +(and) 14.386 Tj +-205 TJm +(use) 13.2801 Tj +-204 TJm +(the) 12.1743 Tj +-204 TJm +(lar) 10.5105 Tj +18 TJm +(gest) 16.0497 Tj +-205 TJm +(block) 22.1369 Tj +-204 TJm +(size) 15.4918 Tj +-205 TJm +(memory) 33.2053 Tj +-204 TJm +(constraints) 43.1679 Tj +-204 TJm +(allo) 14.9439 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(,) 2.49065 Tj +-214 TJm +(since) 20.4731 Tj +-204 TJm +(that) 14.9439 Tj +-205 TJm +(maximises) 42.62 Tj +-204 TJm +(the) 12.1743 Tj +-204 TJm +(compression) 50.3609 Tj +-205 TJm +(achie) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ed.) 11.8953 Tj +72 110.239 Td +(Compression) 52.5826 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(decompression) 59.7656 Tj +-250 TJm +(speed) 22.6848 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(virtually) 33.7633 Tj +-250 TJm +(unaf) 17.7035 Tj +25 TJm +(fected) 24.3386 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(block) 22.1369 Tj +-250 TJm +(size.) 17.9825 Tj +[1 0 0 1 72 108.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -98.1193] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 88.321 Td +/F130_0 9.9626 Tf +(Another) 32.6474 Tj +-296 TJm +(signi\002cant) 41.5142 Tj +-296 TJm +(point) 20.4831 Tj +-295 TJm +(applies) 28.224 Tj +-296 TJm +(to) 7.7509 Tj +-296 TJm +(\002les) 16.6077 Tj +-296 TJm +(which) 24.3486 Tj +-296 TJm +(\002t) 8.30881 Tj +-296 TJm +(in) 7.7509 Tj +-296 TJm +(a) 4.42339 Tj +-295 TJm +(single) 23.8007 Tj +-296 TJm +(block) 22.1369 Tj +-296 TJm +(--) 6.63509 Tj +-296 TJm +(that) 14.9439 Tj +-296 TJm +(means) 25.4544 Tj +-296 TJm +(most) 19.3773 Tj +-295 TJm +(\002les) 16.6077 Tj +-296 TJm +(you') 18.2614 Tj +50 TJm +(d) 4.9813 Tj +-296 TJm +(encounter) 39.2825 Tj +-296 TJm +(using) 21.589 Tj +-296 TJm +(a) 4.42339 Tj +72 76.3658 Td +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-290 TJm +(block) 22.1369 Tj +-290 TJm +(size.) 17.9825 Tj +-859 TJm +(The) 15.4918 Tj +-290 TJm +(amount) 29.8878 Tj +-290 TJm +(of) 8.29885 Tj +-290 TJm +(real) 14.9339 Tj +-290 TJm +(memory) 33.2053 Tj +-289 TJm +(touched) 31.5416 Tj +-290 TJm +(is) 6.64505 Tj +-290 TJm +(proportional) 49.2551 Tj +-290 TJm +(to) 7.7509 Tj +-290 TJm +(the) 12.1743 Tj +-290 TJm +(size) 15.4918 Tj +-290 TJm +(of) 8.29885 Tj +-290 TJm +(the) 12.1743 Tj +-289 TJm +(\002le,) 15.2229 Tj +-300 TJm +(since) 20.4731 Tj +-290 TJm +(the) 12.1743 Tj +-290 TJm +(\002le) 12.7322 Tj +-290 TJm +(is) 6.64505 Tj +-290 TJm +(smaller) 29.3299 Tj +[1 0 0 1 72 50.8518] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.9514 Td +/F130_0 9.9626 Tf +(5) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 9 9 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 105.519 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -371.59 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.109 749.245 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 266.071 747.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(than) 17.1556 Tj +-362 TJm +(a) 4.42339 Tj +-362 TJm +(block.) 24.6275 Tj +-1293 TJm +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-362 TJm +(e) 4.42339 Tj +15 TJm +(xample,) 31.8205 Tj +-390 TJm +(compressing) 50.3609 Tj +-362 TJm +(a) 4.42339 Tj +-362 TJm +(\002le) 12.7322 Tj +-362 TJm +(20,000) 27.3972 Tj +-362 TJm +(bytes) 21.031 Tj +-362 TJm +(long) 17.7135 Tj +-362 TJm +(with) 17.7135 Tj +-362 TJm +(the) 12.1743 Tj +-362 TJm +(\003ag) 14.9439 Tj +[1 0 0 1 406.528 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -406.528 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +406.528 710.037 Td +/F134_0 9.9626 Tf +(-9) 11.9551 Tj +[1 0 0 1 418.483 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -418.483 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +422.09 710.037 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-362 TJm +(cause) 22.1269 Tj +-362 TJm +(the) 12.1743 Tj +-362 TJm +(compressor) 45.9276 Tj +-362 TJm +(to) 7.7509 Tj +72 698.082 Td +(allocate) 30.9837 Tj +-271 TJm +(around) 27.6661 Tj +-272 TJm +(7600k) 24.9065 Tj +-271 TJm +(of) 8.29885 Tj +-272 TJm +(memory) 33.2053 Tj +65 TJm +(,) 2.49065 Tj +-277 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-271 TJm +(only) 17.7135 Tj +-272 TJm +(touch) 22.1369 Tj +-271 TJm +(400k) 19.9252 Tj +-272 TJm +(+) 5.61891 Tj +-271 TJm +(20000) 24.9065 Tj +-272 TJm +(*) 4.9813 Tj +-271 TJm +(8) 4.9813 Tj +-272 TJm +(=) 5.61891 Tj +-271 TJm +(560) 14.9439 Tj +-272 TJm +(kbytes) 26.0123 Tj +-271 TJm +(of) 8.29885 Tj +-272 TJm +(it.) 8.02986 Tj +-748 TJm +(Similarly) 37.0908 Tj +65 TJm +(,) 2.49065 Tj +-277 TJm +(the) 12.1743 Tj +-272 TJm +(decompressor) 55.3323 Tj +72 686.127 Td +(will) 15.5018 Tj +-250 TJm +(allocate) 30.9837 Tj +-250 TJm +(3700k) 24.9065 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(only) 17.7135 Tj +-250 TJm +(touch) 22.1369 Tj +-250 TJm +(100k) 19.9252 Tj +-250 TJm +(+) 5.61891 Tj +-250 TJm +(20000) 24.9065 Tj +-250 TJm +(*) 4.9813 Tj +-250 TJm +(4) 4.9813 Tj +-250 TJm +(=) 5.61891 Tj +-250 TJm +(180) 14.9439 Tj +-250 TJm +(kbytes.) 28.503 Tj +[1 0 0 1 72 683.97] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -674.008] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 664.209 Td +/F130_0 9.9626 Tf +(Here) 19.3573 Tj +-293 TJm +(is) 6.64505 Tj +-294 TJm +(a) 4.42339 Tj +-293 TJm +(table) 19.3673 Tj +-294 TJm +(which) 24.3486 Tj +-293 TJm +(summarises) 47.0434 Tj +-294 TJm +(the) 12.1743 Tj +-293 TJm +(maximum) 40.4083 Tj +-294 TJm +(memory) 33.2053 Tj +-293 TJm +(usage) 22.6848 Tj +-294 TJm +(for) 11.6164 Tj +-293 TJm +(dif) 11.0684 Tj +25 TJm +(ferent) 23.2328 Tj +-294 TJm +(block) 22.1369 Tj +-293 TJm +(sizes.) 21.8579 Tj +-881 TJm +(Also) 18.8194 Tj +-293 TJm +(recorded) 34.8492 Tj +-294 TJm +(is) 6.64505 Tj +-293 TJm +(the) 12.1743 Tj +-294 TJm +(total) 17.7135 Tj +72 652.254 Td +(compressed) 47.0334 Tj +-289 TJm +(size) 15.4918 Tj +-289 TJm +(for) 11.6164 Tj +-289 TJm +(14) 9.9626 Tj +-289 TJm +(\002les) 16.6077 Tj +-290 TJm +(of) 8.29885 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(Calg) 18.8194 Tj +5 TJm +(ary) 12.7222 Tj +-289 TJm +(T) 6.08715 Tj +70 TJm +(e) 4.42339 Tj +15 TJm +(xt) 7.7509 Tj +-289 TJm +(Compression) 52.5826 Tj +-289 TJm +(Corpus) 28.782 Tj +-289 TJm +(totalling) 33.2153 Tj +-289 TJm +(3,141,622) 39.8504 Tj +-290 TJm +(bytes.) 23.5217 Tj +-854 TJm +(This) 17.7135 Tj +-290 TJm +(column) 29.8878 Tj +-289 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +72 640.299 Td +(some) 21.031 Tj +-253 TJm +(feel) 14.9339 Tj +-253 TJm +(for) 11.6164 Tj +-253 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-253 TJm +(compression) 50.3609 Tj +-253 TJm +(v) 4.9813 Tj +25 TJm +(aries) 18.8094 Tj +-253 TJm +(with) 17.7135 Tj +-253 TJm +(block) 22.1369 Tj +-253 TJm +(size.) 17.9825 Tj +-638 TJm +(These) 23.7907 Tj +-253 TJm +(\002gures) 27.1182 Tj +-253 TJm +(tend) 17.1556 Tj +-254 TJm +(to) 7.7509 Tj +-253 TJm +(understate) 40.9463 Tj +-253 TJm +(the) 12.1743 Tj +-253 TJm +(adv) 14.386 Tj +25 TJm +(antage) 26.0024 Tj +-253 TJm +(of) 8.29885 Tj +-253 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +-253 TJm +(block) 22.1369 Tj +72 628.344 Td +(sizes) 19.3673 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +-250 TJm +(\002les,) 19.0983 Tj +-250 TJm +(since) 20.4731 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(Corpus) 28.782 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(dominated) 42.0621 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(smaller) 29.3299 Tj +-250 TJm +(\002les.) 19.0983 Tj +[1 0 0 1 72 626.187] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -156.413] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 155.417 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 151.831] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -616.822] cm +[1 0 0 1 0 0] Tm +0 0 Td +123.952 616.822 Td +/F134_0 9.9626 Tf +(Compress) 47.8205 Tj +-1278 TJm +(Decompress) 59.7756 Tj +-1278 TJm +(Decompress) 59.7756 Tj +-1278 TJm +(Corpus) 35.8654 Tj +90 604.867 Td +(Flag) 23.9102 Tj +-2130 TJm +(usage) 29.8878 Tj +-2556 TJm +(usage) 29.8878 Tj +-2982 TJm +(-s) 11.9551 Tj +-426 TJm +(usage) 29.8878 Tj +-2130 TJm +(Size) 23.9102 Tj +94.244 580.956 Td +(-1) 11.9551 Tj +-2556 TJm +(1200k) 29.8878 Tj +-2982 TJm +(500k) 23.9102 Tj +-3834 TJm +(350k) 23.9102 Tj +-2556 TJm +(914704) 35.8654 Tj +94.244 569.001 Td +(-2) 11.9551 Tj +-2556 TJm +(2000k) 29.8878 Tj +-2982 TJm +(900k) 23.9102 Tj +-3834 TJm +(600k) 23.9102 Tj +-2556 TJm +(877703) 35.8654 Tj +94.244 557.046 Td +(-3) 11.9551 Tj +-2556 TJm +(2800k) 29.8878 Tj +-2556 TJm +(1300k) 29.8878 Tj +-3834 TJm +(850k) 23.9102 Tj +-2556 TJm +(860338) 35.8654 Tj +94.244 545.091 Td +(-4) 11.9551 Tj +-2556 TJm +(3600k) 29.8878 Tj +-2556 TJm +(1700k) 29.8878 Tj +-3408 TJm +(1100k) 29.8878 Tj +-2556 TJm +(846899) 35.8654 Tj +94.244 533.136 Td +(-5) 11.9551 Tj +-2556 TJm +(4400k) 29.8878 Tj +-2556 TJm +(2100k) 29.8878 Tj +-3408 TJm +(1350k) 29.8878 Tj +-2556 TJm +(845160) 35.8654 Tj +94.244 521.181 Td +(-6) 11.9551 Tj +-2556 TJm +(5200k) 29.8878 Tj +-2556 TJm +(2500k) 29.8878 Tj +-3408 TJm +(1600k) 29.8878 Tj +-2556 TJm +(838626) 35.8654 Tj +94.244 509.225 Td +(-7) 11.9551 Tj +-2556 TJm +(6100k) 29.8878 Tj +-2556 TJm +(2900k) 29.8878 Tj +-3408 TJm +(1850k) 29.8878 Tj +-2556 TJm +(834096) 35.8654 Tj +94.244 497.27 Td +(-8) 11.9551 Tj +-2556 TJm +(6800k) 29.8878 Tj +-2556 TJm +(3300k) 29.8878 Tj +-3408 TJm +(2100k) 29.8878 Tj +-2556 TJm +(828642) 35.8654 Tj +94.244 485.315 Td +(-9) 11.9551 Tj +-2556 TJm +(7600k) 29.8878 Tj +-2556 TJm +(3700k) 29.8878 Tj +-3408 TJm +(2350k) 29.8878 Tj +-2556 TJm +(828642) 35.8654 Tj +[1 0 0 1 72 469.773] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -459.811] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 435.021 Td +/F122_0 20.6585 Tf +(2.6.) 34.4584 Tj +-278 TJm +(RECO) 59.6824 Tj +50 TJm +(VERING) 79.2047 Tj +-278 TJm +(D) 14.9154 Tj +40 TJm +(A) 14.9154 Tj +90 TJm +(T) 12.6223 Tj +90 TJm +(A) 14.9154 Tj +-278 TJm +(FR) 27.5378 Tj +20 TJm +(OM) 33.2808 Tj +-278 TJm +(D) 14.9154 Tj +40 TJm +(AMA) 47.0394 Tj +50 TJm +(GED) 44.767 Tj +72 410.23 Td +(FILES) 58.5462 Tj +[1 0 0 1 72 409.972] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -400.01] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 388.312 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 388.312] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -388.312] cm +[1 0 0 1 0 0] Tm +0 0 Td +105.138 388.312 Td +/F130_0 9.9626 Tf +(compresses) 45.9276 Tj +-326 TJm +(\002les) 16.6077 Tj +-326 TJm +(in) 7.7509 Tj +-326 TJm +(blocks,) 28.503 Tj +-346 TJm +(usually) 28.782 Tj +-326 TJm +(900kbytes) 40.9562 Tj +-326 TJm +(long.) 20.2042 Tj +-1077 TJm +(Each) 19.9152 Tj +-326 TJm +(block) 22.1369 Tj +-327 TJm +(is) 6.64505 Tj +-326 TJm +(handled) 31.5416 Tj +-326 TJm +(independently) 56.4481 Tj +65 TJm +(.) 2.49065 Tj +-1077 TJm +(If) 6.63509 Tj +-326 TJm +(a) 4.42339 Tj +-326 TJm +(media) 24.3486 Tj +-326 TJm +(or) 8.29885 Tj +72 376.357 Td +(transmission) 50.3709 Tj +-319 TJm +(error) 19.3573 Tj +-318 TJm +(causes) 26.0024 Tj +-319 TJm +(a) 4.42339 Tj +-318 TJm +(multi-block) 46.4955 Tj +[1 0 0 1 234.518 376.357] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.518 -376.357] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.518 376.357 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 258.429 376.357] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -258.429 -376.357] cm +[1 0 0 1 0 0] Tm +0 0 Td +261.603 376.357 Td +/F130_0 9.9626 Tf +(\002le) 12.7322 Tj +-319 TJm +(to) 7.7509 Tj +-318 TJm +(become) 30.9837 Tj +-319 TJm +(damaged,) 38.4556 Tj +-336 TJm +(it) 5.53921 Tj +-318 TJm +(may) 17.1556 Tj +-319 TJm +(be) 9.40469 Tj +-318 TJm +(possible) 32.6574 Tj +-319 TJm +(to) 7.7509 Tj +-318 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-319 TJm +(data) 16.5977 Tj +-319 TJm +(from) 19.3673 Tj +-318 TJm +(the) 12.1743 Tj +72 364.402 Td +(undamaged) 45.9276 Tj +-250 TJm +(blocks) 26.0123 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002le.) 15.2229 Tj +[1 0 0 1 72 362.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -352.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 342.484 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-358 TJm +(compressed) 47.0334 Tj +-357 TJm +(representation) 56.4381 Tj +-358 TJm +(of) 8.29885 Tj +-357 TJm +(each) 18.2515 Tj +-358 TJm +(block) 22.1369 Tj +-358 TJm +(is) 6.64505 Tj +-357 TJm +(delimited) 37.6387 Tj +-358 TJm +(by) 9.9626 Tj +-357 TJm +(a) 4.42339 Tj +-358 TJm +(48-bit) 23.8007 Tj +-358 TJm +(pattern,) 30.1568 Tj +-384 TJm +(which) 24.3486 Tj +-358 TJm +(mak) 17.1556 Tj +10 TJm +(es) 8.29885 Tj +-357 TJm +(it) 5.53921 Tj +-358 TJm +(possible) 32.6574 Tj +-357 TJm +(to) 7.7509 Tj +-358 TJm +(\002nd) 15.5018 Tj +-358 TJm +(the) 12.1743 Tj +72 330.529 Td +(block) 22.1369 Tj +-286 TJm +(boundaries) 43.7159 Tj +-286 TJm +(wit) 12.7322 Tj +1 TJm +(h) 4.9813 Tj +-286 TJm +(reasonable) 42.6001 Tj +-286 TJm +(certainty) 34.8591 Tj +65 TJm +(.) 2.49065 Tj +-835 TJm +(Each) 19.9152 Tj +-285 TJm +(block) 22.1369 Tj +-286 TJm +(also) 16.0497 Tj +-286 TJm +(carries) 26.5503 Tj +-286 TJm +(its) 9.41466 Tj +-285 TJm +(o) 4.9813 Tj +25 TJm +(wn) 12.1743 Tj +-286 TJm +(32-bit) 23.8007 Tj +-286 TJm +(CRC,) 22.4258 Tj +-286 TJm +(so) 8.85675 Tj +-285 TJm +(damaged) 35.965 Tj +-286 TJm +(blocks) 26.0123 Tj +-286 TJm +(can) 13.8281 Tj +-286 TJm +(be) 9.40469 Tj +72 318.574 Td +(distinguished) 53.1405 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(undamaged) 45.9276 Tj +-250 TJm +(ones.) 20.7521 Tj +[1 0 0 1 72 316.417] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -306.455] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 296.656 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 143.731 296.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -296.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +146.448 296.656 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-273 TJm +(a) 4.42339 Tj +-272 TJm +(simple) 26.5703 Tj +-273 TJm +(program) 33.7533 Tj +-273 TJm +(whose) 25.4544 Tj +-272 TJm +(purpose) 31.5416 Tj +-273 TJm +(is) 6.64505 Tj +-273 TJm +(to) 7.7509 Tj +-272 TJm +(search) 25.4445 Tj +-273 TJm +(for) 11.6164 Tj +-273 TJm +(blocks) 26.0123 Tj +-272 TJm +(in) 7.7509 Tj +[1 0 0 1 392.655 296.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.655 -296.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.655 296.656 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 416.566 296.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -416.566 -296.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.282 296.656 Td +/F130_0 9.9626 Tf +(\002les,) 19.0983 Tj +-278 TJm +(and) 14.386 Tj +-273 TJm +(write) 20.4731 Tj +-273 TJm +(each) 18.2515 Tj +-272 TJm +(block) 22.1369 Tj +-273 TJm +(out) 12.7322 Tj +72 284.701 Td +(into) 15.5018 Tj +-254 TJm +(its) 9.41466 Tj +-255 TJm +(o) 4.9813 Tj +25 TJm +(wn) 12.1743 Tj +[1 0 0 1 121.43 284.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -121.43 -284.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +121.43 284.701 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 145.34 284.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -145.34 -284.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +147.875 284.701 Td +/F130_0 9.9626 Tf +(\002le.) 15.2229 Tj +-647 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-255 TJm +(can) 13.8281 Tj +-254 TJm +(then) 17.1556 Tj +-255 TJm +(use) 13.2801 Tj +[1 0 0 1 240.01 284.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.01 -284.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +240.01 284.701 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-600 TJm +(-t) 11.9551 Tj +[1 0 0 1 287.831 284.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -287.831 -284.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +290.367 284.701 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-255 TJm +(t) 2.7696 Tj +1 TJm +(est) 11.0684 Tj +-255 TJm +(the) 12.1743 Tj +-254 TJm +(inte) 14.9439 Tj +15 TJm +(grity) 18.8194 Tj +-255 TJm +(of) 8.29885 Tj +-254 TJm +(the) 12.1743 Tj +-255 TJm +(resulting) 34.8691 Tj +-254 TJm +(\002les,) 19.0983 Tj +-256 TJm +(and) 14.386 Tj +-255 TJm +(decompress) 47.0334 Tj +-254 TJm +(those) 21.031 Tj +72 272.746 Td +(which) 24.3486 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(undamaged.) 48.4182 Tj +[1 0 0 1 72 270.589] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -260.626] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 250.828 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 143.731 250.828] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -250.828] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.099 250.828 Td +/F130_0 9.9626 Tf +(tak) 12.1743 Tj +10 TJm +(es) 8.29885 Tj +-639 TJm +(a) 4.42339 Tj +-639 TJm +(single) 23.8007 Tj +-639 TJm +(ar) 7.74094 Tj +18 TJm +(gument,) 32.3785 Tj +-737 TJm +(the) 12.1743 Tj +-639 TJm +(name) 21.579 Tj +-639 TJm +(of) 8.29885 Tj +-639 TJm +(the) 12.1743 Tj +-639 TJm +(damaged) 35.965 Tj +-639 TJm +(\002le,) 15.2229 Tj +-737 TJm +(and) 14.386 Tj +-639 TJm +(writes) 24.3486 Tj +-639 TJm +(a) 4.42339 Tj +-639 TJm +(number) 30.4357 Tj +-639 TJm +(of) 8.29885 Tj +-640 TJm +(\002les) 16.6077 Tj +[1 0 0 1 72 238.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -238.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 238.873 Td +/F134_0 9.9626 Tf +(rec0001file.bz2) 89.6634 Tj +[1 0 0 1 161.664 238.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.664 -238.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.664 238.873 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 169.072 238.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.072 -238.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.072 238.873 Td +/F134_0 9.9626 Tf +(rec0002file.bz2) 89.6634 Tj +[1 0 0 1 258.736 238.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -258.736 -238.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +258.736 238.873 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-494 TJm +(etc,) 14.107 Tj +-493 TJm +(containing) 42.0621 Tj +-445 TJm +(the) 12.1743 Tj +-445 TJm +(e) 4.42339 Tj +15 TJm +(xtracted) 32.0895 Tj +-445 TJm +(blocks.) 28.503 Tj +-1789 TJm +(The) 15.4918 Tj +-445 TJm +(output) 25.4644 Tj +-445 TJm +(\002lenames) 38.1866 Tj +-445 TJm +(are) 12.1643 Tj +72 226.918 Td +(designed) 35.417 Tj +-337 TJm +(so) 8.85675 Tj +-337 TJm +(that) 14.9439 Tj +-337 TJm +(the) 12.1743 Tj +-337 TJm +(use) 13.2801 Tj +-337 TJm +(of) 8.29885 Tj +-337 TJm +(wildc) 22.1369 Tj +1 TJm +(ards) 16.5977 Tj +-337 TJm +(in) 7.7509 Tj +-337 TJm +(subsequent) 44.2738 Tj +-337 TJm +(processing) 42.61 Tj +-337 TJm +(--) 6.63509 Tj +-337 TJm +(for) 11.6164 Tj +-337 TJm +(e) 4.42339 Tj +15 TJm +(xample,) 31.8205 Tj +[1 0 0 1 396.538 226.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -396.538 -226.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +396.538 226.918 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-600 TJm +(-dc) 17.9327 Tj +-600 TJm +(rec) 17.9327 Tj +474.247 225.174 Td +(*) 5.97756 Tj +480.224 226.918 Td +(file.bz2) 47.8205 Tj +-600 TJm +(>) 5.97756 Tj +72 214.963 Td +(recovered_data) 83.6858 Tj +[1 0 0 1 155.686 214.963] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.686 -214.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.177 214.963 Td +/F130_0 9.9626 Tf +(--) 6.63509 Tj +-250 TJm +(lists) 16.0597 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002les) 16.6077 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(correct) 27.6562 Tj +-250 TJm +(order) 21.0211 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 213.653] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -203.69] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 193.045 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 143.731 193.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -193.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +145.93 193.045 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-221 TJm +(be) 9.40469 Tj +-220 TJm +(of) 8.29885 Tj +-221 TJm +(most) 19.3773 Tj +-221 TJm +(use) 13.2801 Tj +-220 TJm +(dealing) 29.3299 Tj +-221 TJm +(with) 17.7135 Tj +-221 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +[1 0 0 1 307.229 193.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -307.229 -193.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +307.229 193.045 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 331.14 193.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.14 -193.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +333.338 193.045 Td +/F130_0 9.9626 Tf +(\002les,) 19.0983 Tj +-227 TJm +(as) 8.29885 Tj +-220 TJm +(these) 20.4731 Tj +-221 TJm +(will) 15.5018 Tj +-221 TJm +(contain) 29.3299 Tj +-220 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +-221 TJm +(blocks.) 28.503 Tj +-600 TJm +(It) 6.08715 Tj +-221 TJm +(is) 6.64505 Tj +-221 TJm +(clearly) 27.1082 Tj +72 181.09 Td +(futile) 21.031 Tj +-289 TJm +(to) 7.7509 Tj +-289 TJm +(use) 13.2801 Tj +-289 TJm +(it) 5.53921 Tj +-289 TJm +(on) 9.9626 Tj +-289 TJm +(damaged) 35.965 Tj +-289 TJm +(single-block) 49.2551 Tj +-290 TJm +(\002les) 16.6077 Tj +1 TJm +(,) 2.49065 Tj +-299 TJm +(since) 20.4731 Tj +-289 TJm +(a) 4.42339 Tj +-290 TJm +(damaged) 35.965 Tj +-289 TJm +(block) 22.1369 Tj +-289 TJm +(cannot) 26.5603 Tj +-289 TJm +(be) 9.40469 Tj +-289 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ered.) 19.6363 Tj +-854 TJm +(If) 6.63509 Tj +-289 TJm +(you) 14.9439 Tj +-290 TJm +(wish) 18.8194 Tj +-289 TJm +(to) 7.7509 Tj +-289 TJm +(minimise) 37.0908 Tj +72 169.135 Td +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-320 TJm +(potential) 34.8691 Tj +-320 TJm +(data) 16.5977 Tj +-319 TJm +(loss) 15.5018 Tj +-320 TJm +(through) 30.9936 Tj +-320 TJm +(media) 24.3486 Tj +-320 TJm +(or) 8.29885 Tj +-319 TJm +(transmission) 50.3709 Tj +-320 TJm +(errors,) 25.7234 Tj +-337 TJm +(you) 14.9439 Tj +-320 TJm +(might) 23.2527 Tj +-320 TJm +(consider) 33.7533 Tj +-320 TJm +(compressing) 50.3609 Tj +-319 TJm +(with) 17.7135 Tj +-320 TJm +(a) 4.42339 Tj +-320 TJm +(smaller) 29.3299 Tj +-320 TJm +(block) 22.1369 Tj +72 157.179 Td +(size.) 17.9825 Tj +[1 0 0 1 72 157.08] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -147.117] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 122.426 Td +/F122_0 20.6585 Tf +(2.7.) 34.4584 Tj +-278 TJm +(PERFORMANCE) 161.818 Tj +-278 TJm +(NO) 30.9877 Tj +40 TJm +(TES) 40.1808 Tj +[1 0 0 1 72 122.168] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -112.206] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 100.509 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-305 TJm +(sorting) 27.6761 Tj +-304 TJm +(phase) 22.6848 Tj +-305 TJm +(of) 8.29885 Tj +-304 TJm +(compression) 50.3609 Tj +-305 TJm +(g) 4.9813 Tj +5 TJm +(athers) 23.7907 Tj +-304 TJm +(together) 32.6474 Tj +-305 TJm +(similar) 27.6761 Tj +-304 TJm +(strings) 26.5703 Tj +-305 TJm +(in) 7.7509 Tj +-304 TJm +(the) 12.1743 Tj +-305 TJm +(\002le.) 15.2229 Tj +-947 TJm +(Because) 33.1954 Tj +-305 TJm +(of) 8.29885 Tj +-304 TJm +(this,) 16.8866 Tj +-319 TJm +(\002les) 16.6077 Tj +-304 TJm +(containing) 42.0621 Tj +-305 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +72 88.5534 Td +(long) 17.7135 Tj +-286 TJm +(runs) 17.1556 Tj +-285 TJm +(of) 8.29885 Tj +-286 TJm +(repeated) 33.7433 Tj +-285 TJm +(symbols,) 35.706 Tj +-295 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-286 TJm +("aabaabaabaab) 59.3771 Tj +-285 TJm +(...") 11.5367 Tj +-571 TJm +(\(repeated) 37.0609 Tj +-286 TJm +(se) 8.29885 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(eral) 14.9339 Tj +-286 TJm +(hundred) 32.6474 Tj +-285 TJm +(times\)) 24.9065 Tj +-286 TJm +(may) 17.1556 Tj +-286 TJm +(com) 17.1556 Tj +1 TJm +(press) 20.4731 Tj +-286 TJm +(more) 20.4731 Tj +-286 TJm +(slo) 11.6264 Tj +25 TJm +(wly) 14.9439 Tj +72 76.5983 Td +(than) 17.1556 Tj +-322 TJm +(normal.) 30.7147 Tj +-524 TJm +(V) 7.193 Tj +111 TJm +(ersions) 28.224 Tj +-322 TJm +(0.9.5) 19.9252 Tj +-321 TJm +(and) 14.386 Tj +-322 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-322 TJm +(f) 3.31755 Tj +10 TJm +(are) 12.1643 Tj +-321 TJm +(much) 22.1369 Tj +-322 TJm +(better) 22.6848 Tj +-321 TJm +(than) 17.1556 Tj +-322 TJm +(pre) 12.7222 Tj +25 TJm +(vious) 21.589 Tj +-321 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-322 TJm +(in) 7.7509 Tj +-322 TJm +(this) 14.396 Tj +-321 TJm +(respect.) 30.7047 Tj +-1050 TJm +(The) 15.4918 Tj +-321 TJm +(ratio) 18.2614 Tj +-322 TJm +(between) 33.1954 Tj +[1 0 0 1 72 50.8518] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.9514 Td +/F130_0 9.9626 Tf +(6) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 10 10 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 105.519 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -371.59 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.109 749.245 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 266.071 747.089] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(w) 7.193 Tj +10 TJm +(orst-case) 35.4071 Tj +-289 TJm +(and) 14.386 Tj +-290 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(erage-case) 42.0322 Tj +-289 TJm +(compression) 50.3609 Tj +-290 TJm +(time) 17.7135 Tj +-289 TJm +(is) 6.64505 Tj +-290 TJm +(in) 7.7509 Tj +-289 TJm +(the) 12.1743 Tj +-290 TJm +(re) 7.74094 Tj +15 TJm +(gion) 17.7135 Tj +-289 TJm +(of) 8.29885 Tj +-289 TJm +(10:1.) 20.2042 Tj +-857 TJm +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-290 TJm +(pre) 12.7222 Tj +25 TJm +(vious) 21.589 Tj +-289 TJm +(v) 4.9813 Tj +15 TJm +(ersions,) 30.7147 Tj +-299 TJm +(this) 14.396 Tj +-290 TJm +(\002gure) 23.2427 Tj +-289 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-290 TJm +(more) 20.4731 Tj +72 698.082 Td +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-250 TJm +(100:1.) 25.1855 Tj +-620 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-250 TJm +(can) 13.8281 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(the) 12.1743 Tj +[1 0 0 1 186.002 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -186.002 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +186.002 698.082 Td +/F134_0 9.9626 Tf +(-vvvv) 29.8878 Tj +[1 0 0 1 215.889 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -215.889 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +218.38 698.082 Td +/F130_0 9.9626 Tf +(option) 25.4644 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(monitor) 31.5516 Tj +-250 TJm +(progress) 33.7533 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(great) 19.9152 Tj +-250 TJm +(detail,) 24.6275 Tj +-250 TJm +(if) 6.08715 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant.) 14.6649 Tj +[1 0 0 1 72 695.925] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -685.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 676.164 Td +/F130_0 9.9626 Tf +(Decompression) 61.9773 Tj +-250 TJm +(speed) 22.6848 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(unaf) 17.7035 Tj +25 TJm +(fected) 24.3386 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(these) 20.4731 Tj +-250 TJm +(phenomena.) 48.4182 Tj +[1 0 0 1 72 674.007] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -664.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 654.247 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 654.247] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -654.247] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.863 654.247 Td +/F130_0 9.9626 Tf +(usually) 28.782 Tj +-299 TJm +(allocates) 34.8591 Tj +-298 TJm +(se) 8.29885 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(eral) 14.9339 Tj +-299 TJm +(me) 12.1743 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(abytes) 25.4544 Tj +-298 TJm +(of) 8.29885 Tj +-299 TJm +(memory) 33.2053 Tj +-299 TJm +(to) 7.7509 Tj +-298 TJm +(operate) 29.3199 Tj +-299 TJm +(in,) 10.2416 Tj +-311 TJm +(and) 14.386 Tj +-298 TJm +(then) 17.1556 Tj +-299 TJm +(char) 17.1456 Tj +18 TJm +(ges) 13.2801 Tj +-298 TJm +(all) 9.9626 Tj +-299 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-299 TJm +(it) 5.53921 Tj +-298 TJm +(in) 7.7509 Tj +-299 TJm +(a) 4.42339 Tj +-298 TJm +(f) 3.31755 Tj +10 TJm +(airly) 18.2614 Tj +-299 TJm +(random) 30.4357 Tj +72 642.291 Td +(f) 3.31755 Tj +10 TJm +(ashion.) 28.503 Tj +-743 TJm +(This) 17.7135 Tj +-270 TJm +(means) 25.4544 Tj +-271 TJm +(that) 14.9439 Tj +-270 TJm +(performance,) 52.8317 Tj +-276 TJm +(both) 17.7135 Tj +-270 TJm +(for) 11.6164 Tj +-271 TJm +(compressing) 50.3609 Tj +-270 TJm +(and) 14.386 Tj +-271 TJm +(decompressing,) 62.2563 Tj +-275 TJm +(is) 6.64505 Tj +-271 TJm +(lar) 10.5105 Tj +18 TJm +(gely) 17.1556 Tj +-270 TJm +(determined) 44.8217 Tj +-271 TJm +(by) 9.9626 Tj +-270 TJm +(the) 12.1743 Tj +-271 TJm +(speed) 22.6848 Tj +72 630.336 Td +(at) 7.193 Tj +-294 TJm +(which) 24.3486 Tj +-294 TJm +(your) 18.2614 Tj +-294 TJm +(machine) 33.7533 Tj +-295 TJm +(ca) 8.84679 Tj +1 TJm +(n) 4.9813 Tj +-295 TJm +(service) 28.2141 Tj +-294 TJm +(cache) 22.6749 Tj +-294 TJm +(misses.) 29.0609 Tj +-442 TJm +(Because) 33.1954 Tj +-294 TJm +(of) 8.29885 Tj +-294 TJm +(this,) 16.8866 Tj +-306 TJm +(small) 21.589 Tj +-294 TJm +(changes) 32.0895 Tj +-294 TJm +(to) 7.7509 Tj +-294 TJm +(the) 12.1743 Tj +-294 TJm +(code) 18.8094 Tj +-294 TJm +(to) 7.7509 Tj +-294 TJm +(reduce) 26.5503 Tj +-294 TJm +(the) 12.1743 Tj +-295 TJm +(miss) 18.2714 Tj +-294 TJm +(rate) 14.9339 Tj +72 618.381 Td +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-253 TJm +(been) 18.8094 Tj +-253 TJm +(observ) 26.5603 Tj +15 TJm +(ed) 9.40469 Tj +-253 TJm +(to) 7.7509 Tj +-253 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-253 TJm +(disproportionately) 73.0557 Tj +-253 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-253 TJm +(performance) 50.341 Tj +-253 TJm +(impro) 23.8007 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ements.) 30.7147 Tj +-639 TJm +(I) 3.31755 Tj +-253 TJm +(imagine) 32.0995 Tj +[1 0 0 1 438.909 618.381] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -438.909 -618.381] cm +[1 0 0 1 0 0] Tm +0 0 Td +438.909 618.381 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 468.796 618.381] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468.796 -618.381] cm +[1 0 0 1 0 0] Tm +0 0 Td +471.318 618.381 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-253 TJm +(perform) 32.0895 Tj +-253 TJm +(best) 16.0497 Tj +72 606.426 Td +(on) 9.9626 Tj +-250 TJm +(machines) 37.6287 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-250 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-250 TJm +(caches.) 29.041 Tj +[1 0 0 1 72 604.269] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -594.306] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 571.673 Td +/F122_0 20.6585 Tf +(2.8.) 34.4584 Tj +-278 TJm +(CA) 29.8309 Tj +80 TJm +(VEA) 42.4739 Tj +90 TJm +(TS) 26.4016 Tj +[1 0 0 1 72 571.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -561.452] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 549.755 Td +/F130_0 9.9626 Tf +(I/O) 13.2801 Tj +-268 TJm +(error) 19.3573 Tj +-267 TJm +(messages) 37.6287 Tj +-268 TJm +(are) 12.1643 Tj +-268 TJm +(not) 12.7322 Tj +-268 TJm +(as) 8.29885 Tj +-267 TJm +(helpful) 28.224 Tj +-268 TJm +(as) 8.29885 Tj +-268 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-267 TJm +(could) 22.1369 Tj +-268 TJm +(be.) 11.8953 Tj +[1 0 0 1 293.313 549.755] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -293.313 -549.755] cm +[1 0 0 1 0 0] Tm +0 0 Td +293.313 549.755 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 323.201 549.755] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -323.201 -549.755] cm +[1 0 0 1 0 0] Tm +0 0 Td +325.868 549.755 Td +/F130_0 9.9626 Tf +(tries) 17.1556 Tj +-268 TJm +(hard) 17.7035 Tj +-267 TJm +(to) 7.7509 Tj +-268 TJm +(detect) 23.7907 Tj +-268 TJm +(I/O) 13.2801 Tj +-268 TJm +(errors) 23.2328 Tj +-267 TJm +(and) 14.386 Tj +-268 TJm +(e) 4.42339 Tj +15 TJm +(xit) 10.5205 Tj +-268 TJm +(cleanly) 28.772 Tj +65 TJm +(,) 2.49065 Tj +-272 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-268 TJm +(the) 12.1743 Tj +72 537.8 Td +(details) 26.0123 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(what) 19.3673 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(problem) 33.2053 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(sometimes) 42.62 Tj +-250 TJm +(seem) 20.4731 Tj +-250 TJm +(rather) 23.2328 Tj +-250 TJm +(misleading.) 46.2165 Tj +[1 0 0 1 72 535.643] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -525.681] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 515.882 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-280 TJm +(manual) 29.3299 Tj +-279 TJm +(page) 18.8094 Tj +-280 TJm +(pertains) 31.5416 Tj +-280 TJm +(to) 7.7509 Tj +-279 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-280 TJm +(1.0.5) 19.9252 Tj +-280 TJm +(of) 8.29885 Tj +[1 0 0 1 256.84 515.882] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -256.84 -515.882] cm +[1 0 0 1 0 0] Tm +0 0 Td +256.84 515.882 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 286.728 515.882] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -286.728 -515.882] cm +[1 0 0 1 0 0] Tm +0 0 Td +286.728 515.882 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-798 TJm +(Compressed) 49.2551 Tj +-280 TJm +(data) 16.5977 Tj +-279 TJm +(created) 28.762 Tj +-280 TJm +(by) 9.9626 Tj +-280 TJm +(this) 14.396 Tj +-279 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-280 TJm +(is) 6.64505 Tj +-280 TJm +(entirely) 30.4357 Tj +-279 TJm +(forw) 18.8094 Tj +10 TJm +(ards) 16.5977 Tj +72 503.927 Td +(and) 14.386 Tj +-294 TJm +(backw) 26.0024 Tj +10 TJm +(ards) 16.5977 Tj +-293 TJm +(compatible) 44.2738 Tj +-294 TJm +(with) 17.7135 Tj +-294 TJm +(the) 12.1743 Tj +-293 TJm +(pre) 12.7222 Tj +25 TJm +(vious) 21.589 Tj +-294 TJm +(public) 24.9065 Tj +-294 TJm +(releases,) 34.0223 Tj +-304 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-294 TJm +(0.1pl2,) 27.6761 Tj +-305 TJm +(0.9.0) 19.9252 Tj +-293 TJm +(and) 14.386 Tj +-294 TJm +(0.9.5,) 22.4159 Tj +-305 TJm +(1.0.0,) 22.4159 Tj +-304 TJm +(1.0.1,) 22.4159 Tj +-305 TJm +(1.0.2) 19.9252 Tj +-294 TJm +(and) 14.386 Tj +72 491.972 Td +(1.0.3,) 22.4159 Tj +-263 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-260 TJm +(with) 17.7135 Tj +-260 TJm +(the) 12.1743 Tj +-260 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-260 TJm +(e) 4.42339 Tj +15 TJm +(xception:) 37.0808 Tj +-330 TJm +(0.9.0) 19.9252 Tj +-260 TJm +(and) 14.386 Tj +-260 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-260 TJm +(can) 13.8281 Tj +-260 TJm +(correctly) 35.4071 Tj +-260 TJm +(decompress) 47.0334 Tj +-260 TJm +(multiple) 33.2153 Tj +-260 TJm +(concatenated) 52.0048 Tj +-260 TJm +(compressed) 47.0334 Tj +72 480.017 Td +(\002les.) 19.0983 Tj +-310 TJm +(0.1pl2) 25.1855 Tj +-250 TJm +(cannot) 26.5603 Tj +-250 TJm +(do) 9.9626 Tj +-250 TJm +(this;) 17.1656 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(stop) 16.6077 Tj +-250 TJm +(after) 18.2515 Tj +-250 TJm +(decompressing) 59.7656 Tj +-250 TJm +(just) 14.396 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002rst) 15.5018 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 477.86] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -467.897] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 458.099 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 143.731 458.099] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -458.099] cm +[1 0 0 1 0 0] Tm +0 0 Td +146.174 458.099 Td +/F130_0 9.9626 Tf +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-245 TJm +(prior) 19.3673 Tj +-245 TJm +(to) 7.7509 Tj +-245 TJm +(1.0.2) 19.9252 Tj +-246 TJm +(used) 18.2614 Tj +-245 TJm +(32-bit) 23.8007 Tj +-245 TJm +(inte) 14.9439 Tj +15 TJm +(gers) 16.5977 Tj +-245 TJm +(to) 7.7509 Tj +-245 TJm +(represent) 36.5129 Tj +-245 TJm +(bit) 10.5205 Tj +-246 TJm +(positions) 35.9849 Tj +-245 TJm +(in) 7.7509 Tj +-245 TJm +(compressed) 47.0334 Tj +-245 TJm +(\002les,) 19.0983 Tj +-246 TJm +(so) 8.85675 Tj +-245 TJm +(it) 5.53921 Tj +-245 TJm +(could) 22.1369 Tj +72 446.144 Td +(not) 12.7322 Tj +-384 TJm +(handle) 26.5603 Tj +-383 TJm +(compressed) 47.0334 Tj +-384 TJm +(\002les) 16.6077 Tj +-383 TJm +(more) 20.4731 Tj +-384 TJm +(than) 17.1556 Tj +-383 TJm +(512) 14.9439 Tj +-384 TJm +(me) 12.1743 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(abytes) 25.4544 Tj +-383 TJm +(long.) 20.2042 Tj +-1421 TJm +(V) 7.193 Tj +111 TJm +(ersions) 28.224 Tj +-384 TJm +(1.0.2) 19.9252 Tj +-383 TJm +(and) 14.386 Tj +-384 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-384 TJm +(use) 13.2801 Tj +-383 TJm +(64-bit) 23.8007 Tj +-384 TJm +(ints) 14.396 Tj +-383 TJm +(on) 9.9626 Tj +-384 TJm +(some) 21.031 Tj +72 434.189 Td +(platforms) 38.1866 Tj +-245 TJm +(which) 24.3486 Tj +-246 TJm +(support) 29.8878 Tj +-245 TJm +(them) 19.9252 Tj +-246 TJm +(\(GNU) 24.8965 Tj +-245 TJm +(supported) 39.2925 Tj +-245 TJm +(tar) 10.5105 Tj +18 TJm +(gets,) 18.5404 Tj +-247 TJm +(and) 14.386 Tj +-245 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws\).) 16.8766 Tj +-309 TJm +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-245 TJm +(establish) 34.8691 Tj +-245 TJm +(whether) 32.0895 Tj +-246 TJm +(or) 8.29885 Tj +-245 TJm +(not) 12.7322 Tj +[1 0 0 1 468.269 434.189] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468.269 -434.189] cm +[1 0 0 1 0 0] Tm +0 0 Td +468.269 434.189 Td +/F134_0 9.9626 Tf +(bzip2recover) 71.7307 Tj +[1 0 0 1 540 434.189] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -434.189] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 422.233 Td +/F130_0 9.9626 Tf +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-255 TJm +(b) 4.9813 Tj +20 TJm +(uilt) 13.2901 Tj +-255 TJm +(with) 17.7135 Tj +-255 TJm +(such) 18.2614 Tj +-255 TJm +(a) 4.42339 Tj +-255 TJm +(limitation,) 41.2452 Tj +-256 TJm +(run) 13.2801 Tj +-255 TJm +(it) 5.53921 Tj +-255 TJm +(without) 30.4457 Tj +-255 TJm +(ar) 7.74094 Tj +18 TJm +(guments.) 36.2539 Tj +-325 TJm +(In) 8.29885 Tj +-255 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-256 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ent) 12.1743 Tj +-255 TJm +(you) 14.9439 Tj +-255 TJm +(can) 13.8281 Tj +-255 TJm +(b) 4.9813 Tj +20 TJm +(uild) 15.5018 Tj +-255 TJm +(yourself) 32.6474 Tj +-255 TJm +(an) 9.40469 Tj +-255 TJm +(unlimited) 38.1966 Tj +-255 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-255 TJm +(if) 6.08715 Tj +72 410.278 Td +(you) 14.9439 Tj +-250 TJm +(can) 13.8281 Tj +-250 TJm +(recompile) 39.8404 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 176.318 410.278] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.318 -410.278] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.318 410.278 Td +/F134_0 9.9626 Tf +(MaybeUInt64) 65.7532 Tj +[1 0 0 1 242.071 410.278] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -242.071 -410.278] cm +[1 0 0 1 0 0] Tm +0 0 Td +244.562 410.278 Td +/F130_0 9.9626 Tf +(set) 11.0684 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(unsigned) 35.9749 Tj +-250 TJm +(64-bit) 23.8007 Tj +-250 TJm +(inte) 14.9439 Tj +15 TJm +(ger) 12.7222 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 408.121] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -398.159] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 375.525 Td +/F122_0 20.6585 Tf +(2.9.) 34.4584 Tj +-278 TJm +(A) 14.9154 Tj +50 TJm +(UTHOR) 73.441 Tj +[1 0 0 1 72 375.267] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -365.305] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 353.608 Td +/F130_0 9.9626 Tf +(Julian) 23.8007 Tj +-250 TJm +(Se) 9.9626 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(ard,) 15.2129 Tj +[1 0 0 1 132.801 353.608] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -132.801 -353.608] cm +[1 0 0 1 0 0] Tm +0 0 Td +132.801 353.608 Td +/F134_0 9.9626 Tf +(jseward at bzip.org) 95.641 Tj +[1 0 0 1 228.443 353.608] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -156.443 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -342.111] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 331.69 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-299 TJm +(ideas) 20.4731 Tj +-300 TJm +(embodied) 39.2925 Tj +-299 TJm +(in) 7.7509 Tj +[1 0 0 1 166.942 331.69] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -166.942 -331.69] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.942 331.69 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 196.83 331.69] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.83 -331.69] cm +[1 0 0 1 0 0] Tm +0 0 Td +199.813 331.69 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-299 TJm +(due) 14.386 Tj +-300 TJm +(to) 7.7509 Tj +-299 TJm +(\(at) 10.5105 Tj +-300 TJm +(least\)) 21.579 Tj +-299 TJm +(the) 12.1743 Tj +-300 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-299 TJm +(people:) 29.3299 Tj +-409 TJm +(Michael) 32.6474 Tj +-300 TJm +(Burro) 23.2427 Tj +25 TJm +(ws) 11.0684 Tj +-299 TJm +(and) 14.386 Tj +-299 TJm +(Da) 11.6164 Tj +20 TJm +(vid) 12.7322 Tj +-300 TJm +(Wheeler) 33.7433 Tj +-299 TJm +(\(for) 14.9339 Tj +72 319.735 Td +(the) 12.1743 Tj +-312 TJm +(block) 22.1369 Tj +-313 TJm +(sorting) 27.6761 Tj +-312 TJm +(transformation\),) 64.468 Tj +-328 TJm +(Da) 11.6164 Tj +20 TJm +(vid) 12.7322 Tj +-312 TJm +(Wheeler) 33.7433 Tj +-313 TJm +(\(ag) 12.7222 Tj +5 TJm +(ain,) 14.6649 Tj +-327 TJm +(for) 11.6164 Tj +-313 TJm +(the) 12.1743 Tj +-312 TJm +(Huf) 15.4918 Tj +25 TJm +(fman) 20.4731 Tj +-312 TJm +(coder\),) 27.9351 Tj +-328 TJm +(Peter) 20.4731 Tj +-313 TJm +(Fenwick) 34.3112 Tj +-312 TJm +(\(for) 14.9339 Tj +-312 TJm +(the) 12.1743 Tj +-313 TJm +(structured) 39.8404 Tj +72 307.78 Td +(coding) 27.1182 Tj +-325 TJm +(model) 24.9065 Tj +-326 TJm +(in) 7.7509 Tj +-325 TJm +(the) 12.1743 Tj +-326 TJm +(original) 30.9936 Tj +[1 0 0 1 191.156 307.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -191.156 -307.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +191.156 307.779 Td +/F134_0 9.9626 Tf +(bzip) 23.9102 Tj +[1 0 0 1 215.067 307.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -215.067 -307.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +215.067 307.779 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-344 TJm +(and) 14.386 Tj +-326 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +-325 TJm +(re\002nements\),) 52.2937 Tj +-345 TJm +(and) 14.386 Tj +-325 TJm +(Alistair) 29.8878 Tj +-326 TJm +(Mof) 17.1556 Tj +25 TJm +(f) 3.31755 Tj +10 TJm +(at,) 9.68365 Tj +-344 TJm +(Radford) 32.6474 Tj +-325 TJm +(Neal) 18.8094 Tj +-326 TJm +(and) 14.386 Tj +-325 TJm +(Ian) 12.7222 Tj +-326 TJm +(W) 9.40469 Tj +40 TJm +(itten) 17.7135 Tj +-325 TJm +(\(for) 14.9339 Tj +72 295.824 Td +(the) 12.1743 Tj +-277 TJm +(arithmetic) 40.3983 Tj +-277 TJm +(coder) 22.1269 Tj +-277 TJm +(in) 7.7509 Tj +-277 TJm +(the) 12.1743 Tj +-277 TJm +(original) 30.9936 Tj +[1 0 0 1 214.171 295.824] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -214.171 -295.824] cm +[1 0 0 1 0 0] Tm +0 0 Td +214.171 295.824 Td +/F134_0 9.9626 Tf +(bzip) 23.9102 Tj +[1 0 0 1 238.082 295.824] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -238.082 -295.824] cm +[1 0 0 1 0 0] Tm +0 0 Td +238.082 295.824 Td +/F130_0 9.9626 Tf +(\).) 5.8082 Tj +-782 TJm +(I) 3.31755 Tj +-277 TJm +(am) 12.1743 Tj +-276 TJm +(much) 22.1369 Tj +-277 TJm +(indebted) 34.3112 Tj +-277 TJm +(for) 11.6164 Tj +-277 TJm +(their) 18.2614 Tj +-277 TJm +(help,) 19.6462 Tj +-284 TJm +(support) 29.8878 Tj +-277 TJm +(and) 14.386 Tj +-277 TJm +(advice.) 28.493 Tj +-781 TJm +(See) 14.386 Tj +-277 TJm +(the) 12.1743 Tj +-277 TJm +(manual) 29.3299 Tj +72 283.869 Td +(in) 7.7509 Tj +-330 TJm +(the) 12.1743 Tj +-330 TJm +(source) 26.0024 Tj +-330 TJm +(distrib) 25.4644 Tj +20 TJm +(ution) 20.4831 Tj +-330 TJm +(for) 11.6164 Tj +-329 TJm +(pointers) 32.0995 Tj +-330 TJm +(to) 7.7509 Tj +-330 TJm +(sources) 29.8778 Tj +-330 TJm +(of) 8.29885 Tj +-330 TJm +(documentation.) 61.7083 Tj +-1099 TJm +(Christian) 36.5329 Tj +-330 TJm +(v) 4.9813 Tj +20 TJm +(on) 9.9626 Tj +-330 TJm +(Roques) 29.8878 Tj +-330 TJm +(encouraged) 45.9176 Tj +-330 TJm +(me) 12.1743 Tj +-330 TJm +(to) 7.7509 Tj +-330 TJm +(look) 17.7135 Tj +72 271.914 Td +(for) 11.6164 Tj +-271 TJm +(f) 3.31755 Tj +10 TJm +(aster) 18.8094 Tj +-271 TJm +(sorting) 27.6761 Tj +-271 TJm +(algorithms,) 45.1107 Tj +-276 TJm +(so) 8.85675 Tj +-272 TJm +(as) 8.29885 Tj +-271 TJm +(to) 7.7509 Tj +-271 TJm +(speed) 22.6848 Tj +-271 TJm +(up) 9.9626 Tj +-271 TJm +(compression.) 52.8516 Tj +-746 TJm +(Bela) 18.2614 Tj +-271 TJm +(Lubkin) 28.782 Tj +-271 TJm +(encouraged) 45.9176 Tj +-271 TJm +(me) 12.1743 Tj +-272 TJm +(to) 7.7509 Tj +-271 TJm +(impro) 23.8007 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-271 TJm +(the) 12.1743 Tj +-271 TJm +(w) 7.193 Tj +10 TJm +(orst-case) 35.4071 Tj +72 259.959 Td +(compression) 50.3609 Tj +-340 TJm +(performance.) 52.8317 Tj +-580 TJm +(Donna) 26.5603 Tj +-339 TJm +(Robinson) 38.1966 Tj +-340 TJm +(XMLised) 38.1866 Tj +-340 TJm +(the) 12.1743 Tj +-340 TJm +(documentation.) 61.7083 Tj +-580 TJm +(Man) 18.2614 Tj +15 TJm +(y) 4.9813 Tj +-340 TJm +(people) 26.5603 Tj +-340 TJm +(sent) 16.0497 Tj +-339 TJm +(patches,) 32.3685 Tj +-363 TJm +(helped) 26.5603 Tj +-340 TJm +(with) 17.7135 Tj +72 248.004 Td +(portability) 41.5142 Tj +-250 TJm +(problems,) 39.5714 Tj +-250 TJm +(lent) 14.9439 Tj +-250 TJm +(machines,) 40.1194 Tj +-250 TJm +(g) 4.9813 Tj +5 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(advice) 26.0024 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(were) 19.3573 Tj +-250 TJm +(generally) 37.0708 Tj +-250 TJm +(helpful.) 30.7147 Tj +[1 0 0 1 72 245.847] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -194.995] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.5851] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.4855] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.332 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +539.395 50.9514 Td +/F130_0 9.9626 Tf +(7) 4.9813 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 11 11 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 141.643 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -141.643 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0365 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 701.916 Td +/F122_0 24.7902 Tf +(3.) 20.675 Tj +-556 TJm +(Pr) 26.1785 Tj +20 TJm +(ogramming) 134.983 Tj +-278 TJm +(with) 49.5804 Tj +[1 0 0 1 330.484 701.916] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -330.484 -701.916] cm +[1 0 0 1 0 0] Tm +0 0 Td +330.484 701.916 Td +/F392_0 24.7902 Tf +(libbzip2) 118.993 Tj +[1 0 0 1 449.477 701.916] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -377.477 -5.5156] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -14.9439] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -671.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 656.35 Td +/F122_0 17.2154 Tf +(T) 10.5186 Tj +80 TJm +(ab) 20.0904 Tj +10 TJm +(le) 14.3576 Tj +-278 TJm +(of) 16.2513 Tj +-278 TJm +(Contents) 74.5943 Tj +[1 0 0 1 72 647.528] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.7401] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 635.788 Td +/F130_0 9.9626 Tf +(3.1.) 14.9439 Tj +-310 TJm +(T) 6.08715 Tj +80 TJm +(op-le) 20.4731 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(structure) 34.8591 Tj +[1 0 0 1 164.921 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.902 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.997 635.788 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -635.788] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 635.788 Td +/F130_0 9.9626 Tf +(8) 4.9813 Tj +[1 0 0 1 516.09 635.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 623.832 Td +/F130_0 9.9626 Tf +(3.1.1.) 22.4159 Tj +-310 TJm +(Lo) 11.0684 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 177.374 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -182.355 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.866 623.832 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -623.832] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 623.832 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 623.832] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 611.877 Td +/F130_0 9.9626 Tf +(3.1.2.) 22.4159 Tj +-310 TJm +(High-le) 30.4357 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 179.287 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -184.268 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.822 611.877 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -611.877] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 611.877 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 611.877] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 599.922 Td +/F130_0 9.9626 Tf +(3.1.3.) 22.4159 Tj +-310 TJm +(Utility) 26.0223 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(summary) 37.0808 Tj +[1 0 0 1 202.669 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -207.65 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.582 599.922 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 511.108 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.108 -599.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.108 599.922 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 516.09 599.922] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 587.967 Td +/F130_0 9.9626 Tf +(3.2.) 14.9439 Tj +-310 TJm +(Error) 21.0211 Tj +-250 TJm +(handling) 34.8691 Tj +[1 0 0 1 148.413 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -153.394 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +162.611 587.967 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -587.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 587.967 Td +/F130_0 9.9626 Tf +(10) 9.9626 Tj +[1 0 0 1 516.09 587.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 576.012 Td +/F130_0 9.9626 Tf +(3.3.) 14.9439 Tj +-310 TJm +(Lo) 11.0684 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +[1 0 0 1 167.571 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -172.552 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.045 576.012 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -576.012] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 576.012 Td +/F130_0 9.9626 Tf +(11) 9.9626 Tj +[1 0 0 1 516.09 576.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -0.0995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.8557] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 564.056 Td +/F130_0 9.9626 Tf +(3.3.1.) 22.4159 Tj +[1 0 0 1 97.5043 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 564.056 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 205.101 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.082 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +219.736 564.056 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -564.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 564.056 Td +/F130_0 9.9626 Tf +(11) 9.9626 Tj +[1 0 0 1 516.09 564.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 552.101 Td +/F130_0 9.9626 Tf +(3.3.2.) 22.4159 Tj +[1 0 0 1 97.5043 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 552.101 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 181.19 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -186.172 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.497 552.101 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -552.101] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 552.101 Td +/F130_0 9.9626 Tf +(13) 9.9626 Tj +[1 0 0 1 516.09 552.101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 540.146 Td +/F130_0 9.9626 Tf +(3.3.3.) 22.4159 Tj +[1 0 0 1 97.5043 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 540.146 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 199.123 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.105 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +214.533 540.146 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -540.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 540.146 Td +/F130_0 9.9626 Tf +(16) 9.9626 Tj +[1 0 0 1 516.09 540.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -528.191] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 528.191 Td +/F130_0 9.9626 Tf +(3.3.4.) 22.4159 Tj +[1 0 0 1 97.5043 528.191] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -528.191] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 528.191 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 217.056 528.191] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -222.037 -528.191] cm +[1 0 0 1 0 0] Tm +0 0 Td +232.355 528.191 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 528.191] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -528.191] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 528.191 Td +/F130_0 9.9626 Tf +(16) 9.9626 Tj +[1 0 0 1 516.09 528.191] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -516.236] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 516.236 Td +/F130_0 9.9626 Tf +(3.3.5.) 22.4159 Tj +[1 0 0 1 97.5043 516.236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -516.236] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 516.236 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 193.146 516.236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.127 -516.236] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.116 516.236 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 516.236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -516.236] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 516.236 Td +/F130_0 9.9626 Tf +(17) 9.9626 Tj +[1 0 0 1 516.09 516.236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -504.281] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 504.281 Td +/F130_0 9.9626 Tf +(3.3.6.) 22.4159 Tj +[1 0 0 1 97.5043 504.281] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -504.281] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 504.281 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 211.078 504.281] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.06 -504.281] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.938 504.281 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 504.281] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -504.281] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 504.281 Td +/F130_0 9.9626 Tf +(18) 9.9626 Tj +[1 0 0 1 516.09 504.281] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -492.325] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 492.325 Td +/F130_0 9.9626 Tf +(3.4.) 14.9439 Tj +-310 TJm +(High-le) 30.4357 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +[1 0 0 1 169.483 492.325] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -174.465 -492.325] cm +[1 0 0 1 0 0] Tm +0 0 Td +184.216 492.325 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 492.325] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -492.325] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 492.325 Td +/F130_0 9.9626 Tf +(18) 9.9626 Tj +[1 0 0 1 516.09 492.325] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -480.37] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 480.37 Td +/F130_0 9.9626 Tf +(3.4.1.) 22.4159 Tj +[1 0 0 1 97.5043 480.37] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -480.37] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 480.37 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 181.19 480.37] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -186.172 -480.37] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.497 480.37 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 480.37] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -480.37] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 480.37 Td +/F130_0 9.9626 Tf +(19) 9.9626 Tj +[1 0 0 1 516.09 480.37] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -468.415] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 468.415 Td +/F130_0 9.9626 Tf +(3.4.2.) 22.4159 Tj +[1 0 0 1 97.5043 468.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -468.415] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 468.415 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 157.28 468.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -162.261 -468.415] cm +[1 0 0 1 0 0] Tm +0 0 Td +171.472 468.415 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 468.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -468.415] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 468.415 Td +/F130_0 9.9626 Tf +(20) 9.9626 Tj +[1 0 0 1 516.09 468.415] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -456.46] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 456.46 Td +/F130_0 9.9626 Tf +(3.4.3.) 22.4159 Tj +[1 0 0 1 97.5043 456.46] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -456.46] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 456.46 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 211.078 456.46] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.06 -456.46] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.938 456.46 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 456.46] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -456.46] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 456.46 Td +/F130_0 9.9626 Tf +(21) 9.9626 Tj +[1 0 0 1 516.09 456.46] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -444.505] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 444.505 Td +/F130_0 9.9626 Tf +(3.4.4.) 22.4159 Tj +[1 0 0 1 97.5043 444.505] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -444.505] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 444.505 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 187.168 444.505] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.149 -444.505] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.914 444.505 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 444.505] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -444.505] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 444.505 Td +/F130_0 9.9626 Tf +(22) 9.9626 Tj +[1 0 0 1 516.09 444.505] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6451] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -432.55] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 432.55 Td +/F130_0 9.9626 Tf +(3.4.5.) 22.4159 Tj +[1 0 0 1 97.5043 432.55] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -432.55] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 432.55 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 187.168 432.55] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.149 -432.55] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.914 432.55 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 432.55] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -432.55] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 432.55 Td +/F130_0 9.9626 Tf +(22) 9.9626 Tj +[1 0 0 1 516.09 432.55] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -420.594] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 420.594 Td +/F130_0 9.9626 Tf +(3.4.6.) 22.4159 Tj +[1 0 0 1 97.5043 420.594] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -420.594] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 420.594 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 163.258 420.594] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -168.239 -420.594] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.675 420.594 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 420.594] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -420.594] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 420.594 Td +/F130_0 9.9626 Tf +(23) 9.9626 Tj +[1 0 0 1 516.09 420.594] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6452] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -408.639] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 408.639 Td +/F130_0 9.9626 Tf +(3.4.7.) 22.4159 Tj +[1 0 0 1 97.5043 408.639] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -408.639] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 408.639 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 193.146 408.639] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.127 -408.639] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.116 408.639 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 408.639] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -408.639] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 408.639 Td +/F130_0 9.9626 Tf +(23) 9.9626 Tj +[1 0 0 1 516.09 408.639] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.6451] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -396.684] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 396.684 Td +/F130_0 9.9626 Tf +(3.4.8.) 22.4159 Tj +-310 TJm +(Handling) 37.0808 Tj +-250 TJm +(embedded) 40.9463 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(streams) 30.4357 Tj +[1 0 0 1 279.56 396.684] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -284.541 -396.684] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.601 396.684 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 396.684] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -396.684] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 396.684 Td +/F130_0 9.9626 Tf +(24) 9.9626 Tj +[1 0 0 1 516.09 396.684] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -384.729] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 384.729 Td +/F130_0 9.9626 Tf +(3.4.9.) 22.4159 Tj +-310 TJm +(Standard) 35.417 Tj +-250 TJm +(\002le-reading/writing) 77.4791 Tj +-250 TJm +(code) 18.8094 Tj +[1 0 0 1 234.19 384.729] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -239.172 -384.729] cm +[1 0 0 1 0 0] Tm +0 0 Td +247.564 384.729 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 384.729] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -384.729] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 384.729 Td +/F130_0 9.9626 Tf +(25) 9.9626 Tj +[1 0 0 1 516.09 384.729] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -372.774] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 372.774 Td +/F130_0 9.9626 Tf +(3.5.) 14.9439 Tj +-310 TJm +(Utility) 26.0223 Tj +-250 TJm +(functions) 37.0808 Tj +[1 0 0 1 155.625 372.774] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -160.607 -372.774] cm +[1 0 0 1 0 0] Tm +0 0 Td +170.645 372.774 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 372.774] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -372.774] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 372.774 Td +/F130_0 9.9626 Tf +(26) 9.9626 Tj +[1 0 0 1 516.09 372.774] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -360.819] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 360.819 Td +/F130_0 9.9626 Tf +(3.5.1.) 22.4159 Tj +[1 0 0 1 97.5043 360.819] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -360.819] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 360.819 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffCompress) 143.461 Tj +[1 0 0 1 240.966 360.819] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.948 -360.819] cm +[1 0 0 1 0 0] Tm +0 0 Td +255.38 360.819 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 360.819] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -360.819] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 360.819 Td +/F130_0 9.9626 Tf +(26) 9.9626 Tj +[1 0 0 1 516.09 360.819] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -348.863] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 348.863 Td +/F130_0 9.9626 Tf +(3.5.2.) 22.4159 Tj +[1 0 0 1 97.5043 348.863] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -97.5043 -348.863] cm +[1 0 0 1 0 0] Tm +0 0 Td +97.5043 348.863 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 252.922 348.863] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -257.903 -348.863] cm +[1 0 0 1 0 0] Tm +0 0 Td +267.999 348.863 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 348.863] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -348.863] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 348.863 Td +/F130_0 9.9626 Tf +(27) 9.9626 Tj +[1 0 0 1 516.09 348.863] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -1.5342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -10.421] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -336.908] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 336.908 Td +/F130_0 9.9626 Tf +(3.6.) 14.9439 Tj +[1 0 0 1 90.0324 336.908] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90.0324 -336.908] cm +[1 0 0 1 0 0] Tm +0 0 Td +90.0324 336.908 Td +/F134_0 9.9626 Tf +(zlib) 23.9102 Tj +[1 0 0 1 113.943 336.908] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.943 -336.908] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.433 336.908 Td +/F130_0 9.9626 Tf +(compatibility) 53.1405 Tj +-250 TJm +(functions) 37.0808 Tj +[1 0 0 1 209.144 336.908] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -214.126 -336.908] cm +[1 0 0 1 0 0] Tm +0 0 Td +223.971 336.908 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 336.908] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -336.908] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 336.908 Td +/F130_0 9.9626 Tf +(28) 9.9626 Tj +[1 0 0 1 516.09 336.908] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -324.953] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 324.953 Td +/F130_0 9.9626 Tf +(3.7.) 14.9439 Tj +-310 TJm +(Using) 23.8007 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +[1 0 0 1 177.195 324.953] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.195 -324.953] cm +[1 0 0 1 0 0] Tm +0 0 Td +177.195 324.953 Td +/F134_0 9.9626 Tf +(stdio) 29.8878 Tj +[1 0 0 1 207.083 324.953] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -207.083 -324.953] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.083 324.953 Td +/F130_0 9.9626 Tf +(-free) 18.7994 Tj +-250 TJm +(en) 9.40469 Tj +40 TJm +(vironment) 40.9562 Tj +[1 0 0 1 278.335 324.953] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -283.316 -324.953] cm +[1 0 0 1 0 0] Tm +0 0 Td +291.775 324.953 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 324.953] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -324.953] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 324.953 Td +/F130_0 9.9626 Tf +(28) 9.9626 Tj +[1 0 0 1 516.09 324.953] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -312.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 312.998 Td +/F130_0 9.9626 Tf +(3.7.1.) 22.4159 Tj +-310 TJm +(Getting) 29.8878 Tj +-250 TJm +(rid) 11.0684 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 154.231 312.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -154.231 -312.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +154.231 312.998 Td +/F134_0 9.9626 Tf +(stdio) 29.8878 Tj +[1 0 0 1 184.119 312.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -189.1 -312.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +198.175 312.998 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 312.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -312.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 312.998 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 312.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -301.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 301.043 Td +/F130_0 9.9626 Tf +(3.7.2.) 22.4159 Tj +-310 TJm +(Critical) 29.8878 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(handling) 34.8691 Tj +[1 0 0 1 186.599 301.043] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -191.58 -301.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.629 301.043 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 301.043] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -301.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 301.043 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 301.043] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -289.088] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 289.088 Td +/F130_0 9.9626 Tf +(3.8.) 14.9439 Tj +-310 TJm +(Making) 30.9936 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws) 11.0684 Tj +-250 TJm +(DLL) 19.3673 Tj +[1 0 0 1 189.828 289.088] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -194.809 -289.088] cm +[1 0 0 1 0 0] Tm +0 0 Td +203.243 289.088 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 289.088] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -289.088] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 289.088 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 516.09 289.088] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1569] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -267.006] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 257.207 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-250 TJm +(chapter) 29.3199 Tj +-250 TJm +(describes) 37.0708 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(programming) 54.2364 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 282.448 257.207] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -282.448 -257.207] cm +[1 0 0 1 0 0] Tm +0 0 Td +282.448 257.207 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 330.269 257.207] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -330.269 -257.207] cm +[1 0 0 1 0 0] Tm +0 0 Td +330.269 257.207 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 255.05] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -245.088] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 235.289 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-273 TJm +(general) 29.3199 Tj +-272 TJm +(background) 47.0334 Tj +-273 TJm +(information,) 49.534 Tj +-278 TJm +(particularly) 45.9276 Tj +-273 TJm +(about) 22.1369 Tj +-273 TJm +(memory) 33.2053 Tj +-272 TJm +(use) 13.2801 Tj +-273 TJm +(and) 14.386 Tj +-273 TJm +(performance) 50.341 Tj +-272 TJm +(aspects,) 31.2626 Tj +-279 TJm +(you') 18.2614 Tj +50 TJm +(d) 4.9813 Tj +-272 TJm +(be) 9.40469 Tj +-273 TJm +(well) 17.1556 Tj +-273 TJm +(advised) 30.4357 Tj +72 223.334 Td +(to) 7.7509 Tj +-250 TJm +(read) 17.1456 Tj +[1 0 0 1 101.878 223.334] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -101.878 -223.334] cm +[1 0 0 1 0 0] Tm +0 0 Td +101.878 223.334 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 171.636 223.334] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -171.636 -223.334] cm +[1 0 0 1 0 0] Tm +0 0 Td +174.126 223.334 Td +/F130_0 9.9626 Tf +([2]) 11.6164 Tj +[1 0 0 1 185.743 223.334] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -185.743 -223.334] cm +[1 0 0 1 0 0] Tm +0 0 Td +188.233 223.334 Td +/F130_0 9.9626 Tf +(as) 8.29885 Tj +-250 TJm +(well.) 19.6462 Tj +[1 0 0 1 72 221.177] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -211.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 188.581 Td +/F122_0 20.6585 Tf +(3.1.) 34.4584 Tj +-278 TJm +(T) 12.6223 Tj +80 TJm +(op-le) 49.3532 Tj +15 TJm +(vel) 28.7153 Tj +-278 TJm +(structure) 89.5339 Tj +[1 0 0 1 72 184.305] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -174.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 166.664 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 119.821 166.664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.821 -166.664] cm +[1 0 0 1 0 0] Tm +0 0 Td +123.608 166.664 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-380 TJm +(a) 4.42339 Tj +-380 TJm +(\003e) 9.9626 Tj +15 TJm +(xible) 19.9252 Tj +-381 TJm +(library) 26.5603 Tj +-380 TJm +(for) 11.6164 Tj +-380 TJm +(compressing) 50.3609 Tj +-380 TJm +(and) 14.386 Tj +-380 TJm +(decompressing) 59.7656 Tj +-380 TJm +(data) 16.5977 Tj +-381 TJm +(in) 7.7509 Tj +-380 TJm +(the) 12.1743 Tj +[1 0 0 1 405.291 166.664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -405.291 -166.664] cm +[1 0 0 1 0 0] Tm +0 0 Td +405.291 166.664 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 435.178 166.664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -435.178 -166.664] cm +[1 0 0 1 0 0] Tm +0 0 Td +438.966 166.664 Td +/F130_0 9.9626 Tf +(data) 16.5977 Tj +-380 TJm +(format.) 29.0509 Tj +-1401 TJm +(Although) 37.6387 Tj +72 154.708 Td +(packaged) 37.6188 Tj +-285 TJm +(as) 8.29885 Tj +-284 TJm +(a) 4.42339 Tj +-285 TJm +(single) 23.8007 Tj +-285 TJm +(entity) 22.6948 Tj +65 TJm +(,) 2.49065 Tj +-293 TJm +(it) 5.53921 Tj +-285 TJm +(helps) 21.031 Tj +-285 TJm +(to) 7.7509 Tj +-284 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(ard) 12.7222 Tj +-285 TJm +(the) 12.1743 Tj +-285 TJm +(library) 26.5603 Tj +-284 TJm +(as) 8.29885 Tj +-285 TJm +(three) 19.9152 Tj +-285 TJm +(separate) 32.6375 Tj +-284 TJm +(parts:) 22.1369 Tj +-380 TJm +(the) 12.1743 Tj +-285 TJm +(lo) 7.7509 Tj +25 TJm +(w) 7.193 Tj +-284 TJm +(le) 7.193 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-285 TJm +(interf) 21.579 Tj +10 TJm +(ace,) 15.7608 Tj +-293 TJm +(and) 14.386 Tj +-285 TJm +(the) 12.1743 Tj +-285 TJm +(high) 17.7135 Tj +72 142.753 Td +(le) 7.193 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace,) 15.7608 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(utility) 23.8106 Tj +-250 TJm +(functions.) 39.5714 Tj +[1 0 0 1 72 140.596] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -130.634] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 120.835 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-349 TJm +(structure) 34.8591 Tj +-349 TJm +(of) 8.29885 Tj +[1 0 0 1 141.082 120.835] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -141.082 -120.835] cm +[1 0 0 1 0 0] Tm +0 0 Td +141.082 120.835 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 188.903 120.835] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -188.903 -120.835] cm +[1 0 0 1 0 0] Tm +0 0 Td +188.903 120.835 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +55 TJm +(s) 3.87545 Tj +-349 TJm +(interf) 21.579 Tj +10 TJm +(aces) 17.1456 Tj +-349 TJm +(is) 6.64505 Tj +-349 TJm +(similar) 27.6761 Tj +-349 TJm +(to) 7.7509 Tj +-349 TJm +(that) 14.9439 Tj +-349 TJm +(of) 8.29885 Tj +-349 TJm +(Jean-loup) 38.7346 Tj +-349 TJm +(Gailly') 28.224 Tj +55 TJm +(s) 3.87545 Tj +-349 TJm +(and) 14.386 Tj +-349 TJm +(Mark) 21.579 Tj +-349 TJm +(Adler') 26.0024 Tj +55 TJm +(s) 3.87545 Tj +-349 TJm +(e) 4.42339 Tj +15 TJm +(xcellent) 31.5416 Tj +[1 0 0 1 516.09 120.835] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -516.09 -120.835] cm +[1 0 0 1 0 0] Tm +0 0 Td +516.09 120.835 Td +/F134_0 9.9626 Tf +(zlib) 23.9102 Tj +[1 0 0 1 540 120.835] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -120.835] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 108.88 Td +/F130_0 9.9626 Tf +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 106.723] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -96.7608] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 86.9624 Td +/F130_0 9.9626 Tf +(All) 12.7322 Tj +-242 TJm +(e) 4.42339 Tj +15 TJm +(xternally) 35.417 Tj +-242 TJm +(visible) 26.5703 Tj +-241 TJm +(symbols) 33.2153 Tj +-242 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-242 TJm +(names) 25.4544 Tj +-242 TJm +(be) 9.40469 Tj +15 TJm +(ginning) 30.4457 Tj +[1 0 0 1 284.687 86.9624] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -284.687 -86.9624] cm +[1 0 0 1 0 0] Tm +0 0 Td +284.687 86.9624 Td +/F134_0 9.9626 Tf +(BZ2_) 23.9102 Tj +[1 0 0 1 308.597 86.9624] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -308.597 -86.9624] cm +[1 0 0 1 0 0] Tm +0 0 Td +308.597 86.9624 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-615 TJm +(This) 17.7135 Tj +-241 TJm +(is) 6.64505 Tj +-242 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-242 TJm +(in) 7.7509 Tj +-242 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-242 TJm +(1.0.) 14.9439 Tj +-614 TJm +(The) 15.4918 Tj +-242 TJm +(intention) 35.427 Tj +-242 TJm +(is) 6.64505 Tj +-241 TJm +(to) 7.7509 Tj +-242 TJm +(minimise) 37.0908 Tj +72 75.0073 Td +(pollution) 35.9849 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(namespaces) 47.5814 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(clients.) 28.503 Tj +[1 0 0 1 72 72.8505] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.9987] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -498.225 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +541.288 50.9514 Td +/F130_0 9.9626 Tf +(8) 4.9813 Tj +[1 0 0 1 455.161 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5986 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0366 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 12 12 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -344.462 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +420.96 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 498.449 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -498.449 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.449 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 546.269 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0365 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(part) 15.4918 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(need) 18.8094 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 240.567 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.567 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +240.567 710.037 Td +/F134_0 9.9626 Tf +(#include) 47.8205 Tj +-600 TJm +() 53.798 Tj +[1 0 0 1 348.163 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -348.163 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +350.654 710.037 Td +/F130_0 9.9626 Tf +(into) 15.5018 Tj +-250 TJm +(your) 18.2614 Tj +-250 TJm +(sources.) 32.3685 Tj +[1 0 0 1 72 707.88] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -697.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 679.416 Td +/F122_0 17.2154 Tf +(3.1.1.) 43.0729 Tj +-278 TJm +(Lo) 21.0372 Tj +15 TJm +(w-le) 33.484 Tj +15 TJm +(vel) 23.9294 Tj +-278 TJm +(summar) 66.9679 Tj +-10 TJm +(y) 9.57176 Tj +[1 0 0 1 72 675.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -665.89] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 657.498 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-212 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-212 TJm +(pro) 13.2801 Tj +15 TJm +(vides) 21.031 Tj +-212 TJm +(services) 32.0895 Tj +-212 TJm +(for) 11.6164 Tj +-212 TJm +(compressing) 50.3609 Tj +-212 TJm +(and) 14.386 Tj +-212 TJm +(decompress) 47.0334 Tj +1 TJm +(ing) 12.7322 Tj +-212 TJm +(data) 16.5977 Tj +-212 TJm +(in) 7.7509 Tj +-212 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +-595 TJm +(There') 26.5503 Tj +55 TJm +(s) 3.87545 Tj +-212 TJm +(no) 9.9626 Tj +-212 TJm +(pro) 13.2801 Tj +15 TJm +(vision) 24.3586 Tj +-212 TJm +(for) 11.6164 Tj +-212 TJm +(dealing) 29.3299 Tj +72 645.543 Td +(with) 17.7135 Tj +-213 TJm +(\002les,) 19.0983 Tj +-220 TJm +(streams) 30.4357 Tj +-213 TJm +(or) 8.29885 Tj +-213 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-213 TJm +(other) 20.4731 Tj +-213 TJm +(I/O) 13.2801 Tj +-213 TJm +(mechanisms,) 51.7457 Tj +-221 TJm +(just) 14.396 Tj +-213 TJm +(straight) 29.8878 Tj +-213 TJm +(memory-to-memory) 80.7967 Tj +-213 TJm +(w) 7.193 Tj +10 TJm +(ork.) 15.7708 Tj +-595 TJm +(In) 8.29885 Tj +-213 TJm +(f) 3.31755 Tj +10 TJm +(act,) 14.107 Tj +-221 TJm +(this) 14.396 Tj +-213 TJm +(part) 15.4918 Tj +-213 TJm +(of) 8.29885 Tj +-213 TJm +(the) 12.1743 Tj +-213 TJm +(library) 26.5603 Tj +72 633.588 Td +(can) 13.8281 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(compiled) 37.0808 Tj +-250 TJm +(without) 30.4457 Tj +-250 TJm +(inclusion) 36.5329 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 222.534 633.588] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -222.534 -633.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +222.534 633.588 Td +/F134_0 9.9626 Tf +(stdio.h) 41.8429 Tj +[1 0 0 1 264.377 633.588] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -264.377 -633.588] cm +[1 0 0 1 0 0] Tm +0 0 Td +264.377 633.588 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(may) 17.1556 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(helpful) 28.224 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(embedded) 40.9463 Tj +-250 TJm +(applications.) 50.6399 Tj +[1 0 0 1 72 631.431] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -621.469] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 611.67 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(part) 15.4918 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(no) 9.9626 Tj +-250 TJm +(global) 24.9065 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(ariables) 30.9837 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(therefore) 35.955 Tj +-250 TJm +(thread-safe.) 46.7445 Tj +[1 0 0 1 72 609.513] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -599.551] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 589.752 Td +/F130_0 9.9626 Tf +(Six) 13.2901 Tj +-875 TJm +(routines) 32.0995 Tj +-876 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-875 TJm +(up) 9.9626 Tj +-876 TJm +(the) 12.1743 Tj +-875 TJm +(lo) 7.7509 Tj +25 TJm +(w) 7.193 Tj +-876 TJm +(le) 7.193 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-875 TJm +(interf) 21.579 Tj +10 TJm +(ace:) 16.0398 Tj +[1 0 0 1 308.791 589.752] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -308.791 -589.752] cm +[1 0 0 1 0 0] Tm +0 0 Td +308.791 589.752 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 416.387 589.752] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -416.387 -589.752] cm +[1 0 0 1 0 0] Tm +0 0 Td +416.387 589.752 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 429.158 589.752] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -429.158 -589.752] cm +[1 0 0 1 0 0] Tm +0 0 Td +429.158 589.752 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 512.844 589.752] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -512.844 -589.752] cm +[1 0 0 1 0 0] Tm +0 0 Td +512.844 589.752 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-1032 TJm +(and) 14.386 Tj +[1 0 0 1 72 577.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -577.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 577.797 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 173.619 577.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -173.619 -577.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +186.15 577.797 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-1258 TJm +(compression,) 52.8516 Tj +-1510 TJm +(and) 14.386 Tj +-1257 TJm +(a) 4.42339 Tj +-1258 TJm +(corresponding) 56.996 Tj +-1258 TJm +(trio) 13.8381 Tj +[1 0 0 1 417.958 577.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -417.958 -577.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +417.958 577.797 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 537.509 577.797] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -577.797] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 577.797 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 72 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 565.842 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 167.641 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.641 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.707 565.842 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 192.158 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.158 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.158 565.842 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 305.732 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -305.732 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +310.798 565.842 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-508 TJm +(decompression.) 62.2563 Tj +-2171 TJm +(The) 15.4918 Tj +[1 0 0 1 431.918 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -431.918 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +431.918 564.099 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +437.895 565.842 Td +(Init) 23.9102 Tj +[1 0 0 1 461.805 565.842] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -461.805 -565.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +466.871 565.842 Td +/F130_0 9.9626 Tf +(functions) 37.0808 Tj +-508 TJm +(allocate) 30.9837 Tj +72 553.887 Td +(memory) 33.2053 Tj +-574 TJm +(for) 11.6164 Tj +-573 TJm +(compression/decompression) 112.896 Tj +-574 TJm +(and) 14.386 Tj +-574 TJm +(do) 9.9626 Tj +-573 TJm +(other) 20.4731 Tj +-574 TJm +(initialisations,) 56.1891 Tj +-654 TJm +(whilst) 24.3586 Tj +-574 TJm +(the) 12.1743 Tj +[1 0 0 1 419.502 553.887] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -419.502 -553.887] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.502 552.144 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +425.48 553.887 Td +(End) 17.9327 Tj +[1 0 0 1 443.413 553.887] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -443.413 -553.887] cm +[1 0 0 1 0 0] Tm +0 0 Td +449.128 553.887 Td +/F130_0 9.9626 Tf +(functions) 37.0808 Tj +-574 TJm +(close) 20.4731 Tj +-573 TJm +(do) 9.9626 Tj +25 TJm +(wn) 12.1743 Tj +72 541.932 Td +(operations) 41.5042 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(release) 27.6562 Tj +-250 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 539.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -529.812] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 520.014 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-303 TJm +(real) 14.9339 Tj +-303 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-303 TJm +(is) 6.64505 Tj +-303 TJm +(done) 19.3673 Tj +-303 TJm +(by) 9.9626 Tj +[1 0 0 1 176.892 520.014] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.892 -520.014] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.892 520.014 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 260.578 520.014] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -260.578 -520.014] cm +[1 0 0 1 0 0] Tm +0 0 Td +263.598 520.014 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 281.003 520.014] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -281.003 -520.014] cm +[1 0 0 1 0 0] Tm +0 0 Td +281.003 520.014 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 376.645 520.014] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -376.645 -520.014] cm +[1 0 0 1 0 0] Tm +0 0 Td +376.645 520.014 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-939 TJm +(These) 23.7907 Tj +-303 TJm +(compress) 37.6287 Tj +-303 TJm +(and) 14.386 Tj +-303 TJm +(decompress) 47.0334 Tj +-303 TJm +(data) 16.5977 Tj +72 508.059 Td +(from) 19.3673 Tj +-205 TJm +(a) 4.42339 Tj +-205 TJm +(user) 16.5977 Tj +20 TJm +(-supplied) 37.0808 Tj +-205 TJm +(input) 20.4831 Tj +-206 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-205 TJm +(to) 7.7509 Tj +-205 TJm +(a) 4.42339 Tj +-205 TJm +(user) 16.5977 Tj +20 TJm +(-supplied) 37.0808 Tj +-205 TJm +(output) 25.4644 Tj +-205 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +55 TJm +(.) 2.49065 Tj +-591 TJm +(These) 23.7907 Tj +-205 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fers) 14.9339 Tj +-205 TJm +(can) 13.8281 Tj +-205 TJm +(be) 9.40469 Tj +-205 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-205 TJm +(size;) 18.2614 Tj +-220 TJm +(arbitrary) 34.3012 Tj +-206 TJm +(quantities) 38.7446 Tj +-205 TJm +(of) 8.29885 Tj +72 496.104 Td +(data) 16.5977 Tj +-258 TJm +(are) 12.1643 Tj +-258 TJm +(handled) 31.5416 Tj +-258 TJm +(by) 9.9626 Tj +-257 TJm +(making) 29.8878 Tj +-258 TJm +(repeated) 33.7433 Tj +-258 TJm +(calls) 18.2614 Tj +-258 TJm +(to) 7.7509 Tj +-258 TJm +(these) 20.4731 Tj +-258 TJm +(functions.) 39.5714 Tj +-667 TJm +(This) 17.7135 Tj +-258 TJm +(is) 6.64505 Tj +-258 TJm +(a) 4.42339 Tj +-257 TJm +(\003e) 9.9626 Tj +15 TJm +(xible) 19.9252 Tj +-258 TJm +(mechanism) 45.3796 Tj +-258 TJm +(allo) 14.9439 Tj +25 TJm +(wing) 19.9252 Tj +-258 TJm +(a) 4.42339 Tj +-258 TJm +(consumer) 38.7346 Tj +20 TJm +(-pull) 18.8194 Tj +72 484.148 Td +(style) 18.8194 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(acti) 14.386 Tj +25 TJm +(vity) 15.5018 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(producer) 35.4071 Tj +20 TJm +(-push,) 24.6275 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(mixture) 30.9936 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(both.) 20.2042 Tj +[1 0 0 1 72 481.992] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -472.029] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 453.527 Td +/F122_0 17.2154 Tf +(3.1.2.) 43.0729 Tj +-278 TJm +(High-le) 58.343 Tj +15 TJm +(vel) 23.9294 Tj +-278 TJm +(summar) 66.9679 Tj +-10 TJm +(y) 9.57176 Tj +[1 0 0 1 72 449.697] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -439.734] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 431.61 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-284 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-284 TJm +(pro) 13.2801 Tj +15 TJm +(vides) 21.031 Tj +-285 TJm +(some) 21.031 Tj +-284 TJm +(handy) 24.3486 Tj +-284 TJm +(wrappers) 36.5129 Tj +-284 TJm +(around) 27.6661 Tj +-284 TJm +(the) 12.1743 Tj +-284 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-285 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-284 TJm +(to) 7.7509 Tj +-284 TJm +(f) 3.31755 Tj +10 TJm +(acilitate) 31.5416 Tj +-284 TJm +(reading) 29.8778 Tj +-284 TJm +(and) 14.386 Tj +-285 TJm +(writ) 16.0497 Tj +1 TJm +(ing) 12.7322 Tj +[1 0 0 1 510.112 431.61] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -510.112 -431.61] cm +[1 0 0 1 0 0] Tm +0 0 Td +510.112 431.61 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 540 431.61] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -431.61] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 419.654 Td +/F130_0 9.9626 Tf +(format) 26.5603 Tj +-347 TJm +(\002les) 16.6077 Tj +-346 TJm +(\() 3.31755 Tj +[1 0 0 1 125.391 419.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -125.391 -419.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +125.391 419.654 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 149.301 419.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.301 -419.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +152.754 419.654 Td +/F130_0 9.9626 Tf +(\002les\).) 22.4159 Tj +-1200 TJm +(The) 15.4918 Tj +-346 TJm +(routines) 32.0995 Tj +-347 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-346 TJm +(hooks) 23.8007 Tj +-347 TJm +(to) 7.7509 Tj +-346 TJm +(f) 3.31755 Tj +10 TJm +(acilitate) 31.5416 Tj +-347 TJm +(reading) 29.8778 Tj +-347 TJm +(\002les) 16.6077 Tj +-346 TJm +(in) 7.7509 Tj +-347 TJm +(which) 24.3486 Tj +-346 TJm +(the) 12.1743 Tj +[1 0 0 1 460.049 419.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -460.049 -419.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +460.049 419.654 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 489.937 419.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -489.937 -419.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +493.39 419.654 Td +/F130_0 9.9626 Tf +(data) 16.5977 Tj +-347 TJm +(stream) 26.5603 Tj +72 407.699 Td +(is) 6.64505 Tj +-339 TJm +(embedded) 40.9463 Tj +-339 TJm +(within) 25.4644 Tj +-339 TJm +(some) 21.031 Tj +-339 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +20 TJm +(-scale) 23.2328 Tj +-339 TJm +(\002le) 12.7322 Tj +-339 TJm +(structure,) 37.3498 Tj +-361 TJm +(or) 8.29885 Tj +-339 TJm +(wh) 12.1743 Tj +-1 TJm +(e) 4.42339 Tj +1 TJm +(re) 7.74094 Tj +-340 TJm +(there) 19.9152 Tj +-339 TJm +(are) 12.1643 Tj +-339 TJm +(multiple) 33.2153 Tj +[1 0 0 1 400.941 407.699] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -400.941 -407.699] cm +[1 0 0 1 0 0] Tm +0 0 Td +400.941 407.699 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 430.829 407.699] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -430.829 -407.699] cm +[1 0 0 1 0 0] Tm +0 0 Td +434.207 407.699 Td +/F130_0 9.9626 Tf +(data) 16.5977 Tj +-339 TJm +(streams) 30.4357 Tj +-339 TJm +(concatenated) 52.0048 Tj +72 395.744 Td +(end-to-end.) 45.6486 Tj +[1 0 0 1 72 395.644] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -385.682] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 373.826 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-332 TJm +(reading) 29.8778 Tj +-333 TJm +(\002les,) 19.0983 Tj +[1 0 0 1 144.803 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -144.803 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +144.803 373.826 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 228.489 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -228.489 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +228.489 373.826 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 234.496 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.496 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.496 373.826 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 294.272 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -294.272 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.272 373.826 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 300.279 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -300.279 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +300.279 373.826 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 389.942 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -389.942 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +393.253 373.826 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 410.951 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.951 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +410.951 373.826 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 524.525 373.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -524.525 -373.826] cm +[1 0 0 1 0 0] Tm +0 0 Td +527.836 373.826 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +72 361.871 Td +(supplied.) 36.2539 Tj +-620 TJm +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(writing) 28.782 Tj +-250 TJm +(\002les,) 19.0983 Tj +[1 0 0 1 183.471 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.471 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.471 361.871 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 273.135 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -273.135 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +273.135 361.871 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 278.116 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.116 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +278.116 361.871 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 343.869 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -343.869 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +346.36 361.871 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 363.237 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -363.237 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.237 361.871 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteFinish) 101.619 Tj +[1 0 0 1 464.856 361.871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -464.856 -361.871] cm +[1 0 0 1 0 0] Tm +0 0 Td +467.346 361.871 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable.) 29.0509 Tj +[1 0 0 1 72 359.714] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -349.751] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 339.953 Td +/F130_0 9.9626 Tf +(As) 11.0684 Tj +-374 TJm +(with) 17.7135 Tj +-374 TJm +(the) 12.1743 Tj +-375 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-374 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-405 TJm +(no) 9.9626 Tj +-374 TJm +(global) 24.9065 Tj +-374 TJm +(v) 4.9813 Tj +25 TJm +(ariables) 30.9837 Tj +-375 TJm +(are) 12.1643 Tj +-374 TJm +(used) 18.2614 Tj +-374 TJm +(so) 8.85675 Tj +-374 TJm +(the) 12.1743 Tj +-374 TJm +(library) 26.5603 Tj +-375 TJm +(is) 6.64505 Tj +-374 TJm +(per) 12.7222 Tj +-374 TJm +(se) 8.29885 Tj +-374 TJm +(thread-safe.) 46.7445 Tj +-1365 TJm +(Ho) 12.1743 Tj +25 TJm +(we) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +40 TJm +(,) 2.49065 Tj +-406 TJm +(if) 6.08715 Tj +-374 TJm +(I/O) 13.2801 Tj +72 327.998 Td +(errors) 23.2328 Tj +-267 TJm +(occur) 22.1269 Tj +-267 TJm +(whilst) 24.3586 Tj +-267 TJm +(reading) 29.8778 Tj +-267 TJm +(or) 8.29885 Tj +-267 TJm +(writing) 28.782 Tj +-267 TJm +(the) 12.1743 Tj +-268 TJm +(underlying) 43.1679 Tj +-267 TJm +(compressed) 47.0334 Tj +-267 TJm +(\002les,) 19.0983 Tj +-271 TJm +(you) 14.9439 Tj +-267 TJm +(may) 17.1556 Tj +-267 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-267 TJm +(to) 7.7509 Tj +-267 TJm +(consult) 28.782 Tj +[1 0 0 1 457.199 327.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -457.199 -327.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +457.199 327.998 Td +/F134_0 9.9626 Tf +(errno) 29.8878 Tj +[1 0 0 1 487.087 327.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -487.087 -327.998] cm +[1 0 0 1 0 0] Tm +0 0 Td +489.748 327.998 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-267 TJm +(determine) 39.8404 Tj +72 316.043 Td +(the) 12.1743 Tj +-366 TJm +(cause) 22.1269 Tj +-365 TJm +(of) 8.29885 Tj +-366 TJm +(the) 12.1743 Tj +-365 TJm +(error) 19.3573 Tj +55 TJm +(.) 2.49065 Tj +-1314 TJm +(In) 8.29885 Tj +-366 TJm +(that) 14.9439 Tj +-365 TJm +(case,) 19.6363 Tj +-395 TJm +(you') 18.2614 Tj +50 TJm +(d) 4.9813 Tj +-366 TJm +(need) 18.8094 Tj +-365 TJm +(a) 4.42339 Tj +-366 TJm +(C) 6.64505 Tj +-365 TJm +(library) 26.5603 Tj +-366 TJm +(which) 24.3486 Tj +-366 TJm +(correctly) 35.4071 Tj +-365 TJm +(supports) 33.7633 Tj +[1 0 0 1 431.668 316.043] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -431.668 -316.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +431.668 316.043 Td +/F134_0 9.9626 Tf +(errno) 29.8878 Tj +[1 0 0 1 461.556 316.043] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -461.556 -316.043] cm +[1 0 0 1 0 0] Tm +0 0 Td +465.199 316.043 Td +/F130_0 9.9626 Tf +(in) 7.7509 Tj +-366 TJm +(a) 4.42339 Tj +-365 TJm +(multithreaded) 55.3422 Tj +72 304.088 Td +(en) 9.40469 Tj +40 TJm +(vironment.) 43.4469 Tj +[1 0 0 1 72 303.988] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -294.025] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 282.17 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-243 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-243 TJm +(the) 12.1743 Tj +-242 TJm +(library) 26.5603 Tj +-243 TJm +(a) 4.42339 Tj +-243 TJm +(little) 18.2714 Tj +-242 TJm +(simpler) 29.8878 Tj +-243 TJm +(and) 14.386 Tj +-243 TJm +(more) 20.4731 Tj +-243 TJm +(portable,) 35.1381 Tj +[1 0 0 1 289.263 282.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -289.263 -282.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.263 282.17 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 372.949 282.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -372.949 -282.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +375.368 282.17 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 392.172 282.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.172 -282.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.172 282.17 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 481.836 282.17] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -481.836 -282.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +484.254 282.17 Td +/F130_0 9.9626 Tf +(require) 28.2141 Tj +-243 TJm +(you) 14.9439 Tj +-242 TJm +(to) 7.7509 Tj +72 270.215 Td +(pass) 17.1556 Tj +-247 TJm +(them) 19.9252 Tj +-248 TJm +(\002le) 12.7322 Tj +-247 TJm +(handles) 30.4357 Tj +-247 TJm +(\() 3.31755 Tj +[1 0 0 1 165.421 270.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -165.421 -270.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +165.421 270.215 Td +/F134_0 9.9626 Tf +(FILE) 23.9102 Tj +189.331 268.471 Td +(*) 5.97756 Tj +[1 0 0 1 195.309 270.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -195.309 -270.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +195.309 270.215 Td +/F130_0 9.9626 Tf +(s\)) 7.193 Tj +-247 TJm +(which) 24.3486 Tj +-248 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-247 TJm +(pre) 12.7222 Tj +25 TJm +(viously) 29.3399 Tj +-247 TJm +(been) 18.8094 Tj +-248 TJm +(opened) 28.772 Tj +-247 TJm +(for) 11.6164 Tj +-247 TJm +(reading) 29.8778 Tj +-247 TJm +(or) 8.29885 Tj +-248 TJm +(writing) 28.782 Tj +-247 TJm +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(.) 2.49065 Tj +-618 TJm +(That) 18.2614 Tj +-248 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +20 TJm +(oids) 16.6077 Tj +72 258.26 Td +(portability) 41.5142 Tj +-272 TJm +(problems) 37.0808 Tj +-273 TJm +(associated) 40.9463 Tj +-272 TJm +(with) 17.7135 Tj +-272 TJm +(\002le) 12.7322 Tj +-273 TJm +(operations) 41.5042 Tj +-272 TJm +(and) 14.386 Tj +-272 TJm +(\002le) 12.7322 Tj +-273 TJm +(attrib) 21.031 Tj +20 TJm +(utes,) 18.5404 Tj +-278 TJm +(whilst) 24.3586 Tj +-272 TJm +(not) 12.7322 Tj +-272 TJm +(being) 22.1369 Tj +-273 TJm +(much) 22.1369 Tj +-272 TJm +(of) 8.29885 Tj +-273 TJm +(an) 9.40469 Tj +-272 TJm +(imposition) 42.63 Tj +-272 TJm +(on) 9.9626 Tj +-273 TJm +(the) 12.1743 Tj +72 246.304 Td +(programmer) 49.2451 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 244.147] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -234.185] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 215.683 Td +/F122_0 17.2154 Tf +(3.1.3.) 43.0729 Tj +-278 TJm +(Utility) 47.8244 Tj +-278 TJm +(functions) 77.4693 Tj +-278 TJm +(summar) 66.9679 Tj +-10 TJm +(y) 9.57176 Tj +[1 0 0 1 72 212.12] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -202.157] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 193.765 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-273 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-273 TJm +(simple) 26.5703 Tj +-273 TJm +(needs,) 25.1755 Tj +[1 0 0 1 165.929 193.765] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -165.929 -193.765] cm +[1 0 0 1 0 0] Tm +0 0 Td +165.929 193.765 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffCompress) 143.461 Tj +[1 0 0 1 309.391 193.765] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -309.391 -193.765] cm +[1 0 0 1 0 0] Tm +0 0 Td +312.112 193.765 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 329.219 193.765] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -329.219 -193.765] cm +[1 0 0 1 0 0] Tm +0 0 Td +329.219 193.765 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 484.636 193.765] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -484.636 -193.765] cm +[1 0 0 1 0 0] Tm +0 0 Td +487.357 193.765 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-273 TJm +(pro) 13.2801 Tj +15 TJm +(vided.) 24.6275 Tj +72 181.81 Td +(These) 23.7907 Tj +-374 TJm +(compress) 37.6287 Tj +-373 TJm +(data) 16.5977 Tj +-374 TJm +(in) 7.7509 Tj +-373 TJm +(memory) 33.2053 Tj +-374 TJm +(from) 19.3673 Tj +-373 TJm +(one) 14.386 Tj +-374 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-373 TJm +(to) 7.7509 Tj +-374 TJm +(another) 29.8778 Tj +-374 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-373 TJm +(in) 7.7509 Tj +-374 TJm +(a) 4.42339 Tj +-373 TJm +(single) 23.8007 Tj +-374 TJm +(function) 33.2053 Tj +-373 TJm +(call.) 16.8766 Tj +-1362 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-373 TJm +(should) 26.5703 Tj +-374 TJm +(assess) 24.3486 Tj +72 169.855 Td +(whether) 32.0895 Tj +-344 TJm +(these) 20.4731 Tj +-343 TJm +(functions) 37.0808 Tj +-344 TJm +(ful\002ll) 22.1469 Tj +-344 TJm +(your) 18.2614 Tj +-343 TJm +(memory-to-memory) 80.7967 Tj +-344 TJm +(compression/decompression) 112.896 Tj +-343 TJm +(requirements) 52.0147 Tj +-344 TJm +(before) 25.4445 Tj +-344 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(esting) 23.8007 Tj +72 157.9 Td +(ef) 7.74094 Tj +25 TJm +(fort) 14.386 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(understanding) 56.4481 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(more) 20.4731 Tj +-250 TJm +(general) 29.3199 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(more) 20.4731 Tj +-250 TJm +(comple) 29.3299 Tj +15 TJm +(x) 4.9813 Tj +-250 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace.) 15.7608 Tj +[1 0 0 1 72 155.743] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -145.78] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 135.982 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(oshioka) 30.9936 Tj +-423 TJm +(Tsuneo) 29.3299 Tj +-422 TJm +(\() 3.31755 Tj +[1 0 0 1 150.16 135.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -150.16 -135.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.16 135.982 Td +/F134_0 9.9626 Tf +(tsuneo at rr.iij4u.or.jp) 125.529 Tj +[1 0 0 1 275.69 135.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -275.69 -135.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +275.69 135.982 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-423 TJm +(has) 13.2801 Tj +-422 TJm +(contrib) 28.224 Tj +20 TJm +(uted) 17.1556 Tj +-423 TJm +(some) 21.031 Tj +-423 TJm +(functions) 37.0808 Tj +-422 TJm +(to) 7.7509 Tj +-423 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-423 TJm +(better) 22.6848 Tj +[1 0 0 1 476.462 135.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -476.462 -135.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +476.462 135.982 Td +/F134_0 9.9626 Tf +(zlib) 23.9102 Tj +[1 0 0 1 500.372 135.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -500.372 -135.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +504.583 135.982 Td +/F130_0 9.9626 Tf +(compati-) 35.417 Tj +72 124.027 Td +(bility) 21.041 Tj +65 TJm +(.) 2.49065 Tj +-1446 TJm +(These) 23.7907 Tj +-388 TJm +(functions) 37.0808 Tj +-387 TJm +(are) 12.1643 Tj +[1 0 0 1 193.913 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -193.913 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.913 124.027 Td +/F134_0 9.9626 Tf +(BZ2_bzopen) 59.7756 Tj +[1 0 0 1 253.689 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.689 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +253.689 124.027 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 260.385 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -260.385 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +260.385 124.027 Td +/F134_0 9.9626 Tf +(BZ2_bzread) 59.7756 Tj +[1 0 0 1 320.161 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -320.161 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +320.161 124.027 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 326.857 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -326.857 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +326.857 124.027 Td +/F134_0 9.9626 Tf +(BZ2_bzwrite) 65.7532 Tj +[1 0 0 1 392.611 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.611 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.611 124.027 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 399.306 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -399.306 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +399.306 124.027 Td +/F134_0 9.9626 Tf +(BZ2_bzflush) 65.7532 Tj +[1 0 0 1 465.06 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -465.06 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +465.06 124.027 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 471.756 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -471.756 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +471.756 124.027 Td +/F134_0 9.9626 Tf +(BZ2_bzclose) 65.7532 Tj +[1 0 0 1 537.509 124.027] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -124.027] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 124.027 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 72 112.072] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -112.072] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 112.072 Td +/F134_0 9.9626 Tf +(BZ2_bzerror) 65.7532 Tj +[1 0 0 1 137.753 112.072] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.753 -112.072] cm +[1 0 0 1 0 0] Tm +0 0 Td +140.408 112.072 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 157.449 112.072] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -157.449 -112.072] cm +[1 0 0 1 0 0] Tm +0 0 Td +157.449 112.072 Td +/F134_0 9.9626 Tf +(BZ2_bzlibVersion) 95.641 Tj +[1 0 0 1 253.091 112.072] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.091 -112.072] cm +[1 0 0 1 0 0] Tm +0 0 Td +253.091 112.072 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-719 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-266 TJm +(may) 17.1556 Tj +-267 TJm +(\002nd) 15.5018 Tj +-266 TJm +(these) 20.4731 Tj +-267 TJm +(functions) 37.0808 Tj +-266 TJm +(more) 20.4731 Tj +-267 TJm +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(enient) 24.3486 Tj +-266 TJm +(for) 11.6164 Tj +-267 TJm +(simple) 26.5703 Tj +-266 TJm +(\002le) 12.7322 Tj +-267 TJm +(reading) 29.8778 Tj +72 100.117 Td +(and) 14.386 Tj +-270 TJm +(wri) 13.2801 Tj +1 TJm +(ting,) 17.9925 Tj +-275 TJm +(than) 17.1556 Tj +-269 TJm +(those) 21.031 Tj +-270 TJm +(in) 7.7509 Tj +-269 TJm +(the) 12.1743 Tj +-270 TJm +(high-le) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-269 TJm +(interf) 21.579 Tj +10 TJm +(ace.) 15.7608 Tj +-737 TJm +(These) 23.7907 Tj +-270 TJm +(functions) 37.0808 Tj +-269 TJm +(are) 12.1643 Tj +-270 TJm +(not) 12.7322 Tj +-269 TJm +(\(yet\)) 18.8094 Tj +-270 TJm +(of) 8.29885 Tj +25 TJm +(\002cially) 27.6761 Tj +-269 TJm +(part) 15.4918 Tj +-270 TJm +(of) 8.29885 Tj +-269 TJm +(the) 12.1743 Tj +-270 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-274 TJm +(and) 14.386 Tj +-270 TJm +(are) 12.1643 Tj +72 88.1614 Td +(minimally) 40.9662 Tj +-291 TJm +(documented) 48.6972 Tj +-291 TJm +(here.) 19.6363 Tj +-867 TJm +(If) 6.63509 Tj +-291 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-291 TJm +(break,) 24.6176 Tj +-301 TJm +(you) 14.9439 Tj +-291 TJm +(get) 12.1743 Tj +-292 TJm +(to) 7.7509 Tj +-291 TJm +(k) 4.9813 Tj +10 TJm +(eep) 13.8281 Tj +-291 TJm +(all) 9.9626 Tj +-291 TJm +(the) 12.1743 Tj +-291 TJm +(pieces.) 27.3872 Tj +-433 TJm +(I) 3.31755 Tj +-291 TJm +(hope) 19.3673 Tj +-291 TJm +(to) 7.7509 Tj +-291 TJm +(document) 39.2925 Tj +-292 TJm +(them) 19.9252 Tj +-291 TJm +(properly) 33.7533 Tj +-291 TJm +(when) 21.579 Tj +72 76.2062 Td +(time) 17.7135 Tj +-250 TJm +(permits.) 32.3785 Tj +[1 0 0 1 72 74.0494] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -23.1976] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.9737] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 43.0633 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -498.225 -51.071] cm +[1 0 0 1 0 0] Tm +0 0 Td +541.288 51.071 Td +/F130_0 9.9626 Tf +(9) 4.9813 Tj +[1 0 0 1 455.161 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5986 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0366 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 13 13 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(oshioka) 30.9936 Tj +-250 TJm +(also) 16.0497 Tj +-250 TJm +(contrib) 28.224 Tj +20 TJm +(uted) 17.1556 Tj +-250 TJm +(modi\002cations) 54.2464 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(allo) 14.9439 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(uilt) 13.2901 Tj +-250 TJm +(as) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws) 11.0684 Tj +-250 TJm +(DLL.) 21.8579 Tj +[1 0 0 1 72 707.88] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -698.137] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 675.504 Td +/F122_0 20.6585 Tf +(3.2.) 34.4584 Tj +-278 TJm +(Err) 29.8515 Tj +20 TJm +(or) 20.6585 Tj +-278 TJm +(handling) 86.084 Tj +[1 0 0 1 72 670.907] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -661.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 653.805 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-214 TJm +(library) 26.5603 Tj +-215 TJm +(is) 6.64505 Tj +-214 TJm +(designed) 35.417 Tj +-215 TJm +(to) 7.7509 Tj +-214 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-215 TJm +(cleanly) 28.772 Tj +-214 TJm +(in) 7.7509 Tj +-215 TJm +(all) 9.9626 Tj +-214 TJm +(situations,) 40.6873 Tj +-222 TJm +(including) 37.6387 Tj +-214 TJm +(the) 12.1743 Tj +-215 TJm +(w) 7.193 Tj +10 TJm +(orst-case) 35.4071 Tj +-214 TJm +(situation) 34.3212 Tj +-215 TJm +(of) 8.29885 Tj +-214 TJm +(decompressing) 59.7656 Tj +-215 TJm +(random) 30.4357 Tj +72 641.85 Td +(data.) 19.0883 Tj +-764 TJm +(I'm) 14.386 Tj +-274 TJm +(not) 12.7322 Tj +-275 TJm +(100%) 23.2427 Tj +-274 TJm +(sure) 16.5977 Tj +-274 TJm +(that) 14.9439 Tj +-274 TJm +(it) 5.53921 Tj +-274 TJm +(can) 13.8281 Tj +-274 TJm +(al) 7.193 Tj +10 TJm +(w) 7.193 Tj +10 TJm +(ays) 13.2801 Tj +-274 TJm +(do) 9.9626 Tj +-274 TJm +(this,) 16.8866 Tj +-280 TJm +(so) 8.85675 Tj +-274 TJm +(you) 14.9439 Tj +-274 TJm +(might) 23.2527 Tj +-274 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-274 TJm +(to) 7.7509 Tj +-274 TJm +(add) 14.386 Tj +-274 TJm +(a) 4.42339 Tj +-275 TJm +(s) 3.87545 Tj +1 TJm +(ignal) 19.9252 Tj +-275 TJm +(handler) 29.8778 Tj +-274 TJm +(to) 7.7509 Tj +-274 TJm +(catch) 21.0211 Tj +-274 TJm +(se) 8.29885 Tj +15 TJm +(gmentation) 44.8317 Tj +72 629.894 Td +(violations) 39.3025 Tj +-273 TJm +(during) 26.0123 Tj +-273 TJm +(decompression) 59.7656 Tj +-273 TJm +(if) 6.08715 Tj +-273 TJm +(you) 14.9439 Tj +-273 TJm +(are) 12.1643 Tj +-273 TJm +(feeling) 27.6661 Tj +-274 TJm +(especiall) 34.8591 Tj +1 TJm +(y) 4.9813 Tj +-274 TJm +(paranoid.) 37.3498 Tj +-758 TJm +(I) 3.31755 Tj +-273 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-273 TJm +(be) 9.40469 Tj +-273 TJm +(interested) 38.7346 Tj +-273 TJm +(in) 7.7509 Tj +-274 TJm +(hearing) 29.8778 Tj +-273 TJm +(more) 20.4731 Tj +-273 TJm +(about) 22.1369 Tj +72 617.939 Td +(the) 12.1743 Tj +-250 TJm +(rob) 13.2801 Tj +20 TJm +(ustness) 28.782 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(corrupted) 38.1767 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(data.) 19.0883 Tj +[1 0 0 1 72 615.783] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -606.039] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 596.241 Td +/F130_0 9.9626 Tf +(V) 7.193 Tj +111 TJm +(ersion) 24.3486 Tj +-251 TJm +(1.0.3) 19.9252 Tj +-251 TJm +(more) 20.4731 Tj +-251 TJm +(rob) 13.2801 Tj +20 TJm +(ust) 11.6264 Tj +-251 TJm +(in) 7.7509 Tj +-251 TJm +(this) 14.396 Tj +-251 TJm +(respect) 28.2141 Tj +-252 TJm +(than) 17.1556 Tj +-251 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-251 TJm +(pre) 12.7222 Tj +25 TJm +(vious) 21.589 Tj +-251 TJm +(v) 4.9813 Tj +15 TJm +(ersion.) 26.8392 Tj +-626 TJm +(In) 8.29885 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(estig) 18.8194 Tj +5 TJm +(ations) 23.8007 Tj +-251 TJm +(with) 17.7135 Tj +-251 TJm +(V) 7.193 Tj +111 TJm +(algrind) 28.224 Tj +-251 TJm +(\(a) 7.74094 Tj +-252 TJm +(tool) 15.5018 Tj +-251 TJm +(for) 11.6164 Tj +-251 TJm +(detecting) 36.5229 Tj +72 584.285 Td +(problems) 37.0808 Tj +-422 TJm +(with) 17.7135 Tj +-421 TJm +(memory) 33.2053 Tj +-422 TJm +(management\)) 54.2264 Tj +-421 TJm +(indicate) 31.5416 Tj +-422 TJm +(that,) 17.4346 Tj +-464 TJm +(at) 7.193 Tj +-422 TJm +(least) 18.2614 Tj +-421 TJm +(for) 11.6164 Tj +-422 TJm +(the) 12.1743 Tj +-422 TJm +(f) 3.31755 Tj +1 TJm +(e) 4.42339 Tj +25 TJm +(w) 7.193 Tj +-422 TJm +(\002les) 16.6077 Tj +-422 TJm +(I) 3.31755 Tj +-421 TJm +(tested,) 25.7334 Tj +-464 TJm +(all) 9.9626 Tj +-422 TJm +(single-bit) 37.6387 Tj +-422 TJm +(errors) 23.2328 Tj +-421 TJm +(in) 7.7509 Tj +-422 TJm +(the) 12.1743 Tj +72 572.33 Td +(decompressed) 56.4381 Tj +-342 TJm +(data) 16.5977 Tj +-341 TJm +(are) 12.1643 Tj +-342 TJm +(caught) 26.5603 Tj +-342 TJm +(properly) 33.7533 Tj +65 TJm +(,) 2.49065 Tj +-365 TJm +(with) 17.7135 Tj +-341 TJm +(no) 9.9626 Tj +-342 TJm +(se) 8.29885 Tj +15 TJm +(gmentation) 44.8317 Tj +-342 TJm +(f) 3.31755 Tj +10 TJm +(aults,) 21.31 Tj +-365 TJm +(no) 9.9626 Tj +-341 TJm +(uses) 17.1556 Tj +-342 TJm +(of) 8.29885 Tj +-342 TJm +(uninitialised) 49.2651 Tj +-342 TJm +(data,) 19.0883 Tj +-364 TJm +(no) 9.9626 Tj +-342 TJm +(out) 12.7322 Tj +-342 TJm +(of) 8.29885 Tj +-342 TJm +(range) 22.1269 Tj +72 560.375 Td +(reads) 21.0211 Tj +-261 TJm +(or) 8.29885 Tj +-260 TJm +(writes,) 26.8392 Tj +-263 TJm +(and) 14.386 Tj +-261 TJm +(no) 9.9626 Tj +-261 TJm +(in\002nit) 23.8106 Tj +1 TJm +(e) 4.42339 Tj +-261 TJm +(looping) 30.4457 Tj +-261 TJm +(in) 7.7509 Tj +-260 TJm +(the) 12.1743 Tj +-261 TJm +(decompressor) 55.3323 Tj +55 TJm +(.) 2.49065 Tj +-342 TJm +(So) 10.5205 Tj +-260 TJm +(it') 8.85675 Tj +55 TJm +(s) 3.87545 Tj +-261 TJm +(certainly) 34.8591 Tj +-260 TJm +(pretty) 23.2427 Tj +-261 TJm +(rob) 13.2801 Tj +20 TJm +(ust,) 14.117 Tj +-263 TJm +(although) 34.8691 Tj +-261 TJm +(I) 3.31755 Tj +-260 TJm +(w) 7.193 Tj +10 TJm +(ouldn') 26.0123 Tj +18 TJm +(t) 2.7696 Tj +-261 TJm +(claim) 22.1369 Tj +72 548.42 Td +(it) 5.53921 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(totally) 25.4644 Tj +-250 TJm +(bombproof.) 46.7644 Tj +[1 0 0 1 72 546.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -536.519] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 526.721 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-282 TJm +(\002le) 12.7322 Tj +[1 0 0 1 105.84 526.721] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -105.84 -526.721] cm +[1 0 0 1 0 0] Tm +0 0 Td +105.84 526.721 Td +/F134_0 9.9626 Tf +(bzlib.h) 41.8429 Tj +[1 0 0 1 147.683 526.721] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -147.683 -526.721] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.491 526.721 Td +/F130_0 9.9626 Tf +(contains) 33.2053 Tj +-282 TJm +(all) 9.9626 Tj +-282 TJm +(de\002nitions) 42.0721 Tj +-282 TJm +(nee) 13.8281 Tj +1 TJm +(ded) 14.386 Tj +-282 TJm +(to) 7.7509 Tj +-282 TJm +(use) 13.2801 Tj +-282 TJm +(the) 12.1743 Tj +-282 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-811 TJm +(In) 8.29885 Tj +-282 TJm +(particular) 38.1767 Tj +40 TJm +(,) 2.49065 Tj +-290 TJm +(you) 14.9439 Tj +-282 TJm +(should) 26.5703 Tj +-281 TJm +(de\002nitely) 37.6387 Tj +-282 TJm +(not) 12.7322 Tj +-282 TJm +(include) 29.3299 Tj +[1 0 0 1 72 514.766] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -514.766] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 514.766 Td +/F134_0 9.9626 Tf +(bzlib_private.h) 89.6634 Tj +[1 0 0 1 161.664 514.766] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.664 -514.766] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.664 514.766 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 513.232] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -503.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 493.067 Td +/F130_0 9.9626 Tf +(In) 8.29885 Tj +[1 0 0 1 82.8075 493.067] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -82.8075 -493.067] cm +[1 0 0 1 0 0] Tm +0 0 Td +82.8075 493.067 Td +/F134_0 9.9626 Tf +(bzlib.h) 41.8429 Tj +[1 0 0 1 124.651 493.067] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -124.651 -493.067] cm +[1 0 0 1 0 0] Tm +0 0 Td +124.651 493.067 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-252 TJm +(the) 12.1743 Tj +-252 TJm +(v) 4.9813 Tj +25 TJm +(arious) 24.3486 Tj +-252 TJm +(return) 23.7907 Tj +-252 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-251 TJm +(are) 12.1643 Tj +-252 TJm +(de\002ned.) 31.8205 Tj +-631 TJm +(The) 15.4918 Tj +-252 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-252 TJm +(list) 12.1843 Tj +-251 TJm +(is) 6.64505 Tj +-252 TJm +(not) 12.7322 Tj +-252 TJm +(intended) 34.3112 Tj +-252 TJm +(as) 8.29885 Tj +-252 TJm +(an) 9.40469 Tj +-251 TJm +(e) 4.42339 Tj +15 TJm +(xhausti) 28.782 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-252 TJm +(description) 44.2738 Tj +-252 TJm +(of) 8.29885 Tj +72 481.112 Td +(the) 12.1743 Tj +-236 TJm +(circumstances) 56.4381 Tj +-236 TJm +(in) 7.7509 Tj +-237 TJm +(which) 24.3486 Tj +-236 TJm +(a) 4.42339 Tj +-236 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-236 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-236 TJm +(may) 17.1556 Tj +-237 TJm +(be) 9.40469 Tj +-236 TJm +(returned) 33.1954 Tj +-236 TJm +(--) 6.63509 Tj +-236 TJm +(those) 21.031 Tj +-236 TJm +(descriptions) 48.1492 Tj +-236 TJm +(are) 12.1643 Tj +-237 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-236 TJm +(later) 17.7035 Tj +55 TJm +(.) 2.49065 Tj +-305 TJm +(Rather) 26.5603 Tj +40 TJm +(,) 2.49065 Tj +-239 TJm +(it) 5.53921 Tj +-236 TJm +(is) 6.64505 Tj +-237 TJm +(intended) 34.3112 Tj +-236 TJm +(to) 7.7509 Tj +72 469.157 Td +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +15 TJm +(y) 4.9813 Tj +-266 TJm +(the) 12.1743 Tj +-265 TJm +(rough) 23.2427 Tj +-266 TJm +(meaning) 34.3112 Tj +-265 TJm +(of) 8.29885 Tj +-266 TJm +(each) 18.2515 Tj +-266 TJm +(return) 23.7907 Tj +-265 TJm +(v) 4.9813 Tj +25 TJm +(alue.) 19.0883 Tj +-714 TJm +(The) 15.4918 Tj +-265 TJm +(\002rst) 15.5018 Tj +-266 TJm +(\002) 5.53921 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-265 TJm +(actions) 28.224 Tj +-266 TJm +(are) 12.1643 Tj +-266 TJm +(normal) 28.224 Tj +-265 TJm +(and) 14.386 Tj +-266 TJm +(not) 12.7322 Tj +-265 TJm +(intended) 34.3112 Tj +-266 TJm +(to) 7.7509 Tj +-266 TJm +(denote) 26.5603 Tj +-265 TJm +(an) 9.40469 Tj +-266 TJm +(error) 19.3573 Tj +72 457.202 Td +(situation.) 36.8118 Tj +[1 0 0 1 72 457.102] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -437.615] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 425.76 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 101.888 425.76] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -32.3786 -1.3101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -424.449] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 413.804 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(requested) 38.1767 Tj +-250 TJm +(action) 24.3486 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(completed) 41.5042 Tj +-250 TJm +(successfully) 48.6972 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 411.648] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.766] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -398.138] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 388.34 Td +/F134_0 9.9626 Tf +(BZ_RUN_OK,) 59.7756 Tj +-600 TJm +(BZ_FLUSH_OK,) 71.7307 Tj +-600 TJm +(BZ_FINISH_OK) 71.7307 Tj +[1 0 0 1 287.193 388.34] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -217.684 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -387.03] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 376.384 Td +/F130_0 9.9626 Tf +(In) 8.29885 Tj +[1 0 0 1 118.79 376.384] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -118.79 -376.384] cm +[1 0 0 1 0 0] Tm +0 0 Td +118.79 376.384 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 202.476 376.384] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.476 -376.384] cm +[1 0 0 1 0 0] Tm +0 0 Td +202.476 376.384 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(requested) 38.1767 Tj +-250 TJm +(\003ush/\002nish/nothing-special) 108.493 Tj +-250 TJm +(action) 24.3486 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(completed) 41.5042 Tj +-250 TJm +(successfully) 48.6972 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 374.228] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -360.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 350.92 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 149.709 350.92] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -80.1993 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -349.61] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 338.965 Td +/F130_0 9.9626 Tf +(Compression) 52.5826 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(completed,) 43.9948 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(logical) 27.1182 Tj +-250 TJm +(stream) 26.5603 Tj +-250 TJm +(end) 14.386 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(detected) 33.1954 Tj +-250 TJm +(during) 26.0123 Tj +-250 TJm +(decompression.) 62.2563 Tj +[1 0 0 1 72 336.808] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -313.555] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 303.756 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-250 TJm +(indicate) 31.5416 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(kind.) 20.2042 Tj +[1 0 0 1 72 301.6] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -282.112] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 272.314 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +[1 0 0 1 161.664 272.314] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -92.1544 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -271.004] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 260.359 Td +/F130_0 9.9626 Tf +(Indicates) 35.965 Tj +-386 TJm +(that) 14.9439 Tj +-385 TJm +(the) 12.1743 Tj +-386 TJm +(library) 26.5603 Tj +-386 TJm +(has) 13.2801 Tj +-386 TJm +(been) 18.8094 Tj +-385 TJm +(improperly) 44.2738 Tj +-386 TJm +(compiled) 37.0808 Tj +-386 TJm +(on) 9.9626 Tj +-386 TJm +(your) 18.2614 Tj +-385 TJm +(platform) 34.3112 Tj +-386 TJm +(--) 6.63509 Tj +-386 TJm +(a) 4.42339 Tj +-386 TJm +(major) 23.2427 Tj +-385 TJm +(con\002guration) 53.1305 Tj +-386 TJm +(error) 19.3573 Tj +55 TJm +(.) 2.49065 Tj +108 248.404 Td +(Speci\002cally) 47.0434 Tj +65 TJm +(,) 2.49065 Tj +-481 TJm +(it) 5.53921 Tj +-435 TJm +(means) 25.4544 Tj +-435 TJm +(that) 14.9439 Tj +[1 0 0 1 220.614 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -220.614 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.614 248.404 Td +/F134_0 9.9626 Tf +(sizeof\(char\)) 71.7307 Tj +[1 0 0 1 292.345 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -292.345 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +292.345 248.404 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 299.628 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -299.628 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +299.628 248.404 Td +/F134_0 9.9626 Tf +(sizeof\(short\)) 77.7083 Tj +[1 0 0 1 377.337 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -377.337 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +381.669 248.404 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 400.388 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -400.388 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +400.388 248.404 Td +/F134_0 9.9626 Tf +(sizeof\(int\)) 65.7532 Tj +[1 0 0 1 466.141 248.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -466.141 -248.404] cm +[1 0 0 1 0 0] Tm +0 0 Td +470.474 248.404 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-435 TJm +(not) 12.7322 Tj +-435 TJm +(1,) 7.47195 Tj +-481 TJm +(2) 4.9813 Tj +-435 TJm +(and) 14.386 Tj +108 236.449 Td +(4) 4.9813 Tj +-389 TJm +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(,) 2.49065 Tj +-424 TJm +(as) 8.29885 Tj +-390 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-389 TJm +(should) 26.5703 Tj +-389 TJm +(be.) 11.8953 Tj +-1456 TJm +(Note) 19.3673 Tj +-389 TJm +(that) 14.9439 Tj +-389 TJm +(the) 12.1743 Tj +-389 TJm +(library) 26.5603 Tj +-390 TJm +(should) 26.5703 Tj +-389 TJm +(still) 14.9539 Tj +-389 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-389 TJm +(properly) 33.7533 Tj +-390 TJm +(on) 9.9626 Tj +-389 TJm +(64-bit) 23.8007 Tj +-389 TJm +(platforms) 38.1866 Tj +108 224.493 Td +(which) 24.3486 Tj +-292 TJm +(follo) 18.8194 Tj +25 TJm +(w) 7.193 Tj +-292 TJm +(the) 12.1743 Tj +-292 TJm +(LP64) 21.589 Tj +-292 TJm +(programming) 54.2364 Tj +-293 TJm +(model) 24.9065 Tj +-292 TJm +(--) 6.63509 Tj +-292 TJm +(that) 14.9439 Tj +-292 TJm +(is,) 9.1357 Tj +-303 TJm +(where) 24.3386 Tj +[1 0 0 1 355.279 224.493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -355.279 -224.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +355.279 224.493 Td +/F134_0 9.9626 Tf +(sizeof\(long\)) 71.7307 Tj +[1 0 0 1 427.01 224.493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -427.01 -224.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +429.92 224.493 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 447.217 224.493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -447.217 -224.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +447.217 224.493 Td +/F134_0 9.9626 Tf +(sizeof\(void) 65.7532 Tj +512.97 222.75 Td +(*) 5.97756 Tj +518.948 224.493 Td +(\)) 5.97756 Tj +[1 0 0 1 524.925 224.493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -524.925 -224.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +527.836 224.493 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +108 212.538 Td +(8.) 7.47195 Tj +-620 TJm +(Under) 24.8965 Tj +-250 TJm +(LP64,) 24.0796 Tj +[1 0 0 1 175.606 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -175.606 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +175.606 212.538 Td +/F134_0 9.9626 Tf +(sizeof\(int\)) 65.7532 Tj +[1 0 0 1 241.36 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -241.36 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +243.85 212.538 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(still) 14.9539 Tj +-250 TJm +(4,) 7.47195 Tj +-250 TJm +(so) 8.85675 Tj +[1 0 0 1 291.74 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -291.74 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +291.74 212.538 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 339.56 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -339.56 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +339.56 212.538 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(the) 12.1743 Tj +[1 0 0 1 433.458 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -433.458 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +433.458 212.538 Td +/F134_0 9.9626 Tf +(long) 23.9102 Tj +[1 0 0 1 457.368 212.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -457.368 -212.538] cm +[1 0 0 1 0 0] Tm +0 0 Td +459.859 212.538 Td +/F130_0 9.9626 Tf +(type,) 19.6462 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(OK.) 16.8766 Tj +[1 0 0 1 72 210.381] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -196.872] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 187.074 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 173.619 187.074] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -104.11 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -185.764] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 175.118 Td +/F130_0 9.9626 Tf +(When) 23.7907 Tj +-291 TJm +(using) 21.589 Tj +-290 TJm +(the) 12.1743 Tj +-291 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-300 TJm +(it) 5.53921 Tj +-291 TJm +(is) 6.64505 Tj +-290 TJm +(important) 38.7446 Tj +-291 TJm +(to) 7.7509 Tj +-290 TJm +(call) 14.386 Tj +-291 TJm +(the) 12.1743 Tj +-290 TJm +(functions) 37.0808 Tj +-291 TJm +(in) 7.7509 Tj +-290 TJm +(the) 12.1743 Tj +-291 TJm +(correct) 27.6562 Tj +-290 TJm +(sequence) 36.5129 Tj +-291 TJm +(and) 14.386 Tj +-290 TJm +(with) 17.7135 Tj +-291 TJm +(data) 16.5977 Tj +-290 TJm +(structures) 38.7346 Tj +108 163.163 Td +(\(b) 8.29885 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fers) 14.9339 Tj +-206 TJm +(etc\)) 14.9339 Tj +-205 TJm +(in) 7.7509 Tj +-206 TJm +(the) 12.1743 Tj +-205 TJm +(correct) 27.6562 Tj +-206 TJm +(states.) 24.6275 Tj +[1 0 0 1 239.409 163.163] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -239.409 -163.163] cm +[1 0 0 1 0 0] Tm +0 0 Td +239.409 163.163 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 287.23 163.163] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -287.23 -163.163] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.278 163.163 Td +/F130_0 9.9626 Tf +(checks) 27.1082 Tj +-206 TJm +(as) 8.29885 Tj +-205 TJm +(much) 22.1369 Tj +-206 TJm +(as) 8.29885 Tj +-205 TJm +(it) 5.53921 Tj +-206 TJm +(can) 13.8281 Tj +-206 TJm +(to) 7.7509 Tj +-205 TJm +(ensure) 26.0024 Tj +-206 TJm +(this) 14.396 Tj +-206 TJm +(is) 6.64505 Tj +-205 TJm +(happening,) 43.9948 Tj +-215 TJm +(and) 14.386 Tj +-205 TJm +(returns) 27.6661 Tj +[1 0 0 1 108 151.208] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -108 -151.208] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 151.208 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 209.619 151.208] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -209.619 -151.208] cm +[1 0 0 1 0 0] Tm +0 0 Td +213.27 151.208 Td +/F130_0 9.9626 Tf +(if) 6.08715 Tj +-367 TJm +(not.) 15.2229 Tj +-659 TJm +(Code) 21.031 Tj +-367 TJm +(which) 24.3486 Tj +-367 TJm +(complies) 35.9749 Tj +-366 TJm +(precisely) 35.965 Tj +-367 TJm +(with) 17.7135 Tj +-366 TJm +(the) 12.1743 Tj +-367 TJm +(function) 33.2053 Tj +-366 TJm +(semantics,) 41.7831 Tj +-396 TJm +(as) 8.29885 Tj +-367 TJm +(detailed) 31.5416 Tj +108 139.253 Td +(belo) 17.1556 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(ne) 9.40469 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-250 TJm +(recei) 19.3573 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue;) 19.3673 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ent) 12.1743 Tj +-250 TJm +(denotes) 30.4357 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(uggy) 19.9252 Tj +-250 TJm +(code) 18.8094 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(estig) 18.8194 Tj +5 TJm +(ate.) 14.107 Tj +[1 0 0 1 72 137.096] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7436] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -123.587] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 113.788 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +[1 0 0 1 155.686 113.788] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.1768 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -112.478] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 101.833 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-434 TJm +(when) 21.579 Tj +-434 TJm +(a) 4.42339 Tj +-434 TJm +(parameter) 39.8305 Tj +-434 TJm +(to) 7.7509 Tj +-434 TJm +(a) 4.42339 Tj +-433 TJm +(function) 33.2053 Tj +-434 TJm +(call) 14.386 Tj +-434 TJm +(is) 6.64505 Tj +-434 TJm +(out) 12.7322 Tj +-434 TJm +(of) 8.29885 Tj +-434 TJm +(range) 22.1269 Tj +-434 TJm +(or) 8.29885 Tj +-434 TJm +(otherwise) 38.7346 Tj +-434 TJm +(manifestly) 42.0621 Tj +-434 TJm +(incorrect.) 37.8977 Tj +-1723 TJm +(As) 11.0684 Tj +108 89.8778 Td +(with) 17.7135 Tj +[1 0 0 1 131.644 89.8778] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.644 -89.8778] cm +[1 0 0 1 0 0] Tm +0 0 Td +131.644 89.8778 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 233.263 89.8778] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -233.263 -89.8778] cm +[1 0 0 1 0 0] Tm +0 0 Td +233.263 89.8778 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-595 TJm +(this) 14.396 Tj +-596 TJm +(denotes) 30.4357 Tj +-595 TJm +(a) 4.42339 Tj +-595 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-596 TJm +(in) 7.7509 Tj +-595 TJm +(the) 12.1743 Tj +-595 TJm +(client) 22.1369 Tj +-595 TJm +(code.) 21.3 Tj +-2692 TJm +(The) 15.4918 Tj +-596 TJm +(distinction) 42.0721 Tj +-595 TJm +(between) 33.1954 Tj +[1 0 0 1 108 77.9227] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -108 -77.9227] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 77.9227 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +[1 0 0 1 191.686 77.9227] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -191.686 -77.9227] cm +[1 0 0 1 0 0] Tm +0 0 Td +194.177 77.9227 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 211.053 77.9227] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -211.053 -77.9227] cm +[1 0 0 1 0 0] Tm +0 0 Td +211.053 77.9227 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 312.672 77.9227] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -312.672 -77.9227] cm +[1 0 0 1 0 0] Tm +0 0 Td +315.163 77.9227 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(bit) 10.5205 Tj +-250 TJm +(hazy) 18.8094 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(still) 14.9539 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(orth) 16.0497 Tj +-250 TJm +(making.) 32.3785 Tj +[1 0 0 1 72 75.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.7659] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.1482] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(10) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 14 14 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 143.731 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -74.2217 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -708.727] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 698.082 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-228 TJm +(when) 21.579 Tj +-227 TJm +(a) 4.42339 Tj +-228 TJm +(request) 28.772 Tj +-227 TJm +(to) 7.7509 Tj +-228 TJm +(allocate) 30.9837 Tj +-228 TJm +(memory) 33.2053 Tj +-227 TJm +(f) 3.31755 Tj +10 TJm +(ailed.) 21.8579 Tj +-605 TJm +(Note) 19.3673 Tj +-228 TJm +(that) 14.9439 Tj +-228 TJm +(the) 12.1743 Tj +-227 TJm +(quantity) 32.6574 Tj +-228 TJm +(of) 8.29885 Tj +-227 TJm +(memory) 33.2053 Tj +-228 TJm +(needed) 28.2141 Tj +-228 TJm +(to) 7.7509 Tj +-227 TJm +(decompress) 47.0334 Tj +108 686.127 Td +(a) 4.42339 Tj +-351 TJm +(stream) 26.5603 Tj +-352 TJm +(cannot) 26.5603 Tj +-351 TJm +(be) 9.40469 Tj +-352 TJm +(determined) 44.8217 Tj +-351 TJm +(until) 18.2714 Tj +-352 TJm +(the) 12.1743 Tj +-351 TJm +(stream') 29.8778 Tj +55 TJm +(s) 3.87545 Tj +-351 TJm +(header) 26.5503 Tj +-352 TJm +(has) 13.2801 Tj +-351 TJm +(been) 18.8094 Tj +-352 TJm +(read.) 19.6363 Tj +-1228 TJm +(So) 10.5205 Tj +[1 0 0 1 426.471 686.127] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -426.471 -686.127] cm +[1 0 0 1 0 0] Tm +0 0 Td +426.471 686.127 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 522.113 686.127] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -522.113 -686.127] cm +[1 0 0 1 0 0] Tm +0 0 Td +525.614 686.127 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 108 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -108 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 674.172 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 167.776 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.776 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.13 674.172 Td +/F130_0 9.9626 Tf +(may) 17.1556 Tj +-437 TJm +(return) 23.7907 Tj +[1 0 0 1 221.784 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -221.784 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.784 674.172 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 293.515 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -293.515 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +297.867 674.172 Td +/F130_0 9.9626 Tf +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-437 TJm +(though) 27.6761 Tj +-437 TJm +(some) 21.031 Tj +-437 TJm +(of) 8.29885 Tj +-437 TJm +(the) 12.1743 Tj +-437 TJm +(compressed) 47.0334 Tj +-437 TJm +(data) 16.5977 Tj +-437 TJm +(has) 13.2801 Tj +-437 TJm +(been) 18.8094 Tj +-437 TJm +(read.) 19.6363 Tj +108 662.217 Td +(The) 15.4918 Tj +-479 TJm +(same) 20.4731 Tj +-478 TJm +(is) 6.64505 Tj +-479 TJm +(not) 12.7322 Tj +-478 TJm +(true) 15.4918 Tj +-479 TJm +(for) 11.6164 Tj +-479 TJm +(compression;) 53.1305 Tj +-593 TJm +(once) 18.8094 Tj +[1 0 0 1 301.675 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -301.675 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +301.675 662.217 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 409.271 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -409.271 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +414.04 662.217 Td +/F130_0 9.9626 Tf +(or) 8.29885 Tj +[1 0 0 1 427.107 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -427.107 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +427.107 662.217 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 516.771 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -516.771 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +521.539 662.217 Td +/F130_0 9.9626 Tf +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +108 650.262 Td +(successfully) 48.6972 Tj +-250 TJm +(completed,) 43.9948 Tj +[1 0 0 1 205.672 650.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -205.672 -650.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +205.672 650.261 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 277.403 650.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -277.403 -650.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +279.894 650.261 Td +/F130_0 9.9626 Tf +(cannot) 26.5603 Tj +-250 TJm +(occur) 22.1269 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 648.105] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -634.157] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 624.359 Td +/F134_0 9.9626 Tf +(BZ_DATA_ERROR) 77.7083 Tj +[1 0 0 1 149.709 624.359] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -80.1993 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -623.049] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 612.404 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-266 TJm +(when) 21.579 Tj +-265 TJm +(a) 4.42339 Tj +-266 TJm +(data) 16.5977 Tj +-265 TJm +(inte) 14.9439 Tj +15 TJm +(grity) 18.8194 Tj +-266 TJm +(error) 19.3573 Tj +-266 TJm +(is) 6.64505 Tj +-265 TJm +(detected) 33.1954 Tj +-266 TJm +(during) 26.0123 Tj +-265 TJm +(decompression.) 62.2563 Tj +-714 TJm +(Most) 20.4831 Tj +-266 TJm +(importantl) 41.5142 Tj +1 TJm +(y) 4.9813 Tj +64 TJm +(,) 2.49065 Tj +-269 TJm +(this) 14.396 Tj +-266 TJm +(means) 25.4544 Tj +-265 TJm +(when) 21.579 Tj +108 600.448 Td +(stored) 24.3486 Tj +-222 TJm +(and) 14.386 Tj +-223 TJm +(computed) 39.2925 Tj +-222 TJm +(CRCs) 23.8106 Tj +-222 TJm +(for) 11.6164 Tj +-222 TJm +(the) 12.1743 Tj +-223 TJm +(data) 16.5977 Tj +-222 TJm +(do) 9.9626 Tj +-222 TJm +(not) 12.7322 Tj +-222 TJm +(match.) 26.8392 Tj +-602 TJm +(This) 17.7135 Tj +-222 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-222 TJm +(is) 6.64505 Tj +-223 TJm +(also) 16.0497 Tj +-222 TJm +(returned) 33.1954 Tj +-222 TJm +(upon) 19.9252 Tj +-222 TJm +(detection) 36.5229 Tj +-223 TJm +(of) 8.29885 Tj +-222 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-222 TJm +(other) 20.4731 Tj +108 588.493 Td +(anomaly) 34.3112 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(data.) 19.0883 Tj +[1 0 0 1 72 586.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -572.389] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 562.59 Td +/F134_0 9.9626 Tf +(BZ_DATA_ERROR_MAGIC) 113.574 Tj +[1 0 0 1 185.574 562.59] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.065 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -561.28] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 550.635 Td +/F130_0 9.9626 Tf +(As) 11.0684 Tj +-306 TJm +(a) 4.42339 Tj +-306 TJm +(special) 27.6661 Tj +-306 TJm +(case) 17.1456 Tj +-307 TJm +(of) 8.29885 Tj +[1 0 0 1 191.852 550.635] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -191.852 -550.635] cm +[1 0 0 1 0 0] Tm +0 0 Td +191.852 550.635 Td +/F134_0 9.9626 Tf +(BZ_DATA_ERROR) 77.7083 Tj +[1 0 0 1 269.561 550.635] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -269.561 -550.635] cm +[1 0 0 1 0 0] Tm +0 0 Td +269.561 550.635 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-306 TJm +(it) 5.53921 Tj +-306 TJm +(is) 6.64505 Tj +-306 TJm +(sometimes) 42.62 Tj +-307 TJm +(usef) 16.5977 Tj +1 TJm +(ul) 7.7509 Tj +-307 TJm +(to) 7.7509 Tj +-306 TJm +(kno) 14.9439 Tj +25 TJm +(w) 7.193 Tj +-306 TJm +(when) 21.579 Tj +-306 TJm +(the) 12.1743 Tj +-306 TJm +(compressed) 47.0334 Tj +-306 TJm +(stream) 26.5603 Tj +-306 TJm +(does) 18.2614 Tj +108 538.68 Td +(not) 12.7322 Tj +-250 TJm +(start) 17.1556 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(correct) 27.6562 Tj +-250 TJm +(magic) 24.3486 Tj +-250 TJm +(bytes) 21.031 Tj +-250 TJm +(\() 3.31755 Tj +[1 0 0 1 261.562 538.68] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -261.562 -538.68] cm +[1 0 0 1 0 0] Tm +0 0 Td +261.562 538.68 Td +/F134_0 9.9626 Tf +('B') 17.9327 Tj +-600 TJm +('Z') 17.9327 Tj +-600 TJm +('h') 17.9327 Tj +[1 0 0 1 327.316 538.68] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -327.316 -538.68] cm +[1 0 0 1 0 0] Tm +0 0 Td +327.316 538.68 Td +/F130_0 9.9626 Tf +(\).) 5.8082 Tj +[1 0 0 1 72 536.523] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -522.576] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 512.777 Td +/F134_0 9.9626 Tf +(BZ_IO_ERROR) 65.7532 Tj +[1 0 0 1 137.753 512.777] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -68.2441 -1.3101] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -511.467] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 500.822 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-233 TJm +(by) 9.9626 Tj +[1 0 0 1 159.123 500.822] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.123 -500.822] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.123 500.822 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 218.899 500.822] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -218.899 -500.822] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.218 500.822 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 237.923 500.822] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -237.923 -500.822] cm +[1 0 0 1 0 0] Tm +0 0 Td +237.923 500.822 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 303.676 500.822] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -303.676 -500.822] cm +[1 0 0 1 0 0] Tm +0 0 Td +305.995 500.822 Td +/F130_0 9.9626 Tf +(when) 21.579 Tj +-233 TJm +(there) 19.9152 Tj +-232 TJm +(is) 6.64505 Tj +-233 TJm +(an) 9.40469 Tj +-233 TJm +(error) 19.3573 Tj +-233 TJm +(reading) 29.8778 Tj +-232 TJm +(or) 8.29885 Tj +-233 TJm +(writing) 28.782 Tj +-233 TJm +(in) 7.7509 Tj +-233 TJm +(the) 12.1743 Tj +-232 TJm +(compressed) 47.0334 Tj +108 488.867 Td +(\002le,) 15.2229 Tj +-384 TJm +(and) 14.386 Tj +-357 TJm +(by) 9.9626 Tj +[1 0 0 1 158.511 488.867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.511 -488.867] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.511 488.867 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 242.197 488.867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -242.197 -488.867] cm +[1 0 0 1 0 0] Tm +0 0 Td +245.755 488.867 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 263.698 488.867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -263.698 -488.867] cm +[1 0 0 1 0 0] Tm +0 0 Td +263.698 488.867 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 353.362 488.867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -353.362 -488.867] cm +[1 0 0 1 0 0] Tm +0 0 Td +356.92 488.867 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-357 TJm +(attempts) 33.7633 Tj +-357 TJm +(to) 7.7509 Tj +-357 TJm +(use) 13.2801 Tj +-357 TJm +(a) 4.42339 Tj +-357 TJm +(\002le) 12.7322 Tj +-357 TJm +(for) 11.6164 Tj +-358 TJm +(which) 24.3486 Tj +-357 TJm +(the) 12.1743 Tj +-357 TJm +(error) 19.3573 Tj +108 476.912 Td +(indicator) 35.417 Tj +-260 TJm +(\(viz,) 17.9825 Tj +[1 0 0 1 166.603 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -166.603 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.603 476.912 Td +/F134_0 9.9626 Tf +(ferror\(f\)) 53.798 Tj +[1 0 0 1 220.401 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -220.401 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.401 476.912 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-260 TJm +(is) 6.64505 Tj +-260 TJm +(set.) 13.5591 Tj +-679 TJm +(On) 12.1743 Tj +-260 TJm +(receipt) 27.1082 Tj +-260 TJm +(of) 8.29885 Tj +[1 0 0 1 311.223 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -311.223 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +311.223 476.912 Td +/F134_0 9.9626 Tf +(BZ_IO_ERROR) 65.7532 Tj +[1 0 0 1 376.976 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -376.976 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +376.976 476.912 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-260 TJm +(the) 12.1743 Tj +-260 TJm +(caller) 22.1269 Tj +-260 TJm +(should) 26.5703 Tj +-260 TJm +(consult) 28.782 Tj +[1 0 0 1 482.068 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -482.068 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +482.068 476.912 Td +/F134_0 9.9626 Tf +(errno) 29.8878 Tj +[1 0 0 1 511.956 476.912] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.956 -476.912] cm +[1 0 0 1 0 0] Tm +0 0 Td +514.546 476.912 Td +/F130_0 9.9626 Tf +(and/or) 25.4544 Tj +[1 0 0 1 108 464.957] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -108 -464.957] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 464.957 Td +/F134_0 9.9626 Tf +(perror) 35.8654 Tj +[1 0 0 1 143.865 464.957] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.865 -464.957] cm +[1 0 0 1 0 0] Tm +0 0 Td +146.356 464.957 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(acquire) 29.3199 Tj +-250 TJm +(operating-system) 68.6224 Tj +-250 TJm +(speci\002c) 30.4357 Tj +-250 TJm +(information) 47.0434 Tj +-250 TJm +(about) 22.1369 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(problem.) 35.696 Tj +[1 0 0 1 72 462.8] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.9849] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -448.852] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 439.054 Td +/F134_0 9.9626 Tf +(BZ_UNEXPECTED_EOF) 101.619 Tj +[1 0 0 1 173.619 439.054] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -104.11 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -437.744] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 427.099 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-250 TJm +(by) 9.9626 Tj +[1 0 0 1 159.467 427.099] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.467 -427.099] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.467 427.099 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 219.242 427.099] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -219.242 -427.099] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.733 427.099 Td +/F130_0 9.9626 Tf +(when) 21.579 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(\002nishes) 30.4457 Tj +-250 TJm +(before) 25.4445 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(logical) 27.1182 Tj +-250 TJm +(end) 14.386 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(stream) 26.5603 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(detected.) 35.686 Tj +[1 0 0 1 72 424.942] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -410.994] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 401.196 Td +/F134_0 9.9626 Tf +(BZ_OUTBUFF_FULL) 89.6634 Tj +[1 0 0 1 161.664 401.196] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -92.1544 -1.31] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -399.886] cm +[1 0 0 1 0 0] Tm +0 0 Td +108 389.241 Td +/F130_0 9.9626 Tf +(Returned) 36.5229 Tj +-258 TJm +(by) 9.9626 Tj +[1 0 0 1 159.632 389.241] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.632 -389.241] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.632 389.241 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffCompress) 143.461 Tj +[1 0 0 1 303.094 389.241] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -303.094 -389.241] cm +[1 0 0 1 0 0] Tm +0 0 Td +305.668 389.241 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 322.627 389.241] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -322.627 -389.241] cm +[1 0 0 1 0 0] Tm +0 0 Td +322.627 389.241 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 478.044 389.241] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -478.044 -389.241] cm +[1 0 0 1 0 0] Tm +0 0 Td +480.618 389.241 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-258 TJm +(indicate) 31.5416 Tj +-259 TJm +(that) 14.9439 Tj +108 377.286 Td +(the) 12.1743 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(\002t) 8.30881 Tj +-250 TJm +(into) 15.5018 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-250 TJm +(pro) 13.2801 Tj +15 TJm +(vided.) 24.6275 Tj +[1 0 0 1 72 375.129] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -3.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -351.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 328.585 Td +/F122_0 20.6585 Tf +(3.3.) 34.4584 Tj +-278 TJm +(Lo) 25.2447 Tj +15 TJm +(w-le) 40.1808 Tj +15 TJm +(vel) 28.7153 Tj +-278 TJm +(interface) 86.1046 Tj +[1 0 0 1 72 328.327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -318.364] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 297.964 Td +/F122_0 17.2154 Tf +(3.3.1.) 43.0729 Tj +[1 0 0 1 119.858 297.964] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -297.964] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 297.964 Td +/F392_0 17.2154 Tf +(BZ2_bzCompressInit) 185.926 Tj +[1 0 0 1 305.785 297.964] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -233.785 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -244.779] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(11) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 15 15 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -296.523] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 274.969 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 271.382] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(typedef) 41.8429 Tj +-426 TJm +(struct) 35.8654 Tj +-426 TJm +({) 5.97756 Tj +98.4879 699.676 Td +(char) 23.9102 Tj +126.642 697.933 Td +(*) 5.97756 Tj +132.62 699.676 Td +(next_in;) 47.8205 Tj +98.4879 687.721 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(avail_in;) 53.798 Tj +98.4879 675.766 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(total_in_lo32;) 83.6858 Tj +98.4879 663.811 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(total_in_hi32;) 83.6858 Tj +98.4879 639.9 Td +(char) 23.9102 Tj +126.642 638.157 Td +(*) 5.97756 Tj +132.62 639.9 Td +(next_out;) 53.798 Tj +98.4879 627.945 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(avail_out;) 59.7756 Tj +98.4879 615.99 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(total_out_lo32;) 89.6634 Tj +98.4879 604.035 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(total_out_hi32;) 89.6634 Tj +98.4879 580.125 Td +(void) 23.9102 Tj +126.642 578.381 Td +(*) 5.97756 Tj +132.62 580.125 Td +(state;) 35.8654 Tj +98.4879 556.214 Td +(void) 23.9102 Tj +126.642 554.471 Td +(*) 5.97756 Tj +132.62 556.214 Td +(\() 5.97756 Tj +138.597 554.471 Td +(*) 5.97756 Tj +144.575 556.214 Td +(bzalloc\)\(void) 77.7083 Tj +226.527 554.471 Td +(*) 5.97756 Tj +232.505 556.214 Td +(,int,int\);) 59.7756 Tj +98.4879 544.259 Td +(void) 23.9102 Tj +-426 TJm +(\() 5.97756 Tj +132.62 542.516 Td +(*) 5.97756 Tj +138.597 544.259 Td +(bzfree\)\(void) 71.7307 Tj +214.572 542.516 Td +(*) 5.97756 Tj +220.55 544.259 Td +(,void) 29.8878 Tj +254.682 542.516 Td +(*) 5.97756 Tj +260.659 544.259 Td +(\);) 11.9551 Tj +98.4879 532.304 Td +(void) 23.9102 Tj +126.642 530.56 Td +(*) 5.97756 Tj +132.62 532.304 Td +(opaque;) 41.8429 Tj +89.9999 520.349 Td +(}) 5.97756 Tj +-426 TJm +(bz_stream;) 59.7756 Tj +89.9999 496.438 Td +(int) 17.9327 Tj +-426 TJm +(BZ2_bzCompressInit) 107.596 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +292.281 494.695 Td +(*) 5.97756 Tj +298.258 496.438 Td +(strm,) 29.8878 Tj +196.099 484.483 Td +(int) 17.9327 Tj +-426 TJm +(blockSize100k,) 83.6858 Tj +196.099 472.528 Td +(int) 17.9327 Tj +-426 TJm +(verbosity,) 59.7756 Tj +196.099 460.573 Td +(int) 17.9327 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 445.031] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -435.068] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 423.113 Td +/F130_0 9.9626 Tf +(Prepares) 34.3012 Tj +-356 TJm +(for) 11.6164 Tj +-356 TJm +(compression.) 52.8516 Tj +-1256 TJm +(The) 15.4918 Tj +[1 0 0 1 209.409 423.113] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -209.409 -423.113] cm +[1 0 0 1 0 0] Tm +0 0 Td +209.409 423.113 Td +/F134_0 9.9626 Tf +(bz_stream) 53.798 Tj +[1 0 0 1 263.208 423.113] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -263.208 -423.113] cm +[1 0 0 1 0 0] Tm +0 0 Td +266.754 423.113 Td +/F130_0 9.9626 Tf +(structure) 34.8591 Tj +-356 TJm +(holds) 21.589 Tj +-356 TJm +(all) 9.9626 Tj +-356 TJm +(data) 16.5977 Tj +-356 TJm +(pertaining) 40.3983 Tj +-356 TJm +(to) 7.7509 Tj +-356 TJm +(the) 12.1743 Tj +-356 TJm +(compression) 50.3609 Tj +-355 TJm +(acti) 14.386 Tj +25 TJm +(vity) 15.5018 Tj +65 TJm +(.) 2.49065 Tj +-1256 TJm +(A) 7.193 Tj +[1 0 0 1 72 411.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -411.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 411.158 Td +/F134_0 9.9626 Tf +(bz_stream) 53.798 Tj +[1 0 0 1 125.798 411.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -125.798 -411.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +128.581 411.158 Td +/F130_0 9.9626 Tf +(structure) 34.8591 Tj +-279 TJm +(should) 26.5703 Tj +-280 TJm +(be) 9.40469 Tj +-279 TJm +(allocated) 35.965 Tj +-279 TJm +(and) 14.386 Tj +-280 TJm +(initialised) 39.3025 Tj +-279 TJm +(prior) 19.3673 Tj +-279 TJm +(to) 7.7509 Tj +-279 TJm +(the) 12.1743 Tj +-280 TJm +(call.) 16.8766 Tj +-796 TJm +(The) 15.4918 Tj +-279 TJm +(\002elds) 21.589 Tj +-279 TJm +(of) 8.29885 Tj +[1 0 0 1 431.939 411.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -431.939 -411.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +431.939 411.158 Td +/F134_0 9.9626 Tf +(bz_stream) 53.798 Tj +[1 0 0 1 485.738 411.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -485.738 -411.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +488.52 411.158 Td +/F130_0 9.9626 Tf +(comprise) 36.5229 Tj +-279 TJm +(the) 12.1743 Tj +72 399.203 Td +(entirety) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(user) 16.5977 Tj +20 TJm +(-visible) 29.8878 Tj +-250 TJm +(data.) 19.0883 Tj +[1 0 0 1 204.422 399.203] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.422 -399.203] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.422 399.203 Td +/F134_0 9.9626 Tf +(state) 29.8878 Tj +[1 0 0 1 234.31 399.203] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.31 -399.203] cm +[1 0 0 1 0 0] Tm +0 0 Td +236.8 399.203 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(pointer) 28.224 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(pri) 11.0684 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ate) 11.6164 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(structures) 38.7346 Tj +-250 TJm +(required) 33.1954 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(compression.) 52.8516 Tj +[1 0 0 1 72 397.046] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -387.083] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 377.285 Td +/F130_0 9.9626 Tf +(Custom) 31.0036 Tj +-372 TJm +(memory) 33.2053 Tj +-372 TJm +(allocators) 38.7346 Tj +-372 TJm +(are) 12.1643 Tj +-372 TJm +(supported,) 41.7831 Tj +-403 TJm +(via) 12.1743 Tj +-372 TJm +(\002elds) 21.589 Tj +[1 0 0 1 288.908 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -288.908 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +288.908 377.285 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +[1 0 0 1 330.751 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -330.751 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +330.751 377.285 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 337.253 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -337.253 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +337.253 377.285 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +[1 0 0 1 373.118 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -373.118 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +373.118 377.285 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-403 TJm +(and) 14.386 Tj +[1 0 0 1 397.714 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -397.714 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +397.714 377.285 Td +/F134_0 9.9626 Tf +(opaque) 35.8654 Tj +[1 0 0 1 433.579 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -433.579 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +433.579 377.285 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1353 TJm +(The) 15.4918 Tj +-372 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +[1 0 0 1 493.782 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.782 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +493.782 377.285 Td +/F134_0 9.9626 Tf +(opaque) 35.8654 Tj +[1 0 0 1 529.648 377.285] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -529.648 -377.285] cm +[1 0 0 1 0 0] Tm +0 0 Td +533.355 377.285 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +72 365.33 Td +(passed) 26.5603 Tj +-306 TJm +(to) 7.7509 Tj +-306 TJm +(as) 8.29885 Tj +-306 TJm +(the) 12.1743 Tj +-306 TJm +(\002rst) 15.5018 Tj +-306 TJm +(ar) 7.74094 Tj +18 TJm +(gument) 29.8878 Tj +-306 TJm +(to) 7.7509 Tj +-306 TJm +(all) 9.9626 Tj +-306 TJm +(calls) 18.2614 Tj +-305 TJm +(to) 7.7509 Tj +[1 0 0 1 253.941 365.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.941 -365.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +253.941 365.33 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +[1 0 0 1 295.784 365.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -295.784 -365.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +298.832 365.33 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 316.266 365.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -316.266 -365.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +316.266 365.33 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +[1 0 0 1 352.132 365.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -352.132 -365.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +352.132 365.33 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-320 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-306 TJm +(is) 6.64505 Tj +-306 TJm +(otherwise) 38.7346 Tj +-306 TJm +(ignored) 30.4357 Tj +-306 TJm +(by) 9.9626 Tj +-306 TJm +(the) 12.1743 Tj +-306 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-955 TJm +(The) 15.4918 Tj +72 353.375 Td +(call) 14.386 Tj +[1 0 0 1 89.4309 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -89.4309 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +89.4309 353.375 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +-600 TJm +(\() 5.97756 Tj +-600 TJm +(opaque,) 41.8429 Tj +-600 TJm +(n,) 11.9551 Tj +-600 TJm +(m) 5.97756 Tj +-600 TJm +(\)) 5.97756 Tj +[1 0 0 1 232.893 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -232.893 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +235.938 353.375 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-306 TJm +(e) 4.42339 Tj +15 TJm +(xpected) 30.9837 Tj +-305 TJm +(to) 7.7509 Tj +-306 TJm +(return) 23.7907 Tj +-306 TJm +(a) 4.42339 Tj +-305 TJm +(pointer) 28.224 Tj +[1 0 0 1 360.3 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.3 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +360.3 353.375 Td +/F134_0 9.9626 Tf +(p) 5.97756 Tj +[1 0 0 1 366.277 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -366.277 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +369.322 353.375 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +[1 0 0 1 380.118 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -380.118 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +380.118 353.375 Td +/F134_0 9.9626 Tf +(n) 5.97756 Tj +392.073 351.631 Td +(*) 5.97756 Tj +404.029 353.375 Td +(m) 5.97756 Tj +[1 0 0 1 410.006 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.006 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +413.051 353.375 Td +/F130_0 9.9626 Tf +(bytes) 21.031 Tj +-306 TJm +(of) 8.29885 Tj +-305 TJm +(memory) 33.2053 Tj +65 TJm +(,) 2.49065 Tj +-320 TJm +(and) 14.386 Tj +[1 0 0 1 504.135 353.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -504.135 -353.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +504.135 353.375 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +72 341.42 Td +(\() 5.97756 Tj +-600 TJm +(opaque,) 41.8429 Tj +-600 TJm +(p) 5.97756 Tj +-600 TJm +(\)) 5.97756 Tj +[1 0 0 1 149.709 341.42] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.709 -341.42] cm +[1 0 0 1 0 0] Tm +0 0 Td +152.199 341.42 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-250 TJm +(free) 15.4819 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 339.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -329.3] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 319.502 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-280 TJm +(you) 14.9439 Tj +-280 TJm +(don') 18.2614 Tj +18 TJm +(t) 2.7696 Tj +-280 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-279 TJm +(to) 7.7509 Tj +-280 TJm +(use) 13.2801 Tj +-280 TJm +(a) 4.42339 Tj +-280 TJm +(custom) 28.782 Tj +-280 TJm +(memory) 33.2053 Tj +-279 TJm +(allocator) 34.8591 Tj +40 TJm +(,) 2.49065 Tj +-288 TJm +(set) 11.0684 Tj +[1 0 0 1 299.9 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -299.9 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +299.9 319.502 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +[1 0 0 1 341.743 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -341.743 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +341.743 319.502 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 347.096 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -347.096 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +347.096 319.502 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +[1 0 0 1 382.961 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.961 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +385.749 319.502 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 402.923 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -402.923 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +402.923 319.502 Td +/F134_0 9.9626 Tf +(opaque) 35.8654 Tj +[1 0 0 1 438.788 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -438.788 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +441.576 319.502 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +[1 0 0 1 452.115 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -452.115 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +452.115 319.502 Td +/F134_0 9.9626 Tf +(NULL) 23.9102 Tj +[1 0 0 1 476.025 319.502] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -476.025 -319.502] cm +[1 0 0 1 0 0] Tm +0 0 Td +476.025 319.502 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-280 TJm +(and) 14.386 Tj +-280 TJm +(the) 12.1743 Tj +-279 TJm +(library) 26.5603 Tj +72 307.547 Td +(will) 15.5018 Tj +-250 TJm +(then) 17.1556 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(standard) 33.7533 Tj +[1 0 0 1 176.318 307.547] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.318 -307.547] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.318 307.547 Td +/F134_0 9.9626 Tf +(malloc) 35.8654 Tj +[1 0 0 1 212.183 307.547] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -212.183 -307.547] cm +[1 0 0 1 0 0] Tm +0 0 Td +214.674 307.547 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 219.934 307.547] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -219.934 -307.547] cm +[1 0 0 1 0 0] Tm +0 0 Td +219.934 307.547 Td +/F134_0 9.9626 Tf +(free) 23.9102 Tj +[1 0 0 1 243.844 307.547] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.844 -307.547] cm +[1 0 0 1 0 0] Tm +0 0 Td +246.335 307.547 Td +/F130_0 9.9626 Tf +(routines.) 34.5901 Tj +[1 0 0 1 72 307.392] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -297.43] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 285.629 Td +/F130_0 9.9626 Tf +(Before) 27.1082 Tj +-362 TJm +(calling) 27.1182 Tj +[1 0 0 1 133.438 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -133.438 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +133.438 285.629 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 241.035 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -241.035 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +241.035 285.629 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-390 TJm +(\002elds) 21.589 Tj +[1 0 0 1 272.606 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.606 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +272.606 285.629 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +[1 0 0 1 314.449 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -314.449 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +314.449 285.629 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 320.825 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -320.825 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +320.825 285.629 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +[1 0 0 1 356.69 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -356.69 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +360.296 285.629 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 378.288 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -378.288 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +378.288 285.629 Td +/F134_0 9.9626 Tf +(opaque) 35.8654 Tj +[1 0 0 1 414.154 285.629] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -414.154 -285.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +417.76 285.629 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-362 TJm +(be) 9.40469 Tj +-362 TJm +(\002lled) 20.4831 Tj +-362 TJm +(appropriately) 53.1206 Tj +65 TJm +(,) 2.49065 Tj +72 273.674 Td +(as) 8.29885 Tj +-322 TJm +(just) 14.396 Tj +-323 TJm +(described.) 40.6673 Tj +-1055 TJm +(Upon) 22.1369 Tj +-322 TJm +(return,) 26.2813 Tj +-341 TJm +(the) 12.1743 Tj +-322 TJm +(internal) 30.4357 Tj +-323 TJm +(state) 18.2614 Tj +-322 TJm +(will) 15.5018 Tj +-323 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-322 TJm +(been) 18.8094 Tj +-323 TJm +(allocated) 35.965 Tj +-322 TJm +(and) 14.386 Tj +-323 TJm +(initialised,) 41.7931 Tj +-340 TJm +(and) 14.386 Tj +[1 0 0 1 459.801 273.674] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -459.801 -273.674] cm +[1 0 0 1 0 0] Tm +0 0 Td +459.801 273.674 Td +/F134_0 9.9626 Tf +(total_in_lo32) 77.7083 Tj +[1 0 0 1 537.509 273.674] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -273.674] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 273.674 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 72 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 261.718 Td +/F134_0 9.9626 Tf +(total_in_hi32) 77.7083 Tj +[1 0 0 1 149.709 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.709 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +149.709 261.718 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 155.006 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.006 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.006 261.718 Td +/F134_0 9.9626 Tf +(total_out_lo32) 83.6858 Tj +[1 0 0 1 238.692 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -238.692 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +241.435 261.718 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 258.564 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -258.564 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +258.564 261.718 Td +/F134_0 9.9626 Tf +(total_out_hi32) 83.6858 Tj +[1 0 0 1 342.25 261.718] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.25 -261.718] cm +[1 0 0 1 0 0] Tm +0 0 Td +344.994 261.718 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-275 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-276 TJm +(been) 18.8094 Tj +-275 TJm +(set) 11.0684 Tj +-275 TJm +(to) 7.7509 Tj +-276 TJm +(zero.) 19.6363 Tj +-772 TJm +(These) 23.7907 Tj +-275 TJm +(four) 16.5977 Tj +-276 TJm +(\002elds) 21.589 Tj +-275 TJm +(are) 12.1643 Tj +72 249.763 Td +(used) 18.2614 Tj +-340 TJm +(by) 9.9626 Tj +-339 TJm +(the) 12.1743 Tj +-340 TJm +(library) 26.5603 Tj +-339 TJm +(to) 7.7509 Tj +-340 TJm +(inform) 27.1182 Tj +-339 TJm +(the) 12.1743 Tj +-340 TJm +(caller) 22.1269 Tj +-339 TJm +(of) 8.29885 Tj +-340 TJm +(the) 12.1743 Tj +-339 TJm +(total) 17.7135 Tj +-340 TJm +(amount) 29.8878 Tj +-339 TJm +(of) 8.29885 Tj +-340 TJm +(data) 16.5977 Tj +-340 TJm +(passed) 26.5603 Tj +-339 TJm +(into) 15.5018 Tj +-340 TJm +(and) 14.386 Tj +-339 TJm +(out) 12.7322 Tj +-340 TJm +(of) 8.29885 Tj +-339 TJm +(the) 12.1743 Tj +-340 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-362 TJm +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(.) 2.49065 Tj +72 237.808 Td +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-376 TJm +(should) 26.5703 Tj +-377 TJm +(not) 12.7322 Tj +-376 TJm +(try) 11.0684 Tj +-376 TJm +(to) 7.7509 Tj +-377 TJm +(change) 28.2141 Tj +-376 TJm +(them.) 22.4159 Tj +-1378 TJm +(As) 11.0684 Tj +-377 TJm +(of) 8.29885 Tj +-376 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-377 TJm +(1.0,) 14.9439 Tj +-408 TJm +(64-bit) 23.8007 Tj +-376 TJm +(counts) 26.0123 Tj +-376 TJm +(are) 12.1643 Tj +-377 TJm +(maintained,) 46.7644 Tj +-408 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-376 TJm +(on) 9.9626 Tj +-376 TJm +(32-bit) 23.8007 Tj +-377 TJm +(platforms,) 40.6773 Tj +72 225.853 Td +(using) 21.589 Tj +-371 TJm +(the) 12.1743 Tj +[1 0 0 1 113.148 225.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.148 -225.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +113.148 225.853 Td +/F134_0 9.9626 Tf +(_hi32) 29.8878 Tj +[1 0 0 1 143.036 225.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.036 -225.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +146.729 225.853 Td +/F130_0 9.9626 Tf +(\002elds) 21.589 Tj +-371 TJm +(to) 7.7509 Tj +-370 TJm +(store) 19.3673 Tj +-371 TJm +(the) 12.1743 Tj +-371 TJm +(upper) 22.6848 Tj +-370 TJm +(32) 9.9626 Tj +-371 TJm +(bits) 14.396 Tj +-370 TJm +(of) 8.29885 Tj +-371 TJm +(the) 12.1743 Tj +-371 TJm +(count.) 24.6275 Tj +-1344 TJm +(So,) 13.0112 Tj +-400 TJm +(for) 11.6164 Tj +-371 TJm +(e) 4.42339 Tj +15 TJm +(xample,) 31.8205 Tj +-401 TJm +(the) 12.1743 Tj +-371 TJm +(total) 17.7135 Tj +-370 TJm +(amount) 29.8878 Tj +-371 TJm +(of) 8.29885 Tj +-370 TJm +(data) 16.5977 Tj +-371 TJm +(in) 7.7509 Tj +-371 TJm +(is) 6.64505 Tj +[1 0 0 1 72 213.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -213.898] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 213.898 Td +/F134_0 9.9626 Tf +(\(total_in_hi32) 83.6858 Tj +-600 TJm +(<<) 11.9551 Tj +-600 TJm +(32\)) 17.9327 Tj +-600 TJm +(+) 5.97756 Tj +-600 TJm +(total_in_lo32) 77.7083 Tj +[1 0 0 1 293.171 213.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -293.171 -213.898] cm +[1 0 0 1 0 0] Tm +0 0 Td +293.171 213.898 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 212.588] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -202.625] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 191.98 Td +/F130_0 9.9626 Tf +(P) 5.53921 Tj +15 TJm +(arameter) 34.8492 Tj +[1 0 0 1 115.367 191.98] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -115.367 -191.98] cm +[1 0 0 1 0 0] Tm +0 0 Td +115.367 191.98 Td +/F134_0 9.9626 Tf +(blockSize100k) 77.7083 Tj +[1 0 0 1 193.076 191.98] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -193.076 -191.98] cm +[1 0 0 1 0 0] Tm +0 0 Td +196.204 191.98 Td +/F130_0 9.9626 Tf +(speci\002es) 34.3112 Tj +-314 TJm +(the) 12.1743 Tj +-314 TJm +(block) 22.1369 Tj +-314 TJm +(size) 15.4918 Tj +-314 TJm +(to) 7.7509 Tj +-314 TJm +(be) 9.40469 Tj +-314 TJm +(used) 18.2614 Tj +-314 TJm +(for) 11.6164 Tj +-314 TJm +(compression.) 52.8516 Tj +-1004 TJm +(It) 6.08715 Tj +-314 TJm +(should) 26.5703 Tj +-314 TJm +(be) 9.40469 Tj +-315 TJm +(a) 4.42339 Tj +-314 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-314 TJm +(between) 33.1954 Tj +-314 TJm +(1) 4.9813 Tj +72 180.025 Td +(and) 14.386 Tj +-289 TJm +(9) 4.9813 Tj +-289 TJm +(inclusi) 26.5703 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +-299 TJm +(and) 14.386 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(actual) 23.7907 Tj +-289 TJm +(block) 22.1369 Tj +-289 TJm +(size) 15.4918 Tj +-289 TJm +(used) 18.2614 Tj +-289 TJm +(is) 6.64505 Tj +-289 TJm +(100000) 29.8878 Tj +-289 TJm +(x) 4.9813 Tj +-289 TJm +(this) 14.396 Tj +-289 TJm +(\002gure.) 25.7334 Tj +-854 TJm +(9) 4.9813 Tj +-290 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(best) 16.0497 Tj +-289 TJm +(compression) 50.3609 Tj +-289 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-289 TJm +(tak) 12.1743 Tj +10 TJm +(es) 8.29885 Tj +-289 TJm +(most) 19.3773 Tj +72 168.07 Td +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 165.913] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -155.95] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 146.152 Td +/F130_0 9.9626 Tf +(P) 5.53921 Tj +15 TJm +(arameter) 34.8492 Tj +[1 0 0 1 115.095 146.152] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -115.095 -146.152] cm +[1 0 0 1 0 0] Tm +0 0 Td +115.095 146.152 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 168.893 146.152] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -168.893 -146.152] cm +[1 0 0 1 0 0] Tm +0 0 Td +171.75 146.152 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-287 TJm +(be) 9.40469 Tj +-286 TJm +(set) 11.0684 Tj +-287 TJm +(to) 7.7509 Tj +-287 TJm +(a) 4.42339 Tj +-287 TJm +(number) 30.4357 Tj +-286 TJm +(between) 33.1954 Tj +-287 TJm +(0) 4.9813 Tj +-287 TJm +(and) 14.386 Tj +-287 TJm +(4) 4.9813 Tj +-286 TJm +(inclusi) 26.5703 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e.) 6.91404 Tj +-841 TJm +(0) 4.9813 Tj +-286 TJm +(is) 6.64505 Tj +-287 TJm +(silent,) 24.0796 Tj +-296 TJm +(and) 14.386 Tj +-287 TJm +(greater) 27.6562 Tj +-287 TJm +(numbers) 34.3112 Tj +-286 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +72 134.197 Td +(increasingly) 48.6972 Tj +-342 TJm +(v) 4.9813 Tj +15 TJm +(erbose) 26.0024 Tj +-342 TJm +(monitoring/deb) 61.4394 Tj +20 TJm +(ugging) 27.6761 Tj +-342 TJm +(output.) 27.9551 Tj +-1173 TJm +(If) 6.63509 Tj +-343 TJm +(the) 12.1743 Tj +-342 TJm +(library) 26.5603 Tj +-342 TJm +(has) 13.2801 Tj +-342 TJm +(been) 18.8094 Tj +-342 TJm +(compiled) 37.0808 Tj +-342 TJm +(with) 17.7135 Tj +[1 0 0 1 446.429 134.197] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -446.429 -134.197] cm +[1 0 0 1 0 0] Tm +0 0 Td +446.429 134.197 Td +/F134_0 9.9626 Tf +(-DBZ_NO_STDIO) 77.7083 Tj +[1 0 0 1 524.138 134.197] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -524.138 -134.197] cm +[1 0 0 1 0 0] Tm +0 0 Td +524.138 134.197 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-342 TJm +(no) 9.9626 Tj +72 122.242 Td +(such) 18.2614 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(appear) 26.5503 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(erbosity) 32.0995 Tj +-250 TJm +(setting.) 29.0609 Tj +[1 0 0 1 72 120.085] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -110.122] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 100.324 Td +/F130_0 9.9626 Tf +(P) 5.53921 Tj +15 TJm +(arameter) 34.8492 Tj +[1 0 0 1 116.619 100.324] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -116.619 -100.324] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.619 100.324 Td +/F134_0 9.9626 Tf +(workFactor) 59.7756 Tj +[1 0 0 1 176.394 100.324] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.394 -100.324] cm +[1 0 0 1 0 0] Tm +0 0 Td +180.775 100.324 Td +/F130_0 9.9626 Tf +(controls) 32.0995 Tj +-440 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-439 TJm +(the) 12.1743 Tj +-440 TJm +(compression) 50.3609 Tj +-440 TJm +(phase) 22.6848 Tj +-439 TJm +(beha) 18.8094 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-440 TJm +(when) 21.579 Tj +-439 TJm +(presented) 38.1767 Tj +-440 TJm +(with) 17.7135 Tj +-440 TJm +(w) 7.193 Tj +10 TJm +(orst) 14.9439 Tj +-439 TJm +(case,) 19.6363 Tj +-487 TJm +(highly) 25.4644 Tj +72 88.3686 Td +(repetiti) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +-433 TJm +(input) 20.4831 Tj +-396 TJm +(data.) 19.0883 Tj +-1496 TJm +(If) 6.63509 Tj +-396 TJm +(compression) 50.3609 Tj +-396 TJm +(runs) 17.1556 Tj +-397 TJm +(i) 2.7696 Tj +1 TJm +(nto) 12.7322 Tj +-397 TJm +(dif) 11.0684 Tj +25 TJm +(\002culties) 31.5516 Tj +-396 TJm +(caused) 27.1082 Tj +-396 TJm +(by) 9.9626 Tj +-396 TJm +(repetiti) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-396 TJm +(data,) 19.0883 Tj +-432 TJm +(the) 12.1743 Tj +-397 TJm +(library) 26.5603 Tj +-396 TJm +(switches) 34.3112 Tj +-396 TJm +(from) 19.3673 Tj +[1 0 0 1 72 50.8518] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(12) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 16 16 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(the) 12.1743 Tj +-255 TJm +(standard) 33.7533 Tj +-254 TJm +(sorting) 27.6761 Tj +-255 TJm +(algorithm) 38.7446 Tj +-254 TJm +(to) 7.7509 Tj +-255 TJm +(a) 4.42339 Tj +-255 TJm +(f) 3.31755 Tj +10 TJm +(allback) 28.772 Tj +-254 TJm +(algorithm.) 41.2352 Tj +-648 TJm +(The) 15.4918 Tj +-255 TJm +(f) 3.31755 Tj +10 TJm +(allback) 28.772 Tj +-254 TJm +(is) 6.64505 Tj +-255 TJm +(slo) 11.6264 Tj +25 TJm +(wer) 14.9339 Tj +-255 TJm +(than) 17.1556 Tj +-254 TJm +(the) 12.1743 Tj +-255 TJm +(standard) 33.7533 Tj +-254 TJm +(algorithm) 38.7446 Tj +-255 TJm +(by) 9.9626 Tj +-255 TJm +(perhaps) 30.9837 Tj +72 698.082 Td +(a) 4.42339 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(actor) 19.9152 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(three,) 22.4059 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(al) 7.193 Tj +10 TJm +(w) 7.193 Tj +10 TJm +(ays) 13.2801 Tj +-250 TJm +(beha) 18.8094 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-250 TJm +(reasonably) 43.158 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(no) 9.9626 Tj +-250 TJm +(matter) 25.4544 Tj +-250 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(bad) 14.386 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(input.) 22.9738 Tj +[1 0 0 1 72 695.925] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -685.964] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 676.165 Td +/F130_0 9.9626 Tf +(Lo) 11.0684 Tj +25 TJm +(wer) 14.9339 Tj +-240 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-239 TJm +(of) 8.29885 Tj +[1 0 0 1 138.421 676.165] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -138.421 -676.165] cm +[1 0 0 1 0 0] Tm +0 0 Td +138.421 676.165 Td +/F134_0 9.9626 Tf +(workFactor) 59.7756 Tj +[1 0 0 1 198.197 676.165] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.197 -676.165] cm +[1 0 0 1 0 0] Tm +0 0 Td +200.585 676.165 Td +/F130_0 9.9626 Tf +(reduce) 26.5503 Tj +-240 TJm +(the) 12.1743 Tj +-239 TJm +(amount) 29.8878 Tj +-240 TJm +(of) 8.29885 Tj +-240 TJm +(ef) 7.74094 Tj +25 TJm +(fort) 14.386 Tj +-239 TJm +(the) 12.1743 Tj +-240 TJm +(standard) 33.7533 Tj +-240 TJm +(algorithm) 38.7446 Tj +-239 TJm +(will) 15.5018 Tj +-240 TJm +(e) 4.42339 Tj +15 TJm +(xpend) 24.3486 Tj +-240 TJm +(before) 25.4445 Tj +-240 TJm +(resorting) 35.417 Tj +-239 TJm +(to) 7.7509 Tj +-240 TJm +(the) 12.1743 Tj +72 664.21 Td +(f) 3.31755 Tj +10 TJm +(allback.) 31.2626 Tj +-618 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-248 TJm +(should) 26.5703 Tj +-247 TJm +(set) 11.0684 Tj +-248 TJm +(this) 14.396 Tj +-247 TJm +(parameter) 39.8305 Tj +-248 TJm +(carefully;) 38.1767 Tj +-248 TJm +(too) 12.7322 Tj +-248 TJm +(lo) 7.7509 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(,) 2.49065 Tj +-248 TJm +(and) 14.386 Tj +-247 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +-248 TJm +(inputs) 24.3586 Tj +-248 TJm +(will) 15.5018 Tj +-247 TJm +(be) 9.40469 Tj +-248 TJm +(handled) 31.5416 Tj +-247 TJm +(by) 9.9626 Tj +-248 TJm +(the) 12.1743 Tj +-247 TJm +(f) 3.31755 Tj +10 TJm +(allback) 28.772 Tj +-248 TJm +(algorithm) 38.7446 Tj +72 652.255 Td +(and) 14.386 Tj +-308 TJm +(so) 8.85675 Tj +-308 TJm +(compress) 37.6287 Tj +-308 TJm +(rather) 23.2328 Tj +-309 TJm +(slo) 11.6264 Tj +25 TJm +(wly) 14.9439 Tj +65 TJm +(,) 2.49065 Tj +-322 TJm +(too) 12.7322 Tj +-309 TJm +(high,) 20.2042 Tj +-322 TJm +(and) 14.386 Tj +-308 TJm +(your) 18.2614 Tj +-309 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(erage-to-w) 43.148 Tj +10 TJm +(orst) 14.9439 Tj +-308 TJm +(case) 17.1456 Tj +-308 TJm +(compression) 50.3609 Tj +-308 TJm +(times) 21.589 Tj +-308 TJm +(can) 13.8281 Tj +-308 TJm +(become) 30.9837 Tj +-309 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-308 TJm +(lar) 10.5105 Tj +18 TJm +(ge.) 11.8953 Tj +72 640.3 Td +(The) 15.4918 Tj +-250 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(30) 9.9626 Tj +-250 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-250 TJm +(reasonable) 42.6001 Tj +-250 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +-250 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(wide) 19.3673 Tj +-250 TJm +(range) 22.1269 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(circumstances.) 58.9288 Tj +[1 0 0 1 72 638.143] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -628.181] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 618.383 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-250 TJm +(range) 22.1269 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(0) 4.9813 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(250) 14.9439 Tj +-250 TJm +(inclusi) 26.5703 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e.) 6.91404 Tj +-620 TJm +(0) 4.9813 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(special) 27.6661 Tj +-250 TJm +(case,) 19.6363 Tj +-250 TJm +(equi) 17.1556 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(alent) 19.3673 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(using) 21.589 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(def) 12.7222 Tj +10 TJm +(ault) 14.9439 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(30.) 12.4533 Tj +[1 0 0 1 72 616.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -606.265] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 596.466 Td +/F130_0 9.9626 Tf +(Note) 19.3673 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(generated) 38.7246 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(same) 20.4731 Tj +-250 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(ardless) 27.6661 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(whether) 32.0895 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(allback) 28.772 Tj +-250 TJm +(algorithm) 38.7446 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(used.) 20.7521 Tj +[1 0 0 1 72 594.309] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -584.348] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 574.549 Td +/F130_0 9.9626 Tf +(Be) 11.0684 Tj +-303 TJm +(a) 4.42339 Tj +15 TJm +(w) 7.193 Tj +10 TJm +(are) 12.1643 Tj +-303 TJm +(also) 16.0497 Tj +-303 TJm +(that) 14.9439 Tj +-303 TJm +(this) 14.396 Tj +-304 TJm +(parameter) 39.8305 Tj +-303 TJm +(may) 17.1556 Tj +-303 TJm +(disappear) 38.1767 Tj +-303 TJm +(entirely) 30.4357 Tj +-303 TJm +(in) 7.7509 Tj +-303 TJm +(future) 23.7907 Tj +-303 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-303 TJm +(of) 8.29885 Tj +-303 TJm +(the) 12.1743 Tj +-304 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-938 TJm +(In) 8.29885 Tj +-303 TJm +(principle) 35.417 Tj +-303 TJm +(it) 5.53921 Tj +-304 TJm +(should) 26.5703 Tj +-303 TJm +(be) 9.40469 Tj +72 562.594 Td +(possible) 32.6574 Tj +-270 TJm +(to) 7.7509 Tj +-270 TJm +(de) 9.40469 Tj +25 TJm +(vise) 16.0497 Tj +-270 TJm +(a) 4.42339 Tj +-270 TJm +(good) 19.9252 Tj +-270 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-270 TJm +(to) 7.7509 Tj +-271 TJm +(automat) 32.0995 Tj +1 TJm +(ically) 22.1369 Tj +-271 TJm +(choose) 27.6661 Tj +-270 TJm +(which) 24.3486 Tj +-270 TJm +(algorithm) 38.7446 Tj +-270 TJm +(to) 7.7509 Tj +-270 TJm +(use.) 15.7708 Tj +-740 TJm +(Such) 19.9252 Tj +-270 TJm +(a) 4.42339 Tj +-271 TJm +(m) 7.7509 Tj +1 TJm +(echanism) 37.6287 Tj +-271 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-270 TJm +(render) 25.4445 Tj +-270 TJm +(the) 12.1743 Tj +72 550.639 Td +(parameter) 39.8305 Tj +-250 TJm +(obsolete.) 35.696 Tj +[1 0 0 1 72 548.482] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -538.521] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 528.722 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 528.623] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -144.458] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 143.462 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 139.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -519.258] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 519.258 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 507.303 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 495.348 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 483.392 Td +(if) 11.9551 Tj +-426 TJm +(strm) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 471.437 Td +(or) 11.9551 Tj +-426 TJm +(blockSize) 53.798 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(1) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(blockSize) 53.798 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(9) 5.97756 Tj +98.4879 459.482 Td +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(4) 5.97756 Tj +98.4879 447.527 Td +(or) 11.9551 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(250) 17.9327 Tj +90 435.572 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 423.617 Td +(if) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(enough) 35.8654 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +90 411.661 Td +(BZ_OK) 29.8878 Tj +98.4879 399.706 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 384.165] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5482] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -374.203] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 362.248 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 362.148] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -48.8169] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 47.8207 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 44.2341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -352.783] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 352.783 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +98.4879 340.828 Td +(if) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(returned) 47.8205 Tj +98.4879 328.873 Td +(no) 11.9551 Tj +-426 TJm +(specific) 47.8205 Tj +-426 TJm +(action) 35.8654 Tj +-426 TJm +(needed) 35.8654 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(case) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(error) 29.8878 Tj +[1 0 0 1 72 313.331] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -303.37] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 282.711 Td +/F122_0 17.2154 Tf +(3.3.2.) 43.0729 Tj +[1 0 0 1 119.858 282.711] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -282.711] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 282.711 Td +/F392_0 17.2154 Tf +(BZ2_bzCompress) 144.609 Tj +[1 0 0 1 264.468 282.711] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.468 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -271.014] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 271.014 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzCompress) 83.6858 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +268.371 269.27 Td +(*) 5.97756 Tj +274.348 271.014 Td +(strm,) 29.8878 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(action) 35.8654 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 255.472] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5482] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -245.51] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 233.555 Td +/F130_0 9.9626 Tf +(Pro) 13.8381 Tj +15 TJm +(vides) 21.031 Tj +-222 TJm +(more) 20.4731 Tj +-221 TJm +(input) 20.4831 Tj +-222 TJm +(and/or) 25.4544 Tj +-222 TJm +(output) 25.4644 Tj +-222 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-221 TJm +(space) 22.1269 Tj +-222 TJm +(for) 11.6164 Tj +-222 TJm +(the) 12.1743 Tj +-221 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-601 TJm +(The) 15.4918 Tj +-222 TJm +(caller) 22.1269 Tj +-222 TJm +(maintains) 38.7446 Tj +-222 TJm +(input) 20.4831 Tj +-221 TJm +(and) 14.386 Tj +-222 TJm +(output) 25.4644 Tj +-222 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fers,) 17.4246 Tj +-227 TJm +(and) 14.386 Tj +-222 TJm +(calls) 18.2614 Tj +[1 0 0 1 72 221.6] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -221.6] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 221.6 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 155.686 221.6] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.686 -221.6] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.177 221.6 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(transfer) 30.4258 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(between) 33.1954 Tj +-250 TJm +(them.) 22.4159 Tj +[1 0 0 1 72 220.066] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -210.104] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 199.683 Td +/F130_0 9.9626 Tf +(Before) 27.1082 Tj +-212 TJm +(each) 18.2515 Tj +-213 TJm +(call) 14.386 Tj +-212 TJm +(to) 7.7509 Tj +[1 0 0 1 147.961 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -147.961 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +147.961 199.683 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 231.647 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -231.647 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +231.647 199.683 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 236.329 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -236.329 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +236.329 199.683 Td +/F134_0 9.9626 Tf +(next_in) 41.8429 Tj +[1 0 0 1 278.172 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.172 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +280.288 199.683 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-212 TJm +(point) 20.4831 Tj +-213 TJm +(at) 7.193 Tj +-212 TJm +(the) 12.1743 Tj +-213 TJm +(data) 16.5977 Tj +-212 TJm +(to) 7.7509 Tj +-212 TJm +(be) 9.40469 Tj +-213 TJm +(compressed,) 49.5241 Tj +-220 TJm +(and) 14.386 Tj +[1 0 0 1 463.493 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -463.493 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +463.493 199.683 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 511.314 199.683] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.314 -199.683] cm +[1 0 0 1 0 0] Tm +0 0 Td +513.43 199.683 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +72 187.728 Td +(indicate) 31.5416 Tj +-246 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-247 TJm +(m) 7.7509 Tj +1 TJm +(an) 9.40469 Tj +14 TJm +(y) 4.9813 Tj +-246 TJm +(bytes) 21.031 Tj +-246 TJm +(the) 12.1743 Tj +-246 TJm +(library) 26.5603 Tj +-247 TJm +(may) 17.1556 Tj +-246 TJm +(read.) 19.6363 Tj +[1 0 0 1 259.242 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -259.242 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +259.242 187.728 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 342.929 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.929 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +345.382 187.728 Td +/F130_0 9.9626 Tf +(updates) 30.4357 Tj +[1 0 0 1 378.271 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -378.271 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +378.271 187.728 Td +/F134_0 9.9626 Tf +(next_in) 41.8429 Tj +[1 0 0 1 420.114 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -420.114 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +420.114 187.728 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 425.066 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -425.066 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +425.066 187.728 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 472.886 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.886 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +475.34 187.728 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 492.179 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -492.179 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +492.179 187.728 Td +/F134_0 9.9626 Tf +(total_in) 47.8205 Tj +[1 0 0 1 540 187.728] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -187.728] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 175.773 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(re\003ect) 24.8965 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(bytes) 21.031 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(read.) 19.6363 Tj +[1 0 0 1 72 173.616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -163.654] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 153.856 Td +/F130_0 9.9626 Tf +(Similarly) 37.0908 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 113.611 153.856] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.611 -153.856] cm +[1 0 0 1 0 0] Tm +0 0 Td +113.611 153.856 Td +/F134_0 9.9626 Tf +(next_out) 47.8205 Tj +[1 0 0 1 161.432 153.856] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.432 -153.856] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.072 153.856 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-265 TJm +(point) 20.4831 Tj +-265 TJm +(to) 7.7509 Tj +-265 TJm +(a) 4.42339 Tj +-265 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-265 TJm +(in) 7.7509 Tj +-265 TJm +(which) 24.3486 Tj +-265 TJm +(the) 12.1743 Tj +-265 TJm +(compressed) 47.0334 Tj +-265 TJm +(data) 16.5977 Tj +-265 TJm +(is) 6.64505 Tj +-265 TJm +(to) 7.7509 Tj +-265 TJm +(be) 9.40469 Tj +-265 TJm +(placed,) 28.493 Tj +-269 TJm +(with) 17.7135 Tj +[1 0 0 1 464.742 153.856] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -464.742 -153.856] cm +[1 0 0 1 0 0] Tm +0 0 Td +464.742 153.856 Td +/F134_0 9.9626 Tf +(avail_out) 53.798 Tj +[1 0 0 1 518.54 153.856] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -518.54 -153.856] cm +[1 0 0 1 0 0] Tm +0 0 Td +521.181 153.856 Td +/F130_0 9.9626 Tf +(indi-) 18.8194 Tj +72 141.901 Td +(cating) 24.3486 Tj +-209 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-209 TJm +(much) 22.1369 Tj +-209 TJm +(output) 25.4644 Tj +-209 TJm +(space) 22.1269 Tj +-209 TJm +(is) 6.64505 Tj +-210 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable.) 29.0509 Tj +[1 0 0 1 243.087 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.087 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +243.087 141.901 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 326.773 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -326.773 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +328.856 141.901 Td +/F130_0 9.9626 Tf +(updates) 30.4357 Tj +[1 0 0 1 361.375 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -361.375 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +361.375 141.901 Td +/F134_0 9.9626 Tf +(next_out) 47.8205 Tj +[1 0 0 1 409.196 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -409.196 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +409.196 141.901 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 413.851 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -413.851 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +413.851 141.901 Td +/F134_0 9.9626 Tf +(avail_out) 53.798 Tj +[1 0 0 1 467.649 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -467.649 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +469.732 141.901 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 486.202 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -486.202 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +486.202 141.901 Td +/F134_0 9.9626 Tf +(total_out) 53.798 Tj +[1 0 0 1 540 141.901] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -141.901] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 129.946 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(re\003ect) 24.8965 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(bytes) 21.031 Tj +-250 TJm +(output.) 27.9551 Tj +[1 0 0 1 72 127.789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9617] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -117.827] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 108.029 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-272 TJm +(may) 17.1556 Tj +-272 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-272 TJm +(and) 14.386 Tj +-272 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-272 TJm +(as) 8.29885 Tj +-272 TJm +(little) 18.2714 Tj +-272 TJm +(or) 8.29885 Tj +-272 TJm +(as) 8.29885 Tj +-272 TJm +(much) 22.1369 Tj +-271 TJm +(data) 16.5977 Tj +-272 TJm +(as) 8.29885 Tj +-272 TJm +(you) 14.9439 Tj +-272 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-272 TJm +(on) 9.9626 Tj +-272 TJm +(each) 18.2515 Tj +-272 TJm +(call) 14.386 Tj +-272 TJm +(of) 8.29885 Tj +[1 0 0 1 399.123 108.029] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -399.123 -108.029] cm +[1 0 0 1 0 0] Tm +0 0 Td +399.123 108.029 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 482.809 108.029] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -482.809 -108.029] cm +[1 0 0 1 0 0] Tm +0 0 Td +482.809 108.029 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-752 TJm +(In) 8.29885 Tj +-272 TJm +(the) 12.1743 Tj +-272 TJm +(limit,) 21.32 Tj +72 96.0736 Td +(it) 5.53921 Tj +-266 TJm +(is) 6.64505 Tj +-265 TJm +(acceptable) 42.0422 Tj +-266 TJm +(to) 7.7509 Tj +-266 TJm +(supply) 26.5703 Tj +-266 TJm +(and) 14.386 Tj +-265 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-266 TJm +(data) 16.5977 Tj +-266 TJm +(one) 14.386 Tj +-265 TJm +(byte) 17.1556 Tj +-266 TJm +(at) 7.193 Tj +-266 TJm +(a) 4.42339 Tj +-266 TJm +(time,) 20.2042 Tj +-269 TJm +(although) 34.8691 Tj +-266 TJm +(this) 14.396 Tj +-266 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-265 TJm +(be) 9.40469 Tj +-266 TJm +(terribly) 29.3299 Tj +-266 TJm +(inef) 15.4918 Tj +25 TJm +(\002cient.) 27.3972 Tj +-714 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-266 TJm +(should) 26.5703 Tj +72 84.1184 Td +(al) 7.193 Tj +10 TJm +(w) 7.193 Tj +10 TJm +(ays) 13.2801 Tj +-250 TJm +(ensure) 26.0024 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(least) 18.2614 Tj +-250 TJm +(one) 14.386 Tj +-250 TJm +(byte) 17.1556 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(space) 22.1269 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable) 26.5603 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(each) 18.2515 Tj +-250 TJm +(call.) 16.8766 Tj +[1 0 0 1 72 81.9616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9616] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.1482] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(13) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 17 17 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(A) 7.193 Tj +-250 TJm +(second) 27.6661 Tj +-250 TJm +(purpose) 31.5416 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 156.662 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -156.662 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +156.662 710.037 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 240.348 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.348 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +242.839 710.037 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(request) 28.772 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(change) 28.2141 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(mode) 22.1369 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 707.88] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -697.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 688.12 Td +/F130_0 9.9626 Tf +(Conceptually) 53.1305 Tj +65 TJm +(,) 2.49065 Tj +-217 TJm +(a) 4.42339 Tj +-210 TJm +(compressed) 47.0334 Tj +-209 TJm +(stream) 26.5603 Tj +-209 TJm +(can) 13.8281 Tj +-209 TJm +(be) 9.40469 Tj +-210 TJm +(in) 7.7509 Tj +-209 TJm +(one) 14.386 Tj +-209 TJm +(of) 8.29885 Tj +-209 TJm +(four) 16.5977 Tj +-210 TJm +(states:) 24.9065 Tj +-289 TJm +(IDLE,) 25.1755 Tj +-209 TJm +(R) 6.64505 Tj +40 TJm +(UNNING,) 41.7732 Tj +-210 TJm +(FLUSHING) 49.2551 Tj +-209 TJm +(and) 14.386 Tj +-209 TJm +(FINISHING.) 52.2937 Tj +-419 TJm +(Be-) 14.386 Tj +72 676.164 Td +(fore) 16.0398 Tj +-264 TJm +(initialisation) 49.823 Tj +-263 TJm +(\() 3.31755 Tj +[1 0 0 1 146.434 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -146.434 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +146.434 676.164 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 254.031 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -254.031 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +254.031 676.164 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-264 TJm +(and) 14.386 Tj +-263 TJm +(after) 18.2515 Tj +-264 TJm +(termination) 45.9375 Tj +-264 TJm +(\() 3.31755 Tj +[1 0 0 1 349.75 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -349.75 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +349.75 676.164 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 451.369 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -451.369 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +451.369 676.164 Td +/F130_0 9.9626 Tf +(\),) 5.8082 Tj +-267 TJm +(a) 4.42339 Tj +-264 TJm +(stream) 26.5603 Tj +-264 TJm +(is) 6.64505 Tj +-263 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(arded) 22.1269 Tj +72 664.209 Td +(as) 8.29885 Tj +-250 TJm +(IDLE.) 25.1755 Tj +[1 0 0 1 72 664.11] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -654.147] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 642.291 Td +/F130_0 9.9626 Tf +(Upon) 22.1369 Tj +-389 TJm +(initialisation) 49.823 Tj +-390 TJm +(\() 3.31755 Tj +[1 0 0 1 155.036 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.036 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.036 642.291 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 262.632 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -262.632 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +262.632 642.291 Td +/F130_0 9.9626 Tf +(\),) 5.8082 Tj +-424 TJm +(the) 12.1743 Tj +-390 TJm +(stream) 26.5603 Tj +-389 TJm +(is) 6.64505 Tj +-389 TJm +(placed) 26.0024 Tj +-390 TJm +(in) 7.7509 Tj +-389 TJm +(the) 12.1743 Tj +-390 TJm +(R) 6.64505 Tj +40 TJm +(UNNING) 39.2825 Tj +-389 TJm +(state.) 20.7521 Tj +-1457 TJm +(Subsequent) 45.9375 Tj +-389 TJm +(calls) 18.2614 Tj +72 630.336 Td +(to) 7.7509 Tj +[1 0 0 1 83.818 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -83.818 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +83.818 630.336 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 167.504 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.504 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +171.571 630.336 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-408 TJm +(pass) 17.1556 Tj +[1 0 0 1 223.431 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -223.431 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +223.431 630.336 Td +/F134_0 9.9626 Tf +(BZ_RUN) 35.8654 Tj +[1 0 0 1 259.297 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -259.297 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +263.363 630.336 Td +/F130_0 9.9626 Tf +(as) 8.29885 Tj +-408 TJm +(the) 12.1743 Tj +-408 TJm +(requested) 38.1767 Tj +-409 TJm +(action;) 27.1182 Tj +-487 TJm +(other) 20.4731 Tj +-408 TJm +(actions) 28.224 Tj +-408 TJm +(are) 12.1643 Tj +-409 TJm +(ille) 12.7322 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(al) 7.193 Tj +-408 TJm +(and) 14.386 Tj +-408 TJm +(will) 15.5018 Tj +-408 TJm +(result) 22.1369 Tj +-409 TJm +(in) 7.7509 Tj +[1 0 0 1 72 618.381] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -618.381] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 618.381 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 173.619 618.381] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -173.619 -618.381] cm +[1 0 0 1 0 0] Tm +0 0 Td +173.619 618.381 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 617.071] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -607.108] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 596.463 Td +/F130_0 9.9626 Tf +(At) 9.9626 Tj +-279 TJm +(some) 21.031 Tj +-279 TJm +(point,) 22.9738 Tj +-286 TJm +(the) 12.1743 Tj +-279 TJm +(calling) 27.1182 Tj +-279 TJm +(program) 33.7533 Tj +-279 TJm +(will) 15.5018 Tj +-279 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-278 TJm +(pro) 13.2801 Tj +14 TJm +(vi) 7.7509 Tj +1 TJm +(ded) 14.386 Tj +-279 TJm +(all) 9.9626 Tj +-279 TJm +(the) 12.1743 Tj +-279 TJm +(input) 20.4831 Tj +-279 TJm +(data) 16.5977 Tj +-279 TJm +(it) 5.53921 Tj +-279 TJm +(w) 7.193 Tj +10 TJm +(ants) 16.0497 Tj +-279 TJm +(to.) 10.2416 Tj +-793 TJm +(It) 6.08715 Tj +-279 TJm +(will) 15.5018 Tj +-279 TJm +(then) 17.1556 Tj +-279 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-279 TJm +(to) 7.7509 Tj +-279 TJm +(\002nish) 22.1469 Tj +-279 TJm +(up) 9.9626 Tj +-279 TJm +(--) 6.63509 Tj +72 584.508 Td +(in) 7.7509 Tj +-287 TJm +(ef) 7.74094 Tj +25 TJm +(fect,) 17.4246 Tj +-297 TJm +(asking) 26.0123 Tj +-288 TJm +(the) 12.1743 Tj +-287 TJm +(library) 26.5603 Tj +-287 TJm +(to) 7.7509 Tj +-288 TJm +(process) 29.8778 Tj +-287 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-288 TJm +(data) 16.5977 Tj +-287 TJm +(it) 5.53921 Tj +-287 TJm +(might) 23.2527 Tj +-288 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-287 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fered) 20.4632 Tj +-288 TJm +(internally) 38.1866 Tj +65 TJm +(.) 2.49065 Tj +-844 TJm +(In) 8.29885 Tj +-288 TJm +(this) 14.396 Tj +-287 TJm +(state,) 20.7521 Tj +[1 0 0 1 456.314 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -456.314 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +456.314 584.508 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 540 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 572.553 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-258 TJm +(no) 9.9626 Tj +-257 TJm +(longer) 25.4544 Tj +-258 TJm +(attempt) 29.8878 Tj +-258 TJm +(to) 7.7509 Tj +-258 TJm +(read) 17.1456 Tj +-257 TJm +(data) 16.5977 Tj +-258 TJm +(from) 19.3673 Tj +[1 0 0 1 234.207 572.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.207 -572.553] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.207 572.553 Td +/F134_0 9.9626 Tf +(next_in) 41.8429 Tj +[1 0 0 1 276.051 572.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -276.051 -572.553] cm +[1 0 0 1 0 0] Tm +0 0 Td +276.051 572.553 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-260 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-257 TJm +(it) 5.53921 Tj +-258 TJm +(will) 15.5018 Tj +-258 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-257 TJm +(to) 7.7509 Tj +-258 TJm +(write) 20.4731 Tj +-258 TJm +(data) 16.5977 Tj +-258 TJm +(to) 7.7509 Tj +[1 0 0 1 407.082 572.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -407.082 -572.553] cm +[1 0 0 1 0 0] Tm +0 0 Td +407.082 572.553 Td +/F134_0 9.9626 Tf +(next_out) 47.8205 Tj +[1 0 0 1 454.902 572.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -454.902 -572.553] cm +[1 0 0 1 0 0] Tm +0 0 Td +454.902 572.553 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-666 TJm +(Because) 33.1954 Tj +-258 TJm +(the) 12.1743 Tj +-258 TJm +(output) 25.4644 Tj +72 560.598 Td +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-228 TJm +(supplied) 33.7633 Tj +-228 TJm +(by) 9.9626 Tj +-229 TJm +(the) 12.1743 Tj +-228 TJm +(user) 16.5977 Tj +-228 TJm +(can) 13.8281 Tj +-228 TJm +(be) 9.40469 Tj +-228 TJm +(arbitrarily) 39.8404 Tj +-229 TJm +(sma) 16.0497 Tj +1 TJm +(ll,) 8.02986 Tj +-233 TJm +(the) 12.1743 Tj +-228 TJm +(\002nishing-up) 48.1592 Tj +-228 TJm +(operation) 37.6287 Tj +-229 TJm +(cannot) 26.5603 Tj +-228 TJm +(necessarily) 44.2638 Tj +-228 TJm +(be) 9.40469 Tj +-228 TJm +(done) 19.3673 Tj +-228 TJm +(with) 17.7135 Tj +-229 TJm +(a) 4.42339 Tj +-228 TJm +(single) 23.8007 Tj +72 548.643 Td +(call) 14.386 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 99.6659 548.643] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -99.6659 -548.643] cm +[1 0 0 1 0 0] Tm +0 0 Td +99.6659 548.643 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 183.352 548.643] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.352 -548.643] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.352 548.643 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 547.108] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -537.146] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 526.725 Td +/F130_0 9.9626 Tf +(Instead,) 31.2626 Tj +-346 TJm +(the) 12.1743 Tj +-327 TJm +(calling) 27.1182 Tj +-326 TJm +(program) 33.7533 Tj +-327 TJm +(passes) 25.4544 Tj +[1 0 0 1 218.231 526.725] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -218.231 -526.725] cm +[1 0 0 1 0 0] Tm +0 0 Td +218.231 526.725 Td +/F134_0 9.9626 Tf +(BZ_FINISH) 53.798 Tj +[1 0 0 1 272.029 526.725] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.029 -526.725] cm +[1 0 0 1 0 0] Tm +0 0 Td +275.284 526.725 Td +/F130_0 9.9626 Tf +(as) 8.29885 Tj +-327 TJm +(an) 9.40469 Tj +-327 TJm +(action) 24.3486 Tj +-326 TJm +(to) 7.7509 Tj +[1 0 0 1 338.108 526.725] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -338.108 -526.725] cm +[1 0 0 1 0 0] Tm +0 0 Td +338.108 526.725 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 421.795 526.725] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -421.795 -526.725] cm +[1 0 0 1 0 0] Tm +0 0 Td +421.795 526.725 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1081 TJm +(This) 17.7135 Tj +-326 TJm +(changes) 32.0895 Tj +-327 TJm +(the) 12.1743 Tj +-327 TJm +(stream') 29.8778 Tj +55 TJm +(s) 3.87545 Tj +72 514.77 Td +(state) 18.2614 Tj +-291 TJm +(to) 7.7509 Tj +-290 TJm +(FINISHING.) 52.2937 Tj +-581 TJm +(An) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-291 TJm +(remaining) 40.3983 Tj +-290 TJm +(input) 20.4831 Tj +-291 TJm +(\(ie,) 13.0012 Tj +[1 0 0 1 264.452 514.77] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -264.452 -514.77] cm +[1 0 0 1 0 0] Tm +0 0 Td +264.452 514.77 Td +/F134_0 9.9626 Tf +(next_in[0) 53.798 Tj +-600 TJm +(..) 11.9551 Tj +-1200 TJm +(avail_in-1]) 65.7532 Tj +[1 0 0 1 413.892 514.77] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -413.892 -514.77] cm +[1 0 0 1 0 0] Tm +0 0 Td +413.892 514.77 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-291 TJm +(is) 6.64505 Tj +-290 TJm +(compressed) 47.0334 Tj +-291 TJm +(and) 14.386 Tj +-290 TJm +(transferred) 43.148 Tj +72 502.814 Td +(to) 7.7509 Tj +-421 TJm +(the) 12.1743 Tj +-421 TJm +(output) 25.4644 Tj +-421 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +55 TJm +(.) 2.49065 Tj +-1646 TJm +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-421 TJm +(do) 9.9626 Tj +-422 TJm +(this) 14.396 Tj +1 TJm +(,) 2.49065 Tj +[1 0 0 1 222.339 502.814] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -222.339 -502.814] cm +[1 0 0 1 0 0] Tm +0 0 Td +222.339 502.814 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 306.025 502.814] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -306.025 -502.814] cm +[1 0 0 1 0 0] Tm +0 0 Td +310.22 502.814 Td +/F130_0 9.9626 Tf +(must) 19.3773 Tj +-421 TJm +(be) 9.40469 Tj +-421 TJm +(called) 23.7907 Tj +-421 TJm +(repeatedly) 41.4942 Tj +-421 TJm +(until) 18.2714 Tj +-421 TJm +(all) 9.9626 Tj +-421 TJm +(the) 12.1743 Tj +-421 TJm +(output) 25.4644 Tj +-421 TJm +(has) 13.2801 Tj +-421 TJm +(been) 18.8094 Tj +72 490.859 Td +(consumed.) 42.889 Tj +-1397 TJm +(At) 9.9626 Tj +-379 TJm +(that) 14.9439 Tj +-380 TJm +(point,) 22.9738 Tj +[1 0 0 1 188.346 490.859] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -188.346 -490.859] cm +[1 0 0 1 0 0] Tm +0 0 Td +188.346 490.859 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 272.033 490.859] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.033 -490.859] cm +[1 0 0 1 0 0] Tm +0 0 Td +275.813 490.859 Td +/F130_0 9.9626 Tf +(returns) 27.6661 Tj +[1 0 0 1 307.259 490.859] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -307.259 -490.859] cm +[1 0 0 1 0 0] Tm +0 0 Td +307.259 490.859 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 384.968 490.859] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -384.968 -490.859] cm +[1 0 0 1 0 0] Tm +0 0 Td +384.968 490.859 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-379 TJm +(and) 14.386 Tj +-380 TJm +(the) 12.1743 Tj +-379 TJm +(stream') 29.8778 Tj +55 TJm +(s) 3.87545 Tj +-380 TJm +(state) 18.2614 Tj +-379 TJm +(is) 6.64505 Tj +-380 TJm +(set) 11.0684 Tj +-379 TJm +(back) 18.8094 Tj +-379 TJm +(to) 7.7509 Tj +72 478.904 Td +(IDLE.) 25.1755 Tj +[1 0 0 1 99.6662 478.904] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -99.6662 -478.904] cm +[1 0 0 1 0 0] Tm +0 0 Td +99.6662 478.904 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 201.285 478.904] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -201.285 -478.904] cm +[1 0 0 1 0 0] Tm +0 0 Td +203.776 478.904 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-250 TJm +(then) 17.1556 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(called.) 26.2813 Tj +[1 0 0 1 72 477.37] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -467.407] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 456.986 Td +/F130_0 9.9626 Tf +(Just) 15.5018 Tj +-380 TJm +(to) 7.7509 Tj +-380 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-379 TJm +(sure) 16.5977 Tj +-380 TJm +(the) 12.1743 Tj +-380 TJm +(calling) 27.1182 Tj +-380 TJm +(program) 33.7533 Tj +-379 TJm +(does) 18.2614 Tj +-380 TJm +(not) 12.7322 Tj +-380 TJm +(cheat,) 23.5117 Tj +-412 TJm +(the) 12.1743 Tj +-380 TJm +(library) 26.5603 Tj +-380 TJm +(mak) 17.1556 Tj +10 TJm +(es) 8.29885 Tj +-379 TJm +(a) 4.42339 Tj +-380 TJm +(note) 17.1556 Tj +-380 TJm +(of) 8.29885 Tj +[1 0 0 1 415.708 456.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -415.708 -456.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +415.708 456.986 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 463.528 456.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -463.528 -456.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +467.312 456.986 Td +/F130_0 9.9626 Tf +(at) 7.193 Tj +-380 TJm +(the) 12.1743 Tj +-380 TJm +(time) 17.7135 Tj +-379 TJm +(of) 8.29885 Tj +-380 TJm +(the) 12.1743 Tj +72 445.031 Td +(\002rst) 15.5018 Tj +-286 TJm +(call) 14.386 Tj +-286 TJm +(t) 2.7696 Tj +1 TJm +(o) 4.9813 Tj +[1 0 0 1 118.179 445.031] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -118.179 -445.031] cm +[1 0 0 1 0 0] Tm +0 0 Td +118.179 445.031 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 201.865 445.031] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -201.865 -445.031] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.713 445.031 Td +/F130_0 9.9626 Tf +(which) 24.3486 Tj +-286 TJm +(has) 13.2801 Tj +[1 0 0 1 248.035 445.031] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -248.035 -445.031] cm +[1 0 0 1 0 0] Tm +0 0 Td +248.035 445.031 Td +/F134_0 9.9626 Tf +(BZ_FINISH) 53.798 Tj +[1 0 0 1 301.833 445.031] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -301.833 -445.031] cm +[1 0 0 1 0 0] Tm +0 0 Td +304.68 445.031 Td +/F130_0 9.9626 Tf +(as) 8.29885 Tj +-286 TJm +(an) 9.40469 Tj +-286 TJm +(action) 24.3486 Tj +-285 TJm +(\(ie,) 13.0012 Tj +-295 TJm +(at) 7.193 Tj +-286 TJm +(the) 12.1743 Tj +-286 TJm +(time) 17.7135 Tj +-285 TJm +(the) 12.1743 Tj +-286 TJm +(program) 33.7533 Tj +-286 TJm +(has) 13.2801 Tj +-286 TJm +(announced) 43.158 Tj +-285 TJm +(its) 9.41466 Tj +72 433.076 Td +(intention) 35.427 Tj +-292 TJm +(to) 7.7509 Tj +-292 TJm +(not) 12.7322 Tj +-291 TJm +(supply) 26.5703 Tj +-292 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-292 TJm +(more) 20.4731 Tj +-292 TJm +(input\).) 26.2913 Tj +-870 TJm +(By) 11.6264 Tj +-292 TJm +(comparing) 42.61 Tj +-292 TJm +(this) 14.396 Tj +-292 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-291 TJm +(with) 17.7135 Tj +-292 TJm +(that) 14.9439 Tj +-292 TJm +(of) 8.29885 Tj +[1 0 0 1 392.862 433.076] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.862 -433.076] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.862 433.076 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 440.682 433.076] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -440.682 -433.076] cm +[1 0 0 1 0 0] Tm +0 0 Td +443.589 433.076 Td +/F130_0 9.9626 Tf +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-292 TJm +(subsequent) 44.2738 Tj +-292 TJm +(calls) 18.2614 Tj +-291 TJm +(to) 7.7509 Tj +[1 0 0 1 72 421.121] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -421.121] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 421.121 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 155.686 421.121] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.686 -421.121] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.686 421.121 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-247 TJm +(the) 12.1743 Tj +-247 TJm +(library) 26.5603 Tj +-246 TJm +(can) 13.8281 Tj +-247 TJm +(detect) 23.7907 Tj +-246 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-247 TJm +(att) 9.9626 Tj +1 TJm +(empts) 23.8007 Tj +-247 TJm +(to) 7.7509 Tj +-246 TJm +(slip) 14.396 Tj +-247 TJm +(in) 7.7509 Tj +-246 TJm +(more) 20.4731 Tj +-247 TJm +(data) 16.5977 Tj +-246 TJm +(to) 7.7509 Tj +-247 TJm +(compress.) 40.1194 Tj +-617 TJm +(An) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-247 TJm +(calls) 18.2614 Tj +-246 TJm +(for) 11.6164 Tj +-247 TJm +(which) 24.3486 Tj +-246 TJm +(this) 14.396 Tj +-247 TJm +(is) 6.64505 Tj +72 409.166 Td +(detected) 33.1954 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(return) 23.7907 Tj +[1 0 0 1 151.959 409.166] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -151.959 -409.166] cm +[1 0 0 1 0 0] Tm +0 0 Td +151.959 409.166 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 253.578 409.166] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.578 -409.166] cm +[1 0 0 1 0 0] Tm +0 0 Td +253.578 409.166 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-500 TJm +(This) 17.7135 Tj +-250 TJm +(indicates) 35.417 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(programming) 54.2364 Tj +-250 TJm +(mistak) 26.5703 Tj +10 TJm +(e) 4.42339 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(corrected.) 39.5515 Tj +[1 0 0 1 72 407.009] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -397.046] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 387.248 Td +/F130_0 9.9626 Tf +(Instead) 28.772 Tj +-224 TJm +(of) 8.29885 Tj +-223 TJm +(asking) 26.0123 Tj +-224 TJm +(to) 7.7509 Tj +-223 TJm +(\002nish,) 24.6375 Tj +-229 TJm +(the) 12.1743 Tj +-224 TJm +(calling) 27.1182 Tj +-223 TJm +(program) 33.7533 Tj +-224 TJm +(may) 17.1556 Tj +-224 TJm +(ask) 13.2801 Tj +[1 0 0 1 293.282 387.248] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -293.282 -387.248] cm +[1 0 0 1 0 0] Tm +0 0 Td +293.282 387.248 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 376.968 387.248] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -376.968 -387.248] cm +[1 0 0 1 0 0] Tm +0 0 Td +379.196 387.248 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-224 TJm +(tak) 12.1743 Tj +10 TJm +(e) 4.42339 Tj +-223 TJm +(all) 9.9626 Tj +-224 TJm +(the) 12.1743 Tj +-223 TJm +(remaining) 40.3983 Tj +-224 TJm +(input,) 22.9738 Tj +-229 TJm +(compress) 37.6287 Tj +72 375.293 Td +(it) 5.53921 Tj +-278 TJm +(and) 14.386 Tj +-278 TJm +(terminate) 37.6287 Tj +-278 TJm +(the) 12.1743 Tj +-278 TJm +(current) 28.2141 Tj +-277 TJm +(\(Burro) 26.5603 Tj +25 TJm +(ws-Wheeler\)) 51.4469 Tj +-278 TJm +(compression) 50.3609 Tj +-278 TJm +(block.) 24.6275 Tj +-787 TJm +(Th) 11.0684 Tj +-1 TJm +(i) 2.7696 Tj +1 TJm +(s) 3.87545 Tj +-278 TJm +(could) 22.1369 Tj +-278 TJm +(be) 9.40469 Tj +-278 TJm +(useful) 24.3486 Tj +-278 TJm +(for) 11.6164 Tj +-278 TJm +(error) 19.3573 Tj +-278 TJm +(control) 28.224 Tj +-278 TJm +(purposes.) 37.9077 Tj +72 363.338 Td +(The) 15.4918 Tj +-328 TJm +(mechanism) 45.3796 Tj +-328 TJm +(is) 6.64505 Tj +-328 TJm +(analogous) 40.3983 Tj +-328 TJm +(to) 7.7509 Tj +-328 TJm +(that) 14.9439 Tj +-328 TJm +(for) 11.6164 Tj +-328 TJm +(\002nishing:) 37.6487 Tj +-466 TJm +(call) 14.386 Tj +[1 0 0 1 297.049 363.337] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -297.049 -363.337] cm +[1 0 0 1 0 0] Tm +0 0 Td +297.049 363.337 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 380.735 363.337] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -380.735 -363.337] cm +[1 0 0 1 0 0] Tm +0 0 Td +384.003 363.337 Td +/F130_0 9.9626 Tf +(with) 17.7135 Tj +-328 TJm +(an) 9.40469 Tj +-328 TJm +(action) 24.3486 Tj +-328 TJm +(of) 8.29885 Tj +[1 0 0 1 456.841 363.337] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -456.841 -363.337] cm +[1 0 0 1 0 0] Tm +0 0 Td +456.841 363.337 Td +/F134_0 9.9626 Tf +(BZ_FLUSH) 47.8205 Tj +[1 0 0 1 504.662 363.337] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -504.662 -363.337] cm +[1 0 0 1 0 0] Tm +0 0 Td +504.662 363.337 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-328 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +72 351.382 Td +(output) 25.4644 Tj +-445 TJm +(data,) 19.0883 Tj +-494 TJm +(and) 14.386 Tj +-446 TJm +(persist) 26.0123 Tj +-445 TJm +(with) 17.7135 Tj +-445 TJm +(the) 12.1743 Tj +[1 0 0 1 213.94 351.382] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -213.94 -351.382] cm +[1 0 0 1 0 0] Tm +0 0 Td +213.94 351.382 Td +/F134_0 9.9626 Tf +(BZ_FLUSH) 47.8205 Tj +[1 0 0 1 261.761 351.382] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -261.761 -351.382] cm +[1 0 0 1 0 0] Tm +0 0 Td +266.195 351.382 Td +/F130_0 9.9626 Tf +(action) 24.3486 Tj +-445 TJm +(until) 18.2714 Tj +-445 TJm +(the) 12.1743 Tj +-446 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +[1 0 0 1 360.062 351.382] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.062 -351.382] cm +[1 0 0 1 0 0] Tm +0 0 Td +360.062 351.382 Td +/F134_0 9.9626 Tf +(BZ_RUN) 35.8654 Tj +[1 0 0 1 395.928 351.382] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -395.928 -351.382] cm +[1 0 0 1 0 0] Tm +0 0 Td +400.362 351.382 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-445 TJm +(returned.) 35.686 Tj +-1792 TJm +(As) 11.0684 Tj +-445 TJm +(with) 17.7135 Tj +-445 TJm +(\002nishing,) 37.3697 Tj +[1 0 0 1 72 339.427] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -339.427] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 339.427 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 155.686 339.427] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.686 -339.427] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.177 339.427 Td +/F130_0 9.9626 Tf +(detects) 27.6661 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(attempt) 29.8878 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-250 TJm +(more) 20.4731 Tj +-250 TJm +(input) 20.4831 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(once) 18.8094 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\003ush) 19.3773 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(be) 9.40469 Tj +15 TJm +(gun.) 17.4346 Tj +[1 0 0 1 72 337.27] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -327.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 317.509 Td +/F130_0 9.9626 Tf +(Once) 21.0211 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\003ush) 19.3773 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(complete,) 39.0135 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(stream) 26.5603 Tj +-250 TJm +(returns) 27.6661 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(normal) 28.224 Tj +-250 TJm +(R) 6.64505 Tj +40 TJm +(UNNING) 39.2825 Tj +-250 TJm +(state.) 20.7521 Tj +[1 0 0 1 72 315.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -305.39] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 295.591 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-344 TJm +(all) 9.9626 Tj +-343 TJm +(sounds) 27.6761 Tj +-344 TJm +(pretty) 23.2427 Tj +-344 TJm +(comple) 29.3299 Tj +15 TJm +(x,) 7.47195 Tj +-367 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-344 TJm +(isn') 14.9439 Tj +18 TJm +(t) 2.7696 Tj +-344 TJm +(really) 22.6848 Tj +65 TJm +(.) 2.49065 Tj +-1182 TJm +(Here') 22.6749 Tj +55 TJm +(s) 3.87545 Tj +-344 TJm +(a) 4.42339 Tj +-344 TJm +(table) 19.3673 Tj +-343 TJm +(which) 24.3486 Tj +-344 TJm +(sho) 13.8381 Tj +25 TJm +(ws) 11.0684 Tj +-344 TJm +(which) 24.3486 Tj +-344 TJm +(actions) 28.224 Tj +-343 TJm +(are) 12.1643 Tj +-344 TJm +(allo) 14.9439 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-344 TJm +(in) 7.7509 Tj +-344 TJm +(each) 18.2515 Tj +72 283.636 Td +(state,) 20.7521 Tj +-281 TJm +(what) 19.3673 Tj +-274 TJm +(action) 24.3486 Tj +-275 TJm +(will) 15.5018 Tj +-274 TJm +(be) 9.40469 Tj +-275 TJm +(tak) 12.1743 Tj +10 TJm +(en,) 11.8953 Tj +-280 TJm +(what) 19.3673 Tj +-275 TJm +(the) 12.1743 Tj +-274 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-275 TJm +(state) 18.2614 Tj +-274 TJm +(is,) 9.1357 Tj +-281 TJm +(and) 14.386 Tj +-274 TJm +(what) 19.3673 Tj +-275 TJm +(the) 12.1743 Tj +-275 TJm +(non-error) 37.6188 Tj +-274 TJm +(return) 23.7907 Tj +-275 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-274 TJm +(are.) 14.655 Tj +-767 TJm +(Note) 19.3673 Tj +-275 TJm +(that) 14.9439 Tj +-274 TJm +(you) 14.9439 Tj +-275 TJm +(can') 17.1456 Tj +18 TJm +(t) 2.7696 Tj +72 271.681 Td +(e) 4.42339 Tj +15 TJm +(xplicitly) 33.2153 Tj +-347 TJm +(ask) 13.2801 Tj +-348 TJm +(what) 19.3673 Tj +-347 TJm +(state) 18.2614 Tj +-348 TJm +(the) 12.1743 Tj +-347 TJm +(stream) 26.5603 Tj +-348 TJm +(is) 6.64505 Tj +-347 TJm +(in,) 10.2416 Tj +-372 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-347 TJm +(nor) 13.2801 Tj +-348 TJm +(do) 9.9626 Tj +-347 TJm +(you) 14.9439 Tj +-348 TJm +(need) 18.8094 Tj +-347 TJm +(to) 7.7509 Tj +-348 TJm +(--) 6.63509 Tj +-347 TJm +(it) 5.53921 Tj +-348 TJm +(can) 13.8281 Tj +-347 TJm +(be) 9.40469 Tj +-347 TJm +(inferred) 31.5316 Tj +-348 TJm +(from) 19.3673 Tj +-347 TJm +(the) 12.1743 Tj +-348 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-347 TJm +(returned) 33.1954 Tj +-348 TJm +(by) 9.9626 Tj +[1 0 0 1 72 259.726] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -259.726] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 259.726 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 155.686 259.726] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.686 -259.726] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.686 259.726 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 258.192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -207.34] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(14) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 18 18 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -595.402] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 573.848 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 570.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(IDLE/any) 47.8205 Tj +98.4879 699.676 Td +(Illegal.) 47.8205 Tj +-852 TJm +(IDLE) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(only) 23.9102 Tj +-426 TJm +(exists) 35.8654 Tj +-426 TJm +(after) 29.8878 Tj +-426 TJm +(BZ2_bzCompressEnd) 101.619 Tj +-426 TJm +(or) 11.9551 Tj +98.4879 687.721 Td +(before) 35.8654 Tj +-426 TJm +(BZ2_bzCompressInit.) 113.574 Tj +98.4879 675.766 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_SEQUENCE_ERROR) 101.619 Tj +90 651.856 Td +(RUNNING/BZ_RUN) 83.6858 Tj +98.4879 639.9 Td +(Compress) 47.8205 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(next_in) 41.8429 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(next_out) 47.8205 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(much) 23.9102 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(possible.) 53.798 Tj +98.4879 627.945 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(RUNNING) 41.8429 Tj +98.4879 615.99 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_RUN_OK) 53.798 Tj +90 592.08 Td +(RUNNING/BZ_FLUSH) 95.641 Tj +98.4879 580.125 Td +(Remember) 47.8205 Tj +-426 TJm +(current) 41.8429 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(next_in.) 47.8205 Tj +-426 TJm +(Compress) 47.8205 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(next_in) 41.8429 Tj +98.4879 568.169 Td +(to) 11.9551 Tj +-426 TJm +(next_out) 47.8205 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(much) 23.9102 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(possible,) 53.798 Tj +-426 TJm +(but) 17.9327 Tj +-426 TJm +(do) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(accept) 35.8654 Tj +-426 TJm +(any) 17.9327 Tj +-426 TJm +(more) 23.9102 Tj +-426 TJm +(input.) 35.8654 Tj +98.4879 556.214 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(FLUSHING) 47.8205 Tj +98.4879 544.259 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_FLUSH_OK) 65.7532 Tj +90 520.349 Td +(RUNNING/BZ_FINISH) 101.619 Tj +98.4879 508.394 Td +(Remember) 47.8205 Tj +-426 TJm +(current) 41.8429 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(next_in.) 47.8205 Tj +-426 TJm +(Compress) 47.8205 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(next_in) 41.8429 Tj +98.4879 496.438 Td +(to) 11.9551 Tj +-426 TJm +(next_out) 47.8205 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(much) 23.9102 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(possible,) 53.798 Tj +-426 TJm +(but) 17.9327 Tj +-426 TJm +(do) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(accept) 35.8654 Tj +-426 TJm +(any) 17.9327 Tj +-426 TJm +(more) 23.9102 Tj +-426 TJm +(input.) 35.8654 Tj +98.4879 484.483 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(FINISHING) 53.798 Tj +98.4879 472.528 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_FINISH_OK) 71.7307 Tj +90 448.618 Td +(FLUSHING/BZ_FLUSH) 101.619 Tj +98.4879 436.663 Td +(Compress) 47.8205 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(next_in) 41.8429 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(next_out) 47.8205 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(much) 23.9102 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(possible,) 53.798 Tj +98.4879 424.707 Td +(but) 17.9327 Tj +-426 TJm +(do) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(accept) 35.8654 Tj +-426 TJm +(any) 17.9327 Tj +-426 TJm +(more) 23.9102 Tj +-426 TJm +(input.) 35.8654 Tj +98.4879 412.752 Td +(If) 11.9551 Tj +-426 TJm +(all) 17.9327 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(existing) 47.8205 Tj +-426 TJm +(input) 29.8878 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(used) 23.9102 Tj +-426 TJm +(up) 11.9551 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(all) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +98.4879 400.797 Td +(output) 35.8654 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(removed) 41.8429 Tj +106.976 388.842 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(RUNNING;) 47.8205 Tj +-426 TJm +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_RUN_OK) 53.798 Tj +98.4879 376.887 Td +(else) 23.9102 Tj +106.976 364.932 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(FLUSHING;) 53.798 Tj +-426 TJm +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_FLUSH_OK) 65.7532 Tj +90 341.021 Td +(FLUSHING/other) 83.6858 Tj +98.4879 329.066 Td +(Illegal.) 47.8205 Tj +98.4879 317.111 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_SEQUENCE_ERROR) 101.619 Tj +90 293.201 Td +(FINISHING/BZ_FINISH) 113.574 Tj +98.4879 281.245 Td +(Compress) 47.8205 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(next_in) 41.8429 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(next_out) 47.8205 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(much) 23.9102 Tj +-426 TJm +(as) 11.9551 Tj +-426 TJm +(possible,) 53.798 Tj +98.4879 269.29 Td +(but) 17.9327 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(accept) 35.8654 Tj +-426 TJm +(any) 17.9327 Tj +-426 TJm +(more) 23.9102 Tj +-426 TJm +(input.) 35.8654 Tj +98.4879 257.335 Td +(If) 11.9551 Tj +-426 TJm +(all) 17.9327 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(existing) 47.8205 Tj +-426 TJm +(input) 29.8878 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(used) 23.9102 Tj +-426 TJm +(up) 11.9551 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(all) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +98.4879 245.38 Td +(output) 35.8654 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(removed) 41.8429 Tj +106.976 233.425 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(IDLE;) 29.8878 Tj +-426 TJm +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_STREAM_END) 77.7083 Tj +98.4879 221.47 Td +(else) 23.9102 Tj +106.976 209.514 Td +(Next) 23.9102 Tj +-426 TJm +(state) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(FINISHING;) 59.7756 Tj +-426 TJm +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_FINISH_OK) 71.7307 Tj +90 185.604 Td +(FINISHING/other) 89.6634 Tj +98.4879 173.649 Td +(Illegal.) 47.8205 Tj +98.4879 161.694 Td +(Return) 35.8654 Tj +-426 TJm +(value) 29.8878 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 72 146.152] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -136.189] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 124.234 Td +/F130_0 9.9626 Tf +(That) 18.2614 Tj +-250 TJm +(still) 14.9539 Tj +-250 TJm +(looks) 21.589 Tj +-250 TJm +(complicated?) 53.1206 Tj +-620 TJm +(W) 9.40469 Tj +80 TJm +(ell,) 12.4533 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(air) 10.5105 Tj +-250 TJm +(enough.) 31.8205 Tj +-620 TJm +(The) 15.4918 Tj +-250 TJm +(usual) 21.031 Tj +-250 TJm +(sequence) 36.5129 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(calls) 18.2614 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(compressing) 50.3609 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(load) 17.1556 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(is:) 9.41466 Tj +[1 0 0 1 72 122.077] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.7236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 7.3724 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -79.3724 -92.3537] cm +[1 0 0 1 0 0] Tm +0 0 Td +79.3724 92.3537 Td +/F130_0 9.9626 Tf +(1.) 7.47195 Tj +[1 0 0 1 86.8444 92.3537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.9253 -92.3537] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.9253 92.3537 Td +/F130_0 9.9626 Tf +(Get) 14.386 Tj +-250 TJm +(started) 26.5603 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 158.056 92.3537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.056 -92.3537] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.056 92.3537 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 265.653 92.3537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -265.653 -92.3537] cm +[1 0 0 1 0 0] Tm +0 0 Td +265.653 92.3537 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 268.144 92.3537] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.144 -41.5019] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.893 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(15) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 19 19 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -31.5168] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 7.3724 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -79.3724 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +79.3724 710.037 Td +/F130_0 9.9626 Tf +(2.) 7.47195 Tj +[1 0 0 1 86.8444 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.9253 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.9253 710.037 Td +/F130_0 9.9626 Tf +(Sho) 15.5018 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-240 TJm +(data) 16.5977 Tj +-240 TJm +(in) 7.7509 Tj +-241 TJm +(and) 14.386 Tj +-240 TJm +(shlurp) 24.9065 Tj +-240 TJm +(out) 12.7322 Tj +-240 TJm +(its) 9.41466 Tj +-240 TJm +(compressed) 47.0334 Tj +-241 TJm +(form) 19.3673 Tj +-240 TJm +(using) 21.589 Tj +-240 TJm +(zero) 17.1456 Tj +-240 TJm +(or) 8.29885 Tj +-240 TJm +(more) 20.4731 Tj +-241 TJm +(calls) 18.2614 Tj +-240 TJm +(of) 8.29885 Tj +[1 0 0 1 401.454 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -401.454 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +401.454 710.037 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 485.14 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -485.14 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +487.533 710.037 Td +/F130_0 9.9626 Tf +(with) 17.7135 Tj +-240 TJm +(action) 24.3486 Tj +-240 TJm +(=) 5.61891 Tj +[1 0 0 1 91.9253 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.9253 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.9253 698.082 Td +/F134_0 9.9626 Tf +(BZ_RUN) 35.8654 Tj +[1 0 0 1 127.791 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -127.791 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +127.791 698.082 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 130.281 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -58.2814 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 7.3724 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -79.3724 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +79.3724 676.164 Td +/F130_0 9.9626 Tf +(3.) 7.47195 Tj +[1 0 0 1 86.8444 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.9253 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.9253 676.164 Td +/F130_0 9.9626 Tf +(Finish) 24.9165 Tj +-242 TJm +(up.) 12.4533 Tj +-307 TJm +(Repeatedly) 44.8217 Tj +-241 TJm +(call) 14.386 Tj +[1 0 0 1 198.784 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -198.784 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +198.784 676.164 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 282.471 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -282.471 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +284.878 676.164 Td +/F130_0 9.9626 Tf +(with) 17.7135 Tj +-242 TJm +(action) 24.3486 Tj +-241 TJm +(=) 5.61891 Tj +[1 0 0 1 339.78 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -339.78 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +339.78 676.164 Td +/F134_0 9.9626 Tf +(BZ_FINISH) 53.798 Tj +[1 0 0 1 393.579 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -393.579 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +393.579 676.164 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-242 TJm +(cop) 14.386 Tj +10 TJm +(ying) 17.7135 Tj +-241 TJm +(out) 12.7322 Tj +-242 TJm +(the) 12.1743 Tj +-242 TJm +(compres) 33.7533 Tj +1 TJm +(sed) 13.2801 Tj +-242 TJm +(output,) 27.9551 Tj +91.9253 664.209 Td +(until) 18.2714 Tj +[1 0 0 1 112.687 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -112.687 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +112.687 664.209 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 190.396 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -190.396 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.886 664.209 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(returned.) 35.686 Tj +[1 0 0 1 237.708 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -165.708 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 7.3724 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -79.3724 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +79.3724 642.291 Td +/F130_0 9.9626 Tf +(4.) 7.47195 Tj +[1 0 0 1 86.8444 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.9253 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.9253 642.291 Td +/F130_0 9.9626 Tf +(Close) 22.6948 Tj +-250 TJm +(up) 9.9626 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(go) 9.9626 Tj +-250 TJm +(home.) 24.6275 Tj +-620 TJm +(Call) 16.6077 Tj +[1 0 0 1 208.796 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -208.796 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +208.796 642.291 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 310.415 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -310.415 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +310.415 642.291 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 312.906 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.906 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -630.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 620.374 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-269 TJm +(the) 12.1743 Tj +-270 TJm +(data) 16.5977 Tj +-269 TJm +(you) 14.9439 Tj +-270 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-269 TJm +(to) 7.7509 Tj +-270 TJm +(compress) 37.6287 Tj +-269 TJm +(\002ts) 12.1843 Tj +-270 TJm +(into) 15.5018 Tj +-269 TJm +(your) 18.2614 Tj +-270 TJm +(input) 20.4831 Tj +-269 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-270 TJm +(all) 9.9626 Tj +-269 TJm +(at) 7.193 Tj +-270 TJm +(once,) 21.3 Tj +-274 TJm +(you) 14.9439 Tj +-269 TJm +(can) 13.8281 Tj +-270 TJm +(skip) 16.6077 Tj +-269 TJm +(the) 12.1743 Tj +-270 TJm +(calls) 18.2614 Tj +-269 TJm +(of) 8.29885 Tj +[1 0 0 1 456.314 620.374] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -456.314 -620.374] cm +[1 0 0 1 0 0] Tm +0 0 Td +456.314 620.374 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +72 608.418 Td +(\() 5.97756 Tj +-600 TJm +(...,) 23.9102 Tj +-600 TJm +(BZ_RUN) 35.8654 Tj +-600 TJm +(\)) 5.97756 Tj +[1 0 0 1 161.664 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.664 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.154 608.418 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +-250 TJm +(just) 14.396 Tj +-250 TJm +(do) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +[1 0 0 1 225.036 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -225.036 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +225.036 608.418 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +-600 TJm +(\() 5.97756 Tj +-600 TJm +(...,) 23.9102 Tj +-600 TJm +(BZ_FINISH) 53.798 Tj +-600 TJm +(\)) 5.97756 Tj +[1 0 0 1 422.296 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -422.296 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +424.786 608.418 Td +/F130_0 9.9626 Tf +(calls.) 20.7521 Tj +[1 0 0 1 72 606.262] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -596.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 586.501 Td +/F130_0 9.9626 Tf +(All) 12.7322 Tj +-278 TJm +(required) 33.1954 Tj +-277 TJm +(memory) 33.2053 Tj +-278 TJm +(is) 6.64505 Tj +-277 TJm +(allocated) 35.965 Tj +-278 TJm +(by) 9.9626 Tj +[1 0 0 1 220.295 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -220.295 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.295 586.501 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 327.891 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -327.891 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +327.891 586.501 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-785 TJm +(The) 15.4918 Tj +-278 TJm +(compression) 50.3609 Tj +-277 TJm +(library) 26.5603 Tj +-278 TJm +(can) 13.8281 Tj +-277 TJm +(accept) 25.4445 Tj +-278 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-277 TJm +(data) 16.5977 Tj +-278 TJm +(at) 7.193 Tj +-278 TJm +(all) 9.9626 Tj +72 574.545 Td +(\(ob) 13.2801 Tj +15 TJm +(viously\).) 35.1481 Tj +-612 TJm +(So) 10.5205 Tj +-238 TJm +(you) 14.9439 Tj +-237 TJm +(shouldn') 34.8691 Tj +18 TJm +(t) 2.7696 Tj +-238 TJm +(get) 12.1743 Tj +-238 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-237 TJm +(error) 19.3573 Tj +-238 TJm +(return) 23.7907 Tj +-238 TJm +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +-238 TJm +(from) 19.3673 Tj +-237 TJm +(the) 12.1743 Tj +[1 0 0 1 339.287 574.545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -339.287 -574.545] cm +[1 0 0 1 0 0] Tm +0 0 Td +339.287 574.545 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 422.973 574.545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -422.973 -574.545] cm +[1 0 0 1 0 0] Tm +0 0 Td +425.342 574.545 Td +/F130_0 9.9626 Tf +(calls.) 20.7521 Tj +-612 TJm +(If) 6.63509 Tj +-238 TJm +(you) 14.9439 Tj +-237 TJm +(do,) 12.4533 Tj +-240 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-238 TJm +(will) 15.5018 Tj +-238 TJm +(be) 9.40469 Tj +[1 0 0 1 72 562.59] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -562.59] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 562.59 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +[1 0 0 1 173.619 562.59] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -173.619 -562.59] cm +[1 0 0 1 0 0] Tm +0 0 Td +173.619 562.59 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(indicate) 31.5416 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(your) 18.2614 Tj +-250 TJm +(programming.) 56.727 Tj +[1 0 0 1 72 560.433] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -550.471] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 540.673 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +35 TJm +(ri) 6.08715 Tj +25 TJm +(vial) 14.9439 Tj +-250 TJm +(other) 20.4731 Tj +-250 TJm +(possible) 32.6574 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 538.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8617] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -529.151] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 529.151 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 517.196 Td +(if) 11.9551 Tj +-426 TJm +(strm) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL,) 29.8878 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(strm->s) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +[1 0 0 1 72 501.654] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -491.691] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 471.033 Td +/F122_0 17.2154 Tf +(3.3.3.) 43.0729 Tj +[1 0 0 1 119.858 471.033] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -471.033] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 471.033 Td +/F392_0 17.2154 Tf +(BZ2_bzCompressEnd) 175.597 Tj +[1 0 0 1 295.455 471.033] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -223.455 -2.3326] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -459.335] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 459.335 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzCompressEnd) 101.619 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +286.303 457.592 Td +(*) 5.97756 Tj +292.281 459.335 Td +(strm) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 443.793] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -433.831] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 421.876 Td +/F130_0 9.9626 Tf +(Releases) 34.8591 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(memory) 33.2053 Tj +-250 TJm +(associated) 40.9463 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(compression) 50.3609 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 419.719] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -409.756] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 399.958 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 399.858] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -390.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 390.493 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +-852 TJm +(if) 11.9551 Tj +-426 TJm +(strm) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(strm->s) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +90 378.538 Td +(BZ_OK) 29.8878 Tj +-4686 TJm +(otherwise) 53.798 Tj +[1 0 0 1 72 362.996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -353.034] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 332.375 Td +/F122_0 17.2154 Tf +(3.3.4.) 43.0729 Tj +[1 0 0 1 119.858 332.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -332.375] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 332.375 Td +/F392_0 17.2154 Tf +(BZ2_bzDecompressInit) 206.585 Tj +[1 0 0 1 326.443 332.375] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -254.443 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -320.678] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 320.678 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzDecompressInit) 119.551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +304.236 318.934 Td +(*) 5.97756 Tj +310.214 320.678 Td +(strm,) 29.8878 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(verbosity,) 59.7756 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 305.136] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -295.173] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 283.218 Td +/F130_0 9.9626 Tf +(Prepares) 34.3012 Tj +-351 TJm +(for) 11.6164 Tj +-351 TJm +(decompression.) 62.2563 Tj +-1228 TJm +(As) 11.0684 Tj +-351 TJm +(with) 17.7135 Tj +[1 0 0 1 235.177 283.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -235.177 -283.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +235.177 283.218 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 342.773 283.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.773 -283.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +342.773 283.218 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-377 TJm +(a) 4.42339 Tj +[1 0 0 1 356.937 283.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -356.937 -283.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +356.937 283.218 Td +/F134_0 9.9626 Tf +(bz_stream) 53.798 Tj +[1 0 0 1 410.736 283.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.736 -283.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +414.235 283.218 Td +/F130_0 9.9626 Tf +(record) 25.4445 Tj +-351 TJm +(should) 26.5703 Tj +-351 TJm +(be) 9.40469 Tj +-352 TJm +(allocated) 35.965 Tj +-351 TJm +(and) 14.386 Tj +72 271.263 Td +(initialised) 39.3025 Tj +-306 TJm +(before) 25.4445 Tj +-305 TJm +(the) 12.1743 Tj +-306 TJm +(call.) 16.8766 Tj +-953 TJm +(Fields) 24.3586 Tj +[1 0 0 1 211.833 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -211.833 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +211.833 271.263 Td +/F134_0 9.9626 Tf +(bzalloc) 41.8429 Tj +[1 0 0 1 253.676 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -253.676 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +253.676 271.263 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 259.35 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -259.35 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +259.35 271.263 Td +/F134_0 9.9626 Tf +(bzfree) 35.8654 Tj +[1 0 0 1 295.215 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -295.215 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +298.26 271.263 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 315.69 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -315.69 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +315.69 271.263 Td +/F134_0 9.9626 Tf +(opaque) 35.8654 Tj +[1 0 0 1 351.556 271.263] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -351.556 -271.263] cm +[1 0 0 1 0 0] Tm +0 0 Td +354.6 271.263 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-306 TJm +(be) 9.40469 Tj +-305 TJm +(set) 11.0684 Tj +-306 TJm +(if) 6.08715 Tj +-305 TJm +(a) 4.42339 Tj +-306 TJm +(custom) 28.782 Tj +-305 TJm +(memory) 33.2053 Tj +-306 TJm +(allocator) 34.8591 Tj +-306 TJm +(is) 6.64505 Tj +72 259.308 Td +(required,) 35.686 Tj +-350 TJm +(or) 8.29885 Tj +-331 TJm +(made) 21.579 Tj +[1 0 0 1 147.635 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -147.635 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +147.635 259.308 Td +/F134_0 9.9626 Tf +(NULL) 23.9102 Tj +[1 0 0 1 171.546 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -171.546 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +174.835 259.308 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-330 TJm +(the) 12.1743 Tj +-331 TJm +(normal) 28.224 Tj +[1 0 0 1 236.722 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -236.722 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +236.722 259.308 Td +/F134_0 9.9626 Tf +(malloc) 35.8654 Tj +[1 0 0 1 272.587 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.587 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +275.878 259.308 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 281.938 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -281.938 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +281.938 259.308 Td +/F134_0 9.9626 Tf +(free) 23.9102 Tj +[1 0 0 1 305.848 259.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -305.848 -259.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +309.139 259.308 Td +/F130_0 9.9626 Tf +(routines.) 34.5901 Tj +-1102 TJm +(Upon) 22.1369 Tj +-330 TJm +(return,) 26.2813 Tj +-350 TJm +(the) 12.1743 Tj +-331 TJm +(internal) 30.4357 Tj +-330 TJm +(state) 18.2614 Tj +-330 TJm +(will) 15.5018 Tj +-330 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-331 TJm +(been) 18.8094 Tj +72 247.353 Td +(initialised,) 41.7931 Tj +-250 TJm +(and) 14.386 Tj +[1 0 0 1 133.16 247.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -133.16 -247.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +133.16 247.353 Td +/F134_0 9.9626 Tf +(total_in) 47.8205 Tj +[1 0 0 1 180.98 247.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -180.98 -247.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.471 247.353 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 200.348 247.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -200.348 -247.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +200.348 247.353 Td +/F134_0 9.9626 Tf +(total_out) 53.798 Tj +[1 0 0 1 254.146 247.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -254.146 -247.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +256.637 247.353 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(zero.) 19.6363 Tj +[1 0 0 1 72 245.913] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -235.951] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 225.435 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(meaning) 34.3112 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(parameter) 39.8305 Tj +[1 0 0 1 192.756 225.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.756 -225.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.756 225.435 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 246.554 225.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -246.554 -225.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +246.554 225.435 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(see) 12.7222 Tj +[1 0 0 1 266.748 225.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -266.748 -225.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +266.748 225.435 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 374.345 225.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -374.345 -225.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +374.345 225.435 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 223.278] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -213.315] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 203.517 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +[1 0 0 1 81.4975 203.517] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -81.4975 -203.517] cm +[1 0 0 1 0 0] Tm +0 0 Td +81.4975 203.517 Td +/F134_0 9.9626 Tf +(small) 29.8878 Tj +[1 0 0 1 111.385 203.517] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -111.385 -203.517] cm +[1 0 0 1 0 0] Tm +0 0 Td +114.248 203.517 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-287 TJm +(nonzero,) 34.5802 Tj +-297 TJm +(the) 12.1743 Tj +-287 TJm +(library) 26.5603 Tj +-288 TJm +(will) 15.5018 Tj +-287 TJm +(use) 13.2801 Tj +-287 TJm +(an) 9.40469 Tj +-287 TJm +(alternati) 32.6474 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-288 TJm +(decompression) 59.7656 Tj +-287 TJm +(algorithm) 38.7446 Tj +-287 TJm +(which) 24.3486 Tj +-288 TJm +(uses) 17.1556 Tj +-287 TJm +(less) 14.9439 Tj +-287 TJm +(memory) 33.2053 Tj +-287 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-288 TJm +(at) 7.193 Tj +-287 TJm +(the) 12.1743 Tj +72 191.562 Td +(cost) 16.0497 Tj +-289 TJm +(of) 8.29885 Tj +-290 TJm +(decompressing) 59.7656 Tj +-289 TJm +(more) 20.4731 Tj +-289 TJm +(slo) 11.6264 Tj +25 TJm +(wly) 14.9439 Tj +-290 TJm +(\(roughly) 34.3112 Tj +-289 TJm +(speaking,) 37.9077 Tj +-299 TJm +(half) 15.4918 Tj +-290 TJm +(the) 12.1743 Tj +-289 TJm +(speed,) 25.1755 Tj +-299 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-289 TJm +(the) 12.1743 Tj +-290 TJm +(maximum) 40.4083 Tj +-289 TJm +(memory) 33.2053 Tj +-289 TJm +(requirement) 48.1393 Tj +-290 TJm +(drops) 22.1369 Tj +72 179.607 Td +(to) 7.7509 Tj +-250 TJm +(around) 27.6661 Tj +-250 TJm +(2300k\).) 30.7147 Tj +-620 TJm +(See) 14.386 Tj +[1 0 0 1 166.166 179.607] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -166.166 -179.607] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.166 179.607 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(bzip2) 22.1369 Tj +[1 0 0 1 235.924 179.607] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +[1 0 0 1 -235.924 -179.607] cm +[1 0 0 1 0 0] Tm +0 0 Td +238.415 179.607 Td +/F130_0 9.9626 Tf +([2]) 11.6164 Tj +[1 0 0 1 250.031 179.607] cm +/DeviceRGB {} cs +[0 0 1] sc +/DeviceRGB {} CS +[0 0 1] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -250.031 -179.607] cm +[1 0 0 1 0 0] Tm +0 0 Td +252.522 179.607 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +-250 TJm +(more) 20.4731 Tj +-250 TJm +(information) 47.0434 Tj +-250 TJm +(on) 9.9626 Tj +-250 TJm +(memory) 33.2053 Tj +-250 TJm +(management.) 53.3995 Tj +[1 0 0 1 72 177.45] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -167.487] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 157.689 Td +/F130_0 9.9626 Tf +(Note) 19.3673 Tj +-289 TJm +(that) 14.9439 Tj +-290 TJm +(the) 12.1743 Tj +-289 TJm +(amount) 29.8878 Tj +-289 TJm +(of) 8.29885 Tj +-289 TJm +(memory) 33.2053 Tj +-290 TJm +(needed) 28.2141 Tj +-289 TJm +(to) 7.7509 Tj +-289 TJm +(decompress) 47.0334 Tj +-289 TJm +(a) 4.42339 Tj +-290 TJm +(stream) 26.5603 Tj +-289 TJm +(cannot) 26.5603 Tj +-289 TJm +(be) 9.40469 Tj +-289 TJm +(determined) 44.8217 Tj +-290 TJm +(until) 18.2714 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(stream') 29.8778 Tj +55 TJm +(s) 3.87545 Tj +-289 TJm +(header) 26.5503 Tj +-290 TJm +(has) 13.2801 Tj +72 145.734 Td +(been) 18.8094 Tj +-342 TJm +(read,) 19.6363 Tj +-366 TJm +(so) 8.85675 Tj +-342 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-342 TJm +(if) 6.08715 Tj +[1 0 0 1 161.081 145.734] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.081 -145.734] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.081 145.734 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 280.633 145.734] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -280.633 -145.734] cm +[1 0 0 1 0 0] Tm +0 0 Td +284.043 145.734 Td +/F130_0 9.9626 Tf +(succeeds,) 37.8977 Tj +-365 TJm +(a) 4.42339 Tj +-343 TJm +(subsequent) 44.2738 Tj +[1 0 0 1 381.098 145.734] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -381.098 -145.734] cm +[1 0 0 1 0 0] Tm +0 0 Td +381.098 145.734 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 476.739 145.734] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -476.739 -145.734] cm +[1 0 0 1 0 0] Tm +0 0 Td +480.149 145.734 Td +/F130_0 9.9626 Tf +(could) 22.1369 Tj +-342 TJm +(f) 3.31755 Tj +10 TJm +(ail) 9.9626 Tj +-343 TJm +(with) 17.7135 Tj +[1 0 0 1 72 133.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -133.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 133.779 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 143.731 133.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -133.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +143.731 133.779 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 132.469] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -122.506] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 111.861 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 111.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.9095] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(16) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 20 20 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -117.195] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 95.6413 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 92.0547] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 687.721 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 675.766 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(&&) 11.9551 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(1) 5.97756 Tj +-426 TJm +(\)) 5.97756 Tj +98.4879 663.811 Td +(or) 11.9551 Tj +-426 TJm +(\(verbosity) 59.7756 Tj +-426 TJm +(<;) 11.9551 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(||) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(4\)) 11.9551 Tj +90 651.856 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 639.9 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +[1 0 0 1 72 624.359] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5865] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -614.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 602.441 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 602.341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -48.8169] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 47.8207 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 44.2341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -592.976] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 592.976 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +98.4879 581.021 Td +(if) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(returned) 47.8205 Tj +98.4879 569.066 Td +(no) 11.9551 Tj +-426 TJm +(specific) 47.8205 Tj +-426 TJm +(action) 35.8654 Tj +-426 TJm +(required) 47.8205 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(case) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(error) 29.8878 Tj +[1 0 0 1 72 553.524] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -543.562] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 522.903 Td +/F122_0 17.2154 Tf +(3.3.5.) 43.0729 Tj +[1 0 0 1 119.858 522.903] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -522.903] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 522.903 Td +/F392_0 17.2154 Tf +(BZ2_bzDecompress) 165.268 Tj +[1 0 0 1 285.126 522.903] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -213.126 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -511.206] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 511.206 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzDecompress) 95.641 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +280.326 509.462 Td +(*) 5.97756 Tj +286.303 511.206 Td +(strm) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 495.664] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 473.746 Td +/F130_0 9.9626 Tf +(Pro) 13.8381 Tj +15 TJm +(vides) 21.031 Tj +-301 TJm +(more) 20.4731 Tj +-302 TJm +(input) 20.4831 Tj +-301 TJm +(and/out) 29.8878 Tj +-302 TJm +(output) 25.4644 Tj +-301 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-301 TJm +(space) 22.1269 Tj +-302 TJm +(for) 11.6164 Tj +-301 TJm +(the) 12.1743 Tj +-302 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-928 TJm +(The) 15.4918 Tj +-301 TJm +(caller) 22.1269 Tj +-302 TJm +(maintains) 38.7446 Tj +-301 TJm +(input) 20.4831 Tj +-302 TJm +(and) 14.386 Tj +-301 TJm +(output) 25.4644 Tj +-301 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fers,) 17.4246 Tj +-315 TJm +(and) 14.386 Tj +72 461.791 Td +(uses) 17.1556 Tj +[1 0 0 1 91.6461 461.791] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -91.6461 -461.791] cm +[1 0 0 1 0 0] Tm +0 0 Td +91.6461 461.791 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 187.287 461.791] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -187.287 -461.791] cm +[1 0 0 1 0 0] Tm +0 0 Td +189.778 461.791 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(transfer) 30.4258 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(between) 33.1954 Tj +-250 TJm +(them.) 22.4159 Tj +[1 0 0 1 72 460.257] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -450.294] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 439.873 Td +/F130_0 9.9626 Tf +(Before) 27.1082 Tj +-498 TJm +(each) 18.2515 Tj +-499 TJm +(call) 14.386 Tj +-498 TJm +(to) 7.7509 Tj +[1 0 0 1 159.356 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.356 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.356 439.873 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 254.997 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -254.997 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +254.997 439.873 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 263.071 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -263.071 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +263.071 439.873 Td +/F134_0 9.9626 Tf +(next_in) 41.8429 Tj +[1 0 0 1 304.914 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -304.914 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +309.879 439.873 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-498 TJm +(point) 20.4831 Tj +-499 TJm +(at) 7.193 Tj +-498 TJm +(the) 12.1743 Tj +-498 TJm +(compressed) 47.0334 Tj +-499 TJm +(data,) 19.0883 Tj +-560 TJm +(and) 14.386 Tj +[1 0 0 1 492.179 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -492.179 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +492.179 439.873 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 540 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 427.918 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-308 TJm +(indicate) 31.5416 Tj +-308 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-309 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +-308 TJm +(bytes) 21.031 Tj +-308 TJm +(the) 12.1743 Tj +-308 TJm +(library) 26.5603 Tj +-308 TJm +(may) 17.1556 Tj +-309 TJm +(read.) 19.6363 Tj +[1 0 0 1 294.955 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -294.955 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.955 427.918 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 390.597 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -390.597 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +393.667 427.918 Td +/F130_0 9.9626 Tf +(updates) 30.4357 Tj +[1 0 0 1 427.173 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -427.173 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +427.173 427.918 Td +/F134_0 9.9626 Tf +(next_in) 41.8429 Tj +[1 0 0 1 469.016 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -469.016 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +469.016 427.918 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 474.723 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -474.723 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +474.723 427.918 Td +/F134_0 9.9626 Tf +(avail_in) 47.8205 Tj +[1 0 0 1 522.543 427.918] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -522.543 -427.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +525.614 427.918 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 72 415.963] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -415.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 415.963 Td +/F134_0 9.9626 Tf +(total_in) 47.8205 Tj +[1 0 0 1 119.821 415.963] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.821 -415.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +122.311 415.963 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(re\003ect) 24.8965 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(bytes) 21.031 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(read.) 19.6363 Tj +[1 0 0 1 72 413.806] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -403.843] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 394.045 Td +/F130_0 9.9626 Tf +(Similarly) 37.0908 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 113.799 394.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.799 -394.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +113.799 394.045 Td +/F134_0 9.9626 Tf +(next_out) 47.8205 Tj +[1 0 0 1 161.62 394.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.62 -394.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.41 394.045 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-280 TJm +(point) 20.4831 Tj +-280 TJm +(to) 7.7509 Tj +-280 TJm +(a) 4.42339 Tj +-280 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-280 TJm +(in) 7.7509 Tj +-281 TJm +(which) 24.3486 Tj +-280 TJm +(the) 12.1743 Tj +-280 TJm +(uncompressed) 56.996 Tj +-280 TJm +(output) 25.4644 Tj +-280 TJm +(is) 6.64505 Tj +-280 TJm +(to) 7.7509 Tj +-280 TJm +(be) 9.40469 Tj +-280 TJm +(placed,) 28.493 Tj +-288 TJm +(with) 17.7135 Tj +[1 0 0 1 486.202 394.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -486.202 -394.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +486.202 394.045 Td +/F134_0 9.9626 Tf +(avail_out) 53.798 Tj +[1 0 0 1 540 394.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -394.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 382.09 Td +/F130_0 9.9626 Tf +(indicating) 39.8504 Tj +-525 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-524 TJm +(much) 22.1369 Tj +-525 TJm +(output) 25.4644 Tj +-524 TJm +(space) 22.1269 Tj +-525 TJm +(is) 6.64505 Tj +-525 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable.) 29.0509 Tj +[1 0 0 1 285.792 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -285.792 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +285.792 382.09 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 369.478 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -369.478 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +374.705 382.09 Td +/F130_0 9.9626 Tf +(updates) 30.4357 Tj +[1 0 0 1 410.367 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.367 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +410.367 382.09 Td +/F134_0 9.9626 Tf +(next_out) 47.8205 Tj +[1 0 0 1 458.188 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -458.188 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +458.188 382.09 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 466.589 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -466.589 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +466.589 382.09 Td +/F134_0 9.9626 Tf +(avail_out) 53.798 Tj +[1 0 0 1 520.387 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -520.387 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +525.614 382.09 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 72 370.135] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -370.135] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 370.135 Td +/F134_0 9.9626 Tf +(total_out) 53.798 Tj +[1 0 0 1 125.798 370.135] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -125.798 -370.135] cm +[1 0 0 1 0 0] Tm +0 0 Td +128.289 370.135 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(re\003ect) 24.8965 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(bytes) 21.031 Tj +-250 TJm +(output.) 27.9551 Tj +[1 0 0 1 72 367.978] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -358.015] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 348.217 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-320 TJm +(may) 17.1556 Tj +-321 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-320 TJm +(and) 14.386 Tj +-321 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-320 TJm +(as) 8.29885 Tj +-321 TJm +(little) 18.2714 Tj +-320 TJm +(or) 8.29885 Tj +-320 TJm +(as) 8.29885 Tj +-321 TJm +(much) 22.1369 Tj +-320 TJm +(data) 16.5977 Tj +-321 TJm +(as) 8.29885 Tj +-320 TJm +(you) 14.9439 Tj +-321 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-320 TJm +(on) 9.9626 Tj +-320 TJm +(each) 18.2515 Tj +-321 TJm +(call) 14.386 Tj +-320 TJm +(of) 8.29885 Tj +[1 0 0 1 407.816 348.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -407.816 -348.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +407.816 348.217 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 503.457 348.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -503.457 -348.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +503.457 348.217 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1043 TJm +(In) 8.29885 Tj +-320 TJm +(the) 12.1743 Tj +72 336.262 Td +(limit,) 21.32 Tj +-295 TJm +(it) 5.53921 Tj +-286 TJm +(is) 6.64505 Tj +-287 TJm +(acceptable) 42.0422 Tj +-286 TJm +(to) 7.7509 Tj +-286 TJm +(supply) 26.5703 Tj +-286 TJm +(and) 14.386 Tj +-287 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-286 TJm +(data) 16.5977 Tj +-286 TJm +(one) 14.386 Tj +-286 TJm +(byte) 17.1556 Tj +-287 TJm +(at) 7.193 Tj +-286 TJm +(a) 4.42339 Tj +-286 TJm +(time,) 20.2042 Tj +-295 TJm +(although) 34.8691 Tj +-286 TJm +(this) 14.396 Tj +-287 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-286 TJm +(be) 9.40469 Tj +-286 TJm +(terribly) 29.3299 Tj +-286 TJm +(inef) 15.4918 Tj +25 TJm +(\002cient.) 27.3972 Tj +-838 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +72 324.306 Td +(should) 26.5703 Tj +-250 TJm +(al) 7.193 Tj +10 TJm +(w) 7.193 Tj +10 TJm +(ays) 13.2801 Tj +-250 TJm +(ensure) 26.0024 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(least) 18.2614 Tj +-250 TJm +(one) 14.386 Tj +-250 TJm +(byte) 17.1556 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(space) 22.1269 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable) 26.5603 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(each) 18.2515 Tj +-250 TJm +(call.) 16.8766 Tj +[1 0 0 1 72 322.15] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -312.187] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 302.389 Td +/F130_0 9.9626 Tf +(Use) 15.4918 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 100.772 302.389] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -100.772 -302.389] cm +[1 0 0 1 0 0] Tm +0 0 Td +100.772 302.389 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 196.413 302.389] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.413 -302.389] cm +[1 0 0 1 0 0] Tm +0 0 Td +198.904 302.389 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(simpler) 29.8878 Tj +-250 TJm +(than) 17.1556 Tj +[1 0 0 1 260.064 302.389] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -260.064 -302.389] cm +[1 0 0 1 0 0] Tm +0 0 Td +260.064 302.389 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 343.75 302.389] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -343.75 -302.389] cm +[1 0 0 1 0 0] Tm +0 0 Td +343.75 302.389 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 300.232] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -290.269] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 280.471 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-346 TJm +(should) 26.5703 Tj +-347 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-346 TJm +(input) 20.4831 Tj +-346 TJm +(and) 14.386 Tj +-346 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-347 TJm +(output) 25.4644 Tj +-346 TJm +(as) 8.29885 Tj +-346 TJm +(described) 38.1767 Tj +-346 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +-371 TJm +(and) 14.386 Tj +-346 TJm +(repeatedly) 41.4942 Tj +-346 TJm +(call) 14.386 Tj +[1 0 0 1 422.638 280.471] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -422.638 -280.471] cm +[1 0 0 1 0 0] Tm +0 0 Td +422.638 280.471 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 518.279 280.471] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -518.279 -280.471] cm +[1 0 0 1 0 0] Tm +0 0 Td +521.729 280.471 Td +/F130_0 9.9626 Tf +(until) 18.2714 Tj +[1 0 0 1 72 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 268.516 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 149.709 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.709 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +152.314 268.516 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-262 TJm +(returned.) 35.686 Tj +-344 TJm +(Appearance) 47.5714 Tj +-262 TJm +(of) 8.29885 Tj +[1 0 0 1 261.767 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -261.767 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +261.767 268.516 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 339.475 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -339.475 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +342.081 268.516 Td +/F130_0 9.9626 Tf +(denotes) 30.4357 Tj +-262 TJm +(that) 14.9439 Tj +[1 0 0 1 392.672 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.672 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.672 268.516 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 488.313 268.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -488.313 -268.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +490.919 268.516 Td +/F130_0 9.9626 Tf +(has) 13.2801 Tj +-262 TJm +(detected) 33.1954 Tj +72 256.561 Td +(the) 12.1743 Tj +-212 TJm +(logical) 27.1182 Tj +-212 TJm +(end) 14.386 Tj +-211 TJm +(of) 8.29885 Tj +-212 TJm +(the) 12.1743 Tj +-212 TJm +(compressed) 47.0334 Tj +-212 TJm +(stream.) 29.0509 Tj +[1 0 0 1 237.858 256.561] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -237.858 -256.561] cm +[1 0 0 1 0 0] Tm +0 0 Td +237.858 256.561 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 333.499 256.561] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -333.499 -256.561] cm +[1 0 0 1 0 0] Tm +0 0 Td +335.609 256.561 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-212 TJm +(not) 12.7322 Tj +-212 TJm +(produce) 32.0895 Tj +[1 0 0 1 402.263 256.561] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -402.263 -256.561] cm +[1 0 0 1 0 0] Tm +0 0 Td +402.263 256.561 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 479.972 256.561] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -479.972 -256.561] cm +[1 0 0 1 0 0] Tm +0 0 Td +482.082 256.561 Td +/F130_0 9.9626 Tf +(until) 18.2714 Tj +-212 TJm +(all) 9.9626 Tj +-212 TJm +(output) 25.4644 Tj +72 244.605 Td +(data) 16.5977 Tj +-256 TJm +(has) 13.2801 Tj +-256 TJm +(been) 18.8094 Tj +-255 TJm +(placed) 26.0024 Tj +-256 TJm +(into) 15.5018 Tj +-256 TJm +(the) 12.1743 Tj +-256 TJm +(output) 25.4644 Tj +-256 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +40 TJm +(,) 2.49065 Tj +-257 TJm +(so) 8.85675 Tj +-256 TJm +(once) 18.8094 Tj +[1 0 0 1 278.978 244.605] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.978 -244.605] cm +[1 0 0 1 0 0] Tm +0 0 Td +278.978 244.605 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 356.687 244.605] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -356.687 -244.605] cm +[1 0 0 1 0 0] Tm +0 0 Td +359.236 244.605 Td +/F130_0 9.9626 Tf +(appears,) 32.9164 Tj +-257 TJm +(you) 14.9439 Tj +-256 TJm +(are) 12.1643 Tj +-256 TJm +(guaranteed) 43.7059 Tj +-256 TJm +(to) 7.7509 Tj +-256 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-255 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable) 26.5603 Tj +72 232.65 Td +(all) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(decompressed) 56.4381 Tj +-250 TJm +(output,) 27.9551 Tj +-250 TJm +(and) 14.386 Tj +[1 0 0 1 205.369 232.65] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -205.369 -232.65] cm +[1 0 0 1 0 0] Tm +0 0 Td +205.369 232.65 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 318.943 232.65] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -318.943 -232.65] cm +[1 0 0 1 0 0] Tm +0 0 Td +321.433 232.65 Td +/F130_0 9.9626 Tf +(can) 13.8281 Tj +-250 TJm +(safely) 23.7907 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(called.) 26.2813 Tj +[1 0 0 1 72 230.493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -220.531] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 210.732 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-250 TJm +(case) 17.1456 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue,) 19.0883 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(call) 14.386 Tj +[1 0 0 1 261.259 210.732] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -261.259 -210.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +261.259 210.732 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 374.833 210.732] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -374.833 -210.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +377.323 210.732 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(clean) 21.0211 Tj +-250 TJm +(up) 9.9626 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(release) 27.6562 Tj +-250 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 208.576] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -198.613] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 188.815 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 188.715] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -137.863] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(17) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 21 21 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -200.882] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 179.328 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 175.741] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(strm) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(strm->s) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 687.721 Td +(or) 11.9551 Tj +-426 TJm +(strm->avail_out) 89.6634 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(1) 5.97756 Tj +90 675.766 Td +(BZ_DATA_ERROR) 77.7083 Tj +98.4879 663.811 Td +(if) 11.9551 Tj +-426 TJm +(a) 5.97756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(integrity) 53.798 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(detected) 47.8205 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(stream) 35.8654 Tj +90 651.856 Td +(BZ_DATA_ERROR_MAGIC) 113.574 Tj +98.4879 639.9 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(stream) 35.8654 Tj +-426 TJm +(doesn't) 41.8429 Tj +-426 TJm +(begin) 29.8878 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(right) 29.8878 Tj +-426 TJm +(magic) 29.8878 Tj +-426 TJm +(bytes) 29.8878 Tj +90 627.945 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 615.99 Td +(if) 11.9551 Tj +-426 TJm +(there) 29.8878 Tj +-426 TJm +(wasn't) 35.8654 Tj +-426 TJm +(enough) 35.8654 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(available) 53.798 Tj +90 604.035 Td +(BZ_STREAM_END) 77.7083 Tj +98.4879 592.08 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(logical) 41.8429 Tj +-426 TJm +(end) 17.9327 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(stream) 35.8654 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(detected) 47.8205 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(all) 17.9327 Tj +98.4879 580.125 Td +(output) 35.8654 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(consumed,) 53.798 Tj +-426 TJm +(eg) 11.9551 Tj +-426 TJm +(s-->avail_out) 77.7083 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +90 568.169 Td +(BZ_OK) 29.8878 Tj +98.4879 556.214 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 540.673] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 518.755 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 518.655] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -509.29] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 509.29 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +98.4879 497.335 Td +(if) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(returned) 47.8205 Tj +90 485.38 Td +(BZ2_bzDecompressEnd) 113.574 Tj +98.4879 473.425 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 457.883] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -447.92] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 427.262 Td +/F122_0 17.2154 Tf +(3.3.6.) 43.0729 Tj +[1 0 0 1 119.858 427.262] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -427.262] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 427.262 Td +/F392_0 17.2154 Tf +(BZ2_bzDecompressEnd) 196.256 Tj +[1 0 0 1 316.114 427.262] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -244.114 -2.3326] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -415.564] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 415.564 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzDecompressEnd) 113.574 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bz_stream) 53.798 Tj +298.259 413.821 Td +(*) 5.97756 Tj +304.236 415.564 Td +(strm) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 400.023] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -390.06] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 378.105 Td +/F130_0 9.9626 Tf +(Releases) 34.8591 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(memory) 33.2053 Tj +-250 TJm +(associated) 40.9463 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(decompression) 59.7656 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 375.948] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -365.985] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 356.187 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 356.087] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -346.723] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 346.723 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 334.767 Td +(if) 11.9551 Tj +-426 TJm +(strm) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(strm->s) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +90 322.812 Td +(BZ_OK) 29.8878 Tj +98.4879 310.857 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 295.315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -285.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 273.397 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 273.298] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -263.933] cm +[1 0 0 1 0 0] Tm +0 0 Td +98.4879 263.933 Td +/F134_0 9.9626 Tf +(None.) 29.8878 Tj +[1 0 0 1 72 248.391] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -238.429] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 213.639 Td +/F122_0 20.6585 Tf +(3.4.) 34.4584 Tj +-278 TJm +(High-le) 70.0117 Tj +15 TJm +(vel) 28.7153 Tj +-278 TJm +(interface) 86.1046 Tj +[1 0 0 1 72 209.042] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -199.08] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 191.721 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-250 TJm +(pro) 13.2801 Tj +15 TJm +(vides) 21.031 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(reading) 29.8778 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(writing) 28.782 Tj +[1 0 0 1 300.292 191.721] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -300.292 -191.721] cm +[1 0 0 1 0 0] Tm +0 0 Td +300.292 191.721 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 330.18 191.721] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -330.18 -191.721] cm +[1 0 0 1 0 0] Tm +0 0 Td +332.67 191.721 Td +/F130_0 9.9626 Tf +(format) 26.5603 Tj +-250 TJm +(\002les.) 19.0983 Tj +-620 TJm +(First,) 20.7621 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(general) 29.3199 Tj +-250 TJm +(points.) 26.8492 Tj +[1 0 0 1 72 189.564] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.7236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 159.84 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 159.84 Td +/F130_0 9.9626 Tf +(All) 12.7322 Tj +-332 TJm +(of) 8.29885 Tj +-331 TJm +(the) 12.1743 Tj +-332 TJm +(functions) 37.0808 Tj +-332 TJm +(tak) 12.1743 Tj +10 TJm +(e) 4.42339 Tj +-331 TJm +(an) 9.40469 Tj +[1 0 0 1 202.958 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.958 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +202.958 159.84 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +220.891 158.097 Td +(*) 5.97756 Tj +[1 0 0 1 226.868 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -226.868 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.172 159.84 Td +/F130_0 9.9626 Tf +(\002rst) 15.5018 Tj +-332 TJm +(ar) 7.74094 Tj +18 TJm +(gument,) 32.3785 Tj +[1 0 0 1 292.426 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -292.426 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +292.426 159.84 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 334.269 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -334.269 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +334.269 159.84 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1110 TJm +(After) 21.0211 Tj +-332 TJm +(each) 18.2515 Tj +-331 TJm +(call,) 16.8766 Tj +[1 0 0 1 414.083 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -414.083 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +414.083 159.84 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 455.926 159.84] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -455.926 -159.84] cm +[1 0 0 1 0 0] Tm +0 0 Td +459.23 159.84 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-332 TJm +(be) 9.40469 Tj +-331 TJm +(consulted) 38.1866 Tj +86.944 147.885 Td +(\002rst) 15.5018 Tj +-349 TJm +(to) 7.7509 Tj +-349 TJm +(determine) 39.8404 Tj +-348 TJm +(the) 12.1743 Tj +-349 TJm +(outcome) 34.3112 Tj +-349 TJm +(of) 8.29885 Tj +-349 TJm +(the) 12.1743 Tj +-348 TJm +(call.) 16.8766 Tj +-1213 TJm +(If) 6.63509 Tj +[1 0 0 1 280.386 147.885] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -280.386 -147.885] cm +[1 0 0 1 0 0] Tm +0 0 Td +280.386 147.885 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 322.229 147.885] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -322.229 -147.885] cm +[1 0 0 1 0 0] Tm +0 0 Td +325.704 147.885 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +[1 0 0 1 335.824 147.885] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -335.824 -147.885] cm +[1 0 0 1 0 0] Tm +0 0 Td +335.824 147.885 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 365.711 147.885] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -365.711 -147.885] cm +[1 0 0 1 0 0] Tm +0 0 Td +365.711 147.885 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-349 TJm +(the) 12.1743 Tj +-349 TJm +(call) 14.386 Tj +-348 TJm +(completed) 41.5042 Tj +-349 TJm +(successfully) 48.6972 Tj +65 TJm +(,) 2.49065 Tj +-374 TJm +(and) 14.386 Tj +-348 TJm +(only) 17.7135 Tj +86.944 135.93 Td +(then) 17.1556 Tj +-271 TJm +(should) 26.5703 Tj +-270 TJm +(the) 12.1743 Tj +-271 TJm +(return) 23.7907 Tj +-270 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-271 TJm +(of) 8.29885 Tj +-271 TJm +(the) 12.1743 Tj +-270 TJm +(function) 33.2053 Tj +-271 TJm +(\(if) 9.40469 Tj +-270 TJm +(an) 9.40469 Tj +15 TJm +(y\)) 8.29885 Tj +-271 TJm +(be) 9.40469 Tj +-271 TJm +(cons) 18.2614 Tj +1 TJm +(u) 4.9813 Tj +-1 TJm +(l) 2.7696 Tj +1 TJm +(ted.) 14.6649 Tj +-744 TJm +(If) 6.63509 Tj +[1 0 0 1 365.077 135.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -365.077 -135.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +365.077 135.93 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 406.92 135.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -406.92 -135.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +409.616 135.93 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +[1 0 0 1 418.956 135.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -418.956 -135.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +418.956 135.93 Td +/F134_0 9.9626 Tf +(BZ_IO_ERROR) 65.7532 Tj +[1 0 0 1 484.71 135.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -484.71 -135.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +484.71 135.93 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-271 TJm +(there) 19.9152 Tj +-270 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-271 TJm +(an) 9.40469 Tj +86.944 123.975 Td +(error) 19.3573 Tj +-246 TJm +(reading/writing) 61.4294 Tj +-245 TJm +(the) 12.1743 Tj +-246 TJm +(underlying) 43.1679 Tj +-246 TJm +(compressed) 47.0334 Tj +-245 TJm +(\002le,) 15.2229 Tj +-247 TJm +(and) 14.386 Tj +-245 TJm +(you) 14.9439 Tj +-246 TJm +(should) 26.5703 Tj +-246 TJm +(then) 17.1556 Tj +-245 TJm +(consult) 28.782 Tj +[1 0 0 1 414.096 123.975] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -414.096 -123.975] cm +[1 0 0 1 0 0] Tm +0 0 Td +414.096 123.975 Td +/F134_0 9.9626 Tf +(errno) 29.8878 Tj +[1 0 0 1 443.984 123.975] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -443.984 -123.975] cm +[1 0 0 1 0 0] Tm +0 0 Td +446.432 123.975 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 451.649 123.975] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -451.649 -123.975] cm +[1 0 0 1 0 0] Tm +0 0 Td +451.649 123.975 Td +/F134_0 9.9626 Tf +(perror) 35.8654 Tj +[1 0 0 1 487.514 123.975] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -487.514 -123.975] cm +[1 0 0 1 0 0] Tm +0 0 Td +489.962 123.975 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-246 TJm +(determine) 39.8404 Tj +86.944 112.02 Td +(the) 12.1743 Tj +-356 TJm +(cause) 22.1269 Tj +-356 TJm +(of) 8.29885 Tj +-355 TJm +(the) 12.1743 Tj +-356 TJm +(dif) 11.0684 Tj +25 TJm +(\002culty) 25.4644 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 206.528 112.02] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -206.528 -112.02] cm +[1 0 0 1 0 0] Tm +0 0 Td +206.528 112.02 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 248.371 112.02] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -248.371 -112.02] cm +[1 0 0 1 0 0] Tm +0 0 Td +251.916 112.02 Td +/F130_0 9.9626 Tf +(may) 17.1556 Tj +-356 TJm +(also) 16.0497 Tj +-356 TJm +(be) 9.40469 Tj +-355 TJm +(set) 11.0684 Tj +-356 TJm +(to) 7.7509 Tj +-356 TJm +(v) 4.9813 Tj +25 TJm +(arious) 24.3486 Tj +-356 TJm +(other) 20.4731 Tj +-356 TJm +(v) 4.9813 Tj +25 TJm +(alues;) 23.2427 Tj +-408 TJm +(precise) 28.2141 Tj +-356 TJm +(details) 26.0123 Tj +-356 TJm +(are) 12.1643 Tj +-356 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-356 TJm +(on) 9.9626 Tj +-356 TJm +(a) 4.42339 Tj +86.944 100.064 Td +(per) 12.7222 Tj +20 TJm +(-function) 36.5229 Tj +-250 TJm +(basis) 19.9252 Tj +-250 TJm +(belo) 17.1556 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 186.839 100.064] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -114.838 -49.2126] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(18) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 22 22 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -31.5168] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 710.037 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 710.037 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +[1 0 0 1 95.9576 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -95.9576 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +95.9576 710.037 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 137.801 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.801 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +140.179 710.037 Td +/F130_0 9.9626 Tf +(indicates) 35.417 Tj +-239 TJm +(an) 9.40469 Tj +-238 TJm +(error) 19.3573 Tj +-239 TJm +(\(ie,) 13.0012 Tj +-241 TJm +(an) 9.40469 Tj +15 TJm +(ything) 25.4644 Tj +-239 TJm +(e) 4.42339 Tj +15 TJm +(xcept) 21.579 Tj +[1 0 0 1 292.225 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -292.225 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +292.225 710.037 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 322.113 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -322.113 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +324.492 710.037 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 341.256 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -341.256 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +341.256 710.037 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 418.965 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -418.965 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +418.965 710.037 Td +/F130_0 9.9626 Tf +(\),) 5.8082 Tj +-239 TJm +(you) 14.9439 Tj +-239 TJm +(should) 26.5703 Tj +-238 TJm +(immediately) 49.813 Tj +-239 TJm +(call) 14.386 Tj +[1 0 0 1 86.944 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 698.082 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 176.608 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.608 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.343 698.082 Td +/F130_0 9.9626 Tf +(\(or) 11.6164 Tj +[1 0 0 1 193.695 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -193.695 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.695 698.082 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 289.337 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -289.337 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +289.337 698.082 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-281 TJm +(depending) 41.5042 Tj +-274 TJm +(on) 9.9626 Tj +-275 TJm +(whether) 32.0895 Tj +-274 TJm +(you) 14.9439 Tj +-275 TJm +(are) 12.1643 Tj +-275 TJm +(attempting) 42.62 Tj +-274 TJm +(to) 7.7509 Tj +-275 TJm +(read) 17.1456 Tj +-274 TJm +(or) 8.29885 Tj +-275 TJm +(to) 7.7509 Tj +-274 TJm +(write\)) 23.7907 Tj +86.944 686.127 Td +(to) 7.7509 Tj +-242 TJm +(free) 15.4819 Tj +-242 TJm +(up) 9.9626 Tj +-241 TJm +(all) 9.9626 Tj +-242 TJm +(resources) 37.6188 Tj +-242 TJm +(associated) 40.9463 Tj +-242 TJm +(wi) 9.9626 Tj +1 TJm +(th) 7.7509 Tj +-242 TJm +(the) 12.1743 Tj +-242 TJm +(stream.) 29.0509 Tj +-614 TJm +(Once) 21.0211 Tj +-242 TJm +(an) 9.40469 Tj +-242 TJm +(error) 19.3573 Tj +-242 TJm +(has) 13.2801 Tj +-242 TJm +(been) 18.8094 Tj +-241 TJm +(indicated,) 39.0135 Tj +-244 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +-241 TJm +(of) 8.29885 Tj +-242 TJm +(all) 9.9626 Tj +-242 TJm +(calls) 18.2614 Tj +-242 TJm +(e) 4.42339 Tj +15 TJm +(xcept) 21.579 Tj +[1 0 0 1 86.944 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 674.172 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 176.608 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.608 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.705 674.172 Td +/F130_0 9.9626 Tf +(\() 3.31755 Tj +[1 0 0 1 183.022 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.022 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.022 674.172 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 278.664 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.664 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +278.664 674.172 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-311 TJm +(is) 6.64505 Tj +-311 TJm +(unde\002ned.) 41.7831 Tj +-985 TJm +(The) 15.4918 Tj +-311 TJm +(implication) 45.3896 Tj +-310 TJm +(is) 6.64505 Tj +-311 TJm +(that) 14.9439 Tj +-311 TJm +(\(1\)) 11.6164 Tj +[1 0 0 1 455.988 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -455.988 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +455.988 674.172 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 497.831 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -497.831 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +500.928 674.172 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-311 TJm +(be) 9.40469 Tj +86.944 662.217 Td +(check) 23.2328 Tj +10 TJm +(ed) 9.40469 Tj +-291 TJm +(after) 18.2515 Tj +-291 TJm +(each) 18.2515 Tj +-291 TJm +(call,) 16.8766 Tj +-301 TJm +(and) 14.386 Tj +-291 TJm +(\(2\)) 11.6164 Tj +-291 TJm +(if) 6.08715 Tj +[1 0 0 1 225.347 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -225.347 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +225.347 662.217 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 267.19 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -267.19 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +270.09 662.217 Td +/F130_0 9.9626 Tf +(indicates) 35.417 Tj +-291 TJm +(an) 9.40469 Tj +-291 TJm +(error) 19.3573 Tj +40 TJm +(,) 2.49065 Tj +[1 0 0 1 345.161 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -345.161 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +345.161 662.217 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 434.824 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -434.824 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +437.724 662.217 Td +/F130_0 9.9626 Tf +(\() 3.31755 Tj +[1 0 0 1 441.041 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -441.041 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +441.041 662.217 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 536.683 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -536.683 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +536.683 662.217 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +86.944 650.262 Td +(should) 26.5703 Tj +-250 TJm +(then) 17.1556 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(called) 23.7907 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(clean) 21.0211 Tj +-250 TJm +(up.) 12.4533 Tj +[1 0 0 1 220.034 650.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -148.034 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 628.344 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 628.344 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +[1 0 0 1 106.362 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -106.362 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +106.362 628.344 Td +/F134_0 9.9626 Tf +(FILE) 23.9102 Tj +130.273 626.6 Td +(*) 5.97756 Tj +[1 0 0 1 136.25 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -136.25 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +140.177 628.344 Td +/F130_0 9.9626 Tf +(ar) 7.74094 Tj +18 TJm +(guments) 33.7633 Tj +-394 TJm +(passed) 26.5603 Tj +-394 TJm +(to) 7.7509 Tj +[1 0 0 1 227.592 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -227.592 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +227.592 628.344 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 311.278 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -311.278 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +315.205 628.344 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 321.901 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -321.901 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +321.901 628.344 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteOpen) 89.6634 Tj +[1 0 0 1 411.565 628.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -411.565 -628.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +415.491 628.344 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-394 TJm +(be) 9.40469 Tj +-394 TJm +(set) 11.0684 Tj +-394 TJm +(to) 7.7509 Tj +-394 TJm +(binary) 25.4544 Tj +-395 TJm +(mode.) 24.6275 Tj +86.944 616.389 Td +(Most) 20.4831 Tj +-229 TJm +(Unix) 19.9252 Tj +-229 TJm +(systems) 31.5516 Tj +-228 TJm +(will) 15.5018 Tj +-229 TJm +(do) 9.9626 Tj +-229 TJm +(this) 14.396 Tj +-229 TJm +(by) 9.9626 Tj +-229 TJm +(def) 12.7222 Tj +10 TJm +(ault,) 17.4346 Tj +-233 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-229 TJm +(other) 20.4731 Tj +-229 TJm +(platforms,) 40.6773 Tj +-233 TJm +(including) 37.6387 Tj +-229 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws) 11.0684 Tj +-228 TJm +(and) 14.386 Tj +-229 TJm +(Mac,) 20.1942 Tj +-233 TJm +(will) 15.5018 Tj +-229 TJm +(not.) 15.2229 Tj +-606 TJm +(If) 6.63509 Tj +-229 TJm +(you) 14.9439 Tj +-229 TJm +(omit) 18.2714 Tj +86.944 604.433 Td +(this,) 16.8866 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(may) 17.1556 Tj +-250 TJm +(encounter) 39.2825 Tj +-250 TJm +(problems) 37.0808 Tj +-250 TJm +(when) 21.579 Tj +-250 TJm +(mo) 12.7322 Tj +15 TJm +(ving) 17.7135 Tj +-250 TJm +(code) 18.8094 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(platforms.) 40.6773 Tj +[1 0 0 1 372.66 604.433] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -300.66 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 582.516 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 582.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 582.516 Td +/F130_0 9.9626 Tf +(Memory) 34.3112 Tj +-348 TJm +(allocation) 39.2925 Tj +-348 TJm +(requests) 32.6474 Tj +-348 TJm +(are) 12.1643 Tj +-348 TJm +(handled) 31.5416 Tj +-348 TJm +(by) 9.9626 Tj +[1 0 0 1 267.67 582.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -267.67 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +267.67 582.516 Td +/F134_0 9.9626 Tf +(malloc) 35.8654 Tj +[1 0 0 1 303.535 582.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -303.535 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +307.003 582.516 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 313.241 582.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -313.241 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +313.241 582.516 Td +/F134_0 9.9626 Tf +(free) 23.9102 Tj +[1 0 0 1 337.151 582.516] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -337.151 -582.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +337.151 582.516 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1209 TJm +(At) 9.9626 Tj +-348 TJm +(present) 28.772 Tj +-348 TJm +(there) 19.9152 Tj +-348 TJm +(is) 6.64505 Tj +-348 TJm +(no) 9.9626 Tj +-348 TJm +(f) 3.31755 Tj +10 TJm +(acility) 24.9065 Tj +-348 TJm +(for) 11.6164 Tj +-348 TJm +(user) 16.5977 Tj +20 TJm +(-de\002ned) 32.6474 Tj +86.944 570.56 Td +(memory) 33.2053 Tj +-250 TJm +(allocators) 38.7346 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(I/O) 13.2801 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(\(could) 25.4544 Tj +-250 TJm +(easily) 23.2427 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(added,) 26.2813 Tj +-250 TJm +(though\).) 33.4843 Tj +[1 0 0 1 387.165 570.56] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -315.165 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -548.478] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 529.977 Td +/F122_0 17.2154 Tf +(3.4.1.) 43.0729 Tj +[1 0 0 1 119.858 529.977] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -529.977] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 529.977 Td +/F392_0 17.2154 Tf +(BZ2_bzReadOpen) 144.609 Tj +[1 0 0 1 264.468 529.977] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.468 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -72.7272] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 71.731 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 68.1444] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -518.279] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 518.279 Td +/F134_0 9.9626 Tf +(typedef) 41.8429 Tj +-426 TJm +(void) 23.9102 Tj +-426 TJm +(BZFILE;) 41.8429 Tj +90 494.369 Td +(BZFILE) 35.8654 Tj +130.109 492.625 Td +(*) 5.97756 Tj +136.087 494.369 Td +(BZ2_bzReadOpen\() 89.6634 Tj +-426 TJm +(int) 17.9327 Tj +252.171 492.625 Td +(*) 5.97756 Tj +258.149 494.369 Td +(bzerror,) 47.8205 Tj +-426 TJm +(FILE) 23.9102 Tj +338.368 492.625 Td +(*) 5.97756 Tj +344.346 494.369 Td +(f,) 11.9551 Tj +191.855 482.414 Td +(int) 17.9327 Tj +-426 TJm +(verbosity,) 59.7756 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(small,) 35.8654 Tj +191.855 470.458 Td +(void) 23.9102 Tj +220.01 468.715 Td +(*) 5.97756 Tj +225.987 470.458 Td +(unused,) 41.8429 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(nUnused) 41.8429 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 454.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -444.954] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 432.999 Td +/F130_0 9.9626 Tf +(Prepare) 30.4258 Tj +-290 TJm +(to) 7.7509 Tj +-289 TJm +(read) 17.1456 Tj +-290 TJm +(compressed) 47.0334 Tj +-290 TJm +(data) 16.5977 Tj +-289 TJm +(from) 19.3673 Tj +-290 TJm +(\002le) 12.7322 Tj +-289 TJm +(handle) 26.5603 Tj +[1 0 0 1 272.697 432.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.697 -432.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +272.697 432.999 Td +/F134_0 9.9626 Tf +(f) 5.97756 Tj +[1 0 0 1 278.675 432.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.675 -432.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +278.675 432.999 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 285.439 432.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -285.439 -432.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +285.439 432.999 Td +/F134_0 9.9626 Tf +(f) 5.97756 Tj +[1 0 0 1 291.417 432.999] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -291.417 -432.999] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.303 432.999 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-290 TJm +(refer) 18.7994 Tj +-289 TJm +(to) 7.7509 Tj +-290 TJm +(a) 4.42339 Tj +-290 TJm +(\002le) 12.7322 Tj +-289 TJm +(which) 24.3486 Tj +-290 TJm +(has) 13.2801 Tj +-289 TJm +(been) 18.8094 Tj +-290 TJm +(opened) 28.772 Tj +-290 TJm +(for) 11.6164 Tj +-289 TJm +(reading,) 32.3685 Tj +-300 TJm +(and) 14.386 Tj +72 421.044 Td +(for) 11.6164 Tj +-306 TJm +(which) 24.3486 Tj +-305 TJm +(the) 12.1743 Tj +-306 TJm +(error) 19.3573 Tj +-306 TJm +(indicator) 35.417 Tj +-305 TJm +(\() 3.31755 Tj +[1 0 0 1 193.457 421.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -193.457 -421.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +193.457 421.044 Td +/F134_0 9.9626 Tf +(ferror\(f\)) 53.798 Tj +[1 0 0 1 247.255 421.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -247.255 -421.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +247.255 421.044 Td +/F130_0 9.9626 Tf +(\)is) 9.9626 Tj +-306 TJm +(not) 12.7322 Tj +-305 TJm +(set.) 13.5591 Tj +-954 TJm +(If) 6.63509 Tj +[1 0 0 1 308.784 421.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -308.784 -421.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +308.784 421.044 Td +/F134_0 9.9626 Tf +(small) 29.8878 Tj +[1 0 0 1 338.671 421.044] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -338.671 -421.044] cm +[1 0 0 1 0 0] Tm +0 0 Td +341.717 421.044 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-306 TJm +(1,) 7.47195 Tj +-319 TJm +(the) 12.1743 Tj +-306 TJm +(library) 26.5603 Tj +-306 TJm +(will) 15.5018 Tj +-305 TJm +(try) 11.0684 Tj +-306 TJm +(to) 7.7509 Tj +-306 TJm +(dec) 13.8281 Tj +1 TJm +(ompress) 33.2053 Tj +-306 TJm +(using) 21.589 Tj +-306 TJm +(less) 14.9439 Tj +72 409.089 Td +(memory) 33.2053 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xpense) 27.6661 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(speed.) 25.1755 Tj +[1 0 0 1 72 406.932] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -396.969] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 387.171 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-227 TJm +(reasons) 29.8778 Tj +-227 TJm +(e) 4.42339 Tj +15 TJm +(xplained) 34.3112 Tj +-228 TJm +(belo) 17.1556 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 189.193 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -189.193 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +189.193 387.171 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 248.969 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -248.969 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +251.232 387.171 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-227 TJm +(decompress) 47.0334 Tj +-227 TJm +(the) 12.1743 Tj +[1 0 0 1 332.732 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -332.732 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +332.732 387.171 Td +/F134_0 9.9626 Tf +(nUnused) 41.8429 Tj +[1 0 0 1 374.575 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -374.575 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +376.838 387.171 Td +/F130_0 9.9626 Tf +(bytes) 21.031 Tj +-227 TJm +(starting) 29.8878 Tj +-227 TJm +(at) 7.193 Tj +[1 0 0 1 441.74 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -441.74 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +441.74 387.171 Td +/F134_0 9.9626 Tf +(unused) 35.8654 Tj +[1 0 0 1 477.605 387.171] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -477.605 -387.171] cm +[1 0 0 1 0 0] Tm +0 0 Td +477.605 387.171 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-232 TJm +(before) 25.4445 Tj +-227 TJm +(starting) 29.8878 Tj +72 375.216 Td +(to) 7.7509 Tj +-280 TJm +(read) 17.1456 Tj +-279 TJm +(from) 19.3673 Tj +-280 TJm +(the) 12.1743 Tj +-279 TJm +(\002le) 12.7322 Tj +[1 0 0 1 155.094 375.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.094 -375.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.094 375.215 Td +/F134_0 9.9626 Tf +(f) 5.97756 Tj +[1 0 0 1 161.072 375.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.072 -375.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.072 375.215 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-797 TJm +(At) 9.9626 Tj +-280 TJm +(most) 19.3773 Tj +[1 0 0 1 206.414 375.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -206.414 -375.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +206.414 375.215 Td +/F134_0 9.9626 Tf +(BZ_MAX_UNUSED) 77.7083 Tj +[1 0 0 1 284.122 375.215] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -284.122 -375.215] cm +[1 0 0 1 0 0] Tm +0 0 Td +286.907 375.215 Td +/F130_0 9.9626 Tf +(bytes) 21.031 Tj +-280 TJm +(may) 17.1556 Tj +-279 TJm +(be) 9.40469 Tj +-280 TJm +(supplied) 33.7633 Tj +-279 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-280 TJm +(this.) 16.8866 Tj +-797 TJm +(If) 6.63509 Tj +-279 TJm +(this) 14.396 Tj +-280 TJm +(f) 3.31755 Tj +10 TJm +(acility) 24.9065 Tj +-279 TJm +(is) 6.64505 Tj +-280 TJm +(not) 12.7322 Tj +-279 TJm +(required,) 35.686 Tj +72 363.26 Td +(you) 14.9439 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(pass) 17.1556 Tj +[1 0 0 1 138.141 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -138.141 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +138.141 363.26 Td +/F134_0 9.9626 Tf +(NULL) 23.9102 Tj +[1 0 0 1 162.052 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -162.052 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.542 363.26 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 181.419 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -181.419 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.419 363.26 Td +/F134_0 9.9626 Tf +(0) 5.97756 Tj +[1 0 0 1 187.397 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -187.397 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +189.887 363.26 Td +/F130_0 9.9626 Tf +(for) 11.6164 Tj +[1 0 0 1 203.994 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -203.994 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +203.994 363.26 Td +/F134_0 9.9626 Tf +(unused) 35.8654 Tj +[1 0 0 1 239.86 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -239.86 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +242.351 363.26 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +-250 TJm +(n) 4.9813 Tj +[1 0 0 1 264.208 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -264.208 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +264.208 363.26 Td +/F134_0 9.9626 Tf +(Unused) 35.8654 Tj +[1 0 0 1 300.074 363.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -300.074 -363.26] cm +[1 0 0 1 0 0] Tm +0 0 Td +302.565 363.26 Td +/F130_0 9.9626 Tf +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 361.103] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -351.141] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 341.343 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(meaning) 34.3112 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(parameters) 43.7059 Tj +[1 0 0 1 196.631 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.631 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +196.631 341.343 Td +/F134_0 9.9626 Tf +(small) 29.8878 Tj +[1 0 0 1 226.519 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -226.519 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +229.01 341.343 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 245.887 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.887 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +245.887 341.343 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 299.685 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -299.685 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +299.685 341.343 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(see) 12.7222 Tj +[1 0 0 1 319.879 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -319.879 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +319.879 341.343 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 439.431 341.343] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -439.431 -341.343] cm +[1 0 0 1 0 0] Tm +0 0 Td +439.431 341.343 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 339.186] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -329.223] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 319.425 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-402 TJm +(amount) 29.8878 Tj +-402 TJm +(of) 8.29885 Tj +-402 TJm +(memory) 33.2053 Tj +-402 TJm +(needed) 28.2141 Tj +-402 TJm +(to) 7.7509 Tj +-402 TJm +(decompress) 47.0334 Tj +-402 TJm +(a) 4.42339 Tj +-401 TJm +(\002le) 12.7322 Tj +-402 TJm +(cannot) 26.5603 Tj +-402 TJm +(be) 9.40469 Tj +-402 TJm +(determined) 44.8217 Tj +-402 TJm +(until) 18.2714 Tj +-402 TJm +(the) 12.1743 Tj +-402 TJm +(\002le') 16.0497 Tj +55 TJm +(s) 3.87545 Tj +-402 TJm +(header) 26.5503 Tj +-402 TJm +(has) 13.2801 Tj +-402 TJm +(been) 18.8094 Tj +-402 TJm +(read.) 19.6363 Tj +72 307.47 Td +(So) 10.5205 Tj +-492 TJm +(it) 5.53921 Tj +-491 TJm +(is) 6.64505 Tj +-492 TJm +(possible) 32.6574 Tj +-492 TJm +(that) 14.9439 Tj +[1 0 0 1 166.797 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -166.797 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.797 307.47 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 250.483 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -250.483 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +255.381 307.47 Td +/F130_0 9.9626 Tf +(returns) 27.6661 Tj +[1 0 0 1 287.945 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -287.945 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +287.945 307.47 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 317.833 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -317.833 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +322.729 307.47 Td +/F130_0 9.9626 Tf +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-492 TJm +(a) 4.42339 Tj +-491 TJm +(subsequent) 44.2738 Tj +-492 TJm +(call) 14.386 Tj +-492 TJm +(of) 8.29885 Tj +[1 0 0 1 431.135 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -431.135 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +431.135 307.47 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 490.911 307.47] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -490.911 -307.47] cm +[1 0 0 1 0 0] Tm +0 0 Td +495.81 307.47 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-492 TJm +(return) 23.7907 Tj +[1 0 0 1 72 295.514] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -295.514] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 295.514 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 143.731 295.514] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.731 -295.514] cm +[1 0 0 1 0 0] Tm +0 0 Td +143.731 295.514 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 294.204] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -284.242] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 273.597 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 273.597] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -273.597] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 273.597 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 273.597] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -273.597] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 273.597 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 271.44] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -168.369] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 167.372 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 163.786] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -262.075] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 262.075 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 250.12 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 238.165 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 226.209 Td +(if) 11.9551 Tj +-426 TJm +(f) 5.97756 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 214.254 Td +(or) 11.9551 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(neither) 41.8429 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(nor) 17.9327 Tj +-426 TJm +(1) 5.97756 Tj +98.4879 202.299 Td +(or) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(unused) 35.8654 Tj +-426 TJm +(==) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(&&) 11.9551 Tj +-426 TJm +(nUnused) 41.8429 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(\)) 5.97756 Tj +98.4879 190.344 Td +(or) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(unused) 35.8654 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(&&) 11.9551 Tj +-426 TJm +(!\(0) 17.9327 Tj +-426 TJm +(<=) 11.9551 Tj +-426 TJm +(nUnused) 41.8429 Tj +-426 TJm +(<=) 11.9551 Tj +-426 TJm +(BZ_MAX_UNUSED\)) 83.6858 Tj +-426 TJm +(\)) 5.97756 Tj +90 178.389 Td +(BZ_IO_ERROR) 65.7532 Tj +98.4879 166.434 Td +(if) 11.9551 Tj +-426 TJm +(ferror\(f\)) 53.798 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(nonzero) 41.8429 Tj +90 154.478 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 142.523 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +90 130.568 Td +(BZ_OK) 29.8878 Tj +98.4879 118.613 Td +(otherwise.) 59.7756 Tj +[1 0 0 1 72 103.071] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -93.1085] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 81.1533 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 81.0538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -30.202] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.9737] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -51.071] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 51.071 Td +/F130_0 9.9626 Tf +(19) 9.9626 Tj +[1 0 0 1 453.269 50.8519] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 23 23 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -81.33] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(Pointer) 41.8429 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(abstract) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +90 687.721 Td +(NULL) 23.9102 Tj +98.4879 675.766 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 660.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5493] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -650.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 638.306 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 638.207] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -628.842] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 628.842 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +98.4879 616.887 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +90 604.932 Td +(BZ2_bzClose) 65.7532 Tj +98.4879 592.976 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 577.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -567.472] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 546.813 Td +/F122_0 17.2154 Tf +(3.4.2.) 43.0729 Tj +[1 0 0 1 119.858 546.813] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -546.813] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 546.813 Td +/F392_0 17.2154 Tf +(BZ2_bzRead) 103.292 Tj +[1 0 0 1 223.15 546.813] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -151.15 -2.3326] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -535.116] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 535.116 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzRead) 59.7756 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(int) 17.9327 Tj +208.595 533.373 Td +(*) 5.97756 Tj +214.572 535.116 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +306.747 533.373 Td +(*) 5.97756 Tj +312.724 535.116 Td +(b,) 11.9551 Tj +-426 TJm +(void) 23.9102 Tj +357.077 533.373 Td +(*) 5.97756 Tj +363.055 535.116 Td +(buf,) 23.9102 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 519.574] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -509.612] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 497.656 Td +/F130_0 9.9626 Tf +(Reads) 24.3486 Tj +-285 TJm +(up) 9.9626 Tj +-284 TJm +(to) 7.7509 Tj +[1 0 0 1 122.569 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -122.569 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +122.569 497.656 Td +/F134_0 9.9626 Tf +(len) 17.9327 Tj +[1 0 0 1 140.501 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.501 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +143.337 497.656 Td +/F130_0 9.9626 Tf +(\(uncompressed\)) 63.6311 Tj +-285 TJm +(bytes) 21.031 Tj +-284 TJm +(from) 19.3673 Tj +-285 TJm +(the) 12.1743 Tj +-284 TJm +(compressed) 47.0334 Tj +-285 TJm +(\002le) 12.7322 Tj +[1 0 0 1 336.319 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -336.319 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +336.319 497.656 Td +/F134_0 9.9626 Tf +(b) 5.97756 Tj +[1 0 0 1 342.296 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.296 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +345.132 497.656 Td +/F130_0 9.9626 Tf +(into) 15.5018 Tj +-285 TJm +(the) 12.1743 Tj +-284 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +[1 0 0 1 405.205 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -405.205 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +405.205 497.656 Td +/F134_0 9.9626 Tf +(buf) 17.9327 Tj +[1 0 0 1 423.137 497.656] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -423.137 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +423.137 497.656 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-828 TJm +(If) 6.63509 Tj +-284 TJm +(the) 12.1743 Tj +-285 TJm +(read) 17.1456 Tj +-285 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-284 TJm +(successful,) 43.4369 Tj +[1 0 0 1 72 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 485.701 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 113.843 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +117.36 485.701 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-353 TJm +(set) 11.0684 Tj +-353 TJm +(to) 7.7509 Tj +[1 0 0 1 153.374 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -153.374 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +153.374 485.701 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 183.262 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.262 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +186.778 485.701 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +-353 TJm +(the) 12.1743 Tj +-353 TJm +(number) 30.4357 Tj +-353 TJm +(of) 8.29885 Tj +-353 TJm +(bytes) 21.031 Tj +-353 TJm +(read) 17.1456 Tj +-353 TJm +(is) 6.64505 Tj +-353 TJm +(returned.) 35.686 Tj +-1238 TJm +(If) 6.63509 Tj +-353 TJm +(the) 12.1743 Tj +-353 TJm +(logical) 27.1182 Tj +-353 TJm +(end-of-stream) 55.8802 Tj +-353 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-353 TJm +(detected,) 35.686 Tj +[1 0 0 1 72 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 473.746 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 113.843 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.795 473.746 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-296 TJm +(be) 9.40469 Tj +-297 TJm +(set) 11.0684 Tj +-296 TJm +(to) 7.7509 Tj +[1 0 0 1 172.329 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -172.329 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.329 473.746 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 250.037 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -250.037 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +250.037 473.746 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-296 TJm +(and) 14.386 Tj +-297 TJm +(the) 12.1743 Tj +-296 TJm +(number) 30.4357 Tj +-296 TJm +(of) 8.29885 Tj +-297 TJm +(bytes) 21.031 Tj +-296 TJm +(read) 17.1456 Tj +-296 TJm +(is) 6.64505 Tj +-296 TJm +(returned.) 35.686 Tj +-898 TJm +(All) 12.7322 Tj +-297 TJm +(other) 20.4731 Tj +[1 0 0 1 470 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -470 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +470 473.746 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 511.843 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -511.843 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +514.795 473.746 Td +/F130_0 9.9626 Tf +(v) 4.9813 Tj +25 TJm +(alues) 20.4731 Tj +72 461.791 Td +(denote) 26.5603 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(error) 19.3573 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 461.691] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -451.729] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 439.873 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 131.776 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.776 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +134.224 439.873 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-246 TJm +(supply) 26.5703 Tj +[1 0 0 1 181.193 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -181.193 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.193 439.873 Td +/F134_0 9.9626 Tf +(len) 17.9327 Tj +[1 0 0 1 199.126 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -199.126 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.575 439.873 Td +/F130_0 9.9626 Tf +(bytes,) 23.5217 Tj +-247 TJm +(unless) 24.9065 Tj +-245 TJm +(the) 12.1743 Tj +-246 TJm +(logical) 27.1182 Tj +-246 TJm +(stream) 26.5603 Tj +-246 TJm +(end) 14.386 Tj +-245 TJm +(is) 6.64505 Tj +-246 TJm +(detected) 33.1954 Tj +-246 TJm +(or) 8.29885 Tj +-246 TJm +(an) 9.40469 Tj +-246 TJm +(error) 19.3573 Tj +-245 TJm +(occurs.) 28.493 Tj +-617 TJm +(Because) 33.1954 Tj +-246 TJm +(of) 8.29885 Tj +-246 TJm +(this,) 16.8866 Tj +-247 TJm +(it) 5.53921 Tj +72 427.918 Td +(is) 6.64505 Tj +-231 TJm +(possible) 32.6574 Tj +-231 TJm +(to) 7.7509 Tj +-231 TJm +(detect) 23.7907 Tj +-231 TJm +(the) 12.1743 Tj +-231 TJm +(stream) 26.5603 Tj +-231 TJm +(end) 14.386 Tj +-232 TJm +(by) 9.9626 Tj +-231 TJm +(observing) 39.2925 Tj +-231 TJm +(when) 21.579 Tj +-231 TJm +(the) 12.1743 Tj +-231 TJm +(number) 30.4357 Tj +-231 TJm +(of) 8.29885 Tj +-231 TJm +(bytes) 21.031 Tj +-231 TJm +(returned) 33.1954 Tj +-231 TJm +(is) 6.64505 Tj +-231 TJm +(less) 14.9439 Tj +-231 TJm +(than) 17.1556 Tj +-232 TJm +(the) 12.1743 Tj +-231 TJm +(number) 30.4357 Tj +-231 TJm +(requested.) 40.6673 Tj +72 415.963 Td +(Ne) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ertheless,) 37.3498 Tj +-309 TJm +(this) 14.396 Tj +-297 TJm +(is) 6.64505 Tj +-298 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(arded) 22.1269 Tj +-297 TJm +(as) 8.29885 Tj +-297 TJm +(inadvisable;) 48.1492 Tj +-321 TJm +(you) 14.9439 Tj +-298 TJm +(should) 26.5703 Tj +-297 TJm +(instead) 28.224 Tj +-297 TJm +(check) 23.2328 Tj +[1 0 0 1 360.631 415.963] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.631 -415.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +360.631 415.963 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 402.475 415.963] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -402.475 -415.963] cm +[1 0 0 1 0 0] Tm +0 0 Td +405.437 415.963 Td +/F130_0 9.9626 Tf +(after) 18.2515 Tj +-297 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-298 TJm +(call) 14.386 Tj +-297 TJm +(and) 14.386 Tj +-297 TJm +(w) 7.193 Tj +10 TJm +(atch) 16.5977 Tj +-298 TJm +(out) 12.7322 Tj +-297 TJm +(for) 11.6164 Tj +[1 0 0 1 72 404.008] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -404.008] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 404.008 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 149.709 404.008] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.709 -404.008] cm +[1 0 0 1 0 0] Tm +0 0 Td +149.709 404.008 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 402.698] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -392.735] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 382.09 Td +/F130_0 9.9626 Tf +(Internally) 38.7346 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 117.541 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -117.541 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +117.541 382.09 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 177.317 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.317 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +181.786 382.09 Td +/F130_0 9.9626 Tf +(copies) 25.4544 Tj +-449 TJm +(data) 16.5977 Tj +-448 TJm +(from) 19.3673 Tj +-449 TJm +(the) 12.1743 Tj +-448 TJm +(compressed) 47.0334 Tj +-449 TJm +(\002le) 12.7322 Tj +-448 TJm +(in) 7.7509 Tj +-449 TJm +(chunks) 28.224 Tj +-449 TJm +(of) 8.29885 Tj +-448 TJm +(size) 15.4918 Tj +[1 0 0 1 419.602 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -419.602 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.602 382.09 Td +/F134_0 9.9626 Tf +(BZ_MAX_UNUSED) 77.7083 Tj +[1 0 0 1 497.31 382.09] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -497.31 -382.09] cm +[1 0 0 1 0 0] Tm +0 0 Td +501.778 382.09 Td +/F130_0 9.9626 Tf +(bytes) 21.031 Tj +-449 TJm +(be-) 12.7222 Tj +72 370.135 Td +(fore) 16.0398 Tj +-414 TJm +(decompressing) 59.7656 Tj +-414 TJm +(it.) 8.02986 Tj +-1605 TJm +(If) 6.63509 Tj +-415 TJm +(the) 12.1743 Tj +-414 TJm +(\002le) 12.7322 Tj +-414 TJm +(contains) 33.2053 Tj +-414 TJm +(more) 20.4731 Tj +-414 TJm +(bytes) 21.031 Tj +-415 TJm +(than) 17.1556 Tj +-414 TJm +(strictly) 27.6761 Tj +-414 TJm +(needed) 28.2141 Tj +-414 TJm +(to) 7.7509 Tj +-414 TJm +(reach) 21.569 Tj +-414 TJm +(the) 12.1743 Tj +-415 TJm +(logical) 27.1182 Tj +-414 TJm +(end-of-stream,) 58.3709 Tj +[1 0 0 1 72 358.18] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -358.18] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 358.18 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 131.776 358.18] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.776 -358.18] cm +[1 0 0 1 0 0] Tm +0 0 Td +134.749 358.18 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-298 TJm +(almost) 26.5703 Tj +-299 TJm +(certainly) 34.8591 Tj +-298 TJm +(read) 17.1456 Tj +-299 TJm +(some) 21.031 Tj +-298 TJm +(of) 8.29885 Tj +-299 TJm +(the) 12.1743 Tj +-298 TJm +(trailing) 28.782 Tj +-298 TJm +(data) 16.5977 Tj +-299 TJm +(before) 25.4445 Tj +-298 TJm +(signalling) 39.3025 Tj +[1 0 0 1 413.162 358.18] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -413.162 -358.18] cm +[1 0 0 1 0 0] Tm +0 0 Td +413.162 358.18 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_END) 89.6634 Tj +[1 0 0 1 502.826 358.18] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -502.826 -358.18] cm +[1 0 0 1 0 0] Tm +0 0 Td +502.826 358.18 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-597 TJm +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-298 TJm +(col-) 15.4918 Tj +72 346.224 Td +(lect) 14.386 Tj +-242 TJm +(the) 12.1743 Tj +-242 TJm +(read) 17.1456 Tj +-243 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-242 TJm +(unused) 28.224 Tj +-242 TJm +(data) 16.5977 Tj +-242 TJm +(once) 18.8094 Tj +[1 0 0 1 208.759 346.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -208.759 -346.224] cm +[1 0 0 1 0 0] Tm +0 0 Td +208.759 346.224 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_END) 89.6634 Tj +[1 0 0 1 298.423 346.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -298.423 -346.224] cm +[1 0 0 1 0 0] Tm +0 0 Td +300.835 346.224 Td +/F130_0 9.9626 Tf +(has) 13.2801 Tj +-242 TJm +(appeared,) 38.4457 Tj +-244 TJm +(call) 14.386 Tj +[1 0 0 1 374.201 346.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -374.201 -346.224] cm +[1 0 0 1 0 0] Tm +0 0 Td +374.201 346.224 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 487.775 346.224] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -487.775 -346.224] cm +[1 0 0 1 0 0] Tm +0 0 Td +490.188 346.224 Td +/F130_0 9.9626 Tf +(immediately) 49.813 Tj +72 334.269 Td +(before) 25.4445 Tj +[1 0 0 1 99.935 334.269] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -99.935 -334.269] cm +[1 0 0 1 0 0] Tm +0 0 Td +99.935 334.269 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 189.599 334.269] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -189.599 -334.269] cm +[1 0 0 1 0 0] Tm +0 0 Td +189.599 334.269 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 332.959] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -322.996] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 312.351 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 312.351] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -312.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 312.351 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 312.351] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -312.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 312.351 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 310.195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -259.343] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(20) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 24 24 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -284.568] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 263.014 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 259.427] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(buf) 17.9327 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +90 687.721 Td +(BZ_SEQUENCE_ERROR) 101.619 Tj +98.4879 675.766 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(opened) 35.8654 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(BZ2_bzWriteOpen) 89.6634 Tj +90 663.811 Td +(BZ_IO_ERROR) 65.7532 Tj +98.4879 651.856 Td +(if) 11.9551 Tj +-426 TJm +(there) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(reading) 41.8429 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(file) 23.9102 Tj +90 639.9 Td +(BZ_UNEXPECTED_EOF) 101.619 Tj +98.4879 627.945 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(file) 23.9102 Tj +-426 TJm +(ended) 29.8878 Tj +-426 TJm +(before) 35.8654 Tj +98.4879 615.99 Td +(the) 17.9327 Tj +-426 TJm +(logical) 41.8429 Tj +-426 TJm +(end-of-stream) 77.7083 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(detected) 47.8205 Tj +90 604.035 Td +(BZ_DATA_ERROR) 77.7083 Tj +98.4879 592.08 Td +(if) 11.9551 Tj +-426 TJm +(a) 5.97756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(integrity) 53.798 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(detected) 47.8205 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(stream) 35.8654 Tj +90 580.125 Td +(BZ_DATA_ERROR_MAGIC) 113.574 Tj +98.4879 568.169 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(stream) 35.8654 Tj +-426 TJm +(does) 23.9102 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(begin) 29.8878 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(requisite) 53.798 Tj +-426 TJm +(header) 35.8654 Tj +-426 TJm +(bytes) 29.8878 Tj +98.4879 556.214 Td +(\(ie,) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(a) 5.97756 Tj +-426 TJm +(bzip2) 29.8878 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(file\).) 35.8654 Tj +-852 TJm +(This) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(really) 35.8654 Tj +98.4879 544.259 Td +(a) 5.97756 Tj +-426 TJm +(special) 41.8429 Tj +-426 TJm +(case) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(BZ_DATA_ERROR.) 83.6858 Tj +90 532.304 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 520.349 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(available) 53.798 Tj +90 508.394 Td +(BZ_STREAM_END) 77.7083 Tj +98.4879 496.438 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(logical) 41.8429 Tj +-426 TJm +(end) 17.9327 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(stream) 35.8654 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(detected.) 53.798 Tj +90 484.483 Td +(BZ_OK) 29.8878 Tj +98.4879 472.528 Td +(otherwise.) 59.7756 Tj +[1 0 0 1 72 456.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -447.024] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 435.068 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 434.969] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -425.604] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 425.604 Td +/F134_0 9.9626 Tf +(number) 35.8654 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(bytes) 29.8878 Tj +-426 TJm +(read) 23.9102 Tj +98.4879 413.649 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(BZ_STREAM_END) 77.7083 Tj +90 401.694 Td +(undefined) 53.798 Tj +98.4879 389.739 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 374.197] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -364.234] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 352.279 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 352.18] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -84.6825] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 83.6862 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 80.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -342.815] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 342.815 Td +/F134_0 9.9626 Tf +(collect) 41.8429 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(buf,) 23.9102 Tj +-426 TJm +(then) 23.9102 Tj +-426 TJm +(BZ2_bzRead) 59.7756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(BZ2_bzReadClose) 89.6634 Tj +98.4879 330.859 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +90 318.904 Td +(collect) 41.8429 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(buf,) 23.9102 Tj +-426 TJm +(then) 23.9102 Tj +-426 TJm +(BZ2_bzReadClose) 89.6634 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(BZ2_bzReadGetUnused) 113.574 Tj +98.4879 306.949 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_SEQUENCE_END) 89.6634 Tj +90 294.994 Td +(BZ2_bzReadClose) 89.6634 Tj +98.4879 283.039 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 267.497] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -257.534] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 236.876 Td +/F122_0 17.2154 Tf +(3.4.3.) 43.0729 Tj +[1 0 0 1 119.858 236.876] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -236.876] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 236.876 Td +/F392_0 17.2154 Tf +(BZ2_bzReadGetUnused) 196.256 Tj +[1 0 0 1 316.114 236.876] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -244.114 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8617] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -225.178] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 225.178 Td +/F134_0 9.9626 Tf +(void) 23.9102 Tj +-426 TJm +(BZ2_bzReadGetUnused\() 119.551 Tj +-426 TJm +(int) 17.9327 Tj +259.883 223.435 Td +(*) 5.97756 Tj +270.104 225.178 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +362.278 223.435 Td +(*) 5.97756 Tj +368.256 225.178 Td +(b,) 11.9551 Tj +200.343 213.223 Td +(void) 23.9102 Tj +224.254 211.48 Td +(**) 11.9551 Tj +240.453 213.223 Td +(unused,) 41.8429 Tj +-426 TJm +(int) 17.9327 Tj +304.473 211.48 Td +(*) 5.97756 Tj +314.694 213.223 Td +(nUnused) 41.8429 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 197.681] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -187.719] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 175.764 Td +/F130_0 9.9626 Tf +(Returns) 30.9936 Tj +-435 TJm +(data) 16.5977 Tj +-435 TJm +(which) 24.3486 Tj +-435 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-435 TJm +(read) 17.1456 Tj +-435 TJm +(from) 19.3673 Tj +-435 TJm +(the) 12.1743 Tj +-435 TJm +(compressed) 47.0334 Tj +-435 TJm +(\002le) 12.7322 Tj +-435 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-435 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-435 TJm +(not) 12.7322 Tj +-435 TJm +(needed) 28.2141 Tj +-435 TJm +(to) 7.7509 Tj +-435 TJm +(get) 12.1743 Tj +-435 TJm +(to) 7.7509 Tj +-435 TJm +(the) 12.1743 Tj +-435 TJm +(logical) 27.1182 Tj +-435 TJm +(end-of-stream.) 58.3709 Tj +[1 0 0 1 72 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 162.065 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +77.9776 163.809 Td +(unused) 35.8654 Tj +[1 0 0 1 113.843 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +117.2 163.809 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-337 TJm +(set) 11.0684 Tj +-337 TJm +(to) 7.7509 Tj +-337 TJm +(the) 12.1743 Tj +-337 TJm +(address) 29.8778 Tj +-337 TJm +(of) 8.29885 Tj +-336 TJm +(the) 12.1743 Tj +-337 TJm +(data,) 19.0883 Tj +-359 TJm +(and) 14.386 Tj +[1 0 0 1 269.089 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -269.089 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +269.089 162.065 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +275.067 163.809 Td +(nUnused) 41.8429 Tj +[1 0 0 1 316.91 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -316.91 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +320.267 163.809 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-337 TJm +(the) 12.1743 Tj +-337 TJm +(number) 30.4357 Tj +-337 TJm +(of) 8.29885 Tj +-337 TJm +(bytes.) 23.5217 Tj +[1 0 0 1 427.247 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -427.247 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +427.247 162.065 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +433.225 163.809 Td +(nUnused) 41.8429 Tj +[1 0 0 1 475.068 163.809] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -475.068 -163.809] cm +[1 0 0 1 0 0] Tm +0 0 Td +478.425 163.809 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-337 TJm +(be) 9.40469 Tj +-337 TJm +(set) 11.0684 Tj +-337 TJm +(to) 7.7509 Tj +-337 TJm +(a) 4.42339 Tj +72 151.853 Td +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-250 TJm +(between) 33.1954 Tj +[1 0 0 1 131.506 151.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.506 -151.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +131.506 151.853 Td +/F134_0 9.9626 Tf +(0) 5.97756 Tj +[1 0 0 1 137.484 151.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.484 -151.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +139.975 151.853 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 156.851 151.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -156.851 -151.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +156.851 151.853 Td +/F134_0 9.9626 Tf +(BZ_MAX_UNUSED) 77.7083 Tj +[1 0 0 1 234.56 151.853] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.56 -151.853] cm +[1 0 0 1 0 0] Tm +0 0 Td +237.05 151.853 Td +/F130_0 9.9626 Tf +(inclusi) 26.5703 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e.) 6.91404 Tj +[1 0 0 1 72 150.543] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -140.581] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 129.935 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-882 TJm +(function) 33.2053 Tj +-883 TJm +(may) 17.1556 Tj +-882 TJm +(only) 17.7135 Tj +-883 TJm +(be) 9.40469 Tj +-882 TJm +(called) 23.7907 Tj +-883 TJm +(once) 18.8094 Tj +[1 0 0 1 271.332 129.935] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -271.332 -129.935] cm +[1 0 0 1 0 0] Tm +0 0 Td +271.332 129.935 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 331.108 129.935] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.108 -129.935] cm +[1 0 0 1 0 0] Tm +0 0 Td +339.9 129.935 Td +/F130_0 9.9626 Tf +(has) 13.2801 Tj +-882 TJm +(signalled) 35.9749 Tj +[1 0 0 1 406.737 129.935] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -406.737 -129.935] cm +[1 0 0 1 0 0] Tm +0 0 Td +406.737 129.935 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 484.446 129.935] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -484.446 -129.935] cm +[1 0 0 1 0 0] Tm +0 0 Td +493.231 129.935 Td +/F130_0 9.9626 Tf +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-882 TJm +(before) 25.4445 Tj +[1 0 0 1 72 117.98] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -117.98] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 117.98 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 161.664 117.98] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.664 -117.98] cm +[1 0 0 1 0 0] Tm +0 0 Td +161.664 117.98 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 116.67] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -106.708] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 96.0625 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 96.0625] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -96.0625] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 96.0625 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 96.0625] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -96.0625] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 96.0625 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 93.9057] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -43.0539] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(21) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 25 25 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -129.151] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 107.597 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 104.01] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 687.721 Td +(or) 11.9551 Tj +-426 TJm +(unused) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(nUnused) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +90 675.766 Td +(BZ_SEQUENCE_ERROR) 101.619 Tj +98.4879 663.811 Td +(if) 11.9551 Tj +-426 TJm +(BZ_STREAM_END) 77.7083 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(not) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(signalled) 53.798 Tj +98.4879 651.856 Td +(or) 11.9551 Tj +-426 TJm +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(opened) 35.8654 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(BZ2_bzWriteOpen) 89.6634 Tj +90 639.9 Td +(BZ_OK) 29.8878 Tj +98.4879 627.945 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 612.404] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -602.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 590.486 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 590.386] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3238] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -581.021] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 581.021 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 72 565.48] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -555.517] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 534.858 Td +/F122_0 17.2154 Tf +(3.4.4.) 43.0729 Tj +[1 0 0 1 119.858 534.858] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -534.858] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 534.858 Td +/F392_0 17.2154 Tf +(BZ2_bzReadClose) 154.939 Tj +[1 0 0 1 274.797 534.858] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.797 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -523.161] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 523.161 Td +/F134_0 9.9626 Tf +(void) 23.9102 Tj +-426 TJm +(BZ2_bzReadClose) 89.6634 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(int) 17.9327 Tj +244.46 521.417 Td +(*) 5.97756 Tj +250.438 523.161 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +342.612 521.417 Td +(*) 5.97756 Tj +348.59 523.161 Td +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 507.619] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -497.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 485.701 Td +/F130_0 9.9626 Tf +(Releases) 34.8591 Tj +-430 TJm +(all) 9.9626 Tj +-429 TJm +(memory) 33.2053 Tj +-430 TJm +(pertaining) 40.3983 Tj +-429 TJm +(to) 7.7509 Tj +-430 TJm +(the) 12.1743 Tj +-429 TJm +(compressed) 47.0334 Tj +-430 TJm +(\002le) 12.7322 Tj +[1 0 0 1 304.352 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -304.352 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +304.352 485.701 Td +/F134_0 9.9626 Tf +(b) 5.97756 Tj +[1 0 0 1 310.33 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -310.33 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +310.33 485.701 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 321.276 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -321.276 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +321.276 485.701 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 410.94 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.94 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +415.22 485.701 Td +/F130_0 9.9626 Tf +(does) 18.2614 Tj +-430 TJm +(not) 12.7322 Tj +-429 TJm +(call) 14.386 Tj +[1 0 0 1 473.438 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -473.438 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +473.438 485.701 Td +/F134_0 9.9626 Tf +(fclose) 35.8654 Tj +[1 0 0 1 509.304 485.701] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -509.304 -485.701] cm +[1 0 0 1 0 0] Tm +0 0 Td +513.584 485.701 Td +/F130_0 9.9626 Tf +(on) 9.9626 Tj +-430 TJm +(the) 12.1743 Tj +72 473.746 Td +(underlying) 43.1679 Tj +-264 TJm +(\002le) 12.7322 Tj +-264 TJm +(handle,) 29.0509 Tj +-267 TJm +(so) 8.85675 Tj +-264 TJm +(you) 14.9439 Tj +-264 TJm +(should) 26.5703 Tj +-264 TJm +(do) 9.9626 Tj +-264 TJm +(that) 14.9439 Tj +-264 TJm +(yourself) 32.6474 Tj +-264 TJm +(if) 6.08715 Tj +-263 TJm +(appropriate.) 47.8603 Tj +[1 0 0 1 348.653 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -348.653 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +348.653 473.746 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 438.317 473.746] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -438.317 -473.746] cm +[1 0 0 1 0 0] Tm +0 0 Td +440.946 473.746 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-264 TJm +(be) 9.40469 Tj +-264 TJm +(called) 23.7907 Tj +-264 TJm +(to) 7.7509 Tj +-264 TJm +(clean) 21.0211 Tj +72 461.791 Td +(up) 9.9626 Tj +-250 TJm +(after) 18.2515 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(situations.) 40.6873 Tj +[1 0 0 1 72 459.634] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -449.671] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 439.873 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 439.873 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 439.873] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -439.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 439.873 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 437.716] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -428.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 428.351 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +98.4879 416.396 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(opened) 35.8654 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(BZ2_bzOpenWrite) 89.6634 Tj +90 404.441 Td +(BZ_OK) 29.8878 Tj +98.4879 392.486 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 376.944] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -366.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 355.026 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 354.927] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -345.562] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 345.562 Td +/F134_0 9.9626 Tf +(none) 23.9102 Tj +[1 0 0 1 72 330.02] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -320.058] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 299.399 Td +/F122_0 17.2154 Tf +(3.4.5.) 43.0729 Tj +[1 0 0 1 119.858 299.399] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -299.399] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 299.399 Td +/F392_0 17.2154 Tf +(BZ2_bzWriteOpen) 154.939 Tj +[1 0 0 1 274.797 299.399] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -202.797 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -48.8169] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 47.8207 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 44.2341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -287.702] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 287.702 Td +/F134_0 9.9626 Tf +(BZFILE) 35.8654 Tj +130.109 285.958 Td +(*) 5.97756 Tj +136.087 287.702 Td +(BZ2_bzWriteOpen\() 95.641 Tj +-426 TJm +(int) 17.9327 Tj +258.149 285.958 Td +(*) 5.97756 Tj +264.127 287.702 Td +(bzerror,) 47.8205 Tj +-426 TJm +(FILE) 23.9102 Tj +344.346 285.958 Td +(*) 5.97756 Tj +350.323 287.702 Td +(f,) 11.9551 Tj +196.099 275.746 Td +(int) 17.9327 Tj +-426 TJm +(blockSize100k,) 83.6858 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(verbosity,) 59.7756 Tj +196.099 263.791 Td +(int) 17.9327 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 248.249] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -238.287] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 226.332 Td +/F130_0 9.9626 Tf +(Prepare) 30.4258 Tj +-268 TJm +(to) 7.7509 Tj +-269 TJm +(write) 20.4731 Tj +-268 TJm +(compressed) 47.0334 Tj +-269 TJm +(data) 16.5977 Tj +-268 TJm +(to) 7.7509 Tj +-269 TJm +(\002le) 12.7322 Tj +-268 TJm +(handle) 26.5603 Tj +[1 0 0 1 262.72 226.332] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -262.72 -226.332] cm +[1 0 0 1 0 0] Tm +0 0 Td +262.72 226.332 Td +/F134_0 9.9626 Tf +(f) 5.97756 Tj +[1 0 0 1 268.698 226.332] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -268.698 -226.332] cm +[1 0 0 1 0 0] Tm +0 0 Td +268.698 226.332 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 274.829 226.332] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -274.829 -226.332] cm +[1 0 0 1 0 0] Tm +0 0 Td +274.829 226.332 Td +/F134_0 9.9626 Tf +(f) 5.97756 Tj +[1 0 0 1 280.807 226.332] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -280.807 -226.332] cm +[1 0 0 1 0 0] Tm +0 0 Td +283.481 226.332 Td +/F130_0 9.9626 Tf +(should) 26.5703 Tj +-268 TJm +(refer) 18.7994 Tj +-269 TJm +(to) 7.7509 Tj +-268 TJm +(a) 4.42339 Tj +-269 TJm +(\002le) 12.7322 Tj +-268 TJm +(which) 24.3486 Tj +-269 TJm +(has) 13.2801 Tj +-268 TJm +(been) 18.8094 Tj +-269 TJm +(opened) 28.772 Tj +-268 TJm +(for) 11.6164 Tj +-269 TJm +(writing,) 31.2726 Tj +-273 TJm +(and) 14.386 Tj +-268 TJm +(for) 11.6164 Tj +72 214.377 Td +(which) 24.3486 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(indicator) 35.417 Tj +-250 TJm +(\() 3.31755 Tj +[1 0 0 1 176.577 214.376] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -176.577 -214.376] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.577 214.376 Td +/F134_0 9.9626 Tf +(ferror\(f\)) 53.798 Tj +[1 0 0 1 230.375 214.376] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -230.375 -214.376] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.375 214.376 Td +/F130_0 9.9626 Tf +(\)is) 9.9626 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(set.) 13.5591 Tj +[1 0 0 1 72 212.593] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -202.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 192.459 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-223 TJm +(the) 12.1743 Tj +-224 TJm +(meaning) 34.3112 Tj +-223 TJm +(of) 8.29885 Tj +-224 TJm +(parameters) 43.7059 Tj +[1 0 0 1 195.306 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -195.306 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +195.306 192.459 Td +/F134_0 9.9626 Tf +(blockSize100k) 77.7083 Tj +[1 0 0 1 273.015 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -273.015 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +273.015 192.459 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 277.784 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -277.784 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +277.784 192.459 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 331.583 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.583 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +333.808 192.459 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 350.42 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -350.42 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +350.42 192.459 Td +/F134_0 9.9626 Tf +(workFactor) 59.7756 Tj +[1 0 0 1 410.196 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.196 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +410.196 192.459 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-229 TJm +(see) 12.7222 Tj +[1 0 0 1 429.913 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -429.913 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +429.913 192.459 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 537.509 192.459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -192.459] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 192.459 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 190.302] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -180.339] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 170.541 Td +/F130_0 9.9626 Tf +(All) 12.7322 Tj +-382 TJm +(required) 33.1954 Tj +-382 TJm +(memory) 33.2053 Tj +-382 TJm +(is) 6.64505 Tj +-382 TJm +(allocated) 35.965 Tj +-383 TJm +(at) 7.193 Tj +-382 TJm +(this) 14.396 Tj +-382 TJm +(stage,) 22.9638 Tj +-415 TJm +(so) 8.85675 Tj +-382 TJm +(if) 6.08715 Tj +-382 TJm +(the) 12.1743 Tj +-382 TJm +(call) 14.386 Tj +-382 TJm +(completes) 40.3983 Tj +-382 TJm +(successfully) 48.6972 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 424.691 170.541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -424.691 -170.541] cm +[1 0 0 1 0 0] Tm +0 0 Td +424.691 170.541 Td +/F134_0 9.9626 Tf +(BZ_MEM_ERROR) 71.7307 Tj +[1 0 0 1 496.422 170.541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.422 -170.541] cm +[1 0 0 1 0 0] Tm +0 0 Td +500.228 170.541 Td +/F130_0 9.9626 Tf +(cannot) 26.5603 Tj +-382 TJm +(be) 9.40469 Tj +72 158.586 Td +(signalled) 35.9749 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(subsequent) 44.2738 Tj +-250 TJm +(call) 14.386 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 203.715 158.586] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -203.715 -158.586] cm +[1 0 0 1 0 0] Tm +0 0 Td +203.715 158.586 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 269.468 158.586] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -269.468 -158.586] cm +[1 0 0 1 0 0] Tm +0 0 Td +269.468 158.586 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 156.429] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -146.466] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 136.668 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 136.668] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -136.668] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 136.668 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 136.668] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -136.668] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 136.668 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 134.511] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -83.6593] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8518] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(22) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 26 26 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -165.016] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 143.462 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 139.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 687.721 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 675.766 Td +(if) 11.9551 Tj +-426 TJm +(f) 5.97756 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 663.811 Td +(or) 11.9551 Tj +-426 TJm +(blockSize100k) 77.7083 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(1) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(blockSize100k) 77.7083 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(9) 5.97756 Tj +90 651.856 Td +(BZ_IO_ERROR) 65.7532 Tj +98.4879 639.9 Td +(if) 11.9551 Tj +-426 TJm +(ferror\(f\)) 53.798 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(nonzero) 41.8429 Tj +90 627.945 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 615.99 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +90 604.035 Td +(BZ_OK) 29.8878 Tj +98.4879 592.08 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 576.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -566.575] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 554.62 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 554.521] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -545.156] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 545.156 Td +/F134_0 9.9626 Tf +(Pointer) 41.8429 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(abstract) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +98.4879 533.201 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +90 521.245 Td +(NULL) 23.9102 Tj +98.4879 509.29 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 493.748] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -483.786] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 471.831 Td +/F130_0 9.9626 Tf +(Allo) 17.7135 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able) 16.5977 Tj +-250 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(actions:) 30.9936 Tj +[1 0 0 1 72 471.731] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -84.6825] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 83.6862 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 80.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -462.366] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 462.366 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +98.4879 450.411 Td +(if) 11.9551 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +98.4879 438.456 Td +(\(you) 23.9102 Tj +-426 TJm +(could) 29.8878 Tj +-426 TJm +(go) 11.9551 Tj +-426 TJm +(directly) 47.8205 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(BZ2_bzWriteClose,) 101.619 Tj +-426 TJm +(but) 17.9327 Tj +-426 TJm +(this) 23.9102 Tj +-426 TJm +(would) 29.8878 Tj +-426 TJm +(be) 11.9551 Tj +-426 TJm +(pretty) 35.8654 Tj +485.505 434.212 Td +/F564_0 9.9626 Tf +( ) 9.9626 Tj +493.808 434.212 Td +/F147_0 9.9626 Tf +(-) 2.7696 Tj +90 426.501 Td +/F134_0 9.9626 Tf +(pointless\)) 59.7756 Tj +90 414.546 Td +(BZ2_bzWriteClose) 95.641 Tj +98.4879 402.59 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 387.049] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -377.086] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 356.428 Td +/F122_0 17.2154 Tf +(3.4.6.) 43.0729 Tj +[1 0 0 1 119.858 356.428] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -356.428] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 356.428 Td +/F392_0 17.2154 Tf +(BZ2_bzWrite) 113.622 Tj +[1 0 0 1 233.48 356.428] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.48 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -344.73] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 344.73 Td +/F134_0 9.9626 Tf +(void) 23.9102 Tj +-426 TJm +(BZ2_bzWrite) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(int) 17.9327 Tj +220.55 342.987 Td +(*) 5.97756 Tj +226.528 344.73 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +318.702 342.987 Td +(*) 5.97756 Tj +324.679 344.73 Td +(b,) 11.9551 Tj +-426 TJm +(void) 23.9102 Tj +369.033 342.987 Td +(*) 5.97756 Tj +375.01 344.73 Td +(buf,) 23.9102 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 329.188] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -319.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 307.27 Td +/F130_0 9.9626 Tf +(Absorbs) 33.2053 Tj +[1 0 0 1 107.696 307.27] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -107.696 -307.27] cm +[1 0 0 1 0 0] Tm +0 0 Td +107.696 307.27 Td +/F134_0 9.9626 Tf +(len) 17.9327 Tj +[1 0 0 1 125.629 307.27] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -125.629 -307.27] cm +[1 0 0 1 0 0] Tm +0 0 Td +128.119 307.27 Td +/F130_0 9.9626 Tf +(bytes) 21.031 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +[1 0 0 1 214.544 307.27] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -214.544 -307.27] cm +[1 0 0 1 0 0] Tm +0 0 Td +214.544 307.27 Td +/F134_0 9.9626 Tf +(buf) 17.9327 Tj +[1 0 0 1 232.477 307.27] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -232.477 -307.27] cm +[1 0 0 1 0 0] Tm +0 0 Td +232.477 307.27 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(entually) 32.0995 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(written) 28.224 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(\002le.) 15.2229 Tj +[1 0 0 1 72 305.114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -295.151] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 285.353 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 285.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -285.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 285.353 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 285.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -285.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 285.353 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 283.196] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -108.593] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 107.597 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 104.01] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -273.831] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 273.831 Td +/F134_0 9.9626 Tf +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 261.876 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(buf) 17.9327 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +90 249.921 Td +(BZ_SEQUENCE_ERROR) 101.619 Tj +98.4879 237.965 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(opened) 35.8654 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(BZ2_bzReadOpen) 83.6858 Tj +90 226.01 Td +(BZ_IO_ERROR) 65.7532 Tj +98.4879 214.055 Td +(if) 11.9551 Tj +-426 TJm +(there) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(writing) 41.8429 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(file.) 29.8878 Tj +90 202.1 Td +(BZ_OK) 29.8878 Tj +98.4879 190.145 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 174.603] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -164.64] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 143.982 Td +/F122_0 17.2154 Tf +(3.4.7.) 43.0729 Tj +[1 0 0 1 119.858 143.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -143.982] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 143.982 Td +/F392_0 17.2154 Tf +(BZ2_bzWriteClose) 165.268 Tj +[1 0 0 1 285.126 143.982] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -213.126 -2.3326] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -90.7975] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(23) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 27 27 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -165.016] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 143.462 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 139.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(void) 23.9102 Tj +-426 TJm +(BZ2_bzWriteClose\() 101.619 Tj +-426 TJm +(int) 17.9327 Tj +246.194 709.888 Td +(*) 5.97756 Tj +252.171 711.631 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +340.102 709.888 Td +(*) 5.97756 Tj +350.323 711.631 Td +(f,) 11.9551 Tj +187.611 699.676 Td +(int) 17.9327 Tj +-426 TJm +(abandon,) 47.8205 Tj +187.611 687.721 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +257.609 685.978 Td +(*) 5.97756 Tj +267.83 687.721 Td +(nbytes_in,) 59.7756 Tj +187.611 675.766 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +257.609 674.023 Td +(*) 5.97756 Tj +267.83 675.766 Td +(nbytes_out) 59.7756 Tj +-426 TJm +(\);) 11.9551 Tj +90 651.856 Td +(void) 23.9102 Tj +-426 TJm +(BZ2_bzWriteClose64\() 113.574 Tj +-426 TJm +(int) 17.9327 Tj +258.149 650.112 Td +(*) 5.97756 Tj +264.127 651.856 Td +(bzerror,) 47.8205 Tj +-426 TJm +(BZFILE) 35.8654 Tj +352.057 650.112 Td +(*) 5.97756 Tj +362.278 651.856 Td +(f,) 11.9551 Tj +196.099 639.9 Td +(int) 17.9327 Tj +-426 TJm +(abandon,) 47.8205 Tj +196.099 627.945 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +266.097 626.202 Td +(*) 5.97756 Tj +276.318 627.945 Td +(nbytes_in_lo32,) 89.6634 Tj +196.099 615.99 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +266.097 614.247 Td +(*) 5.97756 Tj +276.318 615.99 Td +(nbytes_in_hi32,) 89.6634 Tj +196.099 604.035 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +266.097 602.292 Td +(*) 5.97756 Tj +276.318 604.035 Td +(nbytes_out_lo32,) 95.641 Tj +196.099 592.08 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +266.097 590.336 Td +(*) 5.97756 Tj +276.318 592.08 Td +(nbytes_out_hi32) 89.6634 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 576.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -566.575] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 554.62 Td +/F130_0 9.9626 Tf +(Compresses) 48.1492 Tj +-403 TJm +(and) 14.386 Tj +-402 TJm +(\003ushes) 27.6761 Tj +-403 TJm +(to) 7.7509 Tj +-403 TJm +(the) 12.1743 Tj +-402 TJm +(compressed) 47.0334 Tj +-403 TJm +(\002le) 12.7322 Tj +-403 TJm +(a) 4.42339 Tj +1 TJm +(ll) 5.53921 Tj +-403 TJm +(data) 16.5977 Tj +-403 TJm +(so) 8.85675 Tj +-402 TJm +(f) 3.31755 Tj +10 TJm +(ar) 7.74094 Tj +-403 TJm +(supplied) 33.7633 Tj +-403 TJm +(by) 9.9626 Tj +[1 0 0 1 384.152 554.62] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -384.152 -554.62] cm +[1 0 0 1 0 0] Tm +0 0 Td +384.152 554.62 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 449.906 554.62] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -449.906 -554.62] cm +[1 0 0 1 0 0] Tm +0 0 Td +449.906 554.62 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-768 TJm +(The) 15.4918 Tj +-403 TJm +(logical) 27.1182 Tj +-402 TJm +(end-of-) 29.3199 Tj +72 542.665 Td +(stream) 26.5603 Tj +-352 TJm +(mark) 20.4731 Tj +10 TJm +(ers) 11.6164 Tj +-352 TJm +(are) 12.1643 Tj +-353 TJm +(also) 16.0497 Tj +-352 TJm +(written,) 30.7147 Tj +-378 TJm +(so) 8.85675 Tj +-352 TJm +(subsequent) 44.2738 Tj +-352 TJm +(calls) 18.2614 Tj +-352 TJm +(to) 7.7509 Tj +[1 0 0 1 300.456 542.665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -300.456 -542.665] cm +[1 0 0 1 0 0] Tm +0 0 Td +300.456 542.665 Td +/F134_0 9.9626 Tf +(BZ2_bzWrite) 65.7532 Tj +[1 0 0 1 366.209 542.665] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -366.209 -542.665] cm +[1 0 0 1 0 0] Tm +0 0 Td +369.718 542.665 Td +/F130_0 9.9626 Tf +(are) 12.1643 Tj +-352 TJm +(ille) 12.7322 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(al.) 9.68365 Tj +-1234 TJm +(All) 12.7322 Tj +-352 TJm +(memory) 33.2053 Tj +-352 TJm +(associated) 40.9463 Tj +-352 TJm +(with) 17.7135 Tj +72 530.71 Td +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +[1 0 0 1 151.411 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -151.411 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +151.411 530.71 Td +/F134_0 9.9626 Tf +(b) 5.97756 Tj +[1 0 0 1 157.389 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -157.389 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.879 530.71 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(released.) 35.1281 Tj +[1 0 0 1 207.231 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -207.231 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +207.231 530.71 Td +/F134_0 9.9626 Tf +(fflush) 35.8654 Tj +[1 0 0 1 243.097 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.097 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +245.587 530.71 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(called) 23.7907 Tj +-250 TJm +(on) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le,) 15.2229 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(not) 12.7322 Tj +[1 0 0 1 422.771 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -422.771 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +422.771 530.71 Td +/F134_0 9.9626 Tf +(fclose) 35.8654 Tj +[1 0 0 1 458.636 530.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -458.636 -530.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +458.636 530.71 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +50 TJm +(d.) 7.47195 Tj +[1 0 0 1 72 528.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -518.59] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 508.792 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +[1 0 0 1 81.5743 508.792] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -81.5743 -508.792] cm +[1 0 0 1 0 0] Tm +0 0 Td +81.5743 508.792 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 177.216 508.792] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.216 -508.792] cm +[1 0 0 1 0 0] Tm +0 0 Td +180.155 508.792 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-295 TJm +(called) 23.7907 Tj +-295 TJm +(to) 7.7509 Tj +-295 TJm +(clean) 21.0211 Tj +-295 TJm +(up) 9.9626 Tj +-295 TJm +(after) 18.2515 Tj +-295 TJm +(an) 9.40469 Tj +-295 TJm +(error) 19.3573 Tj +40 TJm +(,) 2.49065 Tj +-306 TJm +(the) 12.1743 Tj +-295 TJm +(only) 17.7135 Tj +-295 TJm +(action) 24.3486 Tj +-295 TJm +(is) 6.64505 Tj +-295 TJm +(to) 7.7509 Tj +-295 TJm +(release) 27.6562 Tj +-295 TJm +(the) 12.1743 Tj +-295 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +-891 TJm +(The) 15.4918 Tj +-295 TJm +(library) 26.5603 Tj +72 496.837 Td +(records) 29.3199 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(error) 19.3573 Tj +-289 TJm +(codes) 22.6848 Tj +-289 TJm +(issued) 24.9065 Tj +-289 TJm +(by) 9.9626 Tj +-289 TJm +(pre) 12.7222 Tj +25 TJm +(vious) 21.589 Tj +-289 TJm +(calls,) 20.7521 Tj +-299 TJm +(so) 8.85675 Tj +-289 TJm +(this) 14.396 Tj +-289 TJm +(situation) 34.3212 Tj +-289 TJm +(will) 15.5018 Tj +-289 TJm +(be) 9.40469 Tj +-289 TJm +(detected) 33.1954 Tj +-289 TJm +(automatically) 54.2364 Tj +65 TJm +(.) 2.49065 Tj +-427 TJm +(There) 23.2328 Tj +-289 TJm +(is) 6.64505 Tj +-289 TJm +(no) 9.9626 Tj +-289 TJm +(attempt) 29.8878 Tj +72 484.882 Td +(to) 7.7509 Tj +-263 TJm +(complete) 36.5229 Tj +-262 TJm +(the) 12.1743 Tj +-263 TJm +(compression) 50.3609 Tj +-263 TJm +(operation,) 40.1194 Tj +-265 TJm +(nor) 13.2801 Tj +-263 TJm +(to) 7.7509 Tj +[1 0 0 1 258.308 484.882] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -258.308 -484.882] cm +[1 0 0 1 0 0] Tm +0 0 Td +258.308 484.882 Td +/F134_0 9.9626 Tf +(fflush) 35.8654 Tj +[1 0 0 1 294.173 484.882] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -294.173 -484.882] cm +[1 0 0 1 0 0] Tm +0 0 Td +296.79 484.882 Td +/F130_0 9.9626 Tf +(the) 12.1743 Tj +-263 TJm +(compressed) 47.0334 Tj +-262 TJm +(\002le.) 15.2229 Tj +-696 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-263 TJm +(can) 13.8281 Tj +-263 TJm +(force) 20.4632 Tj +-262 TJm +(this) 14.396 Tj +-263 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +-263 TJm +(to) 7.7509 Tj +-262 TJm +(happen) 28.772 Tj +72 472.926 Td +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(case) 17.1456 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(no) 9.9626 Tj +-250 TJm +(error) 19.3573 Tj +40 TJm +(,) 2.49065 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(passing) 29.8878 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(nonzero) 32.0895 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue) 16.5977 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 305.014 472.926] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -305.014 -472.926] cm +[1 0 0 1 0 0] Tm +0 0 Td +305.014 472.926 Td +/F134_0 9.9626 Tf +(abandon) 41.8429 Tj +[1 0 0 1 346.858 472.926] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -346.858 -472.926] cm +[1 0 0 1 0 0] Tm +0 0 Td +346.858 472.926 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 470.77] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -460.807] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 451.009 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +[1 0 0 1 80.5974 451.009] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -80.5974 -451.009] cm +[1 0 0 1 0 0] Tm +0 0 Td +80.5974 451.009 Td +/F134_0 9.9626 Tf +(nbytes_in) 53.798 Tj +[1 0 0 1 134.396 451.009] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -134.396 -451.009] cm +[1 0 0 1 0 0] Tm +0 0 Td +136.358 451.009 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-197 TJm +(non-null,) 36.2539 Tj +[1 0 0 1 183.287 451.009] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -183.287 -451.009] cm +[1 0 0 1 0 0] Tm +0 0 Td +183.287 449.265 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +189.265 451.009 Td +(nbytes_in) 53.798 Tj +[1 0 0 1 243.063 451.009] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.063 -451.009] cm +[1 0 0 1 0 0] Tm +0 0 Td +245.025 451.009 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-197 TJm +(be) 9.40469 Tj +-197 TJm +(set) 11.0684 Tj +-197 TJm +(to) 7.7509 Tj +-197 TJm +(be) 9.40469 Tj +-197 TJm +(the) 12.1743 Tj +-197 TJm +(total) 17.7135 Tj +-197 TJm +(v) 4.9813 Tj +20 TJm +(olume) 24.9065 Tj +-197 TJm +(of) 8.29885 Tj +-197 TJm +(uncompressed) 56.996 Tj +-197 TJm +(data) 16.5977 Tj +-197 TJm +(handled.) 34.0322 Tj +-584 TJm +(Similarly) 37.0908 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 72 439.053] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -439.053] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 439.053 Td +/F134_0 9.9626 Tf +(nbytes_out) 59.7756 Tj +[1 0 0 1 131.776 439.053] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.776 -439.053] cm +[1 0 0 1 0 0] Tm +0 0 Td +134.716 439.053 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-295 TJm +(be) 9.40469 Tj +-295 TJm +(set) 11.0684 Tj +-295 TJm +(to) 7.7509 Tj +-295 TJm +(the) 12.1743 Tj +-295 TJm +(total) 17.7135 Tj +-295 TJm +(v) 4.9813 Tj +20 TJm +(olume) 24.9065 Tj +-296 TJm +(of) 8.29885 Tj +-295 TJm +(compressed) 47.0334 Tj +-295 TJm +(data) 16.5977 Tj +-295 TJm +(written.) 30.7147 Tj +-890 TJm +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-295 TJm +(compatibility) 53.1405 Tj +-295 TJm +(with) 17.7135 Tj +-295 TJm +(older) 20.4731 Tj +-296 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-295 TJm +(of) 8.29885 Tj +72 427.098 Td +(the) 12.1743 Tj +-283 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 118.294 427.098] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -118.294 -427.098] cm +[1 0 0 1 0 0] Tm +0 0 Td +118.294 427.098 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose) 95.641 Tj +[1 0 0 1 213.936 427.098] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -213.936 -427.098] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.753 427.098 Td +/F130_0 9.9626 Tf +(only) 17.7135 Tj +-283 TJm +(yields) 23.8007 Tj +-283 TJm +(the) 12.1743 Tj +-282 TJm +(lo) 7.7509 Tj +25 TJm +(wer) 14.9339 Tj +-283 TJm +(32) 9.9626 Tj +-283 TJm +(bits) 14.396 Tj +-283 TJm +(of) 8.29885 Tj +-283 TJm +(these) 20.4731 Tj +-282 TJm +(counts.) 28.503 Tj +-817 TJm +(Use) 15.4918 Tj +[1 0 0 1 423.499 427.098] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -423.499 -427.098] cm +[1 0 0 1 0 0] Tm +0 0 Td +423.499 427.098 Td +/F134_0 9.9626 Tf +(BZ2_bzWriteClose64) 107.596 Tj +[1 0 0 1 531.095 427.098] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -531.095 -427.098] cm +[1 0 0 1 0 0] Tm +0 0 Td +533.913 427.098 Td +/F130_0 9.9626 Tf +(if) 6.08715 Tj +72 415.143 Td +(you) 14.9439 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(full) 13.8381 Tj +-250 TJm +(64) 9.9626 Tj +-250 TJm +(bit) 10.5205 Tj +-250 TJm +(counts.) 28.503 Tj +-620 TJm +(These) 23.7907 Tj +-250 TJm +(tw) 9.9626 Tj +10 TJm +(o) 4.9813 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(otherwise) 38.7346 Tj +-250 TJm +(absolutely) 40.9562 Tj +-250 TJm +(identical.) 36.8018 Tj +[1 0 0 1 72 412.986] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -403.024] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 393.225 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(assignments) 48.7072 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 169.144 393.225] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -169.144 -393.225] cm +[1 0 0 1 0 0] Tm +0 0 Td +169.144 393.225 Td +/F134_0 9.9626 Tf +(bzerror) 41.8429 Tj +[1 0 0 1 210.987 393.225] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.987 -393.225] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.987 393.225 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 391.069] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -84.6825] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 83.6862 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 80.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -381.704] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 381.704 Td +/F134_0 9.9626 Tf +(BZ_SEQUENCE_ERROR) 101.619 Tj +98.4879 369.748 Td +(if) 11.9551 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(opened) 35.8654 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(BZ2_bzReadOpen) 83.6858 Tj +90 357.793 Td +(BZ_IO_ERROR) 65.7532 Tj +98.4879 345.838 Td +(if) 11.9551 Tj +-426 TJm +(there) 29.8878 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(writing) 41.8429 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(file) 23.9102 Tj +90 333.883 Td +(BZ_OK) 29.8878 Tj +98.4879 321.928 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 306.386] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -296.423] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 275.765 Td +/F122_0 17.2154 Tf +(3.4.8.) 43.0729 Tj +-278 TJm +(Handling) 73.6475 Tj +-278 TJm +(embed) 55.4852 Tj +10 TJm +(ded) 30.609 Tj +-278 TJm +(compressed) 101.416 Tj +-278 TJm +(data) 35.3949 Tj +-278 TJm +(streams) 66.0211 Tj +[1 0 0 1 72 271.935] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -261.972] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 253.847 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-203 TJm +(high-le) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-203 TJm +(library) 26.5603 Tj +-203 TJm +(f) 3.31755 Tj +10 TJm +(acilitates) 35.417 Tj +-203 TJm +(use) 13.2801 Tj +-203 TJm +(of) 8.29885 Tj +[1 0 0 1 226.404 253.847] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -226.404 -253.847] cm +[1 0 0 1 0 0] Tm +0 0 Td +226.404 253.847 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 256.292 253.847] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -256.292 -253.847] cm +[1 0 0 1 0 0] Tm +0 0 Td +258.316 253.847 Td +/F130_0 9.9626 Tf +(data) 16.5977 Tj +-203 TJm +(streams) 30.4357 Tj +-203 TJm +(which) 24.3486 Tj +-203 TJm +(form) 19.3673 Tj +-203 TJm +(some) 21.031 Tj +-203 TJm +(part) 15.4918 Tj +-203 TJm +(of) 8.29885 Tj +-204 TJm +(a) 4.42339 Tj +-203 TJm +(surrounding,) 50.6399 Tj +-212 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +-203 TJm +(data) 16.5977 Tj +-203 TJm +(stream.) 29.0509 Tj +[1 0 0 1 72 251.69] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.7236] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 221.967 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 221.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 221.967 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-240 TJm +(writing,) 31.2726 Tj +-243 TJm +(the) 12.1743 Tj +-240 TJm +(library) 26.5603 Tj +-241 TJm +(tak) 12.1743 Tj +10 TJm +(es) 8.29885 Tj +-240 TJm +(an) 9.40469 Tj +-241 TJm +(open) 19.3673 Tj +-240 TJm +(\002le) 12.7322 Tj +-241 TJm +(handle,) 29.0509 Tj +-242 TJm +(writes) 24.3486 Tj +-241 TJm +(compres) 33.7533 Tj +1 TJm +(sed) 13.2801 Tj +-241 TJm +(data) 16.5977 Tj +-240 TJm +(to) 7.7509 Tj +-241 TJm +(it,) 8.02986 Tj +[1 0 0 1 398.926 221.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -398.926 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +398.926 221.967 Td +/F134_0 9.9626 Tf +(fflush) 35.8654 Tj +[1 0 0 1 434.791 221.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -434.791 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +434.791 221.967 Td +/F130_0 9.9626 Tf +(es) 8.29885 Tj +-240 TJm +(it) 5.53921 Tj +-241 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-240 TJm +(does) 18.2614 Tj +-241 TJm +(not) 12.7322 Tj +[1 0 0 1 504.135 221.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -504.135 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +504.135 221.967 Td +/F134_0 9.9626 Tf +(fclose) 35.8654 Tj +[1 0 0 1 540 221.967] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -221.967] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 210.011 Td +/F130_0 9.9626 Tf +(it.) 8.02986 Tj +-610 TJm +(The) 15.4918 Tj +-235 TJm +(calling) 27.1182 Tj +-235 TJm +(application) 44.2738 Tj +-235 TJm +(can) 13.8281 Tj +-235 TJm +(write) 20.4731 Tj +-235 TJm +(its) 9.41466 Tj +-235 TJm +(o) 4.9813 Tj +25 TJm +(wn) 12.1743 Tj +-235 TJm +(data) 16.5977 Tj +-235 TJm +(before) 25.4445 Tj +-235 TJm +(and) 14.386 Tj +-235 TJm +(after) 18.2515 Tj +-235 TJm +(the) 12.1743 Tj +-235 TJm +(compressed) 47.0334 Tj +-235 TJm +(data) 16.5977 Tj +-235 TJm +(stream,) 29.0509 Tj +-238 TJm +(using) 21.589 Tj +-235 TJm +(that) 14.9439 Tj +-235 TJm +(same) 20.4731 Tj +-235 TJm +(\002le) 12.7322 Tj +86.944 198.056 Td +(handle.) 29.0509 Tj +[1 0 0 1 115.995 198.056] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -43.9948 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -176.139] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 176.139 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 176.139] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -176.139] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 176.139 Td +/F130_0 9.9626 Tf +(Reading) 33.2053 Tj +-236 TJm +(is) 6.64505 Tj +-236 TJm +(more) 20.4731 Tj +-236 TJm +(comple) 29.3299 Tj +15 TJm +(x,) 7.47195 Tj +-238 TJm +(and) 14.386 Tj +-236 TJm +(the) 12.1743 Tj +-236 TJm +(f) 3.31755 Tj +10 TJm +(acilities) 30.9936 Tj +-236 TJm +(are) 12.1643 Tj +-236 TJm +(not) 12.7322 Tj +-235 TJm +(as) 8.29885 Tj +-236 TJm +(general) 29.3199 Tj +-236 TJm +(as) 8.29885 Tj +-236 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-236 TJm +(could) 22.1369 Tj +-236 TJm +(be) 9.40469 Tj +-236 TJm +(since) 20.4731 Tj +-235 TJm +(generality) 39.8404 Tj +-236 TJm +(is) 6.64505 Tj +-236 TJm +(hard) 17.7035 Tj +-236 TJm +(to) 7.7509 Tj +-236 TJm +(reconcile) 36.5129 Tj +86.944 164.183 Td +(with) 17.7135 Tj +-404 TJm +(ef) 7.74094 Tj +25 TJm +(\002cienc) 26.5603 Tj +15 TJm +(y) 4.9813 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 164.811 164.183] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.811 -164.183] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.811 164.183 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 224.587 164.183] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -224.587 -164.183] cm +[1 0 0 1 0 0] Tm +0 0 Td +228.614 164.183 Td +/F130_0 9.9626 Tf +(reads) 21.0211 Tj +-404 TJm +(from) 19.3673 Tj +-405 TJm +(the) 12.1743 Tj +-404 TJm +(compressed) 47.0334 Tj +-404 TJm +(\002le) 12.7322 Tj +-404 TJm +(in) 7.7509 Tj +-405 TJm +(blocks) 26.0123 Tj +-404 TJm +(of) 8.29885 Tj +-404 TJm +(size) 15.4918 Tj +[1 0 0 1 434.744 164.183] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -434.744 -164.183] cm +[1 0 0 1 0 0] Tm +0 0 Td +434.744 164.183 Td +/F134_0 9.9626 Tf +(BZ_MAX_UNUSED) 77.7083 Tj +[1 0 0 1 512.452 164.183] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -512.452 -164.183] cm +[1 0 0 1 0 0] Tm +0 0 Td +516.479 164.183 Td +/F130_0 9.9626 Tf +(bytes,) 23.5217 Tj +86.944 152.228 Td +(and) 14.386 Tj +-413 TJm +(in) 7.7509 Tj +-413 TJm +(doing) 22.6948 Tj +-413 TJm +(so) 8.85675 Tj +-413 TJm +(probably) 35.417 Tj +-413 TJm +(will) 15.5018 Tj +-413 TJm +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ershoot) 29.3299 Tj +-413 TJm +(the) 12.1743 Tj +-413 TJm +(logical) 27.1182 Tj +-413 TJm +(end) 14.386 Tj +-413 TJm +(of) 8.29885 Tj +-413 TJm +(compressed) 47.0334 Tj +-413 TJm +(stream.) 29.0509 Tj +-1598 TJm +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-413 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-413 TJm +(this) 14.396 Tj +-413 TJm +(data) 16.5977 Tj +-413 TJm +(once) 18.8094 Tj +86.944 140.273 Td +(decompression) 59.7656 Tj +-252 TJm +(has) 13.2801 Tj +-252 TJm +(ended,) 26.2813 Tj +-253 TJm +(call) 14.386 Tj +[1 0 0 1 210.705 140.273] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.705 -140.273] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.705 140.273 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 324.279 140.273] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -324.279 -140.273] cm +[1 0 0 1 0 0] Tm +0 0 Td +326.789 140.273 Td +/F130_0 9.9626 Tf +(after) 18.2515 Tj +-252 TJm +(the) 12.1743 Tj +-252 TJm +(last) 13.8381 Tj +-252 TJm +(call) 14.386 Tj +-252 TJm +(of) 8.29885 Tj +[1 0 0 1 406.291 140.273] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -406.291 -140.273] cm +[1 0 0 1 0 0] Tm +0 0 Td +406.291 140.273 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 466.067 140.273] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -466.067 -140.273] cm +[1 0 0 1 0 0] Tm +0 0 Td +468.578 140.273 Td +/F130_0 9.9626 Tf +(\(the) 15.4918 Tj +-252 TJm +(one) 14.386 Tj +-252 TJm +(returning) 36.5229 Tj +[1 0 0 1 86.944 128.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -128.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 128.318 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 164.653 128.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.653 -128.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.653 128.318 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(before) 25.4445 Tj +-250 TJm +(calling) 27.1182 Tj +[1 0 0 1 243.028 128.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -243.028 -128.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +243.028 128.318 Td +/F134_0 9.9626 Tf +(BZ2_bzReadClose) 89.6634 Tj +[1 0 0 1 332.692 128.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -332.692 -128.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +332.692 128.318 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 335.182 128.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -263.182 -77.466] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.8519] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.8518 Td +/F130_0 9.9626 Tf +(24) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 28 28 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-271 TJm +(mechanism) 45.3796 Tj +-272 TJm +(mak) 17.1556 Tj +10 TJm +(es) 8.29885 Tj +-271 TJm +(it) 5.53921 Tj +-271 TJm +(easy) 17.7035 Tj +-271 TJm +(to) 7.7509 Tj +-272 TJm +(decompress) 47.0334 Tj +-271 TJm +(multiple) 33.2153 Tj +[1 0 0 1 293.312 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -293.312 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +293.312 710.037 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 323.2 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -323.2 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +325.903 710.037 Td +/F130_0 9.9626 Tf +(streams) 30.4357 Tj +-271 TJm +(placed) 26.0024 Tj +-272 TJm +(end-to-end.) 45.6486 Tj +-374 TJm +(As) 11.0684 Tj +-271 TJm +(the) 12.1743 Tj +-271 TJm +(end) 14.386 Tj +-271 TJm +(of) 8.29885 Tj +-272 TJm +(one) 14.386 Tj +-271 TJm +(stream,) 29.0509 Tj +72 698.082 Td +(when) 21.579 Tj +[1 0 0 1 96.1948 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -96.1948 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +96.1948 698.082 Td +/F134_0 9.9626 Tf +(BZ2_bzRead) 59.7756 Tj +[1 0 0 1 155.971 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.971 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.586 698.082 Td +/F130_0 9.9626 Tf +(returns) 27.6661 Tj +[1 0 0 1 188.868 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -188.868 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +188.868 698.082 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 266.577 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -266.577 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +266.577 698.082 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-263 TJm +(call) 14.386 Tj +[1 0 0 1 288.685 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -288.685 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +288.685 698.082 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 402.259 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -402.259 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +404.875 698.082 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-263 TJm +(collect) 26.5603 Tj +-262 TJm +(the) 12.1743 Tj +-263 TJm +(unused) 28.224 Tj +-262 TJm +(data) 16.5977 Tj +-263 TJm +(\(cop) 17.7035 Tj +10 TJm +(y) 4.9813 Tj +-262 TJm +(it) 5.53921 Tj +72 686.127 Td +(into) 15.5018 Tj +-265 TJm +(your) 18.2614 Tj +-265 TJm +(o) 4.9813 Tj +25 TJm +(wn) 12.1743 Tj +-265 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-265 TJm +(some) 21.031 Tj +25 TJm +(where\).) 30.1468 Tj +-711 TJm +(That) 18.2614 Tj +-265 TJm +(data) 16.5977 Tj +-265 TJm +(forms) 23.2427 Tj +-265 TJm +(the) 12.1743 Tj +-265 TJm +(start) 17.1556 Tj +-265 TJm +(of) 8.29885 Tj +-265 TJm +(the) 12.1743 Tj +-265 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-265 TJm +(compressed) 47.0334 Tj +-265 TJm +(stream.) 29.0509 Tj +-711 TJm +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-265 TJm +(start) 17.1556 Tj +-265 TJm +(uncompressing) 60.3235 Tj +72 674.172 Td +(that) 14.9439 Tj +-246 TJm +(ne) 9.40469 Tj +15 TJm +(xt) 7.7509 Tj +-246 TJm +(stream,) 29.0509 Tj +-247 TJm +(call) 14.386 Tj +[1 0 0 1 157.205 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -157.205 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +157.205 674.172 Td +/F134_0 9.9626 Tf +(BZ2_bzReadOpen) 83.6858 Tj +[1 0 0 1 240.891 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.891 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +243.344 674.172 Td +/F130_0 9.9626 Tf +(ag) 9.40469 Tj +5 TJm +(ain,) 14.6649 Tj +-247 TJm +(feeding) 29.8778 Tj +-246 TJm +(in) 7.7509 Tj +-246 TJm +(the) 12.1743 Tj +-247 TJm +(unused) 28.224 Tj +-246 TJm +(data) 16.5977 Tj +-246 TJm +(via) 12.1743 Tj +-246 TJm +(the) 12.1743 Tj +[1 0 0 1 405.967 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -405.967 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +405.967 674.172 Td +/F134_0 9.9626 Tf +(unused) 35.8654 Tj +[1 0 0 1 441.833 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -441.833 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +444.286 674.172 Td +/F130_0 9.9626 Tf +(/) 2.7696 Tj +[1 0 0 1 449.508 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -449.508 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +449.508 674.172 Td +/F134_0 9.9626 Tf +(nUnused) 41.8429 Tj +[1 0 0 1 491.351 674.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -491.351 -674.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +493.804 674.172 Td +/F130_0 9.9626 Tf +(parameters.) 46.1966 Tj +72 662.217 Td +(K) 7.193 Tj +25 TJm +(eep) 13.8281 Tj +-263 TJm +(doing) 22.6948 Tj +-263 TJm +(this) 14.396 Tj +-264 TJm +(until) 18.2714 Tj +[1 0 0 1 158.622 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.622 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +158.622 662.217 Td +/F134_0 9.9626 Tf +(BZ_STREAM_END) 77.7083 Tj +[1 0 0 1 236.33 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -236.33 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +238.952 662.217 Td +/F130_0 9.9626 Tf +(return) 23.7907 Tj +-263 TJm +(coincides) 37.6287 Tj +-263 TJm +(with) 17.7135 Tj +-263 TJm +(the) 12.1743 Tj +-264 TJm +(ph) 9.9626 Tj +5 TJm +(ysical) 23.2427 Tj +-263 TJm +(end) 14.386 Tj +-263 TJm +(of) 8.29885 Tj +-263 TJm +(\002le) 12.7322 Tj +-263 TJm +(\() 3.31755 Tj +[1 0 0 1 423.125 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -423.125 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +423.125 662.217 Td +/F134_0 9.9626 Tf +(feof\(f\)) 41.8429 Tj +[1 0 0 1 464.968 662.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -464.968 -662.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +464.968 662.217 Td +/F130_0 9.9626 Tf +(\).) 5.8082 Tj +-699 TJm +(In) 8.29885 Tj +-263 TJm +(this) 14.396 Tj +-263 TJm +(situation) 34.3212 Tj +[1 0 0 1 72 650.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -650.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 650.261 Td +/F134_0 9.9626 Tf +(BZ2_bzReadGetUnused) 113.574 Tj +[1 0 0 1 185.574 650.261] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -185.574 -650.261] cm +[1 0 0 1 0 0] Tm +0 0 Td +188.065 650.261 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(course) 26.0024 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(no) 9.9626 Tj +-250 TJm +(data.) 19.0883 Tj +[1 0 0 1 72 648.951] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -638.989] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 628.344 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-240 TJm +(should) 26.5703 Tj +-241 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-240 TJm +(some) 21.031 Tj +-241 TJm +(feel) 14.9339 Tj +-240 TJm +(for) 11.6164 Tj +-241 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-240 TJm +(the) 12.1743 Tj +-240 TJm +(high-le) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-241 TJm +(interf) 21.579 Tj +10 TJm +(ace) 13.2702 Tj +-240 TJm +(can) 13.8281 Tj +-241 TJm +(be) 9.40469 Tj +-240 TJm +(used.) 20.7521 Tj +-614 TJm +(If) 6.63509 Tj +-240 TJm +(you) 14.9439 Tj +-241 TJm +(require) 28.2141 Tj +-240 TJm +(e) 4.42339 Tj +15 TJm +(xtra) 15.4918 Tj +-241 TJm +(\003e) 9.9626 Tj +15 TJm +(xibi) 15.5018 Tj +1 TJm +(lity) 13.2901 Tj +65 TJm +(,) 2.49065 Tj +-243 TJm +(you') 18.2614 Tj +10 TJm +(ll) 5.53921 Tj +-240 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-241 TJm +(to) 7.7509 Tj +72 616.389 Td +(bite) 14.9439 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ullet) 17.7135 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(get) 12.1743 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(grips) 19.9252 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace.) 15.7608 Tj +[1 0 0 1 72 614.232] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -604.269] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 585.767 Td +/F122_0 17.2154 Tf +(3.4.9.) 43.0729 Tj +-278 TJm +(Standar) 64.0929 Tj +20 TJm +(d) 10.5186 Tj +-278 TJm +(\002le-reading/writing) 154.009 Tj +-278 TJm +(code) 40.1807 Tj +[1 0 0 1 72 581.937] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -571.975] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 563.85 Td +/F130_0 9.9626 Tf +(Here') 22.6749 Tj +55 TJm +(s) 3.87545 Tj +-250 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(you') 18.2614 Tj +50 TJm +(d) 4.9813 Tj +-250 TJm +(write) 20.4731 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le:) 15.5018 Tj +[1 0 0 1 72 561.693] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -371.606] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 370.61 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 367.024] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -552.328] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 552.328 Td +/F134_0 9.9626 Tf +(FILE) 23.9102 Tj +113.91 550.584 Td +(*) 5.97756 Tj +132.62 552.328 Td +(f;) 11.9551 Tj +90 540.373 Td +(BZFILE) 35.8654 Tj +125.865 538.629 Td +(*) 5.97756 Tj +136.087 540.373 Td +(b;) 11.9551 Tj +90 528.418 Td +(int) 17.9327 Tj +-2130 TJm +(nBuf;) 29.8878 Tj +90 516.462 Td +(char) 23.9102 Tj +-1704 TJm +(buf[) 23.9102 Tj +-426 TJm +(/) 5.97756 Tj +165.018 514.719 Td +(*) 5.97756 Tj +175.24 516.462 Td +(whatever) 47.8205 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(you) 17.9327 Tj +-426 TJm +(like) 23.9102 Tj +305.79 514.719 Td +(*) 5.97756 Tj +311.767 516.462 Td +(/) 5.97756 Tj +-426 TJm +(];) 11.9551 Tj +90 504.507 Td +(int) 17.9327 Tj +-2130 TJm +(bzerror;) 47.8205 Tj +90 492.552 Td +(int) 17.9327 Tj +-2130 TJm +(nWritten;) 53.798 Tj +90 468.642 Td +(f) 5.97756 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(fopen) 29.8878 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +("myfile.bz2",) 77.7083 Tj +-426 TJm +("w") 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +90 456.687 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(!f) 11.9551 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +94.244 444.731 Td +(/) 5.97756 Tj +100.222 442.988 Td +(*) 5.97756 Tj +110.443 444.731 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +184.685 442.988 Td +(*) 5.97756 Tj +190.662 444.731 Td +(/) 5.97756 Tj +90 432.776 Td +(}) 5.97756 Tj +90 420.821 Td +(b) 5.97756 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ2_bzWriteOpen\() 95.641 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(f,) 11.9551 Tj +-426 TJm +(9) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +90 408.866 Td +(if) 11.9551 Tj +-426 TJm +(\(bzerror) 47.8205 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(BZ_OK\)) 35.8654 Tj +-426 TJm +({) 5.97756 Tj +94.244 396.911 Td +(BZ2_bzWriteClose) 95.641 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +94.244 384.956 Td +(/) 5.97756 Tj +100.222 383.212 Td +(*) 5.97756 Tj +110.443 384.956 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +184.685 383.212 Td +(*) 5.97756 Tj +190.662 384.956 Td +(/) 5.97756 Tj +90 373 Td +(}) 5.97756 Tj +90 349.09 Td +(while) 29.8878 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(/) 5.97756 Tj +140.331 347.347 Td +(*) 5.97756 Tj +150.553 349.09 Td +(condition) 53.798 Tj +208.595 347.347 Td +(*) 5.97756 Tj +214.572 349.09 Td +(/) 5.97756 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +94.244 337.135 Td +(/) 5.97756 Tj +100.222 335.391 Td +(*) 5.97756 Tj +110.443 337.135 Td +(get) 17.9327 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(write) 29.8878 Tj +-426 TJm +(into) 23.9102 Tj +-426 TJm +(buf,) 23.9102 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(set) 17.9327 Tj +-426 TJm +(nBuf) 23.9102 Tj +-426 TJm +(appropriately) 77.7083 Tj +421.874 335.391 Td +(*) 5.97756 Tj +427.852 337.135 Td +(/) 5.97756 Tj +94.2439 325.18 Td +(nWritten) 47.8205 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ2_bzWrite) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b,) 11.9551 Tj +-426 TJm +(buf,) 23.9102 Tj +-426 TJm +(nBuf) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +94.2439 313.225 Td +(if) 11.9551 Tj +-426 TJm +(\(bzerror) 47.8205 Tj +-426 TJm +(==) 11.9551 Tj +-426 TJm +(BZ_IO_ERROR\)) 71.7307 Tj +-426 TJm +({) 5.97756 Tj +102.732 301.269 Td +(BZ2_bzWriteClose) 95.641 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +102.732 289.314 Td +(/) 5.97756 Tj +108.709 287.571 Td +(*) 5.97756 Tj +118.931 289.314 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +193.172 287.571 Td +(*) 5.97756 Tj +199.15 289.314 Td +(/) 5.97756 Tj +94.2439 277.359 Td +(}) 5.97756 Tj +90 265.404 Td +(}) 5.97756 Tj +90 241.494 Td +(BZ2_bzWriteClose\() 101.619 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +90 229.538 Td +(if) 11.9551 Tj +-426 TJm +(\(bzerror) 47.8205 Tj +-426 TJm +(==) 11.9551 Tj +-426 TJm +(BZ_IO_ERROR\)) 71.7307 Tj +-426 TJm +({) 5.97756 Tj +94.2439 217.583 Td +(/) 5.97756 Tj +100.221 215.84 Td +(*) 5.97756 Tj +110.443 217.583 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +184.684 215.84 Td +(*) 5.97756 Tj +190.662 217.583 Td +(/) 5.97756 Tj +89.9999 205.628 Td +(}) 5.97756 Tj +[1 0 0 1 72 190.086] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -180.124] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 168.168 Td +/F130_0 9.9626 Tf +(And) 17.1556 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(read) 17.1456 Tj +-250 TJm +(from) 19.3673 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le:) 15.5018 Tj +[1 0 0 1 72 166.012] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -115.16] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9513] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9513 Td +/F130_0 9.9626 Tf +(25) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 29 29 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -392.164] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 370.61 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 367.024] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(FILE) 23.9102 Tj +113.91 709.888 Td +(*) 5.97756 Tj +132.62 711.631 Td +(f;) 11.9551 Tj +90 699.676 Td +(BZFILE) 35.8654 Tj +125.865 697.933 Td +(*) 5.97756 Tj +136.087 699.676 Td +(b;) 11.9551 Tj +90 687.721 Td +(int) 17.9327 Tj +-2130 TJm +(nBuf;) 29.8878 Tj +90 675.766 Td +(char) 23.9102 Tj +-1704 TJm +(buf[) 23.9102 Tj +-426 TJm +(/) 5.97756 Tj +165.018 674.023 Td +(*) 5.97756 Tj +175.24 675.766 Td +(whatever) 47.8205 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(you) 17.9327 Tj +-426 TJm +(like) 23.9102 Tj +305.79 674.023 Td +(*) 5.97756 Tj +311.767 675.766 Td +(/) 5.97756 Tj +-426 TJm +(];) 11.9551 Tj +90 663.811 Td +(int) 17.9327 Tj +-2130 TJm +(bzerror;) 47.8205 Tj +90 651.856 Td +(int) 17.9327 Tj +-2130 TJm +(nWritten;) 53.798 Tj +90 627.945 Td +(f) 5.97756 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(fopen) 29.8878 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +("myfile.bz2",) 77.7083 Tj +-426 TJm +("r") 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +90 615.99 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(!f) 11.9551 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +98.488 604.035 Td +(/) 5.97756 Tj +104.466 602.292 Td +(*) 5.97756 Tj +114.687 604.035 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +188.929 602.292 Td +(*) 5.97756 Tj +194.906 604.035 Td +(/) 5.97756 Tj +90 592.08 Td +(}) 5.97756 Tj +90 580.125 Td +(b) 5.97756 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ2_bzReadOpen) 83.6858 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(f,) 11.9551 Tj +-426 TJm +(0,) 11.9551 Tj +-426 TJm +(NULL,) 29.8878 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +90 568.169 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +98.488 556.214 Td +(BZ2_bzReadClose) 89.6634 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +98.488 544.259 Td +(/) 5.97756 Tj +104.466 542.516 Td +(*) 5.97756 Tj +114.687 544.259 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +188.929 542.516 Td +(*) 5.97756 Tj +194.906 544.259 Td +(/) 5.97756 Tj +90 532.304 Td +(}) 5.97756 Tj +90 508.394 Td +(bzerror) 41.8429 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ_OK;) 35.8654 Tj +90 496.438 Td +(while) 29.8878 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(==) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(&&) 11.9551 Tj +-426 TJm +(/) 5.97756 Tj +252.948 494.695 Td +(*) 5.97756 Tj +263.17 496.438 Td +(arbitrary) 53.798 Tj +-426 TJm +(other) 29.8878 Tj +-426 TJm +(conditions) 59.7756 Tj +419.364 494.695 Td +(*) 5.97756 Tj +425.341 496.438 Td +(/\)) 11.9551 Tj +-426 TJm +({) 5.97756 Tj +98.488 484.483 Td +(nBuf) 23.9102 Tj +-426 TJm +(=) 5.97756 Tj +-426 TJm +(BZ2_bzRead) 59.7756 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b,) 11.9551 Tj +-426 TJm +(buf,) 23.9102 Tj +-426 TJm +(/) 5.97756 Tj +319.478 482.74 Td +(*) 5.97756 Tj +329.7 484.483 Td +(size) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(buf) 17.9327 Tj +396.23 482.74 Td +(*) 5.97756 Tj +402.208 484.483 Td +(/) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +98.488 472.528 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(==) 11.9551 Tj +-426 TJm +(BZ_OK) 29.8878 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +106.976 460.573 Td +(/) 5.97756 Tj +112.953 458.829 Td +(*) 5.97756 Tj +123.175 460.573 Td +(do) 11.9551 Tj +-426 TJm +(something) 53.798 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(buf[0) 29.8878 Tj +-426 TJm +(..) 11.9551 Tj +-426 TJm +(nBuf-1]) 41.8429 Tj +321.989 458.829 Td +(*) 5.97756 Tj +327.966 460.573 Td +(/) 5.97756 Tj +98.4879 448.618 Td +(}) 5.97756 Tj +90 436.663 Td +(}) 5.97756 Tj +90 424.707 Td +(if) 11.9551 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(bzerror) 41.8429 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(BZ_STREAM_END) 77.7083 Tj +-426 TJm +(\)) 5.97756 Tj +-426 TJm +({) 5.97756 Tj +102.732 412.752 Td +(BZ2_bzReadClose) 89.6634 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +102.732 400.797 Td +(/) 5.97756 Tj +108.709 399.054 Td +(*) 5.97756 Tj +118.931 400.797 Td +(handle) 35.8654 Tj +-426 TJm +(error) 29.8878 Tj +193.172 399.054 Td +(*) 5.97756 Tj +199.15 400.797 Td +(/) 5.97756 Tj +90 388.842 Td +(}) 5.97756 Tj +-426 TJm +(else) 23.9102 Tj +-426 TJm +({) 5.97756 Tj +102.732 376.887 Td +(BZ2_bzReadClose) 89.6634 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(&bzerror,) 53.798 Tj +-426 TJm +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +90 364.932 Td +(}) 5.97756 Tj +[1 0 0 1 72 349.39] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -339.427] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 314.637 Td +/F122_0 20.6585 Tf +(3.5.) 34.4584 Tj +-278 TJm +(Utility) 57.3893 Tj +-278 TJm +(functions) 92.9633 Tj +[1 0 0 1 72 310.361] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -300.398] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 284.016 Td +/F122_0 17.2154 Tf +(3.5.1.) 43.0729 Tj +[1 0 0 1 119.858 284.016] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -284.016] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 284.016 Td +/F392_0 17.2154 Tf +(BZ2_bzBuffToBuffCompress) 247.902 Tj +[1 0 0 1 367.76 284.016] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -295.76 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -96.6376] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 95.6413 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 92.0548] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -272.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 272.318 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzBuffToBuffCompress\() 149.439 Tj +-426 TJm +(char) 23.9102 Tj +289.771 270.575 Td +(*) 5.97756 Tj +333.944 272.318 Td +(dest,) 29.8878 Tj +217.319 260.363 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +287.317 258.62 Td +(*) 5.97756 Tj +297.538 260.363 Td +(destLen,) 47.8205 Tj +217.319 248.408 Td +(char) 23.9102 Tj +241.23 246.664 Td +(*) 5.97756 Tj +285.403 248.408 Td +(source,) 41.8429 Tj +217.319 236.453 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-852 TJm +(sourceLen,) 59.7756 Tj +217.319 224.498 Td +(int) 17.9327 Tj +-4686 TJm +(blockSize100k,) 83.6858 Tj +217.319 212.542 Td +(int) 17.9327 Tj +-4686 TJm +(verbosity,) 59.7756 Tj +217.319 200.587 Td +(int) 17.9327 Tj +-4686 TJm +(workFactor) 59.7756 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 185.045] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -175.083] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 163.128 Td +/F130_0 9.9626 Tf +(Attempts) 36.5329 Tj +-442 TJm +(to) 7.7509 Tj +-442 TJm +(compress) 37.6287 Tj +-443 TJm +(the) 12.1743 Tj +-442 TJm +(data) 16.5977 Tj +-442 TJm +(in) 7.7509 Tj +[1 0 0 1 216.87 163.128] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.87 -163.128] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.87 163.128 Td +/F134_0 9.9626 Tf +(source[0) 47.8205 Tj +-600 TJm +(..) 11.9551 Tj +-1200 TJm +(sourceLen-1]) 71.7307 Tj +[1 0 0 1 366.31 163.128] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -366.31 -163.128] cm +[1 0 0 1 0 0] Tm +0 0 Td +370.715 163.128 Td +/F130_0 9.9626 Tf +(into) 15.5018 Tj +-442 TJm +(the) 12.1743 Tj +-442 TJm +(destination) 43.7259 Tj +-443 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +40 TJm +(,) 2.49065 Tj +[1 0 0 1 486.202 163.128] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -486.202 -163.128] cm +[1 0 0 1 0 0] Tm +0 0 Td +486.202 163.128 Td +/F134_0 9.9626 Tf +(dest[0) 35.8654 Tj +-600 TJm +(..) 11.9551 Tj +72 149.429 Td +(*) 5.97756 Tj +77.9776 151.173 Td +(destLen-1]) 59.7756 Tj +[1 0 0 1 137.753 151.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.753 -151.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +137.753 151.172 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1393 TJm +(If) 6.63509 Tj +-379 TJm +(the) 12.1743 Tj +-379 TJm +(destination) 43.7259 Tj +-379 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-378 TJm +(is) 6.64505 Tj +-379 TJm +(big) 12.7322 Tj +-379 TJm +(enough,) 31.8205 Tj +[1 0 0 1 318.486 151.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -318.486 -151.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +318.486 149.429 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +324.464 151.173 Td +(destLen) 41.8429 Tj +[1 0 0 1 366.307 151.172] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -366.307 -151.172] cm +[1 0 0 1 0 0] Tm +0 0 Td +370.081 151.172 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-379 TJm +(set) 11.0684 Tj +-379 TJm +(to) 7.7509 Tj +-378 TJm +(the) 12.1743 Tj +-379 TJm +(size) 15.4918 Tj +-379 TJm +(of) 8.29885 Tj +-379 TJm +(the) 12.1743 Tj +-379 TJm +(compressed) 47.0334 Tj +-379 TJm +(data,) 19.0883 Tj +72 139.217 Td +(and) 14.386 Tj +[1 0 0 1 89.5273 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -89.5273 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +89.5273 139.217 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 119.415 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.415 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +122.556 139.217 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-315 TJm +(returned.) 35.686 Tj +-1012 TJm +(If) 6.63509 Tj +-315 TJm +(the) 12.1743 Tj +-316 TJm +(compressed) 47.0334 Tj +-315 TJm +(data) 16.5977 Tj +-315 TJm +(w) 7.193 Tj +10 TJm +(on') 13.2801 Tj +18 TJm +(t) 2.7696 Tj +-316 TJm +(\002t,) 10.7995 Tj +[1 0 0 1 313.322 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -313.322 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +313.322 137.474 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +319.3 139.217 Td +(destLen) 41.8429 Tj +[1 0 0 1 361.143 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -361.143 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +364.284 139.217 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-315 TJm +(unchanged,) 45.6486 Tj +-332 TJm +(and) 14.386 Tj +[1 0 0 1 440.551 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -440.551 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +440.551 139.217 Td +/F134_0 9.9626 Tf +(BZ_OUTBUFF_FULL) 89.6634 Tj +[1 0 0 1 530.215 139.217] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -530.215 -139.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +533.355 139.217 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +72 127.262 Td +(returned.) 35.686 Tj +[1 0 0 1 72 127.163] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -117.2] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 105.344 Td +/F130_0 9.9626 Tf +(Compression) 52.5826 Tj +-297 TJm +(in) 7.7509 Tj +-297 TJm +(this) 14.396 Tj +-297 TJm +(manner) 29.8778 Tj +-297 TJm +(is) 6.64505 Tj +-297 TJm +(a) 4.42339 Tj +-297 TJm +(one-shot) 34.3112 Tj +-297 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ent,) 14.6649 Tj +-309 TJm +(done) 19.3673 Tj +-297 TJm +(with) 17.7135 Tj +-297 TJm +(a) 4.42339 Tj +-297 TJm +(single) 23.8007 Tj +-297 TJm +(call) 14.386 Tj +-297 TJm +(to) 7.7509 Tj +-297 TJm +(this) 14.396 Tj +-297 TJm +(function.) 35.696 Tj +-903 TJm +(The) 15.4918 Tj +-297 TJm +(resulting) 34.8691 Tj +-297 TJm +(compressed) 47.0334 Tj +72 93.3892 Td +(data) 16.5977 Tj +-296 TJm +(is) 6.64505 Tj +-296 TJm +(a) 4.42339 Tj +-296 TJm +(complete) 36.5229 Tj +[1 0 0 1 147.988 93.3892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -147.988 -93.3892] cm +[1 0 0 1 0 0] Tm +0 0 Td +147.988 93.3892 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 177.875 93.3892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -177.875 -93.3892] cm +[1 0 0 1 0 0] Tm +0 0 Td +180.825 93.3892 Td +/F130_0 9.9626 Tf +(format) 26.5603 Tj +-296 TJm +(data) 16.5977 Tj +-296 TJm +(stream.) 29.0509 Tj +-897 TJm +(There) 23.2328 Tj +-296 TJm +(is) 6.64505 Tj +-296 TJm +(no) 9.9626 Tj +-296 TJm +(mechanism) 45.3796 Tj +-296 TJm +(for) 11.6164 Tj +-296 TJm +(making) 29.8878 Tj +-296 TJm +(additional) 39.8504 Tj +-296 TJm +(calls) 18.2614 Tj +-296 TJm +(to) 7.7509 Tj +-296 TJm +(pro) 13.2801 Tj +15 TJm +(vide) 17.1556 Tj +-296 TJm +(e) 4.42339 Tj +15 TJm +(xtra) 15.4918 Tj +72 81.434 Td +(input) 20.4831 Tj +-250 TJm +(data.) 19.0883 Tj +-620 TJm +(If) 6.63509 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(kind) 17.7135 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(mechanism,) 47.8703 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(lo) 7.7509 Tj +25 TJm +(w-le) 17.7035 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(el) 7.193 Tj +-250 TJm +(interf) 21.579 Tj +10 TJm +(ace.) 15.7608 Tj +[1 0 0 1 72 79.2772] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -28.4254] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(26) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 30 30 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-223 TJm +(the) 12.1743 Tj +-224 TJm +(meaning) 34.3112 Tj +-223 TJm +(of) 8.29885 Tj +-224 TJm +(parameters) 43.7059 Tj +[1 0 0 1 195.306 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -195.306 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +195.306 710.037 Td +/F134_0 9.9626 Tf +(blockSize100k) 77.7083 Tj +[1 0 0 1 273.015 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -273.015 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +273.015 710.037 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 277.784 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -277.784 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +277.784 710.037 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 331.583 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.583 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +333.808 710.037 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 350.42 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -350.42 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +350.42 710.037 Td +/F134_0 9.9626 Tf +(workFactor) 59.7756 Tj +[1 0 0 1 410.196 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -410.196 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +410.196 710.037 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-229 TJm +(see) 12.7222 Tj +[1 0 0 1 429.913 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -429.913 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +429.913 710.037 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 537.509 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 710.037 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 707.88] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -697.918] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 688.12 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +80 TJm +(o) 4.9813 Tj +-410 TJm +(guarantee) 38.7246 Tj +-410 TJm +(that) 14.9439 Tj +-410 TJm +(the) 12.1743 Tj +-410 TJm +(compressed) 47.0334 Tj +-410 TJm +(data) 16.5977 Tj +-410 TJm +(will) 15.5018 Tj +-410 TJm +(\002t) 8.30881 Tj +-410 TJm +(in) 7.7509 Tj +-410 TJm +(its) 9.41466 Tj +-410 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +40 TJm +(,) 2.49065 Tj +-450 TJm +(allocate) 30.9837 Tj +-410 TJm +(an) 9.40469 Tj +-410 TJm +(output) 25.4644 Tj +-410 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-411 TJm +(of) 8.29885 Tj +-410 TJm +(size) 15.4918 Tj +-410 TJm +(1%) 13.2801 Tj +-410 TJm +(lar) 10.5105 Tj +18 TJm +(ger) 12.7222 Tj +-410 TJm +(than) 17.1556 Tj +-410 TJm +(the) 12.1743 Tj +72 676.164 Td +(uncompressed) 56.996 Tj +-250 TJm +(data,) 19.0883 Tj +-250 TJm +(plus) 16.6077 Tj +-250 TJm +(six) 11.6264 Tj +-250 TJm +(hundred) 32.6474 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xtra) 15.4918 Tj +-250 TJm +(bytes.) 23.5217 Tj +[1 0 0 1 72 674.007] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -664.045] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 654.247 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 227.417 654.247] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -227.417 -654.247] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.553 654.247 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-315 TJm +(not) 12.7322 Tj +-315 TJm +(write) 20.4731 Tj +-314 TJm +(data) 16.5977 Tj +-315 TJm +(at) 7.193 Tj +-315 TJm +(or) 8.29885 Tj +-315 TJm +(be) 9.40469 Tj +15 TJm +(yond) 19.9252 Tj +[1 0 0 1 362.484 654.247] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -362.484 -654.247] cm +[1 0 0 1 0 0] Tm +0 0 Td +362.484 654.247 Td +/F134_0 9.9626 Tf +(dest[) 29.8878 Tj +392.372 652.503 Td +(*) 5.97756 Tj +398.349 654.247 Td +(destLen]) 47.8205 Tj +[1 0 0 1 446.17 654.247] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -446.17 -654.247] cm +[1 0 0 1 0 0] Tm +0 0 Td +446.17 654.247 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-331 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-315 TJm +(in) 7.7509 Tj +-315 TJm +(case) 17.1456 Tj +-314 TJm +(of) 8.29885 Tj +-315 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +72 642.291 Td +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er\003o) 18.2614 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 642.192] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -632.229] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 620.374 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 620.274] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -168.369] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 167.372 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 163.786] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -610.909] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 610.909 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 598.954 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 586.999 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 575.044 Td +(if) 11.9551 Tj +-426 TJm +(dest) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(destLen) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 563.088 Td +(or) 11.9551 Tj +-426 TJm +(blockSize100k) 77.7083 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(1) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(blockSize100k) 77.7083 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(9) 5.97756 Tj +98.4879 551.133 Td +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(4) 5.97756 Tj +98.4879 539.178 Td +(or) 11.9551 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(workFactor) 59.7756 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(250) 17.9327 Tj +90 527.223 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 515.268 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +90 503.313 Td +(BZ_OUTBUFF_FULL) 89.6634 Tj +98.4879 491.357 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(exceeds) 41.8429 Tj +341.655 489.614 Td +(*) 5.97756 Tj +347.633 491.357 Td +(destLen) 41.8429 Tj +90 479.402 Td +(BZ_OK) 29.8878 Tj +98.4879 467.447 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 451.905] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -441.943] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 421.284 Td +/F122_0 17.2154 Tf +(3.5.2.) 43.0729 Tj +[1 0 0 1 119.858 421.284] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.858 -421.284] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.858 421.284 Td +/F392_0 17.2154 Tf +(BZ2_bzBuffToBuffDecompress) 268.56 Tj +[1 0 0 1 388.419 421.284] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -316.419 -2.3327] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -84.6824] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 83.6862 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 80.0996] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -409.587] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 409.587 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzBuffToBuffDecompress\() 161.394 Tj +-426 TJm +(char) 23.9102 Tj +301.726 407.843 Td +(*) 5.97756 Tj +345.899 409.587 Td +(dest,) 29.8878 Tj +225.807 397.632 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +295.805 395.888 Td +(*) 5.97756 Tj +306.026 397.632 Td +(destLen,) 47.8205 Tj +225.807 385.676 Td +(char) 23.9102 Tj +249.718 383.933 Td +(*) 5.97756 Tj +293.891 385.676 Td +(source,) 41.8429 Tj +225.807 373.721 Td +(unsigned) 47.8205 Tj +-426 TJm +(int) 17.9327 Tj +-852 TJm +(sourceLen,) 59.7756 Tj +225.807 361.766 Td +(int) 17.9327 Tj +-4686 TJm +(small,) 35.8654 Tj +225.807 349.811 Td +(int) 17.9327 Tj +-4686 TJm +(verbosity) 53.798 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 334.269] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -324.306] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 312.351 Td +/F130_0 9.9626 Tf +(Attempts) 36.5329 Tj +-358 TJm +(to) 7.7509 Tj +-359 TJm +(decompress) 47.0334 Tj +-358 TJm +(the) 12.1743 Tj +-358 TJm +(data) 16.5977 Tj +-359 TJm +(in) 7.7509 Tj +[1 0 0 1 221.259 312.351] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -221.259 -312.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.259 312.351 Td +/F134_0 9.9626 Tf +(source[0) 47.8205 Tj +-600 TJm +(..) 11.9551 Tj +-1200 TJm +(sourceLen-1]) 71.7307 Tj +[1 0 0 1 370.698 312.351] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -370.698 -312.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +374.268 312.351 Td +/F130_0 9.9626 Tf +(into) 15.5018 Tj +-358 TJm +(the) 12.1743 Tj +-359 TJm +(destination) 43.7259 Tj +-358 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +40 TJm +(,) 2.49065 Tj +[1 0 0 1 486.202 312.351] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -486.202 -312.351] cm +[1 0 0 1 0 0] Tm +0 0 Td +486.202 312.351 Td +/F134_0 9.9626 Tf +(dest[0) 35.8654 Tj +-600 TJm +(..) 11.9551 Tj +72 298.653 Td +(*) 5.97756 Tj +77.9776 300.396 Td +(destLen-1]) 59.7756 Tj +[1 0 0 1 137.753 300.396] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.753 -300.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +137.753 300.396 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1123 TJm +(If) 6.63509 Tj +-334 TJm +(the) 12.1743 Tj +-334 TJm +(destination) 43.7259 Tj +-334 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-334 TJm +(is) 6.64505 Tj +-334 TJm +(big) 12.7322 Tj +-334 TJm +(enough,) 31.8205 Tj +[1 0 0 1 312.554 300.396] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -312.554 -300.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +312.554 298.653 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +318.531 300.396 Td +(destLen) 41.8429 Tj +[1 0 0 1 360.374 300.396] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.374 -300.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.701 300.396 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-334 TJm +(set) 11.0684 Tj +-334 TJm +(to) 7.7509 Tj +-334 TJm +(the) 12.1743 Tj +-334 TJm +(size) 15.4918 Tj +-333 TJm +(of) 8.29885 Tj +-334 TJm +(the) 12.1743 Tj +-334 TJm +(uncompressed) 56.996 Tj +-334 TJm +(data,) 19.0883 Tj +72 288.441 Td +(and) 14.386 Tj +[1 0 0 1 89.5273 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -89.5273 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +89.5273 288.441 Td +/F134_0 9.9626 Tf +(BZ_OK) 29.8878 Tj +[1 0 0 1 119.415 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.415 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +122.556 288.441 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-315 TJm +(returned.) 35.686 Tj +-1012 TJm +(If) 6.63509 Tj +-315 TJm +(the) 12.1743 Tj +-316 TJm +(compressed) 47.0334 Tj +-315 TJm +(data) 16.5977 Tj +-315 TJm +(w) 7.193 Tj +10 TJm +(on') 13.2801 Tj +18 TJm +(t) 2.7696 Tj +-316 TJm +(\002t,) 10.7995 Tj +[1 0 0 1 313.322 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -313.322 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +313.322 286.698 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +319.3 288.441 Td +(destLen) 41.8429 Tj +[1 0 0 1 361.143 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -361.143 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +364.284 288.441 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-315 TJm +(unchanged,) 45.6486 Tj +-332 TJm +(and) 14.386 Tj +[1 0 0 1 440.551 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -440.551 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +440.551 288.441 Td +/F134_0 9.9626 Tf +(BZ_OUTBUFF_FULL) 89.6634 Tj +[1 0 0 1 530.215 288.441] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -530.215 -288.441] cm +[1 0 0 1 0 0] Tm +0 0 Td +533.355 288.441 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +72 276.486 Td +(returned.) 35.686 Tj +[1 0 0 1 72 276.386] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -266.424] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 254.568 Td +/F134_0 9.9626 Tf +(source) 35.8654 Tj +[1 0 0 1 107.865 254.568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -107.865 -254.568] cm +[1 0 0 1 0 0] Tm +0 0 Td +110.981 254.568 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-313 TJm +(assumed) 34.3112 Tj +-312 TJm +(to) 7.7509 Tj +-313 TJm +(hold) 17.7135 Tj +-313 TJm +(a) 4.42339 Tj +-313 TJm +(complete) 36.5229 Tj +[1 0 0 1 237.04 254.568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -237.04 -254.568] cm +[1 0 0 1 0 0] Tm +0 0 Td +237.04 254.568 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 266.928 254.568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -266.928 -254.568] cm +[1 0 0 1 0 0] Tm +0 0 Td +270.044 254.568 Td +/F130_0 9.9626 Tf +(format) 26.5603 Tj +-313 TJm +(data) 16.5977 Tj +-312 TJm +(stream.) 29.0509 Tj +[1 0 0 1 353.446 254.568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -353.446 -254.568] cm +[1 0 0 1 0 0] Tm +0 0 Td +353.446 254.568 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 508.863 254.568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -508.863 -254.568] cm +[1 0 0 1 0 0] Tm +0 0 Td +511.978 254.568 Td +/F130_0 9.9626 Tf +(tries) 17.1556 Tj +-313 TJm +(to) 7.7509 Tj +72 242.613 Td +(decompress) 47.0334 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(entirety) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(stream) 26.5603 Tj +-250 TJm +(into) 15.5018 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(output) 25.4644 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 240.456] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -230.493] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 220.695 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(meaning) 34.3112 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(parameters) 43.7059 Tj +[1 0 0 1 196.631 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.631 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +196.631 220.695 Td +/F134_0 9.9626 Tf +(small) 29.8878 Tj +[1 0 0 1 226.519 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -226.519 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +229.01 220.695 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 245.887 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.887 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +245.887 220.695 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 299.685 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -299.685 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +299.685 220.695 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(see) 12.7222 Tj +[1 0 0 1 319.879 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -319.879 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +319.879 220.695 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 439.431 220.695] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -439.431 -220.695] cm +[1 0 0 1 0 0] Tm +0 0 Td +439.431 220.695 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 218.538] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -208.576] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 198.777 Td +/F130_0 9.9626 Tf +(Because) 33.1954 Tj +-250 TJm +(the) 12.1743 Tj +-249 TJm +(compression) 50.3609 Tj +-250 TJm +(ratio) 18.2614 Tj +-249 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-249 TJm +(compressed) 47.0334 Tj +-250 TJm +(data) 16.5977 Tj +-249 TJm +(cannot) 26.5603 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(kno) 14.9439 Tj +25 TJm +(wn) 12.1743 Tj +-249 TJm +(in) 7.7509 Tj +-250 TJm +(adv) 14.386 Tj +25 TJm +(ance,) 20.7421 Tj +-249 TJm +(there) 19.9152 Tj +-250 TJm +(is) 6.64505 Tj +-249 TJm +(no) 9.9626 Tj +-250 TJm +(easy) 17.7035 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-249 TJm +(to) 7.7509 Tj +-250 TJm +(guarantee) 38.7246 Tj +72 186.822 Td +(that) 14.9439 Tj +-286 TJm +(the) 12.1743 Tj +-287 TJm +(output) 25.4644 Tj +-286 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +-287 TJm +(will) 15.5018 Tj +-286 TJm +(be) 9.40469 Tj +-286 TJm +(big) 12.7322 Tj +-287 TJm +(enough.) 31.8205 Tj +-838 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-287 TJm +(may) 17.1556 Tj +-286 TJm +(of) 8.29885 Tj +-287 TJm +(course) 26.0024 Tj +-286 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-286 TJm +(arrangements) 53.6685 Tj +-287 TJm +(in) 7.7509 Tj +-286 TJm +(your) 18.2614 Tj +-287 TJm +(code) 18.8094 Tj +-286 TJm +(to) 7.7509 Tj +-286 TJm +(record) 25.4445 Tj +-287 TJm +(the) 12.1743 Tj +-286 TJm +(size) 15.4918 Tj +-287 TJm +(of) 8.29885 Tj +72 174.867 Td +(the) 12.1743 Tj +-250 TJm +(uncompressed) 56.996 Tj +-250 TJm +(data,) 19.0883 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(mechanism) 45.3796 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(be) 9.40469 Tj +15 TJm +(yond) 19.9252 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(scope) 22.6848 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 172.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -162.747] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 152.949 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 227.417 152.949] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -227.417 -152.949] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.553 152.949 Td +/F130_0 9.9626 Tf +(will) 15.5018 Tj +-315 TJm +(not) 12.7322 Tj +-315 TJm +(write) 20.4731 Tj +-314 TJm +(data) 16.5977 Tj +-315 TJm +(at) 7.193 Tj +-315 TJm +(or) 8.29885 Tj +-315 TJm +(be) 9.40469 Tj +15 TJm +(yond) 19.9252 Tj +[1 0 0 1 362.484 152.949] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -362.484 -152.949] cm +[1 0 0 1 0 0] Tm +0 0 Td +362.484 152.949 Td +/F134_0 9.9626 Tf +(dest[) 29.8878 Tj +392.372 151.206 Td +(*) 5.97756 Tj +398.349 152.949 Td +(destLen]) 47.8205 Tj +[1 0 0 1 446.17 152.949] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -446.17 -152.949] cm +[1 0 0 1 0 0] Tm +0 0 Td +446.17 152.949 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-331 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(en) 9.40469 Tj +-315 TJm +(in) 7.7509 Tj +-315 TJm +(case) 17.1456 Tj +-314 TJm +(of) 8.29885 Tj +-315 TJm +(b) 4.9813 Tj +20 TJm +(uf) 8.29885 Tj +25 TJm +(fer) 11.0585 Tj +72 140.994 Td +(o) 4.9813 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(er\003o) 18.2614 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 140.894] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -130.932] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 119.076 Td +/F130_0 9.9626 Tf +(Possible) 33.2153 Tj +-250 TJm +(return) 23.7907 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues:) 23.2427 Tj +[1 0 0 1 72 118.977] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -68.1248] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(27) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 31 31 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -344.462 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +420.96 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 498.449 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -498.449 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.449 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 546.269 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0365 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -248.702] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 227.148 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 223.562] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -711.631] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 711.631 Td +/F134_0 9.9626 Tf +(BZ_CONFIG_ERROR) 89.6634 Tj +98.4879 699.676 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(library) 41.8429 Tj +-426 TJm +(has) 17.9327 Tj +-426 TJm +(been) 23.9102 Tj +-426 TJm +(mis-compiled) 71.7307 Tj +90 687.721 Td +(BZ_PARAM_ERROR) 83.6858 Tj +98.4879 675.766 Td +(if) 11.9551 Tj +-426 TJm +(dest) 23.9102 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(destLen) 41.8429 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(NULL) 23.9102 Tj +98.4879 663.811 Td +(or) 11.9551 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(&&) 11.9551 Tj +-426 TJm +(small) 29.8878 Tj +-426 TJm +(!=) 11.9551 Tj +-426 TJm +(1) 5.97756 Tj +98.4879 651.856 Td +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(<) 5.97756 Tj +-426 TJm +(0) 5.97756 Tj +-426 TJm +(or) 11.9551 Tj +-426 TJm +(verbosity) 53.798 Tj +-426 TJm +(>) 5.97756 Tj +-426 TJm +(4) 5.97756 Tj +90 639.9 Td +(BZ_MEM_ERROR) 71.7307 Tj +98.4879 627.945 Td +(if) 11.9551 Tj +-426 TJm +(insufficient) 71.7307 Tj +-426 TJm +(memory) 35.8654 Tj +-426 TJm +(is) 11.9551 Tj +-426 TJm +(available) 53.798 Tj +90 615.99 Td +(BZ_OUTBUFF_FULL) 89.6634 Tj +98.4879 604.035 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(size) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(exceeds) 41.8429 Tj +341.655 602.291 Td +(*) 5.97756 Tj +347.633 604.035 Td +(destLen) 41.8429 Tj +90 592.08 Td +(BZ_DATA_ERROR) 77.7083 Tj +98.4879 580.125 Td +(if) 11.9551 Tj +-426 TJm +(a) 5.97756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(integrity) 53.798 Tj +-426 TJm +(error) 29.8878 Tj +-426 TJm +(was) 17.9327 Tj +-426 TJm +(detected) 47.8205 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(data) 23.9102 Tj +90 568.169 Td +(BZ_DATA_ERROR_MAGIC) 113.574 Tj +98.4879 556.214 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(doesn't) 41.8429 Tj +-426 TJm +(begin) 29.8878 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(right) 29.8878 Tj +-426 TJm +(magic) 29.8878 Tj +-426 TJm +(bytes) 29.8878 Tj +90 544.259 Td +(BZ_UNEXPECTED_EOF) 101.619 Tj +98.4879 532.304 Td +(if) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compressed) 59.7756 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(ends) 23.9102 Tj +-426 TJm +(unexpectedly) 71.7307 Tj +90 520.349 Td +(BZ_OK) 29.8878 Tj +98.4879 508.394 Td +(otherwise) 53.798 Tj +[1 0 0 1 72 492.852] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -482.889] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 458.099 Td +/F122_0 20.6585 Tf +(3.6.) 34.4584 Tj +[1 0 0 1 112.201 458.099] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -112.201 -458.099] cm +[1 0 0 1 0 0] Tm +0 0 Td +112.201 458.099 Td +/F392_0 20.6585 Tf +(zlib) 49.5804 Tj +[1 0 0 1 161.781 458.099] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -161.781 -458.099] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.524 458.099 Td +/F122_0 20.6585 Tf +(compatibility) 127.422 Tj +-278 TJm +(functions) 92.9633 Tj +[1 0 0 1 72 453.823] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -443.86] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 436.181 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(oshioka) 30.9936 Tj +-604 TJm +(Tsuneo) 29.3299 Tj +-604 TJm +(has) 13.2801 Tj +-604 TJm +(contrib) 28.224 Tj +20 TJm +(uted) 17.1556 Tj +-604 TJm +(some) 21.031 Tj +-604 TJm +(functions) 37.0808 Tj +-604 TJm +(to) 7.7509 Tj +-604 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-604 TJm +(better) 22.6848 Tj +[1 0 0 1 356.347 436.181] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -356.347 -436.181] cm +[1 0 0 1 0 0] Tm +0 0 Td +356.347 436.181 Td +/F134_0 9.9626 Tf +(zlib) 23.9102 Tj +[1 0 0 1 380.257 436.181] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -380.257 -436.181] cm +[1 0 0 1 0 0] Tm +0 0 Td +386.275 436.181 Td +/F130_0 9.9626 Tf +(compatibility) 53.1405 Tj +65 TJm +(.) 2.49065 Tj +-1372 TJm +(These) 23.7907 Tj +-604 TJm +(functions) 37.0808 Tj +-604 TJm +(are) 12.1643 Tj +[1 0 0 1 72 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzopen) 59.7756 Tj +[1 0 0 1 131.776 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.776 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +131.776 424.226 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 144.283 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -144.283 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +144.283 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzread) 59.7756 Tj +[1 0 0 1 204.059 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.059 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.059 424.226 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 216.566 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -216.566 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +216.566 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzwrite) 65.7532 Tj +[1 0 0 1 282.32 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -282.32 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +282.32 424.226 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 294.827 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -294.827 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.827 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzflush) 65.7532 Tj +[1 0 0 1 360.581 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.581 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +360.581 424.226 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 373.088 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -373.088 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +373.088 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzclose) 65.7532 Tj +[1 0 0 1 438.842 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -438.842 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +438.842 424.226 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 451.349 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -451.349 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +451.349 424.226 Td +/F134_0 9.9626 Tf +(BZ2_bzerror) 65.7532 Tj +[1 0 0 1 517.102 424.226] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -517.102 -424.226] cm +[1 0 0 1 0 0] Tm +0 0 Td +525.614 424.226 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 72 412.271] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -412.271] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 412.271 Td +/F134_0 9.9626 Tf +(BZ2_bzlibVersion) 95.641 Tj +[1 0 0 1 167.641 412.271] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.641 -412.271] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.641 412.271 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1420 TJm +(Thes) 19.3673 Tj +1 TJm +(e) 4.42339 Tj +-384 TJm +(functions) 37.0808 Tj +-383 TJm +(are) 12.1643 Tj +-383 TJm +(not) 12.7322 Tj +-383 TJm +(\(yet\)) 18.8094 Tj +-384 TJm +(of) 8.29885 Tj +25 TJm +(\002cially) 27.6761 Tj +-383 TJm +(part) 15.4918 Tj +-383 TJm +(of) 8.29885 Tj +-383 TJm +(the) 12.1743 Tj +-384 TJm +(library) 26.5603 Tj +65 TJm +(.) 2.49065 Tj +-1419 TJm +(If) 6.63509 Tj +-383 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-384 TJm +(break,) 24.6176 Tj +-416 TJm +(you) 14.9439 Tj +-383 TJm +(get) 12.1743 Tj +-384 TJm +(to) 7.7509 Tj +72 400.316 Td +(k) 4.9813 Tj +10 TJm +(eep) 13.8281 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(pieces.) 27.3872 Tj +-620 TJm +(Ne) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ertheless,) 37.3498 Tj +-250 TJm +(I) 3.31755 Tj +-250 TJm +(think) 20.4831 Tj +-250 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-250 TJm +(ok.) 12.4533 Tj +[1 0 0 1 72 398.159] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -48.8169] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 47.8207 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 44.2341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -388.794] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 388.794 Td +/F134_0 9.9626 Tf +(typedef) 41.8429 Tj +-426 TJm +(void) 23.9102 Tj +-426 TJm +(BZFILE;) 41.8429 Tj +90 364.884 Td +(const) 29.8878 Tj +-426 TJm +(char) 23.9102 Tj +152.286 363.14 Td +(*) 5.97756 Tj +162.508 364.884 Td +(BZ2_bzlibVersion) 95.641 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(void) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 349.342] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -339.379] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 327.424 Td +/F130_0 9.9626 Tf +(Returns) 30.9936 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(string) 22.6948 Tj +-250 TJm +(indicating) 39.8504 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ersion.) 26.8392 Tj +[1 0 0 1 72 325.267] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -315.902] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 315.902 Td +/F134_0 9.9626 Tf +(BZFILE) 35.8654 Tj +130.109 314.159 Td +(*) 5.97756 Tj +140.331 315.902 Td +(BZ2_bzopen) 59.7756 Tj +-852 TJm +(\() 5.97756 Tj +-426 TJm +(const) 29.8878 Tj +-426 TJm +(char) 23.9102 Tj +281.103 314.159 Td +(*) 5.97756 Tj +287.08 315.902 Td +(path,) 29.8878 Tj +-426 TJm +(const) 29.8878 Tj +-426 TJm +(char) 23.9102 Tj +383.498 314.159 Td +(*) 5.97756 Tj +389.476 315.902 Td +(mode) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +90 303.947 Td +(BZFILE) 35.8654 Tj +130.109 302.204 Td +(*) 5.97756 Tj +140.331 303.947 Td +(BZ2_bzdopen) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(int) 17.9327 Tj +-3408 TJm +(fd,) 17.9327 Tj +-1704 TJm +(const) 29.8878 Tj +-426 TJm +(char) 23.9102 Tj +369.629 302.204 Td +(*) 5.97756 Tj +375.607 303.947 Td +(mode) 23.9102 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 288.405] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -278.443] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 266.488 Td +/F130_0 9.9626 Tf +(Opens) 25.4544 Tj +-243 TJm +(a) 4.42339 Tj +[1 0 0 1 106.713 266.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -106.713 -266.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +106.713 266.488 Td +/F134_0 9.9626 Tf +(.bz2) 23.9102 Tj +[1 0 0 1 130.624 266.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -130.624 -266.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +133.041 266.488 Td +/F130_0 9.9626 Tf +(\002le) 12.7322 Tj +-243 TJm +(for) 11.6164 Tj +-242 TJm +(reading) 29.8778 Tj +-243 TJm +(or) 8.29885 Tj +-243 TJm +(writing,) 31.2726 Tj +-244 TJm +(using) 21.589 Tj +-243 TJm +(ei) 7.193 Tj +1 TJm +(ther) 15.4918 Tj +-243 TJm +(its) 9.41466 Tj +-243 TJm +(name) 21.579 Tj +-242 TJm +(o) 4.9813 Tj +-1 TJm +(r) 3.31755 Tj +-242 TJm +(a) 4.42339 Tj +-243 TJm +(pre-e) 20.4632 Tj +15 TJm +(xisting) 27.1282 Tj +-243 TJm +(\002le) 12.7322 Tj +-242 TJm +(descriptor) 39.8404 Tj +55 TJm +(.) 2.49065 Tj +-615 TJm +(Analogous) 43.1679 Tj +-243 TJm +(to) 7.7509 Tj +[1 0 0 1 510.112 266.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -510.112 -266.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +510.112 266.488 Td +/F134_0 9.9626 Tf +(fopen) 29.8878 Tj +[1 0 0 1 540 266.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -266.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 254.532 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 88.8767 254.532] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -88.8767 -254.532] cm +[1 0 0 1 0 0] Tm +0 0 Td +88.8767 254.532 Td +/F134_0 9.9626 Tf +(fdopen) 35.8654 Tj +[1 0 0 1 124.742 254.532] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -124.742 -254.532] cm +[1 0 0 1 0 0] Tm +0 0 Td +124.742 254.532 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 252.998] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -243.633] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 243.633 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-426 TJm +(BZ2_bzread) 59.7756 Tj +-852 TJm +(\() 5.97756 Tj +-426 TJm +(BZFILE) 35.8654 Tj +226.528 241.89 Td +(*) 5.97756 Tj +236.749 243.633 Td +(b,) 11.9551 Tj +-426 TJm +(void) 23.9102 Tj +276.859 241.89 Td +(*) 5.97756 Tj +287.08 243.633 Td +(buf,) 23.9102 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +90 231.678 Td +(int) 17.9327 Tj +-426 TJm +(BZ2_bzwrite) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(BZFILE) 35.8654 Tj +228.261 229.935 Td +(*) 5.97756 Tj +238.483 231.678 Td +(b,) 11.9551 Tj +-426 TJm +(void) 23.9102 Tj +278.592 229.935 Td +(*) 5.97756 Tj +288.814 231.678 Td +(buf,) 23.9102 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(len) 17.9327 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 216.136] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -206.174] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 194.219 Td +/F130_0 9.9626 Tf +(Reads/writes) 51.4668 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(from/to) 29.8878 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(pre) 12.7222 Tj +25 TJm +(viously) 29.3399 Tj +-250 TJm +(opened) 28.772 Tj +[1 0 0 1 259.903 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -259.903 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +259.903 194.219 Td +/F134_0 9.9626 Tf +(BZFILE) 35.8654 Tj +[1 0 0 1 295.769 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -295.769 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +295.769 194.219 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-500 TJm +(Analogous) 43.1679 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 359.141 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -359.141 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +359.141 194.219 Td +/F134_0 9.9626 Tf +(fread) 29.8878 Tj +[1 0 0 1 389.029 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -389.029 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +391.519 194.219 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 408.396 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -408.396 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +408.396 194.219 Td +/F134_0 9.9626 Tf +(fwrite) 35.8654 Tj +[1 0 0 1 444.261 194.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.261 -194.219] cm +[1 0 0 1 0 0] Tm +0 0 Td +444.261 194.219 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 192.062] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -182.697] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 182.697 Td +/F134_0 9.9626 Tf +(int) 17.9327 Tj +-852 TJm +(BZ2_bzflush) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(BZFILE) 35.8654 Tj +232.505 180.954 Td +(*) 5.97756 Tj +242.727 182.697 Td +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +90 170.742 Td +(void) 23.9102 Tj +-426 TJm +(BZ2_bzclose) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(BZFILE) 35.8654 Tj +234.239 168.998 Td +(*) 5.97756 Tj +244.46 170.742 Td +(b) 5.97756 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 155.2] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -145.237] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 133.282 Td +/F130_0 9.9626 Tf +(Flushes/closes) 57.5639 Tj +-250 TJm +(a) 4.42339 Tj +[1 0 0 1 138.968 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -138.968 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +138.968 133.282 Td +/F134_0 9.9626 Tf +(BZFILE) 35.8654 Tj +[1 0 0 1 174.833 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -174.833 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +174.833 133.282 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 179.815 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -179.815 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.815 133.282 Td +/F134_0 9.9626 Tf +(BZ2_bzflush) 65.7532 Tj +[1 0 0 1 245.568 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -245.568 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +248.059 133.282 Td +/F130_0 9.9626 Tf +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(actually) 31.5416 Tj +-250 TJm +(do) 9.9626 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(ything.) 27.9551 Tj +-620 TJm +(Analogous) 43.1679 Tj +-250 TJm +(to) 7.7509 Tj +[1 0 0 1 425.472 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -425.472 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +425.472 133.282 Td +/F134_0 9.9626 Tf +(fflush) 35.8654 Tj +[1 0 0 1 461.338 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -461.338 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +463.828 133.282 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 480.705 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -480.705 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +480.705 133.282 Td +/F134_0 9.9626 Tf +(fclose) 35.8654 Tj +[1 0 0 1 516.57 133.282] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -516.57 -133.282] cm +[1 0 0 1 0 0] Tm +0 0 Td +516.57 133.282 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 131.125] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -121.761] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 121.761 Td +/F134_0 9.9626 Tf +(const) 29.8878 Tj +-426 TJm +(char) 23.9102 Tj +152.286 120.017 Td +(*) 5.97756 Tj +162.508 121.761 Td +(BZ2_bzerror) 65.7532 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(BZFILE) 35.8654 Tj +282.836 120.017 Td +(*) 5.97756 Tj +288.814 121.761 Td +(b,) 11.9551 Tj +-426 TJm +(int) 17.9327 Tj +327.19 120.017 Td +(*) 5.97756 Tj +333.167 121.761 Td +(errnum) 35.8654 Tj +-426 TJm +(\)) 5.97756 Tj +[1 0 0 1 72 106.219] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -96.2563] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 84.3011 Td +/F130_0 9.9626 Tf +(Returns) 30.9936 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(string) 22.6948 Tj +-250 TJm +(describing) 41.5042 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(more) 20.4731 Tj +-250 TJm +(recent) 24.3386 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(status) 22.6948 Tj +-250 TJm +(of) 8.29885 Tj +[1 0 0 1 303.858 84.3011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -303.858 -84.3011] cm +[1 0 0 1 0 0] Tm +0 0 Td +303.858 84.3011 Td +/F134_0 9.9626 Tf +(b) 5.97756 Tj +[1 0 0 1 309.835 84.3011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -309.835 -84.3011] cm +[1 0 0 1 0 0] Tm +0 0 Td +309.835 84.3011 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(also) 16.0497 Tj +-250 TJm +(sets) 14.9439 Tj +[1 0 0 1 367.668 84.3011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -367.668 -84.3011] cm +[1 0 0 1 0 0] Tm +0 0 Td +367.668 82.5576 Td +/F134_0 9.9626 Tf +(*) 5.97756 Tj +373.645 84.3011 Td +(errnum) 35.8654 Tj +[1 0 0 1 409.511 84.3011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -409.511 -84.3011] cm +[1 0 0 1 0 0] Tm +0 0 Td +412.001 84.3011 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(its) 9.41466 Tj +-250 TJm +(numerical) 39.8404 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alue.) 19.0883 Tj +[1 0 0 1 72 82.1443] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.3298] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 4.3836 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -495.734 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +536.307 50.9514 Td +/F130_0 9.9626 Tf +(28) 9.9626 Tj +[1 0 0 1 455.161 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -15.0365 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 32 32 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 704.93 Td +/F122_0 20.6585 Tf +(3.7.) 34.4584 Tj +-278 TJm +(Using) 57.3893 Tj +-278 TJm +(the) 30.9877 Tj +-278 TJm +(librar) 51.6669 Tj +-10 TJm +(y) 11.4861 Tj +-278 TJm +(in) 18.3654 Tj +-278 TJm +(a) 11.4861 Tj +[1 0 0 1 322.501 704.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -322.501 -704.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +322.501 704.93 Td +/F392_0 20.6585 Tf +(stdio) 61.9755 Tj +[1 0 0 1 384.477 704.93] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -384.477 -704.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +384.477 704.93 Td +/F122_0 20.6585 Tf +(-free) 44.767 Tj +72 680.139 Td +(en) 24.1085 Tj +40 TJm +(vir) 25.2653 Tj +20 TJm +(onment) 74.5978 Tj +[1 0 0 1 72 679.881] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -669.983] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 649.583 Td +/F122_0 17.2154 Tf +(3.7.1.) 43.0729 Tj +-278 TJm +(Getting) 60.2539 Tj +-278 TJm +(rid) 22.0013 Tj +-278 TJm +(of) 16.2513 Tj +[1 0 0 1 232.721 649.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -232.721 -649.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +232.721 649.583 Td +/F392_0 17.2154 Tf +(stdio) 51.6462 Tj +[1 0 0 1 284.367 649.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -212.367 -3.8303] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -635.855] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 627.73 Td +/F130_0 9.9626 Tf +(In) 8.29885 Tj +-319 TJm +(a) 4.42339 Tj +-319 TJm +(deeply) 26.5603 Tj +-319 TJm +(embedded) 40.9463 Tj +-319 TJm +(application,) 46.7644 Tj +-336 TJm +(you) 14.9439 Tj +-319 TJm +(might) 23.2527 Tj +-319 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-319 TJm +(to) 7.7509 Tj +-319 TJm +(use) 13.2801 Tj +-319 TJm +(just) 14.396 Tj +-319 TJm +(the) 12.1743 Tj +-319 TJm +(memory-to-memory) 80.7967 Tj +-319 TJm +(functions.) 39.5714 Tj +-1035 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-319 TJm +(can) 13.8281 Tj +-319 TJm +(do) 9.9626 Tj +-319 TJm +(this) 14.396 Tj +72 615.775 Td +(con) 14.386 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(eniently) 32.0995 Tj +-327 TJm +(by) 9.9626 Tj +-327 TJm +(compiling) 40.4083 Tj +-327 TJm +(the) 12.1743 Tj +-327 TJm +(library) 26.5603 Tj +-327 TJm +(with) 17.7135 Tj +-328 TJm +(preproces) 38.7246 Tj +1 TJm +(sor) 12.1743 Tj +-328 TJm +(symbol) 29.3399 Tj +[1 0 0 1 336.046 615.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -336.046 -615.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +336.046 615.775 Td +/F134_0 9.9626 Tf +(BZ_NO_STDIO) 65.7532 Tj +[1 0 0 1 401.799 615.775] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -401.799 -615.775] cm +[1 0 0 1 0 0] Tm +0 0 Td +405.057 615.775 Td +/F130_0 9.9626 Tf +(de\002ned.) 31.8205 Tj +-1083 TJm +(Doing) 24.9065 Tj +-327 TJm +(this) 14.396 Tj +-327 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-327 TJm +(you) 14.9439 Tj +-327 TJm +(a) 4.42339 Tj +72 603.819 Td +(library) 26.5603 Tj +-250 TJm +(containing) 42.0621 Tj +-250 TJm +(only) 17.7135 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-250 TJm +(eight) 19.9252 Tj +-250 TJm +(functions:) 39.8504 Tj +[1 0 0 1 72 601.662] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -591.764] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 581.966 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressInit) 107.596 Tj +[1 0 0 1 179.596 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -179.596 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +179.596 581.966 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 199.079 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -199.079 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +199.079 581.966 Td +/F134_0 9.9626 Tf +(BZ2_bzCompress) 83.6858 Tj +[1 0 0 1 282.765 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -282.765 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +282.765 581.966 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 302.247 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -302.247 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +302.247 581.966 Td +/F134_0 9.9626 Tf +(BZ2_bzCompressEnd) 101.619 Tj +[1 0 0 1 403.866 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 14.0915 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -417.958 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +417.958 581.966 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressInit) 119.551 Tj +[1 0 0 1 537.509 581.966] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -581.966] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 581.966 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 72 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 570.011 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompress) 95.641 Tj +[1 0 0 1 167.641 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.641 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +167.641 570.011 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 172.144 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -172.144 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.144 570.011 Td +/F134_0 9.9626 Tf +(BZ2_bzDecompressEnd) 113.574 Tj +[1 0 0 1 285.719 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -287.611 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +287.611 570.011 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffCompress) 143.461 Tj +[1 0 0 1 431.073 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -431.073 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +431.073 570.011 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 435.577 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -435.577 -570.011] cm +[1 0 0 1 0 0] Tm +0 0 Td +435.577 570.011 Td +/F134_0 9.9626 Tf +(BZ2_bzBuffToBuffDecompress) 155.417 Tj +[1 0 0 1 590.994 570.011] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -518.994 -1.5341] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8981] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -558.579] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 548.158 Td +/F130_0 9.9626 Tf +(When) 23.7907 Tj +-250 TJm +(compiled) 37.0808 Tj +-250 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-250 TJm +(this,) 16.8866 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(functions) 37.0808 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(ignore) 25.4544 Tj +[1 0 0 1 272.526 548.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.526 -548.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +272.526 548.158 Td +/F134_0 9.9626 Tf +(verbosity) 53.798 Tj +[1 0 0 1 326.324 548.158] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -326.324 -548.158] cm +[1 0 0 1 0 0] Tm +0 0 Td +328.815 548.158 Td +/F130_0 9.9626 Tf +(settings.) 32.9364 Tj +[1 0 0 1 72 546.001] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -536.103] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 517.601 Td +/F122_0 17.2154 Tf +(3.7.2.) 43.0729 Tj +-278 TJm +(Critical) 58.3602 Tj +-278 TJm +(err) 22.9653 Tj +20 TJm +(or) 17.2154 Tj +-278 TJm +(handling) 71.7366 Tj +[1 0 0 1 72 513.771] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -503.873] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 495.748 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 119.821 495.748] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.821 -495.748] cm +[1 0 0 1 0 0] Tm +0 0 Td +124.529 495.748 Td +/F130_0 9.9626 Tf +(contains) 33.2053 Tj +-473 TJm +(a) 4.42339 Tj +-472 TJm +(number) 30.4357 Tj +-473 TJm +(of) 8.29885 Tj +-472 TJm +(internal) 30.4357 Tj +-473 TJm +(assertion) 35.417 Tj +-472 TJm +(checks) 27.1082 Tj +-473 TJm +(which) 24.3486 Tj +-472 TJm +(should,) 29.0609 Tj +-529 TJm +(needless) 33.7533 Tj +-472 TJm +(to) 7.7509 Tj +-473 TJm +(say) 13.2801 Tj +65 TJm +(,) 2.49065 Tj +-528 TJm +(ne) 9.40469 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-473 TJm +(be) 9.40469 Tj +-472 TJm +(acti) 14.386 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ated.) 19.0883 Tj +72 483.793 Td +(Ne) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ertheless,) 37.3498 Tj +-533 TJm +(if) 6.08715 Tj +-476 TJm +(an) 9.40469 Tj +-476 TJm +(assertion) 35.417 Tj +-476 TJm +(should) 26.5703 Tj +-476 TJm +(f) 3.31755 Tj +10 TJm +(ail,) 12.4533 Tj +-532 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +-476 TJm +(depends) 32.6474 Tj +-476 TJm +(on) 9.9626 Tj +-476 TJm +(whether) 32.0895 Tj +-476 TJm +(or) 8.29885 Tj +-477 TJm +(not) 12.7322 Tj +-476 TJm +(the) 12.1743 Tj +-476 TJm +(library) 26.5603 Tj +-476 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-476 TJm +(compiled) 37.0808 Tj +-476 TJm +(with) 17.7135 Tj +[1 0 0 1 72 471.838] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -471.838] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 471.838 Td +/F134_0 9.9626 Tf +(BZ_NO_STDIO) 65.7532 Tj +[1 0 0 1 137.753 471.838] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.753 -471.838] cm +[1 0 0 1 0 0] Tm +0 0 Td +140.244 471.838 Td +/F130_0 9.9626 Tf +(set.) 13.5591 Tj +[1 0 0 1 72 470.528] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -460.63] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 449.985 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(normal) 28.224 Tj +-250 TJm +(compile,) 34.5901 Tj +-250 TJm +(an) 9.40469 Tj +-250 TJm +(assertion) 35.417 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(ailure) 22.6848 Tj +-250 TJm +(yields) 23.8007 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(message:) 36.5229 Tj +[1 0 0 1 72 447.828] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -437.93] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 428.131 Td +/F130_0 9.9626 Tf +(bzip2/libbzip2:) 60.3335 Tj +-310 TJm +(internal) 30.4357 Tj +-250 TJm +(error) 19.3573 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(N.) 9.68365 Tj +[1 0 0 1 72 425.975] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -416.077] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 406.278 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-332 TJm +(is) 6.64505 Tj +-331 TJm +(a) 4.42339 Tj +-332 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-332 TJm +(in) 7.7509 Tj +-331 TJm +(bzip2/libbzip2,) 60.0546 Tj +-352 TJm +(1.0.5) 19.9252 Tj +-332 TJm +(of) 8.29885 Tj +-332 TJm +(10) 9.9626 Tj +-332 TJm +(December) 40.9363 Tj +-331 TJm +(2007.) 22.4159 Tj +-555 TJm +(Please) 25.4544 Tj +-332 TJm +(report) 23.7907 Tj +-332 TJm +(it) 5.53921 Tj +-331 TJm +(to) 7.7509 Tj +-332 TJm +(me) 12.1743 Tj +-332 TJm +(at:) 9.9626 Tj +-473 TJm +(jse) 11.0684 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(ard at bzip.or) 49.8429 Tj +18 TJm +(g.) 7.47195 Tj +-1110 TJm +(If) 6.63509 Tj +-332 TJm +(this) 14.396 Tj +72 394.323 Td +(happened) 38.1767 Tj +-297 TJm +(when) 21.579 Tj +-298 TJm +(you) 14.9439 Tj +-297 TJm +(were) 19.3573 Tj +-297 TJm +(using) 21.589 Tj +-297 TJm +(some) 21.031 Tj +-298 TJm +(program) 33.7533 Tj +-297 TJm +(which) 24.3486 Tj +-297 TJm +(uses) 17.1556 Tj +-297 TJm +(libbzip2) 32.6574 Tj +-298 TJm +(as) 8.29885 Tj +-297 TJm +(a) 4.42339 Tj +-297 TJm +(component,) 46.7644 Tj +-309 TJm +(you) 14.9439 Tj +-298 TJm +(should) 26.5703 Tj +-297 TJm +(also) 16.0497 Tj +-297 TJm +(report) 23.7907 Tj +-297 TJm +(this) 14.396 Tj +-298 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +72 382.368 Td +(to) 7.7509 Tj +-264 TJm +(the) 12.1743 Tj +-264 TJm +(author\(s\)) 35.965 Tj +-264 TJm +(of) 8.29885 Tj +-264 TJm +(that) 14.9439 Tj +-264 TJm +(program.) 36.2439 Tj +-703 TJm +(Please) 25.4544 Tj +-264 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-264 TJm +(an) 9.40469 Tj +-264 TJm +(ef) 7.74094 Tj +25 TJm +(fort) 14.386 Tj +-264 TJm +(to) 7.7509 Tj +-264 TJm +(report) 23.7907 Tj +-263 TJm +(this) 14.396 Tj +-264 TJm +(b) 4.9813 Tj +20 TJm +(ug;) 12.7322 Tj +-271 TJm +(timely) 25.4644 Tj +-264 TJm +(and) 14.386 Tj +-264 TJm +(accurate) 33.1854 Tj +-264 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-264 TJm +(reports) 27.6661 Tj +-264 TJm +(e) 4.42339 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(entually) 32.0995 Tj +72 370.413 Td +(lead) 16.5977 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(higher) 25.4544 Tj +-250 TJm +(quality) 27.6761 Tj +-250 TJm +(softw) 22.1369 Tj +10 TJm +(are.) 14.655 Tj +-620 TJm +(Thanks.) 31.8205 Tj +-620 TJm +(Julian) 23.8007 Tj +-250 TJm +(Se) 9.9626 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(ard,) 15.2129 Tj +-250 TJm +(10) 9.9626 Tj +-250 TJm +(December) 40.9363 Tj +-250 TJm +(2007.) 22.4159 Tj +[1 0 0 1 72 368.256] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.801] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -348.557] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 338.758 Td +/F130_0 9.9626 Tf +(where) 24.3386 Tj +[1 0 0 1 98.8312 338.758] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -98.8312 -338.758] cm +[1 0 0 1 0 0] Tm +0 0 Td +98.8312 338.758 Td +/F134_0 9.9626 Tf +(N) 5.97756 Tj +[1 0 0 1 104.809 338.758] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -104.809 -338.758] cm +[1 0 0 1 0 0] Tm +0 0 Td +107.302 338.758 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(error) 19.3573 Tj +-251 TJm +(code) 18.8094 Tj +-250 TJm +(number) 30.4357 Tj +55 TJm +(.) 2.49065 Tj +-621 TJm +(If) 6.63509 Tj +[1 0 0 1 230.81 338.758] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -230.81 -338.758] cm +[1 0 0 1 0 0] Tm +0 0 Td +230.81 338.758 Td +/F134_0 9.9626 Tf +(N) 5.97756 Tj +-600 TJm +(==) 11.9551 Tj +-600 TJm +(1007) 23.9102 Tj +[1 0 0 1 284.608 338.758] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -284.608 -338.758] cm +[1 0 0 1 0 0] Tm +0 0 Td +284.608 338.758 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(also) 16.0497 Tj +-251 TJm +(prints) 22.6948 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xtra) 15.4918 Tj +-250 TJm +(te) 7.193 Tj +15 TJm +(xt) 7.7509 Tj +-250 TJm +(advising) 33.7633 Tj +-251 TJm +(the) 12.1743 Tj +-250 TJm +(reader) 24.8866 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(unreliable) 39.8404 Tj +72 326.803 Td +(memory) 33.2053 Tj +-425 TJm +(is) 6.64505 Tj +-424 TJm +(often) 20.4731 Tj +-425 TJm +(associated) 40.9463 Tj +-425 TJm +(with) 17.7135 Tj +-424 TJm +(internal) 30.4357 Tj +-425 TJm +(error) 19.3573 Tj +-424 TJm +(1007.) 22.4159 Tj +-834 TJm +(\(This) 21.031 Tj +-425 TJm +(is) 6.64505 Tj +-425 TJm +(a) 4.42339 Tj +-424 TJm +(frequently-observ) 70.8241 Tj +15 TJm +(ed-phenomenon) 64.189 Tj +-425 TJm +(with) 17.7135 Tj +-425 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +72 314.848 Td +(1.0.0/1.0.1\).) 48.4282 Tj +[1 0 0 1 72 313.065] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -303.167] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 292.995 Td +/F134_0 9.9626 Tf +(exit\(3\)) 41.8429 Tj +[1 0 0 1 113.843 292.995] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -292.995] cm +[1 0 0 1 0 0] Tm +0 0 Td +116.334 292.995 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(then) 17.1556 Tj +-250 TJm +(called.) 26.2813 Tj +[1 0 0 1 72 291.899] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.8981] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -282.001] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 271.142 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +[1 0 0 1 95.0933 271.142] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -95.0933 -271.142] cm +[1 0 0 1 0 0] Tm +0 0 Td +95.0933 271.142 Td +/F134_0 9.9626 Tf +(stdio) 29.8878 Tj +[1 0 0 1 124.981 271.142] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -124.981 -271.142] cm +[1 0 0 1 0 0] Tm +0 0 Td +124.981 271.142 Td +/F130_0 9.9626 Tf +(-free) 18.7994 Tj +-250 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(assertion) 35.417 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(ailures) 26.5603 Tj +-250 TJm +(result) 22.1369 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(call) 14.386 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(function) 33.2053 Tj +-250 TJm +(declared) 33.7433 Tj +-250 TJm +(as:) 11.0684 Tj +[1 0 0 1 72 268.985] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -259.62] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 259.62 Td +/F134_0 9.9626 Tf +(extern) 35.8654 Tj +-426 TJm +(void) 23.9102 Tj +-426 TJm +(bz_internal_error) 101.619 Tj +-426 TJm +(\() 5.97756 Tj +-426 TJm +(int) 17.9327 Tj +-426 TJm +(errcode) 41.8429 Tj +-426 TJm +(\);) 11.9551 Tj +[1 0 0 1 72 244.078] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.4846] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -234.18] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 222.225 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(rele) 14.9339 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant) 12.1743 Tj +-250 TJm +(code) 18.8094 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(passed) 26.5603 Tj +-250 TJm +(as) 8.29885 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(parameter) 39.8305 Tj +55 TJm +(.) 2.49065 Tj +-620 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(supply) 26.5703 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(function.) 35.696 Tj +[1 0 0 1 72 220.068] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -210.17] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 200.372 Td +/F130_0 9.9626 Tf +(In) 8.29885 Tj +-294 TJm +(either) 22.6848 Tj +-294 TJm +(case,) 19.6363 Tj +-306 TJm +(once) 18.8094 Tj +-294 TJm +(an) 9.40469 Tj +-294 TJm +(assertion) 35.417 Tj +-294 TJm +(f) 3.31755 Tj +10 TJm +(ailure) 22.6848 Tj +-294 TJm +(has) 13.2801 Tj +-295 TJm +(occurred,) 37.3398 Tj +-305 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +[1 0 0 1 306.541 200.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -306.541 -200.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +306.541 200.372 Td +/F134_0 9.9626 Tf +(bz_stream) 53.798 Tj +[1 0 0 1 360.339 200.372] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -360.339 -200.372] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.271 200.372 Td +/F130_0 9.9626 Tf +(records) 29.3199 Tj +-294 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +20 TJm +(olv) 12.7322 Tj +15 TJm +(ed) 9.40469 Tj +-294 TJm +(can) 13.8281 Tj +-295 TJm +(be) 9.40469 Tj +-294 TJm +(re) 7.74094 Tj +15 TJm +(g) 4.9813 Tj +5 TJm +(arded) 22.1269 Tj +-294 TJm +(as) 8.29885 Tj +-294 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +25 TJm +(alid.) 17.4346 Tj +72 188.417 Td +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(attempt) 29.8878 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(resume) 28.772 Tj +-250 TJm +(normal) 28.224 Tj +-250 TJm +(operation) 37.6287 Tj +-250 TJm +(with) 17.7135 Tj +-250 TJm +(them.) 22.4159 Tj +[1 0 0 1 72 186.26] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -176.362] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 166.564 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-299 TJm +(may) 17.1556 Tj +65 TJm +(,) 2.49065 Tj +-310 TJm +(of) 8.29885 Tj +-299 TJm +(course,) 28.493 Tj +-311 TJm +(change) 28.2141 Tj +-298 TJm +(critical) 27.6661 Tj +-299 TJm +(error) 19.3573 Tj +-298 TJm +(handling) 34.8691 Tj +-299 TJm +(to) 7.7509 Tj +-298 TJm +(suit) 14.396 Tj +-299 TJm +(your) 18.2614 Tj +-298 TJm +(needs.) 25.1755 Tj +-912 TJm +(As) 11.0684 Tj +-298 TJm +(I) 3.31755 Tj +-299 TJm +(said) 16.0497 Tj +-298 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +-311 TJm +(critical) 27.6661 Tj +-299 TJm +(errors) 23.2328 Tj +-298 TJm +(indicate) 31.5416 Tj +-299 TJm +(b) 4.9813 Tj +20 TJm +(ugs) 13.8381 Tj +72 154.608 Td +(in) 7.7509 Tj +-263 TJm +(the) 12.1743 Tj +-263 TJm +(library) 26.5603 Tj +-263 TJm +(and) 14.386 Tj +-263 TJm +(should) 26.5703 Tj +-263 TJm +(not) 12.7322 Tj +-263 TJm +(occur) 22.1269 Tj +55 TJm +(.) 2.49065 Tj +-697 TJm +(All) 12.7322 Tj +-263 TJm +("normal") 36.3535 Tj +-263 TJm +(error) 19.3573 Tj +-263 TJm +(situations) 38.1966 Tj +-263 TJm +(are) 12.1643 Tj +-263 TJm +(indicated) 36.5229 Tj +-263 TJm +(via) 12.1743 Tj +-263 TJm +(error) 19.3573 Tj +-263 TJm +(return) 23.7907 Tj +-263 TJm +(codes) 22.6848 Tj +-263 TJm +(from) 19.3673 Tj +-263 TJm +(functions,) 39.5714 Tj +72 142.653 Td +(and) 14.386 Tj +-250 TJm +(can) 13.8281 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(reco) 17.1456 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ered) 17.1456 Tj +-250 TJm +(from.) 21.8579 Tj +[1 0 0 1 72 142.554] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -132.656] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 107.965 Td +/F122_0 20.6585 Tf +(3.8.) 34.4584 Tj +-278 TJm +(Making) 71.1685 Tj +-278 TJm +(a) 11.4861 Tj +-278 TJm +(Windo) 63.1117 Tj +15 TJm +(ws) 27.5584 Tj +-278 TJm +(DLL) 40.1601 Tj +[1 0 0 1 72 103.369] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.898] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -93.4708] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 86.112 Td +/F130_0 9.9626 Tf +(Ev) 11.0684 Tj +15 TJm +(erything) 33.2053 Tj +-328 TJm +(related) 27.1082 Tj +-327 TJm +(to) 7.7509 Tj +-328 TJm +(W) 9.40469 Tj +40 TJm +(indo) 17.7135 Tj +25 TJm +(ws) 11.0684 Tj +-328 TJm +(has) 13.2801 Tj +-327 TJm +(been) 18.8094 Tj +-328 TJm +(contrib) 28.224 Tj +20 TJm +(uted) 17.1556 Tj +-328 TJm +(by) 9.9626 Tj +-327 TJm +(Y) 7.193 Tj +110 TJm +(oshioka) 30.9936 Tj +-328 TJm +(Tsuneo) 29.3299 Tj +-328 TJm +(\() 3.31755 Tj +[1 0 0 1 378.139 86.112] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -378.139 -86.112] cm +[1 0 0 1 0 0] Tm +0 0 Td +378.139 86.112 Td +/F134_0 9.9626 Tf +(tsuneo at rr.iij4u.or.jp) 125.529 Tj +[1 0 0 1 503.668 86.112] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -503.668 -86.112] cm +[1 0 0 1 0 0] Tm +0 0 Td +503.668 86.112 Td +/F130_0 9.9626 Tf +(\),) 5.8082 Tj +-347 TJm +(so) 8.85675 Tj +-328 TJm +(you) 14.9439 Tj +72 74.1568 Td +(should) 26.5703 Tj +-250 TJm +(send) 18.2614 Tj +-250 TJm +(your) 18.2614 Tj +-250 TJm +(queries) 28.772 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(him) 15.5018 Tj +-250 TJm +(\(b) 8.29885 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(perhaps) 30.9837 Tj +-250 TJm +(Cc:) 13.8381 Tj +-310 TJm +(me,) 14.6649 Tj +[1 0 0 1 287.958 74.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -287.958 -74.1568] cm +[1 0 0 1 0 0] Tm +0 0 Td +287.958 74.1568 Td +/F134_0 9.9626 Tf +(jseward at bzip.org) 95.641 Tj +[1 0 0 1 383.6 74.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -383.6 -74.1568] cm +[1 0 0 1 0 0] Tm +0 0 Td +383.6 74.1568 Td +/F130_0 9.9626 Tf +(\).) 5.8082 Tj +[1 0 0 1 72 72] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.1482] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.9738] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -51.071] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 51.071 Td +/F130_0 9.9626 Tf +(29) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 33 33 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 8.9114] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 76.4979 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -342.569 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +419.067 749.245 Td +/F130_0 9.9626 Tf +(Programming) 54.7943 Tj +-250 TJm +(with) 17.7135 Tj +[1 0 0 1 496.556 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -496.556 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.556 749.245 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 544.376 749.245] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -278.305 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -5.0363] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(My) 13.8381 Tj +-367 TJm +(v) 4.9813 Tj +25 TJm +(ague) 18.8094 Tj +-367 TJm +(understanding) 56.4481 Tj +-367 TJm +(of) 8.29885 Tj +-367 TJm +(what) 19.3673 Tj +-368 TJm +(to) 7.7509 Tj +-367 TJm +(do) 9.9626 Tj +-367 TJm +(is:) 9.41466 Tj +-544 TJm +(using) 21.589 Tj +-367 TJm +(V) 7.193 Tj +60 TJm +(isual) 18.8194 Tj +-367 TJm +(C++) 17.8829 Tj +-367 TJm +(5.0,) 14.9439 Tj +-397 TJm +(open) 19.3673 Tj +-367 TJm +(the) 12.1743 Tj +-367 TJm +(project) 27.6661 Tj +-367 TJm +(\002le) 12.7322 Tj +[1 0 0 1 432.966 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -432.966 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +432.966 710.037 Td +/F134_0 9.9626 Tf +(libbz2.dsp) 59.7756 Tj +[1 0 0 1 492.742 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -492.742 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +492.742 710.037 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-396 TJm +(and) 14.386 Tj +-368 TJm +(b) 4.9813 Tj +20 TJm +(uild.) 17.9925 Tj +72 698.082 Td +(That') 21.579 Tj +55 TJm +(s) 3.87545 Tj +-250 TJm +(all.) 12.4533 Tj +[1 0 0 1 72 697.983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -688.02] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 676.164 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-284 TJm +(you) 14.9439 Tj +-284 TJm +(can') 17.1456 Tj +18 TJm +(t) 2.7696 Tj +-285 TJm +(open) 19.3673 Tj +-284 TJm +(the) 12.1743 Tj +-284 TJm +(project) 27.6661 Tj +-284 TJm +(\002le) 12.7322 Tj +-284 TJm +(for) 11.6164 Tj +-285 TJm +(some) 21.031 Tj +-284 TJm +(reason,) 28.493 Tj +-293 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-284 TJm +(a) 4.42339 Tj +-284 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-284 TJm +(one,) 16.8766 Tj +-293 TJm +(naming) 29.8878 Tj +-284 TJm +(these) 20.4731 Tj +-284 TJm +(\002les:) 19.3773 Tj +[1 0 0 1 424.505 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -424.505 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +424.505 676.164 Td +/F134_0 9.9626 Tf +(blocksort.c) 65.7532 Tj +[1 0 0 1 490.259 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -490.259 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +490.259 676.164 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 495.666 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -495.666 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +495.666 676.164 Td +/F134_0 9.9626 Tf +(bzlib.c) 41.8429 Tj +[1 0 0 1 537.509 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -537.509 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +537.509 676.164 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 72 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 664.209 Td +/F134_0 9.9626 Tf +(compress.c) 59.7756 Tj +[1 0 0 1 131.776 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -131.776 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +131.776 664.209 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 136.436 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -136.436 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +136.436 664.209 Td +/F134_0 9.9626 Tf +(crctable.c) 59.7756 Tj +[1 0 0 1 196.211 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.211 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +196.211 664.209 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 200.871 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -200.871 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +200.871 664.209 Td +/F134_0 9.9626 Tf +(decompress.c) 71.7307 Tj +[1 0 0 1 272.602 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -272.602 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +272.602 664.209 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 277.262 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -277.262 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +277.262 664.209 Td +/F134_0 9.9626 Tf +(huffman.c) 53.798 Tj +[1 0 0 1 331.06 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -331.06 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +331.06 664.209 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 335.72 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -335.72 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +335.72 664.209 Td +/F134_0 9.9626 Tf +(randtable.c) 65.7532 Tj +[1 0 0 1 401.473 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -401.473 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +403.562 664.209 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 420.037 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -420.037 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +420.037 664.209 Td +/F134_0 9.9626 Tf +(libbz2.def) 59.7756 Tj +[1 0 0 1 479.812 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -479.812 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +479.812 664.209 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-593 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-210 TJm +(will) 15.5018 Tj +-209 TJm +(also) 16.0497 Tj +72 652.254 Td +(need) 18.8094 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(name) 21.579 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(header) 26.5503 Tj +-250 TJm +(\002les) 16.6077 Tj +[1 0 0 1 190.415 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -190.415 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +190.415 652.254 Td +/F134_0 9.9626 Tf +(bzlib.h) 41.8429 Tj +[1 0 0 1 232.258 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -232.258 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.748 652.254 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 251.625 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -251.625 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +251.625 652.254 Td +/F134_0 9.9626 Tf +(bzlib_private.h) 89.6634 Tj +[1 0 0 1 341.289 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -341.289 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +341.289 652.254 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 650.72] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -640.757] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 630.336 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(don') 18.2614 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(VC++,) 27.5665 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(may) 17.1556 Tj +-250 TJm +(need) 18.8094 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(de\002ne) 24.3486 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(proprocessor) 51.4568 Tj +-250 TJm +(symbol) 29.3399 Tj +[1 0 0 1 363.634 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -363.634 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.634 630.336 Td +/F134_0 9.9626 Tf +(_WIN32) 35.8654 Tj +[1 0 0 1 399.5 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -399.5 -630.336] cm +[1 0 0 1 0 0] Tm +0 0 Td +399.5 630.336 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 628.179] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -618.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 608.418 Td +/F130_0 9.9626 Tf +(Finally) 28.234 Tj +65 TJm +(,) 2.49065 Tj +[1 0 0 1 104.568 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -104.568 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.568 608.418 Td +/F134_0 9.9626 Tf +(dlltest.c) 53.798 Tj +[1 0 0 1 158.366 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -158.366 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +160.856 608.418 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(sample) 28.224 Tj +-250 TJm +(program) 33.7533 Tj +-250 TJm +(using) 21.589 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(DLL.) 21.8579 Tj +-500 TJm +(It) 6.08715 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(project) 27.6661 Tj +-250 TJm +(\002le,) 15.2229 Tj +[1 0 0 1 388.58 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -388.58 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +388.58 608.418 Td +/F134_0 9.9626 Tf +(dlltest.dsp) 65.7532 Tj +[1 0 0 1 454.333 608.418] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -454.333 -608.418] cm +[1 0 0 1 0 0] Tm +0 0 Td +454.333 608.418 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 606.262] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -596.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 586.501 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(just) 14.396 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(mak) 17.1556 Tj +10 TJm +(e\002le) 17.1556 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(V) 7.193 Tj +60 TJm +(isual) 18.8194 Tj +-250 TJm +(C,) 9.1357 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(look) 17.7135 Tj +-250 TJm +(at) 7.193 Tj +[1 0 0 1 292.212 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -292.212 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +292.212 586.501 Td +/F134_0 9.9626 Tf +(makefile.msc) 71.7307 Tj +[1 0 0 1 363.943 586.501] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -363.943 -586.501] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.943 586.501 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 584.344] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -574.381] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 564.583 Td +/F130_0 9.9626 Tf +(Be) 11.0684 Tj +-291 TJm +(a) 4.42339 Tj +15 TJm +(w) 7.193 Tj +10 TJm +(are) 12.1643 Tj +-291 TJm +(that) 14.9439 Tj +-291 TJm +(if) 6.08715 Tj +-291 TJm +(you) 14.9439 Tj +-291 TJm +(compile) 32.0995 Tj +[1 0 0 1 192.069 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -192.069 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +192.069 564.583 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 221.958 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -221.958 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +224.857 564.583 Td +/F130_0 9.9626 Tf +(itself) 19.9252 Tj +-291 TJm +(on) 9.9626 Tj +-291 TJm +(W) 9.40469 Tj +40 TJm +(in32,) 20.2042 Tj +-301 TJm +(you) 14.9439 Tj +-291 TJm +(must) 19.3773 Tj +-291 TJm +(set) 11.0684 Tj +[1 0 0 1 346.841 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -346.841 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +346.841 564.583 Td +/F134_0 9.9626 Tf +(BZ_UNIX) 41.8429 Tj +[1 0 0 1 388.685 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -388.685 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +391.583 564.583 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-291 TJm +(0) 4.9813 Tj +-291 TJm +(and) 14.386 Tj +[1 0 0 1 427.399 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -427.399 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +427.399 564.583 Td +/F134_0 9.9626 Tf +(BZ_LCCWIN32) 65.7532 Tj +[1 0 0 1 493.153 564.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.153 -564.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +496.052 564.583 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-291 TJm +(1,) 7.47195 Tj +-301 TJm +(in) 7.7509 Tj +-291 TJm +(the) 12.1743 Tj +72 552.628 Td +(\002le) 12.7322 Tj +[1 0 0 1 87.2227 552.628] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -87.2227 -552.628] cm +[1 0 0 1 0 0] Tm +0 0 Td +87.2227 552.628 Td +/F134_0 9.9626 Tf +(bzip2.c) 41.8429 Tj +[1 0 0 1 129.066 552.628] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -129.066 -552.628] cm +[1 0 0 1 0 0] Tm +0 0 Td +129.066 552.628 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(before) 25.4445 Tj +-250 TJm +(compiling.) 42.899 Tj +-310 TJm +(Otherwise) 40.9463 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(resulting) 34.8691 Tj +-250 TJm +(binary) 25.4544 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(on') 13.2801 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-250 TJm +(correctly) 35.4071 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 550.471] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -540.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 530.71 Td +/F130_0 9.9626 Tf +(I) 3.31755 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(en') 12.7222 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(tried) 18.2614 Tj +-250 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(stuf) 14.9439 Tj +25 TJm +(f) 3.31755 Tj +-250 TJm +(myself,) 29.6088 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(looks) 21.589 Tj +-250 TJm +(plausible.) 38.4656 Tj +[1 0 0 1 72 528.553] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -477.701] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(30) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 34 34 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -140.398 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -13.9477] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -21.5542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -720] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 701.916 Td +/F122_0 24.7902 Tf +(4.) 20.675 Tj +-278 TJm +(Miscellanea) 139.172 Tj +[1 0 0 1 72 701.606] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.1347] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -14.1161] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -678.355] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 658.006 Td +/F122_0 17.2154 Tf +(T) 10.5186 Tj +80 TJm +(ab) 20.0904 Tj +10 TJm +(le) 14.3576 Tj +-278 TJm +(of) 16.2513 Tj +-278 TJm +(Contents) 74.5943 Tj +[1 0 0 1 72 649.183] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -11.7401] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -637.443] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 637.443 Td +/F130_0 9.9626 Tf +(4.1.) 14.9439 Tj +-310 TJm +(Limitations) 45.9475 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(format) 26.5603 Tj +[1 0 0 1 255.231 637.443] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -260.212 -637.443] cm +[1 0 0 1 0 0] Tm +0 0 Td +269.154 637.443 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 637.443] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -637.443] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 637.443 Td +/F130_0 9.9626 Tf +(31) 9.9626 Tj +[1 0 0 1 516.09 637.443] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -625.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 625.488 Td +/F130_0 9.9626 Tf +(4.2.) 14.9439 Tj +-310 TJm +(Portability) 42.0721 Tj +-250 TJm +(issues) 23.8007 Tj +[1 0 0 1 158.395 625.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -163.376 -625.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +172.03 625.488 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 625.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -625.488] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 625.488 Td +/F130_0 9.9626 Tf +(32) 9.9626 Tj +[1 0 0 1 516.09 625.488] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -613.533] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 613.533 Td +/F130_0 9.9626 Tf +(4.3.) 14.9439 Tj +-310 TJm +(Reporting) 39.8504 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ugs) 13.8381 Tj +[1 0 0 1 150.993 613.533] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -155.975 -613.533] cm +[1 0 0 1 0 0] Tm +0 0 Td +166.115 613.533 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 613.533] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -613.533] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 613.533 Td +/F130_0 9.9626 Tf +(32) 9.9626 Tj +[1 0 0 1 516.09 613.533] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7983] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -601.578] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 601.578 Td +/F130_0 9.9626 Tf +(4.4.) 14.9439 Tj +-310 TJm +(Did) 14.9439 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(get) 12.1743 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(right) 18.8194 Tj +-250 TJm +(package?) 37.0609 Tj +[1 0 0 1 212.602 601.578] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 3.0884 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -218.778 -601.578] cm +[1 0 0 1 0 0] Tm +0 0 Td +229.109 601.578 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 601.578] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -601.578] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 601.578 Td +/F130_0 9.9626 Tf +(33) 9.9626 Tj +[1 0 0 1 516.09 601.578] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.7984] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -589.623] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 589.623 Td +/F130_0 9.9626 Tf +(4.5.) 14.9439 Tj +-310 TJm +(Further) 29.3299 Tj +-250 TJm +(Reading) 33.2053 Tj +[1 0 0 1 155.058 589.623] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4906 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -160.039 -589.623] cm +[1 0 0 1 0 0] Tm +0 0 Td +170.361 589.623 Td +/F147_0 9.9626 Tf +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +-166 TJm +(:) 2.7696 Tj +-167 TJm +(:) 2.7696 Tj +[1 0 0 1 506.127 589.623] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -506.127 -589.623] cm +[1 0 0 1 0 0] Tm +0 0 Td +506.127 589.623 Td +/F130_0 9.9626 Tf +(34) 9.9626 Tj +[1 0 0 1 516.09 589.623] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -444.09 -2.1568] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.1348] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -568.7] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 558.901 Td +/F130_0 9.9626 Tf +(These) 23.7907 Tj +-250 TJm +(are) 12.1643 Tj +-250 TJm +(just) 14.396 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(random) 30.4357 Tj +-250 TJm +(thoughts) 34.3212 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(mine.) 22.4159 Tj +-620 TJm +(Y) 7.193 Tj +110 TJm +(our) 13.2801 Tj +-250 TJm +(mileage) 31.5416 Tj +-250 TJm +(may) 17.1556 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(ary) 12.7222 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 556.744] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -547.113] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 524.48 Td +/F122_0 20.6585 Tf +(4.1.) 34.4584 Tj +-278 TJm +(Limitations) 110.192 Tj +-278 TJm +(of) 19.5016 Tj +-278 TJm +(the) 30.9877 Tj +-278 TJm +(compressed) 121.699 Tj +-278 TJm +(\002le) 29.8515 Tj +-278 TJm +(f) 6.87928 Tj +20 TJm +(ormat) 57.3893 Tj +[1 0 0 1 72 520.203] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -510.572] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 502.893 Td +/F134_0 9.9626 Tf +(bzip2-1.0.X) 65.7532 Tj +[1 0 0 1 137.753 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.753 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +137.753 502.893 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +[1 0 0 1 143.405 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -143.405 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +143.405 502.893 Td +/F134_0 9.9626 Tf +(0.9.5) 29.8878 Tj +[1 0 0 1 173.293 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -173.293 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +176.453 502.893 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 194 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -194 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +194 502.893 Td +/F134_0 9.9626 Tf +(0.9.0) 29.8878 Tj +[1 0 0 1 223.888 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -223.888 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +227.048 502.893 Td +/F130_0 9.9626 Tf +(use) 13.2801 Tj +-317 TJm +(e) 4.42339 Tj +15 TJm +(xactly) 24.3486 Tj +-317 TJm +(the) 12.1743 Tj +-318 TJm +(same) 20.4731 Tj +-317 TJm +(\002le) 12.7322 Tj +-317 TJm +(format) 26.5603 Tj +-317 TJm +(as) 8.29885 Tj +-318 TJm +(the) 12.1743 Tj +-317 TJm +(original) 30.9936 Tj +-317 TJm +(v) 4.9813 Tj +15 TJm +(ersion,) 26.8392 Tj +[1 0 0 1 455.801 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -455.801 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +455.801 502.893 Td +/F134_0 9.9626 Tf +(bzip2-0.1) 53.798 Tj +[1 0 0 1 509.599 502.893] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -509.599 -502.893] cm +[1 0 0 1 0 0] Tm +0 0 Td +509.599 502.893 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-1023 TJm +(This) 17.7135 Tj +72 490.938 Td +(decision) 33.2053 Tj +-222 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-222 TJm +(made) 21.579 Tj +-222 TJm +(in) 7.7509 Tj +-221 TJm +(the) 12.1743 Tj +-222 TJm +(interests) 33.2053 Tj +-222 TJm +(of) 8.29885 Tj +-222 TJm +(stability) 32.1095 Tj +65 TJm +(.) 2.49065 Tj +-601 TJm +(Creating) 34.3112 Tj +-222 TJm +(yet) 12.1743 Tj +-222 TJm +(another) 29.8778 Tj +-222 TJm +(incompatible) 52.0247 Tj +-221 TJm +(compressed) 47.0334 Tj +-222 TJm +(\002le) 12.7322 Tj +-222 TJm +(format) 26.5603 Tj +-222 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-222 TJm +(create) 23.7807 Tj +72 478.983 Td +(further) 27.1082 Tj +-250 TJm +(confusion) 39.2925 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(disruption) 40.4083 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(users.) 22.9638 Tj +[1 0 0 1 72 476.826] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -467.194] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 457.396 Td +/F130_0 9.9626 Tf +(Ne) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ertheless,) 37.3498 Tj +-234 TJm +(this) 14.396 Tj +-229 TJm +(is) 6.64505 Tj +-230 TJm +(not) 12.7322 Tj +-229 TJm +(a) 4.42339 Tj +-230 TJm +(painless) 32.0995 Tj +-229 TJm +(decision.) 35.696 Tj +-606 TJm +(De) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(elopment) 37.0808 Tj +-230 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-230 TJm +(since) 20.4731 Tj +-229 TJm +(the) 12.1743 Tj +-230 TJm +(release) 27.6562 Tj +-229 TJm +(of) 8.29885 Tj +[1 0 0 1 407.317 457.396] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -407.317 -457.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +407.317 457.396 Td +/F134_0 9.9626 Tf +(bzip2-0.1) 53.798 Tj +[1 0 0 1 461.115 457.396] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -461.115 -457.396] cm +[1 0 0 1 0 0] Tm +0 0 Td +463.402 457.396 Td +/F130_0 9.9626 Tf +(in) 7.7509 Tj +-230 TJm +(August) 28.782 Tj +-229 TJm +(1997) 19.9252 Tj +-230 TJm +(has) 13.2801 Tj +72 445.441 Td +(sho) 13.8381 Tj +25 TJm +(wn) 12.1743 Tj +-226 TJm +(comple) 29.3299 Tj +15 TJm +(xities) 21.589 Tj +-226 TJm +(in) 7.7509 Tj +-225 TJm +(the) 12.1743 Tj +-226 TJm +(\002le) 12.7322 Tj +-226 TJm +(format) 26.5603 Tj +-226 TJm +(which) 24.3486 Tj +-226 TJm +(slo) 11.6264 Tj +25 TJm +(w) 7.193 Tj +-225 TJm +(do) 9.9626 Tj +25 TJm +(wn) 12.1743 Tj +-226 TJm +(decompression) 59.7656 Tj +-226 TJm +(and,) 16.8766 Tj +-231 TJm +(in) 7.7509 Tj +-226 TJm +(retrospect,) 41.7732 Tj +-230 TJm +(are) 12.1643 Tj +-226 TJm +(unnecessary) 48.6872 Tj +65 TJm +(.) 2.49065 Tj +-604 TJm +(These) 23.7907 Tj +-226 TJm +(are:) 14.9339 Tj +[1 0 0 1 72 443.284] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.0613] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -414.222] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 414.222 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 414.222] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -414.222] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 414.222 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-265 TJm +(run-length) 41.5042 Tj +-266 TJm +(encoder) 31.5316 Tj +40 TJm +(,) 2.49065 Tj +-269 TJm +(which) 24.3486 Tj +-265 TJm +(is) 6.64505 Tj +-265 TJm +(the) 12.1743 Tj +-266 TJm +(\002rst) 15.5018 Tj +-265 TJm +(of) 8.29885 Tj +-265 TJm +(the) 12.1743 Tj +-266 TJm +(compression) 50.3609 Tj +-265 TJm +(transformations,) 65.0259 Tj +-269 TJm +(is) 6.64505 Tj +-265 TJm +(entirely) 30.4357 Tj +-266 TJm +(irrele) 21.0211 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant.) 14.6649 Tj +-711 TJm +(The) 15.4918 Tj +-266 TJm +(original) 30.9936 Tj +86.944 402.267 Td +(purpose) 31.5416 Tj +-301 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-301 TJm +(to) 7.7509 Tj +-301 TJm +(protect) 27.6661 Tj +-301 TJm +(the) 12.1743 Tj +-301 TJm +(sorting) 27.6761 Tj +-301 TJm +(algorithm) 38.7446 Tj +-301 TJm +(from) 19.3673 Tj +-301 TJm +(the) 12.1743 Tj +-301 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-301 TJm +(w) 7.193 Tj +10 TJm +(orst) 14.9439 Tj +-301 TJm +(case) 17.1456 Tj +-301 TJm +(input:) 23.2527 Tj +-412 TJm +(a) 4.42339 Tj +-301 TJm +(string) 22.6948 Tj +-301 TJm +(of) 8.29885 Tj +-301 TJm +(repeated) 33.7433 Tj +-301 TJm +(symbols.) 35.706 Tj +-927 TJm +(But) 14.396 Tj +86.944 390.312 Td +(algorithm) 38.7446 Tj +-274 TJm +(steps) 19.9252 Tj +-275 TJm +(Q6a) 16.5977 Tj +-274 TJm +(and) 14.386 Tj +-274 TJm +(Q6b) 17.1556 Tj +-275 TJm +(in) 7.7509 Tj +-274 TJm +(the) 12.1743 Tj +-274 TJm +(original) 30.9936 Tj +-275 TJm +(Burro) 23.2427 Tj +25 TJm +(ws-Wheel) 40.3884 Tj +1 TJm +(er) 7.74094 Tj +-275 TJm +(technical) 35.965 Tj +-274 TJm +(report) 23.7907 Tj +-274 TJm +(\(SRC-124\)) 43.7259 Tj +-275 TJm +(sho) 13.8381 Tj +25 TJm +(w) 7.193 Tj +-274 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-274 TJm +(repeats) 28.2141 Tj +-275 TJm +(can) 13.8281 Tj +86.944 378.357 Td +(be) 9.40469 Tj +-250 TJm +(handled) 31.5416 Tj +-250 TJm +(without) 30.4457 Tj +-250 TJm +(dif) 11.0684 Tj +25 TJm +(\002culty) 25.4644 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(block) 22.1369 Tj +-250 TJm +(sorting.) 30.1668 Tj +[1 0 0 1 269.617 378.357] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -197.617 -21.5867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -356.77] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 356.77 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 356.77] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -356.77] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 356.77 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-293 TJm +(randomisation) 57.006 Tj +-293 TJm +(mechanism) 45.3796 Tj +-293 TJm +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-294 TJm +(really) 22.6848 Tj +-293 TJm +(need) 18.8094 Tj +-293 TJm +(to) 7.7509 Tj +-293 TJm +(be) 9.40469 Tj +-293 TJm +(there.) 22.4059 Tj +-879 TJm +(Udi) 14.9439 Tj +-294 TJm +(Manber) 30.9837 Tj +-293 TJm +(and) 14.386 Tj +-293 TJm +(Gene) 21.0211 Tj +-293 TJm +(Myers) 25.4544 Tj +-293 TJm +(published) 38.7446 Tj +-294 TJm +(a) 4.42339 Tj +-293 TJm +(suf) 12.1743 Tj +25 TJm +(\002x) 10.5205 Tj +86.944 344.815 Td +(array) 20.4632 Tj +-238 TJm +(construction) 49.2551 Tj +-239 TJm +(algorithm) 38.7446 Tj +-238 TJm +(a) 4.42339 Tj +-238 TJm +(fe) 7.74094 Tj +25 TJm +(w) 7.193 Tj +-239 TJm +(years) 21.0211 Tj +-238 TJm +(back,) 21.3 Tj +-241 TJm +(which) 24.3486 Tj +-238 TJm +(can) 13.8281 Tj +-238 TJm +(be) 9.40469 Tj +-239 TJm +(emplo) 24.9065 Tj +10 TJm +(yed) 14.386 Tj +-238 TJm +(to) 7.7509 Tj +-238 TJm +(sort) 14.9439 Tj +-239 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-238 TJm +(block,) 24.6275 Tj +-241 TJm +(no) 9.9626 Tj +-238 TJm +(matter) 25.4544 Tj +-238 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-239 TJm +(repetiti) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +86.944 332.86 Td +(in) 7.7509 Tj +-229 TJm +(O\(N) 17.7035 Tj +-230 TJm +(log) 12.7322 Tj +-229 TJm +(N\)) 10.5105 Tj +-230 TJm +(time.) 20.2042 Tj +-606 TJm +(Subsequent) 45.9375 Tj +-230 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-229 TJm +(by) 9.9626 Tj +-230 TJm +(K) 7.193 Tj +15 TJm +(unihik) 25.4644 Tj +10 TJm +(o) 4.9813 Tj +-229 TJm +(Sadakane) 38.1767 Tj +-229 TJm +(has) 13.2801 Tj +-230 TJm +(produced) 37.0708 Tj +-229 TJm +(a) 4.42339 Tj +-230 TJm +(deri) 15.4918 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ati) 9.9626 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-229 TJm +(O\(N) 17.7035 Tj +-230 TJm +(\(log) 16.0497 Tj +-229 TJm +(N\)^2\)) 23.4818 Tj +-230 TJm +(algorithm) 38.7446 Tj +86.944 320.905 Td +(which) 24.3486 Tj +-250 TJm +(usually) 28.782 Tj +-250 TJm +(outperforms) 48.6972 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(Manber) 30.9837 Tj +20 TJm +(-Myers) 28.772 Tj +-250 TJm +(algorithm.) 41.2352 Tj +[1 0 0 1 314.189 320.905] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -242.189 -11.7883] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -309.116] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 299.318 Td +/F130_0 9.9626 Tf +(I) 3.31755 Tj +-248 TJm +(could) 22.1369 Tj +-248 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-248 TJm +(changed) 33.1954 Tj +-248 TJm +(to) 7.7509 Tj +-248 TJm +(Sadakane') 41.4942 Tj +55 TJm +(s) 3.87545 Tj +-248 TJm +(algorithm,) 41.2352 Tj +-249 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-248 TJm +(I) 3.31755 Tj +-248 TJm +(\002nd) 15.5018 Tj +-248 TJm +(it) 5.53921 Tj +-248 TJm +(to) 7.7509 Tj +-248 TJm +(be) 9.40469 Tj +-248 TJm +(slo) 11.6264 Tj +25 TJm +(wer) 14.9339 Tj +-248 TJm +(than) 17.1556 Tj +[1 0 0 1 392.444 299.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -392.444 -299.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +392.444 299.318 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 422.332 299.318] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -422.332 -299.318] cm +[1 0 0 1 0 0] Tm +0 0 Td +422.332 299.318 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +55 TJm +(s) 3.87545 Tj +-248 TJm +(e) 4.42339 Tj +15 TJm +(xisting) 27.1282 Tj +-248 TJm +(algorithm) 38.7446 Tj +-248 TJm +(for) 11.6164 Tj +-248 TJm +(most) 19.3773 Tj +86.944 287.363 Td +(inputs,) 26.8492 Tj +-370 TJm +(and) 14.386 Tj +-345 TJm +(the) 12.1743 Tj +-346 TJm +(randomisation) 57.006 Tj +-346 TJm +(mechanism) 45.3796 Tj +-345 TJm +(protects) 31.5416 Tj +-346 TJm +(adequately) 43.158 Tj +-345 TJm +(ag) 9.40469 Tj +5 TJm +(ainst) 18.8194 Tj +-346 TJm +(bad) 14.386 Tj +-346 TJm +(cases.) 23.5117 Tj +-1194 TJm +(I) 3.31755 Tj +-345 TJm +(didn') 21.031 Tj +18 TJm +(t) 2.7696 Tj +-346 TJm +(think) 20.4831 Tj +-346 TJm +(it) 5.53921 Tj +-345 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-346 TJm +(a) 4.42339 Tj +-346 TJm +(good) 19.9252 Tj +86.944 275.408 Td +(tradeof) 28.2141 Tj +25 TJm +(f) 3.31755 Tj +-262 TJm +(to) 7.7509 Tj +-261 TJm +(mak) 17.1556 Tj +10 TJm +(e.) 6.91404 Tj +-690 TJm +(P) 5.53921 Tj +15 TJm +(artly) 18.2614 Tj +-262 TJm +(this) 14.396 Tj +-261 TJm +(is) 6.64505 Tj +-262 TJm +(due) 14.386 Tj +-261 TJm +(to) 7.7509 Tj +-262 TJm +(the) 12.1743 Tj +-262 TJm +(f) 3.31755 Tj +10 TJm +(act) 11.6164 Tj +-261 TJm +(that) 14.9439 Tj +-262 TJm +(I) 3.31755 Tj +-261 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-262 TJm +(not) 12.7322 Tj +-262 TJm +(\003ooded) 29.8878 Tj +-261 TJm +(with) 17.7135 Tj +-262 TJm +(email) 22.1369 Tj +-261 TJm +(complaints) 43.7259 Tj +-262 TJm +(about) 22.1369 Tj +[1 0 0 1 479.557 275.408] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -479.557 -275.408] cm +[1 0 0 1 0 0] Tm +0 0 Td +479.557 275.408 Td +/F134_0 9.9626 Tf +(bzip2-0.1) 53.798 Tj +[1 0 0 1 533.355 275.408] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -533.355 -275.408] cm +[1 0 0 1 0 0] Tm +0 0 Td +533.355 275.408 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +55 TJm +(s) 3.87545 Tj +86.944 263.453 Td +(performance) 50.341 Tj +-250 TJm +(on) 9.9626 Tj +-250 TJm +(repetiti) 28.224 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(data,) 19.0883 Tj +-250 TJm +(so) 8.85675 Tj +-250 TJm +(perhaps) 30.9837 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(isn') 14.9439 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(problem) 33.2053 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(real) 14.9339 Tj +-250 TJm +(inputs.) 26.8492 Tj +[1 0 0 1 72 261.296] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -251.664] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 241.866 Td +/F130_0 9.9626 Tf +(Probably) 35.9749 Tj +-289 TJm +(the) 12.1743 Tj +-288 TJm +(best) 16.0497 Tj +-289 TJm +(long-term) 39.2925 Tj +-289 TJm +(solution,) 34.6001 Tj +-298 TJm +(and) 14.386 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(one) 14.386 Tj +-288 TJm +(I) 3.31755 Tj +-289 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-289 TJm +(incorporated) 50.351 Tj +-288 TJm +(into) 15.5018 Tj +-289 TJm +(0.9.5) 19.9252 Tj +-289 TJm +(and) 14.386 Tj +-288 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +14 TJm +(e,) 6.91404 Tj +-298 TJm +(is) 6.64505 Tj +-289 TJm +(to) 7.7509 Tj +-288 TJm +(use) 13.2801 Tj +-289 TJm +(the) 12.1743 Tj +-289 TJm +(e) 4.42339 Tj +15 TJm +(xisting) 27.1282 Tj +86.944 229.911 Td +(sorting) 27.6761 Tj +-451 TJm +(algorithm) 38.7446 Tj +-452 TJm +(initially) 31.0036 Tj +65 TJm +(,) 2.49065 Tj +-501 TJm +(and) 14.386 Tj +-452 TJm +(f) 3.31755 Tj +10 TJm +(all) 9.9626 Tj +-451 TJm +(back) 18.8094 Tj +-452 TJm +(to) 7.7509 Tj +-451 TJm +(a) 4.42339 Tj +-451 TJm +(O\(N) 17.7035 Tj +-452 TJm +(\(log) 16.0497 Tj +-451 TJm +(N\)^2\)) 23.4818 Tj +-451 TJm +(algorithm) 38.7446 Tj +-452 TJm +(if) 6.08715 Tj +-451 TJm +(the) 12.1743 Tj +-452 TJm +(standard) 33.7533 Tj +-451 TJm +(algorithm) 38.7446 Tj +-451 TJm +(gets) 16.0497 Tj +-452 TJm +(into) 15.5018 Tj +86.944 217.956 Td +(dif) 11.0684 Tj +25 TJm +(\002culties.) 34.0422 Tj +[1 0 0 1 72 217.856] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -21.4871] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -196.369] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 196.369 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 196.369] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -196.369] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 196.369 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-299 TJm +(compressed) 47.0334 Tj +-299 TJm +(\002le) 12.7322 Tj +-299 TJm +(format) 26.5603 Tj +-299 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-300 TJm +(ne) 9.40469 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-299 TJm +(designed) 35.417 Tj +-299 TJm +(to) 7.7509 Tj +-299 TJm +(be) 9.40469 Tj +-299 TJm +(handled) 31.5416 Tj +-299 TJm +(by) 9.9626 Tj +-299 TJm +(a) 4.42339 Tj +-299 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-312 TJm +(and) 14.386 Tj +-299 TJm +(I) 3.31755 Tj +-299 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-299 TJm +(had) 14.386 Tj +-299 TJm +(to) 7.7509 Tj +-299 TJm +(jump) 20.4831 Tj +-300 TJm +(though) 27.6761 Tj +-299 TJm +(some) 21.031 Tj +86.944 184.414 Td +(hoops) 23.8007 Tj +-278 TJm +(to) 7.7509 Tj +-277 TJm +(produce) 32.0895 Tj +-278 TJm +(an) 9.40469 Tj +-278 TJm +(ef) 7.74094 Tj +25 TJm +(\002cient) 24.9065 Tj +-277 TJm +(implementation) 62.5452 Tj +-278 TJm +(of) 8.29885 Tj +-278 TJm +(decompression.) 62.2563 Tj +-786 TJm +(It') 9.40469 Tj +55 TJm +(s) 3.87545 Tj +-278 TJm +(a) 4.42339 Tj +-277 TJm +(bit) 10.5205 Tj +-278 TJm +(hairy) 20.4731 Tj +65 TJm +(.) 2.49065 Tj +-786 TJm +(T) 6.08715 Tj +35 TJm +(ry) 8.29885 Tj +-278 TJm +(passing) 29.8878 Tj +[1 0 0 1 468.269 184.414] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468.269 -184.414] cm +[1 0 0 1 0 0] Tm +0 0 Td +468.269 184.414 Td +/F134_0 9.9626 Tf +(decompress.c) 71.7307 Tj +[1 0 0 1 540 184.414] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -184.414] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 172.459 Td +/F130_0 9.9626 Tf +(through) 30.9936 Tj +-268 TJm +(the) 12.1743 Tj +-268 TJm +(C) 6.64505 Tj +-268 TJm +(preprocessor) 50.8989 Tj +-269 TJm +(and) 14.386 Tj +-268 TJm +(you') 18.2614 Tj +10 TJm +(ll) 5.53921 Tj +-268 TJm +(see) 12.7222 Tj +-268 TJm +(what) 19.3673 Tj +-268 TJm +(I) 3.31755 Tj +-268 TJm +(mean.) 24.0696 Tj +-729 TJm +(Much) 23.2427 Tj +-268 TJm +(of) 8.29885 Tj +-269 TJm +(this) 14.396 Tj +-268 TJm +(comple) 29.3299 Tj +15 TJm +(xity) 15.5018 Tj +-268 TJm +(could) 22.1369 Tj +-268 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-268 TJm +(been) 18.8094 Tj +-268 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +20 TJm +(oided) 22.1369 Tj +-269 TJm +(if) 6.08715 Tj +-268 TJm +(the) 12.1743 Tj +86.944 160.503 Td +(compressed) 47.0334 Tj +-250 TJm +(size) 15.4918 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(each) 18.2515 Tj +-250 TJm +(block) 22.1369 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(recorded) 34.8492 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(data) 16.5977 Tj +-250 TJm +(stream.) 29.0509 Tj +[1 0 0 1 368.754 160.503] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -296.754 -21.5867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -138.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 138.917 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 138.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -138.917] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 138.917 Td +/F130_0 9.9626 Tf +(An) 12.1743 Tj +-250 TJm +(Adler) 22.6848 Tj +20 TJm +(-32) 13.2801 Tj +-250 TJm +(checksum,) 42.3311 Tj +-250 TJm +(rather) 23.2328 Tj +-250 TJm +(than) 17.1556 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(CRC32) 29.8978 Tj +-250 TJm +(checksum,) 42.3311 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(aster) 18.8094 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(compute.) 36.8018 Tj +[1 0 0 1 424.934 138.917] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -352.934 -11.7883] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -127.128] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 117.33 Td +/F130_0 9.9626 Tf +(It) 6.08715 Tj +-349 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-349 TJm +(be) 9.40469 Tj +-349 TJm +(f) 3.31755 Tj +10 TJm +(air) 10.5105 Tj +-348 TJm +(to) 7.7509 Tj +-349 TJm +(say) 13.2801 Tj +-349 TJm +(that) 14.9439 Tj +-349 TJm +(the) 12.1743 Tj +[1 0 0 1 201.979 117.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -201.979 -117.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +201.979 117.33 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 231.867 117.33] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -231.867 -117.33] cm +[1 0 0 1 0 0] Tm +0 0 Td +235.342 117.33 Td +/F130_0 9.9626 Tf +(format) 26.5603 Tj +-349 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-349 TJm +(frozen) 25.4445 Tj +-348 TJm +(before) 25.4445 Tj +-349 TJm +(I) 3.31755 Tj +-349 TJm +(properly) 33.7533 Tj +-349 TJm +(and) 14.386 Tj +-349 TJm +(fully) 18.8194 Tj +-349 TJm +(understood) 44.2738 Tj +-348 TJm +(the) 12.1743 Tj +-349 TJm +(performance) 50.341 Tj +72 105.375 Td +(consequences) 54.7744 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(doing) 22.6948 Tj +-250 TJm +(so.) 11.3474 Tj +[1 0 0 1 72 103.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -93.5867] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 83.7883 Td +/F130_0 9.9626 Tf +(Impro) 24.3486 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(ements) 28.224 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(I) 3.31755 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(as) 8.29885 Tj +-250 TJm +(able) 16.5977 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(incorporate) 45.3697 Tj +-250 TJm +(into) 15.5018 Tj +-250 TJm +(0.9.0,) 22.4159 Tj +-250 TJm +(despite) 28.224 Tj +-250 TJm +(using) 21.589 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(same) 20.4731 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(format,) 29.0509 Tj +-250 TJm +(are:) 14.9339 Tj +[1 0 0 1 72 81.6315] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -30.7796] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(31) 9.9626 Tj +[1 0 0 1 453.269 50.8519] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 35 35 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 116.328 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.4 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.728 749.245 Td +/F130_0 9.9626 Tf +(Miscellanea) 48.1393 Tj +[1 0 0 1 266.071 749.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -7.0936] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -31.5168] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 710.037 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 710.037 Td +/F130_0 9.9626 Tf +(Single) 25.4644 Tj +-202 TJm +(array) 20.4632 Tj +-201 TJm +(implementation) 62.5452 Tj +-202 TJm +(of) 8.29885 Tj +-202 TJm +(the) 12.1743 Tj +-201 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(erse) 16.0398 Tj +-202 TJm +(BWT) 22.1369 Tj +74 TJm +(.) 2.49065 Tj +-403 TJm +(This) 17.7135 Tj +-202 TJm +(signi\002cantly) 49.2651 Tj +-201 TJm +(speeds) 26.5603 Tj +-202 TJm +(up) 9.9626 Tj +-202 TJm +(decompression,) 62.2563 Tj +-211 TJm +(presumably) 46.4855 Tj +-202 TJm +(because) 31.5316 Tj +86.944 698.082 Td +(it) 5.53921 Tj +-250 TJm +(reduces) 30.4258 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(number) 30.4357 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(cache) 22.6749 Tj +-250 TJm +(misses.) 29.0609 Tj +[1 0 0 1 240.496 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -168.496 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 676.164 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 676.164] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -676.164] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 676.164 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(aster) 18.8094 Tj +-314 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(erse) 16.0398 Tj +-315 TJm +(MTF) 20.4831 Tj +-314 TJm +(transform) 38.7346 Tj +-315 TJm +(for) 11.6164 Tj +-314 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-315 TJm +(MTF) 20.4831 Tj +-314 TJm +(v) 4.9813 Tj +25 TJm +(alues.) 22.9638 Tj +-504 TJm +(The) 15.4918 Tj +-314 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-314 TJm +(implementation) 62.5452 Tj +-315 TJm +(is) 6.64505 Tj +-314 TJm +(based) 22.6848 Tj +-315 TJm +(on) 9.9626 Tj +-314 TJm +(the) 12.1743 Tj +-315 TJm +(notion) 25.4644 Tj +-314 TJm +(of) 8.29885 Tj +-315 TJm +(sliding) 27.1282 Tj +86.944 664.209 Td +(blocks) 26.0123 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(v) 4.9813 Tj +25 TJm +(alues.) 22.9638 Tj +[1 0 0 1 153.932 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -81.9321 -21.9178] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 642.291 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 642.291 Td +/F134_0 9.9626 Tf +(bzip2-0.9.0) 65.7532 Tj +[1 0 0 1 152.697 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -152.697 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.412 642.291 Td +/F130_0 9.9626 Tf +(no) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-272 TJm +(reads) 21.0211 Tj +-273 TJm +(and) 14.386 Tj +-272 TJm +(writes) 24.3486 Tj +-273 TJm +(\002les) 16.6077 Tj +-272 TJm +(with) 17.7135 Tj +[1 0 0 1 282.68 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -282.68 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +282.68 642.291 Td +/F134_0 9.9626 Tf +(fread) 29.8878 Tj +[1 0 0 1 312.568 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -312.568 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +315.282 642.291 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 332.383 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -332.383 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +332.383 642.291 Td +/F134_0 9.9626 Tf +(fwrite) 35.8654 Tj +[1 0 0 1 368.248 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -368.248 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +368.248 642.291 Td +/F130_0 9.9626 Tf +(;) 2.7696 Tj +-284 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-272 TJm +(0.1) 12.4533 Tj +-273 TJm +(used) 18.2614 Tj +[1 0 0 1 441.882 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -441.882 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +441.882 642.291 Td +/F134_0 9.9626 Tf +(putc) 23.9102 Tj +[1 0 0 1 465.792 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -465.792 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +468.507 642.291 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 485.607 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -485.607 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +485.607 642.291 Td +/F134_0 9.9626 Tf +(getc) 23.9102 Tj +[1 0 0 1 509.517 642.291] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -509.517 -642.291] cm +[1 0 0 1 0 0] Tm +0 0 Td +509.517 642.291 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-755 TJm +(Duh!) 20.4731 Tj +86.944 630.336 Td +(W) 9.40469 Tj +80 TJm +(ell,) 12.4533 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(li) 5.53921 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(learn.) 22.4059 Tj +[1 0 0 1 184.248 630.336] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -112.248 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -618.217] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 608.418 Td +/F130_0 9.9626 Tf +(Further) 29.3299 Tj +-304 TJm +(ahead,) 25.7234 Tj +-318 TJm +(it) 5.53921 Tj +-305 TJm +(w) 7.193 Tj +10 TJm +(ould) 17.7135 Tj +-304 TJm +(be) 9.40469 Tj +-305 TJm +(nice) 16.5977 Tj +-304 TJm +(to) 7.7509 Tj +-305 TJm +(be) 9.40469 Tj +-304 TJm +(able) 16.5977 Tj +-304 TJm +(to) 7.7509 Tj +-305 TJm +(do) 9.9626 Tj +-304 TJm +(random) 30.4357 Tj +-305 TJm +(access) 25.4445 Tj +-304 TJm +(into) 15.5018 Tj +-305 TJm +(\002les.) 19.0983 Tj +-946 TJm +(This) 17.7135 Tj +-305 TJm +(will) 15.5018 Tj +-304 TJm +(require) 28.2141 Tj +-304 TJm +(some) 21.031 Tj +-305 TJm +(careful) 27.6562 Tj +-304 TJm +(design) 26.0123 Tj +-305 TJm +(of) 8.29885 Tj +72 596.463 Td +(compressed) 47.0334 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(formats.) 32.9264 Tj +[1 0 0 1 72 594.306] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -584.344] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 561.71 Td +/F122_0 20.6585 Tf +(4.2.) 34.4584 Tj +-278 TJm +(P) 13.7792 Tj +40 TJm +(or) 20.6585 Tj +-20 TJm +(tability) 66.5823 Tj +-278 TJm +(issues) 64.3099 Tj +[1 0 0 1 72 557.434] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -547.472] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 539.793 Td +/F130_0 9.9626 Tf +(After) 21.0211 Tj +-250 TJm +(some) 21.031 Tj +-250 TJm +(consideration,) 56.1691 Tj +-250 TJm +(I) 3.31755 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(decided) 30.9837 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(use) 13.2801 Tj +-250 TJm +(GNU) 21.579 Tj +[1 0 0 1 303.231 539.793] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -303.231 -539.793] cm +[1 0 0 1 0 0] Tm +0 0 Td +303.231 539.793 Td +/F134_0 9.9626 Tf +(autoconf) 47.8205 Tj +[1 0 0 1 351.052 539.793] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -351.052 -539.793] cm +[1 0 0 1 0 0] Tm +0 0 Td +353.542 539.793 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-250 TJm +(con\002gure) 37.6287 Tj +-250 TJm +(0.9.5) 19.9252 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(1.0.) 14.9439 Tj +[1 0 0 1 72 537.636] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -527.673] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 517.875 Td +/F134_0 9.9626 Tf +(autoconf) 47.8205 Tj +[1 0 0 1 119.821 517.875] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -119.821 -517.875] cm +[1 0 0 1 0 0] Tm +0 0 Td +119.821 517.875 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-502 TJm +(admirable) 39.8404 Tj +-452 TJm +(and) 14.386 Tj +-452 TJm +(w) 7.193 Tj +10 TJm +(onderful) 33.7533 Tj +-452 TJm +(though) 27.6761 Tj +-452 TJm +(it) 5.53921 Tj +-452 TJm +(is,) 9.1357 Tj +-502 TJm +(mainly) 27.6761 Tj +-452 TJm +(assists) 25.4644 Tj +-452 TJm +(with) 17.7135 Tj +-452 TJm +(portability) 41.5142 Tj +-452 TJm +(problems) 37.0808 Tj +-452 TJm +(between) 33.1954 Tj +-452 TJm +(Unix-lik) 33.7633 Tj +10 TJm +(e) 4.42339 Tj +72 505.92 Td +(platforms.) 40.6773 Tj +-1398 TJm +(But) 14.396 Tj +[1 0 0 1 144.784 505.92] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -144.784 -505.92] cm +[1 0 0 1 0 0] Tm +0 0 Td +144.784 505.92 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 174.672 505.92] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -174.672 -505.92] cm +[1 0 0 1 0 0] Tm +0 0 Td +178.455 505.92 Td +/F130_0 9.9626 Tf +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-380 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-379 TJm +(much) 22.1369 Tj +-380 TJm +(in) 7.7509 Tj +-380 TJm +(the) 12.1743 Tj +-379 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-380 TJm +(of) 8.29885 Tj +-380 TJm +(portability) 41.5142 Tj +-379 TJm +(problems) 37.0808 Tj +-380 TJm +(on) 9.9626 Tj +-380 TJm +(Unix;) 22.6948 Tj +-444 TJm +(most) 19.3773 Tj +-380 TJm +(of) 8.29885 Tj +-380 TJm +(the) 12.1743 Tj +-379 TJm +(dif) 11.0684 Tj +25 TJm +(\002culties) 31.5516 Tj +72 493.964 Td +(appear) 26.5503 Tj +-297 TJm +(when) 21.579 Tj +-296 TJm +(po) 9.9626 Tj +-1 TJm +(r) 3.31755 Tj +1 TJm +(ting) 15.5018 Tj +-297 TJm +(to) 7.7509 Tj +-297 TJm +(the) 12.1743 Tj +-297 TJm +(Mac,) 20.1942 Tj +-308 TJm +(or) 8.29885 Tj +-297 TJm +(to) 7.7509 Tj +-297 TJm +(Microsoft') 42.61 Tj +55 TJm +(s) 3.87545 Tj +-296 TJm +(operating) 37.6287 Tj +-297 TJm +(systems.) 34.0422 Tj +[1 0 0 1 361.339 493.964] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -361.339 -493.964] cm +[1 0 0 1 0 0] Tm +0 0 Td +361.339 493.964 Td +/F134_0 9.9626 Tf +(autoconf) 47.8205 Tj +[1 0 0 1 409.16 493.964] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -409.16 -493.964] cm +[1 0 0 1 0 0] Tm +0 0 Td +412.116 493.964 Td +/F130_0 9.9626 Tf +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-297 TJm +(help) 17.1556 Tj +-296 TJm +(in) 7.7509 Tj +-297 TJm +(those) 21.031 Tj +-297 TJm +(cases,) 23.5117 Tj +-308 TJm +(and) 14.386 Tj +72 482.009 Td +(brings) 24.9065 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(whole) 24.3486 Tj +-250 TJm +(load) 17.1556 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-250 TJm +(comple) 29.3299 Tj +15 TJm +(xity) 15.5018 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 479.852] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -469.89] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 460.091 Td +/F130_0 9.9626 Tf +(Most) 20.4831 Tj +-392 TJm +(people) 26.5603 Tj +-392 TJm +(should) 26.5703 Tj +-393 TJm +(be) 9.40469 Tj +-392 TJm +(able) 16.5977 Tj +-392 TJm +(to) 7.7509 Tj +-392 TJm +(compile) 32.0995 Tj +-393 TJm +(the) 12.1743 Tj +-392 TJm +(library) 26.5603 Tj +-392 TJm +(and) 14.386 Tj +-392 TJm +(program) 33.7533 Tj +-393 TJm +(under) 22.6848 Tj +-392 TJm +(Unix) 19.9252 Tj +-392 TJm +(straight) 29.8878 Tj +-392 TJm +(out-of-the-box,) 60.5925 Tj +-428 TJm +(so) 8.85675 Tj +-392 TJm +(to) 7.7509 Tj +-393 TJm +(speak,) 25.1755 Tj +72 448.136 Td +(especially) 39.8404 Tj +-250 TJm +(if) 6.08715 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(v) 4.9813 Tj +15 TJm +(ersion) 24.3486 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(GNU) 21.579 Tj +-250 TJm +(C) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable.) 29.0509 Tj +[1 0 0 1 72 445.979] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -436.017] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 426.218 Td +/F130_0 9.9626 Tf +(There) 23.2328 Tj +-259 TJm +(are) 12.1643 Tj +-258 TJm +(a) 4.42339 Tj +-259 TJm +(couple) 26.5603 Tj +-258 TJm +(of) 8.29885 Tj +[1 0 0 1 159.561 426.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -159.561 -426.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +159.561 426.218 Td +/F134_0 9.9626 Tf +(__inline__) 59.7756 Tj +[1 0 0 1 219.337 426.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -219.337 -426.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +221.913 426.218 Td +/F130_0 9.9626 Tf +(directi) 25.4544 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-259 TJm +(in) 7.7509 Tj +-258 TJm +(the) 12.1743 Tj +-259 TJm +(code.) 21.3 Tj +-671 TJm +(GNU) 21.579 Tj +-259 TJm +(C) 6.64505 Tj +-258 TJm +(\() 3.31755 Tj +[1 0 0 1 352.587 426.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -352.587 -426.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +352.587 426.218 Td +/F134_0 9.9626 Tf +(gcc) 17.9327 Tj +[1 0 0 1 370.52 426.218] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -370.52 -426.218] cm +[1 0 0 1 0 0] Tm +0 0 Td +370.52 426.218 Td +/F130_0 9.9626 Tf +(\)) 3.31755 Tj +-259 TJm +(should) 26.5703 Tj +-258 TJm +(be) 9.40469 Tj +-259 TJm +(able) 16.5977 Tj +-258 TJm +(to) 7.7509 Tj +-259 TJm +(handle) 26.5603 Tj +-259 TJm +(them.) 22.4159 Tj +-671 TJm +(If) 6.63509 Tj +-259 TJm +(you') 18.2614 Tj +50 TJm +(re) 7.74094 Tj +72 414.263 Td +(not) 12.7322 Tj +-279 TJm +(using) 21.589 Tj +-279 TJm +(GNU) 21.579 Tj +-279 TJm +(C,) 9.1357 Tj +-279 TJm +(your) 18.2614 Tj +-279 TJm +(C) 6.64505 Tj +-279 TJm +(compiler) 35.417 Tj +-279 TJm +(shouldn') 34.8691 Tj +18 TJm +(t) 2.7696 Tj +-279 TJm +(see) 12.7222 Tj +-279 TJm +(them) 19.9252 Tj +-279 TJm +(at) 7.193 Tj +-279 TJm +(all.) 12.4533 Tj +-794 TJm +(If) 6.63509 Tj +-279 TJm +(your) 18.2614 Tj +-279 TJm +(compiler) 35.417 Tj +-279 TJm +(does,) 20.7521 Tj +-286 TJm +(for) 11.6164 Tj +-279 TJm +(some) 21.031 Tj +-279 TJm +(reason,) 28.493 Tj +-287 TJm +(see) 12.7222 Tj +-279 TJm +(them) 19.9252 Tj +-279 TJm +(and) 14.386 Tj +72 402.308 Td +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-283 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-283 TJm +(them,) 22.4159 Tj +-291 TJm +(just) 14.396 Tj +[1 0 0 1 164.167 402.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -164.167 -402.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +164.167 402.308 Td +/F134_0 9.9626 Tf +(#define) 41.8429 Tj +[1 0 0 1 206.01 402.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.8196 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -208.829 -402.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +208.829 402.308 Td +/F134_0 9.9626 Tf +(__inline__) 59.7756 Tj +[1 0 0 1 268.605 402.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -268.605 -402.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +271.425 402.308 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-283 TJm +(be) 9.40469 Tj +[1 0 0 1 294.22 402.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -294.22 -402.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +294.22 402.308 Td +/F134_0 9.9626 Tf +(/) 5.97756 Tj +300.197 400.565 Td +(*) 5.97756 Tj +-600 TJm +(*) 5.97756 Tj +318.13 402.308 Td +(/) 5.97756 Tj +[1 0 0 1 324.108 402.308] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -324.108 -402.308] cm +[1 0 0 1 0 0] Tm +0 0 Td +324.108 402.308 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-818 TJm +(One) 16.5977 Tj +-283 TJm +(easy) 17.7035 Tj +-283 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-283 TJm +(to) 7.7509 Tj +-283 TJm +(do) 9.9626 Tj +-283 TJm +(this) 14.396 Tj +-283 TJm +(is) 6.64505 Tj +-283 TJm +(to) 7.7509 Tj +-283 TJm +(compile) 32.0995 Tj +-283 TJm +(with) 17.7135 Tj +-283 TJm +(the) 12.1743 Tj +-283 TJm +(\003ag) 14.9439 Tj +[1 0 0 1 72 390.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -390.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 390.353 Td +/F134_0 9.9626 Tf +(-D__inline__=) 77.7083 Tj +[1 0 0 1 149.709 390.353] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -149.709 -390.353] cm +[1 0 0 1 0 0] Tm +0 0 Td +149.709 390.353 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-250 TJm +(which) 24.3486 Tj +-250 TJm +(should) 26.5703 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(understood) 44.2738 Tj +-250 TJm +(by) 9.9626 Tj +-250 TJm +(most) 19.3773 Tj +-250 TJm +(Unix) 19.9252 Tj +-250 TJm +(compilers.) 41.7831 Tj +[1 0 0 1 72 388.196] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -378.233] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 368.435 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-321 TJm +(you) 14.9439 Tj +-321 TJm +(still) 14.9539 Tj +-322 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-321 TJm +(dif) 11.0684 Tj +25 TJm +(\002culties,) 34.0422 Tj +-339 TJm +(try) 11.0684 Tj +-321 TJm +(compiling) 40.4083 Tj +-321 TJm +(with) 17.7135 Tj +-322 TJm +(t) 2.7696 Tj +1 TJm +(he) 9.40469 Tj +-322 TJm +(macro) 24.8965 Tj +[1 0 0 1 310.295 368.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -310.295 -368.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +310.295 368.435 Td +/F134_0 9.9626 Tf +(BZ_STRICT_ANSI) 83.6858 Tj +[1 0 0 1 393.981 368.435] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -393.981 -368.435] cm +[1 0 0 1 0 0] Tm +0 0 Td +397.18 368.435 Td +/F130_0 9.9626 Tf +(de\002ned.) 31.8205 Tj +-524 TJm +(This) 17.7135 Tj +-321 TJm +(should) 26.5703 Tj +-321 TJm +(enable) 26.0024 Tj +-321 TJm +(you) 14.9439 Tj +-322 TJm +(to) 7.7509 Tj +72 356.48 Td +(b) 4.9813 Tj +20 TJm +(uild) 15.5018 Tj +-321 TJm +(the) 12.1743 Tj +-321 TJm +(library) 26.5603 Tj +-322 TJm +(in) 7.7509 Tj +-321 TJm +(a) 4.42339 Tj +-321 TJm +(strictly) 27.6761 Tj +-321 TJm +(ANSI) 23.2427 Tj +-321 TJm +(compliant) 39.8504 Tj +-322 TJm +(en) 9.40469 Tj +40 TJm +(vironment.) 43.4469 Tj +-1047 TJm +(Building) 34.8791 Tj +-321 TJm +(the) 12.1743 Tj +-321 TJm +(program) 33.7533 Tj +-322 TJm +(itself) 19.9252 Tj +-321 TJm +(lik) 10.5205 Tj +10 TJm +(e) 4.42339 Tj +-321 TJm +(this) 14.396 Tj +-321 TJm +(is) 6.64505 Tj +-321 TJm +(dangerous) 40.9463 Tj +-322 TJm +(and) 14.386 Tj +72 344.525 Td +(not) 12.7322 Tj +-260 TJm +(supported,) 41.7831 Tj +-263 TJm +(since) 20.4731 Tj +-260 TJm +(you) 14.9439 Tj +-260 TJm +(remo) 20.4731 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +[1 0 0 1 204.498 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -204.498 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +204.498 344.525 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 234.386 344.525] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -234.386 -344.525] cm +[1 0 0 1 0 0] Tm +0 0 Td +234.386 344.525 Td +/F130_0 9.9626 Tf +(') 3.31755 Tj +55 TJm +(s) 3.87545 Tj +-260 TJm +(checks) 27.1082 Tj +-260 TJm +(ag) 9.40469 Tj +5 TJm +(ainst) 18.8194 Tj +-261 TJm +(compressi) 40.3983 Tj +1 TJm +(ng) 9.9626 Tj +-261 TJm +(directories,) 44.5428 Tj +-262 TJm +(symbolic) 36.5329 Tj +-261 TJm +(links,) 21.8679 Tj +-262 TJm +(de) 9.40469 Tj +25 TJm +(vices,) 22.9638 Tj +-263 TJm +(and) 14.386 Tj +-260 TJm +(other) 20.4731 Tj +72 332.57 Td +(not-really-a-\002le) 62.5253 Tj +-250 TJm +(entities.) 31.2726 Tj +-620 TJm +(This) 17.7135 Tj +-250 TJm +(could) 22.1369 Tj +-250 TJm +(cause) 22.1269 Tj +-250 TJm +(\002lesystem) 40.4083 Tj +-250 TJm +(corruption!) 44.8217 Tj +[1 0 0 1 72 330.413] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -320.45] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 310.652 Td +/F130_0 9.9626 Tf +(One) 16.5977 Tj +-392 TJm +(other) 20.4731 Tj +-391 TJm +(thing:) 23.2527 Tj +-594 TJm +(if) 6.08715 Tj +-391 TJm +(you) 14.9439 Tj +-392 TJm +(create) 23.7807 Tj +-391 TJm +(a) 4.42339 Tj +[1 0 0 1 210.879 310.652] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.879 -310.652] cm +[1 0 0 1 0 0] Tm +0 0 Td +210.879 310.652 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 240.767 310.652] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.767 -310.652] cm +[1 0 0 1 0 0] Tm +0 0 Td +244.669 310.652 Td +/F130_0 9.9626 Tf +(binary) 25.4544 Tj +-392 TJm +(for) 11.6164 Tj +-391 TJm +(public) 24.9065 Tj +-392 TJm +(distrib) 25.4644 Tj +20 TJm +(ution,) 22.9738 Tj +-427 TJm +(please) 24.8965 Tj +-392 TJm +(consider) 33.7533 Tj +-391 TJm +(linking) 28.234 Tj +-392 TJm +(it) 5.53921 Tj +-391 TJm +(statically) 35.9749 Tj +-392 TJm +(\() 3.31755 Tj +[1 0 0 1 522.067 310.652] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -522.067 -310.652] cm +[1 0 0 1 0 0] Tm +0 0 Td +522.067 310.652 Td +/F134_0 9.9626 Tf +(gcc) 17.9327 Tj +72 298.697 Td +(-static) 41.8429 Tj +[1 0 0 1 113.843 298.697] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -113.843 -298.697] cm +[1 0 0 1 0 0] Tm +0 0 Td +113.843 298.697 Td +/F130_0 9.9626 Tf +(\).) 5.8082 Tj +-620 TJm +(This) 17.7135 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +20 TJm +(oids) 16.6077 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(sorts) 18.8194 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(library-v) 34.8591 Tj +15 TJm +(ersion) 24.3486 Tj +-250 TJm +(issues) 23.8007 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(others) 24.3486 Tj +-250 TJm +(may) 17.1556 Tj +-250 TJm +(encounter) 39.2825 Tj +-250 TJm +(later) 17.7035 Tj +-250 TJm +(on.) 12.4533 Tj +[1 0 0 1 72 296.54] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -286.577] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 276.779 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-296 TJm +(you) 14.9439 Tj +-296 TJm +(b) 4.9813 Tj +20 TJm +(uild) 15.5018 Tj +[1 0 0 1 122.709 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -122.709 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +122.709 276.779 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 152.596 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -152.596 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +155.545 276.779 Td +/F130_0 9.9626 Tf +(on) 9.9626 Tj +-296 TJm +(W) 9.40469 Tj +40 TJm +(in32,) 20.2042 Tj +-307 TJm +(you) 14.9439 Tj +-296 TJm +(must) 19.3773 Tj +-296 TJm +(set) 11.0684 Tj +[1 0 0 1 254.965 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -254.965 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +254.965 276.779 Td +/F134_0 9.9626 Tf +(BZ_UNIX) 41.8429 Tj +[1 0 0 1 296.808 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -296.808 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +299.756 276.779 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-296 TJm +(0) 4.9813 Tj +-296 TJm +(and) 14.386 Tj +[1 0 0 1 335.72 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -335.72 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +335.72 276.779 Td +/F134_0 9.9626 Tf +(BZ_LCCWIN32) 65.7532 Tj +[1 0 0 1 401.473 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -401.473 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +404.422 276.779 Td +/F130_0 9.9626 Tf +(to) 7.7509 Tj +-296 TJm +(1,) 7.47195 Tj +-307 TJm +(in) 7.7509 Tj +-296 TJm +(the) 12.1743 Tj +-296 TJm +(\002le) 12.7322 Tj +[1 0 0 1 467.159 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -467.159 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +467.159 276.779 Td +/F134_0 9.9626 Tf +(bzip2.c) 41.8429 Tj +[1 0 0 1 509.002 276.779] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -509.002 -276.779] cm +[1 0 0 1 0 0] Tm +0 0 Td +509.002 276.779 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-307 TJm +(before) 25.4445 Tj +72 264.824 Td +(compiling.) 42.899 Tj +-310 TJm +(Otherwise) 40.9463 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(resulting) 34.8691 Tj +-250 TJm +(binary) 25.4544 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(on') 13.2801 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ork) 13.2801 Tj +-250 TJm +(correctly) 35.4071 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 262.667] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -252.704] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 230.071 Td +/F122_0 20.6585 Tf +(4.3.) 34.4584 Tj +-278 TJm +(Repor) 59.6824 Tj +-20 TJm +(ting) 37.867 Tj +-278 TJm +(b) 12.6223 Tj +20 TJm +(ugs) 36.7308 Tj +[1 0 0 1 72 225.474] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -215.512] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 208.153 Td +/F130_0 9.9626 Tf +(I) 3.31755 Tj +-228 TJm +(tried) 18.2614 Tj +-228 TJm +(pretty) 23.2427 Tj +-228 TJm +(hard) 17.7035 Tj +-228 TJm +(to) 7.7509 Tj +-228 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-228 TJm +(sure) 16.5977 Tj +[1 0 0 1 196.25 208.153] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -196.25 -208.153] cm +[1 0 0 1 0 0] Tm +0 0 Td +196.25 208.153 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 226.138 208.153] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -226.138 -208.153] cm +[1 0 0 1 0 0] Tm +0 0 Td +228.409 208.153 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-228 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-228 TJm +(free,) 17.9725 Tj +-232 TJm +(both) 17.7135 Tj +-228 TJm +(by) 9.9626 Tj +-228 TJm +(design) 26.0123 Tj +-228 TJm +(and) 14.386 Tj +-228 TJm +(by) 9.9626 Tj +-228 TJm +(testing.) 29.0609 Tj +-605 TJm +(Hopefully) 40.3983 Tj +-228 TJm +(you') 18.2614 Tj +10 TJm +(ll) 5.53921 Tj +-228 TJm +(ne) 9.40469 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +-228 TJm +(need) 18.8094 Tj +-228 TJm +(to) 7.7509 Tj +-228 TJm +(read) 17.1456 Tj +72 196.198 Td +(this) 14.396 Tj +-250 TJm +(section) 28.224 Tj +-250 TJm +(for) 11.6164 Tj +-250 TJm +(real.) 17.4246 Tj +[1 0 0 1 72 196.098] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -186.136] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 174.28 Td +/F130_0 9.9626 Tf +(Ne) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ertheless,) 37.3498 Tj +-313 TJm +(if) 6.08715 Tj +[1 0 0 1 137.751 174.28] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -137.751 -174.28] cm +[1 0 0 1 0 0] Tm +0 0 Td +137.751 174.28 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 167.639 174.28] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -167.639 -174.28] cm +[1 0 0 1 0 0] Tm +0 0 Td +170.634 174.28 Td +/F130_0 9.9626 Tf +(dies) 16.0497 Tj +-301 TJm +(with) 17.7135 Tj +-300 TJm +(a) 4.42339 Tj +-301 TJm +(se) 8.29885 Tj +15 TJm +(gmentation) 44.8317 Tj +-300 TJm +(f) 3.31755 Tj +10 TJm +(ault,) 17.4346 Tj +-314 TJm +(a) 4.42339 Tj +-300 TJm +(b) 4.9813 Tj +20 TJm +(us) 8.85675 Tj +-301 TJm +(error) 19.3573 Tj +-300 TJm +(or) 8.29885 Tj +-301 TJm +(an) 9.40469 Tj +-301 TJm +(internal) 30.4357 Tj +-300 TJm +(assertion) 35.417 Tj +-301 TJm +(f) 3.31755 Tj +10 TJm +(ailure,) 25.1755 Tj +-313 TJm +(it) 5.53921 Tj +-301 TJm +(wil) 12.7322 Tj +1 TJm +(l) 2.7696 Tj +-301 TJm +(ask) 13.2801 Tj +-301 TJm +(you) 14.9439 Tj +-300 TJm +(to) 7.7509 Tj +72 162.325 Td +(email) 22.1369 Tj +-242 TJm +(me) 12.1743 Tj +-243 TJm +(a) 4.42339 Tj +-242 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-243 TJm +(report.) 26.2813 Tj +-615 TJm +(Experience) 44.8118 Tj +-242 TJm +(from) 19.3673 Tj +-243 TJm +(years) 21.0211 Tj +-242 TJm +(of) 8.29885 Tj +-242 TJm +(feedback) 35.955 Tj +-243 TJm +(of) 8.29885 Tj +-242 TJm +(bzip2) 22.1369 Tj +-243 TJm +(users) 20.4731 Tj +-242 TJm +(indicates) 35.417 Tj +-243 TJm +(that) 14.9439 Tj +-242 TJm +(almost) 26.5703 Tj +-242 TJm +(all) 9.9626 Tj +-243 TJm +(these) 20.4731 Tj +-242 TJm +(problems) 37.0808 Tj +-243 TJm +(can) 13.8281 Tj +72 150.37 Td +(be) 9.40469 Tj +-250 TJm +(traced) 24.3386 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(either) 22.6848 Tj +-250 TJm +(compiler) 35.417 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ugs) 13.8381 Tj +-250 TJm +(or) 8.29885 Tj +-250 TJm +(hardw) 24.8965 Tj +10 TJm +(are) 12.1643 Tj +-250 TJm +(problems.) 39.5714 Tj +[1 0 0 1 72 148.213] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -97.3611] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(32) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 36 36 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 116.328 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.4 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.728 749.245 Td +/F130_0 9.9626 Tf +(Miscellanea) 48.1393 Tj +[1 0 0 1 266.071 749.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -7.0936] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -31.5168] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 710.037 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 710.037] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -710.037] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 710.037 Td +/F130_0 9.9626 Tf +(Recompile) 43.1679 Tj +-306 TJm +(the) 12.1743 Tj +-306 TJm +(program) 33.7533 Tj +-306 TJm +(with) 17.7135 Tj +-306 TJm +(no) 9.9626 Tj +-306 TJm +(optimisation,) 52.3136 Tj +-320 TJm +(and) 14.386 Tj +-306 TJm +(see) 12.7222 Tj +-306 TJm +(if) 6.08715 Tj +-306 TJm +(it) 5.53921 Tj +-306 TJm +(w) 7.193 Tj +10 TJm +(orks.) 19.6462 Tj +-956 TJm +(And/or) 28.224 Tj +-306 TJm +(try) 11.0684 Tj +-306 TJm +(a) 4.42339 Tj +-306 TJm +(dif) 11.0684 Tj +25 TJm +(ferent) 23.2328 Tj +-306 TJm +(compiler) 35.417 Tj +55 TJm +(.) 2.49065 Tj +-956 TJm +(I) 3.31755 Tj +-306 TJm +(heard) 22.1269 Tj +-306 TJm +(all) 9.9626 Tj +86.944 698.082 Td +(sorts) 18.8194 Tj +-282 TJm +(of) 8.29885 Tj +-282 TJm +(stories) 26.0123 Tj +-282 TJm +(about) 22.1369 Tj +-283 TJm +(v) 4.9813 Tj +25 TJm +(arious) 24.3486 Tj +-282 TJm +(\003a) 9.9626 Tj +20 TJm +(v) 4.9813 Tj +20 TJm +(ours) 17.1556 Tj +-282 TJm +(of) 8.29885 Tj +-282 TJm +(GNU) 21.579 Tj +-282 TJm +(C) 6.64505 Tj +-282 TJm +(\(and) 17.7035 Tj +-282 TJm +(other) 20.4731 Tj +-283 TJm +(compilers\)) 42.61 Tj +-282 TJm +(generating) 42.0521 Tj +-282 TJm +(bad) 14.386 Tj +-282 TJm +(code) 18.8094 Tj +-282 TJm +(for) 11.6164 Tj +[1 0 0 1 472.141 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.141 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +472.141 698.082 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 502.029 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -502.029 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +502.029 698.082 Td +/F130_0 9.9626 Tf +(,) 2.49065 Tj +-290 TJm +(and) 14.386 Tj +-282 TJm +(I') 6.63509 Tj +50 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +86.944 686.127 Td +(run) 13.2801 Tj +-250 TJm +(across) 24.8965 Tj +-250 TJm +(tw) 9.9626 Tj +10 TJm +(o) 4.9813 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xamples) 33.2053 Tj +-250 TJm +(myself.) 29.6088 Tj +[1 0 0 1 237.767 686.127] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -165.767 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -674.007] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 664.209 Td +/F130_0 9.9626 Tf +(2.7.X) 22.1369 Tj +-280 TJm +(v) 4.9813 Tj +15 TJm +(ersions) 28.224 Tj +-279 TJm +(of) 8.29885 Tj +-280 TJm +(GNU) 21.579 Tj +-279 TJm +(C) 6.64505 Tj +-280 TJm +(are) 12.1643 Tj +-279 TJm +(kno) 14.9439 Tj +25 TJm +(wn) 12.1743 Tj +-280 TJm +(to) 7.7509 Tj +-280 TJm +(generate) 33.7433 Tj +-279 TJm +(bad) 14.386 Tj +-280 TJm +(code) 18.8094 Tj +-279 TJm +(from) 19.3673 Tj +-280 TJm +(time) 17.7135 Tj +-279 TJm +(to) 7.7509 Tj +-280 TJm +(time,) 20.2042 Tj +-287 TJm +(at) 7.193 Tj +-280 TJm +(high) 17.7135 Tj +-279 TJm +(optimisation) 49.823 Tj +-280 TJm +(le) 7.193 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(els.) 13.5591 Tj +-797 TJm +(If) 6.63509 Tj +-280 TJm +(you) 14.9439 Tj +86.944 652.254 Td +(get) 12.1743 Tj +-295 TJm +(problems,) 39.5714 Tj +-307 TJm +(try) 11.0684 Tj +-296 TJm +(using) 21.589 Tj +-295 TJm +(the) 12.1743 Tj +-296 TJm +(\003ags) 18.8194 Tj +[1 0 0 1 220.116 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -220.116 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +220.116 652.254 Td +/F134_0 9.9626 Tf +(-O2) 17.9327 Tj +[1 0 0 1 238.049 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.9438 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -240.993 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +240.993 652.254 Td +/F134_0 9.9626 Tf +(-fomit-frame-pointer) 119.551 Tj +[1 0 0 1 360.544 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.9438 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -363.488 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +363.488 652.254 Td +/F134_0 9.9626 Tf +(-fno-strength-reduce) 119.551 Tj +[1 0 0 1 483.04 652.254] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -483.04 -652.254] cm +[1 0 0 1 0 0] Tm +0 0 Td +483.04 652.254 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-893 TJm +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-295 TJm +(should) 26.5703 Tj +86.944 640.299 Td +(speci\002cally) 45.3796 Tj +[1 0 0 1 134.814 640.299] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -134.814 -640.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +134.814 640.299 Td +/F637_0 9.9626 Tf +(not) 12.7322 Tj +[1 0 0 1 147.546 640.299] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -147.546 -640.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +150.036 640.299 Td +/F130_0 9.9626 Tf +(use) 13.2801 Tj +[1 0 0 1 165.807 640.299] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -165.807 -640.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +165.807 640.299 Td +/F134_0 9.9626 Tf +(-funroll-loops) 83.6858 Tj +[1 0 0 1 249.493 640.299] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -249.493 -640.299] cm +[1 0 0 1 0 0] Tm +0 0 Td +249.493 640.299 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +[1 0 0 1 72 638.142] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -628.179] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 618.381 Td +/F130_0 9.9626 Tf +(Y) 7.193 Tj +110 TJm +(ou) 9.9626 Tj +-249 TJm +(may) 17.1556 Tj +-249 TJm +(notice) 24.3486 Tj +-248 TJm +(that) 14.9439 Tj +-249 TJm +(the) 12.1743 Tj +-249 TJm +(Mak) 18.2614 Tj +10 TJm +(e\002le) 17.1556 Tj +-249 TJm +(runs) 17.1556 Tj +-248 TJm +(six) 11.6264 Tj +-249 TJm +(tests) 17.7135 Tj +-249 TJm +(as) 8.29885 Tj +-249 TJm +(part) 15.4918 Tj +-249 TJm +(of) 8.29885 Tj +-248 TJm +(the) 12.1743 Tj +-249 TJm +(b) 4.9813 Tj +20 TJm +(uild) 15.5018 Tj +-249 TJm +(process.) 32.3685 Tj +-619 TJm +(If) 6.63509 Tj +-249 TJm +(the) 12.1743 Tj +-249 TJm +(program) 33.7533 Tj +-248 TJm +(passes) 25.4544 Tj +-249 TJm +(all) 9.9626 Tj +-249 TJm +(of) 8.29885 Tj +-249 TJm +(these,) 22.9638 Tj +-249 TJm +(it') 8.85675 Tj +55 TJm +(s) 3.87545 Tj +86.944 606.426 Td +(a) 4.42339 Tj +-250 TJm +(pretty) 23.2427 Tj +-250 TJm +(good) 19.9252 Tj +-250 TJm +(\(b) 8.29885 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(not) 12.7322 Tj +-250 TJm +(100%\)) 26.5603 Tj +-250 TJm +(indication) 39.8504 Tj +-250 TJm +(that) 14.9439 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(compiler) 35.417 Tj +-250 TJm +(has) 13.2801 Tj +-250 TJm +(done) 19.3673 Tj +-250 TJm +(its) 9.41466 Tj +-250 TJm +(job) 12.7322 Tj +-250 TJm +(correctly) 35.4071 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 604.269] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -19.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 584.508 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 584.508 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +[1 0 0 1 95.9558 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -95.9558 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +95.9558 584.508 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 125.844 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -125.844 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +128.22 584.508 Td +/F130_0 9.9626 Tf +(crashes) 29.3199 Tj +-239 TJm +(randomly) 38.1866 Tj +65 TJm +(,) 2.49065 Tj +-240 TJm +(and) 14.386 Tj +-239 TJm +(the) 12.1743 Tj +-239 TJm +(crashe) 25.4445 Tj +1 TJm +(s) 3.87545 Tj +-239 TJm +(are) 12.1643 Tj +-239 TJm +(not) 12.7322 Tj +-238 TJm +(repeatable,) 43.427 Tj +-241 TJm +(you) 14.9439 Tj +-239 TJm +(may) 17.1556 Tj +-238 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-239 TJm +(a) 4.42339 Tj +-238 TJm +(\003ak) 14.9439 Tj +15 TJm +(y) 4.9813 Tj +-239 TJm +(memory) 33.2053 Tj +-238 TJm +(subsystem.) 44.0048 Tj +[1 0 0 1 510.112 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -510.112 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +510.112 584.508 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 540 584.508] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -584.508] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 572.553 Td +/F130_0 9.9626 Tf +(really) 22.6848 Tj +-254 TJm +(hammers) 36.5229 Tj +-253 TJm +(your) 18.2614 Tj +-254 TJm +(memory) 33.2053 Tj +-253 TJm +(hierarch) 32.6375 Tj +5 TJm +(y) 4.9813 Tj +65 TJm +(,) 2.49065 Tj +-255 TJm +(and) 14.386 Tj +-253 TJm +(if) 6.08715 Tj +-254 TJm +(it') 8.85675 Tj +55 TJm +(s) 3.87545 Tj +-254 TJm +(a) 4.42339 Tj +-253 TJm +(bit) 10.5205 Tj +-254 TJm +(mar) 15.4918 Tj +18 TJm +(ginal,) 22.4159 Tj +-254 TJm +(you) 14.9439 Tj +-254 TJm +(may) 17.1556 Tj +-253 TJm +(get) 12.1743 Tj +-254 TJm +(these) 20.4731 Tj +-253 TJm +(problems.) 39.5714 Tj +-642 TJm +(Ditto) 20.4831 Tj +-254 TJm +(if) 6.08715 Tj +-253 TJm +(your) 18.2614 Tj +-254 TJm +(disk) 16.6077 Tj +86.944 560.598 Td +(or) 8.29885 Tj +-250 TJm +(I/O) 13.2801 Tj +-250 TJm +(subsystem) 41.5142 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(slo) 11.6264 Tj +25 TJm +(wly) 14.9439 Tj +-250 TJm +(f) 3.31755 Tj +10 TJm +(ailing.) 25.1855 Tj +-620 TJm +(Y) 7.193 Tj +111 TJm +(up,) 12.4533 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(really) 22.6848 Tj +-250 TJm +(does) 18.2614 Tj +-250 TJm +(happen.) 31.2626 Tj +[1 0 0 1 345.143 560.598] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -273.143 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -548.478] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 538.68 Td +/F130_0 9.9626 Tf +(T) 6.08715 Tj +35 TJm +(ry) 8.29885 Tj +-250 TJm +(using) 21.589 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(dif) 11.0684 Tj +25 TJm +(ferent) 23.2328 Tj +-250 TJm +(machine) 33.7533 Tj +-250 TJm +(of) 8.29885 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(same) 20.4731 Tj +-250 TJm +(type,) 19.6462 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(see) 12.7222 Tj +-250 TJm +(if) 6.08715 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(can) 13.8281 Tj +-250 TJm +(repeat) 24.3386 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(problem.) 35.696 Tj +[1 0 0 1 72 536.523] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -19.761] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.9739 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -78.9739 -516.762] cm +[1 0 0 1 0 0] Tm +0 0 Td +78.9739 516.762 Td +/F130_0 9.9626 Tf +(\225) 3.48691 Tj +[1 0 0 1 82.4608 516.762] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 1.9925 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -86.944 -516.762] cm +[1 0 0 1 0 0] Tm +0 0 Td +86.944 516.762 Td +/F130_0 9.9626 Tf +(This) 17.7135 Tj +-229 TJm +(isn') 14.9439 Tj +18 TJm +(t) 2.7696 Tj +-230 TJm +(really) 22.6848 Tj +-229 TJm +(a) 4.42339 Tj +-229 TJm +(b) 4.9813 Tj +20 TJm +(ug,) 12.4533 Tj +-234 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-229 TJm +(...) 7.47195 Tj +-303 TJm +(If) 6.63509 Tj +[1 0 0 1 212.232 516.762] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -212.232 -516.762] cm +[1 0 0 1 0 0] Tm +0 0 Td +212.232 516.762 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 242.12 516.762] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -242.12 -516.762] cm +[1 0 0 1 0 0] Tm +0 0 Td +244.405 516.762 Td +/F130_0 9.9626 Tf +(tells) 16.6077 Tj +-229 TJm +(you) 14.9439 Tj +-230 TJm +(your) 18.2614 Tj +-229 TJm +(\002le) 12.7322 Tj +-229 TJm +(is) 6.64505 Tj +-230 TJm +(corrupted) 38.1767 Tj +-229 TJm +(on) 9.9626 Tj +-230 TJm +(decompression,) 62.2563 Tj +-233 TJm +(and) 14.386 Tj +-229 TJm +(you) 14.9439 Tj +-230 TJm +(obtained) 34.3112 Tj +-229 TJm +(the) 12.1743 Tj +-229 TJm +(\002le) 12.7322 Tj +86.944 504.807 Td +(via) 12.1743 Tj +-262 TJm +(FTP) 17.1656 Tj +111 TJm +(,) 2.49065 Tj +-263 TJm +(there) 19.9152 Tj +-262 TJm +(is) 6.64505 Tj +-262 TJm +(a) 4.42339 Tj +-262 TJm +(possibility) 41.5241 Tj +-263 TJm +(that) 14.9439 Tj +-262 TJm +(you) 14.9439 Tj +-262 TJm +(for) 11.6164 Tj +18 TJm +(got) 12.7322 Tj +-263 TJm +(to) 7.7509 Tj +-262 TJm +(tell) 12.7322 Tj +-262 TJm +(FTP) 17.1656 Tj +-263 TJm +(to) 7.7509 Tj +-262 TJm +(do) 9.9626 Tj +-262 TJm +(a) 4.42339 Tj +-262 TJm +(binary) 25.4544 Tj +-263 TJm +(mode) 22.1369 Tj +-262 TJm +(transfer) 30.4258 Tj +55 TJm +(.) 2.49065 Tj +-694 TJm +(That) 18.2614 Tj +-262 TJm +(absolutely) 40.9562 Tj +-262 TJm +(will) 15.5018 Tj +-263 TJm +(cause) 22.1269 Tj +86.944 492.852 Td +(the) 12.1743 Tj +-250 TJm +(\002le) 12.7322 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(be) 9.40469 Tj +-250 TJm +(non-decompressible.) 82.7294 Tj +-620 TJm +(Y) 7.193 Tj +110 TJm +(ou') 13.2801 Tj +10 TJm +(ll) 5.53921 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(transfer) 30.4258 Tj +-250 TJm +(it) 5.53921 Tj +-250 TJm +(ag) 9.40469 Tj +5 TJm +(ain.) 14.6649 Tj +[1 0 0 1 351.34 492.852] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -279.34 -12.1195] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -480.732] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 470.934 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-235 TJm +(you') 18.2614 Tj +50 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-236 TJm +(incor) 20.4731 Tj +1 TJm +(p) 4.9813 Tj +-1 TJm +(or) 8.29885 Tj +1 TJm +(ated) 16.5977 Tj +[1 0 0 1 163.036 470.934] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -163.036 -470.934] cm +[1 0 0 1 0 0] Tm +0 0 Td +163.036 470.934 Td +/F134_0 9.9626 Tf +(libbzip2) 47.8205 Tj +[1 0 0 1 210.856 470.934] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -210.856 -470.934] cm +[1 0 0 1 0 0] Tm +0 0 Td +213.2 470.934 Td +/F130_0 9.9626 Tf +(into) 15.5018 Tj +-235 TJm +(your) 18.2614 Tj +-235 TJm +(o) 4.9813 Tj +25 TJm +(wn) 12.1743 Tj +-236 TJm +(program) 33.7533 Tj +-235 TJm +(and) 14.386 Tj +-235 TJm +(are) 12.1643 Tj +-236 TJm +(get) 12.1743 Tj +1 TJm +(ting) 15.5018 Tj +-236 TJm +(problems,) 39.5714 Tj +-238 TJm +(please,) 27.3872 Tj +-238 TJm +(please,) 27.3872 Tj +-238 TJm +(please,) 27.3872 Tj +-238 TJm +(check) 23.2328 Tj +-236 TJm +(that) 14.9439 Tj +72 458.979 Td +(the) 12.1743 Tj +-242 TJm +(parameters) 43.7059 Tj +-243 TJm +(you) 14.9439 Tj +-242 TJm +(are) 12.1643 Tj +-242 TJm +(passing) 29.8878 Tj +-243 TJm +(in) 7.7509 Tj +-242 TJm +(calls) 18.2614 Tj +-242 TJm +(to) 7.7509 Tj +-243 TJm +(the) 12.1743 Tj +-242 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-244 TJm +(are) 12.1643 Tj +-242 TJm +(correct,) 30.1468 Tj +-244 TJm +(and) 14.386 Tj +-243 TJm +(in) 7.7509 Tj +-242 TJm +(accordance) 44.8018 Tj +-242 TJm +(with) 17.7135 Tj +-243 TJm +(what) 19.3673 Tj +-242 TJm +(the) 12.1743 Tj +-242 TJm +(documentation) 59.2177 Tj +-243 TJm +(says) 17.1556 Tj +72 447.024 Td +(is) 6.64505 Tj +-250 TJm +(allo) 14.9439 Tj +25 TJm +(w) 7.193 Tj +10 TJm +(able.) 19.0883 Tj +-310 TJm +(I) 3.31755 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(tried) 18.2614 Tj +-250 TJm +(to) 7.7509 Tj +-250 TJm +(mak) 17.1556 Tj +10 TJm +(e) 4.42339 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(library) 26.5603 Tj +-250 TJm +(rob) 13.2801 Tj +20 TJm +(ust) 11.6264 Tj +-250 TJm +(ag) 9.40469 Tj +5 TJm +(ainst) 18.8194 Tj +-250 TJm +(such) 18.2614 Tj +-250 TJm +(problems,) 39.5714 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-250 TJm +(I'm) 14.386 Tj +-250 TJm +(sure) 16.5977 Tj +-250 TJm +(I) 3.31755 Tj +-250 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(en') 12.7222 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(succeeded.) 43.427 Tj +[1 0 0 1 72 444.867] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -434.904] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 425.106 Td +/F130_0 9.9626 Tf +(Finally) 28.234 Tj +65 TJm +(,) 2.49065 Tj +-324 TJm +(if) 6.08715 Tj +-310 TJm +(the) 12.1743 Tj +-309 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-309 TJm +(comments) 40.9562 Tj +-310 TJm +(don') 18.2614 Tj +18 TJm +(t) 2.7696 Tj +-309 TJm +(help,) 19.6462 Tj +-324 TJm +(you') 18.2614 Tj +10 TJm +(ll) 5.53921 Tj +-310 TJm +(ha) 9.40469 Tj +20 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-309 TJm +(to) 7.7509 Tj +-309 TJm +(send) 18.2614 Tj +-310 TJm +(me) 12.1743 Tj +-309 TJm +(a) 4.42339 Tj +-309 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-310 TJm +(report.) 26.2813 Tj +-976 TJm +(No) 12.1743 Tj +25 TJm +(w) 7.193 Tj +65 TJm +(,) 2.49065 Tj +-324 TJm +(it') 8.85675 Tj +55 TJm +(s) 3.87545 Tj +-310 TJm +(just) 14.396 Tj +-309 TJm +(amazing) 33.7533 Tj +-309 TJm +(ho) 9.9626 Tj +25 TJm +(w) 7.193 Tj +-310 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +72 413.151 Td +(people) 26.5603 Tj +-250 TJm +(will) 15.5018 Tj +-250 TJm +(send) 18.2614 Tj +-250 TJm +(me) 12.1743 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(b) 4.9813 Tj +20 TJm +(ug) 9.9626 Tj +-250 TJm +(report) 23.7907 Tj +-250 TJm +(saying) 26.0123 Tj +-250 TJm +(something) 41.5142 Tj +-250 TJm +(lik) 10.5205 Tj +10 TJm +(e:) 7.193 Tj +[1 0 0 1 72 410.994] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -24.9066] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 23.9103 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 20.3237] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -401.629] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 401.629 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +-426 TJm +(crashed) 41.8429 Tj +-426 TJm +(with) 23.9102 Tj +-426 TJm +(segmentation) 71.7307 Tj +-426 TJm +(fault) 29.8878 Tj +-426 TJm +(on) 11.9551 Tj +-426 TJm +(my) 11.9551 Tj +-426 TJm +(machine) 41.8429 Tj +[1 0 0 1 72 386.087] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -376.125] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 364.169 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +-241 TJm +(absolutely) 40.9562 Tj +-241 TJm +(nothing) 30.4457 Tj +-241 TJm +(el) 7.193 Tj +1 TJm +(se.) 10.7895 Tj +-614 TJm +(Needless) 35.965 Tj +-241 TJm +(to) 7.7509 Tj +-241 TJm +(say) 13.2801 Tj +65 TJm +(,) 2.49065 Tj +-243 TJm +(a) 4.42339 Tj +-241 TJm +(such) 18.2614 Tj +-240 TJm +(a) 4.42339 Tj +-241 TJm +(report) 23.7907 Tj +-241 TJm +(is) 6.64505 Tj +[1 0 0 1 324.681 364.169] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -324.681 -364.169] cm +[1 0 0 1 0 0] Tm +0 0 Td +324.681 364.169 Td +/F637_0 9.9626 Tf +(totally) 25.4644 Tj +55 TJm +(,) 2.49065 Tj +-243 TJm +(utterly) 26.0123 Tj +55 TJm +(,) 2.49065 Tj +-242 TJm +(completely) 43.158 Tj +-241 TJm +(and) 14.9439 Tj +-241 TJm +(compr) 25.4544 Tj +37 TJm +(ehensively) 41.4942 Tj +-241 TJm +(100%) 23.2427 Tj +72 352.214 Td +(useless;) 31.5416 Tj +-257 TJm +(a) 4.9813 Tj +-255 TJm +(waste) 22.6948 Tj +-255 TJm +(of) 7.7509 Tj +-255 TJm +(your) 18.2614 Tj +-255 TJm +(time) 17.1556 Tj +10 TJm +(,) 2.49065 Tj +-256 TJm +(my) 11.6164 Tj +-255 TJm +(time) 17.1556 Tj +10 TJm +(,) 2.49065 Tj +-256 TJm +(and) 14.9439 Tj +-255 TJm +(net) 12.1743 Tj +-255 TJm +(bandwidth) 42.0721 Tj +[1 0 0 1 302.574 352.214] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -302.574 -352.214] cm +[1 0 0 1 0 0] Tm +0 0 Td +302.574 352.214 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-650 TJm +(W) 9.40469 Tj +40 TJm +(ith) 10.5205 Tj +-254 TJm +(no) 9.9626 Tj +-255 TJm +(details) 26.0123 Tj +-255 TJm +(at) 7.193 Tj +-255 TJm +(all,) 12.4533 Tj +-256 TJm +(there') 23.2328 Tj +55 TJm +(s) 3.87545 Tj +-255 TJm +(no) 9.9626 Tj +-255 TJm +(w) 7.193 Tj +10 TJm +(ay) 9.40469 Tj +-255 TJm +(I) 3.31755 Tj +-255 TJm +(can) 13.8281 Tj +-255 TJm +(possibly) 33.2153 Tj +-255 TJm +(be) 9.40469 Tj +15 TJm +(gin) 12.7322 Tj +72 340.259 Td +(to) 7.7509 Tj +-250 TJm +(\002gure) 23.2427 Tj +-250 TJm +(out) 12.7322 Tj +-250 TJm +(what) 19.3673 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(problem) 33.2053 Tj +-250 TJm +(is.) 9.1357 Tj +[1 0 0 1 72 338.102] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -328.14] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 318.341 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-309 TJm +(rules) 19.3673 Tj +-309 TJm +(of) 8.29885 Tj +-309 TJm +(the) 12.1743 Tj +-310 TJm +(g) 4.9813 Tj +5 TJm +(ame) 16.5977 Tj +-309 TJm +(are:) 14.9339 Tj +-428 TJm +(f) 3.31755 Tj +10 TJm +(acts,) 17.9825 Tj +-324 TJm +(f) 3.31755 Tj +10 TJm +(acts,) 17.9825 Tj +-324 TJm +(f) 3.31755 Tj +10 TJm +(acts.) 17.9825 Tj +-975 TJm +(Don') 20.4731 Tj +18 TJm +(t) 2.7696 Tj +-309 TJm +(omit) 18.2714 Tj +-309 TJm +(them) 19.9252 Tj +-309 TJm +(because) 31.5316 Tj +-309 TJm +("oh,) 16.518 Tj +-324 TJm +(the) 12.1743 Tj +15 TJm +(y) 4.9813 Tj +-309 TJm +(w) 7.193 Tj +10 TJm +(on') 13.2801 Tj +18 TJm +(t) 2.7696 Tj +-309 TJm +(be) 9.40469 Tj +-310 TJm +(rele) 14.9339 Tj +25 TJm +(v) 4.9813 Tj +25 TJm +(ant".) 18.7297 Tj +-974 TJm +(At) 9.9626 Tj +-310 TJm +(the) 12.1743 Tj +-309 TJm +(bare) 17.1456 Tj +72 306.386 Td +(minimum:) 41.5241 Tj +[1 0 0 1 72 306.287] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -60.7721] cm +/DeviceRGB {} cs +[0.94899 0.94899 0.976456] sc +/DeviceRGB {} CS +[0.94899 0.94899 0.976456] SC +0 0 468 59.7758 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 56.1892] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -296.922] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 296.922 Td +/F134_0 9.9626 Tf +(Machine) 41.8429 Tj +-426 TJm +(type.) 29.8878 Tj +-852 TJm +(Operating) 53.798 Tj +-426 TJm +(system) 35.8654 Tj +-426 TJm +(version.) 47.8205 Tj +90 284.967 Td +(Exact) 29.8878 Tj +-426 TJm +(version) 41.8429 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(bzip2) 29.8878 Tj +-426 TJm +(\(do) 17.9327 Tj +-426 TJm +(bzip2) 29.8878 Tj +-426 TJm +(-V\).) 23.9102 Tj +90 273.011 Td +(Exact) 29.8878 Tj +-426 TJm +(version) 41.8429 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compiler) 47.8205 Tj +-426 TJm +(used.) 29.8878 Tj +90 261.056 Td +(Flags) 29.8878 Tj +-426 TJm +(passed) 35.8654 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(compiler.) 53.798 Tj +[1 0 0 1 72 245.514] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -235.552] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 223.597 Td +/F130_0 9.9626 Tf +(Ho) 12.1743 Tj +25 TJm +(we) 11.6164 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(er) 7.74094 Tj +40 TJm +(,) 2.49065 Tj +-254 TJm +(the) 12.1743 Tj +-252 TJm +(most) 19.3773 Tj +-253 TJm +(important) 38.7446 Tj +-253 TJm +(single) 23.8007 Tj +-253 TJm +(thing) 20.4831 Tj +-253 TJm +(t) 2.7696 Tj +1 TJm +(hat) 12.1743 Tj +-253 TJm +(will) 15.5018 Tj +-253 TJm +(help) 17.1556 Tj +-253 TJm +(me) 12.1743 Tj +-253 TJm +(is) 6.64505 Tj +-252 TJm +(the) 12.1743 Tj +-253 TJm +(\002le) 12.7322 Tj +-253 TJm +(that) 14.9439 Tj +-253 TJm +(you) 14.9439 Tj +-253 TJm +(were) 19.3573 Tj +-253 TJm +(trying) 23.8007 Tj +-252 TJm +(to) 7.7509 Tj +-253 TJm +(compress) 37.6287 Tj +-253 TJm +(or) 8.29885 Tj +-253 TJm +(decompress) 47.0334 Tj +72 211.641 Td +(at) 7.193 Tj +-304 TJm +(the) 12.1743 Tj +-305 TJm +(time) 17.7135 Tj +-304 TJm +(the) 12.1743 Tj +-304 TJm +(problem) 33.2053 Tj +-305 TJm +(happened.) 40.6673 Tj +-946 TJm +(W) 9.40469 Tj +40 TJm +(ithout) 23.2527 Tj +-304 TJm +(that,) 17.4346 Tj +-318 TJm +(my) 12.7322 Tj +-305 TJm +(ability) 25.4644 Tj +-304 TJm +(to) 7.7509 Tj +-304 TJm +(do) 9.9626 Tj +-305 TJm +(an) 9.40469 Tj +15 TJm +(ything) 25.4644 Tj +-304 TJm +(more) 20.4731 Tj +-304 TJm +(than) 17.1556 Tj +-305 TJm +(speculate) 37.0708 Tj +-304 TJm +(about) 22.1369 Tj +-304 TJm +(the) 12.1743 Tj +-305 TJm +(cause,) 24.6176 Tj +-318 TJm +(is) 6.64505 Tj +72 199.686 Td +(limited.) 30.7247 Tj +[1 0 0 1 72 199.587] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -189.624] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 164.933 Td +/F122_0 20.6585 Tf +(4.4.) 34.4584 Tj +-278 TJm +(Did) 33.2808 Tj +-278 TJm +(y) 11.4861 Tj +25 TJm +(ou) 25.2447 Tj +-278 TJm +(g) 12.6223 Tj +-10 TJm +(et) 18.3654 Tj +-278 TJm +(the) 30.9877 Tj +-278 TJm +(right) 45.9032 Tj +-278 TJm +(pac) 35.5946 Tj +20 TJm +(ka) 22.9723 Tj +10 TJm +(g) 12.6223 Tj +-10 TJm +(e?) 24.1085 Tj +[1 0 0 1 72 160.337] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -150.374] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 143.016 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 143.016] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -143.016] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.603 143.016 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-272 TJm +(a) 4.42339 Tj +-273 TJm +(resource) 33.7433 Tj +-272 TJm +(hog.) 17.4346 Tj +-378 TJm +(It) 6.08715 Tj +-272 TJm +(soaks) 22.1369 Tj +-273 TJm +(up) 9.9626 Tj +-272 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-273 TJm +(amounts) 33.7633 Tj +-272 TJm +(of) 8.29885 Tj +-273 TJm +(CPU) 19.3773 Tj +-272 TJm +(c) 4.42339 Tj +15 TJm +(ycles) 20.4731 Tj +-273 TJm +(and) 14.386 Tj +-272 TJm +(memory) 33.2053 Tj +65 TJm +(.) 2.49065 Tj +-755 TJm +(Also,) 21.31 Tj +-278 TJm +(it) 5.53921 Tj +-273 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-272 TJm +(v) 4.9813 Tj +15 TJm +(ery) 12.7222 Tj +-273 TJm +(lar) 10.5105 Tj +18 TJm +(ge) 9.40469 Tj +-272 TJm +(latencies.) 37.3498 Tj +72 131.06 Td +(In) 8.29885 Tj +-251 TJm +(the) 12.1743 Tj +-251 TJm +(w) 7.193 Tj +10 TJm +(orst) 14.9439 Tj +-251 TJm +(case,) 19.6363 Tj +-251 TJm +(you) 14.9439 Tj +-251 TJm +(can) 13.8281 Tj +-251 TJm +(feed) 17.1456 Tj +-251 TJm +(man) 17.1556 Tj +15 TJm +(y) 4.9813 Tj +-251 TJm +(me) 12.1743 Tj +15 TJm +(g) 4.9813 Tj +4 TJm +(abyt) 17.1556 Tj +1 TJm +(es) 8.29885 Tj +-252 TJm +(of) 8.29885 Tj +-251 TJm +(uncompressed) 56.996 Tj +-251 TJm +(data) 16.5977 Tj +-251 TJm +(into) 15.5018 Tj +-251 TJm +(the) 12.1743 Tj +-251 TJm +(library) 26.5603 Tj +-251 TJm +(before) 25.4445 Tj +-251 TJm +(getting) 27.6761 Tj +-251 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-251 TJm +(compressed) 47.0334 Tj +72 119.105 Td +(output,) 27.9551 Tj +-250 TJm +(so) 8.85675 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(probably) 35.417 Tj +-250 TJm +(rules) 19.3673 Tj +-250 TJm +(out) 12.7322 Tj +-250 TJm +(applications) 48.1492 Tj +-250 TJm +(requiring) 36.5229 Tj +-250 TJm +(interacti) 32.6474 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(e) 4.42339 Tj +-250 TJm +(beha) 18.8094 Tj +20 TJm +(viour) 21.031 Tj +55 TJm +(.) 2.49065 Tj +[1 0 0 1 72 116.949] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -106.986] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 97.1875 Td +/F130_0 9.9626 Tf +(These) 23.7907 Tj +-304 TJm +(aren') 20.4632 Tj +18 TJm +(t) 2.7696 Tj +-304 TJm +(f) 3.31755 Tj +10 TJm +(aults) 18.8194 Tj +-304 TJm +(of) 8.29885 Tj +-304 TJm +(my) 12.7322 Tj +-304 TJm +(implementation,) 65.0359 Tj +-317 TJm +(I) 3.31755 Tj +-304 TJm +(hope,) 21.8579 Tj +-318 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-304 TJm +(more) 20.4731 Tj +-304 TJm +(an) 9.40469 Tj +-304 TJm +(intrinsic) 32.6574 Tj +-304 TJm +(property) 33.7533 Tj +-304 TJm +(of) 8.29885 Tj +-304 TJm +(the) 12.1743 Tj +-304 TJm +(Burro) 23.2427 Tj +25 TJm +(ws-Wheeler) 48.1293 Tj +-304 TJm +(transform) 38.7346 Tj +72 85.2323 Td +(\(unfortunately\).) 62.8042 Tj +-620 TJm +(Maybe) 27.6661 Tj +-250 TJm +(this) 14.396 Tj +-250 TJm +(isn') 14.9439 Tj +18 TJm +(t) 2.7696 Tj +-250 TJm +(what) 19.3673 Tj +-250 TJm +(you) 14.9439 Tj +-250 TJm +(w) 7.193 Tj +10 TJm +(ant.) 14.6649 Tj +[1 0 0 1 72 83.0755] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -22.2611] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7545] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(33) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 37 37 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 116.328 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.4 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.728 749.245 Td +/F130_0 9.9626 Tf +(Miscellanea) 48.1393 Tj +[1 0 0 1 266.071 749.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -7.0936] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(If) 6.63509 Tj +-275 TJm +(you) 14.9439 Tj +-274 TJm +(w) 7.193 Tj +10 TJm +(ant) 12.1743 Tj +-275 TJm +(a) 4.42339 Tj +-274 TJm +(compressor) 45.9276 Tj +-275 TJm +(and/or) 25.4544 Tj +-275 TJm +(library) 26.5603 Tj +-274 TJm +(which) 24.3486 Tj +-275 TJm +(is) 6.64505 Tj +-274 TJm +(f) 3.31755 Tj +10 TJm +(aster) 18.8094 Tj +40 TJm +(,) 2.49065 Tj +-281 TJm +(uses) 17.1556 Tj +-275 TJm +(less) 14.9439 Tj +-274 TJm +(memory) 33.2053 Tj +-275 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-275 TJm +(gets) 16.0497 Tj +-274 TJm +(pretty) 23.2427 Tj +-275 TJm +(good) 19.9252 Tj +-274 TJm +(compression,) 52.8516 Tj +-281 TJm +(and) 14.386 Tj +-275 TJm +(has) 13.2801 Tj +72 698.082 Td +(minimal) 33.2153 Tj +-288 TJm +(latenc) 23.7907 Tj +15 TJm +(y) 4.9813 Tj +65 TJm +(,) 2.49065 Tj +-297 TJm +(consider) 33.7533 Tj +-288 TJm +(Jean-loup) 38.7346 Tj +-288 TJm +(Gailly') 28.224 Tj +55 TJm +(s) 3.87545 Tj +-288 TJm +(and) 14.386 Tj +-288 TJm +(Mark) 21.579 Tj +-288 TJm +(Adl) 14.9439 Tj +1 TJm +(er') 11.0585 Tj +55 TJm +(s) 3.87545 Tj +-288 TJm +(w) 7.193 Tj +10 TJm +(ork,) 15.7708 Tj +[1 0 0 1 353.879 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -353.879 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +353.879 698.082 Td +/F134_0 9.9626 Tf +(zlib-1.2.1) 59.7756 Tj +[1 0 0 1 413.655 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -413.655 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +416.523 698.082 Td +/F130_0 9.9626 Tf +(and) 14.386 Tj +[1 0 0 1 433.777 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -433.777 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +433.777 698.082 Td +/F134_0 9.9626 Tf +(gzip-1.2.4) 59.7756 Tj +[1 0 0 1 493.553 698.082] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.553 -698.082] cm +[1 0 0 1 0 0] Tm +0 0 Td +493.553 698.082 Td +/F130_0 9.9626 Tf +(.) 2.49065 Tj +-847 TJm +(Look) 21.031 Tj +-288 TJm +(for) 11.6164 Tj +72 686.127 Td +(them) 19.9252 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(http://www) 45.3896 Tj +65 TJm +(.zlib) 17.4346 Tj +40 TJm +(.or) 10.7895 Tj +18 TJm +(g) 4.9813 Tj +-250 TJm +(and) 14.386 Tj +-250 TJm +(http://www) 45.3896 Tj +65 TJm +(.gzip.or) 30.4357 Tj +18 TJm +(g) 4.9813 Tj +-250 TJm +(respecti) 30.9837 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(ely) 12.1743 Tj +65 TJm +(.) 2.49065 Tj +[1 0 0 1 72 683.97] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -674.008] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 664.209 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(or) 8.29885 Tj +-582 TJm +(something) 41.5142 Tj +-583 TJm +(f) 3.31755 Tj +10 TJm +(aster) 18.8094 Tj +-582 TJm +(and) 14.386 Tj +-582 TJm +(lighter) 26.0123 Tj +-583 TJm +(still,) 17.4445 Tj +-665 TJm +(you) 14.9439 Tj +-582 TJm +(might) 23.2527 Tj +-583 TJm +(try) 11.0684 Tj +-582 TJm +(Markus) 30.4357 Tj +-582 TJm +(F) 5.53921 Tj +-582 TJm +(X) 7.193 Tj +-582 TJm +(J) 3.87545 Tj +-582 TJm +(Oberhumer') 48.6872 Tj +55 TJm +(s) 3.87545 Tj +[1 0 0 1 437.433 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -437.433 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +437.433 664.209 Td +/F134_0 9.9626 Tf +(LZO) 17.9327 Tj +[1 0 0 1 455.365 664.209] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -455.365 -664.209] cm +[1 0 0 1 0 0] Tm +0 0 Td +461.163 664.209 Td +/F130_0 9.9626 Tf +(real-time) 35.965 Tj +-582 TJm +(compres-) 37.0708 Tj +72 652.254 Td +(sion/decompression) 79.1429 Tj +-250 TJm +(library) 26.5603 Tj +65 TJm +(,) 2.49065 Tj +-250 TJm +(at) 7.193 Tj +-250 TJm +(http://www) 45.3896 Tj +65 TJm +(.oberhumer) 45.6486 Tj +55 TJm +(.com/opensource.) 70.2762 Tj +[1 0 0 1 72 650.097] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -640.135] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 617.501 Td +/F122_0 20.6585 Tf +(4.5.) 34.4584 Tj +-278 TJm +(Fur) 33.2808 Tj +-20 TJm +(ther) 39.0239 Tj +-278 TJm +(Reading) 81.4978 Tj +[1 0 0 1 72 612.905] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9626] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -602.942] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 595.583 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 101.888 595.583] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -101.888 -595.583] cm +[1 0 0 1 0 0] Tm +0 0 Td +104.923 595.583 Td +/F130_0 9.9626 Tf +(is) 6.64505 Tj +-305 TJm +(not) 12.7322 Tj +-304 TJm +(research) 33.1854 Tj +-305 TJm +(w) 7.193 Tj +10 TJm +(ork,) 15.7708 Tj +-318 TJm +(in) 7.7509 Tj +-305 TJm +(the) 12.1743 Tj +-304 TJm +(sense) 21.579 Tj +-305 TJm +(that) 14.9439 Tj +-304 TJm +(it) 5.53921 Tj +-305 TJm +(doesn') 26.5603 Tj +18 TJm +(t) 2.7696 Tj +-305 TJm +(present) 28.772 Tj +-304 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-305 TJm +(ne) 9.40469 Tj +25 TJm +(w) 7.193 Tj +-304 TJm +(ideas.) 22.9638 Tj +-474 TJm +(Rather) 26.5603 Tj +40 TJm +(,) 2.49065 Tj +-318 TJm +(it') 8.85675 Tj +55 TJm +(s) 3.87545 Tj +-305 TJm +(an) 9.40469 Tj +-305 TJm +(engineeri) 37.0708 Tj +1 TJm +(ng) 9.9626 Tj +-305 TJm +(e) 4.42339 Tj +15 TJm +(x) 4.9813 Tj +15 TJm +(ercise) 23.2328 Tj +72 583.628 Td +(based) 22.6848 Tj +-250 TJm +(on) 9.9626 Tj +-250 TJm +(e) 4.42339 Tj +15 TJm +(xisting) 27.1282 Tj +-250 TJm +(ideas.) 22.9638 Tj +[1 0 0 1 72 581.471] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -9.9627] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -571.509] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 561.71 Td +/F130_0 9.9626 Tf +(F) 5.53921 Tj +15 TJm +(our) 13.2801 Tj +-250 TJm +(documents) 43.1679 Tj +-250 TJm +(describe) 33.1954 Tj +-250 TJm +(essentially) 42.0621 Tj +-250 TJm +(all) 9.9626 Tj +-250 TJm +(the) 12.1743 Tj +-250 TJm +(ideas) 20.4731 Tj +-250 TJm +(behind) 27.1182 Tj +[1 0 0 1 298.747 561.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -298.747 -561.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +298.747 561.71 Td +/F134_0 9.9626 Tf +(bzip2) 29.8878 Tj +[1 0 0 1 328.635 561.71] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -328.635 -561.71] cm +[1 0 0 1 0 0] Tm +0 0 Td +328.635 561.71 Td +/F130_0 9.9626 Tf +(:) 2.7696 Tj +[1 0 0 1 72 559.554] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -299.875] cm +/DeviceRGB {} cs +[0.929398 0.968597 0.956848] sc +/DeviceRGB {} CS +[0.929398 0.968597 0.956848] SC +0 0 468 298.879 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 295.293] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -550.189] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 550.189 Td +/F134_0 9.9626 Tf +(Michael) 41.8429 Tj +-426 TJm +(Burrows) 41.8429 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(D.) 11.9551 Tj +-426 TJm +(J.) 11.9551 Tj +-426 TJm +(Wheeler:) 47.8205 Tj +98.4879 538.234 Td +("A) 11.9551 Tj +-426 TJm +(block-sorting) 77.7083 Tj +-426 TJm +(lossless) 47.8205 Tj +-426 TJm +(data) 23.9102 Tj +-426 TJm +(compression) 65.7532 Tj +-426 TJm +(algorithm") 59.7756 Tj +102.732 526.278 Td +(10th) 23.9102 Tj +-426 TJm +(May) 17.9327 Tj +-426 TJm +(1994.) 29.8878 Tj +102.732 514.323 Td +(Digital) 41.8429 Tj +-426 TJm +(SRC) 17.9327 Tj +-426 TJm +(Research) 47.8205 Tj +-426 TJm +(Report) 35.8654 Tj +-426 TJm +(124.) 23.9102 Tj +102.732 502.368 Td +(ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.g\ +z) 382.564 Tj +102.732 490.413 Td +(If) 11.9551 Tj +-426 TJm +(you) 17.9327 Tj +-426 TJm +(have) 23.9102 Tj +-426 TJm +(trouble) 41.8429 Tj +-426 TJm +(finding) 41.8429 Tj +-426 TJm +(it,) 17.9327 Tj +-426 TJm +(try) 17.9327 Tj +-426 TJm +(searching) 53.798 Tj +-426 TJm +(at) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +102.732 478.458 Td +(New) 17.9327 Tj +-426 TJm +(Zealand) 41.8429 Tj +-426 TJm +(Digital) 41.8429 Tj +-426 TJm +(Library,) 47.8205 Tj +-426 TJm +(http://www.nzdl.org.) 119.551 Tj +90 454.547 Td +(Daniel) 35.8654 Tj +-426 TJm +(S.) 11.9551 Tj +-426 TJm +(Hirschberg) 59.7756 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(Debra) 29.8878 Tj +-426 TJm +(A.) 11.9551 Tj +-426 TJm +(LeLewer) 41.8429 Tj +98.4879 442.592 Td +("Efficient) 59.7756 Tj +-426 TJm +(Decoding) 47.8205 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(Prefix) 35.8654 Tj +-426 TJm +(Codes") 35.8654 Tj +102.732 430.637 Td +(Communications) 83.6858 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(ACM,) 23.9102 Tj +-426 TJm +(April) 29.8878 Tj +-426 TJm +(1990,) 29.8878 Tj +-426 TJm +(Vol) 17.9327 Tj +-426 TJm +(33,) 17.9327 Tj +-426 TJm +(Number) 35.8654 Tj +-426 TJm +(4.) 11.9551 Tj +102.732 418.682 Td +(You) 17.9327 Tj +-426 TJm +(might) 29.8878 Tj +-426 TJm +(be) 11.9551 Tj +-426 TJm +(able) 23.9102 Tj +-426 TJm +(to) 11.9551 Tj +-426 TJm +(get) 17.9327 Tj +-426 TJm +(an) 11.9551 Tj +-426 TJm +(electronic) 59.7756 Tj +-426 TJm +(copy) 23.9102 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(this) 23.9102 Tj +102.732 406.727 Td +(from) 23.9102 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(ACM) 17.9327 Tj +-426 TJm +(Digital) 41.8429 Tj +-426 TJm +(Library.) 47.8205 Tj +90 382.816 Td +(David) 29.8878 Tj +-426 TJm +(J.) 11.9551 Tj +-426 TJm +(Wheeler) 41.8429 Tj +102.732 370.861 Td +(Program) 41.8429 Tj +-426 TJm +(bred3.c) 41.8429 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(accompanying) 71.7307 Tj +-426 TJm +(document) 47.8205 Tj +-426 TJm +(bred3.ps.) 53.798 Tj +102.732 358.906 Td +(This) 23.9102 Tj +-426 TJm +(contains) 47.8205 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(idea) 23.9102 Tj +-426 TJm +(behind) 35.8654 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(multi-table) 65.7532 Tj +-426 TJm +(Huffman) 41.8429 Tj +-426 TJm +(coding) 35.8654 Tj +-426 TJm +(scheme.) 41.8429 Tj +102.732 346.951 Td +(ftp://ftp.cl.cam.ac.uk/users/djw3/) 203.237 Tj +90 323.041 Td +(Jon) 17.9327 Tj +-426 TJm +(L.) 11.9551 Tj +-426 TJm +(Bentley) 41.8429 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(Robert) 35.8654 Tj +-426 TJm +(Sedgewick) 53.798 Tj +98.4879 311.085 Td +("Fast) 29.8878 Tj +-426 TJm +(Algorithms) 59.7756 Tj +-426 TJm +(for) 17.9327 Tj +-426 TJm +(Sorting) 41.8429 Tj +-426 TJm +(and) 17.9327 Tj +-426 TJm +(Searching) 53.798 Tj +-426 TJm +(Strings") 47.8205 Tj +102.732 299.13 Td +(Available) 53.798 Tj +-426 TJm +(from) 23.9102 Tj +-426 TJm +(Sedgewick's) 65.7532 Tj +-426 TJm +(web) 17.9327 Tj +-426 TJm +(page,) 29.8878 Tj +102.732 287.175 Td +(www.cs.princeton.edu/~rs) 143.461 Tj +[1 0 0 1 72 259.678] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -249.715] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 237.76 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-239 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-238 TJm +(paper) 22.1269 Tj +-239 TJm +(gi) 7.7509 Tj +25 TJm +(v) 4.9813 Tj +15 TJm +(es) 8.29885 Tj +-239 TJm +(v) 4.9813 Tj +25 TJm +(aluable) 28.772 Tj +-238 TJm +(additional) 39.8504 Tj +-239 TJm +(insights) 31.0036 Tj +-238 TJm +(into) 15.5018 Tj +-239 TJm +(the) 12.1743 Tj +-239 TJm +(algorithm,) 41.2352 Tj +-241 TJm +(b) 4.9813 Tj +20 TJm +(ut) 7.7509 Tj +-238 TJm +(is) 6.64505 Tj +-239 TJm +(not) 12.7322 Tj +-239 TJm +(immedi) 30.4457 Tj +1 TJm +(ately) 19.3673 Tj +-239 TJm +(the) 12.1743 Tj +-239 TJm +(basis) 19.9252 Tj +-238 TJm +(of) 8.29885 Tj +-239 TJm +(an) 9.40469 Tj +15 TJm +(y) 4.9813 Tj +-239 TJm +(code) 18.8094 Tj +72 225.805 Td +(used) 18.2614 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(bzip2.) 24.6275 Tj +[1 0 0 1 72 223.648] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -72.7273] cm +/DeviceRGB {} cs +[0.929398 0.968597 0.956848] sc +/DeviceRGB {} CS +[0.929398 0.968597 0.956848] SC +0 0 468 71.731 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 68.1444] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -214.283] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 214.283 Td +/F134_0 9.9626 Tf +(Peter) 29.8878 Tj +-426 TJm +(Fenwick:) 47.8205 Tj +102.732 202.328 Td +(Block) 29.8878 Tj +-426 TJm +(Sorting) 41.8429 Tj +-426 TJm +(Text) 23.9102 Tj +-426 TJm +(Compression) 65.7532 Tj +102.732 190.373 Td +(Proceedings) 65.7532 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(19th) 23.9102 Tj +-426 TJm +(Australasian) 71.7307 Tj +-426 TJm +(Computer) 47.8205 Tj +-426 TJm +(Science) 41.8429 Tj +-426 TJm +(Conference,) 65.7532 Tj +111.22 178.418 Td +(Melbourne,) 59.7756 Tj +-426 TJm +(Australia.) 59.7756 Tj +-852 TJm +(Jan) 17.9327 Tj +-426 TJm +(31) 11.9551 Tj +-426 TJm +(-) 5.97756 Tj +-426 TJm +(Feb) 17.9327 Tj +-426 TJm +(2,) 11.9551 Tj +-426 TJm +(1996.) 29.8878 Tj +102.732 166.463 Td +(ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps) 322.788 Tj +[1 0 0 1 72 150.921] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -140.958] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 129.003 Td +/F130_0 9.9626 Tf +(K) 7.193 Tj +15 TJm +(unihik) 25.4644 Tj +10 TJm +(o) 4.9813 Tj +-250 TJm +(Sadakane') 41.4942 Tj +55 TJm +(s) 3.87545 Tj +-250 TJm +(sorting) 27.6761 Tj +-250 TJm +(algorithm,) 41.2352 Tj +-250 TJm +(mentioned) 42.0621 Tj +-250 TJm +(abo) 14.386 Tj +15 TJm +(v) 4.9813 Tj +15 TJm +(e,) 6.91404 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable) 26.5603 Tj +-250 TJm +(from:) 22.1369 Tj +[1 0 0 1 72 126.846] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.929398 0.968597 0.956848] sc +/DeviceRGB {} CS +[0.929398 0.968597 0.956848] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -117.482] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 117.482 Td +/F134_0 9.9626 Tf +(http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz) 346.698 Tj +[1 0 0 1 72 89.9846] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -29.1702] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8542] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9514] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9514 Td +/F130_0 9.9626 Tf +(34) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Page: 38 38 +%%BeginPageSetup +%%PageOrientation: Portrait +pdfStartPage +0 0 612 792 re W +%%EndPageSetup +[] 0 d +1 i +0 j +0 J +10 M +1 w +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +false op +false OP +0 0 612 792 re +W +q +[1 0 0 1 72 741.554] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 14.4459] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 187.197 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 -6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 116.328 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -382.4 -749.245] cm +[1 0 0 1 0 0] Tm +0 0 Td +498.728 749.245 Td +/F130_0 9.9626 Tf +(Miscellanea) 48.1393 Tj +[1 0 0 1 266.071 749.146] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 280.796 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -472.974 -7.0936] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -0.4981] cm +q +[] 0 d +0 J +0.4981 w +0 0.2491 m +475.465 0.2491 l +S +Q +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 479.251 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -540 -741.554] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 710.037 Td +/F130_0 9.9626 Tf +(The) 15.4918 Tj +-250 TJm +(Manber) 30.9837 Tj +20 TJm +(-Myers) 28.772 Tj +-250 TJm +(suf) 12.1743 Tj +25 TJm +(\002x) 10.5205 Tj +-250 TJm +(array) 20.4632 Tj +-250 TJm +(construction) 49.2551 Tj +-250 TJm +(algorithm) 38.7446 Tj +-250 TJm +(is) 6.64505 Tj +-250 TJm +(described) 38.1767 Tj +-250 TJm +(in) 7.7509 Tj +-250 TJm +(a) 4.42339 Tj +-250 TJm +(paper) 22.1269 Tj +-250 TJm +(a) 4.42339 Tj +20 TJm +(v) 4.9813 Tj +25 TJm +(ailable) 26.5603 Tj +-250 TJm +(from:) 22.1369 Tj +[1 0 0 1 72 707.88] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -36.8618] cm +/DeviceRGB {} cs +[0.929398 0.968597 0.956848] sc +/DeviceRGB {} CS +[0.929398 0.968597 0.956848] SC +0 0 468 35.8655 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 32.2789] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3685] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -698.516] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 698.516 Td +/F134_0 9.9626 Tf +(http://www.cs.arizona.edu/people/gene/PAPERS/suffix.ps) 322.788 Tj +[1 0 0 1 72 671.019] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -13.5492] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -72 -661.056] cm +[1 0 0 1 0 0] Tm +0 0 Td +72 649.101 Td +/F130_0 9.9626 Tf +(Finally) 28.234 Tj +65 TJm +(,) 2.49065 Tj +-227 TJm +(the) 12.1743 Tj +-221 TJm +(follo) 18.8194 Tj +25 TJm +(wing) 19.9252 Tj +-222 TJm +(papers) 26.0024 Tj +-221 TJm +(document) 39.2925 Tj +-221 TJm +(some) 21.031 Tj +-222 TJm +(in) 7.7509 Tj +40 TJm +(v) 4.9813 Tj +15 TJm +(estig) 18.8194 Tj +5 TJm +(ations) 23.8007 Tj +-221 TJm +(I) 3.31755 Tj +-221 TJm +(made) 21.579 Tj +-222 TJm +(into) 15.5018 Tj +-221 TJm +(the) 12.1743 Tj +-221 TJm +(performance) 50.341 Tj +-222 TJm +(of) 8.29885 Tj +-221 TJm +(sorting) 27.6761 Tj +-221 TJm +(and) 14.386 Tj +-222 TJm +(decompression) 59.7656 Tj +72 637.146 Td +(algorithms:) 45.3896 Tj +[1 0 0 1 72 634.989] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 -132.503] cm +/DeviceRGB {} cs +[0.929398 0.968597 0.956848] sc +/DeviceRGB {} CS +[0.929398 0.968597 0.956848] SC +0 0 468 131.507 re +f +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 127.92] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 18 -8.3686] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -90 -625.624] cm +[1 0 0 1 0 0] Tm +0 0 Td +90 625.624 Td +/F134_0 9.9626 Tf +(Julian) 35.8654 Tj +-426 TJm +(Seward) 35.8654 Tj +102.732 613.669 Td +(On) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(Performance) 65.7532 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(BWT) 17.9327 Tj +-426 TJm +(Sorting) 41.8429 Tj +-426 TJm +(Algorithms) 59.7756 Tj +102.732 601.714 Td +(Proceedings) 65.7532 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(IEEE) 23.9102 Tj +-426 TJm +(Data) 23.9102 Tj +-426 TJm +(Compression) 65.7532 Tj +-426 TJm +(Conference) 59.7756 Tj +-426 TJm +(2000) 23.9102 Tj +111.22 589.759 Td +(Snowbird,) 53.798 Tj +-426 TJm +(Utah.) 29.8878 Tj +-852 TJm +(28-30) 29.8878 Tj +-426 TJm +(March) 29.8878 Tj +-426 TJm +(2000.) 29.8878 Tj +90 565.848 Td +(Julian) 35.8654 Tj +-426 TJm +(Seward) 35.8654 Tj +102.732 553.893 Td +(Space-time) 59.7756 Tj +-426 TJm +(Tradeoffs) 53.798 Tj +-426 TJm +(in) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(Inverse) 41.8429 Tj +-426 TJm +(B-W) 17.9327 Tj +-426 TJm +(Transform) 53.798 Tj +102.732 541.938 Td +(Proceedings) 65.7532 Tj +-426 TJm +(of) 11.9551 Tj +-426 TJm +(the) 17.9327 Tj +-426 TJm +(IEEE) 23.9102 Tj +-426 TJm +(Data) 23.9102 Tj +-426 TJm +(Compression) 65.7532 Tj +-426 TJm +(Conference) 59.7756 Tj +-426 TJm +(2001) 23.9102 Tj +111.22 529.983 Td +(Snowbird,) 53.798 Tj +-426 TJm +(Utah.) 29.8878 Tj +-852 TJm +(27-29) 29.8878 Tj +-426 TJm +(March) 29.8878 Tj +-426 TJm +(2001.) 29.8878 Tj +[1 0 0 1 72 502.486] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 468 3.5866] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -468 -3.5866] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 0 -451.634] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 1.8929 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 374.394 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 2.4907 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 0 6.8541] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 40.5726 -6.7546] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 -493.841 -50.9513] cm +[1 0 0 1 0 0] Tm +0 0 Td +534.414 50.9513 Td +/F130_0 9.9626 Tf +(35) 9.9626 Tj +[1 0 0 1 453.269 50.8518] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 93.5985 0] cm +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +/DeviceRGB {} cs +[0 0 0] sc +/DeviceRGB {} CS +[0 0 0] SC +[1 0 0 1 6.2765 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +[1 0 0 1 -13.1436 0] cm +/DeviceGray {} cs +[0] sc +/DeviceGray {} CS +[0] SC +Q +showpage +%%PageTrailer +pdfEndPage +%%Trailer +end +%%DocumentSuppliedResources: +%%+ font DTUUHP+NimbusSanL-Bold +%%+ font VXAMRV+NimbusRomNo9L-Regu +%%+ font MFECUR+NimbusMonL-Regu +%%+ font ZOVMRD+CMMI10 +%%+ font ERVBFT+NimbusMonL-Bold +%%+ font BZXIEB+CMSY10 +%%+ font WWWUTU+NimbusRomNo9L-ReguItal +%%EOF Added: projects/external/bzip2-1.0.5/manual.xml ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/manual.xml Fri Jun 13 19:13:07 2008 @@ -0,0 +1,2964 @@ + + + %common-ents; +]> + + + + + bzip2 and libbzip2, version 1.0.5 + A program and library for data compression + + &bz-lifespan; + Julian Seward + + Version &bz-version; of &bz-date; + + + + Julian + Seward + + &bz-url; + + + + + + + This program, bzip2, the + associated library libbzip2, and + all documentation, are copyright © &bz-lifespan; Julian Seward. + All rights reserved. + + Redistribution and use in source and binary forms, with + or without modification, are permitted provided that the + following conditions are met: + + + + Redistributions of source code must retain the + above copyright notice, this list of conditions and the + following disclaimer. + + The origin of this software must not be + misrepresented; you must not claim that you wrote the original + software. If you use this software in a product, an + acknowledgment in the product documentation would be + appreciated but is not required. + + Altered source versions must be plainly marked + as such, and must not be misrepresented as being the original + software. + + The name of the author may not be used to + endorse or promote products derived from this software without + specific prior written permission. + + + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + + PATENTS: To the best of my knowledge, + bzip2 and + libbzip2 do not use any patented + algorithms. However, I do not have the resources to carry + out a patent search. Therefore I cannot give any guarantee of + the above statement. + + + + + + + + + +Introduction + +bzip2 compresses files +using the Burrows-Wheeler block-sorting text compression +algorithm, and Huffman coding. Compression is generally +considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of +the PPM family of statistical compressors. + +bzip2 is built on top of +libbzip2, a flexible library for +handling compressed data in the +bzip2 format. This manual +describes both how to use the program and how to work with the +library interface. Most of the manual is devoted to this +library, not the program, which is good news if your interest is +only in the program. + + + + describes how to use + bzip2; this is the only part + you need to read if you just want to know how to operate the + program. + + describes the + programming interfaces in detail, and + + records some + miscellaneous notes which I thought ought to be recorded + somewhere. + + + + + + + +How to use bzip2 + +This chapter contains a copy of the +bzip2 man page, and nothing +else. + + +NAME + + + + bzip2, + bunzip2 - a block-sorting file + compressor, v1.0.4 + + bzcat - + decompresses files to stdout + + bzip2recover - + recovers data from damaged bzip2 files + + + + + + + +SYNOPSIS + + + + bzip2 [ + -cdfkqstvzVL123456789 ] [ filenames ... ] + + bunzip2 [ + -fkvsVL ] [ filenames ... ] + + bzcat [ -s ] [ + filenames ... ] + + bzip2recover + filename + + + + + + + +DESCRIPTION + +bzip2 compresses files +using the Burrows-Wheeler block sorting text compression +algorithm, and Huffman coding. Compression is generally +considerably better than that achieved by more conventional +LZ77/LZ78-based compressors, and approaches the performance of +the PPM family of statistical compressors. + +The command-line options are deliberately very similar to +those of GNU gzip, but they are +not identical. + +bzip2 expects a list of +file names to accompany the command-line flags. Each file is +replaced by a compressed version of itself, with the name +original_name.bz2. Each +compressed file has the same modification date, permissions, and, +when possible, ownership as the corresponding original, so that +these properties can be correctly restored at decompression time. +File name handling is naive in the sense that there is no +mechanism for preserving original file names, permissions, +ownerships or dates in filesystems which lack these concepts, or +have serious file name length restrictions, such as +MS-DOS. + +bzip2 and +bunzip2 will by default not +overwrite existing files. If you want this to happen, specify +the -f flag. + +If no file names are specified, +bzip2 compresses from standard +input to standard output. In this case, +bzip2 will decline to write +compressed output to a terminal, as this would be entirely +incomprehensible and therefore pointless. + +bunzip2 (or +bzip2 -d) decompresses all +specified files. Files which were not created by +bzip2 will be detected and +ignored, and a warning issued. +bzip2 attempts to guess the +filename for the decompressed file from that of the compressed +file as follows: + + + + filename.bz2 + becomes + filename + + filename.bz + becomes + filename + + filename.tbz2 + becomes + filename.tar + + filename.tbz + becomes + filename.tar + + anyothername + becomes + anyothername.out + + + +If the file does not end in one of the recognised endings, +.bz2, +.bz, +.tbz2 or +.tbz, +bzip2 complains that it cannot +guess the name of the original file, and uses the original name +with .out appended. + +As with compression, supplying no filenames causes +decompression from standard input to standard output. + +bunzip2 will correctly +decompress a file which is the concatenation of two or more +compressed files. The result is the concatenation of the +corresponding uncompressed files. Integrity testing +(-t) of concatenated compressed +files is also supported. + +You can also compress or decompress files to the standard +output by giving the -c flag. +Multiple files may be compressed and decompressed like this. The +resulting outputs are fed sequentially to stdout. Compression of +multiple files in this manner generates a stream containing +multiple compressed file representations. Such a stream can be +decompressed correctly only by +bzip2 version 0.9.0 or later. +Earlier versions of bzip2 will +stop after decompressing the first file in the stream. + +bzcat (or +bzip2 -dc) decompresses all +specified files to the standard output. + +bzip2 will read arguments +from the environment variables +BZIP2 and +BZIP, in that order, and will +process them before any arguments read from the command line. +This gives a convenient way to supply default arguments. + +Compression is always performed, even if the compressed +file is slightly larger than the original. Files of less than +about one hundred bytes tend to get larger, since the compression +mechanism has a constant overhead in the region of 50 bytes. +Random data (including the output of most file compressors) is +coded at about 8.05 bits per byte, giving an expansion of around +0.5%. + +As a self-check for your protection, +bzip2 uses 32-bit CRCs to make +sure that the decompressed version of a file is identical to the +original. This guards against corruption of the compressed data, +and against undetected bugs in +bzip2 (hopefully very unlikely). +The chances of data corruption going undetected is microscopic, +about one chance in four billion for each file processed. Be +aware, though, that the check occurs upon decompression, so it +can only tell you that something is wrong. It can't help you +recover the original uncompressed data. You can use +bzip2recover to try to recover +data from damaged files. + +Return values: 0 for a normal exit, 1 for environmental +problems (file not found, invalid flags, I/O errors, etc.), 2 +to indicate a corrupt compressed file, 3 for an internal +consistency error (eg, bug) which caused +bzip2 to panic. + + + + + +OPTIONS + + + + + -c --stdout + Compress or decompress to standard + output. + + + + -d --decompress + Force decompression. + bzip2, + bunzip2 and + bzcat are really the same + program, and the decision about what actions to take is done on + the basis of which name is used. This flag overrides that + mechanism, and forces bzip2 to decompress. + + + + -z --compress + The complement to + -d: forces compression, + regardless of the invokation name. + + + + -t --test + Check integrity of the specified file(s), but + don't decompress them. This really performs a trial + decompression and throws away the result. + + + + -f --force + Force overwrite of output files. Normally, + bzip2 will not overwrite + existing output files. Also forces + bzip2 to break hard links to + files, which it otherwise wouldn't do. + bzip2 normally declines + to decompress files which don't have the correct magic header + bytes. If forced (-f), + however, it will pass such files through unmodified. This is + how GNU gzip behaves. + + + + + -k --keep + Keep (don't delete) input files during + compression or decompression. + + + + -s --small + Reduce memory usage, for compression, + decompression and testing. Files are decompressed and tested + using a modified algorithm which only requires 2.5 bytes per + block byte. This means any file can be decompressed in 2300k + of memory, albeit at about half the normal speed. + During compression, -s + selects a block size of 200k, which limits memory use to around + the same figure, at the expense of your compression ratio. In + short, if your machine is low on memory (8 megabytes or less), + use -s for everything. See + below. + + + + -q --quiet + Suppress non-essential warning messages. + Messages pertaining to I/O errors and other critical events + will not be suppressed. + + + + -v --verbose + Verbose mode -- show the compression ratio for + each file processed. Further + -v's increase the verbosity + level, spewing out lots of information which is primarily of + interest for diagnostic purposes. + + + + -L --license -V --version + Display the software version, license terms and + conditions. + + + + -1 (or + --fast) to + -9 (or + -best) + Set the block size to 100 k, 200 k ... 900 k + when compressing. Has no effect when decompressing. See below. The + --fast and + --best aliases are primarily + for GNU gzip compatibility. + In particular, --fast doesn't + make things significantly faster. And + --best merely selects the + default behaviour. + + + + -- + Treats all subsequent arguments as file names, + even if they start with a dash. This is so you can handle + files with names beginning with a dash, for example: + bzip2 -- + -myfilename. + + + + --repetitive-fast + --repetitive-best + These flags are redundant in versions 0.9.5 and + above. They provided some coarse control over the behaviour of + the sorting algorithm in earlier versions, which was sometimes + useful. 0.9.5 and above have an improved algorithm which + renders these flags irrelevant. + + + + + + + + +MEMORY MANAGEMENT + +bzip2 compresses large +files in blocks. The block size affects both the compression +ratio achieved, and the amount of memory needed for compression +and decompression. The flags -1 +through -9 specify the block +size to be 100,000 bytes through 900,000 bytes (the default) +respectively. At decompression time, the block size used for +compression is read from the header of the compressed file, and +bunzip2 then allocates itself +just enough memory to decompress the file. Since block sizes are +stored in compressed files, it follows that the flags +-1 to +-9 are irrelevant to and so +ignored during decompression. + +Compression and decompression requirements, in bytes, can be +estimated as: + +Compression: 400k + ( 8 x block size ) + +Decompression: 100k + ( 4 x block size ), or + 100k + ( 2.5 x block size ) + + +Larger block sizes give rapidly diminishing marginal +returns. Most of the compression comes from the first two or +three hundred k of block size, a fact worth bearing in mind when +using bzip2 on small machines. +It is also important to appreciate that the decompression memory +requirement is set at compression time by the choice of block +size. + +For files compressed with the default 900k block size, +bunzip2 will require about 3700 +kbytes to decompress. To support decompression of any file on a +4 megabyte machine, bunzip2 has +an option to decompress using approximately half this amount of +memory, about 2300 kbytes. Decompression speed is also halved, +so you should use this option only where necessary. The relevant +flag is -s. + +In general, try and use the largest block size memory +constraints allow, since that maximises the compression achieved. +Compression and decompression speed are virtually unaffected by +block size. + +Another significant point applies to files which fit in a +single block -- that means most files you'd encounter using a +large block size. The amount of real memory touched is +proportional to the size of the file, since the file is smaller +than a block. For example, compressing a file 20,000 bytes long +with the flag -9 will cause the +compressor to allocate around 7600k of memory, but only touch +400k + 20000 * 8 = 560 kbytes of it. Similarly, the decompressor +will allocate 3700k but only touch 100k + 20000 * 4 = 180 +kbytes. + +Here is a table which summarises the maximum memory usage +for different block sizes. Also recorded is the total compressed +size for 14 files of the Calgary Text Compression Corpus +totalling 3,141,622 bytes. This column gives some feel for how +compression varies with block size. These figures tend to +understate the advantage of larger block sizes for larger files, +since the Corpus is dominated by smaller files. + + + Compress Decompress Decompress Corpus +Flag usage usage -s usage Size + + -1 1200k 500k 350k 914704 + -2 2000k 900k 600k 877703 + -3 2800k 1300k 850k 860338 + -4 3600k 1700k 1100k 846899 + -5 4400k 2100k 1350k 845160 + -6 5200k 2500k 1600k 838626 + -7 6100k 2900k 1850k 834096 + -8 6800k 3300k 2100k 828642 + -9 7600k 3700k 2350k 828642 + + + + + + +RECOVERING DATA FROM DAMAGED FILES + +bzip2 compresses files in +blocks, usually 900kbytes long. Each block is handled +independently. If a media or transmission error causes a +multi-block .bz2 file to become +damaged, it may be possible to recover data from the undamaged +blocks in the file. + +The compressed representation of each block is delimited by +a 48-bit pattern, which makes it possible to find the block +boundaries with reasonable certainty. Each block also carries +its own 32-bit CRC, so damaged blocks can be distinguished from +undamaged ones. + +bzip2recover is a simple +program whose purpose is to search for blocks in +.bz2 files, and write each block +out into its own .bz2 file. You +can then use bzip2 -t to test +the integrity of the resulting files, and decompress those which +are undamaged. + +bzip2recover takes a +single argument, the name of the damaged file, and writes a +number of files rec0001file.bz2, +rec0002file.bz2, etc, containing +the extracted blocks. The output filenames are designed so that +the use of wildcards in subsequent processing -- for example, +bzip2 -dc rec*file.bz2 > +recovered_data -- lists the files in the correct +order. + +bzip2recover should be of +most use dealing with large .bz2 +files, as these will contain many blocks. It is clearly futile +to use it on damaged single-block files, since a damaged block +cannot be recovered. If you wish to minimise any potential data +loss through media or transmission errors, you might consider +compressing with a smaller block size. + + + + + +PERFORMANCE NOTES + +The sorting phase of compression gathers together similar +strings in the file. Because of this, files containing very long +runs of repeated symbols, like "aabaabaabaab ..." (repeated +several hundred times) may compress more slowly than normal. +Versions 0.9.5 and above fare much better than previous versions +in this respect. The ratio between worst-case and average-case +compression time is in the region of 10:1. For previous +versions, this figure was more like 100:1. You can use the +-vvvv option to monitor progress +in great detail, if you want. + +Decompression speed is unaffected by these +phenomena. + +bzip2 usually allocates +several megabytes of memory to operate in, and then charges all +over it in a fairly random fashion. This means that performance, +both for compressing and decompressing, is largely determined by +the speed at which your machine can service cache misses. +Because of this, small changes to the code to reduce the miss +rate have been observed to give disproportionately large +performance improvements. I imagine +bzip2 will perform best on +machines with very large caches. + + + + + + +CAVEATS + +I/O error messages are not as helpful as they could be. +bzip2 tries hard to detect I/O +errors and exit cleanly, but the details of what the problem is +sometimes seem rather misleading. + +This manual page pertains to version &bz-version; of +bzip2. Compressed data created by +this version is entirely forwards and backwards compatible with the +previous public releases, versions 0.1pl2, 0.9.0 and 0.9.5, 1.0.0, +1.0.1, 1.0.2 and 1.0.3, but with the following exception: 0.9.0 and +above can correctly decompress multiple concatenated compressed files. +0.1pl2 cannot do this; it will stop after decompressing just the first +file in the stream. + +bzip2recover versions +prior to 1.0.2 used 32-bit integers to represent bit positions in +compressed files, so it could not handle compressed files more +than 512 megabytes long. Versions 1.0.2 and above use 64-bit ints +on some platforms which support them (GNU supported targets, and +Windows). To establish whether or not +bzip2recover was built with such +a limitation, run it without arguments. In any event you can +build yourself an unlimited version if you can recompile it with +MaybeUInt64 set to be an +unsigned 64-bit integer. + + + + + + +AUTHOR + +Julian Seward, +&bz-email; + +The ideas embodied in +bzip2 are due to (at least) the +following people: Michael Burrows and David Wheeler (for the +block sorting transformation), David Wheeler (again, for the +Huffman coder), Peter Fenwick (for the structured coding model in +the original bzip, and many +refinements), and Alistair Moffat, Radford Neal and Ian Witten +(for the arithmetic coder in the original +bzip). I am much indebted for +their help, support and advice. See the manual in the source +distribution for pointers to sources of documentation. Christian +von Roques encouraged me to look for faster sorting algorithms, +so as to speed up compression. Bela Lubkin encouraged me to +improve the worst-case compression performance. +Donna Robinson XMLised the documentation. +Many people sent +patches, helped with portability problems, lent machines, gave +advice and were generally helpful. + + + + + + + + + +Programming with <computeroutput>libbzip2</computeroutput> + + +This chapter describes the programming interface to +libbzip2. + +For general background information, particularly about +memory use and performance aspects, you'd be well advised to read + as well. + + + +Top-level structure + +libbzip2 is a flexible +library for compressing and decompressing data in the +bzip2 data format. Although +packaged as a single entity, it helps to regard the library as +three separate parts: the low level interface, and the high level +interface, and some utility functions. + +The structure of +libbzip2's interfaces is similar +to that of Jean-loup Gailly's and Mark Adler's excellent +zlib library. + +All externally visible symbols have names beginning +BZ2_. This is new in version +1.0. The intention is to minimise pollution of the namespaces of +library clients. + +To use any part of the library, you need to +#include <bzlib.h> +into your sources. + + + + +Low-level summary + +This interface provides services for compressing and +decompressing data in memory. There's no provision for dealing +with files, streams or any other I/O mechanisms, just straight +memory-to-memory work. In fact, this part of the library can be +compiled without inclusion of +stdio.h, which may be helpful +for embedded applications. + +The low-level part of the library has no global variables +and is therefore thread-safe. + +Six routines make up the low level interface: +BZ2_bzCompressInit, +BZ2_bzCompress, and +BZ2_bzCompressEnd for +compression, and a corresponding trio +BZ2_bzDecompressInit, +BZ2_bzDecompress and +BZ2_bzDecompressEnd for +decompression. The *Init +functions allocate memory for compression/decompression and do +other initialisations, whilst the +*End functions close down +operations and release memory. + +The real work is done by +BZ2_bzCompress and +BZ2_bzDecompress. These +compress and decompress data from a user-supplied input buffer to +a user-supplied output buffer. These buffers can be any size; +arbitrary quantities of data are handled by making repeated calls +to these functions. This is a flexible mechanism allowing a +consumer-pull style of activity, or producer-push, or a mixture +of both. + + + + + +High-level summary + +This interface provides some handy wrappers around the +low-level interface to facilitate reading and writing +bzip2 format files +(.bz2 files). The routines +provide hooks to facilitate reading files in which the +bzip2 data stream is embedded +within some larger-scale file structure, or where there are +multiple bzip2 data streams +concatenated end-to-end. + +For reading files, +BZ2_bzReadOpen, +BZ2_bzRead, +BZ2_bzReadClose and +BZ2_bzReadGetUnused are +supplied. For writing files, +BZ2_bzWriteOpen, +BZ2_bzWrite and +BZ2_bzWriteFinish are +available. + +As with the low-level library, no global variables are used +so the library is per se thread-safe. However, if I/O errors +occur whilst reading or writing the underlying compressed files, +you may have to consult errno to +determine the cause of the error. In that case, you'd need a C +library which correctly supports +errno in a multithreaded +environment. + +To make the library a little simpler and more portable, +BZ2_bzReadOpen and +BZ2_bzWriteOpen require you to +pass them file handles (FILE*s) +which have previously been opened for reading or writing +respectively. That avoids portability problems associated with +file operations and file attributes, whilst not being much of an +imposition on the programmer. + + + + + +Utility functions summary + +For very simple needs, +BZ2_bzBuffToBuffCompress and +BZ2_bzBuffToBuffDecompress are +provided. These compress data in memory from one buffer to +another buffer in a single function call. You should assess +whether these functions fulfill your memory-to-memory +compression/decompression requirements before investing effort in +understanding the more general but more complex low-level +interface. + +Yoshioka Tsuneo +(tsuneo at rr.iij4u.or.jp) has +contributed some functions to give better +zlib compatibility. These +functions are BZ2_bzopen, +BZ2_bzread, +BZ2_bzwrite, +BZ2_bzflush, +BZ2_bzclose, +BZ2_bzerror and +BZ2_bzlibVersion. You may find +these functions more convenient for simple file reading and +writing, than those in the high-level interface. These functions +are not (yet) officially part of the library, and are minimally +documented here. If they break, you get to keep all the pieces. +I hope to document them properly when time permits. + +Yoshioka also contributed modifications to allow the +library to be built as a Windows DLL. + + + + + + + +Error handling + +The library is designed to recover cleanly in all +situations, including the worst-case situation of decompressing +random data. I'm not 100% sure that it can always do this, so +you might want to add a signal handler to catch segmentation +violations during decompression if you are feeling especially +paranoid. I would be interested in hearing more about the +robustness of the library to corrupted compressed data. + +Version 1.0.3 more robust in this respect than any +previous version. Investigations with Valgrind (a tool for detecting +problems with memory management) indicate +that, at least for the few files I tested, all single-bit errors +in the decompressed data are caught properly, with no +segmentation faults, no uses of uninitialised data, no out of +range reads or writes, and no infinite looping in the decompressor. +So it's certainly pretty robust, although +I wouldn't claim it to be totally bombproof. + +The file bzlib.h contains +all definitions needed to use the library. In particular, you +should definitely not include +bzlib_private.h. + +In bzlib.h, the various +return values are defined. The following list is not intended as +an exhaustive description of the circumstances in which a given +value may be returned -- those descriptions are given later. +Rather, it is intended to convey the rough meaning of each return +value. The first five actions are normal and not intended to +denote an error situation. + + + + + BZ_OK + The requested action was completed + successfully. + + + + BZ_RUN_OK, BZ_FLUSH_OK, + BZ_FINISH_OK + In + BZ2_bzCompress, the requested + flush/finish/nothing-special action was completed + successfully. + + + + BZ_STREAM_END + Compression of data was completed, or the + logical stream end was detected during + decompression. + + + + +The following return values indicate an error of some +kind. + + + + + BZ_CONFIG_ERROR + Indicates that the library has been improperly + compiled on your platform -- a major configuration error. + Specifically, it means that + sizeof(char), + sizeof(short) and + sizeof(int) are not 1, 2 and + 4 respectively, as they should be. Note that the library + should still work properly on 64-bit platforms which follow + the LP64 programming model -- that is, where + sizeof(long) and + sizeof(void*) are 8. Under + LP64, sizeof(int) is still 4, + so libbzip2, which doesn't + use the long type, is + OK. + + + + BZ_SEQUENCE_ERROR + When using the library, it is important to call + the functions in the correct sequence and with data structures + (buffers etc) in the correct states. + libbzip2 checks as much as it + can to ensure this is happening, and returns + BZ_SEQUENCE_ERROR if not. + Code which complies precisely with the function semantics, as + detailed below, should never receive this value; such an event + denotes buggy code which you should + investigate. + + + + BZ_PARAM_ERROR + Returned when a parameter to a function call is + out of range or otherwise manifestly incorrect. As with + BZ_SEQUENCE_ERROR, this + denotes a bug in the client code. The distinction between + BZ_PARAM_ERROR and + BZ_SEQUENCE_ERROR is a bit + hazy, but still worth making. + + + + BZ_MEM_ERROR + Returned when a request to allocate memory + failed. Note that the quantity of memory needed to decompress + a stream cannot be determined until the stream's header has + been read. So + BZ2_bzDecompress and + BZ2_bzRead may return + BZ_MEM_ERROR even though some + of the compressed data has been read. The same is not true + for compression; once + BZ2_bzCompressInit or + BZ2_bzWriteOpen have + successfully completed, + BZ_MEM_ERROR cannot + occur. + + + + BZ_DATA_ERROR + Returned when a data integrity error is + detected during decompression. Most importantly, this means + when stored and computed CRCs for the data do not match. This + value is also returned upon detection of any other anomaly in + the compressed data. + + + + BZ_DATA_ERROR_MAGIC + As a special case of + BZ_DATA_ERROR, it is + sometimes useful to know when the compressed stream does not + start with the correct magic bytes ('B' 'Z' + 'h'). + + + + BZ_IO_ERROR + Returned by + BZ2_bzRead and + BZ2_bzWrite when there is an + error reading or writing in the compressed file, and by + BZ2_bzReadOpen and + BZ2_bzWriteOpen for attempts + to use a file for which the error indicator (viz, + ferror(f)) is set. On + receipt of BZ_IO_ERROR, the + caller should consult errno + and/or perror to acquire + operating-system specific information about the + problem. + + + + BZ_UNEXPECTED_EOF + Returned by + BZ2_bzRead when the + compressed file finishes before the logical end of stream is + detected. + + + + BZ_OUTBUFF_FULL + Returned by + BZ2_bzBuffToBuffCompress and + BZ2_bzBuffToBuffDecompress to + indicate that the output data will not fit into the output + buffer provided. + + + + + + + + + +Low-level interface + + + +<computeroutput>BZ2_bzCompressInit</computeroutput> + + +typedef struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; +} bz_stream; + +int BZ2_bzCompressInit ( bz_stream *strm, + int blockSize100k, + int verbosity, + int workFactor ); + + +Prepares for compression. The +bz_stream structure holds all +data pertaining to the compression activity. A +bz_stream structure should be +allocated and initialised prior to the call. The fields of +bz_stream comprise the entirety +of the user-visible data. state +is a pointer to the private data structures required for +compression. + +Custom memory allocators are supported, via fields +bzalloc, +bzfree, and +opaque. The value +opaque is passed to as the first +argument to all calls to bzalloc +and bzfree, but is otherwise +ignored by the library. The call bzalloc ( +opaque, n, m ) is expected to return a pointer +p to n * +m bytes of memory, and bzfree ( +opaque, p ) should free that memory. + +If you don't want to use a custom memory allocator, set +bzalloc, +bzfree and +opaque to +NULL, and the library will then +use the standard malloc / +free routines. + +Before calling +BZ2_bzCompressInit, fields +bzalloc, +bzfree and +opaque should be filled +appropriately, as just described. Upon return, the internal +state will have been allocated and initialised, and +total_in_lo32, +total_in_hi32, +total_out_lo32 and +total_out_hi32 will have been +set to zero. These four fields are used by the library to inform +the caller of the total amount of data passed into and out of the +library, respectively. You should not try to change them. As of +version 1.0, 64-bit counts are maintained, even on 32-bit +platforms, using the _hi32 +fields to store the upper 32 bits of the count. So, for example, +the total amount of data in is (total_in_hi32 +<< 32) + total_in_lo32. + +Parameter blockSize100k +specifies the block size to be used for compression. It should +be a value between 1 and 9 inclusive, and the actual block size +used is 100000 x this figure. 9 gives the best compression but +takes most memory. + +Parameter verbosity should +be set to a number between 0 and 4 inclusive. 0 is silent, and +greater numbers give increasingly verbose monitoring/debugging +output. If the library has been compiled with +-DBZ_NO_STDIO, no such output +will appear for any verbosity setting. + +Parameter workFactor +controls how the compression phase behaves when presented with +worst case, highly repetitive, input data. If compression runs +into difficulties caused by repetitive data, the library switches +from the standard sorting algorithm to a fallback algorithm. The +fallback is slower than the standard algorithm by perhaps a +factor of three, but always behaves reasonably, no matter how bad +the input. + +Lower values of workFactor +reduce the amount of effort the standard algorithm will expend +before resorting to the fallback. You should set this parameter +carefully; too low, and many inputs will be handled by the +fallback algorithm and so compress rather slowly, too high, and +your average-to-worst case compression times can become very +large. The default value of 30 gives reasonable behaviour over a +wide range of circumstances. + +Allowable values range from 0 to 250 inclusive. 0 is a +special case, equivalent to using the default value of 30. + +Note that the compressed output generated is the same +regardless of whether or not the fallback algorithm is +used. + +Be aware also that this parameter may disappear entirely in +future versions of the library. In principle it should be +possible to devise a good way to automatically choose which +algorithm to use. Such a mechanism would render the parameter +obsolete. + +Possible return values: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if strm is NULL + or blockSize < 1 or blockSize > 9 + or verbosity < 0 or verbosity > 4 + or workFactor < 0 or workFactor > 250 +BZ_MEM_ERROR + if not enough memory is available +BZ_OK + otherwise + + +Allowable next actions: + + +BZ2_bzCompress + if BZ_OK is returned + no specific action needed in case of error + + + + + + +<computeroutput>BZ2_bzCompress</computeroutput> + + +int BZ2_bzCompress ( bz_stream *strm, int action ); + + +Provides more input and/or output buffer space for the +library. The caller maintains input and output buffers, and +calls BZ2_bzCompress to transfer +data between them. + +Before each call to +BZ2_bzCompress, +next_in should point at the data +to be compressed, and avail_in +should indicate how many bytes the library may read. +BZ2_bzCompress updates +next_in, +avail_in and +total_in to reflect the number +of bytes it has read. + +Similarly, next_out should +point to a buffer in which the compressed data is to be placed, +with avail_out indicating how +much output space is available. +BZ2_bzCompress updates +next_out, +avail_out and +total_out to reflect the number +of bytes output. + +You may provide and remove as little or as much data as you +like on each call of +BZ2_bzCompress. In the limit, +it is acceptable to supply and remove data one byte at a time, +although this would be terribly inefficient. You should always +ensure that at least one byte of output space is available at +each call. + +A second purpose of +BZ2_bzCompress is to request a +change of mode of the compressed stream. + +Conceptually, a compressed stream can be in one of four +states: IDLE, RUNNING, FLUSHING and FINISHING. Before +initialisation +(BZ2_bzCompressInit) and after +termination (BZ2_bzCompressEnd), +a stream is regarded as IDLE. + +Upon initialisation +(BZ2_bzCompressInit), the stream +is placed in the RUNNING state. Subsequent calls to +BZ2_bzCompress should pass +BZ_RUN as the requested action; +other actions are illegal and will result in +BZ_SEQUENCE_ERROR. + +At some point, the calling program will have provided all +the input data it wants to. It will then want to finish up -- in +effect, asking the library to process any data it might have +buffered internally. In this state, +BZ2_bzCompress will no longer +attempt to read data from +next_in, but it will want to +write data to next_out. Because +the output buffer supplied by the user can be arbitrarily small, +the finishing-up operation cannot necessarily be done with a +single call of +BZ2_bzCompress. + +Instead, the calling program passes +BZ_FINISH as an action to +BZ2_bzCompress. This changes +the stream's state to FINISHING. Any remaining input (ie, +next_in[0 .. avail_in-1]) is +compressed and transferred to the output buffer. To do this, +BZ2_bzCompress must be called +repeatedly until all the output has been consumed. At that +point, BZ2_bzCompress returns +BZ_STREAM_END, and the stream's +state is set back to IDLE. +BZ2_bzCompressEnd should then be +called. + +Just to make sure the calling program does not cheat, the +library makes a note of avail_in +at the time of the first call to +BZ2_bzCompress which has +BZ_FINISH as an action (ie, at +the time the program has announced its intention to not supply +any more input). By comparing this value with that of +avail_in over subsequent calls +to BZ2_bzCompress, the library +can detect any attempts to slip in more data to compress. Any +calls for which this is detected will return +BZ_SEQUENCE_ERROR. This +indicates a programming mistake which should be corrected. + +Instead of asking to finish, the calling program may ask +BZ2_bzCompress to take all the +remaining input, compress it and terminate the current +(Burrows-Wheeler) compression block. This could be useful for +error control purposes. The mechanism is analogous to that for +finishing: call BZ2_bzCompress +with an action of BZ_FLUSH, +remove output data, and persist with the +BZ_FLUSH action until the value +BZ_RUN is returned. As with +finishing, BZ2_bzCompress +detects any attempt to provide more input data once the flush has +begun. + +Once the flush is complete, the stream returns to the +normal RUNNING state. + +This all sounds pretty complex, but isn't really. Here's a +table which shows which actions are allowable in each state, what +action will be taken, what the next state is, and what the +non-error return values are. Note that you can't explicitly ask +what state the stream is in, but nor do you need to -- it can be +inferred from the values returned by +BZ2_bzCompress. + + +IDLE/any + Illegal. IDLE state only exists after BZ2_bzCompressEnd or + before BZ2_bzCompressInit. + Return value = BZ_SEQUENCE_ERROR + +RUNNING/BZ_RUN + Compress from next_in to next_out as much as possible. + Next state = RUNNING + Return value = BZ_RUN_OK + +RUNNING/BZ_FLUSH + Remember current value of next_in. Compress from next_in + to next_out as much as possible, but do not accept any more input. + Next state = FLUSHING + Return value = BZ_FLUSH_OK + +RUNNING/BZ_FINISH + Remember current value of next_in. Compress from next_in + to next_out as much as possible, but do not accept any more input. + Next state = FINISHING + Return value = BZ_FINISH_OK + +FLUSHING/BZ_FLUSH + Compress from next_in to next_out as much as possible, + but do not accept any more input. + If all the existing input has been used up and all compressed + output has been removed + Next state = RUNNING; Return value = BZ_RUN_OK + else + Next state = FLUSHING; Return value = BZ_FLUSH_OK + +FLUSHING/other + Illegal. + Return value = BZ_SEQUENCE_ERROR + +FINISHING/BZ_FINISH + Compress from next_in to next_out as much as possible, + but to not accept any more input. + If all the existing input has been used up and all compressed + output has been removed + Next state = IDLE; Return value = BZ_STREAM_END + else + Next state = FINISHING; Return value = BZ_FINISH_OK + +FINISHING/other + Illegal. + Return value = BZ_SEQUENCE_ERROR + + + +That still looks complicated? Well, fair enough. The +usual sequence of calls for compressing a load of data is: + + + + Get started with + BZ2_bzCompressInit. + + Shovel data in and shlurp out its compressed form + using zero or more calls of + BZ2_bzCompress with action = + BZ_RUN. + + Finish up. Repeatedly call + BZ2_bzCompress with action = + BZ_FINISH, copying out the + compressed output, until + BZ_STREAM_END is + returned. Close up and go home. Call + BZ2_bzCompressEnd. + + + +If the data you want to compress fits into your input +buffer all at once, you can skip the calls of +BZ2_bzCompress ( ..., BZ_RUN ) +and just do the BZ2_bzCompress ( ..., BZ_FINISH +) calls. + +All required memory is allocated by +BZ2_bzCompressInit. The +compression library can accept any data at all (obviously). So +you shouldn't get any error return values from the +BZ2_bzCompress calls. If you +do, they will be +BZ_SEQUENCE_ERROR, and indicate +a bug in your programming. + +Trivial other possible return values: + + +BZ_PARAM_ERROR + if strm is NULL, or strm->s is NULL + + + + + + +<computeroutput>BZ2_bzCompressEnd</computeroutput> + + +int BZ2_bzCompressEnd ( bz_stream *strm ); + + +Releases all memory associated with a compression +stream. + +Possible return values: + + +BZ_PARAM_ERROR if strm is NULL or strm->s is NULL +BZ_OK otherwise + + + + + + +<computeroutput>BZ2_bzDecompressInit</computeroutput> + + +int BZ2_bzDecompressInit ( bz_stream *strm, int verbosity, int small ); + + +Prepares for decompression. As with +BZ2_bzCompressInit, a +bz_stream record should be +allocated and initialised before the call. Fields +bzalloc, +bzfree and +opaque should be set if a custom +memory allocator is required, or made +NULL for the normal +malloc / +free routines. Upon return, the +internal state will have been initialised, and +total_in and +total_out will be zero. + +For the meaning of parameter +verbosity, see +BZ2_bzCompressInit. + +If small is nonzero, the +library will use an alternative decompression algorithm which +uses less memory but at the cost of decompressing more slowly +(roughly speaking, half the speed, but the maximum memory +requirement drops to around 2300k). See +for more information on memory management. + +Note that the amount of memory needed to decompress a +stream cannot be determined until the stream's header has been +read, so even if +BZ2_bzDecompressInit succeeds, a +subsequent BZ2_bzDecompress +could fail with +BZ_MEM_ERROR. + +Possible return values: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if ( small != 0 && small != 1 ) + or (verbosity <; 0 || verbosity > 4) +BZ_MEM_ERROR + if insufficient memory is available + + +Allowable next actions: + + +BZ2_bzDecompress + if BZ_OK was returned + no specific action required in case of error + + + + + + +<computeroutput>BZ2_bzDecompress</computeroutput> + + +int BZ2_bzDecompress ( bz_stream *strm ); + + +Provides more input and/out output buffer space for the +library. The caller maintains input and output buffers, and uses +BZ2_bzDecompress to transfer +data between them. + +Before each call to +BZ2_bzDecompress, +next_in should point at the +compressed data, and avail_in +should indicate how many bytes the library may read. +BZ2_bzDecompress updates +next_in, +avail_in and +total_in to reflect the number +of bytes it has read. + +Similarly, next_out should +point to a buffer in which the uncompressed output is to be +placed, with avail_out +indicating how much output space is available. +BZ2_bzCompress updates +next_out, +avail_out and +total_out to reflect the number +of bytes output. + +You may provide and remove as little or as much data as you +like on each call of +BZ2_bzDecompress. In the limit, +it is acceptable to supply and remove data one byte at a time, +although this would be terribly inefficient. You should always +ensure that at least one byte of output space is available at +each call. + +Use of BZ2_bzDecompress is +simpler than +BZ2_bzCompress. + +You should provide input and remove output as described +above, and repeatedly call +BZ2_bzDecompress until +BZ_STREAM_END is returned. +Appearance of BZ_STREAM_END +denotes that BZ2_bzDecompress +has detected the logical end of the compressed stream. +BZ2_bzDecompress will not +produce BZ_STREAM_END until all +output data has been placed into the output buffer, so once +BZ_STREAM_END appears, you are +guaranteed to have available all the decompressed output, and +BZ2_bzDecompressEnd can safely +be called. + +If case of an error return value, you should call +BZ2_bzDecompressEnd to clean up +and release memory. + +Possible return values: + + +BZ_PARAM_ERROR + if strm is NULL or strm->s is NULL + or strm->avail_out < 1 +BZ_DATA_ERROR + if a data integrity error is detected in the compressed stream +BZ_DATA_ERROR_MAGIC + if the compressed stream doesn't begin with the right magic bytes +BZ_MEM_ERROR + if there wasn't enough memory available +BZ_STREAM_END + if the logical end of the data stream was detected and all + output in has been consumed, eg s-->avail_out > 0 +BZ_OK + otherwise + + +Allowable next actions: + + +BZ2_bzDecompress + if BZ_OK was returned +BZ2_bzDecompressEnd + otherwise + + + + + + +<computeroutput>BZ2_bzDecompressEnd</computeroutput> + + +int BZ2_bzDecompressEnd ( bz_stream *strm ); + + +Releases all memory associated with a decompression +stream. + +Possible return values: + + +BZ_PARAM_ERROR + if strm is NULL or strm->s is NULL +BZ_OK + otherwise + + +Allowable next actions: + + + None. + + + + + + + + +High-level interface + +This interface provides functions for reading and writing +bzip2 format files. First, some +general points. + + + + All of the functions take an + int* first argument, + bzerror. After each call, + bzerror should be consulted + first to determine the outcome of the call. If + bzerror is + BZ_OK, the call completed + successfully, and only then should the return value of the + function (if any) be consulted. If + bzerror is + BZ_IO_ERROR, there was an + error reading/writing the underlying compressed file, and you + should then consult errno / + perror to determine the cause + of the difficulty. bzerror + may also be set to various other values; precise details are + given on a per-function basis below. + + If bzerror indicates + an error (ie, anything except + BZ_OK and + BZ_STREAM_END), you should + immediately call + BZ2_bzReadClose (or + BZ2_bzWriteClose, depending on + whether you are attempting to read or to write) to free up all + resources associated with the stream. Once an error has been + indicated, behaviour of all calls except + BZ2_bzReadClose + (BZ2_bzWriteClose) is + undefined. The implication is that (1) + bzerror should be checked + after each call, and (2) if + bzerror indicates an error, + BZ2_bzReadClose + (BZ2_bzWriteClose) should then + be called to clean up. + + The FILE* arguments + passed to BZ2_bzReadOpen / + BZ2_bzWriteOpen should be set + to binary mode. Most Unix systems will do this by default, but + other platforms, including Windows and Mac, will not. If you + omit this, you may encounter problems when moving code to new + platforms. + + Memory allocation requests are handled by + malloc / + free. At present there is no + facility for user-defined memory allocators in the file I/O + functions (could easily be added, though). + + + + + + +<computeroutput>BZ2_bzReadOpen</computeroutput> + + +typedef void BZFILE; + +BZFILE *BZ2_bzReadOpen( int *bzerror, FILE *f, + int verbosity, int small, + void *unused, int nUnused ); + + +Prepare to read compressed data from file handle +f. +f should refer to a file which +has been opened for reading, and for which the error indicator +(ferror(f))is not set. If +small is 1, the library will try +to decompress using less memory, at the expense of speed. + +For reasons explained below, +BZ2_bzRead will decompress the +nUnused bytes starting at +unused, before starting to read +from the file f. At most +BZ_MAX_UNUSED bytes may be +supplied like this. If this facility is not required, you should +pass NULL and +0 for +unused and +nUnused respectively. + +For the meaning of parameters +small and +verbosity, see +BZ2_bzDecompressInit. + +The amount of memory needed to decompress a file cannot be +determined until the file's header has been read. So it is +possible that BZ2_bzReadOpen +returns BZ_OK but a subsequent +call of BZ2_bzRead will return +BZ_MEM_ERROR. + +Possible assignments to +bzerror: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if f is NULL + or small is neither 0 nor 1 + or ( unused == NULL && nUnused != 0 ) + or ( unused != NULL && !(0 <= nUnused <= BZ_MAX_UNUSED) ) +BZ_IO_ERROR + if ferror(f) is nonzero +BZ_MEM_ERROR + if insufficient memory is available +BZ_OK + otherwise. + + +Possible return values: + + +Pointer to an abstract BZFILE + if bzerror is BZ_OK +NULL + otherwise + + +Allowable next actions: + + +BZ2_bzRead + if bzerror is BZ_OK +BZ2_bzClose + otherwise + + + + + + +<computeroutput>BZ2_bzRead</computeroutput> + + +int BZ2_bzRead ( int *bzerror, BZFILE *b, void *buf, int len ); + + +Reads up to len +(uncompressed) bytes from the compressed file +b into the buffer +buf. If the read was +successful, bzerror is set to +BZ_OK and the number of bytes +read is returned. If the logical end-of-stream was detected, +bzerror will be set to +BZ_STREAM_END, and the number of +bytes read is returned. All other +bzerror values denote an +error. + +BZ2_bzRead will supply +len bytes, unless the logical +stream end is detected or an error occurs. Because of this, it +is possible to detect the stream end by observing when the number +of bytes returned is less than the number requested. +Nevertheless, this is regarded as inadvisable; you should instead +check bzerror after every call +and watch out for +BZ_STREAM_END. + +Internally, BZ2_bzRead +copies data from the compressed file in chunks of size +BZ_MAX_UNUSED bytes before +decompressing it. If the file contains more bytes than strictly +needed to reach the logical end-of-stream, +BZ2_bzRead will almost certainly +read some of the trailing data before signalling +BZ_SEQUENCE_END. To collect the +read but unused data once +BZ_SEQUENCE_END has appeared, +call BZ2_bzReadGetUnused +immediately before +BZ2_bzReadClose. + +Possible assignments to +bzerror: + + +BZ_PARAM_ERROR + if b is NULL or buf is NULL or len < 0 +BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzWriteOpen +BZ_IO_ERROR + if there is an error reading from the compressed file +BZ_UNEXPECTED_EOF + if the compressed file ended before + the logical end-of-stream was detected +BZ_DATA_ERROR + if a data integrity error was detected in the compressed stream +BZ_DATA_ERROR_MAGIC + if the stream does not begin with the requisite header bytes + (ie, is not a bzip2 data file). This is really + a special case of BZ_DATA_ERROR. +BZ_MEM_ERROR + if insufficient memory was available +BZ_STREAM_END + if the logical end of stream was detected. +BZ_OK + otherwise. + + +Possible return values: + + +number of bytes read + if bzerror is BZ_OK or BZ_STREAM_END +undefined + otherwise + + +Allowable next actions: + + +collect data from buf, then BZ2_bzRead or BZ2_bzReadClose + if bzerror is BZ_OK +collect data from buf, then BZ2_bzReadClose or BZ2_bzReadGetUnused + if bzerror is BZ_SEQUENCE_END +BZ2_bzReadClose + otherwise + + + + + + +<computeroutput>BZ2_bzReadGetUnused</computeroutput> + + +void BZ2_bzReadGetUnused( int* bzerror, BZFILE *b, + void** unused, int* nUnused ); + + +Returns data which was read from the compressed file but +was not needed to get to the logical end-of-stream. +*unused is set to the address of +the data, and *nUnused to the +number of bytes. *nUnused will +be set to a value between 0 and +BZ_MAX_UNUSED inclusive. + +This function may only be called once +BZ2_bzRead has signalled +BZ_STREAM_END but before +BZ2_bzReadClose. + +Possible assignments to +bzerror: + + +BZ_PARAM_ERROR + if b is NULL + or unused is NULL or nUnused is NULL +BZ_SEQUENCE_ERROR + if BZ_STREAM_END has not been signalled + or if b was opened with BZ2_bzWriteOpen +BZ_OK + otherwise + + +Allowable next actions: + + +BZ2_bzReadClose + + + + + + +<computeroutput>BZ2_bzReadClose</computeroutput> + + +void BZ2_bzReadClose ( int *bzerror, BZFILE *b ); + + +Releases all memory pertaining to the compressed file +b. +BZ2_bzReadClose does not call +fclose on the underlying file +handle, so you should do that yourself if appropriate. +BZ2_bzReadClose should be called +to clean up after all error situations. + +Possible assignments to +bzerror: + + +BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzOpenWrite +BZ_OK + otherwise + + +Allowable next actions: + + +none + + + + + + +<computeroutput>BZ2_bzWriteOpen</computeroutput> + + +BZFILE *BZ2_bzWriteOpen( int *bzerror, FILE *f, + int blockSize100k, int verbosity, + int workFactor ); + + +Prepare to write compressed data to file handle +f. +f should refer to a file which +has been opened for writing, and for which the error indicator +(ferror(f))is not set. + +For the meaning of parameters +blockSize100k, +verbosity and +workFactor, see +BZ2_bzCompressInit. + +All required memory is allocated at this stage, so if the +call completes successfully, +BZ_MEM_ERROR cannot be signalled +by a subsequent call to +BZ2_bzWrite. + +Possible assignments to +bzerror: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if f is NULL + or blockSize100k < 1 or blockSize100k > 9 +BZ_IO_ERROR + if ferror(f) is nonzero +BZ_MEM_ERROR + if insufficient memory is available +BZ_OK + otherwise + + +Possible return values: + + +Pointer to an abstract BZFILE + if bzerror is BZ_OK +NULL + otherwise + + +Allowable next actions: + + +BZ2_bzWrite + if bzerror is BZ_OK + (you could go directly to BZ2_bzWriteClose, but this would be pretty pointless) +BZ2_bzWriteClose + otherwise + + + + + + +<computeroutput>BZ2_bzWrite</computeroutput> + + +void BZ2_bzWrite ( int *bzerror, BZFILE *b, void *buf, int len ); + + +Absorbs len bytes from the +buffer buf, eventually to be +compressed and written to the file. + +Possible assignments to +bzerror: + + +BZ_PARAM_ERROR + if b is NULL or buf is NULL or len < 0 +BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzReadOpen +BZ_IO_ERROR + if there is an error writing the compressed file. +BZ_OK + otherwise + + + + + + +<computeroutput>BZ2_bzWriteClose</computeroutput> + + +void BZ2_bzWriteClose( int *bzerror, BZFILE* f, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out ); + +void BZ2_bzWriteClose64( int *bzerror, BZFILE* f, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 ); + + +Compresses and flushes to the compressed file all data so +far supplied by BZ2_bzWrite. +The logical end-of-stream markers are also written, so subsequent +calls to BZ2_bzWrite are +illegal. All memory associated with the compressed file +b is released. +fflush is called on the +compressed file, but it is not +fclose'd. + +If BZ2_bzWriteClose is +called to clean up after an error, the only action is to release +the memory. The library records the error codes issued by +previous calls, so this situation will be detected automatically. +There is no attempt to complete the compression operation, nor to +fflush the compressed file. You +can force this behaviour to happen even in the case of no error, +by passing a nonzero value to +abandon. + +If nbytes_in is non-null, +*nbytes_in will be set to be the +total volume of uncompressed data handled. Similarly, +nbytes_out will be set to the +total volume of compressed data written. For compatibility with +older versions of the library, +BZ2_bzWriteClose only yields the +lower 32 bits of these counts. Use +BZ2_bzWriteClose64 if you want +the full 64 bit counts. These two functions are otherwise +absolutely identical. + +Possible assignments to +bzerror: + + +BZ_SEQUENCE_ERROR + if b was opened with BZ2_bzReadOpen +BZ_IO_ERROR + if there is an error writing the compressed file +BZ_OK + otherwise + + + + + + +Handling embedded compressed data streams + +The high-level library facilitates use of +bzip2 data streams which form +some part of a surrounding, larger data stream. + + + + For writing, the library takes an open file handle, + writes compressed data to it, + fflushes it but does not + fclose it. The calling + application can write its own data before and after the + compressed data stream, using that same file handle. + + Reading is more complex, and the facilities are not as + general as they could be since generality is hard to reconcile + with efficiency. BZ2_bzRead + reads from the compressed file in blocks of size + BZ_MAX_UNUSED bytes, and in + doing so probably will overshoot the logical end of compressed + stream. To recover this data once decompression has ended, + call BZ2_bzReadGetUnused after + the last call of BZ2_bzRead + (the one returning + BZ_STREAM_END) but before + calling + BZ2_bzReadClose. + + + +This mechanism makes it easy to decompress multiple +bzip2 streams placed end-to-end. +As the end of one stream, when +BZ2_bzRead returns +BZ_STREAM_END, call +BZ2_bzReadGetUnused to collect +the unused data (copy it into your own buffer somewhere). That +data forms the start of the next compressed stream. To start +uncompressing that next stream, call +BZ2_bzReadOpen again, feeding in +the unused data via the unused / +nUnused parameters. Keep doing +this until BZ_STREAM_END return +coincides with the physical end of file +(feof(f)). In this situation +BZ2_bzReadGetUnused will of +course return no data. + +This should give some feel for how the high-level interface +can be used. If you require extra flexibility, you'll have to +bite the bullet and get to grips with the low-level +interface. + + + + + +Standard file-reading/writing code + +Here's how you'd write data to a compressed file: + + +FILE* f; +BZFILE* b; +int nBuf; +char buf[ /* whatever size you like */ ]; +int bzerror; +int nWritten; + +f = fopen ( "myfile.bz2", "w" ); +if ( !f ) { + /* handle error */ +} +b = BZ2_bzWriteOpen( &bzerror, f, 9 ); +if (bzerror != BZ_OK) { + BZ2_bzWriteClose ( b ); + /* handle error */ +} + +while ( /* condition */ ) { + /* get data to write into buf, and set nBuf appropriately */ + nWritten = BZ2_bzWrite ( &bzerror, b, buf, nBuf ); + if (bzerror == BZ_IO_ERROR) { + BZ2_bzWriteClose ( &bzerror, b ); + /* handle error */ + } +} + +BZ2_bzWriteClose( &bzerror, b ); +if (bzerror == BZ_IO_ERROR) { + /* handle error */ +} + + +And to read from a compressed file: + + +FILE* f; +BZFILE* b; +int nBuf; +char buf[ /* whatever size you like */ ]; +int bzerror; +int nWritten; + +f = fopen ( "myfile.bz2", "r" ); +if ( !f ) { + /* handle error */ +} +b = BZ2_bzReadOpen ( &bzerror, f, 0, NULL, 0 ); +if ( bzerror != BZ_OK ) { + BZ2_bzReadClose ( &bzerror, b ); + /* handle error */ +} + +bzerror = BZ_OK; +while ( bzerror == BZ_OK && /* arbitrary other conditions */) { + nBuf = BZ2_bzRead ( &bzerror, b, buf, /* size of buf */ ); + if ( bzerror == BZ_OK ) { + /* do something with buf[0 .. nBuf-1] */ + } +} +if ( bzerror != BZ_STREAM_END ) { + BZ2_bzReadClose ( &bzerror, b ); + /* handle error */ +} else { + BZ2_bzReadClose ( &bzerror, b ); +} + + + + + + + + +Utility functions + + + +<computeroutput>BZ2_bzBuffToBuffCompress</computeroutput> + + +int BZ2_bzBuffToBuffCompress( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor ); + + +Attempts to compress the data in source[0 +.. sourceLen-1] into the destination buffer, +dest[0 .. *destLen-1]. If the +destination buffer is big enough, +*destLen is set to the size of +the compressed data, and BZ_OK +is returned. If the compressed data won't fit, +*destLen is unchanged, and +BZ_OUTBUFF_FULL is +returned. + +Compression in this manner is a one-shot event, done with a +single call to this function. The resulting compressed data is a +complete bzip2 format data +stream. There is no mechanism for making additional calls to +provide extra input data. If you want that kind of mechanism, +use the low-level interface. + +For the meaning of parameters +blockSize100k, +verbosity and +workFactor, see +BZ2_bzCompressInit. + +To guarantee that the compressed data will fit in its +buffer, allocate an output buffer of size 1% larger than the +uncompressed data, plus six hundred extra bytes. + +BZ2_bzBuffToBuffDecompress +will not write data at or beyond +dest[*destLen], even in case of +buffer overflow. + +Possible return values: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if dest is NULL or destLen is NULL + or blockSize100k < 1 or blockSize100k > 9 + or verbosity < 0 or verbosity > 4 + or workFactor < 0 or workFactor > 250 +BZ_MEM_ERROR + if insufficient memory is available +BZ_OUTBUFF_FULL + if the size of the compressed data exceeds *destLen +BZ_OK + otherwise + + + + + + +<computeroutput>BZ2_bzBuffToBuffDecompress</computeroutput> + + +int BZ2_bzBuffToBuffDecompress( char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity ); + + +Attempts to decompress the data in source[0 +.. sourceLen-1] into the destination buffer, +dest[0 .. *destLen-1]. If the +destination buffer is big enough, +*destLen is set to the size of +the uncompressed data, and BZ_OK +is returned. If the compressed data won't fit, +*destLen is unchanged, and +BZ_OUTBUFF_FULL is +returned. + +source is assumed to hold +a complete bzip2 format data +stream. +BZ2_bzBuffToBuffDecompress tries +to decompress the entirety of the stream into the output +buffer. + +For the meaning of parameters +small and +verbosity, see +BZ2_bzDecompressInit. + +Because the compression ratio of the compressed data cannot +be known in advance, there is no easy way to guarantee that the +output buffer will be big enough. You may of course make +arrangements in your code to record the size of the uncompressed +data, but such a mechanism is beyond the scope of this +library. + +BZ2_bzBuffToBuffDecompress +will not write data at or beyond +dest[*destLen], even in case of +buffer overflow. + +Possible return values: + + +BZ_CONFIG_ERROR + if the library has been mis-compiled +BZ_PARAM_ERROR + if dest is NULL or destLen is NULL + or small != 0 && small != 1 + or verbosity < 0 or verbosity > 4 +BZ_MEM_ERROR + if insufficient memory is available +BZ_OUTBUFF_FULL + if the size of the compressed data exceeds *destLen +BZ_DATA_ERROR + if a data integrity error was detected in the compressed data +BZ_DATA_ERROR_MAGIC + if the compressed data doesn't begin with the right magic bytes +BZ_UNEXPECTED_EOF + if the compressed data ends unexpectedly +BZ_OK + otherwise + + + + + + + + +<computeroutput>zlib</computeroutput> compatibility functions + +Yoshioka Tsuneo has contributed some functions to give +better zlib compatibility. +These functions are BZ2_bzopen, +BZ2_bzread, +BZ2_bzwrite, +BZ2_bzflush, +BZ2_bzclose, +BZ2_bzerror and +BZ2_bzlibVersion. These +functions are not (yet) officially part of the library. If they +break, you get to keep all the pieces. Nevertheless, I think +they work ok. + + +typedef void BZFILE; + +const char * BZ2_bzlibVersion ( void ); + + +Returns a string indicating the library version. + + +BZFILE * BZ2_bzopen ( const char *path, const char *mode ); +BZFILE * BZ2_bzdopen ( int fd, const char *mode ); + + +Opens a .bz2 file for +reading or writing, using either its name or a pre-existing file +descriptor. Analogous to fopen +and fdopen. + + +int BZ2_bzread ( BZFILE* b, void* buf, int len ); +int BZ2_bzwrite ( BZFILE* b, void* buf, int len ); + + +Reads/writes data from/to a previously opened +BZFILE. Analogous to +fread and +fwrite. + + +int BZ2_bzflush ( BZFILE* b ); +void BZ2_bzclose ( BZFILE* b ); + + +Flushes/closes a BZFILE. +BZ2_bzflush doesn't actually do +anything. Analogous to fflush +and fclose. + + +const char * BZ2_bzerror ( BZFILE *b, int *errnum ) + + +Returns a string describing the more recent error status of +b, and also sets +*errnum to its numerical +value. + + + + + +Using the library in a <computeroutput>stdio</computeroutput>-free environment + + + +Getting rid of <computeroutput>stdio</computeroutput> + +In a deeply embedded application, you might want to use +just the memory-to-memory functions. You can do this +conveniently by compiling the library with preprocessor symbol +BZ_NO_STDIO defined. Doing this +gives you a library containing only the following eight +functions: + +BZ2_bzCompressInit, +BZ2_bzCompress, +BZ2_bzCompressEnd +BZ2_bzDecompressInit, +BZ2_bzDecompress, +BZ2_bzDecompressEnd +BZ2_bzBuffToBuffCompress, +BZ2_bzBuffToBuffDecompress + +When compiled like this, all functions will ignore +verbosity settings. + + + + + +Critical error handling + +libbzip2 contains a number +of internal assertion checks which should, needless to say, never +be activated. Nevertheless, if an assertion should fail, +behaviour depends on whether or not the library was compiled with +BZ_NO_STDIO set. + +For a normal compile, an assertion failure yields the +message: + +
+bzip2/libbzip2: internal error number N. +This is a bug in bzip2/libbzip2, &bz-version; of &bz-date;. +Please report it to me at: &bz-email;. If this happened +when you were using some program which uses libbzip2 as a +component, you should also report this bug to the author(s) +of that program. Please make an effort to report this bug; +timely and accurate bug reports eventually lead to higher +quality software. Thanks. Julian Seward, &bz-date;. +
+ +where N is some error code +number. If N == 1007, it also +prints some extra text advising the reader that unreliable memory +is often associated with internal error 1007. (This is a +frequently-observed-phenomenon with versions 1.0.0/1.0.1). + +exit(3) is then +called. + +For a stdio-free library, +assertion failures result in a call to a function declared +as: + + +extern void bz_internal_error ( int errcode ); + + +The relevant code is passed as a parameter. You should +supply such a function. + +In either case, once an assertion failure has occurred, any +bz_stream records involved can +be regarded as invalid. You should not attempt to resume normal +operation with them. + +You may, of course, change critical error handling to suit +your needs. As I said above, critical errors indicate bugs in +the library and should not occur. All "normal" error situations +are indicated via error return codes from functions, and can be +recovered from. + +
+ +
+ + + +Making a Windows DLL + +Everything related to Windows has been contributed by +Yoshioka Tsuneo +(tsuneo at rr.iij4u.or.jp), so +you should send your queries to him (but perhaps Cc: me, +&bz-email;). + +My vague understanding of what to do is: using Visual C++ +5.0, open the project file +libbz2.dsp, and build. That's +all. + +If you can't open the project file for some reason, make a +new one, naming these files: +blocksort.c, +bzlib.c, +compress.c, +crctable.c, +decompress.c, +huffman.c, +randtable.c and +libbz2.def. You will also need +to name the header files bzlib.h +and bzlib_private.h. + +If you don't use VC++, you may need to define the +proprocessor symbol +_WIN32. + +Finally, dlltest.c is a +sample program using the DLL. It has a project file, +dlltest.dsp. + +If you just want a makefile for Visual C, have a look at +makefile.msc. + +Be aware that if you compile +bzip2 itself on Win32, you must +set BZ_UNIX to 0 and +BZ_LCCWIN32 to 1, in the file +bzip2.c, before compiling. +Otherwise the resulting binary won't work correctly. + +I haven't tried any of this stuff myself, but it all looks +plausible. + + + +
+ + + + +Miscellanea + +These are just some random thoughts of mine. Your mileage +may vary. + + + +Limitations of the compressed file format + +bzip2-1.0.X, +0.9.5 and +0.9.0 use exactly the same file +format as the original version, +bzip2-0.1. This decision was +made in the interests of stability. Creating yet another +incompatible compressed file format would create further +confusion and disruption for users. + +Nevertheless, this is not a painless decision. Development +work since the release of +bzip2-0.1 in August 1997 has +shown complexities in the file format which slow down +decompression and, in retrospect, are unnecessary. These +are: + + + + The run-length encoder, which is the first of the + compression transformations, is entirely irrelevant. The + original purpose was to protect the sorting algorithm from the + very worst case input: a string of repeated symbols. But + algorithm steps Q6a and Q6b in the original Burrows-Wheeler + technical report (SRC-124) show how repeats can be handled + without difficulty in block sorting. + + The randomisation mechanism doesn't really need to be + there. Udi Manber and Gene Myers published a suffix array + construction algorithm a few years back, which can be employed + to sort any block, no matter how repetitive, in O(N log N) + time. Subsequent work by Kunihiko Sadakane has produced a + derivative O(N (log N)^2) algorithm which usually outperforms + the Manber-Myers algorithm. + + I could have changed to Sadakane's algorithm, but I find + it to be slower than bzip2's + existing algorithm for most inputs, and the randomisation + mechanism protects adequately against bad cases. I didn't + think it was a good tradeoff to make. Partly this is due to + the fact that I was not flooded with email complaints about + bzip2-0.1's performance on + repetitive data, so perhaps it isn't a problem for real + inputs. + + Probably the best long-term solution, and the one I have + incorporated into 0.9.5 and above, is to use the existing + sorting algorithm initially, and fall back to a O(N (log N)^2) + algorithm if the standard algorithm gets into + difficulties. + + The compressed file format was never designed to be + handled by a library, and I have had to jump though some hoops + to produce an efficient implementation of decompression. It's + a bit hairy. Try passing + decompress.c through the C + preprocessor and you'll see what I mean. Much of this + complexity could have been avoided if the compressed size of + each block of data was recorded in the data stream. + + An Adler-32 checksum, rather than a CRC32 checksum, + would be faster to compute. + + + +It would be fair to say that the +bzip2 format was frozen before I +properly and fully understood the performance consequences of +doing so. + +Improvements which I was able to incorporate into 0.9.0, +despite using the same file format, are: + + + + Single array implementation of the inverse BWT. This + significantly speeds up decompression, presumably because it + reduces the number of cache misses. + + Faster inverse MTF transform for large MTF values. + The new implementation is based on the notion of sliding blocks + of values. + + bzip2-0.9.0 now reads + and writes files with fread + and fwrite; version 0.1 used + putc and + getc. Duh! Well, you live + and learn. + + + +Further ahead, it would be nice to be able to do random +access into files. This will require some careful design of +compressed file formats. + + + + + +Portability issues + +After some consideration, I have decided not to use GNU +autoconf to configure 0.9.5 or +1.0. + +autoconf, admirable and +wonderful though it is, mainly assists with portability problems +between Unix-like platforms. But +bzip2 doesn't have much in the +way of portability problems on Unix; most of the difficulties +appear when porting to the Mac, or to Microsoft's operating +systems. autoconf doesn't help +in those cases, and brings in a whole load of new +complexity. + +Most people should be able to compile the library and +program under Unix straight out-of-the-box, so to speak, +especially if you have a version of GNU C available. + +There are a couple of +__inline__ directives in the +code. GNU C (gcc) should be +able to handle them. If you're not using GNU C, your C compiler +shouldn't see them at all. If your compiler does, for some +reason, see them and doesn't like them, just +#define +__inline__ to be +/* */. One easy way to do this +is to compile with the flag +-D__inline__=, which should be +understood by most Unix compilers. + +If you still have difficulties, try compiling with the +macro BZ_STRICT_ANSI defined. +This should enable you to build the library in a strictly ANSI +compliant environment. Building the program itself like this is +dangerous and not supported, since you remove +bzip2's checks against +compressing directories, symbolic links, devices, and other +not-really-a-file entities. This could cause filesystem +corruption! + +One other thing: if you create a +bzip2 binary for public distribution, +please consider linking it statically (gcc +-static). This avoids all sorts of library-version +issues that others may encounter later on. + +If you build bzip2 on +Win32, you must set BZ_UNIX to 0 +and BZ_LCCWIN32 to 1, in the +file bzip2.c, before compiling. +Otherwise the resulting binary won't work correctly. + + + + + +Reporting bugs + +I tried pretty hard to make sure +bzip2 is bug free, both by +design and by testing. Hopefully you'll never need to read this +section for real. + +Nevertheless, if bzip2 dies +with a segmentation fault, a bus error or an internal assertion +failure, it will ask you to email me a bug report. Experience from +years of feedback of bzip2 users indicates that almost all these +problems can be traced to either compiler bugs or hardware +problems. + + + + Recompile the program with no optimisation, and + see if it works. And/or try a different compiler. I heard all + sorts of stories about various flavours of GNU C (and other + compilers) generating bad code for + bzip2, and I've run across two + such examples myself. + + 2.7.X versions of GNU C are known to generate bad code + from time to time, at high optimisation levels. If you get + problems, try using the flags + -O2 + -fomit-frame-pointer + -fno-strength-reduce. You + should specifically not use + -funroll-loops. + + You may notice that the Makefile runs six tests as part + of the build process. If the program passes all of these, it's + a pretty good (but not 100%) indication that the compiler has + done its job correctly. + + If bzip2 + crashes randomly, and the crashes are not repeatable, you may + have a flaky memory subsystem. + bzip2 really hammers your + memory hierarchy, and if it's a bit marginal, you may get these + problems. Ditto if your disk or I/O subsystem is slowly + failing. Yup, this really does happen. + + Try using a different machine of the same type, and see + if you can repeat the problem. + + This isn't really a bug, but ... If + bzip2 tells you your file is + corrupted on decompression, and you obtained the file via FTP, + there is a possibility that you forgot to tell FTP to do a + binary mode transfer. That absolutely will cause the file to + be non-decompressible. You'll have to transfer it + again. + + + +If you've incorporated +libbzip2 into your own program +and are getting problems, please, please, please, check that the +parameters you are passing in calls to the library, are correct, +and in accordance with what the documentation says is allowable. +I have tried to make the library robust against such problems, +but I'm sure I haven't succeeded. + +Finally, if the above comments don't help, you'll have to +send me a bug report. Now, it's just amazing how many people +will send me a bug report saying something like: + + +bzip2 crashed with segmentation fault on my machine + + +and absolutely nothing else. Needless to say, a such a +report is totally, utterly, completely and +comprehensively 100% useless; a waste of your time, my time, and +net bandwidth. With no details at all, there's no way +I can possibly begin to figure out what the problem is. + +The rules of the game are: facts, facts, facts. Don't omit +them because "oh, they won't be relevant". At the bare +minimum: + + +Machine type. Operating system version. +Exact version of bzip2 (do bzip2 -V). +Exact version of the compiler used. +Flags passed to the compiler. + + +However, the most important single thing that will help me +is the file that you were trying to compress or decompress at the +time the problem happened. Without that, my ability to do +anything more than speculate about the cause, is limited. + + + + + +Did you get the right package? + +bzip2 is a resource hog. +It soaks up large amounts of CPU cycles and memory. Also, it +gives very large latencies. In the worst case, you can feed many +megabytes of uncompressed data into the library before getting +any compressed output, so this probably rules out applications +requiring interactive behaviour. + +These aren't faults of my implementation, I hope, but more +an intrinsic property of the Burrows-Wheeler transform +(unfortunately). Maybe this isn't what you want. + +If you want a compressor and/or library which is faster, +uses less memory but gets pretty good compression, and has +minimal latency, consider Jean-loup Gailly's and Mark Adler's +work, zlib-1.2.1 and +gzip-1.2.4. Look for them at +http://www.zlib.org and +http://www.gzip.org +respectively. + +For something faster and lighter still, you might try Markus F +X J Oberhumer's LZO real-time +compression/decompression library, at +http://www.oberhumer.com/opensource. + + + + + + +Further Reading + +bzip2 is not research +work, in the sense that it doesn't present any new ideas. +Rather, it's an engineering exercise based on existing +ideas. + +Four documents describe essentially all the ideas behind +bzip2: + +Michael Burrows and D. J. Wheeler: + "A block-sorting lossless data compression algorithm" + 10th May 1994. + Digital SRC Research Report 124. + ftp://ftp.digital.com/pub/DEC/SRC/research-reports/SRC-124.ps.gz + If you have trouble finding it, try searching at the + New Zealand Digital Library, http://www.nzdl.org. + +Daniel S. Hirschberg and Debra A. LeLewer + "Efficient Decoding of Prefix Codes" + Communications of the ACM, April 1990, Vol 33, Number 4. + You might be able to get an electronic copy of this + from the ACM Digital Library. + +David J. Wheeler + Program bred3.c and accompanying document bred3.ps. + This contains the idea behind the multi-table Huffman coding scheme. + ftp://ftp.cl.cam.ac.uk/users/djw3/ + +Jon L. Bentley and Robert Sedgewick + "Fast Algorithms for Sorting and Searching Strings" + Available from Sedgewick's web page, + www.cs.princeton.edu/~rs + + +The following paper gives valuable additional insights into +the algorithm, but is not immediately the basis of any code used +in bzip2. + +Peter Fenwick: + Block Sorting Text Compression + Proceedings of the 19th Australasian Computer Science Conference, + Melbourne, Australia. Jan 31 - Feb 2, 1996. + ftp://ftp.cs.auckland.ac.nz/pub/peter-f/ACSC96paper.ps + +Kunihiko Sadakane's sorting algorithm, mentioned above, is +available from: + +http://naomi.is.s.u-tokyo.ac.jp/~sada/papers/Sada98b.ps.gz + + +The Manber-Myers suffix array construction algorithm is +described in a paper available from: + +http://www.cs.arizona.edu/people/gene/PAPERS/suffix.ps + + +Finally, the following papers document some +investigations I made into the performance of sorting +and decompression algorithms: + +Julian Seward + On the Performance of BWT Sorting Algorithms + Proceedings of the IEEE Data Compression Conference 2000 + Snowbird, Utah. 28-30 March 2000. + +Julian Seward + Space-time Tradeoffs in the Inverse B-W Transform + Proceedings of the IEEE Data Compression Conference 2001 + Snowbird, Utah. 27-29 March 2001. + + + + + + +
Added: projects/external/bzip2-1.0.5/mk251.c ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/mk251.c Fri Jun 13 19:13:07 2008 @@ -0,0 +1,31 @@ + +/* Spew out a long sequence of the byte 251. When fed to bzip2 + versions 1.0.0 or 1.0.1, causes it to die with internal error + 1007 in blocksort.c. This assertion misses an extremely rare + case, which is fixed in this version (1.0.2) and above. +*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include + +int main () +{ + int i; + for (i = 0; i < 48500000 ; i++) + putchar(251); + return 0; +} Added: projects/external/bzip2-1.0.5/randtable.c ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/randtable.c Fri Jun 13 19:13:07 2008 @@ -0,0 +1,84 @@ + +/*-------------------------------------------------------------*/ +/*--- Table for randomising repetitive blocks ---*/ +/*--- randtable.c ---*/ +/*-------------------------------------------------------------*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include "bzlib_private.h" + + +/*---------------------------------------------*/ +Int32 BZ2_rNums[512] = { + 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, + 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, + 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, + 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, + 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, + 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, + 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, + 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, + 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, + 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, + 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, + 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, + 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, + 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, + 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, + 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, + 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, + 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, + 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, + 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, + 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, + 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, + 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, + 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, + 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, + 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, + 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, + 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, + 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, + 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, + 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, + 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, + 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, + 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, + 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, + 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, + 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, + 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, + 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, + 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, + 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, + 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, + 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, + 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, + 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, + 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, + 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, + 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, + 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, + 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, + 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, + 936, 638 +}; + + +/*-------------------------------------------------------------*/ +/*--- end randtable.c ---*/ +/*-------------------------------------------------------------*/ Added: projects/external/bzip2-1.0.5/sample1.bz2 ============================================================================== Binary file. No diff available. Added: projects/external/bzip2-1.0.5/sample1.ref ============================================================================== Binary file. No diff available. Added: projects/external/bzip2-1.0.5/sample2.bz2 ============================================================================== Binary file. No diff available. Added: projects/external/bzip2-1.0.5/sample2.ref ============================================================================== Binary file. No diff available. Added: projects/external/bzip2-1.0.5/sample3.bz2 ============================================================================== Binary file. No diff available. Added: projects/external/bzip2-1.0.5/sample3.ref ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/sample3.ref Fri Jun 13 19:13:07 2008 @@ -0,0 +1,30007 @@ +This file is exceedingly boring. If you find yourself +reading it, please (1) take it from me that you can safely +guess what the rest of the file says, and (2) seek professional +help. + +ps. there are no further sarcastic remarks in this file. + +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh +ugh Added: projects/external/bzip2-1.0.5/spewG.c ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/spewG.c Fri Jun 13 19:13:07 2008 @@ -0,0 +1,54 @@ + +/* spew out a thoroughly gigantic file designed so that bzip2 + can compress it reasonably rapidly. This is to help test + support for large files (> 2GB) in a reasonable amount of time. + I suggest you use the undocumented --exponential option to + bzip2 when compressing the resulting file; this saves a bit of + time. Note: *don't* bother with --exponential when compressing + Real Files; it'll just waste a lot of CPU time :-) + (but is otherwise harmless). +*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#define _FILE_OFFSET_BITS 64 + +#include +#include + +/* The number of megabytes of junk to spew out (roughly) */ +#define MEGABYTES 5000 + +#define N_BUF 1000000 +char buf[N_BUF]; + +int main ( int argc, char** argv ) +{ + int ii, kk, p; + srandom(1); + setbuffer ( stdout, buf, N_BUF ); + for (kk = 0; kk < MEGABYTES * 515; kk+=3) { + p = 25+random()%50; + for (ii = 0; ii < p; ii++) + printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); + for (ii = 0; ii < p-1; ii++) + printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ); + for (ii = 0; ii < p+1; ii++) + printf ( "ccccccccccccccccccccccccccccccccccccc" ); + } + fflush(stdout); + return 0; +} Added: projects/external/bzip2-1.0.5/unzcrash.c ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/unzcrash.c Fri Jun 13 19:13:07 2008 @@ -0,0 +1,141 @@ + +/* A test program written to test robustness to decompression of + corrupted data. Usage is + unzcrash filename + and the program will read the specified file, compress it (in memory), + and then repeatedly decompress it, each time with a different bit of + the compressed data inverted, so as to test all possible one-bit errors. + This should not cause any invalid memory accesses. If it does, + I want to know about it! + + PS. As you can see from the above description, the process is + incredibly slow. A file of size eg 5KB will cause it to run for + many hours. +*/ + +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#include +#include +#include "bzlib.h" + +#define M_BLOCK 1000000 + +typedef unsigned char uchar; + +#define M_BLOCK_OUT (M_BLOCK + 1000000) +uchar inbuf[M_BLOCK]; +uchar outbuf[M_BLOCK_OUT]; +uchar zbuf[M_BLOCK + 600 + (M_BLOCK / 100)]; + +int nIn, nOut, nZ; + +static char *bzerrorstrings[] = { + "OK" + ,"SEQUENCE_ERROR" + ,"PARAM_ERROR" + ,"MEM_ERROR" + ,"DATA_ERROR" + ,"DATA_ERROR_MAGIC" + ,"IO_ERROR" + ,"UNEXPECTED_EOF" + ,"OUTBUFF_FULL" + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ + ,"???" /* for future */ +}; + +void flip_bit ( int bit ) +{ + int byteno = bit / 8; + int bitno = bit % 8; + uchar mask = 1 << bitno; + //fprintf ( stderr, "(byte %d bit %d mask %d)", + // byteno, bitno, (int)mask ); + zbuf[byteno] ^= mask; +} + +int main ( int argc, char** argv ) +{ + FILE* f; + int r; + int bit; + int i; + + if (argc != 2) { + fprintf ( stderr, "usage: unzcrash filename\n" ); + return 1; + } + + f = fopen ( argv[1], "r" ); + if (!f) { + fprintf ( stderr, "unzcrash: can't open %s\n", argv[1] ); + return 1; + } + + nIn = fread ( inbuf, 1, M_BLOCK, f ); + fprintf ( stderr, "%d bytes read\n", nIn ); + + nZ = M_BLOCK; + r = BZ2_bzBuffToBuffCompress ( + zbuf, &nZ, inbuf, nIn, 9, 0, 30 ); + + assert (r == BZ_OK); + fprintf ( stderr, "%d after compression\n", nZ ); + + for (bit = 0; bit < nZ*8; bit++) { + fprintf ( stderr, "bit %d ", bit ); + flip_bit ( bit ); + nOut = M_BLOCK_OUT; + r = BZ2_bzBuffToBuffDecompress ( + outbuf, &nOut, zbuf, nZ, 0, 0 ); + fprintf ( stderr, " %d %s ", r, bzerrorstrings[-r] ); + + if (r != BZ_OK) { + fprintf ( stderr, "\n" ); + } else { + if (nOut != nIn) { + fprintf(stderr, "nIn/nOut mismatch %d %d\n", nIn, nOut ); + return 1; + } else { + for (i = 0; i < nOut; i++) + if (inbuf[i] != outbuf[i]) { + fprintf(stderr, "mismatch at %d\n", i ); + return 1; + } + if (i == nOut) fprintf(stderr, "really ok!\n" ); + } + } + + flip_bit ( bit ); + } + +#if 0 + assert (nOut == nIn); + for (i = 0; i < nOut; i++) { + if (inbuf[i] != outbuf[i]) { + fprintf ( stderr, "difference at %d !\n", i ); + return 1; + } + } +#endif + + fprintf ( stderr, "all ok\n" ); + return 0; +} Added: projects/external/bzip2-1.0.5/words0 ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/words0 Fri Jun 13 19:13:07 2008 @@ -0,0 +1,9 @@ + +If compilation produces errors, or a large number of warnings, +please read README.COMPILATION.PROBLEMS -- you might be able to +adjust the flags in this Makefile to improve matters. + +Also in README.COMPILATION.PROBLEMS are some hints that may help +if your build produces an executable which is unable to correctly +handle so-called 'large files' -- files of size 2GB or more. + Added: projects/external/bzip2-1.0.5/words1 ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/words1 Fri Jun 13 19:13:07 2008 @@ -0,0 +1,4 @@ + +Doing 6 tests (3 compress, 3 uncompress) ... +If there's a problem, things might stop at this point. + Added: projects/external/bzip2-1.0.5/words2 ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/words2 Fri Jun 13 19:13:07 2008 @@ -0,0 +1,5 @@ + +Checking test results. If any of the four "cmp"s which follow +report any differences, something is wrong. If you can't easily +figure out what, please let me know (jseward at bzip.org). + Added: projects/external/bzip2-1.0.5/words3 ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/words3 Fri Jun 13 19:13:07 2008 @@ -0,0 +1,30 @@ + +If you got this far and the 'cmp's didn't complain, it looks +like you're in business. + +To install in /usr/local/bin, /usr/local/lib, /usr/local/man and +/usr/local/include, type + + make install + +To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type + + make install PREFIX=/xxx/yyy + +If you are (justifiably) paranoid and want to see what 'make install' +is going to do, you can first do + + make -n install or + make -n install PREFIX=/xxx/yyy respectively. + +The -n instructs make to show the commands it would execute, but +not actually execute them. + +Instructions for use are in the preformatted manual page, in the file +bzip2.txt. For more detailed documentation, read the full manual. +It is available in Postscript form (manual.ps), PDF form (manual.pdf), +and HTML form (manual.html). + +You can also do "bzip2 --help" to see some helpful information. +"bzip2 -L" displays the software license. + Added: projects/external/bzip2-1.0.5/xmlproc.sh ============================================================================== --- (empty file) +++ projects/external/bzip2-1.0.5/xmlproc.sh Fri Jun 13 19:13:07 2008 @@ -0,0 +1,114 @@ +#!/bin/bash +# see the README file for usage etc. +# +# ------------------------------------------------------------------ +# This file is part of bzip2/libbzip2, a program and library for +# lossless, block-sorting data compression. +# +# bzip2/libbzip2 version 1.0.5 of 10 December 2007 +# Copyright (C) 1996-2007 Julian Seward +# +# Please read the WARNING, DISCLAIMER and PATENTS sections in the +# README file. +# +# This program is released under the terms of the license contained +# in the file LICENSE. +# ---------------------------------------------------------------- + + +usage() { + echo ''; + echo 'Usage: xmlproc.sh -[option] '; + echo 'Specify a target from:'; + echo '-v verify xml file conforms to dtd'; + echo '-html output in html format (single file)'; + echo '-ps output in postscript format'; + echo '-pdf output in pdf format'; + exit; +} + +if test $# -ne 2; then + usage +fi +# assign the variable for the output type +action=$1; shift +# assign the output filename +xmlfile=$1; shift +# and check user input it correct +if !(test -f $xmlfile); then + echo "No such file: $xmlfile"; + exit; +fi +# some other stuff we will use +OUT=output +xsl_fo=bz-fo.xsl +xsl_html=bz-html.xsl + +basename=$xmlfile +basename=${basename//'.xml'/''} + +fofile="${basename}.fo" +htmlfile="${basename}.html" +pdffile="${basename}.pdf" +psfile="${basename}.ps" +xmlfmtfile="${basename}.fmt" + +# first process the xmlfile with CDATA tags +./format.pl $xmlfile $xmlfmtfile +# so the shell knows where the catalogs live +export XML_CATALOG_FILES=/etc/xml/catalog + +# post-processing tidy up +cleanup() { + echo "Cleaning up: $@" + while [ $# != 0 ] + do + arg=$1; shift; + echo " deleting $arg"; + rm $arg + done +} + +case $action in + -v) + flags='--noout --xinclude --noblanks --postvalid' + dtd='--dtdvalid http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd' + xmllint $flags $dtd $xmlfmtfile 2> $OUT + egrep 'error' $OUT + rm $OUT + ;; + + -html) + echo "Creating $htmlfile ..." + xsltproc --nonet --xinclude -o $htmlfile $xsl_html $xmlfmtfile + cleanup $xmlfmtfile + ;; + + -pdf) + echo "Creating $pdffile ..." + xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile + pdfxmltex $fofile >$OUT $OUT $OUT $OUT $OUT $OUT $OUT $OUT $OUT Author: martin.v.loewis Date: Fri Jun 13 19:15:07 2008 New Revision: 64237 Log: Move bzip2 into proper location. Removed: projects/external/bzip2-1.0.5/ Changes in other areas also in this revision: Added: external/bzip2-1.0.5/ - copied from r64236, /projects/external/bzip2-1.0.5/ From python-checkins at python.org Fri Jun 13 19:15:35 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 19:15:35 +0200 (CEST) Subject: [Python-checkins] r64238 - projects Message-ID: <20080613171535.7203C1E400A@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 19:15:35 2008 New Revision: 64238 Log: Remove bogus directory. Removed: projects/ From python-checkins at python.org Fri Jun 13 19:22:39 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 19:22:39 +0200 (CEST) Subject: [Python-checkins] r64239 - in python/trunk: Misc/NEWS PCbuild/pyproject.vsprops PCbuild/readme.txt Tools/buildbot/external-common.bat Message-ID: <20080613172239.91FB11E4010@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 19:22:39 2008 New Revision: 64239 Log: Switch to bzip2 1.0.5. Modified: python/trunk/Misc/NEWS python/trunk/PCbuild/pyproject.vsprops python/trunk/PCbuild/readme.txt python/trunk/Tools/buildbot/external-common.bat Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 13 19:22:39 2008 @@ -307,7 +307,7 @@ Build ----- -- The Windows installer now includes Tk 8.5. +- The Windows installer now includes Tk 8.5 and bzip2 1.0.5. - Patch #1722225: Support QNX 6. Modified: python/trunk/PCbuild/pyproject.vsprops ============================================================================== --- python/trunk/PCbuild/pyproject.vsprops (original) +++ python/trunk/PCbuild/pyproject.vsprops Fri Jun 13 19:22:39 2008 @@ -78,7 +78,7 @@ /> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3553 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 20:12:52 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 20:12:52 +0200 (CEST) Subject: [Python-checkins] r64243 - in python/trunk: Misc/NEWS PCbuild/pyproject.vsprops PCbuild/readme.txt PCbuild/sqlite3.vcproj Tools/buildbot/external-common.bat Message-ID: <20080613181252.97B571E4006@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 20:12:51 2008 New Revision: 64243 Log: Switch to SQLite 3.5.9. Modified: python/trunk/Misc/NEWS python/trunk/PCbuild/pyproject.vsprops python/trunk/PCbuild/readme.txt python/trunk/PCbuild/sqlite3.vcproj python/trunk/Tools/buildbot/external-common.bat Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 13 20:12:51 2008 @@ -307,7 +307,7 @@ Build ----- -- The Windows installer now includes Tk 8.5 and bzip2 1.0.5. +- The Windows installer now includes Tk 8.5, bzip2 1.0.5, and SQLite 3.5.9. - Patch #1722225: Support QNX 6. Modified: python/trunk/PCbuild/pyproject.vsprops ============================================================================== --- python/trunk/PCbuild/pyproject.vsprops (original) +++ python/trunk/PCbuild/pyproject.vsprops Fri Jun 13 20:12:51 2008 @@ -74,7 +74,7 @@ /> - - - - - - - - - - - - - - - - - - - - @@ -573,167 +533,7 @@ Name="Source Files" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/trunk/Tools/buildbot/external-common.bat ============================================================================== --- python/trunk/Tools/buildbot/external-common.bat (original) +++ python/trunk/Tools/buildbot/external-common.bat Fri Jun 13 20:12:51 2008 @@ -15,7 +15,7 @@ @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1 @rem if exist db-4.4.20 rd /s/q db-4.4.20 @rem if exist openssl-0.9.8g rd /s/q openssl-0.9.8g - at rem if exist sqlite-source-3.3.4 rd /s/q sqlite-source-3.3.4 + at rem if exist sqlite-source-3.5.9 rd /s/q sqlite-source-3.5.9 @rem bzip if not exist bzip2-1.0.5 ( @@ -37,4 +37,7 @@ if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0 @rem sqlite3 -if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 +if not exist sqlite-source-3.5.9 ( + rd /s/q sqlite-source-3.3.4 + svn export http://svn.python.org/projects/external/sqlite-source-3.5.9 +) From python-checkins at python.org Fri Jun 13 20:19:50 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 20:19:50 +0200 (CEST) Subject: [Python-checkins] r64244 - python/trunk/PCbuild/sqlite3.vcproj Message-ID: <20080613181950.0D40E1E4006@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 20:19:49 2008 New Revision: 64244 Log: Update AMD64 build for amalgamated sqlite. Modified: python/trunk/PCbuild/sqlite3.vcproj Modified: python/trunk/PCbuild/sqlite3.vcproj ============================================================================== --- python/trunk/PCbuild/sqlite3.vcproj (original) +++ python/trunk/PCbuild/sqlite3.vcproj Fri Jun 13 20:19:49 2008 @@ -105,6 +105,7 @@ Your mail to 'Stackless-checkins' with the subject r64242 - in stackless/trunk: .bzrignore .hgignore Demo/turtle Doc/ACKS.txt Doc/Makefile Doc/README.txt Doc/about.rst Doc/bugs.rst Doc/c-api/bytearray.rst Doc/c-api/concrete.rst Doc/c-api/exceptions.rst Doc/c-api/file.rst Doc/c-api/long.rst Doc/c-api/marshal.rst Doc/c-api/number.rst Doc/c-api/string.rst Doc/c-api/type.rst Doc/c-api/typeobj.rst Doc/conf.py Doc/distutils/builtdist.rst Doc/distutils/packageindex.rst Doc/distutils/uploading.rst Doc/documenting/markup.rst Doc/glossary.rst Doc/howto/doanddont.rst Doc/includes/mp_benchmarks.py Doc/includes/mp_distributing.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/includes/tzinfo-examples.py Doc/library/_ast.rst Doc/library/_winreg.rst Doc/library/abc.rst Doc/library/aepack.rst Doc/library/aetools.rst Doc/library/aetypes.rst Doc/library/al.rst Doc/library/allos.rst Doc/library/anydbm.rst Doc/library/ast.rst Doc/library/asyn! chat.rst Doc/library/asyncore.rst Doc/library/autogil.rst Doc/library/basehttpserver.rst Doc/library/bastion.rst Doc/library/bdb.rst Doc/library/binhex.rst Doc/library/bsddb.rst Doc/library/bz2.rst Doc/library/calendar.rst Doc/library/carbon.rst Doc/library/cd.rst Doc/library/cgi.rst Doc/library/cgihttpserver.rst Doc/library/chunk.rst Doc/library/cmath.rst Doc/library/cmd.rst Doc/library/codecs.rst Doc/library/collections.rst Doc/library/colorpicker.rst Doc/library/colorsys.rst Doc/library/commands.rst Doc/library/compiler.rst Doc/library/configparser.rst Doc/library/cookie.rst Doc/library/cookielib.rst Doc/library/copy_reg.rst Doc/library/csv.rst Doc/library/ctypes.rst Doc/library/curses.rst Doc/library/dbhash.rst Doc/library/dbm.rst Doc/library/decimal.rst Doc/library/difflib.rst Doc/library/dircache.rst Doc/library/dis.rst Doc/library/dl.rst Doc/library/doctest.rst Doc/library/docxmlrpcserver.rst Doc/library/dumbdbm.rst Doc/library/dummy_thread.rst Doc/library/easydialog! s.rst Doc/library/email.charset.rst Doc/library/email.generator.rst Doc/library/email.header.rst Doc/library/email.message.rst Doc/library/email.parser.rst Doc/library/exceptions.rst Doc/library/filecmp.rst Doc/library/fl.rst Doc/library/fm.rst Doc/library/fpformat.rst Doc/library/fractions.rst Doc/library/framework.rst Doc/ Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 3444888 bytes with a limit of 500 KB Either the message will get posted to the list, or you will receive notification of the moderator's decision. If you would like to cancel this posting, please visit the following URL: http://www.stackless.com/mailman/confirm/stackless-checkins/618d23ff5735b6e4bc563ba6ea923a13533ede78 From python-checkins at python.org Fri Jun 13 20:58:48 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 13 Jun 2008 20:58:48 +0200 (CEST) Subject: [Python-checkins] r64246 - python/trunk/Tools/msi/msi.py Message-ID: <20080613185848.350E81E4006@bag.python.org> Author: martin.v.loewis Date: Fri Jun 13 20:58:47 2008 New Revision: 64246 Log: Pickup sqlite3.dll from binary directory. Commit more often. Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Fri Jun 13 20:58:47 2008 @@ -24,8 +24,6 @@ full_current_version = None # Is Tcl available at all? have_tcl = True -# Where is sqlite3.dll located, relative to srcdir? -sqlite_dir = "../sqlite-source-3.3.4" # path to PCbuild directory PCBUILD="PCbuild" # msvcrt version @@ -939,6 +937,8 @@ dirs={} pydirs = [(root,"Lib")] while pydirs: + # Commit every now and then, or else installer will complain + db.Commit() parent, dir = pydirs.pop() if dir == ".svn" or dir.startswith("plat-"): continue @@ -1041,7 +1041,7 @@ else: sqlite_arch = "" tclsuffix = "" - lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll") + lib.add_file("sqlite3.dll") if have_tcl: if not os.path.exists("%s/%s/_tkinter.pyd" % (srcdir, PCBUILD)): print "WARNING: Missing _tkinter.pyd" From python-checkins at python.org Fri Jun 13 21:13:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 21:13:41 +0200 (CEST) Subject: [Python-checkins] r64248 - in python/trunk: Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/sharedctypes.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/test/test_multiprocessing.py Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/win32_functions.c Message-ID: <20080613191341.16ED11E4006@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 21:13:39 2008 New Revision: 64248 Log: convert multiprocessing to unix line endings Modified: python/trunk/Lib/multiprocessing/__init__.py python/trunk/Lib/multiprocessing/connection.py python/trunk/Lib/multiprocessing/dummy/__init__.py python/trunk/Lib/multiprocessing/dummy/connection.py python/trunk/Lib/multiprocessing/forking.py python/trunk/Lib/multiprocessing/heap.py python/trunk/Lib/multiprocessing/managers.py python/trunk/Lib/multiprocessing/pool.py python/trunk/Lib/multiprocessing/process.py python/trunk/Lib/multiprocessing/queues.py python/trunk/Lib/multiprocessing/reduction.py python/trunk/Lib/multiprocessing/sharedctypes.py python/trunk/Lib/multiprocessing/synchronize.py python/trunk/Lib/multiprocessing/util.py python/trunk/Lib/test/test_multiprocessing.py python/trunk/Modules/_multiprocessing/multiprocessing.c python/trunk/Modules/_multiprocessing/multiprocessing.h python/trunk/Modules/_multiprocessing/pipe_connection.c python/trunk/Modules/_multiprocessing/win32_functions.c Modified: python/trunk/Lib/multiprocessing/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/__init__.py (original) +++ python/trunk/Lib/multiprocessing/__init__.py Fri Jun 13 21:13:39 2008 @@ -68,10 +68,10 @@ class ProcessError(Exception): pass - + class BufferTooShort(ProcessError): pass - + class TimeoutError(ProcessError): pass @@ -123,7 +123,7 @@ num = os.sysconf('SC_NPROCESSORS_ONLN') except (ValueError, OSError, AttributeError): num = 0 - + if num >= 1: return num else: @@ -151,13 +151,13 @@ ''' from multiprocessing.util import log_to_stderr return log_to_stderr(level) - + def allow_connection_pickling(): ''' Install support for sending connections and sockets between processes ''' from multiprocessing import reduction - + # # Definitions depending on native semaphores # @@ -263,7 +263,7 @@ ''' Sets the path to a python.exe or pythonw.exe binary used to run child processes on Windows instead of sys.executable. - Useful for people embedding Python. + Useful for people embedding Python. ''' from multiprocessing.forking import set_executable set_executable(executable) Modified: python/trunk/Lib/multiprocessing/connection.py ============================================================================== --- python/trunk/Lib/multiprocessing/connection.py (original) +++ python/trunk/Lib/multiprocessing/connection.py Fri Jun 13 21:13:39 2008 @@ -50,7 +50,7 @@ ''' if family == 'AF_INET': return ('localhost', 0) - elif family == 'AF_UNIX': + elif family == 'AF_UNIX': return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) elif family == 'AF_PIPE': return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % @@ -160,7 +160,7 @@ c2 = _multiprocessing.Connection(fd2, readable=False) return c1, c2 - + else: from ._multiprocessing import win32 @@ -200,7 +200,7 @@ c1 = _multiprocessing.PipeConnection(h1, writable=duplex) c2 = _multiprocessing.PipeConnection(h2, readable=duplex) - + return c1, c2 # @@ -290,14 +290,14 @@ ) self._handle_queue = [handle] self._last_accepted = None - + sub_debug('listener created with address=%r', self._address) self.close = Finalize( self, PipeListener._finalize_pipe_listener, args=(self._handle_queue, self._address), exitpriority=0 ) - + def accept(self): newhandle = win32.CreateNamedPipe( self._address, win32.PIPE_ACCESS_DUPLEX, @@ -320,7 +320,7 @@ sub_debug('closing listener with address=%r', address) for handle in queue: close(handle) - + def PipeClient(address): ''' Return a connection object connected to the pipe given by `address` @@ -397,7 +397,7 @@ self._loads = loads for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): obj = getattr(conn, attr) - setattr(self, attr, obj) + setattr(self, attr, obj) def send(self, obj): s = self._dumps(obj) self._conn.send_bytes(s) Modified: python/trunk/Lib/multiprocessing/dummy/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/dummy/__init__.py (original) +++ python/trunk/Lib/multiprocessing/dummy/__init__.py Fri Jun 13 21:13:39 2008 @@ -1,143 +1,143 @@ -# -# Support for the API of the multiprocessing package using threads -# -# multiprocessing/dummy/__init__.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ - 'Process', 'current_process', 'active_children', 'freeze_support', - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', - 'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' - ] - -# -# Imports -# - -import threading -import sys -import weakref -import array -import itertools - -from multiprocessing import TimeoutError, cpu_count -from multiprocessing.dummy.connection import Pipe -from threading import Lock, RLock, Semaphore, BoundedSemaphore -from threading import Event -from Queue import Queue - -# -# -# - -class DummyProcess(threading.Thread): - - def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): - threading.Thread.__init__(self, group, target, name, args, kwargs) - self._pid = None - self._children = weakref.WeakKeyDictionary() - self._start_called = False - self._parent = current_process() - - def start(self): - assert self._parent is current_process() - self._start_called = True - self._parent._children[self] = None - threading.Thread.start(self) - - def get_exitcode(self): - if self._start_called and not self.is_alive(): - return 0 - else: - return None - - # XXX - if sys.version_info < (3, 0): - is_alive = threading.Thread.is_alive.im_func - get_name = threading.Thread.get_name.im_func - set_name = threading.Thread.set_name.im_func - is_daemon = threading.Thread.is_daemon.im_func - set_daemon = threading.Thread.set_daemon.im_func - else: - is_alive = threading.Thread.is_alive - get_name = threading.Thread.get_name - set_name = threading.Thread.set_name - is_daemon = threading.Thread.is_daemon - set_daemon = threading.Thread.set_daemon - -# -# -# - -class Condition(threading._Condition): - # XXX - if sys.version_info < (3, 0): - notify_all = threading._Condition.notify_all.im_func - else: - notify_all = threading._Condition.notify_all - -# -# -# - -Process = DummyProcess -current_process = threading.current_thread -current_process()._children = weakref.WeakKeyDictionary() - -def active_children(): - children = current_process()._children - for p in list(children): - if not p.is_alive(): - children.pop(p, None) - return list(children) - -def freeze_support(): - pass - -# -# -# - -class Namespace(object): - def __init__(self, **kwds): - self.__dict__.update(kwds) - def __repr__(self): - items = self.__dict__.items() - temp = [] - for name, value in items: - if not name.startswith('_'): - temp.append('%s=%r' % (name, value)) - temp.sort() - return 'Namespace(%s)' % str.join(', ', temp) - -dict = dict -list = list - -def Array(typecode, sequence, lock=True): - return array.array(typecode, sequence) - -class Value(object): - def __init__(self, typecode, value, lock=True): - self._typecode = typecode - self._value = value - def _get(self): - return self._value - def _set(self, value): - self._value = value - value = property(_get, _set) - def __repr__(self): - return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value) - -def Manager(): - return sys.modules[__name__] - -def shutdown(): - pass - -def Pool(processes=None, initializer=None, initargs=()): - from multiprocessing.pool import ThreadPool - return ThreadPool(processes, initializer, initargs) - -JoinableQueue = Queue +# +# Support for the API of the multiprocessing package using threads +# +# multiprocessing/dummy/__init__.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' + ] + +# +# Imports +# + +import threading +import sys +import weakref +import array +import itertools + +from multiprocessing import TimeoutError, cpu_count +from multiprocessing.dummy.connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event +from Queue import Queue + +# +# +# + +class DummyProcess(threading.Thread): + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + threading.Thread.__init__(self, group, target, name, args, kwargs) + self._pid = None + self._children = weakref.WeakKeyDictionary() + self._start_called = False + self._parent = current_process() + + def start(self): + assert self._parent is current_process() + self._start_called = True + self._parent._children[self] = None + threading.Thread.start(self) + + def get_exitcode(self): + if self._start_called and not self.is_alive(): + return 0 + else: + return None + + # XXX + if sys.version_info < (3, 0): + is_alive = threading.Thread.is_alive.im_func + get_name = threading.Thread.get_name.im_func + set_name = threading.Thread.set_name.im_func + is_daemon = threading.Thread.is_daemon.im_func + set_daemon = threading.Thread.set_daemon.im_func + else: + is_alive = threading.Thread.is_alive + get_name = threading.Thread.get_name + set_name = threading.Thread.set_name + is_daemon = threading.Thread.is_daemon + set_daemon = threading.Thread.set_daemon + +# +# +# + +class Condition(threading._Condition): + # XXX + if sys.version_info < (3, 0): + notify_all = threading._Condition.notify_all.im_func + else: + notify_all = threading._Condition.notify_all + +# +# +# + +Process = DummyProcess +current_process = threading.current_thread +current_process()._children = weakref.WeakKeyDictionary() + +def active_children(): + children = current_process()._children + for p in list(children): + if not p.is_alive(): + children.pop(p, None) + return list(children) + +def freeze_support(): + pass + +# +# +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +dict = dict +list = list + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def _get(self): + return self._value + def _set(self, value): + self._value = value + value = property(_get, _set) + def __repr__(self): + return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value) + +def Manager(): + return sys.modules[__name__] + +def shutdown(): + pass + +def Pool(processes=None, initializer=None, initargs=()): + from multiprocessing.pool import ThreadPool + return ThreadPool(processes, initializer, initargs) + +JoinableQueue = Queue Modified: python/trunk/Lib/multiprocessing/dummy/connection.py ============================================================================== --- python/trunk/Lib/multiprocessing/dummy/connection.py (original) +++ python/trunk/Lib/multiprocessing/dummy/connection.py Fri Jun 13 21:13:39 2008 @@ -1,61 +1,61 @@ -# -# Analogue of `multiprocessing.connection` which uses queues instead of sockets -# -# multiprocessing/dummy/connection.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'Client', 'Listener', 'Pipe' ] - -from Queue import Queue - - -families = [None] - - -class Listener(object): - - def __init__(self, address=None, family=None, backlog=1): - self._backlog_queue = Queue(backlog) - - def accept(self): - return Connection(*self._backlog_queue.get()) - - def close(self): - self._backlog_queue = None - - address = property(lambda self: self._backlog_queue) - - -def Client(address): - _in, _out = Queue(), Queue() - address.put((_out, _in)) - return Connection(_in, _out) - - -def Pipe(duplex=True): - a, b = Queue(), Queue() - return Connection(a, b), Connection(b, a) - - -class Connection(object): - - def __init__(self, _in, _out): - self._out = _out - self._in = _in - self.send = self.send_bytes = _out.put - self.recv = self.recv_bytes = _in.get - - def poll(self, timeout=0.0): - if self._in.qsize() > 0: - return True - if timeout <= 0.0: - return False - self._in.not_empty.acquire() - self._in.not_empty.wait(timeout) - self._in.not_empty.release() - return self._in.qsize() > 0 - - def close(self): - pass +# +# Analogue of `multiprocessing.connection` which uses queues instead of sockets +# +# multiprocessing/dummy/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +from Queue import Queue + + +families = [None] + + +class Listener(object): + + def __init__(self, address=None, family=None, backlog=1): + self._backlog_queue = Queue(backlog) + + def accept(self): + return Connection(*self._backlog_queue.get()) + + def close(self): + self._backlog_queue = None + + address = property(lambda self: self._backlog_queue) + + +def Client(address): + _in, _out = Queue(), Queue() + address.put((_out, _in)) + return Connection(_in, _out) + + +def Pipe(duplex=True): + a, b = Queue(), Queue() + return Connection(a, b), Connection(b, a) + + +class Connection(object): + + def __init__(self, _in, _out): + self._out = _out + self._in = _in + self.send = self.send_bytes = _out.put + self.recv = self.recv_bytes = _in.get + + def poll(self, timeout=0.0): + if self._in.qsize() > 0: + return True + if timeout <= 0.0: + return False + self._in.not_empty.acquire() + self._in.not_empty.wait(timeout) + self._in.not_empty.release() + return self._in.qsize() > 0 + + def close(self): + pass Modified: python/trunk/Lib/multiprocessing/forking.py ============================================================================== --- python/trunk/Lib/multiprocessing/forking.py (original) +++ python/trunk/Lib/multiprocessing/forking.py Fri Jun 13 21:13:39 2008 @@ -92,7 +92,7 @@ except OSError, e: if self.wait(timeout=0.1) is None: raise - + @staticmethod def thread_is_spawning(): return False @@ -107,10 +107,10 @@ import _subprocess import copy_reg import time - + from ._multiprocessing import win32, Connection, PipeConnection from .util import Finalize - + try: from cPickle import dump, load, HIGHEST_PROTOCOL except ImportError: @@ -217,7 +217,7 @@ if code == TERMINATE: code = -signal.SIGTERM self.returncode = code - + return self.returncode def poll(self): @@ -230,7 +230,7 @@ except WindowsError: if self.wait(timeout=0.1) is None: raise - + # # # @@ -308,7 +308,7 @@ Return info about parent needed by child to unpickle process object ''' from .util import _logger, _log_to_stderr - + d = dict( name=name, sys_path=sys.path, @@ -317,7 +317,7 @@ orig_dir=process.ORIGINAL_DIR, authkey=process.current_process().get_authkey(), ) - + if _logger is not None: d['log_level'] = _logger.getEffectiveLevel() @@ -336,7 +336,7 @@ # # Make (Pipe)Connection picklable # - + def reduce_connection(conn): if not Popen.thread_is_spawning(): raise RuntimeError( @@ -345,7 +345,7 @@ ) return type(conn), (Popen.duplicate_for_child(conn.fileno()), conn.readable, conn.writable) - + copy_reg.pickle(Connection, reduce_connection) copy_reg.pickle(PipeConnection, reduce_connection) @@ -367,7 +367,7 @@ if 'authkey' in data: process.current_process()._authkey = data['authkey'] - + if 'log_to_stderr' in data and data['log_to_stderr']: util.log_to_stderr() Modified: python/trunk/Lib/multiprocessing/heap.py ============================================================================== --- python/trunk/Lib/multiprocessing/heap.py (original) +++ python/trunk/Lib/multiprocessing/heap.py Fri Jun 13 21:13:39 2008 @@ -1,201 +1,201 @@ -# -# Module which supports allocation of memory from an mmap -# -# multiprocessing/heap.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -import bisect -import mmap -import tempfile -import os -import sys -import threading -import itertools - -import _multiprocessing -from multiprocessing.util import Finalize, info -from multiprocessing.forking import assert_spawning - -__all__ = ['BufferWrapper'] - -# -# Inheirtable class which wraps an mmap, and from which blocks can be allocated -# - -if sys.platform == 'win32': - - from ._multiprocessing import win32 - - class Arena(object): - - _counter = itertools.count() - - def __init__(self, size): - self.size = size - self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) - self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == 0, 'tagname already in use' - self._state = (self.size, self.name) - - def __getstate__(self): - assert_spawning(self) - return self._state - - def __setstate__(self, state): - self.size, self.name = self._state = state - self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS - -else: - - class Arena(object): - - def __init__(self, size): - self.buffer = mmap.mmap(-1, size) - self.size = size - self.name = None - -# -# Class allowing allocation of chunks of memory from arenas -# - -class Heap(object): - - _alignment = 8 - - def __init__(self, size=mmap.PAGESIZE): - self._lastpid = os.getpid() - self._lock = threading.Lock() - self._size = size - self._lengths = [] - self._len_to_seq = {} - self._start_to_block = {} - self._stop_to_block = {} - self._allocated_blocks = set() - self._arenas = [] - - @staticmethod - def _roundup(n, alignment): - # alignment must be a power of 2 - mask = alignment - 1 - return (n + mask) & ~mask - - def _malloc(self, size): - # returns a large enough block -- it might be much larger - i = bisect.bisect_left(self._lengths, size) - if i == len(self._lengths): - length = self._roundup(max(self._size, size), mmap.PAGESIZE) - self._size *= 2 - info('allocating a new mmap of length %d', length) - arena = Arena(length) - self._arenas.append(arena) - return (arena, 0, length) - else: - length = self._lengths[i] - seq = self._len_to_seq[length] - block = seq.pop() - if not seq: - del self._len_to_seq[length], self._lengths[i] - - (arena, start, stop) = block - del self._start_to_block[(arena, start)] - del self._stop_to_block[(arena, stop)] - return block - - def _free(self, block): - # free location and try to merge with neighbours - (arena, start, stop) = block - - try: - prev_block = self._stop_to_block[(arena, start)] - except KeyError: - pass - else: - start, _ = self._absorb(prev_block) - - try: - next_block = self._start_to_block[(arena, stop)] - except KeyError: - pass - else: - _, stop = self._absorb(next_block) - - block = (arena, start, stop) - length = stop - start - - try: - self._len_to_seq[length].append(block) - except KeyError: - self._len_to_seq[length] = [block] - bisect.insort(self._lengths, length) - - self._start_to_block[(arena, start)] = block - self._stop_to_block[(arena, stop)] = block - - def _absorb(self, block): - # deregister this block so it can be merged with a neighbour - (arena, start, stop) = block - del self._start_to_block[(arena, start)] - del self._stop_to_block[(arena, stop)] - - length = stop - start - seq = self._len_to_seq[length] - seq.remove(block) - if not seq: - del self._len_to_seq[length] - self._lengths.remove(length) - - return start, stop - - def free(self, block): - # free a block returned by malloc() - assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() - - def malloc(self, size): - # return a block of right size (possibly rounded up) - assert 0 <= size < sys.maxint - if os.getpid() != self._lastpid: - self.__init__() # reinitialize after fork - self._lock.acquire() - try: - size = self._roundup(max(size,1), self._alignment) - (arena, start, stop) = self._malloc(size) - new_stop = start + size - if new_stop < stop: - self._free((arena, new_stop, stop)) - block = (arena, start, new_stop) - self._allocated_blocks.add(block) - return block - finally: - self._lock.release() - -# -# Class representing a chunk of an mmap -- can be inherited -# - -class BufferWrapper(object): - - _heap = Heap() - - def __init__(self, size): - assert 0 <= size < sys.maxint - block = BufferWrapper._heap.malloc(size) - self._state = (block, size) - Finalize(self, BufferWrapper._heap.free, args=(block,)) - - def get_address(self): - (arena, start, stop), size = self._state - address, length = _multiprocessing.address_of_buffer(arena.buffer) - assert size <= length - return address + start - - def get_size(self): - return self._state[1] +# +# Module which supports allocation of memory from an mmap +# +# multiprocessing/heap.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import bisect +import mmap +import tempfile +import os +import sys +import threading +import itertools + +import _multiprocessing +from multiprocessing.util import Finalize, info +from multiprocessing.forking import assert_spawning + +__all__ = ['BufferWrapper'] + +# +# Inheirtable class which wraps an mmap, and from which blocks can be allocated +# + +if sys.platform == 'win32': + + from ._multiprocessing import win32 + + class Arena(object): + + _counter = itertools.count() + + def __init__(self, size): + self.size = size + self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == 0, 'tagname already in use' + self._state = (self.size, self.name) + + def __getstate__(self): + assert_spawning(self) + return self._state + + def __setstate__(self, state): + self.size, self.name = self._state = state + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS + +else: + + class Arena(object): + + def __init__(self, size): + self.buffer = mmap.mmap(-1, size) + self.size = size + self.name = None + +# +# Class allowing allocation of chunks of memory from arenas +# + +class Heap(object): + + _alignment = 8 + + def __init__(self, size=mmap.PAGESIZE): + self._lastpid = os.getpid() + self._lock = threading.Lock() + self._size = size + self._lengths = [] + self._len_to_seq = {} + self._start_to_block = {} + self._stop_to_block = {} + self._allocated_blocks = set() + self._arenas = [] + + @staticmethod + def _roundup(n, alignment): + # alignment must be a power of 2 + mask = alignment - 1 + return (n + mask) & ~mask + + def _malloc(self, size): + # returns a large enough block -- it might be much larger + i = bisect.bisect_left(self._lengths, size) + if i == len(self._lengths): + length = self._roundup(max(self._size, size), mmap.PAGESIZE) + self._size *= 2 + info('allocating a new mmap of length %d', length) + arena = Arena(length) + self._arenas.append(arena) + return (arena, 0, length) + else: + length = self._lengths[i] + seq = self._len_to_seq[length] + block = seq.pop() + if not seq: + del self._len_to_seq[length], self._lengths[i] + + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + return block + + def _free(self, block): + # free location and try to merge with neighbours + (arena, start, stop) = block + + try: + prev_block = self._stop_to_block[(arena, start)] + except KeyError: + pass + else: + start, _ = self._absorb(prev_block) + + try: + next_block = self._start_to_block[(arena, stop)] + except KeyError: + pass + else: + _, stop = self._absorb(next_block) + + block = (arena, start, stop) + length = stop - start + + try: + self._len_to_seq[length].append(block) + except KeyError: + self._len_to_seq[length] = [block] + bisect.insort(self._lengths, length) + + self._start_to_block[(arena, start)] = block + self._stop_to_block[(arena, stop)] = block + + def _absorb(self, block): + # deregister this block so it can be merged with a neighbour + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + + length = stop - start + seq = self._len_to_seq[length] + seq.remove(block) + if not seq: + del self._len_to_seq[length] + self._lengths.remove(length) + + return start, stop + + def free(self, block): + # free a block returned by malloc() + assert os.getpid() == self._lastpid + self._lock.acquire() + try: + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() + + def malloc(self, size): + # return a block of right size (possibly rounded up) + assert 0 <= size < sys.maxint + if os.getpid() != self._lastpid: + self.__init__() # reinitialize after fork + self._lock.acquire() + try: + size = self._roundup(max(size,1), self._alignment) + (arena, start, stop) = self._malloc(size) + new_stop = start + size + if new_stop < stop: + self._free((arena, new_stop, stop)) + block = (arena, start, new_stop) + self._allocated_blocks.add(block) + return block + finally: + self._lock.release() + +# +# Class representing a chunk of an mmap -- can be inherited +# + +class BufferWrapper(object): + + _heap = Heap() + + def __init__(self, size): + assert 0 <= size < sys.maxint + block = BufferWrapper._heap.malloc(size) + self._state = (block, size) + Finalize(self, BufferWrapper._heap.free, args=(block,)) + + def get_address(self): + (arena, start, stop), size = self._state + address, length = _multiprocessing.address_of_buffer(arena.buffer) + assert size <= length + return address + start + + def get_size(self): + return self._state[1] Modified: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- python/trunk/Lib/multiprocessing/managers.py (original) +++ python/trunk/Lib/multiprocessing/managers.py Fri Jun 13 21:13:39 2008 @@ -40,7 +40,7 @@ bytes except NameError: bytes = str # XXX not needed in Py2.6 and Py3.0 - + # # Register some things for pickling # @@ -55,7 +55,7 @@ return list, (list(obj),) for view_type in view_types: copy_reg.pickle(view_type, rebuild_as_list) - + # # Type for identifying shared objects # @@ -104,7 +104,7 @@ return RemoteError('Unserializable message: %s\n' % result) else: return ValueError('Unrecognized message type') - + class RemoteError(Exception): def __str__(self): return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) @@ -340,7 +340,7 @@ util.debug('resetting stdout, stderr') sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ - + util._run_finalizers(0) for p in active_children(): @@ -358,7 +358,7 @@ traceback.print_exc() finally: exit(0) - + def create(self, c, typeid, *args, **kwds): ''' Create a new shared object and return its id @@ -367,7 +367,7 @@ try: callable, exposed, method_to_typeid, proxytype = \ self.registry[typeid] - + if callable is None: assert len(args) == 1 and not kwds obj = args[0] @@ -456,7 +456,7 @@ ''' _registry = {} _Server = Server - + def __init__(self, address=None, authkey=None, serializer='pickle'): if authkey is None: authkey = current_process().get_authkey() @@ -487,7 +487,7 @@ conn = Client(self._address, authkey=self._authkey) dispatch(conn, None, 'dummy') self._state.value = State.STARTED - + def start(self): ''' Spawn a server process for this manager object @@ -570,10 +570,10 @@ Return the number of shared objects ''' conn = self._Client(self._address, authkey=self._authkey) - try: + try: return dispatch(conn, None, 'number_of_objects') finally: - conn.close() + conn.close() def __enter__(self): return self @@ -612,7 +612,7 @@ del BaseProxy._address_to_local[address] except KeyError: pass - + address = property(lambda self: self._address) @classmethod @@ -640,7 +640,7 @@ cls._registry[typeid] = ( callable, exposed, method_to_typeid, proxytype ) - + if create_method: def temp(self, *args, **kwds): util.debug('requesting creation of a shared %r object', typeid) @@ -709,9 +709,9 @@ if incref: self._incref() - + util.register_after_fork(self, BaseProxy._after_fork) - + def _connect(self): util.debug('making connection to manager') name = current_process().get_name() @@ -720,7 +720,7 @@ conn = self._Client(self._token.address, authkey=self._authkey) dispatch(conn, None, 'accept_connection', (name,)) self._tls.connection = conn - + def _callmethod(self, methodname, args=(), kwds={}): ''' Try to call a method of the referrent and return a copy of the result @@ -735,7 +735,7 @@ conn.send((self._id, methodname, args, kwds)) kind, result = conn.recv() - + if kind == '#RETURN': return result elif kind == '#PROXY': @@ -793,7 +793,7 @@ threading.current_thread().get_name()) tls.connection.close() del tls.connection - + def _after_fork(self): self._manager = None try: @@ -806,7 +806,7 @@ kwds = {} if Popen.thread_is_spawning(): kwds['authkey'] = self._authkey - + if getattr(self, '_isauto', False): kwds['exposed'] = self._exposed_ return (RebuildProxy, @@ -817,7 +817,7 @@ def __deepcopy__(self, memo): return self._getvalue() - + def __repr__(self): return '<%s object, typeid %r at %s>' % \ (type(self).__name__, self._token.typeid, '0x%x' % id(self)) @@ -842,7 +842,7 @@ If possible the shared object is returned, or otherwise a proxy for it. ''' server = getattr(current_process(), '_manager_server', None) - + if server and server.address == token.address: return server.id_to_obj[token.id][0] else: @@ -884,7 +884,7 @@ Return an auto-proxy for `token` ''' _Client = listener_client[serializer][1] - + if exposed is None: conn = _Client(token.address, authkey=authkey) try: @@ -995,7 +995,7 @@ if key[0] == '_': return object.__getattribute__(self, key) callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__getattribute__', (key,)) + return callmethod('__getattribute__', (key,)) def __setattr__(self, key, value): if key[0] == '_': return object.__setattr__(self, key, value) @@ -1007,7 +1007,7 @@ callmethod = object.__getattribute__(self, '_callmethod') return callmethod('__delattr__', (key,)) - + class ValueProxy(BaseProxy): _exposed_ = ('get', 'set') def get(self): @@ -1063,10 +1063,10 @@ class SyncManager(BaseManager): ''' Subclass of `BaseManager` which supports a number of shared object types. - + The types registered are those intended for the synchronization of threads, plus `dict`, `list` and `Namespace`. - + The `multiprocessing.Manager()` function creates started instances of this class. ''' Modified: python/trunk/Lib/multiprocessing/pool.py ============================================================================== --- python/trunk/Lib/multiprocessing/pool.py (original) +++ python/trunk/Lib/multiprocessing/pool.py Fri Jun 13 21:13:39 2008 @@ -58,18 +58,18 @@ except (EOFError, IOError): debug('worker got EOFError or IOError -- exiting') break - + if task is None: debug('worker got sentinel -- exiting') break - + job, i, func, args, kwds = task try: result = (True, func(*args, **kwds)) except Exception, e: result = (False, e) put((job, i, result)) - + # # Class representing a process pool # @@ -91,7 +91,7 @@ processes = cpu_count() except NotImplementedError: processes = 1 - + self._pool = [] for i in range(processes): w = self.Process( @@ -102,7 +102,7 @@ w.set_name(w.get_name().replace('Process', 'PoolWorker')) w.set_daemon(True) w.start() - + self._task_handler = threading.Thread( target=Pool._handle_tasks, args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) @@ -132,7 +132,7 @@ self._outqueue = SimpleQueue() self._quick_put = self._inqueue._writer.send self._quick_get = self._outqueue._reader.recv - + def apply(self, func, args=(), kwds={}): ''' Equivalent of `apply()` builtin @@ -182,7 +182,7 @@ self._taskqueue.put((((result._job, i, mapstar, (x,), {}) for i, x in enumerate(task_batches)), result._set_length)) return (item for chunk in result for item in chunk) - + def apply_async(self, func, args=(), kwds={}, callback=None): ''' Asynchronous equivalent of `apply()` builtin @@ -199,12 +199,12 @@ assert self._state == RUN if not hasattr(iterable, '__len__'): iterable = list(iterable) - + if chunksize is None: chunksize, extra = divmod(len(iterable), len(self._pool) * 4) if extra: chunksize += 1 - + task_batches = Pool._get_tasks(func, iterable, chunksize) result = MapResult(self._cache, chunksize, len(iterable), callback) self._taskqueue.put((((result._job, i, mapstar, (x,), {}) @@ -234,13 +234,13 @@ break else: debug('task handler got sentinel') - + try: # tell result handler to finish when cache is empty debug('task handler sending sentinel to result handler') outqueue.put(None) - + # tell workers there is no more work debug('task handler sending sentinel to workers') for p in pool: @@ -260,12 +260,12 @@ except (IOError, EOFError): debug('result handler got EOFError/IOError -- exiting') return - + if thread._state: assert thread._state == TERMINATE debug('result handler found thread._state=TERMINATE') break - + if task is None: debug('result handler got sentinel') break @@ -321,7 +321,7 @@ raise NotImplementedError( 'pool objects cannot be passed between processes or pickled' ) - + def close(self): debug('closing pool') if self._state == RUN: @@ -355,7 +355,7 @@ task_handler, result_handler, cache): # this is guaranteed to only be called once debug('finalizing pool') - + task_handler._state = TERMINATE taskqueue.put(None) # sentinel @@ -363,7 +363,7 @@ cls._help_stuff_finish(inqueue, task_handler, len(pool)) assert result_handler.is_alive() or len(cache) == 0 - + result_handler._state = TERMINATE outqueue.put(None) # sentinel @@ -396,14 +396,14 @@ self._ready = False self._callback = callback cache[self._job] = self - + def ready(self): return self._ready - + def successful(self): assert self._ready return self._success - + def wait(self, timeout=None): self._cond.acquire() try: @@ -438,7 +438,7 @@ # class MapResult(ApplyResult): - + def __init__(self, cache, chunksize, length, callback): ApplyResult.__init__(self, cache, callback) self._success = True @@ -449,7 +449,7 @@ self._ready = True else: self._number_left = length//chunksize + bool(length % chunksize) - + def _set(self, i, success_result): success, result = success_result if success: @@ -492,10 +492,10 @@ self._length = None self._unsorted = {} cache[self._job] = self - + def __iter__(self): return self - + def next(self, timeout=None): self._cond.acquire() try: @@ -520,7 +520,7 @@ raise value __next__ = next # XXX - + def _set(self, i, obj): self._cond.acquire() try: @@ -534,12 +534,12 @@ self._cond.notify() else: self._unsorted[i] = obj - + if self._index == self._length: del self._cache[self._job] finally: self._cond.release() - + def _set_length(self, length): self._cond.acquire() try: @@ -572,18 +572,18 @@ # class ThreadPool(Pool): - + from .dummy import Process - + def __init__(self, processes=None, initializer=None, initargs=()): Pool.__init__(self, processes, initializer, initargs) - + def _setup_queues(self): self._inqueue = Queue.Queue() self._outqueue = Queue.Queue() self._quick_put = self._inqueue.put self._quick_get = self._outqueue.get - + @staticmethod def _help_stuff_finish(inqueue, task_handler, size): # put sentinels at head of inqueue to make workers finish Modified: python/trunk/Lib/multiprocessing/process.py ============================================================================== --- python/trunk/Lib/multiprocessing/process.py (original) +++ python/trunk/Lib/multiprocessing/process.py Fri Jun 13 21:13:39 2008 @@ -47,7 +47,7 @@ ''' _cleanup() return list(_current_process._children) - + # # # @@ -69,7 +69,7 @@ The class is analagous to `threading.Thread` ''' _Popen = None - + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): assert group is None, 'group argument must be None for now' count = _current_process._counter.next() @@ -91,7 +91,7 @@ ''' if self._target: self._target(*self._args, **self._kwargs) - + def start(self): ''' Start child process @@ -114,7 +114,7 @@ Terminate process; sends SIGTERM signal or uses TerminateProcess() ''' self._popen.terminate() - + def join(self, timeout=None): ''' Wait until child process terminates @@ -217,11 +217,11 @@ status, self._daemonic and ' daemon' or '') ## - + def _bootstrap(self): from . import util global _current_process - + try: self._children = set() self._counter = itertools.count(1) Modified: python/trunk/Lib/multiprocessing/queues.py ============================================================================== --- python/trunk/Lib/multiprocessing/queues.py (original) +++ python/trunk/Lib/multiprocessing/queues.py Fri Jun 13 21:13:39 2008 @@ -41,9 +41,9 @@ else: self._wlock = Lock() self._sem = BoundedSemaphore(maxsize) - + self._after_fork() - + if sys.platform != 'win32': register_after_fork(self, Queue._after_fork) @@ -51,12 +51,12 @@ assert_spawning(self) return (self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) - + def __setstate__(self, state): (self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) = state self._after_fork() - + def _after_fork(self): debug('Queue._after_fork()') self._notempty = threading.Condition(threading.Lock()) @@ -69,7 +69,7 @@ self._send = self._writer.send self._recv = self._reader.recv self._poll = self._reader.poll - + def put(self, obj, block=True, timeout=None): assert not self._closed if not self._sem.acquire(block, timeout): @@ -93,7 +93,7 @@ return res finally: self._rlock.release() - + else: if block: deadline = time.time() + timeout @@ -135,7 +135,7 @@ assert self._closed if self._jointhread: self._jointhread() - + def cancel_join_thread(self): debug('Queue.cancel_join_thread()') self._joincancelled = True @@ -146,7 +146,7 @@ def _start_thread(self): debug('Queue._start_thread()') - + # Start thread which transfers data from buffer to pipe self._buffer.clear() self._thread = threading.Thread( @@ -174,14 +174,14 @@ [weakref.ref(self._thread)], exitpriority=-5 ) - + # Send sentinel to the thread queue object when garbage collected self._close = Finalize( self, Queue._finalize_close, [self._buffer, self._notempty], exitpriority=10 ) - + @staticmethod def _finalize_join(twr): debug('joining queue thread') @@ -191,7 +191,7 @@ debug('... queue thread joined') else: debug('... queue thread already dead') - + @staticmethod def _finalize_close(buffer, notempty): debug('telling queue thread to quit') @@ -206,7 +206,7 @@ def _feed(buffer, notempty, send, writelock, close): debug('starting thread to feed data to pipe') from .util import is_exiting - + nacquire = notempty.acquire nrelease = notempty.release nwait = notempty.wait @@ -217,7 +217,7 @@ wrelease = writelock.release else: wacquire = None - + try: while 1: nacquire() @@ -257,7 +257,7 @@ traceback.print_exc() except Exception: pass - + _sentinel = object() # @@ -274,7 +274,7 @@ Queue.__init__(self, maxsize) self._unfinished_tasks = Semaphore(0) self._cond = Condition() - + def __getstate__(self): return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) @@ -285,7 +285,7 @@ def put(self, item, block=True, timeout=None): Queue.put(self, item, block, timeout) self._unfinished_tasks.release() - + def task_done(self): self._cond.acquire() try: @@ -295,7 +295,7 @@ self._cond.notify_all() finally: self._cond.release() - + def join(self): self._cond.acquire() try: Modified: python/trunk/Lib/multiprocessing/reduction.py ============================================================================== --- python/trunk/Lib/multiprocessing/reduction.py (original) +++ python/trunk/Lib/multiprocessing/reduction.py Fri Jun 13 21:13:39 2008 @@ -36,7 +36,7 @@ if sys.platform == 'win32': import _subprocess from ._multiprocessing import win32 - + def send_handle(conn, handle, destination_pid): process_handle = win32.OpenProcess( win32.PROCESS_ALL_ACCESS, False, destination_pid @@ -46,14 +46,14 @@ conn.send(new_handle) finally: close(process_handle) - + def recv_handle(conn): return conn.recv() else: def send_handle(conn, handle, destination_pid): _multiprocessing.sendfd(conn.fileno(), handle) - + def recv_handle(conn): return _multiprocessing.recvfd(conn.fileno()) @@ -93,7 +93,7 @@ def _serve(): from .util import is_exiting, sub_warning - + while 1: try: conn = _listener.accept() @@ -109,7 +109,7 @@ 'thread for sharing handles raised exception :\n' + '-'*79 + '\n' + traceback.format_exc() + '-'*79 ) - + # # Functions to be used for pickling/unpickling objects with handles # @@ -176,15 +176,15 @@ # if sys.platform == 'win32': - + def reduce_pipe_connection(conn): rh = reduce_handle(conn.fileno()) return rebuild_pipe_connection, (rh, conn.readable, conn.writable) - + def rebuild_pipe_connection(reduced_handle, readable, writable): handle = rebuild_handle(reduced_handle) return _multiprocessing.PipeConnection( handle, readable=readable, writable=writable ) - + copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) Modified: python/trunk/Lib/multiprocessing/sharedctypes.py ============================================================================== --- python/trunk/Lib/multiprocessing/sharedctypes.py (original) +++ python/trunk/Lib/multiprocessing/sharedctypes.py Fri Jun 13 21:13:39 2008 @@ -92,10 +92,10 @@ new_obj = _new_value(type(obj)) ctypes.pointer(new_obj)[0] = obj return new_obj - + def synchronized(obj, lock=None): assert not isinstance(obj, SynchronizedBase), 'object already synchronized' - + if isinstance(obj, ctypes._SimpleCData): return Synchronized(obj, lock) elif isinstance(obj, ctypes.Array): @@ -123,7 +123,7 @@ return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) else: return rebuild_ctype, (type(obj), obj._wrapper, None) - + def rebuild_ctype(type_, wrapper, length): if length is not None: type_ = type_ * length @@ -170,7 +170,7 @@ # class SynchronizedBase(object): - + def __init__(self, obj, lock=None): self._obj = obj self._lock = lock or RLock() @@ -180,55 +180,55 @@ def __reduce__(self): assert_spawning(self) return synchronized, (self._obj, self._lock) - + def get_obj(self): return self._obj - + def get_lock(self): return self._lock - + def __repr__(self): return '<%s wrapper for %s>' % (type(self).__name__, self._obj) - - + + class Synchronized(SynchronizedBase): value = make_property('value') - - + + class SynchronizedArray(SynchronizedBase): - + def __len__(self): return len(self._obj) - + def __getitem__(self, i): self.acquire() try: return self._obj[i] finally: self.release() - + def __setitem__(self, i, value): self.acquire() try: self._obj[i] = value finally: self.release() - + def __getslice__(self, start, stop): self.acquire() try: return self._obj[start:stop] finally: self.release() - + def __setslice__(self, start, stop, values): self.acquire() try: self._obj[start:stop] = values finally: self.release() - - + + class SynchronizedString(SynchronizedArray): value = make_property('value') raw = make_property('raw') Modified: python/trunk/Lib/multiprocessing/synchronize.py ============================================================================== --- python/trunk/Lib/multiprocessing/synchronize.py (original) +++ python/trunk/Lib/multiprocessing/synchronize.py Fri Jun 13 21:13:39 2008 @@ -38,7 +38,7 @@ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) debug('created semlock with handle %s' % sl.handle) self._make_methods() - + if sys.platform != 'win32': def _after_fork(obj): obj._semlock._after_fork() @@ -129,7 +129,7 @@ def __init__(self): SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) - + def __repr__(self): try: if self._semlock._is_mine(): @@ -210,17 +210,17 @@ def notify(self): assert self._lock._semlock._is_mine(), 'lock is not owned' assert not self._wait_semaphore.acquire(False) - + # to take account of timeouts since last notify() we subtract # woken_count from sleeping_count and rezero woken_count while self._woken_count.acquire(False): res = self._sleeping_count.acquire(False) assert res - + if self._sleeping_count.acquire(False): # try grabbing a sleeper self._wait_semaphore.release() # wake up one sleeper self._woken_count.acquire() # wait for the sleeper to wake - + # rezero _wait_semaphore in case a timeout just happened self._wait_semaphore.acquire(False) @@ -233,7 +233,7 @@ while self._woken_count.acquire(False): res = self._sleeping_count.acquire(False) assert res - + sleepers = 0 while self._sleeping_count.acquire(False): self._wait_semaphore.release() # wake up one sleeper @@ -266,7 +266,7 @@ return False finally: self._cond.release() - + def set(self): self._cond.acquire() try: Modified: python/trunk/Lib/multiprocessing/util.py ============================================================================== --- python/trunk/Lib/multiprocessing/util.py (original) +++ python/trunk/Lib/multiprocessing/util.py Fri Jun 13 21:13:39 2008 @@ -83,7 +83,7 @@ import logging if hasattr(logging, 'multiprocessing'): return - + logging._acquireLock() try: OldLoggerClass = logging.getLoggerClass() Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Fri Jun 13 21:13:39 2008 @@ -1,1791 +1,1791 @@ -# -# Unit tests for the multiprocessing package -# - -import unittest -import threading -import Queue -import time -import sys -import os -import gc -import signal -import array -import copy -import socket -import random -import logging - -import multiprocessing.dummy -import multiprocessing.connection -import multiprocessing.managers -import multiprocessing.heap -import multiprocessing.managers -import multiprocessing.pool -import _multiprocessing - -from multiprocessing import util - -# -# -# - -if sys.version_info >= (3, 0): - def latin(s): - return s.encode('latin') -else: - latin = str - -try: - bytes -except NameError: - bytes = str - def bytearray(seq): - return array.array('c', seq) - -# -# Constants -# - -LOG_LEVEL = util.SUBWARNING -#LOG_LEVEL = logging.WARNING - -DELTA = 0.1 -CHECK_TIMINGS = False # making true makes tests take a lot longer - # and can sometimes cause some non-serious - # failures because some calls block a bit - # longer than expected -if CHECK_TIMINGS: - TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.82, 0.35, 1.4 -else: - TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.1, 0.1, 0.1 - -HAVE_GETVALUE = not getattr(_multiprocessing, - 'HAVE_BROKEN_SEM_GETVALUE', False) - -# -# Creates a wrapper for a function which records the time it takes to finish -# - -class TimingWrapper(object): - - def __init__(self, func): - self.func = func - self.elapsed = None - - def __call__(self, *args, **kwds): - t = time.time() - try: - return self.func(*args, **kwds) - finally: - self.elapsed = time.time() - t - -# -# Base class for test cases -# - -class BaseTestCase(object): - - ALLOWED_TYPES = ('processes', 'manager', 'threads') - - def assertTimingAlmostEqual(self, a, b): - if CHECK_TIMINGS: - self.assertAlmostEqual(a, b, 1) - - def assertReturnsIfImplemented(self, value, func, *args): - try: - res = func(*args) - except NotImplementedError: - pass - else: - return self.assertEqual(value, res) - -# -# Return the value of a semaphore -# - -def get_value(self): - try: - return self.get_value() - except AttributeError: - try: - return self._Semaphore__value - except AttributeError: - try: - return self._value - except AttributeError: - raise NotImplementedError - -# -# Testcases -# - -class _TestProcess(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def test_current(self): - if self.TYPE == 'threads': - return - - current = self.current_process() - authkey = current.get_authkey() - - self.assertTrue(current.is_alive()) - self.assertTrue(not current.is_daemon()) - self.assertTrue(isinstance(authkey, bytes)) - self.assertTrue(len(authkey) > 0) - self.assertEqual(current.get_ident(), os.getpid()) - self.assertEqual(current.get_exitcode(), None) - - def _test(self, q, *args, **kwds): - current = self.current_process() - q.put(args) - q.put(kwds) - q.put(current.get_name()) - if self.TYPE != 'threads': - q.put(bytes(current.get_authkey())) - q.put(current.pid) - - def test_process(self): - q = self.Queue(1) - e = self.Event() - args = (q, 1, 2) - kwargs = {'hello':23, 'bye':2.54} - name = 'SomeProcess' - p = self.Process( - target=self._test, args=args, kwargs=kwargs, name=name - ) - p.set_daemon(True) - current = self.current_process() - - if self.TYPE != 'threads': - self.assertEquals(p.get_authkey(), current.get_authkey()) - self.assertEquals(p.is_alive(), False) - self.assertEquals(p.is_daemon(), True) - self.assertTrue(p not in self.active_children()) - self.assertTrue(type(self.active_children()) is list) - self.assertEqual(p.get_exitcode(), None) - - p.start() - - self.assertEquals(p.get_exitcode(), None) - self.assertEquals(p.is_alive(), True) - self.assertTrue(p in self.active_children()) - - self.assertEquals(q.get(), args[1:]) - self.assertEquals(q.get(), kwargs) - self.assertEquals(q.get(), p.get_name()) - if self.TYPE != 'threads': - self.assertEquals(q.get(), current.get_authkey()) - self.assertEquals(q.get(), p.pid) - - p.join() - - self.assertEquals(p.get_exitcode(), 0) - self.assertEquals(p.is_alive(), False) - self.assertTrue(p not in self.active_children()) - - def _test_terminate(self): - time.sleep(1000) - - def test_terminate(self): - if self.TYPE == 'threads': - return - - p = self.Process(target=self._test_terminate) - p.set_daemon(True) - p.start() - - self.assertEqual(p.is_alive(), True) - self.assertTrue(p in self.active_children()) - self.assertEqual(p.get_exitcode(), None) - - p.terminate() - - join = TimingWrapper(p.join) - self.assertEqual(join(), None) - self.assertTimingAlmostEqual(join.elapsed, 0.0) - - self.assertEqual(p.is_alive(), False) - self.assertTrue(p not in self.active_children()) - - p.join() - - # XXX sometimes get p.get_exitcode() == 0 on Windows ... - #self.assertEqual(p.get_exitcode(), -signal.SIGTERM) - - def test_cpu_count(self): - try: - cpus = multiprocessing.cpu_count() - except NotImplementedError: - cpus = 1 - self.assertTrue(type(cpus) is int) - self.assertTrue(cpus >= 1) - - def test_active_children(self): - self.assertEqual(type(self.active_children()), list) - - p = self.Process(target=time.sleep, args=(DELTA,)) - self.assertTrue(p not in self.active_children()) - - p.start() - self.assertTrue(p in self.active_children()) - - p.join() - self.assertTrue(p not in self.active_children()) - - def _test_recursion(self, wconn, id): - from multiprocessing import forking - wconn.send(id) - if len(id) < 2: - for i in range(2): - p = self.Process( - target=self._test_recursion, args=(wconn, id+[i]) - ) - p.start() - p.join() - - def test_recursion(self): - rconn, wconn = self.Pipe(duplex=False) - self._test_recursion(wconn, []) - - time.sleep(DELTA) - result = [] - while rconn.poll(): - result.append(rconn.recv()) - - expected = [ - [], - [0], - [0, 0], - [0, 1], - [1], - [1, 0], - [1, 1] - ] - self.assertEqual(result, expected) - -# -# -# - -class _UpperCaser(multiprocessing.Process): - - def __init__(self): - multiprocessing.Process.__init__(self) - self.child_conn, self.parent_conn = multiprocessing.Pipe() - - def run(self): - self.parent_conn.close() - for s in iter(self.child_conn.recv, None): - self.child_conn.send(s.upper()) - self.child_conn.close() - - def submit(self, s): - assert type(s) is str - self.parent_conn.send(s) - return self.parent_conn.recv() - - def stop(self): - self.parent_conn.send(None) - self.parent_conn.close() - self.child_conn.close() - -class _TestSubclassingProcess(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_subclassing(self): - uppercaser = _UpperCaser() - uppercaser.start() - self.assertEqual(uppercaser.submit('hello'), 'HELLO') - self.assertEqual(uppercaser.submit('world'), 'WORLD') - uppercaser.stop() - uppercaser.join() - -# -# -# - -def queue_empty(q): - if hasattr(q, 'empty'): - return q.empty() - else: - return q.qsize() == 0 - -def queue_full(q, maxsize): - if hasattr(q, 'full'): - return q.full() - else: - return q.qsize() == maxsize - - -class _TestQueue(BaseTestCase): - - - def _test_put(self, queue, child_can_start, parent_can_continue): - child_can_start.wait() - for i in range(6): - queue.get() - parent_can_continue.set() - - def test_put(self): - MAXSIZE = 6 - queue = self.Queue(maxsize=MAXSIZE) - child_can_start = self.Event() - parent_can_continue = self.Event() - - proc = self.Process( - target=self._test_put, - args=(queue, child_can_start, parent_can_continue) - ) - proc.set_daemon(True) - proc.start() - - self.assertEqual(queue_empty(queue), True) - self.assertEqual(queue_full(queue, MAXSIZE), False) - - queue.put(1) - queue.put(2, True) - queue.put(3, True, None) - queue.put(4, False) - queue.put(5, False, None) - queue.put_nowait(6) - - # the values may be in buffer but not yet in pipe so sleep a bit - time.sleep(DELTA) - - self.assertEqual(queue_empty(queue), False) - self.assertEqual(queue_full(queue, MAXSIZE), True) - - put = TimingWrapper(queue.put) - put_nowait = TimingWrapper(queue.put_nowait) - - self.assertRaises(Queue.Full, put, 7, False) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, False, None) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put_nowait, 7) - self.assertTimingAlmostEqual(put_nowait.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, True, TIMEOUT1) - self.assertTimingAlmostEqual(put.elapsed, TIMEOUT1) - - self.assertRaises(Queue.Full, put, 7, False, TIMEOUT2) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, True, timeout=TIMEOUT3) - self.assertTimingAlmostEqual(put.elapsed, TIMEOUT3) - - child_can_start.set() - parent_can_continue.wait() - - self.assertEqual(queue_empty(queue), True) - self.assertEqual(queue_full(queue, MAXSIZE), False) - - proc.join() - - def _test_get(self, queue, child_can_start, parent_can_continue): - child_can_start.wait() - queue.put(1) - queue.put(2) - queue.put(3) - queue.put(4) - queue.put(5) - parent_can_continue.set() - - def test_get(self): - queue = self.Queue() - child_can_start = self.Event() - parent_can_continue = self.Event() - - proc = self.Process( - target=self._test_get, - args=(queue, child_can_start, parent_can_continue) - ) - proc.set_daemon(True) - proc.start() - - self.assertEqual(queue_empty(queue), True) - - child_can_start.set() - parent_can_continue.wait() - - time.sleep(DELTA) - self.assertEqual(queue_empty(queue), False) - - self.assertEqual(queue.get(), 1) - self.assertEqual(queue.get(True, None), 2) - self.assertEqual(queue.get(True), 3) - self.assertEqual(queue.get(timeout=1), 4) - self.assertEqual(queue.get_nowait(), 5) - - self.assertEqual(queue_empty(queue), True) - - get = TimingWrapper(queue.get) - get_nowait = TimingWrapper(queue.get_nowait) - - self.assertRaises(Queue.Empty, get, False) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get, False, None) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get_nowait) - self.assertTimingAlmostEqual(get_nowait.elapsed, 0) - - self.assertRaises(Queue.Empty, get, True, TIMEOUT1) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) - - self.assertRaises(Queue.Empty, get, False, TIMEOUT2) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get, timeout=TIMEOUT3) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT3) - - proc.join() - - def _test_fork(self, queue): - for i in range(10, 20): - queue.put(i) - # note that at this point the items may only be buffered, so the - # process cannot shutdown until the feeder thread has finished - # pushing items onto the pipe. - - def test_fork(self): - # Old versions of Queue would fail to create a new feeder - # thread for a forked process if the original process had its - # own feeder thread. This test checks that this no longer - # happens. - - queue = self.Queue() - - # put items on queue so that main process starts a feeder thread - for i in range(10): - queue.put(i) - - # wait to make sure thread starts before we fork a new process - time.sleep(DELTA) - - # fork process - p = self.Process(target=self._test_fork, args=(queue,)) - p.start() - - # check that all expected items are in the queue - for i in range(20): - self.assertEqual(queue.get(), i) - self.assertRaises(Queue.Empty, queue.get, False) - - p.join() - - def test_qsize(self): - q = self.Queue() - try: - self.assertEqual(q.qsize(), 0) - except NotImplementedError: - return - q.put(1) - self.assertEqual(q.qsize(), 1) - q.put(5) - self.assertEqual(q.qsize(), 2) - q.get() - self.assertEqual(q.qsize(), 1) - q.get() - self.assertEqual(q.qsize(), 0) - - def _test_task_done(self, q): - for obj in iter(q.get, None): - time.sleep(DELTA) - q.task_done() - - def test_task_done(self): - queue = self.JoinableQueue() - - if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'): - return - - workers = [self.Process(target=self._test_task_done, args=(queue,)) - for i in xrange(4)] - - for p in workers: - p.start() - - for i in xrange(10): - queue.put(i) - - queue.join() - - for p in workers: - queue.put(None) - - for p in workers: - p.join() - -# -# -# - -class _TestLock(BaseTestCase): - - def test_lock(self): - lock = self.Lock() - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(False), False) - self.assertEqual(lock.release(), None) - self.assertRaises((ValueError, threading.ThreadError), lock.release) - - def test_rlock(self): - lock = self.RLock() - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.release(), None) - self.assertEqual(lock.release(), None) - self.assertEqual(lock.release(), None) - self.assertRaises((AssertionError, RuntimeError), lock.release) - - -class _TestSemaphore(BaseTestCase): - - def _test_semaphore(self, sem): - self.assertReturnsIfImplemented(2, get_value, sem) - self.assertEqual(sem.acquire(), True) - self.assertReturnsIfImplemented(1, get_value, sem) - self.assertEqual(sem.acquire(), True) - self.assertReturnsIfImplemented(0, get_value, sem) - self.assertEqual(sem.acquire(False), False) - self.assertReturnsIfImplemented(0, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(1, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(2, get_value, sem) - - def test_semaphore(self): - sem = self.Semaphore(2) - self._test_semaphore(sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(3, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(4, get_value, sem) - - def test_bounded_semaphore(self): - sem = self.BoundedSemaphore(2) - self._test_semaphore(sem) - # Currently fails on OS/X - #if HAVE_GETVALUE: - # self.assertRaises(ValueError, sem.release) - # self.assertReturnsIfImplemented(2, get_value, sem) - - def test_timeout(self): - if self.TYPE != 'processes': - return - - sem = self.Semaphore(0) - acquire = TimingWrapper(sem.acquire) - - self.assertEqual(acquire(False), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0.0) - - self.assertEqual(acquire(False, None), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0.0) - - self.assertEqual(acquire(False, TIMEOUT1), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0) - - self.assertEqual(acquire(True, TIMEOUT2), False) - self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT2) - - self.assertEqual(acquire(timeout=TIMEOUT3), False) - self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT3) - - -class _TestCondition(BaseTestCase): - - def f(self, cond, sleeping, woken, timeout=None): - cond.acquire() - sleeping.release() - cond.wait(timeout) - woken.release() - cond.release() - - def check_invariant(self, cond): - # this is only supposed to succeed when there are no sleepers - if self.TYPE == 'processes': - try: - sleepers = (cond._sleeping_count.get_value() - - cond._woken_count.get_value()) - self.assertEqual(sleepers, 0) - self.assertEqual(cond._wait_semaphore.get_value(), 0) - except NotImplementedError: - pass - - def test_notify(self): - cond = self.Condition() - sleeping = self.Semaphore(0) - woken = self.Semaphore(0) - - p = self.Process(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - # wait for both children to start sleeping - sleeping.acquire() - sleeping.acquire() - - # check no process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(0, get_value, woken) - - # wake up one process/thread - cond.acquire() - cond.notify() - cond.release() - - # check one process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(1, get_value, woken) - - # wake up another - cond.acquire() - cond.notify() - cond.release() - - # check other has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(2, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - p.join() - - def test_notify_all(self): - cond = self.Condition() - sleeping = self.Semaphore(0) - woken = self.Semaphore(0) - - # start some threads/processes which will timeout - for i in range(3): - p = self.Process(target=self.f, - args=(cond, sleeping, woken, TIMEOUT1)) - p.set_daemon(True) - p.start() - - t = threading.Thread(target=self.f, - args=(cond, sleeping, woken, TIMEOUT1)) - t.set_daemon(True) - t.start() - - # wait for them all to sleep - for i in xrange(6): - sleeping.acquire() - - # check they have all timed out - for i in xrange(6): - woken.acquire() - self.assertReturnsIfImplemented(0, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - - # start some more threads/processes - for i in range(3): - p = self.Process(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - t.set_daemon(True) - t.start() - - # wait for them to all sleep - for i in xrange(6): - sleeping.acquire() - - # check no process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(0, get_value, woken) - - # wake them all up - cond.acquire() - cond.notify_all() - cond.release() - - # check they have all woken - time.sleep(DELTA) - self.assertReturnsIfImplemented(6, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - - def test_timeout(self): - cond = self.Condition() - wait = TimingWrapper(cond.wait) - cond.acquire() - res = wait(TIMEOUT1) - cond.release() - self.assertEqual(res, None) - self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) - - -class _TestEvent(BaseTestCase): - - def _test_event(self, event): - time.sleep(TIMEOUT2) - event.set() - - def test_event(self): - event = self.Event() - wait = TimingWrapper(event.wait) - - # Removed temporaily, due to API shear, this does not - # work with threading._Event objects. is_set == isSet - #self.assertEqual(event.is_set(), False) - - self.assertEqual(wait(0.0), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - self.assertEqual(wait(TIMEOUT1), None) - self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) - - event.set() - - # See note above on the API differences - # self.assertEqual(event.is_set(), True) - self.assertEqual(wait(), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - self.assertEqual(wait(TIMEOUT1), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - # self.assertEqual(event.is_set(), True) - - event.clear() - - #self.assertEqual(event.is_set(), False) - - self.Process(target=self._test_event, args=(event,)).start() - self.assertEqual(wait(), None) - -# -# -# - -class _TestValue(BaseTestCase): - - codes_values = [ - ('i', 4343, 24234), - ('d', 3.625, -4.25), - ('h', -232, 234), - ('c', latin('x'), latin('y')) - ] - - def _test(self, values): - for sv, cv in zip(values, self.codes_values): - sv.value = cv[2] - - - def test_value(self, raw=False): - if self.TYPE != 'processes': - return - - if raw: - values = [self.RawValue(code, value) - for code, value, _ in self.codes_values] - else: - values = [self.Value(code, value) - for code, value, _ in self.codes_values] - - for sv, cv in zip(values, self.codes_values): - self.assertEqual(sv.value, cv[1]) - - proc = self.Process(target=self._test, args=(values,)) - proc.start() - proc.join() - - for sv, cv in zip(values, self.codes_values): - self.assertEqual(sv.value, cv[2]) - - def test_rawvalue(self): - self.test_value(raw=True) - - def test_getobj_getlock(self): - if self.TYPE != 'processes': - return - - val1 = self.Value('i', 5) - lock1 = val1.get_lock() - obj1 = val1.get_obj() - - val2 = self.Value('i', 5, lock=None) - lock2 = val2.get_lock() - obj2 = val2.get_obj() - - lock = self.Lock() - val3 = self.Value('i', 5, lock=lock) - lock3 = val3.get_lock() - obj3 = val3.get_obj() - self.assertEqual(lock, lock3) - - arr4 = self.RawValue('i', 5) - self.assertFalse(hasattr(arr4, 'get_lock')) - self.assertFalse(hasattr(arr4, 'get_obj')) - - -class _TestArray(BaseTestCase): - - def f(self, seq): - for i in range(1, len(seq)): - seq[i] += seq[i-1] - - def test_array(self, raw=False): - if self.TYPE != 'processes': - return - - seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831] - if raw: - arr = self.RawArray('i', seq) - else: - arr = self.Array('i', seq) - - self.assertEqual(len(arr), len(seq)) - self.assertEqual(arr[3], seq[3]) - self.assertEqual(list(arr[2:7]), list(seq[2:7])) - - arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4]) - - self.assertEqual(list(arr[:]), seq) - - self.f(seq) - - p = self.Process(target=self.f, args=(arr,)) - p.start() - p.join() - - self.assertEqual(list(arr[:]), seq) - - def test_rawarray(self): - self.test_array(raw=True) - - def test_getobj_getlock_obj(self): - if self.TYPE != 'processes': - return - - arr1 = self.Array('i', range(10)) - lock1 = arr1.get_lock() - obj1 = arr1.get_obj() - - arr2 = self.Array('i', range(10), lock=None) - lock2 = arr2.get_lock() - obj2 = arr2.get_obj() - - lock = self.Lock() - arr3 = self.Array('i', range(10), lock=lock) - lock3 = arr3.get_lock() - obj3 = arr3.get_obj() - self.assertEqual(lock, lock3) - - arr4 = self.RawArray('i', range(10)) - self.assertFalse(hasattr(arr4, 'get_lock')) - self.assertFalse(hasattr(arr4, 'get_obj')) - -# -# -# - -class _TestContainers(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def test_list(self): - a = self.list(range(10)) - self.assertEqual(a[:], range(10)) - - b = self.list() - self.assertEqual(b[:], []) - - b.extend(range(5)) - self.assertEqual(b[:], range(5)) - - self.assertEqual(b[2], 2) - self.assertEqual(b[2:10], [2,3,4]) - - b *= 2 - self.assertEqual(b[:], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) - - self.assertEqual(b + [5, 6], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6]) - - self.assertEqual(a[:], range(10)) - - d = [a, b] - e = self.list(d) - self.assertEqual( - e[:], - [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]] - ) - - f = self.list([a]) - a.append('hello') - self.assertEqual(f[:], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello']]) - - def test_dict(self): - d = self.dict() - indices = range(65, 70) - for i in indices: - d[i] = chr(i) - self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices)) - self.assertEqual(sorted(d.keys()), indices) - self.assertEqual(sorted(d.values()), [chr(i) for i in indices]) - self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices]) - - def test_namespace(self): - n = self.Namespace() - n.name = 'Bob' - n.job = 'Builder' - n._hidden = 'hidden' - self.assertEqual((n.name, n.job), ('Bob', 'Builder')) - del n.job - self.assertEqual(str(n), "Namespace(name='Bob')") - self.assertTrue(hasattr(n, 'name')) - self.assertTrue(not hasattr(n, 'job')) - -# -# -# - -def sqr(x, wait=0.0): - time.sleep(wait) - return x*x - -class _TestPool(BaseTestCase): - - def test_apply(self): - papply = self.pool.apply - self.assertEqual(papply(sqr, (5,)), sqr(5)) - self.assertEqual(papply(sqr, (), {'x':3}), sqr(x=3)) - - def test_map(self): - pmap = self.pool.map - self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) - self.assertEqual(pmap(sqr, range(100), chunksize=20), - map(sqr, range(100))) - - def test_async(self): - res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) - get = TimingWrapper(res.get) - self.assertEqual(get(), 49) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) - - def test_async_timeout(self): - res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) - get = TimingWrapper(res.get) - self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) - - def test_imap(self): - it = self.pool.imap(sqr, range(10)) - self.assertEqual(list(it), map(sqr, range(10))) - - it = self.pool.imap(sqr, range(10)) - for i in range(10): - self.assertEqual(it.next(), i*i) - self.assertRaises(StopIteration, it.next) - - it = self.pool.imap(sqr, range(1000), chunksize=100) - for i in range(1000): - self.assertEqual(it.next(), i*i) - self.assertRaises(StopIteration, it.next) - - def test_imap_unordered(self): - it = self.pool.imap_unordered(sqr, range(1000)) - self.assertEqual(sorted(it), map(sqr, range(1000))) - - it = self.pool.imap_unordered(sqr, range(1000), chunksize=53) - self.assertEqual(sorted(it), map(sqr, range(1000))) - - def test_make_pool(self): - p = multiprocessing.Pool(3) - self.assertEqual(3, len(p._pool)) - p.close() - p.join() - - def test_terminate(self): - if self.TYPE == 'manager': - # On Unix a forked process increfs each shared object to - # which its parent process held a reference. If the - # forked process gets terminated then there is likely to - # be a reference leak. So to prevent - # _TestZZZNumberOfObjects from failing we skip this test - # when using a manager. - return - - result = self.pool.map_async( - time.sleep, [0.1 for i in range(10000)], chunksize=1 - ) - self.pool.terminate() - join = TimingWrapper(self.pool.join) - join() - self.assertTrue(join.elapsed < 0.2) - -# -# Test that manager has expected number of shared objects left -# - -class _TestZZZNumberOfObjects(BaseTestCase): - # Because test cases are sorted alphabetically, this one will get - # run after all the other tests for the manager. It tests that - # there have been no "reference leaks" for the manager's shared - # objects. Note the comment in _TestPool.test_terminate(). - ALLOWED_TYPES = ('manager',) - - def test_number_of_objects(self): - EXPECTED_NUMBER = 1 # the pool object is still alive - multiprocessing.active_children() # discard dead process objs - gc.collect() # do garbage collection - refs = self.manager._number_of_objects() - if refs != EXPECTED_NUMBER: - print self.manager._debugInfo() - - self.assertEqual(refs, EXPECTED_NUMBER) - -# -# Test of creating a customized manager class -# - -from multiprocessing.managers import BaseManager, BaseProxy, RemoteError - -class FooBar(object): - def f(self): - return 'f()' - def g(self): - raise ValueError - def _h(self): - return '_h()' - -def baz(): - for i in xrange(10): - yield i*i - -class IteratorProxy(BaseProxy): - _exposed_ = ('next', '__next__') - def __iter__(self): - return self - def next(self): - return self._callmethod('next') - def __next__(self): - return self._callmethod('__next__') - -class MyManager(BaseManager): - pass - -MyManager.register('Foo', callable=FooBar) -MyManager.register('Bar', callable=FooBar, exposed=('f', '_h')) -MyManager.register('baz', callable=baz, proxytype=IteratorProxy) - - -class _TestMyManager(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def test_mymanager(self): - manager = MyManager() - manager.start() - - foo = manager.Foo() - bar = manager.Bar() - baz = manager.baz() - - foo_methods = [name for name in ('f', 'g', '_h') if hasattr(foo, name)] - bar_methods = [name for name in ('f', 'g', '_h') if hasattr(bar, name)] - - self.assertEqual(foo_methods, ['f', 'g']) - self.assertEqual(bar_methods, ['f', '_h']) - - self.assertEqual(foo.f(), 'f()') - self.assertRaises(ValueError, foo.g) - self.assertEqual(foo._callmethod('f'), 'f()') - self.assertRaises(RemoteError, foo._callmethod, '_h') - - self.assertEqual(bar.f(), 'f()') - self.assertEqual(bar._h(), '_h()') - self.assertEqual(bar._callmethod('f'), 'f()') - self.assertEqual(bar._callmethod('_h'), '_h()') - - self.assertEqual(list(baz), [i*i for i in range(10)]) - - manager.shutdown() - -# -# Test of connecting to a remote server and using xmlrpclib for serialization -# - -_queue = Queue.Queue() -def get_queue(): - return _queue - -class QueueManager(BaseManager): - '''manager class used by server process''' -QueueManager.register('get_queue', callable=get_queue) - -class QueueManager2(BaseManager): - '''manager class which specifies the same interface as QueueManager''' -QueueManager2.register('get_queue') - - -SERIALIZER = 'xmlrpclib' - -class _TestRemoteManager(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def _putter(self, address, authkey): - manager = QueueManager2( - address=address, authkey=authkey, serializer=SERIALIZER - ) - manager.connect() - queue = manager.get_queue() - queue.put(('hello world', None, True, 2.25)) - - def test_remote(self): - authkey = os.urandom(32) - - manager = QueueManager( - address=('localhost', 0), authkey=authkey, serializer=SERIALIZER - ) - manager.start() - - p = self.Process(target=self._putter, args=(manager.address, authkey)) - p.start() - - manager2 = QueueManager2( - address=manager.address, authkey=authkey, serializer=SERIALIZER - ) - manager2.connect() - queue = manager2.get_queue() - - # Note that xmlrpclib will deserialize object as a list not a tuple - self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) - - # Because we are using xmlrpclib for serialization instead of - # pickle this will cause a serialization error. - self.assertRaises(Exception, queue.put, time.sleep) - - # Make queue finalizer run before the server is stopped - del queue - manager.shutdown() - -# -# -# - -SENTINEL = latin('') - -class _TestConnection(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def _echo(self, conn): - for msg in iter(conn.recv_bytes, SENTINEL): - conn.send_bytes(msg) - conn.close() - - def test_connection(self): - conn, child_conn = self.Pipe() - - p = self.Process(target=self._echo, args=(child_conn,)) - p.set_daemon(True) - p.start() - - seq = [1, 2.25, None] - msg = latin('hello world') - longmsg = msg * 10 - arr = array.array('i', range(4)) - - if self.TYPE == 'processes': - self.assertEqual(type(conn.fileno()), int) - - self.assertEqual(conn.send(seq), None) - self.assertEqual(conn.recv(), seq) - - self.assertEqual(conn.send_bytes(msg), None) - self.assertEqual(conn.recv_bytes(), msg) - - if self.TYPE == 'processes': - buffer = array.array('i', [0]*10) - expected = list(arr) + [0] * (10 - len(arr)) - self.assertEqual(conn.send_bytes(arr), None) - self.assertEqual(conn.recv_bytes_into(buffer), - len(arr) * buffer.itemsize) - self.assertEqual(list(buffer), expected) - - buffer = array.array('i', [0]*10) - expected = [0] * 3 + list(arr) + [0] * (10 - 3 - len(arr)) - self.assertEqual(conn.send_bytes(arr), None) - self.assertEqual(conn.recv_bytes_into(buffer, 3 * buffer.itemsize), - len(arr) * buffer.itemsize) - self.assertEqual(list(buffer), expected) - - buffer = bytearray(latin(' ' * 40)) - self.assertEqual(conn.send_bytes(longmsg), None) - try: - res = conn.recv_bytes_into(buffer) - except multiprocessing.BufferTooShort, e: - self.assertEqual(e.args, (longmsg,)) - else: - self.fail('expected BufferTooShort, got %s' % res) - - poll = TimingWrapper(conn.poll) - - self.assertEqual(poll(), False) - self.assertTimingAlmostEqual(poll.elapsed, 0) - - self.assertEqual(poll(TIMEOUT1), False) - self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1) - - conn.send(None) - - self.assertEqual(poll(TIMEOUT1), True) - self.assertTimingAlmostEqual(poll.elapsed, 0) - - self.assertEqual(conn.recv(), None) - - really_big_msg = latin('X') * (1024 * 1024 * 16) # 16Mb - conn.send_bytes(really_big_msg) - self.assertEqual(conn.recv_bytes(), really_big_msg) - - conn.send_bytes(SENTINEL) # tell child to quit - child_conn.close() - - if self.TYPE == 'processes': - self.assertEqual(conn.readable, True) - self.assertEqual(conn.writable, True) - self.assertRaises(EOFError, conn.recv) - self.assertRaises(EOFError, conn.recv_bytes) - - p.join() - - def test_duplex_false(self): - reader, writer = self.Pipe(duplex=False) - self.assertEqual(writer.send(1), None) - self.assertEqual(reader.recv(), 1) - if self.TYPE == 'processes': - self.assertEqual(reader.readable, True) - self.assertEqual(reader.writable, False) - self.assertEqual(writer.readable, False) - self.assertEqual(writer.writable, True) - self.assertRaises(IOError, reader.send, 2) - self.assertRaises(IOError, writer.recv) - self.assertRaises(IOError, writer.poll) - - def test_spawn_close(self): - # We test that a pipe connection can be closed by parent - # process immediately after child is spawned. On Windows this - # would have sometimes failed on old versions because - # child_conn would be closed before the child got a chance to - # duplicate it. - conn, child_conn = self.Pipe() - - p = self.Process(target=self._echo, args=(child_conn,)) - p.start() - child_conn.close() # this might complete before child initializes - - msg = latin('hello') - conn.send_bytes(msg) - self.assertEqual(conn.recv_bytes(), msg) - - conn.send_bytes(SENTINEL) - conn.close() - p.join() - - def test_sendbytes(self): - if self.TYPE != 'processes': - return - - msg = latin('abcdefghijklmnopqrstuvwxyz') - a, b = self.Pipe() - - a.send_bytes(msg) - self.assertEqual(b.recv_bytes(), msg) - - a.send_bytes(msg, 5) - self.assertEqual(b.recv_bytes(), msg[5:]) - - a.send_bytes(msg, 7, 8) - self.assertEqual(b.recv_bytes(), msg[7:7+8]) - - a.send_bytes(msg, 26) - self.assertEqual(b.recv_bytes(), latin('')) - - a.send_bytes(msg, 26, 0) - self.assertEqual(b.recv_bytes(), latin('')) - - self.assertRaises(ValueError, a.send_bytes, msg, 27) - - self.assertRaises(ValueError, a.send_bytes, msg, 22, 5) - - self.assertRaises(ValueError, a.send_bytes, msg, 26, 1) - - self.assertRaises(ValueError, a.send_bytes, msg, -1) - - self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) - - -class _TestListenerClient(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def _test(self, address): - conn = self.connection.Client(address) - conn.send('hello') - conn.close() - - def test_listener_client(self): - for family in self.connection.families: - l = self.connection.Listener(family=family) - p = self.Process(target=self._test, args=(l.address,)) - p.set_daemon(True) - p.start() - conn = l.accept() - self.assertEqual(conn.recv(), 'hello') - p.join() - l.close() - -# -# Test of sending connection and socket objects between processes -# - -class _TestPicklingConnections(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _listener(self, conn, families): - for fam in families: - l = self.connection.Listener(family=fam) - conn.send(l.address) - new_conn = l.accept() - conn.send(new_conn) - - if self.TYPE == 'processes': - l = socket.socket() - l.bind(('localhost', 0)) - conn.send(l.getsockname()) - l.listen(1) - new_conn, addr = l.accept() - conn.send(new_conn) - - conn.recv() - - def _remote(self, conn): - for (address, msg) in iter(conn.recv, None): - client = self.connection.Client(address) - client.send(msg.upper()) - client.close() - - if self.TYPE == 'processes': - address, msg = conn.recv() - client = socket.socket() - client.connect(address) - client.sendall(msg.upper()) - client.close() - - conn.close() - - def test_pickling(self): - try: - multiprocessing.allow_connection_pickling() - except ImportError: - return - - families = self.connection.families - - lconn, lconn0 = self.Pipe() - lp = self.Process(target=self._listener, args=(lconn0, families)) - lp.start() - lconn0.close() - - rconn, rconn0 = self.Pipe() - rp = self.Process(target=self._remote, args=(rconn0,)) - rp.start() - rconn0.close() - - for fam in families: - msg = ('This connection uses family %s' % fam).encode('ascii') - address = lconn.recv() - rconn.send((address, msg)) - new_conn = lconn.recv() - self.assertEqual(new_conn.recv(), msg.upper()) - - rconn.send(None) - - if self.TYPE == 'processes': - msg = latin('This connection uses a normal socket') - address = lconn.recv() - rconn.send((address, msg)) - if hasattr(socket, 'fromfd'): - new_conn = lconn.recv() - self.assertEqual(new_conn.recv(100), msg.upper()) - else: - # XXX On Windows with Py2.6 need to backport fromfd() - discard = lconn.recv_bytes() - - lconn.send(None) - - rconn.close() - lconn.close() - - lp.join() - rp.join() - -# -# -# - -class _TestHeap(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_heap(self): - iterations = 5000 - maxblocks = 50 - blocks = [] - - # create and destroy lots of blocks of different sizes - for i in xrange(iterations): - size = int(random.lognormvariate(0, 1) * 1000) - b = multiprocessing.heap.BufferWrapper(size) - blocks.append(b) - if len(blocks) > maxblocks: - i = random.randrange(maxblocks) - del blocks[i] - - # get the heap object - heap = multiprocessing.heap.BufferWrapper._heap - - # verify the state of the heap - all = [] - occupied = 0 - for L in heap._len_to_seq.values(): - for arena, start, stop in L: - all.append((heap._arenas.index(arena), start, stop, - stop-start, 'free')) - for arena, start, stop in heap._allocated_blocks: - all.append((heap._arenas.index(arena), start, stop, - stop-start, 'occupied')) - occupied += (stop-start) - - all.sort() - - for i in range(len(all)-1): - (arena, start, stop) = all[i][:3] - (narena, nstart, nstop) = all[i+1][:3] - self.assertTrue((arena != narena and nstart == 0) or - (stop == nstart)) - -# -# -# - -try: - from ctypes import Structure, Value, copy, c_int, c_double -except ImportError: - Structure = object - c_int = c_double = None - -class _Foo(Structure): - _fields_ = [ - ('x', c_int), - ('y', c_double) - ] - -class _TestSharedCTypes(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _double(self, x, y, foo, arr, string): - x.value *= 2 - y.value *= 2 - foo.x *= 2 - foo.y *= 2 - string.value *= 2 - for i in range(len(arr)): - arr[i] *= 2 - - def test_sharedctypes(self, lock=False): - if c_int is None: - return - - x = Value('i', 7, lock=lock) - y = Value(ctypes.c_double, 1.0/3.0, lock=lock) - foo = Value(_Foo, 3, 2, lock=lock) - arr = Array('d', range(10), lock=lock) - string = Array('c', 20, lock=lock) - string.value = 'hello' - - p = self.Process(target=self._double, args=(x, y, foo, arr, string)) - p.start() - p.join() - - self.assertEqual(x.value, 14) - self.assertAlmostEqual(y.value, 2.0/3.0) - self.assertEqual(foo.x, 6) - self.assertAlmostEqual(foo.y, 4.0) - for i in range(10): - self.assertAlmostEqual(arr[i], i*2) - self.assertEqual(string.value, latin('hellohello')) - - def test_synchronize(self): - self.test_sharedctypes(lock=True) - - def test_copy(self): - if c_int is None: - return - - foo = _Foo(2, 5.0) - bar = copy(foo) - foo.x = 0 - foo.y = 0 - self.assertEqual(bar.x, 2) - self.assertAlmostEqual(bar.y, 5.0) - -# -# -# - -class _TestFinalize(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _test_finalize(self, conn): - class Foo(object): - pass - - a = Foo() - util.Finalize(a, conn.send, args=('a',)) - del a # triggers callback for a - - b = Foo() - close_b = util.Finalize(b, conn.send, args=('b',)) - close_b() # triggers callback for b - close_b() # does nothing because callback has already been called - del b # does nothing because callback has already been called - - c = Foo() - util.Finalize(c, conn.send, args=('c',)) - - d10 = Foo() - util.Finalize(d10, conn.send, args=('d10',), exitpriority=1) - - d01 = Foo() - util.Finalize(d01, conn.send, args=('d01',), exitpriority=0) - d02 = Foo() - util.Finalize(d02, conn.send, args=('d02',), exitpriority=0) - d03 = Foo() - util.Finalize(d03, conn.send, args=('d03',), exitpriority=0) - - util.Finalize(None, conn.send, args=('e',), exitpriority=-10) - - util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100) - - # call mutliprocessing's cleanup function then exit process without - # garbage collecting locals - util._exit_function() - conn.close() - os._exit(0) - - def test_finalize(self): - conn, child_conn = self.Pipe() - - p = self.Process(target=self._test_finalize, args=(child_conn,)) - p.start() - p.join() - - result = [obj for obj in iter(conn.recv, 'STOP')] - self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e']) - -# -# Test that from ... import * works for each module -# - -class _TestImportStar(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_import(self): - modules = ( - 'multiprocessing', 'multiprocessing.connection', - 'multiprocessing.heap', 'multiprocessing.managers', - 'multiprocessing.pool', 'multiprocessing.process', - 'multiprocessing.reduction', 'multiprocessing.sharedctypes', - 'multiprocessing.synchronize', 'multiprocessing.util' - ) - - for name in modules: - __import__(name) - mod = sys.modules[name] - - for attr in getattr(mod, '__all__', ()): - self.assertTrue( - hasattr(mod, attr), - '%r does not have attribute %r' % (mod, attr) - ) - -# -# Quick test that logging works -- does not test logging output -# - -class _TestLogging(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_enable_logging(self): - logger = multiprocessing.get_logger() - logger.setLevel(util.SUBWARNING) - self.assertTrue(logger is not None) - logger.debug('this will not be printed') - logger.info('nor will this') - logger.setLevel(LOG_LEVEL) - - def _test_level(self, conn): - logger = multiprocessing.get_logger() - conn.send(logger.getEffectiveLevel()) - - def test_level(self): - LEVEL1 = 32 - LEVEL2 = 37 - - logger = multiprocessing.get_logger() - root_logger = logging.getLogger() - root_level = root_logger.level - - reader, writer = multiprocessing.Pipe(duplex=False) - - logger.setLevel(LEVEL1) - self.Process(target=self._test_level, args=(writer,)).start() - self.assertEqual(LEVEL1, reader.recv()) - - logger.setLevel(logging.NOTSET) - root_logger.setLevel(LEVEL2) - self.Process(target=self._test_level, args=(writer,)).start() - self.assertEqual(LEVEL2, reader.recv()) - - root_logger.setLevel(root_level) - logger.setLevel(level=LOG_LEVEL) - -# -# Functions used to create test cases from the base ones in this module -# - -def get_attributes(Source, names): - d = {} - for name in names: - obj = getattr(Source, name) - if type(obj) == type(get_attributes): - obj = staticmethod(obj) - d[name] = obj - return d - -def create_test_cases(Mixin, type): - result = {} - glob = globals() - Type = type[0].upper() + type[1:] - - for name in glob.keys(): - if name.startswith('_Test'): - base = glob[name] - if type in base.ALLOWED_TYPES: - newname = 'With' + Type + name[1:] - class Temp(base, unittest.TestCase, Mixin): - pass - result[newname] = Temp - Temp.__name__ = newname - Temp.__module__ = Mixin.__module__ - return result - -# -# Create test cases -# - -class ProcessesMixin(object): - TYPE = 'processes' - Process = multiprocessing.Process - locals().update(get_attributes(multiprocessing, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'RawValue', - 'RawArray', 'current_process', 'active_children', 'Pipe', - 'connection', 'JoinableQueue' - ))) - -testcases_processes = create_test_cases(ProcessesMixin, type='processes') -globals().update(testcases_processes) - - -class ManagerMixin(object): - TYPE = 'manager' - Process = multiprocessing.Process - manager = object.__new__(multiprocessing.managers.SyncManager) - locals().update(get_attributes(manager, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'list', 'dict', - 'Namespace', 'JoinableQueue' - ))) - -testcases_manager = create_test_cases(ManagerMixin, type='manager') -globals().update(testcases_manager) - - -class ThreadsMixin(object): - TYPE = 'threads' - Process = multiprocessing.dummy.Process - locals().update(get_attributes(multiprocessing.dummy, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'current_process', - 'active_children', 'Pipe', 'connection', 'dict', 'list', - 'Namespace', 'JoinableQueue' - ))) - -testcases_threads = create_test_cases(ThreadsMixin, type='threads') -globals().update(testcases_threads) - -# -# -# - -def test_main(run=None): - if run is None: - from test.test_support import run_unittest as run - - util.get_temp_dir() # creates temp directory for use by all processes - - multiprocessing.get_logger().setLevel(LOG_LEVEL) - - ProcessesMixin.pool = multiprocessing.Pool(4) - ThreadsMixin.pool = multiprocessing.dummy.Pool(4) - ManagerMixin.manager.__init__() - ManagerMixin.manager.start() - ManagerMixin.pool = ManagerMixin.manager.Pool(4) - - testcases = ( - sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + - sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + - sorted(testcases_manager.values(), key=lambda tc:tc.__name__) - ) - - loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase - suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) - run(suite) - - ThreadsMixin.pool.terminate() - ProcessesMixin.pool.terminate() - ManagerMixin.pool.terminate() - ManagerMixin.manager.shutdown() - - del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool - -def main(): - test_main(unittest.TextTestRunner(verbosity=2).run) - -if __name__ == '__main__': - main() +# +# Unit tests for the multiprocessing package +# + +import unittest +import threading +import Queue +import time +import sys +import os +import gc +import signal +import array +import copy +import socket +import random +import logging + +import multiprocessing.dummy +import multiprocessing.connection +import multiprocessing.managers +import multiprocessing.heap +import multiprocessing.managers +import multiprocessing.pool +import _multiprocessing + +from multiprocessing import util + +# +# +# + +if sys.version_info >= (3, 0): + def latin(s): + return s.encode('latin') +else: + latin = str + +try: + bytes +except NameError: + bytes = str + def bytearray(seq): + return array.array('c', seq) + +# +# Constants +# + +LOG_LEVEL = util.SUBWARNING +#LOG_LEVEL = logging.WARNING + +DELTA = 0.1 +CHECK_TIMINGS = False # making true makes tests take a lot longer + # and can sometimes cause some non-serious + # failures because some calls block a bit + # longer than expected +if CHECK_TIMINGS: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.82, 0.35, 1.4 +else: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.1, 0.1, 0.1 + +HAVE_GETVALUE = not getattr(_multiprocessing, + 'HAVE_BROKEN_SEM_GETVALUE', False) + +# +# Creates a wrapper for a function which records the time it takes to finish +# + +class TimingWrapper(object): + + def __init__(self, func): + self.func = func + self.elapsed = None + + def __call__(self, *args, **kwds): + t = time.time() + try: + return self.func(*args, **kwds) + finally: + self.elapsed = time.time() - t + +# +# Base class for test cases +# + +class BaseTestCase(object): + + ALLOWED_TYPES = ('processes', 'manager', 'threads') + + def assertTimingAlmostEqual(self, a, b): + if CHECK_TIMINGS: + self.assertAlmostEqual(a, b, 1) + + def assertReturnsIfImplemented(self, value, func, *args): + try: + res = func(*args) + except NotImplementedError: + pass + else: + return self.assertEqual(value, res) + +# +# Return the value of a semaphore +# + +def get_value(self): + try: + return self.get_value() + except AttributeError: + try: + return self._Semaphore__value + except AttributeError: + try: + return self._value + except AttributeError: + raise NotImplementedError + +# +# Testcases +# + +class _TestProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def test_current(self): + if self.TYPE == 'threads': + return + + current = self.current_process() + authkey = current.get_authkey() + + self.assertTrue(current.is_alive()) + self.assertTrue(not current.is_daemon()) + self.assertTrue(isinstance(authkey, bytes)) + self.assertTrue(len(authkey) > 0) + self.assertEqual(current.get_ident(), os.getpid()) + self.assertEqual(current.get_exitcode(), None) + + def _test(self, q, *args, **kwds): + current = self.current_process() + q.put(args) + q.put(kwds) + q.put(current.get_name()) + if self.TYPE != 'threads': + q.put(bytes(current.get_authkey())) + q.put(current.pid) + + def test_process(self): + q = self.Queue(1) + e = self.Event() + args = (q, 1, 2) + kwargs = {'hello':23, 'bye':2.54} + name = 'SomeProcess' + p = self.Process( + target=self._test, args=args, kwargs=kwargs, name=name + ) + p.set_daemon(True) + current = self.current_process() + + if self.TYPE != 'threads': + self.assertEquals(p.get_authkey(), current.get_authkey()) + self.assertEquals(p.is_alive(), False) + self.assertEquals(p.is_daemon(), True) + self.assertTrue(p not in self.active_children()) + self.assertTrue(type(self.active_children()) is list) + self.assertEqual(p.get_exitcode(), None) + + p.start() + + self.assertEquals(p.get_exitcode(), None) + self.assertEquals(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + + self.assertEquals(q.get(), args[1:]) + self.assertEquals(q.get(), kwargs) + self.assertEquals(q.get(), p.get_name()) + if self.TYPE != 'threads': + self.assertEquals(q.get(), current.get_authkey()) + self.assertEquals(q.get(), p.pid) + + p.join() + + self.assertEquals(p.get_exitcode(), 0) + self.assertEquals(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + def _test_terminate(self): + time.sleep(1000) + + def test_terminate(self): + if self.TYPE == 'threads': + return + + p = self.Process(target=self._test_terminate) + p.set_daemon(True) + p.start() + + self.assertEqual(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + self.assertEqual(p.get_exitcode(), None) + + p.terminate() + + join = TimingWrapper(p.join) + self.assertEqual(join(), None) + self.assertTimingAlmostEqual(join.elapsed, 0.0) + + self.assertEqual(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + p.join() + + # XXX sometimes get p.get_exitcode() == 0 on Windows ... + #self.assertEqual(p.get_exitcode(), -signal.SIGTERM) + + def test_cpu_count(self): + try: + cpus = multiprocessing.cpu_count() + except NotImplementedError: + cpus = 1 + self.assertTrue(type(cpus) is int) + self.assertTrue(cpus >= 1) + + def test_active_children(self): + self.assertEqual(type(self.active_children()), list) + + p = self.Process(target=time.sleep, args=(DELTA,)) + self.assertTrue(p not in self.active_children()) + + p.start() + self.assertTrue(p in self.active_children()) + + p.join() + self.assertTrue(p not in self.active_children()) + + def _test_recursion(self, wconn, id): + from multiprocessing import forking + wconn.send(id) + if len(id) < 2: + for i in range(2): + p = self.Process( + target=self._test_recursion, args=(wconn, id+[i]) + ) + p.start() + p.join() + + def test_recursion(self): + rconn, wconn = self.Pipe(duplex=False) + self._test_recursion(wconn, []) + + time.sleep(DELTA) + result = [] + while rconn.poll(): + result.append(rconn.recv()) + + expected = [ + [], + [0], + [0, 0], + [0, 1], + [1], + [1, 0], + [1, 1] + ] + self.assertEqual(result, expected) + +# +# +# + +class _UpperCaser(multiprocessing.Process): + + def __init__(self): + multiprocessing.Process.__init__(self) + self.child_conn, self.parent_conn = multiprocessing.Pipe() + + def run(self): + self.parent_conn.close() + for s in iter(self.child_conn.recv, None): + self.child_conn.send(s.upper()) + self.child_conn.close() + + def submit(self, s): + assert type(s) is str + self.parent_conn.send(s) + return self.parent_conn.recv() + + def stop(self): + self.parent_conn.send(None) + self.parent_conn.close() + self.child_conn.close() + +class _TestSubclassingProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_subclassing(self): + uppercaser = _UpperCaser() + uppercaser.start() + self.assertEqual(uppercaser.submit('hello'), 'HELLO') + self.assertEqual(uppercaser.submit('world'), 'WORLD') + uppercaser.stop() + uppercaser.join() + +# +# +# + +def queue_empty(q): + if hasattr(q, 'empty'): + return q.empty() + else: + return q.qsize() == 0 + +def queue_full(q, maxsize): + if hasattr(q, 'full'): + return q.full() + else: + return q.qsize() == maxsize + + +class _TestQueue(BaseTestCase): + + + def _test_put(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + for i in range(6): + queue.get() + parent_can_continue.set() + + def test_put(self): + MAXSIZE = 6 + queue = self.Queue(maxsize=MAXSIZE) + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_put, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + queue.put(1) + queue.put(2, True) + queue.put(3, True, None) + queue.put(4, False) + queue.put(5, False, None) + queue.put_nowait(6) + + # the values may be in buffer but not yet in pipe so sleep a bit + time.sleep(DELTA) + + self.assertEqual(queue_empty(queue), False) + self.assertEqual(queue_full(queue, MAXSIZE), True) + + put = TimingWrapper(queue.put) + put_nowait = TimingWrapper(queue.put_nowait) + + self.assertRaises(Queue.Full, put, 7, False) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, False, None) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put_nowait, 7) + self.assertTimingAlmostEqual(put_nowait.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, TIMEOUT1) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Full, put, 7, False, TIMEOUT2) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT3) + + child_can_start.set() + parent_can_continue.wait() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + proc.join() + + def _test_get(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + queue.put(1) + queue.put(2) + queue.put(3) + queue.put(4) + queue.put(5) + parent_can_continue.set() + + def test_get(self): + queue = self.Queue() + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_get, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + + child_can_start.set() + parent_can_continue.wait() + + time.sleep(DELTA) + self.assertEqual(queue_empty(queue), False) + + self.assertEqual(queue.get(), 1) + self.assertEqual(queue.get(True, None), 2) + self.assertEqual(queue.get(True), 3) + self.assertEqual(queue.get(timeout=1), 4) + self.assertEqual(queue.get_nowait(), 5) + + self.assertEqual(queue_empty(queue), True) + + get = TimingWrapper(queue.get) + get_nowait = TimingWrapper(queue.get_nowait) + + self.assertRaises(Queue.Empty, get, False) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, False, None) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get_nowait) + self.assertTimingAlmostEqual(get_nowait.elapsed, 0) + + self.assertRaises(Queue.Empty, get, True, TIMEOUT1) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Empty, get, False, TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT3) + + proc.join() + + def _test_fork(self, queue): + for i in range(10, 20): + queue.put(i) + # note that at this point the items may only be buffered, so the + # process cannot shutdown until the feeder thread has finished + # pushing items onto the pipe. + + def test_fork(self): + # Old versions of Queue would fail to create a new feeder + # thread for a forked process if the original process had its + # own feeder thread. This test checks that this no longer + # happens. + + queue = self.Queue() + + # put items on queue so that main process starts a feeder thread + for i in range(10): + queue.put(i) + + # wait to make sure thread starts before we fork a new process + time.sleep(DELTA) + + # fork process + p = self.Process(target=self._test_fork, args=(queue,)) + p.start() + + # check that all expected items are in the queue + for i in range(20): + self.assertEqual(queue.get(), i) + self.assertRaises(Queue.Empty, queue.get, False) + + p.join() + + def test_qsize(self): + q = self.Queue() + try: + self.assertEqual(q.qsize(), 0) + except NotImplementedError: + return + q.put(1) + self.assertEqual(q.qsize(), 1) + q.put(5) + self.assertEqual(q.qsize(), 2) + q.get() + self.assertEqual(q.qsize(), 1) + q.get() + self.assertEqual(q.qsize(), 0) + + def _test_task_done(self, q): + for obj in iter(q.get, None): + time.sleep(DELTA) + q.task_done() + + def test_task_done(self): + queue = self.JoinableQueue() + + if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'): + return + + workers = [self.Process(target=self._test_task_done, args=(queue,)) + for i in xrange(4)] + + for p in workers: + p.start() + + for i in xrange(10): + queue.put(i) + + queue.join() + + for p in workers: + queue.put(None) + + for p in workers: + p.join() + +# +# +# + +class _TestLock(BaseTestCase): + + def test_lock(self): + lock = self.Lock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(False), False) + self.assertEqual(lock.release(), None) + self.assertRaises((ValueError, threading.ThreadError), lock.release) + + def test_rlock(self): + lock = self.RLock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertRaises((AssertionError, RuntimeError), lock.release) + + +class _TestSemaphore(BaseTestCase): + + def _test_semaphore(self, sem): + self.assertReturnsIfImplemented(2, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.acquire(False), False) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(2, get_value, sem) + + def test_semaphore(self): + sem = self.Semaphore(2) + self._test_semaphore(sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(3, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(4, get_value, sem) + + def test_bounded_semaphore(self): + sem = self.BoundedSemaphore(2) + self._test_semaphore(sem) + # Currently fails on OS/X + #if HAVE_GETVALUE: + # self.assertRaises(ValueError, sem.release) + # self.assertReturnsIfImplemented(2, get_value, sem) + + def test_timeout(self): + if self.TYPE != 'processes': + return + + sem = self.Semaphore(0) + acquire = TimingWrapper(sem.acquire) + + self.assertEqual(acquire(False), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, None), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, TIMEOUT1), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0) + + self.assertEqual(acquire(True, TIMEOUT2), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT2) + + self.assertEqual(acquire(timeout=TIMEOUT3), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT3) + + +class _TestCondition(BaseTestCase): + + def f(self, cond, sleeping, woken, timeout=None): + cond.acquire() + sleeping.release() + cond.wait(timeout) + woken.release() + cond.release() + + def check_invariant(self, cond): + # this is only supposed to succeed when there are no sleepers + if self.TYPE == 'processes': + try: + sleepers = (cond._sleeping_count.get_value() - + cond._woken_count.get_value()) + self.assertEqual(sleepers, 0) + self.assertEqual(cond._wait_semaphore.get_value(), 0) + except NotImplementedError: + pass + + def test_notify(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + # wait for both children to start sleeping + sleeping.acquire() + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake up one process/thread + cond.acquire() + cond.notify() + cond.release() + + # check one process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(1, get_value, woken) + + # wake up another + cond.acquire() + cond.notify() + cond.release() + + # check other has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(2, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + p.join() + + def test_notify_all(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + # start some threads/processes which will timeout + for i in range(3): + p = self.Process(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + t.set_daemon(True) + t.start() + + # wait for them all to sleep + for i in xrange(6): + sleeping.acquire() + + # check they have all timed out + for i in xrange(6): + woken.acquire() + self.assertReturnsIfImplemented(0, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + # start some more threads/processes + for i in range(3): + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + t.set_daemon(True) + t.start() + + # wait for them to all sleep + for i in xrange(6): + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake them all up + cond.acquire() + cond.notify_all() + cond.release() + + # check they have all woken + time.sleep(DELTA) + self.assertReturnsIfImplemented(6, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + def test_timeout(self): + cond = self.Condition() + wait = TimingWrapper(cond.wait) + cond.acquire() + res = wait(TIMEOUT1) + cond.release() + self.assertEqual(res, None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + +class _TestEvent(BaseTestCase): + + def _test_event(self, event): + time.sleep(TIMEOUT2) + event.set() + + def test_event(self): + event = self.Event() + wait = TimingWrapper(event.wait) + + # Removed temporaily, due to API shear, this does not + # work with threading._Event objects. is_set == isSet + #self.assertEqual(event.is_set(), False) + + self.assertEqual(wait(0.0), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + event.set() + + # See note above on the API differences + # self.assertEqual(event.is_set(), True) + self.assertEqual(wait(), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + # self.assertEqual(event.is_set(), True) + + event.clear() + + #self.assertEqual(event.is_set(), False) + + self.Process(target=self._test_event, args=(event,)).start() + self.assertEqual(wait(), None) + +# +# +# + +class _TestValue(BaseTestCase): + + codes_values = [ + ('i', 4343, 24234), + ('d', 3.625, -4.25), + ('h', -232, 234), + ('c', latin('x'), latin('y')) + ] + + def _test(self, values): + for sv, cv in zip(values, self.codes_values): + sv.value = cv[2] + + + def test_value(self, raw=False): + if self.TYPE != 'processes': + return + + if raw: + values = [self.RawValue(code, value) + for code, value, _ in self.codes_values] + else: + values = [self.Value(code, value) + for code, value, _ in self.codes_values] + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[1]) + + proc = self.Process(target=self._test, args=(values,)) + proc.start() + proc.join() + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[2]) + + def test_rawvalue(self): + self.test_value(raw=True) + + def test_getobj_getlock(self): + if self.TYPE != 'processes': + return + + val1 = self.Value('i', 5) + lock1 = val1.get_lock() + obj1 = val1.get_obj() + + val2 = self.Value('i', 5, lock=None) + lock2 = val2.get_lock() + obj2 = val2.get_obj() + + lock = self.Lock() + val3 = self.Value('i', 5, lock=lock) + lock3 = val3.get_lock() + obj3 = val3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawValue('i', 5) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + + +class _TestArray(BaseTestCase): + + def f(self, seq): + for i in range(1, len(seq)): + seq[i] += seq[i-1] + + def test_array(self, raw=False): + if self.TYPE != 'processes': + return + + seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831] + if raw: + arr = self.RawArray('i', seq) + else: + arr = self.Array('i', seq) + + self.assertEqual(len(arr), len(seq)) + self.assertEqual(arr[3], seq[3]) + self.assertEqual(list(arr[2:7]), list(seq[2:7])) + + arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4]) + + self.assertEqual(list(arr[:]), seq) + + self.f(seq) + + p = self.Process(target=self.f, args=(arr,)) + p.start() + p.join() + + self.assertEqual(list(arr[:]), seq) + + def test_rawarray(self): + self.test_array(raw=True) + + def test_getobj_getlock_obj(self): + if self.TYPE != 'processes': + return + + arr1 = self.Array('i', range(10)) + lock1 = arr1.get_lock() + obj1 = arr1.get_obj() + + arr2 = self.Array('i', range(10), lock=None) + lock2 = arr2.get_lock() + obj2 = arr2.get_obj() + + lock = self.Lock() + arr3 = self.Array('i', range(10), lock=lock) + lock3 = arr3.get_lock() + obj3 = arr3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawArray('i', range(10)) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + +# +# +# + +class _TestContainers(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_list(self): + a = self.list(range(10)) + self.assertEqual(a[:], range(10)) + + b = self.list() + self.assertEqual(b[:], []) + + b.extend(range(5)) + self.assertEqual(b[:], range(5)) + + self.assertEqual(b[2], 2) + self.assertEqual(b[2:10], [2,3,4]) + + b *= 2 + self.assertEqual(b[:], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) + + self.assertEqual(b + [5, 6], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6]) + + self.assertEqual(a[:], range(10)) + + d = [a, b] + e = self.list(d) + self.assertEqual( + e[:], + [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]] + ) + + f = self.list([a]) + a.append('hello') + self.assertEqual(f[:], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello']]) + + def test_dict(self): + d = self.dict() + indices = range(65, 70) + for i in indices: + d[i] = chr(i) + self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices)) + self.assertEqual(sorted(d.keys()), indices) + self.assertEqual(sorted(d.values()), [chr(i) for i in indices]) + self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices]) + + def test_namespace(self): + n = self.Namespace() + n.name = 'Bob' + n.job = 'Builder' + n._hidden = 'hidden' + self.assertEqual((n.name, n.job), ('Bob', 'Builder')) + del n.job + self.assertEqual(str(n), "Namespace(name='Bob')") + self.assertTrue(hasattr(n, 'name')) + self.assertTrue(not hasattr(n, 'job')) + +# +# +# + +def sqr(x, wait=0.0): + time.sleep(wait) + return x*x + +class _TestPool(BaseTestCase): + + def test_apply(self): + papply = self.pool.apply + self.assertEqual(papply(sqr, (5,)), sqr(5)) + self.assertEqual(papply(sqr, (), {'x':3}), sqr(x=3)) + + def test_map(self): + pmap = self.pool.map + self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) + self.assertEqual(pmap(sqr, range(100), chunksize=20), + map(sqr, range(100))) + + def test_async(self): + res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) + get = TimingWrapper(res.get) + self.assertEqual(get(), 49) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + def test_async_timeout(self): + res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) + get = TimingWrapper(res.get) + self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) + + def test_imap(self): + it = self.pool.imap(sqr, range(10)) + self.assertEqual(list(it), map(sqr, range(10))) + + it = self.pool.imap(sqr, range(10)) + for i in range(10): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + it = self.pool.imap(sqr, range(1000), chunksize=100) + for i in range(1000): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + def test_imap_unordered(self): + it = self.pool.imap_unordered(sqr, range(1000)) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + it = self.pool.imap_unordered(sqr, range(1000), chunksize=53) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + def test_make_pool(self): + p = multiprocessing.Pool(3) + self.assertEqual(3, len(p._pool)) + p.close() + p.join() + + def test_terminate(self): + if self.TYPE == 'manager': + # On Unix a forked process increfs each shared object to + # which its parent process held a reference. If the + # forked process gets terminated then there is likely to + # be a reference leak. So to prevent + # _TestZZZNumberOfObjects from failing we skip this test + # when using a manager. + return + + result = self.pool.map_async( + time.sleep, [0.1 for i in range(10000)], chunksize=1 + ) + self.pool.terminate() + join = TimingWrapper(self.pool.join) + join() + self.assertTrue(join.elapsed < 0.2) + +# +# Test that manager has expected number of shared objects left +# + +class _TestZZZNumberOfObjects(BaseTestCase): + # Because test cases are sorted alphabetically, this one will get + # run after all the other tests for the manager. It tests that + # there have been no "reference leaks" for the manager's shared + # objects. Note the comment in _TestPool.test_terminate(). + ALLOWED_TYPES = ('manager',) + + def test_number_of_objects(self): + EXPECTED_NUMBER = 1 # the pool object is still alive + multiprocessing.active_children() # discard dead process objs + gc.collect() # do garbage collection + refs = self.manager._number_of_objects() + if refs != EXPECTED_NUMBER: + print self.manager._debugInfo() + + self.assertEqual(refs, EXPECTED_NUMBER) + +# +# Test of creating a customized manager class +# + +from multiprocessing.managers import BaseManager, BaseProxy, RemoteError + +class FooBar(object): + def f(self): + return 'f()' + def g(self): + raise ValueError + def _h(self): + return '_h()' + +def baz(): + for i in xrange(10): + yield i*i + +class IteratorProxy(BaseProxy): + _exposed_ = ('next', '__next__') + def __iter__(self): + return self + def next(self): + return self._callmethod('next') + def __next__(self): + return self._callmethod('__next__') + +class MyManager(BaseManager): + pass + +MyManager.register('Foo', callable=FooBar) +MyManager.register('Bar', callable=FooBar, exposed=('f', '_h')) +MyManager.register('baz', callable=baz, proxytype=IteratorProxy) + + +class _TestMyManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_mymanager(self): + manager = MyManager() + manager.start() + + foo = manager.Foo() + bar = manager.Bar() + baz = manager.baz() + + foo_methods = [name for name in ('f', 'g', '_h') if hasattr(foo, name)] + bar_methods = [name for name in ('f', 'g', '_h') if hasattr(bar, name)] + + self.assertEqual(foo_methods, ['f', 'g']) + self.assertEqual(bar_methods, ['f', '_h']) + + self.assertEqual(foo.f(), 'f()') + self.assertRaises(ValueError, foo.g) + self.assertEqual(foo._callmethod('f'), 'f()') + self.assertRaises(RemoteError, foo._callmethod, '_h') + + self.assertEqual(bar.f(), 'f()') + self.assertEqual(bar._h(), '_h()') + self.assertEqual(bar._callmethod('f'), 'f()') + self.assertEqual(bar._callmethod('_h'), '_h()') + + self.assertEqual(list(baz), [i*i for i in range(10)]) + + manager.shutdown() + +# +# Test of connecting to a remote server and using xmlrpclib for serialization +# + +_queue = Queue.Queue() +def get_queue(): + return _queue + +class QueueManager(BaseManager): + '''manager class used by server process''' +QueueManager.register('get_queue', callable=get_queue) + +class QueueManager2(BaseManager): + '''manager class which specifies the same interface as QueueManager''' +QueueManager2.register('get_queue') + + +SERIALIZER = 'xmlrpclib' + +class _TestRemoteManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def _putter(self, address, authkey): + manager = QueueManager2( + address=address, authkey=authkey, serializer=SERIALIZER + ) + manager.connect() + queue = manager.get_queue() + queue.put(('hello world', None, True, 2.25)) + + def test_remote(self): + authkey = os.urandom(32) + + manager = QueueManager( + address=('localhost', 0), authkey=authkey, serializer=SERIALIZER + ) + manager.start() + + p = self.Process(target=self._putter, args=(manager.address, authkey)) + p.start() + + manager2 = QueueManager2( + address=manager.address, authkey=authkey, serializer=SERIALIZER + ) + manager2.connect() + queue = manager2.get_queue() + + # Note that xmlrpclib will deserialize object as a list not a tuple + self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) + + # Because we are using xmlrpclib for serialization instead of + # pickle this will cause a serialization error. + self.assertRaises(Exception, queue.put, time.sleep) + + # Make queue finalizer run before the server is stopped + del queue + manager.shutdown() + +# +# +# + +SENTINEL = latin('') + +class _TestConnection(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _echo(self, conn): + for msg in iter(conn.recv_bytes, SENTINEL): + conn.send_bytes(msg) + conn.close() + + def test_connection(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.set_daemon(True) + p.start() + + seq = [1, 2.25, None] + msg = latin('hello world') + longmsg = msg * 10 + arr = array.array('i', range(4)) + + if self.TYPE == 'processes': + self.assertEqual(type(conn.fileno()), int) + + self.assertEqual(conn.send(seq), None) + self.assertEqual(conn.recv(), seq) + + self.assertEqual(conn.send_bytes(msg), None) + self.assertEqual(conn.recv_bytes(), msg) + + if self.TYPE == 'processes': + buffer = array.array('i', [0]*10) + expected = list(arr) + [0] * (10 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = array.array('i', [0]*10) + expected = [0] * 3 + list(arr) + [0] * (10 - 3 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer, 3 * buffer.itemsize), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = bytearray(latin(' ' * 40)) + self.assertEqual(conn.send_bytes(longmsg), None) + try: + res = conn.recv_bytes_into(buffer) + except multiprocessing.BufferTooShort, e: + self.assertEqual(e.args, (longmsg,)) + else: + self.fail('expected BufferTooShort, got %s' % res) + + poll = TimingWrapper(conn.poll) + + self.assertEqual(poll(), False) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(poll(TIMEOUT1), False) + self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1) + + conn.send(None) + + self.assertEqual(poll(TIMEOUT1), True) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(conn.recv(), None) + + really_big_msg = latin('X') * (1024 * 1024 * 16) # 16Mb + conn.send_bytes(really_big_msg) + self.assertEqual(conn.recv_bytes(), really_big_msg) + + conn.send_bytes(SENTINEL) # tell child to quit + child_conn.close() + + if self.TYPE == 'processes': + self.assertEqual(conn.readable, True) + self.assertEqual(conn.writable, True) + self.assertRaises(EOFError, conn.recv) + self.assertRaises(EOFError, conn.recv_bytes) + + p.join() + + def test_duplex_false(self): + reader, writer = self.Pipe(duplex=False) + self.assertEqual(writer.send(1), None) + self.assertEqual(reader.recv(), 1) + if self.TYPE == 'processes': + self.assertEqual(reader.readable, True) + self.assertEqual(reader.writable, False) + self.assertEqual(writer.readable, False) + self.assertEqual(writer.writable, True) + self.assertRaises(IOError, reader.send, 2) + self.assertRaises(IOError, writer.recv) + self.assertRaises(IOError, writer.poll) + + def test_spawn_close(self): + # We test that a pipe connection can be closed by parent + # process immediately after child is spawned. On Windows this + # would have sometimes failed on old versions because + # child_conn would be closed before the child got a chance to + # duplicate it. + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.start() + child_conn.close() # this might complete before child initializes + + msg = latin('hello') + conn.send_bytes(msg) + self.assertEqual(conn.recv_bytes(), msg) + + conn.send_bytes(SENTINEL) + conn.close() + p.join() + + def test_sendbytes(self): + if self.TYPE != 'processes': + return + + msg = latin('abcdefghijklmnopqrstuvwxyz') + a, b = self.Pipe() + + a.send_bytes(msg) + self.assertEqual(b.recv_bytes(), msg) + + a.send_bytes(msg, 5) + self.assertEqual(b.recv_bytes(), msg[5:]) + + a.send_bytes(msg, 7, 8) + self.assertEqual(b.recv_bytes(), msg[7:7+8]) + + a.send_bytes(msg, 26) + self.assertEqual(b.recv_bytes(), latin('')) + + a.send_bytes(msg, 26, 0) + self.assertEqual(b.recv_bytes(), latin('')) + + self.assertRaises(ValueError, a.send_bytes, msg, 27) + + self.assertRaises(ValueError, a.send_bytes, msg, 22, 5) + + self.assertRaises(ValueError, a.send_bytes, msg, 26, 1) + + self.assertRaises(ValueError, a.send_bytes, msg, -1) + + self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) + + +class _TestListenerClient(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _test(self, address): + conn = self.connection.Client(address) + conn.send('hello') + conn.close() + + def test_listener_client(self): + for family in self.connection.families: + l = self.connection.Listener(family=family) + p = self.Process(target=self._test, args=(l.address,)) + p.set_daemon(True) + p.start() + conn = l.accept() + self.assertEqual(conn.recv(), 'hello') + p.join() + l.close() + +# +# Test of sending connection and socket objects between processes +# + +class _TestPicklingConnections(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _listener(self, conn, families): + for fam in families: + l = self.connection.Listener(family=fam) + conn.send(l.address) + new_conn = l.accept() + conn.send(new_conn) + + if self.TYPE == 'processes': + l = socket.socket() + l.bind(('localhost', 0)) + conn.send(l.getsockname()) + l.listen(1) + new_conn, addr = l.accept() + conn.send(new_conn) + + conn.recv() + + def _remote(self, conn): + for (address, msg) in iter(conn.recv, None): + client = self.connection.Client(address) + client.send(msg.upper()) + client.close() + + if self.TYPE == 'processes': + address, msg = conn.recv() + client = socket.socket() + client.connect(address) + client.sendall(msg.upper()) + client.close() + + conn.close() + + def test_pickling(self): + try: + multiprocessing.allow_connection_pickling() + except ImportError: + return + + families = self.connection.families + + lconn, lconn0 = self.Pipe() + lp = self.Process(target=self._listener, args=(lconn0, families)) + lp.start() + lconn0.close() + + rconn, rconn0 = self.Pipe() + rp = self.Process(target=self._remote, args=(rconn0,)) + rp.start() + rconn0.close() + + for fam in families: + msg = ('This connection uses family %s' % fam).encode('ascii') + address = lconn.recv() + rconn.send((address, msg)) + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(), msg.upper()) + + rconn.send(None) + + if self.TYPE == 'processes': + msg = latin('This connection uses a normal socket') + address = lconn.recv() + rconn.send((address, msg)) + if hasattr(socket, 'fromfd'): + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(100), msg.upper()) + else: + # XXX On Windows with Py2.6 need to backport fromfd() + discard = lconn.recv_bytes() + + lconn.send(None) + + rconn.close() + lconn.close() + + lp.join() + rp.join() + +# +# +# + +class _TestHeap(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_heap(self): + iterations = 5000 + maxblocks = 50 + blocks = [] + + # create and destroy lots of blocks of different sizes + for i in xrange(iterations): + size = int(random.lognormvariate(0, 1) * 1000) + b = multiprocessing.heap.BufferWrapper(size) + blocks.append(b) + if len(blocks) > maxblocks: + i = random.randrange(maxblocks) + del blocks[i] + + # get the heap object + heap = multiprocessing.heap.BufferWrapper._heap + + # verify the state of the heap + all = [] + occupied = 0 + for L in heap._len_to_seq.values(): + for arena, start, stop in L: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'free')) + for arena, start, stop in heap._allocated_blocks: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'occupied')) + occupied += (stop-start) + + all.sort() + + for i in range(len(all)-1): + (arena, start, stop) = all[i][:3] + (narena, nstart, nstop) = all[i+1][:3] + self.assertTrue((arena != narena and nstart == 0) or + (stop == nstart)) + +# +# +# + +try: + from ctypes import Structure, Value, copy, c_int, c_double +except ImportError: + Structure = object + c_int = c_double = None + +class _Foo(Structure): + _fields_ = [ + ('x', c_int), + ('y', c_double) + ] + +class _TestSharedCTypes(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _double(self, x, y, foo, arr, string): + x.value *= 2 + y.value *= 2 + foo.x *= 2 + foo.y *= 2 + string.value *= 2 + for i in range(len(arr)): + arr[i] *= 2 + + def test_sharedctypes(self, lock=False): + if c_int is None: + return + + x = Value('i', 7, lock=lock) + y = Value(ctypes.c_double, 1.0/3.0, lock=lock) + foo = Value(_Foo, 3, 2, lock=lock) + arr = Array('d', range(10), lock=lock) + string = Array('c', 20, lock=lock) + string.value = 'hello' + + p = self.Process(target=self._double, args=(x, y, foo, arr, string)) + p.start() + p.join() + + self.assertEqual(x.value, 14) + self.assertAlmostEqual(y.value, 2.0/3.0) + self.assertEqual(foo.x, 6) + self.assertAlmostEqual(foo.y, 4.0) + for i in range(10): + self.assertAlmostEqual(arr[i], i*2) + self.assertEqual(string.value, latin('hellohello')) + + def test_synchronize(self): + self.test_sharedctypes(lock=True) + + def test_copy(self): + if c_int is None: + return + + foo = _Foo(2, 5.0) + bar = copy(foo) + foo.x = 0 + foo.y = 0 + self.assertEqual(bar.x, 2) + self.assertAlmostEqual(bar.y, 5.0) + +# +# +# + +class _TestFinalize(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _test_finalize(self, conn): + class Foo(object): + pass + + a = Foo() + util.Finalize(a, conn.send, args=('a',)) + del a # triggers callback for a + + b = Foo() + close_b = util.Finalize(b, conn.send, args=('b',)) + close_b() # triggers callback for b + close_b() # does nothing because callback has already been called + del b # does nothing because callback has already been called + + c = Foo() + util.Finalize(c, conn.send, args=('c',)) + + d10 = Foo() + util.Finalize(d10, conn.send, args=('d10',), exitpriority=1) + + d01 = Foo() + util.Finalize(d01, conn.send, args=('d01',), exitpriority=0) + d02 = Foo() + util.Finalize(d02, conn.send, args=('d02',), exitpriority=0) + d03 = Foo() + util.Finalize(d03, conn.send, args=('d03',), exitpriority=0) + + util.Finalize(None, conn.send, args=('e',), exitpriority=-10) + + util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100) + + # call mutliprocessing's cleanup function then exit process without + # garbage collecting locals + util._exit_function() + conn.close() + os._exit(0) + + def test_finalize(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._test_finalize, args=(child_conn,)) + p.start() + p.join() + + result = [obj for obj in iter(conn.recv, 'STOP')] + self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e']) + +# +# Test that from ... import * works for each module +# + +class _TestImportStar(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_import(self): + modules = ( + 'multiprocessing', 'multiprocessing.connection', + 'multiprocessing.heap', 'multiprocessing.managers', + 'multiprocessing.pool', 'multiprocessing.process', + 'multiprocessing.reduction', 'multiprocessing.sharedctypes', + 'multiprocessing.synchronize', 'multiprocessing.util' + ) + + for name in modules: + __import__(name) + mod = sys.modules[name] + + for attr in getattr(mod, '__all__', ()): + self.assertTrue( + hasattr(mod, attr), + '%r does not have attribute %r' % (mod, attr) + ) + +# +# Quick test that logging works -- does not test logging output +# + +class _TestLogging(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_enable_logging(self): + logger = multiprocessing.get_logger() + logger.setLevel(util.SUBWARNING) + self.assertTrue(logger is not None) + logger.debug('this will not be printed') + logger.info('nor will this') + logger.setLevel(LOG_LEVEL) + + def _test_level(self, conn): + logger = multiprocessing.get_logger() + conn.send(logger.getEffectiveLevel()) + + def test_level(self): + LEVEL1 = 32 + LEVEL2 = 37 + + logger = multiprocessing.get_logger() + root_logger = logging.getLogger() + root_level = root_logger.level + + reader, writer = multiprocessing.Pipe(duplex=False) + + logger.setLevel(LEVEL1) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL1, reader.recv()) + + logger.setLevel(logging.NOTSET) + root_logger.setLevel(LEVEL2) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL2, reader.recv()) + + root_logger.setLevel(root_level) + logger.setLevel(level=LOG_LEVEL) + +# +# Functions used to create test cases from the base ones in this module +# + +def get_attributes(Source, names): + d = {} + for name in names: + obj = getattr(Source, name) + if type(obj) == type(get_attributes): + obj = staticmethod(obj) + d[name] = obj + return d + +def create_test_cases(Mixin, type): + result = {} + glob = globals() + Type = type[0].upper() + type[1:] + + for name in glob.keys(): + if name.startswith('_Test'): + base = glob[name] + if type in base.ALLOWED_TYPES: + newname = 'With' + Type + name[1:] + class Temp(base, unittest.TestCase, Mixin): + pass + result[newname] = Temp + Temp.__name__ = newname + Temp.__module__ = Mixin.__module__ + return result + +# +# Create test cases +# + +class ProcessesMixin(object): + TYPE = 'processes' + Process = multiprocessing.Process + locals().update(get_attributes(multiprocessing, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'RawValue', + 'RawArray', 'current_process', 'active_children', 'Pipe', + 'connection', 'JoinableQueue' + ))) + +testcases_processes = create_test_cases(ProcessesMixin, type='processes') +globals().update(testcases_processes) + + +class ManagerMixin(object): + TYPE = 'manager' + Process = multiprocessing.Process + manager = object.__new__(multiprocessing.managers.SyncManager) + locals().update(get_attributes(manager, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'list', 'dict', + 'Namespace', 'JoinableQueue' + ))) + +testcases_manager = create_test_cases(ManagerMixin, type='manager') +globals().update(testcases_manager) + + +class ThreadsMixin(object): + TYPE = 'threads' + Process = multiprocessing.dummy.Process + locals().update(get_attributes(multiprocessing.dummy, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'current_process', + 'active_children', 'Pipe', 'connection', 'dict', 'list', + 'Namespace', 'JoinableQueue' + ))) + +testcases_threads = create_test_cases(ThreadsMixin, type='threads') +globals().update(testcases_threads) + +# +# +# + +def test_main(run=None): + if run is None: + from test.test_support import run_unittest as run + + util.get_temp_dir() # creates temp directory for use by all processes + + multiprocessing.get_logger().setLevel(LOG_LEVEL) + + ProcessesMixin.pool = multiprocessing.Pool(4) + ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + ManagerMixin.manager.__init__() + ManagerMixin.manager.start() + ManagerMixin.pool = ManagerMixin.manager.Pool(4) + + testcases = ( + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + + sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + ) + + loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase + suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) + run(suite) + + ThreadsMixin.pool.terminate() + ProcessesMixin.pool.terminate() + ManagerMixin.pool.terminate() + ManagerMixin.manager.shutdown() + + del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + +def main(): + test_main(unittest.TextTestRunner(verbosity=2).run) + +if __name__ == '__main__': + main() Modified: python/trunk/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- python/trunk/Modules/_multiprocessing/multiprocessing.c (original) +++ python/trunk/Modules/_multiprocessing/multiprocessing.c Fri Jun 13 21:13:39 2008 @@ -1,311 +1,311 @@ -/* - * Extension module used by multiprocessing package - * - * multiprocessing.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - -PyObject *create_win32_namespace(void); - -PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; -PyObject *ProcessError, *BufferTooShort; - -/* - * Function which raises exceptions based on error codes - */ - -PyObject * -mp_SetError(PyObject *Type, int num) -{ - switch (num) { -#ifdef MS_WINDOWS - case MP_STANDARD_ERROR: - if (Type == NULL) - Type = PyExc_WindowsError; - PyErr_SetExcFromWindowsErr(Type, 0); - break; - case MP_SOCKET_ERROR: - if (Type == NULL) - Type = PyExc_WindowsError; - PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); - break; -#else /* !MS_WINDOWS */ - case MP_STANDARD_ERROR: - case MP_SOCKET_ERROR: - if (Type == NULL) - Type = PyExc_OSError; - PyErr_SetFromErrno(Type); - break; -#endif /* !MS_WINDOWS */ - case MP_MEMORY_ERROR: - PyErr_NoMemory(); - break; - case MP_END_OF_FILE: - PyErr_SetNone(PyExc_EOFError); - break; - case MP_EARLY_END_OF_FILE: - PyErr_SetString(PyExc_IOError, - "got end of file during message"); - break; - case MP_BAD_MESSAGE_LENGTH: - PyErr_SetString(PyExc_IOError, "bad message length"); - break; - case MP_EXCEPTION_HAS_BEEN_SET: - break; - default: - PyErr_Format(PyExc_RuntimeError, - "unkown error number %d", num); - } - return NULL; -} - - -/* - * Windows only - */ - -#ifdef MS_WINDOWS - -/* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ - -HANDLE sigint_event = NULL; - -static BOOL WINAPI -ProcessingCtrlHandler(DWORD dwCtrlType) -{ - SetEvent(sigint_event); - return FALSE; -} - -/* - * Unix only - */ - -#else /* !MS_WINDOWS */ - -#if HAVE_FD_TRANSFER - -/* Functions for transferring file descriptors between processes. - Reimplements some of the functionality of the fdcred - module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ - -static PyObject * -multiprocessing_sendfd(PyObject *self, PyObject *args) -{ - int conn, fd, res; - char dummy_char; - char buf[CMSG_SPACE(sizeof(int))]; - struct msghdr msg = {0}; - struct iovec dummy_iov; - struct cmsghdr *cmsg; - - if (!PyArg_ParseTuple(args, "ii", &conn, &fd)) - return NULL; - - dummy_iov.iov_base = &dummy_char; - dummy_iov.iov_len = 1; - msg.msg_control = buf; - msg.msg_controllen = sizeof(buf); - msg.msg_iov = &dummy_iov; - msg.msg_iovlen = 1; - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - *(int*)CMSG_DATA(cmsg) = fd; - - Py_BEGIN_ALLOW_THREADS - res = sendmsg(conn, &msg, 0); - Py_END_ALLOW_THREADS - - if (res < 0) - return PyErr_SetFromErrno(PyExc_OSError); - Py_RETURN_NONE; -} - -static PyObject * -multiprocessing_recvfd(PyObject *self, PyObject *args) -{ - int conn, fd, res; - char dummy_char; - char buf[CMSG_SPACE(sizeof(int))]; - struct msghdr msg = {0}; - struct iovec dummy_iov; - struct cmsghdr *cmsg; - - if (!PyArg_ParseTuple(args, "i", &conn)) - return NULL; - - dummy_iov.iov_base = &dummy_char; - dummy_iov.iov_len = 1; - msg.msg_control = buf; - msg.msg_controllen = sizeof(buf); - msg.msg_iov = &dummy_iov; - msg.msg_iovlen = 1; - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - - Py_BEGIN_ALLOW_THREADS - res = recvmsg(conn, &msg, 0); - Py_END_ALLOW_THREADS - - if (res < 0) - return PyErr_SetFromErrno(PyExc_OSError); - - fd = *(int*)CMSG_DATA(cmsg); - return Py_BuildValue("i", fd); -} - -#endif /* HAVE_FD_TRANSFER */ - -#endif /* !MS_WINDOWS */ - - -/* - * All platforms - */ - -static PyObject* -multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) -{ - void *buffer; - Py_ssize_t buffer_len; - - if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) - return NULL; - - return Py_BuildValue("N" F_PY_SSIZE_T, - PyLong_FromVoidPtr(buffer), buffer_len); -} - - -/* - * Function table - */ - -static PyMethodDef module_methods[] = { - {"address_of_buffer", multiprocessing_address_of_buffer, METH_O, - "address_of_buffer(obj) -> int\n" - "Return address of obj assuming obj supports buffer inteface"}, -#if HAVE_FD_TRANSFER - {"sendfd", multiprocessing_sendfd, METH_VARARGS, - "sendfd(sockfd, fd) -> None\n" - "Send file descriptor given by fd over the unix domain socket\n" - "whose file decriptor is sockfd"}, - {"recvfd", multiprocessing_recvfd, METH_VARARGS, - "recvfd(sockfd) -> fd\n" - "Receive a file descriptor over a unix domain socket\n" - "whose file decriptor is sockfd"}, -#endif - {NULL} -}; - - -/* - * Initialize - */ - -PyMODINIT_FUNC -init_multiprocessing(void) -{ - PyObject *module, *temp, *value; - - /* Initialize module */ - module = Py_InitModule("_multiprocessing", module_methods); - if (!module) - return; - - /* Get copy of objects from pickle */ - temp = PyImport_ImportModule(PICKLE_MODULE); - if (!temp) - return; - pickle_dumps = PyObject_GetAttrString(temp, "dumps"); - pickle_loads = PyObject_GetAttrString(temp, "loads"); - pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); - Py_XDECREF(temp); - - /* Get copy of BufferTooShort */ - temp = PyImport_ImportModule("multiprocessing"); - if (!temp) - return; - BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); - Py_XDECREF(temp); - - /* Add connection type to module */ - if (PyType_Ready(&ConnectionType) < 0) - return; - Py_INCREF(&ConnectionType); - PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); - -#if defined(MS_WINDOWS) || HAVE_SEM_OPEN - /* Add SemLock type to module */ - if (PyType_Ready(&SemLockType) < 0) - return; - Py_INCREF(&SemLockType); - PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", - Py_BuildValue("i", SEM_VALUE_MAX)); - PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); -#endif - -#ifdef MS_WINDOWS - /* Add PipeConnection to module */ - if (PyType_Ready(&PipeConnectionType) < 0) - return; - Py_INCREF(&PipeConnectionType); - PyModule_AddObject(module, "PipeConnection", - (PyObject*)&PipeConnectionType); - - /* Initialize win32 class and add to multiprocessing */ - temp = create_win32_namespace(); - if (!temp) - return; - PyModule_AddObject(module, "win32", temp); - - /* Initialize the event handle used to signal Ctrl-C */ - sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!sigint_event) { - PyErr_SetFromWindowsErr(0); - return; - } - if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) { - PyErr_SetFromWindowsErr(0); - return; - } -#endif - - /* Add configuration macros */ - temp = PyDict_New(); - if (!temp) - return; -#define ADD_FLAG(name) \ - value = Py_BuildValue("i", name); \ - if (value == NULL) { Py_DECREF(temp); return; } \ - if (PyDict_SetItemString(temp, #name, value) < 0) { \ - Py_DECREF(temp); Py_DECREF(value); return; } \ - Py_DECREF(value) - -#ifdef HAVE_SEM_OPEN - ADD_FLAG(HAVE_SEM_OPEN); -#endif -#ifdef HAVE_SEM_TIMEDWAIT - ADD_FLAG(HAVE_SEM_TIMEDWAIT); -#endif -#ifdef HAVE_FD_TRANSFER - ADD_FLAG(HAVE_FD_TRANSFER); -#endif -#ifdef HAVE_BROKEN_SEM_GETVALUE - ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE); -#endif -#ifdef HAVE_BROKEN_SEM_UNLINK - ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); -#endif - if (PyModule_AddObject(module, "flags", temp) < 0) - return; -} +/* + * Extension module used by multiprocessing package + * + * multiprocessing.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +PyObject *create_win32_namespace(void); + +PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; +PyObject *ProcessError, *BufferTooShort; + +/* + * Function which raises exceptions based on error codes + */ + +PyObject * +mp_SetError(PyObject *Type, int num) +{ + switch (num) { +#ifdef MS_WINDOWS + case MP_STANDARD_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, 0); + break; + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); + break; +#else /* !MS_WINDOWS */ + case MP_STANDARD_ERROR: + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_OSError; + PyErr_SetFromErrno(Type); + break; +#endif /* !MS_WINDOWS */ + case MP_MEMORY_ERROR: + PyErr_NoMemory(); + break; + case MP_END_OF_FILE: + PyErr_SetNone(PyExc_EOFError); + break; + case MP_EARLY_END_OF_FILE: + PyErr_SetString(PyExc_IOError, + "got end of file during message"); + break; + case MP_BAD_MESSAGE_LENGTH: + PyErr_SetString(PyExc_IOError, "bad message length"); + break; + case MP_EXCEPTION_HAS_BEEN_SET: + break; + default: + PyErr_Format(PyExc_RuntimeError, + "unkown error number %d", num); + } + return NULL; +} + + +/* + * Windows only + */ + +#ifdef MS_WINDOWS + +/* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ + +HANDLE sigint_event = NULL; + +static BOOL WINAPI +ProcessingCtrlHandler(DWORD dwCtrlType) +{ + SetEvent(sigint_event); + return FALSE; +} + +/* + * Unix only + */ + +#else /* !MS_WINDOWS */ + +#if HAVE_FD_TRANSFER + +/* Functions for transferring file descriptors between processes. + Reimplements some of the functionality of the fdcred + module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ + +static PyObject * +multiprocessing_sendfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "ii", &conn, &fd)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + *(int*)CMSG_DATA(cmsg) = fd; + + Py_BEGIN_ALLOW_THREADS + res = sendmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + Py_RETURN_NONE; +} + +static PyObject * +multiprocessing_recvfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "i", &conn)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + + Py_BEGIN_ALLOW_THREADS + res = recvmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + + fd = *(int*)CMSG_DATA(cmsg); + return Py_BuildValue("i", fd); +} + +#endif /* HAVE_FD_TRANSFER */ + +#endif /* !MS_WINDOWS */ + + +/* + * All platforms + */ + +static PyObject* +multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) +{ + void *buffer; + Py_ssize_t buffer_len; + + if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) + return NULL; + + return Py_BuildValue("N" F_PY_SSIZE_T, + PyLong_FromVoidPtr(buffer), buffer_len); +} + + +/* + * Function table + */ + +static PyMethodDef module_methods[] = { + {"address_of_buffer", multiprocessing_address_of_buffer, METH_O, + "address_of_buffer(obj) -> int\n" + "Return address of obj assuming obj supports buffer inteface"}, +#if HAVE_FD_TRANSFER + {"sendfd", multiprocessing_sendfd, METH_VARARGS, + "sendfd(sockfd, fd) -> None\n" + "Send file descriptor given by fd over the unix domain socket\n" + "whose file decriptor is sockfd"}, + {"recvfd", multiprocessing_recvfd, METH_VARARGS, + "recvfd(sockfd) -> fd\n" + "Receive a file descriptor over a unix domain socket\n" + "whose file decriptor is sockfd"}, +#endif + {NULL} +}; + + +/* + * Initialize + */ + +PyMODINIT_FUNC +init_multiprocessing(void) +{ + PyObject *module, *temp, *value; + + /* Initialize module */ + module = Py_InitModule("_multiprocessing", module_methods); + if (!module) + return; + + /* Get copy of objects from pickle */ + temp = PyImport_ImportModule(PICKLE_MODULE); + if (!temp) + return; + pickle_dumps = PyObject_GetAttrString(temp, "dumps"); + pickle_loads = PyObject_GetAttrString(temp, "loads"); + pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); + Py_XDECREF(temp); + + /* Get copy of BufferTooShort */ + temp = PyImport_ImportModule("multiprocessing"); + if (!temp) + return; + BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); + Py_XDECREF(temp); + + /* Add connection type to module */ + if (PyType_Ready(&ConnectionType) < 0) + return; + Py_INCREF(&ConnectionType); + PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); + +#if defined(MS_WINDOWS) || HAVE_SEM_OPEN + /* Add SemLock type to module */ + if (PyType_Ready(&SemLockType) < 0) + return; + Py_INCREF(&SemLockType); + PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", + Py_BuildValue("i", SEM_VALUE_MAX)); + PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); +#endif + +#ifdef MS_WINDOWS + /* Add PipeConnection to module */ + if (PyType_Ready(&PipeConnectionType) < 0) + return; + Py_INCREF(&PipeConnectionType); + PyModule_AddObject(module, "PipeConnection", + (PyObject*)&PipeConnectionType); + + /* Initialize win32 class and add to multiprocessing */ + temp = create_win32_namespace(); + if (!temp) + return; + PyModule_AddObject(module, "win32", temp); + + /* Initialize the event handle used to signal Ctrl-C */ + sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!sigint_event) { + PyErr_SetFromWindowsErr(0); + return; + } + if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) { + PyErr_SetFromWindowsErr(0); + return; + } +#endif + + /* Add configuration macros */ + temp = PyDict_New(); + if (!temp) + return; +#define ADD_FLAG(name) \ + value = Py_BuildValue("i", name); \ + if (value == NULL) { Py_DECREF(temp); return; } \ + if (PyDict_SetItemString(temp, #name, value) < 0) { \ + Py_DECREF(temp); Py_DECREF(value); return; } \ + Py_DECREF(value) + +#ifdef HAVE_SEM_OPEN + ADD_FLAG(HAVE_SEM_OPEN); +#endif +#ifdef HAVE_SEM_TIMEDWAIT + ADD_FLAG(HAVE_SEM_TIMEDWAIT); +#endif +#ifdef HAVE_FD_TRANSFER + ADD_FLAG(HAVE_FD_TRANSFER); +#endif +#ifdef HAVE_BROKEN_SEM_GETVALUE + ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE); +#endif +#ifdef HAVE_BROKEN_SEM_UNLINK + ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); +#endif + if (PyModule_AddObject(module, "flags", temp) < 0) + return; +} Modified: python/trunk/Modules/_multiprocessing/multiprocessing.h ============================================================================== --- python/trunk/Modules/_multiprocessing/multiprocessing.h (original) +++ python/trunk/Modules/_multiprocessing/multiprocessing.h Fri Jun 13 21:13:39 2008 @@ -1,163 +1,163 @@ -#ifndef MULTIPROCESSING_H -#define MULTIPROCESSING_H - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "structmember.h" -#include "pythread.h" - -/* - * Platform includes and definitions - */ - -#ifdef MS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include -# include -# include /* getpid() */ -# define SEM_HANDLE HANDLE -# define SEM_VALUE_MAX LONG_MAX -#else -# include /* O_CREAT and O_EXCL */ -# include -# include /* htonl() and ntohl() */ -# if HAVE_SEM_OPEN -# include - typedef sem_t *SEM_HANDLE; -# endif -# define HANDLE int -# define SOCKET int -# define BOOL int -# define UINT32 uint32_t -# define INT32 int32_t -# define TRUE 1 -# define FALSE 0 -# define INVALID_HANDLE_VALUE (-1) -#endif - -/* - * Make sure Py_ssize_t available - */ - -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) - typedef int Py_ssize_t; -# define PY_SSIZE_T_MAX INT_MAX -# define PY_SSIZE_T_MIN INT_MIN -# define F_PY_SSIZE_T "i" -# define PY_FORMAT_SIZE_T "" -# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n) -#else -# define F_PY_SSIZE_T "n" -#endif - -/* - * Format codes - */ - -#if SIZEOF_VOID_P == SIZEOF_LONG -# define F_POINTER "k" -# define T_POINTER T_ULONG -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) -# define F_POINTER "K" -# define T_POINTER T_ULONGLONG -#else -# error "can't find format code for unsigned integer of same size as void*" -#endif - -#ifdef MS_WINDOWS -# define F_HANDLE F_POINTER -# define T_HANDLE T_POINTER -# define F_SEM_HANDLE F_HANDLE -# define T_SEM_HANDLE T_HANDLE -# define F_DWORD "k" -# define T_DWORD T_ULONG -#else -# define F_HANDLE "i" -# define T_HANDLE T_INT -# define F_SEM_HANDLE F_POINTER -# define T_SEM_HANDLE T_POINTER -#endif - -#if PY_VERSION_HEX >= 0x03000000 -# define F_RBUFFER "y" -#else -# define F_RBUFFER "s" -#endif - -/* - * Error codes which can be returned by functions called without GIL - */ - -#define MP_SUCCESS (0) -#define MP_STANDARD_ERROR (-1) -#define MP_MEMORY_ERROR (-1001) -#define MP_END_OF_FILE (-1002) -#define MP_EARLY_END_OF_FILE (-1003) -#define MP_BAD_MESSAGE_LENGTH (-1004) -#define MP_SOCKET_ERROR (-1005) -#define MP_EXCEPTION_HAS_BEEN_SET (-1006) - -PyObject *mp_SetError(PyObject *Type, int num); - -/* - * Externs - not all will really exist on all platforms - */ - -extern PyObject *pickle_dumps; -extern PyObject *pickle_loads; -extern PyObject *pickle_protocol; -extern PyObject *BufferTooShort; -extern PyTypeObject SemLockType; -extern PyTypeObject ConnectionType; -extern PyTypeObject PipeConnectionType; -extern HANDLE sigint_event; - -/* - * Py3k compatibility - */ - -#if PY_VERSION_HEX >= 0x03000000 -# define PICKLE_MODULE "pickle" -# define FROM_FORMAT PyUnicode_FromFormat -# define PyInt_FromLong PyLong_FromLong -# define PyInt_FromSsize_t PyLong_FromSsize_t -#else -# define PICKLE_MODULE "cPickle" -# define FROM_FORMAT PyString_FromFormat -#endif - -#ifndef PyVarObject_HEAD_INIT -# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, -#endif - -#ifndef Py_TPFLAGS_HAVE_WEAKREFS -# define Py_TPFLAGS_HAVE_WEAKREFS 0 -#endif - -/* - * Connection definition - */ - -#define CONNECTION_BUFFER_SIZE 1024 - -typedef struct { - PyObject_HEAD - HANDLE handle; - int flags; - PyObject *weakreflist; - char buffer[CONNECTION_BUFFER_SIZE]; -} ConnectionObject; - -/* - * Miscellaneous - */ - -#define MAX_MESSAGE_LENGTH 0x7fffffff - -#ifndef MIN -# define MIN(x, y) ((x) < (y) ? x : y) -# define MAX(x, y) ((x) > (y) ? x : y) -#endif - -#endif /* MULTIPROCESSING_H */ +#ifndef MULTIPROCESSING_H +#define MULTIPROCESSING_H + +#define PY_SSIZE_T_CLEAN + +#include "Python.h" +#include "structmember.h" +#include "pythread.h" + +/* + * Platform includes and definitions + */ + +#ifdef MS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# include +# include +# include /* getpid() */ +# define SEM_HANDLE HANDLE +# define SEM_VALUE_MAX LONG_MAX +#else +# include /* O_CREAT and O_EXCL */ +# include +# include /* htonl() and ntohl() */ +# if HAVE_SEM_OPEN +# include + typedef sem_t *SEM_HANDLE; +# endif +# define HANDLE int +# define SOCKET int +# define BOOL int +# define UINT32 uint32_t +# define INT32 int32_t +# define TRUE 1 +# define FALSE 0 +# define INVALID_HANDLE_VALUE (-1) +#endif + +/* + * Make sure Py_ssize_t available + */ + +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) + typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +# define F_PY_SSIZE_T "i" +# define PY_FORMAT_SIZE_T "" +# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n) +#else +# define F_PY_SSIZE_T "n" +#endif + +/* + * Format codes + */ + +#if SIZEOF_VOID_P == SIZEOF_LONG +# define F_POINTER "k" +# define T_POINTER T_ULONG +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +# define F_POINTER "K" +# define T_POINTER T_ULONGLONG +#else +# error "can't find format code for unsigned integer of same size as void*" +#endif + +#ifdef MS_WINDOWS +# define F_HANDLE F_POINTER +# define T_HANDLE T_POINTER +# define F_SEM_HANDLE F_HANDLE +# define T_SEM_HANDLE T_HANDLE +# define F_DWORD "k" +# define T_DWORD T_ULONG +#else +# define F_HANDLE "i" +# define T_HANDLE T_INT +# define F_SEM_HANDLE F_POINTER +# define T_SEM_HANDLE T_POINTER +#endif + +#if PY_VERSION_HEX >= 0x03000000 +# define F_RBUFFER "y" +#else +# define F_RBUFFER "s" +#endif + +/* + * Error codes which can be returned by functions called without GIL + */ + +#define MP_SUCCESS (0) +#define MP_STANDARD_ERROR (-1) +#define MP_MEMORY_ERROR (-1001) +#define MP_END_OF_FILE (-1002) +#define MP_EARLY_END_OF_FILE (-1003) +#define MP_BAD_MESSAGE_LENGTH (-1004) +#define MP_SOCKET_ERROR (-1005) +#define MP_EXCEPTION_HAS_BEEN_SET (-1006) + +PyObject *mp_SetError(PyObject *Type, int num); + +/* + * Externs - not all will really exist on all platforms + */ + +extern PyObject *pickle_dumps; +extern PyObject *pickle_loads; +extern PyObject *pickle_protocol; +extern PyObject *BufferTooShort; +extern PyTypeObject SemLockType; +extern PyTypeObject ConnectionType; +extern PyTypeObject PipeConnectionType; +extern HANDLE sigint_event; + +/* + * Py3k compatibility + */ + +#if PY_VERSION_HEX >= 0x03000000 +# define PICKLE_MODULE "pickle" +# define FROM_FORMAT PyUnicode_FromFormat +# define PyInt_FromLong PyLong_FromLong +# define PyInt_FromSsize_t PyLong_FromSsize_t +#else +# define PICKLE_MODULE "cPickle" +# define FROM_FORMAT PyString_FromFormat +#endif + +#ifndef PyVarObject_HEAD_INIT +# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + +#ifndef Py_TPFLAGS_HAVE_WEAKREFS +# define Py_TPFLAGS_HAVE_WEAKREFS 0 +#endif + +/* + * Connection definition + */ + +#define CONNECTION_BUFFER_SIZE 1024 + +typedef struct { + PyObject_HEAD + HANDLE handle; + int flags; + PyObject *weakreflist; + char buffer[CONNECTION_BUFFER_SIZE]; +} ConnectionObject; + +/* + * Miscellaneous + */ + +#define MAX_MESSAGE_LENGTH 0x7fffffff + +#ifndef MIN +# define MIN(x, y) ((x) < (y) ? x : y) +# define MAX(x, y) ((x) > (y) ? x : y) +#endif + +#endif /* MULTIPROCESSING_H */ Modified: python/trunk/Modules/_multiprocessing/pipe_connection.c ============================================================================== --- python/trunk/Modules/_multiprocessing/pipe_connection.c (original) +++ python/trunk/Modules/_multiprocessing/pipe_connection.c Fri Jun 13 21:13:39 2008 @@ -1,136 +1,136 @@ -/* - * A type which wraps a pipe handle in message oriented mode - * - * pipe_connection.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - -#define CLOSE(h) CloseHandle(h) - -/* - * Send string to the pipe; assumes in message oriented mode - */ - -static Py_ssize_t -conn_send_string(ConnectionObject *conn, char *string, size_t length) -{ - DWORD amount_written; - - return WriteFile(conn->handle, string, length, &amount_written, NULL) - ? MP_SUCCESS : MP_STANDARD_ERROR; -} - -/* - * Attempts to read into buffer, or if buffer too small into *newbuffer. - * - * Returns number of bytes read. Assumes in message oriented mode. - */ - -static Py_ssize_t -conn_recv_string(ConnectionObject *conn, char *buffer, - size_t buflength, char **newbuffer, size_t maxlength) -{ - DWORD left, length, full_length, err; - - *newbuffer = NULL; - - if (ReadFile(conn->handle, buffer, MIN(buflength, maxlength), - &length, NULL)) - return length; - - err = GetLastError(); - if (err != ERROR_MORE_DATA) { - if (err == ERROR_BROKEN_PIPE) - return MP_END_OF_FILE; - return MP_STANDARD_ERROR; - } - - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, NULL, &left)) - return MP_STANDARD_ERROR; - - full_length = length + left; - if (full_length > maxlength) - return MP_BAD_MESSAGE_LENGTH; - - *newbuffer = PyMem_Malloc(full_length); - if (*newbuffer == NULL) - return MP_MEMORY_ERROR; - - memcpy(*newbuffer, buffer, length); - - if (ReadFile(conn->handle, *newbuffer+length, left, &length, NULL)) { - assert(length == left); - return full_length; - } else { - PyMem_Free(*newbuffer); - return MP_STANDARD_ERROR; - } -} - -/* - * Check whether any data is available for reading - */ - -#define conn_poll(conn, timeout) conn_poll_save(conn, timeout, _save) - -static int -conn_poll_save(ConnectionObject *conn, double timeout, PyThreadState *_save) -{ - DWORD bytes, deadline, delay; - int difference, res; - BOOL block = FALSE; - - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) - return MP_STANDARD_ERROR; - - if (timeout == 0.0) - return bytes > 0; - - if (timeout < 0.0) - block = TRUE; - else - /* XXX does not check for overflow */ - deadline = GetTickCount() + (DWORD)(1000 * timeout + 0.5); - - Sleep(0); - - for (delay = 1 ; ; delay += 1) { - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) - return MP_STANDARD_ERROR; - else if (bytes > 0) - return TRUE; - - if (!block) { - difference = deadline - GetTickCount(); - if (difference < 0) - return FALSE; - if ((int)delay > difference) - delay = difference; - } - - if (delay > 20) - delay = 20; - - Sleep(delay); - - /* check for signals */ - Py_BLOCK_THREADS - res = PyErr_CheckSignals(); - Py_UNBLOCK_THREADS - - if (res) - return MP_EXCEPTION_HAS_BEEN_SET; - } -} - -/* - * "connection.h" defines the PipeConnection type using the definitions above - */ - -#define CONNECTION_NAME "PipeConnection" -#define CONNECTION_TYPE PipeConnectionType - -#include "connection.h" +/* + * A type which wraps a pipe handle in message oriented mode + * + * pipe_connection.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +#define CLOSE(h) CloseHandle(h) + +/* + * Send string to the pipe; assumes in message oriented mode + */ + +static Py_ssize_t +conn_send_string(ConnectionObject *conn, char *string, size_t length) +{ + DWORD amount_written; + + return WriteFile(conn->handle, string, length, &amount_written, NULL) + ? MP_SUCCESS : MP_STANDARD_ERROR; +} + +/* + * Attempts to read into buffer, or if buffer too small into *newbuffer. + * + * Returns number of bytes read. Assumes in message oriented mode. + */ + +static Py_ssize_t +conn_recv_string(ConnectionObject *conn, char *buffer, + size_t buflength, char **newbuffer, size_t maxlength) +{ + DWORD left, length, full_length, err; + + *newbuffer = NULL; + + if (ReadFile(conn->handle, buffer, MIN(buflength, maxlength), + &length, NULL)) + return length; + + err = GetLastError(); + if (err != ERROR_MORE_DATA) { + if (err == ERROR_BROKEN_PIPE) + return MP_END_OF_FILE; + return MP_STANDARD_ERROR; + } + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, NULL, &left)) + return MP_STANDARD_ERROR; + + full_length = length + left; + if (full_length > maxlength) + return MP_BAD_MESSAGE_LENGTH; + + *newbuffer = PyMem_Malloc(full_length); + if (*newbuffer == NULL) + return MP_MEMORY_ERROR; + + memcpy(*newbuffer, buffer, length); + + if (ReadFile(conn->handle, *newbuffer+length, left, &length, NULL)) { + assert(length == left); + return full_length; + } else { + PyMem_Free(*newbuffer); + return MP_STANDARD_ERROR; + } +} + +/* + * Check whether any data is available for reading + */ + +#define conn_poll(conn, timeout) conn_poll_save(conn, timeout, _save) + +static int +conn_poll_save(ConnectionObject *conn, double timeout, PyThreadState *_save) +{ + DWORD bytes, deadline, delay; + int difference, res; + BOOL block = FALSE; + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + + if (timeout == 0.0) + return bytes > 0; + + if (timeout < 0.0) + block = TRUE; + else + /* XXX does not check for overflow */ + deadline = GetTickCount() + (DWORD)(1000 * timeout + 0.5); + + Sleep(0); + + for (delay = 1 ; ; delay += 1) { + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + else if (bytes > 0) + return TRUE; + + if (!block) { + difference = deadline - GetTickCount(); + if (difference < 0) + return FALSE; + if ((int)delay > difference) + delay = difference; + } + + if (delay > 20) + delay = 20; + + Sleep(delay); + + /* check for signals */ + Py_BLOCK_THREADS + res = PyErr_CheckSignals(); + Py_UNBLOCK_THREADS + + if (res) + return MP_EXCEPTION_HAS_BEEN_SET; + } +} + +/* + * "connection.h" defines the PipeConnection type using the definitions above + */ + +#define CONNECTION_NAME "PipeConnection" +#define CONNECTION_TYPE PipeConnectionType + +#include "connection.h" Modified: python/trunk/Modules/_multiprocessing/win32_functions.c ============================================================================== --- python/trunk/Modules/_multiprocessing/win32_functions.c (original) +++ python/trunk/Modules/_multiprocessing/win32_functions.c Fri Jun 13 21:13:39 2008 @@ -1,260 +1,260 @@ -/* - * Win32 functions used by multiprocessing package - * - * win32_functions.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - - -#define WIN32_FUNCTION(func) \ - {#func, (PyCFunction)win32_ ## func, METH_VARARGS | METH_STATIC, ""} - -#define WIN32_CONSTANT(fmt, con) \ - PyDict_SetItemString(Win32Type.tp_dict, #con, Py_BuildValue(fmt, con)) - - -static PyObject * -win32_CloseHandle(PyObject *self, PyObject *args) -{ - HANDLE hObject; - BOOL success; - - if (!PyArg_ParseTuple(args, F_HANDLE, &hObject)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = CloseHandle(hObject); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_ConnectNamedPipe(PyObject *self, PyObject *args) -{ - HANDLE hNamedPipe; - LPOVERLAPPED lpOverlapped; - BOOL success; - - if (!PyArg_ParseTuple(args, F_HANDLE F_POINTER, - &hNamedPipe, &lpOverlapped)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = ConnectNamedPipe(hNamedPipe, lpOverlapped); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_CreateFile(PyObject *self, PyObject *args) -{ - LPCTSTR lpFileName; - DWORD dwDesiredAccess; - DWORD dwShareMode; - LPSECURITY_ATTRIBUTES lpSecurityAttributes; - DWORD dwCreationDisposition; - DWORD dwFlagsAndAttributes; - HANDLE hTemplateFile; - HANDLE handle; - - if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_POINTER - F_DWORD F_DWORD F_HANDLE, - &lpFileName, &dwDesiredAccess, &dwShareMode, - &lpSecurityAttributes, &dwCreationDisposition, - &dwFlagsAndAttributes, &hTemplateFile)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - handle = CreateFile(lpFileName, dwDesiredAccess, - dwShareMode, lpSecurityAttributes, - dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); - Py_END_ALLOW_THREADS - - if (handle == INVALID_HANDLE_VALUE) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_CreateNamedPipe(PyObject *self, PyObject *args) -{ - LPCTSTR lpName; - DWORD dwOpenMode; - DWORD dwPipeMode; - DWORD nMaxInstances; - DWORD nOutBufferSize; - DWORD nInBufferSize; - DWORD nDefaultTimeOut; - LPSECURITY_ATTRIBUTES lpSecurityAttributes; - HANDLE handle; - - if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_DWORD - F_DWORD F_DWORD F_DWORD F_POINTER, - &lpName, &dwOpenMode, &dwPipeMode, - &nMaxInstances, &nOutBufferSize, - &nInBufferSize, &nDefaultTimeOut, - &lpSecurityAttributes)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - handle = CreateNamedPipe(lpName, dwOpenMode, dwPipeMode, - nMaxInstances, nOutBufferSize, - nInBufferSize, nDefaultTimeOut, - lpSecurityAttributes); - Py_END_ALLOW_THREADS - - if (handle == INVALID_HANDLE_VALUE) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_ExitProcess(PyObject *self, PyObject *args) -{ - UINT uExitCode; - - if (!PyArg_ParseTuple(args, "I", &uExitCode)) - return NULL; - - ExitProcess(uExitCode); - - return NULL; -} - -static PyObject * -win32_GetLastError(PyObject *self, PyObject *args) -{ - return Py_BuildValue(F_DWORD, GetLastError()); -} - -static PyObject * -win32_OpenProcess(PyObject *self, PyObject *args) -{ - DWORD dwDesiredAccess; - BOOL bInheritHandle; - DWORD dwProcessId; - HANDLE handle; - - if (!PyArg_ParseTuple(args, F_DWORD "i" F_DWORD, - &dwDesiredAccess, &bInheritHandle, &dwProcessId)) - return NULL; - - handle = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId); - if (handle == NULL) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_SetNamedPipeHandleState(PyObject *self, PyObject *args) -{ - HANDLE hNamedPipe; - PyObject *oArgs[3]; - DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL}; - int i; - - if (!PyArg_ParseTuple(args, F_HANDLE "OOO", - &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2])) - return NULL; - - PyErr_Clear(); - - for (i = 0 ; i < 3 ; i++) { - if (oArgs[i] != Py_None) { - dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]); - if (PyErr_Occurred()) - return NULL; - pArgs[i] = &dwArgs[i]; - } - } - - if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2])) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_WaitNamedPipe(PyObject *self, PyObject *args) -{ - LPCTSTR lpNamedPipeName; - DWORD nTimeOut; - BOOL success; - - if (!PyArg_ParseTuple(args, "s" F_DWORD, &lpNamedPipeName, &nTimeOut)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = WaitNamedPipe(lpNamedPipeName, nTimeOut); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyMethodDef win32_methods[] = { - WIN32_FUNCTION(CloseHandle), - WIN32_FUNCTION(GetLastError), - WIN32_FUNCTION(OpenProcess), - WIN32_FUNCTION(ExitProcess), - WIN32_FUNCTION(ConnectNamedPipe), - WIN32_FUNCTION(CreateFile), - WIN32_FUNCTION(CreateNamedPipe), - WIN32_FUNCTION(SetNamedPipeHandleState), - WIN32_FUNCTION(WaitNamedPipe), - {NULL} -}; - - -PyTypeObject Win32Type = { - PyVarObject_HEAD_INIT(NULL, 0) -}; - - -PyObject * -create_win32_namespace(void) -{ - Win32Type.tp_name = "_multiprocessing.win32"; - Win32Type.tp_methods = win32_methods; - if (PyType_Ready(&Win32Type) < 0) - return NULL; - Py_INCREF(&Win32Type); - - WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS); - WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); - WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); - WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT); - WIN32_CONSTANT(F_DWORD, GENERIC_READ); - WIN32_CONSTANT(F_DWORD, GENERIC_WRITE); - WIN32_CONSTANT(F_DWORD, INFINITE); - WIN32_CONSTANT(F_DWORD, NMPWAIT_WAIT_FOREVER); - WIN32_CONSTANT(F_DWORD, OPEN_EXISTING); - WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_DUPLEX); - WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_INBOUND); - WIN32_CONSTANT(F_DWORD, PIPE_READMODE_MESSAGE); - WIN32_CONSTANT(F_DWORD, PIPE_TYPE_MESSAGE); - WIN32_CONSTANT(F_DWORD, PIPE_UNLIMITED_INSTANCES); - WIN32_CONSTANT(F_DWORD, PIPE_WAIT); - WIN32_CONSTANT(F_DWORD, PROCESS_ALL_ACCESS); - - WIN32_CONSTANT("i", NULL); - - return (PyObject*)&Win32Type; -} +/* + * Win32 functions used by multiprocessing package + * + * win32_functions.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + + +#define WIN32_FUNCTION(func) \ + {#func, (PyCFunction)win32_ ## func, METH_VARARGS | METH_STATIC, ""} + +#define WIN32_CONSTANT(fmt, con) \ + PyDict_SetItemString(Win32Type.tp_dict, #con, Py_BuildValue(fmt, con)) + + +static PyObject * +win32_CloseHandle(PyObject *self, PyObject *args) +{ + HANDLE hObject; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE, &hObject)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = CloseHandle(hObject); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_ConnectNamedPipe(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + LPOVERLAPPED lpOverlapped; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE F_POINTER, + &hNamedPipe, &lpOverlapped)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = ConnectNamedPipe(hNamedPipe, lpOverlapped); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_CreateFile(PyObject *self, PyObject *args) +{ + LPCTSTR lpFileName; + DWORD dwDesiredAccess; + DWORD dwShareMode; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + DWORD dwCreationDisposition; + DWORD dwFlagsAndAttributes; + HANDLE hTemplateFile; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_POINTER + F_DWORD F_DWORD F_HANDLE, + &lpFileName, &dwDesiredAccess, &dwShareMode, + &lpSecurityAttributes, &dwCreationDisposition, + &dwFlagsAndAttributes, &hTemplateFile)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateFile(lpFileName, dwDesiredAccess, + dwShareMode, lpSecurityAttributes, + dwCreationDisposition, + dwFlagsAndAttributes, hTemplateFile); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_CreateNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpName; + DWORD dwOpenMode; + DWORD dwPipeMode; + DWORD nMaxInstances; + DWORD nOutBufferSize; + DWORD nInBufferSize; + DWORD nDefaultTimeOut; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_DWORD + F_DWORD F_DWORD F_DWORD F_POINTER, + &lpName, &dwOpenMode, &dwPipeMode, + &nMaxInstances, &nOutBufferSize, + &nInBufferSize, &nDefaultTimeOut, + &lpSecurityAttributes)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateNamedPipe(lpName, dwOpenMode, dwPipeMode, + nMaxInstances, nOutBufferSize, + nInBufferSize, nDefaultTimeOut, + lpSecurityAttributes); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_ExitProcess(PyObject *self, PyObject *args) +{ + UINT uExitCode; + + if (!PyArg_ParseTuple(args, "I", &uExitCode)) + return NULL; + + ExitProcess(uExitCode); + + return NULL; +} + +static PyObject * +win32_GetLastError(PyObject *self, PyObject *args) +{ + return Py_BuildValue(F_DWORD, GetLastError()); +} + +static PyObject * +win32_OpenProcess(PyObject *self, PyObject *args) +{ + DWORD dwDesiredAccess; + BOOL bInheritHandle; + DWORD dwProcessId; + HANDLE handle; + + if (!PyArg_ParseTuple(args, F_DWORD "i" F_DWORD, + &dwDesiredAccess, &bInheritHandle, &dwProcessId)) + return NULL; + + handle = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId); + if (handle == NULL) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_SetNamedPipeHandleState(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + PyObject *oArgs[3]; + DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL}; + int i; + + if (!PyArg_ParseTuple(args, F_HANDLE "OOO", + &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2])) + return NULL; + + PyErr_Clear(); + + for (i = 0 ; i < 3 ; i++) { + if (oArgs[i] != Py_None) { + dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]); + if (PyErr_Occurred()) + return NULL; + pArgs[i] = &dwArgs[i]; + } + } + + if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2])) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_WaitNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpNamedPipeName; + DWORD nTimeOut; + BOOL success; + + if (!PyArg_ParseTuple(args, "s" F_DWORD, &lpNamedPipeName, &nTimeOut)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = WaitNamedPipe(lpNamedPipeName, nTimeOut); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyMethodDef win32_methods[] = { + WIN32_FUNCTION(CloseHandle), + WIN32_FUNCTION(GetLastError), + WIN32_FUNCTION(OpenProcess), + WIN32_FUNCTION(ExitProcess), + WIN32_FUNCTION(ConnectNamedPipe), + WIN32_FUNCTION(CreateFile), + WIN32_FUNCTION(CreateNamedPipe), + WIN32_FUNCTION(SetNamedPipeHandleState), + WIN32_FUNCTION(WaitNamedPipe), + {NULL} +}; + + +PyTypeObject Win32Type = { + PyVarObject_HEAD_INIT(NULL, 0) +}; + + +PyObject * +create_win32_namespace(void) +{ + Win32Type.tp_name = "_multiprocessing.win32"; + Win32Type.tp_methods = win32_methods; + if (PyType_Ready(&Win32Type) < 0) + return NULL; + Py_INCREF(&Win32Type); + + WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); + WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT); + WIN32_CONSTANT(F_DWORD, GENERIC_READ); + WIN32_CONSTANT(F_DWORD, GENERIC_WRITE); + WIN32_CONSTANT(F_DWORD, INFINITE); + WIN32_CONSTANT(F_DWORD, NMPWAIT_WAIT_FOREVER); + WIN32_CONSTANT(F_DWORD, OPEN_EXISTING); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_DUPLEX); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_INBOUND); + WIN32_CONSTANT(F_DWORD, PIPE_READMODE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_TYPE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_UNLIMITED_INSTANCES); + WIN32_CONSTANT(F_DWORD, PIPE_WAIT); + WIN32_CONSTANT(F_DWORD, PROCESS_ALL_ACCESS); + + WIN32_CONSTANT("i", NULL); + + return (PyObject*)&Win32Type; +} From python-checkins at python.org Fri Jun 13 21:20:50 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jun 2008 21:20:50 +0200 (CEST) Subject: [Python-checkins] r64250 - in python/trunk/Lib/multiprocessing: __init__.py connection.py forking.py heap.py managers.py pool.py process.py queues.py reduction.py sharedctypes.py synchronize.py util.py Message-ID: <20080613192050.3B5431E4006@bag.python.org> Author: benjamin.peterson Date: Fri Jun 13 21:20:48 2008 New Revision: 64250 Log: darn! I converted half of the files the wrong way. Modified: python/trunk/Lib/multiprocessing/__init__.py python/trunk/Lib/multiprocessing/connection.py python/trunk/Lib/multiprocessing/forking.py python/trunk/Lib/multiprocessing/heap.py python/trunk/Lib/multiprocessing/managers.py python/trunk/Lib/multiprocessing/pool.py python/trunk/Lib/multiprocessing/process.py python/trunk/Lib/multiprocessing/queues.py python/trunk/Lib/multiprocessing/reduction.py python/trunk/Lib/multiprocessing/sharedctypes.py python/trunk/Lib/multiprocessing/synchronize.py python/trunk/Lib/multiprocessing/util.py Modified: python/trunk/Lib/multiprocessing/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/__init__.py (original) +++ python/trunk/Lib/multiprocessing/__init__.py Fri Jun 13 21:20:48 2008 @@ -1,271 +1,271 @@ -# -# Package analogous to 'threading.py' but using processes -# -# multiprocessing/__init__.py -# -# This package is intended to duplicate the functionality (and much of -# the API) of threading.py but uses processes instead of threads. A -# subpackage 'multiprocessing.dummy' has the same API but is a simple -# wrapper for 'threading'. -# -# Try calling `multiprocessing.doc.main()` to read the html -# documentation in in a webbrowser. -# -# -# Copyright (c) 2006-2008, R Oudkerk -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of author nor the names of any contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# - -__version__ = '0.70a1' - -__all__ = [ - 'Process', 'current_process', 'active_children', 'freeze_support', - 'Manager', 'Pipe', 'cpu_count', 'log_to_stderr', 'get_logger', - 'allow_connection_pickling', 'BufferTooShort', 'TimeoutError', - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', - 'Event', 'Queue', 'JoinableQueue', 'Pool', 'Value', 'Array', - 'RawValue', 'RawArray' - ] - -__author__ = 'R. Oudkerk (r.m.oudkerk at gmail.com)' - -# -# Imports -# - -import os -import sys - -from multiprocessing.process import Process, current_process, active_children - -# -# Exceptions -# - -class ProcessError(Exception): - pass - -class BufferTooShort(ProcessError): - pass - -class TimeoutError(ProcessError): - pass - -class AuthenticationError(ProcessError): - pass - -# This is down here because _multiprocessing uses BufferTooShort -import _multiprocessing - -# -# Definitions not depending on native semaphores -# - -def Manager(): - ''' - Returns a manager associated with a running server process - - The managers methods such as `Lock()`, `Condition()` and `Queue()` - can be used to create shared objects. - ''' - from multiprocessing.managers import SyncManager - m = SyncManager() - m.start() - return m - -def Pipe(duplex=True): - ''' - Returns two connection object connected by a pipe - ''' - from multiprocessing.connection import Pipe - return Pipe(duplex) - -def cpu_count(): - ''' - Returns the number of CPUs in the system - ''' - if sys.platform == 'win32': - try: - num = int(os.environ['NUMBER_OF_PROCESSORS']) - except (ValueError, KeyError): - num = 0 - elif sys.platform == 'darwin': - try: - num = int(os.popen('sysctl -n hw.ncpu').read()) - except ValueError: - num = 0 - else: - try: - num = os.sysconf('SC_NPROCESSORS_ONLN') - except (ValueError, OSError, AttributeError): - num = 0 - - if num >= 1: - return num - else: - raise NotImplementedError('cannot determine number of cpus') - -def freeze_support(): - ''' - Check whether this is a fake forked process in a frozen executable. - If so then run code specified by commandline and exit. - ''' - if sys.platform == 'win32' and getattr(sys, 'frozen', False): - from multiprocessing.forking import freeze_support - freeze_support() - -def get_logger(): - ''' - Return package logger -- if it does not already exist then it is created - ''' - from multiprocessing.util import get_logger - return get_logger() - -def log_to_stderr(level=None): - ''' - Turn on logging and add a handler which prints to stderr - ''' - from multiprocessing.util import log_to_stderr - return log_to_stderr(level) - -def allow_connection_pickling(): - ''' - Install support for sending connections and sockets between processes - ''' - from multiprocessing import reduction - -# -# Definitions depending on native semaphores -# - -def Lock(): - ''' - Returns a non-recursive lock object - ''' - from multiprocessing.synchronize import Lock - return Lock() - -def RLock(): - ''' - Returns a recursive lock object - ''' - from multiprocessing.synchronize import RLock - return RLock() - -def Condition(lock=None): - ''' - Returns a condition object - ''' - from multiprocessing.synchronize import Condition - return Condition(lock) - -def Semaphore(value=1): - ''' - Returns a semaphore object - ''' - from multiprocessing.synchronize import Semaphore - return Semaphore(value) - -def BoundedSemaphore(value=1): - ''' - Returns a bounded semaphore object - ''' - from multiprocessing.synchronize import BoundedSemaphore - return BoundedSemaphore(value) - -def Event(): - ''' - Returns an event object - ''' - from multiprocessing.synchronize import Event - return Event() - -def Queue(maxsize=0): - ''' - Returns a queue object - ''' - from multiprocessing.queues import Queue - return Queue(maxsize) - -def JoinableQueue(maxsize=0): - ''' - Returns a queue object - ''' - from multiprocessing.queues import JoinableQueue - return JoinableQueue(maxsize) - -def Pool(processes=None, initializer=None, initargs=()): - ''' - Returns a process pool object - ''' - from multiprocessing.pool import Pool - return Pool(processes, initializer, initargs) - -def RawValue(typecode_or_type, *args): - ''' - Returns a shared object - ''' - from multiprocessing.sharedctypes import RawValue - return RawValue(typecode_or_type, *args) - -def RawArray(typecode_or_type, size_or_initializer): - ''' - Returns a shared array - ''' - from multiprocessing.sharedctypes import RawArray - return RawArray(typecode_or_type, size_or_initializer) - -def Value(typecode_or_type, *args, **kwds): - ''' - Returns a synchronized shared object - ''' - from multiprocessing.sharedctypes import Value - return Value(typecode_or_type, *args, **kwds) - -def Array(typecode_or_type, size_or_initializer, **kwds): - ''' - Returns a synchronized shared array - ''' - from multiprocessing.sharedctypes import Array - return Array(typecode_or_type, size_or_initializer, **kwds) - -# -# -# - -if sys.platform == 'win32': - - def set_executable(executable): - ''' - Sets the path to a python.exe or pythonw.exe binary used to run - child processes on Windows instead of sys.executable. - Useful for people embedding Python. - ''' - from multiprocessing.forking import set_executable - set_executable(executable) - - __all__ += ['set_executable'] +# +# Package analogous to 'threading.py' but using processes +# +# multiprocessing/__init__.py +# +# This package is intended to duplicate the functionality (and much of +# the API) of threading.py but uses processes instead of threads. A +# subpackage 'multiprocessing.dummy' has the same API but is a simple +# wrapper for 'threading'. +# +# Try calling `multiprocessing.doc.main()` to read the html +# documentation in in a webbrowser. +# +# +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of author nor the names of any contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# + +__version__ = '0.70a1' + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Manager', 'Pipe', 'cpu_count', 'log_to_stderr', 'get_logger', + 'allow_connection_pickling', 'BufferTooShort', 'TimeoutError', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'JoinableQueue', 'Pool', 'Value', 'Array', + 'RawValue', 'RawArray' + ] + +__author__ = 'R. Oudkerk (r.m.oudkerk at gmail.com)' + +# +# Imports +# + +import os +import sys + +from multiprocessing.process import Process, current_process, active_children + +# +# Exceptions +# + +class ProcessError(Exception): + pass + +class BufferTooShort(ProcessError): + pass + +class TimeoutError(ProcessError): + pass + +class AuthenticationError(ProcessError): + pass + +# This is down here because _multiprocessing uses BufferTooShort +import _multiprocessing + +# +# Definitions not depending on native semaphores +# + +def Manager(): + ''' + Returns a manager associated with a running server process + + The managers methods such as `Lock()`, `Condition()` and `Queue()` + can be used to create shared objects. + ''' + from multiprocessing.managers import SyncManager + m = SyncManager() + m.start() + return m + +def Pipe(duplex=True): + ''' + Returns two connection object connected by a pipe + ''' + from multiprocessing.connection import Pipe + return Pipe(duplex) + +def cpu_count(): + ''' + Returns the number of CPUs in the system + ''' + if sys.platform == 'win32': + try: + num = int(os.environ['NUMBER_OF_PROCESSORS']) + except (ValueError, KeyError): + num = 0 + elif sys.platform == 'darwin': + try: + num = int(os.popen('sysctl -n hw.ncpu').read()) + except ValueError: + num = 0 + else: + try: + num = os.sysconf('SC_NPROCESSORS_ONLN') + except (ValueError, OSError, AttributeError): + num = 0 + + if num >= 1: + return num + else: + raise NotImplementedError('cannot determine number of cpus') + +def freeze_support(): + ''' + Check whether this is a fake forked process in a frozen executable. + If so then run code specified by commandline and exit. + ''' + if sys.platform == 'win32' and getattr(sys, 'frozen', False): + from multiprocessing.forking import freeze_support + freeze_support() + +def get_logger(): + ''' + Return package logger -- if it does not already exist then it is created + ''' + from multiprocessing.util import get_logger + return get_logger() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + from multiprocessing.util import log_to_stderr + return log_to_stderr(level) + +def allow_connection_pickling(): + ''' + Install support for sending connections and sockets between processes + ''' + from multiprocessing import reduction + +# +# Definitions depending on native semaphores +# + +def Lock(): + ''' + Returns a non-recursive lock object + ''' + from multiprocessing.synchronize import Lock + return Lock() + +def RLock(): + ''' + Returns a recursive lock object + ''' + from multiprocessing.synchronize import RLock + return RLock() + +def Condition(lock=None): + ''' + Returns a condition object + ''' + from multiprocessing.synchronize import Condition + return Condition(lock) + +def Semaphore(value=1): + ''' + Returns a semaphore object + ''' + from multiprocessing.synchronize import Semaphore + return Semaphore(value) + +def BoundedSemaphore(value=1): + ''' + Returns a bounded semaphore object + ''' + from multiprocessing.synchronize import BoundedSemaphore + return BoundedSemaphore(value) + +def Event(): + ''' + Returns an event object + ''' + from multiprocessing.synchronize import Event + return Event() + +def Queue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import Queue + return Queue(maxsize) + +def JoinableQueue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import JoinableQueue + return JoinableQueue(maxsize) + +def Pool(processes=None, initializer=None, initargs=()): + ''' + Returns a process pool object + ''' + from multiprocessing.pool import Pool + return Pool(processes, initializer, initargs) + +def RawValue(typecode_or_type, *args): + ''' + Returns a shared object + ''' + from multiprocessing.sharedctypes import RawValue + return RawValue(typecode_or_type, *args) + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a shared array + ''' + from multiprocessing.sharedctypes import RawArray + return RawArray(typecode_or_type, size_or_initializer) + +def Value(typecode_or_type, *args, **kwds): + ''' + Returns a synchronized shared object + ''' + from multiprocessing.sharedctypes import Value + return Value(typecode_or_type, *args, **kwds) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Returns a synchronized shared array + ''' + from multiprocessing.sharedctypes import Array + return Array(typecode_or_type, size_or_initializer, **kwds) + +# +# +# + +if sys.platform == 'win32': + + def set_executable(executable): + ''' + Sets the path to a python.exe or pythonw.exe binary used to run + child processes on Windows instead of sys.executable. + Useful for people embedding Python. + ''' + from multiprocessing.forking import set_executable + set_executable(executable) + + __all__ += ['set_executable'] Modified: python/trunk/Lib/multiprocessing/connection.py ============================================================================== --- python/trunk/Lib/multiprocessing/connection.py (original) +++ python/trunk/Lib/multiprocessing/connection.py Fri Jun 13 21:20:48 2008 @@ -1,425 +1,425 @@ -# -# A higher level module for using sockets (or Windows named pipes) -# -# multiprocessing/connection.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'Client', 'Listener', 'Pipe' ] - -import os -import sys -import socket -import time -import tempfile -import itertools - -import _multiprocessing -from multiprocessing import current_process -from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug -from multiprocessing.forking import duplicate, close - - -# -# -# - -BUFSIZE = 8192 - -_mmap_counter = itertools.count() - -default_family = 'AF_INET' -families = ['AF_INET'] - -if hasattr(socket, 'AF_UNIX'): - default_family = 'AF_UNIX' - families += ['AF_UNIX'] - -if sys.platform == 'win32': - default_family = 'AF_PIPE' - families += ['AF_PIPE'] - -# -# -# - -def arbitrary_address(family): - ''' - Return an arbitrary free address for the given family - ''' - if family == 'AF_INET': - return ('localhost', 0) - elif family == 'AF_UNIX': - return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) - elif family == 'AF_PIPE': - return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % - (os.getpid(), _mmap_counter.next())) - else: - raise ValueError('unrecognized family') - - -def address_type(address): - ''' - Return the types of the address - - This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' - ''' - if type(address) == tuple: - return 'AF_INET' - elif type(address) is str and address.startswith('\\\\'): - return 'AF_PIPE' - elif type(address) is str: - return 'AF_UNIX' - else: - raise ValueError('address type of %r unrecognized' % address) - -# -# Public functions -# - -class Listener(object): - ''' - Returns a listener object. - - This is a wrapper for a bound socket which is 'listening' for - connections, or for a Windows named pipe. - ''' - def __init__(self, address=None, family=None, backlog=1, authkey=None): - family = family or (address and address_type(address)) \ - or default_family - address = address or arbitrary_address(family) - - if family == 'AF_PIPE': - self._listener = PipeListener(address, backlog) - else: - self._listener = SocketListener(address, family, backlog) - - if authkey is not None and not isinstance(authkey, bytes): - raise TypeError, 'authkey should be a byte string' - - self._authkey = authkey - - def accept(self): - ''' - Accept a connection on the bound socket or named pipe of `self`. - - Returns a `Connection` object. - ''' - c = self._listener.accept() - if self._authkey: - deliver_challenge(c, self._authkey) - answer_challenge(c, self._authkey) - return c - - def close(self): - ''' - Close the bound socket or named pipe of `self`. - ''' - return self._listener.close() - - address = property(lambda self: self._listener._address) - last_accepted = property(lambda self: self._listener._last_accepted) - - -def Client(address, family=None, authkey=None): - ''' - Returns a connection to the address of a `Listener` - ''' - family = family or address_type(address) - if family == 'AF_PIPE': - c = PipeClient(address) - else: - c = SocketClient(address) - - if authkey is not None and not isinstance(authkey, bytes): - raise TypeError, 'authkey should be a byte string' - - if authkey is not None: - answer_challenge(c, authkey) - deliver_challenge(c, authkey) - - return c - - -if sys.platform != 'win32': - - def Pipe(duplex=True): - ''' - Returns pair of connection objects at either end of a pipe - ''' - if duplex: - s1, s2 = socket.socketpair() - c1 = _multiprocessing.Connection(os.dup(s1.fileno())) - c2 = _multiprocessing.Connection(os.dup(s2.fileno())) - s1.close() - s2.close() - else: - fd1, fd2 = os.pipe() - c1 = _multiprocessing.Connection(fd1, writable=False) - c2 = _multiprocessing.Connection(fd2, readable=False) - - return c1, c2 - -else: - - from ._multiprocessing import win32 - - def Pipe(duplex=True): - ''' - Returns pair of connection objects at either end of a pipe - ''' - address = arbitrary_address('AF_PIPE') - if duplex: - openmode = win32.PIPE_ACCESS_DUPLEX - access = win32.GENERIC_READ | win32.GENERIC_WRITE - obsize, ibsize = BUFSIZE, BUFSIZE - else: - openmode = win32.PIPE_ACCESS_INBOUND - access = win32.GENERIC_WRITE - obsize, ibsize = 0, BUFSIZE - - h1 = win32.CreateNamedPipe( - address, openmode, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - 1, obsize, ibsize, win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - h2 = win32.CreateFile( - address, access, 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL - ) - win32.SetNamedPipeHandleState( - h2, win32.PIPE_READMODE_MESSAGE, None, None - ) - - try: - win32.ConnectNamedPipe(h1, win32.NULL) - except WindowsError, e: - if e.args[0] != win32.ERROR_PIPE_CONNECTED: - raise - - c1 = _multiprocessing.PipeConnection(h1, writable=duplex) - c2 = _multiprocessing.PipeConnection(h2, readable=duplex) - - return c1, c2 - -# -# Definitions for connections based on sockets -# - -class SocketListener(object): - ''' - Represtation of a socket which is bound to an address and listening - ''' - def __init__(self, address, family, backlog=1): - self._socket = socket.socket(getattr(socket, family)) - self._socket.bind(address) - self._socket.listen(backlog) - address = self._socket.getsockname() - if type(address) is tuple: - address = (socket.getfqdn(address[0]),) + address[1:] - self._address = address - self._family = family - self._last_accepted = None - - sub_debug('listener bound to address %r', self._address) - - if family == 'AF_UNIX': - self._unlink = Finalize( - self, os.unlink, args=(self._address,), exitpriority=0 - ) - else: - self._unlink = None - - def accept(self): - s, self._last_accepted = self._socket.accept() - fd = duplicate(s.fileno()) - conn = _multiprocessing.Connection(fd) - s.close() - return conn - - def close(self): - self._socket.close() - if self._unlink is not None: - self._unlink() - - -def SocketClient(address): - ''' - Return a connection object connected to the socket given by `address` - ''' - family = address_type(address) - s = socket.socket( getattr(socket, family) ) - - while 1: - try: - s.connect(address) - except socket.error, e: - if e.args[0] != 10061: # 10061 => connection refused - debug('failed to connect to address %s', address) - raise - time.sleep(0.01) - else: - break - else: - raise - - fd = duplicate(s.fileno()) - conn = _multiprocessing.Connection(fd) - s.close() - return conn - -# -# Definitions for connections based on named pipes -# - -if sys.platform == 'win32': - - class PipeListener(object): - ''' - Representation of a named pipe - ''' - def __init__(self, address, backlog=None): - self._address = address - handle = win32.CreateNamedPipe( - address, win32.PIPE_ACCESS_DUPLEX, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, - win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - self._handle_queue = [handle] - self._last_accepted = None - - sub_debug('listener created with address=%r', self._address) - - self.close = Finalize( - self, PipeListener._finalize_pipe_listener, - args=(self._handle_queue, self._address), exitpriority=0 - ) - - def accept(self): - newhandle = win32.CreateNamedPipe( - self._address, win32.PIPE_ACCESS_DUPLEX, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, - win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - self._handle_queue.append(newhandle) - handle = self._handle_queue.pop(0) - try: - win32.ConnectNamedPipe(handle, win32.NULL) - except WindowsError, e: - if e.args[0] != win32.ERROR_PIPE_CONNECTED: - raise - return _multiprocessing.PipeConnection(handle) - - @staticmethod - def _finalize_pipe_listener(queue, address): - sub_debug('closing listener with address=%r', address) - for handle in queue: - close(handle) - - def PipeClient(address): - ''' - Return a connection object connected to the pipe given by `address` - ''' - while 1: - try: - win32.WaitNamedPipe(address, 1000) - h = win32.CreateFile( - address, win32.GENERIC_READ | win32.GENERIC_WRITE, - 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL - ) - except WindowsError, e: - if e.args[0] not in (win32.ERROR_SEM_TIMEOUT, - win32.ERROR_PIPE_BUSY): - raise - else: - break - else: - raise - - win32.SetNamedPipeHandleState( - h, win32.PIPE_READMODE_MESSAGE, None, None - ) - return _multiprocessing.PipeConnection(h) - -# -# Authentication stuff -# - -MESSAGE_LENGTH = 20 - -CHALLENGE = '#CHALLENGE#' -WELCOME = '#WELCOME#' -FAILURE = '#FAILURE#' - -if sys.version_info >= (3, 0): # XXX can use bytes literals in 2.6/3.0 - CHALLENGE = CHALLENGE.encode('ascii') - WELCOME = WELCOME.encode('ascii') - FAILURE = FAILURE.encode('ascii') - -def deliver_challenge(connection, authkey): - import hmac - assert isinstance(authkey, bytes) - message = os.urandom(MESSAGE_LENGTH) - connection.send_bytes(CHALLENGE + message) - digest = hmac.new(authkey, message).digest() - response = connection.recv_bytes(256) # reject large message - if response == digest: - connection.send_bytes(WELCOME) - else: - connection.send_bytes(FAILURE) - raise AuthenticationError('digest received was wrong') - -def answer_challenge(connection, authkey): - import hmac - assert isinstance(authkey, bytes) - message = connection.recv_bytes(256) # reject large message - assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message - message = message[len(CHALLENGE):] - digest = hmac.new(authkey, message).digest() - connection.send_bytes(digest) - response = connection.recv_bytes(256) # reject large message - if response != WELCOME: - raise AuthenticationError('digest sent was rejected') - -# -# Support for using xmlrpclib for serialization -# - -class ConnectionWrapper(object): - def __init__(self, conn, dumps, loads): - self._conn = conn - self._dumps = dumps - self._loads = loads - for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): - obj = getattr(conn, attr) - setattr(self, attr, obj) - def send(self, obj): - s = self._dumps(obj) - self._conn.send_bytes(s) - def recv(self): - s = self._conn.recv_bytes() - return self._loads(s) - -def _xml_dumps(obj): - return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') - -def _xml_loads(s): - (obj,), method = xmlrpclib.loads(s.decode('utf8')) - return obj - -class XmlListener(Listener): - def accept(self): - global xmlrpclib - import xmlrpclib - obj = Listener.accept(self) - return ConnectionWrapper(obj, _xml_dumps, _xml_loads) - -def XmlClient(*args, **kwds): - global xmlrpclib - import xmlrpclib - return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) +# +# A higher level module for using sockets (or Windows named pipes) +# +# multiprocessing/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +import os +import sys +import socket +import time +import tempfile +import itertools + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug +from multiprocessing.forking import duplicate, close + + +# +# +# + +BUFSIZE = 8192 + +_mmap_counter = itertools.count() + +default_family = 'AF_INET' +families = ['AF_INET'] + +if hasattr(socket, 'AF_UNIX'): + default_family = 'AF_UNIX' + families += ['AF_UNIX'] + +if sys.platform == 'win32': + default_family = 'AF_PIPE' + families += ['AF_PIPE'] + +# +# +# + +def arbitrary_address(family): + ''' + Return an arbitrary free address for the given family + ''' + if family == 'AF_INET': + return ('localhost', 0) + elif family == 'AF_UNIX': + return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) + elif family == 'AF_PIPE': + return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % + (os.getpid(), _mmap_counter.next())) + else: + raise ValueError('unrecognized family') + + +def address_type(address): + ''' + Return the types of the address + + This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' + ''' + if type(address) == tuple: + return 'AF_INET' + elif type(address) is str and address.startswith('\\\\'): + return 'AF_PIPE' + elif type(address) is str: + return 'AF_UNIX' + else: + raise ValueError('address type of %r unrecognized' % address) + +# +# Public functions +# + +class Listener(object): + ''' + Returns a listener object. + + This is a wrapper for a bound socket which is 'listening' for + connections, or for a Windows named pipe. + ''' + def __init__(self, address=None, family=None, backlog=1, authkey=None): + family = family or (address and address_type(address)) \ + or default_family + address = address or arbitrary_address(family) + + if family == 'AF_PIPE': + self._listener = PipeListener(address, backlog) + else: + self._listener = SocketListener(address, family, backlog) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + self._authkey = authkey + + def accept(self): + ''' + Accept a connection on the bound socket or named pipe of `self`. + + Returns a `Connection` object. + ''' + c = self._listener.accept() + if self._authkey: + deliver_challenge(c, self._authkey) + answer_challenge(c, self._authkey) + return c + + def close(self): + ''' + Close the bound socket or named pipe of `self`. + ''' + return self._listener.close() + + address = property(lambda self: self._listener._address) + last_accepted = property(lambda self: self._listener._last_accepted) + + +def Client(address, family=None, authkey=None): + ''' + Returns a connection to the address of a `Listener` + ''' + family = family or address_type(address) + if family == 'AF_PIPE': + c = PipeClient(address) + else: + c = SocketClient(address) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + if authkey is not None: + answer_challenge(c, authkey) + deliver_challenge(c, authkey) + + return c + + +if sys.platform != 'win32': + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + if duplex: + s1, s2 = socket.socketpair() + c1 = _multiprocessing.Connection(os.dup(s1.fileno())) + c2 = _multiprocessing.Connection(os.dup(s2.fileno())) + s1.close() + s2.close() + else: + fd1, fd2 = os.pipe() + c1 = _multiprocessing.Connection(fd1, writable=False) + c2 = _multiprocessing.Connection(fd2, readable=False) + + return c1, c2 + +else: + + from ._multiprocessing import win32 + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + address = arbitrary_address('AF_PIPE') + if duplex: + openmode = win32.PIPE_ACCESS_DUPLEX + access = win32.GENERIC_READ | win32.GENERIC_WRITE + obsize, ibsize = BUFSIZE, BUFSIZE + else: + openmode = win32.PIPE_ACCESS_INBOUND + access = win32.GENERIC_WRITE + obsize, ibsize = 0, BUFSIZE + + h1 = win32.CreateNamedPipe( + address, openmode, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + 1, obsize, ibsize, win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + h2 = win32.CreateFile( + address, access, 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + win32.SetNamedPipeHandleState( + h2, win32.PIPE_READMODE_MESSAGE, None, None + ) + + try: + win32.ConnectNamedPipe(h1, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + + c1 = _multiprocessing.PipeConnection(h1, writable=duplex) + c2 = _multiprocessing.PipeConnection(h2, readable=duplex) + + return c1, c2 + +# +# Definitions for connections based on sockets +# + +class SocketListener(object): + ''' + Represtation of a socket which is bound to an address and listening + ''' + def __init__(self, address, family, backlog=1): + self._socket = socket.socket(getattr(socket, family)) + self._socket.bind(address) + self._socket.listen(backlog) + address = self._socket.getsockname() + if type(address) is tuple: + address = (socket.getfqdn(address[0]),) + address[1:] + self._address = address + self._family = family + self._last_accepted = None + + sub_debug('listener bound to address %r', self._address) + + if family == 'AF_UNIX': + self._unlink = Finalize( + self, os.unlink, args=(self._address,), exitpriority=0 + ) + else: + self._unlink = None + + def accept(self): + s, self._last_accepted = self._socket.accept() + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + + def close(self): + self._socket.close() + if self._unlink is not None: + self._unlink() + + +def SocketClient(address): + ''' + Return a connection object connected to the socket given by `address` + ''' + family = address_type(address) + s = socket.socket( getattr(socket, family) ) + + while 1: + try: + s.connect(address) + except socket.error, e: + if e.args[0] != 10061: # 10061 => connection refused + debug('failed to connect to address %s', address) + raise + time.sleep(0.01) + else: + break + else: + raise + + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + +# +# Definitions for connections based on named pipes +# + +if sys.platform == 'win32': + + class PipeListener(object): + ''' + Representation of a named pipe + ''' + def __init__(self, address, backlog=None): + self._address = address + handle = win32.CreateNamedPipe( + address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue = [handle] + self._last_accepted = None + + sub_debug('listener created with address=%r', self._address) + + self.close = Finalize( + self, PipeListener._finalize_pipe_listener, + args=(self._handle_queue, self._address), exitpriority=0 + ) + + def accept(self): + newhandle = win32.CreateNamedPipe( + self._address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue.append(newhandle) + handle = self._handle_queue.pop(0) + try: + win32.ConnectNamedPipe(handle, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + return _multiprocessing.PipeConnection(handle) + + @staticmethod + def _finalize_pipe_listener(queue, address): + sub_debug('closing listener with address=%r', address) + for handle in queue: + close(handle) + + def PipeClient(address): + ''' + Return a connection object connected to the pipe given by `address` + ''' + while 1: + try: + win32.WaitNamedPipe(address, 1000) + h = win32.CreateFile( + address, win32.GENERIC_READ | win32.GENERIC_WRITE, + 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + except WindowsError, e: + if e.args[0] not in (win32.ERROR_SEM_TIMEOUT, + win32.ERROR_PIPE_BUSY): + raise + else: + break + else: + raise + + win32.SetNamedPipeHandleState( + h, win32.PIPE_READMODE_MESSAGE, None, None + ) + return _multiprocessing.PipeConnection(h) + +# +# Authentication stuff +# + +MESSAGE_LENGTH = 20 + +CHALLENGE = '#CHALLENGE#' +WELCOME = '#WELCOME#' +FAILURE = '#FAILURE#' + +if sys.version_info >= (3, 0): # XXX can use bytes literals in 2.6/3.0 + CHALLENGE = CHALLENGE.encode('ascii') + WELCOME = WELCOME.encode('ascii') + FAILURE = FAILURE.encode('ascii') + +def deliver_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = os.urandom(MESSAGE_LENGTH) + connection.send_bytes(CHALLENGE + message) + digest = hmac.new(authkey, message).digest() + response = connection.recv_bytes(256) # reject large message + if response == digest: + connection.send_bytes(WELCOME) + else: + connection.send_bytes(FAILURE) + raise AuthenticationError('digest received was wrong') + +def answer_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = connection.recv_bytes(256) # reject large message + assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message + message = message[len(CHALLENGE):] + digest = hmac.new(authkey, message).digest() + connection.send_bytes(digest) + response = connection.recv_bytes(256) # reject large message + if response != WELCOME: + raise AuthenticationError('digest sent was rejected') + +# +# Support for using xmlrpclib for serialization +# + +class ConnectionWrapper(object): + def __init__(self, conn, dumps, loads): + self._conn = conn + self._dumps = dumps + self._loads = loads + for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): + obj = getattr(conn, attr) + setattr(self, attr, obj) + def send(self, obj): + s = self._dumps(obj) + self._conn.send_bytes(s) + def recv(self): + s = self._conn.recv_bytes() + return self._loads(s) + +def _xml_dumps(obj): + return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') + +def _xml_loads(s): + (obj,), method = xmlrpclib.loads(s.decode('utf8')) + return obj + +class XmlListener(Listener): + def accept(self): + global xmlrpclib + import xmlrpclib + obj = Listener.accept(self) + return ConnectionWrapper(obj, _xml_dumps, _xml_loads) + +def XmlClient(*args, **kwds): + global xmlrpclib + import xmlrpclib + return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) Modified: python/trunk/Lib/multiprocessing/forking.py ============================================================================== --- python/trunk/Lib/multiprocessing/forking.py (original) +++ python/trunk/Lib/multiprocessing/forking.py Fri Jun 13 21:20:48 2008 @@ -1,429 +1,429 @@ -# -# Module for starting a process object using os.fork() or CreateProcess() -# -# multiprocessing/forking.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -import os -import sys -import signal - -from multiprocessing import util, process - -__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close'] - -# -# Check that the current thread is spawning a child process -# - -def assert_spawning(self): - if not Popen.thread_is_spawning(): - raise RuntimeError( - '%s objects should only be shared between processes' - ' through inheritance' % type(self).__name__ - ) - -# -# Unix -# - -if sys.platform != 'win32': - import time - - exit = os._exit - duplicate = os.dup - close = os.close - - # - # We define a Popen class similar to the one from subprocess, but - # whose constructor takes a process object as its argument. - # - - class Popen(object): - - def __init__(self, process_obj): - sys.stdout.flush() - sys.stderr.flush() - self.returncode = None - - self.pid = os.fork() - if self.pid == 0: - if 'random' in sys.modules: - import random - random.seed() - code = process_obj._bootstrap() - sys.stdout.flush() - sys.stderr.flush() - os._exit(code) - - def poll(self, flag=os.WNOHANG): - if self.returncode is None: - pid, sts = os.waitpid(self.pid, flag) - if pid == self.pid: - if os.WIFSIGNALED(sts): - self.returncode = -os.WTERMSIG(sts) - else: - assert os.WIFEXITED(sts) - self.returncode = os.WEXITSTATUS(sts) - return self.returncode - - def wait(self, timeout=None): - if timeout is None: - return self.poll(0) - deadline = time.time() + timeout - delay = 0.0005 - while 1: - res = self.poll() - if res is not None: - break - remaining = deadline - time.time() - if remaining <= 0: - break - delay = min(delay * 2, remaining, 0.05) - time.sleep(delay) - return res - - def terminate(self): - if self.returncode is None: - try: - os.kill(self.pid, signal.SIGTERM) - except OSError, e: - if self.wait(timeout=0.1) is None: - raise - - @staticmethod - def thread_is_spawning(): - return False - -# -# Windows -# - -else: - import thread - import msvcrt - import _subprocess - import copy_reg - import time - - from ._multiprocessing import win32, Connection, PipeConnection - from .util import Finalize - - try: - from cPickle import dump, load, HIGHEST_PROTOCOL - except ImportError: - from pickle import dump, load, HIGHEST_PROTOCOL - - # - # - # - - TERMINATE = 0x10000 - WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) - - exit = win32.ExitProcess - close = win32.CloseHandle - - # - # _python_exe is the assumed path to the python executable. - # People embedding Python want to modify it. - # - - if sys.executable.lower().endswith('pythonservice.exe'): - _python_exe = os.path.join(sys.exec_prefix, 'python.exe') - else: - _python_exe = sys.executable - - def set_executable(exe): - global _python_exe - _python_exe = exe - - # - # - # - - def duplicate(handle, target_process=None, inheritable=False): - if target_process is None: - target_process = _subprocess.GetCurrentProcess() - return _subprocess.DuplicateHandle( - _subprocess.GetCurrentProcess(), handle, target_process, - 0, inheritable, _subprocess.DUPLICATE_SAME_ACCESS - ).Detach() - - # - # We define a Popen class similar to the one from subprocess, but - # whose constructor takes a process object as its argument. - # - - class Popen(object): - ''' - Start a subprocess to run the code of a process object - ''' - _tls = thread._local() - - def __init__(self, process_obj): - # create pipe for communication with child - rfd, wfd = os.pipe() - - # get handle for read end of the pipe and make it inheritable - rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True) - os.close(rfd) - - # start process - cmd = get_command_line() + [rhandle] - cmd = ' '.join('"%s"' % x for x in cmd) - hp, ht, pid, tid = _subprocess.CreateProcess( - _python_exe, cmd, None, None, 1, 0, None, None, None - ) - ht.Close() - close(rhandle) - - # set attributes of self - self.pid = pid - self.returncode = None - self._handle = hp - - # send information to child - prep_data = get_preparation_data(process_obj._name) - to_child = os.fdopen(wfd, 'wb') - Popen._tls.process_handle = int(hp) - try: - dump(prep_data, to_child, HIGHEST_PROTOCOL) - dump(process_obj, to_child, HIGHEST_PROTOCOL) - finally: - del Popen._tls.process_handle - to_child.close() - - @staticmethod - def thread_is_spawning(): - return getattr(Popen._tls, 'process_handle', None) is not None - - @staticmethod - def duplicate_for_child(handle): - return duplicate(handle, Popen._tls.process_handle) - - def wait(self, timeout=None): - if self.returncode is None: - if timeout is None: - msecs = _subprocess.INFINITE - else: - msecs = max(0, int(timeout * 1000 + 0.5)) - - res = _subprocess.WaitForSingleObject(int(self._handle), msecs) - if res == _subprocess.WAIT_OBJECT_0: - code = _subprocess.GetExitCodeProcess(self._handle) - if code == TERMINATE: - code = -signal.SIGTERM - self.returncode = code - - return self.returncode - - def poll(self): - return self.wait(timeout=0) - - def terminate(self): - if self.returncode is None: - try: - _subprocess.TerminateProcess(int(self._handle), TERMINATE) - except WindowsError: - if self.wait(timeout=0.1) is None: - raise - - # - # - # - - def is_forking(argv): - ''' - Return whether commandline indicates we are forking - ''' - if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': - assert len(argv) == 3 - return True - else: - return False - - - def freeze_support(): - ''' - Run code for process object if this in not the main process - ''' - if is_forking(sys.argv): - main() - sys.exit() - - - def get_command_line(): - ''' - Returns prefix of command line used for spawning a child process - ''' - if process.current_process()._identity==() and is_forking(sys.argv): - raise RuntimeError(''' - Attempt to start a new process before the current process - has finished its bootstrapping phase. - - This probably means that you are on Windows and you have - forgotten to use the proper idiom in the main module: - - if __name__ == '__main__': - freeze_support() - ... - - The "freeze_support()" line can be omitted if the program - is not going to be frozen to produce a Windows executable.''') - - if getattr(sys, 'frozen', False): - return [sys.executable, '--multiprocessing-fork'] - else: - prog = 'from multiprocessing.forking import main; main()' - return [_python_exe, '-c', prog, '--multiprocessing-fork'] - - - def main(): - ''' - Run code specifed by data received over pipe - ''' - assert is_forking(sys.argv) - - handle = int(sys.argv[-1]) - fd = msvcrt.open_osfhandle(handle, os.O_RDONLY) - from_parent = os.fdopen(fd, 'rb') - - process.current_process()._inheriting = True - preparation_data = load(from_parent) - prepare(preparation_data) - self = load(from_parent) - process.current_process()._inheriting = False - - from_parent.close() - - exitcode = self._bootstrap() - exit(exitcode) - - - def get_preparation_data(name): - ''' - Return info about parent needed by child to unpickle process object - ''' - from .util import _logger, _log_to_stderr - - d = dict( - name=name, - sys_path=sys.path, - sys_argv=sys.argv, - log_to_stderr=_log_to_stderr, - orig_dir=process.ORIGINAL_DIR, - authkey=process.current_process().get_authkey(), - ) - - if _logger is not None: - d['log_level'] = _logger.getEffectiveLevel() - - if not WINEXE: - main_path = getattr(sys.modules['__main__'], '__file__', None) - if not main_path and sys.argv[0] not in ('', '-c'): - main_path = sys.argv[0] - if main_path is not None: - if not os.path.isabs(main_path) and \ - process.ORIGINAL_DIR is not None: - main_path = os.path.join(process.ORIGINAL_DIR, main_path) - d['main_path'] = os.path.normpath(main_path) - - return d - - # - # Make (Pipe)Connection picklable - # - - def reduce_connection(conn): - if not Popen.thread_is_spawning(): - raise RuntimeError( - 'By default %s objects can only be shared between processes\n' - 'using inheritance' % type(conn).__name__ - ) - return type(conn), (Popen.duplicate_for_child(conn.fileno()), - conn.readable, conn.writable) - - copy_reg.pickle(Connection, reduce_connection) - copy_reg.pickle(PipeConnection, reduce_connection) - - -# -# Prepare current process -# - -old_main_modules = [] - -def prepare(data): - ''' - Try to get current process ready to unpickle process object - ''' - old_main_modules.append(sys.modules['__main__']) - - if 'name' in data: - process.current_process().set_name(data['name']) - - if 'authkey' in data: - process.current_process()._authkey = data['authkey'] - - if 'log_to_stderr' in data and data['log_to_stderr']: - util.log_to_stderr() - - if 'log_level' in data: - util.get_logger().setLevel(data['log_level']) - - if 'sys_path' in data: - sys.path = data['sys_path'] - - if 'sys_argv' in data: - sys.argv = data['sys_argv'] - - if 'dir' in data: - os.chdir(data['dir']) - - if 'orig_dir' in data: - process.ORIGINAL_DIR = data['orig_dir'] - - if 'main_path' in data: - main_path = data['main_path'] - main_name = os.path.splitext(os.path.basename(main_path))[0] - if main_name == '__init__': - main_name = os.path.basename(os.path.dirname(main_path)) - - if main_name != 'ipython': - import imp - - if main_path is None: - dirs = None - elif os.path.basename(main_path).startswith('__init__.py'): - dirs = [os.path.dirname(os.path.dirname(main_path))] - else: - dirs = [os.path.dirname(main_path)] - - assert main_name not in sys.modules, main_name - file, path_name, etc = imp.find_module(main_name, dirs) - try: - # We would like to do "imp.load_module('__main__', ...)" - # here. However, that would cause 'if __name__ == - # "__main__"' clauses to be executed. - main_module = imp.load_module( - '__parents_main__', file, path_name, etc - ) - finally: - if file: - file.close() - - sys.modules['__main__'] = main_module - main_module.__name__ = '__main__' - - # Try to make the potentially picklable objects in - # sys.modules['__main__'] realize they are in the main - # module -- somewhat ugly. - for obj in main_module.__dict__.values(): - try: - if obj.__module__ == '__parents_main__': - obj.__module__ = '__main__' - except Exception: - pass +# +# Module for starting a process object using os.fork() or CreateProcess() +# +# multiprocessing/forking.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import os +import sys +import signal + +from multiprocessing import util, process + +__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close'] + +# +# Check that the current thread is spawning a child process +# + +def assert_spawning(self): + if not Popen.thread_is_spawning(): + raise RuntimeError( + '%s objects should only be shared between processes' + ' through inheritance' % type(self).__name__ + ) + +# +# Unix +# + +if sys.platform != 'win32': + import time + + exit = os._exit + duplicate = os.dup + close = os.close + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + + def __init__(self, process_obj): + sys.stdout.flush() + sys.stderr.flush() + self.returncode = None + + self.pid = os.fork() + if self.pid == 0: + if 'random' in sys.modules: + import random + random.seed() + code = process_obj._bootstrap() + sys.stdout.flush() + sys.stderr.flush() + os._exit(code) + + def poll(self, flag=os.WNOHANG): + if self.returncode is None: + pid, sts = os.waitpid(self.pid, flag) + if pid == self.pid: + if os.WIFSIGNALED(sts): + self.returncode = -os.WTERMSIG(sts) + else: + assert os.WIFEXITED(sts) + self.returncode = os.WEXITSTATUS(sts) + return self.returncode + + def wait(self, timeout=None): + if timeout is None: + return self.poll(0) + deadline = time.time() + timeout + delay = 0.0005 + while 1: + res = self.poll() + if res is not None: + break + remaining = deadline - time.time() + if remaining <= 0: + break + delay = min(delay * 2, remaining, 0.05) + time.sleep(delay) + return res + + def terminate(self): + if self.returncode is None: + try: + os.kill(self.pid, signal.SIGTERM) + except OSError, e: + if self.wait(timeout=0.1) is None: + raise + + @staticmethod + def thread_is_spawning(): + return False + +# +# Windows +# + +else: + import thread + import msvcrt + import _subprocess + import copy_reg + import time + + from ._multiprocessing import win32, Connection, PipeConnection + from .util import Finalize + + try: + from cPickle import dump, load, HIGHEST_PROTOCOL + except ImportError: + from pickle import dump, load, HIGHEST_PROTOCOL + + # + # + # + + TERMINATE = 0x10000 + WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) + + exit = win32.ExitProcess + close = win32.CloseHandle + + # + # _python_exe is the assumed path to the python executable. + # People embedding Python want to modify it. + # + + if sys.executable.lower().endswith('pythonservice.exe'): + _python_exe = os.path.join(sys.exec_prefix, 'python.exe') + else: + _python_exe = sys.executable + + def set_executable(exe): + global _python_exe + _python_exe = exe + + # + # + # + + def duplicate(handle, target_process=None, inheritable=False): + if target_process is None: + target_process = _subprocess.GetCurrentProcess() + return _subprocess.DuplicateHandle( + _subprocess.GetCurrentProcess(), handle, target_process, + 0, inheritable, _subprocess.DUPLICATE_SAME_ACCESS + ).Detach() + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + ''' + Start a subprocess to run the code of a process object + ''' + _tls = thread._local() + + def __init__(self, process_obj): + # create pipe for communication with child + rfd, wfd = os.pipe() + + # get handle for read end of the pipe and make it inheritable + rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True) + os.close(rfd) + + # start process + cmd = get_command_line() + [rhandle] + cmd = ' '.join('"%s"' % x for x in cmd) + hp, ht, pid, tid = _subprocess.CreateProcess( + _python_exe, cmd, None, None, 1, 0, None, None, None + ) + ht.Close() + close(rhandle) + + # set attributes of self + self.pid = pid + self.returncode = None + self._handle = hp + + # send information to child + prep_data = get_preparation_data(process_obj._name) + to_child = os.fdopen(wfd, 'wb') + Popen._tls.process_handle = int(hp) + try: + dump(prep_data, to_child, HIGHEST_PROTOCOL) + dump(process_obj, to_child, HIGHEST_PROTOCOL) + finally: + del Popen._tls.process_handle + to_child.close() + + @staticmethod + def thread_is_spawning(): + return getattr(Popen._tls, 'process_handle', None) is not None + + @staticmethod + def duplicate_for_child(handle): + return duplicate(handle, Popen._tls.process_handle) + + def wait(self, timeout=None): + if self.returncode is None: + if timeout is None: + msecs = _subprocess.INFINITE + else: + msecs = max(0, int(timeout * 1000 + 0.5)) + + res = _subprocess.WaitForSingleObject(int(self._handle), msecs) + if res == _subprocess.WAIT_OBJECT_0: + code = _subprocess.GetExitCodeProcess(self._handle) + if code == TERMINATE: + code = -signal.SIGTERM + self.returncode = code + + return self.returncode + + def poll(self): + return self.wait(timeout=0) + + def terminate(self): + if self.returncode is None: + try: + _subprocess.TerminateProcess(int(self._handle), TERMINATE) + except WindowsError: + if self.wait(timeout=0.1) is None: + raise + + # + # + # + + def is_forking(argv): + ''' + Return whether commandline indicates we are forking + ''' + if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': + assert len(argv) == 3 + return True + else: + return False + + + def freeze_support(): + ''' + Run code for process object if this in not the main process + ''' + if is_forking(sys.argv): + main() + sys.exit() + + + def get_command_line(): + ''' + Returns prefix of command line used for spawning a child process + ''' + if process.current_process()._identity==() and is_forking(sys.argv): + raise RuntimeError(''' + Attempt to start a new process before the current process + has finished its bootstrapping phase. + + This probably means that you are on Windows and you have + forgotten to use the proper idiom in the main module: + + if __name__ == '__main__': + freeze_support() + ... + + The "freeze_support()" line can be omitted if the program + is not going to be frozen to produce a Windows executable.''') + + if getattr(sys, 'frozen', False): + return [sys.executable, '--multiprocessing-fork'] + else: + prog = 'from multiprocessing.forking import main; main()' + return [_python_exe, '-c', prog, '--multiprocessing-fork'] + + + def main(): + ''' + Run code specifed by data received over pipe + ''' + assert is_forking(sys.argv) + + handle = int(sys.argv[-1]) + fd = msvcrt.open_osfhandle(handle, os.O_RDONLY) + from_parent = os.fdopen(fd, 'rb') + + process.current_process()._inheriting = True + preparation_data = load(from_parent) + prepare(preparation_data) + self = load(from_parent) + process.current_process()._inheriting = False + + from_parent.close() + + exitcode = self._bootstrap() + exit(exitcode) + + + def get_preparation_data(name): + ''' + Return info about parent needed by child to unpickle process object + ''' + from .util import _logger, _log_to_stderr + + d = dict( + name=name, + sys_path=sys.path, + sys_argv=sys.argv, + log_to_stderr=_log_to_stderr, + orig_dir=process.ORIGINAL_DIR, + authkey=process.current_process().get_authkey(), + ) + + if _logger is not None: + d['log_level'] = _logger.getEffectiveLevel() + + if not WINEXE: + main_path = getattr(sys.modules['__main__'], '__file__', None) + if not main_path and sys.argv[0] not in ('', '-c'): + main_path = sys.argv[0] + if main_path is not None: + if not os.path.isabs(main_path) and \ + process.ORIGINAL_DIR is not None: + main_path = os.path.join(process.ORIGINAL_DIR, main_path) + d['main_path'] = os.path.normpath(main_path) + + return d + + # + # Make (Pipe)Connection picklable + # + + def reduce_connection(conn): + if not Popen.thread_is_spawning(): + raise RuntimeError( + 'By default %s objects can only be shared between processes\n' + 'using inheritance' % type(conn).__name__ + ) + return type(conn), (Popen.duplicate_for_child(conn.fileno()), + conn.readable, conn.writable) + + copy_reg.pickle(Connection, reduce_connection) + copy_reg.pickle(PipeConnection, reduce_connection) + + +# +# Prepare current process +# + +old_main_modules = [] + +def prepare(data): + ''' + Try to get current process ready to unpickle process object + ''' + old_main_modules.append(sys.modules['__main__']) + + if 'name' in data: + process.current_process().set_name(data['name']) + + if 'authkey' in data: + process.current_process()._authkey = data['authkey'] + + if 'log_to_stderr' in data and data['log_to_stderr']: + util.log_to_stderr() + + if 'log_level' in data: + util.get_logger().setLevel(data['log_level']) + + if 'sys_path' in data: + sys.path = data['sys_path'] + + if 'sys_argv' in data: + sys.argv = data['sys_argv'] + + if 'dir' in data: + os.chdir(data['dir']) + + if 'orig_dir' in data: + process.ORIGINAL_DIR = data['orig_dir'] + + if 'main_path' in data: + main_path = data['main_path'] + main_name = os.path.splitext(os.path.basename(main_path))[0] + if main_name == '__init__': + main_name = os.path.basename(os.path.dirname(main_path)) + + if main_name != 'ipython': + import imp + + if main_path is None: + dirs = None + elif os.path.basename(main_path).startswith('__init__.py'): + dirs = [os.path.dirname(os.path.dirname(main_path))] + else: + dirs = [os.path.dirname(main_path)] + + assert main_name not in sys.modules, main_name + file, path_name, etc = imp.find_module(main_name, dirs) + try: + # We would like to do "imp.load_module('__main__', ...)" + # here. However, that would cause 'if __name__ == + # "__main__"' clauses to be executed. + main_module = imp.load_module( + '__parents_main__', file, path_name, etc + ) + finally: + if file: + file.close() + + sys.modules['__main__'] = main_module + main_module.__name__ = '__main__' + + # Try to make the potentially picklable objects in + # sys.modules['__main__'] realize they are in the main + # module -- somewhat ugly. + for obj in main_module.__dict__.values(): + try: + if obj.__module__ == '__parents_main__': + obj.__module__ = '__main__' + except Exception: + pass Modified: python/trunk/Lib/multiprocessing/heap.py ============================================================================== --- python/trunk/Lib/multiprocessing/heap.py (original) +++ python/trunk/Lib/multiprocessing/heap.py Fri Jun 13 21:20:48 2008 @@ -1,201 +1,201 @@ -# -# Module which supports allocation of memory from an mmap -# -# multiprocessing/heap.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -import bisect -import mmap -import tempfile -import os -import sys -import threading -import itertools - -import _multiprocessing -from multiprocessing.util import Finalize, info -from multiprocessing.forking import assert_spawning - -__all__ = ['BufferWrapper'] - -# -# Inheirtable class which wraps an mmap, and from which blocks can be allocated -# - -if sys.platform == 'win32': - - from ._multiprocessing import win32 - - class Arena(object): - - _counter = itertools.count() - - def __init__(self, size): - self.size = size - self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) - self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == 0, 'tagname already in use' - self._state = (self.size, self.name) - - def __getstate__(self): - assert_spawning(self) - return self._state - - def __setstate__(self, state): - self.size, self.name = self._state = state - self.buffer = mmap.mmap(-1, self.size, tagname=self.name) - assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS - -else: - - class Arena(object): - - def __init__(self, size): - self.buffer = mmap.mmap(-1, size) - self.size = size - self.name = None - -# -# Class allowing allocation of chunks of memory from arenas -# - -class Heap(object): - - _alignment = 8 - - def __init__(self, size=mmap.PAGESIZE): - self._lastpid = os.getpid() - self._lock = threading.Lock() - self._size = size - self._lengths = [] - self._len_to_seq = {} - self._start_to_block = {} - self._stop_to_block = {} - self._allocated_blocks = set() - self._arenas = [] - - @staticmethod - def _roundup(n, alignment): - # alignment must be a power of 2 - mask = alignment - 1 - return (n + mask) & ~mask - - def _malloc(self, size): - # returns a large enough block -- it might be much larger - i = bisect.bisect_left(self._lengths, size) - if i == len(self._lengths): - length = self._roundup(max(self._size, size), mmap.PAGESIZE) - self._size *= 2 - info('allocating a new mmap of length %d', length) - arena = Arena(length) - self._arenas.append(arena) - return (arena, 0, length) - else: - length = self._lengths[i] - seq = self._len_to_seq[length] - block = seq.pop() - if not seq: - del self._len_to_seq[length], self._lengths[i] - - (arena, start, stop) = block - del self._start_to_block[(arena, start)] - del self._stop_to_block[(arena, stop)] - return block - - def _free(self, block): - # free location and try to merge with neighbours - (arena, start, stop) = block - - try: - prev_block = self._stop_to_block[(arena, start)] - except KeyError: - pass - else: - start, _ = self._absorb(prev_block) - - try: - next_block = self._start_to_block[(arena, stop)] - except KeyError: - pass - else: - _, stop = self._absorb(next_block) - - block = (arena, start, stop) - length = stop - start - - try: - self._len_to_seq[length].append(block) - except KeyError: - self._len_to_seq[length] = [block] - bisect.insort(self._lengths, length) - - self._start_to_block[(arena, start)] = block - self._stop_to_block[(arena, stop)] = block - - def _absorb(self, block): - # deregister this block so it can be merged with a neighbour - (arena, start, stop) = block - del self._start_to_block[(arena, start)] - del self._stop_to_block[(arena, stop)] - - length = stop - start - seq = self._len_to_seq[length] - seq.remove(block) - if not seq: - del self._len_to_seq[length] - self._lengths.remove(length) - - return start, stop - - def free(self, block): - # free a block returned by malloc() - assert os.getpid() == self._lastpid - self._lock.acquire() - try: - self._allocated_blocks.remove(block) - self._free(block) - finally: - self._lock.release() - - def malloc(self, size): - # return a block of right size (possibly rounded up) - assert 0 <= size < sys.maxint - if os.getpid() != self._lastpid: - self.__init__() # reinitialize after fork - self._lock.acquire() - try: - size = self._roundup(max(size,1), self._alignment) - (arena, start, stop) = self._malloc(size) - new_stop = start + size - if new_stop < stop: - self._free((arena, new_stop, stop)) - block = (arena, start, new_stop) - self._allocated_blocks.add(block) - return block - finally: - self._lock.release() - -# -# Class representing a chunk of an mmap -- can be inherited -# - -class BufferWrapper(object): - - _heap = Heap() - - def __init__(self, size): - assert 0 <= size < sys.maxint - block = BufferWrapper._heap.malloc(size) - self._state = (block, size) - Finalize(self, BufferWrapper._heap.free, args=(block,)) - - def get_address(self): - (arena, start, stop), size = self._state - address, length = _multiprocessing.address_of_buffer(arena.buffer) - assert size <= length - return address + start - - def get_size(self): - return self._state[1] +# +# Module which supports allocation of memory from an mmap +# +# multiprocessing/heap.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import bisect +import mmap +import tempfile +import os +import sys +import threading +import itertools + +import _multiprocessing +from multiprocessing.util import Finalize, info +from multiprocessing.forking import assert_spawning + +__all__ = ['BufferWrapper'] + +# +# Inheirtable class which wraps an mmap, and from which blocks can be allocated +# + +if sys.platform == 'win32': + + from ._multiprocessing import win32 + + class Arena(object): + + _counter = itertools.count() + + def __init__(self, size): + self.size = size + self.name = 'pym-%d-%d' % (os.getpid(), Arena._counter.next()) + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == 0, 'tagname already in use' + self._state = (self.size, self.name) + + def __getstate__(self): + assert_spawning(self) + return self._state + + def __setstate__(self, state): + self.size, self.name = self._state = state + self.buffer = mmap.mmap(-1, self.size, tagname=self.name) + assert win32.GetLastError() == win32.ERROR_ALREADY_EXISTS + +else: + + class Arena(object): + + def __init__(self, size): + self.buffer = mmap.mmap(-1, size) + self.size = size + self.name = None + +# +# Class allowing allocation of chunks of memory from arenas +# + +class Heap(object): + + _alignment = 8 + + def __init__(self, size=mmap.PAGESIZE): + self._lastpid = os.getpid() + self._lock = threading.Lock() + self._size = size + self._lengths = [] + self._len_to_seq = {} + self._start_to_block = {} + self._stop_to_block = {} + self._allocated_blocks = set() + self._arenas = [] + + @staticmethod + def _roundup(n, alignment): + # alignment must be a power of 2 + mask = alignment - 1 + return (n + mask) & ~mask + + def _malloc(self, size): + # returns a large enough block -- it might be much larger + i = bisect.bisect_left(self._lengths, size) + if i == len(self._lengths): + length = self._roundup(max(self._size, size), mmap.PAGESIZE) + self._size *= 2 + info('allocating a new mmap of length %d', length) + arena = Arena(length) + self._arenas.append(arena) + return (arena, 0, length) + else: + length = self._lengths[i] + seq = self._len_to_seq[length] + block = seq.pop() + if not seq: + del self._len_to_seq[length], self._lengths[i] + + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + return block + + def _free(self, block): + # free location and try to merge with neighbours + (arena, start, stop) = block + + try: + prev_block = self._stop_to_block[(arena, start)] + except KeyError: + pass + else: + start, _ = self._absorb(prev_block) + + try: + next_block = self._start_to_block[(arena, stop)] + except KeyError: + pass + else: + _, stop = self._absorb(next_block) + + block = (arena, start, stop) + length = stop - start + + try: + self._len_to_seq[length].append(block) + except KeyError: + self._len_to_seq[length] = [block] + bisect.insort(self._lengths, length) + + self._start_to_block[(arena, start)] = block + self._stop_to_block[(arena, stop)] = block + + def _absorb(self, block): + # deregister this block so it can be merged with a neighbour + (arena, start, stop) = block + del self._start_to_block[(arena, start)] + del self._stop_to_block[(arena, stop)] + + length = stop - start + seq = self._len_to_seq[length] + seq.remove(block) + if not seq: + del self._len_to_seq[length] + self._lengths.remove(length) + + return start, stop + + def free(self, block): + # free a block returned by malloc() + assert os.getpid() == self._lastpid + self._lock.acquire() + try: + self._allocated_blocks.remove(block) + self._free(block) + finally: + self._lock.release() + + def malloc(self, size): + # return a block of right size (possibly rounded up) + assert 0 <= size < sys.maxint + if os.getpid() != self._lastpid: + self.__init__() # reinitialize after fork + self._lock.acquire() + try: + size = self._roundup(max(size,1), self._alignment) + (arena, start, stop) = self._malloc(size) + new_stop = start + size + if new_stop < stop: + self._free((arena, new_stop, stop)) + block = (arena, start, new_stop) + self._allocated_blocks.add(block) + return block + finally: + self._lock.release() + +# +# Class representing a chunk of an mmap -- can be inherited +# + +class BufferWrapper(object): + + _heap = Heap() + + def __init__(self, size): + assert 0 <= size < sys.maxint + block = BufferWrapper._heap.malloc(size) + self._state = (block, size) + Finalize(self, BufferWrapper._heap.free, args=(block,)) + + def get_address(self): + (arena, start, stop), size = self._state + address, length = _multiprocessing.address_of_buffer(arena.buffer) + assert size <= length + return address + start + + def get_size(self): + return self._state[1] Modified: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- python/trunk/Lib/multiprocessing/managers.py (original) +++ python/trunk/Lib/multiprocessing/managers.py Fri Jun 13 21:20:48 2008 @@ -1,1092 +1,1092 @@ -# -# Module providing the `SyncManager` class for dealing -# with shared objects -# -# multiprocessing/managers.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] - -# -# Imports -# - -import os -import sys -import weakref -import threading -import array -import copy_reg -import Queue - -from traceback import format_exc -from multiprocessing import Process, current_process, active_children, Pool, util, connection -from multiprocessing.process import AuthenticationString -from multiprocessing.forking import exit, Popen, assert_spawning -from multiprocessing.util import Finalize, info - -try: - from cPickle import PicklingError -except ImportError: - from pickle import PicklingError - -# -# -# - -try: - bytes -except NameError: - bytes = str # XXX not needed in Py2.6 and Py3.0 - -# -# Register some things for pickling -# - -def reduce_array(a): - return array.array, (a.typecode, a.tostring()) -copy_reg.pickle(array.array, reduce_array) - -view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] -if view_types[0] is not list: # XXX only needed in Py3.0 - def rebuild_as_list(obj): - return list, (list(obj),) - for view_type in view_types: - copy_reg.pickle(view_type, rebuild_as_list) - -# -# Type for identifying shared objects -# - -class Token(object): - ''' - Type to uniquely indentify a shared object - ''' - __slots__ = ('typeid', 'address', 'id') - - def __init__(self, typeid, address, id): - (self.typeid, self.address, self.id) = (typeid, address, id) - - def __getstate__(self): - return (self.typeid, self.address, self.id) - - def __setstate__(self, state): - (self.typeid, self.address, self.id) = state - - def __repr__(self): - return 'Token(typeid=%r, address=%r, id=%r)' % \ - (self.typeid, self.address, self.id) - -# -# Function for communication with a manager's server process -# - -def dispatch(c, id, methodname, args=(), kwds={}): - ''' - Send a message to manager using connection `c` and return response - ''' - c.send((id, methodname, args, kwds)) - kind, result = c.recv() - if kind == '#RETURN': - return result - raise convert_to_error(kind, result) - -def convert_to_error(kind, result): - if kind == '#ERROR': - return result - elif kind == '#TRACEBACK': - assert type(result) is str - return RemoteError(result) - elif kind == '#UNSERIALIZABLE': - assert type(result) is str - return RemoteError('Unserializable message: %s\n' % result) - else: - return ValueError('Unrecognized message type') - -class RemoteError(Exception): - def __str__(self): - return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) - -# -# Functions for finding the method names of an object -# - -def all_methods(obj): - ''' - Return a list of names of methods of `obj` - ''' - temp = [] - for name in dir(obj): - func = getattr(obj, name) - if hasattr(func, '__call__'): - temp.append(name) - return temp - -def public_methods(obj): - ''' - Return a list of names of methods of `obj` which do not start with '_' - ''' - return [name for name in all_methods(obj) if name[0] != '_'] - -# -# Server which is run in a process controlled by a manager -# - -class Server(object): - ''' - Server class which runs in a process controlled by a manager object - ''' - public = ['shutdown', 'create', 'accept_connection', 'get_methods', - 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] - - def __init__(self, registry, address, authkey, serializer): - assert isinstance(authkey, bytes) - self.registry = registry - self.authkey = AuthenticationString(authkey) - Listener, Client = listener_client[serializer] - - # do authentication later - self.listener = Listener(address=address, backlog=5) - self.address = self.listener.address - - self.id_to_obj = {0: (None, ())} - self.id_to_refcount = {} - self.mutex = threading.RLock() - self.stop = 0 - - def serve_forever(self): - ''' - Run the server forever - ''' - current_process()._manager_server = self - try: - try: - while 1: - try: - c = self.listener.accept() - except (OSError, IOError): - continue - t = threading.Thread(target=self.handle_request, args=(c,)) - t.set_daemon(True) - t.start() - except (KeyboardInterrupt, SystemExit): - pass - finally: - self.stop = 999 - self.listener.close() - - def handle_request(self, c): - ''' - Handle a new connection - ''' - funcname = result = request = None - try: - connection.deliver_challenge(c, self.authkey) - connection.answer_challenge(c, self.authkey) - request = c.recv() - ignore, funcname, args, kwds = request - assert funcname in self.public, '%r unrecognized' % funcname - func = getattr(self, funcname) - except Exception: - msg = ('#TRACEBACK', format_exc()) - else: - try: - result = func(c, *args, **kwds) - except Exception: - msg = ('#TRACEBACK', format_exc()) - else: - msg = ('#RETURN', result) - try: - c.send(msg) - except Exception, e: - try: - c.send(('#TRACEBACK', format_exc())) - except Exception: - pass - util.info('Failure to send message: %r', msg) - util.info(' ... request was %r', request) - util.info(' ... exception was %r', e) - - c.close() - - def serve_client(self, conn): - ''' - Handle requests from the proxies in a particular process/thread - ''' - util.debug('starting server thread to service %r', - threading.current_thread().get_name()) - - recv = conn.recv - send = conn.send - id_to_obj = self.id_to_obj - - while not self.stop: - - try: - methodname = obj = None - request = recv() - ident, methodname, args, kwds = request - obj, exposed, gettypeid = id_to_obj[ident] - - if methodname not in exposed: - raise AttributeError( - 'method %r of %r object is not in exposed=%r' % - (methodname, type(obj), exposed) - ) - - function = getattr(obj, methodname) - - try: - res = function(*args, **kwds) - except Exception, e: - msg = ('#ERROR', e) - else: - typeid = gettypeid and gettypeid.get(methodname, None) - if typeid: - rident, rexposed = self.create(conn, typeid, res) - token = Token(typeid, self.address, rident) - msg = ('#PROXY', (rexposed, token)) - else: - msg = ('#RETURN', res) - - except AttributeError: - if methodname is None: - msg = ('#TRACEBACK', format_exc()) - else: - try: - fallback_func = self.fallback_mapping[methodname] - result = fallback_func( - self, conn, ident, obj, *args, **kwds - ) - msg = ('#RETURN', result) - except Exception: - msg = ('#TRACEBACK', format_exc()) - - except EOFError: - util.debug('got EOF -- exiting thread serving %r', - threading.current_thread().get_name()) - sys.exit(0) - - except Exception: - msg = ('#TRACEBACK', format_exc()) - - try: - try: - send(msg) - except Exception, e: - send(('#UNSERIALIZABLE', repr(msg))) - except Exception, e: - util.info('exception in thread serving %r', - threading.current_thread().get_name()) - util.info(' ... message was %r', msg) - util.info(' ... exception was %r', e) - conn.close() - sys.exit(1) - - def fallback_getvalue(self, conn, ident, obj): - return obj - - def fallback_str(self, conn, ident, obj): - return str(obj) - - def fallback_repr(self, conn, ident, obj): - return repr(obj) - - fallback_mapping = { - '__str__':fallback_str, - '__repr__':fallback_repr, - '#GETVALUE':fallback_getvalue - } - - def dummy(self, c): - pass - - def debug_info(self, c): - ''' - Return some info --- useful to spot problems with refcounting - ''' - self.mutex.acquire() - try: - result = [] - keys = self.id_to_obj.keys() - keys.sort() - for ident in keys: - if ident != 0: - result.append(' %s: refcount=%s\n %s' % - (ident, self.id_to_refcount[ident], - str(self.id_to_obj[ident][0])[:75])) - return '\n'.join(result) - finally: - self.mutex.release() - - def number_of_objects(self, c): - ''' - Number of shared objects - ''' - return len(self.id_to_obj) - 1 # don't count ident=0 - - def shutdown(self, c): - ''' - Shutdown this process - ''' - try: - try: - util.debug('manager received shutdown message') - c.send(('#RETURN', None)) - - if sys.stdout != sys.__stdout__: - util.debug('resetting stdout, stderr') - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - - util._run_finalizers(0) - - for p in active_children(): - util.debug('terminating a child process of manager') - p.terminate() - - for p in active_children(): - util.debug('terminating a child process of manager') - p.join() - - util._run_finalizers() - util.info('manager exiting with exitcode 0') - except: - import traceback - traceback.print_exc() - finally: - exit(0) - - def create(self, c, typeid, *args, **kwds): - ''' - Create a new shared object and return its id - ''' - self.mutex.acquire() - try: - callable, exposed, method_to_typeid, proxytype = \ - self.registry[typeid] - - if callable is None: - assert len(args) == 1 and not kwds - obj = args[0] - else: - obj = callable(*args, **kwds) - - if exposed is None: - exposed = public_methods(obj) - if method_to_typeid is not None: - assert type(method_to_typeid) is dict - exposed = list(exposed) + list(method_to_typeid) - - ident = '%x' % id(obj) # convert to string because xmlrpclib - # only has 32 bit signed integers - util.debug('%r callable returned object with id %r', typeid, ident) - - self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) - if ident not in self.id_to_refcount: - self.id_to_refcount[ident] = None - return ident, tuple(exposed) - finally: - self.mutex.release() - - def get_methods(self, c, token): - ''' - Return the methods of the shared object indicated by token - ''' - return tuple(self.id_to_obj[token.id][1]) - - def accept_connection(self, c, name): - ''' - Spawn a new thread to serve this connection - ''' - threading.current_thread().set_name(name) - c.send(('#RETURN', None)) - self.serve_client(c) - - def incref(self, c, ident): - self.mutex.acquire() - try: - try: - self.id_to_refcount[ident] += 1 - except TypeError: - assert self.id_to_refcount[ident] is None - self.id_to_refcount[ident] = 1 - finally: - self.mutex.release() - - def decref(self, c, ident): - self.mutex.acquire() - try: - assert self.id_to_refcount[ident] >= 1 - self.id_to_refcount[ident] -= 1 - if self.id_to_refcount[ident] == 0: - del self.id_to_obj[ident], self.id_to_refcount[ident] - util.debug('disposing of obj with id %d', ident) - finally: - self.mutex.release() - -# -# Class to represent state of a manager -# - -class State(object): - __slots__ = ['value'] - INITIAL = 0 - STARTED = 1 - SHUTDOWN = 2 - -# -# Mapping from serializer name to Listener and Client types -# - -listener_client = { - 'pickle' : (connection.Listener, connection.Client), - 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) - } - -# -# Definition of BaseManager -# - -class BaseManager(object): - ''' - Base class for managers - ''' - _registry = {} - _Server = Server - - def __init__(self, address=None, authkey=None, serializer='pickle'): - if authkey is None: - authkey = current_process().get_authkey() - self._address = address # XXX not final address if eg ('', 0) - self._authkey = AuthenticationString(authkey) - self._state = State() - self._state.value = State.INITIAL - self._serializer = serializer - self._Listener, self._Client = listener_client[serializer] - - def __reduce__(self): - return type(self).from_address, \ - (self._address, self._authkey, self._serializer) - - def get_server(self): - ''' - Return server object with serve_forever() method and address attribute - ''' - assert self._state.value == State.INITIAL - return Server(self._registry, self._address, - self._authkey, self._serializer) - - def connect(self): - ''' - Connect manager object to the server process - ''' - Listener, Client = listener_client[self._serializer] - conn = Client(self._address, authkey=self._authkey) - dispatch(conn, None, 'dummy') - self._state.value = State.STARTED - - def start(self): - ''' - Spawn a server process for this manager object - ''' - assert self._state.value == State.INITIAL - - # pipe over which we will retrieve address of server - reader, writer = connection.Pipe(duplex=False) - - # spawn process which runs a server - self._process = Process( - target=type(self)._run_server, - args=(self._registry, self._address, self._authkey, - self._serializer, writer), - ) - ident = ':'.join(str(i) for i in self._process._identity) - self._process.set_name(type(self).__name__ + '-' + ident) - self._process.start() - - # get address of server - writer.close() - self._address = reader.recv() - reader.close() - - # register a finalizer - self._state.value = State.STARTED - self.shutdown = util.Finalize( - self, type(self)._finalize_manager, - args=(self._process, self._address, self._authkey, - self._state, self._Client), - exitpriority=0 - ) - - @classmethod - def _run_server(cls, registry, address, authkey, serializer, writer): - ''' - Create a server, report its address and run it - ''' - # create server - server = cls._Server(registry, address, authkey, serializer) - - # inform parent process of the server's address - writer.send(server.address) - writer.close() - - # run the manager - util.info('manager serving at %r', server.address) - server.serve_forever() - - def _create(self, typeid, *args, **kwds): - ''' - Create a new shared object; return the token and exposed tuple - ''' - assert self._state.value == State.STARTED, 'server not yet started' - conn = self._Client(self._address, authkey=self._authkey) - try: - id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) - finally: - conn.close() - return Token(typeid, self._address, id), exposed - - def join(self, timeout=None): - ''' - Join the manager process (if it has been spawned) - ''' - self._process.join(timeout) - - def _debug_info(self): - ''' - Return some info about the servers shared objects and connections - ''' - conn = self._Client(self._address, authkey=self._authkey) - try: - return dispatch(conn, None, 'debug_info') - finally: - conn.close() - - def _number_of_objects(self): - ''' - Return the number of shared objects - ''' - conn = self._Client(self._address, authkey=self._authkey) - try: - return dispatch(conn, None, 'number_of_objects') - finally: - conn.close() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.shutdown() - - @staticmethod - def _finalize_manager(process, address, authkey, state, _Client): - ''' - Shutdown the manager process; will be registered as a finalizer - ''' - if process.is_alive(): - util.info('sending shutdown message to manager') - try: - conn = _Client(address, authkey=authkey) - try: - dispatch(conn, None, 'shutdown') - finally: - conn.close() - except Exception: - pass - - process.join(timeout=0.2) - if process.is_alive(): - util.info('manager still alive') - if hasattr(process, 'terminate'): - util.info('trying to `terminate()` manager process') - process.terminate() - process.join(timeout=0.1) - if process.is_alive(): - util.info('manager still alive after terminate') - - state.value = State.SHUTDOWN - try: - del BaseProxy._address_to_local[address] - except KeyError: - pass - - address = property(lambda self: self._address) - - @classmethod - def register(cls, typeid, callable=None, proxytype=None, exposed=None, - method_to_typeid=None, create_method=True): - ''' - Register a typeid with the manager type - ''' - if '_registry' not in cls.__dict__: - cls._registry = cls._registry.copy() - - if proxytype is None: - proxytype = AutoProxy - - exposed = exposed or getattr(proxytype, '_exposed_', None) - - method_to_typeid = method_to_typeid or \ - getattr(proxytype, '_method_to_typeid_', None) - - if method_to_typeid: - for key, value in method_to_typeid.items(): - assert type(key) is str, '%r is not a string' % key - assert type(value) is str, '%r is not a string' % value - - cls._registry[typeid] = ( - callable, exposed, method_to_typeid, proxytype - ) - - if create_method: - def temp(self, *args, **kwds): - util.debug('requesting creation of a shared %r object', typeid) - token, exp = self._create(typeid, *args, **kwds) - proxy = proxytype( - token, self._serializer, manager=self, - authkey=self._authkey, exposed=exp - ) - return proxy - temp.__name__ = typeid - setattr(cls, typeid, temp) - -# -# Subclass of set which get cleared after a fork -# - -class ProcessLocalSet(set): - def __init__(self): - util.register_after_fork(self, lambda obj: obj.clear()) - def __reduce__(self): - return type(self), () - -# -# Definition of BaseProxy -# - -class BaseProxy(object): - ''' - A base for proxies of shared objects - ''' - _address_to_local = {} - _mutex = util.ForkAwareThreadLock() - - def __init__(self, token, serializer, manager=None, - authkey=None, exposed=None, incref=True): - BaseProxy._mutex.acquire() - try: - tls_idset = BaseProxy._address_to_local.get(token.address, None) - if tls_idset is None: - tls_idset = util.ForkAwareLocal(), ProcessLocalSet() - BaseProxy._address_to_local[token.address] = tls_idset - finally: - BaseProxy._mutex.release() - - # self._tls is used to record the connection used by this - # thread to communicate with the manager at token.address - self._tls = tls_idset[0] - - # self._idset is used to record the identities of all shared - # objects for which the current process owns references and - # which are in the manager at token.address - self._idset = tls_idset[1] - - self._token = token - self._id = self._token.id - self._manager = manager - self._serializer = serializer - self._Client = listener_client[serializer][1] - - if authkey is not None: - self._authkey = AuthenticationString(authkey) - elif self._manager is not None: - self._authkey = self._manager._authkey - else: - self._authkey = current_process().get_authkey() - - if incref: - self._incref() - - util.register_after_fork(self, BaseProxy._after_fork) - - def _connect(self): - util.debug('making connection to manager') - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - conn = self._Client(self._token.address, authkey=self._authkey) - dispatch(conn, None, 'accept_connection', (name,)) - self._tls.connection = conn - - def _callmethod(self, methodname, args=(), kwds={}): - ''' - Try to call a method of the referrent and return a copy of the result - ''' - try: - conn = self._tls.connection - except AttributeError: - util.debug('thread %r does not own a connection', - threading.current_thread().get_name()) - self._connect() - conn = self._tls.connection - - conn.send((self._id, methodname, args, kwds)) - kind, result = conn.recv() - - if kind == '#RETURN': - return result - elif kind == '#PROXY': - exposed, token = result - proxytype = self._manager._registry[token.typeid][-1] - return proxytype( - token, self._serializer, manager=self._manager, - authkey=self._authkey, exposed=exposed - ) - raise convert_to_error(kind, result) - - def _getvalue(self): - ''' - Get a copy of the value of the referent - ''' - return self._callmethod('#GETVALUE') - - def _incref(self): - conn = self._Client(self._token.address, authkey=self._authkey) - dispatch(conn, None, 'incref', (self._id,)) - util.debug('INCREF %r', self._token.id) - - self._idset.add(self._id) - - state = self._manager and self._manager._state - - self._close = util.Finalize( - self, BaseProxy._decref, - args=(self._token, self._authkey, state, - self._tls, self._idset, self._Client), - exitpriority=10 - ) - - @staticmethod - def _decref(token, authkey, state, tls, idset, _Client): - idset.discard(token.id) - - # check whether manager is still alive - if state is None or state.value == State.STARTED: - # tell manager this process no longer cares about referent - try: - util.debug('DECREF %r', token.id) - conn = _Client(token.address, authkey=authkey) - dispatch(conn, None, 'decref', (token.id,)) - except Exception, e: - util.debug('... decref failed %s', e) - - else: - util.debug('DECREF %r -- manager already shutdown', token.id) - - # check whether we can close this thread's connection because - # the process owns no more references to objects for this manager - if not idset and hasattr(tls, 'connection'): - util.debug('thread %r has no more proxies so closing conn', - threading.current_thread().get_name()) - tls.connection.close() - del tls.connection - - def _after_fork(self): - self._manager = None - try: - self._incref() - except Exception, e: - # the proxy may just be for a manager which has shutdown - util.info('incref failed: %s' % e) - - def __reduce__(self): - kwds = {} - if Popen.thread_is_spawning(): - kwds['authkey'] = self._authkey - - if getattr(self, '_isauto', False): - kwds['exposed'] = self._exposed_ - return (RebuildProxy, - (AutoProxy, self._token, self._serializer, kwds)) - else: - return (RebuildProxy, - (type(self), self._token, self._serializer, kwds)) - - def __deepcopy__(self, memo): - return self._getvalue() - - def __repr__(self): - return '<%s object, typeid %r at %s>' % \ - (type(self).__name__, self._token.typeid, '0x%x' % id(self)) - - def __str__(self): - ''' - Return representation of the referent (or a fall-back if that fails) - ''' - try: - return self._callmethod('__repr__') - except Exception: - return repr(self)[:-1] + "; '__str__()' failed>" - -# -# Function used for unpickling -# - -def RebuildProxy(func, token, serializer, kwds): - ''' - Function used for unpickling proxy objects. - - If possible the shared object is returned, or otherwise a proxy for it. - ''' - server = getattr(current_process(), '_manager_server', None) - - if server and server.address == token.address: - return server.id_to_obj[token.id][0] - else: - incref = ( - kwds.pop('incref', True) and - not getattr(current_process(), '_inheriting', False) - ) - return func(token, serializer, incref=incref, **kwds) - -# -# Functions to create proxies and proxy types -# - -def MakeProxyType(name, exposed, _cache={}): - ''' - Return an proxy type whose methods are given by `exposed` - ''' - exposed = tuple(exposed) - try: - return _cache[(name, exposed)] - except KeyError: - pass - - dic = {} - - for meth in exposed: - exec '''def %s(self, *args, **kwds): - return self._callmethod(%r, args, kwds)''' % (meth, meth) in dic - - ProxyType = type(name, (BaseProxy,), dic) - ProxyType._exposed_ = exposed - _cache[(name, exposed)] = ProxyType - return ProxyType - - -def AutoProxy(token, serializer, manager=None, authkey=None, - exposed=None, incref=True): - ''' - Return an auto-proxy for `token` - ''' - _Client = listener_client[serializer][1] - - if exposed is None: - conn = _Client(token.address, authkey=authkey) - try: - exposed = dispatch(conn, None, 'get_methods', (token,)) - finally: - conn.close() - - if authkey is None and manager is not None: - authkey = manager._authkey - if authkey is None: - authkey = current_process().get_authkey() - - ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) - proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, - incref=incref) - proxy._isauto = True - return proxy - -# -# Types/callables which we will register with SyncManager -# - -class Namespace(object): - def __init__(self, **kwds): - self.__dict__.update(kwds) - def __repr__(self): - items = self.__dict__.items() - temp = [] - for name, value in items: - if not name.startswith('_'): - temp.append('%s=%r' % (name, value)) - temp.sort() - return 'Namespace(%s)' % str.join(', ', temp) - -class Value(object): - def __init__(self, typecode, value, lock=True): - self._typecode = typecode - self._value = value - def get(self): - return self._value - def set(self, value): - self._value = value - def __repr__(self): - return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) - value = property(get, set) - -def Array(typecode, sequence, lock=True): - return array.array(typecode, sequence) - -# -# Proxy types used by SyncManager -# - -class IteratorProxy(BaseProxy): - # XXX remove methods for Py3.0 and Py2.6 - _exposed_ = ('__next__', 'next', 'send', 'throw', 'close') - def __iter__(self): - return self - def __next__(self, *args): - return self._callmethod('__next__', args) - def next(self, *args): - return self._callmethod('next', args) - def send(self, *args): - return self._callmethod('send', args) - def throw(self, *args): - return self._callmethod('throw', args) - def close(self, *args): - return self._callmethod('close', args) - - -class AcquirerProxy(BaseProxy): - _exposed_ = ('acquire', 'release') - def acquire(self, blocking=True): - return self._callmethod('acquire', (blocking,)) - def release(self): - return self._callmethod('release') - def __enter__(self): - return self._callmethod('acquire') - def __exit__(self, exc_type, exc_val, exc_tb): - return self._callmethod('release') - - -class ConditionProxy(AcquirerProxy): - # XXX will Condition.notfyAll() name be available in Py3.0? - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') - def wait(self, timeout=None): - return self._callmethod('wait', (timeout,)) - def notify(self): - return self._callmethod('notify') - def notify_all(self): - return self._callmethod('notify_all') - -class EventProxy(BaseProxy): - # XXX will Event.isSet name be available in Py3.0? - _exposed_ = ('isSet', 'set', 'clear', 'wait') - def is_set(self): - return self._callmethod('isSet') - def set(self): - return self._callmethod('set') - def clear(self): - return self._callmethod('clear') - def wait(self, timeout=None): - return self._callmethod('wait', (timeout,)) - -class NamespaceProxy(BaseProxy): - _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') - def __getattr__(self, key): - if key[0] == '_': - return object.__getattribute__(self, key) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__getattribute__', (key,)) - def __setattr__(self, key, value): - if key[0] == '_': - return object.__setattr__(self, key, value) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__setattr__', (key, value)) - def __delattr__(self, key): - if key[0] == '_': - return object.__delattr__(self, key) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__delattr__', (key,)) - - -class ValueProxy(BaseProxy): - _exposed_ = ('get', 'set') - def get(self): - return self._callmethod('get') - def set(self, value): - return self._callmethod('set', (value,)) - value = property(get, set) - - -BaseListProxy = MakeProxyType('BaseListProxy', ( - '__add__', '__contains__', '__delitem__', '__delslice__', - '__getitem__', '__getslice__', '__len__', '__mul__', - '__reversed__', '__rmul__', '__setitem__', '__setslice__', - 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', - 'reverse', 'sort', '__imul__' - )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 -class ListProxy(BaseListProxy): - def __iadd__(self, value): - self._callmethod('extend', (value,)) - return self - def __imul__(self, value): - self._callmethod('__imul__', (value,)) - return self - - -DictProxy = MakeProxyType('DictProxy', ( - '__contains__', '__delitem__', '__getitem__', '__len__', - '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', - 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' - )) - - -ArrayProxy = MakeProxyType('ArrayProxy', ( - '__len__', '__getitem__', '__setitem__', '__getslice__', '__setslice__' - )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 - - -PoolProxy = MakeProxyType('PoolProxy', ( - 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', - 'map', 'map_async', 'terminate' - )) -PoolProxy._method_to_typeid_ = { - 'apply_async': 'AsyncResult', - 'map_async': 'AsyncResult', - 'imap': 'Iterator', - 'imap_unordered': 'Iterator' - } - -# -# Definition of SyncManager -# - -class SyncManager(BaseManager): - ''' - Subclass of `BaseManager` which supports a number of shared object types. - - The types registered are those intended for the synchronization - of threads, plus `dict`, `list` and `Namespace`. - - The `multiprocessing.Manager()` function creates started instances of - this class. - ''' - -SyncManager.register('Queue', Queue.Queue) -SyncManager.register('JoinableQueue', Queue.Queue) -SyncManager.register('Event', threading.Event, EventProxy) -SyncManager.register('Lock', threading.Lock, AcquirerProxy) -SyncManager.register('RLock', threading.RLock, AcquirerProxy) -SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) -SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, - AcquirerProxy) -SyncManager.register('Condition', threading.Condition, ConditionProxy) -SyncManager.register('Pool', Pool, PoolProxy) -SyncManager.register('list', list, ListProxy) -SyncManager.register('dict', dict, DictProxy) -SyncManager.register('Value', Value, ValueProxy) -SyncManager.register('Array', Array, ArrayProxy) -SyncManager.register('Namespace', Namespace, NamespaceProxy) - -# types returned by methods of PoolProxy -SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) -SyncManager.register('AsyncResult', create_method=False) +# +# Module providing the `SyncManager` class for dealing +# with shared objects +# +# multiprocessing/managers.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] + +# +# Imports +# + +import os +import sys +import weakref +import threading +import array +import copy_reg +import Queue + +from traceback import format_exc +from multiprocessing import Process, current_process, active_children, Pool, util, connection +from multiprocessing.process import AuthenticationString +from multiprocessing.forking import exit, Popen, assert_spawning +from multiprocessing.util import Finalize, info + +try: + from cPickle import PicklingError +except ImportError: + from pickle import PicklingError + +# +# +# + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Register some things for pickling +# + +def reduce_array(a): + return array.array, (a.typecode, a.tostring()) +copy_reg.pickle(array.array, reduce_array) + +view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] +if view_types[0] is not list: # XXX only needed in Py3.0 + def rebuild_as_list(obj): + return list, (list(obj),) + for view_type in view_types: + copy_reg.pickle(view_type, rebuild_as_list) + +# +# Type for identifying shared objects +# + +class Token(object): + ''' + Type to uniquely indentify a shared object + ''' + __slots__ = ('typeid', 'address', 'id') + + def __init__(self, typeid, address, id): + (self.typeid, self.address, self.id) = (typeid, address, id) + + def __getstate__(self): + return (self.typeid, self.address, self.id) + + def __setstate__(self, state): + (self.typeid, self.address, self.id) = state + + def __repr__(self): + return 'Token(typeid=%r, address=%r, id=%r)' % \ + (self.typeid, self.address, self.id) + +# +# Function for communication with a manager's server process +# + +def dispatch(c, id, methodname, args=(), kwds={}): + ''' + Send a message to manager using connection `c` and return response + ''' + c.send((id, methodname, args, kwds)) + kind, result = c.recv() + if kind == '#RETURN': + return result + raise convert_to_error(kind, result) + +def convert_to_error(kind, result): + if kind == '#ERROR': + return result + elif kind == '#TRACEBACK': + assert type(result) is str + return RemoteError(result) + elif kind == '#UNSERIALIZABLE': + assert type(result) is str + return RemoteError('Unserializable message: %s\n' % result) + else: + return ValueError('Unrecognized message type') + +class RemoteError(Exception): + def __str__(self): + return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) + +# +# Functions for finding the method names of an object +# + +def all_methods(obj): + ''' + Return a list of names of methods of `obj` + ''' + temp = [] + for name in dir(obj): + func = getattr(obj, name) + if hasattr(func, '__call__'): + temp.append(name) + return temp + +def public_methods(obj): + ''' + Return a list of names of methods of `obj` which do not start with '_' + ''' + return [name for name in all_methods(obj) if name[0] != '_'] + +# +# Server which is run in a process controlled by a manager +# + +class Server(object): + ''' + Server class which runs in a process controlled by a manager object + ''' + public = ['shutdown', 'create', 'accept_connection', 'get_methods', + 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] + + def __init__(self, registry, address, authkey, serializer): + assert isinstance(authkey, bytes) + self.registry = registry + self.authkey = AuthenticationString(authkey) + Listener, Client = listener_client[serializer] + + # do authentication later + self.listener = Listener(address=address, backlog=5) + self.address = self.listener.address + + self.id_to_obj = {0: (None, ())} + self.id_to_refcount = {} + self.mutex = threading.RLock() + self.stop = 0 + + def serve_forever(self): + ''' + Run the server forever + ''' + current_process()._manager_server = self + try: + try: + while 1: + try: + c = self.listener.accept() + except (OSError, IOError): + continue + t = threading.Thread(target=self.handle_request, args=(c,)) + t.set_daemon(True) + t.start() + except (KeyboardInterrupt, SystemExit): + pass + finally: + self.stop = 999 + self.listener.close() + + def handle_request(self, c): + ''' + Handle a new connection + ''' + funcname = result = request = None + try: + connection.deliver_challenge(c, self.authkey) + connection.answer_challenge(c, self.authkey) + request = c.recv() + ignore, funcname, args, kwds = request + assert funcname in self.public, '%r unrecognized' % funcname + func = getattr(self, funcname) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + try: + result = func(c, *args, **kwds) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + msg = ('#RETURN', result) + try: + c.send(msg) + except Exception, e: + try: + c.send(('#TRACEBACK', format_exc())) + except Exception: + pass + util.info('Failure to send message: %r', msg) + util.info(' ... request was %r', request) + util.info(' ... exception was %r', e) + + c.close() + + def serve_client(self, conn): + ''' + Handle requests from the proxies in a particular process/thread + ''' + util.debug('starting server thread to service %r', + threading.current_thread().get_name()) + + recv = conn.recv + send = conn.send + id_to_obj = self.id_to_obj + + while not self.stop: + + try: + methodname = obj = None + request = recv() + ident, methodname, args, kwds = request + obj, exposed, gettypeid = id_to_obj[ident] + + if methodname not in exposed: + raise AttributeError( + 'method %r of %r object is not in exposed=%r' % + (methodname, type(obj), exposed) + ) + + function = getattr(obj, methodname) + + try: + res = function(*args, **kwds) + except Exception, e: + msg = ('#ERROR', e) + else: + typeid = gettypeid and gettypeid.get(methodname, None) + if typeid: + rident, rexposed = self.create(conn, typeid, res) + token = Token(typeid, self.address, rident) + msg = ('#PROXY', (rexposed, token)) + else: + msg = ('#RETURN', res) + + except AttributeError: + if methodname is None: + msg = ('#TRACEBACK', format_exc()) + else: + try: + fallback_func = self.fallback_mapping[methodname] + result = fallback_func( + self, conn, ident, obj, *args, **kwds + ) + msg = ('#RETURN', result) + except Exception: + msg = ('#TRACEBACK', format_exc()) + + except EOFError: + util.debug('got EOF -- exiting thread serving %r', + threading.current_thread().get_name()) + sys.exit(0) + + except Exception: + msg = ('#TRACEBACK', format_exc()) + + try: + try: + send(msg) + except Exception, e: + send(('#UNSERIALIZABLE', repr(msg))) + except Exception, e: + util.info('exception in thread serving %r', + threading.current_thread().get_name()) + util.info(' ... message was %r', msg) + util.info(' ... exception was %r', e) + conn.close() + sys.exit(1) + + def fallback_getvalue(self, conn, ident, obj): + return obj + + def fallback_str(self, conn, ident, obj): + return str(obj) + + def fallback_repr(self, conn, ident, obj): + return repr(obj) + + fallback_mapping = { + '__str__':fallback_str, + '__repr__':fallback_repr, + '#GETVALUE':fallback_getvalue + } + + def dummy(self, c): + pass + + def debug_info(self, c): + ''' + Return some info --- useful to spot problems with refcounting + ''' + self.mutex.acquire() + try: + result = [] + keys = self.id_to_obj.keys() + keys.sort() + for ident in keys: + if ident != 0: + result.append(' %s: refcount=%s\n %s' % + (ident, self.id_to_refcount[ident], + str(self.id_to_obj[ident][0])[:75])) + return '\n'.join(result) + finally: + self.mutex.release() + + def number_of_objects(self, c): + ''' + Number of shared objects + ''' + return len(self.id_to_obj) - 1 # don't count ident=0 + + def shutdown(self, c): + ''' + Shutdown this process + ''' + try: + try: + util.debug('manager received shutdown message') + c.send(('#RETURN', None)) + + if sys.stdout != sys.__stdout__: + util.debug('resetting stdout, stderr') + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + + util._run_finalizers(0) + + for p in active_children(): + util.debug('terminating a child process of manager') + p.terminate() + + for p in active_children(): + util.debug('terminating a child process of manager') + p.join() + + util._run_finalizers() + util.info('manager exiting with exitcode 0') + except: + import traceback + traceback.print_exc() + finally: + exit(0) + + def create(self, c, typeid, *args, **kwds): + ''' + Create a new shared object and return its id + ''' + self.mutex.acquire() + try: + callable, exposed, method_to_typeid, proxytype = \ + self.registry[typeid] + + if callable is None: + assert len(args) == 1 and not kwds + obj = args[0] + else: + obj = callable(*args, **kwds) + + if exposed is None: + exposed = public_methods(obj) + if method_to_typeid is not None: + assert type(method_to_typeid) is dict + exposed = list(exposed) + list(method_to_typeid) + + ident = '%x' % id(obj) # convert to string because xmlrpclib + # only has 32 bit signed integers + util.debug('%r callable returned object with id %r', typeid, ident) + + self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) + if ident not in self.id_to_refcount: + self.id_to_refcount[ident] = None + return ident, tuple(exposed) + finally: + self.mutex.release() + + def get_methods(self, c, token): + ''' + Return the methods of the shared object indicated by token + ''' + return tuple(self.id_to_obj[token.id][1]) + + def accept_connection(self, c, name): + ''' + Spawn a new thread to serve this connection + ''' + threading.current_thread().set_name(name) + c.send(('#RETURN', None)) + self.serve_client(c) + + def incref(self, c, ident): + self.mutex.acquire() + try: + try: + self.id_to_refcount[ident] += 1 + except TypeError: + assert self.id_to_refcount[ident] is None + self.id_to_refcount[ident] = 1 + finally: + self.mutex.release() + + def decref(self, c, ident): + self.mutex.acquire() + try: + assert self.id_to_refcount[ident] >= 1 + self.id_to_refcount[ident] -= 1 + if self.id_to_refcount[ident] == 0: + del self.id_to_obj[ident], self.id_to_refcount[ident] + util.debug('disposing of obj with id %d', ident) + finally: + self.mutex.release() + +# +# Class to represent state of a manager +# + +class State(object): + __slots__ = ['value'] + INITIAL = 0 + STARTED = 1 + SHUTDOWN = 2 + +# +# Mapping from serializer name to Listener and Client types +# + +listener_client = { + 'pickle' : (connection.Listener, connection.Client), + 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) + } + +# +# Definition of BaseManager +# + +class BaseManager(object): + ''' + Base class for managers + ''' + _registry = {} + _Server = Server + + def __init__(self, address=None, authkey=None, serializer='pickle'): + if authkey is None: + authkey = current_process().get_authkey() + self._address = address # XXX not final address if eg ('', 0) + self._authkey = AuthenticationString(authkey) + self._state = State() + self._state.value = State.INITIAL + self._serializer = serializer + self._Listener, self._Client = listener_client[serializer] + + def __reduce__(self): + return type(self).from_address, \ + (self._address, self._authkey, self._serializer) + + def get_server(self): + ''' + Return server object with serve_forever() method and address attribute + ''' + assert self._state.value == State.INITIAL + return Server(self._registry, self._address, + self._authkey, self._serializer) + + def connect(self): + ''' + Connect manager object to the server process + ''' + Listener, Client = listener_client[self._serializer] + conn = Client(self._address, authkey=self._authkey) + dispatch(conn, None, 'dummy') + self._state.value = State.STARTED + + def start(self): + ''' + Spawn a server process for this manager object + ''' + assert self._state.value == State.INITIAL + + # pipe over which we will retrieve address of server + reader, writer = connection.Pipe(duplex=False) + + # spawn process which runs a server + self._process = Process( + target=type(self)._run_server, + args=(self._registry, self._address, self._authkey, + self._serializer, writer), + ) + ident = ':'.join(str(i) for i in self._process._identity) + self._process.set_name(type(self).__name__ + '-' + ident) + self._process.start() + + # get address of server + writer.close() + self._address = reader.recv() + reader.close() + + # register a finalizer + self._state.value = State.STARTED + self.shutdown = util.Finalize( + self, type(self)._finalize_manager, + args=(self._process, self._address, self._authkey, + self._state, self._Client), + exitpriority=0 + ) + + @classmethod + def _run_server(cls, registry, address, authkey, serializer, writer): + ''' + Create a server, report its address and run it + ''' + # create server + server = cls._Server(registry, address, authkey, serializer) + + # inform parent process of the server's address + writer.send(server.address) + writer.close() + + # run the manager + util.info('manager serving at %r', server.address) + server.serve_forever() + + def _create(self, typeid, *args, **kwds): + ''' + Create a new shared object; return the token and exposed tuple + ''' + assert self._state.value == State.STARTED, 'server not yet started' + conn = self._Client(self._address, authkey=self._authkey) + try: + id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) + finally: + conn.close() + return Token(typeid, self._address, id), exposed + + def join(self, timeout=None): + ''' + Join the manager process (if it has been spawned) + ''' + self._process.join(timeout) + + def _debug_info(self): + ''' + Return some info about the servers shared objects and connections + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'debug_info') + finally: + conn.close() + + def _number_of_objects(self): + ''' + Return the number of shared objects + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'number_of_objects') + finally: + conn.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown() + + @staticmethod + def _finalize_manager(process, address, authkey, state, _Client): + ''' + Shutdown the manager process; will be registered as a finalizer + ''' + if process.is_alive(): + util.info('sending shutdown message to manager') + try: + conn = _Client(address, authkey=authkey) + try: + dispatch(conn, None, 'shutdown') + finally: + conn.close() + except Exception: + pass + + process.join(timeout=0.2) + if process.is_alive(): + util.info('manager still alive') + if hasattr(process, 'terminate'): + util.info('trying to `terminate()` manager process') + process.terminate() + process.join(timeout=0.1) + if process.is_alive(): + util.info('manager still alive after terminate') + + state.value = State.SHUTDOWN + try: + del BaseProxy._address_to_local[address] + except KeyError: + pass + + address = property(lambda self: self._address) + + @classmethod + def register(cls, typeid, callable=None, proxytype=None, exposed=None, + method_to_typeid=None, create_method=True): + ''' + Register a typeid with the manager type + ''' + if '_registry' not in cls.__dict__: + cls._registry = cls._registry.copy() + + if proxytype is None: + proxytype = AutoProxy + + exposed = exposed or getattr(proxytype, '_exposed_', None) + + method_to_typeid = method_to_typeid or \ + getattr(proxytype, '_method_to_typeid_', None) + + if method_to_typeid: + for key, value in method_to_typeid.items(): + assert type(key) is str, '%r is not a string' % key + assert type(value) is str, '%r is not a string' % value + + cls._registry[typeid] = ( + callable, exposed, method_to_typeid, proxytype + ) + + if create_method: + def temp(self, *args, **kwds): + util.debug('requesting creation of a shared %r object', typeid) + token, exp = self._create(typeid, *args, **kwds) + proxy = proxytype( + token, self._serializer, manager=self, + authkey=self._authkey, exposed=exp + ) + return proxy + temp.__name__ = typeid + setattr(cls, typeid, temp) + +# +# Subclass of set which get cleared after a fork +# + +class ProcessLocalSet(set): + def __init__(self): + util.register_after_fork(self, lambda obj: obj.clear()) + def __reduce__(self): + return type(self), () + +# +# Definition of BaseProxy +# + +class BaseProxy(object): + ''' + A base for proxies of shared objects + ''' + _address_to_local = {} + _mutex = util.ForkAwareThreadLock() + + def __init__(self, token, serializer, manager=None, + authkey=None, exposed=None, incref=True): + BaseProxy._mutex.acquire() + try: + tls_idset = BaseProxy._address_to_local.get(token.address, None) + if tls_idset is None: + tls_idset = util.ForkAwareLocal(), ProcessLocalSet() + BaseProxy._address_to_local[token.address] = tls_idset + finally: + BaseProxy._mutex.release() + + # self._tls is used to record the connection used by this + # thread to communicate with the manager at token.address + self._tls = tls_idset[0] + + # self._idset is used to record the identities of all shared + # objects for which the current process owns references and + # which are in the manager at token.address + self._idset = tls_idset[1] + + self._token = token + self._id = self._token.id + self._manager = manager + self._serializer = serializer + self._Client = listener_client[serializer][1] + + if authkey is not None: + self._authkey = AuthenticationString(authkey) + elif self._manager is not None: + self._authkey = self._manager._authkey + else: + self._authkey = current_process().get_authkey() + + if incref: + self._incref() + + util.register_after_fork(self, BaseProxy._after_fork) + + def _connect(self): + util.debug('making connection to manager') + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'accept_connection', (name,)) + self._tls.connection = conn + + def _callmethod(self, methodname, args=(), kwds={}): + ''' + Try to call a method of the referrent and return a copy of the result + ''' + try: + conn = self._tls.connection + except AttributeError: + util.debug('thread %r does not own a connection', + threading.current_thread().get_name()) + self._connect() + conn = self._tls.connection + + conn.send((self._id, methodname, args, kwds)) + kind, result = conn.recv() + + if kind == '#RETURN': + return result + elif kind == '#PROXY': + exposed, token = result + proxytype = self._manager._registry[token.typeid][-1] + return proxytype( + token, self._serializer, manager=self._manager, + authkey=self._authkey, exposed=exposed + ) + raise convert_to_error(kind, result) + + def _getvalue(self): + ''' + Get a copy of the value of the referent + ''' + return self._callmethod('#GETVALUE') + + def _incref(self): + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'incref', (self._id,)) + util.debug('INCREF %r', self._token.id) + + self._idset.add(self._id) + + state = self._manager and self._manager._state + + self._close = util.Finalize( + self, BaseProxy._decref, + args=(self._token, self._authkey, state, + self._tls, self._idset, self._Client), + exitpriority=10 + ) + + @staticmethod + def _decref(token, authkey, state, tls, idset, _Client): + idset.discard(token.id) + + # check whether manager is still alive + if state is None or state.value == State.STARTED: + # tell manager this process no longer cares about referent + try: + util.debug('DECREF %r', token.id) + conn = _Client(token.address, authkey=authkey) + dispatch(conn, None, 'decref', (token.id,)) + except Exception, e: + util.debug('... decref failed %s', e) + + else: + util.debug('DECREF %r -- manager already shutdown', token.id) + + # check whether we can close this thread's connection because + # the process owns no more references to objects for this manager + if not idset and hasattr(tls, 'connection'): + util.debug('thread %r has no more proxies so closing conn', + threading.current_thread().get_name()) + tls.connection.close() + del tls.connection + + def _after_fork(self): + self._manager = None + try: + self._incref() + except Exception, e: + # the proxy may just be for a manager which has shutdown + util.info('incref failed: %s' % e) + + def __reduce__(self): + kwds = {} + if Popen.thread_is_spawning(): + kwds['authkey'] = self._authkey + + if getattr(self, '_isauto', False): + kwds['exposed'] = self._exposed_ + return (RebuildProxy, + (AutoProxy, self._token, self._serializer, kwds)) + else: + return (RebuildProxy, + (type(self), self._token, self._serializer, kwds)) + + def __deepcopy__(self, memo): + return self._getvalue() + + def __repr__(self): + return '<%s object, typeid %r at %s>' % \ + (type(self).__name__, self._token.typeid, '0x%x' % id(self)) + + def __str__(self): + ''' + Return representation of the referent (or a fall-back if that fails) + ''' + try: + return self._callmethod('__repr__') + except Exception: + return repr(self)[:-1] + "; '__str__()' failed>" + +# +# Function used for unpickling +# + +def RebuildProxy(func, token, serializer, kwds): + ''' + Function used for unpickling proxy objects. + + If possible the shared object is returned, or otherwise a proxy for it. + ''' + server = getattr(current_process(), '_manager_server', None) + + if server and server.address == token.address: + return server.id_to_obj[token.id][0] + else: + incref = ( + kwds.pop('incref', True) and + not getattr(current_process(), '_inheriting', False) + ) + return func(token, serializer, incref=incref, **kwds) + +# +# Functions to create proxies and proxy types +# + +def MakeProxyType(name, exposed, _cache={}): + ''' + Return an proxy type whose methods are given by `exposed` + ''' + exposed = tuple(exposed) + try: + return _cache[(name, exposed)] + except KeyError: + pass + + dic = {} + + for meth in exposed: + exec '''def %s(self, *args, **kwds): + return self._callmethod(%r, args, kwds)''' % (meth, meth) in dic + + ProxyType = type(name, (BaseProxy,), dic) + ProxyType._exposed_ = exposed + _cache[(name, exposed)] = ProxyType + return ProxyType + + +def AutoProxy(token, serializer, manager=None, authkey=None, + exposed=None, incref=True): + ''' + Return an auto-proxy for `token` + ''' + _Client = listener_client[serializer][1] + + if exposed is None: + conn = _Client(token.address, authkey=authkey) + try: + exposed = dispatch(conn, None, 'get_methods', (token,)) + finally: + conn.close() + + if authkey is None and manager is not None: + authkey = manager._authkey + if authkey is None: + authkey = current_process().get_authkey() + + ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) + proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, + incref=incref) + proxy._isauto = True + return proxy + +# +# Types/callables which we will register with SyncManager +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def get(self): + return self._value + def set(self, value): + self._value = value + def __repr__(self): + return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) + value = property(get, set) + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +# +# Proxy types used by SyncManager +# + +class IteratorProxy(BaseProxy): + # XXX remove methods for Py3.0 and Py2.6 + _exposed_ = ('__next__', 'next', 'send', 'throw', 'close') + def __iter__(self): + return self + def __next__(self, *args): + return self._callmethod('__next__', args) + def next(self, *args): + return self._callmethod('next', args) + def send(self, *args): + return self._callmethod('send', args) + def throw(self, *args): + return self._callmethod('throw', args) + def close(self, *args): + return self._callmethod('close', args) + + +class AcquirerProxy(BaseProxy): + _exposed_ = ('acquire', 'release') + def acquire(self, blocking=True): + return self._callmethod('acquire', (blocking,)) + def release(self): + return self._callmethod('release') + def __enter__(self): + return self._callmethod('acquire') + def __exit__(self, exc_type, exc_val, exc_tb): + return self._callmethod('release') + + +class ConditionProxy(AcquirerProxy): + # XXX will Condition.notfyAll() name be available in Py3.0? + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + def notify(self): + return self._callmethod('notify') + def notify_all(self): + return self._callmethod('notify_all') + +class EventProxy(BaseProxy): + # XXX will Event.isSet name be available in Py3.0? + _exposed_ = ('isSet', 'set', 'clear', 'wait') + def is_set(self): + return self._callmethod('isSet') + def set(self): + return self._callmethod('set') + def clear(self): + return self._callmethod('clear') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + +class NamespaceProxy(BaseProxy): + _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') + def __getattr__(self, key): + if key[0] == '_': + return object.__getattribute__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__getattribute__', (key,)) + def __setattr__(self, key, value): + if key[0] == '_': + return object.__setattr__(self, key, value) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__setattr__', (key, value)) + def __delattr__(self, key): + if key[0] == '_': + return object.__delattr__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__delattr__', (key,)) + + +class ValueProxy(BaseProxy): + _exposed_ = ('get', 'set') + def get(self): + return self._callmethod('get') + def set(self, value): + return self._callmethod('set', (value,)) + value = property(get, set) + + +BaseListProxy = MakeProxyType('BaseListProxy', ( + '__add__', '__contains__', '__delitem__', '__delslice__', + '__getitem__', '__getslice__', '__len__', '__mul__', + '__reversed__', '__rmul__', '__setitem__', '__setslice__', + 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', + 'reverse', 'sort', '__imul__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 +class ListProxy(BaseListProxy): + def __iadd__(self, value): + self._callmethod('extend', (value,)) + return self + def __imul__(self, value): + self._callmethod('__imul__', (value,)) + return self + + +DictProxy = MakeProxyType('DictProxy', ( + '__contains__', '__delitem__', '__getitem__', '__len__', + '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', + 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' + )) + + +ArrayProxy = MakeProxyType('ArrayProxy', ( + '__len__', '__getitem__', '__setitem__', '__getslice__', '__setslice__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 + + +PoolProxy = MakeProxyType('PoolProxy', ( + 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', + 'map', 'map_async', 'terminate' + )) +PoolProxy._method_to_typeid_ = { + 'apply_async': 'AsyncResult', + 'map_async': 'AsyncResult', + 'imap': 'Iterator', + 'imap_unordered': 'Iterator' + } + +# +# Definition of SyncManager +# + +class SyncManager(BaseManager): + ''' + Subclass of `BaseManager` which supports a number of shared object types. + + The types registered are those intended for the synchronization + of threads, plus `dict`, `list` and `Namespace`. + + The `multiprocessing.Manager()` function creates started instances of + this class. + ''' + +SyncManager.register('Queue', Queue.Queue) +SyncManager.register('JoinableQueue', Queue.Queue) +SyncManager.register('Event', threading.Event, EventProxy) +SyncManager.register('Lock', threading.Lock, AcquirerProxy) +SyncManager.register('RLock', threading.RLock, AcquirerProxy) +SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) +SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, + AcquirerProxy) +SyncManager.register('Condition', threading.Condition, ConditionProxy) +SyncManager.register('Pool', Pool, PoolProxy) +SyncManager.register('list', list, ListProxy) +SyncManager.register('dict', dict, DictProxy) +SyncManager.register('Value', Value, ValueProxy) +SyncManager.register('Array', Array, ArrayProxy) +SyncManager.register('Namespace', Namespace, NamespaceProxy) + +# types returned by methods of PoolProxy +SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) +SyncManager.register('AsyncResult', create_method=False) Modified: python/trunk/Lib/multiprocessing/pool.py ============================================================================== --- python/trunk/Lib/multiprocessing/pool.py (original) +++ python/trunk/Lib/multiprocessing/pool.py Fri Jun 13 21:20:48 2008 @@ -1,596 +1,596 @@ -# -# Module providing the `Pool` class for managing a process pool -# -# multiprocessing/pool.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Pool'] - -# -# Imports -# - -import threading -import Queue -import itertools -import collections -import time - -from multiprocessing import Process, cpu_count, TimeoutError -from multiprocessing.util import Finalize, debug - -# -# Constants representing the state of a pool -# - -RUN = 0 -CLOSE = 1 -TERMINATE = 2 - -# -# Miscellaneous -# - -job_counter = itertools.count() - -def mapstar(args): - return map(*args) - -# -# Code run by worker processes -# - -def worker(inqueue, outqueue, initializer=None, initargs=()): - put = outqueue.put - get = inqueue.get - if hasattr(inqueue, '_writer'): - inqueue._writer.close() - outqueue._reader.close() - - if initializer is not None: - initializer(*initargs) - - while 1: - try: - task = get() - except (EOFError, IOError): - debug('worker got EOFError or IOError -- exiting') - break - - if task is None: - debug('worker got sentinel -- exiting') - break - - job, i, func, args, kwds = task - try: - result = (True, func(*args, **kwds)) - except Exception, e: - result = (False, e) - put((job, i, result)) - -# -# Class representing a process pool -# - -class Pool(object): - ''' - Class which supports an async version of the `apply()` builtin - ''' - Process = Process - - def __init__(self, processes=None, initializer=None, initargs=()): - self._setup_queues() - self._taskqueue = Queue.Queue() - self._cache = {} - self._state = RUN - - if processes is None: - try: - processes = cpu_count() - except NotImplementedError: - processes = 1 - - self._pool = [] - for i in range(processes): - w = self.Process( - target=worker, - args=(self._inqueue, self._outqueue, initializer, initargs) - ) - self._pool.append(w) - w.set_name(w.get_name().replace('Process', 'PoolWorker')) - w.set_daemon(True) - w.start() - - self._task_handler = threading.Thread( - target=Pool._handle_tasks, - args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) - ) - self._task_handler.set_daemon(True) - self._task_handler._state = RUN - self._task_handler.start() - - self._result_handler = threading.Thread( - target=Pool._handle_results, - args=(self._outqueue, self._quick_get, self._cache) - ) - self._result_handler.set_daemon(True) - self._result_handler._state = RUN - self._result_handler.start() - - self._terminate = Finalize( - self, self._terminate_pool, - args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, - self._task_handler, self._result_handler, self._cache), - exitpriority=15 - ) - - def _setup_queues(self): - from .queues import SimpleQueue - self._inqueue = SimpleQueue() - self._outqueue = SimpleQueue() - self._quick_put = self._inqueue._writer.send - self._quick_get = self._outqueue._reader.recv - - def apply(self, func, args=(), kwds={}): - ''' - Equivalent of `apply()` builtin - ''' - assert self._state == RUN - return self.apply_async(func, args, kwds).get() - - def map(self, func, iterable, chunksize=None): - ''' - Equivalent of `map()` builtin - ''' - assert self._state == RUN - return self.map_async(func, iterable, chunksize).get() - - def imap(self, func, iterable, chunksize=1): - ''' - Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` - ''' - assert self._state == RUN - if chunksize == 1: - result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) - return result - else: - assert chunksize > 1 - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) - return (item for chunk in result for item in chunk) - - def imap_unordered(self, func, iterable, chunksize=1): - ''' - Like `imap()` method but ordering of results is arbitrary - ''' - assert self._state == RUN - if chunksize == 1: - result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) - return result - else: - assert chunksize > 1 - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) - return (item for chunk in result for item in chunk) - - def apply_async(self, func, args=(), kwds={}, callback=None): - ''' - Asynchronous equivalent of `apply()` builtin - ''' - assert self._state == RUN - result = ApplyResult(self._cache, callback) - self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) - return result - - def map_async(self, func, iterable, chunksize=None, callback=None): - ''' - Asynchronous equivalent of `map()` builtin - ''' - assert self._state == RUN - if not hasattr(iterable, '__len__'): - iterable = list(iterable) - - if chunksize is None: - chunksize, extra = divmod(len(iterable), len(self._pool) * 4) - if extra: - chunksize += 1 - - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = MapResult(self._cache, chunksize, len(iterable), callback) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), None)) - return result - - @staticmethod - def _handle_tasks(taskqueue, put, outqueue, pool): - thread = threading.current_thread() - - for taskseq, set_length in iter(taskqueue.get, None): - i = -1 - for i, task in enumerate(taskseq): - if thread._state: - debug('task handler found thread._state != RUN') - break - try: - put(task) - except IOError: - debug('could not put task on queue') - break - else: - if set_length: - debug('doing set_length()') - set_length(i+1) - continue - break - else: - debug('task handler got sentinel') - - - try: - # tell result handler to finish when cache is empty - debug('task handler sending sentinel to result handler') - outqueue.put(None) - - # tell workers there is no more work - debug('task handler sending sentinel to workers') - for p in pool: - put(None) - except IOError: - debug('task handler got IOError when sending sentinels') - - debug('task handler exiting') - - @staticmethod - def _handle_results(outqueue, get, cache): - thread = threading.current_thread() - - while 1: - try: - task = get() - except (IOError, EOFError): - debug('result handler got EOFError/IOError -- exiting') - return - - if thread._state: - assert thread._state == TERMINATE - debug('result handler found thread._state=TERMINATE') - break - - if task is None: - debug('result handler got sentinel') - break - - job, i, obj = task - try: - cache[job]._set(i, obj) - except KeyError: - pass - - while cache and thread._state != TERMINATE: - try: - task = get() - except (IOError, EOFError): - debug('result handler got EOFError/IOError -- exiting') - return - - if task is None: - debug('result handler ignoring extra sentinel') - continue - job, i, obj = task - try: - cache[job]._set(i, obj) - except KeyError: - pass - - if hasattr(outqueue, '_reader'): - debug('ensuring that outqueue is not full') - # If we don't make room available in outqueue then - # attempts to add the sentinel (None) to outqueue may - # block. There is guaranteed to be no more than 2 sentinels. - try: - for i in range(10): - if not outqueue._reader.poll(): - break - get() - except (IOError, EOFError): - pass - - debug('result handler exiting: len(cache)=%s, thread._state=%s', - len(cache), thread._state) - - @staticmethod - def _get_tasks(func, it, size): - it = iter(it) - while 1: - x = tuple(itertools.islice(it, size)) - if not x: - return - yield (func, x) - - def __reduce__(self): - raise NotImplementedError( - 'pool objects cannot be passed between processes or pickled' - ) - - def close(self): - debug('closing pool') - if self._state == RUN: - self._state = CLOSE - self._taskqueue.put(None) - - def terminate(self): - debug('terminating pool') - self._state = TERMINATE - self._terminate() - - def join(self): - debug('joining pool') - assert self._state in (CLOSE, TERMINATE) - self._task_handler.join() - self._result_handler.join() - for p in self._pool: - p.join() - - @staticmethod - def _help_stuff_finish(inqueue, task_handler, size): - # task_handler may be blocked trying to put items on inqueue - debug('removing tasks from inqueue until task handler finished') - inqueue._rlock.acquire() - while task_handler.is_alive() and inqueue._reader.poll(): - inqueue._reader.recv() - time.sleep(0) - - @classmethod - def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, - task_handler, result_handler, cache): - # this is guaranteed to only be called once - debug('finalizing pool') - - task_handler._state = TERMINATE - taskqueue.put(None) # sentinel - - debug('helping task handler/workers to finish') - cls._help_stuff_finish(inqueue, task_handler, len(pool)) - - assert result_handler.is_alive() or len(cache) == 0 - - result_handler._state = TERMINATE - outqueue.put(None) # sentinel - - if pool and hasattr(pool[0], 'terminate'): - debug('terminating workers') - for p in pool: - p.terminate() - - debug('joining task handler') - task_handler.join(1e100) - - debug('joining result handler') - result_handler.join(1e100) - - if pool and hasattr(pool[0], 'terminate'): - debug('joining pool workers') - for p in pool: - p.join() - -# -# Class whose instances are returned by `Pool.apply_async()` -# - -class ApplyResult(object): - - def __init__(self, cache, callback): - self._cond = threading.Condition(threading.Lock()) - self._job = job_counter.next() - self._cache = cache - self._ready = False - self._callback = callback - cache[self._job] = self - - def ready(self): - return self._ready - - def successful(self): - assert self._ready - return self._success - - def wait(self, timeout=None): - self._cond.acquire() - try: - if not self._ready: - self._cond.wait(timeout) - finally: - self._cond.release() - - def get(self, timeout=None): - self.wait(timeout) - if not self._ready: - raise TimeoutError - if self._success: - return self._value - else: - raise self._value - - def _set(self, i, obj): - self._success, self._value = obj - if self._callback and self._success: - self._callback(self._value) - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - del self._cache[self._job] - -# -# Class whose instances are returned by `Pool.map_async()` -# - -class MapResult(ApplyResult): - - def __init__(self, cache, chunksize, length, callback): - ApplyResult.__init__(self, cache, callback) - self._success = True - self._value = [None] * length - self._chunksize = chunksize - if chunksize <= 0: - self._number_left = 0 - self._ready = True - else: - self._number_left = length//chunksize + bool(length % chunksize) - - def _set(self, i, success_result): - success, result = success_result - if success: - self._value[i*self._chunksize:(i+1)*self._chunksize] = result - self._number_left -= 1 - if self._number_left == 0: - if self._callback: - self._callback(self._value) - del self._cache[self._job] - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - - else: - self._success = False - self._value = result - del self._cache[self._job] - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - -# -# Class whose instances are returned by `Pool.imap()` -# - -class IMapIterator(object): - - def __init__(self, cache): - self._cond = threading.Condition(threading.Lock()) - self._job = job_counter.next() - self._cache = cache - self._items = collections.deque() - self._index = 0 - self._length = None - self._unsorted = {} - cache[self._job] = self - - def __iter__(self): - return self - - def next(self, timeout=None): - self._cond.acquire() - try: - try: - item = self._items.popleft() - except IndexError: - if self._index == self._length: - raise StopIteration - self._cond.wait(timeout) - try: - item = self._items.popleft() - except IndexError: - if self._index == self._length: - raise StopIteration - raise TimeoutError - finally: - self._cond.release() - - success, value = item - if success: - return value - raise value - - __next__ = next # XXX - - def _set(self, i, obj): - self._cond.acquire() - try: - if self._index == i: - self._items.append(obj) - self._index += 1 - while self._index in self._unsorted: - obj = self._unsorted.pop(self._index) - self._items.append(obj) - self._index += 1 - self._cond.notify() - else: - self._unsorted[i] = obj - - if self._index == self._length: - del self._cache[self._job] - finally: - self._cond.release() - - def _set_length(self, length): - self._cond.acquire() - try: - self._length = length - if self._index == self._length: - self._cond.notify() - del self._cache[self._job] - finally: - self._cond.release() - -# -# Class whose instances are returned by `Pool.imap_unordered()` -# - -class IMapUnorderedIterator(IMapIterator): - - def _set(self, i, obj): - self._cond.acquire() - try: - self._items.append(obj) - self._index += 1 - self._cond.notify() - if self._index == self._length: - del self._cache[self._job] - finally: - self._cond.release() - -# -# -# - -class ThreadPool(Pool): - - from .dummy import Process - - def __init__(self, processes=None, initializer=None, initargs=()): - Pool.__init__(self, processes, initializer, initargs) - - def _setup_queues(self): - self._inqueue = Queue.Queue() - self._outqueue = Queue.Queue() - self._quick_put = self._inqueue.put - self._quick_get = self._outqueue.get - - @staticmethod - def _help_stuff_finish(inqueue, task_handler, size): - # put sentinels at head of inqueue to make workers finish - inqueue.not_empty.acquire() - try: - inqueue.queue.clear() - inqueue.queue.extend([None] * size) - inqueue.not_empty.notify_all() - finally: - inqueue.not_empty.release() +# +# Module providing the `Pool` class for managing a process pool +# +# multiprocessing/pool.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Pool'] + +# +# Imports +# + +import threading +import Queue +import itertools +import collections +import time + +from multiprocessing import Process, cpu_count, TimeoutError +from multiprocessing.util import Finalize, debug + +# +# Constants representing the state of a pool +# + +RUN = 0 +CLOSE = 1 +TERMINATE = 2 + +# +# Miscellaneous +# + +job_counter = itertools.count() + +def mapstar(args): + return map(*args) + +# +# Code run by worker processes +# + +def worker(inqueue, outqueue, initializer=None, initargs=()): + put = outqueue.put + get = inqueue.get + if hasattr(inqueue, '_writer'): + inqueue._writer.close() + outqueue._reader.close() + + if initializer is not None: + initializer(*initargs) + + while 1: + try: + task = get() + except (EOFError, IOError): + debug('worker got EOFError or IOError -- exiting') + break + + if task is None: + debug('worker got sentinel -- exiting') + break + + job, i, func, args, kwds = task + try: + result = (True, func(*args, **kwds)) + except Exception, e: + result = (False, e) + put((job, i, result)) + +# +# Class representing a process pool +# + +class Pool(object): + ''' + Class which supports an async version of the `apply()` builtin + ''' + Process = Process + + def __init__(self, processes=None, initializer=None, initargs=()): + self._setup_queues() + self._taskqueue = Queue.Queue() + self._cache = {} + self._state = RUN + + if processes is None: + try: + processes = cpu_count() + except NotImplementedError: + processes = 1 + + self._pool = [] + for i in range(processes): + w = self.Process( + target=worker, + args=(self._inqueue, self._outqueue, initializer, initargs) + ) + self._pool.append(w) + w.set_name(w.get_name().replace('Process', 'PoolWorker')) + w.set_daemon(True) + w.start() + + self._task_handler = threading.Thread( + target=Pool._handle_tasks, + args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) + ) + self._task_handler.set_daemon(True) + self._task_handler._state = RUN + self._task_handler.start() + + self._result_handler = threading.Thread( + target=Pool._handle_results, + args=(self._outqueue, self._quick_get, self._cache) + ) + self._result_handler.set_daemon(True) + self._result_handler._state = RUN + self._result_handler.start() + + self._terminate = Finalize( + self, self._terminate_pool, + args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, + self._task_handler, self._result_handler, self._cache), + exitpriority=15 + ) + + def _setup_queues(self): + from .queues import SimpleQueue + self._inqueue = SimpleQueue() + self._outqueue = SimpleQueue() + self._quick_put = self._inqueue._writer.send + self._quick_get = self._outqueue._reader.recv + + def apply(self, func, args=(), kwds={}): + ''' + Equivalent of `apply()` builtin + ''' + assert self._state == RUN + return self.apply_async(func, args, kwds).get() + + def map(self, func, iterable, chunksize=None): + ''' + Equivalent of `map()` builtin + ''' + assert self._state == RUN + return self.map_async(func, iterable, chunksize).get() + + def imap(self, func, iterable, chunksize=1): + ''' + Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def imap_unordered(self, func, iterable, chunksize=1): + ''' + Like `imap()` method but ordering of results is arbitrary + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def apply_async(self, func, args=(), kwds={}, callback=None): + ''' + Asynchronous equivalent of `apply()` builtin + ''' + assert self._state == RUN + result = ApplyResult(self._cache, callback) + self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) + return result + + def map_async(self, func, iterable, chunksize=None, callback=None): + ''' + Asynchronous equivalent of `map()` builtin + ''' + assert self._state == RUN + if not hasattr(iterable, '__len__'): + iterable = list(iterable) + + if chunksize is None: + chunksize, extra = divmod(len(iterable), len(self._pool) * 4) + if extra: + chunksize += 1 + + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = MapResult(self._cache, chunksize, len(iterable), callback) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), None)) + return result + + @staticmethod + def _handle_tasks(taskqueue, put, outqueue, pool): + thread = threading.current_thread() + + for taskseq, set_length in iter(taskqueue.get, None): + i = -1 + for i, task in enumerate(taskseq): + if thread._state: + debug('task handler found thread._state != RUN') + break + try: + put(task) + except IOError: + debug('could not put task on queue') + break + else: + if set_length: + debug('doing set_length()') + set_length(i+1) + continue + break + else: + debug('task handler got sentinel') + + + try: + # tell result handler to finish when cache is empty + debug('task handler sending sentinel to result handler') + outqueue.put(None) + + # tell workers there is no more work + debug('task handler sending sentinel to workers') + for p in pool: + put(None) + except IOError: + debug('task handler got IOError when sending sentinels') + + debug('task handler exiting') + + @staticmethod + def _handle_results(outqueue, get, cache): + thread = threading.current_thread() + + while 1: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if thread._state: + assert thread._state == TERMINATE + debug('result handler found thread._state=TERMINATE') + break + + if task is None: + debug('result handler got sentinel') + break + + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + while cache and thread._state != TERMINATE: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if task is None: + debug('result handler ignoring extra sentinel') + continue + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + if hasattr(outqueue, '_reader'): + debug('ensuring that outqueue is not full') + # If we don't make room available in outqueue then + # attempts to add the sentinel (None) to outqueue may + # block. There is guaranteed to be no more than 2 sentinels. + try: + for i in range(10): + if not outqueue._reader.poll(): + break + get() + except (IOError, EOFError): + pass + + debug('result handler exiting: len(cache)=%s, thread._state=%s', + len(cache), thread._state) + + @staticmethod + def _get_tasks(func, it, size): + it = iter(it) + while 1: + x = tuple(itertools.islice(it, size)) + if not x: + return + yield (func, x) + + def __reduce__(self): + raise NotImplementedError( + 'pool objects cannot be passed between processes or pickled' + ) + + def close(self): + debug('closing pool') + if self._state == RUN: + self._state = CLOSE + self._taskqueue.put(None) + + def terminate(self): + debug('terminating pool') + self._state = TERMINATE + self._terminate() + + def join(self): + debug('joining pool') + assert self._state in (CLOSE, TERMINATE) + self._task_handler.join() + self._result_handler.join() + for p in self._pool: + p.join() + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # task_handler may be blocked trying to put items on inqueue + debug('removing tasks from inqueue until task handler finished') + inqueue._rlock.acquire() + while task_handler.is_alive() and inqueue._reader.poll(): + inqueue._reader.recv() + time.sleep(0) + + @classmethod + def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, + task_handler, result_handler, cache): + # this is guaranteed to only be called once + debug('finalizing pool') + + task_handler._state = TERMINATE + taskqueue.put(None) # sentinel + + debug('helping task handler/workers to finish') + cls._help_stuff_finish(inqueue, task_handler, len(pool)) + + assert result_handler.is_alive() or len(cache) == 0 + + result_handler._state = TERMINATE + outqueue.put(None) # sentinel + + if pool and hasattr(pool[0], 'terminate'): + debug('terminating workers') + for p in pool: + p.terminate() + + debug('joining task handler') + task_handler.join(1e100) + + debug('joining result handler') + result_handler.join(1e100) + + if pool and hasattr(pool[0], 'terminate'): + debug('joining pool workers') + for p in pool: + p.join() + +# +# Class whose instances are returned by `Pool.apply_async()` +# + +class ApplyResult(object): + + def __init__(self, cache, callback): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._ready = False + self._callback = callback + cache[self._job] = self + + def ready(self): + return self._ready + + def successful(self): + assert self._ready + return self._success + + def wait(self, timeout=None): + self._cond.acquire() + try: + if not self._ready: + self._cond.wait(timeout) + finally: + self._cond.release() + + def get(self, timeout=None): + self.wait(timeout) + if not self._ready: + raise TimeoutError + if self._success: + return self._value + else: + raise self._value + + def _set(self, i, obj): + self._success, self._value = obj + if self._callback and self._success: + self._callback(self._value) + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + del self._cache[self._job] + +# +# Class whose instances are returned by `Pool.map_async()` +# + +class MapResult(ApplyResult): + + def __init__(self, cache, chunksize, length, callback): + ApplyResult.__init__(self, cache, callback) + self._success = True + self._value = [None] * length + self._chunksize = chunksize + if chunksize <= 0: + self._number_left = 0 + self._ready = True + else: + self._number_left = length//chunksize + bool(length % chunksize) + + def _set(self, i, success_result): + success, result = success_result + if success: + self._value[i*self._chunksize:(i+1)*self._chunksize] = result + self._number_left -= 1 + if self._number_left == 0: + if self._callback: + self._callback(self._value) + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + + else: + self._success = False + self._value = result + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap()` +# + +class IMapIterator(object): + + def __init__(self, cache): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._items = collections.deque() + self._index = 0 + self._length = None + self._unsorted = {} + cache[self._job] = self + + def __iter__(self): + return self + + def next(self, timeout=None): + self._cond.acquire() + try: + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + self._cond.wait(timeout) + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + raise TimeoutError + finally: + self._cond.release() + + success, value = item + if success: + return value + raise value + + __next__ = next # XXX + + def _set(self, i, obj): + self._cond.acquire() + try: + if self._index == i: + self._items.append(obj) + self._index += 1 + while self._index in self._unsorted: + obj = self._unsorted.pop(self._index) + self._items.append(obj) + self._index += 1 + self._cond.notify() + else: + self._unsorted[i] = obj + + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + + def _set_length(self, length): + self._cond.acquire() + try: + self._length = length + if self._index == self._length: + self._cond.notify() + del self._cache[self._job] + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap_unordered()` +# + +class IMapUnorderedIterator(IMapIterator): + + def _set(self, i, obj): + self._cond.acquire() + try: + self._items.append(obj) + self._index += 1 + self._cond.notify() + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + +# +# +# + +class ThreadPool(Pool): + + from .dummy import Process + + def __init__(self, processes=None, initializer=None, initargs=()): + Pool.__init__(self, processes, initializer, initargs) + + def _setup_queues(self): + self._inqueue = Queue.Queue() + self._outqueue = Queue.Queue() + self._quick_put = self._inqueue.put + self._quick_get = self._outqueue.get + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # put sentinels at head of inqueue to make workers finish + inqueue.not_empty.acquire() + try: + inqueue.queue.clear() + inqueue.queue.extend([None] * size) + inqueue.not_empty.notify_all() + finally: + inqueue.not_empty.release() Modified: python/trunk/Lib/multiprocessing/process.py ============================================================================== --- python/trunk/Lib/multiprocessing/process.py (original) +++ python/trunk/Lib/multiprocessing/process.py Fri Jun 13 21:20:48 2008 @@ -1,302 +1,302 @@ -# -# Module providing the `Process` class which emulates `threading.Thread` -# -# multiprocessing/process.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Process', 'current_process', 'active_children'] - -# -# Imports -# - -import os -import sys -import signal -import itertools - -# -# -# - -try: - ORIGINAL_DIR = os.path.abspath(os.getcwd()) -except OSError: - ORIGINAL_DIR = None - -try: - bytes -except NameError: - bytes = str # XXX not needed in Py2.6 and Py3.0 - -# -# Public functions -# - -def current_process(): - ''' - Return process object representing the current process - ''' - return _current_process - -def active_children(): - ''' - Return list of process objects corresponding to live child processes - ''' - _cleanup() - return list(_current_process._children) - -# -# -# - -def _cleanup(): - # check for processes which have finished - for p in list(_current_process._children): - if p._popen.poll() is not None: - _current_process._children.discard(p) - -# -# The `Process` class -# - -class Process(object): - ''' - Process objects represent activity that is run in a separate process - - The class is analagous to `threading.Thread` - ''' - _Popen = None - - def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): - assert group is None, 'group argument must be None for now' - count = _current_process._counter.next() - self._identity = _current_process._identity + (count,) - self._authkey = _current_process._authkey - self._daemonic = _current_process._daemonic - self._tempdir = _current_process._tempdir - self._parent_pid = os.getpid() - self._popen = None - self._target = target - self._args = tuple(args) - self._kwargs = dict(kwargs) - self._name = name or type(self).__name__ + '-' + \ - ':'.join(str(i) for i in self._identity) - - def run(self): - ''' - Method to be run in sub-process; can be overridden in sub-class - ''' - if self._target: - self._target(*self._args, **self._kwargs) - - def start(self): - ''' - Start child process - ''' - assert self._popen is None, 'cannot start a process twice' - assert self._parent_pid == os.getpid(), \ - 'can only start a process object created by current process' - assert not _current_process._daemonic, \ - 'daemonic processes are not allowed to have children' - _cleanup() - if self._Popen is not None: - Popen = self._Popen - else: - from .forking import Popen - self._popen = Popen(self) - _current_process._children.add(self) - - def terminate(self): - ''' - Terminate process; sends SIGTERM signal or uses TerminateProcess() - ''' - self._popen.terminate() - - def join(self, timeout=None): - ''' - Wait until child process terminates - ''' - assert self._parent_pid == os.getpid(), 'can only join a child process' - assert self._popen is not None, 'can only join a started process' - res = self._popen.wait(timeout) - if res is not None: - _current_process._children.discard(self) - - def is_alive(self): - ''' - Return whether process is alive - ''' - if self is _current_process: - return True - assert self._parent_pid == os.getpid(), 'can only test a child process' - if self._popen is None: - return False - self._popen.poll() - return self._popen.returncode is None - - def get_name(self): - ''' - Return name of process - ''' - return self._name - - def set_name(self, name): - ''' - Set name of process - ''' - assert isinstance(name, str), 'name must be a string' - self._name = name - - def is_daemon(self): - ''' - Return whether process is a daemon - ''' - return self._daemonic - - def set_daemon(self, daemonic): - ''' - Set whether process is a daemon - ''' - assert self._popen is None, 'process has already started' - self._daemonic = daemonic - - def get_authkey(self): - ''' - Return authorization key of process - ''' - return self._authkey - - def set_authkey(self, authkey): - ''' - Set authorization key of process - ''' - self._authkey = AuthenticationString(authkey) - - def get_exitcode(self): - ''' - Return exit code of process or `None` if it has yet to stop - ''' - if self._popen is None: - return self._popen - return self._popen.poll() - - def get_ident(self): - ''' - Return indentifier (PID) of process or `None` if it has yet to start - ''' - if self is _current_process: - return os.getpid() - else: - return self._popen and self._popen.pid - - pid = property(get_ident) - - def __repr__(self): - if self is _current_process: - status = 'started' - elif self._parent_pid != os.getpid(): - status = 'unknown' - elif self._popen is None: - status = 'initial' - else: - if self._popen.poll() is not None: - status = self.get_exitcode() - else: - status = 'started' - - if type(status) is int: - if status == 0: - status = 'stopped' - else: - status = 'stopped[%s]' % _exitcode_to_name.get(status, status) - - return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, - status, self._daemonic and ' daemon' or '') - - ## - - def _bootstrap(self): - from . import util - global _current_process - - try: - self._children = set() - self._counter = itertools.count(1) - try: - os.close(sys.stdin.fileno()) - except (OSError, ValueError): - pass - _current_process = self - util._finalizer_registry.clear() - util._run_after_forkers() - util.info('child process calling self.run()') - try: - self.run() - exitcode = 0 - finally: - util._exit_function() - except SystemExit, e: - if not e.args: - exitcode = 1 - elif type(e.args[0]) is int: - exitcode = e.args[0] - else: - sys.stderr.write(e.args[0] + '\n') - sys.stderr.flush() - exitcode = 1 - except: - exitcode = 1 - import traceback - sys.stderr.write('Process %s:\n' % self.get_name()) - sys.stderr.flush() - traceback.print_exc() - - util.info('process exiting with exitcode %d' % exitcode) - return exitcode - -# -# We subclass bytes to avoid accidental transmission of auth keys over network -# - -class AuthenticationString(bytes): - def __reduce__(self): - from .forking import Popen - if not Popen.thread_is_spawning(): - raise TypeError( - 'Pickling an AuthenticationString object is ' - 'disallowed for security reasons' - ) - return AuthenticationString, (bytes(self),) - -# -# Create object representing the main process -# - -class _MainProcess(Process): - - def __init__(self): - self._identity = () - self._daemonic = False - self._name = 'MainProcess' - self._parent_pid = None - self._popen = None - self._counter = itertools.count(1) - self._children = set() - self._authkey = AuthenticationString(os.urandom(32)) - self._tempdir = None - -_current_process = _MainProcess() -del _MainProcess - -# -# Give names to some return codes -# - -_exitcode_to_name = {} - -for name, signum in signal.__dict__.items(): - if name[:3]=='SIG' and '_' not in name: - _exitcode_to_name[-signum] = name +# +# Module providing the `Process` class which emulates `threading.Thread` +# +# multiprocessing/process.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Process', 'current_process', 'active_children'] + +# +# Imports +# + +import os +import sys +import signal +import itertools + +# +# +# + +try: + ORIGINAL_DIR = os.path.abspath(os.getcwd()) +except OSError: + ORIGINAL_DIR = None + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Public functions +# + +def current_process(): + ''' + Return process object representing the current process + ''' + return _current_process + +def active_children(): + ''' + Return list of process objects corresponding to live child processes + ''' + _cleanup() + return list(_current_process._children) + +# +# +# + +def _cleanup(): + # check for processes which have finished + for p in list(_current_process._children): + if p._popen.poll() is not None: + _current_process._children.discard(p) + +# +# The `Process` class +# + +class Process(object): + ''' + Process objects represent activity that is run in a separate process + + The class is analagous to `threading.Thread` + ''' + _Popen = None + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + assert group is None, 'group argument must be None for now' + count = _current_process._counter.next() + self._identity = _current_process._identity + (count,) + self._authkey = _current_process._authkey + self._daemonic = _current_process._daemonic + self._tempdir = _current_process._tempdir + self._parent_pid = os.getpid() + self._popen = None + self._target = target + self._args = tuple(args) + self._kwargs = dict(kwargs) + self._name = name or type(self).__name__ + '-' + \ + ':'.join(str(i) for i in self._identity) + + def run(self): + ''' + Method to be run in sub-process; can be overridden in sub-class + ''' + if self._target: + self._target(*self._args, **self._kwargs) + + def start(self): + ''' + Start child process + ''' + assert self._popen is None, 'cannot start a process twice' + assert self._parent_pid == os.getpid(), \ + 'can only start a process object created by current process' + assert not _current_process._daemonic, \ + 'daemonic processes are not allowed to have children' + _cleanup() + if self._Popen is not None: + Popen = self._Popen + else: + from .forking import Popen + self._popen = Popen(self) + _current_process._children.add(self) + + def terminate(self): + ''' + Terminate process; sends SIGTERM signal or uses TerminateProcess() + ''' + self._popen.terminate() + + def join(self, timeout=None): + ''' + Wait until child process terminates + ''' + assert self._parent_pid == os.getpid(), 'can only join a child process' + assert self._popen is not None, 'can only join a started process' + res = self._popen.wait(timeout) + if res is not None: + _current_process._children.discard(self) + + def is_alive(self): + ''' + Return whether process is alive + ''' + if self is _current_process: + return True + assert self._parent_pid == os.getpid(), 'can only test a child process' + if self._popen is None: + return False + self._popen.poll() + return self._popen.returncode is None + + def get_name(self): + ''' + Return name of process + ''' + return self._name + + def set_name(self, name): + ''' + Set name of process + ''' + assert isinstance(name, str), 'name must be a string' + self._name = name + + def is_daemon(self): + ''' + Return whether process is a daemon + ''' + return self._daemonic + + def set_daemon(self, daemonic): + ''' + Set whether process is a daemon + ''' + assert self._popen is None, 'process has already started' + self._daemonic = daemonic + + def get_authkey(self): + ''' + Return authorization key of process + ''' + return self._authkey + + def set_authkey(self, authkey): + ''' + Set authorization key of process + ''' + self._authkey = AuthenticationString(authkey) + + def get_exitcode(self): + ''' + Return exit code of process or `None` if it has yet to stop + ''' + if self._popen is None: + return self._popen + return self._popen.poll() + + def get_ident(self): + ''' + Return indentifier (PID) of process or `None` if it has yet to start + ''' + if self is _current_process: + return os.getpid() + else: + return self._popen and self._popen.pid + + pid = property(get_ident) + + def __repr__(self): + if self is _current_process: + status = 'started' + elif self._parent_pid != os.getpid(): + status = 'unknown' + elif self._popen is None: + status = 'initial' + else: + if self._popen.poll() is not None: + status = self.get_exitcode() + else: + status = 'started' + + if type(status) is int: + if status == 0: + status = 'stopped' + else: + status = 'stopped[%s]' % _exitcode_to_name.get(status, status) + + return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, + status, self._daemonic and ' daemon' or '') + + ## + + def _bootstrap(self): + from . import util + global _current_process + + try: + self._children = set() + self._counter = itertools.count(1) + try: + os.close(sys.stdin.fileno()) + except (OSError, ValueError): + pass + _current_process = self + util._finalizer_registry.clear() + util._run_after_forkers() + util.info('child process calling self.run()') + try: + self.run() + exitcode = 0 + finally: + util._exit_function() + except SystemExit, e: + if not e.args: + exitcode = 1 + elif type(e.args[0]) is int: + exitcode = e.args[0] + else: + sys.stderr.write(e.args[0] + '\n') + sys.stderr.flush() + exitcode = 1 + except: + exitcode = 1 + import traceback + sys.stderr.write('Process %s:\n' % self.get_name()) + sys.stderr.flush() + traceback.print_exc() + + util.info('process exiting with exitcode %d' % exitcode) + return exitcode + +# +# We subclass bytes to avoid accidental transmission of auth keys over network +# + +class AuthenticationString(bytes): + def __reduce__(self): + from .forking import Popen + if not Popen.thread_is_spawning(): + raise TypeError( + 'Pickling an AuthenticationString object is ' + 'disallowed for security reasons' + ) + return AuthenticationString, (bytes(self),) + +# +# Create object representing the main process +# + +class _MainProcess(Process): + + def __init__(self): + self._identity = () + self._daemonic = False + self._name = 'MainProcess' + self._parent_pid = None + self._popen = None + self._counter = itertools.count(1) + self._children = set() + self._authkey = AuthenticationString(os.urandom(32)) + self._tempdir = None + +_current_process = _MainProcess() +del _MainProcess + +# +# Give names to some return codes +# + +_exitcode_to_name = {} + +for name, signum in signal.__dict__.items(): + if name[:3]=='SIG' and '_' not in name: + _exitcode_to_name[-signum] = name Modified: python/trunk/Lib/multiprocessing/queues.py ============================================================================== --- python/trunk/Lib/multiprocessing/queues.py (original) +++ python/trunk/Lib/multiprocessing/queues.py Fri Jun 13 21:20:48 2008 @@ -1,356 +1,356 @@ -# -# Module implementing queues -# -# multiprocessing/queues.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Queue', 'SimpleQueue'] - -import sys -import os -import threading -import collections -import time -import atexit -import weakref - -from Queue import Empty, Full -import _multiprocessing -from multiprocessing import Pipe -from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition -from multiprocessing.util import debug, info, Finalize, register_after_fork -from multiprocessing.forking import assert_spawning - -# -# Queue type using a pipe, buffer and thread -# - -class Queue(object): - - def __init__(self, maxsize=0): - if maxsize <= 0: - maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX - self._maxsize = maxsize - self._reader, self._writer = Pipe(duplex=False) - self._rlock = Lock() - self._opid = os.getpid() - if sys.platform == 'win32': - self._wlock = None - else: - self._wlock = Lock() - self._sem = BoundedSemaphore(maxsize) - - self._after_fork() - - if sys.platform != 'win32': - register_after_fork(self, Queue._after_fork) - - def __getstate__(self): - assert_spawning(self) - return (self._maxsize, self._reader, self._writer, - self._rlock, self._wlock, self._sem, self._opid) - - def __setstate__(self, state): - (self._maxsize, self._reader, self._writer, - self._rlock, self._wlock, self._sem, self._opid) = state - self._after_fork() - - def _after_fork(self): - debug('Queue._after_fork()') - self._notempty = threading.Condition(threading.Lock()) - self._buffer = collections.deque() - self._thread = None - self._jointhread = None - self._joincancelled = False - self._closed = False - self._close = None - self._send = self._writer.send - self._recv = self._reader.recv - self._poll = self._reader.poll - - def put(self, obj, block=True, timeout=None): - assert not self._closed - if not self._sem.acquire(block, timeout): - raise Full - - self._notempty.acquire() - try: - if self._thread is None: - self._start_thread() - self._buffer.append(obj) - self._notempty.notify() - finally: - self._notempty.release() - - def get(self, block=True, timeout=None): - if block and timeout is None: - self._rlock.acquire() - try: - res = self._recv() - self._sem.release() - return res - finally: - self._rlock.release() - - else: - if block: - deadline = time.time() + timeout - if not self._rlock.acquire(block, timeout): - raise Empty - try: - if not self._poll(block and (deadline-time.time()) or 0.0): - raise Empty - res = self._recv() - self._sem.release() - return res - finally: - self._rlock.release() - - def qsize(self): - # Raises NotImplementError on Mac OSX because of broken sem_getvalue() - return self._maxsize - self._sem._semlock._get_value() - - def empty(self): - return not self._poll() - - def full(self): - return self._sem._semlock._is_zero() - - def get_nowait(self): - return self.get(False) - - def put_nowait(self, obj): - return self.put(obj, False) - - def close(self): - self._closed = True - self._reader.close() - if self._close: - self._close() - - def join_thread(self): - debug('Queue.join_thread()') - assert self._closed - if self._jointhread: - self._jointhread() - - def cancel_join_thread(self): - debug('Queue.cancel_join_thread()') - self._joincancelled = True - try: - self._jointhread.cancel() - except AttributeError: - pass - - def _start_thread(self): - debug('Queue._start_thread()') - - # Start thread which transfers data from buffer to pipe - self._buffer.clear() - self._thread = threading.Thread( - target=Queue._feed, - args=(self._buffer, self._notempty, self._send, - self._wlock, self._writer.close), - name='QueueFeederThread' - ) - self._thread.set_daemon(True) - - debug('doing self._thread.start()') - self._thread.start() - debug('... done self._thread.start()') - - # On process exit we will wait for data to be flushed to pipe. - # - # However, if this process created the queue then all - # processes which use the queue will be descendants of this - # process. Therefore waiting for the queue to be flushed - # is pointless once all the child processes have been joined. - created_by_this_process = (self._opid == os.getpid()) - if not self._joincancelled and not created_by_this_process: - self._jointhread = Finalize( - self._thread, Queue._finalize_join, - [weakref.ref(self._thread)], - exitpriority=-5 - ) - - # Send sentinel to the thread queue object when garbage collected - self._close = Finalize( - self, Queue._finalize_close, - [self._buffer, self._notempty], - exitpriority=10 - ) - - @staticmethod - def _finalize_join(twr): - debug('joining queue thread') - thread = twr() - if thread is not None: - thread.join() - debug('... queue thread joined') - else: - debug('... queue thread already dead') - - @staticmethod - def _finalize_close(buffer, notempty): - debug('telling queue thread to quit') - notempty.acquire() - try: - buffer.append(_sentinel) - notempty.notify() - finally: - notempty.release() - - @staticmethod - def _feed(buffer, notempty, send, writelock, close): - debug('starting thread to feed data to pipe') - from .util import is_exiting - - nacquire = notempty.acquire - nrelease = notempty.release - nwait = notempty.wait - bpopleft = buffer.popleft - sentinel = _sentinel - if sys.platform != 'win32': - wacquire = writelock.acquire - wrelease = writelock.release - else: - wacquire = None - - try: - while 1: - nacquire() - try: - if not buffer: - nwait() - finally: - nrelease() - try: - while 1: - obj = bpopleft() - if obj is sentinel: - debug('feeder thread got sentinel -- exiting') - close() - return - - if wacquire is None: - send(obj) - else: - wacquire() - try: - send(obj) - finally: - wrelease() - except IndexError: - pass - except Exception, e: - # Since this runs in a daemon thread the resources it uses - # may be become unusable while the process is cleaning up. - # We ignore errors which happen after the process has - # started to cleanup. - try: - if is_exiting(): - info('error in queue thread: %s', e) - else: - import traceback - traceback.print_exc() - except Exception: - pass - -_sentinel = object() - -# -# A queue type which also supports join() and task_done() methods -# -# Note that if you do not call task_done() for each finished task then -# eventually the counter's semaphore may overflow causing Bad Things -# to happen. -# - -class JoinableQueue(Queue): - - def __init__(self, maxsize=0): - Queue.__init__(self, maxsize) - self._unfinished_tasks = Semaphore(0) - self._cond = Condition() - - def __getstate__(self): - return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) - - def __setstate__(self, state): - Queue.__setstate__(self, state[:-2]) - self._cond, self._unfinished_tasks = state[-2:] - - def put(self, item, block=True, timeout=None): - Queue.put(self, item, block, timeout) - self._unfinished_tasks.release() - - def task_done(self): - self._cond.acquire() - try: - if not self._unfinished_tasks.acquire(False): - raise ValueError('task_done() called too many times') - if self._unfinished_tasks._semlock._is_zero(): - self._cond.notify_all() - finally: - self._cond.release() - - def join(self): - self._cond.acquire() - try: - if not self._unfinished_tasks._semlock._is_zero(): - self._cond.wait() - finally: - self._cond.release() - -# -# Simplified Queue type -- really just a locked pipe -# - -class SimpleQueue(object): - - def __init__(self): - self._reader, self._writer = Pipe(duplex=False) - self._rlock = Lock() - if sys.platform == 'win32': - self._wlock = None - else: - self._wlock = Lock() - self._make_methods() - - def empty(self): - return not self._reader.poll() - - def __getstate__(self): - assert_spawning(self) - return (self._reader, self._writer, self._rlock, self._wlock) - - def __setstate__(self, state): - (self._reader, self._writer, self._rlock, self._wlock) = state - self._make_methods() - - def _make_methods(self): - recv = self._reader.recv - racquire, rrelease = self._rlock.acquire, self._rlock.release - def get(): - racquire() - try: - return recv() - finally: - rrelease() - self.get = get - - if self._wlock is None: - # writes to a message oriented win32 pipe are atomic - self.put = self._writer.send - else: - send = self._writer.send - wacquire, wrelease = self._wlock.acquire, self._wlock.release - def put(obj): - wacquire() - try: - return send(obj) - finally: - wrelease() - self.put = put +# +# Module implementing queues +# +# multiprocessing/queues.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Queue', 'SimpleQueue'] + +import sys +import os +import threading +import collections +import time +import atexit +import weakref + +from Queue import Empty, Full +import _multiprocessing +from multiprocessing import Pipe +from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition +from multiprocessing.util import debug, info, Finalize, register_after_fork +from multiprocessing.forking import assert_spawning + +# +# Queue type using a pipe, buffer and thread +# + +class Queue(object): + + def __init__(self, maxsize=0): + if maxsize <= 0: + maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX + self._maxsize = maxsize + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + self._opid = os.getpid() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._sem = BoundedSemaphore(maxsize) + + self._after_fork() + + if sys.platform != 'win32': + register_after_fork(self, Queue._after_fork) + + def __getstate__(self): + assert_spawning(self) + return (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) + + def __setstate__(self, state): + (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) = state + self._after_fork() + + def _after_fork(self): + debug('Queue._after_fork()') + self._notempty = threading.Condition(threading.Lock()) + self._buffer = collections.deque() + self._thread = None + self._jointhread = None + self._joincancelled = False + self._closed = False + self._close = None + self._send = self._writer.send + self._recv = self._reader.recv + self._poll = self._reader.poll + + def put(self, obj, block=True, timeout=None): + assert not self._closed + if not self._sem.acquire(block, timeout): + raise Full + + self._notempty.acquire() + try: + if self._thread is None: + self._start_thread() + self._buffer.append(obj) + self._notempty.notify() + finally: + self._notempty.release() + + def get(self, block=True, timeout=None): + if block and timeout is None: + self._rlock.acquire() + try: + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + else: + if block: + deadline = time.time() + timeout + if not self._rlock.acquire(block, timeout): + raise Empty + try: + if not self._poll(block and (deadline-time.time()) or 0.0): + raise Empty + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + def qsize(self): + # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + return self._maxsize - self._sem._semlock._get_value() + + def empty(self): + return not self._poll() + + def full(self): + return self._sem._semlock._is_zero() + + def get_nowait(self): + return self.get(False) + + def put_nowait(self, obj): + return self.put(obj, False) + + def close(self): + self._closed = True + self._reader.close() + if self._close: + self._close() + + def join_thread(self): + debug('Queue.join_thread()') + assert self._closed + if self._jointhread: + self._jointhread() + + def cancel_join_thread(self): + debug('Queue.cancel_join_thread()') + self._joincancelled = True + try: + self._jointhread.cancel() + except AttributeError: + pass + + def _start_thread(self): + debug('Queue._start_thread()') + + # Start thread which transfers data from buffer to pipe + self._buffer.clear() + self._thread = threading.Thread( + target=Queue._feed, + args=(self._buffer, self._notempty, self._send, + self._wlock, self._writer.close), + name='QueueFeederThread' + ) + self._thread.set_daemon(True) + + debug('doing self._thread.start()') + self._thread.start() + debug('... done self._thread.start()') + + # On process exit we will wait for data to be flushed to pipe. + # + # However, if this process created the queue then all + # processes which use the queue will be descendants of this + # process. Therefore waiting for the queue to be flushed + # is pointless once all the child processes have been joined. + created_by_this_process = (self._opid == os.getpid()) + if not self._joincancelled and not created_by_this_process: + self._jointhread = Finalize( + self._thread, Queue._finalize_join, + [weakref.ref(self._thread)], + exitpriority=-5 + ) + + # Send sentinel to the thread queue object when garbage collected + self._close = Finalize( + self, Queue._finalize_close, + [self._buffer, self._notempty], + exitpriority=10 + ) + + @staticmethod + def _finalize_join(twr): + debug('joining queue thread') + thread = twr() + if thread is not None: + thread.join() + debug('... queue thread joined') + else: + debug('... queue thread already dead') + + @staticmethod + def _finalize_close(buffer, notempty): + debug('telling queue thread to quit') + notempty.acquire() + try: + buffer.append(_sentinel) + notempty.notify() + finally: + notempty.release() + + @staticmethod + def _feed(buffer, notempty, send, writelock, close): + debug('starting thread to feed data to pipe') + from .util import is_exiting + + nacquire = notempty.acquire + nrelease = notempty.release + nwait = notempty.wait + bpopleft = buffer.popleft + sentinel = _sentinel + if sys.platform != 'win32': + wacquire = writelock.acquire + wrelease = writelock.release + else: + wacquire = None + + try: + while 1: + nacquire() + try: + if not buffer: + nwait() + finally: + nrelease() + try: + while 1: + obj = bpopleft() + if obj is sentinel: + debug('feeder thread got sentinel -- exiting') + close() + return + + if wacquire is None: + send(obj) + else: + wacquire() + try: + send(obj) + finally: + wrelease() + except IndexError: + pass + except Exception, e: + # Since this runs in a daemon thread the resources it uses + # may be become unusable while the process is cleaning up. + # We ignore errors which happen after the process has + # started to cleanup. + try: + if is_exiting(): + info('error in queue thread: %s', e) + else: + import traceback + traceback.print_exc() + except Exception: + pass + +_sentinel = object() + +# +# A queue type which also supports join() and task_done() methods +# +# Note that if you do not call task_done() for each finished task then +# eventually the counter's semaphore may overflow causing Bad Things +# to happen. +# + +class JoinableQueue(Queue): + + def __init__(self, maxsize=0): + Queue.__init__(self, maxsize) + self._unfinished_tasks = Semaphore(0) + self._cond = Condition() + + def __getstate__(self): + return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) + + def __setstate__(self, state): + Queue.__setstate__(self, state[:-2]) + self._cond, self._unfinished_tasks = state[-2:] + + def put(self, item, block=True, timeout=None): + Queue.put(self, item, block, timeout) + self._unfinished_tasks.release() + + def task_done(self): + self._cond.acquire() + try: + if not self._unfinished_tasks.acquire(False): + raise ValueError('task_done() called too many times') + if self._unfinished_tasks._semlock._is_zero(): + self._cond.notify_all() + finally: + self._cond.release() + + def join(self): + self._cond.acquire() + try: + if not self._unfinished_tasks._semlock._is_zero(): + self._cond.wait() + finally: + self._cond.release() + +# +# Simplified Queue type -- really just a locked pipe +# + +class SimpleQueue(object): + + def __init__(self): + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._make_methods() + + def empty(self): + return not self._reader.poll() + + def __getstate__(self): + assert_spawning(self) + return (self._reader, self._writer, self._rlock, self._wlock) + + def __setstate__(self, state): + (self._reader, self._writer, self._rlock, self._wlock) = state + self._make_methods() + + def _make_methods(self): + recv = self._reader.recv + racquire, rrelease = self._rlock.acquire, self._rlock.release + def get(): + racquire() + try: + return recv() + finally: + rrelease() + self.get = get + + if self._wlock is None: + # writes to a message oriented win32 pipe are atomic + self.put = self._writer.send + else: + send = self._writer.send + wacquire, wrelease = self._wlock.acquire, self._wlock.release + def put(obj): + wacquire() + try: + return send(obj) + finally: + wrelease() + self.put = put Modified: python/trunk/Lib/multiprocessing/reduction.py ============================================================================== --- python/trunk/Lib/multiprocessing/reduction.py (original) +++ python/trunk/Lib/multiprocessing/reduction.py Fri Jun 13 21:20:48 2008 @@ -1,190 +1,190 @@ -# -# Module to allow connection and socket objects to be transferred -# between processes -# -# multiprocessing/reduction.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [] - -import os -import sys -import socket -import threading -import copy_reg - -import _multiprocessing -from multiprocessing import current_process -from multiprocessing.forking import Popen, duplicate, close -from multiprocessing.util import register_after_fork, debug, sub_debug -from multiprocessing.connection import Client, Listener - - -# -# -# - -if not(sys.platform == 'win32' or hasattr(_multiprocessing, 'recvfd')): - raise ImportError('pickling of connections not supported') - -# -# Platform specific definitions -# - -if sys.platform == 'win32': - import _subprocess - from ._multiprocessing import win32 - - def send_handle(conn, handle, destination_pid): - process_handle = win32.OpenProcess( - win32.PROCESS_ALL_ACCESS, False, destination_pid - ) - try: - new_handle = duplicate(handle, process_handle) - conn.send(new_handle) - finally: - close(process_handle) - - def recv_handle(conn): - return conn.recv() - -else: - def send_handle(conn, handle, destination_pid): - _multiprocessing.sendfd(conn.fileno(), handle) - - def recv_handle(conn): - return _multiprocessing.recvfd(conn.fileno()) - -# -# Support for a per-process server thread which caches pickled handles -# - -_cache = set() - -def _reset(obj): - global _lock, _listener, _cache - for h in _cache: - close(h) - _cache.clear() - _lock = threading.Lock() - _listener = None - -_reset(None) -register_after_fork(_reset, _reset) - -def _get_listener(): - global _listener - - if _listener is None: - _lock.acquire() - try: - if _listener is None: - debug('starting listener and thread for sending handles') - _listener = Listener(authkey=current_process().get_authkey()) - t = threading.Thread(target=_serve) - t.set_daemon(True) - t.start() - finally: - _lock.release() - - return _listener - -def _serve(): - from .util import is_exiting, sub_warning - - while 1: - try: - conn = _listener.accept() - handle_wanted, destination_pid = conn.recv() - _cache.remove(handle_wanted) - send_handle(conn, handle_wanted, destination_pid) - close(handle_wanted) - conn.close() - except: - if not is_exiting(): - import traceback - sub_warning( - 'thread for sharing handles raised exception :\n' + - '-'*79 + '\n' + traceback.format_exc() + '-'*79 - ) - -# -# Functions to be used for pickling/unpickling objects with handles -# - -def reduce_handle(handle): - if Popen.thread_is_spawning(): - return (None, Popen.duplicate_for_child(handle), True) - dup_handle = duplicate(handle) - _cache.add(dup_handle) - sub_debug('reducing handle %d', handle) - return (_get_listener().address, dup_handle, False) - -def rebuild_handle(pickled_data): - address, handle, inherited = pickled_data - if inherited: - return handle - sub_debug('rebuilding handle %d', handle) - conn = Client(address, authkey=current_process().get_authkey()) - conn.send((handle, os.getpid())) - new_handle = recv_handle(conn) - conn.close() - return new_handle - -# -# Register `_multiprocessing.Connection` with `copy_reg` -# - -def reduce_connection(conn): - rh = reduce_handle(conn.fileno()) - return rebuild_connection, (rh, conn.readable, conn.writable) - -def rebuild_connection(reduced_handle, readable, writable): - handle = rebuild_handle(reduced_handle) - return _multiprocessing.Connection( - handle, readable=readable, writable=writable - ) - -copy_reg.pickle(_multiprocessing.Connection, reduce_connection) - -# -# Register `socket.socket` with `copy_reg` -# - -def fromfd(fd, family, type_, proto=0): - s = socket.fromfd(fd, family, type_, proto) - if s.__class__ is not socket.socket: - s = socket.socket(_sock=s) - return s - -def reduce_socket(s): - reduced_handle = reduce_handle(s.fileno()) - return rebuild_socket, (reduced_handle, s.family, s.type, s.proto) - -def rebuild_socket(reduced_handle, family, type_, proto): - fd = rebuild_handle(reduced_handle) - _sock = fromfd(fd, family, type_, proto) - close(fd) - return _sock - -copy_reg.pickle(socket.socket, reduce_socket) - -# -# Register `_multiprocessing.PipeConnection` with `copy_reg` -# - -if sys.platform == 'win32': - - def reduce_pipe_connection(conn): - rh = reduce_handle(conn.fileno()) - return rebuild_pipe_connection, (rh, conn.readable, conn.writable) - - def rebuild_pipe_connection(reduced_handle, readable, writable): - handle = rebuild_handle(reduced_handle) - return _multiprocessing.PipeConnection( - handle, readable=readable, writable=writable - ) - - copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) +# +# Module to allow connection and socket objects to be transferred +# between processes +# +# multiprocessing/reduction.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [] + +import os +import sys +import socket +import threading +import copy_reg + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.forking import Popen, duplicate, close +from multiprocessing.util import register_after_fork, debug, sub_debug +from multiprocessing.connection import Client, Listener + + +# +# +# + +if not(sys.platform == 'win32' or hasattr(_multiprocessing, 'recvfd')): + raise ImportError('pickling of connections not supported') + +# +# Platform specific definitions +# + +if sys.platform == 'win32': + import _subprocess + from ._multiprocessing import win32 + + def send_handle(conn, handle, destination_pid): + process_handle = win32.OpenProcess( + win32.PROCESS_ALL_ACCESS, False, destination_pid + ) + try: + new_handle = duplicate(handle, process_handle) + conn.send(new_handle) + finally: + close(process_handle) + + def recv_handle(conn): + return conn.recv() + +else: + def send_handle(conn, handle, destination_pid): + _multiprocessing.sendfd(conn.fileno(), handle) + + def recv_handle(conn): + return _multiprocessing.recvfd(conn.fileno()) + +# +# Support for a per-process server thread which caches pickled handles +# + +_cache = set() + +def _reset(obj): + global _lock, _listener, _cache + for h in _cache: + close(h) + _cache.clear() + _lock = threading.Lock() + _listener = None + +_reset(None) +register_after_fork(_reset, _reset) + +def _get_listener(): + global _listener + + if _listener is None: + _lock.acquire() + try: + if _listener is None: + debug('starting listener and thread for sending handles') + _listener = Listener(authkey=current_process().get_authkey()) + t = threading.Thread(target=_serve) + t.set_daemon(True) + t.start() + finally: + _lock.release() + + return _listener + +def _serve(): + from .util import is_exiting, sub_warning + + while 1: + try: + conn = _listener.accept() + handle_wanted, destination_pid = conn.recv() + _cache.remove(handle_wanted) + send_handle(conn, handle_wanted, destination_pid) + close(handle_wanted) + conn.close() + except: + if not is_exiting(): + import traceback + sub_warning( + 'thread for sharing handles raised exception :\n' + + '-'*79 + '\n' + traceback.format_exc() + '-'*79 + ) + +# +# Functions to be used for pickling/unpickling objects with handles +# + +def reduce_handle(handle): + if Popen.thread_is_spawning(): + return (None, Popen.duplicate_for_child(handle), True) + dup_handle = duplicate(handle) + _cache.add(dup_handle) + sub_debug('reducing handle %d', handle) + return (_get_listener().address, dup_handle, False) + +def rebuild_handle(pickled_data): + address, handle, inherited = pickled_data + if inherited: + return handle + sub_debug('rebuilding handle %d', handle) + conn = Client(address, authkey=current_process().get_authkey()) + conn.send((handle, os.getpid())) + new_handle = recv_handle(conn) + conn.close() + return new_handle + +# +# Register `_multiprocessing.Connection` with `copy_reg` +# + +def reduce_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_connection, (rh, conn.readable, conn.writable) + +def rebuild_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.Connection( + handle, readable=readable, writable=writable + ) + +copy_reg.pickle(_multiprocessing.Connection, reduce_connection) + +# +# Register `socket.socket` with `copy_reg` +# + +def fromfd(fd, family, type_, proto=0): + s = socket.fromfd(fd, family, type_, proto) + if s.__class__ is not socket.socket: + s = socket.socket(_sock=s) + return s + +def reduce_socket(s): + reduced_handle = reduce_handle(s.fileno()) + return rebuild_socket, (reduced_handle, s.family, s.type, s.proto) + +def rebuild_socket(reduced_handle, family, type_, proto): + fd = rebuild_handle(reduced_handle) + _sock = fromfd(fd, family, type_, proto) + close(fd) + return _sock + +copy_reg.pickle(socket.socket, reduce_socket) + +# +# Register `_multiprocessing.PipeConnection` with `copy_reg` +# + +if sys.platform == 'win32': + + def reduce_pipe_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_pipe_connection, (rh, conn.readable, conn.writable) + + def rebuild_pipe_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.PipeConnection( + handle, readable=readable, writable=writable + ) + + copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) Modified: python/trunk/Lib/multiprocessing/sharedctypes.py ============================================================================== --- python/trunk/Lib/multiprocessing/sharedctypes.py (original) +++ python/trunk/Lib/multiprocessing/sharedctypes.py Fri Jun 13 21:20:48 2008 @@ -1,234 +1,234 @@ -# -# Module which supports allocation of ctypes objects from shared memory -# -# multiprocessing/sharedctypes.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -import sys -import ctypes -import weakref -import copy_reg - -from multiprocessing import heap, RLock -from multiprocessing.forking import assert_spawning - -__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] - -# -# -# - -typecode_to_type = { - 'c': ctypes.c_char, 'u': ctypes.c_wchar, - 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, - 'h': ctypes.c_short, 'H': ctypes.c_ushort, - 'i': ctypes.c_int, 'I': ctypes.c_uint, - 'l': ctypes.c_long, 'L': ctypes.c_ulong, - 'f': ctypes.c_float, 'd': ctypes.c_double - } - -# -# -# - -def _new_value(type_): - size = ctypes.sizeof(type_) - wrapper = heap.BufferWrapper(size) - return rebuild_ctype(type_, wrapper, None) - -def RawValue(typecode_or_type, *args): - ''' - Returns a ctypes object allocated from shared memory - ''' - type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) - obj = _new_value(type_) - ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) - obj.__init__(*args) - return obj - -def RawArray(typecode_or_type, size_or_initializer): - ''' - Returns a ctypes array allocated from shared memory - ''' - type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) - if isinstance(size_or_initializer, int): - type_ = type_ * size_or_initializer - return _new_value(type_) - else: - type_ = type_ * len(size_or_initializer) - result = _new_value(type_) - result.__init__(*size_or_initializer) - return result - -def Value(typecode_or_type, *args, **kwds): - ''' - Return a synchronization wrapper for a Value - ''' - lock = kwds.pop('lock', None) - if kwds: - raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) - obj = RawValue(typecode_or_type, *args) - if lock is None: - lock = RLock() - assert hasattr(lock, 'acquire') - return synchronized(obj, lock) - -def Array(typecode_or_type, size_or_initializer, **kwds): - ''' - Return a synchronization wrapper for a RawArray - ''' - lock = kwds.pop('lock', None) - if kwds: - raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) - obj = RawArray(typecode_or_type, size_or_initializer) - if lock is None: - lock = RLock() - assert hasattr(lock, 'acquire') - return synchronized(obj, lock) - -def copy(obj): - new_obj = _new_value(type(obj)) - ctypes.pointer(new_obj)[0] = obj - return new_obj - -def synchronized(obj, lock=None): - assert not isinstance(obj, SynchronizedBase), 'object already synchronized' - - if isinstance(obj, ctypes._SimpleCData): - return Synchronized(obj, lock) - elif isinstance(obj, ctypes.Array): - if obj._type_ is ctypes.c_char: - return SynchronizedString(obj, lock) - return SynchronizedArray(obj, lock) - else: - cls = type(obj) - try: - scls = class_cache[cls] - except KeyError: - names = [field[0] for field in cls._fields_] - d = dict((name, make_property(name)) for name in names) - classname = 'Synchronized' + cls.__name__ - scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) - return scls(obj, lock) - -# -# Functions for pickling/unpickling -# - -def reduce_ctype(obj): - assert_spawning(obj) - if isinstance(obj, ctypes.Array): - return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) - else: - return rebuild_ctype, (type(obj), obj._wrapper, None) - -def rebuild_ctype(type_, wrapper, length): - if length is not None: - type_ = type_ * length - if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table: - copy_reg.pickle(type_, reduce_ctype) - obj = type_.from_address(wrapper.get_address()) - obj._wrapper = wrapper - return obj - -# -# Function to create properties -# - -def make_property(name): - try: - return prop_cache[name] - except KeyError: - d = {} - exec template % ((name,)*7) in d - prop_cache[name] = d[name] - return d[name] - -template = ''' -def get%s(self): - self.acquire() - try: - return self._obj.%s - finally: - self.release() -def set%s(self, value): - self.acquire() - try: - self._obj.%s = value - finally: - self.release() -%s = property(get%s, set%s) -''' - -prop_cache = {} -class_cache = weakref.WeakKeyDictionary() - -# -# Synchronized wrappers -# - -class SynchronizedBase(object): - - def __init__(self, obj, lock=None): - self._obj = obj - self._lock = lock or RLock() - self.acquire = self._lock.acquire - self.release = self._lock.release - - def __reduce__(self): - assert_spawning(self) - return synchronized, (self._obj, self._lock) - - def get_obj(self): - return self._obj - - def get_lock(self): - return self._lock - - def __repr__(self): - return '<%s wrapper for %s>' % (type(self).__name__, self._obj) - - -class Synchronized(SynchronizedBase): - value = make_property('value') - - -class SynchronizedArray(SynchronizedBase): - - def __len__(self): - return len(self._obj) - - def __getitem__(self, i): - self.acquire() - try: - return self._obj[i] - finally: - self.release() - - def __setitem__(self, i, value): - self.acquire() - try: - self._obj[i] = value - finally: - self.release() - - def __getslice__(self, start, stop): - self.acquire() - try: - return self._obj[start:stop] - finally: - self.release() - - def __setslice__(self, start, stop, values): - self.acquire() - try: - self._obj[start:stop] = values - finally: - self.release() - - -class SynchronizedString(SynchronizedArray): - value = make_property('value') - raw = make_property('raw') +# +# Module which supports allocation of ctypes objects from shared memory +# +# multiprocessing/sharedctypes.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import sys +import ctypes +import weakref +import copy_reg + +from multiprocessing import heap, RLock +from multiprocessing.forking import assert_spawning + +__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] + +# +# +# + +typecode_to_type = { + 'c': ctypes.c_char, 'u': ctypes.c_wchar, + 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, + 'h': ctypes.c_short, 'H': ctypes.c_ushort, + 'i': ctypes.c_int, 'I': ctypes.c_uint, + 'l': ctypes.c_long, 'L': ctypes.c_ulong, + 'f': ctypes.c_float, 'd': ctypes.c_double + } + +# +# +# + +def _new_value(type_): + size = ctypes.sizeof(type_) + wrapper = heap.BufferWrapper(size) + return rebuild_ctype(type_, wrapper, None) + +def RawValue(typecode_or_type, *args): + ''' + Returns a ctypes object allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + obj = _new_value(type_) + ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) + obj.__init__(*args) + return obj + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a ctypes array allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + if isinstance(size_or_initializer, int): + type_ = type_ * size_or_initializer + return _new_value(type_) + else: + type_ = type_ * len(size_or_initializer) + result = _new_value(type_) + result.__init__(*size_or_initializer) + return result + +def Value(typecode_or_type, *args, **kwds): + ''' + Return a synchronization wrapper for a Value + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawValue(typecode_or_type, *args) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Return a synchronization wrapper for a RawArray + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawArray(typecode_or_type, size_or_initializer) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def copy(obj): + new_obj = _new_value(type(obj)) + ctypes.pointer(new_obj)[0] = obj + return new_obj + +def synchronized(obj, lock=None): + assert not isinstance(obj, SynchronizedBase), 'object already synchronized' + + if isinstance(obj, ctypes._SimpleCData): + return Synchronized(obj, lock) + elif isinstance(obj, ctypes.Array): + if obj._type_ is ctypes.c_char: + return SynchronizedString(obj, lock) + return SynchronizedArray(obj, lock) + else: + cls = type(obj) + try: + scls = class_cache[cls] + except KeyError: + names = [field[0] for field in cls._fields_] + d = dict((name, make_property(name)) for name in names) + classname = 'Synchronized' + cls.__name__ + scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) + return scls(obj, lock) + +# +# Functions for pickling/unpickling +# + +def reduce_ctype(obj): + assert_spawning(obj) + if isinstance(obj, ctypes.Array): + return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) + else: + return rebuild_ctype, (type(obj), obj._wrapper, None) + +def rebuild_ctype(type_, wrapper, length): + if length is not None: + type_ = type_ * length + if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table: + copy_reg.pickle(type_, reduce_ctype) + obj = type_.from_address(wrapper.get_address()) + obj._wrapper = wrapper + return obj + +# +# Function to create properties +# + +def make_property(name): + try: + return prop_cache[name] + except KeyError: + d = {} + exec template % ((name,)*7) in d + prop_cache[name] = d[name] + return d[name] + +template = ''' +def get%s(self): + self.acquire() + try: + return self._obj.%s + finally: + self.release() +def set%s(self, value): + self.acquire() + try: + self._obj.%s = value + finally: + self.release() +%s = property(get%s, set%s) +''' + +prop_cache = {} +class_cache = weakref.WeakKeyDictionary() + +# +# Synchronized wrappers +# + +class SynchronizedBase(object): + + def __init__(self, obj, lock=None): + self._obj = obj + self._lock = lock or RLock() + self.acquire = self._lock.acquire + self.release = self._lock.release + + def __reduce__(self): + assert_spawning(self) + return synchronized, (self._obj, self._lock) + + def get_obj(self): + return self._obj + + def get_lock(self): + return self._lock + + def __repr__(self): + return '<%s wrapper for %s>' % (type(self).__name__, self._obj) + + +class Synchronized(SynchronizedBase): + value = make_property('value') + + +class SynchronizedArray(SynchronizedBase): + + def __len__(self): + return len(self._obj) + + def __getitem__(self, i): + self.acquire() + try: + return self._obj[i] + finally: + self.release() + + def __setitem__(self, i, value): + self.acquire() + try: + self._obj[i] = value + finally: + self.release() + + def __getslice__(self, start, stop): + self.acquire() + try: + return self._obj[start:stop] + finally: + self.release() + + def __setslice__(self, start, stop, values): + self.acquire() + try: + self._obj[start:stop] = values + finally: + self.release() + + +class SynchronizedString(SynchronizedArray): + value = make_property('value') + raw = make_property('raw') Modified: python/trunk/Lib/multiprocessing/synchronize.py ============================================================================== --- python/trunk/Lib/multiprocessing/synchronize.py (original) +++ python/trunk/Lib/multiprocessing/synchronize.py Fri Jun 13 21:20:48 2008 @@ -1,294 +1,294 @@ -# -# Module implementing synchronization primitives -# -# multiprocessing/synchronize.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' - ] - -import threading -import os -import sys - -from time import time as _time, sleep as _sleep - -import _multiprocessing -from multiprocessing.process import current_process -from multiprocessing.util import Finalize, register_after_fork, debug -from multiprocessing.forking import assert_spawning, Popen - -# -# Constants -# - -RECURSIVE_MUTEX, SEMAPHORE = range(2) -SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX - -# -# Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` -# - -class SemLock(object): - - def __init__(self, kind, value, maxvalue): - sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) - debug('created semlock with handle %s' % sl.handle) - self._make_methods() - - if sys.platform != 'win32': - def _after_fork(obj): - obj._semlock._after_fork() - register_after_fork(self, _after_fork) - - def _make_methods(self): - self.acquire = self._semlock.acquire - self.release = self._semlock.release - self.__enter__ = self._semlock.__enter__ - self.__exit__ = self._semlock.__exit__ - - def __getstate__(self): - assert_spawning(self) - sl = self._semlock - return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue) - - def __setstate__(self, state): - self._semlock = _multiprocessing.SemLock._rebuild(*state) - debug('recreated blocker with handle %r' % state[0]) - self._make_methods() - -# -# Semaphore -# - -class Semaphore(SemLock): - - def __init__(self, value=1): - SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX) - - def get_value(self): - return self._semlock._get_value() - - def __repr__(self): - try: - value = self._semlock._get_value() - except Exception: - value = 'unknown' - return '' % value - -# -# Bounded semaphore -# - -class BoundedSemaphore(Semaphore): - - def __init__(self, value=1): - SemLock.__init__(self, SEMAPHORE, value, value) - - def __repr__(self): - try: - value = self._semlock._get_value() - except Exception: - value = 'unknown' - return '' % \ - (value, self._semlock.maxvalue) - -# -# Non-recursive lock -# - -class Lock(SemLock): - - def __init__(self): - SemLock.__init__(self, SEMAPHORE, 1, 1) - - def __repr__(self): - try: - if self._semlock._is_mine(): - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - elif self._semlock._get_value() == 1: - name = 'None' - elif self._semlock._count() > 0: - name = 'SomeOtherThread' - else: - name = 'SomeOtherProcess' - except Exception: - name = 'unknown' - return '' % name - -# -# Recursive lock -# - -class RLock(SemLock): - - def __init__(self): - SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) - - def __repr__(self): - try: - if self._semlock._is_mine(): - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - count = self._semlock._count() - elif self._semlock._get_value() == 1: - name, count = 'None', 0 - elif self._semlock._count() > 0: - name, count = 'SomeOtherThread', 'nonzero' - else: - name, count = 'SomeOtherProcess', 'nonzero' - except Exception: - name, count = 'unknown', 'unknown' - return '' % (name, count) - -# -# Condition variable -# - -class Condition(object): - - def __init__(self, lock=None): - self._lock = lock or RLock() - self._sleeping_count = Semaphore(0) - self._woken_count = Semaphore(0) - self._wait_semaphore = Semaphore(0) - self._make_methods() - - def __getstate__(self): - assert_spawning(self) - return (self._lock, self._sleeping_count, - self._woken_count, self._wait_semaphore) - - def __setstate__(self, state): - (self._lock, self._sleeping_count, - self._woken_count, self._wait_semaphore) = state - self._make_methods() - - def _make_methods(self): - self.acquire = self._lock.acquire - self.release = self._lock.release - self.__enter__ = self._lock.__enter__ - self.__exit__ = self._lock.__exit__ - - def __repr__(self): - try: - num_waiters = (self._sleeping_count._semlock._get_value() - - self._woken_count._semlock._get_value()) - except Exception: - num_waiters = 'unkown' - return '' % (self._lock, num_waiters) - - def wait(self, timeout=None): - assert self._lock._semlock._is_mine(), \ - 'must acquire() condition before using wait()' - - # indicate that this thread is going to sleep - self._sleeping_count.release() - - # release lock - count = self._lock._semlock._count() - for i in xrange(count): - self._lock.release() - - try: - # wait for notification or timeout - self._wait_semaphore.acquire(True, timeout) - finally: - # indicate that this thread has woken - self._woken_count.release() - - # reacquire lock - for i in xrange(count): - self._lock.acquire() - - def notify(self): - assert self._lock._semlock._is_mine(), 'lock is not owned' - assert not self._wait_semaphore.acquire(False) - - # to take account of timeouts since last notify() we subtract - # woken_count from sleeping_count and rezero woken_count - while self._woken_count.acquire(False): - res = self._sleeping_count.acquire(False) - assert res - - if self._sleeping_count.acquire(False): # try grabbing a sleeper - self._wait_semaphore.release() # wake up one sleeper - self._woken_count.acquire() # wait for the sleeper to wake - - # rezero _wait_semaphore in case a timeout just happened - self._wait_semaphore.acquire(False) - - def notify_all(self): - assert self._lock._semlock._is_mine(), 'lock is not owned' - assert not self._wait_semaphore.acquire(False) - - # to take account of timeouts since last notify*() we subtract - # woken_count from sleeping_count and rezero woken_count - while self._woken_count.acquire(False): - res = self._sleeping_count.acquire(False) - assert res - - sleepers = 0 - while self._sleeping_count.acquire(False): - self._wait_semaphore.release() # wake up one sleeper - sleepers += 1 - - if sleepers: - for i in xrange(sleepers): - self._woken_count.acquire() # wait for a sleeper to wake - - # rezero wait_semaphore in case some timeouts just happened - while self._wait_semaphore.acquire(False): - pass - -# -# Event -# - -class Event(object): - - def __init__(self): - self._cond = Condition(Lock()) - self._flag = Semaphore(0) - - def is_set(self): - self._cond.acquire() - try: - if self._flag.acquire(False): - self._flag.release() - return True - return False - finally: - self._cond.release() - - def set(self): - self._cond.acquire() - try: - self._flag.acquire(False) - self._flag.release() - self._cond.notify_all() - finally: - self._cond.release() - - def clear(self): - self._cond.acquire() - try: - self._flag.acquire(False) - finally: - self._cond.release() - - def wait(self, timeout=None): - self._cond.acquire() - try: - if self._flag.acquire(False): - self._flag.release() - else: - self._cond.wait(timeout) - finally: - self._cond.release() +# +# Module implementing synchronization primitives +# +# multiprocessing/synchronize.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' + ] + +import threading +import os +import sys + +from time import time as _time, sleep as _sleep + +import _multiprocessing +from multiprocessing.process import current_process +from multiprocessing.util import Finalize, register_after_fork, debug +from multiprocessing.forking import assert_spawning, Popen + +# +# Constants +# + +RECURSIVE_MUTEX, SEMAPHORE = range(2) +SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX + +# +# Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` +# + +class SemLock(object): + + def __init__(self, kind, value, maxvalue): + sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) + debug('created semlock with handle %s' % sl.handle) + self._make_methods() + + if sys.platform != 'win32': + def _after_fork(obj): + obj._semlock._after_fork() + register_after_fork(self, _after_fork) + + def _make_methods(self): + self.acquire = self._semlock.acquire + self.release = self._semlock.release + self.__enter__ = self._semlock.__enter__ + self.__exit__ = self._semlock.__exit__ + + def __getstate__(self): + assert_spawning(self) + sl = self._semlock + return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue) + + def __setstate__(self, state): + self._semlock = _multiprocessing.SemLock._rebuild(*state) + debug('recreated blocker with handle %r' % state[0]) + self._make_methods() + +# +# Semaphore +# + +class Semaphore(SemLock): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX) + + def get_value(self): + return self._semlock._get_value() + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % value + +# +# Bounded semaphore +# + +class BoundedSemaphore(Semaphore): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, value) + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % \ + (value, self._semlock.maxvalue) + +# +# Non-recursive lock +# + +class Lock(SemLock): + + def __init__(self): + SemLock.__init__(self, SEMAPHORE, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + elif self._semlock._get_value() == 1: + name = 'None' + elif self._semlock._count() > 0: + name = 'SomeOtherThread' + else: + name = 'SomeOtherProcess' + except Exception: + name = 'unknown' + return '' % name + +# +# Recursive lock +# + +class RLock(SemLock): + + def __init__(self): + SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + count = self._semlock._count() + elif self._semlock._get_value() == 1: + name, count = 'None', 0 + elif self._semlock._count() > 0: + name, count = 'SomeOtherThread', 'nonzero' + else: + name, count = 'SomeOtherProcess', 'nonzero' + except Exception: + name, count = 'unknown', 'unknown' + return '' % (name, count) + +# +# Condition variable +# + +class Condition(object): + + def __init__(self, lock=None): + self._lock = lock or RLock() + self._sleeping_count = Semaphore(0) + self._woken_count = Semaphore(0) + self._wait_semaphore = Semaphore(0) + self._make_methods() + + def __getstate__(self): + assert_spawning(self) + return (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) + + def __setstate__(self, state): + (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) = state + self._make_methods() + + def _make_methods(self): + self.acquire = self._lock.acquire + self.release = self._lock.release + self.__enter__ = self._lock.__enter__ + self.__exit__ = self._lock.__exit__ + + def __repr__(self): + try: + num_waiters = (self._sleeping_count._semlock._get_value() - + self._woken_count._semlock._get_value()) + except Exception: + num_waiters = 'unkown' + return '' % (self._lock, num_waiters) + + def wait(self, timeout=None): + assert self._lock._semlock._is_mine(), \ + 'must acquire() condition before using wait()' + + # indicate that this thread is going to sleep + self._sleeping_count.release() + + # release lock + count = self._lock._semlock._count() + for i in xrange(count): + self._lock.release() + + try: + # wait for notification or timeout + self._wait_semaphore.acquire(True, timeout) + finally: + # indicate that this thread has woken + self._woken_count.release() + + # reacquire lock + for i in xrange(count): + self._lock.acquire() + + def notify(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + if self._sleeping_count.acquire(False): # try grabbing a sleeper + self._wait_semaphore.release() # wake up one sleeper + self._woken_count.acquire() # wait for the sleeper to wake + + # rezero _wait_semaphore in case a timeout just happened + self._wait_semaphore.acquire(False) + + def notify_all(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify*() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + sleepers = 0 + while self._sleeping_count.acquire(False): + self._wait_semaphore.release() # wake up one sleeper + sleepers += 1 + + if sleepers: + for i in xrange(sleepers): + self._woken_count.acquire() # wait for a sleeper to wake + + # rezero wait_semaphore in case some timeouts just happened + while self._wait_semaphore.acquire(False): + pass + +# +# Event +# + +class Event(object): + + def __init__(self): + self._cond = Condition(Lock()) + self._flag = Semaphore(0) + + def is_set(self): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + return True + return False + finally: + self._cond.release() + + def set(self): + self._cond.acquire() + try: + self._flag.acquire(False) + self._flag.release() + self._cond.notify_all() + finally: + self._cond.release() + + def clear(self): + self._cond.acquire() + try: + self._flag.acquire(False) + finally: + self._cond.release() + + def wait(self, timeout=None): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + else: + self._cond.wait(timeout) + finally: + self._cond.release() Modified: python/trunk/Lib/multiprocessing/util.py ============================================================================== --- python/trunk/Lib/multiprocessing/util.py (original) +++ python/trunk/Lib/multiprocessing/util.py Fri Jun 13 21:20:48 2008 @@ -1,336 +1,336 @@ -# -# Module providing various facilities to other parts of the package -# -# multiprocessing/util.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -import itertools -import weakref -import copy_reg -import atexit -import threading # we want threading to install it's - # cleanup function before multiprocessing does - -from multiprocessing.process import current_process, active_children - -__all__ = [ - 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', - 'log_to_stderr', 'get_temp_dir', 'register_after_fork', - 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal' - ] - -# -# Logging -# - -NOTSET = 0 -SUBDEBUG = 5 -DEBUG = 10 -INFO = 20 -SUBWARNING = 25 - -LOGGER_NAME = 'multiprocessing' -DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' - -_logger = None -_log_to_stderr = False - -def sub_debug(msg, *args): - if _logger: - _logger.log(SUBDEBUG, msg, *args) - -def debug(msg, *args): - if _logger: - _logger.log(DEBUG, msg, *args) - -def info(msg, *args): - if _logger: - _logger.log(INFO, msg, *args) - -def sub_warning(msg, *args): - if _logger: - _logger.log(SUBWARNING, msg, *args) - -def get_logger(): - ''' - Returns logger used by multiprocessing - ''' - global _logger - - if not _logger: - import logging, atexit - - # XXX multiprocessing should cleanup before logging - if hasattr(atexit, 'unregister'): - atexit.unregister(_exit_function) - atexit.register(_exit_function) - else: - atexit._exithandlers.remove((_exit_function, (), {})) - atexit._exithandlers.append((_exit_function, (), {})) - - _check_logger_class() - _logger = logging.getLogger(LOGGER_NAME) - - return _logger - -def _check_logger_class(): - ''' - Make sure process name is recorded when loggers are used - ''' - # XXX This function is unnecessary once logging is patched - import logging - if hasattr(logging, 'multiprocessing'): - return - - logging._acquireLock() - try: - OldLoggerClass = logging.getLoggerClass() - if not getattr(OldLoggerClass, '_process_aware', False): - class ProcessAwareLogger(OldLoggerClass): - _process_aware = True - def makeRecord(self, *args, **kwds): - record = OldLoggerClass.makeRecord(self, *args, **kwds) - record.processName = current_process()._name - return record - logging.setLoggerClass(ProcessAwareLogger) - finally: - logging._releaseLock() - -def log_to_stderr(level=None): - ''' - Turn on logging and add a handler which prints to stderr - ''' - global _log_to_stderr - import logging - logger = get_logger() - formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) - handler = logging.StreamHandler() - handler.setFormatter(formatter) - logger.addHandler(handler) - if level is not None: - logger.setLevel(level) - _log_to_stderr = True - -# -# Function returning a temp directory which will be removed on exit -# - -def get_temp_dir(): - # get name of a temp directory which will be automatically cleaned up - if current_process()._tempdir is None: - import shutil, tempfile - tempdir = tempfile.mkdtemp(prefix='pymp-') - info('created temp directory %s', tempdir) - Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) - current_process()._tempdir = tempdir - return current_process()._tempdir - -# -# Support for reinitialization of objects when bootstrapping a child process -# - -_afterfork_registry = weakref.WeakValueDictionary() -_afterfork_counter = itertools.count() - -def _run_after_forkers(): - items = list(_afterfork_registry.items()) - items.sort() - for (index, ident, func), obj in items: - try: - func(obj) - except Exception, e: - info('after forker raised exception %s', e) - -def register_after_fork(obj, func): - _afterfork_registry[(_afterfork_counter.next(), id(obj), func)] = obj - -# -# Finalization using weakrefs -# - -_finalizer_registry = {} -_finalizer_counter = itertools.count() - - -class Finalize(object): - ''' - Class which supports object finalization using weakrefs - ''' - def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): - assert exitpriority is None or type(exitpriority) is int - - if obj is not None: - self._weakref = weakref.ref(obj, self) - else: - assert exitpriority is not None - - self._callback = callback - self._args = args - self._kwargs = kwargs or {} - self._key = (exitpriority, _finalizer_counter.next()) - - _finalizer_registry[self._key] = self - - def __call__(self, wr=None): - ''' - Run the callback unless it has already been called or cancelled - ''' - try: - del _finalizer_registry[self._key] - except KeyError: - sub_debug('finalizer no longer registered') - else: - sub_debug('finalizer calling %s with args %s and kwargs %s', - self._callback, self._args, self._kwargs) - res = self._callback(*self._args, **self._kwargs) - self._weakref = self._callback = self._args = \ - self._kwargs = self._key = None - return res - - def cancel(self): - ''' - Cancel finalization of the object - ''' - try: - del _finalizer_registry[self._key] - except KeyError: - pass - else: - self._weakref = self._callback = self._args = \ - self._kwargs = self._key = None - - def still_active(self): - ''' - Return whether this finalizer is still waiting to invoke callback - ''' - return self._key in _finalizer_registry - - def __repr__(self): - try: - obj = self._weakref() - except (AttributeError, TypeError): - obj = None - - if obj is None: - return '' - - x = '' - - -def _run_finalizers(minpriority=None): - ''' - Run all finalizers whose exit priority is not None and at least minpriority - - Finalizers with highest priority are called first; finalizers with - the same priority will be called in reverse order of creation. - ''' - if minpriority is None: - f = lambda p : p[0][0] is not None - else: - f = lambda p : p[0][0] is not None and p[0][0] >= minpriority - - items = [x for x in _finalizer_registry.items() if f(x)] - items.sort(reverse=True) - - for key, finalizer in items: - sub_debug('calling %s', finalizer) - try: - finalizer() - except Exception: - import traceback - traceback.print_exc() - - if minpriority is None: - _finalizer_registry.clear() - -# -# Clean up on exit -# - -def is_exiting(): - ''' - Returns true if the process is shutting down - ''' - return _exiting or _exiting is None - -_exiting = False - -def _exit_function(): - global _exiting - - info('process shutting down') - debug('running all "atexit" finalizers with priority >= 0') - _run_finalizers(0) - - for p in active_children(): - if p._daemonic: - info('calling terminate() for daemon %s', p.get_name()) - p._popen.terminate() - - for p in active_children(): - info('calling join() for process %s', p.get_name()) - p.join() - - debug('running the remaining "atexit" finalizers') - _run_finalizers() - -atexit.register(_exit_function) - -# -# Some fork aware types -# - -class ForkAwareThreadLock(object): - def __init__(self): - self._lock = threading.Lock() - self.acquire = self._lock.acquire - self.release = self._lock.release - register_after_fork(self, ForkAwareThreadLock.__init__) - -class ForkAwareLocal(threading.local): - def __init__(self): - register_after_fork(self, lambda obj : obj.__dict__.clear()) - def __reduce__(self): - return type(self), () - -# -# Try making some callable types picklable -# - -def _reduce_method(m): - if m.im_self is None: - return getattr, (m.im_class, m.im_func.func_name) - else: - return getattr, (m.im_self, m.im_func.func_name) -copy_reg.pickle(type(Finalize.__init__), _reduce_method) - -def _reduce_method_descriptor(m): - return getattr, (m.__objclass__, m.__name__) -copy_reg.pickle(type(list.append), _reduce_method_descriptor) -copy_reg.pickle(type(int.__add__), _reduce_method_descriptor) - -def _reduce_builtin_function_or_method(m): - return getattr, (m.__self__, m.__name__) -copy_reg.pickle(type(list().append), _reduce_builtin_function_or_method) -copy_reg.pickle(type(int().__add__), _reduce_builtin_function_or_method) - -try: - from functools import partial -except ImportError: - pass -else: - def _reduce_partial(p): - return _rebuild_partial, (p.func, p.args, p.keywords or {}) - def _rebuild_partial(func, args, keywords): - return partial(func, *args, **keywords) - copy_reg.pickle(partial, _reduce_partial) +# +# Module providing various facilities to other parts of the package +# +# multiprocessing/util.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import itertools +import weakref +import copy_reg +import atexit +import threading # we want threading to install it's + # cleanup function before multiprocessing does + +from multiprocessing.process import current_process, active_children + +__all__ = [ + 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', + 'log_to_stderr', 'get_temp_dir', 'register_after_fork', + 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal' + ] + +# +# Logging +# + +NOTSET = 0 +SUBDEBUG = 5 +DEBUG = 10 +INFO = 20 +SUBWARNING = 25 + +LOGGER_NAME = 'multiprocessing' +DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' + +_logger = None +_log_to_stderr = False + +def sub_debug(msg, *args): + if _logger: + _logger.log(SUBDEBUG, msg, *args) + +def debug(msg, *args): + if _logger: + _logger.log(DEBUG, msg, *args) + +def info(msg, *args): + if _logger: + _logger.log(INFO, msg, *args) + +def sub_warning(msg, *args): + if _logger: + _logger.log(SUBWARNING, msg, *args) + +def get_logger(): + ''' + Returns logger used by multiprocessing + ''' + global _logger + + if not _logger: + import logging, atexit + + # XXX multiprocessing should cleanup before logging + if hasattr(atexit, 'unregister'): + atexit.unregister(_exit_function) + atexit.register(_exit_function) + else: + atexit._exithandlers.remove((_exit_function, (), {})) + atexit._exithandlers.append((_exit_function, (), {})) + + _check_logger_class() + _logger = logging.getLogger(LOGGER_NAME) + + return _logger + +def _check_logger_class(): + ''' + Make sure process name is recorded when loggers are used + ''' + # XXX This function is unnecessary once logging is patched + import logging + if hasattr(logging, 'multiprocessing'): + return + + logging._acquireLock() + try: + OldLoggerClass = logging.getLoggerClass() + if not getattr(OldLoggerClass, '_process_aware', False): + class ProcessAwareLogger(OldLoggerClass): + _process_aware = True + def makeRecord(self, *args, **kwds): + record = OldLoggerClass.makeRecord(self, *args, **kwds) + record.processName = current_process()._name + return record + logging.setLoggerClass(ProcessAwareLogger) + finally: + logging._releaseLock() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + global _log_to_stderr + import logging + logger = get_logger() + formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) + handler = logging.StreamHandler() + handler.setFormatter(formatter) + logger.addHandler(handler) + if level is not None: + logger.setLevel(level) + _log_to_stderr = True + +# +# Function returning a temp directory which will be removed on exit +# + +def get_temp_dir(): + # get name of a temp directory which will be automatically cleaned up + if current_process()._tempdir is None: + import shutil, tempfile + tempdir = tempfile.mkdtemp(prefix='pymp-') + info('created temp directory %s', tempdir) + Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) + current_process()._tempdir = tempdir + return current_process()._tempdir + +# +# Support for reinitialization of objects when bootstrapping a child process +# + +_afterfork_registry = weakref.WeakValueDictionary() +_afterfork_counter = itertools.count() + +def _run_after_forkers(): + items = list(_afterfork_registry.items()) + items.sort() + for (index, ident, func), obj in items: + try: + func(obj) + except Exception, e: + info('after forker raised exception %s', e) + +def register_after_fork(obj, func): + _afterfork_registry[(_afterfork_counter.next(), id(obj), func)] = obj + +# +# Finalization using weakrefs +# + +_finalizer_registry = {} +_finalizer_counter = itertools.count() + + +class Finalize(object): + ''' + Class which supports object finalization using weakrefs + ''' + def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): + assert exitpriority is None or type(exitpriority) is int + + if obj is not None: + self._weakref = weakref.ref(obj, self) + else: + assert exitpriority is not None + + self._callback = callback + self._args = args + self._kwargs = kwargs or {} + self._key = (exitpriority, _finalizer_counter.next()) + + _finalizer_registry[self._key] = self + + def __call__(self, wr=None): + ''' + Run the callback unless it has already been called or cancelled + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + sub_debug('finalizer no longer registered') + else: + sub_debug('finalizer calling %s with args %s and kwargs %s', + self._callback, self._args, self._kwargs) + res = self._callback(*self._args, **self._kwargs) + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + return res + + def cancel(self): + ''' + Cancel finalization of the object + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + pass + else: + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + + def still_active(self): + ''' + Return whether this finalizer is still waiting to invoke callback + ''' + return self._key in _finalizer_registry + + def __repr__(self): + try: + obj = self._weakref() + except (AttributeError, TypeError): + obj = None + + if obj is None: + return '' + + x = '' + + +def _run_finalizers(minpriority=None): + ''' + Run all finalizers whose exit priority is not None and at least minpriority + + Finalizers with highest priority are called first; finalizers with + the same priority will be called in reverse order of creation. + ''' + if minpriority is None: + f = lambda p : p[0][0] is not None + else: + f = lambda p : p[0][0] is not None and p[0][0] >= minpriority + + items = [x for x in _finalizer_registry.items() if f(x)] + items.sort(reverse=True) + + for key, finalizer in items: + sub_debug('calling %s', finalizer) + try: + finalizer() + except Exception: + import traceback + traceback.print_exc() + + if minpriority is None: + _finalizer_registry.clear() + +# +# Clean up on exit +# + +def is_exiting(): + ''' + Returns true if the process is shutting down + ''' + return _exiting or _exiting is None + +_exiting = False + +def _exit_function(): + global _exiting + + info('process shutting down') + debug('running all "atexit" finalizers with priority >= 0') + _run_finalizers(0) + + for p in active_children(): + if p._daemonic: + info('calling terminate() for daemon %s', p.get_name()) + p._popen.terminate() + + for p in active_children(): + info('calling join() for process %s', p.get_name()) + p.join() + + debug('running the remaining "atexit" finalizers') + _run_finalizers() + +atexit.register(_exit_function) + +# +# Some fork aware types +# + +class ForkAwareThreadLock(object): + def __init__(self): + self._lock = threading.Lock() + self.acquire = self._lock.acquire + self.release = self._lock.release + register_after_fork(self, ForkAwareThreadLock.__init__) + +class ForkAwareLocal(threading.local): + def __init__(self): + register_after_fork(self, lambda obj : obj.__dict__.clear()) + def __reduce__(self): + return type(self), () + +# +# Try making some callable types picklable +# + +def _reduce_method(m): + if m.im_self is None: + return getattr, (m.im_class, m.im_func.func_name) + else: + return getattr, (m.im_self, m.im_func.func_name) +copy_reg.pickle(type(Finalize.__init__), _reduce_method) + +def _reduce_method_descriptor(m): + return getattr, (m.__objclass__, m.__name__) +copy_reg.pickle(type(list.append), _reduce_method_descriptor) +copy_reg.pickle(type(int.__add__), _reduce_method_descriptor) + +def _reduce_builtin_function_or_method(m): + return getattr, (m.__self__, m.__name__) +copy_reg.pickle(type(list().append), _reduce_builtin_function_or_method) +copy_reg.pickle(type(int().__add__), _reduce_builtin_function_or_method) + +try: + from functools import partial +except ImportError: + pass +else: + def _reduce_partial(p): + return _rebuild_partial, (p.func, p.args, p.keywords or {}) + def _rebuild_partial(func, args, keywords): + return partial(func, *args, **keywords) + copy_reg.pickle(partial, _reduce_partial) From python-checkins at python.org Fri Jun 13 21:38:19 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 13 Jun 2008 21:38:19 +0200 (CEST) Subject: [Python-checkins] r64253 - python/trunk/Doc/library/hotshot.rst Message-ID: <20080613193819.20CD51E4019@bag.python.org> Author: andrew.kuchling Date: Fri Jun 13 21:38:18 2008 New Revision: 64253 Log: Typo fixes Modified: python/trunk/Doc/library/hotshot.rst Modified: python/trunk/Doc/library/hotshot.rst ============================================================================== --- python/trunk/Doc/library/hotshot.rst (original) +++ python/trunk/Doc/library/hotshot.rst Fri Jun 13 21:38:18 2008 @@ -18,12 +18,12 @@ .. note:: The :mod:`hotshot` module focuses on minimizing the overhead while profiling, at - the expense of long data post-processing times. For common usages it is + the expense of long data post-processing times. For common usage it is recommended to use :mod:`cProfile` instead. :mod:`hotshot` is not maintained and might be removed from the standard library in the future. .. versionchanged:: 2.5 - the results should be more meaningful than in the past: the timing core + The results should be more meaningful than in the past: the timing core contained a critical bug. .. warning:: From buildbot at python.org Fri Jun 13 22:02:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 20:02:45 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080613200246.0C3E61E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1021 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Fri Jun 13 23:54:30 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jun 2008 23:54:30 +0200 (CEST) Subject: [Python-checkins] r64254 - python/trunk/PC/VS8.0/_multiprocessing.vcproj Message-ID: <20080613215430.F14271E4006@bag.python.org> Author: amaury.forgeotdarc Date: Fri Jun 13 23:54:30 2008 New Revision: 64254 Log: Add a missing file for VS2005 Added: python/trunk/PC/VS8.0/_multiprocessing.vcproj Added: python/trunk/PC/VS8.0/_multiprocessing.vcproj ============================================================================== --- (empty file) +++ python/trunk/PC/VS8.0/_multiprocessing.vcproj Fri Jun 13 23:54:30 2008 @@ -0,0 +1,568 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From g.brandl at gmx.net Fri Jun 13 23:55:07 2008 From: g.brandl at gmx.net (Georg Brandl) Date: Fri, 13 Jun 2008 23:55:07 +0200 Subject: [Python-checkins] r64248 - in python/trunk: Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/sharedctypes.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/test/test_multiprocessing.py Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/win32_functions.c In-Reply-To: <20080613191341.16ED11E4006@bag.python.org> References: <20080613191341.16ED11E4006@bag.python.org> Message-ID: benjamin.peterson schrieb: > Author: benjamin.peterson > Date: Fri Jun 13 21:13:39 2008 > New Revision: 64248 > > Log: > convert multiprocessing to unix line endings Couldn't that be done with the appropriate svn:eol-style keyword? Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. From musiccomposition at gmail.com Sat Jun 14 00:08:47 2008 From: musiccomposition at gmail.com (Benjamin Peterson) Date: Fri, 13 Jun 2008 17:08:47 -0500 Subject: [Python-checkins] r64248 - in python/trunk: Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Message-ID: <1afaf6160806131508p56b03cc9i22b47d73bfa4451f@mail.gmail.com> On Fri, Jun 13, 2008 at 4:55 PM, Georg Brandl wrote: >> Log: >> convert multiprocessing to unix line endings > > Couldn't that be done with the appropriate svn:eol-style keyword? Yes, it seems so. I was apprehensive about adding them because I didn't see them elsewhere in the repo. -- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." From buildbot at python.org Sat Jun 14 00:08:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 22:08:56 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 3.0 Message-ID: <20080613220856.58D031E4007@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%203.0/builds/535 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From martin at v.loewis.de Sat Jun 14 00:25:29 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat, 14 Jun 2008 00:25:29 +0200 Subject: [Python-checkins] r64248 - in python/trunk: Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py In-Reply-To: <1afaf6160806131508p56b03cc9i22b47d73bfa4451f@mail.gmail.com> References: <1afaf6160806131508p56b03cc9i22b47d73bfa4451f@mail.gmail.com> Message-ID: <4852F3D9.7060202@v.loewis.de> >> Couldn't that be done with the appropriate svn:eol-style keyword? > Yes, it seems so. I was apprehensive about adding them because I > didn't see them elsewhere in the repo. Hmm. *All* C files in the repository have the eol-style property, and section 3.10 in the developer FAQ says you should have auto-props enabled in your subversion config. Regards, Martin From python-checkins at python.org Sat Jun 14 00:38:38 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 00:38:38 +0200 (CEST) Subject: [Python-checkins] r64257 - in python/trunk: Doc/includes/email-alternative.py Doc/includes/mp_benchmarks.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/includes/noddy.c Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/includes/shoddy.c Doc/includes/sqlite3/ctx_manager.py Doc/includes/typestruct.h Doc/tools/sphinxext/patchlevel.py Doc/tools/sphinxext/pyspecific.py Include/bytes_methods.h Include/warnings.h Lib/ast.py Lib/bsddb/test/test_distributed_transactions.py Lib/bsddb/test/test_early_close.py Lib/bsddb/test/test_replication.py Lib/ctypes/test/test_errno.py Lib/distutils/config.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_config.py Lib/distutils/tests/test_upload.py Lib/email/test/data/msg_26.txt Lib/encodings/utf_32.py Lib/encodings/utf_32_be.py Lib/encodings/utf_32_le.py Lib/json/__init__.py Lib/json/decoder.py Lib/json/encoder.py Lib/json/scanner.py Lib/json/tests/__init__.py Lib/json/tests/test_decode.py Lib/json/tests/test_default.py Lib/json/tests/test_dump.py Lib/json/tests/test_encode_basestring_ascii.py Lib/json/tests/test_fail.py Lib/json/tests/test_float.py Lib/json/tests/test_indent.py Lib/json/tests/test_pass1.py Lib/json/tests/test_pass2.py Lib/json/tests/test_pass3.py Lib/json/tests/test_recursion.py Lib/json/tests/test_scanstring.py Lib/json/tests/test_separators.py Lib/json/tests/test_speedups.py Lib/json/tests/test_unicode.py Lib/json/tool.py Lib/lib-tk/FileDialog.py Lib/lib-tk/SimpleDialog.py Lib/lib-tk/tkFileDialog.py Lib/lib-tk/tkSimpleDialog.py Lib/lib2to3/__init__.py Lib/lib2to3/fixes/fix_execfile.py Lib/lib2to3/fixes/fix_funcattrs.py Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_itertools.py Lib/lib2to3/fixes/fix_itertools_imports.py Lib/lib2to3/fixes/fix_standarderror.py Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/fixes/fix_xreadlines.py Lib/lib2to3/fixes/fix_zip.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_parser.py Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/sharedctypes.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/numbers.py Lib/pydoc_topics.py Lib/sqlite3/dump.py Lib/sqlite3/test/dump.py Lib/sqlite3/test/py25tests.py Lib/test/buffer_tests.py Lib/test/cmath_testcases.txt Lib/test/curses_tests.py Lib/test/profilee.py Lib/test/pydoc_mod.py Lib/test/relimport.py Lib/test/test_SimpleHTTPServer.py Lib/test/test_abstract_numbers.py Lib/test/test_asyncore.py Lib/test/test_buffer.py Lib/test/test_cmd.py Lib/test/test_docxmlrpc.py Lib/test/test_fractions.py Lib/test/test_future_builtins.py Lib/test/test_httpservers.py Lib/test/test_int.py Lib/test/test_json.py Lib/test/test_memoryio.py Lib/test/test_multiprocessing.py Lib/test/test_mutex.py Lib/test/test_pipes.py Lib/test/test_print.py Lib/test/test_pstats.py Lib/test/test_pydoc.py Lib/test/test_urllib2_localnet.py Modules/_ctypes/libffi_osx/ffi.c Modules/_ctypes/libffi_osx/include/ffi.h Modules/_ctypes/libffi_osx/include/ffi_common.h Modules/_ctypes/libffi_osx/include/fficonfig.h Modules/_ctypes/libffi_osx/include/ffitarget.h Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h Modules/_ctypes/libffi_osx/include/x86-ffitarget.h Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c Modules/_ctypes/libffi_osx/types.c Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c Modules/_json.c Modules/_multiprocessing/connection.h Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/semaphore.c Modules/_multiprocessing/socket_connection.c Modules/_multiprocessing/win32_functions.c Modules/bsddb.h Modules/future_builtins.c Objects/bytes_methods.c Objects/stringlib/ctype.h Objects/stringlib/formatter.h Objects/stringlib/localeutil.h Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/stringlib/transmogrify.h Objects/stringlib/unicodedefs.h PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_ctypes.vcproj PC/VS8.0/_ctypes_test.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_hashlib.vcproj PC/VS8.0/_msi.vcproj PC/VS8.0/_socket.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/_ssl.vcproj PC/VS8.0/_testcapi.vcproj PC/VS8.0/_tkinter.vcproj PC/VS8.0/bdist_wininst.vcproj PC/VS8.0/bz2.vcproj PC/VS8.0/kill_python.c PC/VS8.0/kill_python.vcproj PC/VS8.0/make_buildinfo.vcproj PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyexpat.vcproj PC/VS8.0/python.vcproj PC/VS8.0/pythoncore.vcproj PC/VS8.0/pythonw.vcproj PC/VS8.0/select.vcproj PC/VS8.0/sqlite3.vcproj PC/VS8.0/unicodedata.vcproj PC/VS8.0/w9xpopen.vcproj PC/VS8.0/winsound.vcproj PCbuild/_bsddb44.vcproj PCbuild/_multiprocessing.vcproj PCbuild/bdist_wininst.vcproj PCbuild/kill_python.c PCbuild/kill_python.vcproj PCbuild/sqlite3.vcproj Python/formatter_string.c Python/formatter_unicode.c Tools/pybench/With.py Tools/scripts/patchcheck.py Message-ID: <20080613223838.294551E4010@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 00:38:33 2008 New Revision: 64257 Log: Run svneol.py on all sources. Modified: python/trunk/Doc/includes/email-alternative.py (props changed) python/trunk/Doc/includes/mp_benchmarks.py (props changed) python/trunk/Doc/includes/mp_newtype.py (props changed) python/trunk/Doc/includes/mp_pool.py (props changed) python/trunk/Doc/includes/mp_synchronize.py (props changed) python/trunk/Doc/includes/mp_webserver.py (props changed) python/trunk/Doc/includes/mp_workers.py (props changed) python/trunk/Doc/includes/noddy.c (props changed) python/trunk/Doc/includes/noddy2.c (props changed) python/trunk/Doc/includes/noddy3.c (props changed) python/trunk/Doc/includes/noddy4.c (props changed) python/trunk/Doc/includes/run-func.c (props changed) python/trunk/Doc/includes/shoddy.c (props changed) python/trunk/Doc/includes/sqlite3/ctx_manager.py (props changed) python/trunk/Doc/includes/typestruct.h (props changed) python/trunk/Doc/tools/sphinxext/patchlevel.py (props changed) python/trunk/Doc/tools/sphinxext/pyspecific.py (props changed) python/trunk/Include/bytes_methods.h (props changed) python/trunk/Include/warnings.h (props changed) python/trunk/Lib/ast.py (props changed) python/trunk/Lib/bsddb/test/test_distributed_transactions.py (props changed) python/trunk/Lib/bsddb/test/test_early_close.py (props changed) python/trunk/Lib/bsddb/test/test_replication.py (props changed) python/trunk/Lib/ctypes/test/test_errno.py (contents, props changed) python/trunk/Lib/distutils/config.py (props changed) python/trunk/Lib/distutils/tests/test_build_ext.py (props changed) python/trunk/Lib/distutils/tests/test_config.py (props changed) python/trunk/Lib/distutils/tests/test_upload.py (props changed) python/trunk/Lib/email/test/data/msg_26.txt (contents, props changed) python/trunk/Lib/encodings/utf_32.py (props changed) python/trunk/Lib/encodings/utf_32_be.py (props changed) python/trunk/Lib/encodings/utf_32_le.py (props changed) python/trunk/Lib/json/__init__.py (props changed) python/trunk/Lib/json/decoder.py (props changed) python/trunk/Lib/json/encoder.py (props changed) python/trunk/Lib/json/scanner.py (props changed) python/trunk/Lib/json/tests/__init__.py (props changed) python/trunk/Lib/json/tests/test_decode.py (props changed) python/trunk/Lib/json/tests/test_default.py (props changed) python/trunk/Lib/json/tests/test_dump.py (props changed) python/trunk/Lib/json/tests/test_encode_basestring_ascii.py (props changed) python/trunk/Lib/json/tests/test_fail.py (props changed) python/trunk/Lib/json/tests/test_float.py (props changed) python/trunk/Lib/json/tests/test_indent.py (props changed) python/trunk/Lib/json/tests/test_pass1.py (props changed) python/trunk/Lib/json/tests/test_pass2.py (props changed) python/trunk/Lib/json/tests/test_pass3.py (props changed) python/trunk/Lib/json/tests/test_recursion.py (props changed) python/trunk/Lib/json/tests/test_scanstring.py (props changed) python/trunk/Lib/json/tests/test_separators.py (props changed) python/trunk/Lib/json/tests/test_speedups.py (props changed) python/trunk/Lib/json/tests/test_unicode.py (props changed) python/trunk/Lib/json/tool.py (props changed) python/trunk/Lib/lib-tk/FileDialog.py (props changed) python/trunk/Lib/lib-tk/SimpleDialog.py (props changed) python/trunk/Lib/lib-tk/tkFileDialog.py (props changed) python/trunk/Lib/lib-tk/tkSimpleDialog.py (props changed) python/trunk/Lib/lib2to3/__init__.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_execfile.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_idioms.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_import.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_imports.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_itertools.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_standarderror.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_types.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_zip.py (props changed) python/trunk/Lib/lib2to3/tests/test_all_fixers.py (props changed) python/trunk/Lib/lib2to3/tests/test_parser.py (props changed) python/trunk/Lib/multiprocessing/__init__.py (props changed) python/trunk/Lib/multiprocessing/connection.py (props changed) python/trunk/Lib/multiprocessing/dummy/__init__.py (props changed) python/trunk/Lib/multiprocessing/dummy/connection.py (props changed) python/trunk/Lib/multiprocessing/forking.py (props changed) python/trunk/Lib/multiprocessing/heap.py (props changed) python/trunk/Lib/multiprocessing/managers.py (props changed) python/trunk/Lib/multiprocessing/pool.py (props changed) python/trunk/Lib/multiprocessing/process.py (props changed) python/trunk/Lib/multiprocessing/queues.py (props changed) python/trunk/Lib/multiprocessing/reduction.py (props changed) python/trunk/Lib/multiprocessing/sharedctypes.py (props changed) python/trunk/Lib/multiprocessing/synchronize.py (props changed) python/trunk/Lib/multiprocessing/util.py (props changed) python/trunk/Lib/numbers.py (props changed) python/trunk/Lib/pydoc_topics.py (props changed) python/trunk/Lib/sqlite3/dump.py (props changed) python/trunk/Lib/sqlite3/test/dump.py (props changed) python/trunk/Lib/sqlite3/test/py25tests.py (props changed) python/trunk/Lib/test/buffer_tests.py (props changed) python/trunk/Lib/test/cmath_testcases.txt (props changed) python/trunk/Lib/test/curses_tests.py (props changed) python/trunk/Lib/test/profilee.py (props changed) python/trunk/Lib/test/pydoc_mod.py (props changed) python/trunk/Lib/test/relimport.py (props changed) python/trunk/Lib/test/test_SimpleHTTPServer.py (props changed) python/trunk/Lib/test/test_abstract_numbers.py (props changed) python/trunk/Lib/test/test_asyncore.py (contents, props changed) python/trunk/Lib/test/test_buffer.py (props changed) python/trunk/Lib/test/test_cmd.py (props changed) python/trunk/Lib/test/test_docxmlrpc.py (props changed) python/trunk/Lib/test/test_fractions.py (props changed) python/trunk/Lib/test/test_future_builtins.py (props changed) python/trunk/Lib/test/test_httpservers.py (props changed) python/trunk/Lib/test/test_int.py (props changed) python/trunk/Lib/test/test_json.py (props changed) python/trunk/Lib/test/test_memoryio.py (props changed) python/trunk/Lib/test/test_multiprocessing.py (props changed) python/trunk/Lib/test/test_mutex.py (props changed) python/trunk/Lib/test/test_pipes.py (props changed) python/trunk/Lib/test/test_print.py (props changed) python/trunk/Lib/test/test_pstats.py (props changed) python/trunk/Lib/test/test_pydoc.py (props changed) python/trunk/Lib/test/test_urllib2_localnet.py (props changed) python/trunk/Modules/_ctypes/libffi_osx/ffi.c (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/ffi.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/ffi_common.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/fficonfig.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/ffitarget.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/include/x86-ffitarget.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h (props changed) python/trunk/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c (props changed) python/trunk/Modules/_ctypes/libffi_osx/types.c (props changed) python/trunk/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c (props changed) python/trunk/Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c (props changed) python/trunk/Modules/_json.c (props changed) python/trunk/Modules/_multiprocessing/connection.h (props changed) python/trunk/Modules/_multiprocessing/multiprocessing.c (props changed) python/trunk/Modules/_multiprocessing/multiprocessing.h (props changed) python/trunk/Modules/_multiprocessing/pipe_connection.c (props changed) python/trunk/Modules/_multiprocessing/semaphore.c (props changed) python/trunk/Modules/_multiprocessing/socket_connection.c (props changed) python/trunk/Modules/_multiprocessing/win32_functions.c (props changed) python/trunk/Modules/bsddb.h (props changed) python/trunk/Modules/future_builtins.c (props changed) python/trunk/Objects/bytes_methods.c (props changed) python/trunk/Objects/stringlib/ctype.h (props changed) python/trunk/Objects/stringlib/formatter.h (props changed) python/trunk/Objects/stringlib/localeutil.h (props changed) python/trunk/Objects/stringlib/string_format.h (props changed) python/trunk/Objects/stringlib/stringdefs.h (props changed) python/trunk/Objects/stringlib/transmogrify.h (props changed) python/trunk/Objects/stringlib/unicodedefs.h (props changed) python/trunk/PC/VS8.0/_bsddb.vcproj (contents, props changed) python/trunk/PC/VS8.0/_bsddb44.vcproj (contents, props changed) python/trunk/PC/VS8.0/_ctypes.vcproj (contents, props changed) python/trunk/PC/VS8.0/_ctypes_test.vcproj (contents, props changed) python/trunk/PC/VS8.0/_elementtree.vcproj (contents, props changed) python/trunk/PC/VS8.0/_hashlib.vcproj (contents, props changed) python/trunk/PC/VS8.0/_msi.vcproj (contents, props changed) python/trunk/PC/VS8.0/_socket.vcproj (contents, props changed) python/trunk/PC/VS8.0/_sqlite3.vcproj (contents, props changed) python/trunk/PC/VS8.0/_ssl.vcproj (contents, props changed) python/trunk/PC/VS8.0/_testcapi.vcproj (contents, props changed) python/trunk/PC/VS8.0/_tkinter.vcproj (contents, props changed) python/trunk/PC/VS8.0/bdist_wininst.vcproj (contents, props changed) python/trunk/PC/VS8.0/bz2.vcproj (contents, props changed) python/trunk/PC/VS8.0/kill_python.c (contents, props changed) python/trunk/PC/VS8.0/kill_python.vcproj (contents, props changed) python/trunk/PC/VS8.0/make_buildinfo.vcproj (contents, props changed) python/trunk/PC/VS8.0/make_versioninfo.vcproj (contents, props changed) python/trunk/PC/VS8.0/pcbuild.sln (contents, props changed) python/trunk/PC/VS8.0/pyexpat.vcproj (contents, props changed) python/trunk/PC/VS8.0/python.vcproj (contents, props changed) python/trunk/PC/VS8.0/pythoncore.vcproj (contents, props changed) python/trunk/PC/VS8.0/pythonw.vcproj (contents, props changed) python/trunk/PC/VS8.0/select.vcproj (contents, props changed) python/trunk/PC/VS8.0/sqlite3.vcproj (contents, props changed) python/trunk/PC/VS8.0/unicodedata.vcproj (contents, props changed) python/trunk/PC/VS8.0/w9xpopen.vcproj (contents, props changed) python/trunk/PC/VS8.0/winsound.vcproj (contents, props changed) python/trunk/PCbuild/_bsddb44.vcproj (contents, props changed) python/trunk/PCbuild/_multiprocessing.vcproj (props changed) python/trunk/PCbuild/bdist_wininst.vcproj (contents, props changed) python/trunk/PCbuild/kill_python.c (contents, props changed) python/trunk/PCbuild/kill_python.vcproj (contents, props changed) python/trunk/PCbuild/sqlite3.vcproj (contents, props changed) python/trunk/Python/formatter_string.c (props changed) python/trunk/Python/formatter_unicode.c (props changed) python/trunk/Tools/pybench/With.py (props changed) python/trunk/Tools/scripts/patchcheck.py (props changed) Modified: python/trunk/Lib/ctypes/test/test_errno.py ============================================================================== --- python/trunk/Lib/ctypes/test/test_errno.py (original) +++ python/trunk/Lib/ctypes/test/test_errno.py Sat Jun 14 00:38:33 2008 @@ -1,76 +1,76 @@ -import unittest, os, errno -from ctypes import * -from ctypes.util import find_library -import threading - -class Test(unittest.TestCase): - def test_open(self): - libc_name = find_library("c") - if libc_name is not None: - libc = CDLL(libc_name, use_errno=True) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - - libc_open.argtypes = c_char_p, c_int - - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), errno.ENOENT) - - self.failUnlessEqual(set_errno(32), errno.ENOENT) - self.failUnlessEqual(get_errno(), 32) - - - def _worker(): - set_errno(0) - - libc = CDLL(libc_name, use_errno=False) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - libc_open.argtypes = c_char_p, c_int - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_errno(), 32) - set_errno(0) - - if os.name == "nt": - - def test_GetLastError(self): - dll = WinDLL("kernel32", use_last_error=True) - GetModuleHandle = dll.GetModuleHandleA - GetModuleHandle.argtypes = [c_wchar_p] - - self.failUnlessEqual(0, GetModuleHandle("foo")) - self.failUnlessEqual(get_last_error(), 126) - - self.failUnlessEqual(set_last_error(32), 126) - self.failUnlessEqual(get_last_error(), 32) - - def _worker(): - set_last_error(0) - - dll = WinDLL("kernel32", use_last_error=False) - GetModuleHandle = dll.GetModuleHandleW - GetModuleHandle.argtypes = [c_wchar_p] - GetModuleHandle("bar") - - self.failUnlessEqual(get_last_error(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_last_error(), 32) - - set_last_error(0) - -if __name__ == "__main__": - unittest.main() +import unittest, os, errno +from ctypes import * +from ctypes.util import find_library +import threading + +class Test(unittest.TestCase): + def test_open(self): + libc_name = find_library("c") + if libc_name is not None: + libc = CDLL(libc_name, use_errno=True) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + + libc_open.argtypes = c_char_p, c_int + + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), errno.ENOENT) + + self.failUnlessEqual(set_errno(32), errno.ENOENT) + self.failUnlessEqual(get_errno(), 32) + + + def _worker(): + set_errno(0) + + libc = CDLL(libc_name, use_errno=False) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + libc_open.argtypes = c_char_p, c_int + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_errno(), 32) + set_errno(0) + + if os.name == "nt": + + def test_GetLastError(self): + dll = WinDLL("kernel32", use_last_error=True) + GetModuleHandle = dll.GetModuleHandleA + GetModuleHandle.argtypes = [c_wchar_p] + + self.failUnlessEqual(0, GetModuleHandle("foo")) + self.failUnlessEqual(get_last_error(), 126) + + self.failUnlessEqual(set_last_error(32), 126) + self.failUnlessEqual(get_last_error(), 32) + + def _worker(): + set_last_error(0) + + dll = WinDLL("kernel32", use_last_error=False) + GetModuleHandle = dll.GetModuleHandleW + GetModuleHandle.argtypes = [c_wchar_p] + GetModuleHandle("bar") + + self.failUnlessEqual(get_last_error(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_last_error(), 32) + + set_last_error(0) + +if __name__ == "__main__": + unittest.main() Modified: python/trunk/Lib/email/test/data/msg_26.txt ============================================================================== --- python/trunk/Lib/email/test/data/msg_26.txt (original) +++ python/trunk/Lib/email/test/data/msg_26.txt Sat Jun 14 00:38:33 2008 @@ -1,45 +1,45 @@ -Received: from xcar [192.168.0.2] by jeeves.wooster.local - (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 -Date: Sun, 12 May 2002 08:56:15 +0100 -From: Father Time -To: timbo at jeeves.wooster.local -Subject: IMAP file test -Message-ID: <6df65d354b.father.time at rpc.wooster.local> -X-Organization: Home -User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" -Status: R -X-UIDL: 319998302 - -This message is in MIME format which your mailer apparently does not support. -You either require a newer version of your software which supports MIME, or -a separate MIME decoding utility. Alternatively, ask the sender of this -message to resend it in a different format. - ---1618492860--2051301190--113853680 -Content-Type: text/plain; charset=us-ascii - -Simple email with attachment. - - ---1618492860--2051301190--113853680 -Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 -Content-Disposition: attachment; filename="clock.bmp" -Content-Transfer-Encoding: base64 - -Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA -AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A -zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA -C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ -f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// -////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// -8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA -AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA -sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 -z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA -AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH -MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA -AAAAAAAIAAAAAAAAAIAAAAAA - ---1618492860--2051301190--113853680-- +Received: from xcar [192.168.0.2] by jeeves.wooster.local + (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 +Date: Sun, 12 May 2002 08:56:15 +0100 +From: Father Time +To: timbo at jeeves.wooster.local +Subject: IMAP file test +Message-ID: <6df65d354b.father.time at rpc.wooster.local> +X-Organization: Home +User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" +Status: R +X-UIDL: 319998302 + +This message is in MIME format which your mailer apparently does not support. +You either require a newer version of your software which supports MIME, or +a separate MIME decoding utility. Alternatively, ask the sender of this +message to resend it in a different format. + +--1618492860--2051301190--113853680 +Content-Type: text/plain; charset=us-ascii + +Simple email with attachment. + + +--1618492860--2051301190--113853680 +Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 +Content-Disposition: attachment; filename="clock.bmp" +Content-Transfer-Encoding: base64 + +Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA +AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A +zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA +C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ +f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// +////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// +8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA +AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA +sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 +z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA +AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH +MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA +AAAAAAAIAAAAAAAAAIAAAAAA + +--1618492860--2051301190--113853680-- Modified: python/trunk/Lib/test/test_asyncore.py ============================================================================== --- python/trunk/Lib/test/test_asyncore.py (original) +++ python/trunk/Lib/test/test_asyncore.py Sat Jun 14 00:38:33 2008 @@ -1,415 +1,415 @@ -import asyncore -import unittest -import select -import os -import socket -import threading -import sys -import time - -from test import test_support -from test.test_support import TESTFN, run_unittest, unlink -from StringIO import StringIO - -HOST = test_support.HOST - -class dummysocket: - def __init__(self): - self.closed = False - - def close(self): - self.closed = True - - def fileno(self): - return 42 - -class dummychannel: - def __init__(self): - self.socket = dummysocket() - - def close(self): - self.socket.close() - -class exitingdummy: - def __init__(self): - pass - - def handle_read_event(self): - raise asyncore.ExitNow() - - handle_write_event = handle_read_event - handle_expt_event = handle_read_event - -class crashingdummy: - def __init__(self): - self.error_handled = False - - def handle_read_event(self): - raise Exception() - - handle_write_event = handle_read_event - handle_expt_event = handle_read_event - - def handle_error(self): - self.error_handled = True - -# used when testing senders; just collects what it gets until newline is sent -def capture_server(evt, buf, serv): - try: - serv.listen(5) - conn, addr = serv.accept() - except socket.timeout: - pass - else: - n = 200 - while n > 0: - r, w, e = select.select([conn], [], []) - if r: - data = conn.recv(10) - # keep everything except for the newline terminator - buf.write(data.replace('\n', '')) - if '\n' in data: - break - n -= 1 - time.sleep(0.01) - - conn.close() - finally: - serv.close() - evt.set() - - -class HelperFunctionTests(unittest.TestCase): - def test_readwriteexc(self): - # Check exception handling behavior of read, write and _exception - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore read/write/_exception calls - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) - self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) - self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.read(tr2) - self.assertEqual(tr2.error_handled, True) - - tr2 = crashingdummy() - asyncore.write(tr2) - self.assertEqual(tr2.error_handled, True) - - tr2 = crashingdummy() - asyncore._exception(tr2) - self.assertEqual(tr2.error_handled, True) - - # asyncore.readwrite uses constants in the select module that - # are not present in Windows systems (see this thread: - # http://mail.python.org/pipermail/python-list/2001-October/109973.html) - # These constants should be present as long as poll is available - - if hasattr(select, 'poll'): - def test_readwrite(self): - # Check that correct methods are called by readwrite() - - class testobj: - def __init__(self): - self.read = False - self.write = False - self.expt = False - - def handle_read_event(self): - self.read = True - - def handle_write_event(self): - self.write = True - - def handle_expt_event(self): - self.expt = True - - def handle_error(self): - self.error_handled = True - - for flag in (select.POLLIN, select.POLLPRI): - tobj = testobj() - self.assertEqual(tobj.read, False) - asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.read, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite call - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, flag) - self.assertEqual(tr2.error_handled, True) - - tobj = testobj() - self.assertEqual(tobj.write, False) - asyncore.readwrite(tobj, select.POLLOUT) - self.assertEqual(tobj.write, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite call - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, - select.POLLOUT) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, select.POLLOUT) - self.assertEqual(tr2.error_handled, True) - - for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): - tobj = testobj() - self.assertEqual(tobj.expt, False) - asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.expt, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite calls - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, flag) - self.assertEqual(tr2.error_handled, True) - - def test_closeall(self): - self.closeall_check(False) - - def test_closeall_default(self): - self.closeall_check(True) - - def closeall_check(self, usedefault): - # Check that close_all() closes everything in a given map - - l = [] - testmap = {} - for i in range(10): - c = dummychannel() - l.append(c) - self.assertEqual(c.socket.closed, False) - testmap[i] = c - - if usedefault: - socketmap = asyncore.socket_map - try: - asyncore.socket_map = testmap - asyncore.close_all() - finally: - testmap, asyncore.socket_map = asyncore.socket_map, socketmap - else: - asyncore.close_all(testmap) - - self.assertEqual(len(testmap), 0) - - for c in l: - self.assertEqual(c.socket.closed, True) - - def test_compact_traceback(self): - try: - raise Exception("I don't like spam!") - except: - real_t, real_v, real_tb = sys.exc_info() - r = asyncore.compact_traceback() - else: - self.fail("Expected exception") - - (f, function, line), t, v, info = r - self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') - self.assertEqual(function, 'test_compact_traceback') - self.assertEqual(t, real_t) - self.assertEqual(v, real_v) - self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) - - -class DispatcherTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - asyncore.close_all() - - def test_basic(self): - d = asyncore.dispatcher() - self.assertEqual(d.readable(), True) - self.assertEqual(d.writable(), True) - - def test_repr(self): - d = asyncore.dispatcher() - self.assertEqual(repr(d), '' % id(d)) - - def test_log(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log() (to stderr) - fp = StringIO() - stderr = sys.stderr - l1 = "Lovely spam! Wonderful spam!" - l2 = "I don't like spam!" - try: - sys.stderr = fp - d.log(l1) - d.log(l2) - finally: - sys.stderr = stderr - - lines = fp.getvalue().splitlines() - self.assertEquals(lines, ['log: %s' % l1, 'log: %s' % l2]) - - def test_log_info(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log_info() (to stdout via print) - fp = StringIO() - stdout = sys.stdout - l1 = "Have you got anything without spam?" - l2 = "Why can't she have egg bacon spam and sausage?" - l3 = "THAT'S got spam in it!" - try: - sys.stdout = fp - d.log_info(l1, 'EGGS') - d.log_info(l2) - d.log_info(l3, 'SPAM') - finally: - sys.stdout = stdout - - lines = fp.getvalue().splitlines() - if __debug__: - expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] - else: - expected = ['EGGS: %s' % l1, 'SPAM: %s' % l3] - - self.assertEquals(lines, expected) - - def test_unhandled(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log_info() (to stdout via print) - fp = StringIO() - stdout = sys.stdout - try: - sys.stdout = fp - d.handle_expt() - d.handle_read() - d.handle_write() - d.handle_connect() - d.handle_accept() - finally: - sys.stdout = stdout - - lines = fp.getvalue().splitlines() - expected = ['warning: unhandled exception', - 'warning: unhandled read event', - 'warning: unhandled write event', - 'warning: unhandled connect event', - 'warning: unhandled accept event'] - self.assertEquals(lines, expected) - - - -class dispatcherwithsend_noread(asyncore.dispatcher_with_send): - def readable(self): - return False - - def handle_connect(self): - pass - -class DispatcherWithSendTests(unittest.TestCase): - usepoll = False - - def setUp(self): - pass - - def tearDown(self): - asyncore.close_all() - - def test_send(self): - self.evt = threading.Event() - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) - - cap = StringIO() - args = (self.evt, cap, self.sock) - threading.Thread(target=capture_server, args=args).start() - - # wait a little longer for the server to initialize (it sometimes - # refuses connections on slow machines without this wait) - time.sleep(0.2) - - data = "Suppose there isn't a 16-ton weight?" - d = dispatcherwithsend_noread() - d.create_socket(socket.AF_INET, socket.SOCK_STREAM) - d.connect((HOST, self.port)) - - # give time for socket to connect - time.sleep(0.1) - - d.send(data) - d.send(data) - d.send('\n') - - n = 1000 - while d.out_buffer and n > 0: - asyncore.poll() - n -= 1 - - self.evt.wait() - - self.assertEqual(cap.getvalue(), data*2) - - -class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): - usepoll = True - -if hasattr(asyncore, 'file_wrapper'): - class FileWrapperTest(unittest.TestCase): - def setUp(self): - self.d = "It's not dead, it's sleeping!" - file(TESTFN, 'w').write(self.d) - - def tearDown(self): - unlink(TESTFN) - - def test_recv(self): - fd = os.open(TESTFN, os.O_RDONLY) - w = asyncore.file_wrapper(fd) - - self.assertNotEqual(w.fd, fd) - self.assertNotEqual(w.fileno(), fd) - self.assertEqual(w.recv(13), "It's not dead") - self.assertEqual(w.read(6), ", it's") - w.close() - self.assertRaises(OSError, w.read, 1) - - def test_send(self): - d1 = "Come again?" - d2 = "I want to buy some cheese." - fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) - w = asyncore.file_wrapper(fd) - - w.write(d1) - w.send(d2) - w.close() - self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) - - -def test_main(): - tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, - DispatcherWithSendTests_UsePoll] - if hasattr(asyncore, 'file_wrapper'): - tests.append(FileWrapperTest) - - run_unittest(*tests) - -if __name__ == "__main__": - test_main() +import asyncore +import unittest +import select +import os +import socket +import threading +import sys +import time + +from test import test_support +from test.test_support import TESTFN, run_unittest, unlink +from StringIO import StringIO + +HOST = test_support.HOST + +class dummysocket: + def __init__(self): + self.closed = False + + def close(self): + self.closed = True + + def fileno(self): + return 42 + +class dummychannel: + def __init__(self): + self.socket = dummysocket() + + def close(self): + self.socket.close() + +class exitingdummy: + def __init__(self): + pass + + def handle_read_event(self): + raise asyncore.ExitNow() + + handle_write_event = handle_read_event + handle_expt_event = handle_read_event + +class crashingdummy: + def __init__(self): + self.error_handled = False + + def handle_read_event(self): + raise Exception() + + handle_write_event = handle_read_event + handle_expt_event = handle_read_event + + def handle_error(self): + self.error_handled = True + +# used when testing senders; just collects what it gets until newline is sent +def capture_server(evt, buf, serv): + try: + serv.listen(5) + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 200 + while n > 0: + r, w, e = select.select([conn], [], []) + if r: + data = conn.recv(10) + # keep everything except for the newline terminator + buf.write(data.replace('\n', '')) + if '\n' in data: + break + n -= 1 + time.sleep(0.01) + + conn.close() + finally: + serv.close() + evt.set() + + +class HelperFunctionTests(unittest.TestCase): + def test_readwriteexc(self): + # Check exception handling behavior of read, write and _exception + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore read/write/_exception calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) + self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) + self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.read(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore.write(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore._exception(tr2) + self.assertEqual(tr2.error_handled, True) + + # asyncore.readwrite uses constants in the select module that + # are not present in Windows systems (see this thread: + # http://mail.python.org/pipermail/python-list/2001-October/109973.html) + # These constants should be present as long as poll is available + + if hasattr(select, 'poll'): + def test_readwrite(self): + # Check that correct methods are called by readwrite() + + class testobj: + def __init__(self): + self.read = False + self.write = False + self.expt = False + + def handle_read_event(self): + self.read = True + + def handle_write_event(self): + self.write = True + + def handle_expt_event(self): + self.expt = True + + def handle_error(self): + self.error_handled = True + + for flag in (select.POLLIN, select.POLLPRI): + tobj = testobj() + self.assertEqual(tobj.read, False) + asyncore.readwrite(tobj, flag) + self.assertEqual(tobj.read, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + tobj = testobj() + self.assertEqual(tobj.write, False) + asyncore.readwrite(tobj, select.POLLOUT) + self.assertEqual(tobj.write, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, + select.POLLOUT) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, select.POLLOUT) + self.assertEqual(tr2.error_handled, True) + + for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): + tobj = testobj() + self.assertEqual(tobj.expt, False) + asyncore.readwrite(tobj, flag) + self.assertEqual(tobj.expt, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + def test_closeall(self): + self.closeall_check(False) + + def test_closeall_default(self): + self.closeall_check(True) + + def closeall_check(self, usedefault): + # Check that close_all() closes everything in a given map + + l = [] + testmap = {} + for i in range(10): + c = dummychannel() + l.append(c) + self.assertEqual(c.socket.closed, False) + testmap[i] = c + + if usedefault: + socketmap = asyncore.socket_map + try: + asyncore.socket_map = testmap + asyncore.close_all() + finally: + testmap, asyncore.socket_map = asyncore.socket_map, socketmap + else: + asyncore.close_all(testmap) + + self.assertEqual(len(testmap), 0) + + for c in l: + self.assertEqual(c.socket.closed, True) + + def test_compact_traceback(self): + try: + raise Exception("I don't like spam!") + except: + real_t, real_v, real_tb = sys.exc_info() + r = asyncore.compact_traceback() + else: + self.fail("Expected exception") + + (f, function, line), t, v, info = r + self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') + self.assertEqual(function, 'test_compact_traceback') + self.assertEqual(t, real_t) + self.assertEqual(v, real_v) + self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) + + +class DispatcherTests(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_basic(self): + d = asyncore.dispatcher() + self.assertEqual(d.readable(), True) + self.assertEqual(d.writable(), True) + + def test_repr(self): + d = asyncore.dispatcher() + self.assertEqual(repr(d), '' % id(d)) + + def test_log(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log() (to stderr) + fp = StringIO() + stderr = sys.stderr + l1 = "Lovely spam! Wonderful spam!" + l2 = "I don't like spam!" + try: + sys.stderr = fp + d.log(l1) + d.log(l2) + finally: + sys.stderr = stderr + + lines = fp.getvalue().splitlines() + self.assertEquals(lines, ['log: %s' % l1, 'log: %s' % l2]) + + def test_log_info(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + l1 = "Have you got anything without spam?" + l2 = "Why can't she have egg bacon spam and sausage?" + l3 = "THAT'S got spam in it!" + try: + sys.stdout = fp + d.log_info(l1, 'EGGS') + d.log_info(l2) + d.log_info(l3, 'SPAM') + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + if __debug__: + expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] + else: + expected = ['EGGS: %s' % l1, 'SPAM: %s' % l3] + + self.assertEquals(lines, expected) + + def test_unhandled(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + try: + sys.stdout = fp + d.handle_expt() + d.handle_read() + d.handle_write() + d.handle_connect() + d.handle_accept() + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['warning: unhandled exception', + 'warning: unhandled read event', + 'warning: unhandled write event', + 'warning: unhandled connect event', + 'warning: unhandled accept event'] + self.assertEquals(lines, expected) + + + +class dispatcherwithsend_noread(asyncore.dispatcher_with_send): + def readable(self): + return False + + def handle_connect(self): + pass + +class DispatcherWithSendTests(unittest.TestCase): + usepoll = False + + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_send(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(3) + self.port = test_support.bind_port(self.sock) + + cap = StringIO() + args = (self.evt, cap, self.sock) + threading.Thread(target=capture_server, args=args).start() + + # wait a little longer for the server to initialize (it sometimes + # refuses connections on slow machines without this wait) + time.sleep(0.2) + + data = "Suppose there isn't a 16-ton weight?" + d = dispatcherwithsend_noread() + d.create_socket(socket.AF_INET, socket.SOCK_STREAM) + d.connect((HOST, self.port)) + + # give time for socket to connect + time.sleep(0.1) + + d.send(data) + d.send(data) + d.send('\n') + + n = 1000 + while d.out_buffer and n > 0: + asyncore.poll() + n -= 1 + + self.evt.wait() + + self.assertEqual(cap.getvalue(), data*2) + + +class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): + usepoll = True + +if hasattr(asyncore, 'file_wrapper'): + class FileWrapperTest(unittest.TestCase): + def setUp(self): + self.d = "It's not dead, it's sleeping!" + file(TESTFN, 'w').write(self.d) + + def tearDown(self): + unlink(TESTFN) + + def test_recv(self): + fd = os.open(TESTFN, os.O_RDONLY) + w = asyncore.file_wrapper(fd) + + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) + self.assertEqual(w.recv(13), "It's not dead") + self.assertEqual(w.read(6), ", it's") + w.close() + self.assertRaises(OSError, w.read, 1) + + def test_send(self): + d1 = "Come again?" + d2 = "I want to buy some cheese." + fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) + w = asyncore.file_wrapper(fd) + + w.write(d1) + w.send(d2) + w.close() + self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) + + +def test_main(): + tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, + DispatcherWithSendTests_UsePoll] + if hasattr(asyncore, 'file_wrapper'): + tests.append(FileWrapperTest) + + run_unittest(*tests) + +if __name__ == "__main__": + test_main() Modified: python/trunk/PC/VS8.0/_bsddb.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_bsddb.vcproj (original) +++ python/trunk/PC/VS8.0/_bsddb.vcproj Sat Jun 14 00:38:33 2008 @@ -1,546 +1,546 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_bsddb44.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_bsddb44.vcproj (original) +++ python/trunk/PC/VS8.0/_bsddb44.vcproj Sat Jun 14 00:38:33 2008 @@ -1,1252 +1,1252 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_ctypes.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_ctypes.vcproj (original) +++ python/trunk/PC/VS8.0/_ctypes.vcproj Sat Jun 14 00:38:33 2008 @@ -1,705 +1,705 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_ctypes_test.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_ctypes_test.vcproj (original) +++ python/trunk/PC/VS8.0/_ctypes_test.vcproj Sat Jun 14 00:38:33 2008 @@ -1,521 +1,521 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_elementtree.vcproj (original) +++ python/trunk/PC/VS8.0/_elementtree.vcproj Sat Jun 14 00:38:33 2008 @@ -1,613 +1,613 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_hashlib.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_hashlib.vcproj (original) +++ python/trunk/PC/VS8.0/_hashlib.vcproj Sat Jun 14 00:38:33 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_msi.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_msi.vcproj (original) +++ python/trunk/PC/VS8.0/_msi.vcproj Sat Jun 14 00:38:33 2008 @@ -1,529 +1,529 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_socket.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_socket.vcproj (original) +++ python/trunk/PC/VS8.0/_socket.vcproj Sat Jun 14 00:38:33 2008 @@ -1,537 +1,537 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_sqlite3.vcproj (original) +++ python/trunk/PC/VS8.0/_sqlite3.vcproj Sat Jun 14 00:38:33 2008 @@ -1,613 +1,613 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_ssl.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_ssl.vcproj (original) +++ python/trunk/PC/VS8.0/_ssl.vcproj Sat Jun 14 00:38:33 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_testcapi.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_testcapi.vcproj (original) +++ python/trunk/PC/VS8.0/_testcapi.vcproj Sat Jun 14 00:38:33 2008 @@ -1,521 +1,521 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/_tkinter.vcproj ============================================================================== --- python/trunk/PC/VS8.0/_tkinter.vcproj (original) +++ python/trunk/PC/VS8.0/_tkinter.vcproj Sat Jun 14 00:38:33 2008 @@ -1,541 +1,541 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/bdist_wininst.vcproj ============================================================================== --- python/trunk/PC/VS8.0/bdist_wininst.vcproj (original) +++ python/trunk/PC/VS8.0/bdist_wininst.vcproj Sat Jun 14 00:38:33 2008 @@ -1,270 +1,270 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/bz2.vcproj ============================================================================== --- python/trunk/PC/VS8.0/bz2.vcproj (original) +++ python/trunk/PC/VS8.0/bz2.vcproj Sat Jun 14 00:38:33 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/kill_python.c ============================================================================== --- python/trunk/PC/VS8.0/kill_python.c (original) +++ python/trunk/PC/VS8.0/kill_python.c Sat Jun 14 00:38:33 2008 @@ -1,178 +1,178 @@ -/* - * Helper program for killing lingering python[_d].exe processes before - * building, thus attempting to avoid build failures due to files being - * locked. - */ - -#include -#include -#include -#include - -#pragma comment(lib, "psapi") - -#ifdef _DEBUG -#define PYTHON_EXE (L"python_d.exe") -#define PYTHON_EXE_LEN (12) -#define KILL_PYTHON_EXE (L"kill_python_d.exe") -#define KILL_PYTHON_EXE_LEN (17) -#else -#define PYTHON_EXE (L"python.exe") -#define PYTHON_EXE_LEN (10) -#define KILL_PYTHON_EXE (L"kill_python.exe") -#define KILL_PYTHON_EXE_LEN (15) -#endif - -int -main(int argc, char **argv) -{ - HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ - DWORD dac, our_pid; - size_t len; - wchar_t path[MAX_PATH+1]; - - MODULEENTRY32W me; - PROCESSENTRY32W pe; - - me.dwSize = sizeof(MODULEENTRY32W); - pe.dwSize = sizeof(PROCESSENTRY32W); - - memset(path, 0, MAX_PATH+1); - - our_pid = GetCurrentProcessId(); - - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); - if (hsm == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); - return 1; - } - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[1] failed: %d\n", GetLastError()); - CloseHandle(hsm); - return 1; - } - - /* - * Enumerate over the modules for the current process in order to find - * kill_process[_d].exe, then take a note of the directory it lives in. - */ - do { - if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) - continue; - - len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; - wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); - - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - if (path == NULL) { - printf("failed to discern directory of running process\n"); - return 1; - } - - /* - * Take a snapshot of system processes. Enumerate over the snapshot, - * looking for python processes. When we find one, verify it lives - * in the same directory we live in. If it does, kill it. If we're - * unable to kill it, treat this as a fatal error and return 1. - * - * The rationale behind this is that we're called at the start of the - * build process on the basis that we'll take care of killing any - * running instances, such that the build won't encounter permission - * denied errors during linking. If we can't kill one of the processes, - * we can't provide this assurance, and the build shouldn't start. - */ - - hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hsp == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); - return 1; - } - - if (!Process32FirstW(hsp, &pe)) { - printf("Process32FirstW failed: %d\n", GetLastError()); - CloseHandle(hsp); - return 1; - } - - dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; - do { - - /* - * XXX TODO: if we really wanted to be fancy, we could check the - * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python30[_d].dll), - * as that would also inhibit our ability to rebuild the solution. - * Not worth loosing sleep over though; for now, a simple check - * for just the python executable should be sufficient. - */ - - if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) - /* This isn't a python process. */ - continue; - - /* It's a python process, so figure out which directory it's in... */ - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); - if (hsm == INVALID_HANDLE_VALUE) - /* - * If our module snapshot fails (which will happen if we don't own - * the process), just ignore it and continue. (It seems different - * versions of Windows return different values for GetLastError() - * in this situation; it's easier to just ignore it and move on vs. - * stopping the build for what could be a false positive.) - */ - continue; - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[2] failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - do { - if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) - /* Wrong module, we're looking for python[_d].exe... */ - continue; - - if (_wcsnicmp(path, me.szExePath, len)) - /* Process doesn't live in our directory. */ - break; - - /* Python process residing in the right directory, kill it! */ - hp = OpenProcess(dac, FALSE, pe.th32ProcessID); - if (!hp) { - printf("OpenProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - if (!TerminateProcess(hp, 1)) { - printf("TerminateProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - CloseHandle(hp); - return 1; - } - - CloseHandle(hp); - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - } while (Process32NextW(hsp, &pe)); - - CloseHandle(hsp); - - return 0; -} - -/* vi: set ts=8 sw=4 sts=4 expandtab */ +/* + * Helper program for killing lingering python[_d].exe processes before + * building, thus attempting to avoid build failures due to files being + * locked. + */ + +#include +#include +#include +#include + +#pragma comment(lib, "psapi") + +#ifdef _DEBUG +#define PYTHON_EXE (L"python_d.exe") +#define PYTHON_EXE_LEN (12) +#define KILL_PYTHON_EXE (L"kill_python_d.exe") +#define KILL_PYTHON_EXE_LEN (17) +#else +#define PYTHON_EXE (L"python.exe") +#define PYTHON_EXE_LEN (10) +#define KILL_PYTHON_EXE (L"kill_python.exe") +#define KILL_PYTHON_EXE_LEN (15) +#endif + +int +main(int argc, char **argv) +{ + HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ + DWORD dac, our_pid; + size_t len; + wchar_t path[MAX_PATH+1]; + + MODULEENTRY32W me; + PROCESSENTRY32W pe; + + me.dwSize = sizeof(MODULEENTRY32W); + pe.dwSize = sizeof(PROCESSENTRY32W); + + memset(path, 0, MAX_PATH+1); + + our_pid = GetCurrentProcessId(); + + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); + if (hsm == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); + return 1; + } + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[1] failed: %d\n", GetLastError()); + CloseHandle(hsm); + return 1; + } + + /* + * Enumerate over the modules for the current process in order to find + * kill_process[_d].exe, then take a note of the directory it lives in. + */ + do { + if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) + continue; + + len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; + wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); + + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + if (path == NULL) { + printf("failed to discern directory of running process\n"); + return 1; + } + + /* + * Take a snapshot of system processes. Enumerate over the snapshot, + * looking for python processes. When we find one, verify it lives + * in the same directory we live in. If it does, kill it. If we're + * unable to kill it, treat this as a fatal error and return 1. + * + * The rationale behind this is that we're called at the start of the + * build process on the basis that we'll take care of killing any + * running instances, such that the build won't encounter permission + * denied errors during linking. If we can't kill one of the processes, + * we can't provide this assurance, and the build shouldn't start. + */ + + hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hsp == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); + return 1; + } + + if (!Process32FirstW(hsp, &pe)) { + printf("Process32FirstW failed: %d\n", GetLastError()); + CloseHandle(hsp); + return 1; + } + + dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; + do { + + /* + * XXX TODO: if we really wanted to be fancy, we could check the + * modules for all processes (not just the python[_d].exe ones) + * and see if any of our DLLs are loaded (i.e. python30[_d].dll), + * as that would also inhibit our ability to rebuild the solution. + * Not worth loosing sleep over though; for now, a simple check + * for just the python executable should be sufficient. + */ + + if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) + /* This isn't a python process. */ + continue; + + /* It's a python process, so figure out which directory it's in... */ + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); + if (hsm == INVALID_HANDLE_VALUE) + /* + * If our module snapshot fails (which will happen if we don't own + * the process), just ignore it and continue. (It seems different + * versions of Windows return different values for GetLastError() + * in this situation; it's easier to just ignore it and move on vs. + * stopping the build for what could be a false positive.) + */ + continue; + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[2] failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + do { + if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) + /* Wrong module, we're looking for python[_d].exe... */ + continue; + + if (_wcsnicmp(path, me.szExePath, len)) + /* Process doesn't live in our directory. */ + break; + + /* Python process residing in the right directory, kill it! */ + hp = OpenProcess(dac, FALSE, pe.th32ProcessID); + if (!hp) { + printf("OpenProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + if (!TerminateProcess(hp, 1)) { + printf("TerminateProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + CloseHandle(hp); + return 1; + } + + CloseHandle(hp); + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + } while (Process32NextW(hsp, &pe)); + + CloseHandle(hsp); + + return 0; +} + +/* vi: set ts=8 sw=4 sts=4 expandtab */ Modified: python/trunk/PC/VS8.0/kill_python.vcproj ============================================================================== --- python/trunk/PC/VS8.0/kill_python.vcproj (original) +++ python/trunk/PC/VS8.0/kill_python.vcproj Sat Jun 14 00:38:33 2008 @@ -1,279 +1,279 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/make_buildinfo.vcproj ============================================================================== --- python/trunk/PC/VS8.0/make_buildinfo.vcproj (original) +++ python/trunk/PC/VS8.0/make_buildinfo.vcproj Sat Jun 14 00:38:33 2008 @@ -1,162 +1,162 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/make_versioninfo.vcproj ============================================================================== --- python/trunk/PC/VS8.0/make_versioninfo.vcproj (original) +++ python/trunk/PC/VS8.0/make_versioninfo.vcproj Sat Jun 14 00:38:33 2008 @@ -1,324 +1,324 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/pcbuild.sln ============================================================================== --- python/trunk/PC/VS8.0/pcbuild.sln (original) +++ python/trunk/PC/VS8.0/pcbuild.sln Sat Jun 14 00:38:33 2008 @@ -1,581 +1,581 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} = {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - ProjectSection(ProjectDependencies) = postProject - {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}" - ProjectSection(SolutionItems) = preProject - ..\..\Modules\getbuildinfo.c = ..\..\Modules\getbuildinfo.c - readme.txt = readme.txt - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{9EC7190A-249F-4180-A900-548FDCF3055F}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{17E1E049-C309-4D79-843F-AE483C264AEA}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{31FFC478-7B4A-43E8-9954-8D03E2187E9C}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{13CECB97-4119-4316-9D42-8534019A5A44}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - {A1A295E5-463C-437F-81CA-1F32367685DA} = {A1A295E5-463C-437F-81CA-1F32367685DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}" - ProjectSection(ProjectDependencies) = postProject - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} - {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2.vcproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{ECC7CEAC-A5E5-458E-BB9E-2413CC847881}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "bdist_wininst.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" - ProjectSection(ProjectDependencies) = postProject - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - PGInstrument|Win32 = PGInstrument|Win32 - PGInstrument|x64 = PGInstrument|x64 - PGUpdate|Win32 = PGUpdate|Win32 - PGUpdate|x64 = PGUpdate|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.ActiveCfg = Debug|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.Build.0 = Debug|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.ActiveCfg = Debug|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.Build.0 = Debug|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.ActiveCfg = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.Build.0 = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.ActiveCfg = Debug|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.Build.0 = Debug|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.ActiveCfg = Debug|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.Build.0 = Debug|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.ActiveCfg = Release|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.Build.0 = Release|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.ActiveCfg = Release|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.Build.0 = Release|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.ActiveCfg = Debug|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.Build.0 = Debug|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.ActiveCfg = Debug|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.Build.0 = Debug|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.ActiveCfg = Release|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.Build.0 = Release|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.ActiveCfg = Release|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.Build.0 = Release|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.ActiveCfg = Debug|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.Build.0 = Debug|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.ActiveCfg = Debug|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.Build.0 = Debug|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.ActiveCfg = Release|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.Build.0 = Release|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.ActiveCfg = Release|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.Build.0 = Release|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.ActiveCfg = Debug|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.Build.0 = Debug|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.ActiveCfg = Debug|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.Build.0 = Debug|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.ActiveCfg = Release|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.Build.0 = Release|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.ActiveCfg = Release|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.Build.0 = Release|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.ActiveCfg = Debug|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.Build.0 = Debug|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.ActiveCfg = Debug|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.Build.0 = Debug|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.ActiveCfg = Release|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.Build.0 = Release|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.ActiveCfg = Release|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.Build.0 = Release|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.ActiveCfg = Debug|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.Build.0 = Debug|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.ActiveCfg = Debug|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.Build.0 = Debug|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.ActiveCfg = Release|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.Build.0 = Release|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.ActiveCfg = Release|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.Build.0 = Release|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.ActiveCfg = Debug|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.Build.0 = Debug|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.ActiveCfg = Debug|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.Build.0 = Debug|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.ActiveCfg = Release|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.Build.0 = Release|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.Build.0 = Debug|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.ActiveCfg = Release|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.Build.0 = Release|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.ActiveCfg = Release|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.Build.0 = Release|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.ActiveCfg = Debug|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.Build.0 = Debug|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.ActiveCfg = Debug|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.Build.0 = Debug|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.ActiveCfg = Release|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.Build.0 = Release|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.ActiveCfg = Release|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.Build.0 = Release|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.ActiveCfg = Debug|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.Build.0 = Debug|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.ActiveCfg = Debug|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.Build.0 = Debug|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.ActiveCfg = Release|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.Build.0 = Release|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.ActiveCfg = Release|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.Build.0 = Release|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.ActiveCfg = Debug|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.Build.0 = Debug|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.ActiveCfg = Debug|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.Build.0 = Debug|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.ActiveCfg = Release|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.Build.0 = Release|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.ActiveCfg = Release|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.Build.0 = Release|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.ActiveCfg = Debug|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.Build.0 = Debug|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.ActiveCfg = Debug|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.Build.0 = Debug|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.ActiveCfg = Release|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.Build.0 = Release|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.ActiveCfg = Release|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.Build.0 = Release|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.ActiveCfg = Debug|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.Build.0 = Debug|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.ActiveCfg = Debug|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.Build.0 = Debug|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.ActiveCfg = Release|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.Build.0 = Release|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.ActiveCfg = Release|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.Build.0 = Release|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.ActiveCfg = Debug|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.Build.0 = Debug|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.ActiveCfg = Debug|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.Build.0 = Debug|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.ActiveCfg = Release|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.Build.0 = Release|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.ActiveCfg = Release|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.Build.0 = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.Build.0 = Debug|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.ActiveCfg = Release|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.Build.0 = Debug|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.ActiveCfg = Release|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.ActiveCfg = Debug|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.Build.0 = Debug|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.ActiveCfg = Debug|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.Build.0 = Debug|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.ActiveCfg = Release|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.Build.0 = Debug|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} = {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" + ProjectSection(ProjectDependencies) = postProject + {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}" + ProjectSection(SolutionItems) = preProject + ..\..\Modules\getbuildinfo.c = ..\..\Modules\getbuildinfo.c + readme.txt = readme.txt + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{9EC7190A-249F-4180-A900-548FDCF3055F}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{17E1E049-C309-4D79-843F-AE483C264AEA}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{31FFC478-7B4A-43E8-9954-8D03E2187E9C}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{13CECB97-4119-4316-9D42-8534019A5A44}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {A1A295E5-463C-437F-81CA-1F32367685DA} = {A1A295E5-463C-437F-81CA-1F32367685DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}" + ProjectSection(ProjectDependencies) = postProject + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} + {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2.vcproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{ECC7CEAC-A5E5-458E-BB9E-2413CC847881}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "bdist_wininst.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" + ProjectSection(ProjectDependencies) = postProject + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + PGInstrument|Win32 = PGInstrument|Win32 + PGInstrument|x64 = PGInstrument|x64 + PGUpdate|Win32 = PGUpdate|Win32 + PGUpdate|x64 = PGUpdate|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.ActiveCfg = Debug|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.Build.0 = Debug|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.ActiveCfg = Debug|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.Build.0 = Debug|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.ActiveCfg = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.Build.0 = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.Build.0 = Debug|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.ActiveCfg = Debug|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.Build.0 = Debug|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.ActiveCfg = Release|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.Build.0 = Release|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.ActiveCfg = Release|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.Build.0 = Release|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.ActiveCfg = Debug|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.Build.0 = Debug|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.ActiveCfg = Debug|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.Build.0 = Debug|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.ActiveCfg = Release|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.Build.0 = Release|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.ActiveCfg = Release|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.Build.0 = Release|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.ActiveCfg = Debug|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.Build.0 = Debug|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.ActiveCfg = Debug|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.Build.0 = Debug|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.ActiveCfg = Release|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.Build.0 = Release|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.ActiveCfg = Release|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.Build.0 = Release|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.ActiveCfg = Debug|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.Build.0 = Debug|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.ActiveCfg = Debug|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.Build.0 = Debug|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.ActiveCfg = Release|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.Build.0 = Release|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.ActiveCfg = Release|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.Build.0 = Release|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.ActiveCfg = Debug|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.Build.0 = Debug|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.ActiveCfg = Debug|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.Build.0 = Debug|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.ActiveCfg = Release|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.Build.0 = Release|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.ActiveCfg = Release|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.Build.0 = Release|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.ActiveCfg = Debug|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.Build.0 = Debug|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.ActiveCfg = Debug|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.Build.0 = Debug|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.ActiveCfg = Release|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.Build.0 = Release|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.ActiveCfg = Release|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.Build.0 = Release|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.ActiveCfg = Debug|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.Build.0 = Debug|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.ActiveCfg = Debug|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.Build.0 = Debug|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.ActiveCfg = Release|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.Build.0 = Release|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.Build.0 = Debug|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.ActiveCfg = Release|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.Build.0 = Release|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.ActiveCfg = Release|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.Build.0 = Release|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.ActiveCfg = Debug|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.Build.0 = Debug|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.ActiveCfg = Debug|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.Build.0 = Debug|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.ActiveCfg = Release|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.Build.0 = Release|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.ActiveCfg = Release|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.Build.0 = Release|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.ActiveCfg = Debug|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.Build.0 = Debug|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.ActiveCfg = Debug|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.Build.0 = Debug|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.ActiveCfg = Release|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.Build.0 = Release|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.ActiveCfg = Release|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.Build.0 = Release|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.ActiveCfg = Debug|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.Build.0 = Debug|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.ActiveCfg = Debug|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.Build.0 = Debug|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.ActiveCfg = Release|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.Build.0 = Release|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.ActiveCfg = Release|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.Build.0 = Release|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.ActiveCfg = Debug|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.Build.0 = Debug|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.ActiveCfg = Debug|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.Build.0 = Debug|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.ActiveCfg = Release|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.Build.0 = Release|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.ActiveCfg = Release|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.Build.0 = Release|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.ActiveCfg = Debug|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.Build.0 = Debug|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.ActiveCfg = Debug|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.Build.0 = Debug|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.ActiveCfg = Release|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.Build.0 = Release|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.ActiveCfg = Release|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.Build.0 = Release|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.ActiveCfg = Debug|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.Build.0 = Debug|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.ActiveCfg = Debug|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.Build.0 = Debug|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.ActiveCfg = Release|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.Build.0 = Release|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.ActiveCfg = Release|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.Build.0 = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.Build.0 = Debug|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.ActiveCfg = Release|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.Build.0 = Debug|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.ActiveCfg = Release|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.ActiveCfg = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.Build.0 = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.ActiveCfg = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.Build.0 = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.ActiveCfg = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.Build.0 = Debug|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Modified: python/trunk/PC/VS8.0/pyexpat.vcproj ============================================================================== --- python/trunk/PC/VS8.0/pyexpat.vcproj (original) +++ python/trunk/PC/VS8.0/pyexpat.vcproj Sat Jun 14 00:38:33 2008 @@ -1,553 +1,553 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/python.vcproj ============================================================================== --- python/trunk/PC/VS8.0/python.vcproj (original) +++ python/trunk/PC/VS8.0/python.vcproj Sat Jun 14 00:38:33 2008 @@ -1,637 +1,637 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/pythoncore.vcproj ============================================================================== --- python/trunk/PC/VS8.0/pythoncore.vcproj (original) +++ python/trunk/PC/VS8.0/pythoncore.vcproj Sat Jun 14 00:38:33 2008 @@ -1,1817 +1,1817 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/pythonw.vcproj ============================================================================== --- python/trunk/PC/VS8.0/pythonw.vcproj (original) +++ python/trunk/PC/VS8.0/pythonw.vcproj Sat Jun 14 00:38:33 2008 @@ -1,618 +1,618 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/select.vcproj ============================================================================== --- python/trunk/PC/VS8.0/select.vcproj (original) +++ python/trunk/PC/VS8.0/select.vcproj Sat Jun 14 00:38:33 2008 @@ -1,537 +1,537 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/sqlite3.vcproj ============================================================================== --- python/trunk/PC/VS8.0/sqlite3.vcproj (original) +++ python/trunk/PC/VS8.0/sqlite3.vcproj Sat Jun 14 00:38:33 2008 @@ -1,743 +1,743 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/unicodedata.vcproj ============================================================================== --- python/trunk/PC/VS8.0/unicodedata.vcproj (original) +++ python/trunk/PC/VS8.0/unicodedata.vcproj Sat Jun 14 00:38:33 2008 @@ -1,533 +1,533 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/w9xpopen.vcproj ============================================================================== --- python/trunk/PC/VS8.0/w9xpopen.vcproj (original) +++ python/trunk/PC/VS8.0/w9xpopen.vcproj Sat Jun 14 00:38:33 2008 @@ -1,576 +1,576 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PC/VS8.0/winsound.vcproj ============================================================================== --- python/trunk/PC/VS8.0/winsound.vcproj (original) +++ python/trunk/PC/VS8.0/winsound.vcproj Sat Jun 14 00:38:33 2008 @@ -1,523 +1,523 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild/_bsddb44.vcproj ============================================================================== --- python/trunk/PCbuild/_bsddb44.vcproj (original) +++ python/trunk/PCbuild/_bsddb44.vcproj Sat Jun 14 00:38:33 2008 @@ -1,1252 +1,1252 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild/bdist_wininst.vcproj ============================================================================== --- python/trunk/PCbuild/bdist_wininst.vcproj (original) +++ python/trunk/PCbuild/bdist_wininst.vcproj Sat Jun 14 00:38:33 2008 @@ -1,270 +1,270 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild/kill_python.c ============================================================================== --- python/trunk/PCbuild/kill_python.c (original) +++ python/trunk/PCbuild/kill_python.c Sat Jun 14 00:38:33 2008 @@ -1,178 +1,178 @@ -/* - * Helper program for killing lingering python[_d].exe processes before - * building, thus attempting to avoid build failures due to files being - * locked. - */ - -#include -#include -#include -#include - -#pragma comment(lib, "psapi") - -#ifdef _DEBUG -#define PYTHON_EXE (L"python_d.exe") -#define PYTHON_EXE_LEN (12) -#define KILL_PYTHON_EXE (L"kill_python_d.exe") -#define KILL_PYTHON_EXE_LEN (17) -#else -#define PYTHON_EXE (L"python.exe") -#define PYTHON_EXE_LEN (10) -#define KILL_PYTHON_EXE (L"kill_python.exe") -#define KILL_PYTHON_EXE_LEN (15) -#endif - -int -main(int argc, char **argv) -{ - HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ - DWORD dac, our_pid; - size_t len; - wchar_t path[MAX_PATH+1]; - - MODULEENTRY32W me; - PROCESSENTRY32W pe; - - me.dwSize = sizeof(MODULEENTRY32W); - pe.dwSize = sizeof(PROCESSENTRY32W); - - memset(path, 0, MAX_PATH+1); - - our_pid = GetCurrentProcessId(); - - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); - if (hsm == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); - return 1; - } - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[1] failed: %d\n", GetLastError()); - CloseHandle(hsm); - return 1; - } - - /* - * Enumerate over the modules for the current process in order to find - * kill_process[_d].exe, then take a note of the directory it lives in. - */ - do { - if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) - continue; - - len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; - wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); - - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - if (path == NULL) { - printf("failed to discern directory of running process\n"); - return 1; - } - - /* - * Take a snapshot of system processes. Enumerate over the snapshot, - * looking for python processes. When we find one, verify it lives - * in the same directory we live in. If it does, kill it. If we're - * unable to kill it, treat this as a fatal error and return 1. - * - * The rationale behind this is that we're called at the start of the - * build process on the basis that we'll take care of killing any - * running instances, such that the build won't encounter permission - * denied errors during linking. If we can't kill one of the processes, - * we can't provide this assurance, and the build shouldn't start. - */ - - hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hsp == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); - return 1; - } - - if (!Process32FirstW(hsp, &pe)) { - printf("Process32FirstW failed: %d\n", GetLastError()); - CloseHandle(hsp); - return 1; - } - - dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; - do { - - /* - * XXX TODO: if we really wanted to be fancy, we could check the - * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python30[_d].dll), - * as that would also inhibit our ability to rebuild the solution. - * Not worth loosing sleep over though; for now, a simple check - * for just the python executable should be sufficient. - */ - - if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) - /* This isn't a python process. */ - continue; - - /* It's a python process, so figure out which directory it's in... */ - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); - if (hsm == INVALID_HANDLE_VALUE) - /* - * If our module snapshot fails (which will happen if we don't own - * the process), just ignore it and continue. (It seems different - * versions of Windows return different values for GetLastError() - * in this situation; it's easier to just ignore it and move on vs. - * stopping the build for what could be a false positive.) - */ - continue; - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[2] failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - do { - if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) - /* Wrong module, we're looking for python[_d].exe... */ - continue; - - if (_wcsnicmp(path, me.szExePath, len)) - /* Process doesn't live in our directory. */ - break; - - /* Python process residing in the right directory, kill it! */ - hp = OpenProcess(dac, FALSE, pe.th32ProcessID); - if (!hp) { - printf("OpenProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - if (!TerminateProcess(hp, 1)) { - printf("TerminateProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - CloseHandle(hp); - return 1; - } - - CloseHandle(hp); - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - } while (Process32NextW(hsp, &pe)); - - CloseHandle(hsp); - - return 0; -} - -/* vi: set ts=8 sw=4 sts=4 expandtab */ +/* + * Helper program for killing lingering python[_d].exe processes before + * building, thus attempting to avoid build failures due to files being + * locked. + */ + +#include +#include +#include +#include + +#pragma comment(lib, "psapi") + +#ifdef _DEBUG +#define PYTHON_EXE (L"python_d.exe") +#define PYTHON_EXE_LEN (12) +#define KILL_PYTHON_EXE (L"kill_python_d.exe") +#define KILL_PYTHON_EXE_LEN (17) +#else +#define PYTHON_EXE (L"python.exe") +#define PYTHON_EXE_LEN (10) +#define KILL_PYTHON_EXE (L"kill_python.exe") +#define KILL_PYTHON_EXE_LEN (15) +#endif + +int +main(int argc, char **argv) +{ + HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ + DWORD dac, our_pid; + size_t len; + wchar_t path[MAX_PATH+1]; + + MODULEENTRY32W me; + PROCESSENTRY32W pe; + + me.dwSize = sizeof(MODULEENTRY32W); + pe.dwSize = sizeof(PROCESSENTRY32W); + + memset(path, 0, MAX_PATH+1); + + our_pid = GetCurrentProcessId(); + + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); + if (hsm == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); + return 1; + } + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[1] failed: %d\n", GetLastError()); + CloseHandle(hsm); + return 1; + } + + /* + * Enumerate over the modules for the current process in order to find + * kill_process[_d].exe, then take a note of the directory it lives in. + */ + do { + if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) + continue; + + len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; + wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); + + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + if (path == NULL) { + printf("failed to discern directory of running process\n"); + return 1; + } + + /* + * Take a snapshot of system processes. Enumerate over the snapshot, + * looking for python processes. When we find one, verify it lives + * in the same directory we live in. If it does, kill it. If we're + * unable to kill it, treat this as a fatal error and return 1. + * + * The rationale behind this is that we're called at the start of the + * build process on the basis that we'll take care of killing any + * running instances, such that the build won't encounter permission + * denied errors during linking. If we can't kill one of the processes, + * we can't provide this assurance, and the build shouldn't start. + */ + + hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hsp == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); + return 1; + } + + if (!Process32FirstW(hsp, &pe)) { + printf("Process32FirstW failed: %d\n", GetLastError()); + CloseHandle(hsp); + return 1; + } + + dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; + do { + + /* + * XXX TODO: if we really wanted to be fancy, we could check the + * modules for all processes (not just the python[_d].exe ones) + * and see if any of our DLLs are loaded (i.e. python30[_d].dll), + * as that would also inhibit our ability to rebuild the solution. + * Not worth loosing sleep over though; for now, a simple check + * for just the python executable should be sufficient. + */ + + if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) + /* This isn't a python process. */ + continue; + + /* It's a python process, so figure out which directory it's in... */ + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); + if (hsm == INVALID_HANDLE_VALUE) + /* + * If our module snapshot fails (which will happen if we don't own + * the process), just ignore it and continue. (It seems different + * versions of Windows return different values for GetLastError() + * in this situation; it's easier to just ignore it and move on vs. + * stopping the build for what could be a false positive.) + */ + continue; + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[2] failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + do { + if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) + /* Wrong module, we're looking for python[_d].exe... */ + continue; + + if (_wcsnicmp(path, me.szExePath, len)) + /* Process doesn't live in our directory. */ + break; + + /* Python process residing in the right directory, kill it! */ + hp = OpenProcess(dac, FALSE, pe.th32ProcessID); + if (!hp) { + printf("OpenProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + if (!TerminateProcess(hp, 1)) { + printf("TerminateProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + CloseHandle(hp); + return 1; + } + + CloseHandle(hp); + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + } while (Process32NextW(hsp, &pe)); + + CloseHandle(hsp); + + return 0; +} + +/* vi: set ts=8 sw=4 sts=4 expandtab */ Modified: python/trunk/PCbuild/kill_python.vcproj ============================================================================== --- python/trunk/PCbuild/kill_python.vcproj (original) +++ python/trunk/PCbuild/kill_python.vcproj Sat Jun 14 00:38:33 2008 @@ -1,279 +1,279 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/trunk/PCbuild/sqlite3.vcproj ============================================================================== --- python/trunk/PCbuild/sqlite3.vcproj (original) +++ python/trunk/PCbuild/sqlite3.vcproj Sat Jun 14 00:38:33 2008 @@ -1,543 +1,543 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From buildbot at python.org Sat Jun 14 00:40:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 22:40:36 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080613224036.6A5281E4014@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1134 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 01:01:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 23:01:20 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080613230120.900781E4006@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/380 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 01:45:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 23:45:21 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080613234521.E2E081E4014@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/469 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 01:45:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 23:45:39 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080613234539.63A271E400E@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/132 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_email test_email_renamed ====================================================================== FAIL: test_crlf_separation (email.test.test_email.TestParsers) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/email/test/test_email.py", line 2471, in test_crlf_separation eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') AssertionError: 'Simple email with attachment.\n\n' != 'Simple email with attachment.\r\n\r\n' ====================================================================== FAIL: test_crlf_separation (email.test.test_email_renamed.TestParsers) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/email/test/test_email_renamed.py", line 2466, in test_crlf_separation eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') AssertionError: 'Simple email with attachment.\n\n' != 'Simple email with attachment.\r\n\r\n' sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 01:59:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 13 Jun 2008 23:59:16 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080613235916.461641E4006@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/678 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 89, in writerThread self._writerThread(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 278, in _writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 325, in failUnlessEqual raise self.failureException(msg or '%r != %r' % (first, second)) AssertionError: None != b'2000-2000-2000-2000-2000' Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 89, in writerThread self._writerThread(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 278, in _writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 325, in failUnlessEqual raise self.failureException(msg or '%r != %r' % (first, second)) AssertionError: None != b'1001-1001-1001-1001-1001' Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 89, in writerThread self._writerThread(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 278, in _writerThread self.assertEqual(data, self.makeData(key)) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 325, in failUnlessEqual raise self.failureException(msg or '%r != %r' % (first, second)) AssertionError: None != b'0002-0002-0002-0002-0002' 1 test failed: test_email ====================================================================== FAIL: test_crlf_separation (email.test.test_email.TestParsers) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/email/test/test_email.py", line 2459, in test_crlf_separation eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') AssertionError: 'Simple email with attachment.\n\n' != 'Simple email with attachment.\r\n\r\n' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 02:41:41 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 02:41:41 +0200 (CEST) Subject: [Python-checkins] r64260 - python/trunk/Lib/email/test/data/msg_26.txt Message-ID: <20080614004141.61EBA1E4007@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 02:41:41 2008 New Revision: 64260 Log: Revert eol-style to CRLF. Modified: python/trunk/Lib/email/test/data/msg_26.txt (contents, props changed) Modified: python/trunk/Lib/email/test/data/msg_26.txt ============================================================================== --- python/trunk/Lib/email/test/data/msg_26.txt (original) +++ python/trunk/Lib/email/test/data/msg_26.txt Sat Jun 14 02:41:41 2008 @@ -1,45 +1,45 @@ -Received: from xcar [192.168.0.2] by jeeves.wooster.local - (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 -Date: Sun, 12 May 2002 08:56:15 +0100 -From: Father Time -To: timbo at jeeves.wooster.local -Subject: IMAP file test -Message-ID: <6df65d354b.father.time at rpc.wooster.local> -X-Organization: Home -User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" -Status: R -X-UIDL: 319998302 - -This message is in MIME format which your mailer apparently does not support. -You either require a newer version of your software which supports MIME, or -a separate MIME decoding utility. Alternatively, ask the sender of this -message to resend it in a different format. - ---1618492860--2051301190--113853680 -Content-Type: text/plain; charset=us-ascii - -Simple email with attachment. - - ---1618492860--2051301190--113853680 -Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 -Content-Disposition: attachment; filename="clock.bmp" -Content-Transfer-Encoding: base64 - -Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA -AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A -zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA -C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ -f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// -////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// -8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA -AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA -sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 -z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA -AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH -MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA -AAAAAAAIAAAAAAAAAIAAAAAA - ---1618492860--2051301190--113853680-- +Received: from xcar [192.168.0.2] by jeeves.wooster.local + (SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 +Date: Sun, 12 May 2002 08:56:15 +0100 +From: Father Time +To: timbo at jeeves.wooster.local +Subject: IMAP file test +Message-ID: <6df65d354b.father.time at rpc.wooster.local> +X-Organization: Home +User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" +Status: R +X-UIDL: 319998302 + +This message is in MIME format which your mailer apparently does not support. +You either require a newer version of your software which supports MIME, or +a separate MIME decoding utility. Alternatively, ask the sender of this +message to resend it in a different format. + +--1618492860--2051301190--113853680 +Content-Type: text/plain; charset=us-ascii + +Simple email with attachment. + + +--1618492860--2051301190--113853680 +Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 +Content-Disposition: attachment; filename="clock.bmp" +Content-Transfer-Encoding: base64 + +Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA +AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A +zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA +C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ +f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// +////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// +8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA +AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA +sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 +z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA +AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH +MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA +AAAAAAAIAAAAAAAAAIAAAAAA + +--1618492860--2051301190--113853680-- From buildbot at python.org Sat Jun 14 03:24:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 01:24:52 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080614012452.95ECE1E4006@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1136 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 03:26:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 01:26:15 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080614012616.000A81E4018@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3557 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 03:35:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 01:35:47 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080614013547.A6F761E4006@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1590 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 03:50:46 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 03:50:46 +0200 (CEST) Subject: [Python-checkins] r64262 - python/trunk/Tools/scripts/svneol.py Message-ID: <20080614015046.AB77B1E4009@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 03:50:46 2008 New Revision: 64262 Log: Support subversion repositories of version 8. Modified: python/trunk/Tools/scripts/svneol.py Modified: python/trunk/Tools/scripts/svneol.py ============================================================================== --- python/trunk/Tools/scripts/svneol.py (original) +++ python/trunk/Tools/scripts/svneol.py Sat Jun 14 03:50:46 2008 @@ -33,9 +33,21 @@ import re import os +def propfile(root, fn): + default = os.path.join(root, ".svn", "props", fn+".svn-work") + try: + format = int(open(os.path.join(root, ".svn", "format")).read().strip()) + except IOError: + return default + # XXX I don't know what version uses what format; + # this condition is just anecdotal + if format >= 8: + return os.path.join(root, ".svn", "prop-base", fn+".svn-base") + return default + def proplist(root, fn): "Return a list of property names for file fn in directory root" - path = os.path.join(root, ".svn", "props", fn+".svn-work") + path = propfile(root, fn) try: f = open(path) except IOError: From buildbot at python.org Sat Jun 14 04:15:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 02:15:40 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080614021540.799711E4006@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1005 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_email ====================================================================== FAIL: test_crlf_separation (email.test.test_email.TestParsers) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/email/test/test_email.py", line 2459, in test_crlf_separation eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n') AssertionError: 'Simple email with attachment.\n\n' != 'Simple email with attachment.\r\n\r\n' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 05:19:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 03:19:34 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080614031935.399951E4006@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/384 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sat Jun 14 07:10:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 05:10:07 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080614051008.095B81E4016@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1592 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 08:24:44 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 08:24:44 +0200 (CEST) Subject: [Python-checkins] r64265 - python/trunk/Tools/scripts/svneol.py Message-ID: <20080614062444.74A391E4007@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 08:24:44 2008 New Revision: 64265 Log: Conservatively restrict support to format 8 repositories. Modified: python/trunk/Tools/scripts/svneol.py Modified: python/trunk/Tools/scripts/svneol.py ============================================================================== --- python/trunk/Tools/scripts/svneol.py (original) +++ python/trunk/Tools/scripts/svneol.py Sat Jun 14 08:24:44 2008 @@ -33,48 +33,50 @@ import re import os -def propfile(root, fn): +def propfiles(root, fn): default = os.path.join(root, ".svn", "props", fn+".svn-work") try: format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: - return default - # XXX I don't know what version uses what format; - # this condition is just anecdotal - if format >= 8: - return os.path.join(root, ".svn", "prop-base", fn+".svn-base") - return default + return [] + if format == 8: + # In version 8, committed props are stored in prop-base, + # local modifications in props + return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"), + os.path.join(root, ".svn", "props", fn+".svn-work")] + raise ValueError, "Unknown repository format" def proplist(root, fn): "Return a list of property names for file fn in directory root" - path = propfile(root, fn) - try: - f = open(path) - except IOError: - # no properties file: not under version control - return [] result = [] - while 1: - # key-value pairs, of the form - # K - # NL - # V length - # NL - # END - line = f.readline() - if line.startswith("END"): - break - assert line.startswith("K ") - L = int(line.split()[1]) - key = f.read(L) - result.append(key) - f.readline() - line = f.readline() - assert line.startswith("V ") - L = int(line.split()[1]) - value = f.read(L) - f.readline() - f.close() + for path in propfiles(root, fn): + try: + f = open(path) + except IOError: + # no properties file: not under version control, + # or no properties set + continue + while 1: + # key-value pairs, of the form + # K + # NL + # V length + # NL + # END + line = f.readline() + if line.startswith("END"): + break + assert line.startswith("K ") + L = int(line.split()[1]) + key = f.read(L) + result.append(key) + f.readline() + line = f.readline() + assert line.startswith("V ") + L = int(line.split()[1]) + value = f.read(L) + f.readline() + f.close() return result possible_text_file = re.compile(r"\.([hc]|py|txt|sln|vcproj)$").search From buildbot at python.org Sat Jun 14 09:20:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 07:20:18 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080614072018.99ED71E400B@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/681 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,martin.v.loewis BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 09:40:32 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 14 Jun 2008 09:40:32 +0200 (CEST) Subject: [Python-checkins] r64267 - python/trunk/Tools/buildbot/external-common.bat Message-ID: <20080614074032.A4E141E4007@bag.python.org> Author: amaury.forgeotdarc Date: Sat Jun 14 09:40:32 2008 New Revision: 64267 Log: Use the correct URL for sqlite3 sources, and try to fix windows buildbots. Modified: python/trunk/Tools/buildbot/external-common.bat Modified: python/trunk/Tools/buildbot/external-common.bat ============================================================================== --- python/trunk/Tools/buildbot/external-common.bat (original) +++ python/trunk/Tools/buildbot/external-common.bat Sat Jun 14 09:40:32 2008 @@ -15,7 +15,7 @@ @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1 @rem if exist db-4.4.20 rd /s/q db-4.4.20 @rem if exist openssl-0.9.8g rd /s/q openssl-0.9.8g - at rem if exist sqlite-source-3.5.9 rd /s/q sqlite-source-3.5.9 + at rem if exist sqlite-3.5.9 rd /s/q sqlite-3.5.9 @rem bzip if not exist bzip2-1.0.5 ( @@ -37,7 +37,7 @@ if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0 @rem sqlite3 -if not exist sqlite-source-3.5.9 ( +if not exist sqlite-3.5.9 ( rd /s/q sqlite-source-3.3.4 - svn export http://svn.python.org/projects/external/sqlite-source-3.5.9 + svn export http://svn.python.org/projects/external/sqlite-3.5.9 ) From python-checkins at python.org Sat Jun 14 10:07:25 2008 From: python-checkins at python.org (thomas.lee) Date: Sat, 14 Jun 2008 10:07:25 +0200 (CEST) Subject: [Python-checkins] r64268 - in python/branches/tlee-ast-optimize: Doc/library/ctypes.rst Doc/library/future_builtins.rst Doc/library/mimetools.rst Doc/library/optparse.rst Doc/library/rfc822.rst Doc/library/threading.rst Doc/using/cmdline.rst Include/Python.h Include/pythonrun.h Include/pythread.h Lib/Queue.py Lib/_threading_local.py Lib/logging/__init__.py Lib/mimetools.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/synchronize.py Lib/rfc822.py Lib/test/crashers/loosing_mro_ref.py Lib/test/test_dummy_threading.py Lib/test/test_heapq.py Lib/test/test_mimetools.py Lib/test/test_multiprocessing.py Lib/test/test_py3kwarn.py Lib/test/test_queue.py Lib/test/test_rfc822.py Lib/test/test_smtplib.py Lib/test/test_socket.py Lib/test/test_socketserver.py Lib/test/test_sys.py Lib/test/test_threading.py Lib/test/threaded_import_hangers.py Lib/threading.py Misc/ACKS Misc/NEWS Modules/_collectionsmodule.c Modules/_ctypes/callproc.c Modules/_localemodule.c Modules/_multiprocessing/multiprocessing.c Modules/_tkinter.c Modules/arraymodule.c Modules/errnomodule.c Modules/future_builtins.c Modules/signalmodule.c Modules/socketmodule.c Modules/socketmodule.h Modules/unicodedata_db.h Objects/tupleobject.c PC/VC6/_socket.dsp PC/VC6/pythoncore.dsp PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/kill_python.c PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyproject.vsprops PC/VS8.0/python.vcproj PC/VS8.0/sqlite3.vcproj PC/msvcrtmodule.c PC/pyconfig.h PCbuild/_elementtree.vcproj PCbuild/_multiprocessing.vcproj PCbuild/build_tkinter.py PCbuild/make_versioninfo.vcproj PCbuild/pcbuild.sln PCbuild/pyproject.vsprops PCbuild/python.vcproj PCbuild/vs9to8.py Parser/intrcheck.c Python/thread.c Tools/buildbot/external-amd64.bat Tools/buildbot/external-common.bat Tools/buildbot/external.bat Tools/msi/msi.py Tools/msi/msilib.py Tools/unicode/makeunicodedata.py Message-ID: <20080614080725.2EFC11E4009@bag.python.org> Author: thomas.lee Date: Sat Jun 14 10:07:22 2008 New Revision: 64268 Log: Merged revisions 64121-64232 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64123 | benjamin.peterson | 2008-06-12 02:50:57 +1000 (Thu, 12 Jun 2008) | 2 lines fix Windows building for multiprocessing ........ r64125 | benjamin.peterson | 2008-06-12 03:27:50 +1000 (Thu, 12 Jun 2008) | 2 lines give the threading API PEP 8 names ........ r64128 | benjamin.peterson | 2008-06-12 03:50:00 +1000 (Thu, 12 Jun 2008) | 2 lines add aliases to threading module ........ r64129 | georg.brandl | 2008-06-12 03:53:38 +1000 (Thu, 12 Jun 2008) | 2 lines Fix typos. ........ r64130 | georg.brandl | 2008-06-12 03:57:44 +1000 (Thu, 12 Jun 2008) | 2 lines Clarify what ":errorhandler" refers to. ........ r64131 | thomas.heller | 2008-06-12 03:58:19 +1000 (Thu, 12 Jun 2008) | 1 line Markup fixes, spelling corrections, and better wordings. Hopefully. ........ r64132 | gregory.p.smith | 2008-06-12 04:00:52 +1000 (Thu, 12 Jun 2008) | 3 lines Correct an incorrect comment about our #include of stddef.h. (see Doug Evans' comment on python-dev 2008-06-10) ........ r64133 | benjamin.peterson | 2008-06-12 04:02:31 +1000 (Thu, 12 Jun 2008) | 2 lines add old names back into __all__ ........ r64135 | thomas.heller | 2008-06-12 04:10:43 +1000 (Thu, 12 Jun 2008) | 1 line More doc fixes. ........ r64139 | thomas.heller | 2008-06-12 04:40:51 +1000 (Thu, 12 Jun 2008) | 1 line Smaller doc fixes. ........ r64142 | georg.brandl | 2008-06-12 04:55:38 +1000 (Thu, 12 Jun 2008) | 2 lines Add future_builtins.ascii(). ........ r64143 | thomas.heller | 2008-06-12 05:10:22 +1000 (Thu, 12 Jun 2008) | 1 line Add versionadded marker to ctypes.c_longdouble. ........ r64146 | thomas.heller | 2008-06-12 05:58:22 +1000 (Thu, 12 Jun 2008) | 2 lines Markup fixes, thanks Georg for the help. Document ctypes.util.find_library() and ctypes.util.find_msvcrt(). ........ r64147 | benjamin.peterson | 2008-06-12 06:04:30 +1000 (Thu, 12 Jun 2008) | 2 lines update ACKS and NEWs for multiprocessing ........ r64150 | georg.brandl | 2008-06-12 06:28:06 +1000 (Thu, 12 Jun 2008) | 2 lines Can we agree to put dots at entry ends? Thanks. ........ r64165 | armin.rigo | 2008-06-12 19:50:58 +1000 (Thu, 12 Jun 2008) | 3 lines Sounds obvious, but I didn't even realize that you can put non-string keys in type dictionaries without using this locals() hack. ........ r64169 | benjamin.peterson | 2008-06-13 00:23:49 +1000 (Fri, 13 Jun 2008) | 1 line deprecated mimetools ........ r64185 | martin.v.loewis | 2008-06-13 04:38:47 +1000 (Fri, 13 Jun 2008) | 1 line Switch to Tcl/Tk 8.5.2. ........ r64189 | martin.v.loewis | 2008-06-13 04:52:00 +1000 (Fri, 13 Jun 2008) | 1 line Switch to Tcl/Tk 8.5. ........ r64191 | martin.v.loewis | 2008-06-13 05:00:14 +1000 (Fri, 13 Jun 2008) | 1 line Revert bogus disabling of Tcl and Tk. ........ r64194 | martin.v.loewis | 2008-06-13 05:51:59 +1000 (Fri, 13 Jun 2008) | 1 line Split Tcl make targets into separate ones. ........ r64195 | martin.v.loewis | 2008-06-13 06:06:18 +1000 (Fri, 13 Jun 2008) | 1 line Support file names which include '+' (for Tk 8.5). ........ r64196 | martin.v.loewis | 2008-06-13 06:07:53 +1000 (Fri, 13 Jun 2008) | 1 line Fix Tcl/Tk license file in tcl8*/tk8*, include Tix license. ........ r64197 | amaury.forgeotdarc | 2008-06-13 06:27:42 +1000 (Fri, 13 Jun 2008) | 3 lines It seems that my VS2008 Express does not include a project in the build configuration, if its UUID has lowercase letters. ........ r64202 | amaury.forgeotdarc | 2008-06-13 07:58:20 +1000 (Fri, 13 Jun 2008) | 5 lines Update VS8.0 build files, using the script vs9to8.py. Also remove references to odbc libraries, which are not shipped with vs2003 express. (and certainly not useful) ........ r64206 | benjamin.peterson | 2008-06-13 08:33:06 +1000 (Fri, 13 Jun 2008) | 2 lines add py3k warnings to rfc822 ........ r64212 | benjamin.peterson | 2008-06-13 10:09:47 +1000 (Fri, 13 Jun 2008) | 3 lines #1683 prevent forking from interfering in threading storage This should prevent some test_multiprocessing failures ........ r64214 | amaury.forgeotdarc | 2008-06-13 10:42:22 +1000 (Fri, 13 Jun 2008) | 6 lines Restore support for Microsoft VC6 compiler. Some functions in the msvcrt module are skipped, and socket.ioctl is enabled only when using a more recent Platform SDK. (and yes, there are still companies that use a 10-years old compiler) ........ r64219 | neal.norwitz | 2008-06-13 16:00:46 +1000 (Fri, 13 Jun 2008) | 1 line Check for memory alloc failure ........ r64220 | neal.norwitz | 2008-06-13 16:02:26 +1000 (Fri, 13 Jun 2008) | 3 lines Fix some memory dealloc problems when exceptions occur. It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest. ........ r64221 | neal.norwitz | 2008-06-13 16:03:25 +1000 (Fri, 13 Jun 2008) | 3 lines Fix typo in method name. The LT class implemented less than. The LE class should implement less than or equal to (as the code does). ........ r64223 | georg.brandl | 2008-06-13 16:56:50 +1000 (Fri, 13 Jun 2008) | 2 lines #3095: don't leak values from Py_BuildValue. ........ r64224 | georg.brandl | 2008-06-13 17:08:48 +1000 (Fri, 13 Jun 2008) | 2 lines Typo. ........ r64226 | martin.v.loewis | 2008-06-13 17:47:47 +1000 (Fri, 13 Jun 2008) | 2 lines Make more symbols static. ........ r64229 | georg.brandl | 2008-06-13 23:26:54 +1000 (Fri, 13 Jun 2008) | 2 lines Clarification. ........ r64230 | robert.schuppenies | 2008-06-13 23:29:37 +1000 (Fri, 13 Jun 2008) | 2 lines Fixed: sys.getsizeof does not take the actual length of the tuples into account. ........ Added: python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.c - copied unchanged from r64230, /python/trunk/PC/VS8.0/kill_python.c python/branches/tlee-ast-optimize/PCbuild/_multiprocessing.vcproj - copied unchanged from r64230, /python/trunk/PCbuild/_multiprocessing.vcproj Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/library/ctypes.rst python/branches/tlee-ast-optimize/Doc/library/future_builtins.rst python/branches/tlee-ast-optimize/Doc/library/mimetools.rst python/branches/tlee-ast-optimize/Doc/library/optparse.rst python/branches/tlee-ast-optimize/Doc/library/rfc822.rst python/branches/tlee-ast-optimize/Doc/library/threading.rst python/branches/tlee-ast-optimize/Doc/using/cmdline.rst python/branches/tlee-ast-optimize/Include/Python.h python/branches/tlee-ast-optimize/Include/pythonrun.h python/branches/tlee-ast-optimize/Include/pythread.h python/branches/tlee-ast-optimize/Lib/Queue.py python/branches/tlee-ast-optimize/Lib/_threading_local.py python/branches/tlee-ast-optimize/Lib/logging/__init__.py python/branches/tlee-ast-optimize/Lib/mimetools.py python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py python/branches/tlee-ast-optimize/Lib/rfc822.py python/branches/tlee-ast-optimize/Lib/test/crashers/loosing_mro_ref.py python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py python/branches/tlee-ast-optimize/Lib/test/test_heapq.py python/branches/tlee-ast-optimize/Lib/test/test_mimetools.py python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_queue.py python/branches/tlee-ast-optimize/Lib/test/test_rfc822.py python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py python/branches/tlee-ast-optimize/Lib/test/test_socket.py python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_threading.py python/branches/tlee-ast-optimize/Lib/test/threaded_import_hangers.py python/branches/tlee-ast-optimize/Lib/threading.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c python/branches/tlee-ast-optimize/Modules/_localemodule.c python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c python/branches/tlee-ast-optimize/Modules/_tkinter.c python/branches/tlee-ast-optimize/Modules/arraymodule.c python/branches/tlee-ast-optimize/Modules/errnomodule.c python/branches/tlee-ast-optimize/Modules/future_builtins.c python/branches/tlee-ast-optimize/Modules/signalmodule.c python/branches/tlee-ast-optimize/Modules/socketmodule.c python/branches/tlee-ast-optimize/Modules/socketmodule.h python/branches/tlee-ast-optimize/Modules/unicodedata_db.h python/branches/tlee-ast-optimize/Objects/tupleobject.c python/branches/tlee-ast-optimize/PC/VC6/_socket.dsp python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln python/branches/tlee-ast-optimize/PC/VS8.0/pyproject.vsprops python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj python/branches/tlee-ast-optimize/PC/msvcrtmodule.c python/branches/tlee-ast-optimize/PC/pyconfig.h python/branches/tlee-ast-optimize/PCbuild/_elementtree.vcproj python/branches/tlee-ast-optimize/PCbuild/build_tkinter.py python/branches/tlee-ast-optimize/PCbuild/make_versioninfo.vcproj python/branches/tlee-ast-optimize/PCbuild/pcbuild.sln python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops python/branches/tlee-ast-optimize/PCbuild/python.vcproj python/branches/tlee-ast-optimize/PCbuild/vs9to8.py python/branches/tlee-ast-optimize/Parser/intrcheck.c python/branches/tlee-ast-optimize/Python/thread.c python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat python/branches/tlee-ast-optimize/Tools/buildbot/external.bat python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/Tools/msi/msilib.py python/branches/tlee-ast-optimize/Tools/unicode/makeunicodedata.py Modified: python/branches/tlee-ast-optimize/Doc/library/ctypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ctypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ctypes.rst Sat Jun 14 10:07:22 2008 @@ -42,7 +42,7 @@ convention, while *windll* libraries call functions using the ``stdcall`` calling convention. *oledll* also uses the ``stdcall`` calling convention, and assumes the functions return a Windows :class:`HRESULT` error code. The error -code is used to automatically raise :class:`WindowsError` Python exceptions when +code is used to automatically raise a :class:`WindowsError` exception when the function call fails. Here are some examples for Windows. Note that ``msvcrt`` is the MS standard C @@ -57,10 +57,10 @@ >>> libc = cdll.msvcrt # doctest: +WINDOWS >>> -Windows appends the usual '.dll' file suffix automatically. +Windows appends the usual ``.dll`` file suffix automatically. On Linux, it is required to specify the filename *including* the extension to -load a library, so attribute access does not work. Either the +load a library, so attribute access can not be used to load libraries. Either the :meth:`LoadLibrary` method of the dll loaders should be used, or you should load the library by creating an instance of CDLL by calling the constructor:: @@ -109,7 +109,7 @@ *windll* does not try to select one of them by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` -explicitly, and then call it with normal strings or unicode strings +explicitly, and then call it with strings or unicode strings respectively. Sometimes, dlls export functions with names which aren't valid Python @@ -424,9 +424,9 @@ in the :attr:`argtypes` sequence. The :meth:`from_param` class method receives the Python object passed to the function call, it should do a typecheck or whatever is needed to make sure this object is acceptable, and then return the -object itself, it's :attr:`_as_parameter_` attribute, or whatever you want to +object itself, its :attr:`_as_parameter_` attribute, or whatever you want to pass as the C function argument in this case. Again, the result should be an -integer, string, unicode, a ``ctypes`` instance, or something having the +integer, string, unicode, a ``ctypes`` instance, or an object with an :attr:`_as_parameter_` attribute. @@ -721,6 +721,8 @@ c_long(99) >>> +.. XXX Document dereferencing pointers, and that it is preferred over the .contents attribute. + Pointer instances can also be indexed with integers:: >>> pi[0] @@ -767,7 +769,7 @@ >>> ``ctypes`` checks for ``NULL`` when dereferencing pointers (but dereferencing -non-\ ``NULL`` pointers would crash Python):: +invalid non-\ ``NULL`` pointers would crash Python):: >>> null_ptr[0] Traceback (most recent call last): @@ -813,9 +815,9 @@ >>> bar.values = None >>> -XXX list other conversions... +.. XXX list other conversions... -Sometimes you have instances of incompatible types. In ``C``, you can cast one +Sometimes you have instances of incompatible types. In C, you can cast one type into another type. ``ctypes`` provides a ``cast`` function which can be used in the same way. The ``Bar`` structure defined above accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its ``values`` field, @@ -1072,7 +1074,7 @@ Accessing values exported from dlls ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Sometimes, a dll not only exports functions, it also exports variables. An +Some shared libraries not only export functions, they also export variables. An example in the Python library itself is the ``Py_OptimizeFlag``, an integer set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` flag given on startup. @@ -1248,17 +1250,6 @@ is already known, on a case by case basis. -.. _ctypes-bugs-todo-non-implemented-things: - -Bugs, ToDo and non-implemented things -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Enumeration types are not implemented. You can do it easily yourself, using -:class:`c_int` as the base class. - -``long double`` is not implemented. - - .. _ctypes-ctypes-reference: ctypes reference @@ -1617,9 +1608,8 @@ `use_last_error` does the same for the Windows error code. .. versionchanged:: 2.6 - - The optional `use_errno` and `use_last_error` parameters were added - in Python 2.6. + The optional `use_errno` and `use_last_error` parameters were + added. .. function:: WINFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) @@ -1635,75 +1625,71 @@ The returned function prototype creates functions that use the Python calling convention. The function will *not* release the GIL during the call. -Function prototypes created by the factory functions can be instantiated in -different ways, depending on the type and number of the parameters in the call. - - -.. function:: prototype(address) - :noindex: +Function prototypes created by these factory functions can be instantiated in +different ways, depending on the type and number of the parameters in the call: - Returns a foreign function at the specified address. + .. function:: prototype(address) + :noindex: + :module: -.. function:: prototype(callable) - :noindex: + Returns a foreign function at the specified address which must be an integer. - Create a C callable function (a callback function) from a Python ``callable``. + .. function:: prototype(callable) + :noindex: + :module: -.. function:: prototype(func_spec[, paramflags]) - :noindex: + Create a C callable function (a callback function) from a Python ``callable``. - Returns a foreign function exported by a shared library. ``func_spec`` must be a - 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the - exported function as string, or the ordinal of the exported function as small - integer. The second item is the shared library instance. + .. function:: prototype(func_spec[, paramflags]) + :noindex: + :module: -.. function:: prototype(vtbl_index, name[, paramflags[, iid]]) - :noindex: - - Returns a foreign function that will call a COM method. ``vtbl_index`` is the - index into the virtual function table, a small non-negative integer. *name* is - name of the COM method. *iid* is an optional pointer to the interface identifier - which is used in extended error reporting. + Returns a foreign function exported by a shared library. ``func_spec`` must be a + 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the + exported function as string, or the ordinal of the exported function as small + integer. The second item is the shared library instance. - COM methods use a special calling convention: They require a pointer to the COM - interface as first argument, in addition to those parameters that are specified - in the :attr:`argtypes` tuple. -The optional *paramflags* parameter creates foreign function wrappers with much -more functionality than the features described above. + .. function:: prototype(vtbl_index, name[, paramflags[, iid]]) + :noindex: + :module: -*paramflags* must be a tuple of the same length as :attr:`argtypes`. + Returns a foreign function that will call a COM method. ``vtbl_index`` is the + index into the virtual function table, a small non-negative integer. *name* is + name of the COM method. *iid* is an optional pointer to the interface identifier + which is used in extended error reporting. -Each item in this tuple contains further information about a parameter, it must -be a tuple containing 1, 2, or 3 items. - -The first item is an integer containing flags for the parameter: - - -.. data:: 1 - :noindex: + COM methods use a special calling convention: They require a pointer to the COM + interface as first argument, in addition to those parameters that are specified + in the :attr:`argtypes` tuple. - Specifies an input parameter to the function. + The optional *paramflags* parameter creates foreign function wrappers with much + more functionality than the features described above. + *paramflags* must be a tuple of the same length as :attr:`argtypes`. -.. data:: 2 - :noindex: + Each item in this tuple contains further information about a parameter, it must + be a tuple containing one, two, or three items. - Output parameter. The foreign function fills in a value. + The first item is an integer containing a combination of direction + flags for the parameter: + 1 + Specifies an input parameter to the function. -.. data:: 4 - :noindex: + 2 + Output parameter. The foreign function fills in a value. - Input parameter which defaults to the integer zero. + 4 + Input parameter which defaults to the integer zero. -The optional second item is the parameter name as string. If this is specified, -the foreign function can be called with named parameters. + The optional second item is the parameter name as string. If this is specified, + the foreign function can be called with named parameters. -The optional third item is the default value for this parameter. + The optional third item is the default value for this parameter. This example demonstrates how to wrap the Windows ``MessageBoxA`` function so that it supports default parameters and named arguments. The C declaration from @@ -1716,16 +1702,14 @@ LPCSTR lpCaption, UINT uType); -Here is the wrapping with ``ctypes``: - - :: +Here is the wrapping with ``ctypes``:: - >>> from ctypes import c_int, WINFUNCTYPE, windll - >>> from ctypes.wintypes import HWND, LPCSTR, UINT - >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) - >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) - >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) - >>> + >>> from ctypes import c_int, WINFUNCTYPE, windll + >>> from ctypes.wintypes import HWND, LPCSTR, UINT + >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT) + >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) + >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) + >>> The MessageBox foreign function can now be called in these ways:: @@ -1743,16 +1727,14 @@ HWND hWnd, LPRECT lpRect); -Here is the wrapping with ``ctypes``: - - :: +Here is the wrapping with ``ctypes``:: - >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError - >>> from ctypes.wintypes import BOOL, HWND, RECT - >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) - >>> paramflags = (1, "hwnd"), (2, "lprect") - >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) - >>> + >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError + >>> from ctypes.wintypes import BOOL, HWND, RECT + >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) + >>> paramflags = (1, "hwnd"), (2, "lprect") + >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) + >>> Functions with output parameters will automatically return the output parameter value if there is a single one, or a tuple containing the output parameter @@ -1768,6 +1750,7 @@ ... if not result: ... raise WinError() ... return args + ... >>> GetWindowRect.errcheck = errcheck >>> @@ -1782,7 +1765,7 @@ ... raise WinError() ... rc = args[1] ... return rc.left, rc.top, rc.bottom, rc.right - >>> + ... >>> GetWindowRect.errcheck = errcheck >>> @@ -1878,6 +1861,33 @@ servers with ctypes. It is called from the DllGetClassObject function that the ``_ctypes`` extension dll exports. +.. function:: find_library(name) + :module: ctypes.util + + Try to find a library and return a pathname. `name` is the library name without + any prefix like `lib`, suffix like ``.so``, ``.dylib`` or version number (this + is the form used for the posix linker option :option:`-l`). If no library can + be found, returns ``None``. + + The exact functionality is system dependent. + + .. versionchanged:: 2.6 + Windows only: ``find_library("m")`` or + ``find_library("c")`` return the result of a call to + ``find_msvcrt()``. + +.. function:: find_msvcrt() + :module: ctypes.util + + Windows only: return the filename of the VC runtype library used + by Python, and by the extension modules. If the name of the + library cannot be determined, ``None`` is returned. + + If you need to free memory, for example, allocated by an extension + module with a call to the ``free(void *)``, it is important that you + use the function in the same library that allocated the memory. + + .. versionadded:: 2.6 .. function:: FormatError([code]) @@ -2172,6 +2182,7 @@ optional float initializer. On platforms where ``sizeof(long double) == sizeof(double)`` it is an alias to :class:`c_double`. + .. versionadded:: 2.6 .. class:: c_float Modified: python/branches/tlee-ast-optimize/Doc/library/future_builtins.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/future_builtins.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/future_builtins.rst Sat Jun 14 10:07:22 2008 @@ -28,6 +28,14 @@ Available builtins are: +.. function:: ascii(object) + + Returns the same as :func:`repr`. In Python 3, :func:`repr` will return + printable Unicode characters unescaped, while :func:`ascii` will always + backslash-escape them. Using :func:`future_builtins.ascii` instead of + :func:`repr` in 2.6 code makes it clear that you need a pure ASCII return + value. + .. function:: filter(function, iterable) Works like :func:`itertools.ifilter`. Modified: python/branches/tlee-ast-optimize/Doc/library/mimetools.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/mimetools.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/mimetools.rst Sat Jun 14 10:07:22 2008 @@ -9,7 +9,8 @@ .. deprecated:: 2.3 The :mod:`email` package should be used in preference to the :mod:`mimetools` - module. This module is present only to maintain backward compatibility. + module. This module is present only to maintain backward compatibility, and + it has been removed in 3.x. .. index:: module: rfc822 Modified: python/branches/tlee-ast-optimize/Doc/library/optparse.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/optparse.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/optparse.rst Sat Jun 14 10:07:22 2008 @@ -641,9 +641,9 @@ option involved in the error; be sure to do the same when calling ``parser.error()`` from your application code. -If :mod:`optparse`'s default error-handling behaviour does not suite your needs, -you'll need to subclass OptionParser and override ``exit()`` and/or -:meth:`error`. +If :mod:`optparse`'s default error-handling behaviour does not suit your needs, +you'll need to subclass OptionParser and override its :meth:`exit` and/or +:meth:`error` methods. .. _optparse-putting-it-all-together: Modified: python/branches/tlee-ast-optimize/Doc/library/rfc822.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/rfc822.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/rfc822.rst Sat Jun 14 10:07:22 2008 @@ -9,7 +9,8 @@ .. deprecated:: 2.3 The :mod:`email` package should be used in preference to the :mod:`rfc822` - module. This module is present only to maintain backward compatibility. + module. This module is present only to maintain backward compatibility, and + has been removed in 3.0. This module defines a class, :class:`Message`, which represents an "email message" as defined by the Internet standard :rfc:`2822`. [#]_ Such messages Modified: python/branches/tlee-ast-optimize/Doc/library/threading.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/threading.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/threading.rst Sat Jun 14 10:07:22 2008 @@ -1,4 +1,3 @@ - :mod:`threading` --- Higher-level threading interface ===================================================== @@ -13,10 +12,16 @@ The :mod:`dummy_threading` module is provided for situations where :mod:`threading` cannot be used because :mod:`thread` is missing. +.. note:: + + In 3.x, names in ``camelCase`` have been renamed to their underscored + equivalents. Both names are available in 2.6. + This module defines the following functions and objects: -.. function:: activeCount() +.. function:: active_count() + activeCount() Return the number of :class:`Thread` objects currently alive. The returned count is equal to the length of the list returned by :func:`enumerate`. @@ -30,7 +35,8 @@ thread. -.. function:: currentThread() +.. function:: current_thread() + currentThread() Return the current :class:`Thread` object, corresponding to the caller's thread of control. If the caller's thread of control was not created through the @@ -40,10 +46,10 @@ .. function:: enumerate() - Return a list of all :class:`Thread` objects currently alive. The list includes - daemonic threads, dummy thread objects created by :func:`currentThread`, and the - main thread. It excludes terminated threads and threads that have not yet been - started. + Return a list of all :class:`Thread` objects currently alive. The list + includes daemonic threads, dummy thread objects created by + :func:`current_thread`, and the main thread. It excludes terminated threads + and threads that have not yet been started. .. function:: Event() @@ -395,7 +401,8 @@ lock, its caller should. -.. method:: Condition.notifyAll() +.. method:: Condition.notify_all() + Condition.notifyAll() Wake up all threads waiting on this condition. This method acts like :meth:`notify`, but wakes up all waiting threads instead of one. If the calling @@ -498,7 +505,8 @@ The internal flag is initially false. -.. method:: Event.isSet() +.. method:: Event.is_set() + Event.isSet() Return true if and only if the internal flag is true. @@ -552,12 +560,12 @@ thread until the thread whose :meth:`join` method is called is terminated. A thread has a name. The name can be passed to the constructor, set with the -:meth:`setName` method, and retrieved with the :meth:`getName` method. +:meth:`set_name` method, and retrieved with the :meth:`get_name` method. A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with -the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method. +the :meth:`set_daemon` method and retrieved with the :meth:`is_daemon` method. There is a "main thread" object; this corresponds to the initial thread of control in the Python program. It is not a daemon thread. @@ -637,12 +645,14 @@ raises the same exception. -.. method:: Thread.getName() +.. method:: Thread.get_name() + Thread.getName() Return the thread's name. -.. method:: Thread.setName(name) +.. method:: Thread.set_name(name) + Thread.setName(name) Set the thread's name. @@ -651,18 +661,19 @@ constructor. -.. method:: Thread.getIdent() +.. method:: Thread.get_ident() Return the 'thread identifier' of this thread or None if the thread has not - been started. This is a nonzero integer. See the :mod:`thread` module's - :func:`get_ident()` function. Thread identifiers may be recycled when a - thread exits and another thread is created. The identifier is returned - even after the thread has exited. + been started. This is a nonzero integer. See the :func:`thread.get_ident()` + function. Thread identifiers may be recycled when a thread exits and another + thread is created. The identifier is returned even after the thread has + exited. .. versionadded:: 2.6 -.. method:: Thread.isAlive() +.. method:: Thread.is_alive() + Thread.isAlive() Return whether the thread is alive. @@ -671,12 +682,14 @@ returns a list of all alive threads. -.. method:: Thread.isDaemon() +.. method:: Thread.is_daemon() + Thread.isDaemon() Return the thread's daemon flag. -.. method:: Thread.setDaemon(daemonic) +.. method:: Thread.set_daemon(daemonic) + Thread.setDaemon(daemonic) Set the thread's daemon flag to the Boolean value *daemonic*. This must be called before :meth:`start` is called, otherwise :exc:`RuntimeError` is raised. Modified: python/branches/tlee-ast-optimize/Doc/using/cmdline.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/using/cmdline.rst (original) +++ python/branches/tlee-ast-optimize/Doc/using/cmdline.rst Sat Jun 14 10:07:22 2008 @@ -484,7 +484,8 @@ .. envvar:: PYTHONIOENCODING Overrides the encoding used for stdin/stdout/stderr, in the syntax - encodingname:errorhandler, with the :errors part being optional. + ``encodingname:errorhandler``. The ``:errorhandler`` part is optional and + has the same meaning as in :func:`str.encode`. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Include/Python.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/Python.h (original) +++ python/branches/tlee-ast-optimize/Include/Python.h Sat Jun 14 10:07:22 2008 @@ -44,7 +44,7 @@ #include #endif -/* For uintptr_t, intptr_t */ +/* For size_t? */ #ifdef HAVE_STDDEF_H #include #endif Modified: python/branches/tlee-ast-optimize/Include/pythonrun.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pythonrun.h (original) +++ python/branches/tlee-ast-optimize/Include/pythonrun.h Sat Jun 14 10:07:22 2008 @@ -154,7 +154,7 @@ to a 8k margin. */ #define PYOS_STACK_MARGIN 2048 -#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) +#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif Modified: python/branches/tlee-ast-optimize/Include/pythread.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/pythread.h (original) +++ python/branches/tlee-ast-optimize/Include/pythread.h Sat Jun 14 10:07:22 2008 @@ -40,6 +40,9 @@ PyAPI_FUNC(void *) PyThread_get_key_value(int); PyAPI_FUNC(void) PyThread_delete_key_value(int key); +/* Cleanup after a fork */ +PyAPI_FUNC(void) PyThread_ReInitTLS(void); + #ifdef __cplusplus } #endif Modified: python/branches/tlee-ast-optimize/Lib/Queue.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/Queue.py (original) +++ python/branches/tlee-ast-optimize/Lib/Queue.py Sat Jun 14 10:07:22 2008 @@ -62,7 +62,7 @@ if unfinished <= 0: if unfinished < 0: raise ValueError('task_done() called too many times') - self.all_tasks_done.notifyAll() + self.all_tasks_done.notify_all() self.unfinished_tasks = unfinished finally: self.all_tasks_done.release() Modified: python/branches/tlee-ast-optimize/Lib/_threading_local.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/_threading_local.py (original) +++ python/branches/tlee-ast-optimize/Lib/_threading_local.py Sat Jun 14 10:07:22 2008 @@ -162,16 +162,16 @@ # __init__ being called, to make sure we don't call it # again ourselves. dict = object.__getattribute__(self, '__dict__') - currentThread().__dict__[key] = dict + current_thread().__dict__[key] = dict return self def _patch(self): key = object.__getattribute__(self, '_local__key') - d = currentThread().__dict__.get(key) + d = current_thread().__dict__.get(key) if d is None: d = {} - currentThread().__dict__[key] = d + current_thread().__dict__[key] = d object.__setattr__(self, '__dict__', d) # we have a new instance dict, so call out __init__ if we have @@ -238,4 +238,4 @@ except KeyError: pass # didn't have anything in this thread -from threading import currentThread, RLock +from threading import current_thread, RLock Modified: python/branches/tlee-ast-optimize/Lib/logging/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/logging/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/logging/__init__.py Sat Jun 14 10:07:22 2008 @@ -262,7 +262,7 @@ self.relativeCreated = (self.created - _startTime) * 1000 if logThreads and thread: self.thread = thread.get_ident() - self.threadName = threading.currentThread().getName() + self.threadName = threading.current_thread().get_name() else: self.thread = None self.threadName = None Modified: python/branches/tlee-ast-optimize/Lib/mimetools.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/mimetools.py (original) +++ python/branches/tlee-ast-optimize/Lib/mimetools.py Sat Jun 14 10:07:22 2008 @@ -5,6 +5,9 @@ import rfc822 import tempfile +from warnings import warnpy3k +warnpy3k("in 3.x, mimetools has been removed in favor of the email package") + __all__ = ["Message","choose_boundary","encode","decode","copyliteral", "copybinary"] Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py Sat Jun 14 10:07:22 2008 @@ -48,24 +48,24 @@ threading.Thread.start(self) def get_exitcode(self): - if self._start_called and not self.isAlive(): + if self._start_called and not self.is_alive(): return 0 else: return None # XXX if sys.version_info < (3, 0): - is_alive = threading.Thread.isAlive.im_func - get_name = threading.Thread.getName.im_func - set_name = threading.Thread.setName.im_func - is_daemon = threading.Thread.isDaemon.im_func - set_daemon = threading.Thread.setDaemon.im_func + is_alive = threading.Thread.is_alive.im_func + get_name = threading.Thread.get_name.im_func + set_name = threading.Thread.set_name.im_func + is_daemon = threading.Thread.is_daemon.im_func + set_daemon = threading.Thread.set_daemon.im_func else: - is_alive = threading.Thread.isAlive - get_name = threading.Thread.getName - set_name = threading.Thread.setName - is_daemon = threading.Thread.isDaemon - set_daemon = threading.Thread.setDaemon + is_alive = threading.Thread.is_alive + get_name = threading.Thread.get_name + set_name = threading.Thread.set_name + is_daemon = threading.Thread.is_daemon + set_daemon = threading.Thread.set_daemon # # @@ -74,22 +74,22 @@ class Condition(threading._Condition): # XXX if sys.version_info < (3, 0): - notify_all = threading._Condition.notifyAll.im_func + notify_all = threading._Condition.notify_all.im_func else: - notify_all = threading._Condition.notifyAll + notify_all = threading._Condition.notify_all # # # Process = DummyProcess -current_process = threading.currentThread +current_process = threading.current_thread current_process()._children = weakref.WeakKeyDictionary() def active_children(): children = current_process()._children for p in list(children): - if not p.isAlive(): + if not p.is_alive(): children.pop(p, None) return list(children) Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py Sat Jun 14 10:07:22 2008 @@ -169,7 +169,7 @@ except (OSError, IOError): continue t = threading.Thread(target=self.handle_request, args=(c,)) - t.setDaemon(True) + t.set_daemon(True) t.start() except (KeyboardInterrupt, SystemExit): pass @@ -216,7 +216,7 @@ Handle requests from the proxies in a particular process/thread ''' util.debug('starting server thread to service %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) recv = conn.recv send = conn.send @@ -266,7 +266,7 @@ except EOFError: util.debug('got EOF -- exiting thread serving %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) sys.exit(0) except Exception: @@ -279,7 +279,7 @@ send(('#UNSERIALIZABLE', repr(msg))) except Exception, e: util.info('exception in thread serving %r', - threading.currentThread().getName()) + threading.current_thread().get_name()) util.info(' ... message was %r', msg) util.info(' ... exception was %r', e) conn.close() @@ -401,7 +401,7 @@ ''' Spawn a new thread to serve this connection ''' - threading.currentThread().setName(name) + threading.current_thread().set_name(name) c.send(('#RETURN', None)) self.serve_client(c) @@ -715,8 +715,8 @@ def _connect(self): util.debug('making connection to manager') name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() conn = self._Client(self._token.address, authkey=self._authkey) dispatch(conn, None, 'accept_connection', (name,)) self._tls.connection = conn @@ -729,7 +729,7 @@ conn = self._tls.connection except AttributeError: util.debug('thread %r does not own a connection', - threading.currentThread().getName()) + threading.current_thread().get_name()) self._connect() conn = self._tls.connection @@ -790,7 +790,7 @@ # the process owns no more references to objects for this manager if not idset and hasattr(tls, 'connection'): util.debug('thread %r has no more proxies so closing conn', - threading.currentThread().getName()) + threading.current_thread().get_name()) tls.connection.close() del tls.connection @@ -969,13 +969,13 @@ class ConditionProxy(AcquirerProxy): # XXX will Condition.notfyAll() name be available in Py3.0? - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notifyAll') + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') def wait(self, timeout=None): return self._callmethod('wait', (timeout,)) def notify(self): return self._callmethod('notify') def notify_all(self): - return self._callmethod('notifyAll') + return self._callmethod('notify_all') class EventProxy(BaseProxy): # XXX will Event.isSet name be available in Py3.0? Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py Sat Jun 14 10:07:22 2008 @@ -107,7 +107,7 @@ target=Pool._handle_tasks, args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) ) - self._task_handler.setDaemon(True) + self._task_handler.set_daemon(True) self._task_handler._state = RUN self._task_handler.start() @@ -115,7 +115,7 @@ target=Pool._handle_results, args=(self._outqueue, self._quick_get, self._cache) ) - self._result_handler.setDaemon(True) + self._result_handler.set_daemon(True) self._result_handler._state = RUN self._result_handler.start() @@ -213,7 +213,7 @@ @staticmethod def _handle_tasks(taskqueue, put, outqueue, pool): - thread = threading.currentThread() + thread = threading.current_thread() for taskseq, set_length in iter(taskqueue.get, None): i = -1 @@ -252,7 +252,7 @@ @staticmethod def _handle_results(outqueue, get, cache): - thread = threading.currentThread() + thread = threading.current_thread() while 1: try: @@ -346,7 +346,7 @@ # task_handler may be blocked trying to put items on inqueue debug('removing tasks from inqueue until task handler finished') inqueue._rlock.acquire() - while task_handler.isAlive() and inqueue._reader.poll(): + while task_handler.is_alive() and inqueue._reader.poll(): inqueue._reader.recv() time.sleep(0) @@ -362,7 +362,7 @@ debug('helping task handler/workers to finish') cls._help_stuff_finish(inqueue, task_handler, len(pool)) - assert result_handler.isAlive() or len(cache) == 0 + assert result_handler.is_alive() or len(cache) == 0 result_handler._state = TERMINATE outqueue.put(None) # sentinel @@ -591,6 +591,6 @@ try: inqueue.queue.clear() inqueue.queue.extend([None] * size) - inqueue.not_empty.notifyAll() + inqueue.not_empty.notify_all() finally: inqueue.not_empty.release() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py Sat Jun 14 10:07:22 2008 @@ -155,7 +155,7 @@ self._wlock, self._writer.close), name='QueueFeederThread' ) - self._thread.setDaemon(True) + self._thread.set_daemon(True) debug('doing self._thread.start()') self._thread.start() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py Sat Jun 14 10:07:22 2008 @@ -84,7 +84,7 @@ debug('starting listener and thread for sending handles') _listener = Listener(authkey=current_process().get_authkey()) t = threading.Thread(target=_serve) - t.setDaemon(True) + t.set_daemon(True) t.start() finally: _lock.release() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py Sat Jun 14 10:07:22 2008 @@ -109,8 +109,8 @@ try: if self._semlock._is_mine(): name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() elif self._semlock._get_value() == 1: name = 'None' elif self._semlock._count() > 0: @@ -134,8 +134,8 @@ try: if self._semlock._is_mine(): name = current_process().get_name() - if threading.currentThread().getName() != 'MainThread': - name += '|' + threading.currentThread().getName() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() count = self._semlock._count() elif self._semlock._get_value() == 1: name, count = 'None', 0 Modified: python/branches/tlee-ast-optimize/Lib/rfc822.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/rfc822.py (original) +++ python/branches/tlee-ast-optimize/Lib/rfc822.py Sat Jun 14 10:07:22 2008 @@ -73,6 +73,9 @@ import time +from warnings import warnpy3k +warnpy3k("in 3.x, rfc822 has been removed in favor of the email package") + __all__ = ["Message","AddressList","parsedate","parsedate_tz","mktime_tz"] _blanklines = ('\r\n', '\n') # Optimization for islast() Modified: python/branches/tlee-ast-optimize/Lib/test/crashers/loosing_mro_ref.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/crashers/loosing_mro_ref.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/crashers/loosing_mro_ref.py Sat Jun 14 10:07:22 2008 @@ -27,10 +27,9 @@ class Base2(object): mykey = 'from Base2' -class X(Base): - # you can't add a non-string key to X.__dict__, but it can be - # there from the beginning :-) - locals()[MyKey()] = 5 +# you can't add a non-string key to X.__dict__, but it can be +# there from the beginning :-) +X = type('X', (Base,), {MyKey(): 5}) print X.mykey # I get a segfault, or a slightly wrong assertion error in a debug build. Modified: python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_dummy_threading.py Sat Jun 14 10:07:22 2008 @@ -16,7 +16,7 @@ #delay = random.random() * 2 delay = 0 if test_support.verbose: - print 'task', self.getName(), 'will run for', delay, 'sec' + print 'task', self.get_name(), 'will run for', delay, 'sec' sema.acquire() mutex.acquire() running += 1 @@ -25,11 +25,11 @@ mutex.release() time.sleep(delay) if test_support.verbose: - print 'task', self.getName(), 'done' + print 'task', self.get_name(), 'done' mutex.acquire() running -= 1 if test_support.verbose: - print self.getName(), 'is finished.', running, 'tasks are running' + print self.get_name(), 'is finished.', running, 'tasks are running' mutex.release() sema.release() Modified: python/branches/tlee-ast-optimize/Lib/test/test_heapq.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_heapq.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_heapq.py Sat Jun 14 10:07:22 2008 @@ -210,7 +210,7 @@ class LE: def __init__(self, x): self.x = x - def __lt__(self, other): + def __le__(self, other): return self.x >= other.x data = [random.random() for i in range(100)] target = sorted(data, reverse=True) Modified: python/branches/tlee-ast-optimize/Lib/test/test_mimetools.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_mimetools.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_mimetools.py Sat Jun 14 10:07:22 2008 @@ -1,7 +1,10 @@ import unittest from test import test_support -import string, StringIO, mimetools +import string +import StringIO + +mimetools = test_support.import_module("mimetools", deprecated=True) msgtext1 = mimetools.Message(StringIO.StringIO( """Content-Type: text/plain; charset=iso-8859-1; format=flowed Modified: python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py Sat Jun 14 10:07:22 2008 @@ -632,7 +632,7 @@ p.start() p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - p.setDaemon(True) + p.set_daemon(True) p.start() # wait for both children to start sleeping @@ -679,7 +679,7 @@ t = threading.Thread(target=self.f, args=(cond, sleeping, woken, TIMEOUT1)) - t.setDaemon(True) + t.set_daemon(True) t.start() # wait for them all to sleep @@ -701,7 +701,7 @@ p.start() t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - t.setDaemon(True) + t.set_daemon(True) t.start() # wait for them to all sleep Modified: python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py Sat Jun 14 10:07:22 2008 @@ -197,8 +197,8 @@ # test.testall not tested as it executes all unit tests as an # import side-effect. all_platforms = ('audiodev', 'imputil', 'mutex', 'user', 'new', 'rexec', - 'Bastion', 'compiler', 'dircache', 'fpformat', - 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib') + 'Bastion', 'compiler', 'dircache', 'mimetools', 'fpformat', + 'ihooks', 'mhlib', 'statvfs', 'htmllib', 'sgmllib', 'rfc822') inclusive_platforms = {'irix' : ('pure', 'AL', 'al', 'CD', 'cd', 'cddb', 'cdplayer', 'CL', 'cl', 'DEVICE', 'GL', 'gl', 'ERRNO', 'FILE', 'FL', 'flp', 'fl', Modified: python/branches/tlee-ast-optimize/Lib/test/test_queue.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_queue.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_queue.py Sat Jun 14 10:07:22 2008 @@ -49,11 +49,11 @@ self.t.start() self.result = block_func(*block_args) # If block_func returned before our thread made the call, we failed! - if not self.t.startedEvent.isSet(): + if not self.t.startedEvent.is_set(): self.fail("blocking function '%r' appeared not to block" % block_func) self.t.join(10) # make sure the thread terminates - if self.t.isAlive(): + if self.t.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) return self.result @@ -73,10 +73,10 @@ expected_exception_class) finally: self.t.join(10) # make sure the thread terminates - if self.t.isAlive(): + if self.t.is_alive(): self.fail("trigger function '%r' appeared to not return" % trigger_func) - if not self.t.startedEvent.isSet(): + if not self.t.startedEvent.is_set(): self.fail("trigger thread ended but event never set") Modified: python/branches/tlee-ast-optimize/Lib/test/test_rfc822.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_rfc822.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_rfc822.py Sat Jun 14 10:07:22 2008 @@ -1,7 +1,8 @@ -import rfc822 import unittest from test import test_support +rfc822 = test_support.import_module("rfc822", deprecated=True) + try: from cStringIO import StringIO except ImportError: Modified: python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_smtplib.py Sat Jun 14 10:07:22 2008 @@ -109,7 +109,7 @@ # when the client conversation is finished, it will # set client_evt, and it's then ok to kill the server - if client_evt.isSet(): + if client_evt.is_set(): serv.close() break @@ -118,7 +118,7 @@ except socket.timeout: pass finally: - if not client_evt.isSet(): + if not client_evt.is_set(): # allow some time for the client to read the result time.sleep(0.5) serv.close() Modified: python/branches/tlee-ast-optimize/Lib/test/test_socket.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_socket.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_socket.py Sat Jun 14 10:07:22 2008 @@ -107,7 +107,7 @@ self.clientRun, (test_method,)) self.__setUp() - if not self.server_ready.isSet(): + if not self.server_ready.is_set(): self.server_ready.set() self.client_ready.wait() Modified: python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_socketserver.py Sat Jun 14 10:07:22 2008 @@ -139,7 +139,7 @@ # Time between requests is short enough that we won't wake # up spuriously too many times. kwargs={'poll_interval':0.01}) - t.setDaemon(True) # In case this function raises. + t.set_daemon(True) # In case this function raises. t.start() if verbose: print "server running" for i in range(3): Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Sat Jun 14 10:07:22 2008 @@ -567,6 +567,9 @@ # string self.check_sizeof('', h + l + self.align(i + 1)) self.check_sizeof('abc', h + l + self.align(i + 1) + 3) + # tuple + self.check_sizeof((), h) + self.check_sizeof((1,2,3), h + 3*p) def test_main(): Modified: python/branches/tlee-ast-optimize/Lib/test/test_threading.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_threading.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_threading.py Sat Jun 14 10:07:22 2008 @@ -34,7 +34,7 @@ delay = random.random() / 10000.0 if verbose: print 'task %s will run for %.1f usec' % ( - self.getName(), delay * 1e6) + self.get_name(), delay * 1e6) with self.sema: with self.mutex: @@ -45,14 +45,14 @@ time.sleep(delay) if verbose: - print 'task', self.getName(), 'done' + print 'task', self.get_name(), 'done' with self.mutex: self.nrunning.dec() self.testcase.assert_(self.nrunning.get() >= 0) if verbose: print '%s is finished. %d tasks are running' % ( - self.getName(), self.nrunning.get()) + self.get_name(), self.nrunning.get()) class ThreadTests(unittest.TestCase): @@ -73,7 +73,7 @@ for i in range(NUMTASKS): t = TestThread(""%i, self, sema, mutex, numrunning) threads.append(t) - self.failUnlessEqual(t.getIdent(), None) + self.failUnlessEqual(t.get_ident(), None) self.assert_(re.match('', repr(t))) t.start() @@ -81,8 +81,8 @@ print 'waiting for all tasks to complete' for t in threads: t.join(NUMTASKS) - self.assert_(not t.isAlive()) - self.failIfEqual(t.getIdent(), 0) + self.assert_(not t.is_alive()) + self.failIfEqual(t.get_ident(), 0) self.assert_(re.match('', repr(t))) if verbose: print 'all tasks done' @@ -172,7 +172,7 @@ worker_saw_exception.set() t = Worker() - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown + t.set_daemon(True) # so if this fails, we don't hang Python at shutdown t.start() if verbose: print " started worker thread" @@ -258,12 +258,12 @@ print 'program blocked; aborting' os._exit(2) t = threading.Thread(target=killer) - t.setDaemon(True) + t.set_daemon(True) t.start() # This is the trace function def func(frame, event, arg): - threading.currentThread() + threading.current_thread() return func sys.settrace(func) @@ -348,8 +348,8 @@ self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint) def test_joining_current_thread(self): - currentThread = threading.currentThread() - self.assertRaises(RuntimeError, currentThread.join); + current_thread = threading.current_thread() + self.assertRaises(RuntimeError, current_thread.join); def test_joining_inactive_thread(self): thread = threading.Thread() @@ -358,7 +358,7 @@ def test_daemonize_active_thread(self): thread = threading.Thread() thread.start() - self.assertRaises(RuntimeError, thread.setDaemon, True) + self.assertRaises(RuntimeError, thread.set_daemon, True) def test_main(): Modified: python/branches/tlee-ast-optimize/Lib/test/threaded_import_hangers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/threaded_import_hangers.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/threaded_import_hangers.py Sat Jun 14 10:07:22 2008 @@ -38,5 +38,5 @@ t = Worker(func, args) t.start() t.join(TIMEOUT) - if t.isAlive(): + if t.is_alive(): errors.append("%s appeared to hang" % name) Modified: python/branches/tlee-ast-optimize/Lib/threading.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/threading.py (original) +++ python/branches/tlee-ast-optimize/Lib/threading.py Sat Jun 14 10:07:22 2008 @@ -9,12 +9,15 @@ raise import warnings + +from functools import wraps from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc from collections import deque # Rename some stuff so "from threading import *" is safe -__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', +__all__ = ['activeCount', 'active_count', 'Condition', 'currentThread', + 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] @@ -31,6 +34,18 @@ module='threading', message='sys.exc_clear') +def _old_api(callable, old_name): + if not _sys.py3kwarning: + return callable + @wraps(callable) + def old(*args, **kwargs): + warnings.warnpy3k("In 3.x, {0} is renamed to {1}." + .format(old_name, callable.__name__), + stacklevel=3) + return callable(*args, **kwargs) + old.__name__ = old_name + return old + # Debug support (adapted from ihooks.py). # All the major classes here derive from _Verbose. We force that to # be a new-style class so that all the major classes here are new-style. @@ -52,7 +67,7 @@ if self.__verbose: format = format % args format = "%s: %s\n" % ( - currentThread().getName(), format) + current_thread().get_name(), format) _sys.stderr.write(format) else: @@ -95,11 +110,11 @@ owner = self.__owner return "<%s(%s, %d)>" % ( self.__class__.__name__, - owner and owner.getName(), + owner and owner.get_name(), self.__count) def acquire(self, blocking=1): - me = currentThread() + me = current_thread() if self.__owner is me: self.__count = self.__count + 1 if __debug__: @@ -119,7 +134,7 @@ __enter__ = acquire def release(self): - if self.__owner is not currentThread(): + if self.__owner is not current_thread(): raise RuntimeError("cannot release un-aquired lock") self.__count = count = self.__count - 1 if not count: @@ -154,7 +169,7 @@ return (count, owner) def _is_owned(self): - return self.__owner is currentThread() + return self.__owner is current_thread() def Condition(*args, **kwargs): @@ -203,7 +218,7 @@ self.__lock.acquire() # Ignore saved state def _is_owned(self): - # Return True if lock is owned by currentThread. + # Return True if lock is owned by current_thread. # This method is called only if __lock doesn't have _is_owned(). if self.__lock.acquire(0): self.__lock.release() @@ -271,9 +286,11 @@ except ValueError: pass - def notifyAll(self): + def notify_all(self): self.notify(len(self.__waiters)) + notifyAll = _old_api(notify_all, "notifyAll") + def Semaphore(*args, **kwargs): return _Semaphore(*args, **kwargs) @@ -350,14 +367,16 @@ self.__cond = Condition(Lock()) self.__flag = False - def isSet(self): + def is_set(self): return self.__flag + isSet = _old_api(is_set, "isSet") + def set(self): self.__cond.acquire() try: self.__flag = True - self.__cond.notifyAll() + self.__cond.notify_all() finally: self.__cond.release() @@ -425,12 +444,12 @@ def _set_daemon(self): # Overridden in _MainThread and _DummyThread - return currentThread().isDaemon() + return current_thread().is_daemon() def __repr__(self): assert self.__initialized, "Thread.__init__() was not called" status = "initial" - if self.__started.isSet(): + if self.__started.is_set(): status = "started" if self.__stopped: status = "stopped" @@ -443,7 +462,7 @@ def start(self): if not self.__initialized: raise RuntimeError("thread.__init__() not called") - if self.__started.isSet(): + if self.__started.is_set(): raise RuntimeError("thread already started") if __debug__: self._note("%s.start(): starting thread", self) @@ -514,7 +533,7 @@ # self. if _sys: _sys.stderr.write("Exception in thread %s:\n%s\n" % - (self.getName(), _format_exc())) + (self.get_name(), _format_exc())) else: # Do the best job possible w/o a huge amt. of code to # approximate a traceback (code ideas from @@ -522,7 +541,7 @@ exc_type, exc_value, exc_tb = self.__exc_info() try: print>>self.__stderr, ( - "Exception in thread " + self.getName() + + "Exception in thread " + self.get_name() + " (most likely raised during interpreter shutdown):") print>>self.__stderr, ( "Traceback (most recent call last):") @@ -560,7 +579,7 @@ def __stop(self): self.__block.acquire() self.__stopped = True - self.__block.notifyAll() + self.__block.notify_all() self.__block.release() def __delete(self): @@ -593,7 +612,7 @@ # There must not be any python code between the previous line # and after the lock is released. Otherwise a tracing function # could try to acquire the lock again in the same thread, (in - # currentThread()), and would block. + # current_thread()), and would block. except KeyError: if 'dummy_threading' not in _sys.modules: raise @@ -601,9 +620,9 @@ def join(self, timeout=None): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") - if not self.__started.isSet(): + if not self.__started.is_set(): raise RuntimeError("cannot join thread before it is started") - if self is currentThread(): + if self is current_thread(): raise RuntimeError("cannot join current thread") if __debug__: @@ -631,33 +650,43 @@ finally: self.__block.release() - def getName(self): + def get_name(self): assert self.__initialized, "Thread.__init__() not called" return self.__name - def setName(self, name): + getName = _old_api(get_name, "getName") + + def set_name(self, name): assert self.__initialized, "Thread.__init__() not called" self.__name = str(name) - def getIdent(self): + setName = _old_api(set_name, "setName") + + def get_ident(self): assert self.__initialized, "Thread.__init__() not called" return self.__ident - def isAlive(self): + def is_alive(self): assert self.__initialized, "Thread.__init__() not called" - return self.__started.isSet() and not self.__stopped + return self.__started.is_set() and not self.__stopped - def isDaemon(self): + isAlive = _old_api(is_alive, "isAlive") + + def is_daemon(self): assert self.__initialized, "Thread.__init__() not called" return self.__daemonic - def setDaemon(self, daemonic): + isDaemon = _old_api(is_daemon, "isDaemon") + + def set_daemon(self, daemonic): if not self.__initialized: raise RuntimeError("Thread.__init__() not called") - if self.__started.isSet(): + if self.__started.is_set(): raise RuntimeError("cannot set daemon status of active thread"); self.__daemonic = daemonic + setDaemon = _old_api(set_daemon, "setDaemon") + # The timer class was contributed by Itamar Shtull-Trauring def Timer(*args, **kwargs): @@ -685,7 +714,7 @@ def run(self): self.finished.wait(self.interval) - if not self.finished.isSet(): + if not self.finished.is_set(): self.function(*self.args, **self.kwargs) self.finished.set() @@ -719,16 +748,16 @@ def _pickSomeNonDaemonThread(): for t in enumerate(): - if not t.isDaemon() and t.isAlive(): + if not t.is_daemon() and t.is_alive(): return t return None # Dummy thread class to represent threads not started here. # These aren't garbage collected when they die, nor can they be waited for. -# If they invoke anything in threading.py that calls currentThread(), they +# If they invoke anything in threading.py that calls current_thread(), they # leave an entry in the _active dict forever after. -# Their purpose is to return *something* from currentThread(). +# Their purpose is to return *something* from current_thread(). # They are marked as daemon threads so we won't wait for them # when we exit (conform previous semantics). @@ -756,19 +785,23 @@ # Global API functions -def currentThread(): +def current_thread(): try: return _active[_get_ident()] except KeyError: - ##print "currentThread(): no current thread for", _get_ident() + ##print "current_thread(): no current thread for", _get_ident() return _DummyThread() -def activeCount(): +currentThread = _old_api(current_thread, "currentThread") + +def active_count(): _active_limbo_lock.acquire() count = len(_active) + len(_limbo) _active_limbo_lock.release() return count +activeCount = _old_api(active_count, "activeCount") + def enumerate(): _active_limbo_lock.acquire() active = _active.values() + _limbo.values() @@ -840,7 +873,7 @@ counter = 0 while counter < self.quota: counter = counter + 1 - self.queue.put("%s.%d" % (self.getName(), counter)) + self.queue.put("%s.%d" % (self.get_name(), counter)) _sleep(random() * 0.00001) Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Sat Jun 14 10:07:22 2008 @@ -486,6 +486,7 @@ Gustavo Niemeyer Oscar Nierstrasz Hrvoje Niksic +Jesse Noller Bill Noon Stefan Norberg Tim Northover @@ -502,6 +503,7 @@ Douglas Orr Denis S. Otkidach Michael Otteneder +R. M. Oudkerk Russel Owen Ondrej Palkovsky Mike Pall Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sat Jun 14 10:07:22 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Add future_builtins.ascii(). + - Several set methods now accept multiple arguments: update(), union(), intersection(), intersection_update(), difference(), and difference_update(). @@ -82,19 +84,25 @@ Library ------- +- The rfc822 module has been deprecated for removal in 3.0. + +- The mimetools module has been deprecated for removal in 3.0. + - The ctypes.byref function now takes an optional second parameter which allows to specify an offset in bytes for the constructed pointer-like object. - Added the ast module. +- Added the multiprocessing module, PEP 371. + - Factored out the indentation cleaning from inspect.getdoc() into inspect.cleandoc() to ease standalone use. - Issue #1798: Add ctypes calling convention that allows safe access to errno. -- Issue #2404: ctypes objects support the new pep3118 buffer interface +- Issue #2404: ctypes objects support the new pep3118 buffer interface. - Patch #2125: Add GetInteger and GetString methods for msilib.Record objects. @@ -291,16 +299,20 @@ - The bundled OSX-specific copy of libbffi is now in sync with the version shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms. +- The threading module gained alias for names that are removed in 3.x. + Build ----- +- The Windows installer now includes Tk 8.5. + - Patch #1722225: Support QNX 6. - ``Lib/lib-old`` is now added to sys.path. - On MacOS X it is now possible to install the framework in 64-bit mode or even as a 4-way universal binary (that is, PPC, i386, - PPC64 and x86_64 support in one binary) + PPC64 and x86_64 support in one binary). This is controlled by the configure argument ``--with-universal-archs``: @@ -389,7 +401,7 @@ ending in) '.', '!' or '?'. - Add from_buffer() and from_buffer_copy() class methods to ctypes - data types + data types. - Issue #2682: ctypes callback functions no longer contain a cyclic reference to themselves. Modified: python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_collectionsmodule.c Sat Jun 14 10:07:22 2008 @@ -85,7 +85,7 @@ return b; } -void +static void freeblock(block *b) { if (numfreeblocks < MAXFREEBLOCKS) { @@ -957,7 +957,7 @@ int counter; /* number of items remaining for iteration */ } dequeiterobject; -PyTypeObject dequeiter_type; +static PyTypeObject dequeiter_type; static PyObject * deque_iter(dequeobject *deque) @@ -1024,7 +1024,7 @@ {NULL, NULL} /* sentinel */ }; -PyTypeObject dequeiter_type = { +static PyTypeObject dequeiter_type = { PyVarObject_HEAD_INIT(NULL, 0) "deque_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ @@ -1059,7 +1059,7 @@ /*********************** Deque Reverse Iterator **************************/ -PyTypeObject dequereviter_type; +static PyTypeObject dequereviter_type; static PyObject * deque_reviter(dequeobject *deque) @@ -1106,7 +1106,7 @@ return item; } -PyTypeObject dequereviter_type = { +static PyTypeObject dequereviter_type = { PyVarObject_HEAD_INIT(NULL, 0) "deque_reverse_iterator", /* tp_name */ sizeof(dequeiterobject), /* tp_basicsize */ Modified: python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ctypes/callproc.c Sat Jun 14 10:07:22 2008 @@ -1849,6 +1849,8 @@ return NULL; } shape = PyTuple_New(dict->ndim); + if (shape == NULL) + return NULL; for (i = 0; i < (int)dict->ndim; ++i) PyTuple_SET_ITEM(shape, i, PyLong_FromSsize_t(dict->shape[i])); Modified: python/branches/tlee-ast-optimize/Modules/_localemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_localemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_localemodule.c Sat Jun 14 10:07:22 2008 @@ -444,7 +444,7 @@ #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} -struct langinfo_constant{ +static struct langinfo_constant{ char* name; int value; } langinfo_constants[] = Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c Sat Jun 14 10:07:22 2008 @@ -1,5 +1,5 @@ /* - * Extension module used by mutliprocessing package + * Extension module used by multiprocessing package * * multiprocessing.c * @@ -215,7 +215,7 @@ PyMODINIT_FUNC init_multiprocessing(void) { - PyObject *module, *temp; + PyObject *module, *temp, *value; /* Initialize module */ module = Py_InitModule("_multiprocessing", module_methods); @@ -284,11 +284,12 @@ temp = PyDict_New(); if (!temp) return; - if (PyModule_AddObject(module, "flags", temp) < 0) - return; - -#define ADD_FLAG(name) \ - if (PyDict_SetItemString(temp, #name, Py_BuildValue("i", name)) < 0) return +#define ADD_FLAG(name) \ + value = Py_BuildValue("i", name); \ + if (value == NULL) { Py_DECREF(temp); return; } \ + if (PyDict_SetItemString(temp, #name, value) < 0) { \ + Py_DECREF(temp); Py_DECREF(value); return; } \ + Py_DECREF(value) #ifdef HAVE_SEM_OPEN ADD_FLAG(HAVE_SEM_OPEN); @@ -305,4 +306,6 @@ #ifdef HAVE_BROKEN_SEM_UNLINK ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); #endif + if (PyModule_AddObject(module, "flags", temp) < 0) + return; } Modified: python/branches/tlee-ast-optimize/Modules/_tkinter.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_tkinter.c (original) +++ python/branches/tlee-ast-optimize/Modules/_tkinter.c Sat Jun 14 10:07:22 2008 @@ -490,7 +490,7 @@ lists. SplitObj walks through a nested tuple, finding string objects that need to be split. */ -PyObject * +static PyObject * SplitObj(PyObject *arg) { if (PyTuple_Check(arg)) { @@ -1523,7 +1523,7 @@ return 0; } -void +static void var_perform(VarEvent *ev) { *(ev->res) = ev->func(ev->self, ev->args, ev->flags); Modified: python/branches/tlee-ast-optimize/Modules/arraymodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/arraymodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/arraymodule.c Sat Jun 14 10:07:22 2008 @@ -432,6 +432,9 @@ if (op == NULL) { return NULL; } + op->ob_descr = descr; + op->allocated = size; + op->weakreflist = NULL; Py_SIZE(op) = size; if (size <= 0) { op->ob_item = NULL; @@ -439,13 +442,10 @@ else { op->ob_item = PyMem_NEW(char, nbytes); if (op->ob_item == NULL) { - PyObject_Del(op); + Py_DECREF(op); return PyErr_NoMemory(); } } - op->ob_descr = descr; - op->allocated = size; - op->weakreflist = NULL; return (PyObject *) op; } @@ -826,14 +826,13 @@ } if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) || ((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { - PyErr_NoMemory(); - return -1; + PyErr_NoMemory(); + return -1; } size = Py_SIZE(self) + Py_SIZE(b); PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize); if (self->ob_item == NULL) { - PyObject_Del(self); - PyErr_NoMemory(); + PyErr_NoMemory(); return -1; } memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize, @@ -1547,7 +1546,7 @@ {NULL} }; -PyMethodDef array_methods[] = { +static PyMethodDef array_methods[] = { {"append", (PyCFunction)array_append, METH_O, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, METH_NOARGS, Modified: python/branches/tlee-ast-optimize/Modules/errnomodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/errnomodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/errnomodule.c Sat Jun 14 10:07:22 2008 @@ -5,7 +5,7 @@ /* Windows socket errors (WSA*) */ #ifdef MS_WINDOWS -#include +#include #endif /* Modified: python/branches/tlee-ast-optimize/Modules/future_builtins.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/future_builtins.c (original) +++ python/branches/tlee-ast-optimize/Modules/future_builtins.c Sat Jun 14 10:07:22 2008 @@ -45,11 +45,25 @@ Return the octal representation of an integer or long integer."); +static PyObject * +builtin_ascii(PyObject *self, PyObject *v) +{ + return PyObject_Repr(v); +} + +PyDoc_STRVAR(ascii_doc, +"ascii(object) -> string\n\ +\n\ +Return the same as repr(). In Python 3.x, the repr() result will\n\ +contain printable characters unescaped, while the ascii() result\n\ +will have such characters backslash-escaped."); + /* List of functions exported by this module */ static PyMethodDef module_functions[] = { {"hex", builtin_hex, METH_O, hex_doc}, {"oct", builtin_oct, METH_O, oct_doc}, + {"ascii", builtin_ascii, METH_O, ascii_doc}, {NULL, NULL} /* Sentinel */ }; Modified: python/branches/tlee-ast-optimize/Modules/signalmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/signalmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/signalmodule.c Sat Jun 14 10:07:22 2008 @@ -925,5 +925,6 @@ main_thread = PyThread_get_thread_ident(); main_pid = getpid(); _PyImport_ReInitLock(); + PyThread_ReInitTLS(); #endif } Modified: python/branches/tlee-ast-optimize/Modules/socketmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/socketmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/socketmodule.c Sat Jun 14 10:07:22 2008 @@ -2805,7 +2805,7 @@ Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\ of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR)."); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) static PyObject* sock_ioctl(PySocketSockObject *s, PyObject *arg) { @@ -2858,7 +2858,7 @@ METH_NOARGS, getsockname_doc}, {"getsockopt", (PyCFunction)sock_getsockopt, METH_VARARGS, getsockopt_doc}, -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) {"ioctl", (PyCFunction)sock_ioctl, METH_VARARGS, sock_ioctl_doc}, #endif Modified: python/branches/tlee-ast-optimize/Modules/socketmodule.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/socketmodule.h (original) +++ python/branches/tlee-ast-optimize/Modules/socketmodule.h Sat Jun 14 10:07:22 2008 @@ -13,19 +13,23 @@ # endif #else /* MS_WINDOWS */ -#if _MSC_VER >= 1300 # include # include -# include /* for SIO_RCVALL */ -# define HAVE_ADDRINFO -# define HAVE_SOCKADDR_STORAGE -# define HAVE_GETADDRINFO -# define HAVE_GETNAMEINFO -# define ENABLE_IPV6 -#else -# include -#endif -#endif +/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h + * Separate SDKs have all the functions we want, but older ones don't have + * any version information. I use IPPROTO_IPV6 to detect a decent SDK. + */ +# ifdef IPPROTO_IPV6 +# include /* for SIO_RCVALL */ +# define HAVE_ADDRINFO +# define HAVE_SOCKADDR_STORAGE +# define HAVE_GETADDRINFO +# define HAVE_GETNAMEINFO +# define ENABLE_IPV6 +# else +typedef int socklen_t; +# endif /* IPPROTO_IPV6 */ +#endif /* MS_WINDOWS */ #ifdef HAVE_SYS_UN_H # include Modified: python/branches/tlee-ast-optimize/Modules/unicodedata_db.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/unicodedata_db.h (original) +++ python/branches/tlee-ast-optimize/Modules/unicodedata_db.h Sat Jun 14 10:07:22 2008 @@ -228,7 +228,7 @@ #define TOTAL_FIRST 356 #define TOTAL_LAST 53 struct reindex{int start;short count,index;}; -struct reindex nfc_first[] = { +static struct reindex nfc_first[] = { { 60, 2, 0}, { 65, 15, 3}, { 82, 8, 19}, @@ -425,7 +425,7 @@ {0,0,0} }; -struct reindex nfc_last[] = { +static struct reindex nfc_last[] = { { 768, 4, 0}, { 774, 6, 5}, { 783, 0, 12}, Modified: python/branches/tlee-ast-optimize/Objects/tupleobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/tupleobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/tupleobject.c Sat Jun 14 10:07:22 2008 @@ -708,13 +708,25 @@ } +static PyObject * +tuple_sizeof(PyTupleObject *self) +{ + Py_ssize_t res; + + res = PyTuple_Type.tp_basicsize + Py_SIZE(self) * sizeof(PyObject *); + return PyInt_FromSsize_t(res); +} + PyDoc_STRVAR(index_doc, "T.index(value, [start, [stop]]) -> integer -- return first index of value"); PyDoc_STRVAR(count_doc, "T.count(value) -> integer -- return number of occurrences of value"); +PyDoc_STRVAR(sizeof_doc, +"T.__sizeof__() -- size of T in memory, in bytes"); static PyMethodDef tuple_methods[] = { {"__getnewargs__", (PyCFunction)tuple_getnewargs, METH_NOARGS}, + {"__sizeof__", (PyCFunction)tuple_sizeof, METH_NOARGS, sizeof_doc}, {"index", (PyCFunction)tupleindex, METH_VARARGS, index_doc}, {"count", (PyCFunction)tuplecount, METH_O, count_doc}, {NULL, NULL} /* sentinel */ Modified: python/branches/tlee-ast-optimize/PC/VC6/_socket.dsp ============================================================================== --- python/branches/tlee-ast-optimize/PC/VC6/_socket.dsp (original) +++ python/branches/tlee-ast-optimize/PC/VC6/_socket.dsp Sat Jun 14 10:07:22 2008 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd" +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket.pyd" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "_socket - Win32 Debug" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept +# ADD LINK32 user32.lib kernel32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /base:"0x1e1D0000" /subsystem:windows /dll /debug /machine:I386 /out:"./_socket_d.pyd" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp (original) +++ python/branches/tlee-ast-optimize/PC/VC6/pythoncore.dsp Sat Jun 14 10:07:22 2008 @@ -97,6 +97,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\cjkcodecs\_codecs_cn.c # End Source File # Begin Source File Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj Sat Jun 14 10:07:22 2008 @@ -42,7 +42,7 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj Sat Jun 14 10:07:22 2008 @@ -56,7 +56,6 @@ /> @@ -437,7 +431,6 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj Sat Jun 14 10:07:22 2008 @@ -42,7 +42,7 @@ /> Modified: python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj Sat Jun 14 10:07:22 2008 @@ -62,7 +62,6 @@ /> @@ -573,167 +573,167 @@ Name="Source Files" > Modified: python/branches/tlee-ast-optimize/PC/msvcrtmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/msvcrtmodule.c (original) +++ python/branches/tlee-ast-optimize/PC/msvcrtmodule.c Sat Jun 14 10:07:22 2008 @@ -143,6 +143,7 @@ return PyString_FromStringAndSize(s, 1); } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_getwch(PyObject *self, PyObject *args) { @@ -158,6 +159,7 @@ u[0] = ch; return PyUnicode_FromUnicode(u, 1); } +#endif static PyObject * msvcrt_getche(PyObject *self, PyObject *args) @@ -175,6 +177,7 @@ return PyString_FromStringAndSize(s, 1); } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_getwche(PyObject *self, PyObject *args) { @@ -190,6 +193,7 @@ s[0] = ch; return PyUnicode_FromUnicode(s, 1); } +#endif static PyObject * msvcrt_putch(PyObject *self, PyObject *args) @@ -204,7 +208,7 @@ return Py_None; } - +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_putwch(PyObject *self, PyObject *args) { @@ -223,6 +227,7 @@ Py_RETURN_NONE; } +#endif static PyObject * msvcrt_ungetch(PyObject *self, PyObject *args) @@ -238,6 +243,7 @@ return Py_None; } +#ifdef _WCONIO_DEFINED static PyObject * msvcrt_ungetwch(PyObject *self, PyObject *args) { @@ -251,6 +257,7 @@ Py_INCREF(Py_None); return Py_None; } +#endif static void insertint(PyObject *d, char *name, int value) @@ -279,11 +286,12 @@ {"getche", msvcrt_getche, METH_VARARGS}, {"putch", msvcrt_putch, METH_VARARGS}, {"ungetch", msvcrt_ungetch, METH_VARARGS}, +#ifdef _WCONIO_DEFINED {"getwch", msvcrt_getwch, METH_VARARGS}, {"getwche", msvcrt_getwche, METH_VARARGS}, {"putwch", msvcrt_putwch, METH_VARARGS}, {"ungetwch", msvcrt_ungetwch, METH_VARARGS}, - +#endif {NULL, NULL} }; Modified: python/branches/tlee-ast-optimize/PC/pyconfig.h ============================================================================== --- python/branches/tlee-ast-optimize/PC/pyconfig.h (original) +++ python/branches/tlee-ast-optimize/PC/pyconfig.h Sat Jun 14 10:07:22 2008 @@ -467,13 +467,6 @@ /* Define to `unsigned' if doesn't define. */ /* #undef size_t */ -/* Define to `int' if doesn't define. */ -#if _MSC_VER + 0 >= 1300 -/* VC.NET typedefs socklen_t in ws2tcpip.h. */ -#else -#define socklen_t int -#endif - /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 Modified: python/branches/tlee-ast-optimize/PCbuild/_elementtree.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/_elementtree.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/_elementtree.vcproj Sat Jun 14 10:07:22 2008 @@ -56,7 +56,6 @@ /> @@ -437,7 +431,6 @@ /> Modified: python/branches/tlee-ast-optimize/PCbuild/build_tkinter.py ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/build_tkinter.py (original) +++ python/branches/tlee-ast-optimize/PCbuild/build_tkinter.py Sat Jun 14 10:07:22 2008 @@ -11,14 +11,9 @@ here = os.path.abspath(os.path.dirname(__file__)) par = os.path.pardir -if 1: - TCL = "tcl8.4.16" - TK = "tk8.4.16" - TIX = "tix-8.4.0" -else: - TCL = "tcl8.5b3" - TK = "tcl8.5b3" - TIX = "Tix8.4.2" +TCL = "tcl8.5.2" +TK = "tk8.5.2" +TIX = "tix-8.4.0.x" ROOT = os.path.abspath(os.path.join(here, par, par)) # Windows 2000 compatibility: WINVER 0x0500 @@ -38,9 +33,9 @@ if platform == "Win32": dest = os.path.join(ROOT, "tcltk") machine = "X86" - elif platform == "x64": + elif platform == "AMD64": dest = os.path.join(ROOT, "tcltk64") - machine = "X64" + machine = "AMD64" else: raise ValueError(platform) @@ -50,16 +45,16 @@ os.chdir(os.path.join(tcldir, "win")) if clean: nmake("makefile.vc", "clean") - nmake("makefile.vc") - nmake("makefile.vc", "install", INSTALLDIR=dest) + nmake("makefile.vc", MACHINE=machine) + nmake("makefile.vc", "install", INSTALLDIR=dest, MACHINE=machine) # TK if 1: os.chdir(os.path.join(ROOT, TK, "win")) if clean: nmake("makefile.vc", "clean", TCLDIR=tcldir) - nmake("makefile.vc", TCLDIR=tcldir) - nmake("makefile.vc", "install", TCLDIR=tcldir, INSTALLDIR=dest) + nmake("makefile.vc", TCLDIR=tcldir, MACHINE=machine) + nmake("makefile.vc", "install", TCLDIR=tcldir, INSTALLDIR=dest, MACHINE=machine) # TIX if 1: @@ -67,12 +62,12 @@ os.chdir(os.path.join(ROOT, TIX, "win")) if clean: nmake("python9.mak", "clean") - nmake("python9.mak", MACHINE=machine) - nmake("python9.mak", "install") + nmake("python9.mak", MACHINE=machine, INSTALL_DIR=dest) + nmake("python9.mak", "install", INSTALL_DIR=dest) def main(): - if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"): - print("%s Win32|x64" % sys.argv[0]) + if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "AMD64"): + print("%s Win32|AMD64" % sys.argv[0]) sys.exit(1) if "-c" in sys.argv: Modified: python/branches/tlee-ast-optimize/PCbuild/make_versioninfo.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/make_versioninfo.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/make_versioninfo.vcproj Sat Jun 14 10:07:22 2008 @@ -67,7 +67,6 @@ /> Modified: python/branches/tlee-ast-optimize/PCbuild/python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/python.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/python.vcproj Sat Jun 14 10:07:22 2008 @@ -62,7 +62,6 @@ /> id != id) { + *q = p->next; + free((void *)p); + /* NB This does *not* free p->value! */ + } + else + q = &p->next; + } +} + #endif /* Py_HAVE_NATIVE_TLS */ Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat Sat Jun 14 10:07:22 2008 @@ -4,14 +4,14 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -if not exist tcltk64\bin\tcl84g.dll ( - cd tcl-8.4.18.2\win +if not exist tcltk64\bin\tcl85g.dll ( + cd tcl-8.5.2.1\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install cd ..\.. ) -if not exist tcltk64\bin\tk84g.dll ( - cd tk-8.4.18.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.4.18.2 clean all install +if not exist tcltk64\bin\tk85g.dll ( + cd tk-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean all install cd ..\.. ) Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat Sat Jun 14 10:07:22 2008 @@ -27,8 +27,11 @@ if not exist openssl-0.9.8g svn export http://svn.python.org/projects/external/openssl-0.9.8g @rem tcl/tk -if not exist tcl-8.4.18.2 svn export http://svn.python.org/projects/external/tcl-8.4.18.2 -if not exist tk-8.4.18.1 svn export http://svn.python.org/projects/external/tk-8.4.18.1 +if not exist tcl-8.5.2.1 ( + rd /s/q tcltk tcltk64 + svn export http://svn.python.org/projects/external/tcl-8.5.2.1 +) +if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0 @rem sqlite3 if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external.bat Sat Jun 14 10:07:22 2008 @@ -4,14 +4,18 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\vsvars32.bat" -if not exist tcltk\bin\tcl84g.dll ( - cd tcl-8.4.18.2\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all install +if not exist tcltk\bin\tcl85.dll ( + @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install + cd tcl-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all + nmake -f makefile.vc DEBUG=1 INSTALLDIR=..\..\tcltk install cd ..\.. ) -if not exist tcltk\bin\tk84g.dll ( - cd tk-8.4.18.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.4.18.2 clean all install +if not exist tcltk\bin\tk85.dll ( + cd tk-8.5.2.0\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install cd ..\.. ) Modified: python/branches/tlee-ast-optimize/Tools/msi/msi.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/msi/msi.py (original) +++ python/branches/tlee-ast-optimize/Tools/msi/msi.py Sat Jun 14 10:07:22 2008 @@ -848,17 +848,18 @@ import shutil, glob out = open("LICENSE.txt", "w") shutil.copyfileobj(open(os.path.join(srcdir, "LICENSE")), out) - for dir, file in (("bzip2","LICENSE"), - ("db", "LICENSE"), - ("openssl", "LICENSE"), - ("tcl", "license.terms"), - ("tk", "license.terms")): - out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % dir) - dirs = glob.glob(srcdir+"/../"+dir+"-*") + for name, pat, file in (("bzip2","bzip2-*", "LICENSE"), + ("Berkeley DB", "db-*", "LICENSE"), + ("openssl", "openssl-*", "LICENSE"), + ("Tcl", "tcl8*", "license.terms"), + ("Tk", "tk8*", "license.terms"), + ("Tix", "tix-*", "license.terms")): + out.write("\nThis copy of Python includes a copy of %s, which is licensed under the following terms:\n\n" % name) + dirs = glob.glob(srcdir+"/../"+pat) if not dirs: - raise ValueError, "Could not find "+srcdir+"/../"+dir+"-*" + raise ValueError, "Could not find "+srcdir+"/../"+pat if len(dirs) > 2: - raise ValueError, "Multiple copies of "+dir + raise ValueError, "Multiple copies of "+pat dir = dirs[0] shutil.copyfileobj(open(os.path.join(dir, file)), out) out.close() Modified: python/branches/tlee-ast-optimize/Tools/msi/msilib.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/msi/msilib.py (original) +++ python/branches/tlee-ast-optimize/Tools/msi/msilib.py Sat Jun 14 10:07:22 2008 @@ -333,6 +333,7 @@ #str = str.replace(".", "_") # colons are allowed str = str.replace(" ", "_") str = str.replace("-", "_") + str = str.replace("+", "_") if str[0] in string.digits: str = "_"+str assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str @@ -477,6 +478,7 @@ [(feature.id, component)]) def make_short(self, file): + file = re.sub(r'[\?|><:/*"+,;=\[\]]', '_', file) # restrictions on short names parts = file.split(".") if len(parts)>1: suffix = parts[-1].upper() @@ -505,7 +507,6 @@ if pos in (10, 100, 1000): prefix = prefix[:-1] self.short_names.add(file) - assert not re.search(r'[\?|><:/*"+,;=\[\]]', file) # restrictions on short names return file def add_file(self, file, src=None, version=None, language=None): Modified: python/branches/tlee-ast-optimize/Tools/unicode/makeunicodedata.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/unicode/makeunicodedata.py (original) +++ python/branches/tlee-ast-optimize/Tools/unicode/makeunicodedata.py Sat Jun 14 10:07:22 2008 @@ -229,12 +229,12 @@ print >>fp, "#define TOTAL_FIRST",total_first print >>fp, "#define TOTAL_LAST",total_last print >>fp, "struct reindex{int start;short count,index;};" - print >>fp, "struct reindex nfc_first[] = {" + print >>fp, "static struct reindex nfc_first[] = {" for start,end in comp_first_ranges: print >>fp," { %d, %d, %d}," % (start,end-start,comp_first[start]) print >>fp," {0,0,0}" print >>fp,"};\n" - print >>fp, "struct reindex nfc_last[] = {" + print >>fp, "static struct reindex nfc_last[] = {" for start,end in comp_last_ranges: print >>fp," { %d, %d, %d}," % (start,end-start,comp_last[start]) print >>fp," {0,0,0}" From buildbot at python.org Sat Jun 14 10:31:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 08:31:13 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080614083113.CA1FA1E4010@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/473 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: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 10:36:07 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 14 Jun 2008 10:36:07 +0200 (CEST) Subject: [Python-checkins] r64269 - python/trunk/Modules/socketmodule.h Message-ID: <20080614083607.C06FB1E4009@bag.python.org> Author: amaury.forgeotdarc Date: Sat Jun 14 10:36:07 2008 New Revision: 64269 Log: on windows, r64214 broke compilation with some recent SDKs, because IPPROTO_IPV6 may be an enumeration member... Modified: python/trunk/Modules/socketmodule.h Modified: python/trunk/Modules/socketmodule.h ============================================================================== --- python/trunk/Modules/socketmodule.h (original) +++ python/trunk/Modules/socketmodule.h Sat Jun 14 10:36:07 2008 @@ -17,9 +17,10 @@ # include /* VC6 is shipped with old platform headers, and does not have MSTcpIP.h * Separate SDKs have all the functions we want, but older ones don't have - * any version information. I use IPPROTO_IPV6 to detect a decent SDK. + * any version information. + * I use SIO_GET_MULTICAST_FILTER to detect a decent SDK. */ -# ifdef IPPROTO_IPV6 +# ifdef SIO_GET_MULTICAST_FILTER # include /* for SIO_RCVALL */ # define HAVE_ADDRINFO # define HAVE_SOCKADDR_STORAGE From python-checkins at python.org Sat Jun 14 11:44:42 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 14 Jun 2008 11:44:42 +0200 (CEST) Subject: [Python-checkins] r64270 - python/trunk/Tools/buildbot/external.bat Message-ID: <20080614094442.29CFE1E4009@bag.python.org> Author: amaury.forgeotdarc Date: Sat Jun 14 11:44:41 2008 New Revision: 64270 Log: Since python2.6 must run on Windows 2000, explicitely disable the use of Windows XP themes when compiling tk. This is also consistent with the WINVER=0x0500 option. Modified: python/trunk/Tools/buildbot/external.bat Modified: python/trunk/Tools/buildbot/external.bat ============================================================================== --- python/trunk/Tools/buildbot/external.bat (original) +++ python/trunk/Tools/buildbot/external.bat Sat Jun 14 11:44:41 2008 @@ -14,8 +14,8 @@ if not exist tcltk\bin\tk85.dll ( cd tk-8.5.2.0\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install cd ..\.. ) From python-checkins at python.org Sat Jun 14 13:50:59 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 13:50:59 +0200 (CEST) Subject: [Python-checkins] r64271 - in python/trunk/Tools/buildbot: external-amd64.bat external.bat Message-ID: <20080614115059.F1AB81E4009@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 13:50:59 2008 New Revision: 64271 Log: Avoid rebuilding tcl/tk. Merge x86 changes into AMD64. Modified: python/trunk/Tools/buildbot/external-amd64.bat python/trunk/Tools/buildbot/external.bat Modified: python/trunk/Tools/buildbot/external-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/external-amd64.bat (original) +++ python/trunk/Tools/buildbot/external-amd64.bat Sat Jun 14 13:50:59 2008 @@ -6,12 +6,15 @@ if not exist tcltk64\bin\tcl85g.dll ( cd tcl-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install cd ..\.. ) if not exist tcltk64\bin\tk85g.dll ( cd tk-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean all install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install cd ..\.. ) Modified: python/trunk/Tools/buildbot/external.bat ============================================================================== --- python/trunk/Tools/buildbot/external.bat (original) +++ python/trunk/Tools/buildbot/external.bat Sat Jun 14 13:50:59 2008 @@ -4,7 +4,7 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\vsvars32.bat" -if not exist tcltk\bin\tcl85.dll ( +if not exist tcltk\bin\tcl85g.dll ( @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install cd tcl-8.5.2.1\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all @@ -12,7 +12,7 @@ cd ..\.. ) -if not exist tcltk\bin\tk85.dll ( +if not exist tcltk\bin\tk85g.dll ( cd tk-8.5.2.0\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all From python-checkins at python.org Sat Jun 14 13:51:55 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 13:51:55 +0200 (CEST) Subject: [Python-checkins] r64272 - in python/trunk/Tools/buildbot: build-amd64.bat build.bat buildmsi.bat clean-amd64.bat clean.bat external-amd64.bat external-common.bat external.bat test-amd64.bat test.bat Message-ID: <20080614115155.7AB621E4009@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 13:51:54 2008 New Revision: 64272 Log: Set eol-style to CRLF for all batch files. Modified: python/trunk/Tools/buildbot/build-amd64.bat (contents, props changed) python/trunk/Tools/buildbot/build.bat (contents, props changed) python/trunk/Tools/buildbot/buildmsi.bat (contents, props changed) python/trunk/Tools/buildbot/clean-amd64.bat (contents, props changed) python/trunk/Tools/buildbot/clean.bat (contents, props changed) python/trunk/Tools/buildbot/external-amd64.bat (contents, props changed) python/trunk/Tools/buildbot/external-common.bat (props changed) python/trunk/Tools/buildbot/external.bat (props changed) python/trunk/Tools/buildbot/test-amd64.bat (contents, props changed) python/trunk/Tools/buildbot/test.bat (contents, props changed) Modified: python/trunk/Tools/buildbot/build-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/build-amd64.bat (original) +++ python/trunk/Tools/buildbot/build-amd64.bat Sat Jun 14 13:51:54 2008 @@ -1,6 +1,6 @@ - at rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external-amd64.bat -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -cmd /c Tools\buildbot\clean-amd64.bat -vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe -vcbuild PCbuild\pcbuild.sln "Debug|x64" + at rem Used by the buildbot "compile" step. +cmd /c Tools\buildbot\external-amd64.bat +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 +cmd /c Tools\buildbot\clean-amd64.bat +vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe +vcbuild PCbuild\pcbuild.sln "Debug|x64" Modified: python/trunk/Tools/buildbot/build.bat ============================================================================== --- python/trunk/Tools/buildbot/build.bat (original) +++ python/trunk/Tools/buildbot/build.bat Sat Jun 14 13:51:54 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external.bat -call "%VS90COMNTOOLS%vsvars32.bat" -cmd /c Tools\buildbot\clean.bat -vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe -vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32" - + at rem Used by the buildbot "compile" step. +cmd /c Tools\buildbot\external.bat +call "%VS90COMNTOOLS%vsvars32.bat" +cmd /c Tools\buildbot\clean.bat +vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe +vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32" + Modified: python/trunk/Tools/buildbot/buildmsi.bat ============================================================================== --- python/trunk/Tools/buildbot/buildmsi.bat (original) +++ python/trunk/Tools/buildbot/buildmsi.bat Sat Jun 14 13:51:54 2008 @@ -1,20 +1,20 @@ - at rem Used by the buildbot "buildmsi" step. - -cmd /c Tools\buildbot\external.bat - at rem build release versions of things -call "%VS90COMNTOOLS%vsvars32.bat" - - at rem build Python -vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32" - - at rem build the documentation -bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp' -"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp - - at rem buold the MSI file -cd PC -nmake /f icons.mak -cd ..\Tools\msi -del *.msi -nmake /f msisupport.mak -%HOST_PYTHON% msi.py + at rem Used by the buildbot "buildmsi" step. + +cmd /c Tools\buildbot\external.bat + at rem build release versions of things +call "%VS90COMNTOOLS%vsvars32.bat" + + at rem build Python +vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32" + + at rem build the documentation +bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp' +"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp + + at rem buold the MSI file +cd PC +nmake /f icons.mak +cd ..\Tools\msi +del *.msi +nmake /f msisupport.mak +%HOST_PYTHON% msi.py Modified: python/trunk/Tools/buildbot/clean-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/clean-amd64.bat (original) +++ python/trunk/Tools/buildbot/clean-amd64.bat Sat Jun 14 13:51:54 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "clean" step. -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -cd PCbuild - at echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -vcbuild /clean pcbuild.sln "Release|x64" -vcbuild /clean pcbuild.sln "Debug|x64" + at rem Used by the buildbot "clean" step. +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 +cd PCbuild + at echo Deleting .pyc/.pyo files ... +del /s Lib\*.pyc Lib\*.pyo +vcbuild /clean pcbuild.sln "Release|x64" +vcbuild /clean pcbuild.sln "Debug|x64" Modified: python/trunk/Tools/buildbot/clean.bat ============================================================================== --- python/trunk/Tools/buildbot/clean.bat (original) +++ python/trunk/Tools/buildbot/clean.bat Sat Jun 14 13:51:54 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "clean" step. -call "%VS90COMNTOOLS%vsvars32.bat" - at echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -cd PCbuild -vcbuild /clean pcbuild.sln "Release|Win32" -vcbuild /clean pcbuild.sln "Debug|Win32" + at rem Used by the buildbot "clean" step. +call "%VS90COMNTOOLS%vsvars32.bat" + at echo Deleting .pyc/.pyo files ... +del /s Lib\*.pyc Lib\*.pyo +cd PCbuild +vcbuild /clean pcbuild.sln "Release|Win32" +vcbuild /clean pcbuild.sln "Debug|Win32" Modified: python/trunk/Tools/buildbot/external-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/external-amd64.bat (original) +++ python/trunk/Tools/buildbot/external-amd64.bat Sat Jun 14 13:51:54 2008 @@ -1,20 +1,20 @@ - at rem Fetches (and builds if necessary) external dependencies - - at rem Assume we start inside the Python source directory -call "Tools\buildbot\external-common.bat" -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 - -if not exist tcltk64\bin\tcl85g.dll ( - cd tcl-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install - cd ..\.. -) - -if not exist tcltk64\bin\tk85g.dll ( - cd tk-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install - cd ..\.. -) + at rem Fetches (and builds if necessary) external dependencies + + at rem Assume we start inside the Python source directory +call "Tools\buildbot\external-common.bat" +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 + +if not exist tcltk64\bin\tcl85g.dll ( + cd tcl-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install + cd ..\.. +) + +if not exist tcltk64\bin\tk85g.dll ( + cd tk-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install + cd ..\.. +) Modified: python/trunk/Tools/buildbot/test-amd64.bat ============================================================================== --- python/trunk/Tools/buildbot/test-amd64.bat (original) +++ python/trunk/Tools/buildbot/test-amd64.bat Sat Jun 14 13:51:54 2008 @@ -1,3 +1,3 @@ - at rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -q -d -x64 -uall -rw + at rem Used by the buildbot "test" step. +cd PCbuild +call rt.bat -q -d -x64 -uall -rw Modified: python/trunk/Tools/buildbot/test.bat ============================================================================== --- python/trunk/Tools/buildbot/test.bat (original) +++ python/trunk/Tools/buildbot/test.bat Sat Jun 14 13:51:54 2008 @@ -1,3 +1,3 @@ - at rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -d -q -uall -rw + at rem Used by the buildbot "test" step. +cd PCbuild +call rt.bat -d -q -uall -rw From python-checkins at python.org Sat Jun 14 14:39:59 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 14 Jun 2008 14:39:59 +0200 (CEST) Subject: [Python-checkins] r64275 - sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Message-ID: <20080614123959.B2ED01E400A@bag.python.org> Author: guilherme.polo Date: Sat Jun 14 14:39:59 2008 New Revision: 64275 Log: Proper style for passed params Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Sat Jun 14 14:39:59 2008 @@ -348,9 +348,9 @@ .. method:: current([newindex=None]) - If newindex is specified, sets the combobox value to the element position - newindex. Otherwise, returns the index of the current value or -1 if the - current value is not in the values list. + If *newindex* is specified, sets the combobox value to the element + position *newindex*. Otherwise, returns the index of the current value or + -1 if the current value is not in the values list. .. method:: get() @@ -360,7 +360,7 @@ .. method:: set(value) - Sets the value of the combobox to value. + Sets the value of the combobox to *value*. Notebook From python-checkins at python.org Sat Jun 14 14:42:28 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 14 Jun 2008 14:42:28 +0200 (CEST) Subject: [Python-checkins] r64276 - sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Message-ID: <20080614124228.C1AD21E4009@bag.python.org> Author: guilherme.polo Date: Sat Jun 14 14:42:28 2008 New Revision: 64276 Log: Typo fix; New options supported: selectbackground, selectforeground; Some janitor work; Added support for date selection via mouse click; Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py (original) +++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Sat Jun 14 14:42:28 2008 @@ -1,7 +1,7 @@ """Simple calendar using ttk Treeview together with calendar and datetime classes. -wrriten by Guilherme Polo, 2008. +written by Guilherme Polo, 2008. """ import calendar @@ -15,6 +15,8 @@ import ttk class Calendar(ttk.Frame): + # XXX ToDo: critical: __getitem__, cget and configure + datetime = calendar.datetime.datetime timedelta = calendar.datetime.timedelta @@ -22,47 +24,67 @@ """ WIDGET-SPECIFIC OPTIONS - locale, firstweekday, year, month + locale, firstweekday, year, month, selectbackground, + selectforeground """ # remove custom options from kw before initializating ttk.Frame - self._fwday = kw.pop('firstweekday', 0) + fwday = kw.pop('firstweekday', calendar.MONDAY) year = kw.pop('year', self.datetime.now().year) month = kw.pop('month', self.datetime.now().month) - self._date = self.datetime(year, month, 1) locale = kw.pop('locale', None) + sel_bg = kw.pop('selectbackground', '#ecffc4') + sel_fg = kw.pop('selectforeground', '#05640e') + + self._date = self.datetime(year, month, 1) + self._selection = None # no date selected ttk.Frame.__init__(self, master, **kw) + # instantiate proper calendar class if locale is None: - self._cal = calendar.TextCalendar(self._fwday) + self._cal = calendar.TextCalendar(fwday) else: - self._cal = calendar.LocaleTextCalendar(self._fwday, locale) + self._cal = calendar.LocaleTextCalendar(fwday, locale) - # custom ttk Buttons - style = ttk.Style(master) - style.layout('L.TButton', [('Button.leftarrow', None)]) - style.layout('R.TButton', [('Button.rightarrow', None)]) + self.__setup_styles() # creates custom styles + self.__place_widgets() # pack/grid used widgets + self.__config_calendar() # adjust calendar columns and setup tags + # configure a canvas, and proper bindings, for selecting dates + self.__setup_selection(sel_bg, sel_fg) + # store items ids, used for insertion later + self._items = [self._calendar.insert('', 'end', values='') + for _ in range(6)] + # insert dates in the currently empty calendar + self._build_calendar() + + def __setup_selection(self, sel_bg, sel_fg): + self._font = tkFont.Font() + self._canvas = canvas = Tkinter.Canvas(self._calendar, + background=sel_bg, borderwidth=0, highlightthickness=0) + canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') + + canvas.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', self._pressed) + + def __setup_styles(self): + # custom ttk styles + style = ttk.Style(self.master) + arrow_layout = lambda dir: ( + [('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})] + ) + style.layout('L.TButton', arrow_layout('left')) + style.layout('R.TButton', arrow_layout('right')) + + def __place_widgets(self): # header frame and its widgets hframe = ttk.Frame(self) lbtn = ttk.Button(hframe, style='L.TButton', command=self._prev_month) rbtn = ttk.Button(hframe, style='R.TButton', command=self._next_month) self._header = ttk.Label(hframe, width=15, anchor='center') - # the calendar - cols = self._cal.formatweekheader(3).split() - self._calendar = ttk.Treeview(show='', columns=cols, selectmode='none', - height=7) - self._calendar.tag_configure('header', background='grey90') - self._calendar.insert('', 'end', values=cols, tag='header') - # adjust columns width - font = tkFont.Font() - maxwidth = max(font.measure(col) for col in cols) - for col in cols: - self._calendar.column(col, width=maxwidth, anchor='e') - # store treeview's tags - self._items = [self._calendar.insert('', 'end', values='') - for _ in range(6)] + self._calendar = ttk.Treeview(show='', selectmode='none', height=7) # pack the widgets hframe.pack(in_=self, side='top', pady=4, anchor='center') @@ -71,43 +93,108 @@ rbtn.grid(in_=hframe, column=2, row=0) self._calendar.pack(in_=self, expand=1, fill='both', side='bottom') - # finally build the calendar display - self.__build_calendar() + def __config_calendar(self): + cols = self._cal.formatweekheader(3).split() + self._calendar['columns'] = cols + self._calendar.tag_configure('header', background='grey90') + self._calendar.insert('', 'end', values=cols, tag='header') + # adjust its columns width + font = tkFont.Font() + maxwidth = max(font.measure(col) for col in cols) + for col in cols: + self._calendar.column(col, width=maxwidth, anchor='e') - def __build_calendar(self): + def _build_calendar(self): year, month = self._date.year, self._date.month + # update header text (Month, YEAR) header = self._cal.formatmonthname(year, month, 0) self._header['text'] = header.title() - #cal = self._cal.monthdatescalendar(year, month) - cal = self._cal.monthdayscalendar(year, month) + # update calendar shown dates + cal = self._cal.monthdayscalendar(year, month) for indx, item in enumerate(self._items): week = cal[indx] if indx < len(cal) else [] - #y = ['%02d' % dtime.day for dtime in week] - y = [('%02d' % day) if day else '' for day in week] - self._calendar.item(self._items[indx], values=y) + fmt_week = [('%02d' % day) if day else '' for day in week] + self._calendar.item(item, values=fmt_week) + + def _show_selection(self, text, bbox): + """Configure canvas for a new selection.""" + x, y, width, height = bbox + + textw = self._font.measure(text) + + canvas = self._canvas + canvas.configure(width=width, height=height) + canvas.coords(canvas.text, width - textw, height / 2 - 1) + canvas.itemconfigure(canvas.text, text=text) + canvas.place(in_=self._calendar, x=x, y=y) + + # Callbacks + + def _pressed(self, evt): + """Clicked somewhere in the calendar.""" + x, y, widget = evt.x, evt.y, evt.widget + item = widget.identify_row(y) + column = widget.identify_column(x) + + if not column or not item in self._items: + # clicked in the weekdays row or just outside the columns + return + + item_values = widget.item(item)['values'] + if not len(item_values): # row is empty for this month + return + + text = item_values[int(column[1]) - 1] + if not text: # date is empty + return + + bbox = widget.bbox(item, column) + if not bbox: # calendar not visible yet + return + + # update and then show selection + self._selection = (text, item, column) + self._show_selection(text, bbox) def _prev_month(self): + """Updated calendar to show the previous month.""" + self._canvas.place_forget() + self._date = self._date - self.timedelta(days=1) self._date = self.datetime(self._date.year, self._date.month, 1) - self.__build_calendar() + self._build_calendar() # reconstuct calendar def _next_month(self): + """Update calendar to show the next month.""" + self._canvas.place_forget() + year, month = self._date.year, self._date.month self._date = self._date + self.timedelta( days=calendar.monthrange(year, month)[1] + 1) self._date = self.datetime(self._date.year, self._date.month, 1) - self.__build_calendar() + self._build_calendar() # reconstruct calendar + + # Properties + + @property + def selection(self): + """Return a datetime representing the current selected date.""" + if not self._selection: + return None + + year, month = self._date.year, self._date.month + return self.datetime(year, month, int(self._selection[0])) def test(): root = Tkinter.Tk() root.title('Ttk Calendar') - x = Calendar(firstweekday=6)#, locale=('pt_BR', 'UTF-8')) - x.pack(expand=1, fill='both') - s = ttk.Style() - s.theme_use('clam') + ttkcal = Calendar(firstweekday=calendar.SUNDAY) + ttkcal.pack(expand=1, fill='both') + style = ttk.Style() + style.theme_use('clam') root.mainloop() if __name__ == '__main__': From python-checkins at python.org Sat Jun 14 15:38:20 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 14 Jun 2008 15:38:20 +0200 (CEST) Subject: [Python-checkins] r64277 - sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Message-ID: <20080614133820.6FD701E4009@bag.python.org> Author: guilherme.polo Date: Sat Jun 14 15:38:20 2008 New Revision: 64277 Log: Repositioned __setup_selection; No longer uses clam theme under windows. Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py (original) +++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Sat Jun 14 15:38:20 2008 @@ -58,16 +58,6 @@ # insert dates in the currently empty calendar self._build_calendar() - def __setup_selection(self, sel_bg, sel_fg): - self._font = tkFont.Font() - self._canvas = canvas = Tkinter.Canvas(self._calendar, - background=sel_bg, borderwidth=0, highlightthickness=0) - canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') - - canvas.bind('', lambda evt: canvas.place_forget()) - self._calendar.bind('', lambda evt: canvas.place_forget()) - self._calendar.bind('', self._pressed) - def __setup_styles(self): # custom ttk styles style = ttk.Style(self.master) @@ -104,6 +94,16 @@ for col in cols: self._calendar.column(col, width=maxwidth, anchor='e') + def __setup_selection(self, sel_bg, sel_fg): + self._font = tkFont.Font() + self._canvas = canvas = Tkinter.Canvas(self._calendar, + background=sel_bg, borderwidth=0, highlightthickness=0) + canvas.text = canvas.create_text(0, 0, fill=sel_fg, anchor='w') + + canvas.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', lambda evt: canvas.place_forget()) + self._calendar.bind('', self._pressed) + def _build_calendar(self): year, month = self._date.year, self._date.month @@ -187,14 +187,17 @@ year, month = self._date.year, self._date.month return self.datetime(year, month, int(self._selection[0])) - +import sys def test(): root = Tkinter.Tk() root.title('Ttk Calendar') ttkcal = Calendar(firstweekday=calendar.SUNDAY) ttkcal.pack(expand=1, fill='both') - style = ttk.Style() - style.theme_use('clam') + + if 'win' not in sys.platform: + style = ttk.Style() + style.theme_use('clam') + root.mainloop() if __name__ == '__main__': From buildbot at python.org Sat Jun 14 15:43:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 13:43:13 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080614134313.795281E4009@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1008 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_compile test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 16:24:47 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jun 2008 16:24:47 +0200 (CEST) Subject: [Python-checkins] r64278 - python/trunk/Tools/msi/msilib.py Message-ID: <20080614142447.B17FC1E4009@bag.python.org> Author: martin.v.loewis Date: Sat Jun 14 16:24:47 2008 New Revision: 64278 Log: Disable UAC by default. Modified: python/trunk/Tools/msi/msilib.py Modified: python/trunk/Tools/msi/msilib.py ============================================================================== --- python/trunk/Tools/msi/msilib.py (original) +++ python/trunk/Tools/msi/msilib.py Sat Jun 14 16:24:47 2008 @@ -289,7 +289,8 @@ def init_database(name, schema, ProductName, ProductCode, ProductVersion, - Manufacturer): + Manufacturer, + request_uac = False): try: os.unlink(name) except OSError: @@ -311,7 +312,11 @@ si.SetProperty(PID_AUTHOR, Manufacturer) si.SetProperty(PID_TEMPLATE, msi_type) si.SetProperty(PID_REVNUMBER, gen_uuid()) - si.SetProperty(PID_WORDCOUNT, 2) # long file names, compressed, original media + if request_uac: + wc = 2 # long file names, compressed, original media + else: + wc = 2 | 8 # +never invoke UAC + si.SetProperty(PID_WORDCOUNT, wc) si.SetProperty(PID_PAGECOUNT, 200) si.SetProperty(PID_APPNAME, "Python MSI Library") # XXX more properties From python-checkins at python.org Sat Jun 14 18:52:48 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 14 Jun 2008 18:52:48 +0200 (CEST) Subject: [Python-checkins] r64279 - sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Message-ID: <20080614165248.248E11E400A@bag.python.org> Author: guilherme.polo Date: Sat Jun 14 18:52:47 2008 New Revision: 64279 Log: Set widget minimal size Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Modified: sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py (original) +++ sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py Sat Jun 14 18:52:47 2008 @@ -58,6 +58,9 @@ # insert dates in the currently empty calendar self._build_calendar() + # set the minimal size for the widget + self._calendar.bind('', self.__minsize) + def __setup_styles(self): # custom ttk styles style = ttk.Style(self.master) @@ -92,7 +95,8 @@ font = tkFont.Font() maxwidth = max(font.measure(col) for col in cols) for col in cols: - self._calendar.column(col, width=maxwidth, anchor='e') + self._calendar.column(col, width=maxwidth, minwidth=maxwidth, + anchor='e') def __setup_selection(self, sel_bg, sel_fg): self._font = tkFont.Font() @@ -104,6 +108,11 @@ self._calendar.bind('', lambda evt: canvas.place_forget()) self._calendar.bind('', self._pressed) + def __minsize(self, evt): + width, height = self._calendar.master.geometry().split('x') + height = height[:height.index('+')] + self._calendar.master.minsize(width, height) + def _build_calendar(self): year, month = self._date.year, self._date.month From python-checkins at python.org Sat Jun 14 19:34:10 2008 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 14 Jun 2008 19:34:10 +0200 (CEST) Subject: [Python-checkins] r64280 - python/trunk/Lib/test/test_struct.py Message-ID: <20080614173410.265B01E4009@bag.python.org> Author: gregory.p.smith Date: Sat Jun 14 19:34:09 2008 New Revision: 64280 Log: silence the test when it is skipped on some platforms. should fix a buildbot. Modified: python/trunk/Lib/test/test_struct.py Modified: python/trunk/Lib/test/test_struct.py ============================================================================== --- python/trunk/Lib/test/test_struct.py (original) +++ python/trunk/Lib/test/test_struct.py Sat Jun 14 19:34:09 2008 @@ -569,11 +569,9 @@ for c in '\x01\x7f\xff\x0f\xf0': self.assertTrue(struct.unpack('>?', c)[0]) - def test_crasher(self): - if IS32BIT: + if IS32BIT: + def test_crasher(self): self.assertRaises(MemoryError, struct.pack, "357913941c", "a") - else: - print "%s test_crasher skipped on 64bit build." From buildbot at python.org Sat Jun 14 19:41:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 17:41:43 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20080614174143.C1AC81E4009@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/796 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sat Jun 14 22:24:17 2008 From: python-checkins at python.org (guido.van.rossum) Date: Sat, 14 Jun 2008 22:24:17 +0200 (CEST) Subject: [Python-checkins] r64282 - in peps/trunk: pep-0000.txt pep-3134.txt Message-ID: <20080614202417.AA22D1E4009@bag.python.org> Author: guido.van.rossum Date: Sat Jun 14 22:24:17 2008 New Revision: 64282 Log: Accept PEP 3134 (exception chaining etc.). Modified: peps/trunk/pep-0000.txt peps/trunk/pep-3134.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Sat Jun 14 22:24:17 2008 @@ -84,6 +84,7 @@ SA 3118 Revising the buffer protocol Oliphant, Banks SA 3119 Introducing Abstract Base Classes GvR, Talin SA 3121 Extension Module Initialization & Finalization von L?wis + SA 3134 Exception Chaining and Embedded Tracebacks Yee SA 3137 Immutable Bytes and Mutable Buffer GvR SA 3141 A Type Hierarchy for Numbers Yasskin @@ -97,7 +98,6 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes - S 3134 Exception Chaining and Embedded Tracebacks Yee S 3135 New Super Spealman, Delaney Finished PEPs (done, implemented in Subversion) @@ -516,7 +516,7 @@ SF 3131 Supporting Non-ASCII Identifiers von L?wis SF 3132 Extended Iterable Unpacking Brandl SR 3133 Introducing Roles Winter - S 3134 Exception Chaining and Embedded Tracebacks Yee + SA 3134 Exception Chaining and Embedded Tracebacks Yee S 3135 New Super Spealman, Delaney SR 3136 Labeled break and continue Chisholm SA 3137 Immutable Bytes and Mutable Buffer GvR Modified: peps/trunk/pep-3134.txt ============================================================================== --- peps/trunk/pep-3134.txt (original) +++ peps/trunk/pep-3134.txt Sat Jun 14 22:24:17 2008 @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Ka-Ping Yee -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/plain Created: 12-May-2005 From buildbot at python.org Sun Jun 15 01:26:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 14 Jun 2008 23:26:07 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080614232607.755A91E401B@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/684 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 Jun 15 02:37:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 00:37:57 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080615003757.9DB931E4009@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1143 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 15 03:02:07 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 03:02:07 +0200 (CEST) Subject: [Python-checkins] r64285 - in python/branches/tlee-ast-optimize: Doc/includes/email-alternative.py Doc/includes/mp_benchmarks.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/includes/noddy.c Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/includes/shoddy.c Doc/includes/sqlite3/ctx_manager.py Doc/includes/typestruct.h Doc/library/hotshot.rst Doc/tools/sphinxext/patchlevel.py Doc/tools/sphinxext/pyspecific.py Include/bytes_methods.h Include/warnings.h Lib/ast.py Lib/bsddb/test/test_distributed_transactions.py Lib/bsddb/test/test_early_close.py Lib/bsddb/test/test_replication.py Lib/ctypes/test/test_errno.py Lib/distutils/config.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_config.py Lib/distutils/tests/test_upload.py Lib/encodings/utf_32.py Lib/encodings/utf_32_be.py Lib/encodings/utf_32_le.py Lib/json/__init__.py Lib/json/decoder.py Lib/json/encoder.py Lib/json/scanner.py Lib/json/tests/__init__.py Lib/json/tests/test_decode.py Lib/json/tests/test_default.py Lib/json/tests/test_dump.py Lib/json/tests/test_encode_basestring_ascii.py Lib/json/tests/test_fail.py Lib/json/tests/test_float.py Lib/json/tests/test_indent.py Lib/json/tests/test_pass1.py Lib/json/tests/test_pass2.py Lib/json/tests/test_pass3.py Lib/json/tests/test_recursion.py Lib/json/tests/test_scanstring.py Lib/json/tests/test_separators.py Lib/json/tests/test_speedups.py Lib/json/tests/test_unicode.py Lib/json/tool.py Lib/lib-tk/FileDialog.py Lib/lib-tk/SimpleDialog.py Lib/lib-tk/tkFileDialog.py Lib/lib-tk/tkSimpleDialog.py Lib/lib2to3/__init__.py Lib/lib2to3/fixes/fix_execfile.py Lib/lib2to3/fixes/fix_funcattrs.py Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_itertools.py Lib/lib2to3/fixes/fix_itertools_imports.py Lib/lib2to3/fixes/fix_standarderror.py Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/fixes/fix_xreadlines.py Lib/lib2to3/fixes/fix_zip.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_parser.py Lib/multiprocessing Lib/multiprocessing/__init__.py Lib/multiprocessing/connection.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/dummy/connection.py Lib/multiprocessing/forking.py Lib/multiprocessing/heap.py Lib/multiprocessing/managers.py Lib/multiprocessing/pool.py Lib/multiprocessing/process.py Lib/multiprocessing/queues.py Lib/multiprocessing/reduction.py Lib/multiprocessing/sharedctypes.py Lib/multiprocessing/synchronize.py Lib/multiprocessing/util.py Lib/numbers.py Lib/platform.py Lib/pydoc_topics.py Lib/sqlite3/dump.py Lib/sqlite3/test/dump.py Lib/sqlite3/test/py25tests.py Lib/test/buffer_tests.py Lib/test/cmath_testcases.txt Lib/test/curses_tests.py Lib/test/profilee.py Lib/test/pydoc_mod.py Lib/test/relimport.py Lib/test/test_SimpleHTTPServer.py Lib/test/test_abstract_numbers.py Lib/test/test_asyncore.py Lib/test/test_buffer.py Lib/test/test_cmd.py Lib/test/test_docxmlrpc.py Lib/test/test_fractions.py Lib/test/test_future_builtins.py Lib/test/test_httpservers.py Lib/test/test_int.py Lib/test/test_json.py Lib/test/test_memoryio.py Lib/test/test_multiprocessing.py Lib/test/test_mutex.py Lib/test/test_pipes.py Lib/test/test_print.py Lib/test/test_pstats.py Lib/test/test_pydoc.py Lib/test/test_struct.py Lib/test/test_urllib2_localnet.py Misc/ACKS Misc/NEWS Modules/_ctypes/libffi_osx/ffi.c Modules/_ctypes/libffi_osx/include/ffi.h Modules/_ctypes/libffi_osx/include/ffi_common.h Modules/_ctypes/libffi_osx/include/fficonfig.h Modules/_ctypes/libffi_osx/include/ffitarget.h Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h Modules/_ctypes/libffi_osx/include/x86-ffitarget.h Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c Modules/_ctypes/libffi_osx/types.c Modules/_ctypes/libffi_osx/x86/x86-ffi64.c Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c Modules/_json.c Modules/_multiprocessing/connection.h Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.h Modules/_multiprocessing/pipe_connection.c Modules/_multiprocessing/semaphore.c Modules/_multiprocessing/socket_connection.c Modules/_multiprocessing/win32_functions.c Modules/bsddb.h Modules/future_builtins.c Modules/socketmodule.h Objects/bytes_methods.c Objects/stringlib/ctype.h Objects/stringlib/formatter.h Objects/stringlib/localeutil.h Objects/stringlib/string_format.h Objects/stringlib/stringdefs.h Objects/stringlib/transmogrify.h Objects/stringlib/unicodedefs.h PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_ctypes.vcproj PC/VS8.0/_ctypes_test.vcproj PC/VS8.0/_elementtree.vcproj PC/VS8.0/_hashlib.vcproj PC/VS8.0/_msi.vcproj PC/VS8.0/_multiprocessing.vcproj PC/VS8.0/_socket.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/_ssl.vcproj PC/VS8.0/_testcapi.vcproj PC/VS8.0/_tkinter.vcproj PC/VS8.0/bdist_wininst.vcproj PC/VS8.0/bz2.vcproj PC/VS8.0/kill_python.c PC/VS8.0/kill_python.vcproj PC/VS8.0/make_buildinfo.vcproj PC/VS8.0/make_versioninfo.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyexpat.vcproj PC/VS8.0/python.vcproj PC/VS8.0/pythoncore.vcproj PC/VS8.0/pythonw.vcproj PC/VS8.0/select.vcproj PC/VS8.0/sqlite3.vcproj PC/VS8.0/unicodedata.vcproj PC/VS8.0/w9xpopen.vcproj PC/VS8.0/winsound.vcproj PCbuild/_bsddb44.vcproj PCbuild/_multiprocessing.vcproj PCbuild/bdist_wininst.vcproj PCbuild/kill_python.c PCbuild/kill_python.vcproj PCbuild/pyproject.vsprops PCbuild/readme.txt PCbuild/sqlite3.vcproj Python/formatter_string.c Python/formatter_unicode.c Tools/buildbot/build-amd64.bat Tools/buildbot/build.bat Tools/buildbot/buildmsi.bat Tools/buildbot/clean-amd64.bat Tools/buildbot/clean.bat Tools/buildbot/external-amd64.bat Tools/buildbot/external-common.bat Tools/buildbot/external.bat Tools/buildbot/test-amd64.bat Tools/buildbot/test.bat Tools/msi/msi.py Tools/msi/msilib.py Tools/pybench/With.py Tools/scripts/patchcheck.py Tools/scripts/svneol.py Message-ID: <20080615010207.92E891E4009@bag.python.org> Author: thomas.lee Date: Sun Jun 15 03:02:00 2008 New Revision: 64285 Log: Merged revisions 64233-64284 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64233 | benjamin.peterson | 2008-06-14 01:11:50 +1000 (Sat, 14 Jun 2008) | 2 lines platform.uname now tries to fill empty values even when os.uname is present ........ r64235 | benjamin.peterson | 2008-06-14 01:41:09 +1000 (Sat, 14 Jun 2008) | 1 line set svn:ignore on multiprocessing ........ r64239 | martin.v.loewis | 2008-06-14 03:22:39 +1000 (Sat, 14 Jun 2008) | 1 line Switch to bzip2 1.0.5. ........ r64243 | martin.v.loewis | 2008-06-14 04:12:51 +1000 (Sat, 14 Jun 2008) | 1 line Switch to SQLite 3.5.9. ........ r64244 | martin.v.loewis | 2008-06-14 04:19:49 +1000 (Sat, 14 Jun 2008) | 1 line Update AMD64 build for amalgamated sqlite. ........ r64246 | martin.v.loewis | 2008-06-14 04:58:47 +1000 (Sat, 14 Jun 2008) | 2 lines Pickup sqlite3.dll from binary directory. Commit more often. ........ r64248 | benjamin.peterson | 2008-06-14 05:13:39 +1000 (Sat, 14 Jun 2008) | 1 line convert multiprocessing to unix line endings ........ r64250 | benjamin.peterson | 2008-06-14 05:20:48 +1000 (Sat, 14 Jun 2008) | 1 line darn! I converted half of the files the wrong way. ........ r64253 | andrew.kuchling | 2008-06-14 05:38:18 +1000 (Sat, 14 Jun 2008) | 1 line Typo fixes ........ r64254 | amaury.forgeotdarc | 2008-06-14 07:54:30 +1000 (Sat, 14 Jun 2008) | 2 lines Add a missing file for VS2005 ........ r64257 | martin.v.loewis | 2008-06-14 08:38:33 +1000 (Sat, 14 Jun 2008) | 2 lines Run svneol.py on all sources. ........ r64260 | martin.v.loewis | 2008-06-14 10:41:41 +1000 (Sat, 14 Jun 2008) | 2 lines Revert eol-style to CRLF. ........ r64262 | martin.v.loewis | 2008-06-14 11:50:46 +1000 (Sat, 14 Jun 2008) | 2 lines Support subversion repositories of version 8. ........ r64265 | martin.v.loewis | 2008-06-14 16:24:44 +1000 (Sat, 14 Jun 2008) | 2 lines Conservatively restrict support to format 8 repositories. ........ r64267 | amaury.forgeotdarc | 2008-06-14 17:40:32 +1000 (Sat, 14 Jun 2008) | 2 lines Use the correct URL for sqlite3 sources, and try to fix windows buildbots. ........ r64269 | amaury.forgeotdarc | 2008-06-14 18:36:07 +1000 (Sat, 14 Jun 2008) | 3 lines on windows, r64214 broke compilation with some recent SDKs, because IPPROTO_IPV6 may be an enumeration member... ........ r64270 | amaury.forgeotdarc | 2008-06-14 19:44:41 +1000 (Sat, 14 Jun 2008) | 4 lines Since python2.6 must run on Windows 2000, explicitely disable the use of Windows XP themes when compiling tk. This is also consistent with the WINVER=0x0500 option. ........ r64271 | martin.v.loewis | 2008-06-14 21:50:59 +1000 (Sat, 14 Jun 2008) | 3 lines Avoid rebuilding tcl/tk. Merge x86 changes into AMD64. ........ r64272 | martin.v.loewis | 2008-06-14 21:51:54 +1000 (Sat, 14 Jun 2008) | 2 lines Set eol-style to CRLF for all batch files. ........ r64278 | martin.v.loewis | 2008-06-15 00:24:47 +1000 (Sun, 15 Jun 2008) | 2 lines Disable UAC by default. ........ r64280 | gregory.p.smith | 2008-06-15 03:34:09 +1000 (Sun, 15 Jun 2008) | 3 lines silence the test when it is skipped on some platforms. should fix a buildbot. ........ Added: python/branches/tlee-ast-optimize/PC/VS8.0/_multiprocessing.vcproj - copied unchanged from r64280, /python/trunk/PC/VS8.0/_multiprocessing.vcproj Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/includes/email-alternative.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/noddy.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/noddy2.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/noddy3.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/noddy4.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/run-func.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/shoddy.c (props changed) python/branches/tlee-ast-optimize/Doc/includes/sqlite3/ctx_manager.py (props changed) python/branches/tlee-ast-optimize/Doc/includes/typestruct.h (props changed) python/branches/tlee-ast-optimize/Doc/library/hotshot.rst python/branches/tlee-ast-optimize/Doc/tools/sphinxext/patchlevel.py (props changed) python/branches/tlee-ast-optimize/Doc/tools/sphinxext/pyspecific.py (props changed) python/branches/tlee-ast-optimize/Include/bytes_methods.h (props changed) python/branches/tlee-ast-optimize/Include/warnings.h (props changed) python/branches/tlee-ast-optimize/Lib/ast.py (props changed) python/branches/tlee-ast-optimize/Lib/bsddb/test/test_distributed_transactions.py (props changed) python/branches/tlee-ast-optimize/Lib/bsddb/test/test_early_close.py (props changed) python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py (props changed) python/branches/tlee-ast-optimize/Lib/ctypes/test/test_errno.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/distutils/config.py (props changed) python/branches/tlee-ast-optimize/Lib/distutils/tests/test_build_ext.py (props changed) python/branches/tlee-ast-optimize/Lib/distutils/tests/test_config.py (props changed) python/branches/tlee-ast-optimize/Lib/distutils/tests/test_upload.py (props changed) python/branches/tlee-ast-optimize/Lib/encodings/utf_32.py (props changed) python/branches/tlee-ast-optimize/Lib/encodings/utf_32_be.py (props changed) python/branches/tlee-ast-optimize/Lib/encodings/utf_32_le.py (props changed) python/branches/tlee-ast-optimize/Lib/json/__init__.py (props changed) python/branches/tlee-ast-optimize/Lib/json/decoder.py (props changed) python/branches/tlee-ast-optimize/Lib/json/encoder.py (props changed) python/branches/tlee-ast-optimize/Lib/json/scanner.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/__init__.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_decode.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_default.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_dump.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_encode_basestring_ascii.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_fail.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_float.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_indent.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_pass1.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_pass2.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_pass3.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_recursion.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_scanstring.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_separators.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_speedups.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tests/test_unicode.py (props changed) python/branches/tlee-ast-optimize/Lib/json/tool.py (props changed) python/branches/tlee-ast-optimize/Lib/lib-tk/FileDialog.py (props changed) python/branches/tlee-ast-optimize/Lib/lib-tk/SimpleDialog.py (props changed) python/branches/tlee-ast-optimize/Lib/lib-tk/tkFileDialog.py (props changed) python/branches/tlee-ast-optimize/Lib/lib-tk/tkSimpleDialog.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/__init__.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_execfile.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_funcattrs.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_idioms.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_import.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools_imports.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_standarderror.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_types.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xreadlines.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_zip.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_parser.py (props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/ (props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/__init__.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/connection.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/heap.py (props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/sharedctypes.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/numbers.py (props changed) python/branches/tlee-ast-optimize/Lib/platform.py python/branches/tlee-ast-optimize/Lib/pydoc_topics.py (props changed) python/branches/tlee-ast-optimize/Lib/sqlite3/dump.py (props changed) python/branches/tlee-ast-optimize/Lib/sqlite3/test/dump.py (props changed) python/branches/tlee-ast-optimize/Lib/sqlite3/test/py25tests.py (props changed) python/branches/tlee-ast-optimize/Lib/test/buffer_tests.py (props changed) python/branches/tlee-ast-optimize/Lib/test/cmath_testcases.txt (props changed) python/branches/tlee-ast-optimize/Lib/test/curses_tests.py (props changed) python/branches/tlee-ast-optimize/Lib/test/profilee.py (props changed) python/branches/tlee-ast-optimize/Lib/test/pydoc_mod.py (props changed) python/branches/tlee-ast-optimize/Lib/test/relimport.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_SimpleHTTPServer.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_abstract_numbers.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/test/test_buffer.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_cmd.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_docxmlrpc.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_fractions.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_future_builtins.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_httpservers.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_int.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_json.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_memoryio.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py (contents, props changed) python/branches/tlee-ast-optimize/Lib/test/test_mutex.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_pipes.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_print.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_pstats.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py (props changed) python/branches/tlee-ast-optimize/Lib/test/test_struct.py python/branches/tlee-ast-optimize/Lib/test/test_urllib2_localnet.py (props changed) python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/ffi.c (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/ffi.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/ffi_common.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/fficonfig.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/ffitarget.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/include/x86-ffitarget.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/powerpc/ppc-darwin.h (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/powerpc/ppc-ffi_darwin.c (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/types.c (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-ffi64.c (props changed) python/branches/tlee-ast-optimize/Modules/_ctypes/libffi_osx/x86/x86-ffi_darwin.c (props changed) python/branches/tlee-ast-optimize/Modules/_json.c (props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/connection.h (props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c (contents, props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h (contents, props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/pipe_connection.c (contents, props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/semaphore.c (props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/socket_connection.c (props changed) python/branches/tlee-ast-optimize/Modules/_multiprocessing/win32_functions.c (contents, props changed) python/branches/tlee-ast-optimize/Modules/bsddb.h (props changed) python/branches/tlee-ast-optimize/Modules/future_builtins.c (props changed) python/branches/tlee-ast-optimize/Modules/socketmodule.h python/branches/tlee-ast-optimize/Objects/bytes_methods.c (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/ctype.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/formatter.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/localeutil.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/string_format.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/stringdefs.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/transmogrify.h (props changed) python/branches/tlee-ast-optimize/Objects/stringlib/unicodedefs.h (props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes_test.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_hashlib.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_msi.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_socket.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_testcapi.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/bdist_wininst.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/bz2.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.c (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/make_buildinfo.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/pyexpat.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/pythonw.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/select.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/unicodedata.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/w9xpopen.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PC/VS8.0/winsound.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PCbuild/_multiprocessing.vcproj (props changed) python/branches/tlee-ast-optimize/PCbuild/bdist_wininst.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PCbuild/kill_python.c (contents, props changed) python/branches/tlee-ast-optimize/PCbuild/kill_python.vcproj (contents, props changed) python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops python/branches/tlee-ast-optimize/PCbuild/readme.txt python/branches/tlee-ast-optimize/PCbuild/sqlite3.vcproj (contents, props changed) python/branches/tlee-ast-optimize/Python/formatter_string.c (props changed) python/branches/tlee-ast-optimize/Python/formatter_unicode.c (props changed) python/branches/tlee-ast-optimize/Tools/buildbot/build-amd64.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/build.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/buildmsi.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/clean-amd64.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/clean.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/external.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/test-amd64.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/buildbot/test.bat (contents, props changed) python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/Tools/msi/msilib.py python/branches/tlee-ast-optimize/Tools/pybench/With.py (props changed) python/branches/tlee-ast-optimize/Tools/scripts/patchcheck.py (props changed) python/branches/tlee-ast-optimize/Tools/scripts/svneol.py Modified: python/branches/tlee-ast-optimize/Doc/library/hotshot.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/hotshot.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/hotshot.rst Sun Jun 15 03:02:00 2008 @@ -18,12 +18,12 @@ .. note:: The :mod:`hotshot` module focuses on minimizing the overhead while profiling, at - the expense of long data post-processing times. For common usages it is + the expense of long data post-processing times. For common usage it is recommended to use :mod:`cProfile` instead. :mod:`hotshot` is not maintained and might be removed from the standard library in the future. .. versionchanged:: 2.5 - the results should be more meaningful than in the past: the timing core + The results should be more meaningful than in the past: the timing core contained a critical bug. .. warning:: Modified: python/branches/tlee-ast-optimize/Lib/ctypes/test/test_errno.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ctypes/test/test_errno.py (original) +++ python/branches/tlee-ast-optimize/Lib/ctypes/test/test_errno.py Sun Jun 15 03:02:00 2008 @@ -1,76 +1,76 @@ -import unittest, os, errno -from ctypes import * -from ctypes.util import find_library -import threading - -class Test(unittest.TestCase): - def test_open(self): - libc_name = find_library("c") - if libc_name is not None: - libc = CDLL(libc_name, use_errno=True) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - - libc_open.argtypes = c_char_p, c_int - - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), errno.ENOENT) - - self.failUnlessEqual(set_errno(32), errno.ENOENT) - self.failUnlessEqual(get_errno(), 32) - - - def _worker(): - set_errno(0) - - libc = CDLL(libc_name, use_errno=False) - if os.name == "nt": - libc_open = libc._open - else: - libc_open = libc.open - libc_open.argtypes = c_char_p, c_int - self.failUnlessEqual(libc_open("", 0), -1) - self.failUnlessEqual(get_errno(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_errno(), 32) - set_errno(0) - - if os.name == "nt": - - def test_GetLastError(self): - dll = WinDLL("kernel32", use_last_error=True) - GetModuleHandle = dll.GetModuleHandleA - GetModuleHandle.argtypes = [c_wchar_p] - - self.failUnlessEqual(0, GetModuleHandle("foo")) - self.failUnlessEqual(get_last_error(), 126) - - self.failUnlessEqual(set_last_error(32), 126) - self.failUnlessEqual(get_last_error(), 32) - - def _worker(): - set_last_error(0) - - dll = WinDLL("kernel32", use_last_error=False) - GetModuleHandle = dll.GetModuleHandleW - GetModuleHandle.argtypes = [c_wchar_p] - GetModuleHandle("bar") - - self.failUnlessEqual(get_last_error(), 0) - - t = threading.Thread(target=_worker) - t.start() - t.join() - - self.failUnlessEqual(get_last_error(), 32) - - set_last_error(0) - -if __name__ == "__main__": - unittest.main() +import unittest, os, errno +from ctypes import * +from ctypes.util import find_library +import threading + +class Test(unittest.TestCase): + def test_open(self): + libc_name = find_library("c") + if libc_name is not None: + libc = CDLL(libc_name, use_errno=True) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + + libc_open.argtypes = c_char_p, c_int + + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), errno.ENOENT) + + self.failUnlessEqual(set_errno(32), errno.ENOENT) + self.failUnlessEqual(get_errno(), 32) + + + def _worker(): + set_errno(0) + + libc = CDLL(libc_name, use_errno=False) + if os.name == "nt": + libc_open = libc._open + else: + libc_open = libc.open + libc_open.argtypes = c_char_p, c_int + self.failUnlessEqual(libc_open("", 0), -1) + self.failUnlessEqual(get_errno(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_errno(), 32) + set_errno(0) + + if os.name == "nt": + + def test_GetLastError(self): + dll = WinDLL("kernel32", use_last_error=True) + GetModuleHandle = dll.GetModuleHandleA + GetModuleHandle.argtypes = [c_wchar_p] + + self.failUnlessEqual(0, GetModuleHandle("foo")) + self.failUnlessEqual(get_last_error(), 126) + + self.failUnlessEqual(set_last_error(32), 126) + self.failUnlessEqual(get_last_error(), 32) + + def _worker(): + set_last_error(0) + + dll = WinDLL("kernel32", use_last_error=False) + GetModuleHandle = dll.GetModuleHandleW + GetModuleHandle.argtypes = [c_wchar_p] + GetModuleHandle("bar") + + self.failUnlessEqual(get_last_error(), 0) + + t = threading.Thread(target=_worker) + t.start() + t.join() + + self.failUnlessEqual(get_last_error(), 32) + + set_last_error(0) + +if __name__ == "__main__": + unittest.main() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/__init__.py Sun Jun 15 03:02:00 2008 @@ -1,271 +1,271 @@ -# -# Package analogous to 'threading.py' but using processes -# -# multiprocessing/__init__.py -# -# This package is intended to duplicate the functionality (and much of -# the API) of threading.py but uses processes instead of threads. A -# subpackage 'multiprocessing.dummy' has the same API but is a simple -# wrapper for 'threading'. -# -# Try calling `multiprocessing.doc.main()` to read the html -# documentation in in a webbrowser. -# -# -# Copyright (c) 2006-2008, R Oudkerk -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of author nor the names of any contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# - -__version__ = '0.70a1' - -__all__ = [ - 'Process', 'current_process', 'active_children', 'freeze_support', - 'Manager', 'Pipe', 'cpu_count', 'log_to_stderr', 'get_logger', - 'allow_connection_pickling', 'BufferTooShort', 'TimeoutError', - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', - 'Event', 'Queue', 'JoinableQueue', 'Pool', 'Value', 'Array', - 'RawValue', 'RawArray' - ] - -__author__ = 'R. Oudkerk (r.m.oudkerk at gmail.com)' - -# -# Imports -# - -import os -import sys - -from multiprocessing.process import Process, current_process, active_children - -# -# Exceptions -# - -class ProcessError(Exception): - pass - -class BufferTooShort(ProcessError): - pass - -class TimeoutError(ProcessError): - pass - -class AuthenticationError(ProcessError): - pass - -# This is down here because _multiprocessing uses BufferTooShort -import _multiprocessing - -# -# Definitions not depending on native semaphores -# - -def Manager(): - ''' - Returns a manager associated with a running server process - - The managers methods such as `Lock()`, `Condition()` and `Queue()` - can be used to create shared objects. - ''' - from multiprocessing.managers import SyncManager - m = SyncManager() - m.start() - return m - -def Pipe(duplex=True): - ''' - Returns two connection object connected by a pipe - ''' - from multiprocessing.connection import Pipe - return Pipe(duplex) - -def cpu_count(): - ''' - Returns the number of CPUs in the system - ''' - if sys.platform == 'win32': - try: - num = int(os.environ['NUMBER_OF_PROCESSORS']) - except (ValueError, KeyError): - num = 0 - elif sys.platform == 'darwin': - try: - num = int(os.popen('sysctl -n hw.ncpu').read()) - except ValueError: - num = 0 - else: - try: - num = os.sysconf('SC_NPROCESSORS_ONLN') - except (ValueError, OSError, AttributeError): - num = 0 - - if num >= 1: - return num - else: - raise NotImplementedError('cannot determine number of cpus') - -def freeze_support(): - ''' - Check whether this is a fake forked process in a frozen executable. - If so then run code specified by commandline and exit. - ''' - if sys.platform == 'win32' and getattr(sys, 'frozen', False): - from multiprocessing.forking import freeze_support - freeze_support() - -def get_logger(): - ''' - Return package logger -- if it does not already exist then it is created - ''' - from multiprocessing.util import get_logger - return get_logger() - -def log_to_stderr(level=None): - ''' - Turn on logging and add a handler which prints to stderr - ''' - from multiprocessing.util import log_to_stderr - return log_to_stderr(level) - -def allow_connection_pickling(): - ''' - Install support for sending connections and sockets between processes - ''' - from multiprocessing import reduction - -# -# Definitions depending on native semaphores -# - -def Lock(): - ''' - Returns a non-recursive lock object - ''' - from multiprocessing.synchronize import Lock - return Lock() - -def RLock(): - ''' - Returns a recursive lock object - ''' - from multiprocessing.synchronize import RLock - return RLock() - -def Condition(lock=None): - ''' - Returns a condition object - ''' - from multiprocessing.synchronize import Condition - return Condition(lock) - -def Semaphore(value=1): - ''' - Returns a semaphore object - ''' - from multiprocessing.synchronize import Semaphore - return Semaphore(value) - -def BoundedSemaphore(value=1): - ''' - Returns a bounded semaphore object - ''' - from multiprocessing.synchronize import BoundedSemaphore - return BoundedSemaphore(value) - -def Event(): - ''' - Returns an event object - ''' - from multiprocessing.synchronize import Event - return Event() - -def Queue(maxsize=0): - ''' - Returns a queue object - ''' - from multiprocessing.queues import Queue - return Queue(maxsize) - -def JoinableQueue(maxsize=0): - ''' - Returns a queue object - ''' - from multiprocessing.queues import JoinableQueue - return JoinableQueue(maxsize) - -def Pool(processes=None, initializer=None, initargs=()): - ''' - Returns a process pool object - ''' - from multiprocessing.pool import Pool - return Pool(processes, initializer, initargs) - -def RawValue(typecode_or_type, *args): - ''' - Returns a shared object - ''' - from multiprocessing.sharedctypes import RawValue - return RawValue(typecode_or_type, *args) - -def RawArray(typecode_or_type, size_or_initializer): - ''' - Returns a shared array - ''' - from multiprocessing.sharedctypes import RawArray - return RawArray(typecode_or_type, size_or_initializer) - -def Value(typecode_or_type, *args, **kwds): - ''' - Returns a synchronized shared object - ''' - from multiprocessing.sharedctypes import Value - return Value(typecode_or_type, *args, **kwds) - -def Array(typecode_or_type, size_or_initializer, **kwds): - ''' - Returns a synchronized shared array - ''' - from multiprocessing.sharedctypes import Array - return Array(typecode_or_type, size_or_initializer, **kwds) - -# -# -# - -if sys.platform == 'win32': - - def set_executable(executable): - ''' - Sets the path to a python.exe or pythonw.exe binary used to run - child processes on Windows instead of sys.executable. - Useful for people embedding Python. - ''' - from multiprocessing.forking import set_executable - set_executable(executable) - - __all__ += ['set_executable'] +# +# Package analogous to 'threading.py' but using processes +# +# multiprocessing/__init__.py +# +# This package is intended to duplicate the functionality (and much of +# the API) of threading.py but uses processes instead of threads. A +# subpackage 'multiprocessing.dummy' has the same API but is a simple +# wrapper for 'threading'. +# +# Try calling `multiprocessing.doc.main()` to read the html +# documentation in in a webbrowser. +# +# +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of author nor the names of any contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# + +__version__ = '0.70a1' + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Manager', 'Pipe', 'cpu_count', 'log_to_stderr', 'get_logger', + 'allow_connection_pickling', 'BufferTooShort', 'TimeoutError', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'JoinableQueue', 'Pool', 'Value', 'Array', + 'RawValue', 'RawArray' + ] + +__author__ = 'R. Oudkerk (r.m.oudkerk at gmail.com)' + +# +# Imports +# + +import os +import sys + +from multiprocessing.process import Process, current_process, active_children + +# +# Exceptions +# + +class ProcessError(Exception): + pass + +class BufferTooShort(ProcessError): + pass + +class TimeoutError(ProcessError): + pass + +class AuthenticationError(ProcessError): + pass + +# This is down here because _multiprocessing uses BufferTooShort +import _multiprocessing + +# +# Definitions not depending on native semaphores +# + +def Manager(): + ''' + Returns a manager associated with a running server process + + The managers methods such as `Lock()`, `Condition()` and `Queue()` + can be used to create shared objects. + ''' + from multiprocessing.managers import SyncManager + m = SyncManager() + m.start() + return m + +def Pipe(duplex=True): + ''' + Returns two connection object connected by a pipe + ''' + from multiprocessing.connection import Pipe + return Pipe(duplex) + +def cpu_count(): + ''' + Returns the number of CPUs in the system + ''' + if sys.platform == 'win32': + try: + num = int(os.environ['NUMBER_OF_PROCESSORS']) + except (ValueError, KeyError): + num = 0 + elif sys.platform == 'darwin': + try: + num = int(os.popen('sysctl -n hw.ncpu').read()) + except ValueError: + num = 0 + else: + try: + num = os.sysconf('SC_NPROCESSORS_ONLN') + except (ValueError, OSError, AttributeError): + num = 0 + + if num >= 1: + return num + else: + raise NotImplementedError('cannot determine number of cpus') + +def freeze_support(): + ''' + Check whether this is a fake forked process in a frozen executable. + If so then run code specified by commandline and exit. + ''' + if sys.platform == 'win32' and getattr(sys, 'frozen', False): + from multiprocessing.forking import freeze_support + freeze_support() + +def get_logger(): + ''' + Return package logger -- if it does not already exist then it is created + ''' + from multiprocessing.util import get_logger + return get_logger() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + from multiprocessing.util import log_to_stderr + return log_to_stderr(level) + +def allow_connection_pickling(): + ''' + Install support for sending connections and sockets between processes + ''' + from multiprocessing import reduction + +# +# Definitions depending on native semaphores +# + +def Lock(): + ''' + Returns a non-recursive lock object + ''' + from multiprocessing.synchronize import Lock + return Lock() + +def RLock(): + ''' + Returns a recursive lock object + ''' + from multiprocessing.synchronize import RLock + return RLock() + +def Condition(lock=None): + ''' + Returns a condition object + ''' + from multiprocessing.synchronize import Condition + return Condition(lock) + +def Semaphore(value=1): + ''' + Returns a semaphore object + ''' + from multiprocessing.synchronize import Semaphore + return Semaphore(value) + +def BoundedSemaphore(value=1): + ''' + Returns a bounded semaphore object + ''' + from multiprocessing.synchronize import BoundedSemaphore + return BoundedSemaphore(value) + +def Event(): + ''' + Returns an event object + ''' + from multiprocessing.synchronize import Event + return Event() + +def Queue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import Queue + return Queue(maxsize) + +def JoinableQueue(maxsize=0): + ''' + Returns a queue object + ''' + from multiprocessing.queues import JoinableQueue + return JoinableQueue(maxsize) + +def Pool(processes=None, initializer=None, initargs=()): + ''' + Returns a process pool object + ''' + from multiprocessing.pool import Pool + return Pool(processes, initializer, initargs) + +def RawValue(typecode_or_type, *args): + ''' + Returns a shared object + ''' + from multiprocessing.sharedctypes import RawValue + return RawValue(typecode_or_type, *args) + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a shared array + ''' + from multiprocessing.sharedctypes import RawArray + return RawArray(typecode_or_type, size_or_initializer) + +def Value(typecode_or_type, *args, **kwds): + ''' + Returns a synchronized shared object + ''' + from multiprocessing.sharedctypes import Value + return Value(typecode_or_type, *args, **kwds) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Returns a synchronized shared array + ''' + from multiprocessing.sharedctypes import Array + return Array(typecode_or_type, size_or_initializer, **kwds) + +# +# +# + +if sys.platform == 'win32': + + def set_executable(executable): + ''' + Sets the path to a python.exe or pythonw.exe binary used to run + child processes on Windows instead of sys.executable. + Useful for people embedding Python. + ''' + from multiprocessing.forking import set_executable + set_executable(executable) + + __all__ += ['set_executable'] Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/connection.py Sun Jun 15 03:02:00 2008 @@ -1,425 +1,425 @@ -# -# A higher level module for using sockets (or Windows named pipes) -# -# multiprocessing/connection.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'Client', 'Listener', 'Pipe' ] - -import os -import sys -import socket -import time -import tempfile -import itertools - -import _multiprocessing -from multiprocessing import current_process -from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug -from multiprocessing.forking import duplicate, close - - -# -# -# - -BUFSIZE = 8192 - -_mmap_counter = itertools.count() - -default_family = 'AF_INET' -families = ['AF_INET'] - -if hasattr(socket, 'AF_UNIX'): - default_family = 'AF_UNIX' - families += ['AF_UNIX'] - -if sys.platform == 'win32': - default_family = 'AF_PIPE' - families += ['AF_PIPE'] - -# -# -# - -def arbitrary_address(family): - ''' - Return an arbitrary free address for the given family - ''' - if family == 'AF_INET': - return ('localhost', 0) - elif family == 'AF_UNIX': - return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) - elif family == 'AF_PIPE': - return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % - (os.getpid(), _mmap_counter.next())) - else: - raise ValueError('unrecognized family') - - -def address_type(address): - ''' - Return the types of the address - - This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' - ''' - if type(address) == tuple: - return 'AF_INET' - elif type(address) is str and address.startswith('\\\\'): - return 'AF_PIPE' - elif type(address) is str: - return 'AF_UNIX' - else: - raise ValueError('address type of %r unrecognized' % address) - -# -# Public functions -# - -class Listener(object): - ''' - Returns a listener object. - - This is a wrapper for a bound socket which is 'listening' for - connections, or for a Windows named pipe. - ''' - def __init__(self, address=None, family=None, backlog=1, authkey=None): - family = family or (address and address_type(address)) \ - or default_family - address = address or arbitrary_address(family) - - if family == 'AF_PIPE': - self._listener = PipeListener(address, backlog) - else: - self._listener = SocketListener(address, family, backlog) - - if authkey is not None and not isinstance(authkey, bytes): - raise TypeError, 'authkey should be a byte string' - - self._authkey = authkey - - def accept(self): - ''' - Accept a connection on the bound socket or named pipe of `self`. - - Returns a `Connection` object. - ''' - c = self._listener.accept() - if self._authkey: - deliver_challenge(c, self._authkey) - answer_challenge(c, self._authkey) - return c - - def close(self): - ''' - Close the bound socket or named pipe of `self`. - ''' - return self._listener.close() - - address = property(lambda self: self._listener._address) - last_accepted = property(lambda self: self._listener._last_accepted) - - -def Client(address, family=None, authkey=None): - ''' - Returns a connection to the address of a `Listener` - ''' - family = family or address_type(address) - if family == 'AF_PIPE': - c = PipeClient(address) - else: - c = SocketClient(address) - - if authkey is not None and not isinstance(authkey, bytes): - raise TypeError, 'authkey should be a byte string' - - if authkey is not None: - answer_challenge(c, authkey) - deliver_challenge(c, authkey) - - return c - - -if sys.platform != 'win32': - - def Pipe(duplex=True): - ''' - Returns pair of connection objects at either end of a pipe - ''' - if duplex: - s1, s2 = socket.socketpair() - c1 = _multiprocessing.Connection(os.dup(s1.fileno())) - c2 = _multiprocessing.Connection(os.dup(s2.fileno())) - s1.close() - s2.close() - else: - fd1, fd2 = os.pipe() - c1 = _multiprocessing.Connection(fd1, writable=False) - c2 = _multiprocessing.Connection(fd2, readable=False) - - return c1, c2 - -else: - - from ._multiprocessing import win32 - - def Pipe(duplex=True): - ''' - Returns pair of connection objects at either end of a pipe - ''' - address = arbitrary_address('AF_PIPE') - if duplex: - openmode = win32.PIPE_ACCESS_DUPLEX - access = win32.GENERIC_READ | win32.GENERIC_WRITE - obsize, ibsize = BUFSIZE, BUFSIZE - else: - openmode = win32.PIPE_ACCESS_INBOUND - access = win32.GENERIC_WRITE - obsize, ibsize = 0, BUFSIZE - - h1 = win32.CreateNamedPipe( - address, openmode, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - 1, obsize, ibsize, win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - h2 = win32.CreateFile( - address, access, 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL - ) - win32.SetNamedPipeHandleState( - h2, win32.PIPE_READMODE_MESSAGE, None, None - ) - - try: - win32.ConnectNamedPipe(h1, win32.NULL) - except WindowsError, e: - if e.args[0] != win32.ERROR_PIPE_CONNECTED: - raise - - c1 = _multiprocessing.PipeConnection(h1, writable=duplex) - c2 = _multiprocessing.PipeConnection(h2, readable=duplex) - - return c1, c2 - -# -# Definitions for connections based on sockets -# - -class SocketListener(object): - ''' - Represtation of a socket which is bound to an address and listening - ''' - def __init__(self, address, family, backlog=1): - self._socket = socket.socket(getattr(socket, family)) - self._socket.bind(address) - self._socket.listen(backlog) - address = self._socket.getsockname() - if type(address) is tuple: - address = (socket.getfqdn(address[0]),) + address[1:] - self._address = address - self._family = family - self._last_accepted = None - - sub_debug('listener bound to address %r', self._address) - - if family == 'AF_UNIX': - self._unlink = Finalize( - self, os.unlink, args=(self._address,), exitpriority=0 - ) - else: - self._unlink = None - - def accept(self): - s, self._last_accepted = self._socket.accept() - fd = duplicate(s.fileno()) - conn = _multiprocessing.Connection(fd) - s.close() - return conn - - def close(self): - self._socket.close() - if self._unlink is not None: - self._unlink() - - -def SocketClient(address): - ''' - Return a connection object connected to the socket given by `address` - ''' - family = address_type(address) - s = socket.socket( getattr(socket, family) ) - - while 1: - try: - s.connect(address) - except socket.error, e: - if e.args[0] != 10061: # 10061 => connection refused - debug('failed to connect to address %s', address) - raise - time.sleep(0.01) - else: - break - else: - raise - - fd = duplicate(s.fileno()) - conn = _multiprocessing.Connection(fd) - s.close() - return conn - -# -# Definitions for connections based on named pipes -# - -if sys.platform == 'win32': - - class PipeListener(object): - ''' - Representation of a named pipe - ''' - def __init__(self, address, backlog=None): - self._address = address - handle = win32.CreateNamedPipe( - address, win32.PIPE_ACCESS_DUPLEX, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, - win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - self._handle_queue = [handle] - self._last_accepted = None - - sub_debug('listener created with address=%r', self._address) - - self.close = Finalize( - self, PipeListener._finalize_pipe_listener, - args=(self._handle_queue, self._address), exitpriority=0 - ) - - def accept(self): - newhandle = win32.CreateNamedPipe( - self._address, win32.PIPE_ACCESS_DUPLEX, - win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | - win32.PIPE_WAIT, - win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, - win32.NMPWAIT_WAIT_FOREVER, win32.NULL - ) - self._handle_queue.append(newhandle) - handle = self._handle_queue.pop(0) - try: - win32.ConnectNamedPipe(handle, win32.NULL) - except WindowsError, e: - if e.args[0] != win32.ERROR_PIPE_CONNECTED: - raise - return _multiprocessing.PipeConnection(handle) - - @staticmethod - def _finalize_pipe_listener(queue, address): - sub_debug('closing listener with address=%r', address) - for handle in queue: - close(handle) - - def PipeClient(address): - ''' - Return a connection object connected to the pipe given by `address` - ''' - while 1: - try: - win32.WaitNamedPipe(address, 1000) - h = win32.CreateFile( - address, win32.GENERIC_READ | win32.GENERIC_WRITE, - 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL - ) - except WindowsError, e: - if e.args[0] not in (win32.ERROR_SEM_TIMEOUT, - win32.ERROR_PIPE_BUSY): - raise - else: - break - else: - raise - - win32.SetNamedPipeHandleState( - h, win32.PIPE_READMODE_MESSAGE, None, None - ) - return _multiprocessing.PipeConnection(h) - -# -# Authentication stuff -# - -MESSAGE_LENGTH = 20 - -CHALLENGE = '#CHALLENGE#' -WELCOME = '#WELCOME#' -FAILURE = '#FAILURE#' - -if sys.version_info >= (3, 0): # XXX can use bytes literals in 2.6/3.0 - CHALLENGE = CHALLENGE.encode('ascii') - WELCOME = WELCOME.encode('ascii') - FAILURE = FAILURE.encode('ascii') - -def deliver_challenge(connection, authkey): - import hmac - assert isinstance(authkey, bytes) - message = os.urandom(MESSAGE_LENGTH) - connection.send_bytes(CHALLENGE + message) - digest = hmac.new(authkey, message).digest() - response = connection.recv_bytes(256) # reject large message - if response == digest: - connection.send_bytes(WELCOME) - else: - connection.send_bytes(FAILURE) - raise AuthenticationError('digest received was wrong') - -def answer_challenge(connection, authkey): - import hmac - assert isinstance(authkey, bytes) - message = connection.recv_bytes(256) # reject large message - assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message - message = message[len(CHALLENGE):] - digest = hmac.new(authkey, message).digest() - connection.send_bytes(digest) - response = connection.recv_bytes(256) # reject large message - if response != WELCOME: - raise AuthenticationError('digest sent was rejected') - -# -# Support for using xmlrpclib for serialization -# - -class ConnectionWrapper(object): - def __init__(self, conn, dumps, loads): - self._conn = conn - self._dumps = dumps - self._loads = loads - for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): - obj = getattr(conn, attr) - setattr(self, attr, obj) - def send(self, obj): - s = self._dumps(obj) - self._conn.send_bytes(s) - def recv(self): - s = self._conn.recv_bytes() - return self._loads(s) - -def _xml_dumps(obj): - return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') - -def _xml_loads(s): - (obj,), method = xmlrpclib.loads(s.decode('utf8')) - return obj - -class XmlListener(Listener): - def accept(self): - global xmlrpclib - import xmlrpclib - obj = Listener.accept(self) - return ConnectionWrapper(obj, _xml_dumps, _xml_loads) - -def XmlClient(*args, **kwds): - global xmlrpclib - import xmlrpclib - return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) +# +# A higher level module for using sockets (or Windows named pipes) +# +# multiprocessing/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +import os +import sys +import socket +import time +import tempfile +import itertools + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.util import get_temp_dir, Finalize, sub_debug, debug +from multiprocessing.forking import duplicate, close + + +# +# +# + +BUFSIZE = 8192 + +_mmap_counter = itertools.count() + +default_family = 'AF_INET' +families = ['AF_INET'] + +if hasattr(socket, 'AF_UNIX'): + default_family = 'AF_UNIX' + families += ['AF_UNIX'] + +if sys.platform == 'win32': + default_family = 'AF_PIPE' + families += ['AF_PIPE'] + +# +# +# + +def arbitrary_address(family): + ''' + Return an arbitrary free address for the given family + ''' + if family == 'AF_INET': + return ('localhost', 0) + elif family == 'AF_UNIX': + return tempfile.mktemp(prefix='listener-', dir=get_temp_dir()) + elif family == 'AF_PIPE': + return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' % + (os.getpid(), _mmap_counter.next())) + else: + raise ValueError('unrecognized family') + + +def address_type(address): + ''' + Return the types of the address + + This can be 'AF_INET', 'AF_UNIX', or 'AF_PIPE' + ''' + if type(address) == tuple: + return 'AF_INET' + elif type(address) is str and address.startswith('\\\\'): + return 'AF_PIPE' + elif type(address) is str: + return 'AF_UNIX' + else: + raise ValueError('address type of %r unrecognized' % address) + +# +# Public functions +# + +class Listener(object): + ''' + Returns a listener object. + + This is a wrapper for a bound socket which is 'listening' for + connections, or for a Windows named pipe. + ''' + def __init__(self, address=None, family=None, backlog=1, authkey=None): + family = family or (address and address_type(address)) \ + or default_family + address = address or arbitrary_address(family) + + if family == 'AF_PIPE': + self._listener = PipeListener(address, backlog) + else: + self._listener = SocketListener(address, family, backlog) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + self._authkey = authkey + + def accept(self): + ''' + Accept a connection on the bound socket or named pipe of `self`. + + Returns a `Connection` object. + ''' + c = self._listener.accept() + if self._authkey: + deliver_challenge(c, self._authkey) + answer_challenge(c, self._authkey) + return c + + def close(self): + ''' + Close the bound socket or named pipe of `self`. + ''' + return self._listener.close() + + address = property(lambda self: self._listener._address) + last_accepted = property(lambda self: self._listener._last_accepted) + + +def Client(address, family=None, authkey=None): + ''' + Returns a connection to the address of a `Listener` + ''' + family = family or address_type(address) + if family == 'AF_PIPE': + c = PipeClient(address) + else: + c = SocketClient(address) + + if authkey is not None and not isinstance(authkey, bytes): + raise TypeError, 'authkey should be a byte string' + + if authkey is not None: + answer_challenge(c, authkey) + deliver_challenge(c, authkey) + + return c + + +if sys.platform != 'win32': + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + if duplex: + s1, s2 = socket.socketpair() + c1 = _multiprocessing.Connection(os.dup(s1.fileno())) + c2 = _multiprocessing.Connection(os.dup(s2.fileno())) + s1.close() + s2.close() + else: + fd1, fd2 = os.pipe() + c1 = _multiprocessing.Connection(fd1, writable=False) + c2 = _multiprocessing.Connection(fd2, readable=False) + + return c1, c2 + +else: + + from ._multiprocessing import win32 + + def Pipe(duplex=True): + ''' + Returns pair of connection objects at either end of a pipe + ''' + address = arbitrary_address('AF_PIPE') + if duplex: + openmode = win32.PIPE_ACCESS_DUPLEX + access = win32.GENERIC_READ | win32.GENERIC_WRITE + obsize, ibsize = BUFSIZE, BUFSIZE + else: + openmode = win32.PIPE_ACCESS_INBOUND + access = win32.GENERIC_WRITE + obsize, ibsize = 0, BUFSIZE + + h1 = win32.CreateNamedPipe( + address, openmode, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + 1, obsize, ibsize, win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + h2 = win32.CreateFile( + address, access, 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + win32.SetNamedPipeHandleState( + h2, win32.PIPE_READMODE_MESSAGE, None, None + ) + + try: + win32.ConnectNamedPipe(h1, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + + c1 = _multiprocessing.PipeConnection(h1, writable=duplex) + c2 = _multiprocessing.PipeConnection(h2, readable=duplex) + + return c1, c2 + +# +# Definitions for connections based on sockets +# + +class SocketListener(object): + ''' + Represtation of a socket which is bound to an address and listening + ''' + def __init__(self, address, family, backlog=1): + self._socket = socket.socket(getattr(socket, family)) + self._socket.bind(address) + self._socket.listen(backlog) + address = self._socket.getsockname() + if type(address) is tuple: + address = (socket.getfqdn(address[0]),) + address[1:] + self._address = address + self._family = family + self._last_accepted = None + + sub_debug('listener bound to address %r', self._address) + + if family == 'AF_UNIX': + self._unlink = Finalize( + self, os.unlink, args=(self._address,), exitpriority=0 + ) + else: + self._unlink = None + + def accept(self): + s, self._last_accepted = self._socket.accept() + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + + def close(self): + self._socket.close() + if self._unlink is not None: + self._unlink() + + +def SocketClient(address): + ''' + Return a connection object connected to the socket given by `address` + ''' + family = address_type(address) + s = socket.socket( getattr(socket, family) ) + + while 1: + try: + s.connect(address) + except socket.error, e: + if e.args[0] != 10061: # 10061 => connection refused + debug('failed to connect to address %s', address) + raise + time.sleep(0.01) + else: + break + else: + raise + + fd = duplicate(s.fileno()) + conn = _multiprocessing.Connection(fd) + s.close() + return conn + +# +# Definitions for connections based on named pipes +# + +if sys.platform == 'win32': + + class PipeListener(object): + ''' + Representation of a named pipe + ''' + def __init__(self, address, backlog=None): + self._address = address + handle = win32.CreateNamedPipe( + address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue = [handle] + self._last_accepted = None + + sub_debug('listener created with address=%r', self._address) + + self.close = Finalize( + self, PipeListener._finalize_pipe_listener, + args=(self._handle_queue, self._address), exitpriority=0 + ) + + def accept(self): + newhandle = win32.CreateNamedPipe( + self._address, win32.PIPE_ACCESS_DUPLEX, + win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | + win32.PIPE_WAIT, + win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, + win32.NMPWAIT_WAIT_FOREVER, win32.NULL + ) + self._handle_queue.append(newhandle) + handle = self._handle_queue.pop(0) + try: + win32.ConnectNamedPipe(handle, win32.NULL) + except WindowsError, e: + if e.args[0] != win32.ERROR_PIPE_CONNECTED: + raise + return _multiprocessing.PipeConnection(handle) + + @staticmethod + def _finalize_pipe_listener(queue, address): + sub_debug('closing listener with address=%r', address) + for handle in queue: + close(handle) + + def PipeClient(address): + ''' + Return a connection object connected to the pipe given by `address` + ''' + while 1: + try: + win32.WaitNamedPipe(address, 1000) + h = win32.CreateFile( + address, win32.GENERIC_READ | win32.GENERIC_WRITE, + 0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL + ) + except WindowsError, e: + if e.args[0] not in (win32.ERROR_SEM_TIMEOUT, + win32.ERROR_PIPE_BUSY): + raise + else: + break + else: + raise + + win32.SetNamedPipeHandleState( + h, win32.PIPE_READMODE_MESSAGE, None, None + ) + return _multiprocessing.PipeConnection(h) + +# +# Authentication stuff +# + +MESSAGE_LENGTH = 20 + +CHALLENGE = '#CHALLENGE#' +WELCOME = '#WELCOME#' +FAILURE = '#FAILURE#' + +if sys.version_info >= (3, 0): # XXX can use bytes literals in 2.6/3.0 + CHALLENGE = CHALLENGE.encode('ascii') + WELCOME = WELCOME.encode('ascii') + FAILURE = FAILURE.encode('ascii') + +def deliver_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = os.urandom(MESSAGE_LENGTH) + connection.send_bytes(CHALLENGE + message) + digest = hmac.new(authkey, message).digest() + response = connection.recv_bytes(256) # reject large message + if response == digest: + connection.send_bytes(WELCOME) + else: + connection.send_bytes(FAILURE) + raise AuthenticationError('digest received was wrong') + +def answer_challenge(connection, authkey): + import hmac + assert isinstance(authkey, bytes) + message = connection.recv_bytes(256) # reject large message + assert message[:len(CHALLENGE)] == CHALLENGE, 'message = %r' % message + message = message[len(CHALLENGE):] + digest = hmac.new(authkey, message).digest() + connection.send_bytes(digest) + response = connection.recv_bytes(256) # reject large message + if response != WELCOME: + raise AuthenticationError('digest sent was rejected') + +# +# Support for using xmlrpclib for serialization +# + +class ConnectionWrapper(object): + def __init__(self, conn, dumps, loads): + self._conn = conn + self._dumps = dumps + self._loads = loads + for attr in ('fileno', 'close', 'poll', 'recv_bytes', 'send_bytes'): + obj = getattr(conn, attr) + setattr(self, attr, obj) + def send(self, obj): + s = self._dumps(obj) + self._conn.send_bytes(s) + def recv(self): + s = self._conn.recv_bytes() + return self._loads(s) + +def _xml_dumps(obj): + return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') + +def _xml_loads(s): + (obj,), method = xmlrpclib.loads(s.decode('utf8')) + return obj + +class XmlListener(Listener): + def accept(self): + global xmlrpclib + import xmlrpclib + obj = Listener.accept(self) + return ConnectionWrapper(obj, _xml_dumps, _xml_loads) + +def XmlClient(*args, **kwds): + global xmlrpclib + import xmlrpclib + return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/__init__.py Sun Jun 15 03:02:00 2008 @@ -1,143 +1,143 @@ -# -# Support for the API of the multiprocessing package using threads -# -# multiprocessing/dummy/__init__.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ - 'Process', 'current_process', 'active_children', 'freeze_support', - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', - 'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' - ] - -# -# Imports -# - -import threading -import sys -import weakref -import array -import itertools - -from multiprocessing import TimeoutError, cpu_count -from multiprocessing.dummy.connection import Pipe -from threading import Lock, RLock, Semaphore, BoundedSemaphore -from threading import Event -from Queue import Queue - -# -# -# - -class DummyProcess(threading.Thread): - - def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): - threading.Thread.__init__(self, group, target, name, args, kwargs) - self._pid = None - self._children = weakref.WeakKeyDictionary() - self._start_called = False - self._parent = current_process() - - def start(self): - assert self._parent is current_process() - self._start_called = True - self._parent._children[self] = None - threading.Thread.start(self) - - def get_exitcode(self): - if self._start_called and not self.is_alive(): - return 0 - else: - return None - - # XXX - if sys.version_info < (3, 0): - is_alive = threading.Thread.is_alive.im_func - get_name = threading.Thread.get_name.im_func - set_name = threading.Thread.set_name.im_func - is_daemon = threading.Thread.is_daemon.im_func - set_daemon = threading.Thread.set_daemon.im_func - else: - is_alive = threading.Thread.is_alive - get_name = threading.Thread.get_name - set_name = threading.Thread.set_name - is_daemon = threading.Thread.is_daemon - set_daemon = threading.Thread.set_daemon - -# -# -# - -class Condition(threading._Condition): - # XXX - if sys.version_info < (3, 0): - notify_all = threading._Condition.notify_all.im_func - else: - notify_all = threading._Condition.notify_all - -# -# -# - -Process = DummyProcess -current_process = threading.current_thread -current_process()._children = weakref.WeakKeyDictionary() - -def active_children(): - children = current_process()._children - for p in list(children): - if not p.is_alive(): - children.pop(p, None) - return list(children) - -def freeze_support(): - pass - -# -# -# - -class Namespace(object): - def __init__(self, **kwds): - self.__dict__.update(kwds) - def __repr__(self): - items = self.__dict__.items() - temp = [] - for name, value in items: - if not name.startswith('_'): - temp.append('%s=%r' % (name, value)) - temp.sort() - return 'Namespace(%s)' % str.join(', ', temp) - -dict = dict -list = list - -def Array(typecode, sequence, lock=True): - return array.array(typecode, sequence) - -class Value(object): - def __init__(self, typecode, value, lock=True): - self._typecode = typecode - self._value = value - def _get(self): - return self._value - def _set(self, value): - self._value = value - value = property(_get, _set) - def __repr__(self): - return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value) - -def Manager(): - return sys.modules[__name__] - -def shutdown(): - pass - -def Pool(processes=None, initializer=None, initargs=()): - from multiprocessing.pool import ThreadPool - return ThreadPool(processes, initializer, initargs) - -JoinableQueue = Queue +# +# Support for the API of the multiprocessing package using threads +# +# multiprocessing/dummy/__init__.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Process', 'current_process', 'active_children', 'freeze_support', + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', + 'Event', 'Queue', 'Manager', 'Pipe', 'Pool', 'JoinableQueue' + ] + +# +# Imports +# + +import threading +import sys +import weakref +import array +import itertools + +from multiprocessing import TimeoutError, cpu_count +from multiprocessing.dummy.connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event +from Queue import Queue + +# +# +# + +class DummyProcess(threading.Thread): + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + threading.Thread.__init__(self, group, target, name, args, kwargs) + self._pid = None + self._children = weakref.WeakKeyDictionary() + self._start_called = False + self._parent = current_process() + + def start(self): + assert self._parent is current_process() + self._start_called = True + self._parent._children[self] = None + threading.Thread.start(self) + + def get_exitcode(self): + if self._start_called and not self.is_alive(): + return 0 + else: + return None + + # XXX + if sys.version_info < (3, 0): + is_alive = threading.Thread.is_alive.im_func + get_name = threading.Thread.get_name.im_func + set_name = threading.Thread.set_name.im_func + is_daemon = threading.Thread.is_daemon.im_func + set_daemon = threading.Thread.set_daemon.im_func + else: + is_alive = threading.Thread.is_alive + get_name = threading.Thread.get_name + set_name = threading.Thread.set_name + is_daemon = threading.Thread.is_daemon + set_daemon = threading.Thread.set_daemon + +# +# +# + +class Condition(threading._Condition): + # XXX + if sys.version_info < (3, 0): + notify_all = threading._Condition.notify_all.im_func + else: + notify_all = threading._Condition.notify_all + +# +# +# + +Process = DummyProcess +current_process = threading.current_thread +current_process()._children = weakref.WeakKeyDictionary() + +def active_children(): + children = current_process()._children + for p in list(children): + if not p.is_alive(): + children.pop(p, None) + return list(children) + +def freeze_support(): + pass + +# +# +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +dict = dict +list = list + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def _get(self): + return self._value + def _set(self, value): + self._value = value + value = property(_get, _set) + def __repr__(self): + return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value) + +def Manager(): + return sys.modules[__name__] + +def shutdown(): + pass + +def Pool(processes=None, initializer=None, initargs=()): + from multiprocessing.pool import ThreadPool + return ThreadPool(processes, initializer, initargs) + +JoinableQueue = Queue Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/connection.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/connection.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/connection.py Sun Jun 15 03:02:00 2008 @@ -1,61 +1,61 @@ -# -# Analogue of `multiprocessing.connection` which uses queues instead of sockets -# -# multiprocessing/dummy/connection.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'Client', 'Listener', 'Pipe' ] - -from Queue import Queue - - -families = [None] - - -class Listener(object): - - def __init__(self, address=None, family=None, backlog=1): - self._backlog_queue = Queue(backlog) - - def accept(self): - return Connection(*self._backlog_queue.get()) - - def close(self): - self._backlog_queue = None - - address = property(lambda self: self._backlog_queue) - - -def Client(address): - _in, _out = Queue(), Queue() - address.put((_out, _in)) - return Connection(_in, _out) - - -def Pipe(duplex=True): - a, b = Queue(), Queue() - return Connection(a, b), Connection(b, a) - - -class Connection(object): - - def __init__(self, _in, _out): - self._out = _out - self._in = _in - self.send = self.send_bytes = _out.put - self.recv = self.recv_bytes = _in.get - - def poll(self, timeout=0.0): - if self._in.qsize() > 0: - return True - if timeout <= 0.0: - return False - self._in.not_empty.acquire() - self._in.not_empty.wait(timeout) - self._in.not_empty.release() - return self._in.qsize() > 0 - - def close(self): - pass +# +# Analogue of `multiprocessing.connection` which uses queues instead of sockets +# +# multiprocessing/dummy/connection.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'Client', 'Listener', 'Pipe' ] + +from Queue import Queue + + +families = [None] + + +class Listener(object): + + def __init__(self, address=None, family=None, backlog=1): + self._backlog_queue = Queue(backlog) + + def accept(self): + return Connection(*self._backlog_queue.get()) + + def close(self): + self._backlog_queue = None + + address = property(lambda self: self._backlog_queue) + + +def Client(address): + _in, _out = Queue(), Queue() + address.put((_out, _in)) + return Connection(_in, _out) + + +def Pipe(duplex=True): + a, b = Queue(), Queue() + return Connection(a, b), Connection(b, a) + + +class Connection(object): + + def __init__(self, _in, _out): + self._out = _out + self._in = _in + self.send = self.send_bytes = _out.put + self.recv = self.recv_bytes = _in.get + + def poll(self, timeout=0.0): + if self._in.qsize() > 0: + return True + if timeout <= 0.0: + return False + self._in.not_empty.acquire() + self._in.not_empty.wait(timeout) + self._in.not_empty.release() + return self._in.qsize() > 0 + + def close(self): + pass Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/forking.py Sun Jun 15 03:02:00 2008 @@ -1,429 +1,429 @@ -# -# Module for starting a process object using os.fork() or CreateProcess() -# -# multiprocessing/forking.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -import os -import sys -import signal - -from multiprocessing import util, process - -__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close'] - -# -# Check that the current thread is spawning a child process -# - -def assert_spawning(self): - if not Popen.thread_is_spawning(): - raise RuntimeError( - '%s objects should only be shared between processes' - ' through inheritance' % type(self).__name__ - ) - -# -# Unix -# - -if sys.platform != 'win32': - import time - - exit = os._exit - duplicate = os.dup - close = os.close - - # - # We define a Popen class similar to the one from subprocess, but - # whose constructor takes a process object as its argument. - # - - class Popen(object): - - def __init__(self, process_obj): - sys.stdout.flush() - sys.stderr.flush() - self.returncode = None - - self.pid = os.fork() - if self.pid == 0: - if 'random' in sys.modules: - import random - random.seed() - code = process_obj._bootstrap() - sys.stdout.flush() - sys.stderr.flush() - os._exit(code) - - def poll(self, flag=os.WNOHANG): - if self.returncode is None: - pid, sts = os.waitpid(self.pid, flag) - if pid == self.pid: - if os.WIFSIGNALED(sts): - self.returncode = -os.WTERMSIG(sts) - else: - assert os.WIFEXITED(sts) - self.returncode = os.WEXITSTATUS(sts) - return self.returncode - - def wait(self, timeout=None): - if timeout is None: - return self.poll(0) - deadline = time.time() + timeout - delay = 0.0005 - while 1: - res = self.poll() - if res is not None: - break - remaining = deadline - time.time() - if remaining <= 0: - break - delay = min(delay * 2, remaining, 0.05) - time.sleep(delay) - return res - - def terminate(self): - if self.returncode is None: - try: - os.kill(self.pid, signal.SIGTERM) - except OSError, e: - if self.wait(timeout=0.1) is None: - raise - - @staticmethod - def thread_is_spawning(): - return False - -# -# Windows -# - -else: - import thread - import msvcrt - import _subprocess - import copy_reg - import time - - from ._multiprocessing import win32, Connection, PipeConnection - from .util import Finalize - - try: - from cPickle import dump, load, HIGHEST_PROTOCOL - except ImportError: - from pickle import dump, load, HIGHEST_PROTOCOL - - # - # - # - - TERMINATE = 0x10000 - WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) - - exit = win32.ExitProcess - close = win32.CloseHandle - - # - # _python_exe is the assumed path to the python executable. - # People embedding Python want to modify it. - # - - if sys.executable.lower().endswith('pythonservice.exe'): - _python_exe = os.path.join(sys.exec_prefix, 'python.exe') - else: - _python_exe = sys.executable - - def set_executable(exe): - global _python_exe - _python_exe = exe - - # - # - # - - def duplicate(handle, target_process=None, inheritable=False): - if target_process is None: - target_process = _subprocess.GetCurrentProcess() - return _subprocess.DuplicateHandle( - _subprocess.GetCurrentProcess(), handle, target_process, - 0, inheritable, _subprocess.DUPLICATE_SAME_ACCESS - ).Detach() - - # - # We define a Popen class similar to the one from subprocess, but - # whose constructor takes a process object as its argument. - # - - class Popen(object): - ''' - Start a subprocess to run the code of a process object - ''' - _tls = thread._local() - - def __init__(self, process_obj): - # create pipe for communication with child - rfd, wfd = os.pipe() - - # get handle for read end of the pipe and make it inheritable - rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True) - os.close(rfd) - - # start process - cmd = get_command_line() + [rhandle] - cmd = ' '.join('"%s"' % x for x in cmd) - hp, ht, pid, tid = _subprocess.CreateProcess( - _python_exe, cmd, None, None, 1, 0, None, None, None - ) - ht.Close() - close(rhandle) - - # set attributes of self - self.pid = pid - self.returncode = None - self._handle = hp - - # send information to child - prep_data = get_preparation_data(process_obj._name) - to_child = os.fdopen(wfd, 'wb') - Popen._tls.process_handle = int(hp) - try: - dump(prep_data, to_child, HIGHEST_PROTOCOL) - dump(process_obj, to_child, HIGHEST_PROTOCOL) - finally: - del Popen._tls.process_handle - to_child.close() - - @staticmethod - def thread_is_spawning(): - return getattr(Popen._tls, 'process_handle', None) is not None - - @staticmethod - def duplicate_for_child(handle): - return duplicate(handle, Popen._tls.process_handle) - - def wait(self, timeout=None): - if self.returncode is None: - if timeout is None: - msecs = _subprocess.INFINITE - else: - msecs = max(0, int(timeout * 1000 + 0.5)) - - res = _subprocess.WaitForSingleObject(int(self._handle), msecs) - if res == _subprocess.WAIT_OBJECT_0: - code = _subprocess.GetExitCodeProcess(self._handle) - if code == TERMINATE: - code = -signal.SIGTERM - self.returncode = code - - return self.returncode - - def poll(self): - return self.wait(timeout=0) - - def terminate(self): - if self.returncode is None: - try: - _subprocess.TerminateProcess(int(self._handle), TERMINATE) - except WindowsError: - if self.wait(timeout=0.1) is None: - raise - - # - # - # - - def is_forking(argv): - ''' - Return whether commandline indicates we are forking - ''' - if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': - assert len(argv) == 3 - return True - else: - return False - - - def freeze_support(): - ''' - Run code for process object if this in not the main process - ''' - if is_forking(sys.argv): - main() - sys.exit() - - - def get_command_line(): - ''' - Returns prefix of command line used for spawning a child process - ''' - if process.current_process()._identity==() and is_forking(sys.argv): - raise RuntimeError(''' - Attempt to start a new process before the current process - has finished its bootstrapping phase. - - This probably means that you are on Windows and you have - forgotten to use the proper idiom in the main module: - - if __name__ == '__main__': - freeze_support() - ... - - The "freeze_support()" line can be omitted if the program - is not going to be frozen to produce a Windows executable.''') - - if getattr(sys, 'frozen', False): - return [sys.executable, '--multiprocessing-fork'] - else: - prog = 'from multiprocessing.forking import main; main()' - return [_python_exe, '-c', prog, '--multiprocessing-fork'] - - - def main(): - ''' - Run code specifed by data received over pipe - ''' - assert is_forking(sys.argv) - - handle = int(sys.argv[-1]) - fd = msvcrt.open_osfhandle(handle, os.O_RDONLY) - from_parent = os.fdopen(fd, 'rb') - - process.current_process()._inheriting = True - preparation_data = load(from_parent) - prepare(preparation_data) - self = load(from_parent) - process.current_process()._inheriting = False - - from_parent.close() - - exitcode = self._bootstrap() - exit(exitcode) - - - def get_preparation_data(name): - ''' - Return info about parent needed by child to unpickle process object - ''' - from .util import _logger, _log_to_stderr - - d = dict( - name=name, - sys_path=sys.path, - sys_argv=sys.argv, - log_to_stderr=_log_to_stderr, - orig_dir=process.ORIGINAL_DIR, - authkey=process.current_process().get_authkey(), - ) - - if _logger is not None: - d['log_level'] = _logger.getEffectiveLevel() - - if not WINEXE: - main_path = getattr(sys.modules['__main__'], '__file__', None) - if not main_path and sys.argv[0] not in ('', '-c'): - main_path = sys.argv[0] - if main_path is not None: - if not os.path.isabs(main_path) and \ - process.ORIGINAL_DIR is not None: - main_path = os.path.join(process.ORIGINAL_DIR, main_path) - d['main_path'] = os.path.normpath(main_path) - - return d - - # - # Make (Pipe)Connection picklable - # - - def reduce_connection(conn): - if not Popen.thread_is_spawning(): - raise RuntimeError( - 'By default %s objects can only be shared between processes\n' - 'using inheritance' % type(conn).__name__ - ) - return type(conn), (Popen.duplicate_for_child(conn.fileno()), - conn.readable, conn.writable) - - copy_reg.pickle(Connection, reduce_connection) - copy_reg.pickle(PipeConnection, reduce_connection) - - -# -# Prepare current process -# - -old_main_modules = [] - -def prepare(data): - ''' - Try to get current process ready to unpickle process object - ''' - old_main_modules.append(sys.modules['__main__']) - - if 'name' in data: - process.current_process().set_name(data['name']) - - if 'authkey' in data: - process.current_process()._authkey = data['authkey'] - - if 'log_to_stderr' in data and data['log_to_stderr']: - util.log_to_stderr() - - if 'log_level' in data: - util.get_logger().setLevel(data['log_level']) - - if 'sys_path' in data: - sys.path = data['sys_path'] - - if 'sys_argv' in data: - sys.argv = data['sys_argv'] - - if 'dir' in data: - os.chdir(data['dir']) - - if 'orig_dir' in data: - process.ORIGINAL_DIR = data['orig_dir'] - - if 'main_path' in data: - main_path = data['main_path'] - main_name = os.path.splitext(os.path.basename(main_path))[0] - if main_name == '__init__': - main_name = os.path.basename(os.path.dirname(main_path)) - - if main_name != 'ipython': - import imp - - if main_path is None: - dirs = None - elif os.path.basename(main_path).startswith('__init__.py'): - dirs = [os.path.dirname(os.path.dirname(main_path))] - else: - dirs = [os.path.dirname(main_path)] - - assert main_name not in sys.modules, main_name - file, path_name, etc = imp.find_module(main_name, dirs) - try: - # We would like to do "imp.load_module('__main__', ...)" - # here. However, that would cause 'if __name__ == - # "__main__"' clauses to be executed. - main_module = imp.load_module( - '__parents_main__', file, path_name, etc - ) - finally: - if file: - file.close() - - sys.modules['__main__'] = main_module - main_module.__name__ = '__main__' - - # Try to make the potentially picklable objects in - # sys.modules['__main__'] realize they are in the main - # module -- somewhat ugly. - for obj in main_module.__dict__.values(): - try: - if obj.__module__ == '__parents_main__': - obj.__module__ = '__main__' - except Exception: - pass +# +# Module for starting a process object using os.fork() or CreateProcess() +# +# multiprocessing/forking.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import os +import sys +import signal + +from multiprocessing import util, process + +__all__ = ['Popen', 'assert_spawning', 'exit', 'duplicate', 'close'] + +# +# Check that the current thread is spawning a child process +# + +def assert_spawning(self): + if not Popen.thread_is_spawning(): + raise RuntimeError( + '%s objects should only be shared between processes' + ' through inheritance' % type(self).__name__ + ) + +# +# Unix +# + +if sys.platform != 'win32': + import time + + exit = os._exit + duplicate = os.dup + close = os.close + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + + def __init__(self, process_obj): + sys.stdout.flush() + sys.stderr.flush() + self.returncode = None + + self.pid = os.fork() + if self.pid == 0: + if 'random' in sys.modules: + import random + random.seed() + code = process_obj._bootstrap() + sys.stdout.flush() + sys.stderr.flush() + os._exit(code) + + def poll(self, flag=os.WNOHANG): + if self.returncode is None: + pid, sts = os.waitpid(self.pid, flag) + if pid == self.pid: + if os.WIFSIGNALED(sts): + self.returncode = -os.WTERMSIG(sts) + else: + assert os.WIFEXITED(sts) + self.returncode = os.WEXITSTATUS(sts) + return self.returncode + + def wait(self, timeout=None): + if timeout is None: + return self.poll(0) + deadline = time.time() + timeout + delay = 0.0005 + while 1: + res = self.poll() + if res is not None: + break + remaining = deadline - time.time() + if remaining <= 0: + break + delay = min(delay * 2, remaining, 0.05) + time.sleep(delay) + return res + + def terminate(self): + if self.returncode is None: + try: + os.kill(self.pid, signal.SIGTERM) + except OSError, e: + if self.wait(timeout=0.1) is None: + raise + + @staticmethod + def thread_is_spawning(): + return False + +# +# Windows +# + +else: + import thread + import msvcrt + import _subprocess + import copy_reg + import time + + from ._multiprocessing import win32, Connection, PipeConnection + from .util import Finalize + + try: + from cPickle import dump, load, HIGHEST_PROTOCOL + except ImportError: + from pickle import dump, load, HIGHEST_PROTOCOL + + # + # + # + + TERMINATE = 0x10000 + WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False)) + + exit = win32.ExitProcess + close = win32.CloseHandle + + # + # _python_exe is the assumed path to the python executable. + # People embedding Python want to modify it. + # + + if sys.executable.lower().endswith('pythonservice.exe'): + _python_exe = os.path.join(sys.exec_prefix, 'python.exe') + else: + _python_exe = sys.executable + + def set_executable(exe): + global _python_exe + _python_exe = exe + + # + # + # + + def duplicate(handle, target_process=None, inheritable=False): + if target_process is None: + target_process = _subprocess.GetCurrentProcess() + return _subprocess.DuplicateHandle( + _subprocess.GetCurrentProcess(), handle, target_process, + 0, inheritable, _subprocess.DUPLICATE_SAME_ACCESS + ).Detach() + + # + # We define a Popen class similar to the one from subprocess, but + # whose constructor takes a process object as its argument. + # + + class Popen(object): + ''' + Start a subprocess to run the code of a process object + ''' + _tls = thread._local() + + def __init__(self, process_obj): + # create pipe for communication with child + rfd, wfd = os.pipe() + + # get handle for read end of the pipe and make it inheritable + rhandle = duplicate(msvcrt.get_osfhandle(rfd), inheritable=True) + os.close(rfd) + + # start process + cmd = get_command_line() + [rhandle] + cmd = ' '.join('"%s"' % x for x in cmd) + hp, ht, pid, tid = _subprocess.CreateProcess( + _python_exe, cmd, None, None, 1, 0, None, None, None + ) + ht.Close() + close(rhandle) + + # set attributes of self + self.pid = pid + self.returncode = None + self._handle = hp + + # send information to child + prep_data = get_preparation_data(process_obj._name) + to_child = os.fdopen(wfd, 'wb') + Popen._tls.process_handle = int(hp) + try: + dump(prep_data, to_child, HIGHEST_PROTOCOL) + dump(process_obj, to_child, HIGHEST_PROTOCOL) + finally: + del Popen._tls.process_handle + to_child.close() + + @staticmethod + def thread_is_spawning(): + return getattr(Popen._tls, 'process_handle', None) is not None + + @staticmethod + def duplicate_for_child(handle): + return duplicate(handle, Popen._tls.process_handle) + + def wait(self, timeout=None): + if self.returncode is None: + if timeout is None: + msecs = _subprocess.INFINITE + else: + msecs = max(0, int(timeout * 1000 + 0.5)) + + res = _subprocess.WaitForSingleObject(int(self._handle), msecs) + if res == _subprocess.WAIT_OBJECT_0: + code = _subprocess.GetExitCodeProcess(self._handle) + if code == TERMINATE: + code = -signal.SIGTERM + self.returncode = code + + return self.returncode + + def poll(self): + return self.wait(timeout=0) + + def terminate(self): + if self.returncode is None: + try: + _subprocess.TerminateProcess(int(self._handle), TERMINATE) + except WindowsError: + if self.wait(timeout=0.1) is None: + raise + + # + # + # + + def is_forking(argv): + ''' + Return whether commandline indicates we are forking + ''' + if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': + assert len(argv) == 3 + return True + else: + return False + + + def freeze_support(): + ''' + Run code for process object if this in not the main process + ''' + if is_forking(sys.argv): + main() + sys.exit() + + + def get_command_line(): + ''' + Returns prefix of command line used for spawning a child process + ''' + if process.current_process()._identity==() and is_forking(sys.argv): + raise RuntimeError(''' + Attempt to start a new process before the current process + has finished its bootstrapping phase. + + This probably means that you are on Windows and you have + forgotten to use the proper idiom in the main module: + + if __name__ == '__main__': + freeze_support() + ... + + The "freeze_support()" line can be omitted if the program + is not going to be frozen to produce a Windows executable.''') + + if getattr(sys, 'frozen', False): + return [sys.executable, '--multiprocessing-fork'] + else: + prog = 'from multiprocessing.forking import main; main()' + return [_python_exe, '-c', prog, '--multiprocessing-fork'] + + + def main(): + ''' + Run code specifed by data received over pipe + ''' + assert is_forking(sys.argv) + + handle = int(sys.argv[-1]) + fd = msvcrt.open_osfhandle(handle, os.O_RDONLY) + from_parent = os.fdopen(fd, 'rb') + + process.current_process()._inheriting = True + preparation_data = load(from_parent) + prepare(preparation_data) + self = load(from_parent) + process.current_process()._inheriting = False + + from_parent.close() + + exitcode = self._bootstrap() + exit(exitcode) + + + def get_preparation_data(name): + ''' + Return info about parent needed by child to unpickle process object + ''' + from .util import _logger, _log_to_stderr + + d = dict( + name=name, + sys_path=sys.path, + sys_argv=sys.argv, + log_to_stderr=_log_to_stderr, + orig_dir=process.ORIGINAL_DIR, + authkey=process.current_process().get_authkey(), + ) + + if _logger is not None: + d['log_level'] = _logger.getEffectiveLevel() + + if not WINEXE: + main_path = getattr(sys.modules['__main__'], '__file__', None) + if not main_path and sys.argv[0] not in ('', '-c'): + main_path = sys.argv[0] + if main_path is not None: + if not os.path.isabs(main_path) and \ + process.ORIGINAL_DIR is not None: + main_path = os.path.join(process.ORIGINAL_DIR, main_path) + d['main_path'] = os.path.normpath(main_path) + + return d + + # + # Make (Pipe)Connection picklable + # + + def reduce_connection(conn): + if not Popen.thread_is_spawning(): + raise RuntimeError( + 'By default %s objects can only be shared between processes\n' + 'using inheritance' % type(conn).__name__ + ) + return type(conn), (Popen.duplicate_for_child(conn.fileno()), + conn.readable, conn.writable) + + copy_reg.pickle(Connection, reduce_connection) + copy_reg.pickle(PipeConnection, reduce_connection) + + +# +# Prepare current process +# + +old_main_modules = [] + +def prepare(data): + ''' + Try to get current process ready to unpickle process object + ''' + old_main_modules.append(sys.modules['__main__']) + + if 'name' in data: + process.current_process().set_name(data['name']) + + if 'authkey' in data: + process.current_process()._authkey = data['authkey'] + + if 'log_to_stderr' in data and data['log_to_stderr']: + util.log_to_stderr() + + if 'log_level' in data: + util.get_logger().setLevel(data['log_level']) + + if 'sys_path' in data: + sys.path = data['sys_path'] + + if 'sys_argv' in data: + sys.argv = data['sys_argv'] + + if 'dir' in data: + os.chdir(data['dir']) + + if 'orig_dir' in data: + process.ORIGINAL_DIR = data['orig_dir'] + + if 'main_path' in data: + main_path = data['main_path'] + main_name = os.path.splitext(os.path.basename(main_path))[0] + if main_name == '__init__': + main_name = os.path.basename(os.path.dirname(main_path)) + + if main_name != 'ipython': + import imp + + if main_path is None: + dirs = None + elif os.path.basename(main_path).startswith('__init__.py'): + dirs = [os.path.dirname(os.path.dirname(main_path))] + else: + dirs = [os.path.dirname(main_path)] + + assert main_name not in sys.modules, main_name + file, path_name, etc = imp.find_module(main_name, dirs) + try: + # We would like to do "imp.load_module('__main__', ...)" + # here. However, that would cause 'if __name__ == + # "__main__"' clauses to be executed. + main_module = imp.load_module( + '__parents_main__', file, path_name, etc + ) + finally: + if file: + file.close() + + sys.modules['__main__'] = main_module + main_module.__name__ = '__main__' + + # Try to make the potentially picklable objects in + # sys.modules['__main__'] realize they are in the main + # module -- somewhat ugly. + for obj in main_module.__dict__.values(): + try: + if obj.__module__ == '__parents_main__': + obj.__module__ = '__main__' + except Exception: + pass Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py Sun Jun 15 03:02:00 2008 @@ -1,1092 +1,1092 @@ -# -# Module providing the `SyncManager` class for dealing -# with shared objects -# -# multiprocessing/managers.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] - -# -# Imports -# - -import os -import sys -import weakref -import threading -import array -import copy_reg -import Queue - -from traceback import format_exc -from multiprocessing import Process, current_process, active_children, Pool, util, connection -from multiprocessing.process import AuthenticationString -from multiprocessing.forking import exit, Popen, assert_spawning -from multiprocessing.util import Finalize, info - -try: - from cPickle import PicklingError -except ImportError: - from pickle import PicklingError - -# -# -# - -try: - bytes -except NameError: - bytes = str # XXX not needed in Py2.6 and Py3.0 - -# -# Register some things for pickling -# - -def reduce_array(a): - return array.array, (a.typecode, a.tostring()) -copy_reg.pickle(array.array, reduce_array) - -view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] -if view_types[0] is not list: # XXX only needed in Py3.0 - def rebuild_as_list(obj): - return list, (list(obj),) - for view_type in view_types: - copy_reg.pickle(view_type, rebuild_as_list) - -# -# Type for identifying shared objects -# - -class Token(object): - ''' - Type to uniquely indentify a shared object - ''' - __slots__ = ('typeid', 'address', 'id') - - def __init__(self, typeid, address, id): - (self.typeid, self.address, self.id) = (typeid, address, id) - - def __getstate__(self): - return (self.typeid, self.address, self.id) - - def __setstate__(self, state): - (self.typeid, self.address, self.id) = state - - def __repr__(self): - return 'Token(typeid=%r, address=%r, id=%r)' % \ - (self.typeid, self.address, self.id) - -# -# Function for communication with a manager's server process -# - -def dispatch(c, id, methodname, args=(), kwds={}): - ''' - Send a message to manager using connection `c` and return response - ''' - c.send((id, methodname, args, kwds)) - kind, result = c.recv() - if kind == '#RETURN': - return result - raise convert_to_error(kind, result) - -def convert_to_error(kind, result): - if kind == '#ERROR': - return result - elif kind == '#TRACEBACK': - assert type(result) is str - return RemoteError(result) - elif kind == '#UNSERIALIZABLE': - assert type(result) is str - return RemoteError('Unserializable message: %s\n' % result) - else: - return ValueError('Unrecognized message type') - -class RemoteError(Exception): - def __str__(self): - return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) - -# -# Functions for finding the method names of an object -# - -def all_methods(obj): - ''' - Return a list of names of methods of `obj` - ''' - temp = [] - for name in dir(obj): - func = getattr(obj, name) - if hasattr(func, '__call__'): - temp.append(name) - return temp - -def public_methods(obj): - ''' - Return a list of names of methods of `obj` which do not start with '_' - ''' - return [name for name in all_methods(obj) if name[0] != '_'] - -# -# Server which is run in a process controlled by a manager -# - -class Server(object): - ''' - Server class which runs in a process controlled by a manager object - ''' - public = ['shutdown', 'create', 'accept_connection', 'get_methods', - 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] - - def __init__(self, registry, address, authkey, serializer): - assert isinstance(authkey, bytes) - self.registry = registry - self.authkey = AuthenticationString(authkey) - Listener, Client = listener_client[serializer] - - # do authentication later - self.listener = Listener(address=address, backlog=5) - self.address = self.listener.address - - self.id_to_obj = {0: (None, ())} - self.id_to_refcount = {} - self.mutex = threading.RLock() - self.stop = 0 - - def serve_forever(self): - ''' - Run the server forever - ''' - current_process()._manager_server = self - try: - try: - while 1: - try: - c = self.listener.accept() - except (OSError, IOError): - continue - t = threading.Thread(target=self.handle_request, args=(c,)) - t.set_daemon(True) - t.start() - except (KeyboardInterrupt, SystemExit): - pass - finally: - self.stop = 999 - self.listener.close() - - def handle_request(self, c): - ''' - Handle a new connection - ''' - funcname = result = request = None - try: - connection.deliver_challenge(c, self.authkey) - connection.answer_challenge(c, self.authkey) - request = c.recv() - ignore, funcname, args, kwds = request - assert funcname in self.public, '%r unrecognized' % funcname - func = getattr(self, funcname) - except Exception: - msg = ('#TRACEBACK', format_exc()) - else: - try: - result = func(c, *args, **kwds) - except Exception: - msg = ('#TRACEBACK', format_exc()) - else: - msg = ('#RETURN', result) - try: - c.send(msg) - except Exception, e: - try: - c.send(('#TRACEBACK', format_exc())) - except Exception: - pass - util.info('Failure to send message: %r', msg) - util.info(' ... request was %r', request) - util.info(' ... exception was %r', e) - - c.close() - - def serve_client(self, conn): - ''' - Handle requests from the proxies in a particular process/thread - ''' - util.debug('starting server thread to service %r', - threading.current_thread().get_name()) - - recv = conn.recv - send = conn.send - id_to_obj = self.id_to_obj - - while not self.stop: - - try: - methodname = obj = None - request = recv() - ident, methodname, args, kwds = request - obj, exposed, gettypeid = id_to_obj[ident] - - if methodname not in exposed: - raise AttributeError( - 'method %r of %r object is not in exposed=%r' % - (methodname, type(obj), exposed) - ) - - function = getattr(obj, methodname) - - try: - res = function(*args, **kwds) - except Exception, e: - msg = ('#ERROR', e) - else: - typeid = gettypeid and gettypeid.get(methodname, None) - if typeid: - rident, rexposed = self.create(conn, typeid, res) - token = Token(typeid, self.address, rident) - msg = ('#PROXY', (rexposed, token)) - else: - msg = ('#RETURN', res) - - except AttributeError: - if methodname is None: - msg = ('#TRACEBACK', format_exc()) - else: - try: - fallback_func = self.fallback_mapping[methodname] - result = fallback_func( - self, conn, ident, obj, *args, **kwds - ) - msg = ('#RETURN', result) - except Exception: - msg = ('#TRACEBACK', format_exc()) - - except EOFError: - util.debug('got EOF -- exiting thread serving %r', - threading.current_thread().get_name()) - sys.exit(0) - - except Exception: - msg = ('#TRACEBACK', format_exc()) - - try: - try: - send(msg) - except Exception, e: - send(('#UNSERIALIZABLE', repr(msg))) - except Exception, e: - util.info('exception in thread serving %r', - threading.current_thread().get_name()) - util.info(' ... message was %r', msg) - util.info(' ... exception was %r', e) - conn.close() - sys.exit(1) - - def fallback_getvalue(self, conn, ident, obj): - return obj - - def fallback_str(self, conn, ident, obj): - return str(obj) - - def fallback_repr(self, conn, ident, obj): - return repr(obj) - - fallback_mapping = { - '__str__':fallback_str, - '__repr__':fallback_repr, - '#GETVALUE':fallback_getvalue - } - - def dummy(self, c): - pass - - def debug_info(self, c): - ''' - Return some info --- useful to spot problems with refcounting - ''' - self.mutex.acquire() - try: - result = [] - keys = self.id_to_obj.keys() - keys.sort() - for ident in keys: - if ident != 0: - result.append(' %s: refcount=%s\n %s' % - (ident, self.id_to_refcount[ident], - str(self.id_to_obj[ident][0])[:75])) - return '\n'.join(result) - finally: - self.mutex.release() - - def number_of_objects(self, c): - ''' - Number of shared objects - ''' - return len(self.id_to_obj) - 1 # don't count ident=0 - - def shutdown(self, c): - ''' - Shutdown this process - ''' - try: - try: - util.debug('manager received shutdown message') - c.send(('#RETURN', None)) - - if sys.stdout != sys.__stdout__: - util.debug('resetting stdout, stderr') - sys.stdout = sys.__stdout__ - sys.stderr = sys.__stderr__ - - util._run_finalizers(0) - - for p in active_children(): - util.debug('terminating a child process of manager') - p.terminate() - - for p in active_children(): - util.debug('terminating a child process of manager') - p.join() - - util._run_finalizers() - util.info('manager exiting with exitcode 0') - except: - import traceback - traceback.print_exc() - finally: - exit(0) - - def create(self, c, typeid, *args, **kwds): - ''' - Create a new shared object and return its id - ''' - self.mutex.acquire() - try: - callable, exposed, method_to_typeid, proxytype = \ - self.registry[typeid] - - if callable is None: - assert len(args) == 1 and not kwds - obj = args[0] - else: - obj = callable(*args, **kwds) - - if exposed is None: - exposed = public_methods(obj) - if method_to_typeid is not None: - assert type(method_to_typeid) is dict - exposed = list(exposed) + list(method_to_typeid) - - ident = '%x' % id(obj) # convert to string because xmlrpclib - # only has 32 bit signed integers - util.debug('%r callable returned object with id %r', typeid, ident) - - self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) - if ident not in self.id_to_refcount: - self.id_to_refcount[ident] = None - return ident, tuple(exposed) - finally: - self.mutex.release() - - def get_methods(self, c, token): - ''' - Return the methods of the shared object indicated by token - ''' - return tuple(self.id_to_obj[token.id][1]) - - def accept_connection(self, c, name): - ''' - Spawn a new thread to serve this connection - ''' - threading.current_thread().set_name(name) - c.send(('#RETURN', None)) - self.serve_client(c) - - def incref(self, c, ident): - self.mutex.acquire() - try: - try: - self.id_to_refcount[ident] += 1 - except TypeError: - assert self.id_to_refcount[ident] is None - self.id_to_refcount[ident] = 1 - finally: - self.mutex.release() - - def decref(self, c, ident): - self.mutex.acquire() - try: - assert self.id_to_refcount[ident] >= 1 - self.id_to_refcount[ident] -= 1 - if self.id_to_refcount[ident] == 0: - del self.id_to_obj[ident], self.id_to_refcount[ident] - util.debug('disposing of obj with id %d', ident) - finally: - self.mutex.release() - -# -# Class to represent state of a manager -# - -class State(object): - __slots__ = ['value'] - INITIAL = 0 - STARTED = 1 - SHUTDOWN = 2 - -# -# Mapping from serializer name to Listener and Client types -# - -listener_client = { - 'pickle' : (connection.Listener, connection.Client), - 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) - } - -# -# Definition of BaseManager -# - -class BaseManager(object): - ''' - Base class for managers - ''' - _registry = {} - _Server = Server - - def __init__(self, address=None, authkey=None, serializer='pickle'): - if authkey is None: - authkey = current_process().get_authkey() - self._address = address # XXX not final address if eg ('', 0) - self._authkey = AuthenticationString(authkey) - self._state = State() - self._state.value = State.INITIAL - self._serializer = serializer - self._Listener, self._Client = listener_client[serializer] - - def __reduce__(self): - return type(self).from_address, \ - (self._address, self._authkey, self._serializer) - - def get_server(self): - ''' - Return server object with serve_forever() method and address attribute - ''' - assert self._state.value == State.INITIAL - return Server(self._registry, self._address, - self._authkey, self._serializer) - - def connect(self): - ''' - Connect manager object to the server process - ''' - Listener, Client = listener_client[self._serializer] - conn = Client(self._address, authkey=self._authkey) - dispatch(conn, None, 'dummy') - self._state.value = State.STARTED - - def start(self): - ''' - Spawn a server process for this manager object - ''' - assert self._state.value == State.INITIAL - - # pipe over which we will retrieve address of server - reader, writer = connection.Pipe(duplex=False) - - # spawn process which runs a server - self._process = Process( - target=type(self)._run_server, - args=(self._registry, self._address, self._authkey, - self._serializer, writer), - ) - ident = ':'.join(str(i) for i in self._process._identity) - self._process.set_name(type(self).__name__ + '-' + ident) - self._process.start() - - # get address of server - writer.close() - self._address = reader.recv() - reader.close() - - # register a finalizer - self._state.value = State.STARTED - self.shutdown = util.Finalize( - self, type(self)._finalize_manager, - args=(self._process, self._address, self._authkey, - self._state, self._Client), - exitpriority=0 - ) - - @classmethod - def _run_server(cls, registry, address, authkey, serializer, writer): - ''' - Create a server, report its address and run it - ''' - # create server - server = cls._Server(registry, address, authkey, serializer) - - # inform parent process of the server's address - writer.send(server.address) - writer.close() - - # run the manager - util.info('manager serving at %r', server.address) - server.serve_forever() - - def _create(self, typeid, *args, **kwds): - ''' - Create a new shared object; return the token and exposed tuple - ''' - assert self._state.value == State.STARTED, 'server not yet started' - conn = self._Client(self._address, authkey=self._authkey) - try: - id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) - finally: - conn.close() - return Token(typeid, self._address, id), exposed - - def join(self, timeout=None): - ''' - Join the manager process (if it has been spawned) - ''' - self._process.join(timeout) - - def _debug_info(self): - ''' - Return some info about the servers shared objects and connections - ''' - conn = self._Client(self._address, authkey=self._authkey) - try: - return dispatch(conn, None, 'debug_info') - finally: - conn.close() - - def _number_of_objects(self): - ''' - Return the number of shared objects - ''' - conn = self._Client(self._address, authkey=self._authkey) - try: - return dispatch(conn, None, 'number_of_objects') - finally: - conn.close() - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - self.shutdown() - - @staticmethod - def _finalize_manager(process, address, authkey, state, _Client): - ''' - Shutdown the manager process; will be registered as a finalizer - ''' - if process.is_alive(): - util.info('sending shutdown message to manager') - try: - conn = _Client(address, authkey=authkey) - try: - dispatch(conn, None, 'shutdown') - finally: - conn.close() - except Exception: - pass - - process.join(timeout=0.2) - if process.is_alive(): - util.info('manager still alive') - if hasattr(process, 'terminate'): - util.info('trying to `terminate()` manager process') - process.terminate() - process.join(timeout=0.1) - if process.is_alive(): - util.info('manager still alive after terminate') - - state.value = State.SHUTDOWN - try: - del BaseProxy._address_to_local[address] - except KeyError: - pass - - address = property(lambda self: self._address) - - @classmethod - def register(cls, typeid, callable=None, proxytype=None, exposed=None, - method_to_typeid=None, create_method=True): - ''' - Register a typeid with the manager type - ''' - if '_registry' not in cls.__dict__: - cls._registry = cls._registry.copy() - - if proxytype is None: - proxytype = AutoProxy - - exposed = exposed or getattr(proxytype, '_exposed_', None) - - method_to_typeid = method_to_typeid or \ - getattr(proxytype, '_method_to_typeid_', None) - - if method_to_typeid: - for key, value in method_to_typeid.items(): - assert type(key) is str, '%r is not a string' % key - assert type(value) is str, '%r is not a string' % value - - cls._registry[typeid] = ( - callable, exposed, method_to_typeid, proxytype - ) - - if create_method: - def temp(self, *args, **kwds): - util.debug('requesting creation of a shared %r object', typeid) - token, exp = self._create(typeid, *args, **kwds) - proxy = proxytype( - token, self._serializer, manager=self, - authkey=self._authkey, exposed=exp - ) - return proxy - temp.__name__ = typeid - setattr(cls, typeid, temp) - -# -# Subclass of set which get cleared after a fork -# - -class ProcessLocalSet(set): - def __init__(self): - util.register_after_fork(self, lambda obj: obj.clear()) - def __reduce__(self): - return type(self), () - -# -# Definition of BaseProxy -# - -class BaseProxy(object): - ''' - A base for proxies of shared objects - ''' - _address_to_local = {} - _mutex = util.ForkAwareThreadLock() - - def __init__(self, token, serializer, manager=None, - authkey=None, exposed=None, incref=True): - BaseProxy._mutex.acquire() - try: - tls_idset = BaseProxy._address_to_local.get(token.address, None) - if tls_idset is None: - tls_idset = util.ForkAwareLocal(), ProcessLocalSet() - BaseProxy._address_to_local[token.address] = tls_idset - finally: - BaseProxy._mutex.release() - - # self._tls is used to record the connection used by this - # thread to communicate with the manager at token.address - self._tls = tls_idset[0] - - # self._idset is used to record the identities of all shared - # objects for which the current process owns references and - # which are in the manager at token.address - self._idset = tls_idset[1] - - self._token = token - self._id = self._token.id - self._manager = manager - self._serializer = serializer - self._Client = listener_client[serializer][1] - - if authkey is not None: - self._authkey = AuthenticationString(authkey) - elif self._manager is not None: - self._authkey = self._manager._authkey - else: - self._authkey = current_process().get_authkey() - - if incref: - self._incref() - - util.register_after_fork(self, BaseProxy._after_fork) - - def _connect(self): - util.debug('making connection to manager') - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - conn = self._Client(self._token.address, authkey=self._authkey) - dispatch(conn, None, 'accept_connection', (name,)) - self._tls.connection = conn - - def _callmethod(self, methodname, args=(), kwds={}): - ''' - Try to call a method of the referrent and return a copy of the result - ''' - try: - conn = self._tls.connection - except AttributeError: - util.debug('thread %r does not own a connection', - threading.current_thread().get_name()) - self._connect() - conn = self._tls.connection - - conn.send((self._id, methodname, args, kwds)) - kind, result = conn.recv() - - if kind == '#RETURN': - return result - elif kind == '#PROXY': - exposed, token = result - proxytype = self._manager._registry[token.typeid][-1] - return proxytype( - token, self._serializer, manager=self._manager, - authkey=self._authkey, exposed=exposed - ) - raise convert_to_error(kind, result) - - def _getvalue(self): - ''' - Get a copy of the value of the referent - ''' - return self._callmethod('#GETVALUE') - - def _incref(self): - conn = self._Client(self._token.address, authkey=self._authkey) - dispatch(conn, None, 'incref', (self._id,)) - util.debug('INCREF %r', self._token.id) - - self._idset.add(self._id) - - state = self._manager and self._manager._state - - self._close = util.Finalize( - self, BaseProxy._decref, - args=(self._token, self._authkey, state, - self._tls, self._idset, self._Client), - exitpriority=10 - ) - - @staticmethod - def _decref(token, authkey, state, tls, idset, _Client): - idset.discard(token.id) - - # check whether manager is still alive - if state is None or state.value == State.STARTED: - # tell manager this process no longer cares about referent - try: - util.debug('DECREF %r', token.id) - conn = _Client(token.address, authkey=authkey) - dispatch(conn, None, 'decref', (token.id,)) - except Exception, e: - util.debug('... decref failed %s', e) - - else: - util.debug('DECREF %r -- manager already shutdown', token.id) - - # check whether we can close this thread's connection because - # the process owns no more references to objects for this manager - if not idset and hasattr(tls, 'connection'): - util.debug('thread %r has no more proxies so closing conn', - threading.current_thread().get_name()) - tls.connection.close() - del tls.connection - - def _after_fork(self): - self._manager = None - try: - self._incref() - except Exception, e: - # the proxy may just be for a manager which has shutdown - util.info('incref failed: %s' % e) - - def __reduce__(self): - kwds = {} - if Popen.thread_is_spawning(): - kwds['authkey'] = self._authkey - - if getattr(self, '_isauto', False): - kwds['exposed'] = self._exposed_ - return (RebuildProxy, - (AutoProxy, self._token, self._serializer, kwds)) - else: - return (RebuildProxy, - (type(self), self._token, self._serializer, kwds)) - - def __deepcopy__(self, memo): - return self._getvalue() - - def __repr__(self): - return '<%s object, typeid %r at %s>' % \ - (type(self).__name__, self._token.typeid, '0x%x' % id(self)) - - def __str__(self): - ''' - Return representation of the referent (or a fall-back if that fails) - ''' - try: - return self._callmethod('__repr__') - except Exception: - return repr(self)[:-1] + "; '__str__()' failed>" - -# -# Function used for unpickling -# - -def RebuildProxy(func, token, serializer, kwds): - ''' - Function used for unpickling proxy objects. - - If possible the shared object is returned, or otherwise a proxy for it. - ''' - server = getattr(current_process(), '_manager_server', None) - - if server and server.address == token.address: - return server.id_to_obj[token.id][0] - else: - incref = ( - kwds.pop('incref', True) and - not getattr(current_process(), '_inheriting', False) - ) - return func(token, serializer, incref=incref, **kwds) - -# -# Functions to create proxies and proxy types -# - -def MakeProxyType(name, exposed, _cache={}): - ''' - Return an proxy type whose methods are given by `exposed` - ''' - exposed = tuple(exposed) - try: - return _cache[(name, exposed)] - except KeyError: - pass - - dic = {} - - for meth in exposed: - exec '''def %s(self, *args, **kwds): - return self._callmethod(%r, args, kwds)''' % (meth, meth) in dic - - ProxyType = type(name, (BaseProxy,), dic) - ProxyType._exposed_ = exposed - _cache[(name, exposed)] = ProxyType - return ProxyType - - -def AutoProxy(token, serializer, manager=None, authkey=None, - exposed=None, incref=True): - ''' - Return an auto-proxy for `token` - ''' - _Client = listener_client[serializer][1] - - if exposed is None: - conn = _Client(token.address, authkey=authkey) - try: - exposed = dispatch(conn, None, 'get_methods', (token,)) - finally: - conn.close() - - if authkey is None and manager is not None: - authkey = manager._authkey - if authkey is None: - authkey = current_process().get_authkey() - - ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) - proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, - incref=incref) - proxy._isauto = True - return proxy - -# -# Types/callables which we will register with SyncManager -# - -class Namespace(object): - def __init__(self, **kwds): - self.__dict__.update(kwds) - def __repr__(self): - items = self.__dict__.items() - temp = [] - for name, value in items: - if not name.startswith('_'): - temp.append('%s=%r' % (name, value)) - temp.sort() - return 'Namespace(%s)' % str.join(', ', temp) - -class Value(object): - def __init__(self, typecode, value, lock=True): - self._typecode = typecode - self._value = value - def get(self): - return self._value - def set(self, value): - self._value = value - def __repr__(self): - return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) - value = property(get, set) - -def Array(typecode, sequence, lock=True): - return array.array(typecode, sequence) - -# -# Proxy types used by SyncManager -# - -class IteratorProxy(BaseProxy): - # XXX remove methods for Py3.0 and Py2.6 - _exposed_ = ('__next__', 'next', 'send', 'throw', 'close') - def __iter__(self): - return self - def __next__(self, *args): - return self._callmethod('__next__', args) - def next(self, *args): - return self._callmethod('next', args) - def send(self, *args): - return self._callmethod('send', args) - def throw(self, *args): - return self._callmethod('throw', args) - def close(self, *args): - return self._callmethod('close', args) - - -class AcquirerProxy(BaseProxy): - _exposed_ = ('acquire', 'release') - def acquire(self, blocking=True): - return self._callmethod('acquire', (blocking,)) - def release(self): - return self._callmethod('release') - def __enter__(self): - return self._callmethod('acquire') - def __exit__(self, exc_type, exc_val, exc_tb): - return self._callmethod('release') - - -class ConditionProxy(AcquirerProxy): - # XXX will Condition.notfyAll() name be available in Py3.0? - _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') - def wait(self, timeout=None): - return self._callmethod('wait', (timeout,)) - def notify(self): - return self._callmethod('notify') - def notify_all(self): - return self._callmethod('notify_all') - -class EventProxy(BaseProxy): - # XXX will Event.isSet name be available in Py3.0? - _exposed_ = ('isSet', 'set', 'clear', 'wait') - def is_set(self): - return self._callmethod('isSet') - def set(self): - return self._callmethod('set') - def clear(self): - return self._callmethod('clear') - def wait(self, timeout=None): - return self._callmethod('wait', (timeout,)) - -class NamespaceProxy(BaseProxy): - _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') - def __getattr__(self, key): - if key[0] == '_': - return object.__getattribute__(self, key) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__getattribute__', (key,)) - def __setattr__(self, key, value): - if key[0] == '_': - return object.__setattr__(self, key, value) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__setattr__', (key, value)) - def __delattr__(self, key): - if key[0] == '_': - return object.__delattr__(self, key) - callmethod = object.__getattribute__(self, '_callmethod') - return callmethod('__delattr__', (key,)) - - -class ValueProxy(BaseProxy): - _exposed_ = ('get', 'set') - def get(self): - return self._callmethod('get') - def set(self, value): - return self._callmethod('set', (value,)) - value = property(get, set) - - -BaseListProxy = MakeProxyType('BaseListProxy', ( - '__add__', '__contains__', '__delitem__', '__delslice__', - '__getitem__', '__getslice__', '__len__', '__mul__', - '__reversed__', '__rmul__', '__setitem__', '__setslice__', - 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', - 'reverse', 'sort', '__imul__' - )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 -class ListProxy(BaseListProxy): - def __iadd__(self, value): - self._callmethod('extend', (value,)) - return self - def __imul__(self, value): - self._callmethod('__imul__', (value,)) - return self - - -DictProxy = MakeProxyType('DictProxy', ( - '__contains__', '__delitem__', '__getitem__', '__len__', - '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', - 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' - )) - - -ArrayProxy = MakeProxyType('ArrayProxy', ( - '__len__', '__getitem__', '__setitem__', '__getslice__', '__setslice__' - )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 - - -PoolProxy = MakeProxyType('PoolProxy', ( - 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', - 'map', 'map_async', 'terminate' - )) -PoolProxy._method_to_typeid_ = { - 'apply_async': 'AsyncResult', - 'map_async': 'AsyncResult', - 'imap': 'Iterator', - 'imap_unordered': 'Iterator' - } - -# -# Definition of SyncManager -# - -class SyncManager(BaseManager): - ''' - Subclass of `BaseManager` which supports a number of shared object types. - - The types registered are those intended for the synchronization - of threads, plus `dict`, `list` and `Namespace`. - - The `multiprocessing.Manager()` function creates started instances of - this class. - ''' - -SyncManager.register('Queue', Queue.Queue) -SyncManager.register('JoinableQueue', Queue.Queue) -SyncManager.register('Event', threading.Event, EventProxy) -SyncManager.register('Lock', threading.Lock, AcquirerProxy) -SyncManager.register('RLock', threading.RLock, AcquirerProxy) -SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) -SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, - AcquirerProxy) -SyncManager.register('Condition', threading.Condition, ConditionProxy) -SyncManager.register('Pool', Pool, PoolProxy) -SyncManager.register('list', list, ListProxy) -SyncManager.register('dict', dict, DictProxy) -SyncManager.register('Value', Value, ValueProxy) -SyncManager.register('Array', Array, ArrayProxy) -SyncManager.register('Namespace', Namespace, NamespaceProxy) - -# types returned by methods of PoolProxy -SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) -SyncManager.register('AsyncResult', create_method=False) +# +# Module providing the `SyncManager` class for dealing +# with shared objects +# +# multiprocessing/managers.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] + +# +# Imports +# + +import os +import sys +import weakref +import threading +import array +import copy_reg +import Queue + +from traceback import format_exc +from multiprocessing import Process, current_process, active_children, Pool, util, connection +from multiprocessing.process import AuthenticationString +from multiprocessing.forking import exit, Popen, assert_spawning +from multiprocessing.util import Finalize, info + +try: + from cPickle import PicklingError +except ImportError: + from pickle import PicklingError + +# +# +# + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Register some things for pickling +# + +def reduce_array(a): + return array.array, (a.typecode, a.tostring()) +copy_reg.pickle(array.array, reduce_array) + +view_types = [type(getattr({}, name)()) for name in ('items','keys','values')] +if view_types[0] is not list: # XXX only needed in Py3.0 + def rebuild_as_list(obj): + return list, (list(obj),) + for view_type in view_types: + copy_reg.pickle(view_type, rebuild_as_list) + +# +# Type for identifying shared objects +# + +class Token(object): + ''' + Type to uniquely indentify a shared object + ''' + __slots__ = ('typeid', 'address', 'id') + + def __init__(self, typeid, address, id): + (self.typeid, self.address, self.id) = (typeid, address, id) + + def __getstate__(self): + return (self.typeid, self.address, self.id) + + def __setstate__(self, state): + (self.typeid, self.address, self.id) = state + + def __repr__(self): + return 'Token(typeid=%r, address=%r, id=%r)' % \ + (self.typeid, self.address, self.id) + +# +# Function for communication with a manager's server process +# + +def dispatch(c, id, methodname, args=(), kwds={}): + ''' + Send a message to manager using connection `c` and return response + ''' + c.send((id, methodname, args, kwds)) + kind, result = c.recv() + if kind == '#RETURN': + return result + raise convert_to_error(kind, result) + +def convert_to_error(kind, result): + if kind == '#ERROR': + return result + elif kind == '#TRACEBACK': + assert type(result) is str + return RemoteError(result) + elif kind == '#UNSERIALIZABLE': + assert type(result) is str + return RemoteError('Unserializable message: %s\n' % result) + else: + return ValueError('Unrecognized message type') + +class RemoteError(Exception): + def __str__(self): + return ('\n' + '-'*75 + '\n' + str(self.args[0]) + '-'*75) + +# +# Functions for finding the method names of an object +# + +def all_methods(obj): + ''' + Return a list of names of methods of `obj` + ''' + temp = [] + for name in dir(obj): + func = getattr(obj, name) + if hasattr(func, '__call__'): + temp.append(name) + return temp + +def public_methods(obj): + ''' + Return a list of names of methods of `obj` which do not start with '_' + ''' + return [name for name in all_methods(obj) if name[0] != '_'] + +# +# Server which is run in a process controlled by a manager +# + +class Server(object): + ''' + Server class which runs in a process controlled by a manager object + ''' + public = ['shutdown', 'create', 'accept_connection', 'get_methods', + 'debug_info', 'number_of_objects', 'dummy', 'incref', 'decref'] + + def __init__(self, registry, address, authkey, serializer): + assert isinstance(authkey, bytes) + self.registry = registry + self.authkey = AuthenticationString(authkey) + Listener, Client = listener_client[serializer] + + # do authentication later + self.listener = Listener(address=address, backlog=5) + self.address = self.listener.address + + self.id_to_obj = {0: (None, ())} + self.id_to_refcount = {} + self.mutex = threading.RLock() + self.stop = 0 + + def serve_forever(self): + ''' + Run the server forever + ''' + current_process()._manager_server = self + try: + try: + while 1: + try: + c = self.listener.accept() + except (OSError, IOError): + continue + t = threading.Thread(target=self.handle_request, args=(c,)) + t.set_daemon(True) + t.start() + except (KeyboardInterrupt, SystemExit): + pass + finally: + self.stop = 999 + self.listener.close() + + def handle_request(self, c): + ''' + Handle a new connection + ''' + funcname = result = request = None + try: + connection.deliver_challenge(c, self.authkey) + connection.answer_challenge(c, self.authkey) + request = c.recv() + ignore, funcname, args, kwds = request + assert funcname in self.public, '%r unrecognized' % funcname + func = getattr(self, funcname) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + try: + result = func(c, *args, **kwds) + except Exception: + msg = ('#TRACEBACK', format_exc()) + else: + msg = ('#RETURN', result) + try: + c.send(msg) + except Exception, e: + try: + c.send(('#TRACEBACK', format_exc())) + except Exception: + pass + util.info('Failure to send message: %r', msg) + util.info(' ... request was %r', request) + util.info(' ... exception was %r', e) + + c.close() + + def serve_client(self, conn): + ''' + Handle requests from the proxies in a particular process/thread + ''' + util.debug('starting server thread to service %r', + threading.current_thread().get_name()) + + recv = conn.recv + send = conn.send + id_to_obj = self.id_to_obj + + while not self.stop: + + try: + methodname = obj = None + request = recv() + ident, methodname, args, kwds = request + obj, exposed, gettypeid = id_to_obj[ident] + + if methodname not in exposed: + raise AttributeError( + 'method %r of %r object is not in exposed=%r' % + (methodname, type(obj), exposed) + ) + + function = getattr(obj, methodname) + + try: + res = function(*args, **kwds) + except Exception, e: + msg = ('#ERROR', e) + else: + typeid = gettypeid and gettypeid.get(methodname, None) + if typeid: + rident, rexposed = self.create(conn, typeid, res) + token = Token(typeid, self.address, rident) + msg = ('#PROXY', (rexposed, token)) + else: + msg = ('#RETURN', res) + + except AttributeError: + if methodname is None: + msg = ('#TRACEBACK', format_exc()) + else: + try: + fallback_func = self.fallback_mapping[methodname] + result = fallback_func( + self, conn, ident, obj, *args, **kwds + ) + msg = ('#RETURN', result) + except Exception: + msg = ('#TRACEBACK', format_exc()) + + except EOFError: + util.debug('got EOF -- exiting thread serving %r', + threading.current_thread().get_name()) + sys.exit(0) + + except Exception: + msg = ('#TRACEBACK', format_exc()) + + try: + try: + send(msg) + except Exception, e: + send(('#UNSERIALIZABLE', repr(msg))) + except Exception, e: + util.info('exception in thread serving %r', + threading.current_thread().get_name()) + util.info(' ... message was %r', msg) + util.info(' ... exception was %r', e) + conn.close() + sys.exit(1) + + def fallback_getvalue(self, conn, ident, obj): + return obj + + def fallback_str(self, conn, ident, obj): + return str(obj) + + def fallback_repr(self, conn, ident, obj): + return repr(obj) + + fallback_mapping = { + '__str__':fallback_str, + '__repr__':fallback_repr, + '#GETVALUE':fallback_getvalue + } + + def dummy(self, c): + pass + + def debug_info(self, c): + ''' + Return some info --- useful to spot problems with refcounting + ''' + self.mutex.acquire() + try: + result = [] + keys = self.id_to_obj.keys() + keys.sort() + for ident in keys: + if ident != 0: + result.append(' %s: refcount=%s\n %s' % + (ident, self.id_to_refcount[ident], + str(self.id_to_obj[ident][0])[:75])) + return '\n'.join(result) + finally: + self.mutex.release() + + def number_of_objects(self, c): + ''' + Number of shared objects + ''' + return len(self.id_to_obj) - 1 # don't count ident=0 + + def shutdown(self, c): + ''' + Shutdown this process + ''' + try: + try: + util.debug('manager received shutdown message') + c.send(('#RETURN', None)) + + if sys.stdout != sys.__stdout__: + util.debug('resetting stdout, stderr') + sys.stdout = sys.__stdout__ + sys.stderr = sys.__stderr__ + + util._run_finalizers(0) + + for p in active_children(): + util.debug('terminating a child process of manager') + p.terminate() + + for p in active_children(): + util.debug('terminating a child process of manager') + p.join() + + util._run_finalizers() + util.info('manager exiting with exitcode 0') + except: + import traceback + traceback.print_exc() + finally: + exit(0) + + def create(self, c, typeid, *args, **kwds): + ''' + Create a new shared object and return its id + ''' + self.mutex.acquire() + try: + callable, exposed, method_to_typeid, proxytype = \ + self.registry[typeid] + + if callable is None: + assert len(args) == 1 and not kwds + obj = args[0] + else: + obj = callable(*args, **kwds) + + if exposed is None: + exposed = public_methods(obj) + if method_to_typeid is not None: + assert type(method_to_typeid) is dict + exposed = list(exposed) + list(method_to_typeid) + + ident = '%x' % id(obj) # convert to string because xmlrpclib + # only has 32 bit signed integers + util.debug('%r callable returned object with id %r', typeid, ident) + + self.id_to_obj[ident] = (obj, set(exposed), method_to_typeid) + if ident not in self.id_to_refcount: + self.id_to_refcount[ident] = None + return ident, tuple(exposed) + finally: + self.mutex.release() + + def get_methods(self, c, token): + ''' + Return the methods of the shared object indicated by token + ''' + return tuple(self.id_to_obj[token.id][1]) + + def accept_connection(self, c, name): + ''' + Spawn a new thread to serve this connection + ''' + threading.current_thread().set_name(name) + c.send(('#RETURN', None)) + self.serve_client(c) + + def incref(self, c, ident): + self.mutex.acquire() + try: + try: + self.id_to_refcount[ident] += 1 + except TypeError: + assert self.id_to_refcount[ident] is None + self.id_to_refcount[ident] = 1 + finally: + self.mutex.release() + + def decref(self, c, ident): + self.mutex.acquire() + try: + assert self.id_to_refcount[ident] >= 1 + self.id_to_refcount[ident] -= 1 + if self.id_to_refcount[ident] == 0: + del self.id_to_obj[ident], self.id_to_refcount[ident] + util.debug('disposing of obj with id %d', ident) + finally: + self.mutex.release() + +# +# Class to represent state of a manager +# + +class State(object): + __slots__ = ['value'] + INITIAL = 0 + STARTED = 1 + SHUTDOWN = 2 + +# +# Mapping from serializer name to Listener and Client types +# + +listener_client = { + 'pickle' : (connection.Listener, connection.Client), + 'xmlrpclib' : (connection.XmlListener, connection.XmlClient) + } + +# +# Definition of BaseManager +# + +class BaseManager(object): + ''' + Base class for managers + ''' + _registry = {} + _Server = Server + + def __init__(self, address=None, authkey=None, serializer='pickle'): + if authkey is None: + authkey = current_process().get_authkey() + self._address = address # XXX not final address if eg ('', 0) + self._authkey = AuthenticationString(authkey) + self._state = State() + self._state.value = State.INITIAL + self._serializer = serializer + self._Listener, self._Client = listener_client[serializer] + + def __reduce__(self): + return type(self).from_address, \ + (self._address, self._authkey, self._serializer) + + def get_server(self): + ''' + Return server object with serve_forever() method and address attribute + ''' + assert self._state.value == State.INITIAL + return Server(self._registry, self._address, + self._authkey, self._serializer) + + def connect(self): + ''' + Connect manager object to the server process + ''' + Listener, Client = listener_client[self._serializer] + conn = Client(self._address, authkey=self._authkey) + dispatch(conn, None, 'dummy') + self._state.value = State.STARTED + + def start(self): + ''' + Spawn a server process for this manager object + ''' + assert self._state.value == State.INITIAL + + # pipe over which we will retrieve address of server + reader, writer = connection.Pipe(duplex=False) + + # spawn process which runs a server + self._process = Process( + target=type(self)._run_server, + args=(self._registry, self._address, self._authkey, + self._serializer, writer), + ) + ident = ':'.join(str(i) for i in self._process._identity) + self._process.set_name(type(self).__name__ + '-' + ident) + self._process.start() + + # get address of server + writer.close() + self._address = reader.recv() + reader.close() + + # register a finalizer + self._state.value = State.STARTED + self.shutdown = util.Finalize( + self, type(self)._finalize_manager, + args=(self._process, self._address, self._authkey, + self._state, self._Client), + exitpriority=0 + ) + + @classmethod + def _run_server(cls, registry, address, authkey, serializer, writer): + ''' + Create a server, report its address and run it + ''' + # create server + server = cls._Server(registry, address, authkey, serializer) + + # inform parent process of the server's address + writer.send(server.address) + writer.close() + + # run the manager + util.info('manager serving at %r', server.address) + server.serve_forever() + + def _create(self, typeid, *args, **kwds): + ''' + Create a new shared object; return the token and exposed tuple + ''' + assert self._state.value == State.STARTED, 'server not yet started' + conn = self._Client(self._address, authkey=self._authkey) + try: + id, exposed = dispatch(conn, None, 'create', (typeid,)+args, kwds) + finally: + conn.close() + return Token(typeid, self._address, id), exposed + + def join(self, timeout=None): + ''' + Join the manager process (if it has been spawned) + ''' + self._process.join(timeout) + + def _debug_info(self): + ''' + Return some info about the servers shared objects and connections + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'debug_info') + finally: + conn.close() + + def _number_of_objects(self): + ''' + Return the number of shared objects + ''' + conn = self._Client(self._address, authkey=self._authkey) + try: + return dispatch(conn, None, 'number_of_objects') + finally: + conn.close() + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.shutdown() + + @staticmethod + def _finalize_manager(process, address, authkey, state, _Client): + ''' + Shutdown the manager process; will be registered as a finalizer + ''' + if process.is_alive(): + util.info('sending shutdown message to manager') + try: + conn = _Client(address, authkey=authkey) + try: + dispatch(conn, None, 'shutdown') + finally: + conn.close() + except Exception: + pass + + process.join(timeout=0.2) + if process.is_alive(): + util.info('manager still alive') + if hasattr(process, 'terminate'): + util.info('trying to `terminate()` manager process') + process.terminate() + process.join(timeout=0.1) + if process.is_alive(): + util.info('manager still alive after terminate') + + state.value = State.SHUTDOWN + try: + del BaseProxy._address_to_local[address] + except KeyError: + pass + + address = property(lambda self: self._address) + + @classmethod + def register(cls, typeid, callable=None, proxytype=None, exposed=None, + method_to_typeid=None, create_method=True): + ''' + Register a typeid with the manager type + ''' + if '_registry' not in cls.__dict__: + cls._registry = cls._registry.copy() + + if proxytype is None: + proxytype = AutoProxy + + exposed = exposed or getattr(proxytype, '_exposed_', None) + + method_to_typeid = method_to_typeid or \ + getattr(proxytype, '_method_to_typeid_', None) + + if method_to_typeid: + for key, value in method_to_typeid.items(): + assert type(key) is str, '%r is not a string' % key + assert type(value) is str, '%r is not a string' % value + + cls._registry[typeid] = ( + callable, exposed, method_to_typeid, proxytype + ) + + if create_method: + def temp(self, *args, **kwds): + util.debug('requesting creation of a shared %r object', typeid) + token, exp = self._create(typeid, *args, **kwds) + proxy = proxytype( + token, self._serializer, manager=self, + authkey=self._authkey, exposed=exp + ) + return proxy + temp.__name__ = typeid + setattr(cls, typeid, temp) + +# +# Subclass of set which get cleared after a fork +# + +class ProcessLocalSet(set): + def __init__(self): + util.register_after_fork(self, lambda obj: obj.clear()) + def __reduce__(self): + return type(self), () + +# +# Definition of BaseProxy +# + +class BaseProxy(object): + ''' + A base for proxies of shared objects + ''' + _address_to_local = {} + _mutex = util.ForkAwareThreadLock() + + def __init__(self, token, serializer, manager=None, + authkey=None, exposed=None, incref=True): + BaseProxy._mutex.acquire() + try: + tls_idset = BaseProxy._address_to_local.get(token.address, None) + if tls_idset is None: + tls_idset = util.ForkAwareLocal(), ProcessLocalSet() + BaseProxy._address_to_local[token.address] = tls_idset + finally: + BaseProxy._mutex.release() + + # self._tls is used to record the connection used by this + # thread to communicate with the manager at token.address + self._tls = tls_idset[0] + + # self._idset is used to record the identities of all shared + # objects for which the current process owns references and + # which are in the manager at token.address + self._idset = tls_idset[1] + + self._token = token + self._id = self._token.id + self._manager = manager + self._serializer = serializer + self._Client = listener_client[serializer][1] + + if authkey is not None: + self._authkey = AuthenticationString(authkey) + elif self._manager is not None: + self._authkey = self._manager._authkey + else: + self._authkey = current_process().get_authkey() + + if incref: + self._incref() + + util.register_after_fork(self, BaseProxy._after_fork) + + def _connect(self): + util.debug('making connection to manager') + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'accept_connection', (name,)) + self._tls.connection = conn + + def _callmethod(self, methodname, args=(), kwds={}): + ''' + Try to call a method of the referrent and return a copy of the result + ''' + try: + conn = self._tls.connection + except AttributeError: + util.debug('thread %r does not own a connection', + threading.current_thread().get_name()) + self._connect() + conn = self._tls.connection + + conn.send((self._id, methodname, args, kwds)) + kind, result = conn.recv() + + if kind == '#RETURN': + return result + elif kind == '#PROXY': + exposed, token = result + proxytype = self._manager._registry[token.typeid][-1] + return proxytype( + token, self._serializer, manager=self._manager, + authkey=self._authkey, exposed=exposed + ) + raise convert_to_error(kind, result) + + def _getvalue(self): + ''' + Get a copy of the value of the referent + ''' + return self._callmethod('#GETVALUE') + + def _incref(self): + conn = self._Client(self._token.address, authkey=self._authkey) + dispatch(conn, None, 'incref', (self._id,)) + util.debug('INCREF %r', self._token.id) + + self._idset.add(self._id) + + state = self._manager and self._manager._state + + self._close = util.Finalize( + self, BaseProxy._decref, + args=(self._token, self._authkey, state, + self._tls, self._idset, self._Client), + exitpriority=10 + ) + + @staticmethod + def _decref(token, authkey, state, tls, idset, _Client): + idset.discard(token.id) + + # check whether manager is still alive + if state is None or state.value == State.STARTED: + # tell manager this process no longer cares about referent + try: + util.debug('DECREF %r', token.id) + conn = _Client(token.address, authkey=authkey) + dispatch(conn, None, 'decref', (token.id,)) + except Exception, e: + util.debug('... decref failed %s', e) + + else: + util.debug('DECREF %r -- manager already shutdown', token.id) + + # check whether we can close this thread's connection because + # the process owns no more references to objects for this manager + if not idset and hasattr(tls, 'connection'): + util.debug('thread %r has no more proxies so closing conn', + threading.current_thread().get_name()) + tls.connection.close() + del tls.connection + + def _after_fork(self): + self._manager = None + try: + self._incref() + except Exception, e: + # the proxy may just be for a manager which has shutdown + util.info('incref failed: %s' % e) + + def __reduce__(self): + kwds = {} + if Popen.thread_is_spawning(): + kwds['authkey'] = self._authkey + + if getattr(self, '_isauto', False): + kwds['exposed'] = self._exposed_ + return (RebuildProxy, + (AutoProxy, self._token, self._serializer, kwds)) + else: + return (RebuildProxy, + (type(self), self._token, self._serializer, kwds)) + + def __deepcopy__(self, memo): + return self._getvalue() + + def __repr__(self): + return '<%s object, typeid %r at %s>' % \ + (type(self).__name__, self._token.typeid, '0x%x' % id(self)) + + def __str__(self): + ''' + Return representation of the referent (or a fall-back if that fails) + ''' + try: + return self._callmethod('__repr__') + except Exception: + return repr(self)[:-1] + "; '__str__()' failed>" + +# +# Function used for unpickling +# + +def RebuildProxy(func, token, serializer, kwds): + ''' + Function used for unpickling proxy objects. + + If possible the shared object is returned, or otherwise a proxy for it. + ''' + server = getattr(current_process(), '_manager_server', None) + + if server and server.address == token.address: + return server.id_to_obj[token.id][0] + else: + incref = ( + kwds.pop('incref', True) and + not getattr(current_process(), '_inheriting', False) + ) + return func(token, serializer, incref=incref, **kwds) + +# +# Functions to create proxies and proxy types +# + +def MakeProxyType(name, exposed, _cache={}): + ''' + Return an proxy type whose methods are given by `exposed` + ''' + exposed = tuple(exposed) + try: + return _cache[(name, exposed)] + except KeyError: + pass + + dic = {} + + for meth in exposed: + exec '''def %s(self, *args, **kwds): + return self._callmethod(%r, args, kwds)''' % (meth, meth) in dic + + ProxyType = type(name, (BaseProxy,), dic) + ProxyType._exposed_ = exposed + _cache[(name, exposed)] = ProxyType + return ProxyType + + +def AutoProxy(token, serializer, manager=None, authkey=None, + exposed=None, incref=True): + ''' + Return an auto-proxy for `token` + ''' + _Client = listener_client[serializer][1] + + if exposed is None: + conn = _Client(token.address, authkey=authkey) + try: + exposed = dispatch(conn, None, 'get_methods', (token,)) + finally: + conn.close() + + if authkey is None and manager is not None: + authkey = manager._authkey + if authkey is None: + authkey = current_process().get_authkey() + + ProxyType = MakeProxyType('AutoProxy[%s]' % token.typeid, exposed) + proxy = ProxyType(token, serializer, manager=manager, authkey=authkey, + incref=incref) + proxy._isauto = True + return proxy + +# +# Types/callables which we will register with SyncManager +# + +class Namespace(object): + def __init__(self, **kwds): + self.__dict__.update(kwds) + def __repr__(self): + items = self.__dict__.items() + temp = [] + for name, value in items: + if not name.startswith('_'): + temp.append('%s=%r' % (name, value)) + temp.sort() + return 'Namespace(%s)' % str.join(', ', temp) + +class Value(object): + def __init__(self, typecode, value, lock=True): + self._typecode = typecode + self._value = value + def get(self): + return self._value + def set(self, value): + self._value = value + def __repr__(self): + return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) + value = property(get, set) + +def Array(typecode, sequence, lock=True): + return array.array(typecode, sequence) + +# +# Proxy types used by SyncManager +# + +class IteratorProxy(BaseProxy): + # XXX remove methods for Py3.0 and Py2.6 + _exposed_ = ('__next__', 'next', 'send', 'throw', 'close') + def __iter__(self): + return self + def __next__(self, *args): + return self._callmethod('__next__', args) + def next(self, *args): + return self._callmethod('next', args) + def send(self, *args): + return self._callmethod('send', args) + def throw(self, *args): + return self._callmethod('throw', args) + def close(self, *args): + return self._callmethod('close', args) + + +class AcquirerProxy(BaseProxy): + _exposed_ = ('acquire', 'release') + def acquire(self, blocking=True): + return self._callmethod('acquire', (blocking,)) + def release(self): + return self._callmethod('release') + def __enter__(self): + return self._callmethod('acquire') + def __exit__(self, exc_type, exc_val, exc_tb): + return self._callmethod('release') + + +class ConditionProxy(AcquirerProxy): + # XXX will Condition.notfyAll() name be available in Py3.0? + _exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + def notify(self): + return self._callmethod('notify') + def notify_all(self): + return self._callmethod('notify_all') + +class EventProxy(BaseProxy): + # XXX will Event.isSet name be available in Py3.0? + _exposed_ = ('isSet', 'set', 'clear', 'wait') + def is_set(self): + return self._callmethod('isSet') + def set(self): + return self._callmethod('set') + def clear(self): + return self._callmethod('clear') + def wait(self, timeout=None): + return self._callmethod('wait', (timeout,)) + +class NamespaceProxy(BaseProxy): + _exposed_ = ('__getattribute__', '__setattr__', '__delattr__') + def __getattr__(self, key): + if key[0] == '_': + return object.__getattribute__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__getattribute__', (key,)) + def __setattr__(self, key, value): + if key[0] == '_': + return object.__setattr__(self, key, value) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__setattr__', (key, value)) + def __delattr__(self, key): + if key[0] == '_': + return object.__delattr__(self, key) + callmethod = object.__getattribute__(self, '_callmethod') + return callmethod('__delattr__', (key,)) + + +class ValueProxy(BaseProxy): + _exposed_ = ('get', 'set') + def get(self): + return self._callmethod('get') + def set(self, value): + return self._callmethod('set', (value,)) + value = property(get, set) + + +BaseListProxy = MakeProxyType('BaseListProxy', ( + '__add__', '__contains__', '__delitem__', '__delslice__', + '__getitem__', '__getslice__', '__len__', '__mul__', + '__reversed__', '__rmul__', '__setitem__', '__setslice__', + 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', + 'reverse', 'sort', '__imul__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 +class ListProxy(BaseListProxy): + def __iadd__(self, value): + self._callmethod('extend', (value,)) + return self + def __imul__(self, value): + self._callmethod('__imul__', (value,)) + return self + + +DictProxy = MakeProxyType('DictProxy', ( + '__contains__', '__delitem__', '__getitem__', '__len__', + '__setitem__', 'clear', 'copy', 'get', 'has_key', 'items', + 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values' + )) + + +ArrayProxy = MakeProxyType('ArrayProxy', ( + '__len__', '__getitem__', '__setitem__', '__getslice__', '__setslice__' + )) # XXX __getslice__ and __setslice__ unneeded in Py3.0 + + +PoolProxy = MakeProxyType('PoolProxy', ( + 'apply', 'apply_async', 'close', 'imap', 'imap_unordered', 'join', + 'map', 'map_async', 'terminate' + )) +PoolProxy._method_to_typeid_ = { + 'apply_async': 'AsyncResult', + 'map_async': 'AsyncResult', + 'imap': 'Iterator', + 'imap_unordered': 'Iterator' + } + +# +# Definition of SyncManager +# + +class SyncManager(BaseManager): + ''' + Subclass of `BaseManager` which supports a number of shared object types. + + The types registered are those intended for the synchronization + of threads, plus `dict`, `list` and `Namespace`. + + The `multiprocessing.Manager()` function creates started instances of + this class. + ''' + +SyncManager.register('Queue', Queue.Queue) +SyncManager.register('JoinableQueue', Queue.Queue) +SyncManager.register('Event', threading.Event, EventProxy) +SyncManager.register('Lock', threading.Lock, AcquirerProxy) +SyncManager.register('RLock', threading.RLock, AcquirerProxy) +SyncManager.register('Semaphore', threading.Semaphore, AcquirerProxy) +SyncManager.register('BoundedSemaphore', threading.BoundedSemaphore, + AcquirerProxy) +SyncManager.register('Condition', threading.Condition, ConditionProxy) +SyncManager.register('Pool', Pool, PoolProxy) +SyncManager.register('list', list, ListProxy) +SyncManager.register('dict', dict, DictProxy) +SyncManager.register('Value', Value, ValueProxy) +SyncManager.register('Array', Array, ArrayProxy) +SyncManager.register('Namespace', Namespace, NamespaceProxy) + +# types returned by methods of PoolProxy +SyncManager.register('Iterator', proxytype=IteratorProxy, create_method=False) +SyncManager.register('AsyncResult', create_method=False) Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py Sun Jun 15 03:02:00 2008 @@ -1,596 +1,596 @@ -# -# Module providing the `Pool` class for managing a process pool -# -# multiprocessing/pool.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Pool'] - -# -# Imports -# - -import threading -import Queue -import itertools -import collections -import time - -from multiprocessing import Process, cpu_count, TimeoutError -from multiprocessing.util import Finalize, debug - -# -# Constants representing the state of a pool -# - -RUN = 0 -CLOSE = 1 -TERMINATE = 2 - -# -# Miscellaneous -# - -job_counter = itertools.count() - -def mapstar(args): - return map(*args) - -# -# Code run by worker processes -# - -def worker(inqueue, outqueue, initializer=None, initargs=()): - put = outqueue.put - get = inqueue.get - if hasattr(inqueue, '_writer'): - inqueue._writer.close() - outqueue._reader.close() - - if initializer is not None: - initializer(*initargs) - - while 1: - try: - task = get() - except (EOFError, IOError): - debug('worker got EOFError or IOError -- exiting') - break - - if task is None: - debug('worker got sentinel -- exiting') - break - - job, i, func, args, kwds = task - try: - result = (True, func(*args, **kwds)) - except Exception, e: - result = (False, e) - put((job, i, result)) - -# -# Class representing a process pool -# - -class Pool(object): - ''' - Class which supports an async version of the `apply()` builtin - ''' - Process = Process - - def __init__(self, processes=None, initializer=None, initargs=()): - self._setup_queues() - self._taskqueue = Queue.Queue() - self._cache = {} - self._state = RUN - - if processes is None: - try: - processes = cpu_count() - except NotImplementedError: - processes = 1 - - self._pool = [] - for i in range(processes): - w = self.Process( - target=worker, - args=(self._inqueue, self._outqueue, initializer, initargs) - ) - self._pool.append(w) - w.set_name(w.get_name().replace('Process', 'PoolWorker')) - w.set_daemon(True) - w.start() - - self._task_handler = threading.Thread( - target=Pool._handle_tasks, - args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) - ) - self._task_handler.set_daemon(True) - self._task_handler._state = RUN - self._task_handler.start() - - self._result_handler = threading.Thread( - target=Pool._handle_results, - args=(self._outqueue, self._quick_get, self._cache) - ) - self._result_handler.set_daemon(True) - self._result_handler._state = RUN - self._result_handler.start() - - self._terminate = Finalize( - self, self._terminate_pool, - args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, - self._task_handler, self._result_handler, self._cache), - exitpriority=15 - ) - - def _setup_queues(self): - from .queues import SimpleQueue - self._inqueue = SimpleQueue() - self._outqueue = SimpleQueue() - self._quick_put = self._inqueue._writer.send - self._quick_get = self._outqueue._reader.recv - - def apply(self, func, args=(), kwds={}): - ''' - Equivalent of `apply()` builtin - ''' - assert self._state == RUN - return self.apply_async(func, args, kwds).get() - - def map(self, func, iterable, chunksize=None): - ''' - Equivalent of `map()` builtin - ''' - assert self._state == RUN - return self.map_async(func, iterable, chunksize).get() - - def imap(self, func, iterable, chunksize=1): - ''' - Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` - ''' - assert self._state == RUN - if chunksize == 1: - result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) - return result - else: - assert chunksize > 1 - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = IMapIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) - return (item for chunk in result for item in chunk) - - def imap_unordered(self, func, iterable, chunksize=1): - ''' - Like `imap()` method but ordering of results is arbitrary - ''' - assert self._state == RUN - if chunksize == 1: - result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, func, (x,), {}) - for i, x in enumerate(iterable)), result._set_length)) - return result - else: - assert chunksize > 1 - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = IMapUnorderedIterator(self._cache) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), result._set_length)) - return (item for chunk in result for item in chunk) - - def apply_async(self, func, args=(), kwds={}, callback=None): - ''' - Asynchronous equivalent of `apply()` builtin - ''' - assert self._state == RUN - result = ApplyResult(self._cache, callback) - self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) - return result - - def map_async(self, func, iterable, chunksize=None, callback=None): - ''' - Asynchronous equivalent of `map()` builtin - ''' - assert self._state == RUN - if not hasattr(iterable, '__len__'): - iterable = list(iterable) - - if chunksize is None: - chunksize, extra = divmod(len(iterable), len(self._pool) * 4) - if extra: - chunksize += 1 - - task_batches = Pool._get_tasks(func, iterable, chunksize) - result = MapResult(self._cache, chunksize, len(iterable), callback) - self._taskqueue.put((((result._job, i, mapstar, (x,), {}) - for i, x in enumerate(task_batches)), None)) - return result - - @staticmethod - def _handle_tasks(taskqueue, put, outqueue, pool): - thread = threading.current_thread() - - for taskseq, set_length in iter(taskqueue.get, None): - i = -1 - for i, task in enumerate(taskseq): - if thread._state: - debug('task handler found thread._state != RUN') - break - try: - put(task) - except IOError: - debug('could not put task on queue') - break - else: - if set_length: - debug('doing set_length()') - set_length(i+1) - continue - break - else: - debug('task handler got sentinel') - - - try: - # tell result handler to finish when cache is empty - debug('task handler sending sentinel to result handler') - outqueue.put(None) - - # tell workers there is no more work - debug('task handler sending sentinel to workers') - for p in pool: - put(None) - except IOError: - debug('task handler got IOError when sending sentinels') - - debug('task handler exiting') - - @staticmethod - def _handle_results(outqueue, get, cache): - thread = threading.current_thread() - - while 1: - try: - task = get() - except (IOError, EOFError): - debug('result handler got EOFError/IOError -- exiting') - return - - if thread._state: - assert thread._state == TERMINATE - debug('result handler found thread._state=TERMINATE') - break - - if task is None: - debug('result handler got sentinel') - break - - job, i, obj = task - try: - cache[job]._set(i, obj) - except KeyError: - pass - - while cache and thread._state != TERMINATE: - try: - task = get() - except (IOError, EOFError): - debug('result handler got EOFError/IOError -- exiting') - return - - if task is None: - debug('result handler ignoring extra sentinel') - continue - job, i, obj = task - try: - cache[job]._set(i, obj) - except KeyError: - pass - - if hasattr(outqueue, '_reader'): - debug('ensuring that outqueue is not full') - # If we don't make room available in outqueue then - # attempts to add the sentinel (None) to outqueue may - # block. There is guaranteed to be no more than 2 sentinels. - try: - for i in range(10): - if not outqueue._reader.poll(): - break - get() - except (IOError, EOFError): - pass - - debug('result handler exiting: len(cache)=%s, thread._state=%s', - len(cache), thread._state) - - @staticmethod - def _get_tasks(func, it, size): - it = iter(it) - while 1: - x = tuple(itertools.islice(it, size)) - if not x: - return - yield (func, x) - - def __reduce__(self): - raise NotImplementedError( - 'pool objects cannot be passed between processes or pickled' - ) - - def close(self): - debug('closing pool') - if self._state == RUN: - self._state = CLOSE - self._taskqueue.put(None) - - def terminate(self): - debug('terminating pool') - self._state = TERMINATE - self._terminate() - - def join(self): - debug('joining pool') - assert self._state in (CLOSE, TERMINATE) - self._task_handler.join() - self._result_handler.join() - for p in self._pool: - p.join() - - @staticmethod - def _help_stuff_finish(inqueue, task_handler, size): - # task_handler may be blocked trying to put items on inqueue - debug('removing tasks from inqueue until task handler finished') - inqueue._rlock.acquire() - while task_handler.is_alive() and inqueue._reader.poll(): - inqueue._reader.recv() - time.sleep(0) - - @classmethod - def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, - task_handler, result_handler, cache): - # this is guaranteed to only be called once - debug('finalizing pool') - - task_handler._state = TERMINATE - taskqueue.put(None) # sentinel - - debug('helping task handler/workers to finish') - cls._help_stuff_finish(inqueue, task_handler, len(pool)) - - assert result_handler.is_alive() or len(cache) == 0 - - result_handler._state = TERMINATE - outqueue.put(None) # sentinel - - if pool and hasattr(pool[0], 'terminate'): - debug('terminating workers') - for p in pool: - p.terminate() - - debug('joining task handler') - task_handler.join(1e100) - - debug('joining result handler') - result_handler.join(1e100) - - if pool and hasattr(pool[0], 'terminate'): - debug('joining pool workers') - for p in pool: - p.join() - -# -# Class whose instances are returned by `Pool.apply_async()` -# - -class ApplyResult(object): - - def __init__(self, cache, callback): - self._cond = threading.Condition(threading.Lock()) - self._job = job_counter.next() - self._cache = cache - self._ready = False - self._callback = callback - cache[self._job] = self - - def ready(self): - return self._ready - - def successful(self): - assert self._ready - return self._success - - def wait(self, timeout=None): - self._cond.acquire() - try: - if not self._ready: - self._cond.wait(timeout) - finally: - self._cond.release() - - def get(self, timeout=None): - self.wait(timeout) - if not self._ready: - raise TimeoutError - if self._success: - return self._value - else: - raise self._value - - def _set(self, i, obj): - self._success, self._value = obj - if self._callback and self._success: - self._callback(self._value) - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - del self._cache[self._job] - -# -# Class whose instances are returned by `Pool.map_async()` -# - -class MapResult(ApplyResult): - - def __init__(self, cache, chunksize, length, callback): - ApplyResult.__init__(self, cache, callback) - self._success = True - self._value = [None] * length - self._chunksize = chunksize - if chunksize <= 0: - self._number_left = 0 - self._ready = True - else: - self._number_left = length//chunksize + bool(length % chunksize) - - def _set(self, i, success_result): - success, result = success_result - if success: - self._value[i*self._chunksize:(i+1)*self._chunksize] = result - self._number_left -= 1 - if self._number_left == 0: - if self._callback: - self._callback(self._value) - del self._cache[self._job] - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - - else: - self._success = False - self._value = result - del self._cache[self._job] - self._cond.acquire() - try: - self._ready = True - self._cond.notify() - finally: - self._cond.release() - -# -# Class whose instances are returned by `Pool.imap()` -# - -class IMapIterator(object): - - def __init__(self, cache): - self._cond = threading.Condition(threading.Lock()) - self._job = job_counter.next() - self._cache = cache - self._items = collections.deque() - self._index = 0 - self._length = None - self._unsorted = {} - cache[self._job] = self - - def __iter__(self): - return self - - def next(self, timeout=None): - self._cond.acquire() - try: - try: - item = self._items.popleft() - except IndexError: - if self._index == self._length: - raise StopIteration - self._cond.wait(timeout) - try: - item = self._items.popleft() - except IndexError: - if self._index == self._length: - raise StopIteration - raise TimeoutError - finally: - self._cond.release() - - success, value = item - if success: - return value - raise value - - __next__ = next # XXX - - def _set(self, i, obj): - self._cond.acquire() - try: - if self._index == i: - self._items.append(obj) - self._index += 1 - while self._index in self._unsorted: - obj = self._unsorted.pop(self._index) - self._items.append(obj) - self._index += 1 - self._cond.notify() - else: - self._unsorted[i] = obj - - if self._index == self._length: - del self._cache[self._job] - finally: - self._cond.release() - - def _set_length(self, length): - self._cond.acquire() - try: - self._length = length - if self._index == self._length: - self._cond.notify() - del self._cache[self._job] - finally: - self._cond.release() - -# -# Class whose instances are returned by `Pool.imap_unordered()` -# - -class IMapUnorderedIterator(IMapIterator): - - def _set(self, i, obj): - self._cond.acquire() - try: - self._items.append(obj) - self._index += 1 - self._cond.notify() - if self._index == self._length: - del self._cache[self._job] - finally: - self._cond.release() - -# -# -# - -class ThreadPool(Pool): - - from .dummy import Process - - def __init__(self, processes=None, initializer=None, initargs=()): - Pool.__init__(self, processes, initializer, initargs) - - def _setup_queues(self): - self._inqueue = Queue.Queue() - self._outqueue = Queue.Queue() - self._quick_put = self._inqueue.put - self._quick_get = self._outqueue.get - - @staticmethod - def _help_stuff_finish(inqueue, task_handler, size): - # put sentinels at head of inqueue to make workers finish - inqueue.not_empty.acquire() - try: - inqueue.queue.clear() - inqueue.queue.extend([None] * size) - inqueue.not_empty.notify_all() - finally: - inqueue.not_empty.release() +# +# Module providing the `Pool` class for managing a process pool +# +# multiprocessing/pool.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Pool'] + +# +# Imports +# + +import threading +import Queue +import itertools +import collections +import time + +from multiprocessing import Process, cpu_count, TimeoutError +from multiprocessing.util import Finalize, debug + +# +# Constants representing the state of a pool +# + +RUN = 0 +CLOSE = 1 +TERMINATE = 2 + +# +# Miscellaneous +# + +job_counter = itertools.count() + +def mapstar(args): + return map(*args) + +# +# Code run by worker processes +# + +def worker(inqueue, outqueue, initializer=None, initargs=()): + put = outqueue.put + get = inqueue.get + if hasattr(inqueue, '_writer'): + inqueue._writer.close() + outqueue._reader.close() + + if initializer is not None: + initializer(*initargs) + + while 1: + try: + task = get() + except (EOFError, IOError): + debug('worker got EOFError or IOError -- exiting') + break + + if task is None: + debug('worker got sentinel -- exiting') + break + + job, i, func, args, kwds = task + try: + result = (True, func(*args, **kwds)) + except Exception, e: + result = (False, e) + put((job, i, result)) + +# +# Class representing a process pool +# + +class Pool(object): + ''' + Class which supports an async version of the `apply()` builtin + ''' + Process = Process + + def __init__(self, processes=None, initializer=None, initargs=()): + self._setup_queues() + self._taskqueue = Queue.Queue() + self._cache = {} + self._state = RUN + + if processes is None: + try: + processes = cpu_count() + except NotImplementedError: + processes = 1 + + self._pool = [] + for i in range(processes): + w = self.Process( + target=worker, + args=(self._inqueue, self._outqueue, initializer, initargs) + ) + self._pool.append(w) + w.set_name(w.get_name().replace('Process', 'PoolWorker')) + w.set_daemon(True) + w.start() + + self._task_handler = threading.Thread( + target=Pool._handle_tasks, + args=(self._taskqueue, self._quick_put, self._outqueue, self._pool) + ) + self._task_handler.set_daemon(True) + self._task_handler._state = RUN + self._task_handler.start() + + self._result_handler = threading.Thread( + target=Pool._handle_results, + args=(self._outqueue, self._quick_get, self._cache) + ) + self._result_handler.set_daemon(True) + self._result_handler._state = RUN + self._result_handler.start() + + self._terminate = Finalize( + self, self._terminate_pool, + args=(self._taskqueue, self._inqueue, self._outqueue, self._pool, + self._task_handler, self._result_handler, self._cache), + exitpriority=15 + ) + + def _setup_queues(self): + from .queues import SimpleQueue + self._inqueue = SimpleQueue() + self._outqueue = SimpleQueue() + self._quick_put = self._inqueue._writer.send + self._quick_get = self._outqueue._reader.recv + + def apply(self, func, args=(), kwds={}): + ''' + Equivalent of `apply()` builtin + ''' + assert self._state == RUN + return self.apply_async(func, args, kwds).get() + + def map(self, func, iterable, chunksize=None): + ''' + Equivalent of `map()` builtin + ''' + assert self._state == RUN + return self.map_async(func, iterable, chunksize).get() + + def imap(self, func, iterable, chunksize=1): + ''' + Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def imap_unordered(self, func, iterable, chunksize=1): + ''' + Like `imap()` method but ordering of results is arbitrary + ''' + assert self._state == RUN + if chunksize == 1: + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, func, (x,), {}) + for i, x in enumerate(iterable)), result._set_length)) + return result + else: + assert chunksize > 1 + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = IMapUnorderedIterator(self._cache) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), result._set_length)) + return (item for chunk in result for item in chunk) + + def apply_async(self, func, args=(), kwds={}, callback=None): + ''' + Asynchronous equivalent of `apply()` builtin + ''' + assert self._state == RUN + result = ApplyResult(self._cache, callback) + self._taskqueue.put(([(result._job, None, func, args, kwds)], None)) + return result + + def map_async(self, func, iterable, chunksize=None, callback=None): + ''' + Asynchronous equivalent of `map()` builtin + ''' + assert self._state == RUN + if not hasattr(iterable, '__len__'): + iterable = list(iterable) + + if chunksize is None: + chunksize, extra = divmod(len(iterable), len(self._pool) * 4) + if extra: + chunksize += 1 + + task_batches = Pool._get_tasks(func, iterable, chunksize) + result = MapResult(self._cache, chunksize, len(iterable), callback) + self._taskqueue.put((((result._job, i, mapstar, (x,), {}) + for i, x in enumerate(task_batches)), None)) + return result + + @staticmethod + def _handle_tasks(taskqueue, put, outqueue, pool): + thread = threading.current_thread() + + for taskseq, set_length in iter(taskqueue.get, None): + i = -1 + for i, task in enumerate(taskseq): + if thread._state: + debug('task handler found thread._state != RUN') + break + try: + put(task) + except IOError: + debug('could not put task on queue') + break + else: + if set_length: + debug('doing set_length()') + set_length(i+1) + continue + break + else: + debug('task handler got sentinel') + + + try: + # tell result handler to finish when cache is empty + debug('task handler sending sentinel to result handler') + outqueue.put(None) + + # tell workers there is no more work + debug('task handler sending sentinel to workers') + for p in pool: + put(None) + except IOError: + debug('task handler got IOError when sending sentinels') + + debug('task handler exiting') + + @staticmethod + def _handle_results(outqueue, get, cache): + thread = threading.current_thread() + + while 1: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if thread._state: + assert thread._state == TERMINATE + debug('result handler found thread._state=TERMINATE') + break + + if task is None: + debug('result handler got sentinel') + break + + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + while cache and thread._state != TERMINATE: + try: + task = get() + except (IOError, EOFError): + debug('result handler got EOFError/IOError -- exiting') + return + + if task is None: + debug('result handler ignoring extra sentinel') + continue + job, i, obj = task + try: + cache[job]._set(i, obj) + except KeyError: + pass + + if hasattr(outqueue, '_reader'): + debug('ensuring that outqueue is not full') + # If we don't make room available in outqueue then + # attempts to add the sentinel (None) to outqueue may + # block. There is guaranteed to be no more than 2 sentinels. + try: + for i in range(10): + if not outqueue._reader.poll(): + break + get() + except (IOError, EOFError): + pass + + debug('result handler exiting: len(cache)=%s, thread._state=%s', + len(cache), thread._state) + + @staticmethod + def _get_tasks(func, it, size): + it = iter(it) + while 1: + x = tuple(itertools.islice(it, size)) + if not x: + return + yield (func, x) + + def __reduce__(self): + raise NotImplementedError( + 'pool objects cannot be passed between processes or pickled' + ) + + def close(self): + debug('closing pool') + if self._state == RUN: + self._state = CLOSE + self._taskqueue.put(None) + + def terminate(self): + debug('terminating pool') + self._state = TERMINATE + self._terminate() + + def join(self): + debug('joining pool') + assert self._state in (CLOSE, TERMINATE) + self._task_handler.join() + self._result_handler.join() + for p in self._pool: + p.join() + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # task_handler may be blocked trying to put items on inqueue + debug('removing tasks from inqueue until task handler finished') + inqueue._rlock.acquire() + while task_handler.is_alive() and inqueue._reader.poll(): + inqueue._reader.recv() + time.sleep(0) + + @classmethod + def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, + task_handler, result_handler, cache): + # this is guaranteed to only be called once + debug('finalizing pool') + + task_handler._state = TERMINATE + taskqueue.put(None) # sentinel + + debug('helping task handler/workers to finish') + cls._help_stuff_finish(inqueue, task_handler, len(pool)) + + assert result_handler.is_alive() or len(cache) == 0 + + result_handler._state = TERMINATE + outqueue.put(None) # sentinel + + if pool and hasattr(pool[0], 'terminate'): + debug('terminating workers') + for p in pool: + p.terminate() + + debug('joining task handler') + task_handler.join(1e100) + + debug('joining result handler') + result_handler.join(1e100) + + if pool and hasattr(pool[0], 'terminate'): + debug('joining pool workers') + for p in pool: + p.join() + +# +# Class whose instances are returned by `Pool.apply_async()` +# + +class ApplyResult(object): + + def __init__(self, cache, callback): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._ready = False + self._callback = callback + cache[self._job] = self + + def ready(self): + return self._ready + + def successful(self): + assert self._ready + return self._success + + def wait(self, timeout=None): + self._cond.acquire() + try: + if not self._ready: + self._cond.wait(timeout) + finally: + self._cond.release() + + def get(self, timeout=None): + self.wait(timeout) + if not self._ready: + raise TimeoutError + if self._success: + return self._value + else: + raise self._value + + def _set(self, i, obj): + self._success, self._value = obj + if self._callback and self._success: + self._callback(self._value) + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + del self._cache[self._job] + +# +# Class whose instances are returned by `Pool.map_async()` +# + +class MapResult(ApplyResult): + + def __init__(self, cache, chunksize, length, callback): + ApplyResult.__init__(self, cache, callback) + self._success = True + self._value = [None] * length + self._chunksize = chunksize + if chunksize <= 0: + self._number_left = 0 + self._ready = True + else: + self._number_left = length//chunksize + bool(length % chunksize) + + def _set(self, i, success_result): + success, result = success_result + if success: + self._value[i*self._chunksize:(i+1)*self._chunksize] = result + self._number_left -= 1 + if self._number_left == 0: + if self._callback: + self._callback(self._value) + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + + else: + self._success = False + self._value = result + del self._cache[self._job] + self._cond.acquire() + try: + self._ready = True + self._cond.notify() + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap()` +# + +class IMapIterator(object): + + def __init__(self, cache): + self._cond = threading.Condition(threading.Lock()) + self._job = job_counter.next() + self._cache = cache + self._items = collections.deque() + self._index = 0 + self._length = None + self._unsorted = {} + cache[self._job] = self + + def __iter__(self): + return self + + def next(self, timeout=None): + self._cond.acquire() + try: + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + self._cond.wait(timeout) + try: + item = self._items.popleft() + except IndexError: + if self._index == self._length: + raise StopIteration + raise TimeoutError + finally: + self._cond.release() + + success, value = item + if success: + return value + raise value + + __next__ = next # XXX + + def _set(self, i, obj): + self._cond.acquire() + try: + if self._index == i: + self._items.append(obj) + self._index += 1 + while self._index in self._unsorted: + obj = self._unsorted.pop(self._index) + self._items.append(obj) + self._index += 1 + self._cond.notify() + else: + self._unsorted[i] = obj + + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + + def _set_length(self, length): + self._cond.acquire() + try: + self._length = length + if self._index == self._length: + self._cond.notify() + del self._cache[self._job] + finally: + self._cond.release() + +# +# Class whose instances are returned by `Pool.imap_unordered()` +# + +class IMapUnorderedIterator(IMapIterator): + + def _set(self, i, obj): + self._cond.acquire() + try: + self._items.append(obj) + self._index += 1 + self._cond.notify() + if self._index == self._length: + del self._cache[self._job] + finally: + self._cond.release() + +# +# +# + +class ThreadPool(Pool): + + from .dummy import Process + + def __init__(self, processes=None, initializer=None, initargs=()): + Pool.__init__(self, processes, initializer, initargs) + + def _setup_queues(self): + self._inqueue = Queue.Queue() + self._outqueue = Queue.Queue() + self._quick_put = self._inqueue.put + self._quick_get = self._outqueue.get + + @staticmethod + def _help_stuff_finish(inqueue, task_handler, size): + # put sentinels at head of inqueue to make workers finish + inqueue.not_empty.acquire() + try: + inqueue.queue.clear() + inqueue.queue.extend([None] * size) + inqueue.not_empty.notify_all() + finally: + inqueue.not_empty.release() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/process.py Sun Jun 15 03:02:00 2008 @@ -1,302 +1,302 @@ -# -# Module providing the `Process` class which emulates `threading.Thread` -# -# multiprocessing/process.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Process', 'current_process', 'active_children'] - -# -# Imports -# - -import os -import sys -import signal -import itertools - -# -# -# - -try: - ORIGINAL_DIR = os.path.abspath(os.getcwd()) -except OSError: - ORIGINAL_DIR = None - -try: - bytes -except NameError: - bytes = str # XXX not needed in Py2.6 and Py3.0 - -# -# Public functions -# - -def current_process(): - ''' - Return process object representing the current process - ''' - return _current_process - -def active_children(): - ''' - Return list of process objects corresponding to live child processes - ''' - _cleanup() - return list(_current_process._children) - -# -# -# - -def _cleanup(): - # check for processes which have finished - for p in list(_current_process._children): - if p._popen.poll() is not None: - _current_process._children.discard(p) - -# -# The `Process` class -# - -class Process(object): - ''' - Process objects represent activity that is run in a separate process - - The class is analagous to `threading.Thread` - ''' - _Popen = None - - def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): - assert group is None, 'group argument must be None for now' - count = _current_process._counter.next() - self._identity = _current_process._identity + (count,) - self._authkey = _current_process._authkey - self._daemonic = _current_process._daemonic - self._tempdir = _current_process._tempdir - self._parent_pid = os.getpid() - self._popen = None - self._target = target - self._args = tuple(args) - self._kwargs = dict(kwargs) - self._name = name or type(self).__name__ + '-' + \ - ':'.join(str(i) for i in self._identity) - - def run(self): - ''' - Method to be run in sub-process; can be overridden in sub-class - ''' - if self._target: - self._target(*self._args, **self._kwargs) - - def start(self): - ''' - Start child process - ''' - assert self._popen is None, 'cannot start a process twice' - assert self._parent_pid == os.getpid(), \ - 'can only start a process object created by current process' - assert not _current_process._daemonic, \ - 'daemonic processes are not allowed to have children' - _cleanup() - if self._Popen is not None: - Popen = self._Popen - else: - from .forking import Popen - self._popen = Popen(self) - _current_process._children.add(self) - - def terminate(self): - ''' - Terminate process; sends SIGTERM signal or uses TerminateProcess() - ''' - self._popen.terminate() - - def join(self, timeout=None): - ''' - Wait until child process terminates - ''' - assert self._parent_pid == os.getpid(), 'can only join a child process' - assert self._popen is not None, 'can only join a started process' - res = self._popen.wait(timeout) - if res is not None: - _current_process._children.discard(self) - - def is_alive(self): - ''' - Return whether process is alive - ''' - if self is _current_process: - return True - assert self._parent_pid == os.getpid(), 'can only test a child process' - if self._popen is None: - return False - self._popen.poll() - return self._popen.returncode is None - - def get_name(self): - ''' - Return name of process - ''' - return self._name - - def set_name(self, name): - ''' - Set name of process - ''' - assert isinstance(name, str), 'name must be a string' - self._name = name - - def is_daemon(self): - ''' - Return whether process is a daemon - ''' - return self._daemonic - - def set_daemon(self, daemonic): - ''' - Set whether process is a daemon - ''' - assert self._popen is None, 'process has already started' - self._daemonic = daemonic - - def get_authkey(self): - ''' - Return authorization key of process - ''' - return self._authkey - - def set_authkey(self, authkey): - ''' - Set authorization key of process - ''' - self._authkey = AuthenticationString(authkey) - - def get_exitcode(self): - ''' - Return exit code of process or `None` if it has yet to stop - ''' - if self._popen is None: - return self._popen - return self._popen.poll() - - def get_ident(self): - ''' - Return indentifier (PID) of process or `None` if it has yet to start - ''' - if self is _current_process: - return os.getpid() - else: - return self._popen and self._popen.pid - - pid = property(get_ident) - - def __repr__(self): - if self is _current_process: - status = 'started' - elif self._parent_pid != os.getpid(): - status = 'unknown' - elif self._popen is None: - status = 'initial' - else: - if self._popen.poll() is not None: - status = self.get_exitcode() - else: - status = 'started' - - if type(status) is int: - if status == 0: - status = 'stopped' - else: - status = 'stopped[%s]' % _exitcode_to_name.get(status, status) - - return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, - status, self._daemonic and ' daemon' or '') - - ## - - def _bootstrap(self): - from . import util - global _current_process - - try: - self._children = set() - self._counter = itertools.count(1) - try: - os.close(sys.stdin.fileno()) - except (OSError, ValueError): - pass - _current_process = self - util._finalizer_registry.clear() - util._run_after_forkers() - util.info('child process calling self.run()') - try: - self.run() - exitcode = 0 - finally: - util._exit_function() - except SystemExit, e: - if not e.args: - exitcode = 1 - elif type(e.args[0]) is int: - exitcode = e.args[0] - else: - sys.stderr.write(e.args[0] + '\n') - sys.stderr.flush() - exitcode = 1 - except: - exitcode = 1 - import traceback - sys.stderr.write('Process %s:\n' % self.get_name()) - sys.stderr.flush() - traceback.print_exc() - - util.info('process exiting with exitcode %d' % exitcode) - return exitcode - -# -# We subclass bytes to avoid accidental transmission of auth keys over network -# - -class AuthenticationString(bytes): - def __reduce__(self): - from .forking import Popen - if not Popen.thread_is_spawning(): - raise TypeError( - 'Pickling an AuthenticationString object is ' - 'disallowed for security reasons' - ) - return AuthenticationString, (bytes(self),) - -# -# Create object representing the main process -# - -class _MainProcess(Process): - - def __init__(self): - self._identity = () - self._daemonic = False - self._name = 'MainProcess' - self._parent_pid = None - self._popen = None - self._counter = itertools.count(1) - self._children = set() - self._authkey = AuthenticationString(os.urandom(32)) - self._tempdir = None - -_current_process = _MainProcess() -del _MainProcess - -# -# Give names to some return codes -# - -_exitcode_to_name = {} - -for name, signum in signal.__dict__.items(): - if name[:3]=='SIG' and '_' not in name: - _exitcode_to_name[-signum] = name +# +# Module providing the `Process` class which emulates `threading.Thread` +# +# multiprocessing/process.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Process', 'current_process', 'active_children'] + +# +# Imports +# + +import os +import sys +import signal +import itertools + +# +# +# + +try: + ORIGINAL_DIR = os.path.abspath(os.getcwd()) +except OSError: + ORIGINAL_DIR = None + +try: + bytes +except NameError: + bytes = str # XXX not needed in Py2.6 and Py3.0 + +# +# Public functions +# + +def current_process(): + ''' + Return process object representing the current process + ''' + return _current_process + +def active_children(): + ''' + Return list of process objects corresponding to live child processes + ''' + _cleanup() + return list(_current_process._children) + +# +# +# + +def _cleanup(): + # check for processes which have finished + for p in list(_current_process._children): + if p._popen.poll() is not None: + _current_process._children.discard(p) + +# +# The `Process` class +# + +class Process(object): + ''' + Process objects represent activity that is run in a separate process + + The class is analagous to `threading.Thread` + ''' + _Popen = None + + def __init__(self, group=None, target=None, name=None, args=(), kwargs={}): + assert group is None, 'group argument must be None for now' + count = _current_process._counter.next() + self._identity = _current_process._identity + (count,) + self._authkey = _current_process._authkey + self._daemonic = _current_process._daemonic + self._tempdir = _current_process._tempdir + self._parent_pid = os.getpid() + self._popen = None + self._target = target + self._args = tuple(args) + self._kwargs = dict(kwargs) + self._name = name or type(self).__name__ + '-' + \ + ':'.join(str(i) for i in self._identity) + + def run(self): + ''' + Method to be run in sub-process; can be overridden in sub-class + ''' + if self._target: + self._target(*self._args, **self._kwargs) + + def start(self): + ''' + Start child process + ''' + assert self._popen is None, 'cannot start a process twice' + assert self._parent_pid == os.getpid(), \ + 'can only start a process object created by current process' + assert not _current_process._daemonic, \ + 'daemonic processes are not allowed to have children' + _cleanup() + if self._Popen is not None: + Popen = self._Popen + else: + from .forking import Popen + self._popen = Popen(self) + _current_process._children.add(self) + + def terminate(self): + ''' + Terminate process; sends SIGTERM signal or uses TerminateProcess() + ''' + self._popen.terminate() + + def join(self, timeout=None): + ''' + Wait until child process terminates + ''' + assert self._parent_pid == os.getpid(), 'can only join a child process' + assert self._popen is not None, 'can only join a started process' + res = self._popen.wait(timeout) + if res is not None: + _current_process._children.discard(self) + + def is_alive(self): + ''' + Return whether process is alive + ''' + if self is _current_process: + return True + assert self._parent_pid == os.getpid(), 'can only test a child process' + if self._popen is None: + return False + self._popen.poll() + return self._popen.returncode is None + + def get_name(self): + ''' + Return name of process + ''' + return self._name + + def set_name(self, name): + ''' + Set name of process + ''' + assert isinstance(name, str), 'name must be a string' + self._name = name + + def is_daemon(self): + ''' + Return whether process is a daemon + ''' + return self._daemonic + + def set_daemon(self, daemonic): + ''' + Set whether process is a daemon + ''' + assert self._popen is None, 'process has already started' + self._daemonic = daemonic + + def get_authkey(self): + ''' + Return authorization key of process + ''' + return self._authkey + + def set_authkey(self, authkey): + ''' + Set authorization key of process + ''' + self._authkey = AuthenticationString(authkey) + + def get_exitcode(self): + ''' + Return exit code of process or `None` if it has yet to stop + ''' + if self._popen is None: + return self._popen + return self._popen.poll() + + def get_ident(self): + ''' + Return indentifier (PID) of process or `None` if it has yet to start + ''' + if self is _current_process: + return os.getpid() + else: + return self._popen and self._popen.pid + + pid = property(get_ident) + + def __repr__(self): + if self is _current_process: + status = 'started' + elif self._parent_pid != os.getpid(): + status = 'unknown' + elif self._popen is None: + status = 'initial' + else: + if self._popen.poll() is not None: + status = self.get_exitcode() + else: + status = 'started' + + if type(status) is int: + if status == 0: + status = 'stopped' + else: + status = 'stopped[%s]' % _exitcode_to_name.get(status, status) + + return '<%s(%s, %s%s)>' % (type(self).__name__, self._name, + status, self._daemonic and ' daemon' or '') + + ## + + def _bootstrap(self): + from . import util + global _current_process + + try: + self._children = set() + self._counter = itertools.count(1) + try: + os.close(sys.stdin.fileno()) + except (OSError, ValueError): + pass + _current_process = self + util._finalizer_registry.clear() + util._run_after_forkers() + util.info('child process calling self.run()') + try: + self.run() + exitcode = 0 + finally: + util._exit_function() + except SystemExit, e: + if not e.args: + exitcode = 1 + elif type(e.args[0]) is int: + exitcode = e.args[0] + else: + sys.stderr.write(e.args[0] + '\n') + sys.stderr.flush() + exitcode = 1 + except: + exitcode = 1 + import traceback + sys.stderr.write('Process %s:\n' % self.get_name()) + sys.stderr.flush() + traceback.print_exc() + + util.info('process exiting with exitcode %d' % exitcode) + return exitcode + +# +# We subclass bytes to avoid accidental transmission of auth keys over network +# + +class AuthenticationString(bytes): + def __reduce__(self): + from .forking import Popen + if not Popen.thread_is_spawning(): + raise TypeError( + 'Pickling an AuthenticationString object is ' + 'disallowed for security reasons' + ) + return AuthenticationString, (bytes(self),) + +# +# Create object representing the main process +# + +class _MainProcess(Process): + + def __init__(self): + self._identity = () + self._daemonic = False + self._name = 'MainProcess' + self._parent_pid = None + self._popen = None + self._counter = itertools.count(1) + self._children = set() + self._authkey = AuthenticationString(os.urandom(32)) + self._tempdir = None + +_current_process = _MainProcess() +del _MainProcess + +# +# Give names to some return codes +# + +_exitcode_to_name = {} + +for name, signum in signal.__dict__.items(): + if name[:3]=='SIG' and '_' not in name: + _exitcode_to_name[-signum] = name Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/queues.py Sun Jun 15 03:02:00 2008 @@ -1,356 +1,356 @@ -# -# Module implementing queues -# -# multiprocessing/queues.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = ['Queue', 'SimpleQueue'] - -import sys -import os -import threading -import collections -import time -import atexit -import weakref - -from Queue import Empty, Full -import _multiprocessing -from multiprocessing import Pipe -from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition -from multiprocessing.util import debug, info, Finalize, register_after_fork -from multiprocessing.forking import assert_spawning - -# -# Queue type using a pipe, buffer and thread -# - -class Queue(object): - - def __init__(self, maxsize=0): - if maxsize <= 0: - maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX - self._maxsize = maxsize - self._reader, self._writer = Pipe(duplex=False) - self._rlock = Lock() - self._opid = os.getpid() - if sys.platform == 'win32': - self._wlock = None - else: - self._wlock = Lock() - self._sem = BoundedSemaphore(maxsize) - - self._after_fork() - - if sys.platform != 'win32': - register_after_fork(self, Queue._after_fork) - - def __getstate__(self): - assert_spawning(self) - return (self._maxsize, self._reader, self._writer, - self._rlock, self._wlock, self._sem, self._opid) - - def __setstate__(self, state): - (self._maxsize, self._reader, self._writer, - self._rlock, self._wlock, self._sem, self._opid) = state - self._after_fork() - - def _after_fork(self): - debug('Queue._after_fork()') - self._notempty = threading.Condition(threading.Lock()) - self._buffer = collections.deque() - self._thread = None - self._jointhread = None - self._joincancelled = False - self._closed = False - self._close = None - self._send = self._writer.send - self._recv = self._reader.recv - self._poll = self._reader.poll - - def put(self, obj, block=True, timeout=None): - assert not self._closed - if not self._sem.acquire(block, timeout): - raise Full - - self._notempty.acquire() - try: - if self._thread is None: - self._start_thread() - self._buffer.append(obj) - self._notempty.notify() - finally: - self._notempty.release() - - def get(self, block=True, timeout=None): - if block and timeout is None: - self._rlock.acquire() - try: - res = self._recv() - self._sem.release() - return res - finally: - self._rlock.release() - - else: - if block: - deadline = time.time() + timeout - if not self._rlock.acquire(block, timeout): - raise Empty - try: - if not self._poll(block and (deadline-time.time()) or 0.0): - raise Empty - res = self._recv() - self._sem.release() - return res - finally: - self._rlock.release() - - def qsize(self): - # Raises NotImplementError on Mac OSX because of broken sem_getvalue() - return self._maxsize - self._sem._semlock._get_value() - - def empty(self): - return not self._poll() - - def full(self): - return self._sem._semlock._is_zero() - - def get_nowait(self): - return self.get(False) - - def put_nowait(self, obj): - return self.put(obj, False) - - def close(self): - self._closed = True - self._reader.close() - if self._close: - self._close() - - def join_thread(self): - debug('Queue.join_thread()') - assert self._closed - if self._jointhread: - self._jointhread() - - def cancel_join_thread(self): - debug('Queue.cancel_join_thread()') - self._joincancelled = True - try: - self._jointhread.cancel() - except AttributeError: - pass - - def _start_thread(self): - debug('Queue._start_thread()') - - # Start thread which transfers data from buffer to pipe - self._buffer.clear() - self._thread = threading.Thread( - target=Queue._feed, - args=(self._buffer, self._notempty, self._send, - self._wlock, self._writer.close), - name='QueueFeederThread' - ) - self._thread.set_daemon(True) - - debug('doing self._thread.start()') - self._thread.start() - debug('... done self._thread.start()') - - # On process exit we will wait for data to be flushed to pipe. - # - # However, if this process created the queue then all - # processes which use the queue will be descendants of this - # process. Therefore waiting for the queue to be flushed - # is pointless once all the child processes have been joined. - created_by_this_process = (self._opid == os.getpid()) - if not self._joincancelled and not created_by_this_process: - self._jointhread = Finalize( - self._thread, Queue._finalize_join, - [weakref.ref(self._thread)], - exitpriority=-5 - ) - - # Send sentinel to the thread queue object when garbage collected - self._close = Finalize( - self, Queue._finalize_close, - [self._buffer, self._notempty], - exitpriority=10 - ) - - @staticmethod - def _finalize_join(twr): - debug('joining queue thread') - thread = twr() - if thread is not None: - thread.join() - debug('... queue thread joined') - else: - debug('... queue thread already dead') - - @staticmethod - def _finalize_close(buffer, notempty): - debug('telling queue thread to quit') - notempty.acquire() - try: - buffer.append(_sentinel) - notempty.notify() - finally: - notempty.release() - - @staticmethod - def _feed(buffer, notempty, send, writelock, close): - debug('starting thread to feed data to pipe') - from .util import is_exiting - - nacquire = notempty.acquire - nrelease = notempty.release - nwait = notempty.wait - bpopleft = buffer.popleft - sentinel = _sentinel - if sys.platform != 'win32': - wacquire = writelock.acquire - wrelease = writelock.release - else: - wacquire = None - - try: - while 1: - nacquire() - try: - if not buffer: - nwait() - finally: - nrelease() - try: - while 1: - obj = bpopleft() - if obj is sentinel: - debug('feeder thread got sentinel -- exiting') - close() - return - - if wacquire is None: - send(obj) - else: - wacquire() - try: - send(obj) - finally: - wrelease() - except IndexError: - pass - except Exception, e: - # Since this runs in a daemon thread the resources it uses - # may be become unusable while the process is cleaning up. - # We ignore errors which happen after the process has - # started to cleanup. - try: - if is_exiting(): - info('error in queue thread: %s', e) - else: - import traceback - traceback.print_exc() - except Exception: - pass - -_sentinel = object() - -# -# A queue type which also supports join() and task_done() methods -# -# Note that if you do not call task_done() for each finished task then -# eventually the counter's semaphore may overflow causing Bad Things -# to happen. -# - -class JoinableQueue(Queue): - - def __init__(self, maxsize=0): - Queue.__init__(self, maxsize) - self._unfinished_tasks = Semaphore(0) - self._cond = Condition() - - def __getstate__(self): - return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) - - def __setstate__(self, state): - Queue.__setstate__(self, state[:-2]) - self._cond, self._unfinished_tasks = state[-2:] - - def put(self, item, block=True, timeout=None): - Queue.put(self, item, block, timeout) - self._unfinished_tasks.release() - - def task_done(self): - self._cond.acquire() - try: - if not self._unfinished_tasks.acquire(False): - raise ValueError('task_done() called too many times') - if self._unfinished_tasks._semlock._is_zero(): - self._cond.notify_all() - finally: - self._cond.release() - - def join(self): - self._cond.acquire() - try: - if not self._unfinished_tasks._semlock._is_zero(): - self._cond.wait() - finally: - self._cond.release() - -# -# Simplified Queue type -- really just a locked pipe -# - -class SimpleQueue(object): - - def __init__(self): - self._reader, self._writer = Pipe(duplex=False) - self._rlock = Lock() - if sys.platform == 'win32': - self._wlock = None - else: - self._wlock = Lock() - self._make_methods() - - def empty(self): - return not self._reader.poll() - - def __getstate__(self): - assert_spawning(self) - return (self._reader, self._writer, self._rlock, self._wlock) - - def __setstate__(self, state): - (self._reader, self._writer, self._rlock, self._wlock) = state - self._make_methods() - - def _make_methods(self): - recv = self._reader.recv - racquire, rrelease = self._rlock.acquire, self._rlock.release - def get(): - racquire() - try: - return recv() - finally: - rrelease() - self.get = get - - if self._wlock is None: - # writes to a message oriented win32 pipe are atomic - self.put = self._writer.send - else: - send = self._writer.send - wacquire, wrelease = self._wlock.acquire, self._wlock.release - def put(obj): - wacquire() - try: - return send(obj) - finally: - wrelease() - self.put = put +# +# Module implementing queues +# +# multiprocessing/queues.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = ['Queue', 'SimpleQueue'] + +import sys +import os +import threading +import collections +import time +import atexit +import weakref + +from Queue import Empty, Full +import _multiprocessing +from multiprocessing import Pipe +from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition +from multiprocessing.util import debug, info, Finalize, register_after_fork +from multiprocessing.forking import assert_spawning + +# +# Queue type using a pipe, buffer and thread +# + +class Queue(object): + + def __init__(self, maxsize=0): + if maxsize <= 0: + maxsize = _multiprocessing.SemLock.SEM_VALUE_MAX + self._maxsize = maxsize + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + self._opid = os.getpid() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._sem = BoundedSemaphore(maxsize) + + self._after_fork() + + if sys.platform != 'win32': + register_after_fork(self, Queue._after_fork) + + def __getstate__(self): + assert_spawning(self) + return (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) + + def __setstate__(self, state): + (self._maxsize, self._reader, self._writer, + self._rlock, self._wlock, self._sem, self._opid) = state + self._after_fork() + + def _after_fork(self): + debug('Queue._after_fork()') + self._notempty = threading.Condition(threading.Lock()) + self._buffer = collections.deque() + self._thread = None + self._jointhread = None + self._joincancelled = False + self._closed = False + self._close = None + self._send = self._writer.send + self._recv = self._reader.recv + self._poll = self._reader.poll + + def put(self, obj, block=True, timeout=None): + assert not self._closed + if not self._sem.acquire(block, timeout): + raise Full + + self._notempty.acquire() + try: + if self._thread is None: + self._start_thread() + self._buffer.append(obj) + self._notempty.notify() + finally: + self._notempty.release() + + def get(self, block=True, timeout=None): + if block and timeout is None: + self._rlock.acquire() + try: + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + else: + if block: + deadline = time.time() + timeout + if not self._rlock.acquire(block, timeout): + raise Empty + try: + if not self._poll(block and (deadline-time.time()) or 0.0): + raise Empty + res = self._recv() + self._sem.release() + return res + finally: + self._rlock.release() + + def qsize(self): + # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + return self._maxsize - self._sem._semlock._get_value() + + def empty(self): + return not self._poll() + + def full(self): + return self._sem._semlock._is_zero() + + def get_nowait(self): + return self.get(False) + + def put_nowait(self, obj): + return self.put(obj, False) + + def close(self): + self._closed = True + self._reader.close() + if self._close: + self._close() + + def join_thread(self): + debug('Queue.join_thread()') + assert self._closed + if self._jointhread: + self._jointhread() + + def cancel_join_thread(self): + debug('Queue.cancel_join_thread()') + self._joincancelled = True + try: + self._jointhread.cancel() + except AttributeError: + pass + + def _start_thread(self): + debug('Queue._start_thread()') + + # Start thread which transfers data from buffer to pipe + self._buffer.clear() + self._thread = threading.Thread( + target=Queue._feed, + args=(self._buffer, self._notempty, self._send, + self._wlock, self._writer.close), + name='QueueFeederThread' + ) + self._thread.set_daemon(True) + + debug('doing self._thread.start()') + self._thread.start() + debug('... done self._thread.start()') + + # On process exit we will wait for data to be flushed to pipe. + # + # However, if this process created the queue then all + # processes which use the queue will be descendants of this + # process. Therefore waiting for the queue to be flushed + # is pointless once all the child processes have been joined. + created_by_this_process = (self._opid == os.getpid()) + if not self._joincancelled and not created_by_this_process: + self._jointhread = Finalize( + self._thread, Queue._finalize_join, + [weakref.ref(self._thread)], + exitpriority=-5 + ) + + # Send sentinel to the thread queue object when garbage collected + self._close = Finalize( + self, Queue._finalize_close, + [self._buffer, self._notempty], + exitpriority=10 + ) + + @staticmethod + def _finalize_join(twr): + debug('joining queue thread') + thread = twr() + if thread is not None: + thread.join() + debug('... queue thread joined') + else: + debug('... queue thread already dead') + + @staticmethod + def _finalize_close(buffer, notempty): + debug('telling queue thread to quit') + notempty.acquire() + try: + buffer.append(_sentinel) + notempty.notify() + finally: + notempty.release() + + @staticmethod + def _feed(buffer, notempty, send, writelock, close): + debug('starting thread to feed data to pipe') + from .util import is_exiting + + nacquire = notempty.acquire + nrelease = notempty.release + nwait = notempty.wait + bpopleft = buffer.popleft + sentinel = _sentinel + if sys.platform != 'win32': + wacquire = writelock.acquire + wrelease = writelock.release + else: + wacquire = None + + try: + while 1: + nacquire() + try: + if not buffer: + nwait() + finally: + nrelease() + try: + while 1: + obj = bpopleft() + if obj is sentinel: + debug('feeder thread got sentinel -- exiting') + close() + return + + if wacquire is None: + send(obj) + else: + wacquire() + try: + send(obj) + finally: + wrelease() + except IndexError: + pass + except Exception, e: + # Since this runs in a daemon thread the resources it uses + # may be become unusable while the process is cleaning up. + # We ignore errors which happen after the process has + # started to cleanup. + try: + if is_exiting(): + info('error in queue thread: %s', e) + else: + import traceback + traceback.print_exc() + except Exception: + pass + +_sentinel = object() + +# +# A queue type which also supports join() and task_done() methods +# +# Note that if you do not call task_done() for each finished task then +# eventually the counter's semaphore may overflow causing Bad Things +# to happen. +# + +class JoinableQueue(Queue): + + def __init__(self, maxsize=0): + Queue.__init__(self, maxsize) + self._unfinished_tasks = Semaphore(0) + self._cond = Condition() + + def __getstate__(self): + return Queue.__getstate__(self) + (self._cond, self._unfinished_tasks) + + def __setstate__(self, state): + Queue.__setstate__(self, state[:-2]) + self._cond, self._unfinished_tasks = state[-2:] + + def put(self, item, block=True, timeout=None): + Queue.put(self, item, block, timeout) + self._unfinished_tasks.release() + + def task_done(self): + self._cond.acquire() + try: + if not self._unfinished_tasks.acquire(False): + raise ValueError('task_done() called too many times') + if self._unfinished_tasks._semlock._is_zero(): + self._cond.notify_all() + finally: + self._cond.release() + + def join(self): + self._cond.acquire() + try: + if not self._unfinished_tasks._semlock._is_zero(): + self._cond.wait() + finally: + self._cond.release() + +# +# Simplified Queue type -- really just a locked pipe +# + +class SimpleQueue(object): + + def __init__(self): + self._reader, self._writer = Pipe(duplex=False) + self._rlock = Lock() + if sys.platform == 'win32': + self._wlock = None + else: + self._wlock = Lock() + self._make_methods() + + def empty(self): + return not self._reader.poll() + + def __getstate__(self): + assert_spawning(self) + return (self._reader, self._writer, self._rlock, self._wlock) + + def __setstate__(self, state): + (self._reader, self._writer, self._rlock, self._wlock) = state + self._make_methods() + + def _make_methods(self): + recv = self._reader.recv + racquire, rrelease = self._rlock.acquire, self._rlock.release + def get(): + racquire() + try: + return recv() + finally: + rrelease() + self.get = get + + if self._wlock is None: + # writes to a message oriented win32 pipe are atomic + self.put = self._writer.send + else: + send = self._writer.send + wacquire, wrelease = self._wlock.acquire, self._wlock.release + def put(obj): + wacquire() + try: + return send(obj) + finally: + wrelease() + self.put = put Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/reduction.py Sun Jun 15 03:02:00 2008 @@ -1,190 +1,190 @@ -# -# Module to allow connection and socket objects to be transferred -# between processes -# -# multiprocessing/reduction.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [] - -import os -import sys -import socket -import threading -import copy_reg - -import _multiprocessing -from multiprocessing import current_process -from multiprocessing.forking import Popen, duplicate, close -from multiprocessing.util import register_after_fork, debug, sub_debug -from multiprocessing.connection import Client, Listener - - -# -# -# - -if not(sys.platform == 'win32' or hasattr(_multiprocessing, 'recvfd')): - raise ImportError('pickling of connections not supported') - -# -# Platform specific definitions -# - -if sys.platform == 'win32': - import _subprocess - from ._multiprocessing import win32 - - def send_handle(conn, handle, destination_pid): - process_handle = win32.OpenProcess( - win32.PROCESS_ALL_ACCESS, False, destination_pid - ) - try: - new_handle = duplicate(handle, process_handle) - conn.send(new_handle) - finally: - close(process_handle) - - def recv_handle(conn): - return conn.recv() - -else: - def send_handle(conn, handle, destination_pid): - _multiprocessing.sendfd(conn.fileno(), handle) - - def recv_handle(conn): - return _multiprocessing.recvfd(conn.fileno()) - -# -# Support for a per-process server thread which caches pickled handles -# - -_cache = set() - -def _reset(obj): - global _lock, _listener, _cache - for h in _cache: - close(h) - _cache.clear() - _lock = threading.Lock() - _listener = None - -_reset(None) -register_after_fork(_reset, _reset) - -def _get_listener(): - global _listener - - if _listener is None: - _lock.acquire() - try: - if _listener is None: - debug('starting listener and thread for sending handles') - _listener = Listener(authkey=current_process().get_authkey()) - t = threading.Thread(target=_serve) - t.set_daemon(True) - t.start() - finally: - _lock.release() - - return _listener - -def _serve(): - from .util import is_exiting, sub_warning - - while 1: - try: - conn = _listener.accept() - handle_wanted, destination_pid = conn.recv() - _cache.remove(handle_wanted) - send_handle(conn, handle_wanted, destination_pid) - close(handle_wanted) - conn.close() - except: - if not is_exiting(): - import traceback - sub_warning( - 'thread for sharing handles raised exception :\n' + - '-'*79 + '\n' + traceback.format_exc() + '-'*79 - ) - -# -# Functions to be used for pickling/unpickling objects with handles -# - -def reduce_handle(handle): - if Popen.thread_is_spawning(): - return (None, Popen.duplicate_for_child(handle), True) - dup_handle = duplicate(handle) - _cache.add(dup_handle) - sub_debug('reducing handle %d', handle) - return (_get_listener().address, dup_handle, False) - -def rebuild_handle(pickled_data): - address, handle, inherited = pickled_data - if inherited: - return handle - sub_debug('rebuilding handle %d', handle) - conn = Client(address, authkey=current_process().get_authkey()) - conn.send((handle, os.getpid())) - new_handle = recv_handle(conn) - conn.close() - return new_handle - -# -# Register `_multiprocessing.Connection` with `copy_reg` -# - -def reduce_connection(conn): - rh = reduce_handle(conn.fileno()) - return rebuild_connection, (rh, conn.readable, conn.writable) - -def rebuild_connection(reduced_handle, readable, writable): - handle = rebuild_handle(reduced_handle) - return _multiprocessing.Connection( - handle, readable=readable, writable=writable - ) - -copy_reg.pickle(_multiprocessing.Connection, reduce_connection) - -# -# Register `socket.socket` with `copy_reg` -# - -def fromfd(fd, family, type_, proto=0): - s = socket.fromfd(fd, family, type_, proto) - if s.__class__ is not socket.socket: - s = socket.socket(_sock=s) - return s - -def reduce_socket(s): - reduced_handle = reduce_handle(s.fileno()) - return rebuild_socket, (reduced_handle, s.family, s.type, s.proto) - -def rebuild_socket(reduced_handle, family, type_, proto): - fd = rebuild_handle(reduced_handle) - _sock = fromfd(fd, family, type_, proto) - close(fd) - return _sock - -copy_reg.pickle(socket.socket, reduce_socket) - -# -# Register `_multiprocessing.PipeConnection` with `copy_reg` -# - -if sys.platform == 'win32': - - def reduce_pipe_connection(conn): - rh = reduce_handle(conn.fileno()) - return rebuild_pipe_connection, (rh, conn.readable, conn.writable) - - def rebuild_pipe_connection(reduced_handle, readable, writable): - handle = rebuild_handle(reduced_handle) - return _multiprocessing.PipeConnection( - handle, readable=readable, writable=writable - ) - - copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) +# +# Module to allow connection and socket objects to be transferred +# between processes +# +# multiprocessing/reduction.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [] + +import os +import sys +import socket +import threading +import copy_reg + +import _multiprocessing +from multiprocessing import current_process +from multiprocessing.forking import Popen, duplicate, close +from multiprocessing.util import register_after_fork, debug, sub_debug +from multiprocessing.connection import Client, Listener + + +# +# +# + +if not(sys.platform == 'win32' or hasattr(_multiprocessing, 'recvfd')): + raise ImportError('pickling of connections not supported') + +# +# Platform specific definitions +# + +if sys.platform == 'win32': + import _subprocess + from ._multiprocessing import win32 + + def send_handle(conn, handle, destination_pid): + process_handle = win32.OpenProcess( + win32.PROCESS_ALL_ACCESS, False, destination_pid + ) + try: + new_handle = duplicate(handle, process_handle) + conn.send(new_handle) + finally: + close(process_handle) + + def recv_handle(conn): + return conn.recv() + +else: + def send_handle(conn, handle, destination_pid): + _multiprocessing.sendfd(conn.fileno(), handle) + + def recv_handle(conn): + return _multiprocessing.recvfd(conn.fileno()) + +# +# Support for a per-process server thread which caches pickled handles +# + +_cache = set() + +def _reset(obj): + global _lock, _listener, _cache + for h in _cache: + close(h) + _cache.clear() + _lock = threading.Lock() + _listener = None + +_reset(None) +register_after_fork(_reset, _reset) + +def _get_listener(): + global _listener + + if _listener is None: + _lock.acquire() + try: + if _listener is None: + debug('starting listener and thread for sending handles') + _listener = Listener(authkey=current_process().get_authkey()) + t = threading.Thread(target=_serve) + t.set_daemon(True) + t.start() + finally: + _lock.release() + + return _listener + +def _serve(): + from .util import is_exiting, sub_warning + + while 1: + try: + conn = _listener.accept() + handle_wanted, destination_pid = conn.recv() + _cache.remove(handle_wanted) + send_handle(conn, handle_wanted, destination_pid) + close(handle_wanted) + conn.close() + except: + if not is_exiting(): + import traceback + sub_warning( + 'thread for sharing handles raised exception :\n' + + '-'*79 + '\n' + traceback.format_exc() + '-'*79 + ) + +# +# Functions to be used for pickling/unpickling objects with handles +# + +def reduce_handle(handle): + if Popen.thread_is_spawning(): + return (None, Popen.duplicate_for_child(handle), True) + dup_handle = duplicate(handle) + _cache.add(dup_handle) + sub_debug('reducing handle %d', handle) + return (_get_listener().address, dup_handle, False) + +def rebuild_handle(pickled_data): + address, handle, inherited = pickled_data + if inherited: + return handle + sub_debug('rebuilding handle %d', handle) + conn = Client(address, authkey=current_process().get_authkey()) + conn.send((handle, os.getpid())) + new_handle = recv_handle(conn) + conn.close() + return new_handle + +# +# Register `_multiprocessing.Connection` with `copy_reg` +# + +def reduce_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_connection, (rh, conn.readable, conn.writable) + +def rebuild_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.Connection( + handle, readable=readable, writable=writable + ) + +copy_reg.pickle(_multiprocessing.Connection, reduce_connection) + +# +# Register `socket.socket` with `copy_reg` +# + +def fromfd(fd, family, type_, proto=0): + s = socket.fromfd(fd, family, type_, proto) + if s.__class__ is not socket.socket: + s = socket.socket(_sock=s) + return s + +def reduce_socket(s): + reduced_handle = reduce_handle(s.fileno()) + return rebuild_socket, (reduced_handle, s.family, s.type, s.proto) + +def rebuild_socket(reduced_handle, family, type_, proto): + fd = rebuild_handle(reduced_handle) + _sock = fromfd(fd, family, type_, proto) + close(fd) + return _sock + +copy_reg.pickle(socket.socket, reduce_socket) + +# +# Register `_multiprocessing.PipeConnection` with `copy_reg` +# + +if sys.platform == 'win32': + + def reduce_pipe_connection(conn): + rh = reduce_handle(conn.fileno()) + return rebuild_pipe_connection, (rh, conn.readable, conn.writable) + + def rebuild_pipe_connection(reduced_handle, readable, writable): + handle = rebuild_handle(reduced_handle) + return _multiprocessing.PipeConnection( + handle, readable=readable, writable=writable + ) + + copy_reg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection) Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/sharedctypes.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/sharedctypes.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/sharedctypes.py Sun Jun 15 03:02:00 2008 @@ -1,234 +1,234 @@ -# -# Module which supports allocation of ctypes objects from shared memory -# -# multiprocessing/sharedctypes.py -# -# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt -# - -import sys -import ctypes -import weakref -import copy_reg - -from multiprocessing import heap, RLock -from multiprocessing.forking import assert_spawning - -__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] - -# -# -# - -typecode_to_type = { - 'c': ctypes.c_char, 'u': ctypes.c_wchar, - 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, - 'h': ctypes.c_short, 'H': ctypes.c_ushort, - 'i': ctypes.c_int, 'I': ctypes.c_uint, - 'l': ctypes.c_long, 'L': ctypes.c_ulong, - 'f': ctypes.c_float, 'd': ctypes.c_double - } - -# -# -# - -def _new_value(type_): - size = ctypes.sizeof(type_) - wrapper = heap.BufferWrapper(size) - return rebuild_ctype(type_, wrapper, None) - -def RawValue(typecode_or_type, *args): - ''' - Returns a ctypes object allocated from shared memory - ''' - type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) - obj = _new_value(type_) - ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) - obj.__init__(*args) - return obj - -def RawArray(typecode_or_type, size_or_initializer): - ''' - Returns a ctypes array allocated from shared memory - ''' - type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) - if isinstance(size_or_initializer, int): - type_ = type_ * size_or_initializer - return _new_value(type_) - else: - type_ = type_ * len(size_or_initializer) - result = _new_value(type_) - result.__init__(*size_or_initializer) - return result - -def Value(typecode_or_type, *args, **kwds): - ''' - Return a synchronization wrapper for a Value - ''' - lock = kwds.pop('lock', None) - if kwds: - raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) - obj = RawValue(typecode_or_type, *args) - if lock is None: - lock = RLock() - assert hasattr(lock, 'acquire') - return synchronized(obj, lock) - -def Array(typecode_or_type, size_or_initializer, **kwds): - ''' - Return a synchronization wrapper for a RawArray - ''' - lock = kwds.pop('lock', None) - if kwds: - raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) - obj = RawArray(typecode_or_type, size_or_initializer) - if lock is None: - lock = RLock() - assert hasattr(lock, 'acquire') - return synchronized(obj, lock) - -def copy(obj): - new_obj = _new_value(type(obj)) - ctypes.pointer(new_obj)[0] = obj - return new_obj - -def synchronized(obj, lock=None): - assert not isinstance(obj, SynchronizedBase), 'object already synchronized' - - if isinstance(obj, ctypes._SimpleCData): - return Synchronized(obj, lock) - elif isinstance(obj, ctypes.Array): - if obj._type_ is ctypes.c_char: - return SynchronizedString(obj, lock) - return SynchronizedArray(obj, lock) - else: - cls = type(obj) - try: - scls = class_cache[cls] - except KeyError: - names = [field[0] for field in cls._fields_] - d = dict((name, make_property(name)) for name in names) - classname = 'Synchronized' + cls.__name__ - scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) - return scls(obj, lock) - -# -# Functions for pickling/unpickling -# - -def reduce_ctype(obj): - assert_spawning(obj) - if isinstance(obj, ctypes.Array): - return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) - else: - return rebuild_ctype, (type(obj), obj._wrapper, None) - -def rebuild_ctype(type_, wrapper, length): - if length is not None: - type_ = type_ * length - if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table: - copy_reg.pickle(type_, reduce_ctype) - obj = type_.from_address(wrapper.get_address()) - obj._wrapper = wrapper - return obj - -# -# Function to create properties -# - -def make_property(name): - try: - return prop_cache[name] - except KeyError: - d = {} - exec template % ((name,)*7) in d - prop_cache[name] = d[name] - return d[name] - -template = ''' -def get%s(self): - self.acquire() - try: - return self._obj.%s - finally: - self.release() -def set%s(self, value): - self.acquire() - try: - self._obj.%s = value - finally: - self.release() -%s = property(get%s, set%s) -''' - -prop_cache = {} -class_cache = weakref.WeakKeyDictionary() - -# -# Synchronized wrappers -# - -class SynchronizedBase(object): - - def __init__(self, obj, lock=None): - self._obj = obj - self._lock = lock or RLock() - self.acquire = self._lock.acquire - self.release = self._lock.release - - def __reduce__(self): - assert_spawning(self) - return synchronized, (self._obj, self._lock) - - def get_obj(self): - return self._obj - - def get_lock(self): - return self._lock - - def __repr__(self): - return '<%s wrapper for %s>' % (type(self).__name__, self._obj) - - -class Synchronized(SynchronizedBase): - value = make_property('value') - - -class SynchronizedArray(SynchronizedBase): - - def __len__(self): - return len(self._obj) - - def __getitem__(self, i): - self.acquire() - try: - return self._obj[i] - finally: - self.release() - - def __setitem__(self, i, value): - self.acquire() - try: - self._obj[i] = value - finally: - self.release() - - def __getslice__(self, start, stop): - self.acquire() - try: - return self._obj[start:stop] - finally: - self.release() - - def __setslice__(self, start, stop, values): - self.acquire() - try: - self._obj[start:stop] = values - finally: - self.release() - - -class SynchronizedString(SynchronizedArray): - value = make_property('value') - raw = make_property('raw') +# +# Module which supports allocation of ctypes objects from shared memory +# +# multiprocessing/sharedctypes.py +# +# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt +# + +import sys +import ctypes +import weakref +import copy_reg + +from multiprocessing import heap, RLock +from multiprocessing.forking import assert_spawning + +__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] + +# +# +# + +typecode_to_type = { + 'c': ctypes.c_char, 'u': ctypes.c_wchar, + 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, + 'h': ctypes.c_short, 'H': ctypes.c_ushort, + 'i': ctypes.c_int, 'I': ctypes.c_uint, + 'l': ctypes.c_long, 'L': ctypes.c_ulong, + 'f': ctypes.c_float, 'd': ctypes.c_double + } + +# +# +# + +def _new_value(type_): + size = ctypes.sizeof(type_) + wrapper = heap.BufferWrapper(size) + return rebuild_ctype(type_, wrapper, None) + +def RawValue(typecode_or_type, *args): + ''' + Returns a ctypes object allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + obj = _new_value(type_) + ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) + obj.__init__(*args) + return obj + +def RawArray(typecode_or_type, size_or_initializer): + ''' + Returns a ctypes array allocated from shared memory + ''' + type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) + if isinstance(size_or_initializer, int): + type_ = type_ * size_or_initializer + return _new_value(type_) + else: + type_ = type_ * len(size_or_initializer) + result = _new_value(type_) + result.__init__(*size_or_initializer) + return result + +def Value(typecode_or_type, *args, **kwds): + ''' + Return a synchronization wrapper for a Value + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawValue(typecode_or_type, *args) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def Array(typecode_or_type, size_or_initializer, **kwds): + ''' + Return a synchronization wrapper for a RawArray + ''' + lock = kwds.pop('lock', None) + if kwds: + raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) + obj = RawArray(typecode_or_type, size_or_initializer) + if lock is None: + lock = RLock() + assert hasattr(lock, 'acquire') + return synchronized(obj, lock) + +def copy(obj): + new_obj = _new_value(type(obj)) + ctypes.pointer(new_obj)[0] = obj + return new_obj + +def synchronized(obj, lock=None): + assert not isinstance(obj, SynchronizedBase), 'object already synchronized' + + if isinstance(obj, ctypes._SimpleCData): + return Synchronized(obj, lock) + elif isinstance(obj, ctypes.Array): + if obj._type_ is ctypes.c_char: + return SynchronizedString(obj, lock) + return SynchronizedArray(obj, lock) + else: + cls = type(obj) + try: + scls = class_cache[cls] + except KeyError: + names = [field[0] for field in cls._fields_] + d = dict((name, make_property(name)) for name in names) + classname = 'Synchronized' + cls.__name__ + scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) + return scls(obj, lock) + +# +# Functions for pickling/unpickling +# + +def reduce_ctype(obj): + assert_spawning(obj) + if isinstance(obj, ctypes.Array): + return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) + else: + return rebuild_ctype, (type(obj), obj._wrapper, None) + +def rebuild_ctype(type_, wrapper, length): + if length is not None: + type_ = type_ * length + if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table: + copy_reg.pickle(type_, reduce_ctype) + obj = type_.from_address(wrapper.get_address()) + obj._wrapper = wrapper + return obj + +# +# Function to create properties +# + +def make_property(name): + try: + return prop_cache[name] + except KeyError: + d = {} + exec template % ((name,)*7) in d + prop_cache[name] = d[name] + return d[name] + +template = ''' +def get%s(self): + self.acquire() + try: + return self._obj.%s + finally: + self.release() +def set%s(self, value): + self.acquire() + try: + self._obj.%s = value + finally: + self.release() +%s = property(get%s, set%s) +''' + +prop_cache = {} +class_cache = weakref.WeakKeyDictionary() + +# +# Synchronized wrappers +# + +class SynchronizedBase(object): + + def __init__(self, obj, lock=None): + self._obj = obj + self._lock = lock or RLock() + self.acquire = self._lock.acquire + self.release = self._lock.release + + def __reduce__(self): + assert_spawning(self) + return synchronized, (self._obj, self._lock) + + def get_obj(self): + return self._obj + + def get_lock(self): + return self._lock + + def __repr__(self): + return '<%s wrapper for %s>' % (type(self).__name__, self._obj) + + +class Synchronized(SynchronizedBase): + value = make_property('value') + + +class SynchronizedArray(SynchronizedBase): + + def __len__(self): + return len(self._obj) + + def __getitem__(self, i): + self.acquire() + try: + return self._obj[i] + finally: + self.release() + + def __setitem__(self, i, value): + self.acquire() + try: + self._obj[i] = value + finally: + self.release() + + def __getslice__(self, start, stop): + self.acquire() + try: + return self._obj[start:stop] + finally: + self.release() + + def __setslice__(self, start, stop, values): + self.acquire() + try: + self._obj[start:stop] = values + finally: + self.release() + + +class SynchronizedString(SynchronizedArray): + value = make_property('value') + raw = make_property('raw') Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/synchronize.py Sun Jun 15 03:02:00 2008 @@ -1,294 +1,294 @@ -# -# Module implementing synchronization primitives -# -# multiprocessing/synchronize.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -__all__ = [ - 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' - ] - -import threading -import os -import sys - -from time import time as _time, sleep as _sleep - -import _multiprocessing -from multiprocessing.process import current_process -from multiprocessing.util import Finalize, register_after_fork, debug -from multiprocessing.forking import assert_spawning, Popen - -# -# Constants -# - -RECURSIVE_MUTEX, SEMAPHORE = range(2) -SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX - -# -# Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` -# - -class SemLock(object): - - def __init__(self, kind, value, maxvalue): - sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) - debug('created semlock with handle %s' % sl.handle) - self._make_methods() - - if sys.platform != 'win32': - def _after_fork(obj): - obj._semlock._after_fork() - register_after_fork(self, _after_fork) - - def _make_methods(self): - self.acquire = self._semlock.acquire - self.release = self._semlock.release - self.__enter__ = self._semlock.__enter__ - self.__exit__ = self._semlock.__exit__ - - def __getstate__(self): - assert_spawning(self) - sl = self._semlock - return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue) - - def __setstate__(self, state): - self._semlock = _multiprocessing.SemLock._rebuild(*state) - debug('recreated blocker with handle %r' % state[0]) - self._make_methods() - -# -# Semaphore -# - -class Semaphore(SemLock): - - def __init__(self, value=1): - SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX) - - def get_value(self): - return self._semlock._get_value() - - def __repr__(self): - try: - value = self._semlock._get_value() - except Exception: - value = 'unknown' - return '' % value - -# -# Bounded semaphore -# - -class BoundedSemaphore(Semaphore): - - def __init__(self, value=1): - SemLock.__init__(self, SEMAPHORE, value, value) - - def __repr__(self): - try: - value = self._semlock._get_value() - except Exception: - value = 'unknown' - return '' % \ - (value, self._semlock.maxvalue) - -# -# Non-recursive lock -# - -class Lock(SemLock): - - def __init__(self): - SemLock.__init__(self, SEMAPHORE, 1, 1) - - def __repr__(self): - try: - if self._semlock._is_mine(): - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - elif self._semlock._get_value() == 1: - name = 'None' - elif self._semlock._count() > 0: - name = 'SomeOtherThread' - else: - name = 'SomeOtherProcess' - except Exception: - name = 'unknown' - return '' % name - -# -# Recursive lock -# - -class RLock(SemLock): - - def __init__(self): - SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) - - def __repr__(self): - try: - if self._semlock._is_mine(): - name = current_process().get_name() - if threading.current_thread().get_name() != 'MainThread': - name += '|' + threading.current_thread().get_name() - count = self._semlock._count() - elif self._semlock._get_value() == 1: - name, count = 'None', 0 - elif self._semlock._count() > 0: - name, count = 'SomeOtherThread', 'nonzero' - else: - name, count = 'SomeOtherProcess', 'nonzero' - except Exception: - name, count = 'unknown', 'unknown' - return '' % (name, count) - -# -# Condition variable -# - -class Condition(object): - - def __init__(self, lock=None): - self._lock = lock or RLock() - self._sleeping_count = Semaphore(0) - self._woken_count = Semaphore(0) - self._wait_semaphore = Semaphore(0) - self._make_methods() - - def __getstate__(self): - assert_spawning(self) - return (self._lock, self._sleeping_count, - self._woken_count, self._wait_semaphore) - - def __setstate__(self, state): - (self._lock, self._sleeping_count, - self._woken_count, self._wait_semaphore) = state - self._make_methods() - - def _make_methods(self): - self.acquire = self._lock.acquire - self.release = self._lock.release - self.__enter__ = self._lock.__enter__ - self.__exit__ = self._lock.__exit__ - - def __repr__(self): - try: - num_waiters = (self._sleeping_count._semlock._get_value() - - self._woken_count._semlock._get_value()) - except Exception: - num_waiters = 'unkown' - return '' % (self._lock, num_waiters) - - def wait(self, timeout=None): - assert self._lock._semlock._is_mine(), \ - 'must acquire() condition before using wait()' - - # indicate that this thread is going to sleep - self._sleeping_count.release() - - # release lock - count = self._lock._semlock._count() - for i in xrange(count): - self._lock.release() - - try: - # wait for notification or timeout - self._wait_semaphore.acquire(True, timeout) - finally: - # indicate that this thread has woken - self._woken_count.release() - - # reacquire lock - for i in xrange(count): - self._lock.acquire() - - def notify(self): - assert self._lock._semlock._is_mine(), 'lock is not owned' - assert not self._wait_semaphore.acquire(False) - - # to take account of timeouts since last notify() we subtract - # woken_count from sleeping_count and rezero woken_count - while self._woken_count.acquire(False): - res = self._sleeping_count.acquire(False) - assert res - - if self._sleeping_count.acquire(False): # try grabbing a sleeper - self._wait_semaphore.release() # wake up one sleeper - self._woken_count.acquire() # wait for the sleeper to wake - - # rezero _wait_semaphore in case a timeout just happened - self._wait_semaphore.acquire(False) - - def notify_all(self): - assert self._lock._semlock._is_mine(), 'lock is not owned' - assert not self._wait_semaphore.acquire(False) - - # to take account of timeouts since last notify*() we subtract - # woken_count from sleeping_count and rezero woken_count - while self._woken_count.acquire(False): - res = self._sleeping_count.acquire(False) - assert res - - sleepers = 0 - while self._sleeping_count.acquire(False): - self._wait_semaphore.release() # wake up one sleeper - sleepers += 1 - - if sleepers: - for i in xrange(sleepers): - self._woken_count.acquire() # wait for a sleeper to wake - - # rezero wait_semaphore in case some timeouts just happened - while self._wait_semaphore.acquire(False): - pass - -# -# Event -# - -class Event(object): - - def __init__(self): - self._cond = Condition(Lock()) - self._flag = Semaphore(0) - - def is_set(self): - self._cond.acquire() - try: - if self._flag.acquire(False): - self._flag.release() - return True - return False - finally: - self._cond.release() - - def set(self): - self._cond.acquire() - try: - self._flag.acquire(False) - self._flag.release() - self._cond.notify_all() - finally: - self._cond.release() - - def clear(self): - self._cond.acquire() - try: - self._flag.acquire(False) - finally: - self._cond.release() - - def wait(self, timeout=None): - self._cond.acquire() - try: - if self._flag.acquire(False): - self._flag.release() - else: - self._cond.wait(timeout) - finally: - self._cond.release() +# +# Module implementing synchronization primitives +# +# multiprocessing/synchronize.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +__all__ = [ + 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event' + ] + +import threading +import os +import sys + +from time import time as _time, sleep as _sleep + +import _multiprocessing +from multiprocessing.process import current_process +from multiprocessing.util import Finalize, register_after_fork, debug +from multiprocessing.forking import assert_spawning, Popen + +# +# Constants +# + +RECURSIVE_MUTEX, SEMAPHORE = range(2) +SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX + +# +# Base class for semaphores and mutexes; wraps `_multiprocessing.SemLock` +# + +class SemLock(object): + + def __init__(self, kind, value, maxvalue): + sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) + debug('created semlock with handle %s' % sl.handle) + self._make_methods() + + if sys.platform != 'win32': + def _after_fork(obj): + obj._semlock._after_fork() + register_after_fork(self, _after_fork) + + def _make_methods(self): + self.acquire = self._semlock.acquire + self.release = self._semlock.release + self.__enter__ = self._semlock.__enter__ + self.__exit__ = self._semlock.__exit__ + + def __getstate__(self): + assert_spawning(self) + sl = self._semlock + return (Popen.duplicate_for_child(sl.handle), sl.kind, sl.maxvalue) + + def __setstate__(self, state): + self._semlock = _multiprocessing.SemLock._rebuild(*state) + debug('recreated blocker with handle %r' % state[0]) + self._make_methods() + +# +# Semaphore +# + +class Semaphore(SemLock): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX) + + def get_value(self): + return self._semlock._get_value() + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % value + +# +# Bounded semaphore +# + +class BoundedSemaphore(Semaphore): + + def __init__(self, value=1): + SemLock.__init__(self, SEMAPHORE, value, value) + + def __repr__(self): + try: + value = self._semlock._get_value() + except Exception: + value = 'unknown' + return '' % \ + (value, self._semlock.maxvalue) + +# +# Non-recursive lock +# + +class Lock(SemLock): + + def __init__(self): + SemLock.__init__(self, SEMAPHORE, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + elif self._semlock._get_value() == 1: + name = 'None' + elif self._semlock._count() > 0: + name = 'SomeOtherThread' + else: + name = 'SomeOtherProcess' + except Exception: + name = 'unknown' + return '' % name + +# +# Recursive lock +# + +class RLock(SemLock): + + def __init__(self): + SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1) + + def __repr__(self): + try: + if self._semlock._is_mine(): + name = current_process().get_name() + if threading.current_thread().get_name() != 'MainThread': + name += '|' + threading.current_thread().get_name() + count = self._semlock._count() + elif self._semlock._get_value() == 1: + name, count = 'None', 0 + elif self._semlock._count() > 0: + name, count = 'SomeOtherThread', 'nonzero' + else: + name, count = 'SomeOtherProcess', 'nonzero' + except Exception: + name, count = 'unknown', 'unknown' + return '' % (name, count) + +# +# Condition variable +# + +class Condition(object): + + def __init__(self, lock=None): + self._lock = lock or RLock() + self._sleeping_count = Semaphore(0) + self._woken_count = Semaphore(0) + self._wait_semaphore = Semaphore(0) + self._make_methods() + + def __getstate__(self): + assert_spawning(self) + return (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) + + def __setstate__(self, state): + (self._lock, self._sleeping_count, + self._woken_count, self._wait_semaphore) = state + self._make_methods() + + def _make_methods(self): + self.acquire = self._lock.acquire + self.release = self._lock.release + self.__enter__ = self._lock.__enter__ + self.__exit__ = self._lock.__exit__ + + def __repr__(self): + try: + num_waiters = (self._sleeping_count._semlock._get_value() - + self._woken_count._semlock._get_value()) + except Exception: + num_waiters = 'unkown' + return '' % (self._lock, num_waiters) + + def wait(self, timeout=None): + assert self._lock._semlock._is_mine(), \ + 'must acquire() condition before using wait()' + + # indicate that this thread is going to sleep + self._sleeping_count.release() + + # release lock + count = self._lock._semlock._count() + for i in xrange(count): + self._lock.release() + + try: + # wait for notification or timeout + self._wait_semaphore.acquire(True, timeout) + finally: + # indicate that this thread has woken + self._woken_count.release() + + # reacquire lock + for i in xrange(count): + self._lock.acquire() + + def notify(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + if self._sleeping_count.acquire(False): # try grabbing a sleeper + self._wait_semaphore.release() # wake up one sleeper + self._woken_count.acquire() # wait for the sleeper to wake + + # rezero _wait_semaphore in case a timeout just happened + self._wait_semaphore.acquire(False) + + def notify_all(self): + assert self._lock._semlock._is_mine(), 'lock is not owned' + assert not self._wait_semaphore.acquire(False) + + # to take account of timeouts since last notify*() we subtract + # woken_count from sleeping_count and rezero woken_count + while self._woken_count.acquire(False): + res = self._sleeping_count.acquire(False) + assert res + + sleepers = 0 + while self._sleeping_count.acquire(False): + self._wait_semaphore.release() # wake up one sleeper + sleepers += 1 + + if sleepers: + for i in xrange(sleepers): + self._woken_count.acquire() # wait for a sleeper to wake + + # rezero wait_semaphore in case some timeouts just happened + while self._wait_semaphore.acquire(False): + pass + +# +# Event +# + +class Event(object): + + def __init__(self): + self._cond = Condition(Lock()) + self._flag = Semaphore(0) + + def is_set(self): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + return True + return False + finally: + self._cond.release() + + def set(self): + self._cond.acquire() + try: + self._flag.acquire(False) + self._flag.release() + self._cond.notify_all() + finally: + self._cond.release() + + def clear(self): + self._cond.acquire() + try: + self._flag.acquire(False) + finally: + self._cond.release() + + def wait(self, timeout=None): + self._cond.acquire() + try: + if self._flag.acquire(False): + self._flag.release() + else: + self._cond.wait(timeout) + finally: + self._cond.release() Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/util.py Sun Jun 15 03:02:00 2008 @@ -1,336 +1,336 @@ -# -# Module providing various facilities to other parts of the package -# -# multiprocessing/util.py -# -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt -# - -import itertools -import weakref -import copy_reg -import atexit -import threading # we want threading to install it's - # cleanup function before multiprocessing does - -from multiprocessing.process import current_process, active_children - -__all__ = [ - 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', - 'log_to_stderr', 'get_temp_dir', 'register_after_fork', - 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal' - ] - -# -# Logging -# - -NOTSET = 0 -SUBDEBUG = 5 -DEBUG = 10 -INFO = 20 -SUBWARNING = 25 - -LOGGER_NAME = 'multiprocessing' -DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' - -_logger = None -_log_to_stderr = False - -def sub_debug(msg, *args): - if _logger: - _logger.log(SUBDEBUG, msg, *args) - -def debug(msg, *args): - if _logger: - _logger.log(DEBUG, msg, *args) - -def info(msg, *args): - if _logger: - _logger.log(INFO, msg, *args) - -def sub_warning(msg, *args): - if _logger: - _logger.log(SUBWARNING, msg, *args) - -def get_logger(): - ''' - Returns logger used by multiprocessing - ''' - global _logger - - if not _logger: - import logging, atexit - - # XXX multiprocessing should cleanup before logging - if hasattr(atexit, 'unregister'): - atexit.unregister(_exit_function) - atexit.register(_exit_function) - else: - atexit._exithandlers.remove((_exit_function, (), {})) - atexit._exithandlers.append((_exit_function, (), {})) - - _check_logger_class() - _logger = logging.getLogger(LOGGER_NAME) - - return _logger - -def _check_logger_class(): - ''' - Make sure process name is recorded when loggers are used - ''' - # XXX This function is unnecessary once logging is patched - import logging - if hasattr(logging, 'multiprocessing'): - return - - logging._acquireLock() - try: - OldLoggerClass = logging.getLoggerClass() - if not getattr(OldLoggerClass, '_process_aware', False): - class ProcessAwareLogger(OldLoggerClass): - _process_aware = True - def makeRecord(self, *args, **kwds): - record = OldLoggerClass.makeRecord(self, *args, **kwds) - record.processName = current_process()._name - return record - logging.setLoggerClass(ProcessAwareLogger) - finally: - logging._releaseLock() - -def log_to_stderr(level=None): - ''' - Turn on logging and add a handler which prints to stderr - ''' - global _log_to_stderr - import logging - logger = get_logger() - formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) - handler = logging.StreamHandler() - handler.setFormatter(formatter) - logger.addHandler(handler) - if level is not None: - logger.setLevel(level) - _log_to_stderr = True - -# -# Function returning a temp directory which will be removed on exit -# - -def get_temp_dir(): - # get name of a temp directory which will be automatically cleaned up - if current_process()._tempdir is None: - import shutil, tempfile - tempdir = tempfile.mkdtemp(prefix='pymp-') - info('created temp directory %s', tempdir) - Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) - current_process()._tempdir = tempdir - return current_process()._tempdir - -# -# Support for reinitialization of objects when bootstrapping a child process -# - -_afterfork_registry = weakref.WeakValueDictionary() -_afterfork_counter = itertools.count() - -def _run_after_forkers(): - items = list(_afterfork_registry.items()) - items.sort() - for (index, ident, func), obj in items: - try: - func(obj) - except Exception, e: - info('after forker raised exception %s', e) - -def register_after_fork(obj, func): - _afterfork_registry[(_afterfork_counter.next(), id(obj), func)] = obj - -# -# Finalization using weakrefs -# - -_finalizer_registry = {} -_finalizer_counter = itertools.count() - - -class Finalize(object): - ''' - Class which supports object finalization using weakrefs - ''' - def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): - assert exitpriority is None or type(exitpriority) is int - - if obj is not None: - self._weakref = weakref.ref(obj, self) - else: - assert exitpriority is not None - - self._callback = callback - self._args = args - self._kwargs = kwargs or {} - self._key = (exitpriority, _finalizer_counter.next()) - - _finalizer_registry[self._key] = self - - def __call__(self, wr=None): - ''' - Run the callback unless it has already been called or cancelled - ''' - try: - del _finalizer_registry[self._key] - except KeyError: - sub_debug('finalizer no longer registered') - else: - sub_debug('finalizer calling %s with args %s and kwargs %s', - self._callback, self._args, self._kwargs) - res = self._callback(*self._args, **self._kwargs) - self._weakref = self._callback = self._args = \ - self._kwargs = self._key = None - return res - - def cancel(self): - ''' - Cancel finalization of the object - ''' - try: - del _finalizer_registry[self._key] - except KeyError: - pass - else: - self._weakref = self._callback = self._args = \ - self._kwargs = self._key = None - - def still_active(self): - ''' - Return whether this finalizer is still waiting to invoke callback - ''' - return self._key in _finalizer_registry - - def __repr__(self): - try: - obj = self._weakref() - except (AttributeError, TypeError): - obj = None - - if obj is None: - return '' - - x = '' - - -def _run_finalizers(minpriority=None): - ''' - Run all finalizers whose exit priority is not None and at least minpriority - - Finalizers with highest priority are called first; finalizers with - the same priority will be called in reverse order of creation. - ''' - if minpriority is None: - f = lambda p : p[0][0] is not None - else: - f = lambda p : p[0][0] is not None and p[0][0] >= minpriority - - items = [x for x in _finalizer_registry.items() if f(x)] - items.sort(reverse=True) - - for key, finalizer in items: - sub_debug('calling %s', finalizer) - try: - finalizer() - except Exception: - import traceback - traceback.print_exc() - - if minpriority is None: - _finalizer_registry.clear() - -# -# Clean up on exit -# - -def is_exiting(): - ''' - Returns true if the process is shutting down - ''' - return _exiting or _exiting is None - -_exiting = False - -def _exit_function(): - global _exiting - - info('process shutting down') - debug('running all "atexit" finalizers with priority >= 0') - _run_finalizers(0) - - for p in active_children(): - if p._daemonic: - info('calling terminate() for daemon %s', p.get_name()) - p._popen.terminate() - - for p in active_children(): - info('calling join() for process %s', p.get_name()) - p.join() - - debug('running the remaining "atexit" finalizers') - _run_finalizers() - -atexit.register(_exit_function) - -# -# Some fork aware types -# - -class ForkAwareThreadLock(object): - def __init__(self): - self._lock = threading.Lock() - self.acquire = self._lock.acquire - self.release = self._lock.release - register_after_fork(self, ForkAwareThreadLock.__init__) - -class ForkAwareLocal(threading.local): - def __init__(self): - register_after_fork(self, lambda obj : obj.__dict__.clear()) - def __reduce__(self): - return type(self), () - -# -# Try making some callable types picklable -# - -def _reduce_method(m): - if m.im_self is None: - return getattr, (m.im_class, m.im_func.func_name) - else: - return getattr, (m.im_self, m.im_func.func_name) -copy_reg.pickle(type(Finalize.__init__), _reduce_method) - -def _reduce_method_descriptor(m): - return getattr, (m.__objclass__, m.__name__) -copy_reg.pickle(type(list.append), _reduce_method_descriptor) -copy_reg.pickle(type(int.__add__), _reduce_method_descriptor) - -def _reduce_builtin_function_or_method(m): - return getattr, (m.__self__, m.__name__) -copy_reg.pickle(type(list().append), _reduce_builtin_function_or_method) -copy_reg.pickle(type(int().__add__), _reduce_builtin_function_or_method) - -try: - from functools import partial -except ImportError: - pass -else: - def _reduce_partial(p): - return _rebuild_partial, (p.func, p.args, p.keywords or {}) - def _rebuild_partial(func, args, keywords): - return partial(func, *args, **keywords) - copy_reg.pickle(partial, _reduce_partial) +# +# Module providing various facilities to other parts of the package +# +# multiprocessing/util.py +# +# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# + +import itertools +import weakref +import copy_reg +import atexit +import threading # we want threading to install it's + # cleanup function before multiprocessing does + +from multiprocessing.process import current_process, active_children + +__all__ = [ + 'sub_debug', 'debug', 'info', 'sub_warning', 'get_logger', + 'log_to_stderr', 'get_temp_dir', 'register_after_fork', + 'is_exiting', 'Finalize', 'ForkAwareThreadLock', 'ForkAwareLocal' + ] + +# +# Logging +# + +NOTSET = 0 +SUBDEBUG = 5 +DEBUG = 10 +INFO = 20 +SUBWARNING = 25 + +LOGGER_NAME = 'multiprocessing' +DEFAULT_LOGGING_FORMAT = '[%(levelname)s/%(processName)s] %(message)s' + +_logger = None +_log_to_stderr = False + +def sub_debug(msg, *args): + if _logger: + _logger.log(SUBDEBUG, msg, *args) + +def debug(msg, *args): + if _logger: + _logger.log(DEBUG, msg, *args) + +def info(msg, *args): + if _logger: + _logger.log(INFO, msg, *args) + +def sub_warning(msg, *args): + if _logger: + _logger.log(SUBWARNING, msg, *args) + +def get_logger(): + ''' + Returns logger used by multiprocessing + ''' + global _logger + + if not _logger: + import logging, atexit + + # XXX multiprocessing should cleanup before logging + if hasattr(atexit, 'unregister'): + atexit.unregister(_exit_function) + atexit.register(_exit_function) + else: + atexit._exithandlers.remove((_exit_function, (), {})) + atexit._exithandlers.append((_exit_function, (), {})) + + _check_logger_class() + _logger = logging.getLogger(LOGGER_NAME) + + return _logger + +def _check_logger_class(): + ''' + Make sure process name is recorded when loggers are used + ''' + # XXX This function is unnecessary once logging is patched + import logging + if hasattr(logging, 'multiprocessing'): + return + + logging._acquireLock() + try: + OldLoggerClass = logging.getLoggerClass() + if not getattr(OldLoggerClass, '_process_aware', False): + class ProcessAwareLogger(OldLoggerClass): + _process_aware = True + def makeRecord(self, *args, **kwds): + record = OldLoggerClass.makeRecord(self, *args, **kwds) + record.processName = current_process()._name + return record + logging.setLoggerClass(ProcessAwareLogger) + finally: + logging._releaseLock() + +def log_to_stderr(level=None): + ''' + Turn on logging and add a handler which prints to stderr + ''' + global _log_to_stderr + import logging + logger = get_logger() + formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT) + handler = logging.StreamHandler() + handler.setFormatter(formatter) + logger.addHandler(handler) + if level is not None: + logger.setLevel(level) + _log_to_stderr = True + +# +# Function returning a temp directory which will be removed on exit +# + +def get_temp_dir(): + # get name of a temp directory which will be automatically cleaned up + if current_process()._tempdir is None: + import shutil, tempfile + tempdir = tempfile.mkdtemp(prefix='pymp-') + info('created temp directory %s', tempdir) + Finalize(None, shutil.rmtree, args=[tempdir], exitpriority=-100) + current_process()._tempdir = tempdir + return current_process()._tempdir + +# +# Support for reinitialization of objects when bootstrapping a child process +# + +_afterfork_registry = weakref.WeakValueDictionary() +_afterfork_counter = itertools.count() + +def _run_after_forkers(): + items = list(_afterfork_registry.items()) + items.sort() + for (index, ident, func), obj in items: + try: + func(obj) + except Exception, e: + info('after forker raised exception %s', e) + +def register_after_fork(obj, func): + _afterfork_registry[(_afterfork_counter.next(), id(obj), func)] = obj + +# +# Finalization using weakrefs +# + +_finalizer_registry = {} +_finalizer_counter = itertools.count() + + +class Finalize(object): + ''' + Class which supports object finalization using weakrefs + ''' + def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): + assert exitpriority is None or type(exitpriority) is int + + if obj is not None: + self._weakref = weakref.ref(obj, self) + else: + assert exitpriority is not None + + self._callback = callback + self._args = args + self._kwargs = kwargs or {} + self._key = (exitpriority, _finalizer_counter.next()) + + _finalizer_registry[self._key] = self + + def __call__(self, wr=None): + ''' + Run the callback unless it has already been called or cancelled + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + sub_debug('finalizer no longer registered') + else: + sub_debug('finalizer calling %s with args %s and kwargs %s', + self._callback, self._args, self._kwargs) + res = self._callback(*self._args, **self._kwargs) + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + return res + + def cancel(self): + ''' + Cancel finalization of the object + ''' + try: + del _finalizer_registry[self._key] + except KeyError: + pass + else: + self._weakref = self._callback = self._args = \ + self._kwargs = self._key = None + + def still_active(self): + ''' + Return whether this finalizer is still waiting to invoke callback + ''' + return self._key in _finalizer_registry + + def __repr__(self): + try: + obj = self._weakref() + except (AttributeError, TypeError): + obj = None + + if obj is None: + return '' + + x = '' + + +def _run_finalizers(minpriority=None): + ''' + Run all finalizers whose exit priority is not None and at least minpriority + + Finalizers with highest priority are called first; finalizers with + the same priority will be called in reverse order of creation. + ''' + if minpriority is None: + f = lambda p : p[0][0] is not None + else: + f = lambda p : p[0][0] is not None and p[0][0] >= minpriority + + items = [x for x in _finalizer_registry.items() if f(x)] + items.sort(reverse=True) + + for key, finalizer in items: + sub_debug('calling %s', finalizer) + try: + finalizer() + except Exception: + import traceback + traceback.print_exc() + + if minpriority is None: + _finalizer_registry.clear() + +# +# Clean up on exit +# + +def is_exiting(): + ''' + Returns true if the process is shutting down + ''' + return _exiting or _exiting is None + +_exiting = False + +def _exit_function(): + global _exiting + + info('process shutting down') + debug('running all "atexit" finalizers with priority >= 0') + _run_finalizers(0) + + for p in active_children(): + if p._daemonic: + info('calling terminate() for daemon %s', p.get_name()) + p._popen.terminate() + + for p in active_children(): + info('calling join() for process %s', p.get_name()) + p.join() + + debug('running the remaining "atexit" finalizers') + _run_finalizers() + +atexit.register(_exit_function) + +# +# Some fork aware types +# + +class ForkAwareThreadLock(object): + def __init__(self): + self._lock = threading.Lock() + self.acquire = self._lock.acquire + self.release = self._lock.release + register_after_fork(self, ForkAwareThreadLock.__init__) + +class ForkAwareLocal(threading.local): + def __init__(self): + register_after_fork(self, lambda obj : obj.__dict__.clear()) + def __reduce__(self): + return type(self), () + +# +# Try making some callable types picklable +# + +def _reduce_method(m): + if m.im_self is None: + return getattr, (m.im_class, m.im_func.func_name) + else: + return getattr, (m.im_self, m.im_func.func_name) +copy_reg.pickle(type(Finalize.__init__), _reduce_method) + +def _reduce_method_descriptor(m): + return getattr, (m.__objclass__, m.__name__) +copy_reg.pickle(type(list.append), _reduce_method_descriptor) +copy_reg.pickle(type(int.__add__), _reduce_method_descriptor) + +def _reduce_builtin_function_or_method(m): + return getattr, (m.__self__, m.__name__) +copy_reg.pickle(type(list().append), _reduce_builtin_function_or_method) +copy_reg.pickle(type(int().__add__), _reduce_builtin_function_or_method) + +try: + from functools import partial +except ImportError: + pass +else: + def _reduce_partial(p): + return _rebuild_partial, (p.func, p.args, p.keywords or {}) + def _rebuild_partial(func, args, keywords): + return partial(func, *args, **keywords) + copy_reg.pickle(partial, _reduce_partial) Modified: python/branches/tlee-ast-optimize/Lib/platform.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/platform.py (original) +++ python/branches/tlee-ast-optimize/Lib/platform.py Sun Jun 15 03:02:00 2008 @@ -1090,23 +1090,30 @@ """ global _uname_cache + no_os_uname = 0 if _uname_cache is not None: return _uname_cache + processor = '' + # Get some infos from the builtin os.uname API... try: system,node,release,version,machine = os.uname() - except AttributeError: - # Hmm, no uname... we'll have to poke around the system then. - system = sys.platform - release = '' - version = '' - node = _node() - machine = '' - processor = '' - use_syscmd_ver = 1 + no_os_uname = 1 + + if no_os_uname or not filter(None, (system, node, release, version, machine)): + # Hmm, no there is either no uname or uname has returned + #'unknowns'... we'll have to poke around the system then. + if no_os_uname: + system = sys.platform + release = '' + version = '' + node = _node() + machine = '' + + use_syscmd_ver = 01 # Try win32_ver() on win32 platforms if system == 'win32': @@ -1117,8 +1124,10 @@ # available on Win XP and later; see # http://support.microsoft.com/kb/888731 and # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM - machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') - processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) + if not machine: + machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') + if not processor: + processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) # Try the 'ver' system command available on some # platforms @@ -1160,30 +1169,28 @@ release,(version,stage,nonrel),machine = mac_ver() system = 'MacOS' - else: - # System specific extensions - if system == 'OpenVMS': - # OpenVMS seems to have release and version mixed up - if not release or release == '0': - release = version - version = '' - # Get processor information - try: - import vms_lib - except ImportError: - pass - else: - csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) - if (cpu_number >= 128): - processor = 'Alpha' - else: - processor = 'VAX' + # System specific extensions + if system == 'OpenVMS': + # OpenVMS seems to have release and version mixed up + if not release or release == '0': + release = version + version = '' + # Get processor information + try: + import vms_lib + except ImportError: + pass else: - # Get processor information from the uname system command - processor = _syscmd_uname('-p','') + csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) + if (cpu_number >= 128): + processor = 'Alpha' + else: + processor = 'VAX' + if not processor: + # Get processor information from the uname system command + processor = _syscmd_uname('-p','') - # 'unknown' is not really any useful as information; we'll convert - # it to '' which is more portable + #If any unknowns still exist, replace them with ''s, which are more portable if system == 'unknown': system = '' if node == 'unknown': Modified: python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py Sun Jun 15 03:02:00 2008 @@ -1,415 +1,415 @@ -import asyncore -import unittest -import select -import os -import socket -import threading -import sys -import time - -from test import test_support -from test.test_support import TESTFN, run_unittest, unlink -from StringIO import StringIO - -HOST = test_support.HOST - -class dummysocket: - def __init__(self): - self.closed = False - - def close(self): - self.closed = True - - def fileno(self): - return 42 - -class dummychannel: - def __init__(self): - self.socket = dummysocket() - - def close(self): - self.socket.close() - -class exitingdummy: - def __init__(self): - pass - - def handle_read_event(self): - raise asyncore.ExitNow() - - handle_write_event = handle_read_event - handle_expt_event = handle_read_event - -class crashingdummy: - def __init__(self): - self.error_handled = False - - def handle_read_event(self): - raise Exception() - - handle_write_event = handle_read_event - handle_expt_event = handle_read_event - - def handle_error(self): - self.error_handled = True - -# used when testing senders; just collects what it gets until newline is sent -def capture_server(evt, buf, serv): - try: - serv.listen(5) - conn, addr = serv.accept() - except socket.timeout: - pass - else: - n = 200 - while n > 0: - r, w, e = select.select([conn], [], []) - if r: - data = conn.recv(10) - # keep everything except for the newline terminator - buf.write(data.replace('\n', '')) - if '\n' in data: - break - n -= 1 - time.sleep(0.01) - - conn.close() - finally: - serv.close() - evt.set() - - -class HelperFunctionTests(unittest.TestCase): - def test_readwriteexc(self): - # Check exception handling behavior of read, write and _exception - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore read/write/_exception calls - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) - self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) - self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.read(tr2) - self.assertEqual(tr2.error_handled, True) - - tr2 = crashingdummy() - asyncore.write(tr2) - self.assertEqual(tr2.error_handled, True) - - tr2 = crashingdummy() - asyncore._exception(tr2) - self.assertEqual(tr2.error_handled, True) - - # asyncore.readwrite uses constants in the select module that - # are not present in Windows systems (see this thread: - # http://mail.python.org/pipermail/python-list/2001-October/109973.html) - # These constants should be present as long as poll is available - - if hasattr(select, 'poll'): - def test_readwrite(self): - # Check that correct methods are called by readwrite() - - class testobj: - def __init__(self): - self.read = False - self.write = False - self.expt = False - - def handle_read_event(self): - self.read = True - - def handle_write_event(self): - self.write = True - - def handle_expt_event(self): - self.expt = True - - def handle_error(self): - self.error_handled = True - - for flag in (select.POLLIN, select.POLLPRI): - tobj = testobj() - self.assertEqual(tobj.read, False) - asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.read, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite call - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, flag) - self.assertEqual(tr2.error_handled, True) - - tobj = testobj() - self.assertEqual(tobj.write, False) - asyncore.readwrite(tobj, select.POLLOUT) - self.assertEqual(tobj.write, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite call - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, - select.POLLOUT) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, select.POLLOUT) - self.assertEqual(tr2.error_handled, True) - - for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): - tobj = testobj() - self.assertEqual(tobj.expt, False) - asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.expt, True) - - # check that ExitNow exceptions in the object handler method - # bubbles all the way up through asyncore readwrite calls - tr1 = exitingdummy() - self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) - - # check that an exception other than ExitNow in the object handler - # method causes the handle_error method to get called - tr2 = crashingdummy() - asyncore.readwrite(tr2, flag) - self.assertEqual(tr2.error_handled, True) - - def test_closeall(self): - self.closeall_check(False) - - def test_closeall_default(self): - self.closeall_check(True) - - def closeall_check(self, usedefault): - # Check that close_all() closes everything in a given map - - l = [] - testmap = {} - for i in range(10): - c = dummychannel() - l.append(c) - self.assertEqual(c.socket.closed, False) - testmap[i] = c - - if usedefault: - socketmap = asyncore.socket_map - try: - asyncore.socket_map = testmap - asyncore.close_all() - finally: - testmap, asyncore.socket_map = asyncore.socket_map, socketmap - else: - asyncore.close_all(testmap) - - self.assertEqual(len(testmap), 0) - - for c in l: - self.assertEqual(c.socket.closed, True) - - def test_compact_traceback(self): - try: - raise Exception("I don't like spam!") - except: - real_t, real_v, real_tb = sys.exc_info() - r = asyncore.compact_traceback() - else: - self.fail("Expected exception") - - (f, function, line), t, v, info = r - self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') - self.assertEqual(function, 'test_compact_traceback') - self.assertEqual(t, real_t) - self.assertEqual(v, real_v) - self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) - - -class DispatcherTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - asyncore.close_all() - - def test_basic(self): - d = asyncore.dispatcher() - self.assertEqual(d.readable(), True) - self.assertEqual(d.writable(), True) - - def test_repr(self): - d = asyncore.dispatcher() - self.assertEqual(repr(d), '' % id(d)) - - def test_log(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log() (to stderr) - fp = StringIO() - stderr = sys.stderr - l1 = "Lovely spam! Wonderful spam!" - l2 = "I don't like spam!" - try: - sys.stderr = fp - d.log(l1) - d.log(l2) - finally: - sys.stderr = stderr - - lines = fp.getvalue().splitlines() - self.assertEquals(lines, ['log: %s' % l1, 'log: %s' % l2]) - - def test_log_info(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log_info() (to stdout via print) - fp = StringIO() - stdout = sys.stdout - l1 = "Have you got anything without spam?" - l2 = "Why can't she have egg bacon spam and sausage?" - l3 = "THAT'S got spam in it!" - try: - sys.stdout = fp - d.log_info(l1, 'EGGS') - d.log_info(l2) - d.log_info(l3, 'SPAM') - finally: - sys.stdout = stdout - - lines = fp.getvalue().splitlines() - if __debug__: - expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] - else: - expected = ['EGGS: %s' % l1, 'SPAM: %s' % l3] - - self.assertEquals(lines, expected) - - def test_unhandled(self): - d = asyncore.dispatcher() - - # capture output of dispatcher.log_info() (to stdout via print) - fp = StringIO() - stdout = sys.stdout - try: - sys.stdout = fp - d.handle_expt() - d.handle_read() - d.handle_write() - d.handle_connect() - d.handle_accept() - finally: - sys.stdout = stdout - - lines = fp.getvalue().splitlines() - expected = ['warning: unhandled exception', - 'warning: unhandled read event', - 'warning: unhandled write event', - 'warning: unhandled connect event', - 'warning: unhandled accept event'] - self.assertEquals(lines, expected) - - - -class dispatcherwithsend_noread(asyncore.dispatcher_with_send): - def readable(self): - return False - - def handle_connect(self): - pass - -class DispatcherWithSendTests(unittest.TestCase): - usepoll = False - - def setUp(self): - pass - - def tearDown(self): - asyncore.close_all() - - def test_send(self): - self.evt = threading.Event() - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.sock.settimeout(3) - self.port = test_support.bind_port(self.sock) - - cap = StringIO() - args = (self.evt, cap, self.sock) - threading.Thread(target=capture_server, args=args).start() - - # wait a little longer for the server to initialize (it sometimes - # refuses connections on slow machines without this wait) - time.sleep(0.2) - - data = "Suppose there isn't a 16-ton weight?" - d = dispatcherwithsend_noread() - d.create_socket(socket.AF_INET, socket.SOCK_STREAM) - d.connect((HOST, self.port)) - - # give time for socket to connect - time.sleep(0.1) - - d.send(data) - d.send(data) - d.send('\n') - - n = 1000 - while d.out_buffer and n > 0: - asyncore.poll() - n -= 1 - - self.evt.wait() - - self.assertEqual(cap.getvalue(), data*2) - - -class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): - usepoll = True - -if hasattr(asyncore, 'file_wrapper'): - class FileWrapperTest(unittest.TestCase): - def setUp(self): - self.d = "It's not dead, it's sleeping!" - file(TESTFN, 'w').write(self.d) - - def tearDown(self): - unlink(TESTFN) - - def test_recv(self): - fd = os.open(TESTFN, os.O_RDONLY) - w = asyncore.file_wrapper(fd) - - self.assertNotEqual(w.fd, fd) - self.assertNotEqual(w.fileno(), fd) - self.assertEqual(w.recv(13), "It's not dead") - self.assertEqual(w.read(6), ", it's") - w.close() - self.assertRaises(OSError, w.read, 1) - - def test_send(self): - d1 = "Come again?" - d2 = "I want to buy some cheese." - fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) - w = asyncore.file_wrapper(fd) - - w.write(d1) - w.send(d2) - w.close() - self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) - - -def test_main(): - tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, - DispatcherWithSendTests_UsePoll] - if hasattr(asyncore, 'file_wrapper'): - tests.append(FileWrapperTest) - - run_unittest(*tests) - -if __name__ == "__main__": - test_main() +import asyncore +import unittest +import select +import os +import socket +import threading +import sys +import time + +from test import test_support +from test.test_support import TESTFN, run_unittest, unlink +from StringIO import StringIO + +HOST = test_support.HOST + +class dummysocket: + def __init__(self): + self.closed = False + + def close(self): + self.closed = True + + def fileno(self): + return 42 + +class dummychannel: + def __init__(self): + self.socket = dummysocket() + + def close(self): + self.socket.close() + +class exitingdummy: + def __init__(self): + pass + + def handle_read_event(self): + raise asyncore.ExitNow() + + handle_write_event = handle_read_event + handle_expt_event = handle_read_event + +class crashingdummy: + def __init__(self): + self.error_handled = False + + def handle_read_event(self): + raise Exception() + + handle_write_event = handle_read_event + handle_expt_event = handle_read_event + + def handle_error(self): + self.error_handled = True + +# used when testing senders; just collects what it gets until newline is sent +def capture_server(evt, buf, serv): + try: + serv.listen(5) + conn, addr = serv.accept() + except socket.timeout: + pass + else: + n = 200 + while n > 0: + r, w, e = select.select([conn], [], []) + if r: + data = conn.recv(10) + # keep everything except for the newline terminator + buf.write(data.replace('\n', '')) + if '\n' in data: + break + n -= 1 + time.sleep(0.01) + + conn.close() + finally: + serv.close() + evt.set() + + +class HelperFunctionTests(unittest.TestCase): + def test_readwriteexc(self): + # Check exception handling behavior of read, write and _exception + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore read/write/_exception calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.read, tr1) + self.assertRaises(asyncore.ExitNow, asyncore.write, tr1) + self.assertRaises(asyncore.ExitNow, asyncore._exception, tr1) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.read(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore.write(tr2) + self.assertEqual(tr2.error_handled, True) + + tr2 = crashingdummy() + asyncore._exception(tr2) + self.assertEqual(tr2.error_handled, True) + + # asyncore.readwrite uses constants in the select module that + # are not present in Windows systems (see this thread: + # http://mail.python.org/pipermail/python-list/2001-October/109973.html) + # These constants should be present as long as poll is available + + if hasattr(select, 'poll'): + def test_readwrite(self): + # Check that correct methods are called by readwrite() + + class testobj: + def __init__(self): + self.read = False + self.write = False + self.expt = False + + def handle_read_event(self): + self.read = True + + def handle_write_event(self): + self.write = True + + def handle_expt_event(self): + self.expt = True + + def handle_error(self): + self.error_handled = True + + for flag in (select.POLLIN, select.POLLPRI): + tobj = testobj() + self.assertEqual(tobj.read, False) + asyncore.readwrite(tobj, flag) + self.assertEqual(tobj.read, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + tobj = testobj() + self.assertEqual(tobj.write, False) + asyncore.readwrite(tobj, select.POLLOUT) + self.assertEqual(tobj.write, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite call + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, + select.POLLOUT) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, select.POLLOUT) + self.assertEqual(tr2.error_handled, True) + + for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): + tobj = testobj() + self.assertEqual(tobj.expt, False) + asyncore.readwrite(tobj, flag) + self.assertEqual(tobj.expt, True) + + # check that ExitNow exceptions in the object handler method + # bubbles all the way up through asyncore readwrite calls + tr1 = exitingdummy() + self.assertRaises(asyncore.ExitNow, asyncore.readwrite, tr1, flag) + + # check that an exception other than ExitNow in the object handler + # method causes the handle_error method to get called + tr2 = crashingdummy() + asyncore.readwrite(tr2, flag) + self.assertEqual(tr2.error_handled, True) + + def test_closeall(self): + self.closeall_check(False) + + def test_closeall_default(self): + self.closeall_check(True) + + def closeall_check(self, usedefault): + # Check that close_all() closes everything in a given map + + l = [] + testmap = {} + for i in range(10): + c = dummychannel() + l.append(c) + self.assertEqual(c.socket.closed, False) + testmap[i] = c + + if usedefault: + socketmap = asyncore.socket_map + try: + asyncore.socket_map = testmap + asyncore.close_all() + finally: + testmap, asyncore.socket_map = asyncore.socket_map, socketmap + else: + asyncore.close_all(testmap) + + self.assertEqual(len(testmap), 0) + + for c in l: + self.assertEqual(c.socket.closed, True) + + def test_compact_traceback(self): + try: + raise Exception("I don't like spam!") + except: + real_t, real_v, real_tb = sys.exc_info() + r = asyncore.compact_traceback() + else: + self.fail("Expected exception") + + (f, function, line), t, v, info = r + self.assertEqual(os.path.split(f)[-1], 'test_asyncore.py') + self.assertEqual(function, 'test_compact_traceback') + self.assertEqual(t, real_t) + self.assertEqual(v, real_v) + self.assertEqual(info, '[%s|%s|%s]' % (f, function, line)) + + +class DispatcherTests(unittest.TestCase): + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_basic(self): + d = asyncore.dispatcher() + self.assertEqual(d.readable(), True) + self.assertEqual(d.writable(), True) + + def test_repr(self): + d = asyncore.dispatcher() + self.assertEqual(repr(d), '' % id(d)) + + def test_log(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log() (to stderr) + fp = StringIO() + stderr = sys.stderr + l1 = "Lovely spam! Wonderful spam!" + l2 = "I don't like spam!" + try: + sys.stderr = fp + d.log(l1) + d.log(l2) + finally: + sys.stderr = stderr + + lines = fp.getvalue().splitlines() + self.assertEquals(lines, ['log: %s' % l1, 'log: %s' % l2]) + + def test_log_info(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + l1 = "Have you got anything without spam?" + l2 = "Why can't she have egg bacon spam and sausage?" + l3 = "THAT'S got spam in it!" + try: + sys.stdout = fp + d.log_info(l1, 'EGGS') + d.log_info(l2) + d.log_info(l3, 'SPAM') + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + if __debug__: + expected = ['EGGS: %s' % l1, 'info: %s' % l2, 'SPAM: %s' % l3] + else: + expected = ['EGGS: %s' % l1, 'SPAM: %s' % l3] + + self.assertEquals(lines, expected) + + def test_unhandled(self): + d = asyncore.dispatcher() + + # capture output of dispatcher.log_info() (to stdout via print) + fp = StringIO() + stdout = sys.stdout + try: + sys.stdout = fp + d.handle_expt() + d.handle_read() + d.handle_write() + d.handle_connect() + d.handle_accept() + finally: + sys.stdout = stdout + + lines = fp.getvalue().splitlines() + expected = ['warning: unhandled exception', + 'warning: unhandled read event', + 'warning: unhandled write event', + 'warning: unhandled connect event', + 'warning: unhandled accept event'] + self.assertEquals(lines, expected) + + + +class dispatcherwithsend_noread(asyncore.dispatcher_with_send): + def readable(self): + return False + + def handle_connect(self): + pass + +class DispatcherWithSendTests(unittest.TestCase): + usepoll = False + + def setUp(self): + pass + + def tearDown(self): + asyncore.close_all() + + def test_send(self): + self.evt = threading.Event() + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.sock.settimeout(3) + self.port = test_support.bind_port(self.sock) + + cap = StringIO() + args = (self.evt, cap, self.sock) + threading.Thread(target=capture_server, args=args).start() + + # wait a little longer for the server to initialize (it sometimes + # refuses connections on slow machines without this wait) + time.sleep(0.2) + + data = "Suppose there isn't a 16-ton weight?" + d = dispatcherwithsend_noread() + d.create_socket(socket.AF_INET, socket.SOCK_STREAM) + d.connect((HOST, self.port)) + + # give time for socket to connect + time.sleep(0.1) + + d.send(data) + d.send(data) + d.send('\n') + + n = 1000 + while d.out_buffer and n > 0: + asyncore.poll() + n -= 1 + + self.evt.wait() + + self.assertEqual(cap.getvalue(), data*2) + + +class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): + usepoll = True + +if hasattr(asyncore, 'file_wrapper'): + class FileWrapperTest(unittest.TestCase): + def setUp(self): + self.d = "It's not dead, it's sleeping!" + file(TESTFN, 'w').write(self.d) + + def tearDown(self): + unlink(TESTFN) + + def test_recv(self): + fd = os.open(TESTFN, os.O_RDONLY) + w = asyncore.file_wrapper(fd) + + self.assertNotEqual(w.fd, fd) + self.assertNotEqual(w.fileno(), fd) + self.assertEqual(w.recv(13), "It's not dead") + self.assertEqual(w.read(6), ", it's") + w.close() + self.assertRaises(OSError, w.read, 1) + + def test_send(self): + d1 = "Come again?" + d2 = "I want to buy some cheese." + fd = os.open(TESTFN, os.O_WRONLY | os.O_APPEND) + w = asyncore.file_wrapper(fd) + + w.write(d1) + w.send(d2) + w.close() + self.assertEqual(file(TESTFN).read(), self.d + d1 + d2) + + +def test_main(): + tests = [HelperFunctionTests, DispatcherTests, DispatcherWithSendTests, + DispatcherWithSendTests_UsePoll] + if hasattr(asyncore, 'file_wrapper'): + tests.append(FileWrapperTest) + + run_unittest(*tests) + +if __name__ == "__main__": + test_main() Modified: python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py Sun Jun 15 03:02:00 2008 @@ -1,1791 +1,1791 @@ -# -# Unit tests for the multiprocessing package -# - -import unittest -import threading -import Queue -import time -import sys -import os -import gc -import signal -import array -import copy -import socket -import random -import logging - -import multiprocessing.dummy -import multiprocessing.connection -import multiprocessing.managers -import multiprocessing.heap -import multiprocessing.managers -import multiprocessing.pool -import _multiprocessing - -from multiprocessing import util - -# -# -# - -if sys.version_info >= (3, 0): - def latin(s): - return s.encode('latin') -else: - latin = str - -try: - bytes -except NameError: - bytes = str - def bytearray(seq): - return array.array('c', seq) - -# -# Constants -# - -LOG_LEVEL = util.SUBWARNING -#LOG_LEVEL = logging.WARNING - -DELTA = 0.1 -CHECK_TIMINGS = False # making true makes tests take a lot longer - # and can sometimes cause some non-serious - # failures because some calls block a bit - # longer than expected -if CHECK_TIMINGS: - TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.82, 0.35, 1.4 -else: - TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.1, 0.1, 0.1 - -HAVE_GETVALUE = not getattr(_multiprocessing, - 'HAVE_BROKEN_SEM_GETVALUE', False) - -# -# Creates a wrapper for a function which records the time it takes to finish -# - -class TimingWrapper(object): - - def __init__(self, func): - self.func = func - self.elapsed = None - - def __call__(self, *args, **kwds): - t = time.time() - try: - return self.func(*args, **kwds) - finally: - self.elapsed = time.time() - t - -# -# Base class for test cases -# - -class BaseTestCase(object): - - ALLOWED_TYPES = ('processes', 'manager', 'threads') - - def assertTimingAlmostEqual(self, a, b): - if CHECK_TIMINGS: - self.assertAlmostEqual(a, b, 1) - - def assertReturnsIfImplemented(self, value, func, *args): - try: - res = func(*args) - except NotImplementedError: - pass - else: - return self.assertEqual(value, res) - -# -# Return the value of a semaphore -# - -def get_value(self): - try: - return self.get_value() - except AttributeError: - try: - return self._Semaphore__value - except AttributeError: - try: - return self._value - except AttributeError: - raise NotImplementedError - -# -# Testcases -# - -class _TestProcess(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def test_current(self): - if self.TYPE == 'threads': - return - - current = self.current_process() - authkey = current.get_authkey() - - self.assertTrue(current.is_alive()) - self.assertTrue(not current.is_daemon()) - self.assertTrue(isinstance(authkey, bytes)) - self.assertTrue(len(authkey) > 0) - self.assertEqual(current.get_ident(), os.getpid()) - self.assertEqual(current.get_exitcode(), None) - - def _test(self, q, *args, **kwds): - current = self.current_process() - q.put(args) - q.put(kwds) - q.put(current.get_name()) - if self.TYPE != 'threads': - q.put(bytes(current.get_authkey())) - q.put(current.pid) - - def test_process(self): - q = self.Queue(1) - e = self.Event() - args = (q, 1, 2) - kwargs = {'hello':23, 'bye':2.54} - name = 'SomeProcess' - p = self.Process( - target=self._test, args=args, kwargs=kwargs, name=name - ) - p.set_daemon(True) - current = self.current_process() - - if self.TYPE != 'threads': - self.assertEquals(p.get_authkey(), current.get_authkey()) - self.assertEquals(p.is_alive(), False) - self.assertEquals(p.is_daemon(), True) - self.assertTrue(p not in self.active_children()) - self.assertTrue(type(self.active_children()) is list) - self.assertEqual(p.get_exitcode(), None) - - p.start() - - self.assertEquals(p.get_exitcode(), None) - self.assertEquals(p.is_alive(), True) - self.assertTrue(p in self.active_children()) - - self.assertEquals(q.get(), args[1:]) - self.assertEquals(q.get(), kwargs) - self.assertEquals(q.get(), p.get_name()) - if self.TYPE != 'threads': - self.assertEquals(q.get(), current.get_authkey()) - self.assertEquals(q.get(), p.pid) - - p.join() - - self.assertEquals(p.get_exitcode(), 0) - self.assertEquals(p.is_alive(), False) - self.assertTrue(p not in self.active_children()) - - def _test_terminate(self): - time.sleep(1000) - - def test_terminate(self): - if self.TYPE == 'threads': - return - - p = self.Process(target=self._test_terminate) - p.set_daemon(True) - p.start() - - self.assertEqual(p.is_alive(), True) - self.assertTrue(p in self.active_children()) - self.assertEqual(p.get_exitcode(), None) - - p.terminate() - - join = TimingWrapper(p.join) - self.assertEqual(join(), None) - self.assertTimingAlmostEqual(join.elapsed, 0.0) - - self.assertEqual(p.is_alive(), False) - self.assertTrue(p not in self.active_children()) - - p.join() - - # XXX sometimes get p.get_exitcode() == 0 on Windows ... - #self.assertEqual(p.get_exitcode(), -signal.SIGTERM) - - def test_cpu_count(self): - try: - cpus = multiprocessing.cpu_count() - except NotImplementedError: - cpus = 1 - self.assertTrue(type(cpus) is int) - self.assertTrue(cpus >= 1) - - def test_active_children(self): - self.assertEqual(type(self.active_children()), list) - - p = self.Process(target=time.sleep, args=(DELTA,)) - self.assertTrue(p not in self.active_children()) - - p.start() - self.assertTrue(p in self.active_children()) - - p.join() - self.assertTrue(p not in self.active_children()) - - def _test_recursion(self, wconn, id): - from multiprocessing import forking - wconn.send(id) - if len(id) < 2: - for i in range(2): - p = self.Process( - target=self._test_recursion, args=(wconn, id+[i]) - ) - p.start() - p.join() - - def test_recursion(self): - rconn, wconn = self.Pipe(duplex=False) - self._test_recursion(wconn, []) - - time.sleep(DELTA) - result = [] - while rconn.poll(): - result.append(rconn.recv()) - - expected = [ - [], - [0], - [0, 0], - [0, 1], - [1], - [1, 0], - [1, 1] - ] - self.assertEqual(result, expected) - -# -# -# - -class _UpperCaser(multiprocessing.Process): - - def __init__(self): - multiprocessing.Process.__init__(self) - self.child_conn, self.parent_conn = multiprocessing.Pipe() - - def run(self): - self.parent_conn.close() - for s in iter(self.child_conn.recv, None): - self.child_conn.send(s.upper()) - self.child_conn.close() - - def submit(self, s): - assert type(s) is str - self.parent_conn.send(s) - return self.parent_conn.recv() - - def stop(self): - self.parent_conn.send(None) - self.parent_conn.close() - self.child_conn.close() - -class _TestSubclassingProcess(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_subclassing(self): - uppercaser = _UpperCaser() - uppercaser.start() - self.assertEqual(uppercaser.submit('hello'), 'HELLO') - self.assertEqual(uppercaser.submit('world'), 'WORLD') - uppercaser.stop() - uppercaser.join() - -# -# -# - -def queue_empty(q): - if hasattr(q, 'empty'): - return q.empty() - else: - return q.qsize() == 0 - -def queue_full(q, maxsize): - if hasattr(q, 'full'): - return q.full() - else: - return q.qsize() == maxsize - - -class _TestQueue(BaseTestCase): - - - def _test_put(self, queue, child_can_start, parent_can_continue): - child_can_start.wait() - for i in range(6): - queue.get() - parent_can_continue.set() - - def test_put(self): - MAXSIZE = 6 - queue = self.Queue(maxsize=MAXSIZE) - child_can_start = self.Event() - parent_can_continue = self.Event() - - proc = self.Process( - target=self._test_put, - args=(queue, child_can_start, parent_can_continue) - ) - proc.set_daemon(True) - proc.start() - - self.assertEqual(queue_empty(queue), True) - self.assertEqual(queue_full(queue, MAXSIZE), False) - - queue.put(1) - queue.put(2, True) - queue.put(3, True, None) - queue.put(4, False) - queue.put(5, False, None) - queue.put_nowait(6) - - # the values may be in buffer but not yet in pipe so sleep a bit - time.sleep(DELTA) - - self.assertEqual(queue_empty(queue), False) - self.assertEqual(queue_full(queue, MAXSIZE), True) - - put = TimingWrapper(queue.put) - put_nowait = TimingWrapper(queue.put_nowait) - - self.assertRaises(Queue.Full, put, 7, False) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, False, None) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put_nowait, 7) - self.assertTimingAlmostEqual(put_nowait.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, True, TIMEOUT1) - self.assertTimingAlmostEqual(put.elapsed, TIMEOUT1) - - self.assertRaises(Queue.Full, put, 7, False, TIMEOUT2) - self.assertTimingAlmostEqual(put.elapsed, 0) - - self.assertRaises(Queue.Full, put, 7, True, timeout=TIMEOUT3) - self.assertTimingAlmostEqual(put.elapsed, TIMEOUT3) - - child_can_start.set() - parent_can_continue.wait() - - self.assertEqual(queue_empty(queue), True) - self.assertEqual(queue_full(queue, MAXSIZE), False) - - proc.join() - - def _test_get(self, queue, child_can_start, parent_can_continue): - child_can_start.wait() - queue.put(1) - queue.put(2) - queue.put(3) - queue.put(4) - queue.put(5) - parent_can_continue.set() - - def test_get(self): - queue = self.Queue() - child_can_start = self.Event() - parent_can_continue = self.Event() - - proc = self.Process( - target=self._test_get, - args=(queue, child_can_start, parent_can_continue) - ) - proc.set_daemon(True) - proc.start() - - self.assertEqual(queue_empty(queue), True) - - child_can_start.set() - parent_can_continue.wait() - - time.sleep(DELTA) - self.assertEqual(queue_empty(queue), False) - - self.assertEqual(queue.get(), 1) - self.assertEqual(queue.get(True, None), 2) - self.assertEqual(queue.get(True), 3) - self.assertEqual(queue.get(timeout=1), 4) - self.assertEqual(queue.get_nowait(), 5) - - self.assertEqual(queue_empty(queue), True) - - get = TimingWrapper(queue.get) - get_nowait = TimingWrapper(queue.get_nowait) - - self.assertRaises(Queue.Empty, get, False) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get, False, None) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get_nowait) - self.assertTimingAlmostEqual(get_nowait.elapsed, 0) - - self.assertRaises(Queue.Empty, get, True, TIMEOUT1) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) - - self.assertRaises(Queue.Empty, get, False, TIMEOUT2) - self.assertTimingAlmostEqual(get.elapsed, 0) - - self.assertRaises(Queue.Empty, get, timeout=TIMEOUT3) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT3) - - proc.join() - - def _test_fork(self, queue): - for i in range(10, 20): - queue.put(i) - # note that at this point the items may only be buffered, so the - # process cannot shutdown until the feeder thread has finished - # pushing items onto the pipe. - - def test_fork(self): - # Old versions of Queue would fail to create a new feeder - # thread for a forked process if the original process had its - # own feeder thread. This test checks that this no longer - # happens. - - queue = self.Queue() - - # put items on queue so that main process starts a feeder thread - for i in range(10): - queue.put(i) - - # wait to make sure thread starts before we fork a new process - time.sleep(DELTA) - - # fork process - p = self.Process(target=self._test_fork, args=(queue,)) - p.start() - - # check that all expected items are in the queue - for i in range(20): - self.assertEqual(queue.get(), i) - self.assertRaises(Queue.Empty, queue.get, False) - - p.join() - - def test_qsize(self): - q = self.Queue() - try: - self.assertEqual(q.qsize(), 0) - except NotImplementedError: - return - q.put(1) - self.assertEqual(q.qsize(), 1) - q.put(5) - self.assertEqual(q.qsize(), 2) - q.get() - self.assertEqual(q.qsize(), 1) - q.get() - self.assertEqual(q.qsize(), 0) - - def _test_task_done(self, q): - for obj in iter(q.get, None): - time.sleep(DELTA) - q.task_done() - - def test_task_done(self): - queue = self.JoinableQueue() - - if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'): - return - - workers = [self.Process(target=self._test_task_done, args=(queue,)) - for i in xrange(4)] - - for p in workers: - p.start() - - for i in xrange(10): - queue.put(i) - - queue.join() - - for p in workers: - queue.put(None) - - for p in workers: - p.join() - -# -# -# - -class _TestLock(BaseTestCase): - - def test_lock(self): - lock = self.Lock() - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(False), False) - self.assertEqual(lock.release(), None) - self.assertRaises((ValueError, threading.ThreadError), lock.release) - - def test_rlock(self): - lock = self.RLock() - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.acquire(), True) - self.assertEqual(lock.release(), None) - self.assertEqual(lock.release(), None) - self.assertEqual(lock.release(), None) - self.assertRaises((AssertionError, RuntimeError), lock.release) - - -class _TestSemaphore(BaseTestCase): - - def _test_semaphore(self, sem): - self.assertReturnsIfImplemented(2, get_value, sem) - self.assertEqual(sem.acquire(), True) - self.assertReturnsIfImplemented(1, get_value, sem) - self.assertEqual(sem.acquire(), True) - self.assertReturnsIfImplemented(0, get_value, sem) - self.assertEqual(sem.acquire(False), False) - self.assertReturnsIfImplemented(0, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(1, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(2, get_value, sem) - - def test_semaphore(self): - sem = self.Semaphore(2) - self._test_semaphore(sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(3, get_value, sem) - self.assertEqual(sem.release(), None) - self.assertReturnsIfImplemented(4, get_value, sem) - - def test_bounded_semaphore(self): - sem = self.BoundedSemaphore(2) - self._test_semaphore(sem) - # Currently fails on OS/X - #if HAVE_GETVALUE: - # self.assertRaises(ValueError, sem.release) - # self.assertReturnsIfImplemented(2, get_value, sem) - - def test_timeout(self): - if self.TYPE != 'processes': - return - - sem = self.Semaphore(0) - acquire = TimingWrapper(sem.acquire) - - self.assertEqual(acquire(False), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0.0) - - self.assertEqual(acquire(False, None), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0.0) - - self.assertEqual(acquire(False, TIMEOUT1), False) - self.assertTimingAlmostEqual(acquire.elapsed, 0) - - self.assertEqual(acquire(True, TIMEOUT2), False) - self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT2) - - self.assertEqual(acquire(timeout=TIMEOUT3), False) - self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT3) - - -class _TestCondition(BaseTestCase): - - def f(self, cond, sleeping, woken, timeout=None): - cond.acquire() - sleeping.release() - cond.wait(timeout) - woken.release() - cond.release() - - def check_invariant(self, cond): - # this is only supposed to succeed when there are no sleepers - if self.TYPE == 'processes': - try: - sleepers = (cond._sleeping_count.get_value() - - cond._woken_count.get_value()) - self.assertEqual(sleepers, 0) - self.assertEqual(cond._wait_semaphore.get_value(), 0) - except NotImplementedError: - pass - - def test_notify(self): - cond = self.Condition() - sleeping = self.Semaphore(0) - woken = self.Semaphore(0) - - p = self.Process(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - # wait for both children to start sleeping - sleeping.acquire() - sleeping.acquire() - - # check no process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(0, get_value, woken) - - # wake up one process/thread - cond.acquire() - cond.notify() - cond.release() - - # check one process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(1, get_value, woken) - - # wake up another - cond.acquire() - cond.notify() - cond.release() - - # check other has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(2, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - p.join() - - def test_notify_all(self): - cond = self.Condition() - sleeping = self.Semaphore(0) - woken = self.Semaphore(0) - - # start some threads/processes which will timeout - for i in range(3): - p = self.Process(target=self.f, - args=(cond, sleeping, woken, TIMEOUT1)) - p.set_daemon(True) - p.start() - - t = threading.Thread(target=self.f, - args=(cond, sleeping, woken, TIMEOUT1)) - t.set_daemon(True) - t.start() - - # wait for them all to sleep - for i in xrange(6): - sleeping.acquire() - - # check they have all timed out - for i in xrange(6): - woken.acquire() - self.assertReturnsIfImplemented(0, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - - # start some more threads/processes - for i in range(3): - p = self.Process(target=self.f, args=(cond, sleeping, woken)) - p.set_daemon(True) - p.start() - - t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) - t.set_daemon(True) - t.start() - - # wait for them to all sleep - for i in xrange(6): - sleeping.acquire() - - # check no process/thread has woken up - time.sleep(DELTA) - self.assertReturnsIfImplemented(0, get_value, woken) - - # wake them all up - cond.acquire() - cond.notify_all() - cond.release() - - # check they have all woken - time.sleep(DELTA) - self.assertReturnsIfImplemented(6, get_value, woken) - - # check state is not mucked up - self.check_invariant(cond) - - def test_timeout(self): - cond = self.Condition() - wait = TimingWrapper(cond.wait) - cond.acquire() - res = wait(TIMEOUT1) - cond.release() - self.assertEqual(res, None) - self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) - - -class _TestEvent(BaseTestCase): - - def _test_event(self, event): - time.sleep(TIMEOUT2) - event.set() - - def test_event(self): - event = self.Event() - wait = TimingWrapper(event.wait) - - # Removed temporaily, due to API shear, this does not - # work with threading._Event objects. is_set == isSet - #self.assertEqual(event.is_set(), False) - - self.assertEqual(wait(0.0), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - self.assertEqual(wait(TIMEOUT1), None) - self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) - - event.set() - - # See note above on the API differences - # self.assertEqual(event.is_set(), True) - self.assertEqual(wait(), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - self.assertEqual(wait(TIMEOUT1), None) - self.assertTimingAlmostEqual(wait.elapsed, 0.0) - # self.assertEqual(event.is_set(), True) - - event.clear() - - #self.assertEqual(event.is_set(), False) - - self.Process(target=self._test_event, args=(event,)).start() - self.assertEqual(wait(), None) - -# -# -# - -class _TestValue(BaseTestCase): - - codes_values = [ - ('i', 4343, 24234), - ('d', 3.625, -4.25), - ('h', -232, 234), - ('c', latin('x'), latin('y')) - ] - - def _test(self, values): - for sv, cv in zip(values, self.codes_values): - sv.value = cv[2] - - - def test_value(self, raw=False): - if self.TYPE != 'processes': - return - - if raw: - values = [self.RawValue(code, value) - for code, value, _ in self.codes_values] - else: - values = [self.Value(code, value) - for code, value, _ in self.codes_values] - - for sv, cv in zip(values, self.codes_values): - self.assertEqual(sv.value, cv[1]) - - proc = self.Process(target=self._test, args=(values,)) - proc.start() - proc.join() - - for sv, cv in zip(values, self.codes_values): - self.assertEqual(sv.value, cv[2]) - - def test_rawvalue(self): - self.test_value(raw=True) - - def test_getobj_getlock(self): - if self.TYPE != 'processes': - return - - val1 = self.Value('i', 5) - lock1 = val1.get_lock() - obj1 = val1.get_obj() - - val2 = self.Value('i', 5, lock=None) - lock2 = val2.get_lock() - obj2 = val2.get_obj() - - lock = self.Lock() - val3 = self.Value('i', 5, lock=lock) - lock3 = val3.get_lock() - obj3 = val3.get_obj() - self.assertEqual(lock, lock3) - - arr4 = self.RawValue('i', 5) - self.assertFalse(hasattr(arr4, 'get_lock')) - self.assertFalse(hasattr(arr4, 'get_obj')) - - -class _TestArray(BaseTestCase): - - def f(self, seq): - for i in range(1, len(seq)): - seq[i] += seq[i-1] - - def test_array(self, raw=False): - if self.TYPE != 'processes': - return - - seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831] - if raw: - arr = self.RawArray('i', seq) - else: - arr = self.Array('i', seq) - - self.assertEqual(len(arr), len(seq)) - self.assertEqual(arr[3], seq[3]) - self.assertEqual(list(arr[2:7]), list(seq[2:7])) - - arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4]) - - self.assertEqual(list(arr[:]), seq) - - self.f(seq) - - p = self.Process(target=self.f, args=(arr,)) - p.start() - p.join() - - self.assertEqual(list(arr[:]), seq) - - def test_rawarray(self): - self.test_array(raw=True) - - def test_getobj_getlock_obj(self): - if self.TYPE != 'processes': - return - - arr1 = self.Array('i', range(10)) - lock1 = arr1.get_lock() - obj1 = arr1.get_obj() - - arr2 = self.Array('i', range(10), lock=None) - lock2 = arr2.get_lock() - obj2 = arr2.get_obj() - - lock = self.Lock() - arr3 = self.Array('i', range(10), lock=lock) - lock3 = arr3.get_lock() - obj3 = arr3.get_obj() - self.assertEqual(lock, lock3) - - arr4 = self.RawArray('i', range(10)) - self.assertFalse(hasattr(arr4, 'get_lock')) - self.assertFalse(hasattr(arr4, 'get_obj')) - -# -# -# - -class _TestContainers(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def test_list(self): - a = self.list(range(10)) - self.assertEqual(a[:], range(10)) - - b = self.list() - self.assertEqual(b[:], []) - - b.extend(range(5)) - self.assertEqual(b[:], range(5)) - - self.assertEqual(b[2], 2) - self.assertEqual(b[2:10], [2,3,4]) - - b *= 2 - self.assertEqual(b[:], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) - - self.assertEqual(b + [5, 6], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6]) - - self.assertEqual(a[:], range(10)) - - d = [a, b] - e = self.list(d) - self.assertEqual( - e[:], - [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]] - ) - - f = self.list([a]) - a.append('hello') - self.assertEqual(f[:], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello']]) - - def test_dict(self): - d = self.dict() - indices = range(65, 70) - for i in indices: - d[i] = chr(i) - self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices)) - self.assertEqual(sorted(d.keys()), indices) - self.assertEqual(sorted(d.values()), [chr(i) for i in indices]) - self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices]) - - def test_namespace(self): - n = self.Namespace() - n.name = 'Bob' - n.job = 'Builder' - n._hidden = 'hidden' - self.assertEqual((n.name, n.job), ('Bob', 'Builder')) - del n.job - self.assertEqual(str(n), "Namespace(name='Bob')") - self.assertTrue(hasattr(n, 'name')) - self.assertTrue(not hasattr(n, 'job')) - -# -# -# - -def sqr(x, wait=0.0): - time.sleep(wait) - return x*x - -class _TestPool(BaseTestCase): - - def test_apply(self): - papply = self.pool.apply - self.assertEqual(papply(sqr, (5,)), sqr(5)) - self.assertEqual(papply(sqr, (), {'x':3}), sqr(x=3)) - - def test_map(self): - pmap = self.pool.map - self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) - self.assertEqual(pmap(sqr, range(100), chunksize=20), - map(sqr, range(100))) - - def test_async(self): - res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) - get = TimingWrapper(res.get) - self.assertEqual(get(), 49) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) - - def test_async_timeout(self): - res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) - get = TimingWrapper(res.get) - self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) - self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) - - def test_imap(self): - it = self.pool.imap(sqr, range(10)) - self.assertEqual(list(it), map(sqr, range(10))) - - it = self.pool.imap(sqr, range(10)) - for i in range(10): - self.assertEqual(it.next(), i*i) - self.assertRaises(StopIteration, it.next) - - it = self.pool.imap(sqr, range(1000), chunksize=100) - for i in range(1000): - self.assertEqual(it.next(), i*i) - self.assertRaises(StopIteration, it.next) - - def test_imap_unordered(self): - it = self.pool.imap_unordered(sqr, range(1000)) - self.assertEqual(sorted(it), map(sqr, range(1000))) - - it = self.pool.imap_unordered(sqr, range(1000), chunksize=53) - self.assertEqual(sorted(it), map(sqr, range(1000))) - - def test_make_pool(self): - p = multiprocessing.Pool(3) - self.assertEqual(3, len(p._pool)) - p.close() - p.join() - - def test_terminate(self): - if self.TYPE == 'manager': - # On Unix a forked process increfs each shared object to - # which its parent process held a reference. If the - # forked process gets terminated then there is likely to - # be a reference leak. So to prevent - # _TestZZZNumberOfObjects from failing we skip this test - # when using a manager. - return - - result = self.pool.map_async( - time.sleep, [0.1 for i in range(10000)], chunksize=1 - ) - self.pool.terminate() - join = TimingWrapper(self.pool.join) - join() - self.assertTrue(join.elapsed < 0.2) - -# -# Test that manager has expected number of shared objects left -# - -class _TestZZZNumberOfObjects(BaseTestCase): - # Because test cases are sorted alphabetically, this one will get - # run after all the other tests for the manager. It tests that - # there have been no "reference leaks" for the manager's shared - # objects. Note the comment in _TestPool.test_terminate(). - ALLOWED_TYPES = ('manager',) - - def test_number_of_objects(self): - EXPECTED_NUMBER = 1 # the pool object is still alive - multiprocessing.active_children() # discard dead process objs - gc.collect() # do garbage collection - refs = self.manager._number_of_objects() - if refs != EXPECTED_NUMBER: - print self.manager._debugInfo() - - self.assertEqual(refs, EXPECTED_NUMBER) - -# -# Test of creating a customized manager class -# - -from multiprocessing.managers import BaseManager, BaseProxy, RemoteError - -class FooBar(object): - def f(self): - return 'f()' - def g(self): - raise ValueError - def _h(self): - return '_h()' - -def baz(): - for i in xrange(10): - yield i*i - -class IteratorProxy(BaseProxy): - _exposed_ = ('next', '__next__') - def __iter__(self): - return self - def next(self): - return self._callmethod('next') - def __next__(self): - return self._callmethod('__next__') - -class MyManager(BaseManager): - pass - -MyManager.register('Foo', callable=FooBar) -MyManager.register('Bar', callable=FooBar, exposed=('f', '_h')) -MyManager.register('baz', callable=baz, proxytype=IteratorProxy) - - -class _TestMyManager(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def test_mymanager(self): - manager = MyManager() - manager.start() - - foo = manager.Foo() - bar = manager.Bar() - baz = manager.baz() - - foo_methods = [name for name in ('f', 'g', '_h') if hasattr(foo, name)] - bar_methods = [name for name in ('f', 'g', '_h') if hasattr(bar, name)] - - self.assertEqual(foo_methods, ['f', 'g']) - self.assertEqual(bar_methods, ['f', '_h']) - - self.assertEqual(foo.f(), 'f()') - self.assertRaises(ValueError, foo.g) - self.assertEqual(foo._callmethod('f'), 'f()') - self.assertRaises(RemoteError, foo._callmethod, '_h') - - self.assertEqual(bar.f(), 'f()') - self.assertEqual(bar._h(), '_h()') - self.assertEqual(bar._callmethod('f'), 'f()') - self.assertEqual(bar._callmethod('_h'), '_h()') - - self.assertEqual(list(baz), [i*i for i in range(10)]) - - manager.shutdown() - -# -# Test of connecting to a remote server and using xmlrpclib for serialization -# - -_queue = Queue.Queue() -def get_queue(): - return _queue - -class QueueManager(BaseManager): - '''manager class used by server process''' -QueueManager.register('get_queue', callable=get_queue) - -class QueueManager2(BaseManager): - '''manager class which specifies the same interface as QueueManager''' -QueueManager2.register('get_queue') - - -SERIALIZER = 'xmlrpclib' - -class _TestRemoteManager(BaseTestCase): - - ALLOWED_TYPES = ('manager',) - - def _putter(self, address, authkey): - manager = QueueManager2( - address=address, authkey=authkey, serializer=SERIALIZER - ) - manager.connect() - queue = manager.get_queue() - queue.put(('hello world', None, True, 2.25)) - - def test_remote(self): - authkey = os.urandom(32) - - manager = QueueManager( - address=('localhost', 0), authkey=authkey, serializer=SERIALIZER - ) - manager.start() - - p = self.Process(target=self._putter, args=(manager.address, authkey)) - p.start() - - manager2 = QueueManager2( - address=manager.address, authkey=authkey, serializer=SERIALIZER - ) - manager2.connect() - queue = manager2.get_queue() - - # Note that xmlrpclib will deserialize object as a list not a tuple - self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) - - # Because we are using xmlrpclib for serialization instead of - # pickle this will cause a serialization error. - self.assertRaises(Exception, queue.put, time.sleep) - - # Make queue finalizer run before the server is stopped - del queue - manager.shutdown() - -# -# -# - -SENTINEL = latin('') - -class _TestConnection(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def _echo(self, conn): - for msg in iter(conn.recv_bytes, SENTINEL): - conn.send_bytes(msg) - conn.close() - - def test_connection(self): - conn, child_conn = self.Pipe() - - p = self.Process(target=self._echo, args=(child_conn,)) - p.set_daemon(True) - p.start() - - seq = [1, 2.25, None] - msg = latin('hello world') - longmsg = msg * 10 - arr = array.array('i', range(4)) - - if self.TYPE == 'processes': - self.assertEqual(type(conn.fileno()), int) - - self.assertEqual(conn.send(seq), None) - self.assertEqual(conn.recv(), seq) - - self.assertEqual(conn.send_bytes(msg), None) - self.assertEqual(conn.recv_bytes(), msg) - - if self.TYPE == 'processes': - buffer = array.array('i', [0]*10) - expected = list(arr) + [0] * (10 - len(arr)) - self.assertEqual(conn.send_bytes(arr), None) - self.assertEqual(conn.recv_bytes_into(buffer), - len(arr) * buffer.itemsize) - self.assertEqual(list(buffer), expected) - - buffer = array.array('i', [0]*10) - expected = [0] * 3 + list(arr) + [0] * (10 - 3 - len(arr)) - self.assertEqual(conn.send_bytes(arr), None) - self.assertEqual(conn.recv_bytes_into(buffer, 3 * buffer.itemsize), - len(arr) * buffer.itemsize) - self.assertEqual(list(buffer), expected) - - buffer = bytearray(latin(' ' * 40)) - self.assertEqual(conn.send_bytes(longmsg), None) - try: - res = conn.recv_bytes_into(buffer) - except multiprocessing.BufferTooShort, e: - self.assertEqual(e.args, (longmsg,)) - else: - self.fail('expected BufferTooShort, got %s' % res) - - poll = TimingWrapper(conn.poll) - - self.assertEqual(poll(), False) - self.assertTimingAlmostEqual(poll.elapsed, 0) - - self.assertEqual(poll(TIMEOUT1), False) - self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1) - - conn.send(None) - - self.assertEqual(poll(TIMEOUT1), True) - self.assertTimingAlmostEqual(poll.elapsed, 0) - - self.assertEqual(conn.recv(), None) - - really_big_msg = latin('X') * (1024 * 1024 * 16) # 16Mb - conn.send_bytes(really_big_msg) - self.assertEqual(conn.recv_bytes(), really_big_msg) - - conn.send_bytes(SENTINEL) # tell child to quit - child_conn.close() - - if self.TYPE == 'processes': - self.assertEqual(conn.readable, True) - self.assertEqual(conn.writable, True) - self.assertRaises(EOFError, conn.recv) - self.assertRaises(EOFError, conn.recv_bytes) - - p.join() - - def test_duplex_false(self): - reader, writer = self.Pipe(duplex=False) - self.assertEqual(writer.send(1), None) - self.assertEqual(reader.recv(), 1) - if self.TYPE == 'processes': - self.assertEqual(reader.readable, True) - self.assertEqual(reader.writable, False) - self.assertEqual(writer.readable, False) - self.assertEqual(writer.writable, True) - self.assertRaises(IOError, reader.send, 2) - self.assertRaises(IOError, writer.recv) - self.assertRaises(IOError, writer.poll) - - def test_spawn_close(self): - # We test that a pipe connection can be closed by parent - # process immediately after child is spawned. On Windows this - # would have sometimes failed on old versions because - # child_conn would be closed before the child got a chance to - # duplicate it. - conn, child_conn = self.Pipe() - - p = self.Process(target=self._echo, args=(child_conn,)) - p.start() - child_conn.close() # this might complete before child initializes - - msg = latin('hello') - conn.send_bytes(msg) - self.assertEqual(conn.recv_bytes(), msg) - - conn.send_bytes(SENTINEL) - conn.close() - p.join() - - def test_sendbytes(self): - if self.TYPE != 'processes': - return - - msg = latin('abcdefghijklmnopqrstuvwxyz') - a, b = self.Pipe() - - a.send_bytes(msg) - self.assertEqual(b.recv_bytes(), msg) - - a.send_bytes(msg, 5) - self.assertEqual(b.recv_bytes(), msg[5:]) - - a.send_bytes(msg, 7, 8) - self.assertEqual(b.recv_bytes(), msg[7:7+8]) - - a.send_bytes(msg, 26) - self.assertEqual(b.recv_bytes(), latin('')) - - a.send_bytes(msg, 26, 0) - self.assertEqual(b.recv_bytes(), latin('')) - - self.assertRaises(ValueError, a.send_bytes, msg, 27) - - self.assertRaises(ValueError, a.send_bytes, msg, 22, 5) - - self.assertRaises(ValueError, a.send_bytes, msg, 26, 1) - - self.assertRaises(ValueError, a.send_bytes, msg, -1) - - self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) - - -class _TestListenerClient(BaseTestCase): - - ALLOWED_TYPES = ('processes', 'threads') - - def _test(self, address): - conn = self.connection.Client(address) - conn.send('hello') - conn.close() - - def test_listener_client(self): - for family in self.connection.families: - l = self.connection.Listener(family=family) - p = self.Process(target=self._test, args=(l.address,)) - p.set_daemon(True) - p.start() - conn = l.accept() - self.assertEqual(conn.recv(), 'hello') - p.join() - l.close() - -# -# Test of sending connection and socket objects between processes -# - -class _TestPicklingConnections(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _listener(self, conn, families): - for fam in families: - l = self.connection.Listener(family=fam) - conn.send(l.address) - new_conn = l.accept() - conn.send(new_conn) - - if self.TYPE == 'processes': - l = socket.socket() - l.bind(('localhost', 0)) - conn.send(l.getsockname()) - l.listen(1) - new_conn, addr = l.accept() - conn.send(new_conn) - - conn.recv() - - def _remote(self, conn): - for (address, msg) in iter(conn.recv, None): - client = self.connection.Client(address) - client.send(msg.upper()) - client.close() - - if self.TYPE == 'processes': - address, msg = conn.recv() - client = socket.socket() - client.connect(address) - client.sendall(msg.upper()) - client.close() - - conn.close() - - def test_pickling(self): - try: - multiprocessing.allow_connection_pickling() - except ImportError: - return - - families = self.connection.families - - lconn, lconn0 = self.Pipe() - lp = self.Process(target=self._listener, args=(lconn0, families)) - lp.start() - lconn0.close() - - rconn, rconn0 = self.Pipe() - rp = self.Process(target=self._remote, args=(rconn0,)) - rp.start() - rconn0.close() - - for fam in families: - msg = ('This connection uses family %s' % fam).encode('ascii') - address = lconn.recv() - rconn.send((address, msg)) - new_conn = lconn.recv() - self.assertEqual(new_conn.recv(), msg.upper()) - - rconn.send(None) - - if self.TYPE == 'processes': - msg = latin('This connection uses a normal socket') - address = lconn.recv() - rconn.send((address, msg)) - if hasattr(socket, 'fromfd'): - new_conn = lconn.recv() - self.assertEqual(new_conn.recv(100), msg.upper()) - else: - # XXX On Windows with Py2.6 need to backport fromfd() - discard = lconn.recv_bytes() - - lconn.send(None) - - rconn.close() - lconn.close() - - lp.join() - rp.join() - -# -# -# - -class _TestHeap(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_heap(self): - iterations = 5000 - maxblocks = 50 - blocks = [] - - # create and destroy lots of blocks of different sizes - for i in xrange(iterations): - size = int(random.lognormvariate(0, 1) * 1000) - b = multiprocessing.heap.BufferWrapper(size) - blocks.append(b) - if len(blocks) > maxblocks: - i = random.randrange(maxblocks) - del blocks[i] - - # get the heap object - heap = multiprocessing.heap.BufferWrapper._heap - - # verify the state of the heap - all = [] - occupied = 0 - for L in heap._len_to_seq.values(): - for arena, start, stop in L: - all.append((heap._arenas.index(arena), start, stop, - stop-start, 'free')) - for arena, start, stop in heap._allocated_blocks: - all.append((heap._arenas.index(arena), start, stop, - stop-start, 'occupied')) - occupied += (stop-start) - - all.sort() - - for i in range(len(all)-1): - (arena, start, stop) = all[i][:3] - (narena, nstart, nstop) = all[i+1][:3] - self.assertTrue((arena != narena and nstart == 0) or - (stop == nstart)) - -# -# -# - -try: - from ctypes import Structure, Value, copy, c_int, c_double -except ImportError: - Structure = object - c_int = c_double = None - -class _Foo(Structure): - _fields_ = [ - ('x', c_int), - ('y', c_double) - ] - -class _TestSharedCTypes(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _double(self, x, y, foo, arr, string): - x.value *= 2 - y.value *= 2 - foo.x *= 2 - foo.y *= 2 - string.value *= 2 - for i in range(len(arr)): - arr[i] *= 2 - - def test_sharedctypes(self, lock=False): - if c_int is None: - return - - x = Value('i', 7, lock=lock) - y = Value(ctypes.c_double, 1.0/3.0, lock=lock) - foo = Value(_Foo, 3, 2, lock=lock) - arr = Array('d', range(10), lock=lock) - string = Array('c', 20, lock=lock) - string.value = 'hello' - - p = self.Process(target=self._double, args=(x, y, foo, arr, string)) - p.start() - p.join() - - self.assertEqual(x.value, 14) - self.assertAlmostEqual(y.value, 2.0/3.0) - self.assertEqual(foo.x, 6) - self.assertAlmostEqual(foo.y, 4.0) - for i in range(10): - self.assertAlmostEqual(arr[i], i*2) - self.assertEqual(string.value, latin('hellohello')) - - def test_synchronize(self): - self.test_sharedctypes(lock=True) - - def test_copy(self): - if c_int is None: - return - - foo = _Foo(2, 5.0) - bar = copy(foo) - foo.x = 0 - foo.y = 0 - self.assertEqual(bar.x, 2) - self.assertAlmostEqual(bar.y, 5.0) - -# -# -# - -class _TestFinalize(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def _test_finalize(self, conn): - class Foo(object): - pass - - a = Foo() - util.Finalize(a, conn.send, args=('a',)) - del a # triggers callback for a - - b = Foo() - close_b = util.Finalize(b, conn.send, args=('b',)) - close_b() # triggers callback for b - close_b() # does nothing because callback has already been called - del b # does nothing because callback has already been called - - c = Foo() - util.Finalize(c, conn.send, args=('c',)) - - d10 = Foo() - util.Finalize(d10, conn.send, args=('d10',), exitpriority=1) - - d01 = Foo() - util.Finalize(d01, conn.send, args=('d01',), exitpriority=0) - d02 = Foo() - util.Finalize(d02, conn.send, args=('d02',), exitpriority=0) - d03 = Foo() - util.Finalize(d03, conn.send, args=('d03',), exitpriority=0) - - util.Finalize(None, conn.send, args=('e',), exitpriority=-10) - - util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100) - - # call mutliprocessing's cleanup function then exit process without - # garbage collecting locals - util._exit_function() - conn.close() - os._exit(0) - - def test_finalize(self): - conn, child_conn = self.Pipe() - - p = self.Process(target=self._test_finalize, args=(child_conn,)) - p.start() - p.join() - - result = [obj for obj in iter(conn.recv, 'STOP')] - self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e']) - -# -# Test that from ... import * works for each module -# - -class _TestImportStar(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_import(self): - modules = ( - 'multiprocessing', 'multiprocessing.connection', - 'multiprocessing.heap', 'multiprocessing.managers', - 'multiprocessing.pool', 'multiprocessing.process', - 'multiprocessing.reduction', 'multiprocessing.sharedctypes', - 'multiprocessing.synchronize', 'multiprocessing.util' - ) - - for name in modules: - __import__(name) - mod = sys.modules[name] - - for attr in getattr(mod, '__all__', ()): - self.assertTrue( - hasattr(mod, attr), - '%r does not have attribute %r' % (mod, attr) - ) - -# -# Quick test that logging works -- does not test logging output -# - -class _TestLogging(BaseTestCase): - - ALLOWED_TYPES = ('processes',) - - def test_enable_logging(self): - logger = multiprocessing.get_logger() - logger.setLevel(util.SUBWARNING) - self.assertTrue(logger is not None) - logger.debug('this will not be printed') - logger.info('nor will this') - logger.setLevel(LOG_LEVEL) - - def _test_level(self, conn): - logger = multiprocessing.get_logger() - conn.send(logger.getEffectiveLevel()) - - def test_level(self): - LEVEL1 = 32 - LEVEL2 = 37 - - logger = multiprocessing.get_logger() - root_logger = logging.getLogger() - root_level = root_logger.level - - reader, writer = multiprocessing.Pipe(duplex=False) - - logger.setLevel(LEVEL1) - self.Process(target=self._test_level, args=(writer,)).start() - self.assertEqual(LEVEL1, reader.recv()) - - logger.setLevel(logging.NOTSET) - root_logger.setLevel(LEVEL2) - self.Process(target=self._test_level, args=(writer,)).start() - self.assertEqual(LEVEL2, reader.recv()) - - root_logger.setLevel(root_level) - logger.setLevel(level=LOG_LEVEL) - -# -# Functions used to create test cases from the base ones in this module -# - -def get_attributes(Source, names): - d = {} - for name in names: - obj = getattr(Source, name) - if type(obj) == type(get_attributes): - obj = staticmethod(obj) - d[name] = obj - return d - -def create_test_cases(Mixin, type): - result = {} - glob = globals() - Type = type[0].upper() + type[1:] - - for name in glob.keys(): - if name.startswith('_Test'): - base = glob[name] - if type in base.ALLOWED_TYPES: - newname = 'With' + Type + name[1:] - class Temp(base, unittest.TestCase, Mixin): - pass - result[newname] = Temp - Temp.__name__ = newname - Temp.__module__ = Mixin.__module__ - return result - -# -# Create test cases -# - -class ProcessesMixin(object): - TYPE = 'processes' - Process = multiprocessing.Process - locals().update(get_attributes(multiprocessing, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'RawValue', - 'RawArray', 'current_process', 'active_children', 'Pipe', - 'connection', 'JoinableQueue' - ))) - -testcases_processes = create_test_cases(ProcessesMixin, type='processes') -globals().update(testcases_processes) - - -class ManagerMixin(object): - TYPE = 'manager' - Process = multiprocessing.Process - manager = object.__new__(multiprocessing.managers.SyncManager) - locals().update(get_attributes(manager, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'list', 'dict', - 'Namespace', 'JoinableQueue' - ))) - -testcases_manager = create_test_cases(ManagerMixin, type='manager') -globals().update(testcases_manager) - - -class ThreadsMixin(object): - TYPE = 'threads' - Process = multiprocessing.dummy.Process - locals().update(get_attributes(multiprocessing.dummy, ( - 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', - 'Condition', 'Event', 'Value', 'Array', 'current_process', - 'active_children', 'Pipe', 'connection', 'dict', 'list', - 'Namespace', 'JoinableQueue' - ))) - -testcases_threads = create_test_cases(ThreadsMixin, type='threads') -globals().update(testcases_threads) - -# -# -# - -def test_main(run=None): - if run is None: - from test.test_support import run_unittest as run - - util.get_temp_dir() # creates temp directory for use by all processes - - multiprocessing.get_logger().setLevel(LOG_LEVEL) - - ProcessesMixin.pool = multiprocessing.Pool(4) - ThreadsMixin.pool = multiprocessing.dummy.Pool(4) - ManagerMixin.manager.__init__() - ManagerMixin.manager.start() - ManagerMixin.pool = ManagerMixin.manager.Pool(4) - - testcases = ( - sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + - sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + - sorted(testcases_manager.values(), key=lambda tc:tc.__name__) - ) - - loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase - suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) - run(suite) - - ThreadsMixin.pool.terminate() - ProcessesMixin.pool.terminate() - ManagerMixin.pool.terminate() - ManagerMixin.manager.shutdown() - - del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool - -def main(): - test_main(unittest.TextTestRunner(verbosity=2).run) - -if __name__ == '__main__': - main() +# +# Unit tests for the multiprocessing package +# + +import unittest +import threading +import Queue +import time +import sys +import os +import gc +import signal +import array +import copy +import socket +import random +import logging + +import multiprocessing.dummy +import multiprocessing.connection +import multiprocessing.managers +import multiprocessing.heap +import multiprocessing.managers +import multiprocessing.pool +import _multiprocessing + +from multiprocessing import util + +# +# +# + +if sys.version_info >= (3, 0): + def latin(s): + return s.encode('latin') +else: + latin = str + +try: + bytes +except NameError: + bytes = str + def bytearray(seq): + return array.array('c', seq) + +# +# Constants +# + +LOG_LEVEL = util.SUBWARNING +#LOG_LEVEL = logging.WARNING + +DELTA = 0.1 +CHECK_TIMINGS = False # making true makes tests take a lot longer + # and can sometimes cause some non-serious + # failures because some calls block a bit + # longer than expected +if CHECK_TIMINGS: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.82, 0.35, 1.4 +else: + TIMEOUT1, TIMEOUT2, TIMEOUT3 = 0.1, 0.1, 0.1 + +HAVE_GETVALUE = not getattr(_multiprocessing, + 'HAVE_BROKEN_SEM_GETVALUE', False) + +# +# Creates a wrapper for a function which records the time it takes to finish +# + +class TimingWrapper(object): + + def __init__(self, func): + self.func = func + self.elapsed = None + + def __call__(self, *args, **kwds): + t = time.time() + try: + return self.func(*args, **kwds) + finally: + self.elapsed = time.time() - t + +# +# Base class for test cases +# + +class BaseTestCase(object): + + ALLOWED_TYPES = ('processes', 'manager', 'threads') + + def assertTimingAlmostEqual(self, a, b): + if CHECK_TIMINGS: + self.assertAlmostEqual(a, b, 1) + + def assertReturnsIfImplemented(self, value, func, *args): + try: + res = func(*args) + except NotImplementedError: + pass + else: + return self.assertEqual(value, res) + +# +# Return the value of a semaphore +# + +def get_value(self): + try: + return self.get_value() + except AttributeError: + try: + return self._Semaphore__value + except AttributeError: + try: + return self._value + except AttributeError: + raise NotImplementedError + +# +# Testcases +# + +class _TestProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def test_current(self): + if self.TYPE == 'threads': + return + + current = self.current_process() + authkey = current.get_authkey() + + self.assertTrue(current.is_alive()) + self.assertTrue(not current.is_daemon()) + self.assertTrue(isinstance(authkey, bytes)) + self.assertTrue(len(authkey) > 0) + self.assertEqual(current.get_ident(), os.getpid()) + self.assertEqual(current.get_exitcode(), None) + + def _test(self, q, *args, **kwds): + current = self.current_process() + q.put(args) + q.put(kwds) + q.put(current.get_name()) + if self.TYPE != 'threads': + q.put(bytes(current.get_authkey())) + q.put(current.pid) + + def test_process(self): + q = self.Queue(1) + e = self.Event() + args = (q, 1, 2) + kwargs = {'hello':23, 'bye':2.54} + name = 'SomeProcess' + p = self.Process( + target=self._test, args=args, kwargs=kwargs, name=name + ) + p.set_daemon(True) + current = self.current_process() + + if self.TYPE != 'threads': + self.assertEquals(p.get_authkey(), current.get_authkey()) + self.assertEquals(p.is_alive(), False) + self.assertEquals(p.is_daemon(), True) + self.assertTrue(p not in self.active_children()) + self.assertTrue(type(self.active_children()) is list) + self.assertEqual(p.get_exitcode(), None) + + p.start() + + self.assertEquals(p.get_exitcode(), None) + self.assertEquals(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + + self.assertEquals(q.get(), args[1:]) + self.assertEquals(q.get(), kwargs) + self.assertEquals(q.get(), p.get_name()) + if self.TYPE != 'threads': + self.assertEquals(q.get(), current.get_authkey()) + self.assertEquals(q.get(), p.pid) + + p.join() + + self.assertEquals(p.get_exitcode(), 0) + self.assertEquals(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + def _test_terminate(self): + time.sleep(1000) + + def test_terminate(self): + if self.TYPE == 'threads': + return + + p = self.Process(target=self._test_terminate) + p.set_daemon(True) + p.start() + + self.assertEqual(p.is_alive(), True) + self.assertTrue(p in self.active_children()) + self.assertEqual(p.get_exitcode(), None) + + p.terminate() + + join = TimingWrapper(p.join) + self.assertEqual(join(), None) + self.assertTimingAlmostEqual(join.elapsed, 0.0) + + self.assertEqual(p.is_alive(), False) + self.assertTrue(p not in self.active_children()) + + p.join() + + # XXX sometimes get p.get_exitcode() == 0 on Windows ... + #self.assertEqual(p.get_exitcode(), -signal.SIGTERM) + + def test_cpu_count(self): + try: + cpus = multiprocessing.cpu_count() + except NotImplementedError: + cpus = 1 + self.assertTrue(type(cpus) is int) + self.assertTrue(cpus >= 1) + + def test_active_children(self): + self.assertEqual(type(self.active_children()), list) + + p = self.Process(target=time.sleep, args=(DELTA,)) + self.assertTrue(p not in self.active_children()) + + p.start() + self.assertTrue(p in self.active_children()) + + p.join() + self.assertTrue(p not in self.active_children()) + + def _test_recursion(self, wconn, id): + from multiprocessing import forking + wconn.send(id) + if len(id) < 2: + for i in range(2): + p = self.Process( + target=self._test_recursion, args=(wconn, id+[i]) + ) + p.start() + p.join() + + def test_recursion(self): + rconn, wconn = self.Pipe(duplex=False) + self._test_recursion(wconn, []) + + time.sleep(DELTA) + result = [] + while rconn.poll(): + result.append(rconn.recv()) + + expected = [ + [], + [0], + [0, 0], + [0, 1], + [1], + [1, 0], + [1, 1] + ] + self.assertEqual(result, expected) + +# +# +# + +class _UpperCaser(multiprocessing.Process): + + def __init__(self): + multiprocessing.Process.__init__(self) + self.child_conn, self.parent_conn = multiprocessing.Pipe() + + def run(self): + self.parent_conn.close() + for s in iter(self.child_conn.recv, None): + self.child_conn.send(s.upper()) + self.child_conn.close() + + def submit(self, s): + assert type(s) is str + self.parent_conn.send(s) + return self.parent_conn.recv() + + def stop(self): + self.parent_conn.send(None) + self.parent_conn.close() + self.child_conn.close() + +class _TestSubclassingProcess(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_subclassing(self): + uppercaser = _UpperCaser() + uppercaser.start() + self.assertEqual(uppercaser.submit('hello'), 'HELLO') + self.assertEqual(uppercaser.submit('world'), 'WORLD') + uppercaser.stop() + uppercaser.join() + +# +# +# + +def queue_empty(q): + if hasattr(q, 'empty'): + return q.empty() + else: + return q.qsize() == 0 + +def queue_full(q, maxsize): + if hasattr(q, 'full'): + return q.full() + else: + return q.qsize() == maxsize + + +class _TestQueue(BaseTestCase): + + + def _test_put(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + for i in range(6): + queue.get() + parent_can_continue.set() + + def test_put(self): + MAXSIZE = 6 + queue = self.Queue(maxsize=MAXSIZE) + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_put, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + queue.put(1) + queue.put(2, True) + queue.put(3, True, None) + queue.put(4, False) + queue.put(5, False, None) + queue.put_nowait(6) + + # the values may be in buffer but not yet in pipe so sleep a bit + time.sleep(DELTA) + + self.assertEqual(queue_empty(queue), False) + self.assertEqual(queue_full(queue, MAXSIZE), True) + + put = TimingWrapper(queue.put) + put_nowait = TimingWrapper(queue.put_nowait) + + self.assertRaises(Queue.Full, put, 7, False) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, False, None) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put_nowait, 7) + self.assertTimingAlmostEqual(put_nowait.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, TIMEOUT1) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Full, put, 7, False, TIMEOUT2) + self.assertTimingAlmostEqual(put.elapsed, 0) + + self.assertRaises(Queue.Full, put, 7, True, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(put.elapsed, TIMEOUT3) + + child_can_start.set() + parent_can_continue.wait() + + self.assertEqual(queue_empty(queue), True) + self.assertEqual(queue_full(queue, MAXSIZE), False) + + proc.join() + + def _test_get(self, queue, child_can_start, parent_can_continue): + child_can_start.wait() + queue.put(1) + queue.put(2) + queue.put(3) + queue.put(4) + queue.put(5) + parent_can_continue.set() + + def test_get(self): + queue = self.Queue() + child_can_start = self.Event() + parent_can_continue = self.Event() + + proc = self.Process( + target=self._test_get, + args=(queue, child_can_start, parent_can_continue) + ) + proc.set_daemon(True) + proc.start() + + self.assertEqual(queue_empty(queue), True) + + child_can_start.set() + parent_can_continue.wait() + + time.sleep(DELTA) + self.assertEqual(queue_empty(queue), False) + + self.assertEqual(queue.get(), 1) + self.assertEqual(queue.get(True, None), 2) + self.assertEqual(queue.get(True), 3) + self.assertEqual(queue.get(timeout=1), 4) + self.assertEqual(queue.get_nowait(), 5) + + self.assertEqual(queue_empty(queue), True) + + get = TimingWrapper(queue.get) + get_nowait = TimingWrapper(queue.get_nowait) + + self.assertRaises(Queue.Empty, get, False) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, False, None) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get_nowait) + self.assertTimingAlmostEqual(get_nowait.elapsed, 0) + + self.assertRaises(Queue.Empty, get, True, TIMEOUT1) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + self.assertRaises(Queue.Empty, get, False, TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, 0) + + self.assertRaises(Queue.Empty, get, timeout=TIMEOUT3) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT3) + + proc.join() + + def _test_fork(self, queue): + for i in range(10, 20): + queue.put(i) + # note that at this point the items may only be buffered, so the + # process cannot shutdown until the feeder thread has finished + # pushing items onto the pipe. + + def test_fork(self): + # Old versions of Queue would fail to create a new feeder + # thread for a forked process if the original process had its + # own feeder thread. This test checks that this no longer + # happens. + + queue = self.Queue() + + # put items on queue so that main process starts a feeder thread + for i in range(10): + queue.put(i) + + # wait to make sure thread starts before we fork a new process + time.sleep(DELTA) + + # fork process + p = self.Process(target=self._test_fork, args=(queue,)) + p.start() + + # check that all expected items are in the queue + for i in range(20): + self.assertEqual(queue.get(), i) + self.assertRaises(Queue.Empty, queue.get, False) + + p.join() + + def test_qsize(self): + q = self.Queue() + try: + self.assertEqual(q.qsize(), 0) + except NotImplementedError: + return + q.put(1) + self.assertEqual(q.qsize(), 1) + q.put(5) + self.assertEqual(q.qsize(), 2) + q.get() + self.assertEqual(q.qsize(), 1) + q.get() + self.assertEqual(q.qsize(), 0) + + def _test_task_done(self, q): + for obj in iter(q.get, None): + time.sleep(DELTA) + q.task_done() + + def test_task_done(self): + queue = self.JoinableQueue() + + if sys.version_info < (2, 5) and not hasattr(queue, 'task_done'): + return + + workers = [self.Process(target=self._test_task_done, args=(queue,)) + for i in xrange(4)] + + for p in workers: + p.start() + + for i in xrange(10): + queue.put(i) + + queue.join() + + for p in workers: + queue.put(None) + + for p in workers: + p.join() + +# +# +# + +class _TestLock(BaseTestCase): + + def test_lock(self): + lock = self.Lock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(False), False) + self.assertEqual(lock.release(), None) + self.assertRaises((ValueError, threading.ThreadError), lock.release) + + def test_rlock(self): + lock = self.RLock() + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.acquire(), True) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertEqual(lock.release(), None) + self.assertRaises((AssertionError, RuntimeError), lock.release) + + +class _TestSemaphore(BaseTestCase): + + def _test_semaphore(self, sem): + self.assertReturnsIfImplemented(2, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.acquire(), True) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.acquire(False), False) + self.assertReturnsIfImplemented(0, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(1, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(2, get_value, sem) + + def test_semaphore(self): + sem = self.Semaphore(2) + self._test_semaphore(sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(3, get_value, sem) + self.assertEqual(sem.release(), None) + self.assertReturnsIfImplemented(4, get_value, sem) + + def test_bounded_semaphore(self): + sem = self.BoundedSemaphore(2) + self._test_semaphore(sem) + # Currently fails on OS/X + #if HAVE_GETVALUE: + # self.assertRaises(ValueError, sem.release) + # self.assertReturnsIfImplemented(2, get_value, sem) + + def test_timeout(self): + if self.TYPE != 'processes': + return + + sem = self.Semaphore(0) + acquire = TimingWrapper(sem.acquire) + + self.assertEqual(acquire(False), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, None), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0.0) + + self.assertEqual(acquire(False, TIMEOUT1), False) + self.assertTimingAlmostEqual(acquire.elapsed, 0) + + self.assertEqual(acquire(True, TIMEOUT2), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT2) + + self.assertEqual(acquire(timeout=TIMEOUT3), False) + self.assertTimingAlmostEqual(acquire.elapsed, TIMEOUT3) + + +class _TestCondition(BaseTestCase): + + def f(self, cond, sleeping, woken, timeout=None): + cond.acquire() + sleeping.release() + cond.wait(timeout) + woken.release() + cond.release() + + def check_invariant(self, cond): + # this is only supposed to succeed when there are no sleepers + if self.TYPE == 'processes': + try: + sleepers = (cond._sleeping_count.get_value() - + cond._woken_count.get_value()) + self.assertEqual(sleepers, 0) + self.assertEqual(cond._wait_semaphore.get_value(), 0) + except NotImplementedError: + pass + + def test_notify(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + p = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + # wait for both children to start sleeping + sleeping.acquire() + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake up one process/thread + cond.acquire() + cond.notify() + cond.release() + + # check one process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(1, get_value, woken) + + # wake up another + cond.acquire() + cond.notify() + cond.release() + + # check other has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(2, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + p.join() + + def test_notify_all(self): + cond = self.Condition() + sleeping = self.Semaphore(0) + woken = self.Semaphore(0) + + # start some threads/processes which will timeout + for i in range(3): + p = self.Process(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, + args=(cond, sleeping, woken, TIMEOUT1)) + t.set_daemon(True) + t.start() + + # wait for them all to sleep + for i in xrange(6): + sleeping.acquire() + + # check they have all timed out + for i in xrange(6): + woken.acquire() + self.assertReturnsIfImplemented(0, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + # start some more threads/processes + for i in range(3): + p = self.Process(target=self.f, args=(cond, sleeping, woken)) + p.set_daemon(True) + p.start() + + t = threading.Thread(target=self.f, args=(cond, sleeping, woken)) + t.set_daemon(True) + t.start() + + # wait for them to all sleep + for i in xrange(6): + sleeping.acquire() + + # check no process/thread has woken up + time.sleep(DELTA) + self.assertReturnsIfImplemented(0, get_value, woken) + + # wake them all up + cond.acquire() + cond.notify_all() + cond.release() + + # check they have all woken + time.sleep(DELTA) + self.assertReturnsIfImplemented(6, get_value, woken) + + # check state is not mucked up + self.check_invariant(cond) + + def test_timeout(self): + cond = self.Condition() + wait = TimingWrapper(cond.wait) + cond.acquire() + res = wait(TIMEOUT1) + cond.release() + self.assertEqual(res, None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + +class _TestEvent(BaseTestCase): + + def _test_event(self, event): + time.sleep(TIMEOUT2) + event.set() + + def test_event(self): + event = self.Event() + wait = TimingWrapper(event.wait) + + # Removed temporaily, due to API shear, this does not + # work with threading._Event objects. is_set == isSet + #self.assertEqual(event.is_set(), False) + + self.assertEqual(wait(0.0), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, TIMEOUT1) + + event.set() + + # See note above on the API differences + # self.assertEqual(event.is_set(), True) + self.assertEqual(wait(), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + self.assertEqual(wait(TIMEOUT1), None) + self.assertTimingAlmostEqual(wait.elapsed, 0.0) + # self.assertEqual(event.is_set(), True) + + event.clear() + + #self.assertEqual(event.is_set(), False) + + self.Process(target=self._test_event, args=(event,)).start() + self.assertEqual(wait(), None) + +# +# +# + +class _TestValue(BaseTestCase): + + codes_values = [ + ('i', 4343, 24234), + ('d', 3.625, -4.25), + ('h', -232, 234), + ('c', latin('x'), latin('y')) + ] + + def _test(self, values): + for sv, cv in zip(values, self.codes_values): + sv.value = cv[2] + + + def test_value(self, raw=False): + if self.TYPE != 'processes': + return + + if raw: + values = [self.RawValue(code, value) + for code, value, _ in self.codes_values] + else: + values = [self.Value(code, value) + for code, value, _ in self.codes_values] + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[1]) + + proc = self.Process(target=self._test, args=(values,)) + proc.start() + proc.join() + + for sv, cv in zip(values, self.codes_values): + self.assertEqual(sv.value, cv[2]) + + def test_rawvalue(self): + self.test_value(raw=True) + + def test_getobj_getlock(self): + if self.TYPE != 'processes': + return + + val1 = self.Value('i', 5) + lock1 = val1.get_lock() + obj1 = val1.get_obj() + + val2 = self.Value('i', 5, lock=None) + lock2 = val2.get_lock() + obj2 = val2.get_obj() + + lock = self.Lock() + val3 = self.Value('i', 5, lock=lock) + lock3 = val3.get_lock() + obj3 = val3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawValue('i', 5) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + + +class _TestArray(BaseTestCase): + + def f(self, seq): + for i in range(1, len(seq)): + seq[i] += seq[i-1] + + def test_array(self, raw=False): + if self.TYPE != 'processes': + return + + seq = [680, 626, 934, 821, 150, 233, 548, 982, 714, 831] + if raw: + arr = self.RawArray('i', seq) + else: + arr = self.Array('i', seq) + + self.assertEqual(len(arr), len(seq)) + self.assertEqual(arr[3], seq[3]) + self.assertEqual(list(arr[2:7]), list(seq[2:7])) + + arr[4:8] = seq[4:8] = array.array('i', [1, 2, 3, 4]) + + self.assertEqual(list(arr[:]), seq) + + self.f(seq) + + p = self.Process(target=self.f, args=(arr,)) + p.start() + p.join() + + self.assertEqual(list(arr[:]), seq) + + def test_rawarray(self): + self.test_array(raw=True) + + def test_getobj_getlock_obj(self): + if self.TYPE != 'processes': + return + + arr1 = self.Array('i', range(10)) + lock1 = arr1.get_lock() + obj1 = arr1.get_obj() + + arr2 = self.Array('i', range(10), lock=None) + lock2 = arr2.get_lock() + obj2 = arr2.get_obj() + + lock = self.Lock() + arr3 = self.Array('i', range(10), lock=lock) + lock3 = arr3.get_lock() + obj3 = arr3.get_obj() + self.assertEqual(lock, lock3) + + arr4 = self.RawArray('i', range(10)) + self.assertFalse(hasattr(arr4, 'get_lock')) + self.assertFalse(hasattr(arr4, 'get_obj')) + +# +# +# + +class _TestContainers(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_list(self): + a = self.list(range(10)) + self.assertEqual(a[:], range(10)) + + b = self.list() + self.assertEqual(b[:], []) + + b.extend(range(5)) + self.assertEqual(b[:], range(5)) + + self.assertEqual(b[2], 2) + self.assertEqual(b[2:10], [2,3,4]) + + b *= 2 + self.assertEqual(b[:], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]) + + self.assertEqual(b + [5, 6], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6]) + + self.assertEqual(a[:], range(10)) + + d = [a, b] + e = self.list(d) + self.assertEqual( + e[:], + [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 1, 2, 3, 4, 0, 1, 2, 3, 4]] + ) + + f = self.list([a]) + a.append('hello') + self.assertEqual(f[:], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'hello']]) + + def test_dict(self): + d = self.dict() + indices = range(65, 70) + for i in indices: + d[i] = chr(i) + self.assertEqual(d.copy(), dict((i, chr(i)) for i in indices)) + self.assertEqual(sorted(d.keys()), indices) + self.assertEqual(sorted(d.values()), [chr(i) for i in indices]) + self.assertEqual(sorted(d.items()), [(i, chr(i)) for i in indices]) + + def test_namespace(self): + n = self.Namespace() + n.name = 'Bob' + n.job = 'Builder' + n._hidden = 'hidden' + self.assertEqual((n.name, n.job), ('Bob', 'Builder')) + del n.job + self.assertEqual(str(n), "Namespace(name='Bob')") + self.assertTrue(hasattr(n, 'name')) + self.assertTrue(not hasattr(n, 'job')) + +# +# +# + +def sqr(x, wait=0.0): + time.sleep(wait) + return x*x + +class _TestPool(BaseTestCase): + + def test_apply(self): + papply = self.pool.apply + self.assertEqual(papply(sqr, (5,)), sqr(5)) + self.assertEqual(papply(sqr, (), {'x':3}), sqr(x=3)) + + def test_map(self): + pmap = self.pool.map + self.assertEqual(pmap(sqr, range(10)), map(sqr, range(10))) + self.assertEqual(pmap(sqr, range(100), chunksize=20), + map(sqr, range(100))) + + def test_async(self): + res = self.pool.apply_async(sqr, (7, TIMEOUT1,)) + get = TimingWrapper(res.get) + self.assertEqual(get(), 49) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT1) + + def test_async_timeout(self): + res = self.pool.apply_async(sqr, (6, TIMEOUT2 + 0.2)) + get = TimingWrapper(res.get) + self.assertRaises(multiprocessing.TimeoutError, get, timeout=TIMEOUT2) + self.assertTimingAlmostEqual(get.elapsed, TIMEOUT2) + + def test_imap(self): + it = self.pool.imap(sqr, range(10)) + self.assertEqual(list(it), map(sqr, range(10))) + + it = self.pool.imap(sqr, range(10)) + for i in range(10): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + it = self.pool.imap(sqr, range(1000), chunksize=100) + for i in range(1000): + self.assertEqual(it.next(), i*i) + self.assertRaises(StopIteration, it.next) + + def test_imap_unordered(self): + it = self.pool.imap_unordered(sqr, range(1000)) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + it = self.pool.imap_unordered(sqr, range(1000), chunksize=53) + self.assertEqual(sorted(it), map(sqr, range(1000))) + + def test_make_pool(self): + p = multiprocessing.Pool(3) + self.assertEqual(3, len(p._pool)) + p.close() + p.join() + + def test_terminate(self): + if self.TYPE == 'manager': + # On Unix a forked process increfs each shared object to + # which its parent process held a reference. If the + # forked process gets terminated then there is likely to + # be a reference leak. So to prevent + # _TestZZZNumberOfObjects from failing we skip this test + # when using a manager. + return + + result = self.pool.map_async( + time.sleep, [0.1 for i in range(10000)], chunksize=1 + ) + self.pool.terminate() + join = TimingWrapper(self.pool.join) + join() + self.assertTrue(join.elapsed < 0.2) + +# +# Test that manager has expected number of shared objects left +# + +class _TestZZZNumberOfObjects(BaseTestCase): + # Because test cases are sorted alphabetically, this one will get + # run after all the other tests for the manager. It tests that + # there have been no "reference leaks" for the manager's shared + # objects. Note the comment in _TestPool.test_terminate(). + ALLOWED_TYPES = ('manager',) + + def test_number_of_objects(self): + EXPECTED_NUMBER = 1 # the pool object is still alive + multiprocessing.active_children() # discard dead process objs + gc.collect() # do garbage collection + refs = self.manager._number_of_objects() + if refs != EXPECTED_NUMBER: + print self.manager._debugInfo() + + self.assertEqual(refs, EXPECTED_NUMBER) + +# +# Test of creating a customized manager class +# + +from multiprocessing.managers import BaseManager, BaseProxy, RemoteError + +class FooBar(object): + def f(self): + return 'f()' + def g(self): + raise ValueError + def _h(self): + return '_h()' + +def baz(): + for i in xrange(10): + yield i*i + +class IteratorProxy(BaseProxy): + _exposed_ = ('next', '__next__') + def __iter__(self): + return self + def next(self): + return self._callmethod('next') + def __next__(self): + return self._callmethod('__next__') + +class MyManager(BaseManager): + pass + +MyManager.register('Foo', callable=FooBar) +MyManager.register('Bar', callable=FooBar, exposed=('f', '_h')) +MyManager.register('baz', callable=baz, proxytype=IteratorProxy) + + +class _TestMyManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def test_mymanager(self): + manager = MyManager() + manager.start() + + foo = manager.Foo() + bar = manager.Bar() + baz = manager.baz() + + foo_methods = [name for name in ('f', 'g', '_h') if hasattr(foo, name)] + bar_methods = [name for name in ('f', 'g', '_h') if hasattr(bar, name)] + + self.assertEqual(foo_methods, ['f', 'g']) + self.assertEqual(bar_methods, ['f', '_h']) + + self.assertEqual(foo.f(), 'f()') + self.assertRaises(ValueError, foo.g) + self.assertEqual(foo._callmethod('f'), 'f()') + self.assertRaises(RemoteError, foo._callmethod, '_h') + + self.assertEqual(bar.f(), 'f()') + self.assertEqual(bar._h(), '_h()') + self.assertEqual(bar._callmethod('f'), 'f()') + self.assertEqual(bar._callmethod('_h'), '_h()') + + self.assertEqual(list(baz), [i*i for i in range(10)]) + + manager.shutdown() + +# +# Test of connecting to a remote server and using xmlrpclib for serialization +# + +_queue = Queue.Queue() +def get_queue(): + return _queue + +class QueueManager(BaseManager): + '''manager class used by server process''' +QueueManager.register('get_queue', callable=get_queue) + +class QueueManager2(BaseManager): + '''manager class which specifies the same interface as QueueManager''' +QueueManager2.register('get_queue') + + +SERIALIZER = 'xmlrpclib' + +class _TestRemoteManager(BaseTestCase): + + ALLOWED_TYPES = ('manager',) + + def _putter(self, address, authkey): + manager = QueueManager2( + address=address, authkey=authkey, serializer=SERIALIZER + ) + manager.connect() + queue = manager.get_queue() + queue.put(('hello world', None, True, 2.25)) + + def test_remote(self): + authkey = os.urandom(32) + + manager = QueueManager( + address=('localhost', 0), authkey=authkey, serializer=SERIALIZER + ) + manager.start() + + p = self.Process(target=self._putter, args=(manager.address, authkey)) + p.start() + + manager2 = QueueManager2( + address=manager.address, authkey=authkey, serializer=SERIALIZER + ) + manager2.connect() + queue = manager2.get_queue() + + # Note that xmlrpclib will deserialize object as a list not a tuple + self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) + + # Because we are using xmlrpclib for serialization instead of + # pickle this will cause a serialization error. + self.assertRaises(Exception, queue.put, time.sleep) + + # Make queue finalizer run before the server is stopped + del queue + manager.shutdown() + +# +# +# + +SENTINEL = latin('') + +class _TestConnection(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _echo(self, conn): + for msg in iter(conn.recv_bytes, SENTINEL): + conn.send_bytes(msg) + conn.close() + + def test_connection(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.set_daemon(True) + p.start() + + seq = [1, 2.25, None] + msg = latin('hello world') + longmsg = msg * 10 + arr = array.array('i', range(4)) + + if self.TYPE == 'processes': + self.assertEqual(type(conn.fileno()), int) + + self.assertEqual(conn.send(seq), None) + self.assertEqual(conn.recv(), seq) + + self.assertEqual(conn.send_bytes(msg), None) + self.assertEqual(conn.recv_bytes(), msg) + + if self.TYPE == 'processes': + buffer = array.array('i', [0]*10) + expected = list(arr) + [0] * (10 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = array.array('i', [0]*10) + expected = [0] * 3 + list(arr) + [0] * (10 - 3 - len(arr)) + self.assertEqual(conn.send_bytes(arr), None) + self.assertEqual(conn.recv_bytes_into(buffer, 3 * buffer.itemsize), + len(arr) * buffer.itemsize) + self.assertEqual(list(buffer), expected) + + buffer = bytearray(latin(' ' * 40)) + self.assertEqual(conn.send_bytes(longmsg), None) + try: + res = conn.recv_bytes_into(buffer) + except multiprocessing.BufferTooShort, e: + self.assertEqual(e.args, (longmsg,)) + else: + self.fail('expected BufferTooShort, got %s' % res) + + poll = TimingWrapper(conn.poll) + + self.assertEqual(poll(), False) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(poll(TIMEOUT1), False) + self.assertTimingAlmostEqual(poll.elapsed, TIMEOUT1) + + conn.send(None) + + self.assertEqual(poll(TIMEOUT1), True) + self.assertTimingAlmostEqual(poll.elapsed, 0) + + self.assertEqual(conn.recv(), None) + + really_big_msg = latin('X') * (1024 * 1024 * 16) # 16Mb + conn.send_bytes(really_big_msg) + self.assertEqual(conn.recv_bytes(), really_big_msg) + + conn.send_bytes(SENTINEL) # tell child to quit + child_conn.close() + + if self.TYPE == 'processes': + self.assertEqual(conn.readable, True) + self.assertEqual(conn.writable, True) + self.assertRaises(EOFError, conn.recv) + self.assertRaises(EOFError, conn.recv_bytes) + + p.join() + + def test_duplex_false(self): + reader, writer = self.Pipe(duplex=False) + self.assertEqual(writer.send(1), None) + self.assertEqual(reader.recv(), 1) + if self.TYPE == 'processes': + self.assertEqual(reader.readable, True) + self.assertEqual(reader.writable, False) + self.assertEqual(writer.readable, False) + self.assertEqual(writer.writable, True) + self.assertRaises(IOError, reader.send, 2) + self.assertRaises(IOError, writer.recv) + self.assertRaises(IOError, writer.poll) + + def test_spawn_close(self): + # We test that a pipe connection can be closed by parent + # process immediately after child is spawned. On Windows this + # would have sometimes failed on old versions because + # child_conn would be closed before the child got a chance to + # duplicate it. + conn, child_conn = self.Pipe() + + p = self.Process(target=self._echo, args=(child_conn,)) + p.start() + child_conn.close() # this might complete before child initializes + + msg = latin('hello') + conn.send_bytes(msg) + self.assertEqual(conn.recv_bytes(), msg) + + conn.send_bytes(SENTINEL) + conn.close() + p.join() + + def test_sendbytes(self): + if self.TYPE != 'processes': + return + + msg = latin('abcdefghijklmnopqrstuvwxyz') + a, b = self.Pipe() + + a.send_bytes(msg) + self.assertEqual(b.recv_bytes(), msg) + + a.send_bytes(msg, 5) + self.assertEqual(b.recv_bytes(), msg[5:]) + + a.send_bytes(msg, 7, 8) + self.assertEqual(b.recv_bytes(), msg[7:7+8]) + + a.send_bytes(msg, 26) + self.assertEqual(b.recv_bytes(), latin('')) + + a.send_bytes(msg, 26, 0) + self.assertEqual(b.recv_bytes(), latin('')) + + self.assertRaises(ValueError, a.send_bytes, msg, 27) + + self.assertRaises(ValueError, a.send_bytes, msg, 22, 5) + + self.assertRaises(ValueError, a.send_bytes, msg, 26, 1) + + self.assertRaises(ValueError, a.send_bytes, msg, -1) + + self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) + + +class _TestListenerClient(BaseTestCase): + + ALLOWED_TYPES = ('processes', 'threads') + + def _test(self, address): + conn = self.connection.Client(address) + conn.send('hello') + conn.close() + + def test_listener_client(self): + for family in self.connection.families: + l = self.connection.Listener(family=family) + p = self.Process(target=self._test, args=(l.address,)) + p.set_daemon(True) + p.start() + conn = l.accept() + self.assertEqual(conn.recv(), 'hello') + p.join() + l.close() + +# +# Test of sending connection and socket objects between processes +# + +class _TestPicklingConnections(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _listener(self, conn, families): + for fam in families: + l = self.connection.Listener(family=fam) + conn.send(l.address) + new_conn = l.accept() + conn.send(new_conn) + + if self.TYPE == 'processes': + l = socket.socket() + l.bind(('localhost', 0)) + conn.send(l.getsockname()) + l.listen(1) + new_conn, addr = l.accept() + conn.send(new_conn) + + conn.recv() + + def _remote(self, conn): + for (address, msg) in iter(conn.recv, None): + client = self.connection.Client(address) + client.send(msg.upper()) + client.close() + + if self.TYPE == 'processes': + address, msg = conn.recv() + client = socket.socket() + client.connect(address) + client.sendall(msg.upper()) + client.close() + + conn.close() + + def test_pickling(self): + try: + multiprocessing.allow_connection_pickling() + except ImportError: + return + + families = self.connection.families + + lconn, lconn0 = self.Pipe() + lp = self.Process(target=self._listener, args=(lconn0, families)) + lp.start() + lconn0.close() + + rconn, rconn0 = self.Pipe() + rp = self.Process(target=self._remote, args=(rconn0,)) + rp.start() + rconn0.close() + + for fam in families: + msg = ('This connection uses family %s' % fam).encode('ascii') + address = lconn.recv() + rconn.send((address, msg)) + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(), msg.upper()) + + rconn.send(None) + + if self.TYPE == 'processes': + msg = latin('This connection uses a normal socket') + address = lconn.recv() + rconn.send((address, msg)) + if hasattr(socket, 'fromfd'): + new_conn = lconn.recv() + self.assertEqual(new_conn.recv(100), msg.upper()) + else: + # XXX On Windows with Py2.6 need to backport fromfd() + discard = lconn.recv_bytes() + + lconn.send(None) + + rconn.close() + lconn.close() + + lp.join() + rp.join() + +# +# +# + +class _TestHeap(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_heap(self): + iterations = 5000 + maxblocks = 50 + blocks = [] + + # create and destroy lots of blocks of different sizes + for i in xrange(iterations): + size = int(random.lognormvariate(0, 1) * 1000) + b = multiprocessing.heap.BufferWrapper(size) + blocks.append(b) + if len(blocks) > maxblocks: + i = random.randrange(maxblocks) + del blocks[i] + + # get the heap object + heap = multiprocessing.heap.BufferWrapper._heap + + # verify the state of the heap + all = [] + occupied = 0 + for L in heap._len_to_seq.values(): + for arena, start, stop in L: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'free')) + for arena, start, stop in heap._allocated_blocks: + all.append((heap._arenas.index(arena), start, stop, + stop-start, 'occupied')) + occupied += (stop-start) + + all.sort() + + for i in range(len(all)-1): + (arena, start, stop) = all[i][:3] + (narena, nstart, nstop) = all[i+1][:3] + self.assertTrue((arena != narena and nstart == 0) or + (stop == nstart)) + +# +# +# + +try: + from ctypes import Structure, Value, copy, c_int, c_double +except ImportError: + Structure = object + c_int = c_double = None + +class _Foo(Structure): + _fields_ = [ + ('x', c_int), + ('y', c_double) + ] + +class _TestSharedCTypes(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _double(self, x, y, foo, arr, string): + x.value *= 2 + y.value *= 2 + foo.x *= 2 + foo.y *= 2 + string.value *= 2 + for i in range(len(arr)): + arr[i] *= 2 + + def test_sharedctypes(self, lock=False): + if c_int is None: + return + + x = Value('i', 7, lock=lock) + y = Value(ctypes.c_double, 1.0/3.0, lock=lock) + foo = Value(_Foo, 3, 2, lock=lock) + arr = Array('d', range(10), lock=lock) + string = Array('c', 20, lock=lock) + string.value = 'hello' + + p = self.Process(target=self._double, args=(x, y, foo, arr, string)) + p.start() + p.join() + + self.assertEqual(x.value, 14) + self.assertAlmostEqual(y.value, 2.0/3.0) + self.assertEqual(foo.x, 6) + self.assertAlmostEqual(foo.y, 4.0) + for i in range(10): + self.assertAlmostEqual(arr[i], i*2) + self.assertEqual(string.value, latin('hellohello')) + + def test_synchronize(self): + self.test_sharedctypes(lock=True) + + def test_copy(self): + if c_int is None: + return + + foo = _Foo(2, 5.0) + bar = copy(foo) + foo.x = 0 + foo.y = 0 + self.assertEqual(bar.x, 2) + self.assertAlmostEqual(bar.y, 5.0) + +# +# +# + +class _TestFinalize(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def _test_finalize(self, conn): + class Foo(object): + pass + + a = Foo() + util.Finalize(a, conn.send, args=('a',)) + del a # triggers callback for a + + b = Foo() + close_b = util.Finalize(b, conn.send, args=('b',)) + close_b() # triggers callback for b + close_b() # does nothing because callback has already been called + del b # does nothing because callback has already been called + + c = Foo() + util.Finalize(c, conn.send, args=('c',)) + + d10 = Foo() + util.Finalize(d10, conn.send, args=('d10',), exitpriority=1) + + d01 = Foo() + util.Finalize(d01, conn.send, args=('d01',), exitpriority=0) + d02 = Foo() + util.Finalize(d02, conn.send, args=('d02',), exitpriority=0) + d03 = Foo() + util.Finalize(d03, conn.send, args=('d03',), exitpriority=0) + + util.Finalize(None, conn.send, args=('e',), exitpriority=-10) + + util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100) + + # call mutliprocessing's cleanup function then exit process without + # garbage collecting locals + util._exit_function() + conn.close() + os._exit(0) + + def test_finalize(self): + conn, child_conn = self.Pipe() + + p = self.Process(target=self._test_finalize, args=(child_conn,)) + p.start() + p.join() + + result = [obj for obj in iter(conn.recv, 'STOP')] + self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e']) + +# +# Test that from ... import * works for each module +# + +class _TestImportStar(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_import(self): + modules = ( + 'multiprocessing', 'multiprocessing.connection', + 'multiprocessing.heap', 'multiprocessing.managers', + 'multiprocessing.pool', 'multiprocessing.process', + 'multiprocessing.reduction', 'multiprocessing.sharedctypes', + 'multiprocessing.synchronize', 'multiprocessing.util' + ) + + for name in modules: + __import__(name) + mod = sys.modules[name] + + for attr in getattr(mod, '__all__', ()): + self.assertTrue( + hasattr(mod, attr), + '%r does not have attribute %r' % (mod, attr) + ) + +# +# Quick test that logging works -- does not test logging output +# + +class _TestLogging(BaseTestCase): + + ALLOWED_TYPES = ('processes',) + + def test_enable_logging(self): + logger = multiprocessing.get_logger() + logger.setLevel(util.SUBWARNING) + self.assertTrue(logger is not None) + logger.debug('this will not be printed') + logger.info('nor will this') + logger.setLevel(LOG_LEVEL) + + def _test_level(self, conn): + logger = multiprocessing.get_logger() + conn.send(logger.getEffectiveLevel()) + + def test_level(self): + LEVEL1 = 32 + LEVEL2 = 37 + + logger = multiprocessing.get_logger() + root_logger = logging.getLogger() + root_level = root_logger.level + + reader, writer = multiprocessing.Pipe(duplex=False) + + logger.setLevel(LEVEL1) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL1, reader.recv()) + + logger.setLevel(logging.NOTSET) + root_logger.setLevel(LEVEL2) + self.Process(target=self._test_level, args=(writer,)).start() + self.assertEqual(LEVEL2, reader.recv()) + + root_logger.setLevel(root_level) + logger.setLevel(level=LOG_LEVEL) + +# +# Functions used to create test cases from the base ones in this module +# + +def get_attributes(Source, names): + d = {} + for name in names: + obj = getattr(Source, name) + if type(obj) == type(get_attributes): + obj = staticmethod(obj) + d[name] = obj + return d + +def create_test_cases(Mixin, type): + result = {} + glob = globals() + Type = type[0].upper() + type[1:] + + for name in glob.keys(): + if name.startswith('_Test'): + base = glob[name] + if type in base.ALLOWED_TYPES: + newname = 'With' + Type + name[1:] + class Temp(base, unittest.TestCase, Mixin): + pass + result[newname] = Temp + Temp.__name__ = newname + Temp.__module__ = Mixin.__module__ + return result + +# +# Create test cases +# + +class ProcessesMixin(object): + TYPE = 'processes' + Process = multiprocessing.Process + locals().update(get_attributes(multiprocessing, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'RawValue', + 'RawArray', 'current_process', 'active_children', 'Pipe', + 'connection', 'JoinableQueue' + ))) + +testcases_processes = create_test_cases(ProcessesMixin, type='processes') +globals().update(testcases_processes) + + +class ManagerMixin(object): + TYPE = 'manager' + Process = multiprocessing.Process + manager = object.__new__(multiprocessing.managers.SyncManager) + locals().update(get_attributes(manager, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'list', 'dict', + 'Namespace', 'JoinableQueue' + ))) + +testcases_manager = create_test_cases(ManagerMixin, type='manager') +globals().update(testcases_manager) + + +class ThreadsMixin(object): + TYPE = 'threads' + Process = multiprocessing.dummy.Process + locals().update(get_attributes(multiprocessing.dummy, ( + 'Queue', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', + 'Condition', 'Event', 'Value', 'Array', 'current_process', + 'active_children', 'Pipe', 'connection', 'dict', 'list', + 'Namespace', 'JoinableQueue' + ))) + +testcases_threads = create_test_cases(ThreadsMixin, type='threads') +globals().update(testcases_threads) + +# +# +# + +def test_main(run=None): + if run is None: + from test.test_support import run_unittest as run + + util.get_temp_dir() # creates temp directory for use by all processes + + multiprocessing.get_logger().setLevel(LOG_LEVEL) + + ProcessesMixin.pool = multiprocessing.Pool(4) + ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + ManagerMixin.manager.__init__() + ManagerMixin.manager.start() + ManagerMixin.pool = ManagerMixin.manager.Pool(4) + + testcases = ( + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + + sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + ) + + loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase + suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) + run(suite) + + ThreadsMixin.pool.terminate() + ProcessesMixin.pool.terminate() + ManagerMixin.pool.terminate() + ManagerMixin.manager.shutdown() + + del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + +def main(): + test_main(unittest.TextTestRunner(verbosity=2).run) + +if __name__ == '__main__': + main() Modified: python/branches/tlee-ast-optimize/Lib/test/test_struct.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_struct.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_struct.py Sun Jun 15 03:02:00 2008 @@ -569,11 +569,9 @@ for c in '\x01\x7f\xff\x0f\xf0': self.assertTrue(struct.unpack('>?', c)[0]) - def test_crasher(self): - if IS32BIT: + if IS32BIT: + def test_crasher(self): self.assertRaises(MemoryError, struct.pack, "357913941c", "a") - else: - print "%s test_crasher skipped on 64bit build." Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Sun Jun 15 03:02:00 2008 @@ -675,6 +675,7 @@ Monty Taylor Amy Taylor Tobias Thelen +James Thomas Robin Thomas Eric Tiedemann Tracy Tims Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sun Jun 15 03:02:00 2008 @@ -84,6 +84,9 @@ Library ------- +- Issue #2912: platform.uname now tries to determine unknown information even if + os.uname exists. + - The rfc822 module has been deprecated for removal in 3.0. - The mimetools module has been deprecated for removal in 3.0. @@ -304,7 +307,7 @@ Build ----- -- The Windows installer now includes Tk 8.5. +- The Windows installer now includes Tk 8.5, bzip2 1.0.5, and SQLite 3.5.9. - Patch #1722225: Support QNX 6. Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.c Sun Jun 15 03:02:00 2008 @@ -1,311 +1,311 @@ -/* - * Extension module used by multiprocessing package - * - * multiprocessing.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - -PyObject *create_win32_namespace(void); - -PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; -PyObject *ProcessError, *BufferTooShort; - -/* - * Function which raises exceptions based on error codes - */ - -PyObject * -mp_SetError(PyObject *Type, int num) -{ - switch (num) { -#ifdef MS_WINDOWS - case MP_STANDARD_ERROR: - if (Type == NULL) - Type = PyExc_WindowsError; - PyErr_SetExcFromWindowsErr(Type, 0); - break; - case MP_SOCKET_ERROR: - if (Type == NULL) - Type = PyExc_WindowsError; - PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); - break; -#else /* !MS_WINDOWS */ - case MP_STANDARD_ERROR: - case MP_SOCKET_ERROR: - if (Type == NULL) - Type = PyExc_OSError; - PyErr_SetFromErrno(Type); - break; -#endif /* !MS_WINDOWS */ - case MP_MEMORY_ERROR: - PyErr_NoMemory(); - break; - case MP_END_OF_FILE: - PyErr_SetNone(PyExc_EOFError); - break; - case MP_EARLY_END_OF_FILE: - PyErr_SetString(PyExc_IOError, - "got end of file during message"); - break; - case MP_BAD_MESSAGE_LENGTH: - PyErr_SetString(PyExc_IOError, "bad message length"); - break; - case MP_EXCEPTION_HAS_BEEN_SET: - break; - default: - PyErr_Format(PyExc_RuntimeError, - "unkown error number %d", num); - } - return NULL; -} - - -/* - * Windows only - */ - -#ifdef MS_WINDOWS - -/* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ - -HANDLE sigint_event = NULL; - -static BOOL WINAPI -ProcessingCtrlHandler(DWORD dwCtrlType) -{ - SetEvent(sigint_event); - return FALSE; -} - -/* - * Unix only - */ - -#else /* !MS_WINDOWS */ - -#if HAVE_FD_TRANSFER - -/* Functions for transferring file descriptors between processes. - Reimplements some of the functionality of the fdcred - module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ - -static PyObject * -multiprocessing_sendfd(PyObject *self, PyObject *args) -{ - int conn, fd, res; - char dummy_char; - char buf[CMSG_SPACE(sizeof(int))]; - struct msghdr msg = {0}; - struct iovec dummy_iov; - struct cmsghdr *cmsg; - - if (!PyArg_ParseTuple(args, "ii", &conn, &fd)) - return NULL; - - dummy_iov.iov_base = &dummy_char; - dummy_iov.iov_len = 1; - msg.msg_control = buf; - msg.msg_controllen = sizeof(buf); - msg.msg_iov = &dummy_iov; - msg.msg_iovlen = 1; - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - *(int*)CMSG_DATA(cmsg) = fd; - - Py_BEGIN_ALLOW_THREADS - res = sendmsg(conn, &msg, 0); - Py_END_ALLOW_THREADS - - if (res < 0) - return PyErr_SetFromErrno(PyExc_OSError); - Py_RETURN_NONE; -} - -static PyObject * -multiprocessing_recvfd(PyObject *self, PyObject *args) -{ - int conn, fd, res; - char dummy_char; - char buf[CMSG_SPACE(sizeof(int))]; - struct msghdr msg = {0}; - struct iovec dummy_iov; - struct cmsghdr *cmsg; - - if (!PyArg_ParseTuple(args, "i", &conn)) - return NULL; - - dummy_iov.iov_base = &dummy_char; - dummy_iov.iov_len = 1; - msg.msg_control = buf; - msg.msg_controllen = sizeof(buf); - msg.msg_iov = &dummy_iov; - msg.msg_iovlen = 1; - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - - Py_BEGIN_ALLOW_THREADS - res = recvmsg(conn, &msg, 0); - Py_END_ALLOW_THREADS - - if (res < 0) - return PyErr_SetFromErrno(PyExc_OSError); - - fd = *(int*)CMSG_DATA(cmsg); - return Py_BuildValue("i", fd); -} - -#endif /* HAVE_FD_TRANSFER */ - -#endif /* !MS_WINDOWS */ - - -/* - * All platforms - */ - -static PyObject* -multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) -{ - void *buffer; - Py_ssize_t buffer_len; - - if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) - return NULL; - - return Py_BuildValue("N" F_PY_SSIZE_T, - PyLong_FromVoidPtr(buffer), buffer_len); -} - - -/* - * Function table - */ - -static PyMethodDef module_methods[] = { - {"address_of_buffer", multiprocessing_address_of_buffer, METH_O, - "address_of_buffer(obj) -> int\n" - "Return address of obj assuming obj supports buffer inteface"}, -#if HAVE_FD_TRANSFER - {"sendfd", multiprocessing_sendfd, METH_VARARGS, - "sendfd(sockfd, fd) -> None\n" - "Send file descriptor given by fd over the unix domain socket\n" - "whose file decriptor is sockfd"}, - {"recvfd", multiprocessing_recvfd, METH_VARARGS, - "recvfd(sockfd) -> fd\n" - "Receive a file descriptor over a unix domain socket\n" - "whose file decriptor is sockfd"}, -#endif - {NULL} -}; - - -/* - * Initialize - */ - -PyMODINIT_FUNC -init_multiprocessing(void) -{ - PyObject *module, *temp, *value; - - /* Initialize module */ - module = Py_InitModule("_multiprocessing", module_methods); - if (!module) - return; - - /* Get copy of objects from pickle */ - temp = PyImport_ImportModule(PICKLE_MODULE); - if (!temp) - return; - pickle_dumps = PyObject_GetAttrString(temp, "dumps"); - pickle_loads = PyObject_GetAttrString(temp, "loads"); - pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); - Py_XDECREF(temp); - - /* Get copy of BufferTooShort */ - temp = PyImport_ImportModule("multiprocessing"); - if (!temp) - return; - BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); - Py_XDECREF(temp); - - /* Add connection type to module */ - if (PyType_Ready(&ConnectionType) < 0) - return; - Py_INCREF(&ConnectionType); - PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); - -#if defined(MS_WINDOWS) || HAVE_SEM_OPEN - /* Add SemLock type to module */ - if (PyType_Ready(&SemLockType) < 0) - return; - Py_INCREF(&SemLockType); - PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", - Py_BuildValue("i", SEM_VALUE_MAX)); - PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); -#endif - -#ifdef MS_WINDOWS - /* Add PipeConnection to module */ - if (PyType_Ready(&PipeConnectionType) < 0) - return; - Py_INCREF(&PipeConnectionType); - PyModule_AddObject(module, "PipeConnection", - (PyObject*)&PipeConnectionType); - - /* Initialize win32 class and add to multiprocessing */ - temp = create_win32_namespace(); - if (!temp) - return; - PyModule_AddObject(module, "win32", temp); - - /* Initialize the event handle used to signal Ctrl-C */ - sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!sigint_event) { - PyErr_SetFromWindowsErr(0); - return; - } - if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) { - PyErr_SetFromWindowsErr(0); - return; - } -#endif - - /* Add configuration macros */ - temp = PyDict_New(); - if (!temp) - return; -#define ADD_FLAG(name) \ - value = Py_BuildValue("i", name); \ - if (value == NULL) { Py_DECREF(temp); return; } \ - if (PyDict_SetItemString(temp, #name, value) < 0) { \ - Py_DECREF(temp); Py_DECREF(value); return; } \ - Py_DECREF(value) - -#ifdef HAVE_SEM_OPEN - ADD_FLAG(HAVE_SEM_OPEN); -#endif -#ifdef HAVE_SEM_TIMEDWAIT - ADD_FLAG(HAVE_SEM_TIMEDWAIT); -#endif -#ifdef HAVE_FD_TRANSFER - ADD_FLAG(HAVE_FD_TRANSFER); -#endif -#ifdef HAVE_BROKEN_SEM_GETVALUE - ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE); -#endif -#ifdef HAVE_BROKEN_SEM_UNLINK - ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); -#endif - if (PyModule_AddObject(module, "flags", temp) < 0) - return; -} +/* + * Extension module used by multiprocessing package + * + * multiprocessing.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +PyObject *create_win32_namespace(void); + +PyObject *pickle_dumps, *pickle_loads, *pickle_protocol; +PyObject *ProcessError, *BufferTooShort; + +/* + * Function which raises exceptions based on error codes + */ + +PyObject * +mp_SetError(PyObject *Type, int num) +{ + switch (num) { +#ifdef MS_WINDOWS + case MP_STANDARD_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, 0); + break; + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_WindowsError; + PyErr_SetExcFromWindowsErr(Type, WSAGetLastError()); + break; +#else /* !MS_WINDOWS */ + case MP_STANDARD_ERROR: + case MP_SOCKET_ERROR: + if (Type == NULL) + Type = PyExc_OSError; + PyErr_SetFromErrno(Type); + break; +#endif /* !MS_WINDOWS */ + case MP_MEMORY_ERROR: + PyErr_NoMemory(); + break; + case MP_END_OF_FILE: + PyErr_SetNone(PyExc_EOFError); + break; + case MP_EARLY_END_OF_FILE: + PyErr_SetString(PyExc_IOError, + "got end of file during message"); + break; + case MP_BAD_MESSAGE_LENGTH: + PyErr_SetString(PyExc_IOError, "bad message length"); + break; + case MP_EXCEPTION_HAS_BEEN_SET: + break; + default: + PyErr_Format(PyExc_RuntimeError, + "unkown error number %d", num); + } + return NULL; +} + + +/* + * Windows only + */ + +#ifdef MS_WINDOWS + +/* On Windows we set an event to signal Ctrl-C; compare with timemodule.c */ + +HANDLE sigint_event = NULL; + +static BOOL WINAPI +ProcessingCtrlHandler(DWORD dwCtrlType) +{ + SetEvent(sigint_event); + return FALSE; +} + +/* + * Unix only + */ + +#else /* !MS_WINDOWS */ + +#if HAVE_FD_TRANSFER + +/* Functions for transferring file descriptors between processes. + Reimplements some of the functionality of the fdcred + module at http://www.mca-ltd.com/resources/fdcred_1.tgz. */ + +static PyObject * +multiprocessing_sendfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "ii", &conn, &fd)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + *(int*)CMSG_DATA(cmsg) = fd; + + Py_BEGIN_ALLOW_THREADS + res = sendmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + Py_RETURN_NONE; +} + +static PyObject * +multiprocessing_recvfd(PyObject *self, PyObject *args) +{ + int conn, fd, res; + char dummy_char; + char buf[CMSG_SPACE(sizeof(int))]; + struct msghdr msg = {0}; + struct iovec dummy_iov; + struct cmsghdr *cmsg; + + if (!PyArg_ParseTuple(args, "i", &conn)) + return NULL; + + dummy_iov.iov_base = &dummy_char; + dummy_iov.iov_len = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + msg.msg_iov = &dummy_iov; + msg.msg_iovlen = 1; + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + + Py_BEGIN_ALLOW_THREADS + res = recvmsg(conn, &msg, 0); + Py_END_ALLOW_THREADS + + if (res < 0) + return PyErr_SetFromErrno(PyExc_OSError); + + fd = *(int*)CMSG_DATA(cmsg); + return Py_BuildValue("i", fd); +} + +#endif /* HAVE_FD_TRANSFER */ + +#endif /* !MS_WINDOWS */ + + +/* + * All platforms + */ + +static PyObject* +multiprocessing_address_of_buffer(PyObject *self, PyObject *obj) +{ + void *buffer; + Py_ssize_t buffer_len; + + if (PyObject_AsWriteBuffer(obj, &buffer, &buffer_len) < 0) + return NULL; + + return Py_BuildValue("N" F_PY_SSIZE_T, + PyLong_FromVoidPtr(buffer), buffer_len); +} + + +/* + * Function table + */ + +static PyMethodDef module_methods[] = { + {"address_of_buffer", multiprocessing_address_of_buffer, METH_O, + "address_of_buffer(obj) -> int\n" + "Return address of obj assuming obj supports buffer inteface"}, +#if HAVE_FD_TRANSFER + {"sendfd", multiprocessing_sendfd, METH_VARARGS, + "sendfd(sockfd, fd) -> None\n" + "Send file descriptor given by fd over the unix domain socket\n" + "whose file decriptor is sockfd"}, + {"recvfd", multiprocessing_recvfd, METH_VARARGS, + "recvfd(sockfd) -> fd\n" + "Receive a file descriptor over a unix domain socket\n" + "whose file decriptor is sockfd"}, +#endif + {NULL} +}; + + +/* + * Initialize + */ + +PyMODINIT_FUNC +init_multiprocessing(void) +{ + PyObject *module, *temp, *value; + + /* Initialize module */ + module = Py_InitModule("_multiprocessing", module_methods); + if (!module) + return; + + /* Get copy of objects from pickle */ + temp = PyImport_ImportModule(PICKLE_MODULE); + if (!temp) + return; + pickle_dumps = PyObject_GetAttrString(temp, "dumps"); + pickle_loads = PyObject_GetAttrString(temp, "loads"); + pickle_protocol = PyObject_GetAttrString(temp, "HIGHEST_PROTOCOL"); + Py_XDECREF(temp); + + /* Get copy of BufferTooShort */ + temp = PyImport_ImportModule("multiprocessing"); + if (!temp) + return; + BufferTooShort = PyObject_GetAttrString(temp, "BufferTooShort"); + Py_XDECREF(temp); + + /* Add connection type to module */ + if (PyType_Ready(&ConnectionType) < 0) + return; + Py_INCREF(&ConnectionType); + PyModule_AddObject(module, "Connection", (PyObject*)&ConnectionType); + +#if defined(MS_WINDOWS) || HAVE_SEM_OPEN + /* Add SemLock type to module */ + if (PyType_Ready(&SemLockType) < 0) + return; + Py_INCREF(&SemLockType); + PyDict_SetItemString(SemLockType.tp_dict, "SEM_VALUE_MAX", + Py_BuildValue("i", SEM_VALUE_MAX)); + PyModule_AddObject(module, "SemLock", (PyObject*)&SemLockType); +#endif + +#ifdef MS_WINDOWS + /* Add PipeConnection to module */ + if (PyType_Ready(&PipeConnectionType) < 0) + return; + Py_INCREF(&PipeConnectionType); + PyModule_AddObject(module, "PipeConnection", + (PyObject*)&PipeConnectionType); + + /* Initialize win32 class and add to multiprocessing */ + temp = create_win32_namespace(); + if (!temp) + return; + PyModule_AddObject(module, "win32", temp); + + /* Initialize the event handle used to signal Ctrl-C */ + sigint_event = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!sigint_event) { + PyErr_SetFromWindowsErr(0); + return; + } + if (!SetConsoleCtrlHandler(ProcessingCtrlHandler, TRUE)) { + PyErr_SetFromWindowsErr(0); + return; + } +#endif + + /* Add configuration macros */ + temp = PyDict_New(); + if (!temp) + return; +#define ADD_FLAG(name) \ + value = Py_BuildValue("i", name); \ + if (value == NULL) { Py_DECREF(temp); return; } \ + if (PyDict_SetItemString(temp, #name, value) < 0) { \ + Py_DECREF(temp); Py_DECREF(value); return; } \ + Py_DECREF(value) + +#ifdef HAVE_SEM_OPEN + ADD_FLAG(HAVE_SEM_OPEN); +#endif +#ifdef HAVE_SEM_TIMEDWAIT + ADD_FLAG(HAVE_SEM_TIMEDWAIT); +#endif +#ifdef HAVE_FD_TRANSFER + ADD_FLAG(HAVE_FD_TRANSFER); +#endif +#ifdef HAVE_BROKEN_SEM_GETVALUE + ADD_FLAG(HAVE_BROKEN_SEM_GETVALUE); +#endif +#ifdef HAVE_BROKEN_SEM_UNLINK + ADD_FLAG(HAVE_BROKEN_SEM_UNLINK); +#endif + if (PyModule_AddObject(module, "flags", temp) < 0) + return; +} Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h Sun Jun 15 03:02:00 2008 @@ -1,163 +1,163 @@ -#ifndef MULTIPROCESSING_H -#define MULTIPROCESSING_H - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "structmember.h" -#include "pythread.h" - -/* - * Platform includes and definitions - */ - -#ifdef MS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include -# include -# include /* getpid() */ -# define SEM_HANDLE HANDLE -# define SEM_VALUE_MAX LONG_MAX -#else -# include /* O_CREAT and O_EXCL */ -# include -# include /* htonl() and ntohl() */ -# if HAVE_SEM_OPEN -# include - typedef sem_t *SEM_HANDLE; -# endif -# define HANDLE int -# define SOCKET int -# define BOOL int -# define UINT32 uint32_t -# define INT32 int32_t -# define TRUE 1 -# define FALSE 0 -# define INVALID_HANDLE_VALUE (-1) -#endif - -/* - * Make sure Py_ssize_t available - */ - -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) - typedef int Py_ssize_t; -# define PY_SSIZE_T_MAX INT_MAX -# define PY_SSIZE_T_MIN INT_MIN -# define F_PY_SSIZE_T "i" -# define PY_FORMAT_SIZE_T "" -# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n) -#else -# define F_PY_SSIZE_T "n" -#endif - -/* - * Format codes - */ - -#if SIZEOF_VOID_P == SIZEOF_LONG -# define F_POINTER "k" -# define T_POINTER T_ULONG -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) -# define F_POINTER "K" -# define T_POINTER T_ULONGLONG -#else -# error "can't find format code for unsigned integer of same size as void*" -#endif - -#ifdef MS_WINDOWS -# define F_HANDLE F_POINTER -# define T_HANDLE T_POINTER -# define F_SEM_HANDLE F_HANDLE -# define T_SEM_HANDLE T_HANDLE -# define F_DWORD "k" -# define T_DWORD T_ULONG -#else -# define F_HANDLE "i" -# define T_HANDLE T_INT -# define F_SEM_HANDLE F_POINTER -# define T_SEM_HANDLE T_POINTER -#endif - -#if PY_VERSION_HEX >= 0x03000000 -# define F_RBUFFER "y" -#else -# define F_RBUFFER "s" -#endif - -/* - * Error codes which can be returned by functions called without GIL - */ - -#define MP_SUCCESS (0) -#define MP_STANDARD_ERROR (-1) -#define MP_MEMORY_ERROR (-1001) -#define MP_END_OF_FILE (-1002) -#define MP_EARLY_END_OF_FILE (-1003) -#define MP_BAD_MESSAGE_LENGTH (-1004) -#define MP_SOCKET_ERROR (-1005) -#define MP_EXCEPTION_HAS_BEEN_SET (-1006) - -PyObject *mp_SetError(PyObject *Type, int num); - -/* - * Externs - not all will really exist on all platforms - */ - -extern PyObject *pickle_dumps; -extern PyObject *pickle_loads; -extern PyObject *pickle_protocol; -extern PyObject *BufferTooShort; -extern PyTypeObject SemLockType; -extern PyTypeObject ConnectionType; -extern PyTypeObject PipeConnectionType; -extern HANDLE sigint_event; - -/* - * Py3k compatibility - */ - -#if PY_VERSION_HEX >= 0x03000000 -# define PICKLE_MODULE "pickle" -# define FROM_FORMAT PyUnicode_FromFormat -# define PyInt_FromLong PyLong_FromLong -# define PyInt_FromSsize_t PyLong_FromSsize_t -#else -# define PICKLE_MODULE "cPickle" -# define FROM_FORMAT PyString_FromFormat -#endif - -#ifndef PyVarObject_HEAD_INIT -# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, -#endif - -#ifndef Py_TPFLAGS_HAVE_WEAKREFS -# define Py_TPFLAGS_HAVE_WEAKREFS 0 -#endif - -/* - * Connection definition - */ - -#define CONNECTION_BUFFER_SIZE 1024 - -typedef struct { - PyObject_HEAD - HANDLE handle; - int flags; - PyObject *weakreflist; - char buffer[CONNECTION_BUFFER_SIZE]; -} ConnectionObject; - -/* - * Miscellaneous - */ - -#define MAX_MESSAGE_LENGTH 0x7fffffff - -#ifndef MIN -# define MIN(x, y) ((x) < (y) ? x : y) -# define MAX(x, y) ((x) > (y) ? x : y) -#endif - -#endif /* MULTIPROCESSING_H */ +#ifndef MULTIPROCESSING_H +#define MULTIPROCESSING_H + +#define PY_SSIZE_T_CLEAN + +#include "Python.h" +#include "structmember.h" +#include "pythread.h" + +/* + * Platform includes and definitions + */ + +#ifdef MS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# include +# include +# include /* getpid() */ +# define SEM_HANDLE HANDLE +# define SEM_VALUE_MAX LONG_MAX +#else +# include /* O_CREAT and O_EXCL */ +# include +# include /* htonl() and ntohl() */ +# if HAVE_SEM_OPEN +# include + typedef sem_t *SEM_HANDLE; +# endif +# define HANDLE int +# define SOCKET int +# define BOOL int +# define UINT32 uint32_t +# define INT32 int32_t +# define TRUE 1 +# define FALSE 0 +# define INVALID_HANDLE_VALUE (-1) +#endif + +/* + * Make sure Py_ssize_t available + */ + +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) + typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +# define F_PY_SSIZE_T "i" +# define PY_FORMAT_SIZE_T "" +# define PyInt_FromSsize_t(n) PyInt_FromLong((long)n) +#else +# define F_PY_SSIZE_T "n" +#endif + +/* + * Format codes + */ + +#if SIZEOF_VOID_P == SIZEOF_LONG +# define F_POINTER "k" +# define T_POINTER T_ULONG +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +# define F_POINTER "K" +# define T_POINTER T_ULONGLONG +#else +# error "can't find format code for unsigned integer of same size as void*" +#endif + +#ifdef MS_WINDOWS +# define F_HANDLE F_POINTER +# define T_HANDLE T_POINTER +# define F_SEM_HANDLE F_HANDLE +# define T_SEM_HANDLE T_HANDLE +# define F_DWORD "k" +# define T_DWORD T_ULONG +#else +# define F_HANDLE "i" +# define T_HANDLE T_INT +# define F_SEM_HANDLE F_POINTER +# define T_SEM_HANDLE T_POINTER +#endif + +#if PY_VERSION_HEX >= 0x03000000 +# define F_RBUFFER "y" +#else +# define F_RBUFFER "s" +#endif + +/* + * Error codes which can be returned by functions called without GIL + */ + +#define MP_SUCCESS (0) +#define MP_STANDARD_ERROR (-1) +#define MP_MEMORY_ERROR (-1001) +#define MP_END_OF_FILE (-1002) +#define MP_EARLY_END_OF_FILE (-1003) +#define MP_BAD_MESSAGE_LENGTH (-1004) +#define MP_SOCKET_ERROR (-1005) +#define MP_EXCEPTION_HAS_BEEN_SET (-1006) + +PyObject *mp_SetError(PyObject *Type, int num); + +/* + * Externs - not all will really exist on all platforms + */ + +extern PyObject *pickle_dumps; +extern PyObject *pickle_loads; +extern PyObject *pickle_protocol; +extern PyObject *BufferTooShort; +extern PyTypeObject SemLockType; +extern PyTypeObject ConnectionType; +extern PyTypeObject PipeConnectionType; +extern HANDLE sigint_event; + +/* + * Py3k compatibility + */ + +#if PY_VERSION_HEX >= 0x03000000 +# define PICKLE_MODULE "pickle" +# define FROM_FORMAT PyUnicode_FromFormat +# define PyInt_FromLong PyLong_FromLong +# define PyInt_FromSsize_t PyLong_FromSsize_t +#else +# define PICKLE_MODULE "cPickle" +# define FROM_FORMAT PyString_FromFormat +#endif + +#ifndef PyVarObject_HEAD_INIT +# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + +#ifndef Py_TPFLAGS_HAVE_WEAKREFS +# define Py_TPFLAGS_HAVE_WEAKREFS 0 +#endif + +/* + * Connection definition + */ + +#define CONNECTION_BUFFER_SIZE 1024 + +typedef struct { + PyObject_HEAD + HANDLE handle; + int flags; + PyObject *weakreflist; + char buffer[CONNECTION_BUFFER_SIZE]; +} ConnectionObject; + +/* + * Miscellaneous + */ + +#define MAX_MESSAGE_LENGTH 0x7fffffff + +#ifndef MIN +# define MIN(x, y) ((x) < (y) ? x : y) +# define MAX(x, y) ((x) > (y) ? x : y) +#endif + +#endif /* MULTIPROCESSING_H */ Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/pipe_connection.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/pipe_connection.c (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/pipe_connection.c Sun Jun 15 03:02:00 2008 @@ -1,136 +1,136 @@ -/* - * A type which wraps a pipe handle in message oriented mode - * - * pipe_connection.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - -#define CLOSE(h) CloseHandle(h) - -/* - * Send string to the pipe; assumes in message oriented mode - */ - -static Py_ssize_t -conn_send_string(ConnectionObject *conn, char *string, size_t length) -{ - DWORD amount_written; - - return WriteFile(conn->handle, string, length, &amount_written, NULL) - ? MP_SUCCESS : MP_STANDARD_ERROR; -} - -/* - * Attempts to read into buffer, or if buffer too small into *newbuffer. - * - * Returns number of bytes read. Assumes in message oriented mode. - */ - -static Py_ssize_t -conn_recv_string(ConnectionObject *conn, char *buffer, - size_t buflength, char **newbuffer, size_t maxlength) -{ - DWORD left, length, full_length, err; - - *newbuffer = NULL; - - if (ReadFile(conn->handle, buffer, MIN(buflength, maxlength), - &length, NULL)) - return length; - - err = GetLastError(); - if (err != ERROR_MORE_DATA) { - if (err == ERROR_BROKEN_PIPE) - return MP_END_OF_FILE; - return MP_STANDARD_ERROR; - } - - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, NULL, &left)) - return MP_STANDARD_ERROR; - - full_length = length + left; - if (full_length > maxlength) - return MP_BAD_MESSAGE_LENGTH; - - *newbuffer = PyMem_Malloc(full_length); - if (*newbuffer == NULL) - return MP_MEMORY_ERROR; - - memcpy(*newbuffer, buffer, length); - - if (ReadFile(conn->handle, *newbuffer+length, left, &length, NULL)) { - assert(length == left); - return full_length; - } else { - PyMem_Free(*newbuffer); - return MP_STANDARD_ERROR; - } -} - -/* - * Check whether any data is available for reading - */ - -#define conn_poll(conn, timeout) conn_poll_save(conn, timeout, _save) - -static int -conn_poll_save(ConnectionObject *conn, double timeout, PyThreadState *_save) -{ - DWORD bytes, deadline, delay; - int difference, res; - BOOL block = FALSE; - - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) - return MP_STANDARD_ERROR; - - if (timeout == 0.0) - return bytes > 0; - - if (timeout < 0.0) - block = TRUE; - else - /* XXX does not check for overflow */ - deadline = GetTickCount() + (DWORD)(1000 * timeout + 0.5); - - Sleep(0); - - for (delay = 1 ; ; delay += 1) { - if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) - return MP_STANDARD_ERROR; - else if (bytes > 0) - return TRUE; - - if (!block) { - difference = deadline - GetTickCount(); - if (difference < 0) - return FALSE; - if ((int)delay > difference) - delay = difference; - } - - if (delay > 20) - delay = 20; - - Sleep(delay); - - /* check for signals */ - Py_BLOCK_THREADS - res = PyErr_CheckSignals(); - Py_UNBLOCK_THREADS - - if (res) - return MP_EXCEPTION_HAS_BEEN_SET; - } -} - -/* - * "connection.h" defines the PipeConnection type using the definitions above - */ - -#define CONNECTION_NAME "PipeConnection" -#define CONNECTION_TYPE PipeConnectionType - -#include "connection.h" +/* + * A type which wraps a pipe handle in message oriented mode + * + * pipe_connection.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + +#define CLOSE(h) CloseHandle(h) + +/* + * Send string to the pipe; assumes in message oriented mode + */ + +static Py_ssize_t +conn_send_string(ConnectionObject *conn, char *string, size_t length) +{ + DWORD amount_written; + + return WriteFile(conn->handle, string, length, &amount_written, NULL) + ? MP_SUCCESS : MP_STANDARD_ERROR; +} + +/* + * Attempts to read into buffer, or if buffer too small into *newbuffer. + * + * Returns number of bytes read. Assumes in message oriented mode. + */ + +static Py_ssize_t +conn_recv_string(ConnectionObject *conn, char *buffer, + size_t buflength, char **newbuffer, size_t maxlength) +{ + DWORD left, length, full_length, err; + + *newbuffer = NULL; + + if (ReadFile(conn->handle, buffer, MIN(buflength, maxlength), + &length, NULL)) + return length; + + err = GetLastError(); + if (err != ERROR_MORE_DATA) { + if (err == ERROR_BROKEN_PIPE) + return MP_END_OF_FILE; + return MP_STANDARD_ERROR; + } + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, NULL, &left)) + return MP_STANDARD_ERROR; + + full_length = length + left; + if (full_length > maxlength) + return MP_BAD_MESSAGE_LENGTH; + + *newbuffer = PyMem_Malloc(full_length); + if (*newbuffer == NULL) + return MP_MEMORY_ERROR; + + memcpy(*newbuffer, buffer, length); + + if (ReadFile(conn->handle, *newbuffer+length, left, &length, NULL)) { + assert(length == left); + return full_length; + } else { + PyMem_Free(*newbuffer); + return MP_STANDARD_ERROR; + } +} + +/* + * Check whether any data is available for reading + */ + +#define conn_poll(conn, timeout) conn_poll_save(conn, timeout, _save) + +static int +conn_poll_save(ConnectionObject *conn, double timeout, PyThreadState *_save) +{ + DWORD bytes, deadline, delay; + int difference, res; + BOOL block = FALSE; + + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + + if (timeout == 0.0) + return bytes > 0; + + if (timeout < 0.0) + block = TRUE; + else + /* XXX does not check for overflow */ + deadline = GetTickCount() + (DWORD)(1000 * timeout + 0.5); + + Sleep(0); + + for (delay = 1 ; ; delay += 1) { + if (!PeekNamedPipe(conn->handle, NULL, 0, NULL, &bytes, NULL)) + return MP_STANDARD_ERROR; + else if (bytes > 0) + return TRUE; + + if (!block) { + difference = deadline - GetTickCount(); + if (difference < 0) + return FALSE; + if ((int)delay > difference) + delay = difference; + } + + if (delay > 20) + delay = 20; + + Sleep(delay); + + /* check for signals */ + Py_BLOCK_THREADS + res = PyErr_CheckSignals(); + Py_UNBLOCK_THREADS + + if (res) + return MP_EXCEPTION_HAS_BEEN_SET; + } +} + +/* + * "connection.h" defines the PipeConnection type using the definitions above + */ + +#define CONNECTION_NAME "PipeConnection" +#define CONNECTION_TYPE PipeConnectionType + +#include "connection.h" Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/win32_functions.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/win32_functions.c (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/win32_functions.c Sun Jun 15 03:02:00 2008 @@ -1,260 +1,260 @@ -/* - * Win32 functions used by multiprocessing package - * - * win32_functions.c - * - * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt - */ - -#include "multiprocessing.h" - - -#define WIN32_FUNCTION(func) \ - {#func, (PyCFunction)win32_ ## func, METH_VARARGS | METH_STATIC, ""} - -#define WIN32_CONSTANT(fmt, con) \ - PyDict_SetItemString(Win32Type.tp_dict, #con, Py_BuildValue(fmt, con)) - - -static PyObject * -win32_CloseHandle(PyObject *self, PyObject *args) -{ - HANDLE hObject; - BOOL success; - - if (!PyArg_ParseTuple(args, F_HANDLE, &hObject)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = CloseHandle(hObject); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_ConnectNamedPipe(PyObject *self, PyObject *args) -{ - HANDLE hNamedPipe; - LPOVERLAPPED lpOverlapped; - BOOL success; - - if (!PyArg_ParseTuple(args, F_HANDLE F_POINTER, - &hNamedPipe, &lpOverlapped)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = ConnectNamedPipe(hNamedPipe, lpOverlapped); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_CreateFile(PyObject *self, PyObject *args) -{ - LPCTSTR lpFileName; - DWORD dwDesiredAccess; - DWORD dwShareMode; - LPSECURITY_ATTRIBUTES lpSecurityAttributes; - DWORD dwCreationDisposition; - DWORD dwFlagsAndAttributes; - HANDLE hTemplateFile; - HANDLE handle; - - if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_POINTER - F_DWORD F_DWORD F_HANDLE, - &lpFileName, &dwDesiredAccess, &dwShareMode, - &lpSecurityAttributes, &dwCreationDisposition, - &dwFlagsAndAttributes, &hTemplateFile)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - handle = CreateFile(lpFileName, dwDesiredAccess, - dwShareMode, lpSecurityAttributes, - dwCreationDisposition, - dwFlagsAndAttributes, hTemplateFile); - Py_END_ALLOW_THREADS - - if (handle == INVALID_HANDLE_VALUE) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_CreateNamedPipe(PyObject *self, PyObject *args) -{ - LPCTSTR lpName; - DWORD dwOpenMode; - DWORD dwPipeMode; - DWORD nMaxInstances; - DWORD nOutBufferSize; - DWORD nInBufferSize; - DWORD nDefaultTimeOut; - LPSECURITY_ATTRIBUTES lpSecurityAttributes; - HANDLE handle; - - if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_DWORD - F_DWORD F_DWORD F_DWORD F_POINTER, - &lpName, &dwOpenMode, &dwPipeMode, - &nMaxInstances, &nOutBufferSize, - &nInBufferSize, &nDefaultTimeOut, - &lpSecurityAttributes)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - handle = CreateNamedPipe(lpName, dwOpenMode, dwPipeMode, - nMaxInstances, nOutBufferSize, - nInBufferSize, nDefaultTimeOut, - lpSecurityAttributes); - Py_END_ALLOW_THREADS - - if (handle == INVALID_HANDLE_VALUE) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_ExitProcess(PyObject *self, PyObject *args) -{ - UINT uExitCode; - - if (!PyArg_ParseTuple(args, "I", &uExitCode)) - return NULL; - - ExitProcess(uExitCode); - - return NULL; -} - -static PyObject * -win32_GetLastError(PyObject *self, PyObject *args) -{ - return Py_BuildValue(F_DWORD, GetLastError()); -} - -static PyObject * -win32_OpenProcess(PyObject *self, PyObject *args) -{ - DWORD dwDesiredAccess; - BOOL bInheritHandle; - DWORD dwProcessId; - HANDLE handle; - - if (!PyArg_ParseTuple(args, F_DWORD "i" F_DWORD, - &dwDesiredAccess, &bInheritHandle, &dwProcessId)) - return NULL; - - handle = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId); - if (handle == NULL) - return PyErr_SetFromWindowsErr(0); - - return Py_BuildValue(F_HANDLE, handle); -} - -static PyObject * -win32_SetNamedPipeHandleState(PyObject *self, PyObject *args) -{ - HANDLE hNamedPipe; - PyObject *oArgs[3]; - DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL}; - int i; - - if (!PyArg_ParseTuple(args, F_HANDLE "OOO", - &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2])) - return NULL; - - PyErr_Clear(); - - for (i = 0 ; i < 3 ; i++) { - if (oArgs[i] != Py_None) { - dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]); - if (PyErr_Occurred()) - return NULL; - pArgs[i] = &dwArgs[i]; - } - } - - if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2])) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyObject * -win32_WaitNamedPipe(PyObject *self, PyObject *args) -{ - LPCTSTR lpNamedPipeName; - DWORD nTimeOut; - BOOL success; - - if (!PyArg_ParseTuple(args, "s" F_DWORD, &lpNamedPipeName, &nTimeOut)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - success = WaitNamedPipe(lpNamedPipeName, nTimeOut); - Py_END_ALLOW_THREADS - - if (!success) - return PyErr_SetFromWindowsErr(0); - - Py_RETURN_NONE; -} - -static PyMethodDef win32_methods[] = { - WIN32_FUNCTION(CloseHandle), - WIN32_FUNCTION(GetLastError), - WIN32_FUNCTION(OpenProcess), - WIN32_FUNCTION(ExitProcess), - WIN32_FUNCTION(ConnectNamedPipe), - WIN32_FUNCTION(CreateFile), - WIN32_FUNCTION(CreateNamedPipe), - WIN32_FUNCTION(SetNamedPipeHandleState), - WIN32_FUNCTION(WaitNamedPipe), - {NULL} -}; - - -PyTypeObject Win32Type = { - PyVarObject_HEAD_INIT(NULL, 0) -}; - - -PyObject * -create_win32_namespace(void) -{ - Win32Type.tp_name = "_multiprocessing.win32"; - Win32Type.tp_methods = win32_methods; - if (PyType_Ready(&Win32Type) < 0) - return NULL; - Py_INCREF(&Win32Type); - - WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS); - WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); - WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); - WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT); - WIN32_CONSTANT(F_DWORD, GENERIC_READ); - WIN32_CONSTANT(F_DWORD, GENERIC_WRITE); - WIN32_CONSTANT(F_DWORD, INFINITE); - WIN32_CONSTANT(F_DWORD, NMPWAIT_WAIT_FOREVER); - WIN32_CONSTANT(F_DWORD, OPEN_EXISTING); - WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_DUPLEX); - WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_INBOUND); - WIN32_CONSTANT(F_DWORD, PIPE_READMODE_MESSAGE); - WIN32_CONSTANT(F_DWORD, PIPE_TYPE_MESSAGE); - WIN32_CONSTANT(F_DWORD, PIPE_UNLIMITED_INSTANCES); - WIN32_CONSTANT(F_DWORD, PIPE_WAIT); - WIN32_CONSTANT(F_DWORD, PROCESS_ALL_ACCESS); - - WIN32_CONSTANT("i", NULL); - - return (PyObject*)&Win32Type; -} +/* + * Win32 functions used by multiprocessing package + * + * win32_functions.c + * + * Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt + */ + +#include "multiprocessing.h" + + +#define WIN32_FUNCTION(func) \ + {#func, (PyCFunction)win32_ ## func, METH_VARARGS | METH_STATIC, ""} + +#define WIN32_CONSTANT(fmt, con) \ + PyDict_SetItemString(Win32Type.tp_dict, #con, Py_BuildValue(fmt, con)) + + +static PyObject * +win32_CloseHandle(PyObject *self, PyObject *args) +{ + HANDLE hObject; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE, &hObject)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = CloseHandle(hObject); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_ConnectNamedPipe(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + LPOVERLAPPED lpOverlapped; + BOOL success; + + if (!PyArg_ParseTuple(args, F_HANDLE F_POINTER, + &hNamedPipe, &lpOverlapped)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = ConnectNamedPipe(hNamedPipe, lpOverlapped); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_CreateFile(PyObject *self, PyObject *args) +{ + LPCTSTR lpFileName; + DWORD dwDesiredAccess; + DWORD dwShareMode; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + DWORD dwCreationDisposition; + DWORD dwFlagsAndAttributes; + HANDLE hTemplateFile; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_POINTER + F_DWORD F_DWORD F_HANDLE, + &lpFileName, &dwDesiredAccess, &dwShareMode, + &lpSecurityAttributes, &dwCreationDisposition, + &dwFlagsAndAttributes, &hTemplateFile)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateFile(lpFileName, dwDesiredAccess, + dwShareMode, lpSecurityAttributes, + dwCreationDisposition, + dwFlagsAndAttributes, hTemplateFile); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_CreateNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpName; + DWORD dwOpenMode; + DWORD dwPipeMode; + DWORD nMaxInstances; + DWORD nOutBufferSize; + DWORD nInBufferSize; + DWORD nDefaultTimeOut; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + HANDLE handle; + + if (!PyArg_ParseTuple(args, "s" F_DWORD F_DWORD F_DWORD + F_DWORD F_DWORD F_DWORD F_POINTER, + &lpName, &dwOpenMode, &dwPipeMode, + &nMaxInstances, &nOutBufferSize, + &nInBufferSize, &nDefaultTimeOut, + &lpSecurityAttributes)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + handle = CreateNamedPipe(lpName, dwOpenMode, dwPipeMode, + nMaxInstances, nOutBufferSize, + nInBufferSize, nDefaultTimeOut, + lpSecurityAttributes); + Py_END_ALLOW_THREADS + + if (handle == INVALID_HANDLE_VALUE) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_ExitProcess(PyObject *self, PyObject *args) +{ + UINT uExitCode; + + if (!PyArg_ParseTuple(args, "I", &uExitCode)) + return NULL; + + ExitProcess(uExitCode); + + return NULL; +} + +static PyObject * +win32_GetLastError(PyObject *self, PyObject *args) +{ + return Py_BuildValue(F_DWORD, GetLastError()); +} + +static PyObject * +win32_OpenProcess(PyObject *self, PyObject *args) +{ + DWORD dwDesiredAccess; + BOOL bInheritHandle; + DWORD dwProcessId; + HANDLE handle; + + if (!PyArg_ParseTuple(args, F_DWORD "i" F_DWORD, + &dwDesiredAccess, &bInheritHandle, &dwProcessId)) + return NULL; + + handle = OpenProcess(dwDesiredAccess, bInheritHandle, dwProcessId); + if (handle == NULL) + return PyErr_SetFromWindowsErr(0); + + return Py_BuildValue(F_HANDLE, handle); +} + +static PyObject * +win32_SetNamedPipeHandleState(PyObject *self, PyObject *args) +{ + HANDLE hNamedPipe; + PyObject *oArgs[3]; + DWORD dwArgs[3], *pArgs[3] = {NULL, NULL, NULL}; + int i; + + if (!PyArg_ParseTuple(args, F_HANDLE "OOO", + &hNamedPipe, &oArgs[0], &oArgs[1], &oArgs[2])) + return NULL; + + PyErr_Clear(); + + for (i = 0 ; i < 3 ; i++) { + if (oArgs[i] != Py_None) { + dwArgs[i] = PyInt_AsUnsignedLongMask(oArgs[i]); + if (PyErr_Occurred()) + return NULL; + pArgs[i] = &dwArgs[i]; + } + } + + if (!SetNamedPipeHandleState(hNamedPipe, pArgs[0], pArgs[1], pArgs[2])) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyObject * +win32_WaitNamedPipe(PyObject *self, PyObject *args) +{ + LPCTSTR lpNamedPipeName; + DWORD nTimeOut; + BOOL success; + + if (!PyArg_ParseTuple(args, "s" F_DWORD, &lpNamedPipeName, &nTimeOut)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + success = WaitNamedPipe(lpNamedPipeName, nTimeOut); + Py_END_ALLOW_THREADS + + if (!success) + return PyErr_SetFromWindowsErr(0); + + Py_RETURN_NONE; +} + +static PyMethodDef win32_methods[] = { + WIN32_FUNCTION(CloseHandle), + WIN32_FUNCTION(GetLastError), + WIN32_FUNCTION(OpenProcess), + WIN32_FUNCTION(ExitProcess), + WIN32_FUNCTION(ConnectNamedPipe), + WIN32_FUNCTION(CreateFile), + WIN32_FUNCTION(CreateNamedPipe), + WIN32_FUNCTION(SetNamedPipeHandleState), + WIN32_FUNCTION(WaitNamedPipe), + {NULL} +}; + + +PyTypeObject Win32Type = { + PyVarObject_HEAD_INIT(NULL, 0) +}; + + +PyObject * +create_win32_namespace(void) +{ + Win32Type.tp_name = "_multiprocessing.win32"; + Win32Type.tp_methods = win32_methods; + if (PyType_Ready(&Win32Type) < 0) + return NULL; + Py_INCREF(&Win32Type); + + WIN32_CONSTANT(F_DWORD, ERROR_ALREADY_EXISTS); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); + WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); + WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT); + WIN32_CONSTANT(F_DWORD, GENERIC_READ); + WIN32_CONSTANT(F_DWORD, GENERIC_WRITE); + WIN32_CONSTANT(F_DWORD, INFINITE); + WIN32_CONSTANT(F_DWORD, NMPWAIT_WAIT_FOREVER); + WIN32_CONSTANT(F_DWORD, OPEN_EXISTING); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_DUPLEX); + WIN32_CONSTANT(F_DWORD, PIPE_ACCESS_INBOUND); + WIN32_CONSTANT(F_DWORD, PIPE_READMODE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_TYPE_MESSAGE); + WIN32_CONSTANT(F_DWORD, PIPE_UNLIMITED_INSTANCES); + WIN32_CONSTANT(F_DWORD, PIPE_WAIT); + WIN32_CONSTANT(F_DWORD, PROCESS_ALL_ACCESS); + + WIN32_CONSTANT("i", NULL); + + return (PyObject*)&Win32Type; +} Modified: python/branches/tlee-ast-optimize/Modules/socketmodule.h ============================================================================== --- python/branches/tlee-ast-optimize/Modules/socketmodule.h (original) +++ python/branches/tlee-ast-optimize/Modules/socketmodule.h Sun Jun 15 03:02:00 2008 @@ -17,9 +17,10 @@ # include /* VC6 is shipped with old platform headers, and does not have MSTcpIP.h * Separate SDKs have all the functions we want, but older ones don't have - * any version information. I use IPPROTO_IPV6 to detect a decent SDK. + * any version information. + * I use SIO_GET_MULTICAST_FILTER to detect a decent SDK. */ -# ifdef IPPROTO_IPV6 +# ifdef SIO_GET_MULTICAST_FILTER # include /* for SIO_RCVALL */ # define HAVE_ADDRINFO # define HAVE_SOCKADDR_STORAGE Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb.vcproj Sun Jun 15 03:02:00 2008 @@ -1,546 +1,546 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_bsddb44.vcproj Sun Jun 15 03:02:00 2008 @@ -1,1252 +1,1252 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes.vcproj Sun Jun 15 03:02:00 2008 @@ -1,705 +1,705 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes_test.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes_test.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_ctypes_test.vcproj Sun Jun 15 03:02:00 2008 @@ -1,521 +1,521 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_elementtree.vcproj Sun Jun 15 03:02:00 2008 @@ -1,613 +1,613 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_hashlib.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_hashlib.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_hashlib.vcproj Sun Jun 15 03:02:00 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_msi.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_msi.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_msi.vcproj Sun Jun 15 03:02:00 2008 @@ -1,529 +1,529 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_socket.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_socket.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_socket.vcproj Sun Jun 15 03:02:00 2008 @@ -1,537 +1,537 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_sqlite3.vcproj Sun Jun 15 03:02:00 2008 @@ -1,613 +1,613 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_ssl.vcproj Sun Jun 15 03:02:00 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_testcapi.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_testcapi.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_testcapi.vcproj Sun Jun 15 03:02:00 2008 @@ -1,521 +1,521 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/_tkinter.vcproj Sun Jun 15 03:02:00 2008 @@ -1,541 +1,541 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/bdist_wininst.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/bdist_wininst.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/bdist_wininst.vcproj Sun Jun 15 03:02:00 2008 @@ -1,270 +1,270 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/bz2.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/bz2.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/bz2.vcproj Sun Jun 15 03:02:00 2008 @@ -1,545 +1,545 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.c ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.c (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.c Sun Jun 15 03:02:00 2008 @@ -1,178 +1,178 @@ -/* - * Helper program for killing lingering python[_d].exe processes before - * building, thus attempting to avoid build failures due to files being - * locked. - */ - -#include -#include -#include -#include - -#pragma comment(lib, "psapi") - -#ifdef _DEBUG -#define PYTHON_EXE (L"python_d.exe") -#define PYTHON_EXE_LEN (12) -#define KILL_PYTHON_EXE (L"kill_python_d.exe") -#define KILL_PYTHON_EXE_LEN (17) -#else -#define PYTHON_EXE (L"python.exe") -#define PYTHON_EXE_LEN (10) -#define KILL_PYTHON_EXE (L"kill_python.exe") -#define KILL_PYTHON_EXE_LEN (15) -#endif - -int -main(int argc, char **argv) -{ - HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ - DWORD dac, our_pid; - size_t len; - wchar_t path[MAX_PATH+1]; - - MODULEENTRY32W me; - PROCESSENTRY32W pe; - - me.dwSize = sizeof(MODULEENTRY32W); - pe.dwSize = sizeof(PROCESSENTRY32W); - - memset(path, 0, MAX_PATH+1); - - our_pid = GetCurrentProcessId(); - - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); - if (hsm == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); - return 1; - } - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[1] failed: %d\n", GetLastError()); - CloseHandle(hsm); - return 1; - } - - /* - * Enumerate over the modules for the current process in order to find - * kill_process[_d].exe, then take a note of the directory it lives in. - */ - do { - if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) - continue; - - len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; - wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); - - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - if (path == NULL) { - printf("failed to discern directory of running process\n"); - return 1; - } - - /* - * Take a snapshot of system processes. Enumerate over the snapshot, - * looking for python processes. When we find one, verify it lives - * in the same directory we live in. If it does, kill it. If we're - * unable to kill it, treat this as a fatal error and return 1. - * - * The rationale behind this is that we're called at the start of the - * build process on the basis that we'll take care of killing any - * running instances, such that the build won't encounter permission - * denied errors during linking. If we can't kill one of the processes, - * we can't provide this assurance, and the build shouldn't start. - */ - - hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hsp == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); - return 1; - } - - if (!Process32FirstW(hsp, &pe)) { - printf("Process32FirstW failed: %d\n", GetLastError()); - CloseHandle(hsp); - return 1; - } - - dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; - do { - - /* - * XXX TODO: if we really wanted to be fancy, we could check the - * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python30[_d].dll), - * as that would also inhibit our ability to rebuild the solution. - * Not worth loosing sleep over though; for now, a simple check - * for just the python executable should be sufficient. - */ - - if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) - /* This isn't a python process. */ - continue; - - /* It's a python process, so figure out which directory it's in... */ - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); - if (hsm == INVALID_HANDLE_VALUE) - /* - * If our module snapshot fails (which will happen if we don't own - * the process), just ignore it and continue. (It seems different - * versions of Windows return different values for GetLastError() - * in this situation; it's easier to just ignore it and move on vs. - * stopping the build for what could be a false positive.) - */ - continue; - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[2] failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - do { - if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) - /* Wrong module, we're looking for python[_d].exe... */ - continue; - - if (_wcsnicmp(path, me.szExePath, len)) - /* Process doesn't live in our directory. */ - break; - - /* Python process residing in the right directory, kill it! */ - hp = OpenProcess(dac, FALSE, pe.th32ProcessID); - if (!hp) { - printf("OpenProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - if (!TerminateProcess(hp, 1)) { - printf("TerminateProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - CloseHandle(hp); - return 1; - } - - CloseHandle(hp); - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - } while (Process32NextW(hsp, &pe)); - - CloseHandle(hsp); - - return 0; -} - -/* vi: set ts=8 sw=4 sts=4 expandtab */ +/* + * Helper program for killing lingering python[_d].exe processes before + * building, thus attempting to avoid build failures due to files being + * locked. + */ + +#include +#include +#include +#include + +#pragma comment(lib, "psapi") + +#ifdef _DEBUG +#define PYTHON_EXE (L"python_d.exe") +#define PYTHON_EXE_LEN (12) +#define KILL_PYTHON_EXE (L"kill_python_d.exe") +#define KILL_PYTHON_EXE_LEN (17) +#else +#define PYTHON_EXE (L"python.exe") +#define PYTHON_EXE_LEN (10) +#define KILL_PYTHON_EXE (L"kill_python.exe") +#define KILL_PYTHON_EXE_LEN (15) +#endif + +int +main(int argc, char **argv) +{ + HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ + DWORD dac, our_pid; + size_t len; + wchar_t path[MAX_PATH+1]; + + MODULEENTRY32W me; + PROCESSENTRY32W pe; + + me.dwSize = sizeof(MODULEENTRY32W); + pe.dwSize = sizeof(PROCESSENTRY32W); + + memset(path, 0, MAX_PATH+1); + + our_pid = GetCurrentProcessId(); + + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); + if (hsm == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); + return 1; + } + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[1] failed: %d\n", GetLastError()); + CloseHandle(hsm); + return 1; + } + + /* + * Enumerate over the modules for the current process in order to find + * kill_process[_d].exe, then take a note of the directory it lives in. + */ + do { + if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) + continue; + + len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; + wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); + + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + if (path == NULL) { + printf("failed to discern directory of running process\n"); + return 1; + } + + /* + * Take a snapshot of system processes. Enumerate over the snapshot, + * looking for python processes. When we find one, verify it lives + * in the same directory we live in. If it does, kill it. If we're + * unable to kill it, treat this as a fatal error and return 1. + * + * The rationale behind this is that we're called at the start of the + * build process on the basis that we'll take care of killing any + * running instances, such that the build won't encounter permission + * denied errors during linking. If we can't kill one of the processes, + * we can't provide this assurance, and the build shouldn't start. + */ + + hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hsp == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); + return 1; + } + + if (!Process32FirstW(hsp, &pe)) { + printf("Process32FirstW failed: %d\n", GetLastError()); + CloseHandle(hsp); + return 1; + } + + dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; + do { + + /* + * XXX TODO: if we really wanted to be fancy, we could check the + * modules for all processes (not just the python[_d].exe ones) + * and see if any of our DLLs are loaded (i.e. python30[_d].dll), + * as that would also inhibit our ability to rebuild the solution. + * Not worth loosing sleep over though; for now, a simple check + * for just the python executable should be sufficient. + */ + + if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) + /* This isn't a python process. */ + continue; + + /* It's a python process, so figure out which directory it's in... */ + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); + if (hsm == INVALID_HANDLE_VALUE) + /* + * If our module snapshot fails (which will happen if we don't own + * the process), just ignore it and continue. (It seems different + * versions of Windows return different values for GetLastError() + * in this situation; it's easier to just ignore it and move on vs. + * stopping the build for what could be a false positive.) + */ + continue; + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[2] failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + do { + if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) + /* Wrong module, we're looking for python[_d].exe... */ + continue; + + if (_wcsnicmp(path, me.szExePath, len)) + /* Process doesn't live in our directory. */ + break; + + /* Python process residing in the right directory, kill it! */ + hp = OpenProcess(dac, FALSE, pe.th32ProcessID); + if (!hp) { + printf("OpenProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + if (!TerminateProcess(hp, 1)) { + printf("TerminateProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + CloseHandle(hp); + return 1; + } + + CloseHandle(hp); + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + } while (Process32NextW(hsp, &pe)); + + CloseHandle(hsp); + + return 0; +} + +/* vi: set ts=8 sw=4 sts=4 expandtab */ Modified: python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/kill_python.vcproj Sun Jun 15 03:02:00 2008 @@ -1,279 +1,279 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/make_buildinfo.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/make_buildinfo.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/make_buildinfo.vcproj Sun Jun 15 03:02:00 2008 @@ -1,162 +1,162 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/make_versioninfo.vcproj Sun Jun 15 03:02:00 2008 @@ -1,324 +1,324 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/pcbuild.sln Sun Jun 15 03:02:00 2008 @@ -1,581 +1,581 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} = {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" - ProjectSection(ProjectDependencies) = postProject - {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}" - ProjectSection(SolutionItems) = preProject - ..\..\Modules\getbuildinfo.c = ..\..\Modules\getbuildinfo.c - readme.txt = readme.txt - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{9EC7190A-249F-4180-A900-548FDCF3055F}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{17E1E049-C309-4D79-843F-AE483C264AEA}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{31FFC478-7B4A-43E8-9954-8D03E2187E9C}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{13CECB97-4119-4316-9D42-8534019A5A44}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - {A1A295E5-463C-437F-81CA-1F32367685DA} = {A1A295E5-463C-437F-81CA-1F32367685DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}" - ProjectSection(ProjectDependencies) = postProject - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} - {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2.vcproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{ECC7CEAC-A5E5-458E-BB9E-2413CC847881}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "bdist_wininst.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" - ProjectSection(ProjectDependencies) = postProject - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" - ProjectSection(ProjectDependencies) = postProject - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - PGInstrument|Win32 = PGInstrument|Win32 - PGInstrument|x64 = PGInstrument|x64 - PGUpdate|Win32 = PGUpdate|Win32 - PGUpdate|x64 = PGUpdate|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 - {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 - {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 - {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 - {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 - {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|Win32 - {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.ActiveCfg = Debug|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.Build.0 = Debug|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.ActiveCfg = Debug|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.Build.0 = Debug|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.ActiveCfg = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.Build.0 = Release|Win32 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64 - {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.ActiveCfg = Debug|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.Build.0 = Debug|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.ActiveCfg = Debug|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.Build.0 = Debug|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.ActiveCfg = Release|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.Build.0 = Release|Win32 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.ActiveCfg = Release|x64 - {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.Build.0 = Release|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.ActiveCfg = Debug|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.Build.0 = Debug|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.ActiveCfg = Debug|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.Build.0 = Debug|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.ActiveCfg = Release|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.Build.0 = Release|Win32 - {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.ActiveCfg = Release|x64 - {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.Build.0 = Release|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.ActiveCfg = Debug|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.Build.0 = Debug|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.ActiveCfg = Debug|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.Build.0 = Debug|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.ActiveCfg = Release|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.Build.0 = Release|Win32 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.ActiveCfg = Release|x64 - {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.Build.0 = Release|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.ActiveCfg = Debug|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.Build.0 = Debug|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.ActiveCfg = Debug|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.Build.0 = Debug|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.ActiveCfg = Release|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.Build.0 = Release|Win32 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.ActiveCfg = Release|x64 - {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.Build.0 = Release|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.ActiveCfg = Debug|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.Build.0 = Debug|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.ActiveCfg = Debug|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.Build.0 = Debug|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.ActiveCfg = Release|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.Build.0 = Release|Win32 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.ActiveCfg = Release|x64 - {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.Build.0 = Release|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.ActiveCfg = Debug|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.Build.0 = Debug|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.ActiveCfg = Debug|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.Build.0 = Debug|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.ActiveCfg = Release|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.Build.0 = Release|Win32 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.ActiveCfg = Release|x64 - {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.Build.0 = Release|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.ActiveCfg = Debug|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.Build.0 = Debug|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.ActiveCfg = Debug|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.Build.0 = Debug|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.ActiveCfg = Release|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.Build.0 = Release|Win32 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64 - {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.Build.0 = Debug|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.ActiveCfg = Release|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.Build.0 = Release|Win32 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.ActiveCfg = Release|x64 - {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.Build.0 = Release|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.ActiveCfg = Debug|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.Build.0 = Debug|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.ActiveCfg = Debug|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.Build.0 = Debug|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.ActiveCfg = Release|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.Build.0 = Release|Win32 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.ActiveCfg = Release|x64 - {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.Build.0 = Release|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.ActiveCfg = Debug|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.Build.0 = Debug|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.ActiveCfg = Debug|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.Build.0 = Debug|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.ActiveCfg = Release|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.Build.0 = Release|Win32 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.ActiveCfg = Release|x64 - {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.Build.0 = Release|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.ActiveCfg = Debug|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.Build.0 = Debug|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.ActiveCfg = Debug|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.Build.0 = Debug|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.ActiveCfg = Release|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.Build.0 = Release|Win32 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.ActiveCfg = Release|x64 - {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.Build.0 = Release|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.ActiveCfg = Debug|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.Build.0 = Debug|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.ActiveCfg = Debug|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.Build.0 = Debug|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.ActiveCfg = Release|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.Build.0 = Release|Win32 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.ActiveCfg = Release|x64 - {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.Build.0 = Release|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.ActiveCfg = Debug|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.Build.0 = Debug|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.ActiveCfg = Debug|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.Build.0 = Debug|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.ActiveCfg = Release|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.Build.0 = Release|Win32 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.ActiveCfg = Release|x64 - {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.Build.0 = Release|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.ActiveCfg = Debug|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.Build.0 = Debug|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.ActiveCfg = Debug|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.Build.0 = Debug|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.ActiveCfg = Release|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.Build.0 = Release|Win32 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.ActiveCfg = Release|x64 - {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.Build.0 = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|x64.ActiveCfg = Release|x64 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 - {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.Build.0 = Debug|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.ActiveCfg = Release|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 - {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.Build.0 = Debug|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.ActiveCfg = Release|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64 - {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.ActiveCfg = Debug|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.Build.0 = Debug|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.ActiveCfg = Debug|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.Build.0 = Debug|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.ActiveCfg = Release|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64 - {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.Build.0 = Debug|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.Build.0 = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.ActiveCfg = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} = {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{F0E0541E-F17D-430B-97C4-93ADF0DD284E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}" + ProjectSection(ProjectDependencies) = postProject + {F0E0541E-F17D-430B-97C4-93ADF0DD284E} = {F0E0541E-F17D-430B-97C4-93ADF0DD284E} + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + {C73F0EC1-358B-4177-940F-0846AC8B04CD} = {C73F0EC1-358B-4177-940F-0846AC8B04CD} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythonw", "pythonw.vcproj", "{F4229CC3-873C-49AE-9729-DD308ED4CD4A}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "w9xpopen", "w9xpopen.vcproj", "{E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_buildinfo", "make_buildinfo.vcproj", "{C73F0EC1-358B-4177-940F-0846AC8B04CD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{553EC33E-9816-4996-A660-5D6186A0B0B3}" + ProjectSection(SolutionItems) = preProject + ..\..\Modules\getbuildinfo.c = ..\..\Modules\getbuildinfo.c + readme.txt = readme.txt + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes", "_ctypes.vcproj", "{0E9791DB-593A-465F-98BC-681011311618}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ctypes_test", "_ctypes_test.vcproj", "{9EC7190A-249F-4180-A900-548FDCF3055F}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_elementtree", "_elementtree.vcproj", "{17E1E049-C309-4D79-843F-AE483C264AEA}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_msi", "_msi.vcproj", "{31FFC478-7B4A-43E8-9954-8D03E2187E9C}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_sqlite3", "_sqlite3.vcproj", "{13CECB97-4119-4316-9D42-8534019A5A44}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + {A1A295E5-463C-437F-81CA-1F32367685DA} = {A1A295E5-463C-437F-81CA-1F32367685DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}" + ProjectSection(ProjectDependencies) = postProject + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} + {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bz2", "bz2.vcproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unicodedata", "unicodedata.vcproj", "{ECC7CEAC-A5E5-458E-BB9E-2413CC847881}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcproj", "{D06B6426-4762-44CC-8BAD-D79052507F2F}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bdist_wininst", "bdist_wininst.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" + ProjectSection(ProjectDependencies) = postProject + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9} + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" + ProjectSection(ProjectDependencies) = postProject + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" + ProjectSection(ProjectDependencies) = postProject + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + PGInstrument|Win32 = PGInstrument|Win32 + PGInstrument|x64 = PGInstrument|x64 + PGUpdate|Win32 = PGUpdate|Win32 + PGUpdate|x64 = PGUpdate|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.ActiveCfg = Debug|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|Win32.Build.0 = Debug|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.ActiveCfg = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Debug|x64.Build.0 = Debug|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.ActiveCfg = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|Win32.Build.0 = Release|Win32 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.ActiveCfg = Release|x64 + {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}.Release|x64.Build.0 = Release|x64 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.ActiveCfg = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|Win32.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.ActiveCfg = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Debug|x64.Build.0 = Debug|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGInstrument|x64.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.PGUpdate|x64.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|Win32.Build.0 = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.ActiveCfg = Release|Win32 + {F0E0541E-F17D-430B-97C4-93ADF0DD284E}.Release|x64.Build.0 = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.ActiveCfg = Debug|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|Win32.Build.0 = Debug|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.ActiveCfg = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Debug|x64.Build.0 = Debug|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.ActiveCfg = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|Win32.Build.0 = Release|Win32 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.ActiveCfg = Release|x64 + {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}.Release|x64.Build.0 = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.ActiveCfg = Debug|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|Win32.Build.0 = Debug|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.ActiveCfg = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Debug|x64.Build.0 = Debug|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.ActiveCfg = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|Win32.Build.0 = Release|Win32 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.ActiveCfg = Release|x64 + {F4229CC3-873C-49AE-9729-DD308ED4CD4A}.Release|x64.Build.0 = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.ActiveCfg = Debug|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|Win32.Build.0 = Debug|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.ActiveCfg = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Debug|x64.Build.0 = Debug|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.ActiveCfg = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|Win32.Build.0 = Release|Win32 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.ActiveCfg = Release|x64 + {E9E0A1F6-0009-4E8C-B8F8-1B8F5D49A058}.Release|x64.Build.0 = Release|x64 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Debug|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGInstrument|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.PGUpdate|x64.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|Win32.Build.0 = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.ActiveCfg = Release|Win32 + {C73F0EC1-358B-4177-940F-0846AC8B04CD}.Release|x64.Build.0 = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.ActiveCfg = Debug|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|Win32.Build.0 = Debug|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.ActiveCfg = Debug|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Debug|x64.Build.0 = Debug|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.ActiveCfg = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|Win32.Build.0 = Release|Win32 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.ActiveCfg = Release|x64 + {28B5D777-DDF2-4B6B-B34F-31D938813856}.Release|x64.Build.0 = Release|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|Win32.Build.0 = Debug|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.ActiveCfg = Debug|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Debug|x64.Build.0 = Debug|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.ActiveCfg = Release|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|Win32.Build.0 = Release|Win32 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.ActiveCfg = Release|x64 + {B4D38F3F-68FB-42EC-A45D-E00657BB3627}.Release|x64.Build.0 = Release|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.ActiveCfg = Debug|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|Win32.Build.0 = Debug|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.ActiveCfg = Debug|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Debug|x64.Build.0 = Debug|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {0E9791DB-593A-465F-98BC-681011311618}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.ActiveCfg = Release|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Release|Win32.Build.0 = Release|Win32 + {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.ActiveCfg = Release|x64 + {0E9791DB-593A-465F-98BC-681011311618}.Release|x64.Build.0 = Release|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.ActiveCfg = Debug|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|Win32.Build.0 = Debug|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.ActiveCfg = Debug|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Debug|x64.Build.0 = Debug|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.ActiveCfg = Release|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|Win32.Build.0 = Release|Win32 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.ActiveCfg = Release|x64 + {9EC7190A-249F-4180-A900-548FDCF3055F}.Release|x64.Build.0 = Release|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.ActiveCfg = Debug|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|Win32.Build.0 = Debug|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.ActiveCfg = Debug|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Debug|x64.Build.0 = Debug|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.ActiveCfg = Release|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|Win32.Build.0 = Release|Win32 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.ActiveCfg = Release|x64 + {17E1E049-C309-4D79-843F-AE483C264AEA}.Release|x64.Build.0 = Release|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.ActiveCfg = Debug|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|Win32.Build.0 = Debug|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.ActiveCfg = Debug|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Debug|x64.Build.0 = Debug|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.ActiveCfg = Release|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|Win32.Build.0 = Release|Win32 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.ActiveCfg = Release|x64 + {31FFC478-7B4A-43E8-9954-8D03E2187E9C}.Release|x64.Build.0 = Release|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.ActiveCfg = Debug|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|Win32.Build.0 = Debug|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.ActiveCfg = Debug|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Debug|x64.Build.0 = Debug|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.ActiveCfg = Release|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|Win32.Build.0 = Release|Win32 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.ActiveCfg = Release|x64 + {86937F53-C189-40EF-8CE8-8759D8E7D480}.Release|x64.Build.0 = Release|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.ActiveCfg = Debug|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|Win32.Build.0 = Debug|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.ActiveCfg = Debug|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Debug|x64.Build.0 = Debug|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.ActiveCfg = Release|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|Win32.Build.0 = Release|Win32 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.ActiveCfg = Release|x64 + {13CECB97-4119-4316-9D42-8534019A5A44}.Release|x64.Build.0 = Release|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.ActiveCfg = Debug|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|Win32.Build.0 = Debug|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.ActiveCfg = Debug|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Debug|x64.Build.0 = Debug|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.ActiveCfg = Release|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|Win32.Build.0 = Release|Win32 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.ActiveCfg = Release|x64 + {C6E20F84-3247-4AD6-B051-B073268F73BA}.Release|x64.Build.0 = Release|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.ActiveCfg = Debug|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|Win32.Build.0 = Debug|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.ActiveCfg = Debug|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Debug|x64.Build.0 = Debug|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.ActiveCfg = Release|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|Win32.Build.0 = Release|Win32 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.ActiveCfg = Release|x64 + {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}.Release|x64.Build.0 = Release|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.ActiveCfg = Debug|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|Win32.Build.0 = Debug|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.ActiveCfg = Debug|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Debug|x64.Build.0 = Debug|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.ActiveCfg = Release|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|Win32.Build.0 = Release|Win32 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.ActiveCfg = Release|x64 + {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}.Release|x64.Build.0 = Release|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.ActiveCfg = Debug|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|Win32.Build.0 = Debug|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.ActiveCfg = Debug|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Debug|x64.Build.0 = Debug|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.ActiveCfg = Release|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|Win32.Build.0 = Release|Win32 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.ActiveCfg = Release|x64 + {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}.Release|x64.Build.0 = Release|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.ActiveCfg = Debug|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|Win32.Build.0 = Debug|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.ActiveCfg = Debug|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Debug|x64.Build.0 = Debug|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.ActiveCfg = Release|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|Win32.Build.0 = Release|Win32 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.ActiveCfg = Release|x64 + {18CAE28C-B454-46C1-87A0-493D91D97F03}.Release|x64.Build.0 = Release|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.ActiveCfg = Debug|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|Win32.Build.0 = Debug|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.ActiveCfg = Debug|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Debug|x64.Build.0 = Debug|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.ActiveCfg = Release|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|Win32.Build.0 = Release|Win32 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.ActiveCfg = Release|x64 + {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}.Release|x64.Build.0 = Release|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.ActiveCfg = Debug|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|Win32.Build.0 = Debug|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.ActiveCfg = Debug|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Debug|x64.Build.0 = Debug|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.ActiveCfg = Release|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|Win32.Build.0 = Release|Win32 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.ActiveCfg = Release|x64 + {D06B6426-4762-44CC-8BAD-D79052507F2F}.Release|x64.Build.0 = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGInstrument|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.PGUpdate|x64.ActiveCfg = Release|x64 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 + {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|x64.ActiveCfg = Release|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.ActiveCfg = Debug|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|Win32.Build.0 = Debug|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.ActiveCfg = Debug|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Debug|x64.Build.0 = Debug|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.ActiveCfg = Release|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 + {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 + {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.Build.0 = Debug|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.ActiveCfg = Release|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|Win32.Build.0 = Release|Win32 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.ActiveCfg = Release|x64 + {A1A295E5-463C-437F-81CA-1F32367685DA}.Release|x64.Build.0 = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.ActiveCfg = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|Win32.Build.0 = Debug|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.ActiveCfg = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Debug|x64.Build.0 = Debug|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.ActiveCfg = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64 + {9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.Build.0 = Debug|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGInstrument|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.PGUpdate|x64.Build.0 = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.ActiveCfg = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|Win32.Build.0 = Release|Win32 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.ActiveCfg = Release|x64 + {6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pyexpat.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/pyexpat.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/pyexpat.vcproj Sun Jun 15 03:02:00 2008 @@ -1,553 +1,553 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/python.vcproj Sun Jun 15 03:02:00 2008 @@ -1,637 +1,637 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/pythoncore.vcproj Sun Jun 15 03:02:00 2008 @@ -1,1817 +1,1817 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/pythonw.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/pythonw.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/pythonw.vcproj Sun Jun 15 03:02:00 2008 @@ -1,618 +1,618 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/select.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/select.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/select.vcproj Sun Jun 15 03:02:00 2008 @@ -1,537 +1,537 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/sqlite3.vcproj Sun Jun 15 03:02:00 2008 @@ -1,743 +1,743 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/unicodedata.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/unicodedata.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/unicodedata.vcproj Sun Jun 15 03:02:00 2008 @@ -1,533 +1,533 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/w9xpopen.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/w9xpopen.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/w9xpopen.vcproj Sun Jun 15 03:02:00 2008 @@ -1,576 +1,576 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PC/VS8.0/winsound.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PC/VS8.0/winsound.vcproj (original) +++ python/branches/tlee-ast-optimize/PC/VS8.0/winsound.vcproj Sun Jun 15 03:02:00 2008 @@ -1,523 +1,523 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj Sun Jun 15 03:02:00 2008 @@ -1,1252 +1,1252 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PCbuild/bdist_wininst.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/bdist_wininst.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/bdist_wininst.vcproj Sun Jun 15 03:02:00 2008 @@ -1,270 +1,270 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PCbuild/kill_python.c ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/kill_python.c (original) +++ python/branches/tlee-ast-optimize/PCbuild/kill_python.c Sun Jun 15 03:02:00 2008 @@ -1,178 +1,178 @@ -/* - * Helper program for killing lingering python[_d].exe processes before - * building, thus attempting to avoid build failures due to files being - * locked. - */ - -#include -#include -#include -#include - -#pragma comment(lib, "psapi") - -#ifdef _DEBUG -#define PYTHON_EXE (L"python_d.exe") -#define PYTHON_EXE_LEN (12) -#define KILL_PYTHON_EXE (L"kill_python_d.exe") -#define KILL_PYTHON_EXE_LEN (17) -#else -#define PYTHON_EXE (L"python.exe") -#define PYTHON_EXE_LEN (10) -#define KILL_PYTHON_EXE (L"kill_python.exe") -#define KILL_PYTHON_EXE_LEN (15) -#endif - -int -main(int argc, char **argv) -{ - HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ - DWORD dac, our_pid; - size_t len; - wchar_t path[MAX_PATH+1]; - - MODULEENTRY32W me; - PROCESSENTRY32W pe; - - me.dwSize = sizeof(MODULEENTRY32W); - pe.dwSize = sizeof(PROCESSENTRY32W); - - memset(path, 0, MAX_PATH+1); - - our_pid = GetCurrentProcessId(); - - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); - if (hsm == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); - return 1; - } - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[1] failed: %d\n", GetLastError()); - CloseHandle(hsm); - return 1; - } - - /* - * Enumerate over the modules for the current process in order to find - * kill_process[_d].exe, then take a note of the directory it lives in. - */ - do { - if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) - continue; - - len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; - wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); - - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - if (path == NULL) { - printf("failed to discern directory of running process\n"); - return 1; - } - - /* - * Take a snapshot of system processes. Enumerate over the snapshot, - * looking for python processes. When we find one, verify it lives - * in the same directory we live in. If it does, kill it. If we're - * unable to kill it, treat this as a fatal error and return 1. - * - * The rationale behind this is that we're called at the start of the - * build process on the basis that we'll take care of killing any - * running instances, such that the build won't encounter permission - * denied errors during linking. If we can't kill one of the processes, - * we can't provide this assurance, and the build shouldn't start. - */ - - hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (hsp == INVALID_HANDLE_VALUE) { - printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); - return 1; - } - - if (!Process32FirstW(hsp, &pe)) { - printf("Process32FirstW failed: %d\n", GetLastError()); - CloseHandle(hsp); - return 1; - } - - dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; - do { - - /* - * XXX TODO: if we really wanted to be fancy, we could check the - * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python30[_d].dll), - * as that would also inhibit our ability to rebuild the solution. - * Not worth loosing sleep over though; for now, a simple check - * for just the python executable should be sufficient. - */ - - if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) - /* This isn't a python process. */ - continue; - - /* It's a python process, so figure out which directory it's in... */ - hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); - if (hsm == INVALID_HANDLE_VALUE) - /* - * If our module snapshot fails (which will happen if we don't own - * the process), just ignore it and continue. (It seems different - * versions of Windows return different values for GetLastError() - * in this situation; it's easier to just ignore it and move on vs. - * stopping the build for what could be a false positive.) - */ - continue; - - if (!Module32FirstW(hsm, &me)) { - printf("Module32FirstW[2] failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - do { - if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) - /* Wrong module, we're looking for python[_d].exe... */ - continue; - - if (_wcsnicmp(path, me.szExePath, len)) - /* Process doesn't live in our directory. */ - break; - - /* Python process residing in the right directory, kill it! */ - hp = OpenProcess(dac, FALSE, pe.th32ProcessID); - if (!hp) { - printf("OpenProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - return 1; - } - - if (!TerminateProcess(hp, 1)) { - printf("TerminateProcess failed: %d\n", GetLastError()); - CloseHandle(hsp); - CloseHandle(hsm); - CloseHandle(hp); - return 1; - } - - CloseHandle(hp); - break; - - } while (Module32NextW(hsm, &me)); - - CloseHandle(hsm); - - } while (Process32NextW(hsp, &pe)); - - CloseHandle(hsp); - - return 0; -} - -/* vi: set ts=8 sw=4 sts=4 expandtab */ +/* + * Helper program for killing lingering python[_d].exe processes before + * building, thus attempting to avoid build failures due to files being + * locked. + */ + +#include +#include +#include +#include + +#pragma comment(lib, "psapi") + +#ifdef _DEBUG +#define PYTHON_EXE (L"python_d.exe") +#define PYTHON_EXE_LEN (12) +#define KILL_PYTHON_EXE (L"kill_python_d.exe") +#define KILL_PYTHON_EXE_LEN (17) +#else +#define PYTHON_EXE (L"python.exe") +#define PYTHON_EXE_LEN (10) +#define KILL_PYTHON_EXE (L"kill_python.exe") +#define KILL_PYTHON_EXE_LEN (15) +#endif + +int +main(int argc, char **argv) +{ + HANDLE hp, hsp, hsm; /* process, snapshot processes, snapshot modules */ + DWORD dac, our_pid; + size_t len; + wchar_t path[MAX_PATH+1]; + + MODULEENTRY32W me; + PROCESSENTRY32W pe; + + me.dwSize = sizeof(MODULEENTRY32W); + pe.dwSize = sizeof(PROCESSENTRY32W); + + memset(path, 0, MAX_PATH+1); + + our_pid = GetCurrentProcessId(); + + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, our_pid); + if (hsm == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[1] failed: %d\n", GetLastError()); + return 1; + } + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[1] failed: %d\n", GetLastError()); + CloseHandle(hsm); + return 1; + } + + /* + * Enumerate over the modules for the current process in order to find + * kill_process[_d].exe, then take a note of the directory it lives in. + */ + do { + if (_wcsnicmp(me.szModule, KILL_PYTHON_EXE, KILL_PYTHON_EXE_LEN)) + continue; + + len = wcsnlen_s(me.szExePath, MAX_PATH) - KILL_PYTHON_EXE_LEN; + wcsncpy_s(path, MAX_PATH+1, me.szExePath, len); + + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + if (path == NULL) { + printf("failed to discern directory of running process\n"); + return 1; + } + + /* + * Take a snapshot of system processes. Enumerate over the snapshot, + * looking for python processes. When we find one, verify it lives + * in the same directory we live in. If it does, kill it. If we're + * unable to kill it, treat this as a fatal error and return 1. + * + * The rationale behind this is that we're called at the start of the + * build process on the basis that we'll take care of killing any + * running instances, such that the build won't encounter permission + * denied errors during linking. If we can't kill one of the processes, + * we can't provide this assurance, and the build shouldn't start. + */ + + hsp = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hsp == INVALID_HANDLE_VALUE) { + printf("CreateToolhelp32Snapshot[2] failed: %d\n", GetLastError()); + return 1; + } + + if (!Process32FirstW(hsp, &pe)) { + printf("Process32FirstW failed: %d\n", GetLastError()); + CloseHandle(hsp); + return 1; + } + + dac = PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE; + do { + + /* + * XXX TODO: if we really wanted to be fancy, we could check the + * modules for all processes (not just the python[_d].exe ones) + * and see if any of our DLLs are loaded (i.e. python30[_d].dll), + * as that would also inhibit our ability to rebuild the solution. + * Not worth loosing sleep over though; for now, a simple check + * for just the python executable should be sufficient. + */ + + if (_wcsnicmp(pe.szExeFile, PYTHON_EXE, PYTHON_EXE_LEN)) + /* This isn't a python process. */ + continue; + + /* It's a python process, so figure out which directory it's in... */ + hsm = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pe.th32ProcessID); + if (hsm == INVALID_HANDLE_VALUE) + /* + * If our module snapshot fails (which will happen if we don't own + * the process), just ignore it and continue. (It seems different + * versions of Windows return different values for GetLastError() + * in this situation; it's easier to just ignore it and move on vs. + * stopping the build for what could be a false positive.) + */ + continue; + + if (!Module32FirstW(hsm, &me)) { + printf("Module32FirstW[2] failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + do { + if (_wcsnicmp(me.szModule, PYTHON_EXE, PYTHON_EXE_LEN)) + /* Wrong module, we're looking for python[_d].exe... */ + continue; + + if (_wcsnicmp(path, me.szExePath, len)) + /* Process doesn't live in our directory. */ + break; + + /* Python process residing in the right directory, kill it! */ + hp = OpenProcess(dac, FALSE, pe.th32ProcessID); + if (!hp) { + printf("OpenProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + return 1; + } + + if (!TerminateProcess(hp, 1)) { + printf("TerminateProcess failed: %d\n", GetLastError()); + CloseHandle(hsp); + CloseHandle(hsm); + CloseHandle(hp); + return 1; + } + + CloseHandle(hp); + break; + + } while (Module32NextW(hsm, &me)); + + CloseHandle(hsm); + + } while (Process32NextW(hsp, &pe)); + + CloseHandle(hsp); + + return 0; +} + +/* vi: set ts=8 sw=4 sts=4 expandtab */ Modified: python/branches/tlee-ast-optimize/PCbuild/kill_python.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/kill_python.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/kill_python.vcproj Sun Jun 15 03:02:00 2008 @@ -1,279 +1,279 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops (original) +++ python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops Sun Jun 15 03:02:00 2008 @@ -74,11 +74,11 @@ /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: python/branches/tlee-ast-optimize/Tools/buildbot/build-amd64.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/build-amd64.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/build-amd64.bat Sun Jun 15 03:02:00 2008 @@ -1,6 +1,6 @@ - at rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external-amd64.bat -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -cmd /c Tools\buildbot\clean-amd64.bat -vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe -vcbuild PCbuild\pcbuild.sln "Debug|x64" + at rem Used by the buildbot "compile" step. +cmd /c Tools\buildbot\external-amd64.bat +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 +cmd /c Tools\buildbot\clean-amd64.bat +vcbuild /useenv PCbuild\kill_python.vcproj "Debug|x64" && PCbuild\amd64\kill_python_d.exe +vcbuild PCbuild\pcbuild.sln "Debug|x64" Modified: python/branches/tlee-ast-optimize/Tools/buildbot/build.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/build.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/build.bat Sun Jun 15 03:02:00 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "compile" step. -cmd /c Tools\buildbot\external.bat -call "%VS90COMNTOOLS%vsvars32.bat" -cmd /c Tools\buildbot\clean.bat -vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe -vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32" - + at rem Used by the buildbot "compile" step. +cmd /c Tools\buildbot\external.bat +call "%VS90COMNTOOLS%vsvars32.bat" +cmd /c Tools\buildbot\clean.bat +vcbuild /useenv PCbuild\kill_python.vcproj "Debug|Win32" && PCbuild\kill_python_d.exe +vcbuild /useenv PCbuild\pcbuild.sln "Debug|Win32" + Modified: python/branches/tlee-ast-optimize/Tools/buildbot/buildmsi.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/buildmsi.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/buildmsi.bat Sun Jun 15 03:02:00 2008 @@ -1,20 +1,20 @@ - at rem Used by the buildbot "buildmsi" step. - -cmd /c Tools\buildbot\external.bat - at rem build release versions of things -call "%VS90COMNTOOLS%vsvars32.bat" - - at rem build Python -vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32" - - at rem build the documentation -bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp' -"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp - - at rem buold the MSI file -cd PC -nmake /f icons.mak -cd ..\Tools\msi -del *.msi -nmake /f msisupport.mak -%HOST_PYTHON% msi.py + at rem Used by the buildbot "buildmsi" step. + +cmd /c Tools\buildbot\external.bat + at rem build release versions of things +call "%VS90COMNTOOLS%vsvars32.bat" + + at rem build Python +vcbuild /useenv PCbuild\pcbuild.sln "Release|Win32" + + at rem build the documentation +bash.exe -c 'cd Doc;make PYTHON=python2.5 update htmlhelp' +"%ProgramFiles%\HTML Help Workshop\hhc.exe" Doc\build\htmlhelp\python26a3.hhp + + at rem buold the MSI file +cd PC +nmake /f icons.mak +cd ..\Tools\msi +del *.msi +nmake /f msisupport.mak +%HOST_PYTHON% msi.py Modified: python/branches/tlee-ast-optimize/Tools/buildbot/clean-amd64.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/clean-amd64.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/clean-amd64.bat Sun Jun 15 03:02:00 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "clean" step. -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 -cd PCbuild - at echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -vcbuild /clean pcbuild.sln "Release|x64" -vcbuild /clean pcbuild.sln "Debug|x64" + at rem Used by the buildbot "clean" step. +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 +cd PCbuild + at echo Deleting .pyc/.pyo files ... +del /s Lib\*.pyc Lib\*.pyo +vcbuild /clean pcbuild.sln "Release|x64" +vcbuild /clean pcbuild.sln "Debug|x64" Modified: python/branches/tlee-ast-optimize/Tools/buildbot/clean.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/clean.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/clean.bat Sun Jun 15 03:02:00 2008 @@ -1,7 +1,7 @@ - at rem Used by the buildbot "clean" step. -call "%VS90COMNTOOLS%vsvars32.bat" - at echo Deleting .pyc/.pyo files ... -del /s Lib\*.pyc Lib\*.pyo -cd PCbuild -vcbuild /clean pcbuild.sln "Release|Win32" -vcbuild /clean pcbuild.sln "Debug|Win32" + at rem Used by the buildbot "clean" step. +call "%VS90COMNTOOLS%vsvars32.bat" + at echo Deleting .pyc/.pyo files ... +del /s Lib\*.pyc Lib\*.pyo +cd PCbuild +vcbuild /clean pcbuild.sln "Release|Win32" +vcbuild /clean pcbuild.sln "Debug|Win32" Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external-amd64.bat Sun Jun 15 03:02:00 2008 @@ -1,17 +1,20 @@ - at rem Fetches (and builds if necessary) external dependencies - - at rem Assume we start inside the Python source directory -call "Tools\buildbot\external-common.bat" -call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 - -if not exist tcltk64\bin\tcl85g.dll ( - cd tcl-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all install - cd ..\.. -) - -if not exist tcltk64\bin\tk85g.dll ( - cd tk-8.5.2.1\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean all install - cd ..\.. -) + at rem Fetches (and builds if necessary) external dependencies + + at rem Assume we start inside the Python source directory +call "Tools\buildbot\external-common.bat" +call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64 + +if not exist tcltk64\bin\tcl85g.dll ( + cd tcl-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 clean all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 install + cd ..\.. +) + +if not exist tcltk64\bin\tk85g.dll ( + cd tk-8.5.2.1\win + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 MACHINE=AMD64 INSTALLDIR=..\..\tcltk64 TCLDIR=..\..\tcl-8.5.2.1 install + cd ..\.. +) Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat Sun Jun 15 03:02:00 2008 @@ -4,7 +4,7 @@ cd .. @rem XXX: If you need to force the buildbots to start from a fresh environment, uncomment @rem the following, check it in, then check it out, comment it out, then check it back in. - at rem if exist bzip2-1.0.3 rd /s/q bzip2-1.0.3 + at rem if exist bzip2-1.0.5 rd /s/q bzip2-1.0.5 @rem if exist tcltk rd /s/q tcltk @rem if exist tcltk64 rd /s/q tcltk64 @rem if exist tcl8.4.12 rd /s/q tcl8.4.12 @@ -15,10 +15,13 @@ @rem if exist tk-8.4.18.1 rd /s/q tk-8.4.18.1 @rem if exist db-4.4.20 rd /s/q db-4.4.20 @rem if exist openssl-0.9.8g rd /s/q openssl-0.9.8g - at rem if exist sqlite-source-3.3.4 rd /s/q sqlite-source-3.3.4 + at rem if exist sqlite-3.5.9 rd /s/q sqlite-3.5.9 @rem bzip -if not exist bzip2-1.0.3 svn export http://svn.python.org/projects/external/bzip2-1.0.3 +if not exist bzip2-1.0.5 ( + rd /s/q bzip2-1.0.3 + svn export http://svn.python.org/projects/external/bzip2-1.0.5 +) @rem Sleepycat db if not exist db-4.4.20 svn export http://svn.python.org/projects/external/db-4.4.20-vs9 db-4.4.20 @@ -34,4 +37,7 @@ if not exist tk-8.5.2.0 svn export http://svn.python.org/projects/external/tk-8.5.2.0 @rem sqlite3 -if not exist sqlite-source-3.3.4 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 +if not exist sqlite-3.5.9 ( + rd /s/q sqlite-source-3.3.4 + svn export http://svn.python.org/projects/external/sqlite-3.5.9 +) Modified: python/branches/tlee-ast-optimize/Tools/buildbot/external.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/external.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/external.bat Sun Jun 15 03:02:00 2008 @@ -4,7 +4,7 @@ call "Tools\buildbot\external-common.bat" call "%VS90COMNTOOLS%\vsvars32.bat" -if not exist tcltk\bin\tcl85.dll ( +if not exist tcltk\bin\tcl85g.dll ( @rem all and install need to be separate invocations, otherwise nmakehlp is not found on install cd tcl-8.5.2.1\win nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk clean all @@ -12,10 +12,10 @@ cd ..\.. ) -if not exist tcltk\bin\tk85.dll ( +if not exist tcltk\bin\tk85g.dll ( cd tk-8.5.2.0\win - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all - nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 clean + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 all + nmake -f makefile.vc COMPILERFLAGS=-DWINVER=0x0500 OPTS=noxp DEBUG=1 INSTALLDIR=..\..\tcltk TCLDIR=..\..\tcl-8.5.2.1 install cd ..\.. ) Modified: python/branches/tlee-ast-optimize/Tools/buildbot/test-amd64.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/test-amd64.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/test-amd64.bat Sun Jun 15 03:02:00 2008 @@ -1,3 +1,3 @@ - at rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -q -d -x64 -uall -rw + at rem Used by the buildbot "test" step. +cd PCbuild +call rt.bat -q -d -x64 -uall -rw Modified: python/branches/tlee-ast-optimize/Tools/buildbot/test.bat ============================================================================== --- python/branches/tlee-ast-optimize/Tools/buildbot/test.bat (original) +++ python/branches/tlee-ast-optimize/Tools/buildbot/test.bat Sun Jun 15 03:02:00 2008 @@ -1,3 +1,3 @@ - at rem Used by the buildbot "test" step. -cd PCbuild -call rt.bat -d -q -uall -rw + at rem Used by the buildbot "test" step. +cd PCbuild +call rt.bat -d -q -uall -rw Modified: python/branches/tlee-ast-optimize/Tools/msi/msi.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/msi/msi.py (original) +++ python/branches/tlee-ast-optimize/Tools/msi/msi.py Sun Jun 15 03:02:00 2008 @@ -24,8 +24,6 @@ full_current_version = None # Is Tcl available at all? have_tcl = True -# Where is sqlite3.dll located, relative to srcdir? -sqlite_dir = "../sqlite-source-3.3.4" # path to PCbuild directory PCBUILD="PCbuild" # msvcrt version @@ -939,6 +937,8 @@ dirs={} pydirs = [(root,"Lib")] while pydirs: + # Commit every now and then, or else installer will complain + db.Commit() parent, dir = pydirs.pop() if dir == ".svn" or dir.startswith("plat-"): continue @@ -1041,7 +1041,7 @@ else: sqlite_arch = "" tclsuffix = "" - lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll") + lib.add_file("sqlite3.dll") if have_tcl: if not os.path.exists("%s/%s/_tkinter.pyd" % (srcdir, PCBUILD)): print "WARNING: Missing _tkinter.pyd" Modified: python/branches/tlee-ast-optimize/Tools/msi/msilib.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/msi/msilib.py (original) +++ python/branches/tlee-ast-optimize/Tools/msi/msilib.py Sun Jun 15 03:02:00 2008 @@ -289,7 +289,8 @@ def init_database(name, schema, ProductName, ProductCode, ProductVersion, - Manufacturer): + Manufacturer, + request_uac = False): try: os.unlink(name) except OSError: @@ -311,7 +312,11 @@ si.SetProperty(PID_AUTHOR, Manufacturer) si.SetProperty(PID_TEMPLATE, msi_type) si.SetProperty(PID_REVNUMBER, gen_uuid()) - si.SetProperty(PID_WORDCOUNT, 2) # long file names, compressed, original media + if request_uac: + wc = 2 # long file names, compressed, original media + else: + wc = 2 | 8 # +never invoke UAC + si.SetProperty(PID_WORDCOUNT, wc) si.SetProperty(PID_PAGECOUNT, 200) si.SetProperty(PID_APPNAME, "Python MSI Library") # XXX more properties Modified: python/branches/tlee-ast-optimize/Tools/scripts/svneol.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/scripts/svneol.py (original) +++ python/branches/tlee-ast-optimize/Tools/scripts/svneol.py Sun Jun 15 03:02:00 2008 @@ -33,36 +33,50 @@ import re import os -def proplist(root, fn): - "Return a list of property names for file fn in directory root" - path = os.path.join(root, ".svn", "props", fn+".svn-work") +def propfiles(root, fn): + default = os.path.join(root, ".svn", "props", fn+".svn-work") try: - f = open(path) + format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: - # no properties file: not under version control return [] + if format == 8: + # In version 8, committed props are stored in prop-base, + # local modifications in props + return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"), + os.path.join(root, ".svn", "props", fn+".svn-work")] + raise ValueError, "Unknown repository format" + +def proplist(root, fn): + "Return a list of property names for file fn in directory root" result = [] - while 1: - # key-value pairs, of the form - # K - # NL - # V length - # NL - # END - line = f.readline() - if line.startswith("END"): - break - assert line.startswith("K ") - L = int(line.split()[1]) - key = f.read(L) - result.append(key) - f.readline() - line = f.readline() - assert line.startswith("V ") - L = int(line.split()[1]) - value = f.read(L) - f.readline() - f.close() + for path in propfiles(root, fn): + try: + f = open(path) + except IOError: + # no properties file: not under version control, + # or no properties set + continue + while 1: + # key-value pairs, of the form + # K + # NL + # V length + # NL + # END + line = f.readline() + if line.startswith("END"): + break + assert line.startswith("K ") + L = int(line.split()[1]) + key = f.read(L) + result.append(key) + f.readline() + line = f.readline() + assert line.startswith("V ") + L = int(line.split()[1]) + value = f.read(L) + f.readline() + f.close() return result possible_text_file = re.compile(r"\.([hc]|py|txt|sln|vcproj)$").search From python-checkins at python.org Sun Jun 15 04:31:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 15 Jun 2008 04:31:06 +0200 (CEST) Subject: [Python-checkins] r64286 - in python/trunk/Lib/lib2to3: fixer_base.py fixer_util.py fixes/basefix.py fixes/fix_apply.py fixes/fix_basestring.py fixes/fix_buffer.py fixes/fix_callable.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_exec.py fixes/fix_execfile.py fixes/fix_filter.py fixes/fix_funcattrs.py fixes/fix_future.py fixes/fix_has_key.py fixes/fix_idioms.py fixes/fix_import.py fixes/fix_imports.py fixes/fix_input.py fixes/fix_intern.py fixes/fix_itertools.py fixes/fix_itertools_imports.py fixes/fix_long.py fixes/fix_map.py fixes/fix_methodattrs.py fixes/fix_ne.py fixes/fix_next.py fixes/fix_nonzero.py fixes/fix_numliterals.py fixes/fix_print.py fixes/fix_raise.py fixes/fix_raw_input.py fixes/fix_renames.py fixes/fix_repr.py fixes/fix_standarderror.py fixes/fix_throw.py fixes/fix_tuple_params.py fixes/fix_types.py fixes/fix_unicode.py fixes/fix_ws_comma.py fixes/fix_xrange.py fixes/fix_xreadlines.py fixes/fix_zip.py fixes/util.py refactor.py tests/test_all_fixers.py tests/test_fixers.py tests/test_util.py Message-ID: <20080615023106.DA2641E4009@bag.python.org> Author: benjamin.peterson Date: Sun Jun 15 04:31:05 2008 New Revision: 64286 Log: Merged revisions 63661,63666,63695,63711,63729,63769,63790,63880,63886 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r63661 | georg.brandl | 2008-05-26 05:26:20 -0500 (Mon, 26 May 2008) | 2 lines Add import fixes for dbm package. ........ r63666 | georg.brandl | 2008-05-26 05:49:09 -0500 (Mon, 26 May 2008) | 2 lines Add xmlrpc package fixes. ........ r63695 | georg.brandl | 2008-05-26 10:14:33 -0500 (Mon, 26 May 2008) | 2 lines Add fixer entries for http package. ........ r63711 | benjamin.peterson | 2008-05-26 13:43:51 -0500 (Mon, 26 May 2008) | 2 lines add import mapping for test.test_support -> test.support ........ r63729 | benjamin.peterson | 2008-05-26 16:31:03 -0500 (Mon, 26 May 2008) | 2 lines mapping for commands module -> subprocess ........ r63769 | brett.cannon | 2008-05-29 00:13:13 -0500 (Thu, 29 May 2008) | 1 line Fixer for UserString.UserString over to the collections module. ........ r63790 | brett.cannon | 2008-05-29 14:13:51 -0500 (Thu, 29 May 2008) | 4 lines Add a fixer for UserList. Closes issue #2878. Thanks to Quentin Gallet-Gilles for the patch. ........ r63880 | collin.winter | 2008-06-01 18:09:38 -0500 (Sun, 01 Jun 2008) | 6 lines Move lib2to3/fixes/{basefix,util}.py down to lib2to3/. This is step 1 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. ........ r63886 | collin.winter | 2008-06-01 22:15:01 -0500 (Sun, 01 Jun 2008) | 5 lines Allow refactoring tools to specify a directory for fixer modules. This is step 2 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. Step 1: r63880. ........ Added: python/trunk/Lib/lib2to3/fixer_base.py - copied unchanged from r63886, /sandbox/trunk/2to3/lib2to3/fixer_base.py python/trunk/Lib/lib2to3/fixer_util.py - copied unchanged from r63886, /sandbox/trunk/2to3/lib2to3/fixer_util.py Removed: python/trunk/Lib/lib2to3/fixes/basefix.py python/trunk/Lib/lib2to3/fixes/util.py Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/fixes/fix_apply.py python/trunk/Lib/lib2to3/fixes/fix_basestring.py python/trunk/Lib/lib2to3/fixes/fix_buffer.py python/trunk/Lib/lib2to3/fixes/fix_callable.py python/trunk/Lib/lib2to3/fixes/fix_dict.py python/trunk/Lib/lib2to3/fixes/fix_except.py python/trunk/Lib/lib2to3/fixes/fix_exec.py python/trunk/Lib/lib2to3/fixes/fix_execfile.py python/trunk/Lib/lib2to3/fixes/fix_filter.py python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py python/trunk/Lib/lib2to3/fixes/fix_future.py python/trunk/Lib/lib2to3/fixes/fix_has_key.py python/trunk/Lib/lib2to3/fixes/fix_idioms.py python/trunk/Lib/lib2to3/fixes/fix_import.py python/trunk/Lib/lib2to3/fixes/fix_imports.py python/trunk/Lib/lib2to3/fixes/fix_input.py python/trunk/Lib/lib2to3/fixes/fix_intern.py python/trunk/Lib/lib2to3/fixes/fix_itertools.py python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py python/trunk/Lib/lib2to3/fixes/fix_long.py python/trunk/Lib/lib2to3/fixes/fix_map.py python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py python/trunk/Lib/lib2to3/fixes/fix_ne.py python/trunk/Lib/lib2to3/fixes/fix_next.py python/trunk/Lib/lib2to3/fixes/fix_nonzero.py python/trunk/Lib/lib2to3/fixes/fix_numliterals.py python/trunk/Lib/lib2to3/fixes/fix_print.py python/trunk/Lib/lib2to3/fixes/fix_raise.py python/trunk/Lib/lib2to3/fixes/fix_raw_input.py python/trunk/Lib/lib2to3/fixes/fix_renames.py python/trunk/Lib/lib2to3/fixes/fix_repr.py python/trunk/Lib/lib2to3/fixes/fix_standarderror.py python/trunk/Lib/lib2to3/fixes/fix_throw.py python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py python/trunk/Lib/lib2to3/fixes/fix_types.py python/trunk/Lib/lib2to3/fixes/fix_unicode.py python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py python/trunk/Lib/lib2to3/fixes/fix_xrange.py python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py python/trunk/Lib/lib2to3/fixes/fix_zip.py python/trunk/Lib/lib2to3/refactor.py python/trunk/Lib/lib2to3/tests/test_all_fixers.py python/trunk/Lib/lib2to3/tests/test_fixers.py python/trunk/Lib/lib2to3/tests/test_util.py Deleted: python/trunk/Lib/lib2to3/fixes/basefix.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/basefix.py Sun Jun 15 04:31:05 2008 +++ (empty file) @@ -1,188 +0,0 @@ -# Copyright 2006 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Base class for fixers (optional, but recommended).""" - -# Python imports -import logging -import itertools - -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - -# Local imports -from ..patcomp import PatternCompiler -from .. import pygram -from .util import does_tree_import - -class BaseFix(object): - - """Optional base class for fixers. - - The subclass name must be FixFooBar where FooBar is the result of - removing underscores and capitalizing the words of the fix name. - For example, the class name for a fixer named 'has_key' should be - FixHasKey. - """ - - PATTERN = None # Most subclasses should override with a string literal - pattern = None # Compiled pattern, set by compile_pattern() - options = None # Options object passed to initializer - filename = None # The filename (set by set_filename) - logger = None # A logger (set by set_filename) - numbers = itertools.count(1) # For new_name() - used_names = set() # A set of all used NAMEs - order = "post" # Does the fixer prefer pre- or post-order traversal - explicit = False # Is this ignored by refactor.py -f all? - run_order = 5 # Fixers will be sorted by run order before execution - # Lower numbers will be run first. - - # Shortcut for access to Python grammar symbols - syms = pygram.python_symbols - - def __init__(self, options, log): - """Initializer. Subclass may override. - - Args: - options: an optparse.Values instance which can be used - to inspect the command line options. - log: a list to append warnings and other messages to. - """ - self.options = options - self.log = log - self.compile_pattern() - - def compile_pattern(self): - """Compiles self.PATTERN into self.pattern. - - Subclass may override if it doesn't want to use - self.{pattern,PATTERN} in .match(). - """ - if self.PATTERN is not None: - self.pattern = PatternCompiler().compile_pattern(self.PATTERN) - - def set_filename(self, filename): - """Set the filename, and a logger derived from it. - - The main refactoring tool should call this. - """ - self.filename = filename - self.logger = logging.getLogger(filename) - - def match(self, node): - """Returns match for a given parse tree node. - - Should return a true or false object (not necessarily a bool). - It may return a non-empty dict of matching sub-nodes as - returned by a matching pattern. - - Subclass may override. - """ - results = {"node": node} - return self.pattern.match(node, results) and results - - def transform(self, node, results): - """Returns the transformation for a given parse tree node. - - Args: - node: the root of the parse tree that matched the fixer. - results: a dict mapping symbolic names to part of the match. - - Returns: - None, or a node that is a modified copy of the - argument node. The node argument may also be modified in-place to - effect the same change. - - Subclass *must* override. - """ - raise NotImplementedError() - - def parenthesize(self, node): - """Wrapper around pygram.parenthesize().""" - return pygram.parenthesize(node) - - def new_name(self, template="xxx_todo_changeme"): - """Return a string suitable for use as an identifier - - The new name is guaranteed not to conflict with other identifiers. - """ - name = template - while name in self.used_names: - name = template + str(self.numbers.next()) - self.used_names.add(name) - return name - - def log_message(self, message): - if self.first_log: - self.first_log = False - self.log.append("### In file %s ###" % self.filename) - self.log.append(message) - - def cannot_convert(self, node, reason=None): - """Warn the user that a given chunk of code is not valid Python 3, - but that it cannot be converted automatically. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - for_output = node.clone() - for_output.set_prefix("") - msg = "Line %d: could not convert: %s" - self.log_message(msg % (lineno, for_output)) - if reason: - self.log_message(reason) - - def warning(self, node, reason): - """Used for warning the user about possible uncertainty in the - translation. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - self.log_message("Line %d: %s" % (lineno, reason)) - - def start_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the start of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - self.used_names = tree.used_names - self.set_filename(filename) - self.numbers = itertools.count(1) - self.first_log = True - - def finish_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the conclusion of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - pass - - -class ConditionalFix(BaseFix): - """ Base class for fixers which not execute if an import is found. """ - - # This is the name of the import which, if found, will cause the test to be skipped - skip_on = None - - def start_tree(self, *args): - super(ConditionalFix, self).start_tree(*args) - self._should_skip = None - - def should_skip(self, node): - if self._should_skip is not None: - return self._should_skip - pkg = self.skip_on.split(".") - name = pkg[-1] - pkg = ".".join(pkg[:-1]) - self._should_skip = does_tree_import(pkg, name, node) - return self._should_skip Modified: python/trunk/Lib/lib2to3/fixes/fix_apply.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_apply.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_apply.py Sun Jun 15 04:31:05 2008 @@ -8,10 +8,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Call, Comma +from .. import fixer_base +from ..fixer_util import Call, Comma -class FixApply(basefix.BaseFix): +class FixApply(fixer_base.BaseFix): PATTERN = """ power< 'apply' Modified: python/trunk/Lib/lib2to3/fixes/fix_basestring.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_basestring.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_basestring.py Sun Jun 15 04:31:05 2008 @@ -2,10 +2,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBasestring(basefix.BaseFix): +class FixBasestring(fixer_base.BaseFix): PATTERN = "'basestring'" Modified: python/trunk/Lib/lib2to3/fixes/fix_buffer.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_buffer.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_buffer.py Sun Jun 15 04:31:05 2008 @@ -4,11 +4,11 @@ """Fixer that changes buffer(...) into memoryview(...).""" # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBuffer(basefix.BaseFix): +class FixBuffer(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: python/trunk/Lib/lib2to3/fixes/fix_callable.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_callable.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_callable.py Sun Jun 15 04:31:05 2008 @@ -7,10 +7,10 @@ # Local imports from .. import pytree -from . import basefix -from .util import Call, Name, String +from .. import fixer_base +from ..fixer_util import Call, Name, String -class FixCallable(basefix.BaseFix): +class FixCallable(fixer_base.BaseFix): # Ignore callable(*args) or use of keywords. # Either could be a hint that the builtin callable() is not being used. Modified: python/trunk/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_dict.py Sun Jun 15 04:31:05 2008 @@ -27,15 +27,15 @@ from .. import pytree from .. import patcomp from ..pgen2 import token -from . import basefix -from .util import Name, Call, LParen, RParen, ArgList, Dot, set -from . import util +from .. import fixer_base +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from .. import fixer_util -iter_exempt = util.consuming_calls | set(["iter"]) +iter_exempt = fixer_util.consuming_calls | set(["iter"]) -class FixDict(basefix.BaseFix): +class FixDict(fixer_base.BaseFix): PATTERN = """ power< head=any+ trailer< '.' method=('keys'|'items'|'values'| @@ -92,7 +92,7 @@ return results["func"].value in iter_exempt else: # list(d.keys()) -> list(d.keys()), etc. - return results["func"].value in util.consuming_calls + return results["func"].value in fixer_util.consuming_calls if not isiter: return False # for ... in d.iterkeys() -> for ... in d.keys(), etc. Modified: python/trunk/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_except.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_except.py Sun Jun 15 04:31:05 2008 @@ -24,8 +24,8 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Assign, Attr, Name, is_tuple, is_list, reversed +from .. import fixer_base +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed def find_excepts(nodes): for i, n in enumerate(nodes): @@ -33,7 +33,7 @@ if n.children[0].value == 'except': yield (n, nodes[i+2]) -class FixExcept(basefix.BaseFix): +class FixExcept(fixer_base.BaseFix): PATTERN = """ try_stmt< 'try' ':' suite Modified: python/trunk/Lib/lib2to3/fixes/fix_exec.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_exec.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_exec.py Sun Jun 15 04:31:05 2008 @@ -11,11 +11,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Comma, Name, Call +from .. import fixer_base +from ..fixer_util import Comma, Name, Call -class FixExec(basefix.BaseFix): +class FixExec(fixer_base.BaseFix): PATTERN = """ exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > Modified: python/trunk/Lib/lib2to3/fixes/fix_execfile.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_execfile.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_execfile.py Sun Jun 15 04:31:05 2008 @@ -8,11 +8,11 @@ """ from .. import pytree -from . import basefix -from .util import Comma, Name, Call, LParen, RParen, Dot +from .. import fixer_base +from ..fixer_util import Comma, Name, Call, LParen, RParen, Dot -class FixExecfile(basefix.BaseFix): +class FixExecfile(fixer_base.BaseFix): PATTERN = """ power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > Modified: python/trunk/Lib/lib2to3/fixes/fix_filter.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_filter.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_filter.py Sun Jun 15 04:31:05 2008 @@ -15,10 +15,10 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context -class FixFilter(basefix.ConditionalFix): +class FixFilter(fixer_base.ConditionalFix): PATTERN = """ filter_lambda=power< Modified: python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py Sun Jun 15 04:31:05 2008 @@ -2,11 +2,11 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixFuncattrs(basefix.BaseFix): +class FixFuncattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' Modified: python/trunk/Lib/lib2to3/fixes/fix_future.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_future.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_future.py Sun Jun 15 04:31:05 2008 @@ -5,10 +5,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixFuture(basefix.BaseFix): +class FixFuture(fixer_base.BaseFix): PATTERN = """import_from< 'from' module_name="__future__" 'import' any >""" # This should be run last -- some things check for the import Modified: python/trunk/Lib/lib2to3/fixes/fix_has_key.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_has_key.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_has_key.py Sun Jun 15 04:31:05 2008 @@ -32,11 +32,11 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixHasKey(basefix.BaseFix): +class FixHasKey(fixer_base.BaseFix): PATTERN = """ anchor=power< Modified: python/trunk/Lib/lib2to3/fixes/fix_idioms.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_idioms.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_idioms.py Sun Jun 15 04:31:05 2008 @@ -28,13 +28,13 @@ # Author: Jacques Frechet, Collin Winter # Local imports -from . import basefix -from .util import Call, Comma, Name, Node, syms +from .. import fixer_base +from ..fixer_util import Call, Comma, Name, Node, syms CMP = "(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)" TYPE = "power< 'type' trailer< '(' x=any ')' > >" -class FixIdioms(basefix.BaseFix): +class FixIdioms(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: python/trunk/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_import.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_import.py Sun Jun 15 04:31:05 2008 @@ -11,11 +11,11 @@ """ # Local imports -from . import basefix +from .. import fixer_base from os.path import dirname, join, exists, pathsep -from .util import FromImport +from ..fixer_util import FromImport -class FixImport(basefix.BaseFix): +class FixImport(fixer_base.BaseFix): PATTERN = """ import_from< type='from' imp=any 'import' any > Modified: python/trunk/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_imports.py Sun Jun 15 04:31:05 2008 @@ -8,8 +8,8 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set import __builtin__ builtin_names = [name for name in dir(__builtin__) if name not in ("__name__", "__doc__")] @@ -150,6 +150,123 @@ 'error', 'exit', 'exit_thread', 'get_ident', 'interrupt_main', 'stack_size', 'start_new', 'start_new_thread']), + 'whichdb': ('dbm', ['whichdb']), + 'anydbm': ('dbm', ['error', 'open']), + 'dbhash': ('dbm.bsd', ['error', 'open']), + 'dumbdbm': ('dbm.dumb', ['error', 'open', '_Database']), + 'dbm': ('dbm.ndbm', ['error', 'open', 'library']), + 'gdbm': ('dbm.gnu', ['error', 'open', 'open_flags']), + 'xmlrpclib': ('xmlrpc.client', + ['Error', 'ProtocolError', 'ResponseError', 'Fault', + 'ServerProxy', 'Boolean', 'DateTime', 'Binary', + 'ExpatParser', 'FastMarshaller', 'FastParser', + 'FastUnmarshaller', 'MultiCall', 'MultiCallIterator', + 'SlowParser', 'Marshaller', 'Unmarshaller', 'Server', + 'Transport', 'SafeTransport', 'SgmlopParser', + 'boolean', 'getparser', 'dumps', 'loads', 'escape', + 'PARSE_ERROR', 'SERVER_ERROR', 'WRAPPERS', + 'APPLICATION_ERROR', 'SYSTEM_ERROR', + 'TRANSPORT_ERROR', 'NOT_WELLFORMED_ERROR', + 'UNSUPPORTED_ENCODING', 'INVALID_ENCODING_CHAR', + 'INVALID_XMLRPC', 'METHOD_NOT_FOUND', + 'INVALID_METHOD_PARAMS', 'INTERNAL_ERROR', + 'MININT', 'MAXINT']), + 'DocXMLRPCServer': ('xmlrpc.server', + ['CGIXMLRPCRequestHandler', + 'DocCGIXMLRPCRequestHandler', + 'DocXMLRPCRequestHandler', 'DocXMLRPCServer', + 'ServerHTMLDoc', 'SimpleXMLRPCRequestHandler', + 'SimpleXMLRPCServer', 'XMLRPCDocGenerator', + 'resolve_dotted_attribute']), + 'SimpleXMLRPCServer': ('xmlrpc.server', + ['CGIXMLRPCRequestHandler', + 'Fault', 'SimpleXMLRPCDispatcher', + 'SimpleXMLRPCRequestHandler', + 'SimpleXMLRPCServer', 'SocketServer', + 'list_public_methods', + 'remove_duplicates', + 'resolve_dotted_attribute']), + 'httplib': ('http.client', + ['ACCEPTED', 'BAD_GATEWAY', 'BAD_REQUEST', + 'BadStatusLine', 'CONFLICT', 'CONTINUE', 'CREATED', + 'CannotSendHeader', 'CannotSendRequest', + 'EXPECTATION_FAILED', 'FAILED_DEPENDENCY', 'FORBIDDEN', + 'FOUND', 'FakeSocket', 'GATEWAY_TIMEOUT', 'GONE', + 'HTTP', 'HTTPConnection', 'HTTPException', + 'HTTPMessage', 'HTTPResponse', 'HTTPS', + 'HTTPSConnection', 'HTTPS_PORT', 'HTTP_PORT', + 'HTTP_VERSION_NOT_SUPPORTED', 'IM_USED', + 'INSUFFICIENT_STORAGE', 'INTERNAL_SERVER_ERROR', + 'ImproperConnectionState', 'IncompleteRead', + 'InvalidURL', 'LENGTH_REQUIRED', 'LOCKED', + 'LineAndFileWrapper', 'MAXAMOUNT', 'METHOD_NOT_ALLOWED', + 'MOVED_PERMANENTLY', 'MULTIPLE_CHOICES', 'MULTI_STATUS', + 'NON_AUTHORITATIVE_INFORMATION', 'NOT_ACCEPTABLE', + 'NOT_EXTENDED', 'NOT_FOUND', 'NOT_IMPLEMENTED', + 'NOT_MODIFIED', 'NO_CONTENT', 'NotConnected', 'OK', + 'PARTIAL_CONTENT', 'PAYMENT_REQUIRED', + 'PRECONDITION_FAILED', 'PROCESSING', + 'PROXY_AUTHENTICATION_REQUIRED', + 'REQUESTED_RANGE_NOT_SATISFIABLE', + 'REQUEST_ENTITY_TOO_LARGE', 'REQUEST_TIMEOUT', + 'REQUEST_URI_TOO_LONG', 'RESET_CONTENT', + 'ResponseNotReady', 'SEE_OTHER', 'SERVICE_UNAVAILABLE', + 'SSLFile', 'SWITCHING_PROTOCOLS', 'SharedSocket', + 'SharedSocketClient', 'StringIO', 'TEMPORARY_REDIRECT', + 'UNAUTHORIZED', 'UNPROCESSABLE_ENTITY', + 'UNSUPPORTED_MEDIA_TYPE', 'UPGRADE_REQUIRED', + 'USE_PROXY', 'UnimplementedFileMode', 'UnknownProtocol', + 'UnknownTransferEncoding', 'error', 'responses']), + 'Cookie': ('http.cookies', + ['BaseCookie', 'Cookie', 'CookieError', 'Morsel', + 'SerialCookie', 'SimpleCookie', 'SmartCookie']), + 'cookielib': ('http.cookiejar', + ['Absent', 'Cookie', 'CookieJar', 'CookiePolicy', + 'DAYS', 'DEFAULT_HTTP_PORT', 'DefaultCookiePolicy', + 'EPOCH_YEAR', 'ESCAPED_CHAR_RE', 'FileCookieJar', + 'HEADER_ESCAPE_RE', 'HEADER_JOIN_ESCAPE_RE', + 'HEADER_QUOTED_VALUE_RE', 'HEADER_TOKEN_RE', + 'HEADER_VALUE_RE', 'HTTP_PATH_SAFE', 'IPV4_RE', + 'ISO_DATE_RE', 'LOOSE_HTTP_DATE_RE', 'LWPCookieJar', + 'LoadError', 'MISSING_FILENAME_TEXT', 'MONTHS', + 'MONTHS_LOWER', 'MozillaCookieJar', 'STRICT_DATE_RE', + 'TIMEZONE_RE', 'UTC_ZONES', 'WEEKDAY_RE', + 'cut_port_re', 'deepvalues', 'domain_match', + 'eff_request_host', 'escape_path', 'http2time', + 'is_HDN', 'is_third_party', 'iso2time', + 'join_header_words', 'liberal_is_HDN', 'logger', + 'lwp_cookie_str', 'month', 'offset_from_tz_string', + 'parse_ns_headers', 'reach', 'request_host', + 'request_path', 'request_port', 'split_header_words', + 'time', 'time2isoz', 'time2netscape', 'unmatched', + 'uppercase_escaped_char', 'urllib', + 'user_domain_match', 'vals_sorted_by_key']), + 'BaseHTTPServer': ('http.server', + ['BaseHTTPRequestHandler', + 'DEFAULT_ERROR_MESSAGE', 'HTTPServer']), + 'SimpleHTTPServer': ('http.server', ['SimpleHTTPRequestHandler']), + 'CGIHTTPServer': ('http.server', + ['CGIHTTPRequestHandler', 'executable', + 'nobody_uid', 'nobody']), + 'test.test_support': ('test.support', + ["Error", "TestFailed", "TestSkipped", "ResourceDenied", + "import_module", "verbose", "use_resources", + "max_memuse", "record_original_stdout", + "get_original_stdout", "unload", "unlink", "rmtree", + "forget", "is_resource_enabled", "requires", + "find_unused_port", "bind_port", + "fcmp", "is_jython", "TESTFN", "HOST", + "FUZZ", "findfile", "verify", "vereq", "sortdict", + "check_syntax_error", "open_urlresource", "WarningMessage", + "catch_warning", "CleanImport", "EnvironmentVarGuard", + "TransientResource", "captured_output", "captured_stdout", + "TransientResource", "transient_internet", "run_with_locale", + "set_memlimit", "bigmemtest", "bigaddrspacetest", + "BasicTestRunner", "run_unittest", "run_doctest", + "threading_setup", "threading_cleanup", "reap_children"]), + 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), + 'UserString' : ('collections', ['UserString']), + 'UserList' : ('collections', ['UserList']), } @@ -180,7 +297,7 @@ yield """bare_name=%s""" % alternates(bare) -class FixImports(basefix.BaseFix): +class FixImports(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: python/trunk/Lib/lib2to3/fixes/fix_input.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_input.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_input.py Sun Jun 15 04:31:05 2008 @@ -2,15 +2,15 @@ # Author: Andre Roberge # Local imports -from . import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name from .. import patcomp context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >") -class FixInput(basefix.BaseFix): +class FixInput(fixer_base.BaseFix): PATTERN = """ power< 'input' args=trailer< '(' [any] ')' > > Modified: python/trunk/Lib/lib2to3/fixes/fix_intern.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_intern.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_intern.py Sun Jun 15 04:31:05 2008 @@ -7,11 +7,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Attr +from .. import fixer_base +from ..fixer_util import Name, Attr -class FixIntern(basefix.BaseFix): +class FixIntern(fixer_base.BaseFix): PATTERN = """ power< 'intern' Modified: python/trunk/Lib/lib2to3/fixes/fix_itertools.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_itertools.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_itertools.py Sun Jun 15 04:31:05 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixItertools(basefix.BaseFix): +class FixItertools(fixer_base.BaseFix): it_funcs = "('imap'|'ifilter'|'izip'|'ifilterfalse')" PATTERN = """ power< it='itertools' Modified: python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py Sun Jun 15 04:31:05 2008 @@ -1,10 +1,10 @@ """ Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """ # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixItertoolsImports(basefix.BaseFix): +class FixItertoolsImports(fixer_base.BaseFix): PATTERN = """ import_from< 'from' 'itertools' 'import' imports=any > """ %(locals()) Modified: python/trunk/Lib/lib2to3/fixes/fix_long.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_long.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_long.py Sun Jun 15 04:31:05 2008 @@ -8,11 +8,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Number +from .. import fixer_base +from ..fixer_util import Name, Number -class FixLong(basefix.BaseFix): +class FixLong(fixer_base.BaseFix): PATTERN = """ (long_type = 'long' | number = NUMBER) Modified: python/trunk/Lib/lib2to3/fixes/fix_map.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_map.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_map.py Sun Jun 15 04:31:05 2008 @@ -21,11 +21,11 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context from ..pygram import python_symbols as syms -class FixMap(basefix.ConditionalFix): +class FixMap(fixer_base.ConditionalFix): PATTERN = """ map_none=power< Modified: python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py Sun Jun 15 04:31:05 2008 @@ -3,8 +3,8 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name MAP = { "im_func" : "__func__", @@ -12,7 +12,7 @@ "im_class" : "__self__.__class__" } -class FixMethodattrs(basefix.BaseFix): +class FixMethodattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > """ Modified: python/trunk/Lib/lib2to3/fixes/fix_ne.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_ne.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_ne.py Sun Jun 15 04:31:05 2008 @@ -6,10 +6,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix +from .. import fixer_base -class FixNe(basefix.BaseFix): +class FixNe(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: python/trunk/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_next.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_next.py Sun Jun 15 04:31:05 2008 @@ -8,13 +8,13 @@ # Local imports from ..pgen2 import token from ..pygram import python_symbols as syms -from . import basefix -from .util import Name, Call, find_binding, any +from .. import fixer_base +from ..fixer_util import Name, Call, find_binding, any bind_warning = "Calls to builtin next() possibly shadowed by global binding" -class FixNext(basefix.BaseFix): +class FixNext(fixer_base.BaseFix): PATTERN = """ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | Modified: python/trunk/Lib/lib2to3/fixes/fix_nonzero.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_nonzero.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_nonzero.py Sun Jun 15 04:31:05 2008 @@ -2,10 +2,10 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name, syms +from .. import fixer_base +from ..fixer_util import Name, syms -class FixNonzero(basefix.BaseFix): +class FixNonzero(fixer_base.BaseFix): PATTERN = """ classdef< 'class' any+ ':' suite< any* Modified: python/trunk/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_numliterals.py Sun Jun 15 04:31:05 2008 @@ -5,11 +5,11 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Number, set +from .. import fixer_base +from ..fixer_util import Number, set -class FixNumliterals(basefix.BaseFix): +class FixNumliterals(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: python/trunk/Lib/lib2to3/fixes/fix_print.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_print.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_print.py Sun Jun 15 04:31:05 2008 @@ -17,8 +17,8 @@ from .. import patcomp from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Comma, String, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Comma, String, is_tuple parend_expr = patcomp.compile_pattern( @@ -26,7 +26,7 @@ ) -class FixPrint(basefix.ConditionalFix): +class FixPrint(fixer_base.ConditionalFix): PATTERN = """ simple_stmt< bare='print' any > | print_stmt Modified: python/trunk/Lib/lib2to3/fixes/fix_raise.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_raise.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_raise.py Sun Jun 15 04:31:05 2008 @@ -24,10 +24,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Attr, ArgList, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Attr, ArgList, is_tuple -class FixRaise(basefix.BaseFix): +class FixRaise(fixer_base.BaseFix): PATTERN = """ raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > Modified: python/trunk/Lib/lib2to3/fixes/fix_raw_input.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_raw_input.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_raw_input.py Sun Jun 15 04:31:05 2008 @@ -2,10 +2,10 @@ # Author: Andre Roberge # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixRawInput(basefix.BaseFix): +class FixRawInput(fixer_base.BaseFix): PATTERN = """ power< name='raw_input' trailer< '(' [any] ')' > > Modified: python/trunk/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_renames.py Sun Jun 15 04:31:05 2008 @@ -7,8 +7,8 @@ # based on Collin Winter's fix_import # Local imports -from .import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set MAPPING = {"sys": {"maxint" : "maxsize"}, } @@ -39,7 +39,7 @@ #yield """bare_name=%s""" % alternates(bare) -class FixRenames(basefix.BaseFix): +class FixRenames(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: python/trunk/Lib/lib2to3/fixes/fix_repr.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_repr.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_repr.py Sun Jun 15 04:31:05 2008 @@ -4,11 +4,11 @@ """Fixer that transforms `xyzzy` into repr(xyzzy).""" # Local imports -from .import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name -class FixRepr(basefix.BaseFix): +class FixRepr(fixer_base.BaseFix): PATTERN = """ atom < '`' expr=any '`' > Modified: python/trunk/Lib/lib2to3/fixes/fix_standarderror.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_standarderror.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_standarderror.py Sun Jun 15 04:31:05 2008 @@ -4,11 +4,11 @@ """Fixer for StandardError -> Exception.""" # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixStandarderror(basefix.BaseFix): +class FixStandarderror(fixer_base.BaseFix): PATTERN = """ 'StandardError' Modified: python/trunk/Lib/lib2to3/fixes/fix_throw.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_throw.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_throw.py Sun Jun 15 04:31:05 2008 @@ -10,10 +10,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, ArgList, Attr, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, ArgList, Attr, is_tuple -class FixThrow(basefix.BaseFix): +class FixThrow(fixer_base.BaseFix): PATTERN = """ power< any trailer< '.' 'throw' > Modified: python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py Sun Jun 15 04:31:05 2008 @@ -21,14 +21,14 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Assign, Name, Newline, Number, Subscript, syms +from .. import fixer_base +from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms def is_docstring(stmt): return isinstance(stmt, pytree.Node) and \ stmt.children[0].type == token.STRING -class FixTupleParams(basefix.BaseFix): +class FixTupleParams(fixer_base.BaseFix): PATTERN = """ funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > Modified: python/trunk/Lib/lib2to3/fixes/fix_types.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_types.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_types.py Sun Jun 15 04:31:05 2008 @@ -21,8 +21,8 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name _TYPE_MAPPING = { 'BooleanType' : 'bool', @@ -51,7 +51,7 @@ _pats = ["power< 'types' trailer< '.' name='%s' > >" % t for t in _TYPE_MAPPING] -class FixTypes(basefix.BaseFix): +class FixTypes(fixer_base.BaseFix): PATTERN = '|'.join(_pats) Modified: python/trunk/Lib/lib2to3/fixes/fix_unicode.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_unicode.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_unicode.py Sun Jun 15 04:31:05 2008 @@ -4,9 +4,9 @@ import re from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixUnicode(basefix.BaseFix): +class FixUnicode(fixer_base.BaseFix): PATTERN = "STRING | NAME<'unicode' | 'unichr'>" Modified: python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py Sun Jun 15 04:31:05 2008 @@ -7,9 +7,9 @@ from .. import pytree from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixWsComma(basefix.BaseFix): +class FixWsComma(fixer_base.BaseFix): explicit = True # The user must ask for this fixers Modified: python/trunk/Lib/lib2to3/fixes/fix_xrange.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_xrange.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_xrange.py Sun Jun 15 04:31:05 2008 @@ -4,12 +4,12 @@ """Fixer that changes xrange(...) into range(...).""" # Local imports -from .import basefix -from .util import Name, Call, consuming_calls +from .. import fixer_base +from ..fixer_util import Name, Call, consuming_calls from .. import patcomp -class FixXrange(basefix.BaseFix): +class FixXrange(fixer_base.BaseFix): PATTERN = """ power< (name='range'|name='xrange') trailer< '(' [any] ')' > any* > Modified: python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py Sun Jun 15 04:31:05 2008 @@ -4,11 +4,11 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixXreadlines(basefix.BaseFix): +class FixXreadlines(fixer_base.BaseFix): PATTERN = """ power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | Modified: python/trunk/Lib/lib2to3/fixes/fix_zip.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_zip.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_zip.py Sun Jun 15 04:31:05 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name, Call, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, in_special_context -class FixZip(basefix.ConditionalFix): +class FixZip(fixer_base.ConditionalFix): PATTERN = """ power< 'zip' args=trailer< '(' [any] ')' > Deleted: python/trunk/Lib/lib2to3/fixes/util.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/util.py Sun Jun 15 04:31:05 2008 +++ (empty file) @@ -1,366 +0,0 @@ -"""Utility functions, node construction macros, etc.""" -# Author: Collin Winter - -# Local imports -from ..pgen2 import token -from ..pytree import Leaf, Node -from ..pygram import python_symbols as syms -from .. import patcomp - - -########################################################### -### Common node-construction "macros" -########################################################### - -def KeywordArg(keyword, value): - return Node(syms.argument, - [keyword, Leaf(token.EQUAL, '='), value]) - -def LParen(): - return Leaf(token.LPAR, "(") - -def RParen(): - return Leaf(token.RPAR, ")") - -def Assign(target, source): - """Build an assignment statement""" - if not isinstance(target, list): - target = [target] - if not isinstance(source, list): - source.set_prefix(" ") - source = [source] - - return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) - -def Name(name, prefix=None): - """Return a NAME leaf""" - return Leaf(token.NAME, name, prefix=prefix) - -def Attr(obj, attr): - """A node tuple for obj.attr""" - return [obj, Node(syms.trailer, [Dot(), attr])] - -def Comma(): - """A comma leaf""" - return Leaf(token.COMMA, ",") - -def Dot(): - """A period (.) leaf""" - return Leaf(token.DOT, ".") - -def ArgList(args, lparen=LParen(), rparen=RParen()): - """A parenthesised argument list, used by Call()""" - return Node(syms.trailer, - [lparen.clone(), - Node(syms.arglist, args), - rparen.clone()]) - -def Call(func_name, args, prefix=None): - """A function call""" - node = Node(syms.power, [func_name, ArgList(args)]) - if prefix is not None: - node.set_prefix(prefix) - return node - -def Newline(): - """A newline literal""" - return Leaf(token.NEWLINE, "\n") - -def BlankLine(): - """A blank line""" - return Leaf(token.NEWLINE, "") - -def Number(n, prefix=None): - return Leaf(token.NUMBER, n, prefix=prefix) - -def Subscript(index_node): - """A numeric or string subscript""" - return Node(syms.trailer, [Leaf(token.LBRACE, '['), - index_node, - Leaf(token.RBRACE, ']')]) - -def String(string, prefix=None): - """A string leaf""" - return Leaf(token.STRING, string, prefix=prefix) - -def ListComp(xp, fp, it, test=None): - """A list comprehension of the form [xp for fp in it if test]. - - If test is None, the "if test" part is omitted. - """ - xp.set_prefix("") - fp.set_prefix(" ") - it.set_prefix(" ") - for_leaf = Leaf(token.NAME, "for") - for_leaf.set_prefix(" ") - in_leaf = Leaf(token.NAME, "in") - in_leaf.set_prefix(" ") - inner_args = [for_leaf, fp, in_leaf, it] - if test: - test.set_prefix(" ") - if_leaf = Leaf(token.NAME, "if") - if_leaf.set_prefix(" ") - inner_args.append(Node(syms.comp_if, [if_leaf, test])) - inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) - return Node(syms.atom, - [Leaf(token.LBRACE, "["), - inner, - Leaf(token.RBRACE, "]")]) - -def FromImport(package_name, name_leafs): - """ Return an import statement in the form: - from package import name_leafs""" - # XXX: May not handle dotted imports properly (eg, package_name='foo.bar') - assert package_name == '.' or '.' not in package.name, "FromImport has "\ - "not been tested with dotted package names -- use at your own "\ - "peril!" - - for leaf in name_leafs: - # Pull the leaves out of their old tree - leaf.remove() - - children = [Leaf(token.NAME, 'from'), - Leaf(token.NAME, package_name, prefix=" "), - Leaf(token.NAME, 'import', prefix=" "), - Node(syms.import_as_names, name_leafs)] - imp = Node(syms.import_from, children) - return imp - - -########################################################### -### Determine whether a node represents a given literal -########################################################### - -def is_tuple(node): - """Does the node represent a tuple literal?""" - if isinstance(node, Node) and node.children == [LParen(), RParen()]: - return True - return (isinstance(node, Node) - and len(node.children) == 3 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[1], Node) - and isinstance(node.children[2], Leaf) - and node.children[0].value == "(" - and node.children[2].value == ")") - -def is_list(node): - """Does the node represent a list literal?""" - return (isinstance(node, Node) - and len(node.children) > 1 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[-1], Leaf) - and node.children[0].value == "[" - and node.children[-1].value == "]") - -########################################################### -### Common portability code. This allows fixers to do, eg, -### "from .util import set" and forget about it. -########################################################### - -try: - any = any -except NameError: - def any(l): - for o in l: - if o: - return True - return False - -try: - set = set -except NameError: - from sets import Set as set - -try: - reversed = reversed -except NameError: - def reversed(l): - return l[::-1] - -########################################################### -### Misc -########################################################### - - -consuming_calls = set(["sorted", "list", "set", "any", "all", "tuple", "sum", - "min", "max"]) - -def attr_chain(obj, attr): - """Follow an attribute chain. - - If you have a chain of objects where a.foo -> b, b.foo-> c, etc, - use this to iterate over all objects in the chain. Iteration is - terminated by getattr(x, attr) is None. - - Args: - obj: the starting object - attr: the name of the chaining attribute - - Yields: - Each successive object in the chain. - """ - next = getattr(obj, attr) - while next: - yield next - next = getattr(next, attr) - -p0 = """for_stmt< 'for' any 'in' node=any ':' any* > - | comp_for< 'for' any 'in' node=any any* > - """ -p1 = """ -power< - ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | - 'any' | 'all' | (any* trailer< '.' 'join' >) ) - trailer< '(' node=any ')' > - any* -> -""" -p2 = """ -power< - 'sorted' - trailer< '(' arglist ')' > - any* -> -""" -pats_built = False -def in_special_context(node): - """ Returns true if node is in an environment where all that is required - of it is being itterable (ie, it doesn't matter if it returns a list - or an itterator). - See test_map_nochange in test_fixers.py for some examples and tests. - """ - global p0, p1, p2, pats_built - if not pats_built: - p1 = patcomp.compile_pattern(p1) - p0 = patcomp.compile_pattern(p0) - p2 = patcomp.compile_pattern(p2) - pats_built = True - patterns = [p0, p1, p2] - for pattern, parent in zip(patterns, attr_chain(node, "parent")): - results = {} - if pattern.match(parent, results) and results["node"] is node: - return True - return False - -########################################################### -### The following functions are to find bindings in a suite -########################################################### - -def make_suite(node): - if node.type == syms.suite: - return node - node = node.clone() - parent, node.parent = node.parent, None - suite = Node(syms.suite, [node]) - suite.parent = parent - return suite - -def does_tree_import(package, name, node): - """ Returns true if name is imported from package at the - top level of the tree which node belongs to. - To cover the case of an import like 'import foo', use - Null for the package and 'foo' for the name. """ - # Scamper up to the top level namespace - while node.type != syms.file_input: - assert node.parent, "Tree is insane! root found before "\ - "file_input node was found." - node = node.parent - - binding = find_binding(name, node, package) - return bool(binding) - -_def_syms = set([syms.classdef, syms.funcdef]) -def find_binding(name, node, package=None): - """ Returns the node which binds variable name, otherwise None. - If optional argument package is supplied, only imports will - be returned. - See test cases for examples.""" - for child in node.children: - ret = None - if child.type == syms.for_stmt: - if _find(name, child.children[1]): - return child - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type in (syms.if_stmt, syms.while_stmt): - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type == syms.try_stmt: - n = find_binding(name, make_suite(child.children[2]), package) - if n: - ret = n - else: - for i, kid in enumerate(child.children[3:]): - if kid.type == token.COLON and kid.value == ":": - # i+3 is the colon, i+4 is the suite - n = find_binding(name, make_suite(child.children[i+4]), package) - if n: ret = n - elif child.type in _def_syms and child.children[1].value == name: - ret = child - elif _is_import_binding(child, name, package): - ret = child - elif child.type == syms.simple_stmt: - ret = find_binding(name, child, package) - elif child.type == syms.expr_stmt: - if _find(name, child.children[0]): - ret = child - - if ret: - if not package: - return ret - if ret.type in (syms.import_name, syms.import_from): - return ret - return None - -_block_syms = set([syms.funcdef, syms.classdef, syms.trailer]) -def _find(name, node): - nodes = [node] - while nodes: - node = nodes.pop() - if node.type > 256 and node.type not in _block_syms: - nodes.extend(node.children) - elif node.type == token.NAME and node.value == name: - return node - return None - -def _is_import_binding(node, name, package=None): - """ Will reuturn node if node will import name, or node - will import * from package. None is returned otherwise. - See test cases for examples. """ - - if node.type == syms.import_name and not package: - imp = node.children[1] - if imp.type == syms.dotted_as_names: - for child in imp.children: - if child.type == syms.dotted_as_name: - if child.children[2].value == name: - return node - elif child.type == token.NAME and child.value == name: - return node - elif imp.type == syms.dotted_as_name: - last = imp.children[-1] - if last.type == token.NAME and last.value == name: - return node - elif imp.type == token.NAME and imp.value == name: - return node - elif node.type == syms.import_from: - # unicode(...) is used to make life easier here, because - # from a.b import parses to ['import', ['a', '.', 'b'], ...] - if package and unicode(node.children[1]).strip() != package: - return None - n = node.children[3] - if package and _find('as', n): - # See test_from_import_as for explanation - return None - elif n.type == syms.import_as_names and _find(name, n): - return node - elif n.type == syms.import_as_name: - child = n.children[2] - if child.type == token.NAME and child.value == name: - return node - elif n.type == token.NAME and n.value == name: - return node - elif package and n.type == token.STAR: - return node - return None Modified: python/trunk/Lib/lib2to3/refactor.py ============================================================================== --- python/trunk/Lib/lib2to3/refactor.py (original) +++ python/trunk/Lib/lib2to3/refactor.py Sun Jun 15 04:31:05 2008 @@ -30,11 +30,13 @@ from . import fixes from . import pygram -def main(args=None): +def main(fixer_dir, args=None): """Main program. - Call without arguments to use sys.argv[1:] as the arguments; or - call with a list of arguments (excluding sys.argv[0]). + Args: + fixer_dir: directory where fixer modules are located. + args: optional; a list of command line arguments. If omitted, + sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). """ @@ -57,7 +59,7 @@ options, args = parser.parse_args(args) if options.list_fixes: print "Available transformations for the -f/--fix option:" - for fixname in get_all_fix_names(): + for fixname in get_all_fix_names(fixer_dir): print fixname if not args: return 0 @@ -76,7 +78,7 @@ logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO) # Initialize the refactoring tool - rt = RefactoringTool(options) + rt = RefactoringTool(fixer_dir, options) # Refactor all files and directories passed as arguments if not rt.errors: @@ -87,10 +89,10 @@ return int(bool(rt.errors)) -def get_all_fix_names(): +def get_all_fix_names(fixer_dir): """Return a sorted list of all available fix names.""" fix_names = [] - names = os.listdir(os.path.dirname(fixes.__file__)) + names = os.listdir(fixer_dir) names.sort() for name in names: if name.startswith("fix_") and name.endswith(".py"): @@ -138,11 +140,14 @@ class RefactoringTool(object): - def __init__(self, options): + def __init__(self, fixer_dir, options): """Initializer. - The argument is an optparse.Values instance. + Args: + fixer_dir: directory in which to find fixer modules. + options: an optparse.Values instance. """ + self.fixer_dir = fixer_dir self.options = options self.errors = [] self.logger = logging.getLogger("RefactoringTool") @@ -167,14 +172,15 @@ want a pre-order AST traversal, and post_order is the list that want post-order traversal. """ + fixer_pkg = ".".join(self.fixer_dir.split(os.path.sep)) pre_order_fixers = [] post_order_fixers = [] fix_names = self.options.fix if not fix_names or "all" in fix_names: - fix_names = get_all_fix_names() + fix_names = get_all_fix_names(self.fixer_dir) for fix_name in fix_names: try: - mod = __import__("lib2to3.fixes.fix_" + fix_name, {}, {}, ["*"]) + mod = __import__(fixer_pkg + ".fix_" + fix_name, {}, {}, ["*"]) except ImportError: self.log_error("Can't find transformation %s", fix_name) continue Modified: python/trunk/Lib/lib2to3/tests/test_all_fixers.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_all_fixers.py (original) +++ python/trunk/Lib/lib2to3/tests/test_all_fixers.py Sun Jun 15 04:31:05 2008 @@ -29,7 +29,7 @@ def setUp(self): options = Options(fix=["all", "idioms", "ws_comma", "buffer"], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) def test_all_project_files(self): for filepath in support.all_project_files(): Modified: python/trunk/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_fixers.py (original) +++ python/trunk/Lib/lib2to3/tests/test_fixers.py Sun Jun 15 04:31:05 2008 @@ -10,13 +10,14 @@ # Python imports import unittest +from itertools import chain from os.path import dirname, pathsep # Local imports from .. import pygram from .. import pytree from .. import refactor -from ..fixes import util +from .. import fixer_util class Options: @@ -29,11 +30,10 @@ class FixerTestCase(support.TestCase): def setUp(self): options = Options(fix=[self.fixer], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) self.fixer_log = [] self.filename = "" - from itertools import chain for order in (self.refactor.pre_order.values(),\ self.refactor.post_order.values()): for fixer in chain(*order): @@ -70,7 +70,7 @@ fix = [self.fixer] fix.extend(names) options = Options(fix=fix, print_function=False) - r = refactor.RefactoringTool(options) + r = refactor.RefactoringTool("lib2to3/fixes", options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): @@ -1109,7 +1109,7 @@ self.check(b, a) def test_unchanged(self): - for wrapper in util.consuming_calls: + for wrapper in fixer_util.consuming_calls: s = "s = %s(d.keys())" % wrapper self.unchanged(s) @@ -1302,7 +1302,7 @@ self.unchanged("x in range(10, 3, 9)") def test_in_consuming_context(self): - for call in util.consuming_calls: + for call in fixer_util.consuming_calls: self.unchanged("a = %s(range(10))" % call) class Test_raw_input(FixerTestCase): Modified: python/trunk/Lib/lib2to3/tests/test_util.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_util.py (original) +++ python/trunk/Lib/lib2to3/tests/test_util.py Sun Jun 15 04:31:05 2008 @@ -10,7 +10,8 @@ # Local imports from .. import pytree -from ..fixes import util +from .. import fixer_util +from ..fixer_util import Attr, Name def parse(code, strip_levels=0): @@ -25,13 +26,13 @@ class MacroTestCase(support.TestCase): def assertStr(self, node, string): if isinstance(node, (tuple, list)): - node = pytree.Node(util.syms.simple_stmt, node) + node = pytree.Node(fixer_util.syms.simple_stmt, node) self.assertEqual(str(node), string) class Test_is_tuple(support.TestCase): def is_tuple(self, string): - return util.is_tuple(parse(string, strip_levels=2)) + return fixer_util.is_tuple(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_tuple("(a, b)")) @@ -47,7 +48,7 @@ class Test_is_list(support.TestCase): def is_list(self, string): - return util.is_list(parse(string, strip_levels=2)) + return fixer_util.is_list(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_list("[]")) @@ -62,23 +63,18 @@ class Test_Attr(MacroTestCase): def test(self): - from ..fixes.util import Attr, Name call = parse("foo()", strip_levels=2) self.assertStr(Attr(Name("a"), Name("b")), "a.b") self.assertStr(Attr(call, Name("b")), "foo().b") def test_returns(self): - from ..fixes.util import Attr, Name - attr = Attr(Name("a"), Name("b")) self.assertEqual(type(attr), list) class Test_Name(MacroTestCase): def test(self): - from ..fixes.util import Name - self.assertStr(Name("a"), "a") self.assertStr(Name("foo.foo().bar"), "foo.foo().bar") self.assertStr(Name("a", prefix="b"), "ba") @@ -88,7 +84,7 @@ def _find_bind_rec(self, name, node): # Search a tree for a binding -- used to find the starting # point for these tests. - c = util.find_binding(name, node) + c = fixer_util.find_binding(name, node) if c: return c for child in node.children: c = self._find_bind_rec(name, child) @@ -98,7 +94,7 @@ node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) - return util.does_tree_import(package, name, node) + return fixer_util.does_tree_import(package, name, node) def try_with(self, string): failing_tests = (("a", "a", "from a import b"), @@ -130,7 +126,7 @@ class Test_find_binding(support.TestCase): def find_binding(self, name, string, package=None): - return util.find_binding(name, parse(string), package) + return fixer_util.find_binding(name, parse(string), package) def test_simple_assignment(self): self.failUnless(self.find_binding("a", "a = b")) From buildbot at python.org Sun Jun 15 05:00:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 03:00:54 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20080615030055.1BEC11E4012@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%202.5/builds/6 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: The web-page 'force build' button was pressed by 'aldo': testing Build Source Stamp: [branch release25-maint] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Sun Jun 15 05:35:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 03:35:46 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20080615033546.A2C921E4009@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%202.5/builds/9 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: The web-page 'force build' button was pressed by 'aldo': test Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jun 15 09:40:55 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 09:40:55 +0200 (CEST) Subject: [Python-checkins] r64288 - in python/branches/tlee-ast-optimize: Lib/lib2to3 Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/basefix.py Lib/lib2to3/fixes/fix_apply.py Lib/lib2to3/fixes/fix_basestring.py Lib/lib2to3/fixes/fix_buffer.py Lib/lib2to3/fixes/fix_callable.py Lib/lib2to3/fixes/fix_dict.py Lib/lib2to3/fixes/fix_except.py Lib/lib2to3/fixes/fix_exec.py Lib/lib2to3/fixes/fix_execfile.py Lib/lib2to3/fixes/fix_filter.py Lib/lib2to3/fixes/fix_funcattrs.py Lib/lib2to3/fixes/fix_future.py Lib/lib2to3/fixes/fix_has_key.py Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_input.py Lib/lib2to3/fixes/fix_intern.py Lib/lib2to3/fixes/fix_itertools.py Lib/lib2to3/fixes/fix_itertools_imports.py Lib/lib2to3/fixes/fix_long.py Lib/lib2to3/fixes/fix_map.py Lib/lib2to3/fixes/fix_methodattrs.py Lib/lib2to3/fixes/fix_ne.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_nonzero.py Lib/lib2to3/fixes/fix_numliterals.py Lib/lib2to3/fixes/fix_print.py Lib/lib2to3/fixes/fix_raise.py Lib/lib2to3/fixes/fix_raw_input.py Lib/lib2to3/fixes/fix_renames.py Lib/lib2to3/fixes/fix_repr.py Lib/lib2to3/fixes/fix_standarderror.py Lib/lib2to3/fixes/fix_throw.py Lib/lib2to3/fixes/fix_tuple_params.py Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/fixes/fix_unicode.py Lib/lib2to3/fixes/fix_ws_comma.py Lib/lib2to3/fixes/fix_xrange.py Lib/lib2to3/fixes/fix_xreadlines.py Lib/lib2to3/fixes/fix_zip.py Lib/lib2to3/fixes/util.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_util.py Message-ID: <20080615074055.BA5FD1E4009@bag.python.org> Author: thomas.lee Date: Sun Jun 15 09:40:53 2008 New Revision: 64288 Log: Merged revisions 64285-64287 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r64286 | benjamin.peterson | 2008-06-15 12:31:05 +1000 (Sun, 15 Jun 2008) | 49 lines Merged revisions 63661,63666,63695,63711,63729,63769,63790,63880,63886 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r63661 | georg.brandl | 2008-05-26 05:26:20 -0500 (Mon, 26 May 2008) | 2 lines Add import fixes for dbm package. ........ r63666 | georg.brandl | 2008-05-26 05:49:09 -0500 (Mon, 26 May 2008) | 2 lines Add xmlrpc package fixes. ........ r63695 | georg.brandl | 2008-05-26 10:14:33 -0500 (Mon, 26 May 2008) | 2 lines Add fixer entries for http package. ........ r63711 | benjamin.peterson | 2008-05-26 13:43:51 -0500 (Mon, 26 May 2008) | 2 lines add import mapping for test.test_support -> test.support ........ r63729 | benjamin.peterson | 2008-05-26 16:31:03 -0500 (Mon, 26 May 2008) | 2 lines mapping for commands module -> subprocess ........ r63769 | brett.cannon | 2008-05-29 00:13:13 -0500 (Thu, 29 May 2008) | 1 line Fixer for UserString.UserString over to the collections module. ........ r63790 | brett.cannon | 2008-05-29 14:13:51 -0500 (Thu, 29 May 2008) | 4 lines Add a fixer for UserList. Closes issue #2878. Thanks to Quentin Gallet-Gilles for the patch. ........ r63880 | collin.winter | 2008-06-01 18:09:38 -0500 (Sun, 01 Jun 2008) | 6 lines Move lib2to3/fixes/{basefix,util}.py down to lib2to3/. This is step 1 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. ........ r63886 | collin.winter | 2008-06-01 22:15:01 -0500 (Sun, 01 Jun 2008) | 5 lines Allow refactoring tools to specify a directory for fixer modules. This is step 2 of turning lib2to3/ into a general-purpose refactoring library, reusable by other projects. Step 1: r63880. ........ ................ Added: python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py - copied unchanged from r64286, /python/trunk/Lib/lib2to3/fixer_base.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py - copied unchanged from r64286, /python/trunk/Lib/lib2to3/fixer_util.py Removed: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/basefix.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/util.py Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_apply.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_basestring.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_buffer.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_callable.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_dict.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_except.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_exec.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_execfile.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_filter.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_funcattrs.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_future.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_has_key.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_idioms.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_import.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_input.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_intern.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools_imports.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_long.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_map.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_methodattrs.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ne.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_nonzero.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_numliterals.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_print.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raise.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_renames.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_repr.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_standarderror.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_throw.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_tuple_params.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_types.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_unicode.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ws_comma.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xrange.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xreadlines.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_zip.py python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_util.py Deleted: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/basefix.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/basefix.py Sun Jun 15 09:40:53 2008 +++ (empty file) @@ -1,188 +0,0 @@ -# Copyright 2006 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Base class for fixers (optional, but recommended).""" - -# Python imports -import logging -import itertools - -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - -# Local imports -from ..patcomp import PatternCompiler -from .. import pygram -from .util import does_tree_import - -class BaseFix(object): - - """Optional base class for fixers. - - The subclass name must be FixFooBar where FooBar is the result of - removing underscores and capitalizing the words of the fix name. - For example, the class name for a fixer named 'has_key' should be - FixHasKey. - """ - - PATTERN = None # Most subclasses should override with a string literal - pattern = None # Compiled pattern, set by compile_pattern() - options = None # Options object passed to initializer - filename = None # The filename (set by set_filename) - logger = None # A logger (set by set_filename) - numbers = itertools.count(1) # For new_name() - used_names = set() # A set of all used NAMEs - order = "post" # Does the fixer prefer pre- or post-order traversal - explicit = False # Is this ignored by refactor.py -f all? - run_order = 5 # Fixers will be sorted by run order before execution - # Lower numbers will be run first. - - # Shortcut for access to Python grammar symbols - syms = pygram.python_symbols - - def __init__(self, options, log): - """Initializer. Subclass may override. - - Args: - options: an optparse.Values instance which can be used - to inspect the command line options. - log: a list to append warnings and other messages to. - """ - self.options = options - self.log = log - self.compile_pattern() - - def compile_pattern(self): - """Compiles self.PATTERN into self.pattern. - - Subclass may override if it doesn't want to use - self.{pattern,PATTERN} in .match(). - """ - if self.PATTERN is not None: - self.pattern = PatternCompiler().compile_pattern(self.PATTERN) - - def set_filename(self, filename): - """Set the filename, and a logger derived from it. - - The main refactoring tool should call this. - """ - self.filename = filename - self.logger = logging.getLogger(filename) - - def match(self, node): - """Returns match for a given parse tree node. - - Should return a true or false object (not necessarily a bool). - It may return a non-empty dict of matching sub-nodes as - returned by a matching pattern. - - Subclass may override. - """ - results = {"node": node} - return self.pattern.match(node, results) and results - - def transform(self, node, results): - """Returns the transformation for a given parse tree node. - - Args: - node: the root of the parse tree that matched the fixer. - results: a dict mapping symbolic names to part of the match. - - Returns: - None, or a node that is a modified copy of the - argument node. The node argument may also be modified in-place to - effect the same change. - - Subclass *must* override. - """ - raise NotImplementedError() - - def parenthesize(self, node): - """Wrapper around pygram.parenthesize().""" - return pygram.parenthesize(node) - - def new_name(self, template="xxx_todo_changeme"): - """Return a string suitable for use as an identifier - - The new name is guaranteed not to conflict with other identifiers. - """ - name = template - while name in self.used_names: - name = template + str(self.numbers.next()) - self.used_names.add(name) - return name - - def log_message(self, message): - if self.first_log: - self.first_log = False - self.log.append("### In file %s ###" % self.filename) - self.log.append(message) - - def cannot_convert(self, node, reason=None): - """Warn the user that a given chunk of code is not valid Python 3, - but that it cannot be converted automatically. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - for_output = node.clone() - for_output.set_prefix("") - msg = "Line %d: could not convert: %s" - self.log_message(msg % (lineno, for_output)) - if reason: - self.log_message(reason) - - def warning(self, node, reason): - """Used for warning the user about possible uncertainty in the - translation. - - First argument is the top-level node for the code in question. - Optional second argument is why it can't be converted. - """ - lineno = node.get_lineno() - self.log_message("Line %d: %s" % (lineno, reason)) - - def start_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the start of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - self.used_names = tree.used_names - self.set_filename(filename) - self.numbers = itertools.count(1) - self.first_log = True - - def finish_tree(self, tree, filename): - """Some fixers need to maintain tree-wide state. - This method is called once, at the conclusion of tree fix-up. - - tree - the root node of the tree to be processed. - filename - the name of the file the tree came from. - """ - pass - - -class ConditionalFix(BaseFix): - """ Base class for fixers which not execute if an import is found. """ - - # This is the name of the import which, if found, will cause the test to be skipped - skip_on = None - - def start_tree(self, *args): - super(ConditionalFix, self).start_tree(*args) - self._should_skip = None - - def should_skip(self, node): - if self._should_skip is not None: - return self._should_skip - pkg = self.skip_on.split(".") - name = pkg[-1] - pkg = ".".join(pkg[:-1]) - self._should_skip = does_tree_import(pkg, name, node) - return self._should_skip Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_apply.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_apply.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_apply.py Sun Jun 15 09:40:53 2008 @@ -8,10 +8,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Call, Comma +from .. import fixer_base +from ..fixer_util import Call, Comma -class FixApply(basefix.BaseFix): +class FixApply(fixer_base.BaseFix): PATTERN = """ power< 'apply' Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_basestring.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_basestring.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_basestring.py Sun Jun 15 09:40:53 2008 @@ -2,10 +2,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBasestring(basefix.BaseFix): +class FixBasestring(fixer_base.BaseFix): PATTERN = "'basestring'" Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_buffer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_buffer.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_buffer.py Sun Jun 15 09:40:53 2008 @@ -4,11 +4,11 @@ """Fixer that changes buffer(...) into memoryview(...).""" # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixBuffer(basefix.BaseFix): +class FixBuffer(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_callable.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_callable.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_callable.py Sun Jun 15 09:40:53 2008 @@ -7,10 +7,10 @@ # Local imports from .. import pytree -from . import basefix -from .util import Call, Name, String +from .. import fixer_base +from ..fixer_util import Call, Name, String -class FixCallable(basefix.BaseFix): +class FixCallable(fixer_base.BaseFix): # Ignore callable(*args) or use of keywords. # Either could be a hint that the builtin callable() is not being used. Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_dict.py Sun Jun 15 09:40:53 2008 @@ -27,15 +27,15 @@ from .. import pytree from .. import patcomp from ..pgen2 import token -from . import basefix -from .util import Name, Call, LParen, RParen, ArgList, Dot, set -from . import util +from .. import fixer_base +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from .. import fixer_util -iter_exempt = util.consuming_calls | set(["iter"]) +iter_exempt = fixer_util.consuming_calls | set(["iter"]) -class FixDict(basefix.BaseFix): +class FixDict(fixer_base.BaseFix): PATTERN = """ power< head=any+ trailer< '.' method=('keys'|'items'|'values'| @@ -92,7 +92,7 @@ return results["func"].value in iter_exempt else: # list(d.keys()) -> list(d.keys()), etc. - return results["func"].value in util.consuming_calls + return results["func"].value in fixer_util.consuming_calls if not isiter: return False # for ... in d.iterkeys() -> for ... in d.keys(), etc. Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_except.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_except.py Sun Jun 15 09:40:53 2008 @@ -24,8 +24,8 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Assign, Attr, Name, is_tuple, is_list, reversed +from .. import fixer_base +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed def find_excepts(nodes): for i, n in enumerate(nodes): @@ -33,7 +33,7 @@ if n.children[0].value == 'except': yield (n, nodes[i+2]) -class FixExcept(basefix.BaseFix): +class FixExcept(fixer_base.BaseFix): PATTERN = """ try_stmt< 'try' ':' suite Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_exec.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_exec.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_exec.py Sun Jun 15 09:40:53 2008 @@ -11,11 +11,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Comma, Name, Call +from .. import fixer_base +from ..fixer_util import Comma, Name, Call -class FixExec(basefix.BaseFix): +class FixExec(fixer_base.BaseFix): PATTERN = """ exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_execfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_execfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_execfile.py Sun Jun 15 09:40:53 2008 @@ -8,11 +8,11 @@ """ from .. import pytree -from . import basefix -from .util import Comma, Name, Call, LParen, RParen, Dot +from .. import fixer_base +from ..fixer_util import Comma, Name, Call, LParen, RParen, Dot -class FixExecfile(basefix.BaseFix): +class FixExecfile(fixer_base.BaseFix): PATTERN = """ power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_filter.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_filter.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_filter.py Sun Jun 15 09:40:53 2008 @@ -15,10 +15,10 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context -class FixFilter(basefix.ConditionalFix): +class FixFilter(fixer_base.ConditionalFix): PATTERN = """ filter_lambda=power< Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_funcattrs.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_funcattrs.py Sun Jun 15 09:40:53 2008 @@ -2,11 +2,11 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixFuncattrs(basefix.BaseFix): +class FixFuncattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_future.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_future.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_future.py Sun Jun 15 09:40:53 2008 @@ -5,10 +5,10 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixFuture(basefix.BaseFix): +class FixFuture(fixer_base.BaseFix): PATTERN = """import_from< 'from' module_name="__future__" 'import' any >""" # This should be run last -- some things check for the import Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_has_key.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_has_key.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_has_key.py Sun Jun 15 09:40:53 2008 @@ -32,11 +32,11 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixHasKey(basefix.BaseFix): +class FixHasKey(fixer_base.BaseFix): PATTERN = """ anchor=power< Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_idioms.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_idioms.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_idioms.py Sun Jun 15 09:40:53 2008 @@ -28,13 +28,13 @@ # Author: Jacques Frechet, Collin Winter # Local imports -from . import basefix -from .util import Call, Comma, Name, Node, syms +from .. import fixer_base +from ..fixer_util import Call, Comma, Name, Node, syms CMP = "(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)" TYPE = "power< 'type' trailer< '(' x=any ')' > >" -class FixIdioms(basefix.BaseFix): +class FixIdioms(fixer_base.BaseFix): explicit = True # The user must ask for this fixer Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_import.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_import.py Sun Jun 15 09:40:53 2008 @@ -11,11 +11,11 @@ """ # Local imports -from . import basefix +from .. import fixer_base from os.path import dirname, join, exists, pathsep -from .util import FromImport +from ..fixer_util import FromImport -class FixImport(basefix.BaseFix): +class FixImport(fixer_base.BaseFix): PATTERN = """ import_from< type='from' imp=any 'import' any > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py Sun Jun 15 09:40:53 2008 @@ -8,8 +8,8 @@ # Author: Collin Winter # Local imports -from . import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set import __builtin__ builtin_names = [name for name in dir(__builtin__) if name not in ("__name__", "__doc__")] @@ -150,6 +150,123 @@ 'error', 'exit', 'exit_thread', 'get_ident', 'interrupt_main', 'stack_size', 'start_new', 'start_new_thread']), + 'whichdb': ('dbm', ['whichdb']), + 'anydbm': ('dbm', ['error', 'open']), + 'dbhash': ('dbm.bsd', ['error', 'open']), + 'dumbdbm': ('dbm.dumb', ['error', 'open', '_Database']), + 'dbm': ('dbm.ndbm', ['error', 'open', 'library']), + 'gdbm': ('dbm.gnu', ['error', 'open', 'open_flags']), + 'xmlrpclib': ('xmlrpc.client', + ['Error', 'ProtocolError', 'ResponseError', 'Fault', + 'ServerProxy', 'Boolean', 'DateTime', 'Binary', + 'ExpatParser', 'FastMarshaller', 'FastParser', + 'FastUnmarshaller', 'MultiCall', 'MultiCallIterator', + 'SlowParser', 'Marshaller', 'Unmarshaller', 'Server', + 'Transport', 'SafeTransport', 'SgmlopParser', + 'boolean', 'getparser', 'dumps', 'loads', 'escape', + 'PARSE_ERROR', 'SERVER_ERROR', 'WRAPPERS', + 'APPLICATION_ERROR', 'SYSTEM_ERROR', + 'TRANSPORT_ERROR', 'NOT_WELLFORMED_ERROR', + 'UNSUPPORTED_ENCODING', 'INVALID_ENCODING_CHAR', + 'INVALID_XMLRPC', 'METHOD_NOT_FOUND', + 'INVALID_METHOD_PARAMS', 'INTERNAL_ERROR', + 'MININT', 'MAXINT']), + 'DocXMLRPCServer': ('xmlrpc.server', + ['CGIXMLRPCRequestHandler', + 'DocCGIXMLRPCRequestHandler', + 'DocXMLRPCRequestHandler', 'DocXMLRPCServer', + 'ServerHTMLDoc', 'SimpleXMLRPCRequestHandler', + 'SimpleXMLRPCServer', 'XMLRPCDocGenerator', + 'resolve_dotted_attribute']), + 'SimpleXMLRPCServer': ('xmlrpc.server', + ['CGIXMLRPCRequestHandler', + 'Fault', 'SimpleXMLRPCDispatcher', + 'SimpleXMLRPCRequestHandler', + 'SimpleXMLRPCServer', 'SocketServer', + 'list_public_methods', + 'remove_duplicates', + 'resolve_dotted_attribute']), + 'httplib': ('http.client', + ['ACCEPTED', 'BAD_GATEWAY', 'BAD_REQUEST', + 'BadStatusLine', 'CONFLICT', 'CONTINUE', 'CREATED', + 'CannotSendHeader', 'CannotSendRequest', + 'EXPECTATION_FAILED', 'FAILED_DEPENDENCY', 'FORBIDDEN', + 'FOUND', 'FakeSocket', 'GATEWAY_TIMEOUT', 'GONE', + 'HTTP', 'HTTPConnection', 'HTTPException', + 'HTTPMessage', 'HTTPResponse', 'HTTPS', + 'HTTPSConnection', 'HTTPS_PORT', 'HTTP_PORT', + 'HTTP_VERSION_NOT_SUPPORTED', 'IM_USED', + 'INSUFFICIENT_STORAGE', 'INTERNAL_SERVER_ERROR', + 'ImproperConnectionState', 'IncompleteRead', + 'InvalidURL', 'LENGTH_REQUIRED', 'LOCKED', + 'LineAndFileWrapper', 'MAXAMOUNT', 'METHOD_NOT_ALLOWED', + 'MOVED_PERMANENTLY', 'MULTIPLE_CHOICES', 'MULTI_STATUS', + 'NON_AUTHORITATIVE_INFORMATION', 'NOT_ACCEPTABLE', + 'NOT_EXTENDED', 'NOT_FOUND', 'NOT_IMPLEMENTED', + 'NOT_MODIFIED', 'NO_CONTENT', 'NotConnected', 'OK', + 'PARTIAL_CONTENT', 'PAYMENT_REQUIRED', + 'PRECONDITION_FAILED', 'PROCESSING', + 'PROXY_AUTHENTICATION_REQUIRED', + 'REQUESTED_RANGE_NOT_SATISFIABLE', + 'REQUEST_ENTITY_TOO_LARGE', 'REQUEST_TIMEOUT', + 'REQUEST_URI_TOO_LONG', 'RESET_CONTENT', + 'ResponseNotReady', 'SEE_OTHER', 'SERVICE_UNAVAILABLE', + 'SSLFile', 'SWITCHING_PROTOCOLS', 'SharedSocket', + 'SharedSocketClient', 'StringIO', 'TEMPORARY_REDIRECT', + 'UNAUTHORIZED', 'UNPROCESSABLE_ENTITY', + 'UNSUPPORTED_MEDIA_TYPE', 'UPGRADE_REQUIRED', + 'USE_PROXY', 'UnimplementedFileMode', 'UnknownProtocol', + 'UnknownTransferEncoding', 'error', 'responses']), + 'Cookie': ('http.cookies', + ['BaseCookie', 'Cookie', 'CookieError', 'Morsel', + 'SerialCookie', 'SimpleCookie', 'SmartCookie']), + 'cookielib': ('http.cookiejar', + ['Absent', 'Cookie', 'CookieJar', 'CookiePolicy', + 'DAYS', 'DEFAULT_HTTP_PORT', 'DefaultCookiePolicy', + 'EPOCH_YEAR', 'ESCAPED_CHAR_RE', 'FileCookieJar', + 'HEADER_ESCAPE_RE', 'HEADER_JOIN_ESCAPE_RE', + 'HEADER_QUOTED_VALUE_RE', 'HEADER_TOKEN_RE', + 'HEADER_VALUE_RE', 'HTTP_PATH_SAFE', 'IPV4_RE', + 'ISO_DATE_RE', 'LOOSE_HTTP_DATE_RE', 'LWPCookieJar', + 'LoadError', 'MISSING_FILENAME_TEXT', 'MONTHS', + 'MONTHS_LOWER', 'MozillaCookieJar', 'STRICT_DATE_RE', + 'TIMEZONE_RE', 'UTC_ZONES', 'WEEKDAY_RE', + 'cut_port_re', 'deepvalues', 'domain_match', + 'eff_request_host', 'escape_path', 'http2time', + 'is_HDN', 'is_third_party', 'iso2time', + 'join_header_words', 'liberal_is_HDN', 'logger', + 'lwp_cookie_str', 'month', 'offset_from_tz_string', + 'parse_ns_headers', 'reach', 'request_host', + 'request_path', 'request_port', 'split_header_words', + 'time', 'time2isoz', 'time2netscape', 'unmatched', + 'uppercase_escaped_char', 'urllib', + 'user_domain_match', 'vals_sorted_by_key']), + 'BaseHTTPServer': ('http.server', + ['BaseHTTPRequestHandler', + 'DEFAULT_ERROR_MESSAGE', 'HTTPServer']), + 'SimpleHTTPServer': ('http.server', ['SimpleHTTPRequestHandler']), + 'CGIHTTPServer': ('http.server', + ['CGIHTTPRequestHandler', 'executable', + 'nobody_uid', 'nobody']), + 'test.test_support': ('test.support', + ["Error", "TestFailed", "TestSkipped", "ResourceDenied", + "import_module", "verbose", "use_resources", + "max_memuse", "record_original_stdout", + "get_original_stdout", "unload", "unlink", "rmtree", + "forget", "is_resource_enabled", "requires", + "find_unused_port", "bind_port", + "fcmp", "is_jython", "TESTFN", "HOST", + "FUZZ", "findfile", "verify", "vereq", "sortdict", + "check_syntax_error", "open_urlresource", "WarningMessage", + "catch_warning", "CleanImport", "EnvironmentVarGuard", + "TransientResource", "captured_output", "captured_stdout", + "TransientResource", "transient_internet", "run_with_locale", + "set_memlimit", "bigmemtest", "bigaddrspacetest", + "BasicTestRunner", "run_unittest", "run_doctest", + "threading_setup", "threading_cleanup", "reap_children"]), + 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), + 'UserString' : ('collections', ['UserString']), + 'UserList' : ('collections', ['UserList']), } @@ -180,7 +297,7 @@ yield """bare_name=%s""" % alternates(bare) -class FixImports(basefix.BaseFix): +class FixImports(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_input.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_input.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_input.py Sun Jun 15 09:40:53 2008 @@ -2,15 +2,15 @@ # Author: Andre Roberge # Local imports -from . import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name from .. import patcomp context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >") -class FixInput(basefix.BaseFix): +class FixInput(fixer_base.BaseFix): PATTERN = """ power< 'input' args=trailer< '(' [any] ')' > > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_intern.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_intern.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_intern.py Sun Jun 15 09:40:53 2008 @@ -7,11 +7,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Attr +from .. import fixer_base +from ..fixer_util import Name, Attr -class FixIntern(basefix.BaseFix): +class FixIntern(fixer_base.BaseFix): PATTERN = """ power< 'intern' Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools.py Sun Jun 15 09:40:53 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixItertools(basefix.BaseFix): +class FixItertools(fixer_base.BaseFix): it_funcs = "('imap'|'ifilter'|'izip'|'ifilterfalse')" PATTERN = """ power< it='itertools' Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools_imports.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_itertools_imports.py Sun Jun 15 09:40:53 2008 @@ -1,10 +1,10 @@ """ Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """ # Local imports -from . import basefix -from .util import BlankLine +from .. import fixer_base +from ..fixer_util import BlankLine -class FixItertoolsImports(basefix.BaseFix): +class FixItertoolsImports(fixer_base.BaseFix): PATTERN = """ import_from< 'from' 'itertools' 'import' imports=any > """ %(locals()) Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_long.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_long.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_long.py Sun Jun 15 09:40:53 2008 @@ -8,11 +8,11 @@ # Local imports from .. import pytree -from . import basefix -from .util import Name, Number +from .. import fixer_base +from ..fixer_util import Name, Number -class FixLong(basefix.BaseFix): +class FixLong(fixer_base.BaseFix): PATTERN = """ (long_type = 'long' | number = NUMBER) Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_map.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_map.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_map.py Sun Jun 15 09:40:53 2008 @@ -21,11 +21,11 @@ # Local imports from ..pgen2 import token -from . import basefix -from .util import Name, Call, ListComp, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, ListComp, in_special_context from ..pygram import python_symbols as syms -class FixMap(basefix.ConditionalFix): +class FixMap(fixer_base.ConditionalFix): PATTERN = """ map_none=power< Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_methodattrs.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_methodattrs.py Sun Jun 15 09:40:53 2008 @@ -3,8 +3,8 @@ # Author: Christian Heimes # Local imports -from . import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name MAP = { "im_func" : "__func__", @@ -12,7 +12,7 @@ "im_class" : "__self__.__class__" } -class FixMethodattrs(basefix.BaseFix): +class FixMethodattrs(fixer_base.BaseFix): PATTERN = """ power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > """ Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ne.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ne.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ne.py Sun Jun 15 09:40:53 2008 @@ -6,10 +6,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from . import basefix +from .. import fixer_base -class FixNe(basefix.BaseFix): +class FixNe(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py Sun Jun 15 09:40:53 2008 @@ -8,13 +8,13 @@ # Local imports from ..pgen2 import token from ..pygram import python_symbols as syms -from . import basefix -from .util import Name, Call, find_binding, any +from .. import fixer_base +from ..fixer_util import Name, Call, find_binding, any bind_warning = "Calls to builtin next() possibly shadowed by global binding" -class FixNext(basefix.BaseFix): +class FixNext(fixer_base.BaseFix): PATTERN = """ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_nonzero.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_nonzero.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_nonzero.py Sun Jun 15 09:40:53 2008 @@ -2,10 +2,10 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name, syms +from .. import fixer_base +from ..fixer_util import Name, syms -class FixNonzero(basefix.BaseFix): +class FixNonzero(fixer_base.BaseFix): PATTERN = """ classdef< 'class' any+ ':' suite< any* Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_numliterals.py Sun Jun 15 09:40:53 2008 @@ -5,11 +5,11 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Number, set +from .. import fixer_base +from ..fixer_util import Number, set -class FixNumliterals(basefix.BaseFix): +class FixNumliterals(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. def match(self, node): Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_print.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_print.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_print.py Sun Jun 15 09:40:53 2008 @@ -17,8 +17,8 @@ from .. import patcomp from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Comma, String, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Comma, String, is_tuple parend_expr = patcomp.compile_pattern( @@ -26,7 +26,7 @@ ) -class FixPrint(basefix.ConditionalFix): +class FixPrint(fixer_base.ConditionalFix): PATTERN = """ simple_stmt< bare='print' any > | print_stmt Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raise.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raise.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raise.py Sun Jun 15 09:40:53 2008 @@ -24,10 +24,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, Attr, ArgList, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, Attr, ArgList, is_tuple -class FixRaise(basefix.BaseFix): +class FixRaise(fixer_base.BaseFix): PATTERN = """ raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_raw_input.py Sun Jun 15 09:40:53 2008 @@ -2,10 +2,10 @@ # Author: Andre Roberge # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixRawInput(basefix.BaseFix): +class FixRawInput(fixer_base.BaseFix): PATTERN = """ power< name='raw_input' trailer< '(' [any] ')' > > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_renames.py Sun Jun 15 09:40:53 2008 @@ -7,8 +7,8 @@ # based on Collin Winter's fix_import # Local imports -from .import basefix -from .util import Name, attr_chain, any, set +from .. import fixer_base +from ..fixer_util import Name, attr_chain, any, set MAPPING = {"sys": {"maxint" : "maxsize"}, } @@ -39,7 +39,7 @@ #yield """bare_name=%s""" % alternates(bare) -class FixRenames(basefix.BaseFix): +class FixRenames(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_repr.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_repr.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_repr.py Sun Jun 15 09:40:53 2008 @@ -4,11 +4,11 @@ """Fixer that transforms `xyzzy` into repr(xyzzy).""" # Local imports -from .import basefix -from .util import Call, Name +from .. import fixer_base +from ..fixer_util import Call, Name -class FixRepr(basefix.BaseFix): +class FixRepr(fixer_base.BaseFix): PATTERN = """ atom < '`' expr=any '`' > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_standarderror.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_standarderror.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_standarderror.py Sun Jun 15 09:40:53 2008 @@ -4,11 +4,11 @@ """Fixer for StandardError -> Exception.""" # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixStandarderror(basefix.BaseFix): +class FixStandarderror(fixer_base.BaseFix): PATTERN = """ 'StandardError' Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_throw.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_throw.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_throw.py Sun Jun 15 09:40:53 2008 @@ -10,10 +10,10 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Name, Call, ArgList, Attr, is_tuple +from .. import fixer_base +from ..fixer_util import Name, Call, ArgList, Attr, is_tuple -class FixThrow(basefix.BaseFix): +class FixThrow(fixer_base.BaseFix): PATTERN = """ power< any trailer< '.' 'throw' > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_tuple_params.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_tuple_params.py Sun Jun 15 09:40:53 2008 @@ -21,14 +21,14 @@ # Local imports from .. import pytree from ..pgen2 import token -from .import basefix -from .util import Assign, Name, Newline, Number, Subscript, syms +from .. import fixer_base +from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms def is_docstring(stmt): return isinstance(stmt, pytree.Node) and \ stmt.children[0].type == token.STRING -class FixTupleParams(basefix.BaseFix): +class FixTupleParams(fixer_base.BaseFix): PATTERN = """ funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_types.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_types.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_types.py Sun Jun 15 09:40:53 2008 @@ -21,8 +21,8 @@ # Local imports from ..pgen2 import token -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name _TYPE_MAPPING = { 'BooleanType' : 'bool', @@ -51,7 +51,7 @@ _pats = ["power< 'types' trailer< '.' name='%s' > >" % t for t in _TYPE_MAPPING] -class FixTypes(basefix.BaseFix): +class FixTypes(fixer_base.BaseFix): PATTERN = '|'.join(_pats) Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_unicode.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_unicode.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_unicode.py Sun Jun 15 09:40:53 2008 @@ -4,9 +4,9 @@ import re from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixUnicode(basefix.BaseFix): +class FixUnicode(fixer_base.BaseFix): PATTERN = "STRING | NAME<'unicode' | 'unichr'>" Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ws_comma.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_ws_comma.py Sun Jun 15 09:40:53 2008 @@ -7,9 +7,9 @@ from .. import pytree from ..pgen2 import token -from .import basefix +from .. import fixer_base -class FixWsComma(basefix.BaseFix): +class FixWsComma(fixer_base.BaseFix): explicit = True # The user must ask for this fixers Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xrange.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xrange.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xrange.py Sun Jun 15 09:40:53 2008 @@ -4,12 +4,12 @@ """Fixer that changes xrange(...) into range(...).""" # Local imports -from .import basefix -from .util import Name, Call, consuming_calls +from .. import fixer_base +from ..fixer_util import Name, Call, consuming_calls from .. import patcomp -class FixXrange(basefix.BaseFix): +class FixXrange(fixer_base.BaseFix): PATTERN = """ power< (name='range'|name='xrange') trailer< '(' [any] ')' > any* > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xreadlines.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_xreadlines.py Sun Jun 15 09:40:53 2008 @@ -4,11 +4,11 @@ # Author: Collin Winter # Local imports -from .import basefix -from .util import Name +from .. import fixer_base +from ..fixer_util import Name -class FixXreadlines(basefix.BaseFix): +class FixXreadlines(fixer_base.BaseFix): PATTERN = """ power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_zip.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_zip.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_zip.py Sun Jun 15 09:40:53 2008 @@ -8,10 +8,10 @@ """ # Local imports -from . import basefix -from .util import Name, Call, in_special_context +from .. import fixer_base +from ..fixer_util import Name, Call, in_special_context -class FixZip(basefix.ConditionalFix): +class FixZip(fixer_base.ConditionalFix): PATTERN = """ power< 'zip' args=trailer< '(' [any] ')' > Deleted: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/util.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/util.py Sun Jun 15 09:40:53 2008 +++ (empty file) @@ -1,366 +0,0 @@ -"""Utility functions, node construction macros, etc.""" -# Author: Collin Winter - -# Local imports -from ..pgen2 import token -from ..pytree import Leaf, Node -from ..pygram import python_symbols as syms -from .. import patcomp - - -########################################################### -### Common node-construction "macros" -########################################################### - -def KeywordArg(keyword, value): - return Node(syms.argument, - [keyword, Leaf(token.EQUAL, '='), value]) - -def LParen(): - return Leaf(token.LPAR, "(") - -def RParen(): - return Leaf(token.RPAR, ")") - -def Assign(target, source): - """Build an assignment statement""" - if not isinstance(target, list): - target = [target] - if not isinstance(source, list): - source.set_prefix(" ") - source = [source] - - return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) - -def Name(name, prefix=None): - """Return a NAME leaf""" - return Leaf(token.NAME, name, prefix=prefix) - -def Attr(obj, attr): - """A node tuple for obj.attr""" - return [obj, Node(syms.trailer, [Dot(), attr])] - -def Comma(): - """A comma leaf""" - return Leaf(token.COMMA, ",") - -def Dot(): - """A period (.) leaf""" - return Leaf(token.DOT, ".") - -def ArgList(args, lparen=LParen(), rparen=RParen()): - """A parenthesised argument list, used by Call()""" - return Node(syms.trailer, - [lparen.clone(), - Node(syms.arglist, args), - rparen.clone()]) - -def Call(func_name, args, prefix=None): - """A function call""" - node = Node(syms.power, [func_name, ArgList(args)]) - if prefix is not None: - node.set_prefix(prefix) - return node - -def Newline(): - """A newline literal""" - return Leaf(token.NEWLINE, "\n") - -def BlankLine(): - """A blank line""" - return Leaf(token.NEWLINE, "") - -def Number(n, prefix=None): - return Leaf(token.NUMBER, n, prefix=prefix) - -def Subscript(index_node): - """A numeric or string subscript""" - return Node(syms.trailer, [Leaf(token.LBRACE, '['), - index_node, - Leaf(token.RBRACE, ']')]) - -def String(string, prefix=None): - """A string leaf""" - return Leaf(token.STRING, string, prefix=prefix) - -def ListComp(xp, fp, it, test=None): - """A list comprehension of the form [xp for fp in it if test]. - - If test is None, the "if test" part is omitted. - """ - xp.set_prefix("") - fp.set_prefix(" ") - it.set_prefix(" ") - for_leaf = Leaf(token.NAME, "for") - for_leaf.set_prefix(" ") - in_leaf = Leaf(token.NAME, "in") - in_leaf.set_prefix(" ") - inner_args = [for_leaf, fp, in_leaf, it] - if test: - test.set_prefix(" ") - if_leaf = Leaf(token.NAME, "if") - if_leaf.set_prefix(" ") - inner_args.append(Node(syms.comp_if, [if_leaf, test])) - inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) - return Node(syms.atom, - [Leaf(token.LBRACE, "["), - inner, - Leaf(token.RBRACE, "]")]) - -def FromImport(package_name, name_leafs): - """ Return an import statement in the form: - from package import name_leafs""" - # XXX: May not handle dotted imports properly (eg, package_name='foo.bar') - assert package_name == '.' or '.' not in package.name, "FromImport has "\ - "not been tested with dotted package names -- use at your own "\ - "peril!" - - for leaf in name_leafs: - # Pull the leaves out of their old tree - leaf.remove() - - children = [Leaf(token.NAME, 'from'), - Leaf(token.NAME, package_name, prefix=" "), - Leaf(token.NAME, 'import', prefix=" "), - Node(syms.import_as_names, name_leafs)] - imp = Node(syms.import_from, children) - return imp - - -########################################################### -### Determine whether a node represents a given literal -########################################################### - -def is_tuple(node): - """Does the node represent a tuple literal?""" - if isinstance(node, Node) and node.children == [LParen(), RParen()]: - return True - return (isinstance(node, Node) - and len(node.children) == 3 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[1], Node) - and isinstance(node.children[2], Leaf) - and node.children[0].value == "(" - and node.children[2].value == ")") - -def is_list(node): - """Does the node represent a list literal?""" - return (isinstance(node, Node) - and len(node.children) > 1 - and isinstance(node.children[0], Leaf) - and isinstance(node.children[-1], Leaf) - and node.children[0].value == "[" - and node.children[-1].value == "]") - -########################################################### -### Common portability code. This allows fixers to do, eg, -### "from .util import set" and forget about it. -########################################################### - -try: - any = any -except NameError: - def any(l): - for o in l: - if o: - return True - return False - -try: - set = set -except NameError: - from sets import Set as set - -try: - reversed = reversed -except NameError: - def reversed(l): - return l[::-1] - -########################################################### -### Misc -########################################################### - - -consuming_calls = set(["sorted", "list", "set", "any", "all", "tuple", "sum", - "min", "max"]) - -def attr_chain(obj, attr): - """Follow an attribute chain. - - If you have a chain of objects where a.foo -> b, b.foo-> c, etc, - use this to iterate over all objects in the chain. Iteration is - terminated by getattr(x, attr) is None. - - Args: - obj: the starting object - attr: the name of the chaining attribute - - Yields: - Each successive object in the chain. - """ - next = getattr(obj, attr) - while next: - yield next - next = getattr(next, attr) - -p0 = """for_stmt< 'for' any 'in' node=any ':' any* > - | comp_for< 'for' any 'in' node=any any* > - """ -p1 = """ -power< - ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | - 'any' | 'all' | (any* trailer< '.' 'join' >) ) - trailer< '(' node=any ')' > - any* -> -""" -p2 = """ -power< - 'sorted' - trailer< '(' arglist ')' > - any* -> -""" -pats_built = False -def in_special_context(node): - """ Returns true if node is in an environment where all that is required - of it is being itterable (ie, it doesn't matter if it returns a list - or an itterator). - See test_map_nochange in test_fixers.py for some examples and tests. - """ - global p0, p1, p2, pats_built - if not pats_built: - p1 = patcomp.compile_pattern(p1) - p0 = patcomp.compile_pattern(p0) - p2 = patcomp.compile_pattern(p2) - pats_built = True - patterns = [p0, p1, p2] - for pattern, parent in zip(patterns, attr_chain(node, "parent")): - results = {} - if pattern.match(parent, results) and results["node"] is node: - return True - return False - -########################################################### -### The following functions are to find bindings in a suite -########################################################### - -def make_suite(node): - if node.type == syms.suite: - return node - node = node.clone() - parent, node.parent = node.parent, None - suite = Node(syms.suite, [node]) - suite.parent = parent - return suite - -def does_tree_import(package, name, node): - """ Returns true if name is imported from package at the - top level of the tree which node belongs to. - To cover the case of an import like 'import foo', use - Null for the package and 'foo' for the name. """ - # Scamper up to the top level namespace - while node.type != syms.file_input: - assert node.parent, "Tree is insane! root found before "\ - "file_input node was found." - node = node.parent - - binding = find_binding(name, node, package) - return bool(binding) - -_def_syms = set([syms.classdef, syms.funcdef]) -def find_binding(name, node, package=None): - """ Returns the node which binds variable name, otherwise None. - If optional argument package is supplied, only imports will - be returned. - See test cases for examples.""" - for child in node.children: - ret = None - if child.type == syms.for_stmt: - if _find(name, child.children[1]): - return child - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type in (syms.if_stmt, syms.while_stmt): - n = find_binding(name, make_suite(child.children[-1]), package) - if n: ret = n - elif child.type == syms.try_stmt: - n = find_binding(name, make_suite(child.children[2]), package) - if n: - ret = n - else: - for i, kid in enumerate(child.children[3:]): - if kid.type == token.COLON and kid.value == ":": - # i+3 is the colon, i+4 is the suite - n = find_binding(name, make_suite(child.children[i+4]), package) - if n: ret = n - elif child.type in _def_syms and child.children[1].value == name: - ret = child - elif _is_import_binding(child, name, package): - ret = child - elif child.type == syms.simple_stmt: - ret = find_binding(name, child, package) - elif child.type == syms.expr_stmt: - if _find(name, child.children[0]): - ret = child - - if ret: - if not package: - return ret - if ret.type in (syms.import_name, syms.import_from): - return ret - return None - -_block_syms = set([syms.funcdef, syms.classdef, syms.trailer]) -def _find(name, node): - nodes = [node] - while nodes: - node = nodes.pop() - if node.type > 256 and node.type not in _block_syms: - nodes.extend(node.children) - elif node.type == token.NAME and node.value == name: - return node - return None - -def _is_import_binding(node, name, package=None): - """ Will reuturn node if node will import name, or node - will import * from package. None is returned otherwise. - See test cases for examples. """ - - if node.type == syms.import_name and not package: - imp = node.children[1] - if imp.type == syms.dotted_as_names: - for child in imp.children: - if child.type == syms.dotted_as_name: - if child.children[2].value == name: - return node - elif child.type == token.NAME and child.value == name: - return node - elif imp.type == syms.dotted_as_name: - last = imp.children[-1] - if last.type == token.NAME and last.value == name: - return node - elif imp.type == token.NAME and imp.value == name: - return node - elif node.type == syms.import_from: - # unicode(...) is used to make life easier here, because - # from a.b import parses to ['import', ['a', '.', 'b'], ...] - if package and unicode(node.children[1]).strip() != package: - return None - n = node.children[3] - if package and _find('as', n): - # See test_from_import_as for explanation - return None - elif n.type == syms.import_as_names and _find(name, n): - return node - elif n.type == syms.import_as_name: - child = n.children[2] - if child.type == token.NAME and child.value == name: - return node - elif n.type == token.NAME and n.value == name: - return node - elif package and n.type == token.STAR: - return node - return None Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py Sun Jun 15 09:40:53 2008 @@ -30,11 +30,13 @@ from . import fixes from . import pygram -def main(args=None): +def main(fixer_dir, args=None): """Main program. - Call without arguments to use sys.argv[1:] as the arguments; or - call with a list of arguments (excluding sys.argv[0]). + Args: + fixer_dir: directory where fixer modules are located. + args: optional; a list of command line arguments. If omitted, + sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). """ @@ -57,7 +59,7 @@ options, args = parser.parse_args(args) if options.list_fixes: print "Available transformations for the -f/--fix option:" - for fixname in get_all_fix_names(): + for fixname in get_all_fix_names(fixer_dir): print fixname if not args: return 0 @@ -76,7 +78,7 @@ logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO) # Initialize the refactoring tool - rt = RefactoringTool(options) + rt = RefactoringTool(fixer_dir, options) # Refactor all files and directories passed as arguments if not rt.errors: @@ -87,10 +89,10 @@ return int(bool(rt.errors)) -def get_all_fix_names(): +def get_all_fix_names(fixer_dir): """Return a sorted list of all available fix names.""" fix_names = [] - names = os.listdir(os.path.dirname(fixes.__file__)) + names = os.listdir(fixer_dir) names.sort() for name in names: if name.startswith("fix_") and name.endswith(".py"): @@ -138,11 +140,14 @@ class RefactoringTool(object): - def __init__(self, options): + def __init__(self, fixer_dir, options): """Initializer. - The argument is an optparse.Values instance. + Args: + fixer_dir: directory in which to find fixer modules. + options: an optparse.Values instance. """ + self.fixer_dir = fixer_dir self.options = options self.errors = [] self.logger = logging.getLogger("RefactoringTool") @@ -167,14 +172,15 @@ want a pre-order AST traversal, and post_order is the list that want post-order traversal. """ + fixer_pkg = ".".join(self.fixer_dir.split(os.path.sep)) pre_order_fixers = [] post_order_fixers = [] fix_names = self.options.fix if not fix_names or "all" in fix_names: - fix_names = get_all_fix_names() + fix_names = get_all_fix_names(self.fixer_dir) for fix_name in fix_names: try: - mod = __import__("lib2to3.fixes.fix_" + fix_name, {}, {}, ["*"]) + mod = __import__(fixer_pkg + ".fix_" + fix_name, {}, {}, ["*"]) except ImportError: self.log_error("Can't find transformation %s", fix_name) continue Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_all_fixers.py Sun Jun 15 09:40:53 2008 @@ -29,7 +29,7 @@ def setUp(self): options = Options(fix=["all", "idioms", "ws_comma", "buffer"], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) def test_all_project_files(self): for filepath in support.all_project_files(): Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py Sun Jun 15 09:40:53 2008 @@ -10,13 +10,14 @@ # Python imports import unittest +from itertools import chain from os.path import dirname, pathsep # Local imports from .. import pygram from .. import pytree from .. import refactor -from ..fixes import util +from .. import fixer_util class Options: @@ -29,11 +30,10 @@ class FixerTestCase(support.TestCase): def setUp(self): options = Options(fix=[self.fixer], print_function=False) - self.refactor = refactor.RefactoringTool(options) + self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) self.fixer_log = [] self.filename = "" - from itertools import chain for order in (self.refactor.pre_order.values(),\ self.refactor.post_order.values()): for fixer in chain(*order): @@ -70,7 +70,7 @@ fix = [self.fixer] fix.extend(names) options = Options(fix=fix, print_function=False) - r = refactor.RefactoringTool(options) + r = refactor.RefactoringTool("lib2to3/fixes", options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): @@ -1109,7 +1109,7 @@ self.check(b, a) def test_unchanged(self): - for wrapper in util.consuming_calls: + for wrapper in fixer_util.consuming_calls: s = "s = %s(d.keys())" % wrapper self.unchanged(s) @@ -1302,7 +1302,7 @@ self.unchanged("x in range(10, 3, 9)") def test_in_consuming_context(self): - for call in util.consuming_calls: + for call in fixer_util.consuming_calls: self.unchanged("a = %s(range(10))" % call) class Test_raw_input(FixerTestCase): Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_util.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_util.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_util.py Sun Jun 15 09:40:53 2008 @@ -10,7 +10,8 @@ # Local imports from .. import pytree -from ..fixes import util +from .. import fixer_util +from ..fixer_util import Attr, Name def parse(code, strip_levels=0): @@ -25,13 +26,13 @@ class MacroTestCase(support.TestCase): def assertStr(self, node, string): if isinstance(node, (tuple, list)): - node = pytree.Node(util.syms.simple_stmt, node) + node = pytree.Node(fixer_util.syms.simple_stmt, node) self.assertEqual(str(node), string) class Test_is_tuple(support.TestCase): def is_tuple(self, string): - return util.is_tuple(parse(string, strip_levels=2)) + return fixer_util.is_tuple(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_tuple("(a, b)")) @@ -47,7 +48,7 @@ class Test_is_list(support.TestCase): def is_list(self, string): - return util.is_list(parse(string, strip_levels=2)) + return fixer_util.is_list(parse(string, strip_levels=2)) def test_valid(self): self.failUnless(self.is_list("[]")) @@ -62,23 +63,18 @@ class Test_Attr(MacroTestCase): def test(self): - from ..fixes.util import Attr, Name call = parse("foo()", strip_levels=2) self.assertStr(Attr(Name("a"), Name("b")), "a.b") self.assertStr(Attr(call, Name("b")), "foo().b") def test_returns(self): - from ..fixes.util import Attr, Name - attr = Attr(Name("a"), Name("b")) self.assertEqual(type(attr), list) class Test_Name(MacroTestCase): def test(self): - from ..fixes.util import Name - self.assertStr(Name("a"), "a") self.assertStr(Name("foo.foo().bar"), "foo.foo().bar") self.assertStr(Name("a", prefix="b"), "ba") @@ -88,7 +84,7 @@ def _find_bind_rec(self, name, node): # Search a tree for a binding -- used to find the starting # point for these tests. - c = util.find_binding(name, node) + c = fixer_util.find_binding(name, node) if c: return c for child in node.children: c = self._find_bind_rec(name, child) @@ -98,7 +94,7 @@ node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) - return util.does_tree_import(package, name, node) + return fixer_util.does_tree_import(package, name, node) def try_with(self, string): failing_tests = (("a", "a", "from a import b"), @@ -130,7 +126,7 @@ class Test_find_binding(support.TestCase): def find_binding(self, name, string, package=None): - return util.find_binding(name, parse(string), package) + return fixer_util.find_binding(name, parse(string), package) def test_simple_assignment(self): self.failUnless(self.find_binding("a", "a = b")) From python-checkins at python.org Sun Jun 15 10:29:59 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 10:29:59 +0200 (CEST) Subject: [Python-checkins] r64289 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080615082959.345B81E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 15 10:29:58 2008 New Revision: 64289 Log: Some refactoring and more documentation in autodoc. Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sun Jun 15 10:29:58 2008 @@ -62,7 +62,7 @@ def get_module_charset(module): - """Return the charset of the given module.""" + """Return the charset of the given module (cached in _module_charsets).""" if module in _module_charsets: return _module_charsets[module] filename = __import__(module, None, None, ['']).__file__ @@ -79,66 +79,137 @@ return charset +def get_doc(what, obj, env): + """Format and yield lines of the docstring(s) for the object.""" + docstrings = [] + if getattr(obj, '__doc__', None): + docstrings.append(obj.__doc__) + # skip some lines in module docstrings if configured + if what == 'module' and env.config.automodule_skip_lines and docstrings: + docstrings[0] = '\n'.join(docstring.splitlines() + [env.config.automodule_skip_lines:]) + # for classes, what the "docstring" is can be controlled via an option + if what in ('class', 'exception'): + content = env.config.autoclass_content + if content in ('both', 'init'): + initdocstring = getattr(obj, '__init__', None).__doc__ + # for new-style classes, no __init__ means default __init__ + if initdocstring == object.__init__.__doc__: + initdocstring = None + if initdocstring: + if content == 'init': + docstrings = [initdocstring] + else: + docstrings.append('\n\n' + initdocstring) + # the default is only the class docstring + + # decode the docstrings using the module's source encoding + charset = None + module = getattr(obj, '__module__', None) + if module is not None: + charset = get_module_charset(module) + + for docstring in docstrings: + if isinstance(docstring, str) and charset: + docstring = docstring.decode(charset) + for line in prepare_docstring(docstring): + yield line + + +def format_signature(what, obj): + """Return the signature of the object, formatted for display.""" + if what not in ('class', 'method', 'function'): + return '' + remove_self = what in ('class', 'method') + if what == 'class': + # for classes, the relevant signature is the __init__ method's + obj = getattr(obj, '__init__', None) + # classes without __init__ method? + if obj is None or obj is object.__init__: + return '' + argspec = inspect.getargspec(obj) + if remove_self and argspec[0][0:1] == ['self']: + del argspec[0][0] + return inspect.formatargspec(*argspec) + + def generate_rst(what, name, members, inherited, undoc, add_content, document, lineno, indent='', filename_set=None, check_module=False): env = document.settings.env - # parse the definition + # first, parse the definition -- auto directives for classes and functions + # can contain a signature which is then used instead of an autogenerated one try: - mod, obj, signature = py_sig_re.match(name).groups() + path, base, signature = py_sig_re.match(name).groups() except: warning = document.reporter.warning( 'invalid signature for auto%s (%r)' % (what, name), line=lineno) return [warning], ViewList() - basename = (mod or '') + obj - if mod: - mod = mod.rstrip('.') + # fullname is the fully qualified name, base the name after the last dot + fullname = (path or '') + base + # path is the name up to the last dot + path = path and path.rstrip('.') warnings = [] - # find out what to import + # determine what module to import -- mod is the module name, objpath the + # path of names to get via getattr + mod = None if what == 'module': - mod = basename + mod = fullname if signature: warnings.append(document.reporter.warning( 'ignoring arguments for automodule %s' % mod, line=lineno)) objpath = [] elif what in ('class', 'exception', 'function'): - if not mod and hasattr(env, 'autodoc_current_module'): - mod = env.autodoc_current_module - if not mod: - mod = env.currmodule - objpath = [obj] + if path: + mod = path + else: + # if documenting a toplevel object without explicit module, it can + # be contained in another auto directive ... + if hasattr(env, 'autodoc_current_module'): + mod = env.autodoc_current_module + # ... or in the scope of a module directive + if not mod: + mod = env.currmodule + objpath = [base] else: - mod_cls = mod - if not mod_cls and hasattr(env, 'autodoc_current_class'): - mod_cls = env.autodoc_current_class - if not mod_cls: - mod_cls = env.currclass + if path: + mod_cls = path + else: + # if documenting a class-level object without path, there must be a + # current class, either from a parent auto directive ... + if hasattr(env, 'autodoc_current_class'): + mod_cls = env.autodoc_current_class + # ... or from a class directive + if not mod_cls: + mod_cls = env.currclass mod, cls = rpartition(mod_cls, '.') + # if the module name is still missing, get it like above if not mod and hasattr(env, 'autodoc_current_module'): mod = env.autodoc_current_module if not mod: mod = env.currmodule - objpath = [cls, obj] - - qualname = '.'.join(objpath) or mod - result = ViewList() - docstrings = [] - - # make sure that the view list starts with an empty line. This is - # necessary for some situations where another directive preprocesses - # rst and no starting newline is present - result.append('', '') + objpath = [cls, base] + # by this time, a module *must* be determined if mod is None: warnings.append(document.reporter.warning( 'don\'t know which module to import for autodocumenting %r ' '(try placing a "module" or "currentmodule" directive in the document, ' - 'or giving an explicit module name)' % basename, line=lineno)) + 'or giving an explicit module name)' % fullname, line=lineno)) return warnings, result - # import module and get docstring of object to document + # the name to put into the generated directive -- doesn't contain the module + name_in_directive = '.'.join(objpath) or mod + + # make sure that the view list starts with an empty line. This is + # necessary for some situations where another directive preprocesses + # reST and no starting newline is present + result = ViewList() + result.append('', '') + + # now, import the module and get docstring(s) of object to document try: todoc = module = __import__(mod, None, None, ['foo']) if filename_set is not None and hasattr(module, '__file__') and module.__file__: @@ -148,42 +219,34 @@ filename_set.add(modfile) for part in objpath: todoc = getattr(todoc, part) - if check_module: - # only checking __module__ for members not given explicitly - if hasattr(todoc, '__module__'): - if todoc.__module__ != mod: - return warnings, result - if getattr(todoc, '__doc__', None): - docstrings.append(todoc.__doc__) except (ImportError, AttributeError): warnings.append(document.reporter.warning( 'autodoc can\'t import/find %s %r, check your spelling ' - 'and sys.path' % (what, str(basename)), line=lineno)) + 'and sys.path' % (what, str(fullname)), line=lineno)) return warnings, result - # add directive header + # check __module__ of object if wanted (for members not given explicitly) + if check_module: + if hasattr(todoc, '__module__'): + if todoc.__module__ != mod: + return warnings, result + + # format the object's signature, if any if signature is not None: + # signature given explicitly -- the parentheses were stripped by the regex args = '(%s)' % signature else: try: - if what == 'class': - args = inspect.formatargspec(*inspect.getargspec(todoc.__init__)) - if args[1:7] == 'self, ': - args = '(' + args[7:] - elif args == '(self)': - args = '()' - elif what in ('function', 'method'): - args = inspect.formatargspec(*inspect.getargspec(todoc)) - if what == 'method': - if args[1:7] == 'self, ': - args = '(' + args[7:] - elif args == '(self)': - args = '()' - else: - args = '' - except Exception: + args = format_signature(what, todoc) + except Exception, err: + warnings.append(document.reporter.warning( + 'error while formatting signature for %s: %s' % + (fullname, err), line=lineno)) args = '' - result.append(indent + '.. %s:: %s%s' % (what, qualname, args), '') + + # now, create the directive header + result.append(indent + '.. %s:: %s%s' % (what, name_in_directive, args), + '') if what != 'module': # Be explicit about the module, this is necessary since .. class:: doesn't # support a prepended module name @@ -194,43 +257,16 @@ if what != 'module': indent += ' ' - # skip some lines in module docstrings if configured - if what == 'module' and env.config.automodule_skip_lines and docstrings[0]: - docstrings[0] = '\n'.join(docstring.splitlines() - [env.config.automodule_skip_lines:]) - - # for classes, what the "docstring" is can be controlled via an option - if what in ('class', 'exception'): - content = env.config.autoclass_content - if content in ('both', 'init'): - initdocstring = getattr(todoc, '__init__', None).__doc__ - # for new-style classes, no __init__ means default __init__ - if initdocstring == object.__init__.__doc__: - initdocstring = None - if initdocstring: - if content == 'init': - docstrings = [initdocstring] - else: - docstrings.append('\n\n' + initdocstring) - # the default is only the class docstring - - # get the encoding of the docstring - module = getattr(todoc, '__module__', None) - if module is not None: - charset = get_module_charset(module) - docstrings = [isinstance(d, str) and d.decode(charset) or d for d in docstrings] - - # add docstring content - for docstring in docstrings: - docstring = prepare_docstring(docstring) - for i, line in enumerate(docstring): - result.append(indent + line, '' % basename, i) + # add content from docstrings + for i, line in enumerate(get_doc(what, todoc, env)): + result.append(indent + line, '' % fullname, i) # add source content, if present if add_content: for line, src in zip(add_content.data, add_content.items): result.append(indent + line, src[0], src[1]) + # document members? if not members or what in ('function', 'method', 'attribute'): return warnings, result @@ -243,6 +279,7 @@ _all = members == ['__all__'] members_check_module = False if _all: + # unqualified :members: given if what == 'module': # for implicit module members, check __module__ to avoid documenting # imported objects @@ -258,8 +295,10 @@ else: all_members = [(mname, getattr(todoc, mname)) for mname in members] for (membername, member) in all_members: + # ignore members whose name starts with _ by default if _all and membername.startswith('_'): continue + # ignore undocumented members if :undoc-members: is not given doc = getattr(member, '__doc__', None) if not undoc and not doc: continue @@ -283,7 +322,7 @@ else: # XXX: todo -- attribute docs continue - full_membername = basename + '.' + membername + full_membername = fullname + '.' + membername subwarn, subres = generate_rst(memberwhat, full_membername, ['__all__'], inherited, undoc, None, document, lineno, indent, check_module=members_check_module) @@ -296,10 +335,9 @@ return warnings, result - def _auto_directive(dirname, arguments, options, content, lineno, content_offset, block_text, state, state_machine): - what = dirname[4:] + what = dirname[4:] # strip "auto" name = arguments[0] members = options.get('members', []) inherited = 'inherited-members' in options From python-checkins at python.org Sun Jun 15 10:48:06 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 10:48:06 +0200 (CEST) Subject: [Python-checkins] r64290 - in doctools/trunk: CHANGES doc/config.rst sphinx/builder.py sphinx/config.py sphinx/directives/desc.py sphinx/quickstart.py sphinx/templates/layout.html Message-ID: <20080615084806.C9EF01E4009@bag.python.org> Author: georg.brandl Date: Sun Jun 15 10:48:06 2008 New Revision: 64290 Log: Add html_favicon config value. Modified: doctools/trunk/CHANGES doctools/trunk/doc/config.rst doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/config.py doctools/trunk/sphinx/directives/desc.py doctools/trunk/sphinx/quickstart.py doctools/trunk/sphinx/templates/layout.html Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sun Jun 15 10:48:06 2008 @@ -4,42 +4,53 @@ New features added ------------------ -* A new config value, `html_file_suffix`, can be used to set the HTML file - suffix to e.g. ``.xhtml``. +* ``tocdepth`` can be given as a file-wide metadata entry, and + specifies the maximum depth of a TOC of this file. -* The `autodoc` extension accepts signatures for functions, methods and - classes now that override the signature got via introspection from - Python code. +* HTML output: -* The new config value `html_use_index` can be used to switch index - generation in HTML documents off. + - The "previous" and "next" links have a more logical structure, so + that by following "next" links you can traverse the entire TOC + tree. -* The new `exclude_trees` config option can be used to exclude whole - subtrees from the search for source files. + - The new event `html-page-context` can be used to include custom + values into the context used when rendering an HTML template. -* The directories in the `html_static_path` can now contain subdirectories. + - Document metadata is now in the default template context, under + the name `metadata`. -* The new config value `html_short_title` can be used to set a shorter - title for the documentation which is then used in the navigation bar. + - The new config value `html_favicon` can be used to set a favicon + for the HTML output. Thanks to Sebastian Wiesner. -* The new config value `html_show_sphinx` can be used to control whether - a link to Sphinx is added to the HTML footer. + - The new config value `html_use_index` can be used to switch index + generation in HTML documents off. -* Defaults for configuration values can now be callables, which allows - dynamic defaults. + - The new config value `html_short_title` can be used to set a + shorter title for the documentation which is then used in the + navigation bar. + + - The new config value `html_show_sphinx` can be used to control + whether a link to Sphinx is added to the HTML footer. -* The new ``html-page-context`` event can be used to include custom values - into the context used when rendering an HTML template. + - The new config value `html_file_suffix` can be used to set the + HTML file suffix to e.g. ``.xhtml``. -* Add document metadata to the values in the default template context. + - The directories in the `html_static_path` can now contain + subdirectories. -* Let the "previous" and "next" to more logical documents, so that by - following "next" links you can traverse the entire TOC tree. +* The new config value `exclude_trees` can be used to exclude whole + subtrees from the search for source files. + +* Defaults for configuration values can now be callables, which allows + dynamic defaults. -* Added TextBuilder to create plain-text output. +* The new TextBuilder creates plain-text output. -* ``tocdepth`` can be given as a file-wide metadata entry, and specifies - the maximum depth of a TOC of this file. +* Extensions: + + - The `autodoc` extension accepts signatures for functions, methods + and classes now that override the signature got via introspection + from Python code. Bugs fixed ---------- Modified: doctools/trunk/doc/config.rst ============================================================================== --- doctools/trunk/doc/config.rst (original) +++ doctools/trunk/doc/config.rst Sun Jun 15 10:48:06 2008 @@ -202,6 +202,15 @@ below) that is the logo of the docs. It is placed at the top of the sidebar; its width should therefore not exceed 200 pixels. Default: ``None``. +.. confval:: html_favicon + + If given, this must be the name of an image file (within the static path, see + below) that is the favicon of the docs. Modern browsers use this as icon for + tabs, windows and bookmarks. It should be a Windows-style icon file + (``.ico``), which is 16x16 or 32x32 pixels large. Default: ``None``. + + .. versionadded:: 0.4 + .. confval:: html_static_path A list of paths that contain custom static files (such as style sheets or Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sun Jun 15 10:48:06 2008 @@ -321,6 +321,11 @@ logo = self.config.html_logo and \ path.basename(self.config.html_logo) or '' + favicon = self.config.html_favicon and \ + path.basename(self.config.html_favicon) or '' + if os.path.splitext(favicon)[1] != '.ico': + self.warn('html_favicon is not an .ico file') + if not isinstance(self.config.html_use_opensearch, basestring): self.warn('html_use_opensearch config value must now be a string') @@ -342,6 +347,7 @@ builder = self.name, parents = [], logo = logo, + favicon = favicon, len = len, # the built-in ) Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Sun Jun 15 10:48:06 2008 @@ -50,6 +50,7 @@ html_short_title = (lambda self: self.html_title, False), html_style = ('default.css', False), html_logo = (None, False), + html_favicon = (None, False), html_static_path = ([], False), html_last_updated_fmt = ('%b %d, %Y', False), html_use_smartypants = (True, False), Modified: doctools/trunk/sphinx/directives/desc.py ============================================================================== --- doctools/trunk/sphinx/directives/desc.py (original) +++ doctools/trunk/sphinx/directives/desc.py Sun Jun 15 10:48:06 2008 @@ -445,3 +445,6 @@ target_directive.content = 0 target_directive.arguments = (1, 0, 1) + +# note, the target directive is not registered here, it is used by the application +# when registering additional xref types Modified: doctools/trunk/sphinx/quickstart.py ============================================================================== --- doctools/trunk/sphinx/quickstart.py (original) +++ doctools/trunk/sphinx/quickstart.py Sun Jun 15 10:48:06 2008 @@ -112,6 +112,11 @@ # the sidebar. #html_logo = None +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". Modified: doctools/trunk/sphinx/templates/layout.html ============================================================================== --- doctools/trunk/sphinx/templates/layout.html (original) +++ doctools/trunk/sphinx/templates/layout.html Sun Jun 15 10:48:06 2008 @@ -119,12 +119,15 @@ - {%- endif %} - {%- if use_opensearch and builder != 'htmlhelp' %} + {%- if use_opensearch %} {%- endif %} + {%- if favicon %} + + {%- endif %} + {%- endif %} {%- block rellinks %} {%- if hasdoc('about') %} From python-checkins at python.org Sun Jun 15 14:00:59 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 14:00:59 +0200 (CEST) Subject: [Python-checkins] r64291 - in python/branches/tlee-ast-optimize: Lib/test/test_optimizer.py Python/optimize.c Message-ID: <20080615120059.4B4BE1E4029@bag.python.org> Author: thomas.lee Date: Sun Jun 15 14:00:58 2008 New Revision: 64291 Log: Simplify jumps to returns from if statements. Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py Sun Jun 15 14:00:58 2008 @@ -222,7 +222,24 @@ self.assertEqual(tuple, ast.body[0].value.value.__class__) self.assertEqual(obj, ast.body[0].value.value) - def test_folding_of_constant_list_in_for_loop(self): + def test_skip_unreachable_for_loop(self): + code = """ +for i in []: + print i +""" + ast = self.compileast(code) + self.assertEqual(_ast.Pass, ast.body[0].__class__) + + def test_skip_unreachable_while_loop(self): + code = """ +while 0: + print 'foo' +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Pass, ast.body[0].__class__) + + def test_fold_constant_list_in_for_loop(self): code = """ for i in [1, 2, 3]: print i @@ -242,6 +259,20 @@ self.assertEqual(_ast.Const, ast.body[0].value.__class__) self.assertEqual(obj, ast.body[0].value.value) + def test_jumps_to_returns_are_simplified(self): + code = """ +def foo(x): + if x: + y = 1 + else: + y = 0 + return y +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) + self.assertEqual('y', ast.body[0].body[0].body[1].value.id) + def test_main(): test_support.run_unittest(AstOptimizerTest) Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 15 14:00:58 2008 @@ -152,6 +152,34 @@ } /** + */ +static asdl_seq* +_asdl_seq_append(asdl_seq* seq1, int n1, asdl_seq* seq2, int n2, + PyArena* arena) +{ + asdl_seq* new; + int newlen, i; + int len1, len2; + + /* XXX: check this calculation */ + len1 = asdl_seq_LEN(seq1) - n1; + len2 = asdl_seq_LEN(seq2) - n2; + newlen = len1 + len2; + + new = asdl_seq_new(newlen, arena); + if (new == NULL) + return NULL; + + for (i = 0; i < len1; i++) + asdl_seq_SET(new, i, asdl_seq_GET(seq1, n1 + i)); + + for (i = 0; i < len2; i++) + asdl_seq_SET(new, len1 + i, asdl_seq_GET(seq2, n2 + i)); + + return new; +} + +/** * Replace an AST node at position `n' with the node(s) in `replacement'. */ static asdl_seq* @@ -203,50 +231,150 @@ return seq; } +#define LAST_IN_SEQ(seq) (asdl_seq_LEN((seq)) - 1) + /** - * Optimize a sequence of statements. + * Eliminate code that we can determine will never be executed. */ static int -optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +_eliminate_unreachable_code(asdl_seq** seq_ptr, int n, PySTEntryObject* ste, + PyArena* arena) { - int n; asdl_seq* seq = *seq_ptr; - for (n = 0; n < asdl_seq_LEN(seq); n++) { - stmt_ty stmt = asdl_seq_GET(seq, n); - if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) - return 0; + stmt_ty stmt = asdl_seq_GET(seq, n); - if (stmt->kind == If_kind) { - PyObject* test = _expr_constant_value(stmt->v.If.test); - /* eliminate branches that can never be reached */ - if (test != NULL) { - if (PyObject_IsTrue(test)) - seq = _asdl_seq_replace(seq, n, stmt->v.If.body, arena); + /* eliminate unreachable branches in an "if" statement? */ + if (stmt->kind == If_kind) { + PyObject* test = _expr_constant_value(stmt->v.If.test); + if (test != NULL) { + if (PyObject_IsTrue(test)) + seq = _asdl_seq_replace(seq, n, stmt->v.If.body, arena); + else { + if (stmt->v.If.orelse == NULL) { + /* no "else:" body: use a Pass() */ + seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, + stmt->col_offset, arena); + } else { - if (stmt->v.If.orelse == NULL) { - /* no "else:" body: use a Pass() */ - seq = _asdl_seq_replace_with_pass(seq, n, - stmt->lineno, stmt->col_offset, arena); - } - else { - seq = _asdl_seq_replace(seq, n, stmt->v.If.orelse, - arena); - } + seq = _asdl_seq_replace(seq, n, stmt->v.If.orelse, arena); } - if (seq == NULL) - return 0; - *seq_ptr = seq; } + if (seq == NULL) + return 0; + *seq_ptr = seq; + } + } + /* eliminate unreachable while loops? */ + else if (stmt->kind == While_kind) { + PyObject* test = _expr_constant_value(stmt->v.While.test); + if (test != NULL) { + if (!PyObject_IsTrue(test)) { + /* XXX: what about orelse? */ + seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, + stmt->col_offset, arena); + } + if (seq == NULL) + return 0; + *seq_ptr = seq; } - else if (stmt->kind == Return_kind && n < (asdl_seq_LEN(seq) - 1)) { - /* eliminate all nodes after a return */ - seq = _asdl_seq_replace_with_pass(seq, n + 1, - stmt->lineno, stmt->col_offset, arena); + } + /* eliminate unreachable for loops? */ + else if (stmt->kind == For_kind) { + PyObject* iter = _expr_constant_value(stmt->v.For.iter); + if (iter != NULL) { + if (PyObject_Size(iter) == 0) { + /* XXX: what about orelse? */ + seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, + stmt->col_offset, arena); + } if (seq == NULL) return 0; *seq_ptr = seq; } } + /* eliminate all code after a "return" statement */ + else if (stmt->kind == Return_kind && n < LAST_IN_SEQ(seq)) { + /* eliminate all nodes after a return */ + seq = _asdl_seq_replace_with_pass(seq, n + 1, + stmt->lineno, stmt->col_offset, arena); + if (seq == NULL) + return 0; + *seq_ptr = seq; + } + + return 1; +} + +static asdl_seq* +_asdl_seq_append_return(asdl_seq* seq, expr_ty value, PyArena* arena) +{ + stmt_ty ret; + stmt_ty last; + asdl_seq* retseq = asdl_seq_new(1, arena); + if (retseq == NULL) + return NULL; + last = asdl_seq_GET(seq, asdl_seq_LEN(seq)-1); + ret = Return(value, last->lineno, last->col_offset, arena); + if (ret == NULL) + return NULL; + asdl_seq_SET(retseq, 0, ret); + return _asdl_seq_append(seq, 0, retseq, 0, arena); +} + +/** + * Simplify any branches that converge on a "return" statement such that + * they immediately return rather than jump. + */ +static int +_simplify_jumps_to_return(asdl_seq* seq, PySTEntryObject* ste, + PyArena* arena) +{ + int n, len; + + len = asdl_seq_LEN(seq); + + for (n = 0; n < len - 1; n++) { + stmt_ty stmt = asdl_seq_GET(seq, n); + stmt_ty next = asdl_seq_GET(seq, n+1); + + if (next->kind == Return_kind) { + /* if the else body is not present, there will be no jump */ + if (stmt->kind == If_kind && stmt->v.If.orelse != NULL) { + stmt_ty inner = asdl_seq_GET(stmt->v.If.body, + asdl_seq_LEN(stmt->v.If.body)-1); + + if (inner->kind != Return_kind) { + stmt->v.If.body = + _asdl_seq_append_return(stmt->v.If.body, + next->v.Return.value, arena); + + if (stmt->v.If.body == NULL) + return 0; + } + } + } + } + + return 1; +} + +/** + * Optimize a sequence of statements. + */ +static int +optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +{ + int n; + asdl_seq* seq = *seq_ptr; + for (n = 0; n < asdl_seq_LEN(seq); n++) { + if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) + return 0; + if (!_eliminate_unreachable_code(seq_ptr, n, ste, arena)) + return 0; + if (ste->ste_type == FunctionBlock) + if (!_simplify_jumps_to_return(*seq_ptr, ste, arena)) + return 0; + } return 1; } @@ -972,11 +1100,9 @@ } static int -optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +_optimize_for_iter(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.target, ste, arena)) - return 0; if (!optimize_expr(&stmt->v.For.iter, ste, arena)) return 0; /* if the object we're iterating over is a list of constants, @@ -997,6 +1123,17 @@ return 0; } } + return 1; +} + +static int +optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +{ + stmt_ty stmt = *stmt_ptr; + if (!optimize_expr(&stmt->v.For.target, ste, arena)) + return 0; + if (!_optimize_for_iter(&stmt, ste, arena)) + return 0; if (!optimize_stmt_seq(&stmt->v.For.body, ste, arena)) return 0; if (!optimize_stmt_seq(&stmt->v.For.orelse, ste, arena)) From python-checkins at python.org Sun Jun 15 15:14:50 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 15:14:50 +0200 (CEST) Subject: [Python-checkins] r64292 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080615131450.0E2CF1E400A@bag.python.org> Author: thomas.lee Date: Sun Jun 15 15:14:49 2008 New Revision: 64292 Log: While.orelse and For.orelse were not being used in place of their respective bodies in unreachable loops. Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 15 15:14:49 2008 @@ -269,13 +269,17 @@ PyObject* test = _expr_constant_value(stmt->v.While.test); if (test != NULL) { if (!PyObject_IsTrue(test)) { - /* XXX: what about orelse? */ - seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, - stmt->col_offset, arena); + if (stmt->v.While.orelse != NULL) { + seq = _asdl_seq_replace(seq, n, stmt->v.While.orelse, + arena); + } + else { + seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, + stmt->col_offset, arena); + } + if (seq == NULL) + return 0; } - if (seq == NULL) - return 0; - *seq_ptr = seq; } } /* eliminate unreachable for loops? */ @@ -283,13 +287,16 @@ PyObject* iter = _expr_constant_value(stmt->v.For.iter); if (iter != NULL) { if (PyObject_Size(iter) == 0) { - /* XXX: what about orelse? */ - seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, - stmt->col_offset, arena); + if (stmt->v.For.orelse != NULL) { + seq = _asdl_seq_replace(seq, n, stmt->v.For.orelse, arena); + } + else { + seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, + stmt->col_offset, arena); + } + if (seq == NULL) + return 0; } - if (seq == NULL) - return 0; - *seq_ptr = seq; } } /* eliminate all code after a "return" statement */ @@ -299,9 +306,10 @@ stmt->lineno, stmt->col_offset, arena); if (seq == NULL) return 0; - *seq_ptr = seq; } + *seq_ptr = seq; + return 1; } From python-checkins at python.org Sun Jun 15 15:18:49 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 15:18:49 +0200 (CEST) Subject: [Python-checkins] r64293 - python/branches/tlee-ast-optimize/Lib/test/test_grammar.py Message-ID: <20080615131849.9AB481E400A@bag.python.org> Author: thomas.lee Date: Sun Jun 15 15:18:49 2008 New Revision: 64293 Log: Added code to testFor to check potential optimizations of empty for loops still call the 'else' body. Modified: python/branches/tlee-ast-optimize/Lib/test/test_grammar.py Modified: python/branches/tlee-ast-optimize/Lib/test/test_grammar.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_grammar.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_grammar.py Sun Jun 15 15:18:49 2008 @@ -612,6 +612,16 @@ result.append(x) self.assertEqual(result, [1, 2, 3]) + # + # Ensure that the else: clause is executed for an empty sequence + # + n = 0 + for x in []: + n = 1 + else: + n = 2 + self.assertEqual(2, n) + def testTry(self): ### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] ### | 'try' ':' suite 'finally' ':' suite From python-checkins at python.org Sun Jun 15 15:41:12 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 15:41:12 +0200 (CEST) Subject: [Python-checkins] r64294 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080615134112.7CED61E4016@bag.python.org> Author: thomas.lee Date: Sun Jun 15 15:41:12 2008 New Revision: 64294 Log: Only call optimize_name for Name nodes with a Load context. Fixes test_xmlrpc Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 15 15:41:12 2008 @@ -1007,7 +1007,12 @@ } case Name_kind: { - return optimize_name(expr_ptr, ste, arena); + /* we probably only want to optimize loads ... storing values + * in a Const makes no sense! + */ + if (expr->v.Name.ctx == Load) + return optimize_name(expr_ptr, ste, arena); + /* fall through */ } case Num_kind: case Str_kind: From python-checkins at python.org Sun Jun 15 16:31:17 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 16:31:17 +0200 (CEST) Subject: [Python-checkins] r64295 - in doctools/trunk: CHANGES TODO doc/rest.rst sphinx/builder.py sphinx/environment.py sphinx/htmlwriter.py sphinx/latexwriter.py Message-ID: <20080615143117.4A2491E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 16:31:16 2008 New Revision: 64295 Log: Add image format handling. Modified: doctools/trunk/CHANGES doctools/trunk/TODO doctools/trunk/doc/rest.rst doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/htmlwriter.py doctools/trunk/sphinx/latexwriter.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sun Jun 15 16:31:16 2008 @@ -38,6 +38,9 @@ - The directories in the `html_static_path` can now contain subdirectories. +* The image directive now supports specifying the extension as ``.*``, + which makes the builder select the one that matches best. + * The new config value `exclude_trees` can be used to exclude whole subtrees from the search for source files. Modified: doctools/trunk/TODO ============================================================================== --- doctools/trunk/TODO (original) +++ doctools/trunk/TODO Sun Jun 15 16:31:16 2008 @@ -13,12 +13,3 @@ - "often used" combo box in sidebar - source file cross-references? -Web App -******* - -- fix /download - -- discuss and debug comments system -- prepare for databases other than sqlite for comments -- add search via Xapian or Nucular (Python indexer - nucular.sf.net) -- optionally have a contents tree view in the sidebar (AJAX based)? Modified: doctools/trunk/doc/rest.rst ============================================================================== --- doctools/trunk/doc/rest.rst (original) +++ doctools/trunk/doc/rest.rst Sun Jun 15 16:31:16 2008 @@ -72,7 +72,7 @@ A. First item B. Second item - + Nested lists are possible, but be aware that they must be separated from the parent list items by blank lines:: @@ -214,12 +214,27 @@ reST supports an image directive, used like so:: - .. image:: filename + .. image:: gnu.png (options) -When used within Sphinx, the ``filename`` given must be relative to the source -file, and Sphinx will automatically copy image files over to a subdirectory of -the output directory on building. +When used within Sphinx, the file name given (here ``gnu.png``) must be relative +to the source file, and Sphinx will automatically copy image files over to a +subdirectory of the output directory on building (e.g. the ``_static`` directory +for HTML output.) + +Sphinx extends the standard docutils behavior by allowing an asterisk for the +extension:: + + .. image:: gnu.* + +Sphinx then searches for all images matching the provided pattern and determines +their type. Each builder then chooses the best image out of these candidates. +For instance, if the file name ``gnu.*`` was given and two files :file:`gnu.pdf` +and :file:`gnu.png` existed in the source tree, the LaTeX builder would choose +the former, while the HTML builder would prefer the latter. + +.. versionchanged:: 0.4 + Added the support for file names ending in an asterisk. Footnotes Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sun Jun 15 16:31:16 2008 @@ -62,6 +62,9 @@ self.info = app.info self.config = app.config + # images that need to be copied over (source -> dest) + self.images = {} + # if None, this is set in load_env() self.env = env self.freshenv = freshenv @@ -118,6 +121,28 @@ if l == 0: self.info() + supported_image_types = [] + + def post_process_images(self, doctree): + """ + Pick the best candidate for all image URIs. + """ + for node in doctree.traverse(nodes.image): + uri = node['candidates'].get('*', None) + if not uri: + for imgtype in self.supported_image_types: + uri = node['candidates'].get(imgtype, None) + if uri: + node['uri'] = uri + break + else: + self.warn('%s:%s: %s' % + (node.source, node.lineno, + 'No matching candidate for uri: %(uri)s' % node)) + continue + if uri in self.env.images: + self.images[uri] = self.env.images[uri][1] + # build methods def load_env(self): @@ -271,6 +296,8 @@ copysource = True out_suffix = '.html' indexer_format = 'json' + supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', + 'image/jpeg'] def init(self): """Load templates.""" @@ -323,7 +350,7 @@ favicon = self.config.html_favicon and \ path.basename(self.config.html_favicon) or '' - if os.path.splitext(favicon)[1] != '.ico': + if favicon and os.path.splitext(favicon)[1] != '.ico': self.warn('html_favicon is not an .ico file') if not isinstance(self.config.html_use_opensearch, basestring): @@ -407,6 +434,7 @@ ) def write_doc(self, docname, doctree): + self.post_process_images(doctree) destination = StringOutput(encoding='utf-8') doctree.settings = self.docsettings @@ -504,10 +532,10 @@ self.info() # copy image files - if self.env.images: + if self.images: self.info(bold('copying images...'), nonl=1) ensuredir(path.join(self.outdir, '_images')) - for src, (_, dest) in self.env.images.iteritems(): + for src, dest in self.images.iteritems(): self.info(' '+src, nonl=1) shutil.copyfile(path.join(self.srcdir, src), path.join(self.outdir, '_images', dest)) @@ -636,6 +664,8 @@ name = 'pickle' out_suffix = '.fpickle' indexer_format = 'pickle' + supported_image_types = ('image/svg+xml', 'image/png', 'image/gif', + 'image/jpeg') def init(self): self.init_translator_class() @@ -711,6 +741,7 @@ # don't copy the reST source copysource = False + supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] def init(self): StandaloneHTMLBuilder.init(self) @@ -726,6 +757,8 @@ Builds LaTeX output to create PDF. """ name = 'latex' + supported_image_types = ['application/pdf', 'image/png', 'image/gif', + 'image/jpeg'] def init(self): self.docnames = [] @@ -787,6 +820,7 @@ self.info("processing " + targetname + "... ", nonl=1) doctree = self.assemble_doctree(docname, toctree_only, appendices=(docclass == 'manual') and appendices or []) + self.post_process_images(doctree) self.info("writing... ", nonl=1) doctree.settings = docsettings doctree.settings.author = author @@ -852,9 +886,9 @@ def finish(self): # copy image files - if self.env.images: + if self.images: self.info(bold('copying images...'), nonl=1) - for src, (_, dest) in self.env.images.iteritems(): + for src, dest in self.images.iteritems(): self.info(' '+src, nonl=1) shutil.copyfile(path.join(self.srcdir, src), path.join(self.outdir, dest)) Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Sun Jun 15 16:31:16 2008 @@ -14,9 +14,11 @@ import time import heapq import types +import imghdr import difflib import cPickle as pickle from os import path +from glob import glob from string import uppercase from itertools import izip, groupby try: @@ -511,25 +513,43 @@ existing_names = set(v[1] for v in self.images.itervalues()) docdir = path.dirname(self.doc2path(docname, base=None)) for node in doctree.traverse(nodes.image): + # Map the mimetype to the corresponding image. The writer may + # choose the best image from these candidates. The special key * is + # set if there is only single candiate to be used by a writer. + node['candidates'] = candidates = {} imguri = node['uri'] if imguri.find('://') != -1: self.warn(docname, 'Nonlocal image URI found: %s' % imguri, node.line) + candidates['*'] = imguri + continue + imgpath = path.normpath(path.join(docdir, imguri)) + if imgpath.endswith(os.extsep + '*'): + for filename in glob(imgpath): + basename, ext = os.path.splitext(filename) + if ext == '.pdf': + candidates['application/pdf'] = filename + elif ext == '.svg': + candidates['image/svg+xml'] = filename + else: + imgtype = imghdr.what(filename) + if imgtype: + candidates['image/' + imgtype] = filename else: - imgpath = path.normpath(path.join(docdir, imguri)) - node['uri'] = imgpath - self.dependencies.setdefault(docname, set()).add(imgpath) - if not os.access(path.join(self.srcdir, imgpath), os.R_OK): - self.warn(docname, 'Image file not readable: %s' % imguri, node.line) - if imgpath in self.images: - self.images[imgpath][0].add(docname) + candidates['*'] = imgpath + for img in candidates.itervalues(): + self.dependencies.setdefault(docname, set()).add(img) + if not os.access(path.join(self.srcdir, img), os.R_OK): + self.warn(docname, 'Image file not readable: %s' % img, node.line) + if img in self.images: + self.images[img][0].add(docname) continue - uniquename = path.basename(imgpath) + uniquename = path.basename(img) base, ext = path.splitext(uniquename) i = 0 while uniquename in existing_names: i += 1 uniquename = '%s%s%s' % (base, i, ext) - self.images[imgpath] = (set([docname]), uniquename) + self.images[img] = (set([docname]), uniquename) existing_names.add(uniquename) def process_metadata(self, docname, doctree): Modified: doctools/trunk/sphinx/htmlwriter.py ============================================================================== --- doctools/trunk/sphinx/htmlwriter.py (original) +++ doctools/trunk/sphinx/htmlwriter.py Sun Jun 15 16:31:16 2008 @@ -250,9 +250,9 @@ def visit_image(self, node): olduri = node['uri'] # rewrite the URI if the environment knows about it - if olduri in self.builder.env.images: + if olduri in self.builder.images: node['uri'] = posixpath.join(self.builder.imgpath, - self.builder.env.images[olduri][1]) + self.builder.images[olduri]) BaseTranslator.visit_image(self, node) def visit_toctree(self, node): Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Sun Jun 15 16:31:16 2008 @@ -630,8 +630,8 @@ pre.append('\n') post.append('\n') pre.reverse() - if node['uri'] in self.builder.env.images: - uri = self.builder.env.images[node['uri']][1] + if node['uri'] in self.builder.images: + uri = self.builder.images[node['uri']] else: uri = node['uri'] if uri.find('://') != -1: From python-checkins at python.org Sun Jun 15 17:08:51 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 15 Jun 2008 17:08:51 +0200 (CEST) Subject: [Python-checkins] r64296 - in python/branches/tlee-ast-optimize: Lib/test/test_optimizer.py Python/optimize.c Message-ID: <20080615150851.C87EE1E400A@bag.python.org> Author: thomas.lee Date: Sun Jun 15 17:08:51 2008 New Revision: 64296 Log: Remove optimizations for True/False named pseudo-constants, since it breaks a bunch of 2.x semantics that may be relied upon. Added a test for enforcing the 2.6 semantics for now. Finally, added an error check for OOM to optimize_name. Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py Sun Jun 15 17:08:51 2008 @@ -139,7 +139,8 @@ self.assertNum(-5, "-5") self.assertNum(True, "not 0") self.assertNum(-3, "-+3") - self.assertNum(False, "not True") + # XXX: cannot be enforced in 2.6 + #self.assertNum(False, "not True") self.assertNum(True, "not None") def test_unary_failure_left_until_runtime(self): @@ -249,7 +250,7 @@ self.assertEqual((1, 2, 3), ast.body[0].iter.value) def test_named_constants(self): - tests = [None, True, False] + tests = [None] for obj in tests: code = repr(obj) @@ -273,6 +274,19 @@ self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) self.assertEqual('y', ast.body[0].body[0].body[1].value.id) + def test_assignment_to_true_works(self): + # --------------------------------------------------------------------- + # Please note that this test is for <2.6 to ensure that + # assignment to True and False are possible despite any + # optimizations. + # --------------------------------------------------------------------- + + True = 0 + assert not True + + False = 1 + assert False + def test_main(): test_support.run_unittest(AstOptimizerTest) Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jun 15 17:08:51 2008 @@ -34,15 +34,6 @@ else if (expr->kind == Num_kind) { return expr->v.Num.n; } - else if (expr->kind == Name_kind) { - const char* name = PyString_AS_STRING(expr->v.Name.id); - if (strcmp(name, "True") == 0) - return Py_True; - else if (strcmp(name, "False") == 0) - return Py_False; - else if (strcmp(name, "None") == 0) - return Py_None; - } else if (expr->kind == Const_kind) { return expr->v.Const.value; } @@ -916,10 +907,16 @@ const char* id = PyString_AS_STRING(expr->v.Name.id); PyObject* constvalue = NULL; + /* allow "assignment to none" error to naturally occur */ + if (expr->v.Name.ctx != Load) + return 1; + if (strcmp(id, "None") == 0) { Py_INCREF(Py_None); constvalue = Py_None; } +/* this is not doable in 2.x ... */ +#if 0 else if (strcmp(id, "True") == 0) { Py_INCREF(Py_True); constvalue = Py_True; @@ -928,10 +925,14 @@ Py_INCREF(Py_False); constvalue = Py_False; } +#endif - if (constvalue != NULL) + if (constvalue != NULL) { *expr_ptr = Const(constvalue, expr->lineno, expr->col_offset, arena); + if (*expr_ptr == NULL) + return 0; + } return 1; } @@ -1007,12 +1008,7 @@ } case Name_kind: { - /* we probably only want to optimize loads ... storing values - * in a Const makes no sense! - */ - if (expr->v.Name.ctx == Load) - return optimize_name(expr_ptr, ste, arena); - /* fall through */ + return optimize_name(expr_ptr, ste, arena); } case Num_kind: case Str_kind: From python-checkins at python.org Sun Jun 15 19:09:23 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 19:09:23 +0200 (CEST) Subject: [Python-checkins] r64297 - in doctools/trunk: CHANGES sphinx/ext/autodoc.py Message-ID: <20080615170923.C69761E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 19:09:23 2008 New Revision: 64297 Log: Correctly report source location for docstrings included with autodoc. Modified: doctools/trunk/CHANGES doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sun Jun 15 19:09:23 2008 @@ -42,7 +42,8 @@ which makes the builder select the one that matches best. * The new config value `exclude_trees` can be used to exclude whole - subtrees from the search for source files. + subtrees from the search for source files. Thanks to Sebastian + Wiesner. * Defaults for configuration values can now be callables, which allows dynamic defaults. @@ -58,6 +59,9 @@ Bugs fixed ---------- +* Correctly report the source location for docstrings included with + autodoc. + * Fix the LaTeX output of description units with multiple signatures. * Handle the figure directive in LaTeX output. Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sun Jun 15 19:09:23 2008 @@ -33,6 +33,47 @@ _module_charsets = {} +class AutodocReporter(object): + """ + A reporter replacement that assigns the correct source name + and line number to a system message, as recorded in a ViewList. + """ + def __init__(self, viewlist, reporter): + self.viewlist = viewlist + self.reporter = reporter + + def __getattr__(self, name): + return getattr(self.reporter, name) + + def system_message(self, level, message, *children, **kwargs): + if 'line' in kwargs: + try: + source, line = self.viewlist.items[kwargs['line']] + except IndexError: + pass + else: + kwargs['source'] = source + kwargs['line'] = line + return self.reporter.system_message(level, message, + *children, **kwargs) + + def debug(self, *args, **kwargs): + if self.reporter.debug_flag: + return self.system_message(0, *args, **kwargs) + + def info(self, *args, **kwargs): + return self.system_message(1, *args, **kwargs) + + def warning(self, *args, **kwargs): + return self.system_message(2, *args, **kwargs) + + def error(self, *args, **kwargs): + return self.system_message(3, *args, **kwargs) + + def severe(self, *args, **kwargs): + return self.system_message(4, *args, **kwargs) + + def isdescriptor(x): """Check if the object is some kind of descriptor.""" for item in '__get__', '__set__', '__delete__': @@ -65,8 +106,11 @@ """Return the charset of the given module (cached in _module_charsets).""" if module in _module_charsets: return _module_charsets[module] - filename = __import__(module, None, None, ['']).__file__ - if filename[-4:] in ('.pyc', '.pyo'): + try: + filename = __import__(module, None, None, ['']).__file__ + except (ImportError, AttributeError): + return None + if filename[-4:].lower() in ('.pyc', '.pyo'): filename = filename[:-1] for line in [linecache.getline(filename, x) for x in (1, 2)]: match = _charset_re.search(line) @@ -137,6 +181,8 @@ lineno, indent='', filename_set=None, check_module=False): env = document.settings.env + result = None + # first, parse the definition -- auto directives for classes and functions # can contain a signature which is then used instead of an autogenerated one try: @@ -144,7 +190,7 @@ except: warning = document.reporter.warning( 'invalid signature for auto%s (%r)' % (what, name), line=lineno) - return [warning], ViewList() + return [warning], result # fullname is the fully qualified name, base the name after the last dot fullname = (path or '') + base # path is the name up to the last dot @@ -203,20 +249,17 @@ # the name to put into the generated directive -- doesn't contain the module name_in_directive = '.'.join(objpath) or mod - # make sure that the view list starts with an empty line. This is - # necessary for some situations where another directive preprocesses - # reST and no starting newline is present - result = ViewList() - result.append('', '') - # now, import the module and get docstring(s) of object to document try: todoc = module = __import__(mod, None, None, ['foo']) - if filename_set is not None and hasattr(module, '__file__') and module.__file__: + if hasattr(module, '__file__') and module.__file__: modfile = module.__file__ - if modfile.lower().endswith('.pyc') or modfile.lower().endswith('.pyo'): + if modfile[-4:].lower() in ('.pyc', '.pyo'): modfile = modfile[:-1] - filename_set.add(modfile) + if filename_set is not None: + filename_set.add(modfile) + else: + modfile = None # e.g. for builtin and C modules for part in objpath: todoc = getattr(todoc, part) except (ImportError, AttributeError): @@ -244,6 +287,12 @@ (fullname, err), line=lineno)) args = '' + # make sure that the view list starts with an empty line. This is + # necessary for some situations where another directive preprocesses + # reST and no starting newline is present + result = ViewList() + result.append('', '') + # now, create the directive header result.append(indent + '.. %s:: %s%s' % (what, name_in_directive, args), '') @@ -257,9 +306,14 @@ if what != 'module': indent += ' ' + if modfile: + sourcename = '%s:docstring of %s' % (modfile, fullname) + else: + sourcename = 'docstring of %s' % fullname + # add content from docstrings for i, line in enumerate(get_doc(what, todoc, env)): - result.append(indent + line, '' % fullname, i) + result.append(indent + line, sourcename, i) # add source content, if present if add_content: @@ -349,12 +403,17 @@ filename_set = set() warnings, result = generate_rst(what, name, members, inherited, undoc, content, state.document, lineno, filename_set=filename_set) + if result is None: + return warnings # record all filenames as dependencies -- this will at least partially make # automatic invalidation possible for fn in filename_set: state.document.settings.env.note_dependency(fn) + # use a custom reporter that correctly assigns lines to source and lineno + old_reporter = state.memo.reporter + state.memo.reporter = AutodocReporter(result, state.memo.reporter) if dirname == 'automodule': node = nodes.section() # hack around title style bookkeeping @@ -362,12 +421,13 @@ surrounding_section_level = state.memo.section_level state.memo.title_styles = [] state.memo.section_level = 0 - state.nested_parse(result, content_offset, node, match_titles=1) + state.nested_parse(result, 0, node, match_titles=1) state.memo.title_styles = surrounding_title_styles state.memo.section_level = surrounding_section_level else: node = nodes.paragraph() - state.nested_parse(result, content_offset, node) + state.nested_parse(result, 0, node) + state.memo.reporter = old_reporter return warnings + node.children def auto_directive(*args, **kwds): From python-checkins at python.org Sun Jun 15 19:46:16 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 19:46:16 +0200 (CEST) Subject: [Python-checkins] r64298 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080615174616.AECDE1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 19:46:16 2008 New Revision: 64298 Log: Quick fix for None return. Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sun Jun 15 19:46:16 2008 @@ -381,7 +381,8 @@ inherited, undoc, None, document, lineno, indent, check_module=members_check_module) warnings.extend(subwarn) - result.extend(subres) + if subres is not None: + result.extend(subres) env.autodoc_current_module = None env.autodoc_current_class = None From python-checkins at python.org Sun Jun 15 19:48:16 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 19:48:16 +0200 (CEST) Subject: [Python-checkins] r64299 - doctools/trunk/sphinx/__init__.py Message-ID: <20080615174816.5378C1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 19:48:16 2008 New Revision: 64299 Log: Don't ignore SystemExit; it shouldn't occur while building. Modified: doctools/trunk/sphinx/__init__.py Modified: doctools/trunk/sphinx/__init__.py ============================================================================== --- doctools/trunk/sphinx/__init__.py (original) +++ doctools/trunk/sphinx/__init__.py Sun Jun 15 19:48:16 2008 @@ -141,8 +141,6 @@ traceback.print_exc() pdb.post_mortem(sys.exc_info()[2]) return 1 - except SystemExit: - return 0 except Exception, err: if use_pdb: import pdb From python-checkins at python.org Sun Jun 15 21:53:24 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 21:53:24 +0200 (CEST) Subject: [Python-checkins] r64300 - in python/branches/release25-maint: Lib/test/test_grammar.py Python/ast.c Message-ID: <20080615195324.9926F1E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 21:53:12 2008 New Revision: 64300 Log: #3117: backport r55087, fixes segfault with lambda (None,): None. Modified: python/branches/release25-maint/Lib/test/test_grammar.py python/branches/release25-maint/Python/ast.c Modified: python/branches/release25-maint/Lib/test/test_grammar.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_grammar.py (original) +++ python/branches/release25-maint/Lib/test/test_grammar.py Sun Jun 15 21:53:12 2008 @@ -277,6 +277,7 @@ verify(l5(1, 2) == 5) verify(l5(1, 2, 3) == 6) check_syntax("lambda x: x = 2") +check_syntax("lambda (None,): None") ### stmt: simple_stmt | compound_stmt # Tested below Modified: python/branches/release25-maint/Python/ast.c ============================================================================== --- python/branches/release25-maint/Python/ast.c (original) +++ python/branches/release25-maint/Python/ast.c Sun Jun 15 21:53:12 2008 @@ -249,6 +249,8 @@ goto error; asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset, arena)); + if (!asdl_seq_GET(stmts, 0)) + goto error; return Interactive(stmts, arena); } else { @@ -679,6 +681,8 @@ if (NCH(ch) != 1) { /* We have complex arguments, setup for unpacking. */ asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); + if (!asdl_seq_GET(args, k-1)) + goto error; } else { /* def foo((x)): setup for checking NAME below. */ /* Loop because there can be many parens and tuple From python-checkins at python.org Sun Jun 15 21:54:36 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 15 Jun 2008 21:54:36 +0200 (CEST) Subject: [Python-checkins] r64301 - python/trunk/Lib/test/test_grammar.py Message-ID: <20080615195436.E11401E400A@bag.python.org> Author: georg.brandl Date: Sun Jun 15 21:54:36 2008 New Revision: 64301 Log: Forward-port new test from r64300. Modified: python/trunk/Lib/test/test_grammar.py Modified: python/trunk/Lib/test/test_grammar.py ============================================================================== --- python/trunk/Lib/test/test_grammar.py (original) +++ python/trunk/Lib/test/test_grammar.py Sun Jun 15 21:54:36 2008 @@ -299,6 +299,7 @@ self.assertEquals(l5(1, 2), 5) self.assertEquals(l5(1, 2, 3), 6) check_syntax_error(self, "lambda x: x = 2") + check_syntax_error(self, "lambda (None,): None") ### stmt: simple_stmt | compound_stmt # Tested below From buildbot at python.org Sun Jun 15 22:29:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 20:29:18 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.5 Message-ID: <20080615202918.9DA191E400A@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%202.5/builds/617 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/test/test_thread.py", line 281, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_socketserver Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 81, in run svr = svrcls(self.__addr, self.__hdlrcls) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 330, in __init__ self.server_bind() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 341, in server_bind self.socket.bind(self.server_address) File "", line 1, in bind error: (98, 'Address already in use') Traceback (most recent call last): File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/threading.py", line 446, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 467, in process_request_thread self.handle_error(request, client_address) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 464, in process_request_thread self.finish_request(request, client_address) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 254, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/SocketServer.py", line 522, in __init__ self.handle() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 21, in handle time.sleep(DELAY) AttributeError: 'NoneType' object has no attribute 'sleep' Traceback (most recent call last): File "./Lib/test/regrtest.py", line 557, in runtest_inner indirect_test() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 212, in test_main testall() File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 197, in testall testloop(socket.AF_INET, udpservers, MyDatagramHandler, testdgram) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 144, in testloop testfunc(proto, addr) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 53, in testdgram buf = data = receive(s, 100) File "/home/buildslave/python-trunk/2.5.norwitz-x86/build/Lib/test/test_socketserver.py", line 48, in receive raise RuntimeError, "timed out on %r" % (sock,) RuntimeError: timed out on make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 15 23:08:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 21:08:35 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080615210846.B1D8B1E400A@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1601 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Mon Jun 16 00:27:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 15 Jun 2008 22:27:35 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080615222736.1367F1E400A@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1013 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 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_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 16 03:42:40 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 16 Jun 2008 03:42:40 +0200 (CEST) Subject: [Python-checkins] r64303 - in python/trunk: Misc/NEWS Python/marshal.c Message-ID: <20080616014240.B10851E400B@bag.python.org> Author: raymond.hettinger Date: Mon Jun 16 03:42:40 2008 New Revision: 64303 Log: Issue 3116: fix quadratic behavior in marshal.dumps(). Modified: python/trunk/Misc/NEWS python/trunk/Python/marshal.c Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 16 03:42:40 2008 @@ -50,6 +50,8 @@ Extension Modules ----------------- +- Issue #3116: marshal.dumps() had quadratic behavior for strings > 32Mb. + - Issue #2138: Add factorial() the math module. - The heapq module does comparisons using LT instead of LE. This Modified: python/trunk/Python/marshal.c ============================================================================== --- python/trunk/Python/marshal.c (original) +++ python/trunk/Python/marshal.c Mon Jun 16 03:42:40 2008 @@ -67,7 +67,7 @@ size = PyString_Size(p->str); newsize = size + size + 1024; if (newsize > 32*1024*1024) { - newsize = size + 1024*1024; + newsize = size + (size >> 3); /* 12.5% overallocation */ } if (_PyString_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; From python-checkins at python.org Mon Jun 16 03:49:18 2008 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 16 Jun 2008 03:49:18 +0200 (CEST) Subject: [Python-checkins] r64304 - in python/branches/release25-maint: Misc/NEWS Python/marshal.c Message-ID: <20080616014918.D31FE1E400B@bag.python.org> Author: raymond.hettinger Date: Mon Jun 16 03:49:18 2008 New Revision: 64304 Log: Issue #3116 and #1792: Fix quadratic behavior in marshal.dumps(). Modified: python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/marshal.c Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Jun 16 03:49:18 2008 @@ -48,6 +48,8 @@ Library ------- +- Issue #3116 and #1792: Fix quadratic behavior in marshal.dumps(). + - Issue #2682: ctypes callback functions no longer contain a cyclic reference to themselves. Modified: python/branches/release25-maint/Python/marshal.c ============================================================================== --- python/branches/release25-maint/Python/marshal.c (original) +++ python/branches/release25-maint/Python/marshal.c Mon Jun 16 03:49:18 2008 @@ -65,7 +65,10 @@ if (p->str == NULL) return; /* An error already occurred */ size = PyString_Size(p->str); - newsize = size + 1024; + newsize = size + size + 1024; + if (newsize > 32*1024*1024) { + newsize = size + (size >> 3); /* 12.5% overallocation */ + } if (_PyString_Resize(&p->str, newsize) != 0) { p->ptr = p->end = NULL; } From buildbot at python.org Mon Jun 16 04:31:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 02:31:21 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080616023121.6FE7F1E4015@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/481 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: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Mon Jun 16 04:41:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 02:41:23 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080616024123.7D7F51E400B@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3240 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpgkr25u/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From python-checkins at python.org Mon Jun 16 08:08:09 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jun 2008 08:08:09 +0200 (CEST) Subject: [Python-checkins] r64305 - in peps/trunk: pep-0000.txt pep-0372.txt Message-ID: <20080616060809.3E8FD1E400C@bag.python.org> Author: georg.brandl Date: Mon Jun 16 08:08:08 2008 New Revision: 64305 Log: Add PEP 372, Adding an ordered directory to collections. Added: peps/trunk/pep-0372.txt (contents, props changed) Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon Jun 16 08:08:08 2008 @@ -98,6 +98,7 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes + S 372 Adding an ordered directory to collections Ronacher S 3135 New Super Spealman, Delaney Finished PEPs (done, implemented in Subversion) @@ -476,6 +477,7 @@ S 369 Post import hooks Heimes SA 370 Per user site-packages directory Heimes SA 371 Addition of the multiprocessing package Noller, Oudkerk + S 372 Adding an ordered directory to collections Ronacher SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR @@ -629,6 +631,7 @@ Reis, Christian R. kiko at async.com.br Riehl, Jonathan jriehl at spaceship.com Roberge, Andr? andre.roberge at gmail.com + Ronacher, Armin armin.ronacher at active-4.com van Rossum, Guido (GvR) guido at python.org van Rossum, Just (JvR) just at letterror.com Sajip, Vinay vinay_sajip at red-dove.com Added: peps/trunk/pep-0372.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0372.txt Mon Jun 16 08:08:08 2008 @@ -0,0 +1,234 @@ +PEP: 372 +Title: Adding an ordered directory to collections +Version: $Revision$ +Last-Modified: $Date$ +Author: Armin Ronacher +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 15-Jun-2008 +Python-Version: 2.6, 3.0 +Post-History: + + +Abstract +======== + +This PEP proposes an ordered dictionary as a new data structure for +the ``collections`` module, called "odict" in this PEP for short. The +proposed API incorporates the experiences gained from working with +similar implementations that exist in various real-world applications +and other programming languages. + + +Rationale +========= + +In current Python versions, the widely used built-in dict type does +not specify an order for the key/value pairs stored. This makes it +hard to use dictionaries as data storage for some specific use cases. + +Some dynamic programming languages like PHP and Ruby 1.9 guarantee a +certain order on iteration. In those languages, and existing Python +ordered-dict implementations, the ordering of items is defined by the +time of insertion of the key. New keys are appended at the end, keys +that are overwritten and not moved. + +The following example shows the behavior for simple assignments: + +>>> d = odict() +>>> d['parrot'] = 'dead' +>>> d['penguin'] = 'exploded' +>>> d.items() +[('parrot', 'dead'), ('penguin', 'exploded')] + +That the ordering is preserved makes an odict useful for a couple of +situations: + +- XML/HTML processing libraries currently drop the ordering of + attributes, use a list instead of a dict which makes filtering + cumbersome, or implement their own ordered dictionary. This affects + ElementTree, html5lib, Genshi and many more libraries. + +- There are many ordererd dict implementations in various libraries + and applications, most of them subtly incompatible with each other. + Furthermore, subclassing dict is a non-trivial task and many + implementations don't override all the methods properly which can + lead to unexpected results. + + Additionally, many ordered dicts are implemented in an inefficient + way, making many operations more complex then they have to be. + +- PEP 3115 allows metaclasses to change the mapping object used for + the class body. An ordered dict could be used to create ordered + member declarations similar to C structs. This could be useful, for + example, for future ``ctypes`` releases as well as ORMs that define + database tables as classes, like the one the Django framework ships. + Django currently uses an ugly hack to restore the ordering of + members in database models. + +- Code ported from other programming languages such as PHP often + depends on a ordered dict. Having an implementation of an + ordering-preserving dictionary in the standard library could ease + the transition and improve the compatibility of different libraries. + + +Ordered Dict API +================ + +The ordered dict API would be mostly compatible with dict and existing +ordered dicts. (Note: this PEP refers to the Python 2.x dictionary +API; the transfer to the 3.x API is trivial.) + +The constructor and ``update()`` both accept iterables of tuples as +well as mappings like a dict does. The ordering however is preserved +for the first case: + +>>> d = odict([('a', 'b'), ('c', 'd')]) +>>> d.update({'foo': 'bar'}) +>>> d +collections.odict([('a', 'b'), ('c', 'd'), ('foo', 'bar')]) + +If ordered dicts are updated from regular dicts, the ordering of new +keys is of course undefined again unless ``sort()`` is called. + +All iteration methods as well as ``keys()``, ``values()`` and +``items()`` return the values ordered by the the time the key-value +pair was inserted: + +>>> d['spam'] = 'eggs' +>>> d.keys() +['a', 'c', 'foo', 'spam'] +>>> d.values() +['b', 'd', 'bar', 'eggs'] +>>> d.items() +[('a', 'b'), ('c', 'd'), ('foo', 'bar'), ('spam', 'eggs')] + +New methods not available on dict: + + ``odict.byindex(index)`` + + Index-based lookup is supported by ``byindex()`` which returns + the key/value pair for an index, that is, the "position" of a + key in the ordered dict. 0 is the first key/value pair, -1 + the last. + + >>> d.byindex(2) + ('foo', 'bar') + + ``odict.sort(cmp=None, key=None, reverse=False)`` + + Sorts the odict in place by cmp or key. This works exactly + like ``list.sort()``, but the comparison functions are passed + a key/value tuple, not only the value. + + >>> d = odict([(42, 1), (1, 4), (23, 7)]) + >>> d.sort() + >>> d + collections.odict([(1, 4), (23, 7), (42, 1)]) + + ``odict.reverse()`` + + Reverses the odict in place. + + ``odict.__reverse__()`` + + Supports reverse iteration by key. + + +Questions and Answers +===================== + +What happens if an existing key is reassigned? + + The key is not moved but assigned a new value in place. This is + consistent with existing implementations and allows subclasses to + change the behavior easily:: + + class movingcollections.odict): + def __setitem__(self, key, value): + self.pop(key, None) + odict.__setitem__(self, key, value) + +What happens if keys appear multiple times in the list passed to the +constructor? + + The same as for regular dicts: The latter item overrides the + former. This has the side-effect that the position of the first + key is used because the key is actually overwritten: + + >>> odict([('a', 1), ('b', 2), ('a', 3)]) + collections.odict([('a', 3), ('b', 2)]) + + This behavior is consistent with existing implementations in + Python, the PHP array and the hashmap in Ruby 1.9. + +Why is there no ``odict.insert()``? + + There are few situations where you really want to insert a key at + an specified index. To avoid API complication, the proposed + solution for this situation is creating a list of items, + manipulating that and converting it back into an odict: + + >>> d = odict([('a', 42), ('b', 23), ('c', 19)]) + >>> l = d.items() + >>> l.insert(1, ('x', 0)) + >>> odict(l) + collections.odict([('a', 42), ('x', 0), ('b', 23), ('c', 19)]) + + +Example Implementation +====================== + +A poorly performing example implementation of the odict written in +Python is available: + + `odict.py `_ + +The version for ``collections`` should be implemented in C and use a +linked list internally. + +Other implementations of ordered dicts in various Python projects or +standalone libraries, that inspired the API proposed here, are: + +- `odict in Babel`_ +- `OrderedDict in Django`_ +- `The odict module`_ +- `ordereddict`_ (a C implementation of the odict module) +- `StableDict`_ +- `Armin Rigo's OrderedDict`_ + + +.. _odict in Babel: http://babel.edgewall.org/browser/trunk/babel/util.py?rev=374#L178 +.. _OrderedDict in Django: + http://code.djangoproject.com/browser/django/trunk/django/utils/datastructures.py?rev=7140#L53 +.. _The odict module: http://www.voidspace.org.uk/python/odict.html +.. _ordereddict: http://www.xs4all.nl/~anthon/Python/ordereddict/ +.. _StableDict: http://pypi.python.org/pypi/StableDict/0.2 +.. _Armin Rigo's OrderedDict: http://codespeak.net/svn/user/arigo/hack/pyfuse/OrderedDict.py + + +Future Directions +================= + +With the availability of an ordered dict in the standard library, +other libraries may take advantage of that. For example, ElementTree +could return odicts in the future that retain the attribute ordering +of the source file. + + +Copyright +========= + +This document has been placed in the public domain. + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: + From buildbot at python.org Mon Jun 16 10:54:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 08:54:34 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080616085434.43CE31E4007@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1483 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,andrew.kuchling,armin.rigo,benjamin.peterson,georg.brandl,gregory.p.smith,martin.v.loewis,neal.norwitz,raymond.hettinger,robert.schuppenies,thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 16 12:15:48 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jun 2008 12:15:48 +0200 (CEST) Subject: [Python-checkins] r64306 - peps/trunk/pep-0372.txt Message-ID: <20080616101548.8EC6C1E4016@bag.python.org> Author: georg.brandl Date: Mon Jun 16 12:15:48 2008 New Revision: 64306 Log: Updates and fixes from Armin. Modified: peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Mon Jun 16 12:15:48 2008 @@ -31,8 +31,8 @@ Some dynamic programming languages like PHP and Ruby 1.9 guarantee a certain order on iteration. In those languages, and existing Python ordered-dict implementations, the ordering of items is defined by the -time of insertion of the key. New keys are appended at the end, keys -that are overwritten and not moved. +time of insertion of the key. New keys are appended at the end, but +keys that are overwritten are not moved to the end. The following example shows the behavior for simple assignments: @@ -67,6 +67,11 @@ Django currently uses an ugly hack to restore the ordering of members in database models. +- The RawConfigParser class accepts a ``dict_type`` argument that + allows an application to set the type of dictionary used internally. + The motivation for this addition was expressly to allow users to + provide an ordered dictionary. [1]_ + - Code ported from other programming languages such as PHP often depends on a ordered dict. Having an implementation of an ordering-preserving dictionary in the standard library could ease @@ -106,34 +111,37 @@ New methods not available on dict: - ``odict.byindex(index)`` +``odict.byindex(index)`` - Index-based lookup is supported by ``byindex()`` which returns - the key/value pair for an index, that is, the "position" of a - key in the ordered dict. 0 is the first key/value pair, -1 - the last. + Returns the key/value pair for an index, that is, the "position" of a key in + the ordered dict. 0 is the first key/value pair, -1 the last. - >>> d.byindex(2) - ('foo', 'bar') + >>> d.byindex(2) + ('foo', 'bar') - ``odict.sort(cmp=None, key=None, reverse=False)`` + If there is no key for index an `IndexError` is raised. - Sorts the odict in place by cmp or key. This works exactly - like ``list.sort()``, but the comparison functions are passed - a key/value tuple, not only the value. +``odict.index(key)`` - >>> d = odict([(42, 1), (1, 4), (23, 7)]) - >>> d.sort() - >>> d - collections.odict([(1, 4), (23, 7), (42, 1)]) + Returns the index of a key. If the key does not exist, a `ValueError` is + raised. - ``odict.reverse()`` +``odict.sort(cmp=None, key=None, reverse=False)`` - Reverses the odict in place. + Sorts the odict in place by cmp or key. This works exactly like + ``list.sort()``, but the comparison functions are passed a key/value tuple, + not only the value. - ``odict.__reverse__()`` + >>> d = odict([(42, 1), (1, 4), (23, 7)]) d.sort() d + collections.odict([(1, 4), (23, 7), (42, 1)]) - Supports reverse iteration by key. +``odict.reverse()`` + + Reverses the odict in place. + +``odict.__reverse__()`` + + Supports reverse iteration by key. Questions and Answers @@ -145,10 +153,10 @@ consistent with existing implementations and allows subclasses to change the behavior easily:: - class movingcollections.odict): + class moving_odict(collections.odict): def __setitem__(self, key, value): self.pop(key, None) - odict.__setitem__(self, key, value) + collections.odict.__setitem__(self, key, value) What happens if keys appear multiple times in the list passed to the constructor? @@ -217,6 +225,12 @@ of the source file. +References +========== + +.. [1] http://bugs.python.org/issue1371075 + + Copyright ========= From python-checkins at python.org Mon Jun 16 14:11:23 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jun 2008 14:11:23 +0200 (CEST) Subject: [Python-checkins] r64307 - in peps/trunk: pep-0000.txt pep-0372.txt Message-ID: <20080616121123.829511E4004@bag.python.org> Author: georg.brandl Date: Mon Jun 16 14:11:23 2008 New Revision: 64307 Log: Fix PEP title. Modified: peps/trunk/pep-0000.txt peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon Jun 16 14:11:23 2008 @@ -98,7 +98,7 @@ S 364 Transitioning to the Py3K Standard Library Warsaw S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes - S 372 Adding an ordered directory to collections Ronacher + S 372 Adding an ordered dictionary to collections Ronacher S 3135 New Super Spealman, Delaney Finished PEPs (done, implemented in Subversion) @@ -477,7 +477,7 @@ S 369 Post import hooks Heimes SA 370 Per user site-packages directory Heimes SA 371 Addition of the multiprocessing package Noller, Oudkerk - S 372 Adding an ordered directory to collections Ronacher + S 372 Adding an ordered dictionary to collections Ronacher SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Mon Jun 16 14:11:23 2008 @@ -1,5 +1,5 @@ PEP: 372 -Title: Adding an ordered directory to collections +Title: Adding an ordered dictionary to collections Version: $Revision$ Last-Modified: $Date$ Author: Armin Ronacher From python-checkins at python.org Mon Jun 16 14:21:13 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jun 2008 14:21:13 +0200 (CEST) Subject: [Python-checkins] r64308 - peps/trunk/pep-0372.txt Message-ID: <20080616122113.0F2531E4004@bag.python.org> Author: georg.brandl Date: Mon Jun 16 14:21:12 2008 New Revision: 64308 Log: Further fixes. Modified: peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Mon Jun 16 14:21:12 2008 @@ -50,7 +50,7 @@ cumbersome, or implement their own ordered dictionary. This affects ElementTree, html5lib, Genshi and many more libraries. -- There are many ordererd dict implementations in various libraries +- There are many ordered dict implementations in various libraries and applications, most of them subtly incompatible with each other. Furthermore, subclassing dict is a non-trivial task and many implementations don't override all the methods properly which can @@ -98,8 +98,8 @@ keys is of course undefined again unless ``sort()`` is called. All iteration methods as well as ``keys()``, ``values()`` and -``items()`` return the values ordered by the the time the key-value -pair was inserted: +``items()`` return the values ordered by the time the key-value pair +was inserted: >>> d['spam'] = 'eggs' >>> d.keys() From ncoghlan at gmail.com Mon Jun 16 14:55:39 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 16 Jun 2008 22:55:39 +1000 Subject: [Python-checkins] r64306 - peps/trunk/pep-0372.txt In-Reply-To: <20080616101548.8EC6C1E4016@bag.python.org> References: <20080616101548.8EC6C1E4016@bag.python.org> Message-ID: <485662CB.5000804@gmail.com> georg.brandl wrote: > Author: georg.brandl > Date: Mon Jun 16 12:15:48 2008 > New Revision: 64306 > > Log: > Updates and fixes from Armin. > > > Modified: > peps/trunk/pep-0372.txt > > Modified: peps/trunk/pep-0372.txt > ============================================================================== > --- peps/trunk/pep-0372.txt (original) > +++ peps/trunk/pep-0372.txt Mon Jun 16 12:15:48 2008 > @@ -31,8 +31,8 @@ > Some dynamic programming languages like PHP and Ruby 1.9 guarantee a > certain order on iteration. In those languages, and existing Python > ordered-dict implementations, the ordering of items is defined by the > -time of insertion of the key. New keys are appended at the end, keys > -that are overwritten and not moved. > +time of insertion of the key. New keys are appended at the end, but > +keys that are overwritten are not moved to the end. > > The following example shows the behavior for simple assignments: > > @@ -67,6 +67,11 @@ > Django currently uses an ugly hack to restore the ordering of > members in database models. > > +- The RawConfigParser class accepts a ``dict_type`` argument that > + allows an application to set the type of dictionary used internally. > + The motivation for this addition was expressly to allow users to > + provide an ordered dictionary. [1]_ > + > - Code ported from other programming languages such as PHP often > depends on a ordered dict. Having an implementation of an > ordering-preserving dictionary in the standard library could ease > @@ -106,34 +111,37 @@ > > New methods not available on dict: > > - ``odict.byindex(index)`` > +``odict.byindex(index)`` > > - Index-based lookup is supported by ``byindex()`` which returns > - the key/value pair for an index, that is, the "position" of a > - key in the ordered dict. 0 is the first key/value pair, -1 > - the last. > + Returns the key/value pair for an index, that is, the "position" of a key in > + the ordered dict. 0 is the first key/value pair, -1 the last. > > - >>> d.byindex(2) > - ('foo', 'bar') > + >>> d.byindex(2) > + ('foo', 'bar') > > - ``odict.sort(cmp=None, key=None, reverse=False)`` > + If there is no key for index an `IndexError` is raised. > > - Sorts the odict in place by cmp or key. This works exactly > - like ``list.sort()``, but the comparison functions are passed > - a key/value tuple, not only the value. > +``odict.index(key)`` > > - >>> d = odict([(42, 1), (1, 4), (23, 7)]) > - >>> d.sort() > - >>> d > - collections.odict([(1, 4), (23, 7), (42, 1)]) > + Returns the index of a key. If the key does not exist, a `ValueError` is > + raised. Hmm, while I can see the rationale for suggesting ValueError here for the symmetry with list, KeyError is probably more intuitive. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Mon Jun 16 21:12:43 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 16 Jun 2008 21:12:43 +0200 (CEST) Subject: [Python-checkins] r64309 - in python/trunk: Lib/test/test_weakref.py Misc/NEWS Objects/weakrefobject.c Message-ID: <20080616191243.63DEF1E4003@bag.python.org> Author: amaury.forgeotdarc Date: Mon Jun 16 21:12:42 2008 New Revision: 64309 Log: Issue 3110: Crash with weakref subclass, seen after a "import multiprocessing.reduction" An instance of a weakref subclass can have attributes. If such a weakref holds the only strong reference to the object, deleting the weakref will delete the object. In this case, the callback must not be called, because the ref object is being deleted! Modified: python/trunk/Lib/test/test_weakref.py python/trunk/Misc/NEWS python/trunk/Objects/weakrefobject.c Modified: python/trunk/Lib/test/test_weakref.py ============================================================================== --- python/trunk/Lib/test/test_weakref.py (original) +++ python/trunk/Lib/test/test_weakref.py Mon Jun 16 21:12:42 2008 @@ -666,7 +666,7 @@ w = Target() -class SubclassableWeakrefTestCase(unittest.TestCase): +class SubclassableWeakrefTestCase(TestBase): def test_subclass_refs(self): class MyRef(weakref.ref): @@ -730,6 +730,44 @@ self.assertEqual(r.meth(), "abcdef") self.failIf(hasattr(r, "__dict__")) + def test_subclass_refs_with_cycle(self): + # Bug #3110 + # An instance of a weakref subclass can have attributes. + # If such a weakref holds the only strong reference to the object, + # deleting the weakref will delete the object. In this case, + # the callback must not be called, because the ref object is + # being deleted. + class MyRef(weakref.ref): + pass + + # Use a local callback, for "regrtest -R::" + # to detect refcounting problems + def callback(w): + self.cbcalled += 1 + + o = C() + r1 = MyRef(o, callback) + r1.o = o + del o + + del r1 # Used to crash here + + self.assertEqual(self.cbcalled, 0) + + # Same test, with two weakrefs to the same object + # (since code paths are different) + o = C() + r1 = MyRef(o, callback) + r2 = MyRef(o, callback) + r1.r = r2 + r2.o = o + del o + del r2 + + del r1 # Used to crash here + + self.assertEqual(self.cbcalled, 0) + class Object: def __init__(self, arg): @@ -1171,6 +1209,7 @@ MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, + SubclassableWeakrefTestCase, ) test_support.run_doctest(sys.modules[__name__]) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 16 21:12:42 2008 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #3100: Corrected a crash on deallocation of a subclassed weakref which + holds the last (strong) reference to its referent. + - Add future_builtins.ascii(). - Several set methods now accept multiple arguments: update(), union(), Modified: python/trunk/Objects/weakrefobject.c ============================================================================== --- python/trunk/Objects/weakrefobject.c (original) +++ python/trunk/Objects/weakrefobject.c Mon Jun 16 21:12:42 2008 @@ -907,7 +907,8 @@ current->wr_callback = NULL; clear_weakref(current); if (callback != NULL) { - handle_callback(current, callback); + if (current->ob_refcnt > 0) + handle_callback(current, callback); Py_DECREF(callback); } } @@ -925,9 +926,15 @@ for (i = 0; i < count; ++i) { PyWeakReference *next = current->wr_next; - Py_INCREF(current); - PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); - PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); + if (current->ob_refcnt > 0) + { + Py_INCREF(current); + PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); + PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); + } + else { + Py_DECREF(current->wr_callback); + } current->wr_callback = NULL; clear_weakref(current); current = next; @@ -935,6 +942,7 @@ for (i = 0; i < count; ++i) { PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1); + /* The tuple may have slots left to NULL */ if (callback != NULL) { PyObject *item = PyTuple_GET_ITEM(tuple, i * 2); handle_callback((PyWeakReference *)item, callback); From python-checkins at python.org Mon Jun 16 21:22:43 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 16 Jun 2008 21:22:43 +0200 (CEST) Subject: [Python-checkins] r64310 - in python/branches/release25-maint: Lib/test/test_weakref.py Misc/NEWS Objects/weakrefobject.c Message-ID: <20080616192243.489091E4003@bag.python.org> Author: amaury.forgeotdarc Date: Mon Jun 16 21:22:42 2008 New Revision: 64310 Log: Issue 3110: Crash with weakref subclass, seen after a "import multiprocessing.reduction" An instance of a weakref subclass can have attributes. If such a weakref holds the only strong reference to the object, deleting the weakref will delete the object. In this case, the callback must not be called, because the ref object is being deleted! Backport of r34309 Modified: python/branches/release25-maint/Lib/test/test_weakref.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/weakrefobject.c Modified: python/branches/release25-maint/Lib/test/test_weakref.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_weakref.py (original) +++ python/branches/release25-maint/Lib/test/test_weakref.py Mon Jun 16 21:22:42 2008 @@ -645,7 +645,7 @@ w = Target() -class SubclassableWeakrefTestCase(unittest.TestCase): +class SubclassableWeakrefTestCase(TestBase): def test_subclass_refs(self): class MyRef(weakref.ref): @@ -709,6 +709,44 @@ self.assertEqual(r.meth(), "abcdef") self.failIf(hasattr(r, "__dict__")) + def test_subclass_refs_with_cycle(self): + # Bug #3110 + # An instance of a weakref subclass can have attributes. + # If such a weakref holds the only strong reference to the object, + # deleting the weakref will delete the object. In this case, + # the callback must not be called, because the ref object is + # being deleted. + class MyRef(weakref.ref): + pass + + # Use a local callback, for "regrtest -R::" + # to detect refcounting problems + def callback(w): + self.cbcalled += 1 + + o = C() + r1 = MyRef(o, callback) + r1.o = o + del o + + del r1 # Used to crash here + + self.assertEqual(self.cbcalled, 0) + + # Same test, with two weakrefs to the same object + # (since code paths are different) + o = C() + r1 = MyRef(o, callback) + r2 = MyRef(o, callback) + r1.r = r2 + r2.o = o + del o + del r2 + + del r1 # Used to crash here + + self.assertEqual(self.cbcalled, 0) + class Object: def __init__(self, arg): @@ -1150,6 +1188,7 @@ MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, + SubclassableWeakrefTestCase, ) test_support.run_doctest(sys.modules[__name__]) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Jun 16 21:22:42 2008 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Issue #3100: Corrected a crash on deallocation of a subclassed weakref which + holds the last (strong) reference to its referent. + - Issue #1686386: Tuple's tp_repr did not take into account the possibility of having a self-referential tuple, which is possible from C code. Nor did object's tp_str consider that a type's tp_str could do something that could Modified: python/branches/release25-maint/Objects/weakrefobject.c ============================================================================== --- python/branches/release25-maint/Objects/weakrefobject.c (original) +++ python/branches/release25-maint/Objects/weakrefobject.c Mon Jun 16 21:22:42 2008 @@ -900,7 +900,8 @@ current->wr_callback = NULL; clear_weakref(current); if (callback != NULL) { - handle_callback(current, callback); + if (current->ob_refcnt > 0) + handle_callback(current, callback); Py_DECREF(callback); } } @@ -918,9 +919,15 @@ for (i = 0; i < count; ++i) { PyWeakReference *next = current->wr_next; - Py_INCREF(current); - PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); - PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); + if (current->ob_refcnt > 0) + { + Py_INCREF(current); + PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); + PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); + } + else { + Py_DECREF(current->wr_callback); + } current->wr_callback = NULL; clear_weakref(current); current = next; @@ -928,6 +935,7 @@ for (i = 0; i < count; ++i) { PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1); + /* The tuple may have slots left to NULL */ if (callback != NULL) { PyObject *item = PyTuple_GET_ITEM(tuple, i * 2); handle_callback((PyWeakReference *)item, callback); From buildbot at python.org Mon Jun 16 22:03:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 20:03:35 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080616200335.7839F1E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/688 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: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 16 22:18:18 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jun 2008 22:18:18 +0200 (CEST) Subject: [Python-checkins] r64313 - python/trunk/Tools/scripts/2to3 Message-ID: <20080616201818.A95D61E4003@bag.python.org> Author: benjamin.peterson Date: Mon Jun 16 22:18:18 2008 New Revision: 64313 Log: fix Tools/scripts/2to3 as the result of a merge error Modified: python/trunk/Tools/scripts/2to3 Modified: python/trunk/Tools/scripts/2to3 ============================================================================== --- python/trunk/Tools/scripts/2to3 (original) +++ python/trunk/Tools/scripts/2to3 Mon Jun 16 22:18:18 2008 @@ -2,4 +2,4 @@ from lib2to3 import refactor import sys -sys.exit(refactor.main()) +sys.exit(refactor.main("lib2to3/fixes")) From buildbot at python.org Mon Jun 16 22:33:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 20:33:43 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2.5 Message-ID: <20080616203343.33EF91E4003@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%202.5/builds/191 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_timeout sincerely, -The Buildbot From python-checkins at python.org Mon Jun 16 22:41:12 2008 From: python-checkins at python.org (david.goodger) Date: Mon, 16 Jun 2008 22:41:12 +0200 (CEST) Subject: [Python-checkins] r64315 - peps/trunk/pep-0372.txt Message-ID: <20080616204112.8E5BC1E4003@bag.python.org> Author: david.goodger Date: Mon Jun 16 22:41:12 2008 New Revision: 64315 Log: markup: removed blank lines to make a definition list Modified: peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Mon Jun 16 22:41:12 2008 @@ -112,7 +112,6 @@ New methods not available on dict: ``odict.byindex(index)`` - Returns the key/value pair for an index, that is, the "position" of a key in the ordered dict. 0 is the first key/value pair, -1 the last. @@ -122,12 +121,10 @@ If there is no key for index an `IndexError` is raised. ``odict.index(key)`` - Returns the index of a key. If the key does not exist, a `ValueError` is raised. ``odict.sort(cmp=None, key=None, reverse=False)`` - Sorts the odict in place by cmp or key. This works exactly like ``list.sort()``, but the comparison functions are passed a key/value tuple, not only the value. @@ -136,11 +133,9 @@ collections.odict([(1, 4), (23, 7), (42, 1)]) ``odict.reverse()`` - Reverses the odict in place. ``odict.__reverse__()`` - Supports reverse iteration by key. From python-checkins at python.org Mon Jun 16 22:52:48 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jun 2008 22:52:48 +0200 (CEST) Subject: [Python-checkins] r64317 - python/trunk/Lib/test/test_multiprocessing.py Message-ID: <20080616205248.6CF311E401B@bag.python.org> Author: benjamin.peterson Date: Mon Jun 16 22:52:48 2008 New Revision: 64317 Log: reduce the test_multiprocessing load to ones that shouldn't hang. These will be reenabled gradually as we find the problems. Modified: python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Mon Jun 16 22:52:48 2008 @@ -390,7 +390,7 @@ def _test_get(self, queue, child_can_start, parent_can_continue): child_can_start.wait() - queue.put(1) + #queue.put(1) queue.put(2) queue.put(3) queue.put(4) @@ -417,7 +417,8 @@ time.sleep(DELTA) self.assertEqual(queue_empty(queue), False) - self.assertEqual(queue.get(), 1) + # Hangs unexpectedly, remove for now + #self.assertEqual(queue.get(), 1) self.assertEqual(queue.get(True, None), 2) self.assertEqual(queue.get(True), 3) self.assertEqual(queue.get(timeout=1), 4) @@ -959,7 +960,7 @@ def sqr(x, wait=0.0): time.sleep(wait) return x*x - +""" class _TestPool(BaseTestCase): def test_apply(self): @@ -1029,7 +1030,7 @@ join = TimingWrapper(self.pool.join) join() self.assertTrue(join.elapsed < 0.2) - +""" # # Test that manager has expected number of shared objects left # @@ -1356,7 +1357,7 @@ # # Test of sending connection and socket objects between processes # - +""" class _TestPicklingConnections(BaseTestCase): ALLOWED_TYPES = ('processes',) @@ -1438,7 +1439,7 @@ lp.join() rp.join() - +""" # # # @@ -1761,28 +1762,28 @@ multiprocessing.get_logger().setLevel(LOG_LEVEL) - ProcessesMixin.pool = multiprocessing.Pool(4) - ThreadsMixin.pool = multiprocessing.dummy.Pool(4) - ManagerMixin.manager.__init__() - ManagerMixin.manager.start() - ManagerMixin.pool = ManagerMixin.manager.Pool(4) + #ProcessesMixin.pool = multiprocessing.Pool(4) + #ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + #ManagerMixin.manager.__init__() + #ManagerMixin.manager.start() + #ManagerMixin.pool = ManagerMixin.manager.Pool(4) testcases = ( - sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + - sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + - sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) #+ + #sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + #sorted(testcases_manager.values(), key=lambda tc:tc.__name__) ) loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) run(suite) - ThreadsMixin.pool.terminate() - ProcessesMixin.pool.terminate() - ManagerMixin.pool.terminate() - ManagerMixin.manager.shutdown() + #ThreadsMixin.pool.terminate() + #ProcessesMixin.pool.terminate() + #ManagerMixin.pool.terminate() + #ManagerMixin.manager.shutdown() - del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + #del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool def main(): test_main(unittest.TextTestRunner(verbosity=2).run) From python-checkins at python.org Mon Jun 16 23:00:47 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jun 2008 23:00:47 +0200 (CEST) Subject: [Python-checkins] r64320 - python/trunk/Misc/developers.txt Message-ID: <20080616210047.706FF1E4003@bag.python.org> Author: georg.brandl Date: Mon Jun 16 23:00:47 2008 New Revision: 64320 Log: Add Jesse Noller to the developers list. Modified: python/trunk/Misc/developers.txt Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Mon Jun 16 23:00:47 2008 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Jesse Noller was given SVN access on 16 June 2008 by Georg Brandl, + for work on the multiprocessing module. + - Gregor Lingl was given SVN access on 10 June 2008 by MvL, for work on the turtle module. From buildbot at python.org Mon Jun 16 23:56:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 21:56:42 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 2.5 Message-ID: <20080616215649.C0A751E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%202.5/builds/503 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 879, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From buildbot at python.org Mon Jun 16 23:59:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 21:59:09 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080616215909.3EC981E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1146 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Jun 17 00:02:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 22:02:37 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080616220237.451271E4008@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/693 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: The web-page 'force build' button was pressed by '': get recent changes in Build Source Stamp: [branch py3k] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Tue Jun 17 00:08:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 22:08:51 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080616220851.4722C1E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3242 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpb2KIyr/cgi-bin/file2.py", line 2, in import cgi Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/trunk.norwitz-tru64/build/Lib/test/test_socket.py", line 123, in clientRun Fatal Python error: UNREF invalid object sincerely, -The Buildbot From buildbot at python.org Tue Jun 17 00:19:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 22:19:31 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080616221931.862861E4003@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/396 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Tue Jun 17 00:52:29 2008 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Jun 2008 00:52:29 +0200 (CEST) Subject: [Python-checkins] r64321 - sandbox/trunk/import_in_py/docs/flowchart.graffle Message-ID: <20080616225229.322F21E4003@bag.python.org> Author: brett.cannon Date: Tue Jun 17 00:52:28 2008 New Revision: 64321 Log: Massive rewrite of the flowchart to take into account __package__ and to split up the parts of import into separate sheets. Modified: sandbox/trunk/import_in_py/docs/flowchart.graffle Modified: sandbox/trunk/import_in_py/docs/flowchart.graffle ============================================================================== Binary files. No diff available. From python-checkins at python.org Tue Jun 17 00:53:04 2008 From: python-checkins at python.org (brett.cannon) Date: Tue, 17 Jun 2008 00:53:04 +0200 (CEST) Subject: [Python-checkins] r64322 - sandbox/trunk/import_in_py/docs/__import__.pdf Message-ID: <20080616225304.65B111E4003@bag.python.org> Author: brett.cannon Date: Tue Jun 17 00:53:04 2008 New Revision: 64322 Log: Remove the PDF of the flowchart as it is now woefully out of date. Removed: sandbox/trunk/import_in_py/docs/__import__.pdf Deleted: sandbox/trunk/import_in_py/docs/__import__.pdf ============================================================================== Binary file. No diff available. From buildbot at python.org Tue Jun 17 01:42:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 16 Jun 2008 23:42:59 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080616234300.18CFA1E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3572 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 17 09:46:34 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 09:46:34 +0200 (CEST) Subject: [Python-checkins] r64323 - doctools/trunk/doc/config.rst Message-ID: <20080617074634.B1E051E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 09:46:33 2008 New Revision: 64323 Log: Add notes about Unicode and escaping of backslashes. Modified: doctools/trunk/doc/config.rst Modified: doctools/trunk/doc/config.rst ============================================================================== --- doctools/trunk/doc/config.rst (original) +++ doctools/trunk/doc/config.rst Tue Jun 17 09:46:33 2008 @@ -28,6 +28,11 @@ * Remember that document names use ``/`` as the path separator and don't contain the file name extension. +* Since :file:`conf.py` is read as a Python file, the usual rules apply for + encodings and Unicode support: declare the encoding using an encoding cookie + (a comment like ``# -*- coding: utf-8 -*-``) and use Unicode string literals + when you include non-ASCII characters in configuration values. + * The contents of the config namespace are pickled (so that Sphinx can find out when configuration changes), so it may not contain unpickleable values -- delete them from the namespace with ``del`` if appropriate. Modules are @@ -377,12 +382,15 @@ .. confval:: latex_appendices - Documents to append as an appendix to all manuals. + A list of document names to append as an appendix to all manuals. .. confval:: latex_preamble Additional LaTeX markup for the preamble. + Keep in mind that backslashes must be doubled in Python string literals to + avoid interpretation as escape sequences. + .. confval:: latex_use_modindex If true, add a module index to LaTeX documents. Default is ``True``. From python-checkins at python.org Tue Jun 17 10:00:58 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 10:00:58 +0200 (CEST) Subject: [Python-checkins] r64324 - doctools/trunk/sphinx/__init__.py Message-ID: <20080617080058.682CB1E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 10:00:58 2008 New Revision: 64324 Log: Fix printing of SystemMessages with Unicode content. Modified: doctools/trunk/sphinx/__init__.py Modified: doctools/trunk/sphinx/__init__.py ============================================================================== --- doctools/trunk/sphinx/__init__.py (original) +++ doctools/trunk/sphinx/__init__.py Tue Jun 17 10:00:58 2008 @@ -151,7 +151,7 @@ else: if isinstance(err, SystemMessage): print >>sys.stderr, darkred('reST markup error:') - print >>sys.stderr, str(err) + print >>sys.stderr, err.args[0].encode('ascii', 'backslashreplace') else: print >>sys.stderr, darkred('Exception occurred:') print >>sys.stderr, format_exception_cut_frames().rstrip() From python-checkins at python.org Tue Jun 17 10:07:37 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 10:07:37 +0200 (CEST) Subject: [Python-checkins] r64325 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080617080737.58ED91E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 10:07:37 2008 New Revision: 64325 Log: Use Unicode throughout autodoc. Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Tue Jun 17 10:07:37 2008 @@ -154,8 +154,16 @@ charset = get_module_charset(module) for docstring in docstrings: - if isinstance(docstring, str) and charset: - docstring = docstring.decode(charset) + if isinstance(docstring, str): + if charset: + docstring = docstring.decode(charset) + else: + try: + # try decoding with utf-8, should only work for real UTF-8 + docstring = docstring.decode('utf-8') + except UnicodeError: + # last resort -- can't fail + docstring = docstring.decode('latin1') for line in prepare_docstring(docstring): yield line @@ -178,7 +186,7 @@ def generate_rst(what, name, members, inherited, undoc, add_content, document, - lineno, indent='', filename_set=None, check_module=False): + lineno, indent=u'', filename_set=None, check_module=False): env = document.settings.env result = None @@ -291,20 +299,20 @@ # necessary for some situations where another directive preprocesses # reST and no starting newline is present result = ViewList() - result.append('', '') + result.append(u'', '') # now, create the directive header - result.append(indent + '.. %s:: %s%s' % (what, name_in_directive, args), + result.append(indent + u'.. %s:: %s%s' % (what, name_in_directive, args), '') if what != 'module': # Be explicit about the module, this is necessary since .. class:: doesn't # support a prepended module name - result.append(indent + ' :module: %s' % mod, '') - result.append('', '') + result.append(indent + u' :module: %s' % mod, '') + result.append(u'', '') # the module directive doesn't have content if what != 'module': - indent += ' ' + indent += u' ' if modfile: sourcename = '%s:docstring of %s' % (modfile, fullname) From python-checkins at python.org Tue Jun 17 10:42:15 2008 From: python-checkins at python.org (robert.schuppenies) Date: Tue, 17 Jun 2008 10:42:15 +0200 (CEST) Subject: [Python-checkins] r64326 - python/trunk/Lib/test/test_sys.py Message-ID: <20080617084215.9106C1E4004@bag.python.org> Author: robert.schuppenies Date: Tue Jun 17 10:42:15 2008 New Revision: 64326 Log: Issue 3048: Fixed sys.sizeof test fails with wide unicode. Modified: python/trunk/Lib/test/test_sys.py Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Tue Jun 17 10:42:15 2008 @@ -538,8 +538,7 @@ self.check_sizeof([], h + l + p + l) self.check_sizeof([1, 2, 3], h + l + p + l + 3*l) # unicode - import math - usize = math.log(sys.maxunicode + 1, 2) / 8 + usize = len(u'\0'.encode('unicode-internal')) samples = [u'', u'1'*100] # we need to test for both sizes, because we don't know if the string # has been cached From python-checkins at python.org Tue Jun 17 11:01:26 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 11:01:26 +0200 (CEST) Subject: [Python-checkins] r64327 - in doctools/trunk: CHANGES TODO doc/config.rst sphinx/builder.py sphinx/config.py sphinx/quickstart.py sphinx/templates/genindex-single.html sphinx/templates/genindex-split.html sphinx/templates/genindex.html sphinx/templates/modindex.html Message-ID: <20080617090126.C166B1E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 11:01:26 2008 New Revision: 64327 Log: Support splitting the HTML index. Added: doctools/trunk/sphinx/templates/genindex-single.html (contents, props changed) doctools/trunk/sphinx/templates/genindex-split.html (contents, props changed) Modified: doctools/trunk/CHANGES doctools/trunk/TODO doctools/trunk/doc/config.rst doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/config.py doctools/trunk/sphinx/quickstart.py doctools/trunk/sphinx/templates/genindex.html doctools/trunk/sphinx/templates/modindex.html Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Tue Jun 17 11:01:26 2008 @@ -25,6 +25,10 @@ - The new config value `html_use_index` can be used to switch index generation in HTML documents off. + - The new config value `html_split_index` can be used to create + separate index pages for each letter, to be used when the complete + index is too large for one page. + - The new config value `html_short_title` can be used to set a shorter title for the documentation which is then used in the navigation bar. Modified: doctools/trunk/TODO ============================================================================== --- doctools/trunk/TODO (original) +++ doctools/trunk/TODO Tue Jun 17 11:01:26 2008 @@ -8,7 +8,6 @@ - range and object options for literalinclude - option for compact module index - HTML section numbers? -- split the general index? - "seealso" links to external examples, see http://svn.python.org/projects/sandbox/trunk/seealso/ and http://effbot.org/zone/idea-seealso.htm - "often used" combo box in sidebar - source file cross-references? Modified: doctools/trunk/doc/config.rst ============================================================================== --- doctools/trunk/doc/config.rst (original) +++ doctools/trunk/doc/config.rst Tue Jun 17 11:01:26 2008 @@ -287,6 +287,13 @@ .. versionadded:: 0.4 +.. confval:: html_split_index + + If true, the index is generated twice: once as a single page with all the + entries, and once as one page per starting letter. Default is ``False``. + + .. versionadded:: 0.4 + .. confval:: html_copy_source If true, the reST sources are included in the HTML build as Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Tue Jun 17 11:01:26 2008 @@ -5,7 +5,7 @@ Builder classes for different output formats. - :copyright: 2007-2008 by Georg Brandl. + :copyright: 2007-2008 by Georg Brandl, Sebastian Wiesner. :license: BSD. """ @@ -464,9 +464,19 @@ genindexcontext = dict( genindexentries = genindex, genindexcounts = indexcounts, + split_index = self.config.html_split_index, ) self.info(' genindex', nonl=1) - self.handle_page('genindex', genindexcontext, 'genindex.html') + + if self.config.html_split_index: + self.handle_page('genindex', genindexcontext, 'genindex-split.html') + self.handle_page('genindex-all', genindexcontext, 'genindex.html') + for (key, entries), count in zip(genindex, indexcounts): + ctx = {'key': key, 'entries': entries, 'count': count, + 'genindexentries': genindex} + self.handle_page('genindex-' + key, ctx, 'genindex-single.html') + else: + self.handle_page('genindex', genindexcontext, 'genindex.html') # the global module index @@ -481,6 +491,7 @@ platforms = set() # sort out collapsable modules modindexentries = [] + letters = [] pmn = '' cg = 0 # collapse group fl = '' # first letter @@ -488,8 +499,10 @@ pl = pl and pl.split(', ') or [] platforms.update(pl) if fl != mn[0].lower() and mn[0] != '_': + # heading modindexentries.append(['', False, 0, False, mn[0].upper(), '', [], False]) + letters.append(mn[0].upper()) tn = mn.split('.')[0] if tn != mn: # submodule @@ -510,6 +523,7 @@ modindexcontext = dict( modindexentries = modindexentries, platforms = platforms, + letters = letters, ) self.info(' modindex', nonl=1) self.handle_page('modindex', modindexcontext, 'modindex.html') Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Tue Jun 17 11:01:26 2008 @@ -59,6 +59,7 @@ html_additional_pages = ({}, False), html_use_modindex = (True, False), html_use_index = (True, False), + html_split_index = (False, False), html_copy_source = (True, False), html_use_opensearch = ('', False), html_file_suffix = (None, False), Modified: doctools/trunk/sphinx/quickstart.py ============================================================================== --- doctools/trunk/sphinx/quickstart.py (original) +++ doctools/trunk/sphinx/quickstart.py Tue Jun 17 11:01:26 2008 @@ -143,6 +143,9 @@ # If false, no index is generated. #html_use_index = True +# If true, the index is split into individual pages for each letter. +#html_split_index = False + # If true, the reST sources are included in the HTML build as _sources/. #html_copy_source = True Added: doctools/trunk/sphinx/templates/genindex-single.html ============================================================================== --- (empty file) +++ doctools/trunk/sphinx/templates/genindex-single.html Tue Jun 17 11:01:26 2008 @@ -0,0 +1,45 @@ +{% extends "layout.html" %} +{% set title = 'Index' %} +{% block body %} + +

Index – {{ key }}

+ +
+
+{%- set breakat = count // 2 %} +{%- set numcols = 1 %} +{%- set numitems = 0 %} +{% for entryname, (links, subitems) in entries %} +
{%- if links -%}{{ entryname|e }} + {%- for link in links[1:] %}, [Link]{% endfor -%} + {%- else -%} +{{ entryname|e }} + {%- endif -%}
+ {%- if subitems %} +
+ {%- for subentryname, subentrylinks in subitems %} +
{{ subentryname|e }} + {%- for link in subentrylinks[1:] %}, [Link]{% endfor -%} +
+ {%- endfor %} +
+ {%- endif -%} +{%- set numitems = numitems + 1 + len(subitems) -%} +{%- if numcols < 2 and numitems > breakat -%} +{%- set numcols = numcols+1 -%} +
+{%- endif -%} +{%- endfor %} +
+ +{% endblock %} + +{% block sidebarrel %} +

Index

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

Full index on one page

+{% endblock %} Added: doctools/trunk/sphinx/templates/genindex-split.html ============================================================================== --- (empty file) +++ doctools/trunk/sphinx/templates/genindex-split.html Tue Jun 17 11:01:26 2008 @@ -0,0 +1,29 @@ +{% extends "layout.html" %} +{% set title = 'Index' %} +{% block body %} + +

Index

+ +

Index pages by letter:

+ +

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

Full index on one page + (can be huge)

+ +{% endblock %} + +{% block sidebarrel %} +{% if split_index %} +

Index

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

Full index on one page

+{% endif %} +{% endblock %} Modified: doctools/trunk/sphinx/templates/genindex.html ============================================================================== --- doctools/trunk/sphinx/templates/genindex.html (original) +++ doctools/trunk/sphinx/templates/genindex.html Tue Jun 17 11:01:26 2008 @@ -42,3 +42,15 @@ {% endfor %} {% endblock %} + +{% block sidebarrel %} +{% if split_index %} +

Index

+

{% for key, dummy in genindexentries -%} + {{ key }} + {% if not loop.last %}| {% endif %} + {%- endfor %}

+ +

Full index on one page

+{% endif %} +{% endblock %} Modified: doctools/trunk/sphinx/templates/modindex.html ============================================================================== --- doctools/trunk/sphinx/templates/modindex.html (original) +++ doctools/trunk/sphinx/templates/modindex.html Tue Jun 17 11:01:26 2008 @@ -24,11 +24,16 @@ {% endif %} + {%- for letter in letters %} + {{ letter }} {% if not loop.last %}| {% endif %} + {%- endfor %} +
+ {%- for modname, collapse, cgroup, indent, fname, synops, pform, dep in modindexentries %} {%- if not modname -%} - + {%- else -%}
 
{{ fname }}
{{ fname }}
{% if collapse -%} From python-checkins at python.org Tue Jun 17 11:01:36 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 11:01:36 +0200 (CEST) Subject: [Python-checkins] r64328 - python/trunk/Doc/conf.py Message-ID: <20080617090136.08B1B1E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 11:01:35 2008 New Revision: 64328 Log: Split the HTML index. Modified: python/trunk/Doc/conf.py Modified: python/trunk/Doc/conf.py ============================================================================== --- python/trunk/Doc/conf.py (original) +++ python/trunk/Doc/conf.py Tue Jun 17 11:01:35 2008 @@ -94,6 +94,9 @@ # Output file base name for HTML help builder. htmlhelp_basename = 'python' + release.replace('.', '') +# Split the index +html_split_index = True + # Options for LaTeX output # ------------------------ From python-checkins at python.org Tue Jun 17 11:13:43 2008 From: python-checkins at python.org (armin.ronacher) Date: Tue, 17 Jun 2008 11:13:43 +0200 (CEST) Subject: [Python-checkins] r64329 - peps/trunk/pep-0372.txt Message-ID: <20080617091343.E98711E4004@bag.python.org> Author: armin.ronacher Date: Tue Jun 17 11:13:43 2008 New Revision: 64329 Log: PEP 0372: added notice on comparing Modified: peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Tue Jun 17 11:13:43 2008 @@ -118,7 +118,8 @@ >>> d.byindex(2) ('foo', 'bar') - If there is no key for index an `IndexError` is raised. + If there is no key for index an `IndexError` is raised. Slices are not + supported. ``odict.index(key)`` Returns the index of a key. If the key does not exist, a `ValueError` is @@ -138,6 +139,17 @@ ``odict.__reverse__()`` Supports reverse iteration by key. +``odict.__eq__()`` / ``odict.__ne__()`` + Compares the odict to another object. If it's compared to another + odict the ordering of items is taken into account, otherwise only + the keys and values. + +``odict.__cmp__()`` + Ordered dicts are sorted by their items. ``cmp(od1, od2)`` is + equivalent to ``cmp(od1.items(), od2.items())`` if both ``od1`` + and ``od2`` are ordered dicts. Otherwise the regular dict comparison + kicks in. + Questions and Answers ===================== @@ -179,6 +191,20 @@ >>> odict(l) collections.odict([('a', 42), ('x', 0), ('b', 23), ('c', 19)]) +Is the ordered dict a dict subclass? + + Yes. Like ``defaultdict``, ``odict`` subclasses ``dict``. + +Does ``odict.pop()`` support list-like popping of items? + + No. Neither ``odict.__getitem__()`` nor ``odict.pop()`` support + retrieving or deleting items by index. Slices are not supported + either. This would introduce ambiguities if integers or slice + objects are used as dict keys. + + As a matter of fact, ``odict`` does not implement the ``Sequence`` + interface. + Example Implementation ====================== From python-checkins at python.org Tue Jun 17 11:23:26 2008 From: python-checkins at python.org (armin.ronacher) Date: Tue, 17 Jun 2008 11:23:26 +0200 (CEST) Subject: [Python-checkins] r64330 - peps/trunk/pep-0372.txt Message-ID: <20080617092326.4D4BB1E4007@bag.python.org> Author: armin.ronacher Date: Tue Jun 17 11:23:26 2008 New Revision: 64330 Log: PEP 0372: `__reverse__` -> `__reversed__` Modified: peps/trunk/pep-0372.txt Modified: peps/trunk/pep-0372.txt ============================================================================== --- peps/trunk/pep-0372.txt (original) +++ peps/trunk/pep-0372.txt Tue Jun 17 11:23:26 2008 @@ -136,7 +136,7 @@ ``odict.reverse()`` Reverses the odict in place. -``odict.__reverse__()`` +``odict.__reversed__()`` Supports reverse iteration by key. ``odict.__eq__()`` / ``odict.__ne__()`` From python-checkins at python.org Tue Jun 17 11:24:11 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 11:24:11 +0200 (CEST) Subject: [Python-checkins] r64331 - in doctools/trunk: CHANGES doc/ext/autodoc.rst sphinx/ext/autodoc.py Message-ID: <20080617092411.C8DF21E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 11:24:11 2008 New Revision: 64331 Log: Support inheritance display in autoclass, thanks to mdboom. Modified: doctools/trunk/CHANGES doctools/trunk/doc/ext/autodoc.rst doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Tue Jun 17 11:24:11 2008 @@ -60,6 +60,10 @@ and classes now that override the signature got via introspection from Python code. + - The `autodoc` extension now offers a ``show-inheritance`` option + for autoclass that inserts a list of bases after the signature. + + Bugs fixed ---------- Modified: doctools/trunk/doc/ext/autodoc.rst ============================================================================== --- doctools/trunk/doc/ext/autodoc.rst (original) +++ doctools/trunk/doc/ext/autodoc.rst Tue Jun 17 11:24:11 2008 @@ -46,67 +46,73 @@ Noodle's docstring. - If you want to automatically document members, there's a ``members`` - option:: - - .. autoclass:: Noodle - :members: + The "auto" directives can also contain content of their own, it will be + inserted into the resulting non-auto directive source after the docstring + (but before any automatic member documentation). - will document all non-private member functions and properties (that is, those - whose name doesn't start with ``_``), while :: + Therefore, you can also mix automatic and non-automatic member documentation, + like so:: .. autoclass:: Noodle :members: eat, slurp - will document exactly the specified members. + .. method:: boil(time=10) - Members without docstrings will be left out, unless you give the - ``undoc-members`` flag option:: + Boil the noodle *time* minutes. - .. autoclass:: Noodle - :members: - :undoc-members: + **Options and advanced usage** + + * If you want to automatically document members, there's a ``members`` + option:: - .. versionadded:: 0.3 - For classes and exceptions, members inherited from base classes will be - left out, unless you give the ``inherited-members`` flag option, in - addition to ``members``: + .. autoclass:: Noodle + :members: - :: + will document all non-private member functions and properties (that is, + those whose name doesn't start with ``_``), while :: - .. autoclass:: Noodle - :members: - :inherited-members: + .. autoclass:: Noodle + :members: eat, slurp - This can be combined with ``undoc-members`` to document *all* available - members of the class or module. + will document exactly the specified members. - .. versionadded:: 0.4 - It's possible to override the signature for callable members (functions, - methods, classes) with the regular syntax that will override the signature - gained from instropection: + * Members without docstrings will be left out, unless you give the + ``undoc-members`` flag option:: - :: + .. autoclass:: Noodle + :members: + :undoc-members: - .. autoclass:: Noodle(type) + * For classes and exceptions, members inherited from base classes will be + left out, unless you give the ``inherited-members`` flag option, in + addition to ``members``:: - .. automethod:: eat(persona) + .. autoclass:: Noodle + :members: + :inherited-members: - This is useful if the signature from the method is hidden by a decorator. + This can be combined with ``undoc-members`` to document *all* available + members of the class or module. - The "auto" directives can also contain content of their own, it will be - inserted into the resulting non-auto directive source after the docstring - (but before any automatic member documentation). + .. versionadded:: 0.3 - Therefore, you can also mix automatic and non-automatic member documentation, - like so:: + * It's possible to override the signature for callable members (functions, + methods, classes) with the regular syntax that will override the signature + gained from instropection:: - .. autoclass:: Noodle - :members: eat, slurp + .. autoclass:: Noodle(type) - .. method:: boil(time=10) + .. automethod:: eat(persona) - Boil the noodle *time* minutes. + This is useful if the signature from the method is hidden by a decorator. + + .. versionadded:: 0.4 + + * The :dir:`autoclass` and :dir:`autoexception` directives also support a + flag option called ``show-inheritance``. When given, a list of base + classes will be inserted just below the class signature. + + .. versionadded:: 0.4 .. note:: Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Tue Jun 17 11:24:11 2008 @@ -33,6 +33,10 @@ _module_charsets = {} +class Options(object): + pass + + class AutodocReporter(object): """ A reporter replacement that assigns the correct source name @@ -185,8 +189,8 @@ return inspect.formatargspec(*argspec) -def generate_rst(what, name, members, inherited, undoc, add_content, document, - lineno, indent=u'', filename_set=None, check_module=False): +def generate_rst(what, name, members, options, add_content, document, lineno, + indent=u'', filename_set=None, check_module=False): env = document.settings.env result = None @@ -310,6 +314,14 @@ result.append(indent + u' :module: %s' % mod, '') result.append(u'', '') + if options.show_inheritance and what in ('class', 'exception'): + if len(todoc.__bases__): + bases = [b.__module__ == '__builtin__' and + u':class:`%s`' % b.__name__ or + u':class:`%s.%s`' % (b.__module__, b.__name__) + for b in todoc.__bases__] + result.append(indent + u' Bases: %s' % ', '.join(bases), '') + # the module directive doesn't have content if what != 'module': indent += u' ' @@ -348,7 +360,7 @@ members_check_module = True all_members = inspect.getmembers(todoc) else: - if inherited: + if options.inherited: # getmembers() uses dir() which pulls in members from all base classes all_members = inspect.getmembers(todoc) else: @@ -362,7 +374,7 @@ continue # ignore undocumented members if :undoc-members: is not given doc = getattr(member, '__doc__', None) - if not undoc and not doc: + if not options.undoc and not doc: continue if what == 'module': if isinstance(member, types.FunctionType): @@ -386,8 +398,8 @@ continue full_membername = fullname + '.' + membername subwarn, subres = generate_rst(memberwhat, full_membername, ['__all__'], - inherited, undoc, None, document, lineno, - indent, check_module=members_check_module) + options, None, document, lineno, indent, + check_module=members_check_module) warnings.extend(subwarn) if subres is not None: result.extend(subres) @@ -402,16 +414,18 @@ content_offset, block_text, state, state_machine): what = dirname[4:] # strip "auto" name = arguments[0] + genopt = Options() members = options.get('members', []) - inherited = 'inherited-members' in options - if inherited and not members: + genopt.inherited = 'inherited-members' in options + if genopt.inherited and not members: # :inherited-members: implies :members: members = ['__all__'] - undoc = 'undoc-members' in options + genopt.undoc = 'undoc-members' in options + genopt.show_inheritance = 'show-inheritance' in options filename_set = set() - warnings, result = generate_rst(what, name, members, inherited, undoc, content, - state.document, lineno, filename_set=filename_set) + warnings, result = generate_rst(what, name, members, genopt, content, state.document, + lineno, filename_set=filename_set) if result is None: return warnings @@ -455,7 +469,8 @@ def setup(app): mod_options = {'members': members_directive, 'undoc-members': directives.flag} cls_options = {'members': members_directive, 'undoc-members': directives.flag, - 'inherited-members': directives.flag} + 'inherited-members': directives.flag, + 'show-inheritance': directives.flag} app.add_directive('automodule', auto_directive_withmembers, 1, (1, 0, 1), **mod_options) app.add_directive('autoclass', auto_directive_withmembers, From python-checkins at python.org Tue Jun 17 11:26:50 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 11:26:50 +0200 (CEST) Subject: [Python-checkins] r64332 - in doctools/trunk: CHANGES sphinx/latexwriter.py Message-ID: <20080617092650.8DA231E4018@bag.python.org> Author: georg.brandl Date: Tue Jun 17 11:26:50 2008 New Revision: 64332 Log: Translate line blocks with \raggedright. Modified: doctools/trunk/CHANGES doctools/trunk/sphinx/latexwriter.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Tue Jun 17 11:26:50 2008 @@ -100,6 +100,9 @@ * Enable autodoc to process Unicode docstrings. +* The LaTeX writer now translates line blocks with ``\raggedright``, + which plays nicer with tables. + Release 0.3 (May 6, 2008) ========================= Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Tue Jun 17 11:26:50 2008 @@ -865,16 +865,22 @@ * inline markup is supported. * serif typeface """ - self.body.append('\\begin{flushleft}\n') + self.body.append('{\\raggedright{}') self.literal_whitespace = 1 def depart_line_block(self, node): self.literal_whitespace = 0 - self.body.append('\n\\end{flushleft}\n') + # remove the last \\ + del self.body[-1] + self.body.append('}\n') def visit_line(self, node): - pass + self._line_start = len(self.body) def depart_line(self, node): - self.body.append('~\\\\\n') + if self._line_start == len(self.body): + # no output in this line -- add a nonbreaking space, else the + # \\ command will give an error + self.body.append('~') + self.body.append('\\\\\n') def visit_block_quote(self, node): # If the block quote contains a single object and that object From python-checkins at python.org Tue Jun 17 12:06:39 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 12:06:39 +0200 (CEST) Subject: [Python-checkins] r64333 - in doctools/trunk: CHANGES TODO doc/config.rst doc/markup/inline.rst sphinx/config.py sphinx/environment.py sphinx/quickstart.py sphinx/roles.py Message-ID: <20080617100639.2DF071E402B@bag.python.org> Author: georg.brandl Date: Tue Jun 17 12:06:37 2008 New Revision: 64333 Log: Add default_role configuration value. Modified: doctools/trunk/CHANGES doctools/trunk/TODO doctools/trunk/doc/config.rst doctools/trunk/doc/markup/inline.rst doctools/trunk/sphinx/config.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/quickstart.py doctools/trunk/sphinx/roles.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Tue Jun 17 12:06:37 2008 @@ -7,6 +7,9 @@ * ``tocdepth`` can be given as a file-wide metadata entry, and specifies the maximum depth of a TOC of this file. +* The new config value `default_role` can be used to select the + default role for all documents. + * HTML output: - The "previous" and "next" links have a more logical structure, so Modified: doctools/trunk/TODO ============================================================================== --- doctools/trunk/TODO (original) +++ doctools/trunk/TODO Tue Jun 17 12:06:37 2008 @@ -1,9 +1,7 @@ -Global TODO +Sphinx TODO =========== -Sphinx -****** - +- remove redundant
    s in tocs - autoattribute in autodoc - range and object options for literalinclude - option for compact module index Modified: doctools/trunk/doc/config.rst ============================================================================== --- doctools/trunk/doc/config.rst (original) +++ doctools/trunk/doc/config.rst Tue Jun 17 12:06:37 2008 @@ -153,6 +153,18 @@ instance is then used to render HTML documents, and possibly the output of other builders (currently the changes builder). +.. confval:: default_role + + The name of a reST role (builtin or Sphinx extension) to use as the default + role, that is, for text marked up ```like this```. This can be set to + ``'obj'`` to make ```filter``` a cross-reference to the function "filter". + The default is ``None``, which doesn't reassign the default role. + + The default role can always be set within individual documents using the + standard reST :dir:`default-role` directive. + + .. versionadded:: 0.4 + .. confval:: add_function_parentheses A boolean that decides whether parentheses are appended to function and Modified: doctools/trunk/doc/markup/inline.rst ============================================================================== --- doctools/trunk/doc/markup/inline.rst (original) +++ doctools/trunk/doc/markup/inline.rst Tue Jun 17 12:06:37 2008 @@ -88,6 +88,13 @@ The name of an exception. A dotted name may be used. +.. role:: obj + + The name of an object of unspecified type. Useful e.g. as the + :confval:`default_role`. + + .. versionadded:: 0.4 + The name enclosed in this markup can include a module name and/or a class name. For example, ``:func:`filter``` could refer to a function named ``filter`` in the current module, or the built-in function of that name. In contrast, Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Tue Jun 17 12:06:37 2008 @@ -36,6 +36,7 @@ unused_docs = ([], True), exclude_dirs = ([], True), exclude_trees = ([], True), + default_role = (None, True), add_function_parentheses = (True, True), add_module_names = (True, True), show_authors = (False, True), Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Tue Jun 17 12:06:37 2008 @@ -34,6 +34,8 @@ from docutils.core import publish_doctree from docutils.utils import Reporter from docutils.readers import standalone +from docutils.parsers.rst import roles +from docutils.parsers.rst.languages import en as english from docutils.transforms import Transform from docutils.transforms.parts import ContentsFilter from docutils.transforms.universal import FilterMessages @@ -70,6 +72,8 @@ 'today', ]) +dummy_reporter = Reporter('', 4, 4) + class RedirStream(object): def __init__(self, writefunc): @@ -449,6 +453,14 @@ if src_path is None: src_path = self.doc2path(docname) + if self.config.default_role: + role_fn, messages = roles.role(self.config.default_role, english, + 0, dummy_reporter) + if role_fn: + roles._roles[''] = role_fn + else: + self.warn(docname, 'default role %s not found' % + self.config.default_role) self.docname = docname doctree = publish_doctree(None, src_path, FileInput, settings_overrides=self.settings, @@ -834,7 +846,7 @@ return newnode descroles = frozenset(('data', 'exc', 'func', 'class', 'const', 'attr', - 'meth', 'cfunc', 'cdata', 'ctype', 'cmacro')) + 'meth', 'cfunc', 'cdata', 'ctype', 'cmacro', 'obj')) def resolve_references(self, doctree, fromdocname, builder): for node in doctree.traverse(addnodes.pending_xref): Modified: doctools/trunk/sphinx/quickstart.py ============================================================================== --- doctools/trunk/sphinx/quickstart.py (original) +++ doctools/trunk/sphinx/quickstart.py Tue Jun 17 12:06:37 2008 @@ -78,6 +78,9 @@ # for source files. #exclude_dirs = [] +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True Modified: doctools/trunk/sphinx/roles.py ============================================================================== --- doctools/trunk/sphinx/roles.py (original) +++ doctools/trunk/sphinx/roles.py Tue Jun 17 12:06:37 2008 @@ -39,6 +39,8 @@ def indexmarkup_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]): env = inliner.document.settings.env + if not typ: + typ = env.config.default_role text = utils.unescape(etext) targetid = 'index-%s' % env.index_num env.index_num += 1 @@ -114,6 +116,8 @@ def xfileref_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): env = inliner.document.settings.env + if not typ: + typ = env.config.default_role text = utils.unescape(text) # if the first character is a bang, don't cross-reference at all if text[0:1] == '!': @@ -142,7 +146,7 @@ target = text[brace+1:] title = text[:brace] # special target for Python object cross-references - if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'mod'): + if typ in ('data', 'exc', 'func', 'class', 'const', 'attr', 'meth', 'mod', 'obj'): # fix-up parentheses in link title if titleistarget: title = title.lstrip('.') # only has a meaning for the target @@ -209,7 +213,7 @@ 'const': xfileref_role, 'attr': xfileref_role, 'meth': xfileref_role, - + 'obj': xfileref_role, 'cfunc' : xfileref_role, 'cdata' : xfileref_role, 'ctype' : xfileref_role, From python-checkins at python.org Tue Jun 17 12:22:04 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 12:22:04 +0200 (CEST) Subject: [Python-checkins] r64334 - doctools/trunk/sphinx/environment.py Message-ID: <20080617102204.A7BD51E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 12:22:04 2008 New Revision: 64334 Log: Increment env version after the image handling change. Modified: doctools/trunk/sphinx/environment.py Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Tue Jun 17 12:22:04 2008 @@ -63,7 +63,7 @@ # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 22 +ENV_VERSION = 23 default_substitutions = set([ From python-checkins at python.org Tue Jun 17 12:33:19 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 12:33:19 +0200 (CEST) Subject: [Python-checkins] r64335 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080617103319.883861E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 12:33:19 2008 New Revision: 64335 Log: Fix unbound local. Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Tue Jun 17 12:33:19 2008 @@ -134,7 +134,7 @@ docstrings.append(obj.__doc__) # skip some lines in module docstrings if configured if what == 'module' and env.config.automodule_skip_lines and docstrings: - docstrings[0] = '\n'.join(docstring.splitlines() + docstrings[0] = '\n'.join(docstrings[0].splitlines() [env.config.automodule_skip_lines:]) # for classes, what the "docstring" is can be controlled via an option if what in ('class', 'exception'): From python-checkins at python.org Tue Jun 17 12:34:51 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 17 Jun 2008 12:34:51 +0200 (CEST) Subject: [Python-checkins] r64336 - in doctools/trunk/sphinx: builder.py templates/layout.html Message-ID: <20080617103451.B448F1E4004@bag.python.org> Author: georg.brandl Date: Tue Jun 17 12:34:51 2008 New Revision: 64336 Log: Compile the right-aligned rellinks into a list that is iterated over at template rendering time. Modified: doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/templates/layout.html Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Tue Jun 17 12:34:51 2008 @@ -358,6 +358,12 @@ self.relations = self.env.collect_relations() + rellinks = [] + if self.config.html_use_index: + rellinks.append(('genindex', 'General Index', 'I', 'index')) + if self.config.html_use_modindex: + rellinks.append(('modindex', 'Global Module Index', 'M', 'modules')) + self.globalcontext = dict( project = self.config.project, release = self.config.release, @@ -365,12 +371,11 @@ last_updated = self.last_updated, copyright = self.config.copyright, style = self.config.html_style, - use_modindex = self.config.html_use_modindex, - use_index = self.config.html_use_index, use_opensearch = self.config.html_use_opensearch, docstitle = self.config.html_title, shorttitle = self.config.html_short_title, show_sphinx = self.config.html_show_sphinx, + rellinks = rellinks, builder = self.name, parents = [], logo = logo, @@ -383,21 +388,24 @@ # find out relations prev = next = None parents = [] + rellinks = self.globalcontext['rellinks'][:] related = self.relations.get(docname) titles = self.env.titles + if related and related[2]: + try: + next = {'link': self.get_relative_uri(docname, related[2]), + 'title': self.render_partial(titles[related[2]])['title']} + rellinks.append((related[2], next['title'], 'N', 'next')) + except KeyError: + next = None if related and related[1]: try: prev = {'link': self.get_relative_uri(docname, related[1]), 'title': self.render_partial(titles[related[1]])['title']} + rellinks.append((related[1], prev['title'], 'P', 'previous')) except KeyError: # the relation is (somehow) not in the TOC tree, handle that gracefully prev = None - if related and related[2]: - try: - next = {'link': self.get_relative_uri(docname, related[2]), - 'title': self.render_partial(titles[related[2]])['title']} - except KeyError: - next = None while related and related[0]: try: parents.append( @@ -427,6 +435,7 @@ title = title, meta = meta, body = body, + rellinks = rellinks, sourcename = sourcename, toc = self.render_partial(self.env.get_toc_for(docname))['fragment'], # only display a TOC if there's more than one item to show Modified: doctools/trunk/sphinx/templates/layout.html ============================================================================== --- doctools/trunk/sphinx/templates/layout.html (original) +++ doctools/trunk/sphinx/templates/layout.html Tue Jun 17 12:34:51 2008 @@ -8,22 +8,12 @@
Modified: doctools/trunk/sphinx/templates/genindex.html ============================================================================== --- doctools/trunk/sphinx/templates/genindex.html (original) +++ doctools/trunk/sphinx/templates/genindex.html Thu Jun 26 13:11:20 2008 @@ -32,7 +32,7 @@ {%- endfor %}
{%- endif -%} -{%- set numitems = numitems + 1 + len(subitems) -%} +{%- set numitems = numitems + 1 + subitems|length -%} {%- if numcols < 2 and numitems > breakat -%} {%- set numcols = numcols+1 -%}
Added: doctools/trunk/sphinx/util/_json.py ============================================================================== --- (empty file) +++ doctools/trunk/sphinx/util/_json.py Thu Jun 26 13:11:20 2008 @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util._json + ~~~~~~~~~~~~~~~~~ + + This module implements a simple JSON serializer if simplejson is + unavailable. + + This is not fully JSON compliant but enough for the searchindex. + And the generated files are smaller than the simplejson ones. + + Uses the basestring encode function from simplejson. + + :copyright: Copyright 2008 by Armin Ronacher, Bob Ippolito. + :license: BSD. +""" +import re + + +# escape \, ", control characters and everything outside ASCII +ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') +ESCAPE_DICT = { + '\\': '\\\\', + '"': '\\"', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t', +} + + +def encode_basestring_ascii(s): + def replace(match): + s = match.group(0) + try: + return ESCAPE_DICT[s] + except KeyError: + n = ord(s) + if n < 0x10000: + return '\\u%04x' % (n,) + else: + # surrogate pair + n -= 0x10000 + s1 = 0xd800 | ((n >> 10) & 0x3ff) + s2 = 0xdc00 | (n & 0x3ff) + return '\\u%04x\\u%04x' % (s1, s2) + return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' + + +def dumps(obj, key=False): + if key: + if not isinstance(obj, basestring): + obj = str(obj) + return encode_basestring_ascii(obj) + if obj is None: + return 'null' + elif obj is True or obj is False: + return obj and 'true' or 'false' + elif isinstance(obj, (int, long, float)): + return str(obj) + elif isinstance(obj, dict): + return '{%s}' % ','.join('%s:%s' % ( + dumps(key, True), + dumps(value) + ) for key, value in obj.iteritems()) + elif isinstance(obj, (tuple, list, set)): + return '[%s]' % ','.join(dumps(x) for x in obj) + elif isinstance(obj, basestring): + return encode_basestring_ascii(obj) + raise TypeError(type(obj)) + + +def dump(obj, f): + f.write(dumps(obj)) Modified: doctools/trunk/sphinx/util/json.py ============================================================================== --- doctools/trunk/sphinx/util/json.py (original) +++ doctools/trunk/sphinx/util/json.py Thu Jun 26 13:11:20 2008 @@ -3,87 +3,32 @@ sphinx.util.json ~~~~~~~~~~~~~~~~ - Minimal JSON module that generates small dumps. + This module imports JSON functions from various locations. - This is not fully JSON compliant but enough for the searchindex. - And the generated files are smaller than the simplejson ones. - - Uses the basestring encode function from simplejson. - - :copyright: 2007-2008 by Armin Ronacher, Bob Ippolito. + :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ -import re - -# escape \, ", control characters and everything outside ASCII -ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') -ESCAPE_DICT = { - '\\': '\\\\', - '"': '\\"', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', -} - - -def encode_basestring_ascii(s): - def replace(match): - s = match.group(0) - try: - return ESCAPE_DICT[s] - except KeyError: - n = ord(s) - if n < 0x10000: - return '\\u%04x' % (n,) - else: - # surrogate pair - n -= 0x10000 - s1 = 0xd800 | ((n >> 10) & 0x3ff) - s2 = 0xdc00 | (n & 0x3ff) - return '\\u%04x\\u%04x' % (s1, s2) - return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' - - -def dump_json(obj, key=False): - if key: - if not isinstance(obj, basestring): - obj = str(obj) - return encode_basestring_ascii(obj) - if obj is None: - return 'null' - elif obj is True or obj is False: - return obj and 'true' or 'false' - elif isinstance(obj, (int, long, float)): - return str(obj) - elif isinstance(obj, dict): - return '{%s}' % ','.join('%s:%s' % ( - dump_json(key, True), - dump_json(value) - ) for key, value in obj.iteritems()) - elif isinstance(obj, (tuple, list, set)): - return '[%s]' % ','.join(dump_json(x) for x in obj) - elif isinstance(obj, basestring): - return encode_basestring_ascii(obj) - raise TypeError(type(obj)) - - -STRING = re.compile(r'("(\\\\|\\"|[^"])*")') - -def load_json(s): - d = {'null': None, 'true': True, 'false': False} - s = STRING.sub(r'u\1', s) - return eval(s, d) - - -# serializer interface -dumps = dump_json -loads = load_json +# if no simplejson is available this module can not load json files. +can_load = True -def dump(obj, f): - f.write(dumps(obj)) +# unset __name__ for a moment so that the import goes straight into +# the stdlib for python 2.4. +_old_name = __name__ +del __name__ + +try: + from simplejson import dumps, dump, loads, load +except ImportError: + try: + from json import dumps, dump, loads, load + except ImportError: + from sphinx.util._json import dumps, dump + def _dummy(x): + raise NotImplementedError('simplejson unavailable, can\'t load') + load = loads = _dummy + can_load = False + del _dummy -def load(f): - return loads(f.read()) +__name__ = _old_name +del _old_name From python-checkins at python.org Thu Jun 26 13:13:44 2008 From: python-checkins at python.org (armin.ronacher) Date: Thu, 26 Jun 2008 13:13:44 +0200 (CEST) Subject: [Python-checkins] r64531 - doctools/trunk/doc/builders.rst Message-ID: <20080626111344.8833C1E400C@bag.python.org> Author: armin.ronacher Date: Thu Jun 26 13:13:44 2008 New Revision: 64531 Log: Fixed a syntax error in the builder documentation. Modified: doctools/trunk/doc/builders.rst Modified: doctools/trunk/doc/builders.rst ============================================================================== --- doctools/trunk/doc/builders.rst (original) +++ doctools/trunk/doc/builders.rst Thu Jun 26 13:13:44 2008 @@ -89,7 +89,7 @@ import phpserialize - classs PHPSerializedBuilder(SerializingHTMLBuilder): + class PHPSerializedBuilder(SerializingHTMLBuilder): name = 'phpserialized' implementation = phpserialize out_suffix = '.file.phpdump' From python-checkins at python.org Thu Jun 26 16:32:11 2008 From: python-checkins at python.org (thomas.lee) Date: Thu, 26 Jun 2008 16:32:11 +0200 (CEST) Subject: [Python-checkins] r64532 - in python/branches/tlee-ast-optimize: Lib/test/test_cpickle.py Mac/Makefile.in Modules/cPickle.c Message-ID: <20080626143211.221C51E4003@bag.python.org> Author: thomas.lee Date: Thu Jun 26 16:32:10 2008 New Revision: 64532 Log: Merged revisions 64525-64531 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64526 | mark.dickinson | 2008-06-26 01:29:32 +1000 (Thu, 26 Jun 2008) | 2 lines issue #3199: Fix typo in Mac/Makefile.in ........ r64527 | facundo.batista | 2008-06-26 05:24:53 +1000 (Thu, 26 Jun 2008) | 9 lines Reverting the patch from #3165, as it broke other behaviours. I left the original test commented out (note that that test came from #2702, which seems to have a problem in FreeBSD and Windows, but not in Linux). I included a new test, to watch over the now-broken behaviour, I took it from #3179. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py python/branches/tlee-ast-optimize/Mac/Makefile.in python/branches/tlee-ast-optimize/Modules/cPickle.c Modified: python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py Thu Jun 26 16:32:10 2008 @@ -94,16 +94,28 @@ pass class cPickleDeepRecursive(unittest.TestCase): - '''Issue 2702. This should raise a RecursionLimit but in some - platforms (FreeBSD, win32) sometimes raises KeyError instead, - or just silently terminates the interpreter (=crashes). - ''' - def test_deep_recursive(self): - nodes = [Node() for i in range(500)] - for n in nodes: - n.connections = list(nodes) - n.connections.remove(n) - self.assertRaises(RuntimeError, cPickle.dumps, n) +# I commented out, because the patch that fixes this was reverted, as +# it broke the next test case. Check the issues for full history. +# def test_issue2702(self): +# '''This should raise a RecursionLimit but in some +# platforms (FreeBSD, win32) sometimes raises KeyError instead, +# or just silently terminates the interpreter (=crashes). +# ''' +# nodes = [Node() for i in range(500)] +# for n in nodes: +# n.connections = list(nodes) +# n.connections.remove(n) +# self.assertRaises(RuntimeError, cPickle.dumps, n) + + def test_issue3179(self): + '''Safe test, because of I broken this case when fixing the + behaviour for the previous test. + ''' + res=[] + for x in range(1,2000): + res.append(dict(doc=x, similar=[])) + cPickle.dumps(res) + def test_main(): test_support.run_unittest( Modified: python/branches/tlee-ast-optimize/Mac/Makefile.in ============================================================================== --- python/branches/tlee-ast-optimize/Mac/Makefile.in (original) +++ python/branches/tlee-ast-optimize/Mac/Makefile.in Thu Jun 26 16:32:10 2008 @@ -113,7 +113,7 @@ $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ fi for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ - pydoc$(VERSION) python$(VERSION)-config) smtpd$(VERSION).py ;\ + pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\ do \ ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ done Modified: python/branches/tlee-ast-optimize/Modules/cPickle.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cPickle.c (original) +++ python/branches/tlee-ast-optimize/Modules/cPickle.c Thu Jun 26 16:32:10 2008 @@ -1523,8 +1523,6 @@ static char append = APPEND; static char appends = APPENDS; - self->nesting++; - assert(iter != NULL); if (self->proto == 0) { @@ -1664,8 +1662,6 @@ static char setitem = SETITEM; static char setitems = SETITEMS; - self->nesting++; - assert(iter != NULL); if (self->proto == 0) { From python-checkins at python.org Thu Jun 26 17:20:35 2008 From: python-checkins at python.org (robert.schuppenies) Date: Thu, 26 Jun 2008 17:20:35 +0200 (CEST) Subject: [Python-checkins] r64533 - in python/trunk: Lib/test/test_sys.py Objects/dictobject.c Message-ID: <20080626152035.EB7771E401C@bag.python.org> Author: robert.schuppenies Date: Thu Jun 26 17:20:35 2008 New Revision: 64533 Log: Corrected inconsistencies in sizeof tests and addressed issue pointed out by Jean Brouwers. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Objects/dictobject.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Thu Jun 26 17:20:35 2008 @@ -416,7 +416,7 @@ self.P = len(struct.pack('P', 0)) # due to missing size_t information from struct, it is assumed that # sizeof(Py_ssize_t) = sizeof(void*) - self.header = 'lP' + self.header = 'PP' if hasattr(sys, "gettotalrefcount"): self.header += '2P' self.file = open(test.test_support.TESTFN, 'wb') @@ -480,7 +480,7 @@ self.check_sizeof(float(0), size(h + 'd')) # function def func(): pass - self.check_sizeof(func, size(h + '9l')) + self.check_sizeof(func, size(h + '9P')) class c(): @staticmethod def foo(): @@ -489,9 +489,9 @@ def bar(cls): pass # staticmethod - self.check_sizeof(foo, size(h + 'l')) + self.check_sizeof(foo, size(h + 'P')) # classmethod - self.check_sizeof(bar, size(h + 'l')) + self.check_sizeof(bar, size(h + 'P')) # generator def get_gen(): yield 1 self.check_sizeof(get_gen(), size(h + 'Pi2P')) @@ -502,11 +502,11 @@ # module self.check_sizeof(unittest, size(h + 'P')) # xrange - self.check_sizeof(xrange(1), size(h + '3P')) + self.check_sizeof(xrange(1), size(h + '3l')) # slice self.check_sizeof(slice(0), size(h + '3P')) - h += 'l' + h += 'P' # new-style class class class_newstyle(object): def method(): @@ -520,12 +520,9 @@ h = self.header size = self.calcsize # dict - self.check_sizeof({}, size(h + '3P3P') + 8*size('P2P')) + self.check_sizeof({}, size(h + '3P2P') + 8*size('P2P')) longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} - self.check_sizeof(longdict, size(h + '3P3P') + (8+16)*size('P2P')) - # list - self.check_sizeof([], size(h + 'lPP')) - self.check_sizeof([1, 2, 3], size(h + 'lPP') + 3*self.P) + self.check_sizeof(longdict, size(h + '3P2P') + (8+16)*size('P2P')) # unicode usize = len(u'\0'.encode('unicode-internal')) samples = [u'', u'1'*100] @@ -544,7 +541,10 @@ finally: self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) - h += 'l' + h += 'P' + # list + self.check_sizeof([], size(h + 'PP')) + self.check_sizeof([1, 2, 3], size(h + 'PP') + 3*self.P) # long self.check_sizeof(0L, size(h + 'H')) self.check_sizeof(1L, size(h + 'H')) Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Thu Jun 26 17:20:35 2008 @@ -2037,7 +2037,7 @@ { Py_ssize_t res; - res = sizeof(PyDictObject) + sizeof(mp->ma_table); + res = sizeof(PyDictObject); if (mp->ma_table != mp->ma_smalltable) res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry); return PyInt_FromSsize_t(res); From python-checkins at python.org Thu Jun 26 20:55:37 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 26 Jun 2008 20:55:37 +0200 (CEST) Subject: [Python-checkins] r64535 - python/trunk/Doc/library/socketserver.rst Message-ID: <20080626185537.E34BD1E4013@bag.python.org> Author: georg.brandl Date: Thu Jun 26 20:55:37 2008 New Revision: 64535 Log: Add a version tag for shutdown(). Modified: python/trunk/Doc/library/socketserver.rst Modified: python/trunk/Doc/library/socketserver.rst ============================================================================== --- python/trunk/Doc/library/socketserver.rst (original) +++ python/trunk/Doc/library/socketserver.rst Thu Jun 26 20:55:37 2008 @@ -158,6 +158,8 @@ Tells the :meth:`serve_forever` loop to stop and waits until it does. + .. versionadded:: 2.6 + .. data:: address_family From python-checkins at python.org Thu Jun 26 21:10:59 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 26 Jun 2008 21:10:59 +0200 (CEST) Subject: [Python-checkins] r64537 - doctools/branches/0.4.x Message-ID: <20080626191059.B5AF31E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 26 21:10:59 2008 New Revision: 64537 Log: Make a branch for 0.4 bugfixes. Added: doctools/branches/0.4.x/ - copied from r64488, /doctools/trunk/ From python-checkins at python.org Thu Jun 26 21:12:49 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 26 Jun 2008 21:12:49 +0200 (CEST) Subject: [Python-checkins] r64538 - doctools/trunk Message-ID: <20080626191249.2D4291E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 26 21:12:48 2008 New Revision: 64538 Log: Initialized merge tracking via "svnmerge" with revisions "1-64537" from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x Modified: doctools/trunk/ (props changed) From buildbot at python.org Thu Jun 26 22:34:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 20:34:35 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD trunk Message-ID: <20080626203436.049061E4003@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%20trunk/builds/1267 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 26 22:36:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 20:36:51 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 2.5 Message-ID: <20080626203651.355DD1E4014@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%202.5/builds/200 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jun 26 22:43:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 20:43:01 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080626204302.4BD251E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1066 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Thu Jun 26 22:46:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 20:46:46 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080626204704.EF2721E4003@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/690 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_ctypes test_pickletools test_sys ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 19, in dumps return pickle.dumps(item) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_1) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 71, in dumps return pickle.dumps(item, 1) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\ctypes\test\test_pickling.py", line 75, in dumps return pickle.dumps(item, 2) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance sincerely, -The Buildbot From python-checkins at python.org Thu Jun 26 22:57:36 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 26 Jun 2008 22:57:36 +0200 (CEST) Subject: [Python-checkins] r64540 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080626205736.3EB061E4010@bag.python.org> Author: guilherme.polo Date: Thu Jun 26 22:57:35 2008 New Revision: 64540 Log: Added some widget factories; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Thu Jun 26 22:57:35 2008 @@ -18,11 +18,14 @@ def available_widgets(): """Returns a list of Ttk widgets.""" - widgets = [] + widgets = {} # will discard Style and extension classes unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') # some widgets contain Vertical and Horizontal layouts special = ('Progressbar', 'Scale', 'Scrollbar') + sample_text = ('Button', 'Checkbutton', 'Label', 'Radiobutton') + sample_text_size = ('Labelframe', ) + sample_progress = ('Progressbar', ) for name in ttk.__all__: if name in unwanted_names: @@ -33,14 +36,41 @@ # do not add aliases continue + widget_d = {'factory': None, 'layouts': None} + if name in special: - widgets.append((name, ('Horizontal', 'Vertical'))) - else: - widgets.append(name) + widget_d['layouts'] = ('Horizontal', 'Vertical') + + if name in sample_text: + widget_d['factory'] = widget_text + elif name in sample_text_size: + widget_d['factory'] = widget_text_size + elif name in sample_progress: + widget_d['factory'] = widget_progress + + widgets[name] = widget_d return widgets +def widget_text(widget, master, text="Sample", **kw): + """Instantiate widget and set its text option to a custom value.""" + return widget(master, text=text, **kw) + + +def widget_text_size(widget, master, text="Sample", width=150, **kw): + """Instantiate widget and set its text option to a custom value and + set a size for it.""" + return widget(master, text=text, width=width, height=width, **kw) + + +def widget_progress(widget, master, maximum=10, **kw): + """Instantiate a progressbar and step it a bit.""" + w = widget(master, maximum=maximum, **kw) + w.step(4) + return w + + class AutoScroll(object): """Configure the scrollbars for a widget.""" @@ -142,14 +172,18 @@ opts = {'orient': complement.lower()} # create a sample widget - sample = getattr(ttk, widget_name)(self._preview_area, **opts) + if widget.get('factory', None): + widget_class = getattr(ttk, widget_name) + sample = widget['factory'](widget_class, self._preview_area, **opts) + else: + sample = getattr(ttk, widget_name)(self._preview_area, **opts) if widget['class'] is None: widget['class'] = "%s%s%s" % (complement, '.' if complement else '', sample.winfo_class()) sample['style'] = 'Custom.%s' % widget['class'] if self._current_widget['widget'] is not None: self._current_widget['widget'].pack_forget() - sample.pack() + sample.pack(expand=True) self._current_widget['layout'] = sample['style'] self._current_widget['widget'] = sample @@ -272,7 +306,8 @@ # preview area self._preview_area = ttk.Frame(topright, width=200, padding=12) - self._preview_area.pack(anchor='center', side='left', expand=True) + self._preview_area.pack(anchor='center', side='left', expand=True, + fill='both') # options, images and themes frames = ttk.Frame(topright) @@ -331,19 +366,18 @@ """Insert available widgets to the treeview.""" self._widget = {} widgets = available_widgets() - for widget in widgets: - if isinstance(widget, tuple): # horizontal/vertical layout - widget, children = widget - else: - children = () + for name, opts in sorted(widgets.items()): + children = opts.pop('layouts') or () - parent = self._tv_widgets.insert('', 'end', text=widget) - self._widget[widget] = {'tv_item': parent, 'class': None} + parent = self._tv_widgets.insert('', 'end', text=name) + self._widget[name] = {'tv_item': parent, 'class': None} + self._widget[name].update(opts) for child in children: - child_name = '%s.%s' % (child, widget) + child_name = '%s.%s' % (child, name) item = self._tv_widgets.insert(parent, 'end', text=child_name) self._widget[child_name] = {'tv_item': item, 'class': None} + self._widget[child_name].update(opts) def main(args=None): From python-checkins at python.org Thu Jun 26 22:58:18 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 26 Jun 2008 22:58:18 +0200 (CEST) Subject: [Python-checkins] r64541 - in doctools/trunk/sphinx/templates: genindex-single.html genindex.html Message-ID: <20080626205818.E9A5C1E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 26 22:58:18 2008 New Revision: 64541 Log: Fix precedence. Modified: doctools/trunk/sphinx/templates/genindex-single.html doctools/trunk/sphinx/templates/genindex.html Modified: doctools/trunk/sphinx/templates/genindex-single.html ============================================================================== --- doctools/trunk/sphinx/templates/genindex-single.html (original) +++ doctools/trunk/sphinx/templates/genindex-single.html Thu Jun 26 22:58:18 2008 @@ -24,7 +24,7 @@ {%- endfor %}
{%- endif -%} -{%- set numitems = numitems + 1 + subitems|length -%} +{%- set numitems = numitems + 1 + (subitems|length) -%} {%- if numcols < 2 and numitems > breakat -%} {%- set numcols = numcols+1 -%}
Modified: doctools/trunk/sphinx/templates/genindex.html ============================================================================== --- doctools/trunk/sphinx/templates/genindex.html (original) +++ doctools/trunk/sphinx/templates/genindex.html Thu Jun 26 22:58:18 2008 @@ -32,7 +32,7 @@ {%- endfor %}
{%- endif -%} -{%- set numitems = numitems + 1 + subitems|length -%} +{%- set numitems = numitems + 1 + (subitems|length) -%} {%- if numcols < 2 and numitems > breakat -%} {%- set numcols = numcols+1 -%}
From python-checkins at python.org Thu Jun 26 22:58:40 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 26 Jun 2008 22:58:40 +0200 (CEST) Subject: [Python-checkins] r64542 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080626205840.B79BD1E4003@bag.python.org> Author: guilherme.polo Date: Thu Jun 26 22:58:40 2008 New Revision: 64542 Log: Removed trailling whitespaces Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Thu Jun 26 22:58:40 2008 @@ -1392,7 +1392,7 @@ """Construct a LabeledScale with parent master, a variable to be associated with the Ttk Scale widget and its range. If variable is not specified, a Tkinter.IntVar is created. - + WIDGET-SPECIFIC OPTIONS compound: 'top' or 'bottom' Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Thu Jun 26 22:58:40 2008 @@ -1392,9 +1392,9 @@ """Construct a LabeledScale with parent master, a variable to be associated with the Ttk Scale widget and its range. If variable is not specified, a tkinter.IntVar is created. - + WIDGET-SPECIFIC OPTIONS - + compound: 'top' or 'bottom' Specifies how to display the label relative to the scale. Defaults to 'top'. From python-checkins at python.org Thu Jun 26 23:12:55 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 26 Jun 2008 23:12:55 +0200 (CEST) Subject: [Python-checkins] r64544 - python/trunk/Doc/Makefile Message-ID: <20080626211255.698651E4003@bag.python.org> Author: georg.brandl Date: Thu Jun 26 23:12:55 2008 New Revision: 64544 Log: Use newer versions of externals. Modified: python/trunk/Doc/Makefile Modified: python/trunk/Doc/Makefile ============================================================================== --- python/trunk/Doc/Makefile (original) +++ python/trunk/Doc/Makefile Thu Jun 26 23:12:55 2008 @@ -33,15 +33,15 @@ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ - svn checkout $(SVNROOT)/external/docutils-0.4/docutils tools/docutils; \ + svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ fi @if [ ! -d tools/jinja ]; then \ echo "Checking out Jinja..."; \ - svn checkout $(SVNROOT)/external/Jinja-1.1/jinja tools/jinja; \ + svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \ fi @if [ ! -d tools/pygments ]; then \ echo "Checking out Pygments..."; \ - svn checkout $(SVNROOT)/external/Pygments-0.9/pygments tools/pygments; \ + svn checkout $(SVNROOT)/external/Pygments-0.10/pygments tools/pygments; \ fi update: checkout From buildbot at python.org Thu Jun 26 23:18:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 21:18:07 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080626211807.A03881E4013@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/429 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/py3k] 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 buildbot at python.org Thu Jun 26 23:19:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 21:19:32 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 2.5 Message-ID: <20080626211932.7D8A11E4003@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%202.5/builds/44 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl,gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Thu Jun 26 23:23:30 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 26 Jun 2008 23:23:30 +0200 (CEST) Subject: [Python-checkins] r64545 - python/trunk/Doc/Makefile Message-ID: <20080626212330.B779C1E4003@bag.python.org> Author: benjamin.peterson Date: Thu Jun 26 23:23:30 2008 New Revision: 64545 Log: add a htmlview directive Modified: python/trunk/Doc/Makefile Modified: python/trunk/Doc/Makefile ============================================================================== --- python/trunk/Doc/Makefile (original) +++ python/trunk/Doc/Makefile Thu Jun 26 23:23:30 2008 @@ -103,6 +103,8 @@ @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ "into the Lib/ directory" +htmlview: html + $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" clean: -rm -rf build/* -rm -rf tools/sphinx From python-checkins at python.org Thu Jun 26 23:24:35 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 26 Jun 2008 23:24:35 +0200 (CEST) Subject: [Python-checkins] r64546 - python/trunk/Lib/multiprocessing/managers.py Message-ID: <20080626212435.D13C61E4003@bag.python.org> Author: benjamin.peterson Date: Thu Jun 26 23:24:35 2008 New Revision: 64546 Log: use the new API Modified: python/trunk/Lib/multiprocessing/managers.py Modified: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- python/trunk/Lib/multiprocessing/managers.py (original) +++ python/trunk/Lib/multiprocessing/managers.py Thu Jun 26 23:24:35 2008 @@ -967,7 +967,7 @@ # XXX will Event.isSet name be available in Py3.0? _exposed_ = ('isSet', 'set', 'clear', 'wait') def is_set(self): - return self._callmethod('isSet') + return self._callmethod('is_set') def set(self): return self._callmethod('set') def clear(self): From buildbot at python.org Thu Jun 26 23:26:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 21:26:52 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20080626212653.148851E400D@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%20trunk/builds/48 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 5 tests failed: test_httpservers test_kqueue test_math test_signal test_ssl ====================================================================== ERROR: test_authorization (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_httpservers.py", line 338, in test_authorization res = self.request('/cgi-bin/file1.py', 'GET', headers=headers) File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_httpservers.py", line 64, in request return self.connection.getresponse() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 945, in getresponse response.begin() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 414, in begin self.msg = HTTPMessage(self.fp, 0) File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/mimetools.py", line 19, in __init__ rfc822.Message.__init__(self, fp, seekable) File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/rfc822.py", line 107, in __init__ self.readheaders() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 270, in readheaders line = self.fp.readline() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/socket.py", line 395, in readline data = recv(1) error: [Errno 4] Interrupted system call ====================================================================== ERROR: test_headers_and_content (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_httpservers.py", line 319, in test_headers_and_content res = self.request('/cgi-bin/file1.py') File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_httpservers.py", line 64, in request return self.connection.getresponse() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 945, in getresponse response.begin() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 414, in begin self.msg = HTTPMessage(self.fp, 0) File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/mimetools.py", line 19, in __init__ rfc822.Message.__init__(self, fp, seekable) File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/rfc822.py", line 107, in __init__ self.readheaders() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 270, in readheaders line = self.fp.readline() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/socket.py", line 395, in readline data = recv(1) error: [Errno 4] Interrupted system call ====================================================================== ERROR: test_post (test.test_httpservers.CGIHTTPServerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_httpservers.py", line 328, in test_post self.assertEquals(res.read(), '1, python, 123456\n') File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/httplib.py", line 517, in read s = self.fp.read() File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/socket.py", line 327, in read data = self._sock.recv(rbufsize) error: [Errno 4] Interrupted system call ====================================================================== FAIL: test_queue_event (test.test_kqueue.TestKQueue) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_kqueue.py", line 118, in test_queue_event (server.fileno(), select.KQ_FILTER_WRITE, flags)]) AssertionError: [(18L, -2, 5L), (20L, -2, 5L)] != [(18, -2, 0), (20, -2, 0)] ====================================================================== FAIL: testLog (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_math.py", line 419, in testLog self.assertRaises(ValueError, math.log, NINF) AssertionError: ValueError not raised ====================================================================== FAIL: testLog10 (test.test_math.MathTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_math.py", line 441, in testLog10 self.assertRaises(ValueError, math.log10, NINF) AssertionError: ValueError not raised ====================================================================== FAIL: test_siginterrupt_off (test.test_signal.SiginterruptTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_signal.py", line 295, in test_siginterrupt_off self.assertEquals(i, False) AssertionError: True != False ====================================================================== FAIL: test_itimer_prof (test.test_signal.ItimerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_signal.py", line 382, in test_itimer_prof self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) AssertionError: (0.059999999999999998, 0.20000000000000001) != (0.0, 0.0) ====================================================================== FAIL: test_itimer_virtual (test.test_signal.ItimerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildbot/trunk.cortesi/build/Lib/test/test_signal.py", line 368, in test_itimer_virtual self.assertEquals(signal.getitimer(self.itimer), (0.0, 0.0)) AssertionError: (0.0, 0.01) != (0.0, 0.0) sincerely, -The Buildbot From python-checkins at python.org Thu Jun 26 23:29:19 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 26 Jun 2008 23:29:19 +0200 (CEST) Subject: [Python-checkins] r64547 - python/trunk/Lib/multiprocessing/managers.py Message-ID: <20080626212919.CE2291E4014@bag.python.org> Author: benjamin.peterson Date: Thu Jun 26 23:29:19 2008 New Revision: 64547 Log: fix isSet in _exposed Modified: python/trunk/Lib/multiprocessing/managers.py Modified: python/trunk/Lib/multiprocessing/managers.py ============================================================================== --- python/trunk/Lib/multiprocessing/managers.py (original) +++ python/trunk/Lib/multiprocessing/managers.py Thu Jun 26 23:29:19 2008 @@ -964,8 +964,7 @@ return self._callmethod('notify_all') class EventProxy(BaseProxy): - # XXX will Event.isSet name be available in Py3.0? - _exposed_ = ('isSet', 'set', 'clear', 'wait') + _exposed_ = ('is_set', 'set', 'clear', 'wait') def is_set(self): return self._callmethod('is_set') def set(self): From buildbot at python.org Thu Jun 26 23:34:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 21:34:32 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20080626213432.53C921E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/794 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_replication.py", line 150, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- EOF on connection from site 127.0.0.1:46704') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_replication.py", line 124, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 26 23:35:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 21:35:19 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080626213519.E00011E4003@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/693 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,eric.smith,facundo.batista,georg.brandl,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 00:16:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 22:16:03 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080626221604.0C63A1E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/547 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 00:31:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 22:31:49 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP 2.5 Message-ID: <20080626223149.AC41C1E400E@bag.python.org> The Buildbot has detected a new failure of amd64 XP 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%202.5/builds/220 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc,georg.brandl,gregory.p.smith,raymond.hettinger BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 00:58:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 22:58:11 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080626225811.2AE211E400E@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1531 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,benjamin.peterson,eric.smith,facundo.batista,georg.brandl,hyeshik.chang,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 01:05:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 23:05:28 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20080626230528.B06DF1E4003@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%20trunk/builds/51 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 01:25:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 23:25:03 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20080626232503.DD9101E4003@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/431 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl 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 buildbot at python.org Fri Jun 27 01:28:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 26 Jun 2008 23:28:26 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080626232826.7ACE81E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3626 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,andrew.kuchling,barry.warsaw,benjamin.peterson,eric.smith,facundo.batista,georg.brandl,hyeshik.chang,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: 4 tests failed: test_lib2to3 test_logging test_multiprocessing test_urllib2net Traceback (most recent call last): File "./Lib/test/regrtest.py", line 547, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_lib2to3.py", line 3, in from lib2to3.tests import test_fixers, test_pytree, test_util File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/__init__.py", line 11, in from . import support File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/support.py", line 21, in grammar = driver.load_grammar(grammar_path) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/pgen2/driver.py", line 118, in load_grammar logger = logging.getLogger() AttributeError: 'module' object has no attribute 'getLogger' Traceback (most recent call last): File "./Lib/test/regrtest.py", line 547, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_logging.py", line 25, in import logging.handlers File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/logging/handlers.py", line 50, in class BaseRotatingHandler(logging.FileHandler): AttributeError: 'module' object has no attribute 'FileHandler' Traceback (most recent call last): File "./Lib/test/regrtest.py", line 554, in runtest_inner indirect_test() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_multiprocessing.py", line 1770, in test_main multiprocessing.get_logger().setLevel(LOG_LEVEL) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/multiprocessing/__init__.py", line 146, in get_logger return get_logger() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/multiprocessing/util.py", line 73, in get_logger _check_logger_class() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/multiprocessing/util.py", line 89, in _check_logger_class OldLoggerClass = logging.getLoggerClass() AttributeError: 'module' object has no attribute 'getLoggerClass' ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 124, in test_file self._test_urls(urls, self._extra_handlers(), retry=True) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 160, in _test_urls debug = logging.getLogger("test_urllib2").debug AttributeError: 'module' object has no attribute 'getLogger' ====================================================================== ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 112, in test_ftp self._test_urls(urls, self._extra_handlers()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 160, in _test_urls debug = logging.getLogger("test_urllib2").debug AttributeError: 'module' object has no attribute 'getLogger' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 02:10:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 00:10:51 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080627001051.8A4471E4017@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1647 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,eric.smith,facundo.batista,mark.dickinson,raymond.hettinger,robert.schuppenies BUILD FAILED: failed test Excerpt from the test logfile: 22 tests failed: test_bz2 test_cookielib test_deque test_file test_filecmp test_fileinput test_gzip test_hotshot test_io test_iter test_mailbox test_marshal test_mmap test_multibytecodec test_pkgutil test_set test_shutil test_subprocess test_urllib test_urllib2 test_uu test_zipfile ====================================================================== ERROR: testIterator (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 109, in testIterator self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testModeU (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 253, in testModeU self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testOpenDel (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 242, in testOpenDel self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRead (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 62, in testRead self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRead100 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 83, in testRead100 self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadChunk10 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 70, in testReadChunk10 self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadLine (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 90, in testReadLine self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 100, in testReadLines self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekBackwards (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 197, in testSeekBackwards self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekBackwardsFromEnd (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 206, in testSeekBackwardsFromEnd self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekForward (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 188, in testSeekForward self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPostEnd (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 214, in testSeekPostEnd self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPostEndTwice (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 223, in testSeekPostEndTwice self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testSeekPreStart (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 233, in testSeekPreStart self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testUniversalNewlinesCRLF (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 133, in testUniversalNewlinesCRLF self.createTempFile(crlf=1) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ============================================================[17400 refs] ========== ERROR: testUniversalNewlinesLF (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 125, in testUniversalNewlinesLF self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWrite (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 141, in testWrite bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteChunks10 (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 151, in testWriteChunks10 bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 166, in testWriteLines bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testWriteMethodsOnReadOnlyFile (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 178, in testWriteMethodsOnReadOnlyFile bz2f = BZ2File(self.filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testXReadLines (test.test_bz2.BZ2FileTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 117, in testXReadLines self.createTempFile() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_bz2.py", line 52, in createTempFile f = open(self.filename, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bad_magic (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 268, in test_bad_magic f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_lwp_valueless_cookie (test.test_cookielib.FileCookieJarTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_cookielib.py", line 243, in test_lwp_valueless_cookie c.save(filename, ignore_discard=True) File "C:\buildbot\work\trunk.heller-windows\build\lib\_LWPCookieJar.py", line 83, in save f = open(filename, "w") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_maxlen (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 79, in test_maxlen fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_print (test.test_deque.TestBasic) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_deque.py", line 286, in test_print fo = open(test_support.TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_matching (test.test_filecmp.FileCompareTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_filecmp.py", line 13, in setUp output = open(name, 'w') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 48, in test_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readline (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 85, in test_readline self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_readlines (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 98, in test_readlines self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_read (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 112, in test_seek_read self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_whence (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 132, in test_seek_whence self.test_write() File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_seek_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 144, in test_seek_write f = gzip.GzipFile(self.filename, 'w') File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_write (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_gzip.py", line 35, in test_write f = gzip.GzipFile(self.filename, 'wb') ; f.write(data1 * 50) File "C:\buildbot\work\trunk.heller-windows\build\lib\gzip.py", line 79, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_close_flushes (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 251, in test_close_flushes f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_destructor (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 245, in test_destructor f = MyFileIO(test_support.TESTFN, "w") IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_large_file_ops (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 211, in test_large_file_ops f = io.open(test_support.TESTFN, "w+b", 0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_raw_file_io (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 151, in test_raw_file_io f = io.open(test_support.TESTFN, "wb", buffering=0) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_readline (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 179, in test_readline f = io.open(test_support.TESTFN, "wb") File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: test_with_open (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 221, in test_with_open with open(test_support.TESTFN, "wb", bufsize) as f: IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testBasicIO (test.test_io.TextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 820, in testBasicIO f = io.open(test_support.TESTFN, "w+", encoding=enc) File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 222, in open closefd) IOError: [Errno 13] Permission denied ====================================================================== ERROR: Test seek/tell using the StatefulIncrementalDecoder. ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 946, in testSeekAndTell testSeekAndTellWithData(input) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 926, in testSeekAndTellWithData decoded = f.read() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1668, in read decoder = self._decoder or self._get_decoder() File "C:\buildbot\work\trunk.heller-windows\build\lib\io.py", line 1457, in _get_decoder decoder = make_decoder(self._errors) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_io.py", line 523, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_add_and_close (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_from_string (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_mbox_or_mmdf_message (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_close (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_items (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_open_close_open (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_relock (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_update (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_values (test.test_mailbox.TestMbox) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 811, in _factory = lambda self, path, factory=None: mailbox.mbox(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 736, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_and_close (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_from_string (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_mbox_or_mmdf_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_close (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_items (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_conflict (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_lock_unlock (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_open_close_open (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_pop (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_popitem (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_relock (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_remove (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_set_item (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_update (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_values (test.test_mailbox.TestMMDF) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 816, in _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 768, in __init__ _mboxMMDF.__init__(self, path, factory, create) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 515, in __init__ f = open(self._path, 'rb') IOError: [Errno 13] Permission denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_add_and_remove_folders (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_clear (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_close (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_contains (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_delitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_discard (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_dump_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_flush (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_file (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_folder (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_message (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_get_string (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_getitem (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_has_key (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_items (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iter (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iteritems (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_iterkeys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_itervalues (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_keys (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_len (test.test_mailbox.TestMH) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 58, in setUp self._box = self._factory(self._path) File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mailbox.py", line 821, in _factory = lambda self, path, factory=None: mailbox.MH(path, factory) File "C:\buildbot\work\trunk.heller-windows\build\lib\mailbox.py", line 815, in __init__ os.mkdir(self._path, 0700) WindowsError: [Error 5] Access is denied: 'C:\\buildbot\\work\\trunk.heller-windows\\build\\PCbuild\\@test' ====================================================================== ERROR: test_floats (test.test_marshal.FloatTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 70, in test_floats marshal.dump(f, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_buffer (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 135, in test_buffer marshal.dump(b, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_string (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 124, in test_string marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_unicode (test.test_marshal.StringTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 113, in test_unicode marshal.dump(s, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_dict (test.test_marshal.ContainerTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_marshal.py", line 164, in test_dict marshal.dump(self.d, file(test_support.TESTFN, "wb")) IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_rfind (test.test_mmap.MmapTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_mmap.py", line 280, in test_rfind f = open(TESTFN, 'w+') IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: test_bug1728403 (test.test_multibytecodec.Test_StreamReader) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_multibytecodec.py", line 148, in test_bug1728403 os.unlink(TESTFN) WindowsError: [Error 5] Access is denied: '@test' ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_urllib2.py", line 614, in test_file f = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRandomOpenDeflated (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testRandomOpenStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadlineDeflated (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadlineStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadlinesDeflated (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testReadlinesStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testStored (test.test_zipfile.TestsWithSourceFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 31, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testGoodPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 746, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' ====================================================================== ERROR: testNoPassword (test.test_zipfile.DecryptionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\buildbot\work\trunk.heller-windows\build\lib\test\test_zipfile.py", line 746, in setUp fp = open(TESTFN, "wb") IOError: [Errno 13] Permission denied: '@test' sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 02:31:14 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jun 2008 02:31:14 +0200 (CEST) Subject: [Python-checkins] r64549 - in python/trunk: Lib/test/test_warnings.py Lib/warnings.py Misc/NEWS Python/_warnings.c Message-ID: <20080627003114.804531E4003@bag.python.org> Author: brett.cannon Date: Fri Jun 27 02:31:13 2008 New Revision: 64549 Log: warnings.warn_explicit() did not have the proper TypeErrors in place to prevent bus errors or SystemError being raised. As a side effect of fixing this, a bad DECREF that could be triggered when 'message' and 'category' were both None was fixed. Closes issue 3211. Thanks JP Calderone for the bug report. Modified: python/trunk/Lib/test/test_warnings.py python/trunk/Lib/warnings.py python/trunk/Misc/NEWS python/trunk/Python/_warnings.c Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Fri Jun 27 02:31:13 2008 @@ -301,6 +301,21 @@ warning_tests.__name__ = module_name sys.argv = argv + def test_warn_explicit_type_errors(self): + # warn_explicit() shoud error out gracefully if it is given objects + # of the wrong types. + # lineno is expected to be an integer. + self.assertRaises(TypeError, self.module.warn_explicit, + None, UserWarning, None, None) + # Either 'message' needs to be an instance of Warning or 'category' + # needs to be a subclass. + self.assertRaises(TypeError, self.module.warn_explicit, + None, None, None, 1) + # 'registry' must be a dict or None. + self.assertRaises((TypeError, AttributeError), + self.module.warn_explicit, + None, Warning, None, 1, registry=42) + class CWarnTests(BaseTest, WarnTests): Modified: python/trunk/Lib/warnings.py ============================================================================== --- python/trunk/Lib/warnings.py (original) +++ python/trunk/Lib/warnings.py Fri Jun 27 02:31:13 2008 @@ -202,6 +202,7 @@ def warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None): + lineno = int(lineno) if module is None: module = filename or "" if module[-3:].lower() == ".py": Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 27 02:31:13 2008 @@ -25,6 +25,11 @@ Core and Builtins ----------------- +- Issue #3211: warnings.warn_explicit() did not guard against its 'registry' + argument being anything other than a dict or None. Also fixed a bug in error + handling when 'message' and 'category' were both set to None, triggering a + bus error. + - Issue #3100: Corrected a crash on deallocation of a subclassed weakref which holds the last (strong) reference to its referent. Modified: python/trunk/Python/_warnings.c ============================================================================== --- python/trunk/Python/_warnings.c (original) +++ python/trunk/Python/_warnings.c Fri Jun 27 02:31:13 2008 @@ -280,6 +280,11 @@ PyObject *item = Py_None; const char *action; int rc; + + if (registry && !PyDict_Check(registry) && (registry != Py_None)) { + PyErr_SetString(PyExc_TypeError, "'registry' must be a dict"); + return NULL; + } /* Normalize module. */ if (module == NULL) { @@ -303,6 +308,8 @@ else { text = message; message = PyObject_CallFunction(category, "O", message); + if (message == NULL) + goto cleanup; } lineno_obj = PyInt_FromLong(lineno); @@ -314,7 +321,7 @@ if (key == NULL) goto cleanup; - if (registry != NULL) { + if ((registry != NULL) && (registry != Py_None)) { rc = already_warned(registry, key, 0); if (rc == -1) goto cleanup; @@ -336,12 +343,13 @@ is "always". */ rc = 0; if (strcmp(action, "always") != 0) { - if (registry != NULL && PyDict_SetItem(registry, key, Py_True) < 0) + if (registry != NULL && registry != Py_None && + PyDict_SetItem(registry, key, Py_True) < 0) goto cleanup; else if (strcmp(action, "ignore") == 0) goto return_none; else if (strcmp(action, "once") == 0) { - if (registry == NULL) { + if (registry == NULL || registry == Py_None) { registry = get_once_registry(); if (registry == NULL) goto cleanup; @@ -351,7 +359,7 @@ } else if (strcmp(action, "module") == 0) { /* registry[(text, category, 0)] = 1 */ - if (registry != NULL) + if (registry != NULL && registry != Py_None) rc = update_registry(registry, text, category, 0); } else if (strcmp(action, "default") != 0) { @@ -435,7 +443,7 @@ Py_XDECREF(text); Py_XDECREF(lineno_obj); Py_DECREF(module); - Py_DECREF(message); + Py_XDECREF(message); return result; /* Py_None or NULL. */ } From buildbot at python.org Fri Jun 27 02:31:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 00:31:25 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080627003125.51BF41E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1069 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,eric.smith,georg.brandl,mark.dickinson,raymond.hettinger BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 02:32:16 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jun 2008 02:32:16 +0200 (CEST) Subject: [Python-checkins] r64550 - python/trunk/Lib/multiprocessing/dummy Message-ID: <20080627003216.E68A01E4003@bag.python.org> Author: brett.cannon Date: Fri Jun 27 02:32:16 2008 New Revision: 64550 Log: Ignore .pyc and .pyo files. Modified: python/trunk/Lib/multiprocessing/dummy/ (props changed) From buildbot at python.org Fri Jun 27 03:28:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 01:28:24 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080627012825.148FE1E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/253 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,eric.smith,facundo.batista,georg.brandl,mark.dickinson,raymond.hettinger,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 03:36:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 01:36:19 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD trunk Message-ID: <20080627013619.CAF2D1E4003@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%20trunk/builds/1270 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,eric.smith,facundo.batista,georg.brandl,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 04:09:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 02:09:49 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080627020949.8CFB01E4003@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1153 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: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 04:24:49 2008 From: python-checkins at python.org (trent.nelson) Date: Fri, 27 Jun 2008 04:24:49 +0200 (CEST) Subject: [Python-checkins] r64554 - python/trunk Message-ID: <20080627022449.A2CA91E4003@bag.python.org> Author: trent.nelson Date: Fri Jun 27 04:24:49 2008 New Revision: 64554 Log: Initialized merge tracking via "svnmerge" with revisions "1-64347" from svn+ssh://pythondev at svn.python.org/python/branches/tnelson-trunk-bsddb-47-upgrade Modified: python/trunk/ (props changed) From buildbot at python.org Fri Jun 27 04:26:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 02:26:09 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080627022609.65F8B1E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1183 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 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 Fri Jun 27 04:28:33 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 02:28:33 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 3.0 Message-ID: <20080627022833.994621E4003@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%203.0/builds/1071 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows 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 Fri Jun 27 04:30:34 2008 From: python-checkins at python.org (trent.nelson) Date: Fri, 27 Jun 2008 04:30:34 +0200 (CEST) Subject: [Python-checkins] r64555 - in python/trunk: Lib/bsddb/test/test_replication.py PCbuild/_bsddb.vcproj PCbuild/_bsddb44.vcproj PCbuild/pcbuild.sln PCbuild/pyproject.vsprops Tools/buildbot/external-common.bat Message-ID: <20080627023034.B8F151E4003@bag.python.org> Author: trent.nelson Date: Fri Jun 27 04:30:34 2008 New Revision: 64555 Log: Merged revisions 64368-64369 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/tnelson-trunk-bsddb-47-upgrade ........ r64368 | trent.nelson | 2008-06-17 23:13:44 -0500 (Tue, 17 Jun 2008) | 1 line Initial commit of work pertaining to switching the Windows build from Berkeley DB 4.4.20 to 4.7.25. Note that I've deprecated the standalone '_bsddb44.vcproj' in lieu of adding the sources in a separate folder to the _bsddb project. This was a conscious decision and actually makes everything far more easier to manage. With this approach, entire test suite passed straight off the bat. Well, almost -- the timeout in bsddb/test/test_replication.py needed bumping up a little -- 2 seconds was too short. 10 seconds seems to be fine for me, but I'll make sure Jesus verifies. More documentation to come once I've been able to test out this approach on the buildbots (hence keeping the changes in a separate branch for now). ........ r64369 | trent.nelson | 2008-06-17 23:19:12 -0500 (Tue, 17 Jun 2008) | 1 line Bump Berkeley DB version from 4.4.20 to 4.7.25. ........ Removed: python/trunk/PCbuild/_bsddb44.vcproj Modified: python/trunk/ (props changed) python/trunk/Lib/bsddb/test/test_replication.py python/trunk/PCbuild/_bsddb.vcproj python/trunk/PCbuild/pcbuild.sln python/trunk/PCbuild/pyproject.vsprops python/trunk/Tools/buildbot/external-common.bat Modified: python/trunk/Lib/bsddb/test/test_replication.py ============================================================================== --- python/trunk/Lib/bsddb/test/test_replication.py (original) +++ python/trunk/Lib/bsddb/test/test_replication.py Fri Jun 27 04:30:34 2008 @@ -94,7 +94,7 @@ # The timeout is necessary in BDB 4.5, since DB_EVENT_REP_STARTUPDONE # is not generated if the master has no new transactions. # This is solved in BDB 4.6 (#15542). - timeout = time.time()+2 + timeout = time.time()+10 while (time.time()= (4,6) : Modified: python/trunk/PCbuild/_bsddb.vcproj ============================================================================== --- python/trunk/PCbuild/_bsddb.vcproj (original) +++ python/trunk/PCbuild/_bsddb.vcproj Fri Jun 27 04:30:34 2008 @@ -43,6 +43,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deleted: python/trunk/PCbuild/_bsddb44.vcproj ============================================================================== --- python/trunk/PCbuild/_bsddb44.vcproj Fri Jun 27 04:30:34 2008 +++ (empty file) @@ -1,1252 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/trunk/PCbuild/pcbuild.sln ============================================================================== --- python/trunk/PCbuild/pcbuild.sln (original) +++ python/trunk/PCbuild/pcbuild.sln Fri Jun 27 04:30:34 2008 @@ -41,7 +41,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" ProjectSection(ProjectDependencies) = postProject {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection EndProject @@ -121,11 +120,6 @@ {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" ProjectSection(ProjectDependencies) = postProject {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} @@ -510,22 +504,6 @@ {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 Modified: python/trunk/PCbuild/pyproject.vsprops ============================================================================== --- python/trunk/PCbuild/pyproject.vsprops (original) +++ python/trunk/PCbuild/pyproject.vsprops Fri Jun 27 04:30:34 2008 @@ -50,11 +50,11 @@ /> 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/539 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: trent.nelson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 05:02:29 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 03:02:29 +0000 Subject: [Python-checkins] buildbot failure in amd64 XP trunk Message-ID: <20080627030229.7A39E1E4020@bag.python.org> The Buildbot has detected a new failure of amd64 XP trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20XP%20trunk/builds/1534 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: trent.nelson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 05:19:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 03:19:32 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080627031932.998701E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/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: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 05:43:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 03:43:12 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080627034312.8136F1E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3628 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_urllib2 test_urllib2net ====================================================================== ERROR: test_trivial (test.test_urllib2.TrivialTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 36, in test_trivial f = urllib2.urlopen(file_url) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1212, in file_open return self.open_local_file(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1231, in open_local_file localfile = url2pathname(file) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 55, in url2pathname return unquote(pathname) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_file (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 621, in test_file r = h.file_open(Request(url)) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1212, in file_open return self.open_local_file(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1231, in open_local_file localfile = url2pathname(file) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 55, in url2pathname return unquote(pathname) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 581, in test_ftp r = h.ftp_open(req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1301, in ftp_open return addinfourl(fp, headers, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 724, in test_http r = h.do_open(http, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_redirect (test.test_urllib2.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 832, in test_redirect MockHeaders({"location": to_url})) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 565, in http_error_302 new = self.redirect_request(req, fp, code, msg, headers, newurl) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 545, in redirect_request raise HTTPError(req.get_full_url(), code, msg, headers, fp) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 162, in __init__ self.__super_init(fp, hdrs, url, code) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_build_opener (test.test_urllib2.MiscTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2.py", line 1046, in test_build_opener o = build_opener(FooHandler, BarHandler) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_file (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 124, in test_file self._test_urls(urls, self._extra_handlers(), retry=True) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 162, in _test_urls urlopen = urllib2.build_opener(*handlers).open File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 112, in test_ftp self._test_urls(urls, self._extra_handlers()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 162, in _test_urls urlopen = urllib2.build_opener(*handlers).open File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 461, in build_opener opener.add_handler(klass()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 673, in __init__ proxies = getproxies() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 1553, in getproxies return getproxies_environment() or getproxies_macosx_sysconf() TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_close (test.test_urllib2net.CloseSocketTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 82, in test_close response = _urlopen_with_retry("http://www.python.org/") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 230, in test_ftp_basic u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 237, in test_ftp_default_timeout u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 246, in test_ftp_no_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 252, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1292, in ftp_open fp, retrlen = fw.retrfile(file, type) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 893, in retrfile self.endtransfer), conn[1]) TypeError: 'NoneType' object is not callable ====================================================================== ERROR: test_http_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 201, in test_http_basic u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 208, in test_http_default_timeout u = _urlopen_with_retry("http://www.python.org") File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 217, in test_http_no_timeout u = _urlopen_with_retry("http://www.python.org", timeout=None) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found ====================================================================== ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 223, in test_http_timeout u = _urlopen_with_retry("http://www.python.org", timeout=120) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 26, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 380, in open response = self._open(req, data) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 398, in _open '_open', req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 358, in _call_chain result = func(*args) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1116, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib2.py", line 1107, in do_open resp = addinfourl(fp, r.msg, req.get_full_url()) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/urllib.py", line 968, in __init__ addbase.__init__(self, fp) TypeError: expected string or Unicode object, NoneType found make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 06:04:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 04:04:34 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20080627040434.6CFD91E4003@bag.python.org> The Buildbot has detected a new failure of x86 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20W2k8%20trunk/builds/812 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,andrew.kuchling,barry.warsaw,benjamin.peterson,brett.cannon,eric.smith,facundo.batista,georg.brandl,hyeshik.chang,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller,trent.nelson,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: 4 tests failed: test_ctypes test_site test_sys test_wsgiref ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 19, in dumps return pickle.dumps(item) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_1) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 71, in dumps return pickle.dumps(item, 1) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "S:\buildbots\python\trunk.nelson-windows\build\lib\ctypes\test\test_pickling.py", line 75, in dumps return pickle.dumps(item, 2) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "S:\buildbots\python\trunk.nelson-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_site.py", line 115, in test_s_option env=env) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 444, in call return Popen(*popenargs, **kwargs).wait() File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: test_ioencoding (test.test_sys.SysModuleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_sys.py", line 398, in test_ioencoding stdout = subprocess.PIPE, env=env) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "S:\buildbots\python\trunk.nelson-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: testEnviron (test.test_wsgiref.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_wsgiref.py", line 437, in testEnviron self.checkOSEnviron(h) File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_wsgiref.py", line 429, in checkOSEnviron self.assertEqual(env[k],v) KeyError: 'TCL_LIBRARY' ====================================================================== FAIL: test_simple_validation_error (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_wsgiref.py", line 157, in test_simple_validation_error "AssertionError: Headers (('Content-Type', 'text/plain')) must" AssertionError: "AssertionError: Environmental variable LIB is not a string: (value: u'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 9.0\\\\VC\\\\ATLMFC\\\\LIB;C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 9.0\\\\VC\\\\LIB;C:\\\\Program Files\\\\Microsoft SDKs\\\\Windows\\\\v6.1\\\\lib')" != "AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: " ====================================================================== FAIL: test_validated_hello (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_wsgiref.py", line 145, in test_validated_hello self.check_hello(out, has_length=False) File "S:\buildbots\python\trunk.nelson-windows\build\lib\test\test_wsgiref.py", line 134, in check_hello "\r\n" AssertionError: 'HTTP/1.0 500 Dude, this is whack!\r\nDate: Fri, 27 Jun 2008 04:02:20 GMT\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nContent-Length: 59\r\n\r\nA server error occurred. Please contact the administrator.' != 'HTTP/1.0 200 OK\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nDate: Mon, 05 Jun 2006 18:49:54 GMT\r\n\r\nHello, world!' sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 06:18:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 04:18:07 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20080627041807.4ABAE1E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/797 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_replication.py", line 150, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- EOF on connection from site 127.0.0.1:53687') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_replication.py", line 124, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 07:08:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 05:08:26 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080627050826.920FC1E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/550 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: trent.nelson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 08:18:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 06:18:16 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080627061816.49A2E1E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1053 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: trent.nelson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 12:11:53 2008 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jun 2008 12:11:53 +0200 (CEST) Subject: [Python-checkins] r64557 - in python/trunk/Lib: fractions.py test/test_fractions.py Message-ID: <20080627101153.777491E4003@bag.python.org> Author: mark.dickinson Date: Fri Jun 27 12:11:52 2008 New Revision: 64557 Log: Remove trailing 'L's from numerator and denominator in the repr() of a Fraction instance. Modified: python/trunk/Lib/fractions.py python/trunk/Lib/test/test_fractions.py Modified: python/trunk/Lib/fractions.py ============================================================================== --- python/trunk/Lib/fractions.py (original) +++ python/trunk/Lib/fractions.py Fri Jun 27 12:11:52 2008 @@ -203,7 +203,7 @@ def __repr__(self): """repr(self)""" - return ('Fraction(%r, %r)' % (self._numerator, self._denominator)) + return ('Fraction(%s, %s)' % (self._numerator, self._denominator)) def __str__(self): """str(self)""" Modified: python/trunk/Lib/test/test_fractions.py ============================================================================== --- python/trunk/Lib/test/test_fractions.py (original) +++ python/trunk/Lib/test/test_fractions.py Fri Jun 27 12:11:52 2008 @@ -351,6 +351,10 @@ def testStringification(self): self.assertEquals("Fraction(7, 3)", repr(F(7, 3))) + self.assertEquals("Fraction(6283185307, 2000000000)", + repr(F('3.1415926535'))) + self.assertEquals("Fraction(-1, 100000000000000000000)", + repr(F(1, -10**20))) self.assertEquals("7/3", str(F(7, 3))) self.assertEquals("7", str(F(7, 1))) From buildbot at python.org Fri Jun 27 13:00:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 11:00:48 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20080627110048.A40C31E4003@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/541 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: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 13:03:22 2008 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jun 2008 13:03:22 +0200 (CEST) Subject: [Python-checkins] r64558 - python/trunk/Misc/ACKS Message-ID: <20080627110322.298DA1E4003@bag.python.org> Author: mark.dickinson Date: Fri Jun 27 13:03:21 2008 New Revision: 64558 Log: Add Jean Brouwers for his work on math.sum Modified: python/trunk/Misc/ACKS Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Fri Jun 27 13:03:21 2008 @@ -88,6 +88,7 @@ Tom Bridgman Richard Brodie Daniel Brotsky +Jean Brouwers Gary S. Brown Oleg Broytmann Dave Brueck From buildbot at python.org Fri Jun 27 13:03:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 11:03:24 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080627110324.B22B31E400D@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/698 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 4 tests failed: test_bsddb3 test_subprocess test_sys test_wsgiref ====================================================================== FAIL: testEnviron (test.test_wsgiref.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_wsgiref.py", line 437, in testEnviron self.checkOSEnviron(h) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_wsgiref.py", line 429, in checkOSEnviron self.assertEqual(env[k],v) AssertionError: u'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v3.5;C:\\Windows\\Microsoft.NET\\Framework64\\v3.5\\Microsoft .NET Framework 3.5 (Pre-Release Version);C:\\Windows\\Microsoft.NET\\Framework64\\v2.0.50727;C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\VCPackages;C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\IDE;C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\Tools;C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\Tools\\bin;C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\bin\\x64;C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\bin\\win64\\x64;C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\bin;C:\\tools;C:\\Perl64\\site\\bin;C:\\Perl64\\bin;C:\\Python25;C:\\Python25\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\Program Files (x86)\\Microsoft SQL Server\\90\\Tools\\binn;C:\\Program Files (x86)\\Subversion\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0;C:\\Windows\\idmu\\common;.;..\\..\\tcltk64\\bin' != 'C:\\tools;C:\\Perl64\\site\\bin;C:\\Perl64\\bin;C:\\Python25\\;C:\\Python25\\Scripts;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;c:\\Program Files (x86)\\Microsoft SQL Server\\90\\Tools\\binn\\;C:\\Program Files (x86)\\Subversion\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\idmu\\common;;..\\..\\tcltk64\\bin' ====================================================================== FAIL: test_simple_validation_error (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_wsgiref.py", line 157, in test_simple_validation_error "AssertionError: Headers (('Content-Type', 'text/plain')) must" AssertionError: "AssertionError: Environmental variable LIB is not a string: (value: u'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 9.0\\\\VC\\\\ATLMFC\\\\LIB\\\\amd64;C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 9.0\\\\VC\\\\LIB\\\\amd64;C:\\\\Program Files\\\\Microsoft SDKs\\\\Windows\\\\v6.1\\\\lib\\\\x64')" != "AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: " ====================================================================== FAIL: test_validated_hello (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_wsgiref.py", line 145, in test_validated_hello self.check_hello(out, has_length=False) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_wsgiref.py", line 134, in check_hello "\r\n" AssertionError: 'HTTP/1.0 500 Dude, this is whack!\r\nDate: Fri, 27 Jun 2008 11:01:12 GMT\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nContent-Length: 59\r\n\r\nA server error occurred. Please contact the administrator.' != 'HTTP/1.0 200 OK\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nDate: Mon, 05 Jun 2006 18:49:54 GMT\r\n\r\nHello, world!' sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 13:13:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 11:13:40 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080627111340.DF9301E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3630 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmath make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 27 13:28:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 27 Jun 2008 11:28:43 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-3 trunk Message-ID: <20080627112844.015001E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-3 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-3%20trunk/builds/1652 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Fri Jun 27 14:07:31 2008 From: python-checkins at python.org (armin.ronacher) Date: Fri, 27 Jun 2008 14:07:31 +0200 (CEST) Subject: [Python-checkins] r64559 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080627120731.29D751E4003@bag.python.org> Author: armin.ronacher Date: Fri Jun 27 14:07:30 2008 New Revision: 64559 Log: Constructors that are callables but not python functions fail silently now on documentation. Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Fri Jun 27 14:07:30 2008 @@ -242,7 +242,8 @@ # for classes, the relevant signature is the __init__ method's obj = getattr(obj, '__init__', None) # classes without __init__ method? - if obj is None or obj is object.__init__: + if obj is None or obj is object.__init__ or not \ + (inspect.ismethod(obj) or inspect.isfunction(obj)): return '' argspec = inspect.getargspec(obj) if what in ('class', 'method') and argspec[0] and \ From python-checkins at python.org Fri Jun 27 18:49:27 2008 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jun 2008 18:49:27 +0200 (CEST) Subject: [Python-checkins] r64561 - python/trunk/Doc/library/fractions.rst Message-ID: <20080627164927.8391D1E4003@bag.python.org> Author: mark.dickinson Date: Fri Jun 27 18:49:27 2008 New Revision: 64561 Log: Issue #3197: rework documentation for fractions module. Modified: python/trunk/Doc/library/fractions.rst Modified: python/trunk/Doc/library/fractions.rst ============================================================================== --- python/trunk/Doc/library/fractions.rst (original) +++ python/trunk/Doc/library/fractions.rst Fri Jun 27 18:49:27 2008 @@ -9,38 +9,74 @@ .. versionadded:: 2.6 -The :mod:`fractions` module defines an immutable, infinite-precision -Fraction number class. +The :mod:`fractions` module provides support for rational number arithmetic. +A Fraction instance can be constructed from a pair of integers, from +another rational number, or from a string. + .. class:: Fraction(numerator=0, denominator=1) Fraction(other_fraction) Fraction(string) The first version requires that *numerator* and *denominator* are instances of :class:`numbers.Integral` and returns a new - ``Fraction`` representing ``numerator/denominator``. If - *denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The - second version requires that *other_fraction* is an instance of - :class:`numbers.Rational` and returns an instance of - :class:`Fraction` with the same value. The third version expects a - string of the form ``[-+]?[0-9]+(/[0-9]+)?``, optionally surrounded - by spaces. - - Implements all of the methods and operations from - :class:`numbers.Rational` and is immutable and hashable. + :class:`Fraction` instance with value ``numerator/denominator``. If + *denominator* is :const:`0`, it raises a + :exc:`ZeroDivisionError`. The second version requires that + *other_fraction* is an instance of :class:`numbers.Rational` and + returns an :class:`Fraction` instance with the same value. The + last version of the constructor expects a string or unicode + instance in one of two possible forms. The first form is:: + + [sign] numerator ['/' denominator] + + where the optional ``sign`` may be either '+' or '-' and + ``numerator`` and ``denominator`` (if present) are strings of + decimal digits. The second permitted form is that of a number + containing a decimal point:: + + [sign] integer '.' [fraction] | [sign] '.' fraction + + where ``integer`` and ``fraction`` are strings of digits. In + either form the input string may also have leading and/or trailing + whitespace. Here are some examples:: + + >>> from fractions import Fraction + >>> Fraction(16, -10) + Fraction(-8, 5) + >>> Fraction(123) + Fraction(123, 1) + >>> Fraction() + Fraction(0, 1) + >>> Fraction('3/7') + Fraction(3, 7) + [40794 refs] + >>> Fraction(' -3/7 ') + Fraction(-3, 7) + >>> Fraction('1.414213 \t\n') + Fraction(1414213, 1000000) + >>> Fraction('-.125') + Fraction(-1, 8) + + + The :class:`Fraction` class inherits from the abstract base class + :class:`numbers.Rational`, and implements all of the methods and + operations from that class. :class:`Fraction` instances are hashable, + and should be treated as immutable. In addition, + :class:`Fraction` has the following methods: .. method:: from_float(flt) - This classmethod constructs a :class:`Fraction` representing the exact + This class method constructs a :class:`Fraction` representing the exact value of *flt*, which must be a :class:`float`. Beware that ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)`` .. method:: from_decimal(dec) - This classmethod constructs a :class:`Fraction` representing the exact + This class method constructs a :class:`Fraction` representing the exact value of *dec*, which must be a :class:`decimal.Decimal`. @@ -52,34 +88,24 @@ >>> from fractions import Fraction >>> Fraction('3.1415926535897932').limit_denominator(1000) - Fraction(355L, 113L) + Fraction(355, 113) or for recovering a rational number that's represented as a float: >>> from math import pi, cos >>> Fraction.from_float(cos(pi/3)) - Fraction(4503599627370497L, 9007199254740992L) + Fraction(4503599627370497, 9007199254740992) >>> Fraction.from_float(cos(pi/3)).limit_denominator() - Fraction(1L, 2L) - - - .. method:: __floor__() - - Returns the greatest :class:`int` ``<= self``. - - - .. method:: __ceil__() - - Returns the least :class:`int` ``>= self``. + Fraction(1, 2) - .. method:: __round__() - __round__(ndigits) +.. function:: gcd(a, b) - The first version returns the nearest :class:`int` to ``self``, rounding - half to even. The second version rounds ``self`` to the nearest multiple - of ``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), - again rounding half toward even. + Return the greatest common divisor of the integers `a` and `b`. If + either `a` or `b` is nonzero, then the absolute value of `gcd(a, + b)` is the largest integer that divides both `a` and `b`. `gcd(a,b)` + has the same sign as `b` if `b` is nonzero; otherwise it takes the sign + of `a`. `gcd(0, 0)` returns `0`. .. seealso:: From python-checkins at python.org Fri Jun 27 19:46:35 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 27 Jun 2008 19:46:35 +0200 (CEST) Subject: [Python-checkins] r64563 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080627174635.49D381E4003@bag.python.org> Author: guilherme.polo Date: Fri Jun 27 19:46:34 2008 New Revision: 64563 Log: Added factories for notebook, treeview, scrollbar and combobox Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Fri Jun 27 19:46:34 2008 @@ -23,9 +23,12 @@ unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') # some widgets contain Vertical and Horizontal layouts special = ('Progressbar', 'Scale', 'Scrollbar') - sample_text = ('Button', 'Checkbutton', 'Label', 'Radiobutton') - sample_text_size = ('Labelframe', ) - sample_progress = ('Progressbar', ) + + sample = {'Button': widget_text, 'Checkbutton': widget_text, + 'Label': widget_text, 'Radiobutton': widget_text, + 'Labelframe': widget_text_size, 'Combobox': widget_values, + 'Progressbar': widget_progress, 'Notebook': widget_notebook, + 'Treeview': widget_treeview, 'Scrollbar': widget_expand} for name in ttk.__all__: if name in unwanted_names: @@ -41,28 +44,25 @@ if name in special: widget_d['layouts'] = ('Horizontal', 'Vertical') - if name in sample_text: - widget_d['factory'] = widget_text - elif name in sample_text_size: - widget_d['factory'] = widget_text_size - elif name in sample_progress: - widget_d['factory'] = widget_progress + if name in sample: + widget_d['factory'] = sample[name] widgets[name] = widget_d return widgets - def widget_text(widget, master, text="Sample", **kw): """Instantiate widget and set its text option to a custom value.""" return widget(master, text=text, **kw) - def widget_text_size(widget, master, text="Sample", width=150, **kw): """Instantiate widget and set its text option to a custom value and set a size for it.""" return widget(master, text=text, width=width, height=width, **kw) +def widget_values(widget, master, **kw): + """Instantiate widget with some custom values.""" + return widget(master, values=["Value %d" % i for i in range(5)], **kw) def widget_progress(widget, master, maximum=10, **kw): """Instantiate a progressbar and step it a bit.""" @@ -70,6 +70,32 @@ w.step(4) return w +def widget_notebook(widget, master, **kw): + """Create a sample notebook with 2 tabs.""" + w = widget(master, **kw) + t1 = ttk.Frame(w, width=150, height=150) + t2 = ttk.Frame(w, width=150, height=150) + w.add(t1, text="Tab 1") + w.add(t2, text="Tab 2") + return w + +def widget_treeview(widget, master, **kw): + """Create a sample treeview with 2 columns and 2 rows.""" + w = widget(master, columns=[0, 1], **kw) + w.column('#0', width=70) + for i in range(2): + w.column(i, width=40, ) + w.heading(i, text=i) + w.insert('', 'end', text="Row %d" % i, values=[i, i + 1]) + return w + +def widget_expand(widget, master, **kw): + """Instantiate widget and configure it to expand.""" + w = widget(master, **kw) + fill = 'x' if 'horizontal' in str(w['orient']) else 'y' + w.pack_configure(expand=True, fill=fill) + return w + class AutoScroll(object): """Configure the scrollbars for a widget.""" From python-checkins at python.org Fri Jun 27 22:50:43 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 27 Jun 2008 22:50:43 +0200 (CEST) Subject: [Python-checkins] r64564 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080627205043.A5F971E4012@bag.python.org> Author: guilherme.polo Date: Fri Jun 27 22:50:42 2008 New Revision: 64564 Log: Fixed AutoScroll so it actually works with grid and pack; New options can be added in the configure and map frames; New images can be added in the images frame; Repositioned the images frame; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Fri Jun 27 22:50:42 2008 @@ -2,8 +2,8 @@ A lot of features are missing for now. """ -# ToDO: Add support for adding new options in configure and map tabs. -# Do the images frame. +# ToDO: Add a way to remove options. +# Add a way to edit image name and path/data. # ... import sys @@ -12,8 +12,14 @@ try: import cStringIO import Tkinter -except ImportError: + from tkSimpleDialog import Dialog + from tkMessageBox import showwarning + from tkFileDialog import askopenfilename +except ImportError: # assuming py3k import tkinter as Tkinter + from tkinter.simpledialog import Dialog + from tkinter.messagebox import showwarning + from tkinter.filedialog import askopenfilename import io as cStringIO def available_widgets(): @@ -106,7 +112,6 @@ self.configure(yscrollcommand=self._autoscroll(vsb), xscrollcommand=self._autoscroll(hsb)) - self.grid(column=0, row=0, sticky='nsew', in_=master) vsb.grid(column=1, row=0, sticky='ns', in_=master) hsb.grid(column=0, row=1, sticky='ew', in_=master) @@ -114,6 +119,14 @@ master.grid_columnconfigure(0, weight=1) master.grid_rowconfigure(0, weight=1) + # Copy geometry methods of master -- hack! (took from ScrolledText.py) + methods = Tkinter.Pack.__dict__.keys() + methods = methods + Tkinter.Grid.__dict__.keys() + + for m in methods: + if m[0] != '_' and m != 'config' and m != 'configure': + setattr(self, m, getattr(master, m)) + @staticmethod def _autoscroll(sbar): """Hide and show scrollbar as needed.""" @@ -129,13 +142,11 @@ return wrapped - def _create_container(func): """Creates a ttk Frame with a given master, and use this new frame to place the scrollbars and the widget.""" def wrapped(cls, master, **kw): container = ttk.Frame(master) - container.pack(fill='both', expand=True) return func(cls, container, **kw) return wrapped @@ -159,13 +170,123 @@ AutoScroll.__init__(self, master) +class NewOption(Dialog): + """Ask for an option name and initial value.""" + + def __init__(self, master, title="New Option"): + Dialog.__init__(self, master, title) + + def body(self, master): + lbl = ttk.Label(master, text="Option name") + self.o_entry = ttk.Entry(master) + + lbl_val = ttk.Label(master, text="Initial value") + self.v_entry = ttk.Entry(master) + + lbl.grid(row=0, column=0, padx=6, sticky='e') + self.o_entry.grid(row=0, column=1, padx=6) + lbl_val.grid(row=1, column=0, padx=6, pady=6, sticky='e') + self.v_entry.grid(row=1, column=1, padx=6) + + self.resizable(False, False) + + def buttonbox(self): + box = ttk.Frame(self) + + w = ttk.Button(box, text="OK", command=self.ok, default='active') + w.pack(side='right', padx=6, pady=6) + w = ttk.Button(box, text="Cancel", command=self.cancel) + w.pack(side='right', padx=6, pady=6) + + self.bind("", self.ok) + self.bind("", self.cancel) + + box.pack(expand=True, fill='x') + + def validate(self): + """Check if an option name was entered.""" + if self.o_entry.get(): + self.result = (self.o_entry.get(), self.v_entry.get()) + return True + + showwarning("Empty option name", + "You need to define an option name at least.", parent=self) + return False + + +class NewImage(NewOption): # reusing buttonbox + """A dialog that asks for a image name and image path or data.""" + + def __init__(self, master, title="New Image"): + NewOption.__init__(self, master, title) + + def body(self, master): + lbl = ttk.Label(master, text="Image name") + self.img_name = ttk.Entry(master) + + lbl_val = ttk.Label(master, text="Image path") + self.img_path = ttk.Entry(master) + browse = ttk.Button(master, text="Find", command=self._find_image) + + lbl_other = ttk.Label(master, text="or") + + lbl_data = ttk.Label(master, text="Image data") + self.img_data = ScrolledText(master, width=60, height=6) + + lbl.grid(row=0, column=0, padx=6, sticky='e') + self.img_name.grid(row=0, column=1, padx=6, columnspan=2, sticky='ew') + lbl_val.grid(row=1, column=0, padx=6, pady=6, sticky='e') + self.img_path.grid(row=1, column=1, padx=6, sticky='ew') + browse.grid(row=1, column=2, padx=6, sticky='e') + lbl_other.grid(row=2, columnspan=3, pady=3) + lbl_data.grid(row=3, column=0, padx=6, sticky='new') + self.img_data.grid(row=3, column=1, columnspan=2) + + master.grid_columnconfigure(1, weight=1) + + self.resizable(False, False) + + def validate(self): + """Verify that a name was defined and only one between data and + image path has been defined.""" + img_name = self.img_name.get() + img_path = self.img_path.get() + img_data = self.img_data.get('1.0', 'end').strip() + + if not img_name or (img_path and img_data) or \ + (not img_path and not img_data): + showwarning("Invalid image specification", + "You need to specify an image name and then either specify " + "a image path or the image data.", parent=self) + return False + + try: + if img_data: + self.result = Tkinter.PhotoImage(name=img_name, data=img_data) + else: + self.result = Tkinter.PhotoImage(name=img_name, file=img_path) + except Tkinter.TclError as err: + showwarning("Error creating image", err, parent=self) + return False + + return True + + def _find_image(self): + path = askopenfilename(parent=self) + if path: + # erase previous content + self.img_path.delete(0, len(self.img_path.get())) + # insert new path + self.img_path.insert(0, path) + + class MainWindow(object): def __init__(self, master, title=None): frame = ttk.Frame(master) self.master = frame.master width = 640 - height = int(width * 3 / 4) + height = width - 50#int(width * 3 / 4) self.master.geometry('%dx%d' % (width, height)) self.master.minsize(width, height) self.master.title(title) @@ -243,9 +364,22 @@ self._update_style(self._style.map, self._mapframe) def _update_style(self, func, frame): + widget = self._current_widget + layout_name = widget['layout'] + raw_name = layout_name[layout_name.find('.', 1) + 1:] + options = func(raw_name) + options.update(func(layout_name)) + + # add options to the specified frame + for opt_name, opt_value in options.items(): + self._add_opt_frame(frame, func, layout_name, opt_name, opt_value) + + def _add_opt_frame(self, frame, func, layout_name, opt_name, opt_value): + """Add a new option to a frame.""" def change_opt(option, text): - # XXX Warning: eval usage! + """Try to apply the new value of a option that changed.""" try: + # XXX Warning: eval usage! func(layout_name, **{option: eval(text)}) except NameError: func(layout_name, **{option: text}) @@ -253,23 +387,16 @@ pass return 1 - widget = self._current_widget - layout_name = widget['layout'] - raw_name = layout_name[layout_name.find('.', 1) + 1:] - options = func(raw_name) - options.update(func(layout_name)) - - # add widgets - for opt_name, opt_value in options.items(): - lbl = ttk.Label(frame, text=opt_name) - entry = ttk.Entry(frame) - entry.insert(0, opt_value) - entry.configure(validate='key', - validatecommand=( - self.master.register(change_opt), opt_name, '%P')) - lbl.pack(side='top', anchor='w') - entry.pack(side='top', fill='x', pady=3) - self._current_options.extend([lbl, entry]) + lbl = ttk.Label(frame, text=opt_name) + entry = ttk.Entry(frame) + entry.insert(0, opt_value) + entry.configure(validate='key', + validatecommand=(self.master.register(change_opt), opt_name, '%P')) + entry.validate() + lbl.pack(side='top', anchor='w') + entry.pack(side='top', fill='x', pady=3) + self._current_options = self._current_options or [] + self._current_options.extend([lbl, entry]) def _change_theme(self, event): """New theme selected at themes combobox, change current theme.""" @@ -292,10 +419,39 @@ def _reset_layout(self): """Reset the layout for current selected widget.""" widget = self._current_widget + if widget['widget'] is None: # nothing to reset + return + orig_name = widget['layout'][widget['layout'].find('.', 1) + 1:] self._style.layout(widget['layout'], self._style.layout(orig_name)) self._update_layout_text() + def _ask_new_frame_opt(self, frame, func): + """Open a dialog asking for a new option to be added in the + specified frame.""" + widget = self._current_widget + if widget['widget'] is None: + showwarning("No widget active", + "Select one widget before trying to add an option.", + parent=self.master) + return + layout_name = widget['layout'] + + dlg = NewOption(self.master) + if dlg.result is not None: + option, value = dlg.result + self._add_opt_frame(frame, func, layout_name, option, value) + + def _new_image(self): + """Add a new image to the image combobox. This image can be used + in any widget layout.""" + dlg = NewImage(self.master) + if dlg.result: # add new image to the images list + img = dlg.result + self._imagelist.set(img.name) + self._imagelist['values'] = (self._imagelist['values'] or ()) + \ + (img.name, ) + def __create_menu(self): menu = Tkinter.Menu() self.master['menu'] = menu @@ -313,20 +469,29 @@ paned = ttk.Panedwindow() # top frame - top = ttk.Frame(paned, padding=[0, 0, 0, 12]) + top = ttk.Frame(paned) top.pack(side='top', fill='both', expand=True) - # top left frame (widget listing) + # top left frame (widget listing, images) left = ttk.Frame(top) left.pack(side='left', fill='y') tframe = ttk.Frame(left) tframe.pack(side='top', fill='y', expand=True) self._tv_widgets = treeview = ScrolledTreeview(tframe, selectmode='browse') + treeview.pack(side='left', fill='y', expand=True) treeview.heading('#0', text="Widgets") treeview.bind('<>', self._change_preview) + # images + imagesframe = ttk.Labelframe(left, text="Images", padding=6) + self._imagelist = ttk.Combobox(imagesframe, state='readonly') + self._imagelist.pack(fill='x', pady=6) + newimg = ttk.Button(imagesframe, text="Add Image", + command=self._new_image) + newimg.pack(side='bottom', anchor='e') + imagesframe.pack(fill='x', pady=12) - # top right frame (preview, style conf, style map, images, themes) + # top right frame (preview, style conf, style map, themes) topright = ttk.Frame(top) topright.pack(side='top', fill='both', expand=True, padx=6) @@ -342,8 +507,16 @@ styleframe = ttk.Labelframe(frames, text="Style", padding=6) stylenb = ttk.Notebook(styleframe) self._configframe = ttk.Frame(stylenb, padding=6) + newopt = ttk.Button(self._configframe, text="Add option", + command=lambda: self._ask_new_frame_opt(self._configframe, + self._style.configure)) + newopt.pack(side='bottom', anchor='e') self._configframe.pack() self._mapframe = ttk.Frame(stylenb, padding=6) + newmopt = ttk.Button(self._mapframe, text="Add option", + command=lambda: self._ask_new_frame_opt(self._mapframe, + self._style.map)) + newmopt.pack(side='bottom', anchor='e') self._mapframe.pack() themeframe = ttk.Frame(stylenb, padding=6) themeframe.pack(padx=6) @@ -357,10 +530,6 @@ stylenb.add(themeframe, text="Themes") stylenb.pack(fill='both', anchor='n') styleframe.pack(fill='both', anchor='n') - # images frame - imagesframe = ttk.Labelframe(frames, text="Images", padding=6, - height=42) - imagesframe.pack(fill='x', pady=12) # bottom frame (layout) bottom = ttk.Frame(paned, padding=[0, 0, 6]) @@ -370,6 +539,7 @@ textframe = ttk.Frame(layoutframe) textframe.pack(side='left', fill='both', expand=True) self.layouttext = ScrolledText(textframe) + self.layouttext.pack(expand=True, fill='both') btnsframe = ttk.Frame(layoutframe, padding=[6, 0, 0, 0]) btnsframe.pack(side='right', anchor='n', fill='x') apply_btn = ttk.Button(btnsframe, text="Apply", @@ -385,11 +555,13 @@ paned.bind('', self.__adjust_sash) def __adjust_sash(self, event): + """Adjust sash position between the top frame and the bottom frame.""" + height = self.master.geometry().split('x')[1].split('+')[0] paned = event.widget - paned.sashpos(0, 280) + paned.sashpos(0, int(height) - 180) def __fill_treeview(self): - """Insert available widgets to the treeview.""" + """Insert available widgets in the treeview.""" self._widget = {} widgets = available_widgets() for name, opts in sorted(widgets.items()): From python-checkins at python.org Fri Jun 27 23:34:25 2008 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 27 Jun 2008 23:34:25 +0200 (CEST) Subject: [Python-checkins] r64565 - python/trunk/Doc/library/collections.rst Message-ID: <20080627213425.342C01E4003@bag.python.org> Author: raymond.hettinger Date: Fri Jun 27 23:34:24 2008 New Revision: 64565 Log: Fix whitespace in example code. Modified: python/trunk/Doc/library/collections.rst Modified: python/trunk/Doc/library/collections.rst ============================================================================== --- python/trunk/Doc/library/collections.rst (original) +++ python/trunk/Doc/library/collections.rst Fri Jun 27 23:34:24 2008 @@ -540,8 +540,8 @@ raise ValueError('Got unexpected field names: %r' % kwds.keys()) return result - def __getnewargs__(self): - return tuple(self) + def __getnewargs__(self): + return tuple(self) x = property(itemgetter(0)) y = property(itemgetter(1)) From python-checkins at python.org Sat Jun 28 00:20:25 2008 From: python-checkins at python.org (mark.dickinson) Date: Sat, 28 Jun 2008 00:20:25 +0200 (CEST) Subject: [Python-checkins] r64567 - in python/trunk: configure configure.in pyconfig.h.in Message-ID: <20080627222026.150A41E4010@bag.python.org> Author: mark.dickinson Date: Sat Jun 28 00:20:14 2008 New Revision: 64567 Log: Fix typo in configure.in, and propagate configure.in changes from r64002 to configure and pyconfig.h.in. Modified: python/trunk/configure python/trunk/configure.in python/trunk/pyconfig.h.in Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Sat Jun 28 00:20:14 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 63955 . +# From configure.in Revision: 64002 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -11150,6 +11150,467 @@ fi +{ echo "$as_me:$LINENO: checking for long double support" >&5 +echo $ECHO_N "checking for long double support... $ECHO_C" >&6; } +have_long_double=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +long double x; x = (long double)0.; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_DOUBLE 1 +_ACEOF + + have_long_double=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $have_long_double" >&5 +echo "${ECHO_T}$have_long_double" >&6; } +if test "$have_long_double" = yes ; then +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of long double" >&5 +echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_double=$ac_lo;; +'') if test "$ac_cv_type_long_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_double=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_double=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_double=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double +_ACEOF + + +fi + { echo "$as_me:$LINENO: checking for _Bool support" >&5 echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6; } have_c99_bool=no Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Sat Jun 28 00:20:14 2008 @@ -1328,7 +1328,7 @@ have_long_double=yes ]) AC_MSG_RESULT($have_long_double) -if test "$have_long_long" = yes ; then +if test "$have_long_double" = yes ; then AC_CHECK_SIZEOF(long double, 12) fi Modified: python/trunk/pyconfig.h.in ============================================================================== --- python/trunk/pyconfig.h.in (original) +++ python/trunk/pyconfig.h.in Sat Jun 28 00:20:14 2008 @@ -384,6 +384,9 @@ /* Define to 1 if you have the `log1p' function. */ #undef HAVE_LOG1P +/* Define this if you have the type long double. */ +#undef HAVE_LONG_DOUBLE + /* Define this if you have the type long long. */ #undef HAVE_LONG_LONG @@ -887,6 +890,9 @@ /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG From python-checkins at python.org Sat Jun 28 01:22:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 28 Jun 2008 01:22:06 +0200 (CEST) Subject: [Python-checkins] r64568 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20080627232206.CF2291E400F@bag.python.org> Author: benjamin.peterson Date: Sat Jun 28 01:22:06 2008 New Revision: 64568 Log: edit multiprocessing docs Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Sat Jun 28 01:22:06 2008 @@ -6,23 +6,24 @@ .. versionadded:: 2.6 + Introduction ---------------------- -:mod:`multiprocessing` is a package that supports spawning processes -using an API similar to the :mod:`threading` module. The -:mod:`multiprocessing` package offers both local and remote -concurrency, effectively side-stepping the :term:`Global Interpreter -Lock` by using subprocesses instead of threads. Due to this, the -:mod:`multiprocessing` module allows the programmer to fully leverage -multiple processors on a given machine. It runs on both Unix and +:mod:`multiprocessing` is a package that supports spawning processes using an +API similar to the :mod:`threading` module. The :mod:`multiprocessing` package +offers both local and remote concurrency, effectively side-stepping the +:term:`Global Interpreter Lock` by using subprocesses instead of threads. Due +to this, the :mod:`multiprocessing` module allows the programmer to fully +leverage multiple processors on a given machine. It runs on both Unix and Windows. + The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ In :mod:`multiprocessing`, processes are spawned by creating a :class:`Process` -object and then calling its :meth:`Process.start` method. :class:`Process` +object and then calling its :meth:`~Process.start` method. :class:`Process` follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: @@ -87,11 +88,12 @@ p.join() The two connection objects returned by :func:`Pipe` represent the two ends of - the pipe. Each connection object has :meth:`send` and :meth:`recv` methods - (among others). Note that data in a pipe may become corrupted if two - processes (or threads) try to read from or write to the *same* end of the - pipe at the same time. Of course there is no risk of corruption from - processes using different ends of the pipe at the same time. + the pipe. Each connection object has :meth:`~Connection.send` and + :meth:`~Connection.recv` methods (among others). Note that data in a pipe + may become corrupted if two processes (or threads) try to read from or write + to the *same* end of the pipe at the same time. Of course there is no risk + of corruption from processes using different ends of the pipe at the same + time. Synchronization between processes @@ -212,7 +214,7 @@ Using a pool of workers ~~~~~~~~~~~~~~~~~~~~~~~ -The :class:`multiprocessing.pool.Pool()` class represents a pool of worker +The :class:`~multiprocessing.pool.Pool` class represents a pool of worker processes. It has methods which allows tasks to be offloaded to the worker processes in a few different ways. @@ -248,8 +250,8 @@ The constructor should always be called with keyword arguments. *group* should always be ``None``; it exists solely for compatibility with - :class:`threading.Thread`. *target* is the callable object to be invoked by - the :meth:`run()` method. It defaults to None, meaning nothing is + :class:`~threading.Thread`. *target* is the callable object to be invoked by + the :meth:`run()` method. It defaults to ``None``, meaning nothing is called. *name* is the process name. By default, a unique name is constructed of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\ :sub:`1`,N\ :sub:`2`,...,N\ :sub:`k` is a sequence of integers whose length @@ -360,7 +362,7 @@ .. method:: terminate() Terminate the process. On Unix this is done using the ``SIGTERM`` signal; - on Windows ``TerminateProcess()`` is used. Note that exit handlers and + on Windows :cfunc:`TerminateProcess` is used. Note that exit handlers and finally clauses, etc., will not be executed. Note that descendant processes of the process will *not* be terminated -- @@ -416,14 +418,17 @@ The :class:`Queue` and :class:`JoinableQueue` types are multi-producer, multi-consumer FIFO queues modelled on the :class:`Queue.Queue` class in the standard library. They differ in that :class:`Queue` lacks the -:meth:`task_done` and :meth:`join` methods introduced into Python 2.5's -:class:`Queue.Queue` class. +:meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join` methods introduced +into Python 2.5's :class:`Queue.Queue` class. If you use :class:`JoinableQueue` then you **must** call :meth:`JoinableQueue.task_done` for each task removed from the queue or else the semaphore used to count the number of unfinished tasks may eventually overflow raising an exception. +Note that one can also create a shared queue by using a manager object -- see +:ref:`multiprocessing-managers`. + .. note:: :mod:`multiprocessing` uses the usual :exc:`Queue.Empty` and @@ -453,9 +458,6 @@ Note that a queue created using a manager does not have this issue. See :ref:`multiprocessing-programming`. -Note that one can also create a shared queue by using a manager object -- see -:ref:`multiprocessing-managers`. - For an example of the usage of queues for interprocess communication see :ref:`multiprocessing-examples`. @@ -481,7 +483,7 @@ standard library's :mod:`Queue` module are raised to signal timeouts. :class:`Queue` implements all the methods of :class:`Queue.Queue` except for - :meth:`task_done` and :meth:`join`. + :meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join`. .. method:: qsize() @@ -549,13 +551,13 @@ By default if a process is not the creator of the queue then on exit it will attempt to join the queue's background thread. The process can call - :meth:`cancel_join_thread()` to make :meth:`join_thread()` do nothing. + :meth:`cancel_join_thread` to make :meth:`join_thread` do nothing. .. method:: cancel_join_thread() Prevent :meth:`join_thread` from blocking. In particular, this prevents the background thread from being joined automatically when the process - exits -- see :meth:`join_thread()`. + exits -- see :meth:`join_thread`. .. class:: JoinableQueue([maxsize]) @@ -566,13 +568,13 @@ .. method:: task_done() Indicate that a formerly enqueued task is complete. Used by queue consumer - threads. For each :meth:`get` used to fetch a task, a subsequent call to - :meth:`task_done` tells the queue that the processing on the task is - complete. - - If a :meth:`join` is currently blocking, it will resume when all items - have been processed (meaning that a :meth:`task_done` call was received - for every item that had been :meth:`put` into the queue). + threads. For each :meth:`~Queue.get` used to fetch a task, a subsequent + call to :meth:`task_done` tells the queue that the processing on the task + is complete. + + If a :meth:`~Queue.join` is currently blocking, it will resume when all + items have been processed (meaning that a :meth:`task_done` call was + received for every item that had been :meth:`~Queue.put` into the queue). Raises a :exc:`ValueError` if called more times than there were items placed in the queue. @@ -586,7 +588,7 @@ queue. The count goes down whenever a consumer thread calls :meth:`task_done` to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, - :meth:`join` unblocks. + :meth:`~Queue.join` unblocks. Miscellaneous @@ -628,17 +630,17 @@ freeze_support() Process(target=f).start() - If the :func:`freeze_support()` line is missed out then trying to run the - frozen executable will raise :exc:`RuntimeError`. + If the ``freeze_support()`` line is missed out then trying to run the frozen + executable will raise :exc:`RuntimeError`. If the module is being run normally by the Python interpreter then - :func:`freeze_support()` has no effect. + :func:`freeze_support` has no effect. .. function:: set_executable() Sets the path of the python interpreter to use when starting a child process. - (By default `sys.executable` is used). Embedders will probably need to do - some thing like :: + (By default :data:`sys.executable` is used). Embedders will probably need to + do some thing like :: setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe')) @@ -659,7 +661,7 @@ Connection objects allow the sending and receiving of picklable objects or strings. They can be thought of as message oriented connected sockets. -Connection objects usually created using :func:`Pipe()` -- see also +Connection objects usually created using :func:`Pipe` -- see also :ref:`multiprocessing-listeners-clients`. .. class:: Connection @@ -756,9 +758,10 @@ receives, which can be a security risk unless you can trust the process which sent the message. - Therefore, unless the connection object was produced using :func:`Pipe()` - you should only use the `recv()` and `send()` methods after performing some - sort of authentication. See :ref:`multiprocessing-auth-keys`. + Therefore, unless the connection object was produced using :func:`Pipe` you + should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` + methods after performing some sort of authentication. See + :ref:`multiprocessing-auth-keys`. .. warning:: @@ -771,8 +774,8 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Generally synchronization primitives are not as necessary in a multiprocess -program as they are in a mulithreaded program. See the documentation for the -standard library's :mod:`threading` module. +program as they are in a mulithreaded program. See the documentation for +:mod:`threading` module. Note that one can also create synchronization primitives by using a manager object -- see :ref:`multiprocessing-managers`. @@ -786,7 +789,7 @@ .. class:: Condition([lock]) - A condition variable: a clone of `threading.Condition`. + A condition variable: a clone of :class:`threading.Condition`. If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` object from :mod:`multiprocessing`. @@ -809,7 +812,7 @@ .. note:: - The :meth:`acquire()` method of :class:`BoundedSemaphore`, :class:`Lock`, + The :meth:`acquire` method of :class:`BoundedSemaphore`, :class:`Lock`, :class:`RLock` and :class:`Semaphore` has a timeout parameter not supported by the equivalents in :mod:`threading`. The signature is ``acquire(block=True, timeout=None)`` with keyword parameters being @@ -835,7 +838,7 @@ It is possible to create shared objects using shared memory which can be inherited by child processes. -.. function:: Value(typecode_or_type[, lock[, *args]]) +.. function:: Value(typecode_or_type[, *args, lock]]) Return a :mod:`ctypes` object allocated from shared memory. By default the return value is actually a synchronized wrapper for the object. @@ -927,7 +930,7 @@ attributes which allow one to use it to store and retrieve strings -- see documentation for :mod:`ctypes`. -.. function:: Array(typecode_or_type, size_or_initializer[, lock[, *args]]) +.. function:: Array(typecode_or_type, size_or_initializer[, *args[, lock]]) The same as :func:`RawArray` except that depending on the value of *lock* a process-safe synchronization wrapper may be returned instead of a raw ctypes @@ -969,11 +972,11 @@ :class:`multiprocessing.RLock` object is created automatically. A synchronized wrapper will have two methods in addition to those of the - object it wraps: :meth:`get_obj()` returns the wrapped object and - :meth:`get_lock()` returns the lock object used for synchronization. + object it wraps: :meth:`get_obj` returns the wrapped object and + :meth:`get_lock` returns the lock object used for synchronization. Note that accessing the ctypes object through the wrapper can be a lot slower - han accessing the raw ctypes object. + than accessing the raw ctypes object. The table below compares the syntax for creating shared ctypes objects from @@ -1049,10 +1052,10 @@ .. function:: multiprocessing.Manager() - Returns a started :class:`SyncManager` object which can be used for sharing - objects between processes. The returned manager object corresponds to a - spawned child process and has methods which will create shared objects and - return corresponding proxies. + Returns a started :class:`~multiprocessing.managers.SyncManager` object which + can be used for sharing objects between processes. The returned manager + object corresponds to a spawned child process and has methods which will + create shared objects and return corresponding proxies. .. module:: multiprocessing.managers :synopsis: Share data between process with shared objects. @@ -1092,7 +1095,7 @@ .. method:: shutdown() Stop the process used by the manager. This is only available if - meth:`start` has been used to start the server process. + :meth:`start` has been used to start the server process. This can be called multiple times. @@ -1106,12 +1109,12 @@ *callable* is a callable used for creating objects for this type identifier. If a manager instance will be created using the - :meth:`from_address()` classmethod or if the *create_method* argument is + :meth:`from_address` classmethod or if the *create_method* argument is ``False`` then this can be left as ``None``. - *proxytype* is a subclass of :class:`multiprocessing.managers.BaseProxy` - which is used to create proxies for shared objects with this *typeid*. If - ``None`` then a proxy class is created automatically. + *proxytype* is a subclass of :class:`BaseProxy` which is used to create + proxies for shared objects with this *typeid*. If ``None`` then a proxy + class is created automatically. *exposed* is used to specify a sequence of method names which proxies for this typeid should be allowed to access using @@ -1119,7 +1122,7 @@ :attr:`proxytype._exposed_` is used instead if it exists.) In the case where no exposed list is specified, all "public methods" of the shared object will be accessible. (Here a "public method" means any attribute - which has a ``__call__()`` method and whose name does not begin with + which has a :meth:`__call__` method and whose name does not begin with ``'_'``.) *method_to_typeid* is a mapping used to specify the return type of those @@ -1144,7 +1147,7 @@ A subclass of :class:`BaseManager` which can be used for the synchronization of processes. Objects of this type are returned by - :func:`multiprocessing.Manager()`. + :func:`multiprocessing.Manager`. It also supports creation of shared lists and dictionaries. @@ -1175,7 +1178,7 @@ .. method:: Queue([maxsize]) - Create a shared `Queue.Queue` object and return a proxy for it. + Create a shared :class:`Queue.Queue` object and return a proxy for it. .. method:: RLock() @@ -1188,7 +1191,7 @@ .. method:: Array(typecode, sequence) - Create an array and return a proxy for it. (*format* is ignored.) + Create an array and return a proxy for it. .. method:: Value(typecode, value) @@ -1229,8 +1232,8 @@ >>>>>>>>>>>>>>>>>>> To create one's own manager, one creates a subclass of :class:`BaseManager` and -use the :meth:`resgister()` classmethod to register new types or callables with -the manager class. For example:: +use the :meth:`~BaseManager.resgister` classmethod to register new types or +callables with the manager class. For example:: from multiprocessing.managers import BaseManager @@ -1329,7 +1332,7 @@ >>> a = manager.list() >>> b = manager.list() - >>> a.append(b) # referent of `a` now contains referent of `b` + >>> a.append(b) # referent of a now contains referent of b >>> print a, b [[]] [] >>> b.append('hello') @@ -1376,7 +1379,7 @@ Note in particular that an exception will be raised if *methodname* has not been *exposed* - An example of the usage of :meth:`_call_method()`:: + An example of the usage of :meth:`_call_method`:: >>> l = manager.list(range(10)) >>> l._call_method('__len__') @@ -1420,7 +1423,7 @@ :synopsis: Create pools of processes. One can create a pool of processes which will carry out tasks submitted to it -with the :class:`Pool` class in :mod:`multiprocess.pool`. +with the :class:`Pool` class. .. class:: multiprocessing.Pool([processes[, initializer[, initargs]]]) @@ -1458,7 +1461,7 @@ .. method:: map_async(func, iterable[, chunksize[, callback]]) - A variant of the :meth:`.map` method which returns a result object. + A variant of the :meth:`map` method which returns a result object. If *callback* is specified then it should be a callable which accepts a single argument. When the result becomes ready *callback* is applied to @@ -1566,7 +1569,7 @@ However, the :mod:`multiprocessing.connection` module allows some extra flexibility. It basically gives a high level message oriented API for dealing with sockets or Windows named pipes, and also has support for *digest -authentication* using the :mod:`hmac` module from the standard library. +authentication* using the :mod:`hmac` module. .. function:: deliver_challenge(connection, authkey) @@ -1589,7 +1592,7 @@ .. function:: Client(address[, family[, authenticate[, authkey]]]) Attempt to set up a connection to the listener which is using address - *address*, returning a :class:`Connection`. + *address*, returning a :class:`~multiprocessing.Connection`. The type of the connection is determined by *family* argument, but this can generally be omitted since it can usually be inferred from the format of @@ -1665,15 +1668,6 @@ Exception raised when there is an authentication error. -.. exception:: BufferTooShort - - Exception raise by the :meth:`Connection.recv_bytes_into` method of a - connection object when the supplied buffer object is too small for the - message read. - - If *e* is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give - the message as a byte string. - **Examples** @@ -1756,11 +1750,11 @@ If authentication is requested but do authentication key is specified then the return value of ``current_process().get_auth_key`` is used (see -:class:`Process`). This value will automatically inherited by any -:class:`Process` object that the current process creates. This means that (by -default) all processes of a multi-process program will share a single -authentication key which can be used when setting up connections between the -themselves. +:class:`~multiprocessing.Process`). This value will automatically inherited by +any :class:`~multiprocessing.Process` object that the current process creates. +This means that (by default) all processes of a multi-process program will share +a single authentication key which can be used when setting up connections +between the themselves. Suitable authentication keys can also be generated by using :func:`os.urandom`. @@ -1810,7 +1804,7 @@ :synopsis: Dumb wrapper around threading. :mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is -no more than a wrapper around the `threading` module. +no more than a wrapper around the :mod:`threading` module. .. _multiprocessing-programming: @@ -1870,8 +1864,7 @@ processes. Therefore it is probably best to only consider using - :meth:`Process.terminate()` on processes which never use any shared - resources. + :meth:`Process.terminate` on processes which never use any shared resources. Joining processes that use queues @@ -1994,7 +1987,7 @@ p = Process(target=foo) p.start() - (The :func:`freeze_support()` line can be omitted if the program will be run + (The ``freeze_support()`` line can be omitted if the program will be run normally instead of frozen.) This allows the newly spawned Python interpreter to safely import the module @@ -2047,4 +2040,4 @@ You will need to have private key authentication for all hosts configured for this to work. -.. literalinclude:: ../includes/mp_distributing.py \ No newline at end of file +.. literalinclude:: ../includes/mp_distributing.py From python-checkins at python.org Sat Jun 28 03:04:31 2008 From: python-checkins at python.org (hyeshik.chang) Date: Sat, 28 Jun 2008 03:04:31 +0200 (CEST) Subject: [Python-checkins] r64570 - python/trunk/setup.py Message-ID: <20080628010431.E2CE81E4003@bag.python.org> Author: hyeshik.chang Date: Sat Jun 28 03:04:31 2008 New Revision: 64570 Log: Give information for compililation of _multiprocessing.SemLock on FreeBSD: FreeBSD's P1003.1b semaphore support is highly experimental and it's disabled by default. Even if a user loads the experimental kernel module manually, _multiprocessing doesn't work correctly due to several known incompatibilities around sem_unlink and sem_getvalue, yet. Modified: python/trunk/setup.py Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Sat Jun 28 03:04:31 2008 @@ -1258,6 +1258,17 @@ HAVE_BROKEN_SEM_UNLINK=1 ) libraries = [] + + elif platform in ('freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): + # FreeBSD's P1003.1b semaphore support is very experimental + # and has many known problems. (as of June 2008) + macros = dict( # FreeBSD + HAVE_SEM_OPEN=0, + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + ) + libraries = [] + else: # Linux and other unices macros = dict( HAVE_SEM_OPEN=1, From buildbot at python.org Sat Jun 28 03:34:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 01:34:39 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080628013439.755391E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1056 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 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_pty test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 03:35:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 01:35:34 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080628013535.36ADD1E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/553 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 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_compile test_urllib2 ====================================================================== FAIL: test_exec_with_general_mapping_for_locals (test.test_compile.TestSpecifics) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_compile.py", line 76, in test_exec_with_general_mapping_for_locals self.assertEqual(m.results, ('z', g)) AssertionError: ('z', {'TestSpecifics': , '_ast': , '__builtins__': {'bytearray': , 'IndexError': , 'all': , 'help': Type help() for interactive help, or help(object) for help about object., 'vars': , 'SyntaxError': , 'UnicodeDecodeError': , 'memoryview': , 'isinstance': , '__build_class__': , 'copyright': Copyright (c) 2001-2008 Python Software Foundation. ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 03:35:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 01:35:39 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080628013539.EA2491E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/209 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: sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 04:57:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 02:57:13 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080628025714.15D1D1E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3632 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,hyeshik.chang BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jun 28 15:18:15 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 28 Jun 2008 15:18:15 +0200 (CEST) Subject: [Python-checkins] r64572 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080628131815.095B31E4003@bag.python.org> Author: benjamin.peterson Date: Sat Jun 28 15:18:14 2008 New Revision: 64572 Log: fix typo Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Sat Jun 28 15:18:14 2008 @@ -1284,12 +1284,12 @@ Here are all of the changes that Python 2.6 makes to the core Python language. * The :func:`hasattr` function was catching and ignoring all errors, - under the assumption that they meant a :meth:`__getattr__` method has - failing somewhere and the return value of :func:`hasattr` would therefore - be ``False``. This logic shouldn't be applied to - :exc:`KeyboardInterrupt` and :exc:`SystemExit`, however; Python 2.6 will - no longer discard such exceptions when :func:`hasattr` encounters them. - (Fixed by Benjamin Peterson; :issue:`2196`.) + under the assumption that they meant a :meth:`__getattr__` method + was failing somewhere and the return value of :func:`hasattr` would + therefore be ``False``. This logic shouldn't be applied to + :exc:`KeyboardInterrupt` and :exc:`SystemExit`, however; Python 2.6 + will no longer discard such exceptions when :func:`hasattr` + encounters them. (Fixed by Benjamin Peterson; :issue:`2196`.) * When calling a function using the ``**`` syntax to provide keyword arguments, you are no longer required to use a Python dictionary; From python-checkins at python.org Sat Jun 28 18:18:04 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 28 Jun 2008 18:18:04 +0200 (CEST) Subject: [Python-checkins] r64574 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080628161804.204951E4003@bag.python.org> Author: guilherme.polo Date: Sat Jun 28 18:18:03 2008 New Revision: 64574 Log: Dropped py3k support; Added support for element creation; Added support for custom layout creation; Some refactoring; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Sat Jun 28 18:18:03 2008 @@ -1,26 +1,23 @@ -"""Sample application for playing with Ttk theming. -A lot of features are missing for now. +""" +Sample application for playing with Ttk theming. +* A lot of features are missing for now. + +-- Guilherme Polo, 2008. """ # ToDO: Add a way to remove options. -# Add a way to edit image name and path/data. +# Add a way to edit images/elements. +# Handling element options. # ... import sys import ttk import pprint -try: - import cStringIO - import Tkinter - from tkSimpleDialog import Dialog - from tkMessageBox import showwarning - from tkFileDialog import askopenfilename -except ImportError: # assuming py3k - import tkinter as Tkinter - from tkinter.simpledialog import Dialog - from tkinter.messagebox import showwarning - from tkinter.filedialog import askopenfilename - import io as cStringIO +import cStringIO +import Tkinter +from tkSimpleDialog import Dialog, askstring +from tkMessageBox import showwarning +from tkFileDialog import askopenfilename def available_widgets(): """Returns a list of Ttk widgets.""" @@ -265,7 +262,7 @@ self.result = Tkinter.PhotoImage(name=img_name, data=img_data) else: self.result = Tkinter.PhotoImage(name=img_name, file=img_path) - except Tkinter.TclError as err: + except Tkinter.TclError, err: showwarning("Error creating image", err, parent=self) return False @@ -280,6 +277,66 @@ self.img_path.insert(0, path) +class NewElement(NewOption): # reusing buttonbox + """A dialog for collecting data for a new image element.""" + + def __init__(self, master, title="New Element", imglist=None): + self._imglist = imglist + NewOption.__init__(self, master, title) + + def body(self, master): + # element name + name = ttk.Label(master, text="Element name") + self.name = ttk.Entry(master) + # only image type is being supported for now + etype = ttk.Label(master, text="Element type") + self.etype = ttk.Entry(master) + self.etype.insert(0, "image") + self.etype['state'] = 'readonly' + defimg = ttk.Label(master, text="Default image") + self.defimg = ttk.Combobox(master) + if self._imglist: + self.defimg['values'] = self._imglist['values'] + # options + opts = ttk.Label(master, text="Options") + self.opts = ttk.Entry(master) + # statespec(s) + sspec = ttk.Label(master, text="StateSpec(s)") + self.sspec = ttk.Entry(master) + + # place the widgets + name.grid(row=0, column=0, sticky='w', padx=6, pady=3) + self.name.grid(row=0, column=1, pady=3, sticky='ew') + etype.grid(row=0, column=2, sticky='w', padx=6, pady=3) + self.etype.grid(row=0, column=3, pady=3) + defimg.grid(row=1, column=0, sticky='w', padx=6, pady=3) + self.defimg.grid(row=1, column=1, pady=3, sticky='ew') + opts.grid(row=1, column=2, sticky='w', padx=6, pady=3) + self.opts.grid(row=1, column=3, pady=3) + sspec.grid(row=2, column=0, sticky='w', padx=6, pady=3) + self.sspec.grid(row=2, column=1, columnspan=3, sticky='ew', pady=3) + + self.resizable(False, False) + + def validate(self): + """Check if an, apparently, correct element specification has been + entered.""" + entries = [('elementname', self.name), ('etype', self.etype), + ('def', self.defimg), ('sspec', self.sspec), ('opts', self.opts)] + values = {} + for name, entry in entries: + values[name] = entry.get() + + if not all((values['elementname'], values['etype'], values['def'])): + showwarning("Invalid element specification", + "You need to specify a name, a type and a default image " + "at least.", parent=self) + return False + + self.result = values + return True + + class MainWindow(object): def __init__(self, master, title=None): frame = ttk.Frame(master) @@ -314,10 +371,17 @@ complement = '' opts = {} - if '.' in widget_name: # horizontal/vertical layout + if '.' in widget_name: # horizontal/vertical layout (maybe) complement, widget_name = widget_name.split('.') opts = {'orient': complement.lower()} + # check if this is a widget or a custom layout + if not hasattr(ttk, widget_name): # custom layout + self._current_widget['layout'] = "Custom.T%s.%s" % (complement, + widget_name) + self._update_layout_text() + return + # create a sample widget if widget.get('factory', None): widget_class = getattr(ttk, widget_name) @@ -343,13 +407,14 @@ """Update the layout text for the current widget.""" layout_name = self._current_widget['layout'] output = cStringIO.StringIO() - layout = pprint.pprint(self._style.layout(layout_name), stream=output) + pprint.pprint(self._style.layout(layout_name), stream=output) layout = output.getvalue() output.close() self.layouttext.delete('1.0', 'end') # clear current text self.layouttext.insert('1.0', layout) # set new text def _remove_previous_widgets(self): + """Remove widgets from the style frames.""" self._current_options = self._current_options or [] # remove previous widgets for widget in self._current_options: @@ -364,6 +429,7 @@ self._update_style(self._style.map, self._mapframe) def _update_style(self, func, frame): + """Treeview selection changed, update the displayed style.""" widget = self._current_widget layout_name = widget['layout'] raw_name = layout_name[layout_name.find('.', 1) + 1:] @@ -374,6 +440,17 @@ for opt_name, opt_value in options.items(): self._add_opt_frame(frame, func, layout_name, opt_name, opt_value) + def _add_custom_layout(self): + """Create a new, and empty, custom layout.""" + result = askstring("New Layout", "Layout name") + if result: + # create an empty layout + self._style.layout(result, '') + # create a "semi-widget" + treeview = self._tv_custom + widget_d = {'factory': None, 'layouts': None} + self._add_widget(result, widget_d, treeview) + def _add_opt_frame(self, frame, func, layout_name, opt_name, opt_value): """Add a new option to a frame.""" def change_opt(option, text): @@ -413,7 +490,7 @@ return text = self.layouttext.get('1.0', 'end') - # XXX Warning, eval usage! + # XXX Warning: eval usage! self._style.layout(layout, eval(text)) def _reset_layout(self): @@ -442,7 +519,39 @@ option, value = dlg.result self._add_opt_frame(frame, func, layout_name, option, value) - def _new_image(self): + def _ask_new_element(self, frame): + """Open a dialog for getting data for a new style element.""" + dlg = NewElement(self.master, imglist=self._imagelist) + if dlg.result: + name = dlg.result['elementname'] + # format args + if dlg.result['sspec']: + # XXX Warning: eval usage! + sspec = eval(dlg.result['sspec']) + if dlg.result['sspec'].count('(') == 1: + # only one statespec defined + sspec = (sspec, ) + else: + sspec = () + args = (dlg.result['def'], ) + sspec + + # format opts (XXX Not done) + #if dlg.result['opts']: + # print dlg.result['opts'] + + # create element + try: + self._style.element_create(name, dlg.result['etype'], *args) + except Tkinter.TclError, err: + showwarning("Element couldn't be created", + "The specified element couldn'be created, reason: " + "\n%s" % err, parent=self.master) + + # add it to the list + self._elems.set(name) + self._elems['values'] = (self._elems['values'] or ()) + (name, ) + + def _ask_new_image(self): """Add a new image to the image combobox. This image can be used in any widget layout.""" dlg = NewImage(self.master) @@ -452,6 +561,21 @@ self._imagelist['values'] = (self._imagelist['values'] or ()) + \ (img.name, ) + def _add_widget(self, name, opts, treeview=None): + """Add a new widget to self._widget.""" + treeview = treeview or self._tv_widgets + children = opts.pop('layouts') or () + + parent = treeview.insert('', 'end', text=name) + self._widget[name] = {'tv_item': parent, 'class': None} + self._widget[name].update(opts) + + for child in children: + child_name = '%s.%s' % (child, name) + item = treeview.insert(parent, 'end', text=child_name) + self._widget[child_name] = {'tv_item': item, 'class': None} + self._widget[child_name].update(opts) + def __create_menu(self): menu = Tkinter.Menu() self.master['menu'] = menu @@ -462,7 +586,12 @@ file_menu.add_command(label="Exit", underline=1, command=self.master.destroy) + layout_menu = Tkinter.Menu(menu, tearoff=False) + layout_menu.add_command(label="New layout", + command=self._add_custom_layout) + menu.add('cascade', menu=file_menu, label="File", underline=0) + menu.add('cascade', menu=layout_menu, label="Custom Layouts") def __setup_widgets(self): """Create and layout widgets.""" @@ -472,26 +601,23 @@ top = ttk.Frame(paned) top.pack(side='top', fill='both', expand=True) - # top left frame (widget listing, images) + # top left frame (widget listing, custom layouts, images) left = ttk.Frame(top) left.pack(side='left', fill='y') - tframe = ttk.Frame(left) - tframe.pack(side='top', fill='y', expand=True) - self._tv_widgets = treeview = ScrolledTreeview(tframe, - selectmode='browse') - treeview.pack(side='left', fill='y', expand=True) - treeview.heading('#0', text="Widgets") - treeview.bind('<>', self._change_preview) - # images - imagesframe = ttk.Labelframe(left, text="Images", padding=6) - self._imagelist = ttk.Combobox(imagesframe, state='readonly') - self._imagelist.pack(fill='x', pady=6) - newimg = ttk.Button(imagesframe, text="Add Image", - command=self._new_image) - newimg.pack(side='bottom', anchor='e') - imagesframe.pack(fill='x', pady=12) + # widget listing + self._tv_widgets = ScrolledTreeview(left, selectmode='browse') + self._tv_widgets.pack(side='top', fill='y', anchor='w', expand=True) + self._tv_widgets.heading('#0', text="Widgets") + self._tv_widgets.bind('<>', self._change_preview) + # custom layouts + self._tv_custom = ScrolledTreeview(left, selectmode='browse', + height=4) + self._tv_custom.pack(side='top', anchor='w') + self._tv_custom.heading('#0', text="Custom Layouts") + self._tv_custom.bind('<>', self._change_preview) - # top right frame (preview, style conf, style map, themes) + # top right frame (preview, style conf, style map, elements, themes and + # images) topright = ttk.Frame(top) topright.pack(side='top', fill='both', expand=True, padx=6) @@ -505,19 +631,31 @@ frames.pack(side='right', anchor='n') # style notebook and frames styleframe = ttk.Labelframe(frames, text="Style", padding=6) + styleframe.pack(fill='both', anchor='n') stylenb = ttk.Notebook(styleframe) + # style configure self._configframe = ttk.Frame(stylenb, padding=6) newopt = ttk.Button(self._configframe, text="Add option", command=lambda: self._ask_new_frame_opt(self._configframe, self._style.configure)) newopt.pack(side='bottom', anchor='e') self._configframe.pack() + # style map self._mapframe = ttk.Frame(stylenb, padding=6) newmopt = ttk.Button(self._mapframe, text="Add option", command=lambda: self._ask_new_frame_opt(self._mapframe, self._style.map)) newmopt.pack(side='bottom', anchor='e') self._mapframe.pack() + # style elements + elemframe = ttk.Frame(stylenb, padding=6) + self._elems = ttk.Combobox(elemframe, state='readonly') + self._elems.pack(fill='x', pady=6) + newelem = ttk.Button(elemframe, text="New element", + command=lambda: self._ask_new_element(elemframe)) + newelem.pack(side='bottom', anchor='e') + elemframe.pack() + # themes themeframe = ttk.Frame(stylenb, padding=6) themeframe.pack(padx=6) themes = ttk.Combobox(themeframe, values=self._style.theme_names(), @@ -525,11 +663,20 @@ themes.set("Pick one") themes.bind('<>', self._change_theme) themes.pack(fill='x') + # add frames to the style notebook stylenb.add(self._configframe, text="Configure") stylenb.add(self._mapframe, text="Map") + stylenb.add(elemframe, text="Elems") stylenb.add(themeframe, text="Themes") stylenb.pack(fill='both', anchor='n') - styleframe.pack(fill='both', anchor='n') + # images frame + imagesframe = ttk.Labelframe(frames, text="Images", padding=6) + self._imagelist = ttk.Combobox(imagesframe, state='readonly') + self._imagelist.pack(fill='x', pady=6) + newimg = ttk.Button(imagesframe, text="Add Image", + command=self._ask_new_image) + newimg.pack(side='bottom', anchor='e') + imagesframe.pack(fill='x', pady=12) # bottom frame (layout) bottom = ttk.Frame(paned, padding=[0, 0, 6]) @@ -565,17 +712,7 @@ self._widget = {} widgets = available_widgets() for name, opts in sorted(widgets.items()): - children = opts.pop('layouts') or () - - parent = self._tv_widgets.insert('', 'end', text=name) - self._widget[name] = {'tv_item': parent, 'class': None} - self._widget[name].update(opts) - - for child in children: - child_name = '%s.%s' % (child, name) - item = self._tv_widgets.insert(parent, 'end', text=child_name) - self._widget[child_name] = {'tv_item': item, 'class': None} - self._widget[child_name].update(opts) + self._add_widget(name, opts) def main(args=None): From python-checkins at python.org Sat Jun 28 19:08:34 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 28 Jun 2008 19:08:34 +0200 (CEST) Subject: [Python-checkins] r64575 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080628170834.06B641E4003@bag.python.org> Author: guilherme.polo Date: Sat Jun 28 19:08:25 2008 New Revision: 64575 Log: A new element was being added to the elements list even if it couldn't be created, fixed now. Increased a bit more the ToDo list; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Sat Jun 28 19:08:25 2008 @@ -7,6 +7,8 @@ # ToDO: Add a way to remove options. # Add a way to edit images/elements. +# Add sublayouts. +# Add pre-defined elements for the current theme. # Handling element options. # ... @@ -546,10 +548,10 @@ showwarning("Element couldn't be created", "The specified element couldn'be created, reason: " "\n%s" % err, parent=self.master) - - # add it to the list - self._elems.set(name) - self._elems['values'] = (self._elems['values'] or ()) + (name, ) + else: + # add it to the list + self._elems.set(name) + self._elems['values'] = (self._elems['values'] or ()) + (name, ) def _ask_new_image(self): """Add a new image to the image combobox. This image can be used From buildbot at python.org Sat Jun 28 20:34:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 18:34:38 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu trunk Message-ID: <20080628183438.868671E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%20trunk/builds/651 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,andrew.kuchling,barry.warsaw,benjamin.peterson,brett.cannon,eric.smith,facundo.batista,georg.brandl,hyeshik.chang,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller,trent.nelson,vinay.sajip BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 20:39:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 18:39:10 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080628183910.805F51E4003@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/106 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: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 20:53:29 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 18:53:29 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080628185329.463521E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/391 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 28 21:33:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 19:33:47 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080628193348.4278A1E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/211 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: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 00:16:56 2008 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 29 Jun 2008 00:16:56 +0200 (CEST) Subject: [Python-checkins] r64577 - python/trunk/Objects/dictobject.c Message-ID: <20080628221656.588311E4005@bag.python.org> Author: raymond.hettinger Date: Sun Jun 29 00:16:53 2008 New Revision: 64577 Log: Issue 3230: Do not the set specific size macro. Modified: python/trunk/Objects/dictobject.c Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Sun Jun 29 00:16:53 2008 @@ -1253,7 +1253,7 @@ PyObject *key; long hash; - if (dictresize(mp, PySet_GET_SIZE(seq))) + if (dictresize(mp, Py_SIZE(seq))) return NULL; while (_PyDict_Next(seq, &pos, &key, &oldvalue, &hash)) { From python-checkins at python.org Sun Jun 29 00:19:38 2008 From: python-checkins at python.org (bill.janssen) Date: Sun, 29 Jun 2008 00:19:38 +0200 (CEST) Subject: [Python-checkins] r64578 - in python/trunk: Doc/library/ssl.rst Lib/ssl.py Lib/test/test_ssl.py Lib/test/wrongcert.pem Modules/_ssl.c Message-ID: <20080628221938.506331E4003@bag.python.org> Author: bill.janssen Date: Sun Jun 29 00:19:33 2008 New Revision: 64578 Log: various SSL fixes; issues 1251, 3162, 3212 Added: python/trunk/Lib/test/wrongcert.pem (contents, props changed) Modified: python/trunk/Doc/library/ssl.rst python/trunk/Lib/ssl.py python/trunk/Lib/test/test_ssl.py python/trunk/Modules/_ssl.c Modified: python/trunk/Doc/library/ssl.rst ============================================================================== --- python/trunk/Doc/library/ssl.rst (original) +++ python/trunk/Doc/library/ssl.rst Sun Jun 29 00:19:33 2008 @@ -54,7 +54,7 @@ network connection. This error is a subtype of :exc:`socket.error`, which in turn is a subtype of :exc:`IOError`. -.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None) +.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True) Takes an instance ``sock`` of :class:`socket.socket`, and returns an instance of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, which wraps the underlying socket in an SSL context. @@ -122,6 +122,18 @@ In some older versions of OpenSSL (for instance, 0.9.7l on OS X 10.4), an SSLv2 client could not connect to an SSLv23 server. + The parameter ``do_handshake_on_connect`` specifies whether to do the SSL + handshake automatically after doing a :meth:`socket.connect`, or whether the + application program will call it explicitly, by invoking the :meth:`SSLSocket.do_handshake` + method. Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control over + the blocking behavior of the socket I/O involved in the handshake. + + The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket.read` + method should signal unexpected EOF from the other end of the connection. If specified + as :const:`True` (the default), it returns a normal EOF in response to unexpected + EOF errors raised from the underlying socket; if :const:`False`, it will raise + the exceptions back to the caller. + .. function:: RAND_status() Returns True if the SSL pseudo-random number generator has been @@ -290,6 +302,25 @@ number of secret bits being used. If no connection has been established, returns ``None``. +.. method:: SSLSocket.do_handshake() + + Perform a TLS/SSL handshake. If this is used with a non-blocking socket, + it may raise :exc:`SSLError` with an ``arg[0]`` of :const:`SSL_ERROR_WANT_READ` + or :const:`SSL_ERROR_WANT_WRITE`, in which case it must be called again until it + completes successfully. For example, to simulate the behavior of a blocking socket, + one might write:: + + while True: + try: + s.do_handshake() + break + except ssl.SSLError, err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], []) + else: + raise .. index:: single: certificates @@ -367,6 +398,7 @@ chains for each issuer you are willing to trust. Again, this file just contains these chains concatenated together. For validation, Python will use the first chain it finds in the file which matches. + Some "standard" root certificates are available from various certification authorities: `CACert.org `_, Modified: python/trunk/Lib/ssl.py ============================================================================== --- python/trunk/Lib/ssl.py (original) +++ python/trunk/Lib/ssl.py Sun Jun 29 00:19:33 2008 @@ -74,7 +74,7 @@ SSL_ERROR_EOF, \ SSL_ERROR_INVALID_ERROR_CODE -from socket import socket +from socket import socket, _fileobject from socket import getnameinfo as _getnameinfo import base64 # for DER-to-PEM translation @@ -86,8 +86,16 @@ def __init__(self, sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, - ssl_version=PROTOCOL_SSLv23, ca_certs=None): + ssl_version=PROTOCOL_SSLv23, ca_certs=None, + do_handshake_on_connect=True, + suppress_ragged_eofs=True): socket.__init__(self, _sock=sock._sock) + # the initializer for socket trashes the methods (tsk, tsk), so... + self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) + self.recv = lambda x, flags=0: SSLSocket.recv(self, x, flags) + self.sendto = lambda data, addr, flags=0: SSLSocket.sendto(self, data, addr, flags) + self.recvfrom = lambda addr, buflen, flags: SSLSocket.recvfrom(self, addr, buflen, flags) + if certfile and not keyfile: keyfile = certfile # see if it's connected @@ -101,18 +109,34 @@ self._sslobj = _ssl.sslwrap(self._sock, server_side, keyfile, certfile, cert_reqs, ssl_version, ca_certs) + if do_handshake_on_connect: + timeout = self.gettimeout() + try: + self.settimeout(None) + self.do_handshake() + finally: + self.settimeout(timeout) self.keyfile = keyfile self.certfile = certfile self.cert_reqs = cert_reqs self.ssl_version = ssl_version self.ca_certs = ca_certs + self.do_handshake_on_connect = do_handshake_on_connect + self.suppress_ragged_eofs = suppress_ragged_eofs + self._makefile_refs = 0 def read(self, len=1024): """Read up to LEN bytes and return them. Return zero-length string on EOF.""" - return self._sslobj.read(len) + try: + return self._sslobj.read(len) + except SSLError, x: + if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: + return '' + else: + raise def write(self, data): @@ -143,16 +167,27 @@ raise ValueError( "non-zero flags not allowed in calls to send() on %s" % self.__class__) - return self._sslobj.write(data) + while True: + try: + v = self._sslobj.write(data) + except SSLError, x: + if x.args[0] == SSL_ERROR_WANT_READ: + return 0 + elif x.args[0] == SSL_ERROR_WANT_WRITE: + return 0 + else: + raise + else: + return v else: return socket.send(self, data, flags) - def send_to (self, data, addr, flags=0): + def sendto (self, data, addr, flags=0): if self._sslobj: - raise ValueError("send_to not allowed on instances of %s" % + raise ValueError("sendto not allowed on instances of %s" % self.__class__) else: - return socket.send_to(self, data, addr, flags) + return socket.sendto(self, data, addr, flags) def sendall (self, data, flags=0): if self._sslobj: @@ -160,7 +195,12 @@ raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - return self._sslobj.write(data) + amount = len(data) + count = 0 + while (count < amount): + v = self.send(data[count:]) + count += v + return amount else: return socket.sendall(self, data, flags) @@ -170,25 +210,51 @@ raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - return self._sslobj.read(data, buflen) + while True: + try: + return self.read(buflen) + except SSLError, x: + if x.args[0] == SSL_ERROR_WANT_READ: + continue + else: + raise x else: return socket.recv(self, buflen, flags) - def recv_from (self, addr, buflen=1024, flags=0): + def recvfrom (self, addr, buflen=1024, flags=0): if self._sslobj: - raise ValueError("recv_from not allowed on instances of %s" % + raise ValueError("recvfrom not allowed on instances of %s" % self.__class__) else: - return socket.recv_from(self, addr, buflen, flags) + return socket.recvfrom(self, addr, buflen, flags) - def shutdown(self, how): + def pending (self): + if self._sslobj: + return self._sslobj.pending() + else: + return 0 + + def shutdown (self, how): self._sslobj = None socket.shutdown(self, how) - def close(self): + def close (self): self._sslobj = None socket.close(self) + def close (self): + if self._makefile_refs < 1: + self._sslobj = None + socket.close(self) + else: + self._makefile_refs -= 1 + + def do_handshake (self): + + """Perform a TLS/SSL handshake.""" + + self._sslobj.do_handshake() + def connect(self, addr): """Connects to remote ADDR, and then wraps the connection in @@ -202,6 +268,8 @@ self._sslobj = _ssl.sslwrap(self._sock, False, self.keyfile, self.certfile, self.cert_reqs, self.ssl_version, self.ca_certs) + if self.do_handshake_on_connect: + self.do_handshake() def accept(self): @@ -210,260 +278,39 @@ SSL channel, and the address of the remote client.""" newsock, addr = socket.accept(self) - return (SSLSocket(newsock, True, self.keyfile, self.certfile, - self.cert_reqs, self.ssl_version, - self.ca_certs), addr) - + return (SSLSocket(newsock, + keyfile=self.keyfile, + certfile=self.certfile, + server_side=True, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ca_certs=self.ca_certs, + do_handshake_on_connect=self.do_handshake_on_connect, + suppress_ragged_eofs=self.suppress_ragged_eofs), + addr) def makefile(self, mode='r', bufsize=-1): """Ouch. Need to make and return a file-like object that works with the SSL connection.""" - if self._sslobj: - return SSLFileStream(self._sslobj, mode, bufsize) - else: - return socket.makefile(self, mode, bufsize) - - -class SSLFileStream: - - """A class to simulate a file stream on top of a socket. - Most of this is just lifted from the socket module, and - adjusted to work with an SSL stream instead of a socket.""" - - - default_bufsize = 8192 - name = "" - - __slots__ = ["mode", "bufsize", "softspace", - # "closed" is a property, see below - "_sslobj", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", - "_close", "_fileno"] - - def __init__(self, sslobj, mode='rb', bufsize=-1, close=False): - self._sslobj = sslobj - self.mode = mode # Not actually used in this version - if bufsize < 0: - bufsize = self.default_bufsize - self.bufsize = bufsize - self.softspace = False - if bufsize == 0: - self._rbufsize = 1 - elif bufsize == 1: - self._rbufsize = self.default_bufsize - else: - self._rbufsize = bufsize - self._wbufsize = bufsize - self._rbuf = "" # A string - self._wbuf = [] # A list of strings - self._close = close - self._fileno = -1 - - def _getclosed(self): - return self._sslobj is None - closed = property(_getclosed, doc="True if the file is closed") - - def fileno(self): - return self._fileno - - def close(self): - try: - if self._sslobj: - self.flush() - finally: - if self._close and self._sslobj: - self._sslobj.close() - self._sslobj = None - - def __del__(self): - try: - self.close() - except: - # close() may fail if __init__ didn't complete - pass - - def flush(self): - if self._wbuf: - buffer = "".join(self._wbuf) - self._wbuf = [] - count = 0 - while (count < len(buffer)): - written = self._sslobj.write(buffer) - count += written - buffer = buffer[written:] - - def write(self, data): - data = str(data) # XXX Should really reject non-string non-buffers - if not data: - return - self._wbuf.append(data) - if (self._wbufsize == 0 or - self._wbufsize == 1 and '\n' in data or - self._get_wbuf_len() >= self._wbufsize): - self.flush() - - def writelines(self, list): - # XXX We could do better here for very long lists - # XXX Should really reject non-string non-buffers - self._wbuf.extend(filter(None, map(str, list))) - if (self._wbufsize <= 1 or - self._get_wbuf_len() >= self._wbufsize): - self.flush() - - def _get_wbuf_len(self): - buf_len = 0 - for x in self._wbuf: - buf_len += len(x) - return buf_len - - def read(self, size=-1): - data = self._rbuf - if size < 0: - # Read until EOF - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - if self._rbufsize <= 1: - recv_size = self.default_bufsize - else: - recv_size = self._rbufsize - while True: - data = self._sslobj.read(recv_size) - if not data: - break - buffers.append(data) - return "".join(buffers) - else: - # Read until size bytes or EOF seen, whichever comes first - buf_len = len(data) - if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - left = size - buf_len - recv_size = max(self._rbufsize, left) - data = self._sslobj.read(recv_size) - if not data: - break - buffers.append(data) - n = len(data) - if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] - break - buf_len += n - return "".join(buffers) - - def readline(self, size=-1): - data = self._rbuf - if size < 0: - # Read until \n or EOF, whichever comes first - if self._rbufsize <= 1: - # Speed up unbuffered case - assert data == "" - buffers = [] - while data != "\n": - data = self._sslobj.read(1) - if not data: - break - buffers.append(data) - return "".join(buffers) - nl = data.find('\n') - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - data = self._sslobj.read(self._rbufsize) - if not data: - break - buffers.append(data) - nl = data.find('\n') - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] - break - return "".join(buffers) - else: - # Read until size bytes or \n or EOF seen, whichever comes first - nl = data.find('\n', 0, size) - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buf_len = len(data) - if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - data = self._sslobj.read(self._rbufsize) - if not data: - break - buffers.append(data) - left = size - buf_len - nl = data.find('\n', 0, left) - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] - break - n = len(data) - if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] - break - buf_len += n - return "".join(buffers) - - def readlines(self, sizehint=0): - total = 0 - list = [] - while True: - line = self.readline() - if not line: - break - list.append(line) - total += len(line) - if sizehint and total >= sizehint: - break - return list - - # Iterator protocols - - def __iter__(self): - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration - return line - + self._makefile_refs += 1 + return _fileobject(self, mode, bufsize) def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, - ssl_version=PROTOCOL_SSLv23, ca_certs=None): + ssl_version=PROTOCOL_SSLv23, ca_certs=None, + do_handshake_on_connect=True, + suppress_ragged_eofs=True): return SSLSocket(sock, keyfile=keyfile, certfile=certfile, server_side=server_side, cert_reqs=cert_reqs, - ssl_version=ssl_version, ca_certs=ca_certs) + ssl_version=ssl_version, ca_certs=ca_certs, + do_handshake_on_connect=do_handshake_on_connect, + suppress_ragged_eofs=suppress_ragged_eofs) + # some utility functions @@ -549,5 +396,7 @@ for compability with Python 2.5 and earlier. Will disappear in Python 3.0.""" - return _ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE, - PROTOCOL_SSLv23, None) + ssl_sock = _ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE, + PROTOCOL_SSLv23, None) + ssl_sock.do_handshake() + return ssl_sock Modified: python/trunk/Lib/test/test_ssl.py ============================================================================== --- python/trunk/Lib/test/test_ssl.py (original) +++ python/trunk/Lib/test/test_ssl.py Sun Jun 29 00:19:33 2008 @@ -3,7 +3,9 @@ import sys import unittest from test import test_support +import asyncore import socket +import select import errno import subprocess import time @@ -97,8 +99,7 @@ if (d1 != d2): raise test_support.TestFailed("PEM-to-DER or DER-to-PEM translation failed") - -class NetworkTests(unittest.TestCase): +class NetworkedTests(unittest.TestCase): def testConnect(self): s = ssl.wrap_socket(socket.socket(socket.AF_INET), @@ -130,6 +131,31 @@ finally: s.close() + + def testNonBlockingHandshake(self): + s = socket.socket(socket.AF_INET) + s.connect(("svn.python.org", 443)) + s.setblocking(False) + s = ssl.wrap_socket(s, + cert_reqs=ssl.CERT_NONE, + do_handshake_on_connect=False) + count = 0 + while True: + try: + count += 1 + s.do_handshake() + break + except ssl.SSLError, err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], []) + else: + raise + s.close() + if test_support.verbose: + sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) + def testFetchServerCert(self): pem = ssl.get_server_certificate(("svn.python.org", 443)) @@ -176,6 +202,18 @@ threading.Thread.__init__(self) self.setDaemon(True) + def show_conn_details(self): + if self.server.certreqs == ssl.CERT_REQUIRED: + cert = self.sslconn.getpeercert() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") + cert_binary = self.sslconn.getpeercert(True) + if test_support.verbose and self.server.chatty: + sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") + cipher = self.sslconn.cipher() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") + def wrap_conn (self): try: self.sslconn = ssl.wrap_socket(self.sock, server_side=True, @@ -187,6 +225,7 @@ if self.server.chatty: handle_error("\n server: bad connection attempt from " + str(self.sock.getpeername()) + ":\n") + self.close() if not self.server.expect_bad_connects: # here, we want to stop the server, because this shouldn't # happen in the context of our test case @@ -197,16 +236,6 @@ return False else: - if self.server.certreqs == ssl.CERT_REQUIRED: - cert = self.sslconn.getpeercert() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") - cert_binary = self.sslconn.getpeercert(True) - if test_support.verbose and self.server.chatty: - sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") - cipher = self.sslconn.cipher() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") return True def read(self): @@ -225,13 +254,16 @@ if self.sslconn: self.sslconn.close() else: - self.sock.close() + self.sock._sock.close() def run (self): self.running = True if not self.server.starttls_server: - if not self.wrap_conn(): + if isinstance(self.sock, ssl.SSLSocket): + self.sslconn = self.sock + elif not self.wrap_conn(): return + self.show_conn_details() while self.running: try: msg = self.read() @@ -270,7 +302,9 @@ def __init__(self, certificate, ssl_version=None, certreqs=None, cacerts=None, expect_bad_connects=False, - chatty=True, connectionchatty=False, starttls_server=False): + chatty=True, connectionchatty=False, starttls_server=False, + wrap_accepting_socket=False): + if ssl_version is None: ssl_version = ssl.PROTOCOL_TLSv1 if certreqs is None: @@ -284,8 +318,16 @@ self.connectionchatty = connectionchatty self.starttls_server = starttls_server self.sock = socket.socket() - self.port = test_support.bind_port(self.sock) self.flag = None + if wrap_accepting_socket: + self.sock = ssl.wrap_socket(self.sock, server_side=True, + certfile=self.certificate, + cert_reqs = self.certreqs, + ca_certs = self.cacerts, + ssl_version = self.protocol) + if test_support.verbose and self.chatty: + sys.stdout.write(' server: wrapped server socket as %s\n' % str(self.sock)) + self.port = test_support.bind_port(self.sock) self.active = False threading.Thread.__init__(self) self.setDaemon(False) @@ -316,13 +358,86 @@ except: if self.chatty: handle_error("Test server failure:\n") + self.sock.close() def stop (self): self.active = False - self.sock.close() + class AsyncoreEchoServer(threading.Thread): + + class EchoServer (asyncore.dispatcher): + + class ConnectionHandler (asyncore.dispatcher_with_send): + + def __init__(self, conn, certfile): + asyncore.dispatcher_with_send.__init__(self, conn) + self.socket = ssl.wrap_socket(conn, server_side=True, + certfile=certfile, + do_handshake_on_connect=True) + + def readable(self): + if isinstance(self.socket, ssl.SSLSocket): + while self.socket.pending() > 0: + self.handle_read_event() + return True + + def handle_read(self): + data = self.recv(1024) + self.send(data.lower()) + + def handle_close(self): + if test_support.verbose: + sys.stdout.write(" server: closed connection %s\n" % self.socket) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.certfile = certfile + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.socket) + self.listen(5) + + def handle_accept(self): + sock_obj, addr = self.accept() + if test_support.verbose: + sys.stdout.write(" server: new connection from %s:%s\n" %addr) + self.ConnectionHandler(sock_obj, self.certfile) - class AsyncoreHTTPSServer(threading.Thread): + def handle_error(self): + raise + + def __init__(self, certfile): + self.flag = None + self.active = False + self.server = self.EchoServer(certfile) + self.port = self.server.port + threading.Thread.__init__(self) + self.setDaemon(True) + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def start (self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run (self): + self.active = True + if self.flag: + self.flag.set() + while self.active: + try: + asyncore.loop(1) + except: + pass + + def stop (self): + self.active = False + self.server.close() + + class SocketServerHTTPSServer(threading.Thread): class HTTPSServer(HTTPServer): @@ -335,6 +450,12 @@ self.active_lock = threading.Lock() self.allow_reuse_address = True + def __str__(self): + return ('<%s %s:%s>' % + (self.__class__.__name__, + self.server_name, + self.server_port)) + def get_request (self): # override this to wrap socket with SSL sock, addr = self.socket.accept() @@ -421,8 +542,8 @@ # we override this to suppress logging unless "verbose" if test_support.verbose: - sys.stdout.write(" server (%s, %d, %s):\n [%s] %s\n" % - (self.server.server_name, + sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" % + (self.server.server_address, self.server.server_port, self.request.cipher(), self.log_date_time_string(), @@ -440,9 +561,7 @@ self.setDaemon(True) def __str__(self): - return '<%s %s:%d>' % (self.__class__.__name__, - self.server.server_name, - self.server.server_port) + return "<%s %s>" % (self.__class__.__name__, self.server) def start (self, flag=None): self.flag = flag @@ -487,14 +606,16 @@ def serverParamsTest (certfile, protocol, certreqs, cacertsfile, client_certfile, client_protocol=None, indata="FOO\n", - chatty=True, connectionchatty=False): + chatty=True, connectionchatty=False, + wrap_accepting_socket=False): server = ThreadedEchoServer(certfile, certreqs=certreqs, ssl_version=protocol, cacerts=cacertsfile, chatty=chatty, - connectionchatty=connectionchatty) + connectionchatty=connectionchatty, + wrap_accepting_socket=wrap_accepting_socket) flag = threading.Event() server.start(flag) # wait for it to start @@ -572,7 +693,7 @@ ssl.get_protocol_name(server_protocol))) - class ConnectedTests(unittest.TestCase): + class ThreadedTests(unittest.TestCase): def testRudeShutdown(self): @@ -600,7 +721,7 @@ listener_gone.wait() try: ssl_sock = ssl.wrap_socket(s) - except socket.sslerror: + except IOError: pass else: raise test_support.TestFailed( @@ -680,6 +801,9 @@ def testMalformedCert(self): badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, "badcert.pem")) + def testWrongCert(self): + badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, + "wrongcert.pem")) def testMalformedKey(self): badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, "badkey.pem")) @@ -796,9 +920,9 @@ server.stop() server.join() - def testAsyncore(self): + def testSocketServer(self): - server = AsyncoreHTTPSServer(CERTFILE) + server = SocketServerHTTPSServer(CERTFILE) flag = threading.Event() server.start(flag) # wait for it to start @@ -810,8 +934,8 @@ d1 = open(CERTFILE, 'rb').read() d2 = '' # now fetch the same data from the HTTPS server - url = 'https://%s:%d/%s' % ( - HOST, server.port, os.path.split(CERTFILE)[1]) + url = 'https://127.0.0.1:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) f = urllib.urlopen(url) dlen = f.info().getheader("content-length") if dlen and (int(dlen) > 0): @@ -834,6 +958,58 @@ server.stop() server.join() + def testWrappedAccept (self): + + if test_support.verbose: + sys.stdout.write("\n") + serverParamsTest(CERTFILE, ssl.PROTOCOL_SSLv23, ssl.CERT_REQUIRED, + CERTFILE, CERTFILE, ssl.PROTOCOL_SSLv23, + chatty=True, connectionchatty=True, + wrap_accepting_socket=True) + + + def testAsyncoreServer (self): + + indata = "TEST MESSAGE of mixed case\n" + + if test_support.verbose: + sys.stdout.write("\n") + server = AsyncoreEchoServer(CERTFILE) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + try: + s = ssl.wrap_socket(socket.socket()) + s.connect(('127.0.0.1', server.port)) + except ssl.SSLError, x: + raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + except Exception, x: + raise test_support.TestFailed("Unexpected exception: " + str(x)) + else: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(indata))) + s.write(indata) + outdata = s.read() + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + raise test_support.TestFailed( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + finally: + server.stop() + # wait for server thread to end + server.join() + def test_main(verbose=False): if skip_expected: @@ -850,15 +1026,19 @@ not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)): raise test_support.TestFailed("Can't read certificate files!") + TESTPORT = test_support.find_unused_port() + if not TESTPORT: + raise test_support.TestFailed("Can't find open port to test servers on!") + tests = [BasicTests] if test_support.is_resource_enabled('network'): - tests.append(NetworkTests) + tests.append(NetworkedTests) if _have_threads: thread_info = test_support.threading_setup() if thread_info and test_support.is_resource_enabled('network'): - tests.append(ConnectedTests) + tests.append(ThreadedTests) test_support.run_unittest(*tests) Added: python/trunk/Lib/test/wrongcert.pem ============================================================================== --- (empty file) +++ python/trunk/Lib/test/wrongcert.pem Sun Jun 29 00:19:33 2008 @@ -0,0 +1,32 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnH +FlbsVUg2Xtk6+bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6T +f9lnNTwpSoeK24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQAB +AoGAQFko4uyCgzfxr4Ezb4Mp5pN3Npqny5+Jey3r8EjSAX9Ogn+CNYgoBcdtFgbq +1yif/0sK7ohGBJU9FUCAwrqNBI9ZHB6rcy7dx+gULOmRBGckln1o5S1+smVdmOsW +7zUVLBVByKuNWqTYFlzfVd6s4iiXtAE2iHn3GCyYdlICwrECQQDhMQVxHd3EFbzg +SFmJBTARlZ2GKA3c1g/h9/XbkEPQ9/RwI3vnjJ2RaSnjlfoLl8TOcf0uOGbOEyFe +19RvCLXjAkEA1s+UE5ziF+YVkW3WolDCQ2kQ5WG9+ccfNebfh6b67B7Ln5iG0Sbg +ky9cjsO3jbMJQtlzAQnH1850oRD5Gi51dQJAIbHCDLDZU9Ok1TI+I2BhVuA6F666 +lEZ7TeZaJSYq34OaUYUdrwG9OdqwZ9sy9LUav4ESzu2lhEQchCJrKMn23QJAReqs +ZLHUeTjfXkVk7dHhWPWSlUZ6AhmIlA/AQ7Payg2/8wM/JkZEJEPvGVykms9iPUrv +frADRr+hAGe43IewnQJBAJWKZllPgKuEBPwoEldHNS8nRu61D7HzxEzQ2xnfj+Nk +2fgf1MAzzTRsikfGENhVsVWeqOcijWb6g5gsyCmlRpc= +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIICsDCCAhmgAwIBAgIJAOqYOYFJfEEoMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV +BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX +aWRnaXRzIFB0eSBMdGQwHhcNMDgwNjI2MTgxNTUyWhcNMDkwNjI2MTgxNTUyWjBF +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB +gQC89ZNxjTgWgq7Z1g0tJ65w+k7lNAj5IgjLb155UkUrz0XsHDnHFlbsVUg2Xtk6 ++bo2UEYIzN7cIm5ImpmyW/2z0J1IDVDlvR2xJ659xrE0v5c2cB6Tf9lnNTwpSoeK +24Nd7Jwq4j9vk95fLrdqsBq0/KVlsCXeixS/CaqqduXfvwIDAQABo4GnMIGkMB0G +A1UdDgQWBBTctMtI3EO9OjLI0x9Zo2ifkwIiNjB1BgNVHSMEbjBsgBTctMtI3EO9 +OjLI0x9Zo2ifkwIiNqFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt +U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAOqYOYFJ +fEEoMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAQwa7jya/DfhaDn7E +usPkpgIX8WCL2B1SqnRTXEZfBPPVq/cUmFGyEVRVATySRuMwi8PXbVcOhXXuocA+ +43W+iIsD9pXapCZhhOerCq18TC1dWK98vLUsoK8PMjB6e5H/O8bqojv0EeC+fyCw +eSHj5jpC8iZKjCHBn+mAi4cQ514= +-----END CERTIFICATE----- Modified: python/trunk/Modules/_ssl.c ============================================================================== --- python/trunk/Modules/_ssl.c (original) +++ python/trunk/Modules/_ssl.c Sun Jun 29 00:19:33 2008 @@ -2,14 +2,15 @@ SSL support based on patches by Brian E Gallew and Laszlo Kovacs. Re-worked a bit by Bill Janssen to add server-side support and - certificate decoding. + certificate decoding. Chris Stawarz contributed some non-blocking + patches. This module is imported by ssl.py. It should *not* be used directly. XXX should partial writes be enabled, SSL_MODE_ENABLE_PARTIAL_WRITE? - XXX what about SSL_MODE_AUTO_RETRY + XXX what about SSL_MODE_AUTO_RETRY? */ #include "Python.h" @@ -265,8 +266,6 @@ PySSLObject *self; char *errstr = NULL; int ret; - int err; - int sockstate; int verification_mode; self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */ @@ -388,57 +387,6 @@ SSL_set_accept_state(self->ssl); PySSL_END_ALLOW_THREADS - /* Actually negotiate SSL connection */ - /* XXX If SSL_connect() returns 0, it's also a failure. */ - sockstate = 0; - do { - PySSL_BEGIN_ALLOW_THREADS - if (socket_type == PY_SSL_CLIENT) - ret = SSL_connect(self->ssl); - else - ret = SSL_accept(self->ssl); - err = SSL_get_error(self->ssl, ret); - PySSL_END_ALLOW_THREADS - if(PyErr_CheckSignals()) { - goto fail; - } - if (err == SSL_ERROR_WANT_READ) { - sockstate = check_socket_and_wait_for_timeout(Sock, 0); - } else if (err == SSL_ERROR_WANT_WRITE) { - sockstate = check_socket_and_wait_for_timeout(Sock, 1); - } else { - sockstate = SOCKET_OPERATION_OK; - } - if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("The connect operation timed out")); - goto fail; - } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("Underlying socket has been closed.")); - goto fail; - } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("Underlying socket too large for select().")); - goto fail; - } else if (sockstate == SOCKET_IS_NONBLOCKING) { - break; - } - } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); - if (ret < 1) { - PySSL_SetError(self, ret, __FILE__, __LINE__); - goto fail; - } - self->ssl->debug = 1; - - PySSL_BEGIN_ALLOW_THREADS - if ((self->peer_cert = SSL_get_peer_certificate(self->ssl))) { - X509_NAME_oneline(X509_get_subject_name(self->peer_cert), - self->server, X509_NAME_MAXLEN); - X509_NAME_oneline(X509_get_issuer_name(self->peer_cert), - self->issuer, X509_NAME_MAXLEN); - } - PySSL_END_ALLOW_THREADS self->Socket = Sock; Py_INCREF(self->Socket); return self; @@ -488,6 +436,65 @@ /* SSL object methods */ +static PyObject *PySSL_SSLdo_handshake(PySSLObject *self) +{ + int ret; + int err; + int sockstate; + + /* Actually negotiate SSL connection */ + /* XXX If SSL_do_handshake() returns 0, it's also a failure. */ + sockstate = 0; + do { + PySSL_BEGIN_ALLOW_THREADS + ret = SSL_do_handshake(self->ssl); + err = SSL_get_error(self->ssl, ret); + PySSL_END_ALLOW_THREADS + if(PyErr_CheckSignals()) { + return NULL; + } + if (err == SSL_ERROR_WANT_READ) { + sockstate = check_socket_and_wait_for_timeout(self->Socket, 0); + } else if (err == SSL_ERROR_WANT_WRITE) { + sockstate = check_socket_and_wait_for_timeout(self->Socket, 1); + } else { + sockstate = SOCKET_OPERATION_OK; + } + if (sockstate == SOCKET_HAS_TIMED_OUT) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("The handshake operation timed out")); + return NULL; + } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("Underlying socket has been closed.")); + return NULL; + } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("Underlying socket too large for select().")); + return NULL; + } else if (sockstate == SOCKET_IS_NONBLOCKING) { + break; + } + } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); + if (ret < 1) + return PySSL_SetError(self, ret, __FILE__, __LINE__); + self->ssl->debug = 1; + + if (self->peer_cert) + X509_free (self->peer_cert); + PySSL_BEGIN_ALLOW_THREADS + if ((self->peer_cert = SSL_get_peer_certificate(self->ssl))) { + X509_NAME_oneline(X509_get_subject_name(self->peer_cert), + self->server, X509_NAME_MAXLEN); + X509_NAME_oneline(X509_get_issuer_name(self->peer_cert), + self->issuer, X509_NAME_MAXLEN); + } + PySSL_END_ALLOW_THREADS + + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * PySSL_server(PySSLObject *self) { @@ -1127,7 +1134,9 @@ rc = select(s->sock_fd+1, &fds, NULL, NULL, &tv); PySSL_END_ALLOW_THREADS +#ifdef HAVE_POLL normal_return: +#endif /* Return SOCKET_TIMED_OUT on timeout, SOCKET_OPERATION_OK otherwise (when we are able to write or when there's something to read) */ return rc == 0 ? SOCKET_HAS_TIMED_OUT : SOCKET_OPERATION_OK; @@ -1140,10 +1149,16 @@ int count; int sockstate; int err; + int nonblocking; if (!PyArg_ParseTuple(args, "s#:write", &data, &count)) return NULL; + /* just in case the blocking state of the socket has been changed */ + nonblocking = (self->Socket->sock_timeout >= 0.0); + BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); + BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); + sockstate = check_socket_and_wait_for_timeout(self->Socket, 1); if (sockstate == SOCKET_HAS_TIMED_OUT) { PyErr_SetString(PySSLErrorObject, @@ -1200,6 +1215,25 @@ Writes the string s into the SSL object. Returns the number\n\ of bytes written."); +static PyObject *PySSL_SSLpending(PySSLObject *self) +{ + int count = 0; + + PySSL_BEGIN_ALLOW_THREADS + count = SSL_pending(self->ssl); + PySSL_END_ALLOW_THREADS + if (count < 0) + return PySSL_SetError(self, count, __FILE__, __LINE__); + else + return PyInt_FromLong(count); +} + +PyDoc_STRVAR(PySSL_SSLpending_doc, +"pending() -> count\n\ +\n\ +Returns the number of already decrypted bytes available for read,\n\ +pending on the connection.\n"); + static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) { PyObject *buf; @@ -1207,6 +1241,7 @@ int len = 1024; int sockstate; int err; + int nonblocking; if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; @@ -1214,6 +1249,11 @@ if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; + /* just in case the blocking state of the socket has been changed */ + nonblocking = (self->Socket->sock_timeout >= 0.0); + BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); + BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); + /* first check if there are bytes ready to be read */ PySSL_BEGIN_ALLOW_THREADS count = SSL_pending(self->ssl); @@ -1232,9 +1272,18 @@ Py_DECREF(buf); return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { - /* should contain a zero-length string */ - _PyString_Resize(&buf, 0); - return buf; + if (SSL_get_shutdown(self->ssl) != + SSL_RECEIVED_SHUTDOWN) + { + Py_DECREF(buf); + PyErr_SetString(PySSLErrorObject, + "Socket closed without SSL shutdown handshake"); + return NULL; + } else { + /* should contain a zero-length string */ + _PyString_Resize(&buf, 0); + return buf; + } } } do { @@ -1285,16 +1334,54 @@ \n\ Read up to len bytes from the SSL socket."); +static PyObject *PySSL_SSLshutdown(PySSLObject *self) +{ + int err; + + /* Guard against closed socket */ + if (self->Socket->sock_fd < 0) { + PyErr_SetString(PySSLErrorObject, + "Underlying socket has been closed."); + return NULL; + } + + PySSL_BEGIN_ALLOW_THREADS + err = SSL_shutdown(self->ssl); + if (err == 0) { + /* we need to call it again to finish the shutdown */ + err = SSL_shutdown(self->ssl); + } + PySSL_END_ALLOW_THREADS + + if (err < 0) + return PySSL_SetError(self, err, __FILE__, __LINE__); + else { + Py_INCREF(self->Socket); + return (PyObject *) (self->Socket); + } +} + +PyDoc_STRVAR(PySSL_SSLshutdown_doc, +"shutdown(s) -> socket\n\ +\n\ +Does the SSL shutdown handshake with the remote end, and returns\n\ +the underlying socket object."); + static PyMethodDef PySSLMethods[] = { + {"do_handshake", (PyCFunction)PySSL_SSLdo_handshake, METH_NOARGS}, {"write", (PyCFunction)PySSL_SSLwrite, METH_VARARGS, PySSL_SSLwrite_doc}, {"read", (PyCFunction)PySSL_SSLread, METH_VARARGS, PySSL_SSLread_doc}, + {"pending", (PyCFunction)PySSL_SSLpending, METH_NOARGS, + PySSL_SSLpending_doc}, {"server", (PyCFunction)PySSL_server, METH_NOARGS}, {"issuer", (PyCFunction)PySSL_issuer, METH_NOARGS}, {"peer_certificate", (PyCFunction)PySSL_peercert, METH_VARARGS, PySSL_peercert_doc}, {"cipher", (PyCFunction)PySSL_cipher, METH_NOARGS}, + {"shutdown", (PyCFunction)PySSL_SSLshutdown, METH_NOARGS, + PySSL_SSLshutdown_doc}, {NULL, NULL} }; From buildbot at python.org Sun Jun 29 00:38:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 22:38:11 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080628223811.B81641E4003@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/132 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,bill.janssen,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asynchat ====================================================================== ERROR: test_close_when_done (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 207, in test_close_when_done asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_empty_line (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 196, in test_empty_line asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator1 (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 123, in test_line_terminator1 self.line_terminator_check('\n', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator2 (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 128, in test_line_terminator2 self.line_terminator_check('\r\n', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator3 (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 133, in test_line_terminator3 self.line_terminator_check('qqq', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_none_terminator (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 163, in test_none_terminator asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_numeric_terminator1 (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 150, in test_numeric_terminator1 self.numeric_terminator_check(1) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 142, in numeric_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_numeric_terminator2 (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 154, in test_numeric_terminator2 self.numeric_terminator_check(6L) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 142, in numeric_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_simple_producer (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 175, in test_simple_producer asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_string_producer (test.test_asynchat.TestAsynchat) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 185, in test_string_producer asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 139, in poll read(obj) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_close_when_done (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 207, in test_close_when_done asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_empty_line (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 196, in test_empty_line asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator1 (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 123, in test_line_terminator1 self.line_terminator_check('\n', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator2 (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 128, in test_line_terminator2 self.line_terminator_check('\r\n', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_line_terminator3 (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 133, in test_line_terminator3 self.line_terminator_check('qqq', l) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 111, in line_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_none_terminator (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 163, in test_none_terminator asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_numeric_terminator1 (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 150, in test_numeric_terminator1 self.numeric_terminator_check(1) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 142, in numeric_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_numeric_terminator2 (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 154, in test_numeric_terminator2 self.numeric_terminator_check(6L) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 142, in numeric_terminator_check asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_simple_producer (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 175, in test_simple_producer asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol ====================================================================== ERROR: test_string_producer (test.test_asynchat.TestAsynchat_WithPoll) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_asynchat.py", line 185, in test_string_producer asyncore.loop(use_poll=self.usepoll, count=300, timeout=.01) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 202, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 01:00:22 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 29 Jun 2008 01:00:22 +0200 (CEST) Subject: [Python-checkins] r64579 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080628230022.5B1221E4003@bag.python.org> Author: guilherme.polo Date: Sun Jun 29 01:00:21 2008 New Revision: 64579 Log: Every widget that needs a factory has one now; Added sublayouts; Removed custom layouts since I was using it only for adding sublayouts; Some other misc changes. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Sun Jun 29 01:00:21 2008 @@ -5,11 +5,10 @@ -- Guilherme Polo, 2008. """ -# ToDO: Add a way to remove options. +# ToDO: Support element options. +# Add a way to remove options. # Add a way to edit images/elements. -# Add sublayouts. # Add pre-defined elements for the current theme. -# Handling element options. # ... import sys @@ -21,19 +20,24 @@ from tkMessageBox import showwarning from tkFileDialog import askopenfilename -def available_widgets(): - """Returns a list of Ttk widgets.""" +def available_widgets(): # XXX misleading function name + """Returns a list of Ttk widgets.""" # XXX misleading docstring widgets = {} # will discard Style and extension classes unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') # some widgets contain Vertical and Horizontal layouts - special = ('Progressbar', 'Scale', 'Scrollbar') + vert_horiz = ('Progressbar', 'Scale', 'Scrollbar') + # several widgets contain a single layout named as Twidgetname + prefix_t = ('Label', 'Button', 'Checkbutton', 'Radiobutton', 'Menubutton', + 'Entry', 'Combobox', 'Frame', 'Labelframe', 'Separator', 'Sizegrip') sample = {'Button': widget_text, 'Checkbutton': widget_text, 'Label': widget_text, 'Radiobutton': widget_text, 'Labelframe': widget_text_size, 'Combobox': widget_values, 'Progressbar': widget_progress, 'Notebook': widget_notebook, - 'Treeview': widget_treeview, 'Scrollbar': widget_expand} + 'Treeview': widget_treeview, 'Scrollbar': widget_expand, + 'Frame': widget_expand, 'Separator': widget_expand, + 'Menubutton': widget_menubtn, 'Panedwindow': widget_paned} for name in ttk.__all__: if name in unwanted_names: @@ -46,11 +50,23 @@ widget_d = {'factory': None, 'layouts': None} - if name in special: - widget_d['layouts'] = ('Horizontal', 'Vertical') + if name in prefix_t: + widget_d['layouts'] = ('T%s' % name, ) + elif name in vert_horiz: + widget_d['layouts'] = ('Horizontal.T%s' % name, + 'Vertical.T%s' % name) + elif name == 'Notebook': + widget_d['layouts'] = ('TNotebook', 'Tab') + elif name == 'Panedwindow': + widget_d['layouts'] = ('TPanedwindow', 'Horizontal.Sash', + 'Vertical.Sash') + elif name == 'Treeview': + widget_d['layouts'] = ('Treeview', 'Item', 'Cell', 'Heading', 'Row') if name in sample: widget_d['factory'] = sample[name] + if name == 'Scrollbar': + widget_d['class'] = 'Vertical.TScrollbar' widgets[name] = widget_d @@ -94,10 +110,29 @@ w.insert('', 'end', text="Row %d" % i, values=[i, i + 1]) return w +def widget_menubtn(widget, master, **kw): + """Create a sample menu button with some options.""" + menu = Tkinter.Menu(tearoff=False) + for i in range(5): + menu.add_radiobutton(label='Item %d' % i) + return widget(master, text="Sample", menu=menu, **kw) + +def widget_paned(widget, master, **kw): + """Create a sample Panedwindow with two children.""" + w = widget(master, height=150, **kw) + c1 = ttk.Label(w, text="Top") + c2 = ttk.Label(w, text="Bottom") + w.add(c1) + w.add(c2) + return w + def widget_expand(widget, master, **kw): """Instantiate widget and configure it to expand.""" w = widget(master, **kw) - fill = 'x' if 'horizontal' in str(w['orient']) else 'y' + try: + fill = 'x' if 'horizontal' in str(w['orient']) else 'y' + except Tkinter.TclError: + fill = 'both' w.pack_configure(expand=True, fill=fill) return w @@ -358,31 +393,38 @@ self.__setup_widgets() self.__fill_treeview() - def _change_preview(self, event): - """New treeview selection, update preview area.""" + def _change_preview(self, event, invalid=False): + """New treeview selection (or theme changed), update preview area.""" treeview = getattr(event, 'widget', event) - if not treeview.selection(): - return - tv_item = treeview.item(treeview.selection()[0]) + sel = treeview.selection() + if not sel: # nothing selected + return + + sel = sel[0] + tv_item = treeview.item(sel) widget_name = tv_item['text'] + widget_style = None + opts = {} + + if self._is_layout(widget_name, sel): # not a widget, but a layout + self._update_layout_text(widget_name) + if 'Horizontal' in widget_name or 'Vertical' in widget_name: + opts['orient'] = widget_name.split('.')[0].lower() + widget_style = "Custom.%s" % widget_name + widget_name = treeview.item(treeview.parent(sel))['text'] + else: + self._empty_layout_text() + widget = self._widget[widget_name] - parent = widget['tv_item'] - if treeview.get_children(parent): - return + widget_style = widget_style or "Custom.%s" % widget['class'] + curr_widget = self._current_widget - complement = '' - opts = {} - if '.' in widget_name: # horizontal/vertical layout (maybe) - complement, widget_name = widget_name.split('.') - opts = {'orient': complement.lower()} - - # check if this is a widget or a custom layout - if not hasattr(ttk, widget_name): # custom layout - self._current_widget['layout'] = "Custom.T%s.%s" % (complement, - widget_name) - self._update_layout_text() - return + if not invalid and curr_widget['layout'] == widget_style: + if not opts or \ + str(curr_widget['widget']['orient']) == opts['orient']: + # didn't select a new widget/no new options + return # create a sample widget if widget.get('factory', None): @@ -390,30 +432,22 @@ sample = widget['factory'](widget_class, self._preview_area, **opts) else: sample = getattr(ttk, widget_name)(self._preview_area, **opts) - if widget['class'] is None: - widget['class'] = "%s%s%s" % (complement, - '.' if complement else '', sample.winfo_class()) - sample['style'] = 'Custom.%s' % widget['class'] - if self._current_widget['widget'] is not None: - self._current_widget['widget'].pack_forget() + + sample['style'] = widget_style + if curr_widget['widget'] is not None: + curr_widget['widget'].pack_forget() sample.pack(expand=True) - self._current_widget['layout'] = sample['style'] - self._current_widget['widget'] = sample - self._update_layout_text() + curr_widget['layout'] = widget_style + curr_widget['widget'] = sample self._remove_previous_widgets() self._update_style_configframe() self._update_style_mapframe() - def _update_layout_text(self): - """Update the layout text for the current widget.""" - layout_name = self._current_widget['layout'] - output = cStringIO.StringIO() - pprint.pprint(self._style.layout(layout_name), stream=output) - layout = output.getvalue() - output.close() - self.layouttext.delete('1.0', 'end') # clear current text - self.layouttext.insert('1.0', layout) # set new text + def _is_layout(self, name, selection): + """Check if a treeview selection is a layout or a widget.""" + return (name not in self._widget or + self._widget[name]['tv_item'] != selection) def _remove_previous_widgets(self): """Remove widgets from the style frames.""" @@ -442,17 +476,6 @@ for opt_name, opt_value in options.items(): self._add_opt_frame(frame, func, layout_name, opt_name, opt_value) - def _add_custom_layout(self): - """Create a new, and empty, custom layout.""" - result = askstring("New Layout", "Layout name") - if result: - # create an empty layout - self._style.layout(result, '') - # create a "semi-widget" - treeview = self._tv_custom - widget_d = {'factory': None, 'layouts': None} - self._add_widget(result, widget_d, treeview) - def _add_opt_frame(self, frame, func, layout_name, opt_name, opt_value): """Add a new option to a frame.""" def change_opt(option, text): @@ -464,7 +487,7 @@ func(layout_name, **{option: text}) except (SyntaxError, Tkinter.TclError, TypeError): pass - return 1 + return True lbl = ttk.Label(frame, text=opt_name) entry = ttk.Entry(frame) @@ -477,13 +500,18 @@ self._current_options = self._current_options or [] self._current_options.extend([lbl, entry]) - def _change_theme(self, event): - """New theme selected at themes combobox, change current theme.""" - widget = event.widget - self._style.theme_use(widget.get()) + def _update_layout_text(self, layout_name): + """Update the layout text for the current widget.""" + output = cStringIO.StringIO() + pprint.pprint(self._style.layout(layout_name), stream=output) + layout = output.getvalue() + output.close() + self._empty_layout_text() + self.layouttext.insert('1.0', layout) # set new text - treeview = self._tv_widgets - self._change_preview(treeview) + def _empty_layout_text(self): + """Clear current text in the layout text widget.""" + self.layouttext.delete('1.0', 'end') def _apply_layout(self): """Apply the supposed new layout for the current selected widget.""" @@ -492,6 +520,8 @@ return text = self.layouttext.get('1.0', 'end') + if not text.strip(): # no text + return # XXX Warning: eval usage! self._style.layout(layout, eval(text)) @@ -502,8 +532,7 @@ return orig_name = widget['layout'][widget['layout'].find('.', 1) + 1:] - self._style.layout(widget['layout'], self._style.layout(orig_name)) - self._update_layout_text() + self._update_layout_text(orig_name) def _ask_new_frame_opt(self, frame, func): """Open a dialog asking for a new option to be added in the @@ -563,37 +592,39 @@ self._imagelist['values'] = (self._imagelist['values'] or ()) + \ (img.name, ) + def _change_theme(self, event): + """New theme selected at themes combobox, change current theme.""" + widget = event.widget + self._style.theme_use(widget.get()) + + treeview = self._tv_widgets + self._change_preview(treeview, invalid=True) + def _add_widget(self, name, opts, treeview=None): """Add a new widget to self._widget.""" treeview = treeview or self._tv_widgets - children = opts.pop('layouts') or () + children = opts.pop('layouts') parent = treeview.insert('', 'end', text=name) - self._widget[name] = {'tv_item': parent, 'class': None} + self._widget[name] = {'tv_item': parent, 'class': children[0]} self._widget[name].update(opts) for child in children: - child_name = '%s.%s' % (child, name) - item = treeview.insert(parent, 'end', text=child_name) - self._widget[child_name] = {'tv_item': item, 'class': None} - self._widget[child_name].update(opts) + treeview.insert(parent, 'end', text=child) def __create_menu(self): menu = Tkinter.Menu() self.master['menu'] = menu file_menu = Tkinter.Menu(menu, tearoff=False) - #file_menu.add_command(label="Save", underline=0) file_menu.add_separator() - file_menu.add_command(label="Exit", underline=1, + file_menu.add_command(label="Exit", underline=1, accelerator="Ctrl-X", command=self.master.destroy) layout_menu = Tkinter.Menu(menu, tearoff=False) - layout_menu.add_command(label="New layout", - command=self._add_custom_layout) menu.add('cascade', menu=file_menu, label="File", underline=0) - menu.add('cascade', menu=layout_menu, label="Custom Layouts") + self.master.bind('', 'exit') def __setup_widgets(self): """Create and layout widgets.""" @@ -603,7 +634,7 @@ top = ttk.Frame(paned) top.pack(side='top', fill='both', expand=True) - # top left frame (widget listing, custom layouts, images) + # top left frame (widget listing, images) left = ttk.Frame(top) left.pack(side='left', fill='y') # widget listing @@ -611,22 +642,15 @@ self._tv_widgets.pack(side='top', fill='y', anchor='w', expand=True) self._tv_widgets.heading('#0', text="Widgets") self._tv_widgets.bind('<>', self._change_preview) - # custom layouts - self._tv_custom = ScrolledTreeview(left, selectmode='browse', - height=4) - self._tv_custom.pack(side='top', anchor='w') - self._tv_custom.heading('#0', text="Custom Layouts") - self._tv_custom.bind('<>', self._change_preview) - # top right frame (preview, style conf, style map, elements, themes and - # images) + # top right frame (preview, style notebook, images) topright = ttk.Frame(top) - topright.pack(side='top', fill='both', expand=True, padx=6) + topright.pack(side='top', fill='both', expand=True) # preview area - self._preview_area = ttk.Frame(topright, width=200, padding=12) + self._preview_area = ttk.Frame(topright, width=200) self._preview_area.pack(anchor='center', side='left', expand=True, - fill='both') + fill='both', padx=12) # options, images and themes frames = ttk.Frame(topright) From python-checkins at python.org Sun Jun 29 01:00:39 2008 From: python-checkins at python.org (bill.janssen) Date: Sun, 29 Jun 2008 01:00:39 +0200 (CEST) Subject: [Python-checkins] r64580 - python/trunk/Lib/test/test_ssl.py Message-ID: <20080628230039.A2DE71E4003@bag.python.org> Author: bill.janssen Date: Sun Jun 29 01:00:39 2008 New Revision: 64580 Log: make sure we close the active channels when eof is received on them Modified: python/trunk/Lib/test/test_ssl.py Modified: python/trunk/Lib/test/test_ssl.py ============================================================================== --- python/trunk/Lib/test/test_ssl.py (original) +++ python/trunk/Lib/test/test_ssl.py Sun Jun 29 01:00:39 2008 @@ -386,6 +386,7 @@ self.send(data.lower()) def handle_close(self): + self.close() if test_support.verbose: sys.stdout.write(" server: closed connection %s\n" % self.socket) From buildbot at python.org Sun Jun 29 01:03:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 23:03:32 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080628230332.54AA91E4003@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/1678 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,bill.janssen,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_smtplib.py", line 108, in debugging_server poll_fun(0.01, asyncore.socket_map) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 99, in readwrite obj.handle_read_event() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 411, in handle_read_event self.handle_read() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_ssl.py", line 386, in handle_read self.send(data.lower()) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 517, in send self.initiate_send() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 504, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/asyncore.py", line 347, in send result = self.socket.send(data) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/ssl.py", line 94, in self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/ssl.py", line 172, in send v = self._sslobj.write(data) SSLError: [Errno 8] _ssl.c:1209: EOF occurred in violation of protocol 2 tests failed: test_bsddb3 test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 01:06:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jun 2008 01:06:06 +0200 (CEST) Subject: [Python-checkins] r64582 - python/trunk/Lib/test/test_audioop.py Message-ID: <20080628230606.52F2B1E4005@bag.python.org> Author: benjamin.peterson Date: Sun Jun 29 01:06:05 2008 New Revision: 64582 Log: convert test_audioop to unittest. Thanks to Giampaolo Rodola. Modified: python/trunk/Lib/test/test_audioop.py Modified: python/trunk/Lib/test/test_audioop.py ============================================================================== --- python/trunk/Lib/test/test_audioop.py (original) +++ python/trunk/Lib/test/test_audioop.py Sun Jun 29 01:06:05 2008 @@ -1,286 +1,169 @@ -# Test audioop. import audioop -from test.test_support import verbose +import unittest +from test.test_support import run_unittest + def gendata1(): return '\0\1\2' def gendata2(): - if verbose: - print 'getsample' if audioop.getsample('\0\1', 2, 0) == 1: return '\0\0\0\1\0\2' else: return '\0\0\1\0\2\0' def gendata4(): - if verbose: - print 'getsample' if audioop.getsample('\0\0\0\1', 4, 0) == 1: return '\0\0\0\0\0\0\0\1\0\0\0\2' else: return '\0\0\0\0\1\0\0\0\2\0\0\0' -def testmax(data): - if verbose: - print 'max' - if audioop.max(data[0], 1) != 2 or \ - audioop.max(data[1], 2) != 2 or \ - audioop.max(data[2], 4) != 2: - return 0 - return 1 - -def testminmax(data): - if verbose: - print 'minmax' - if audioop.minmax(data[0], 1) != (0, 2) or \ - audioop.minmax(data[1], 2) != (0, 2) or \ - audioop.minmax(data[2], 4) != (0, 2): - return 0 - return 1 - -def testmaxpp(data): - if verbose: - print 'maxpp' - if audioop.maxpp(data[0], 1) != 0 or \ - audioop.maxpp(data[1], 2) != 0 or \ - audioop.maxpp(data[2], 4) != 0: - return 0 - return 1 - -def testavg(data): - if verbose: - print 'avg' - if audioop.avg(data[0], 1) != 1 or \ - audioop.avg(data[1], 2) != 1 or \ - audioop.avg(data[2], 4) != 1: - return 0 - return 1 - -def testavgpp(data): - if verbose: - print 'avgpp' - if audioop.avgpp(data[0], 1) != 0 or \ - audioop.avgpp(data[1], 2) != 0 or \ - audioop.avgpp(data[2], 4) != 0: - return 0 - return 1 - -def testrms(data): - if audioop.rms(data[0], 1) != 1 or \ - audioop.rms(data[1], 2) != 1 or \ - audioop.rms(data[2], 4) != 1: - return 0 - return 1 - -def testcross(data): - if verbose: - print 'cross' - if audioop.cross(data[0], 1) != 0 or \ - audioop.cross(data[1], 2) != 0 or \ - audioop.cross(data[2], 4) != 0: - return 0 - return 1 - -def testadd(data): - if verbose: - print 'add' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.add(data[0], data[0], 1) != data2[0] or \ - audioop.add(data[1], data[1], 2) != data2[1] or \ - audioop.add(data[2], data[2], 4) != data2[2]: - return 0 - return 1 - -def testbias(data): - if verbose: - print 'bias' - # Note: this test assumes that avg() works - d1 = audioop.bias(data[0], 1, 100) - d2 = audioop.bias(data[1], 2, 100) - d4 = audioop.bias(data[2], 4, 100) - if audioop.avg(d1, 1) != 101 or \ - audioop.avg(d2, 2) != 101 or \ - audioop.avg(d4, 4) != 101: - return 0 - return 1 - -def testlin2lin(data): - if verbose: - print 'lin2lin' - # too simple: we test only the size - for d1 in data: - for d2 in data: - got = len(d1)//3 - wtd = len(d2)//3 - if len(audioop.lin2lin(d1, got, wtd)) != len(d2): - return 0 - return 1 - -def testadpcm2lin(data): - # Very cursory test - if audioop.adpcm2lin('\0\0', 1, None) != ('\0\0\0\0', (0,0)): - return 0 - return 1 - -def testlin2adpcm(data): - if verbose: - print 'lin2adpcm' - # Very cursory test - if audioop.lin2adpcm('\0\0\0\0', 1, None) != ('\0\0', (0,0)): - return 0 - return 1 - -def testlin2alaw(data): - if verbose: - print 'lin2alaw' - if audioop.lin2alaw(data[0], 1) != '\xd5\xc5\xf5' or \ - audioop.lin2alaw(data[1], 2) != '\xd5\xd5\xd5' or \ - audioop.lin2alaw(data[2], 4) != '\xd5\xd5\xd5': - return 0 - return 1 - -def testalaw2lin(data): - if verbose: - print 'alaw2lin' - # Cursory - d = audioop.lin2alaw(data[0], 1) - if audioop.alaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testlin2ulaw(data): - if verbose: - print 'lin2ulaw' - if audioop.lin2ulaw(data[0], 1) != '\xff\xe7\xdb' or \ - audioop.lin2ulaw(data[1], 2) != '\xff\xff\xff' or \ - audioop.lin2ulaw(data[2], 4) != '\xff\xff\xff': - return 0 - return 1 - -def testulaw2lin(data): - if verbose: - print 'ulaw2lin' - # Cursory - d = audioop.lin2ulaw(data[0], 1) - if audioop.ulaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testmul(data): - if verbose: - print 'mul' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.mul(data[0], 1, 2) != data2[0] or \ - audioop.mul(data[1],2, 2) != data2[1] or \ - audioop.mul(data[2], 4, 2) != data2[2]: - return 0 - return 1 - -def testratecv(data): - if verbose: - print 'ratecv' - state = None - d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': - return 0 - return 1 - -def testreverse(data): - if verbose: - print 'reverse' - if audioop.reverse(data[0], 1) != '\2\1\0': - return 0 - return 1 - -def testtomono(data): - if verbose: - print 'tomono' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tomono(data2, 1, 0.5, 0.5) != data[0]: - return 0 - return 1 - -def testtostereo(data): - if verbose: - print 'tostereo' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tostereo(data[0], 1, 1, 1) != data2: - return 0 - return 1 - -def testfindfactor(data): - if verbose: - print 'findfactor' - if audioop.findfactor(data[1], data[1]) != 1.0: - return 0 - return 1 - -def testfindfit(data): - if verbose: - print 'findfit' - if audioop.findfit(data[1], data[1]) != (0, 1.0): - return 0 - return 1 - -def testfindmax(data): - if verbose: - print 'findmax' - if audioop.findmax(data[1], 1) != 2: - return 0 - return 1 - -def testgetsample(data): - if verbose: - print 'getsample' - for i in range(3): - if audioop.getsample(data[0], 1, i) != i or \ - audioop.getsample(data[1], 2, i) != i or \ - audioop.getsample(data[2], 4, i) != i: - return 0 - return 1 - -def testone(name, data): - try: - func = eval('test'+name) - except NameError: - print 'No test found for audioop.'+name+'()' - return - try: - rv = func(data) - except 'xx': - print 'Test FAILED for audioop.'+name+'() (with an exception)' - return - if not rv: - print 'Test FAILED for audioop.'+name+'()' +data = [gendata1(), gendata2(), gendata4()] -def test_main(): - data = [gendata1(), gendata2(), gendata4()] - names = dir(audioop) - # We know there is a routine 'add' - routines = [] - for n in names: - if type(eval('audioop.'+n)) == type(audioop.add): - routines.append(n) - for n in routines: - testone(n, data) +class TestAudioop(unittest.TestCase): + + def test_max(self): + self.assertEqual(audioop.max(data[0], 1), 2) + self.assertEqual(audioop.max(data[1], 2), 2) + self.assertEqual(audioop.max(data[2], 4), 2) + + def test_minmax(self): + self.assertEqual(audioop.minmax(data[0], 1), (0, 2)) + Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) + self.assertEqual(audioop.minmax(data[2], 4), (0, 2)) + + def test_maxpp(self): + self.assertEqual(audioop.maxpp(data[0], 1), 0) + self.assertEqual(audioop.maxpp(data[1], 2), 0) + self.assertEqual(audioop.maxpp(data[2], 4), 0) + + def test_avg(self): + self.assertEqual(audioop.avg(data[0], 1), 1) + self.assertEqual(audioop.avg(data[1], 2), 1) + self.assertEqual(audioop.avg(data[2], 4), 1) + + def test_avgpp(self): + self.assertEqual(audioop.avgpp(data[0], 1), 0) + self.assertEqual(audioop.avgpp(data[1], 2), 0) + self.assertEqual(audioop.avgpp(data[2], 4), 0) + + def test_rms(self): + self.assertEqual(audioop.rms(data[0], 1), 1) + self.assertEqual(audioop.rms(data[1], 2), 1) + self.assertEqual(audioop.rms(data[2], 4), 1) + + def test_cross(self): + self.assertEqual(audioop.cross(data[0], 1), 0) + self.assertEqual(audioop.cross(data[1], 2), 0) + self.assertEqual(audioop.cross(data[2], 4), 0) + + def test_add(self): + data2 = [] + for d in data: + str = '' + for s in d: + str = str + chr(ord(s)*2) + data2.append(str) + self.assertEqual(audioop.add(data[0], data[0], 1), data2[0]) + self.assertEqual(audioop.add(data[1], data[1], 2), data2[1]) + self.assertEqual(audioop.add(data[2], data[2], 4), data2[2]) + + def test_bias(self): + # Note: this test assumes that avg() works + d1 = audioop.bias(data[0], 1, 100) + d2 = audioop.bias(data[1], 2, 100) + d4 = audioop.bias(data[2], 4, 100) + self.assertEqual(audioop.avg(d1, 1), 101) + self.assertEqual(audioop.avg(d2, 2), 101) + self.assertEqual(audioop.avg(d4, 4), 101) + + def test_lin2lin(self): + # too simple: we test only the size + for d1 in data: + for d2 in data: + got = len(d1)//3 + wtd = len(d2)//3 + self.assertEqual(len(audioop.lin2lin(d1, got, wtd)), len(d2)) + + def test_adpcm2lin(self): + # Very cursory test + self.assertEqual(audioop.adpcm2lin('\0\0', 1, None), ('\0\0\0\0', (0,0))) + + def test_lin2adpcm(self): + # Very cursory test + self.assertEqual(audioop.lin2adpcm('\0\0\0\0', 1, None), ('\0\0', (0,0))) + + def test_lin2alaw(self): + self.assertEqual(audioop.lin2alaw(data[0], 1), '\xd5\xc5\xf5') + self.assertEqual(audioop.lin2alaw(data[1], 2), '\xd5\xd5\xd5') + self.assertEqual(audioop.lin2alaw(data[2], 4), '\xd5\xd5\xd5') + + def test_alaw2lin(self): + # Cursory + d = audioop.lin2alaw(data[0], 1) + self.assertEqual(audioop.alaw2lin(d, 1), data[0]) + + def test_lin2ulaw(self): + self.assertEqual(audioop.lin2ulaw(data[0], 1), '\xff\xe7\xdb') + self.assertEqual(audioop.lin2ulaw(data[1], 2), '\xff\xff\xff') + self.assertEqual(audioop.lin2ulaw(data[2], 4), '\xff\xff\xff') + + def test_ulaw2lin(self): + # Cursory + d = audioop.lin2ulaw(data[0], 1) + self.assertEqual(audioop.ulaw2lin(d, 1), data[0]) + + def test_mul(self): + data2 = [] + for d in data: + str = '' + for s in d: + str = str + chr(ord(s)*2) + data2.append(str) + self.assertEqual(audioop.mul(data[0], 1, 2), data2[0]) + self.assertEqual(audioop.mul(data[1],2, 2), data2[1]) + self.assertEqual(audioop.mul(data[2], 4, 2), data2[2]) + + def test_ratecv(self): + state = None + d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) + d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) + self.assertEqual(d1 + d2, '\000\000\001\001\002\001\000\000\001\001\002') + + def test_reverse(self): + self.assertEqual(audioop.reverse(data[0], 1), '\2\1\0') + + def test_tomono(self): + data2 = '' + for d in data[0]: + data2 = data2 + d + d + self.assertEqual(audioop.tomono(data2, 1, 0.5, 0.5), data[0]) + + def test_tostereo(self): + data2 = '' + for d in data[0]: + data2 = data2 + d + d + self.assertEqual(audioop.tostereo(data[0], 1, 1, 1), data2) + + def test_findfactor(self): + self.assertEqual(audioop.findfactor(data[1], data[1]), 1.0) + + def test_findfit(self): + self.assertEqual(audioop.findfit(data[1], data[1]), (0, 1.0)) + + def test_findmax(self): + self.assertEqual(audioop.findmax(data[1], 1), 2) + + def test_getsample(self): + for i in range(3): + self.assertEqual(audioop.getsample(data[0], 1, i), i) + self.assertEqual(audioop.getsample(data[1], 2, i), i) + self.assertEqual(audioop.getsample(data[2], 4, i), i) +def test_main(): + run_unittest(TestAudioop) + if __name__ == '__main__': test_main() From python-checkins at python.org Sun Jun 29 01:06:49 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jun 2008 01:06:49 +0200 (CEST) Subject: [Python-checkins] r64583 - python/trunk/Doc/reference/compound_stmts.rst Message-ID: <20080628230649.A32281E4007@bag.python.org> Author: benjamin.peterson Date: Sun Jun 29 01:06:49 2008 New Revision: 64583 Log: rewrap Modified: python/trunk/Doc/reference/compound_stmts.rst Modified: python/trunk/Doc/reference/compound_stmts.rst ============================================================================== --- python/trunk/Doc/reference/compound_stmts.rst (original) +++ python/trunk/Doc/reference/compound_stmts.rst Sun Jun 29 01:06:49 2008 @@ -46,7 +46,7 @@ compound_stmt: `if_stmt` : | `while_stmt` : | `for_stmt` - : | `try_stmt` + : | `try_stmt : | `with_stmt` : | `funcdef` : | `classdef` @@ -538,10 +538,10 @@ class`\es, descriptors can be used to create instance variables with different implementation details. -Class definitions, like function definitions, may be wrapped by one or -more :term:`decorator` expressions. The evaluation rules for the -decorator expressions are the same as for functions. The result must -be a class object, which is then bound to the class name. +Class definitions, like function definitions, may be wrapped by one or more +:term:`decorator` expressions. The evaluation rules for the decorator +expressions are the same as for functions. The result must be a class object, +which is then bound to the class name. .. rubric:: Footnotes From buildbot at python.org Sun Jun 29 01:19:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 23:19:41 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080628231941.501911E4003@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/316 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_doctest make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 01:32:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 23:32:56 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080628233256.45F7E1E4004@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/134 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_audioop ====================================================================== ERROR: test_minmax (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_audioop.py", line 33, in test_minmax Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) NameError: global name 'Self' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 01:35:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jun 2008 01:35:31 +0200 (CEST) Subject: [Python-checkins] r64585 - python/trunk/Lib/test/test_audioop.py Message-ID: <20080628233531.C87581E4004@bag.python.org> Author: benjamin.peterson Date: Sun Jun 29 01:35:31 2008 New Revision: 64585 Log: fix typo Modified: python/trunk/Lib/test/test_audioop.py Modified: python/trunk/Lib/test/test_audioop.py ============================================================================== --- python/trunk/Lib/test/test_audioop.py (original) +++ python/trunk/Lib/test/test_audioop.py Sun Jun 29 01:35:31 2008 @@ -30,7 +30,7 @@ def test_minmax(self): self.assertEqual(audioop.minmax(data[0], 1), (0, 2)) - Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) + self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) self.assertEqual(audioop.minmax(data[2], 4), (0, 2)) def test_maxpp(self): From buildbot at python.org Sun Jun 29 01:59:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 28 Jun 2008 23:59:40 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080628235940.B74011E4004@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/214 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,bill.janssen BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_audioop ====================================================================== ERROR: test_minmax (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_audioop.py", line 33, in test_minmax Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) NameError: global name 'Self' is not defined sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 02:01:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 00:01:47 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080629000147.8E8C41E4009@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/260 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,bill.janssen BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_audioop ====================================================================== ERROR: test_minmax (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_audioop.py", line 33, in test_minmax Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) NameError: global name 'Self' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 02:18:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 00:18:54 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080629001855.158B11E4005@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3634 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,bill.janssen BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_audioop ====================================================================== ERROR: test_minmax (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_audioop.py", line 33, in test_minmax Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) NameError: global name 'Self' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 02:46:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 00:46:10 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20080629004611.26E161E4006@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/803 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,bill.janssen BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_audioop ====================================================================== ERROR: test_minmax (test.test_audioop.TestAudioop) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_audioop.py", line 33, in test_minmax Self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) NameError: global name 'Self' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 02:46:33 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 00:46:33 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080629004634.2107C1E400C@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/1680 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 BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 04:31:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 02:31:41 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080629023142.01FB21E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/556 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 4 tests failed: test_compile test_mailbox test_telnetlib test_urllib2 ====================================================================== FAIL: test_exec_with_general_mapping_for_locals (test.test_compile.TestSpecifics) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_compile.py", line 76, in test_exec_with_general_mapping_for_locals self.assertEqual(m.results, ('z', g)) AssertionError: ('z', {'TestSpecifics': , '_ast': , '__builtins__': {'bytearray': , 'IndexError': , 'all': , 'help': Type help() for interactive help, or help(object) for help about object., 'vars': , 'SyntaxError': , 'UnicodeDecodeError': , 'memoryview': , 'isinstance': , '__build_class__': , 'copyright': Copyright (c) 2001-2008 Python Software Foundation. ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 05:59:38 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 29 Jun 2008 05:59:38 +0200 (CEST) Subject: [Python-checkins] r64589 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080629035938.9CF031E4004@bag.python.org> Author: guilherme.polo Date: Sun Jun 29 05:59:38 2008 New Revision: 64589 Log: Adjusted Notebook and Treeview sublayouts so applying changes on them will actually work; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Sun Jun 29 05:59:38 2008 @@ -56,12 +56,13 @@ widget_d['layouts'] = ('Horizontal.T%s' % name, 'Vertical.T%s' % name) elif name == 'Notebook': - widget_d['layouts'] = ('TNotebook', 'Tab') + widget_d['layouts'] = ('TNotebook', 'TNotebook.Tab') elif name == 'Panedwindow': widget_d['layouts'] = ('TPanedwindow', 'Horizontal.Sash', 'Vertical.Sash') elif name == 'Treeview': - widget_d['layouts'] = ('Treeview', 'Item', 'Cell', 'Heading', 'Row') + widget_d['layouts'] = ('Treeview', 'Treeview.Item', + 'Treeview.Cell', 'Treeview.Heading', 'Treeview.Row') if name in sample: widget_d['factory'] = sample[name] @@ -408,7 +409,7 @@ opts = {} if self._is_layout(widget_name, sel): # not a widget, but a layout - self._update_layout_text(widget_name) + self._update_layout_text("Custom.%s" % widget_name) if 'Horizontal' in widget_name or 'Vertical' in widget_name: opts['orient'] = widget_name.split('.')[0].lower() widget_style = "Custom.%s" % widget_name @@ -417,7 +418,7 @@ self._empty_layout_text() widget = self._widget[widget_name] - widget_style = widget_style or "Custom.%s" % widget['class'] + widget_style = widget_style or widget['class'] curr_widget = self._current_widget if not invalid and curr_widget['layout'] == widget_style: @@ -507,15 +508,17 @@ layout = output.getvalue() output.close() self._empty_layout_text() + self.layouttext.layout = layout_name self.layouttext.insert('1.0', layout) # set new text def _empty_layout_text(self): """Clear current text in the layout text widget.""" self.layouttext.delete('1.0', 'end') + self.layouttext.layout = None def _apply_layout(self): """Apply the supposed new layout for the current selected widget.""" - layout = self._current_widget['layout'] + layout = self.layouttext.layout if not layout: # nothing to do return @@ -527,12 +530,12 @@ def _reset_layout(self): """Reset the layout for current selected widget.""" - widget = self._current_widget - if widget['widget'] is None: # nothing to reset + layout = self.layouttext.layout + if not layout: # nothing to reset return - orig_name = widget['layout'][widget['layout'].find('.', 1) + 1:] - self._update_layout_text(orig_name) + self._update_layout_text(layout[layout.find('.') + 1:]) + self.layouttext.layout = layout def _ask_new_frame_opt(self, frame, func): """Open a dialog asking for a new option to be added in the @@ -606,7 +609,8 @@ children = opts.pop('layouts') parent = treeview.insert('', 'end', text=name) - self._widget[name] = {'tv_item': parent, 'class': children[0]} + self._widget[name] = {'tv_item': parent, + 'class': "Custom.%s" % children[0]} self._widget[name].update(opts) for child in children: @@ -712,6 +716,7 @@ textframe = ttk.Frame(layoutframe) textframe.pack(side='left', fill='both', expand=True) self.layouttext = ScrolledText(textframe) + self.layouttext.layout = None self.layouttext.pack(expand=True, fill='both') btnsframe = ttk.Frame(layoutframe, padding=[6, 0, 0, 0]) btnsframe.pack(side='right', anchor='n', fill='x') From ncoghlan at gmail.com Sun Jun 29 06:43:41 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 29 Jun 2008 14:43:41 +1000 Subject: [Python-checkins] r64583 - python/trunk/Doc/reference/compound_stmts.rst In-Reply-To: <20080628230649.A32281E4007@bag.python.org> References: <20080628230649.A32281E4007@bag.python.org> Message-ID: <486712FD.1000107@gmail.com> benjamin.peterson wrote: > Author: benjamin.peterson > Date: Sun Jun 29 01:06:49 2008 > New Revision: 64583 > > Log: > rewrap > > Modified: > python/trunk/Doc/reference/compound_stmts.rst > > Modified: python/trunk/Doc/reference/compound_stmts.rst > ============================================================================== > --- python/trunk/Doc/reference/compound_stmts.rst (original) > +++ python/trunk/Doc/reference/compound_stmts.rst Sun Jun 29 01:06:49 2008 > @@ -46,7 +46,7 @@ > compound_stmt: `if_stmt` > : | `while_stmt` > : | `for_stmt` > - : | `try_stmt` > + : | `try_stmt You lost a trailing backtick there. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From buildbot at python.org Sun Jun 29 14:02:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 12:02:51 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2 trunk Message-ID: <20080629120251.58ED61E4005@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD 2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%202%20trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: werven-freebsd Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,andrew.kuchling,barry.warsaw,benjamin.peterson,bill.janssen,brett.cannon,eric.smith,facundo.batista,georg.brandl,hyeshik.chang,mark.dickinson,raymond.hettinger,robert.schuppenies,thomas.heller,trent.nelson,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/trunk.werven-freebsd/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/trunk.werven-freebsd/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/usr/home/buildbot/buildarea/trunk.werven-freebsd/build/Lib/bsddb/test/test_thread.py", line 289, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/usr/home/buildbot/buildarea/trunk.werven-freebsd/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 14:32:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 12:32:51 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2 2.5 Message-ID: <20080629123251.5DC821E4005@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD 2 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%202%202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: werven-freebsd Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 14:33:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 12:33:51 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20080629123351.85CEF1E4005@bag.python.org> The Buildbot has detected a new failure of sparc Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%20trunk/builds/496 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: The web-page 'force build' button was pressed by 'MatthiasKlose': build using db4.7 Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Bus error sincerely, -The Buildbot From buildbot at python.org Sun Jun 29 15:02:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 13:02:51 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2 3.0 Message-ID: <20080629130251.EFAF81E4005@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD 2 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%202%203.0/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: werven-freebsd Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,barry.warsaw,benjamin.peterson,bill.janssen,brett.cannon,eric.smith,facundo.batista,georg.brandl,guido.van.rossum,jeremy.hylton,mark.dickinson,matthias.klose,raymond.hettinger,robert.schuppenies,senthil.kumaran,trent.nelson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/multiprocessing/process.py", line 232, in _bootstrap Process Process-3: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): Exception in thread Thread-14: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): Exception in thread Thread-15: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): Exception in thread Thread-16: Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument Traceback (most recent call last): File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 492, in _bootstrap_inner self.run() File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/threading.py", line 447, in run self._target(*self._args, **self._kwargs) File "/usr/home/buildbot/buildarea/3.0.werven-freebsd/build/Lib/test/test_multiprocessing.py", line 609, in f cond.acquire() OSError: [Errno 22] Invalid argument sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 15:43:07 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jun 2008 15:43:07 +0200 (CEST) Subject: [Python-checkins] r64590 - python/trunk/Doc/reference/compound_stmts.rst Message-ID: <20080629134307.E4AEB1E400D@bag.python.org> Author: benjamin.peterson Date: Sun Jun 29 15:43:07 2008 New Revision: 64590 Log: reinstate the ending backtick. thanks Nick :) Modified: python/trunk/Doc/reference/compound_stmts.rst Modified: python/trunk/Doc/reference/compound_stmts.rst ============================================================================== --- python/trunk/Doc/reference/compound_stmts.rst (original) +++ python/trunk/Doc/reference/compound_stmts.rst Sun Jun 29 15:43:07 2008 @@ -46,7 +46,7 @@ compound_stmt: `if_stmt` : | `while_stmt` : | `for_stmt` - : | `try_stmt + : | `try_stmt` : | `with_stmt` : | `funcdef` : | `classdef` From python-checkins at python.org Sun Jun 29 16:36:36 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 29 Jun 2008 16:36:36 +0200 (CEST) Subject: [Python-checkins] r64591 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080629143636.833481E4005@bag.python.org> Author: guilherme.polo Date: Sun Jun 29 16:36:36 2008 New Revision: 64591 Log: Added support for element options; Labels on NewElement Dialog are right-aligned now. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Sun Jun 29 16:36:36 2008 @@ -5,8 +5,7 @@ -- Guilherme Polo, 2008. """ -# ToDO: Support element options. -# Add a way to remove options. +# ToDO: Add a way to remove options. # Add a way to edit images/elements. # Add pre-defined elements for the current theme. # ... @@ -343,15 +342,15 @@ self.sspec = ttk.Entry(master) # place the widgets - name.grid(row=0, column=0, sticky='w', padx=6, pady=3) + name.grid(row=0, column=0, sticky='e', padx=6, pady=3) self.name.grid(row=0, column=1, pady=3, sticky='ew') - etype.grid(row=0, column=2, sticky='w', padx=6, pady=3) + etype.grid(row=0, column=2, sticky='e', padx=6, pady=3) self.etype.grid(row=0, column=3, pady=3) - defimg.grid(row=1, column=0, sticky='w', padx=6, pady=3) + defimg.grid(row=1, column=0, sticky='e', padx=6, pady=3) self.defimg.grid(row=1, column=1, pady=3, sticky='ew') - opts.grid(row=1, column=2, sticky='w', padx=6, pady=3) + opts.grid(row=1, column=2, sticky='e', padx=6, pady=3) self.opts.grid(row=1, column=3, pady=3) - sspec.grid(row=2, column=0, sticky='w', padx=6, pady=3) + sspec.grid(row=2, column=0, sticky='e', padx=6, pady=3) self.sspec.grid(row=2, column=1, columnspan=3, sticky='ew', pady=3) self.resizable(False, False) @@ -371,6 +370,26 @@ "at least.", parent=self) return False + if values['opts']: + try: + # XXX Warning: eval usage! + values['opts'] = eval(values['opts']) + if not isinstance(values['opts'], dict): + raise ValueError + except (NameError, SyntaxError), err: + showwarning("Invalid options specification", + "Options should be formatted according to a dict.\n\n" + "Error: %s" % err, + parent=self) + return False + except ValueError: + showwarning("Invalid options specification", + "Options should be formatted according to a dict.", + parent=self) + return False + else: + values['opts'] = {} + self.result = values return True @@ -569,13 +588,10 @@ sspec = () args = (dlg.result['def'], ) + sspec - # format opts (XXX Not done) - #if dlg.result['opts']: - # print dlg.result['opts'] - # create element try: - self._style.element_create(name, dlg.result['etype'], *args) + self._style.element_create(name, dlg.result['etype'], *args, + **dlg.result['opts']) except Tkinter.TclError, err: showwarning("Element couldn't be created", "The specified element couldn'be created, reason: " From buildbot at python.org Sun Jun 29 20:07:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 18:07:25 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080629180725.866411E401D@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/1275 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: The web-page 'rebuild' button was pressed by 'David Bolen': Test svn error Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 29 23:25:30 2008 From: python-checkins at python.org (vinay.sajip) Date: Sun, 29 Jun 2008 23:25:30 +0200 (CEST) Subject: [Python-checkins] r64592 - python/trunk/Lib/logging/config.py Message-ID: <20080629212530.0ECF51E4006@bag.python.org> Author: vinay.sajip Date: Sun Jun 29 23:25:28 2008 New Revision: 64592 Log: Removed out-of-date comment in _install_handlers and used issubclass in place of equality comparison of classes. Modified: python/trunk/Lib/logging/config.py Modified: python/trunk/Lib/logging/config.py ============================================================================== --- python/trunk/Lib/logging/config.py (original) +++ python/trunk/Lib/logging/config.py Sun Jun 29 23:25:28 2008 @@ -155,8 +155,7 @@ h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) - #temporary hack for FileHandler and MemoryHandler. - if klass == logging.handlers.MemoryHandler: + if issubclass(klass, logging.handlers.MemoryHandler): if "target" in opts: target = cp.get(sectname,"target") else: From python-checkins at python.org Sun Jun 29 23:27:16 2008 From: python-checkins at python.org (vinay.sajip) Date: Sun, 29 Jun 2008 23:27:16 +0200 (CEST) Subject: [Python-checkins] r64593 - python/trunk/Misc/NEWS Message-ID: <20080629212716.0C2E21E4006@bag.python.org> Author: vinay.sajip Date: Sun Jun 29 23:27:15 2008 New Revision: 64593 Log: Updated to reflect change in logging.config to remove out-of-date comment in _install_handlers and the use of issubclass in place of equality comparison of classes. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 29 23:27:15 2008 @@ -107,6 +107,9 @@ Library ------- +- logging.config: Removed out-of-date comment in _install_handlers and + used issubclass in place of equality comparison of classes. + - Issue #2722: Now the os.getcwd() supports very long path names. - Issue #2888: Fixed the behaviour of pprint when working with nested From buildbot at python.org Mon Jun 30 00:27:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 29 Jun 2008 22:27:23 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080629222723.D72501E4006@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3636 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_smtplib.py", line 108, in debugging_server poll_fun(0.01, asyncore.socket_map) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 103, in readwrite obj.handle_expt_event() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 448, in handle_expt_event raise socket.error(err, msg) error: [Errno 54] Connection reset by peer 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 30 01:07:59 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 30 Jun 2008 01:07:59 +0200 (CEST) Subject: [Python-checkins] r64594 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080629230759.B16E41E4006@bag.python.org> Author: guilherme.polo Date: Mon Jun 30 01:07:59 2008 New Revision: 64594 Log: Updated ToDo list; Fixed misleading name/docstring for the function available_widgets. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Mon Jun 30 01:07:59 2008 @@ -1,14 +1,16 @@ """ Sample application for playing with Ttk theming. -* A lot of features are missing for now. -- Guilherme Polo, 2008. """ -# ToDO: Add a way to remove options. -# Add a way to edit images/elements. -# Add pre-defined elements for the current theme. -# ... +# XXX ToDo List: +# * Save/Load style changes, maybe. +# * Add a way to remove options (only custom options): +# - Not possible in tk, but could recreate the widget and not set it. +# * Add a way to edit images/elements. +# * Add pre-defined elements for the current theme: +# - Just after editing elements feature is added. import sys import ttk @@ -19,8 +21,9 @@ from tkMessageBox import showwarning from tkFileDialog import askopenfilename -def available_widgets(): # XXX misleading function name - """Returns a list of Ttk widgets.""" # XXX misleading docstring +def map_widgets(): + """Maps Ttk widgets to their respective layout(s), factory and + possibly others.""" widgets = {} # will discard Style and extension classes unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') @@ -641,8 +644,6 @@ file_menu.add_command(label="Exit", underline=1, accelerator="Ctrl-X", command=self.master.destroy) - layout_menu = Tkinter.Menu(menu, tearoff=False) - menu.add('cascade', menu=file_menu, label="File", underline=0) self.master.bind('', 'exit') @@ -726,7 +727,7 @@ # bottom frame (layout) bottom = ttk.Frame(paned, padding=[0, 0, 6]) - bottom.pack(side='bottom')#, fill='both', expand=False) + bottom.pack(side='bottom') layoutframe = ttk.Labelframe(bottom, text="Layout", padding=6) layoutframe.pack(fill='both', expand=True) textframe = ttk.Frame(layoutframe) @@ -757,7 +758,7 @@ def __fill_treeview(self): """Insert available widgets in the treeview.""" self._widget = {} - widgets = available_widgets() + widgets = map_widgets() for name, opts in sorted(widgets.items()): self._add_widget(name, opts) From python-checkins at python.org Mon Jun 30 03:10:56 2008 From: python-checkins at python.org (facundo.batista) Date: Mon, 30 Jun 2008 03:10:56 +0200 (CEST) Subject: [Python-checkins] r64595 - in python/trunk: Lib/test/test_cpickle.py Modules/cPickle.c Message-ID: <20080630011056.7CDE91E4006@bag.python.org> Author: facundo.batista Date: Mon Jun 30 03:10:55 2008 New Revision: 64595 Log: Fix #2702, with a correct accounting of recursion. Modified: python/trunk/Lib/test/test_cpickle.py python/trunk/Modules/cPickle.c Modified: python/trunk/Lib/test/test_cpickle.py ============================================================================== --- python/trunk/Lib/test/test_cpickle.py (original) +++ python/trunk/Lib/test/test_cpickle.py Mon Jun 30 03:10:55 2008 @@ -94,23 +94,19 @@ pass class cPickleDeepRecursive(unittest.TestCase): -# I commented out, because the patch that fixes this was reverted, as -# it broke the next test case. Check the issues for full history. -# def test_issue2702(self): -# '''This should raise a RecursionLimit but in some -# platforms (FreeBSD, win32) sometimes raises KeyError instead, -# or just silently terminates the interpreter (=crashes). -# ''' -# nodes = [Node() for i in range(500)] -# for n in nodes: -# n.connections = list(nodes) -# n.connections.remove(n) -# self.assertRaises(RuntimeError, cPickle.dumps, n) + def test_issue2702(self): + # This should raise a RecursionLimit but in some + # platforms (FreeBSD, win32) sometimes raises KeyError instead, + # or just silently terminates the interpreter (=crashes). + nodes = [Node() for i in range(500)] + for n in nodes: + n.connections = list(nodes) + n.connections.remove(n) + self.assertRaises(RuntimeError, cPickle.dumps, n) def test_issue3179(self): - '''Safe test, because of I broken this case when fixing the - behaviour for the previous test. - ''' + # Safe test, because I broke this case when fixing the + # behaviour for the previous test. res=[] for x in range(1,2000): res.append(dict(doc=x, similar=[])) Modified: python/trunk/Modules/cPickle.c ============================================================================== --- python/trunk/Modules/cPickle.c (original) +++ python/trunk/Modules/cPickle.c Mon Jun 30 03:10:55 2008 @@ -339,7 +339,6 @@ int bin; int fast; /* Fast mode doesn't save in memo, don't use if circ ref */ - int nesting; int (*write_func)(struct Picklerobject *, const char *, Py_ssize_t); char *write_buf; int buf_size; @@ -1630,7 +1629,12 @@ iter = PyObject_GetIter(args); if (iter == NULL) goto finally; - res = batch_list(self, iter); + + if (Py_EnterRecursiveCall(" while pickling an object") == 0) + { + res = batch_list(self, iter); + Py_LeaveRecursiveCall(); + } Py_DECREF(iter); finally: @@ -1786,7 +1790,11 @@ iter = PyObject_CallMethod(args, "iteritems", "()"); if (iter == NULL) goto finally; - res = batch_dict(self, iter); + if (Py_EnterRecursiveCall(" while pickling an object") == 0) + { + res = batch_dict(self, iter); + Py_LeaveRecursiveCall(); + } Py_DECREF(iter); finally: @@ -2306,11 +2314,8 @@ int res = -1; int tmp, size; - if (self->nesting++ > Py_GetRecursionLimit()){ - PyErr_SetString(PyExc_RuntimeError, - "maximum recursion depth exceeded"); - goto finally; - } + if (Py_EnterRecursiveCall(" while pickling an object")) + return -1; if (!pers_save && self->pers_func) { if ((tmp = save_pers(self, args, self->pers_func)) != 0) { @@ -2559,7 +2564,7 @@ res = save_reduce(self, t, args); finally: - self->nesting--; + Py_LeaveRecursiveCall(); Py_XDECREF(py_ob_id); Py_XDECREF(__reduce__); Py_XDECREF(t); @@ -2801,7 +2806,6 @@ self->inst_pers_func = NULL; self->write_buf = NULL; self->fast = 0; - self->nesting = 0; self->fast_container = 0; self->fast_memo = NULL; self->buf_size = 0; From buildbot at python.org Mon Jun 30 03:41:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 01:41:41 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080630014141.DBB8D1E4012@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/137 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllibnet make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 04:08:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 02:08:56 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080630020856.415991E4006@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/263 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllibnet make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 04:10:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 02:10:44 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080630021045.0EFE11E4006@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/1682 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: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 06:22:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 04:22:44 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080630042244.F374B1E4007@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/110 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 06:37:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 04:37:35 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080630043735.79EA61E4007@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1164 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 07:48:55 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 05:48:55 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080630054855.62A591E4007@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/319 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 30 08:57:39 2008 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 30 Jun 2008 08:57:39 +0200 (CEST) Subject: [Python-checkins] r64597 - in python/trunk: Misc/NEWS PCbuild/sqlite3.vcproj Message-ID: <20080630065739.E423C1E4007@bag.python.org> Author: martin.v.loewis Date: Mon Jun 30 08:57:39 2008 New Revision: 64597 Log: Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd Modified: python/trunk/Misc/NEWS python/trunk/PCbuild/sqlite3.vcproj Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 30 08:57:39 2008 @@ -17,6 +17,11 @@ slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, 10, -1). +Build +----- + +- Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. + What's New in Python 2.6 beta 1? ================================ Modified: python/trunk/PCbuild/sqlite3.vcproj ============================================================================== --- python/trunk/PCbuild/sqlite3.vcproj (original) +++ python/trunk/PCbuild/sqlite3.vcproj Mon Jun 30 08:57:39 2008 @@ -305,6 +305,7 @@ /> Author: martin.v.loewis Date: Mon Jun 30 09:01:09 2008 New Revision: 64598 Log: Add _multiprocessing module. Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Mon Jun 30 09:01:09 2008 @@ -92,7 +92,8 @@ '_ctypes.pyd', '_ctypes_test.pyd', '_sqlite3.pyd', - '_hashlib.pyd' + '_hashlib.pyd', + '_multiprocessing.pyd' ] # Well-known component UUIDs From buildbot at python.org Mon Jun 30 10:02:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 08:02:06 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080630080206.9BAE01E4007@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3638 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_smtplib.py", line 108, in debugging_server poll_fun(0.01, asyncore.socket_map) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 103, in readwrite obj.handle_expt_event() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 448, in handle_expt_event raise socket.error(err, msg) error: [Errno 54] Connection reset by peer 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 30 17:39:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 15:39:09 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080630153909.562991E4008@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/216 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_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot